@dynamic-labs/wagmi-connector 0.17.0-RC.2 → 0.17.0-RC.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +235 -0
- package/package.json +7 -6
- package/src/lib/Connector.js +2 -2
- package/src/lib/DynamicWagmiConnector.d.ts +3 -3
- package/src/lib/DynamicWagmiConnector.js +5 -2
- package/src/lib/SyncDynamicWagmi.js +9 -9
- package/src/lib/getWagmiChainsFromDynamicChains.d.ts +2 -2
- package/src/lib/getWagmiProvidersFromDynamicChains.d.ts +2 -2
- package/src/lib/getWagmiProvidersFromDynamicChains.js +35 -14
- package/src/lib/hooks/index.d.ts +2 -0
- package/src/lib/hooks/useSyncConnectState/index.d.ts +1 -0
- package/src/lib/hooks/useSyncConnectState/useSyncConnectState.d.ts +11 -0
- package/src/lib/hooks/useSyncConnectState/useSyncConnectState.js +25 -0
- package/src/lib/hooks/useWalletConnectorEverPresent/index.d.ts +1 -0
- package/src/lib/hooks/useWalletConnectorEverPresent/useWalletConnectorEverPresent.d.ts +2 -0
- package/src/lib/hooks/useWalletConnectorEverPresent/useWalletConnectorEverPresent.js +13 -0
- package/src/lib/mappers/chain.d.ts +2 -2
- package/src/lib/mappers/chain.js +29 -34
- package/src/lib/types.d.ts +25 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,239 @@
|
|
|
1
1
|
|
|
2
|
+
## [0.17.0-RC.20](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.19...v0.17.0-RC.20) (2023-06-01)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add AccessDeniedContext to lift denied wallet state up ([#2180](https://github.com/dynamic-labs/DynamicAuth/issues/2180)) ([509519d](https://github.com/dynamic-labs/DynamicAuth/commit/509519d08496248545f1548f676b13e140473e41))
|
|
8
|
+
* **DYN-2338:** update magic icons to social icons ([#2176](https://github.com/dynamic-labs/DynamicAuth/issues/2176)) ([42a4f63](https://github.com/dynamic-labs/DynamicAuth/commit/42a4f6367e6fa4ad8736f9ac42f535c8a9c1d377))
|
|
9
|
+
* **DynamicWidget:** add send balance button ([#2183](https://github.com/dynamic-labs/DynamicAuth/issues/2183)) ([d76355e](https://github.com/dynamic-labs/DynamicAuth/commit/d76355e1f9c3a7b05cbb5b7b3144dad379586689))
|
|
10
|
+
* handle magic redirect error ([#2203](https://github.com/dynamic-labs/DynamicAuth/issues/2203)) ([9a088c6](https://github.com/dynamic-labs/DynamicAuth/commit/9a088c6aad2eb2c1045f544a784083d2732df440))
|
|
11
|
+
* **SendBalanceModal:** adds openSendBalanceModal in dynamic context ([#2159](https://github.com/dynamic-labs/DynamicAuth/issues/2159)) ([f89b21b](https://github.com/dynamic-labs/DynamicAuth/commit/f89b21bfcd65bb61ef33b17b460140404574b235))
|
|
12
|
+
* social error handling improvements ([#2146](https://github.com/dynamic-labs/DynamicAuth/issues/2146)) ([a64a26a](https://github.com/dynamic-labs/DynamicAuth/commit/a64a26aa42c228654cb135cd6c4778e8bd2bd0e6))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* amendments to user profile ([#2201](https://github.com/dynamic-labs/DynamicAuth/issues/2201)) ([5d12c17](https://github.com/dynamic-labs/DynamicAuth/commit/5d12c1716cdcd8d843ef3ff941e163bad28573b1))
|
|
18
|
+
* **formatBigNumber:** display the ceil value when value is too low ([#2165](https://github.com/dynamic-labs/DynamicAuth/issues/2165)) ([ad56fe1](https://github.com/dynamic-labs/DynamicAuth/commit/ad56fe11d55ee038e08ef77dfa2bd6155fee7fe3))
|
|
19
|
+
* use wcv2 only if wallet supports it ([#2198](https://github.com/dynamic-labs/DynamicAuth/issues/2198)) ([3d5fea7](https://github.com/dynamic-labs/DynamicAuth/commit/3d5fea7743a18b47f33ef371ecc2652003accb4d))
|
|
20
|
+
|
|
21
|
+
## [0.17.0-RC.19](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.18...v0.17.0-RC.19) (2023-05-30)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* add SocialWrongAccountView ([#2153](https://github.com/dynamic-labs/DynamicAuth/issues/2153)) ([531a29d](https://github.com/dynamic-labs/DynamicAuth/commit/531a29d7d87739d974ecc35c57ef0d333a5e7451))
|
|
27
|
+
* do not show unlink button for embedded wallets ([#2169](https://github.com/dynamic-labs/DynamicAuth/issues/2169)) ([f813058](https://github.com/dynamic-labs/DynamicAuth/commit/f8130585c82c7ae73d1e32e107f67ec86b4edb89))
|
|
28
|
+
* **DYN-2402:** coinbase issues after disconnecting ([#2149](https://github.com/dynamic-labs/DynamicAuth/issues/2149)) ([91d49fb](https://github.com/dynamic-labs/DynamicAuth/commit/91d49fb7f8c6fca3ab03098f3fba53d277c836ad))
|
|
29
|
+
* handle user reconnecting with wrong social account ([#2157](https://github.com/dynamic-labs/DynamicAuth/issues/2157)) ([4f7c6df](https://github.com/dynamic-labs/DynamicAuth/commit/4f7c6dff7df9a7966a644bf2510cb3825b2c6408))
|
|
30
|
+
* **social:** handle reconnect ([#2131](https://github.com/dynamic-labs/DynamicAuth/issues/2131)) ([2b3e5fb](https://github.com/dynamic-labs/DynamicAuth/commit/2b3e5fbb72bb7dafee3bd0bbfa73fae444055410))
|
|
31
|
+
|
|
32
|
+
## [0.17.0-RC.18](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.17...v0.17.0-RC.18) (2023-05-19)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
* add getReferencedAccount ([#2141](https://github.com/dynamic-labs/DynamicAuth/issues/2141)) ([ac170a6](https://github.com/dynamic-labs/DynamicAuth/commit/ac170a6dfac25ff9911feb390495974aa5dbede6))
|
|
38
|
+
* add reconnectSocialWallet ([#2142](https://github.com/dynamic-labs/DynamicAuth/issues/2142)) ([fefd759](https://github.com/dynamic-labs/DynamicAuth/commit/fefd759b816b286dd8a7673cf6c839fee59768ac))
|
|
39
|
+
* **DYN-2220:** add Transaction Successfully Sent view ([#2134](https://github.com/dynamic-labs/DynamicAuth/issues/2134)) ([7db96ad](https://github.com/dynamic-labs/DynamicAuth/commit/7db96adcd3b84aef29fbabe40a1e048ea629d2bb))
|
|
40
|
+
* **MagicSocialWalletConnector:** store public address from redirect result in local storage ([#2139](https://github.com/dynamic-labs/DynamicAuth/issues/2139)) ([90b60e4](https://github.com/dynamic-labs/DynamicAuth/commit/90b60e485a53ff29a0e52ef27a58383771490974))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Bug Fixes
|
|
44
|
+
|
|
45
|
+
* issue when linking from detect_new_wallet ([#2148](https://github.com/dynamic-labs/DynamicAuth/issues/2148)) ([98feb7b](https://github.com/dynamic-labs/DynamicAuth/commit/98feb7bde081a8107577ac7ec70d0f9c4b611a2b))
|
|
46
|
+
* multi-wallet flows ([#2150](https://github.com/dynamic-labs/DynamicAuth/issues/2150)) ([c82ef4a](https://github.com/dynamic-labs/DynamicAuth/commit/c82ef4a5cc75c9f8edb30620e32dd64bbdb0eb7f))
|
|
47
|
+
* starknet getConnectedAccounts should return an empty array if there's no address to return ([#2140](https://github.com/dynamic-labs/DynamicAuth/issues/2140)) ([ce39641](https://github.com/dynamic-labs/DynamicAuth/commit/ce39641a6dbec1d05d8d5cc611a02de8bd756351))
|
|
48
|
+
|
|
49
|
+
## [0.17.0-RC.17](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.16...v0.17.0-RC.17) (2023-05-17)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Features
|
|
53
|
+
|
|
54
|
+
* distinguish walletconnect deeplink types ([#2093](https://github.com/dynamic-labs/DynamicAuth/issues/2093)) ([dcd29f7](https://github.com/dynamic-labs/DynamicAuth/commit/dcd29f7cfc5e6481aaaae502b3fc4e4d225f1fc1))
|
|
55
|
+
* **social:** pass did token to verify request ([#2124](https://github.com/dynamic-labs/DynamicAuth/issues/2124)) ([60d73a5](https://github.com/dynamic-labs/DynamicAuth/commit/60d73a5f432d488979f33fe29666d1afa8fc0e8e))
|
|
56
|
+
* support optional priority and stalltimeout for customer provided rpc urls ([#2091](https://github.com/dynamic-labs/DynamicAuth/issues/2091)) ([eebacda](https://github.com/dynamic-labs/DynamicAuth/commit/eebacda6a9d6ba583eff4e4e5a38eb9945c4825e))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Bug Fixes
|
|
60
|
+
|
|
61
|
+
* add and remove event listeners for Solflare ([#2127](https://github.com/dynamic-labs/DynamicAuth/issues/2127)) ([978c7ba](https://github.com/dynamic-labs/DynamicAuth/commit/978c7ba0e3745e26d9dfc9b7c46a24adc913f02f))
|
|
62
|
+
* get publicKey from provider if no address and publicKey are returned on connect ([#2126](https://github.com/dynamic-labs/DynamicAuth/issues/2126)) ([c9c9b2a](https://github.com/dynamic-labs/DynamicAuth/commit/c9c9b2af81f660aa651fc4b0e01cd3c823bb0229))
|
|
63
|
+
* remove detect known secondary wallet modal ([#2117](https://github.com/dynamic-labs/DynamicAuth/issues/2117)) ([0e8bbd8](https://github.com/dynamic-labs/DynamicAuth/commit/0e8bbd8c385fe528a7af3ccc037812df9d6e0c84))
|
|
64
|
+
* revert changes for select wallet to work with solflare ([#2120](https://github.com/dynamic-labs/DynamicAuth/issues/2120)) ([76cf228](https://github.com/dynamic-labs/DynamicAuth/commit/76cf228c495d6592da4c88b8a0d5a5fc480861ae))
|
|
65
|
+
* setIsVerifying to false when selecting a connector ([#2133](https://github.com/dynamic-labs/DynamicAuth/issues/2133)) ([8ddeba3](https://github.com/dynamic-labs/DynamicAuth/commit/8ddeba377f35dfb4a104cd6bd7ee6315d574710f))
|
|
66
|
+
* setPrimaryWallet and useSyncPrimaryWallet updates ([#2128](https://github.com/dynamic-labs/DynamicAuth/issues/2128)) ([fb47b17](https://github.com/dynamic-labs/DynamicAuth/commit/fb47b17ddc7f41c29f140a1a85a1e47dbf017fff))
|
|
67
|
+
* update text color and add close button on extension not installed prompt ([#2122](https://github.com/dynamic-labs/DynamicAuth/issues/2122)) ([b4848a0](https://github.com/dynamic-labs/DynamicAuth/commit/b4848a0a8094b4ceac67e2667d277a9aa5e2e137))
|
|
68
|
+
|
|
69
|
+
## [0.17.0-RC.16](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.15...v0.17.0-RC.16) (2023-05-15)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
### Features
|
|
73
|
+
|
|
74
|
+
* add social oauth result to verify request ([#2081](https://github.com/dynamic-labs/DynamicAuth/issues/2081)) ([4da650a](https://github.com/dynamic-labs/DynamicAuth/commit/4da650affe9c96e0ab9e446f58c91b9b13db3651))
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### Bug Fixes
|
|
78
|
+
|
|
79
|
+
* **DYN-2327:** user profile is not loaded properly on the first load ([#2113](https://github.com/dynamic-labs/DynamicAuth/issues/2113)) ([c05834e](https://github.com/dynamic-labs/DynamicAuth/commit/c05834ed89ecc12d586baa97bcaf2bd3c1919f59))
|
|
80
|
+
|
|
81
|
+
## [0.17.0-RC.15](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.14...v0.17.0-RC.15) (2023-05-15)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
### Bug Fixes
|
|
85
|
+
|
|
86
|
+
* pass network to link request ([#2114](https://github.com/dynamic-labs/DynamicAuth/issues/2114)) ([0f7d20d](https://github.com/dynamic-labs/DynamicAuth/commit/0f7d20d948b737b98d4a8db8aaa7648033e25922))
|
|
87
|
+
|
|
88
|
+
## [0.17.0-RC.14](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.13...v0.17.0-RC.14) (2023-05-12)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### Features
|
|
92
|
+
|
|
93
|
+
* add local flowNetwork prop to toggle between mainnet and testnet ([#2094](https://github.com/dynamic-labs/DynamicAuth/issues/2094)) ([43c3f20](https://github.com/dynamic-labs/DynamicAuth/commit/43c3f20abf2d6c83e88e48f885749b978cec078a))
|
|
94
|
+
* deprecate multiWallet sdk setting and fetch it from projectSettings ([#2079](https://github.com/dynamic-labs/DynamicAuth/issues/2079)) ([8b7f11d](https://github.com/dynamic-labs/DynamicAuth/commit/8b7f11d9eb71a17056be05cc8006d15dc149e3ff))
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### Bug Fixes
|
|
98
|
+
|
|
99
|
+
* **balance:** correctly compare AVAX address when fetching balance ([#2064](https://github.com/dynamic-labs/DynamicAuth/issues/2064)) ([c5942d1](https://github.com/dynamic-labs/DynamicAuth/commit/c5942d112804f3a935bca396221fb33a3c7cc42a))
|
|
100
|
+
* **DYN-2231:** restore User Profile display when social is the only enabled flag in information capture ([#2070](https://github.com/dynamic-labs/DynamicAuth/issues/2070)) ([6790bc7](https://github.com/dynamic-labs/DynamicAuth/commit/6790bc7e54afb1807be9996dc47129932441bbae))
|
|
101
|
+
|
|
102
|
+
## [0.17.0-RC.13](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.12...v0.17.0-RC.13) (2023-05-10)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
### Features
|
|
106
|
+
|
|
107
|
+
* discriminate magic connectors ([#2069](https://github.com/dynamic-labs/DynamicAuth/issues/2069)) ([e9f6fd1](https://github.com/dynamic-labs/DynamicAuth/commit/e9f6fd15082364612a86d6d2a091cb8bd4eccc1f))
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
### Bug Fixes
|
|
111
|
+
|
|
112
|
+
* add popper to fix dots menu positioning ([#2075](https://github.com/dynamic-labs/DynamicAuth/issues/2075)) ([fe945bd](https://github.com/dynamic-labs/DynamicAuth/commit/fe945bd3bcc5edeecfa0a2e7e53e30dc507c6118))
|
|
113
|
+
* polyfill process if not defined in global ([#2088](https://github.com/dynamic-labs/DynamicAuth/issues/2088)) ([a5d8194](https://github.com/dynamic-labs/DynamicAuth/commit/a5d81942440a6fe290c15b58b942012afe42aa00))
|
|
114
|
+
|
|
115
|
+
## [0.17.0-RC.12](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.11...v0.17.0-RC.12) (2023-05-09)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### Bug Fixes
|
|
119
|
+
|
|
120
|
+
* allow opening network picker when unsupported network and only one network enabled ([#2061](https://github.com/dynamic-labs/DynamicAuth/issues/2061)) ([486607f](https://github.com/dynamic-labs/DynamicAuth/commit/486607f8bb2666749ce39f18cf2368c86a78f74f))
|
|
121
|
+
* **DynamicWagmiConnector:** prevent disconnect when WC is not present ([#2063](https://github.com/dynamic-labs/DynamicAuth/issues/2063)) ([ef93623](https://github.com/dynamic-labs/DynamicAuth/commit/ef93623fb68b63a9e89a5958eb87bbddedd15fb6))
|
|
122
|
+
|
|
123
|
+
## [0.17.0-RC.11](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.10...v0.17.0-RC.11) (2023-05-08)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
### Features
|
|
127
|
+
|
|
128
|
+
* add walletConnectors setting for supplying array of wallet connectors ([#2059](https://github.com/dynamic-labs/DynamicAuth/issues/2059)) ([ae65218](https://github.com/dynamic-labs/DynamicAuth/commit/ae652180b17a870f7bbf5f99c876f386e0de1af5))
|
|
129
|
+
|
|
130
|
+
## [0.17.0-RC.10](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.9...v0.17.0-RC.10) (2023-05-05)
|
|
131
|
+
|
|
132
|
+
## [0.17.0-RC.9](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.8...v0.17.0-RC.9) (2023-05-05)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
### Features
|
|
136
|
+
|
|
137
|
+
* **DYN-2231:** show in the user profile all existing fields ([#1988](https://github.com/dynamic-labs/DynamicAuth/issues/1988)) ([1f8cee2](https://github.com/dynamic-labs/DynamicAuth/commit/1f8cee22cf8338bd518961288c570c40e807cd52))
|
|
138
|
+
* **TransactionModal:** add insufficient funds warning ([#2031](https://github.com/dynamic-labs/DynamicAuth/issues/2031)) ([bf868e2](https://github.com/dynamic-labs/DynamicAuth/commit/bf868e239e74f4cd0ceda5e09b7538d97d4e431d))
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
### Bug Fixes
|
|
142
|
+
|
|
143
|
+
* **DYN-1820:** use missing_from_list error code ([#2040](https://github.com/dynamic-labs/DynamicAuth/issues/2040)) ([92c7ad5](https://github.com/dynamic-labs/DynamicAuth/commit/92c7ad565376573d963c65fa821c97a2102ec8d7))
|
|
144
|
+
* **MagicClientNetworkHandler:** save last used network id ([#2045](https://github.com/dynamic-labs/DynamicAuth/issues/2045)) ([6e1c571](https://github.com/dynamic-labs/DynamicAuth/commit/6e1c57127a824cd02d4b785fb8a387e4f221f044))
|
|
145
|
+
* **TransactionModal:** ensure alchemy will not fail when estimating for gas ([#2034](https://github.com/dynamic-labs/DynamicAuth/issues/2034)) ([86c0d7c](https://github.com/dynamic-labs/DynamicAuth/commit/86c0d7cc7b20ff12bc9fc2e33961e177d9decf2a))
|
|
146
|
+
|
|
147
|
+
## [0.17.0-RC.8](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.7...v0.17.0-RC.8) (2023-05-03)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
### ⚠ BREAKING CHANGES
|
|
151
|
+
|
|
152
|
+
* Removes support for Fortmatic in favor of Magic
|
|
153
|
+
|
|
154
|
+
### Features
|
|
155
|
+
|
|
156
|
+
* add selected address to qr code modal ([#2017](https://github.com/dynamic-labs/DynamicAuth/issues/2017)) ([58a5d69](https://github.com/dynamic-labs/DynamicAuth/commit/58a5d691f8a4045d92be1a2bcaf6092f44b91b73))
|
|
157
|
+
* **DYN-2228:** show network picker only when more than 1 network ([#2007](https://github.com/dynamic-labs/DynamicAuth/issues/2007)) ([8329737](https://github.com/dynamic-labs/DynamicAuth/commit/83297378cc5ed019f3f8297b48c16f56d7cfe9a7))
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
### Bug Fixes
|
|
161
|
+
|
|
162
|
+
* disable kyc submit button when network is not supported ([#1952](https://github.com/dynamic-labs/DynamicAuth/issues/1952)) ([ec2f0eb](https://github.com/dynamic-labs/DynamicAuth/commit/ec2f0eb708ed2938dd68cbc7e8ee40f3bc856c2b))
|
|
163
|
+
* missing evm networks for connect-only ([#2006](https://github.com/dynamic-labs/DynamicAuth/issues/2006)) ([78561b3](https://github.com/dynamic-labs/DynamicAuth/commit/78561b3243ac38a348a383bb3c79ce58c8731538))
|
|
164
|
+
* wallet-connect menu on mobile ([#2025](https://github.com/dynamic-labs/DynamicAuth/issues/2025)) ([1f358a6](https://github.com/dynamic-labs/DynamicAuth/commit/1f358a66dda696e745db32f121fb4ef62379cb9a))
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
* remove Fortmatic ([#2010](https://github.com/dynamic-labs/DynamicAuth/issues/2010)) ([0ca95c1](https://github.com/dynamic-labs/DynamicAuth/commit/0ca95c175b5d8383433340832bd9ae7dab85f912))
|
|
168
|
+
|
|
169
|
+
## [0.17.0-RC.7](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.6...v0.17.0-RC.7) (2023-04-28)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
### ⚠ BREAKING CHANGES
|
|
173
|
+
|
|
174
|
+
* EvmNetwork has deprecated `chainName` and replaced it with `name` with the exact same value.
|
|
175
|
+
Additionally, calling `walletConnector.getNetwork()` or `walletConnector.switchNetwork()` are generic network types of `string | number`
|
|
176
|
+
|
|
177
|
+
If for example, you know you are working with an EVM network, you can type cast with `walletConnector.getNetwork<number>()` to work nicely in typescript.
|
|
178
|
+
|
|
179
|
+
* feat: add network config version to invalidate local storage cache if new version is available
|
|
180
|
+
|
|
181
|
+
### Features
|
|
182
|
+
|
|
183
|
+
* added onramp funding UI ([#1884](https://github.com/dynamic-labs/DynamicAuth/issues/1884)) ([d2d9895](https://github.com/dynamic-labs/DynamicAuth/commit/d2d98953b511ebe4aa62b6b5c9cd36c15e1fef97))
|
|
184
|
+
* create useNameService hook ([#1909](https://github.com/dynamic-labs/DynamicAuth/issues/1909)) ([78fd40a](https://github.com/dynamic-labs/DynamicAuth/commit/78fd40a7781fd907b6b807c544b5840fab30009a))
|
|
185
|
+
* **DYN-2235:** automatically move customer to the next step after updating their network ([#1999](https://github.com/dynamic-labs/DynamicAuth/issues/1999)) ([7721f51](https://github.com/dynamic-labs/DynamicAuth/commit/7721f51a92a899613c63a0bdc4d3504ab5d027b7))
|
|
186
|
+
* expose getNameService to useDynamicContext and add it to walletkitactions ([#1987](https://github.com/dynamic-labs/DynamicAuth/issues/1987)) ([48ac670](https://github.com/dynamic-labs/DynamicAuth/commit/48ac670bf086a67648c8853329a8069ba3905d36))
|
|
187
|
+
* **magic-link:** add default chain id to magic connector ([#1946](https://github.com/dynamic-labs/DynamicAuth/issues/1946)) ([8b64d96](https://github.com/dynamic-labs/DynamicAuth/commit/8b64d9680525e4882c390667f98d778ce887343e))
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
### Bug Fixes
|
|
191
|
+
|
|
192
|
+
* call authSucces in missing places ([#1961](https://github.com/dynamic-labs/DynamicAuth/issues/1961)) ([c61ee5b](https://github.com/dynamic-labs/DynamicAuth/commit/c61ee5bac965a0b7c8f62ee8a5aa0167b1aa190b)), closes [#1963](https://github.com/dynamic-labs/DynamicAuth/issues/1963)
|
|
193
|
+
* display ens info when there's any ([#1973](https://github.com/dynamic-labs/DynamicAuth/issues/1973)) ([9b14dbe](https://github.com/dynamic-labs/DynamicAuth/commit/9b14dbe69043933edce7f0cecc0406f6d7c7a45d))
|
|
194
|
+
* revert trigger onAuthSuccess on additional flows ([#1953](https://github.com/dynamic-labs/DynamicAuth/issues/1953)) ([#1960](https://github.com/dynamic-labs/DynamicAuth/issues/1960)) ([fb10791](https://github.com/dynamic-labs/DynamicAuth/commit/fb107914eb799692e25d4fa63229ad66967bd3aa))
|
|
195
|
+
* show 'install extension' prompt when selecting a secondary wallet that cannot be detected ([#1948](https://github.com/dynamic-labs/DynamicAuth/issues/1948)) ([b6593c1](https://github.com/dynamic-labs/DynamicAuth/commit/b6593c19fe8edaefeca3fa9b8b1d5c64f7c3b9f9))
|
|
196
|
+
* support both number and string types for chainId regardless of chain ([#1978](https://github.com/dynamic-labs/DynamicAuth/issues/1978)) ([25fcc96](https://github.com/dynamic-labs/DynamicAuth/commit/25fcc969129be832cc0e9c68edc04773944dacae))
|
|
197
|
+
* update setPrimaryWallet return type ([#1983](https://github.com/dynamic-labs/DynamicAuth/issues/1983)) ([0724a4b](https://github.com/dynamic-labs/DynamicAuth/commit/0724a4bcaee25639b29335a91824dcaedb7b0330))
|
|
198
|
+
* update walletconnect disconned callback to reject instead of throwing an error ([#1992](https://github.com/dynamic-labs/DynamicAuth/issues/1992)) ([da726cf](https://github.com/dynamic-labs/DynamicAuth/commit/da726cfca67c945026bd29c6db7f8c6fef910b4d))
|
|
199
|
+
|
|
200
|
+
## [0.17.0-RC.6](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.5...v0.17.0-RC.6) (2023-04-25)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
### Bug Fixes
|
|
204
|
+
|
|
205
|
+
* pass autoConnect to true on wagmi client ([#1957](https://github.com/dynamic-labs/DynamicAuth/issues/1957)) ([10b9df8](https://github.com/dynamic-labs/DynamicAuth/commit/10b9df87374e9d4c4d85b98110cc10e84ed35cb8))
|
|
206
|
+
* trigger onAuthSuccess on additional flows ([#1953](https://github.com/dynamic-labs/DynamicAuth/issues/1953)) ([a485231](https://github.com/dynamic-labs/DynamicAuth/commit/a4852312bc8a11136b391ca59d38755397c00f76))
|
|
207
|
+
|
|
208
|
+
## [0.17.0-RC.5](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.4...v0.17.0-RC.5) (2023-04-24)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
### Bug Fixes
|
|
212
|
+
|
|
213
|
+
* **Cypress:** add polyfills ([#1945](https://github.com/dynamic-labs/DynamicAuth/issues/1945)) ([4902ecf](https://github.com/dynamic-labs/DynamicAuth/commit/4902ecf74306cc052c2df52796e1b254fb1829e5))
|
|
214
|
+
* **DYN-2261:** hide authorization flow after network switch ([#1942](https://github.com/dynamic-labs/DynamicAuth/issues/1942)) ([cc3ca53](https://github.com/dynamic-labs/DynamicAuth/commit/cc3ca5398191f18046958cc950cec25d6043fab3))
|
|
215
|
+
|
|
216
|
+
## [0.17.0-RC.4](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.3...v0.17.0-RC.4) (2023-04-22)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
### Bug Fixes
|
|
220
|
+
|
|
221
|
+
* wait for safe transaction validation before verify call to api ([#1925](https://github.com/dynamic-labs/DynamicAuth/issues/1925)) ([c2cd271](https://github.com/dynamic-labs/DynamicAuth/commit/c2cd27195f0058384bf6569b7da81815d4a31bb6))
|
|
222
|
+
|
|
223
|
+
## [0.17.0-RC.3](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.2...v0.17.0-RC.3) (2023-04-21)
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
### Features
|
|
227
|
+
|
|
228
|
+
* consume social sign in settings from dashboard ([#1896](https://github.com/dynamic-labs/DynamicAuth/issues/1896)) ([484fc53](https://github.com/dynamic-labs/DynamicAuth/commit/484fc539ee4f4bbef02dea52a3c4dace1a647b70))
|
|
229
|
+
* **DYN-1820:** support allow list in email authorization ([#1916](https://github.com/dynamic-labs/DynamicAuth/issues/1916)) ([9356346](https://github.com/dynamic-labs/DynamicAuth/commit/93563460d3231f644f21c9acda1b0c33e4dcd893))
|
|
230
|
+
* **DYN-2092:** add and expose global loading state ([#1872](https://github.com/dynamic-labs/DynamicAuth/issues/1872)) ([2aa1781](https://github.com/dynamic-labs/DynamicAuth/commit/2aa1781d02a801b712ff0a3fd6f9d608cc420b2a))
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
### Bug Fixes
|
|
234
|
+
|
|
235
|
+
* lock QR Code to 1.5.1 ([#1924](https://github.com/dynamic-labs/DynamicAuth/issues/1924)) ([5c49ba7](https://github.com/dynamic-labs/DynamicAuth/commit/5c49ba7ca20d1effdb8f3d367158adeacda42809))
|
|
236
|
+
|
|
2
237
|
## [0.17.0-RC.2](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.1...v0.17.0-RC.2) (2023-04-20)
|
|
3
238
|
|
|
4
239
|
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/wagmi-connector",
|
|
3
|
-
"version": "0.17.0-RC.
|
|
3
|
+
"version": "0.17.0-RC.20",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
7
7
|
"directory": "packages/wagmi-connector"
|
|
8
8
|
},
|
|
9
9
|
"peerDependencies": {
|
|
10
|
-
"@wagmi/core": "~0.
|
|
10
|
+
"@wagmi/core": "~0.10.11",
|
|
11
11
|
"react": "^17.0.2 || ^18.0.0",
|
|
12
|
-
"ethers": "
|
|
13
|
-
"wagmi": "~0.
|
|
14
|
-
"@dynamic-labs/sdk-react": "0.17.0-RC.
|
|
15
|
-
"@dynamic-labs/
|
|
12
|
+
"ethers": "5.7.2",
|
|
13
|
+
"wagmi": "~0.12.13",
|
|
14
|
+
"@dynamic-labs/sdk-react-core": "0.17.0-RC.20",
|
|
15
|
+
"@dynamic-labs/types": "0.17.0-RC.20",
|
|
16
|
+
"@dynamic-labs/wallet-connector-core": "0.17.0-RC.20"
|
|
16
17
|
},
|
|
17
18
|
"license": "MIT",
|
|
18
19
|
"main": "./src/index.cjs",
|
package/src/lib/Connector.js
CHANGED
|
@@ -82,7 +82,7 @@ class Connector extends Connector$1 {
|
|
|
82
82
|
if (!network) {
|
|
83
83
|
throw new Error('Network is not defined');
|
|
84
84
|
}
|
|
85
|
-
return network;
|
|
85
|
+
return Number(network);
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
getProvider(config) {
|
|
@@ -114,7 +114,7 @@ class Connector extends Connector$1 {
|
|
|
114
114
|
name: `Chain ${id}`,
|
|
115
115
|
nativeCurrency: { decimals: 18, name: 'Ether', symbol: 'ETH' },
|
|
116
116
|
network: `${id}`,
|
|
117
|
-
rpcUrls: { default: { http: [''] } },
|
|
117
|
+
rpcUrls: { default: { http: [''] }, public: { http: [''] } },
|
|
118
118
|
});
|
|
119
119
|
});
|
|
120
120
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { WagmiEvmNetworks } from './types';
|
|
3
3
|
type DynamicWagmiConnectorProps = {
|
|
4
4
|
children: ReactNode;
|
|
5
|
-
evmNetworks?:
|
|
5
|
+
evmNetworks?: WagmiEvmNetworks[];
|
|
6
6
|
};
|
|
7
|
-
export declare const DynamicWagmiConnector: ({ evmNetworks: customerSuppliedEvmNetworks, children, }: DynamicWagmiConnectorProps) => React.FunctionComponentElement<React.PropsWithChildren<import("wagmi").WagmiConfigProps<import("@wagmi/core/dist/index-
|
|
7
|
+
export declare const DynamicWagmiConnector: ({ evmNetworks: customerSuppliedEvmNetworks, children, }: DynamicWagmiConnectorProps) => React.FunctionComponentElement<React.PropsWithChildren<import("wagmi").WagmiConfigProps<import("@wagmi/core/dist/index-35b6525c").P, import("@wagmi/core/dist/index-35b6525c").W>>>;
|
|
8
8
|
export {};
|
|
@@ -19,7 +19,10 @@ let connector = undefined;
|
|
|
19
19
|
const DynamicWagmiConnector = ({ evmNetworks: customerSuppliedEvmNetworks, children, }) => {
|
|
20
20
|
var _a;
|
|
21
21
|
const { networkConfigurations, walletConnector, handleLogOut } = useDynamicContext();
|
|
22
|
-
const evmNetworks = (_a = customerSuppliedEvmNetworks !== null && customerSuppliedEvmNetworks !== void 0 ? customerSuppliedEvmNetworks : networkConfigurations === null || networkConfigurations === void 0 ? void 0 : networkConfigurations.evm) !== null && _a !== void 0 ? _a : []
|
|
22
|
+
const evmNetworks = ((_a = customerSuppliedEvmNetworks !== null && customerSuppliedEvmNetworks !== void 0 ? customerSuppliedEvmNetworks : networkConfigurations === null || networkConfigurations === void 0 ? void 0 : networkConfigurations.evm) !== null && _a !== void 0 ? _a : []).map((network) => {
|
|
23
|
+
network.chainId = parseInt(network.chainId.toString());
|
|
24
|
+
return network;
|
|
25
|
+
});
|
|
23
26
|
const mappedChains = getWagmiChainsFromDynamicChains(evmNetworks);
|
|
24
27
|
const mappedProviders = getWagmiProvidersFromDynamicChains(evmNetworks);
|
|
25
28
|
const { chains, provider } = configureChains(mappedChains, mappedProviders);
|
|
@@ -33,7 +36,7 @@ const DynamicWagmiConnector = ({ evmNetworks: customerSuppliedEvmNetworks, child
|
|
|
33
36
|
else if (connector && !walletConnector) {
|
|
34
37
|
connector = undefined;
|
|
35
38
|
}
|
|
36
|
-
client.config = Object.assign(Object.assign({}, client.config), { connectors: connector ? [connector] : [], provider });
|
|
39
|
+
client.config = Object.assign(Object.assign({}, client.config), { autoConnect: true, connectors: connector ? [connector] : [], provider: provider });
|
|
37
40
|
// use React.createElement to prevent bunding react/jsx-runtime,
|
|
38
41
|
// which is not compatible when bundling apps using React 17
|
|
39
42
|
return React.createElement(WagmiConfig, { client: client }, React.createElement(SyncDynamicWagmi, { connector }, children));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { useClient, useConnect, useDisconnect } from 'wagmi';
|
|
3
3
|
import { useDynamicContext } from '@dynamic-labs/sdk-react-core';
|
|
4
|
+
import { useSyncConnectState } from './hooks/useSyncConnectState/useSyncConnectState.js';
|
|
4
5
|
|
|
5
6
|
const SyncDynamicWagmi = ({ children, connector, }) => {
|
|
6
7
|
const { status: clientStatus } = useClient();
|
|
@@ -16,14 +17,13 @@ const SyncDynamicWagmi = ({ children, connector, }) => {
|
|
|
16
17
|
}, 100);
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}, [clientStatus, connect, connector, disconnect, walletConnector]);
|
|
20
|
+
useSyncConnectState({
|
|
21
|
+
clientStatus,
|
|
22
|
+
connect,
|
|
23
|
+
connector,
|
|
24
|
+
disconnect,
|
|
25
|
+
walletConnector,
|
|
26
|
+
});
|
|
27
27
|
// use React.createElement to prevent bunding react/jsx-runtime,
|
|
28
28
|
// which is not compatible when bundling apps using React 17
|
|
29
29
|
return React.createElement(React.Fragment, null, children);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Chain } from 'wagmi';
|
|
2
|
-
import {
|
|
3
|
-
export declare const getWagmiChainsFromDynamicChains: (dynamicChains:
|
|
2
|
+
import { WagmiEvmNetworks } from './types';
|
|
3
|
+
export declare const getWagmiChainsFromDynamicChains: (dynamicChains: WagmiEvmNetworks[]) => Chain[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { providers } from 'ethers';
|
|
2
2
|
import { Chain, ChainProviderFn } from 'wagmi';
|
|
3
|
-
import {
|
|
4
|
-
export declare const getWagmiProvidersFromDynamicChains: (dynamicChains:
|
|
3
|
+
import { WagmiEvmNetworks } from './types';
|
|
4
|
+
export declare const getWagmiProvidersFromDynamicChains: (dynamicChains: WagmiEvmNetworks[]) => ChainProviderFn<Chain, providers.JsonRpcProvider, providers.WebSocketProvider>[];
|
|
@@ -1,21 +1,42 @@
|
|
|
1
1
|
import { publicProvider } from 'wagmi/providers/public';
|
|
2
|
-
import {
|
|
2
|
+
import { jsonRpcProvider } from 'wagmi/providers/jsonRpc';
|
|
3
3
|
|
|
4
|
+
/* eslint-disable prefer-destructuring */
|
|
5
|
+
const getProvider = (dynamicChain, rpcUrl) => {
|
|
6
|
+
let http;
|
|
7
|
+
let webSocket;
|
|
8
|
+
let priority;
|
|
9
|
+
let stallTimeout;
|
|
10
|
+
if (typeof rpcUrl !== 'string') {
|
|
11
|
+
http = rpcUrl.http;
|
|
12
|
+
webSocket = rpcUrl.webSocket;
|
|
13
|
+
priority = rpcUrl.priority;
|
|
14
|
+
stallTimeout = rpcUrl.stallTimeout;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
http = rpcUrl;
|
|
18
|
+
}
|
|
19
|
+
return (chain) => {
|
|
20
|
+
if (chain.id !== dynamicChain.chainId)
|
|
21
|
+
return null;
|
|
22
|
+
return jsonRpcProvider({
|
|
23
|
+
priority,
|
|
24
|
+
rpc: () => ({
|
|
25
|
+
http,
|
|
26
|
+
webSocket,
|
|
27
|
+
}),
|
|
28
|
+
stallTimeout,
|
|
29
|
+
})(chain);
|
|
30
|
+
};
|
|
31
|
+
};
|
|
4
32
|
const getWagmiProvidersFromDynamicChains = (dynamicChains) => {
|
|
5
|
-
var _a;
|
|
6
33
|
const wagmiProviders = [];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
chain,
|
|
14
|
-
provider: () => new providers.JsonRpcProvider(url, chain.id),
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
34
|
+
dynamicChains.forEach((dynamicChain) => {
|
|
35
|
+
var _a;
|
|
36
|
+
((_a = dynamicChain.privateCustomerRpcUrls) !== null && _a !== void 0 ? _a : []).forEach((rpcUrl) => {
|
|
37
|
+
wagmiProviders.push(getProvider(dynamicChain, rpcUrl));
|
|
38
|
+
});
|
|
39
|
+
});
|
|
19
40
|
return [...wagmiProviders, publicProvider()];
|
|
20
41
|
};
|
|
21
42
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useSyncConnectState } from './useSyncConnectState';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Connector } from 'wagmi';
|
|
2
|
+
import { ConnectArgs } from '@wagmi/core';
|
|
3
|
+
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
+
export type SyncConnectStateHookProps = {
|
|
5
|
+
clientStatus: 'connected' | 'connecting' | 'reconnecting' | 'disconnected';
|
|
6
|
+
connect: (args?: Partial<ConnectArgs> | undefined) => void;
|
|
7
|
+
connector: Connector | undefined;
|
|
8
|
+
disconnect: () => void;
|
|
9
|
+
walletConnector: WalletConnector | null;
|
|
10
|
+
};
|
|
11
|
+
export declare const useSyncConnectState: ({ walletConnector, disconnect, clientStatus, connect, connector, }: SyncConnectStateHookProps) => void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useWalletConnectorEverPresent } from '../useWalletConnectorEverPresent/useWalletConnectorEverPresent.js';
|
|
3
|
+
|
|
4
|
+
const useSyncConnectState = ({ walletConnector, disconnect, clientStatus, connect, connector, }) => {
|
|
5
|
+
const wasWalletConnectEverPresent = useWalletConnectorEverPresent(walletConnector);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (!walletConnector) {
|
|
8
|
+
if (wasWalletConnectEverPresent) {
|
|
9
|
+
disconnect();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
else if (connector && clientStatus !== 'connected') {
|
|
13
|
+
connect({ connector });
|
|
14
|
+
}
|
|
15
|
+
}, [
|
|
16
|
+
clientStatus,
|
|
17
|
+
connect,
|
|
18
|
+
connector,
|
|
19
|
+
disconnect,
|
|
20
|
+
walletConnector,
|
|
21
|
+
wasWalletConnectEverPresent,
|
|
22
|
+
]);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { useSyncConnectState };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useWalletConnectorEverPresent } from './useWalletConnectorEverPresent';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const useWalletConnectorEverPresent = (walletConnector) => {
|
|
4
|
+
const [present, setPresent] = useState(false);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
if (walletConnector) {
|
|
7
|
+
setPresent(true);
|
|
8
|
+
}
|
|
9
|
+
}, [walletConnector]);
|
|
10
|
+
return present;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { useWalletConnectorEverPresent };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Chain } from 'wagmi';
|
|
2
|
-
import {
|
|
3
|
-
export declare const mapDynamicChainToWagmi: (dynamicChain:
|
|
2
|
+
import { WagmiEvmNetworks } from '../types';
|
|
3
|
+
export declare const mapDynamicChainToWagmi: (dynamicChain: WagmiEvmNetworks) => Chain;
|
package/src/lib/mappers/chain.js
CHANGED
|
@@ -1,47 +1,42 @@
|
|
|
1
1
|
import * as allChains from 'wagmi/chains';
|
|
2
2
|
|
|
3
3
|
// eslint-disable-next-line import/no-namespace
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
|
|
4
|
+
const findRpcProvider = (rpcUrls, privateCustomerRpcUrls, name) => {
|
|
5
|
+
const findRpcUrl = privateCustomerRpcUrls === null || privateCustomerRpcUrls === void 0 ? void 0 : privateCustomerRpcUrls.find((rpcUrl) => {
|
|
6
|
+
if (typeof rpcUrl === 'string') {
|
|
7
|
+
return rpcUrl.includes(name);
|
|
8
|
+
}
|
|
9
|
+
else if (typeof rpcUrl.http === 'string') {
|
|
10
|
+
return rpcUrl.http.includes(name);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
if (typeof findRpcUrl === 'string') {
|
|
17
|
+
rpcUrls[name] = { http: [findRpcUrl] };
|
|
18
|
+
}
|
|
19
|
+
else if (typeof (findRpcUrl === null || findRpcUrl === void 0 ? void 0 : findRpcUrl.http) === 'string') {
|
|
20
|
+
rpcUrls[name] = { http: [findRpcUrl.http] };
|
|
18
21
|
}
|
|
22
|
+
};
|
|
23
|
+
const mapDynamicChainToWagmi = (dynamicChain) => {
|
|
24
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
19
25
|
const rpcUrls = {
|
|
20
26
|
default: {
|
|
21
27
|
http: dynamicChain.rpcUrls,
|
|
22
28
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (alchemyUrl) {
|
|
26
|
-
rpcUrls.alchemy = { http: [alchemyUrl] };
|
|
27
|
-
}
|
|
28
|
-
const infuraUrl = (_b = dynamicChain.privateCustomerRpcUrls) === null || _b === void 0 ? void 0 : _b.find((url) => url.includes('infura'));
|
|
29
|
-
if (infuraUrl) {
|
|
30
|
-
rpcUrls.infura = { http: [infuraUrl] };
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
blockExplorers: {
|
|
34
|
-
default: {
|
|
35
|
-
name: '',
|
|
36
|
-
url: (_d = (_c = dynamicChain.blockExplorerUrls) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : '',
|
|
37
|
-
},
|
|
29
|
+
public: {
|
|
30
|
+
http: dynamicChain.rpcUrls,
|
|
38
31
|
},
|
|
39
|
-
id: dynamicChain.chainId,
|
|
40
|
-
name: (_e = dynamicChain.vanityName) !== null && _e !== void 0 ? _e : dynamicChain.chainName,
|
|
41
|
-
nativeCurrency: dynamicChain.nativeCurrency,
|
|
42
|
-
network: dynamicChain.chainName,
|
|
43
|
-
rpcUrls,
|
|
44
32
|
};
|
|
33
|
+
const rpcUrlProviders = ['alchemy', 'infura'];
|
|
34
|
+
rpcUrlProviders.forEach((name) => findRpcProvider(rpcUrls, dynamicChain.privateCustomerRpcUrls, name));
|
|
35
|
+
/**
|
|
36
|
+
* Find the chain in Wagmi that matches the chainId of the dynamic chain.
|
|
37
|
+
*/
|
|
38
|
+
const wagmiChain = ((_a = Object.values(allChains).find((chain) => chain.id === dynamicChain.chainId)) !== null && _a !== void 0 ? _a : {});
|
|
39
|
+
return Object.assign(Object.assign({}, wagmiChain), { blockExplorers: Object.assign(Object.assign({}, wagmiChain === null || wagmiChain === void 0 ? void 0 : wagmiChain.blockExplorers), { default: Object.assign(Object.assign({}, (_b = wagmiChain.blockExplorers) === null || _b === void 0 ? void 0 : _b.default), { name: '', url: (_d = (_c = dynamicChain.blockExplorerUrls) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : '' }) }), id: (_e = dynamicChain.chainId) !== null && _e !== void 0 ? _e : wagmiChain.id, name: (_g = (_f = dynamicChain.vanityName) !== null && _f !== void 0 ? _f : dynamicChain.name) !== null && _g !== void 0 ? _g : wagmiChain.name, nativeCurrency: (_h = dynamicChain.nativeCurrency) !== null && _h !== void 0 ? _h : wagmiChain.nativeCurrency, network: (_j = dynamicChain.name) !== null && _j !== void 0 ? _j : wagmiChain.network, rpcUrls: rpcUrls !== null && rpcUrls !== void 0 ? rpcUrls : wagmiChain.rpcUrls });
|
|
45
40
|
};
|
|
46
41
|
|
|
47
42
|
export { mapDynamicChainToWagmi };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { EvmNetwork } from '@dynamic-labs/types';
|
|
2
|
+
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
3
|
+
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
4
|
+
type CustomProviderOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* The URL of the RPC endpoint.
|
|
7
|
+
*/
|
|
8
|
+
http: string;
|
|
9
|
+
/**
|
|
10
|
+
* The priority of this provider.
|
|
11
|
+
*/
|
|
12
|
+
priority?: number;
|
|
13
|
+
/**
|
|
14
|
+
* The timeout in milliseconds for requests to this provider.
|
|
15
|
+
*/
|
|
16
|
+
stallTimeout?: number;
|
|
17
|
+
/**
|
|
18
|
+
* The URL of the websocket endpoint.
|
|
19
|
+
*/
|
|
20
|
+
webSocket?: string;
|
|
21
|
+
};
|
|
22
|
+
export type WagmiEvmNetworks = Omit<PartialBy<EvmNetwork, 'iconUrls' | 'networkId' | 'vanityName'>, 'privateCustomerRpcUrls'> & {
|
|
23
|
+
privateCustomerRpcUrls: (string | CustomProviderOptions)[];
|
|
24
|
+
};
|
|
25
|
+
export {};
|