The collectibles are not supported on Optimism and Arbitrum #18507 (#18562)

* add chain id to the request

* add tests

* fix lint issues

* remove OPENSEA_API_KEY

* move subscription to a helper method for chain-ids
This commit is contained in:
mmilad75 2024-01-24 19:17:08 +03:30 committed by GitHub
parent d20f10cf8b
commit ed7463132a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 27 additions and 2 deletions

View File

@ -2,9 +2,9 @@
(:require [camel-snake-kebab.core :as csk]
[camel-snake-kebab.extras :as cske]
[clojure.string :as string]
[re-frame.core :as rf]
[taoensso.timbre :as log]
[utils.ethereum.chain :as chain]
[utils.re-frame :as rf]
[utils.transforms :as types]))
(def collectible-data-types
@ -66,8 +66,9 @@
data-type (collectible-data-types :header)
fetch-criteria {:fetch-type (fetch-type :fetch-if-not-cached)
:max-cache-age-seconds max-cache-age-seconds}
chain-ids (chain/chain-ids db)
request-params [request-id
[(chain/chain-id db)]
chain-ids
(keys (get-in db [:wallet :accounts]))
collectibles-filter
start-at-index

View File

@ -12,14 +12,17 @@
:short-name "eth"
:network-name :ethereum
:related-chain-id 1
:chain-id 3
:layer 1}
{:test? true
:short-name "arb1"
:related-chain-id 42161
:chain-id 4
:layer 2}
{:test? true
:short-name "opt"
:related-chain-id 10
:chain-id 5
:layer 2}]
:prod [{:test? false
:short-name "eth"

View File

@ -84,3 +84,10 @@
(defn chain-id
[db]
(network->chain-id (get-current-network db)))
(defn chain-ids
[db]
(let [test-networks-enabled? (get-in db [:profile/profile :test-networks-enabled?])
networks (get-in db [:wallet :networks])
env-networks (get networks (if test-networks-enabled? :test :prod))]
(map :chain-id env-networks)))

View File

@ -3,7 +3,21 @@
[cljs.test :refer-macros [deftest is]]
[utils.ethereum.chain :as chain]))
(defn chain-ids-db
[test-networks-enabled?]
{:profile/profile {:test-networks-enabled? test-networks-enabled?}
:wallet {:networks {:test [{:chain-id 3}
{:chain-id 4}
{:chain-id 5}]
:prod [{:chain-id 1}
{:chain-id 42161}
{:chain-id 10}]}}})
(deftest chain-id->chain-keyword
(is (= (chain/chain-id->chain-keyword 1) :mainnet))
(is (= (chain/chain-id->chain-keyword 5) :goerli))
(is (= (chain/chain-id->chain-keyword 5777) :custom)))
(deftest chain-ids
(is (= (chain/chain-ids (chain-ids-db false)) [1 42161 10]))
(is (= (chain/chain-ids (chain-ids-db true)) [3 4 5])))