@dynamic-labs/sdk-react-core 4.88.0 → 4.88.2
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 +17 -153
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.cjs +6 -0
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.js +6 -0
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +3 -3
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +4 -4
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +11 -10
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +12 -11
- package/src/lib/utils/hooks/useReconcileInstalledWallets/index.d.ts +1 -0
- package/src/lib/utils/hooks/useReconcileInstalledWallets/useReconcileInstalledWallets.cjs +69 -0
- package/src/lib/utils/hooks/useReconcileInstalledWallets/useReconcileInstalledWallets.d.ts +7 -0
- package/src/lib/utils/hooks/useReconcileInstalledWallets/useReconcileInstalledWallets.js +65 -0
- package/src/lib/utils/hooks/useWalletList/buildWalletsList.cjs +42 -0
- package/src/lib/utils/hooks/useWalletList/buildWalletsList.d.ts +17 -0
- package/src/lib/utils/hooks/useWalletList/buildWalletsList.js +38 -0
- package/src/lib/utils/hooks/useWalletList/useWalletList.cjs +27 -26
- package/src/lib/utils/hooks/useWalletList/useWalletList.js +27 -26
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +26 -21
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +26 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.88.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.88.1...v4.88.2) (2026-06-06)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **aleo:** support sendBalance on WaaS wallets (add connector.requestTransaction) ([#11474](https://github.com/dynamic-labs/dynamic-auth/issues/11474)) ([c11d49d](https://github.com/dynamic-labs/dynamic-auth/commit/c11d49d2cd1aeafdc6d6713a5c711dbe28ecf17d))
|
|
8
|
+
* remove rerenders from useDynamicWaas and useCreateDynamicEmbeddedWalletWallets ([#11482](https://github.com/dynamic-labs/dynamic-auth/issues/11482)) ([9724bf6](https://github.com/dynamic-labs/dynamic-auth/commit/9724bf67db7abd09366985b15e9687802e6ad3b1))
|
|
9
|
+
* **sdk-react-core:** reconcile installed wallets after late provider injection (DYNT-1074) ([#11480](https://github.com/dynamic-labs/dynamic-auth/issues/11480)) ([4d833da](https://github.com/dynamic-labs/dynamic-auth/commit/4d833daa5ee2e09780ee612ae93c6c5fddea9fdf))
|
|
10
|
+
|
|
11
|
+
### [4.88.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.88.0...v4.88.1) (2026-06-04)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **solana:** poll wallet-standard registry to catch late-injecting wallets ([#11464](https://github.com/dynamic-labs/dynamic-auth/issues/11464)) ([afa8ae7](https://github.com/dynamic-labs/dynamic-auth/commit/afa8ae785d7be58775addc4bb2db3dc1b5500f87))
|
|
17
|
+
|
|
2
18
|
## [4.88.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.87.2...v4.88.0) (2026-06-04)
|
|
3
19
|
|
|
4
20
|
|
|
@@ -6452,156 +6468,4 @@ Enjoy!
|
|
|
6452
6468
|
### Bug Fixes
|
|
6453
6469
|
|
|
6454
6470
|
* **view-context:** refactor view context to have initial view ([#2268](https://github.com/dynamic-labs/DynamicAuth/issues/2268)) ([0afe6ae](https://github.com/dynamic-labs/DynamicAuth/commit/0afe6ae469f62fd16fd8471322f9295957f607f6))
|
|
6455
|
-
* **wcv2:** upgrade universal
|
|
6456
|
-
|
|
6457
|
-
## [0.17.0-RC.29](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.28...v0.17.0-RC.29) (2023-06-07)
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
### Bug Fixes
|
|
6461
|
-
|
|
6462
|
-
* de-duplicate authSuccess call ([#2269](https://github.com/dynamic-labs/DynamicAuth/issues/2269)) ([00268d0](https://github.com/dynamic-labs/DynamicAuth/commit/00268d001355946c98d285d71d7f7acc96d4c9f7))
|
|
6463
|
-
* hide search when filtered wallets equal to number of shown wallets ([#2221](https://github.com/dynamic-labs/DynamicAuth/issues/2221)) ([fb0f629](https://github.com/dynamic-labs/DynamicAuth/commit/fb0f629ae76240fe681db91b485139934026054e))
|
|
6464
|
-
|
|
6465
|
-
## [0.17.0-RC.28](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.27...v0.17.0-RC.28) (2023-06-06)
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
### Features
|
|
6469
|
-
|
|
6470
|
-
* lower username minimum length requirement ([#2265](https://github.com/dynamic-labs/DynamicAuth/issues/2265)) ([ed891ca](https://github.com/dynamic-labs/DynamicAuth/commit/ed891cac8cceaf9e0556b679eda7a3575725805d))
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
### Bug Fixes
|
|
6474
|
-
|
|
6475
|
-
* **send_balance:** add amount validation to form ([#2261](https://github.com/dynamic-labs/DynamicAuth/issues/2261)) ([9a57cfe](https://github.com/dynamic-labs/DynamicAuth/commit/9a57cfe0dd7f97aa16351b091ab385b2b5c7c5e4))
|
|
6476
|
-
* shrink dynamic widget in smaller containers ([#2260](https://github.com/dynamic-labs/DynamicAuth/issues/2260)) ([353f447](https://github.com/dynamic-labs/DynamicAuth/commit/353f44724db83e9f1500c606fdea7d50a8067711))
|
|
6477
|
-
|
|
6478
|
-
## [0.17.0-RC.27](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.26...v0.17.0-RC.27) (2023-06-06)
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
### Features
|
|
6482
|
-
|
|
6483
|
-
* sync wagmi to first connected eth wallet ([#2253](https://github.com/dynamic-labs/DynamicAuth/issues/2253)) ([c00aed7](https://github.com/dynamic-labs/DynamicAuth/commit/c00aed73a1014c668311c8cb59e5a466b5ee6779))
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
### Bug Fixes
|
|
6487
|
-
|
|
6488
|
-
* include username in userFieldsSchema ([#2257](https://github.com/dynamic-labs/DynamicAuth/issues/2257)) ([6e5431d](https://github.com/dynamic-labs/DynamicAuth/commit/6e5431d08323d718b11accf3790ef56fc7325b5c))
|
|
6489
|
-
|
|
6490
|
-
## [0.17.0-RC.26](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.25...v0.17.0-RC.26) (2023-06-05)
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
### Features
|
|
6494
|
-
|
|
6495
|
-
* disable button on social unlink ([#2234](https://github.com/dynamic-labs/DynamicAuth/issues/2234)) ([7f148de](https://github.com/dynamic-labs/DynamicAuth/commit/7f148de76b0fca632e1b4d6ff71c18eb0207c02b))
|
|
6496
|
-
* update magic + email icon in auth flow views ([#2224](https://github.com/dynamic-labs/DynamicAuth/issues/2224)) ([93f1ed6](https://github.com/dynamic-labs/DynamicAuth/commit/93f1ed644428701c2747565033d0ad113fa8eeb2))
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
### Bug Fixes
|
|
6500
|
-
|
|
6501
|
-
* **wallets:** keep magic social wallet connector on mobile ([#2242](https://github.com/dynamic-labs/DynamicAuth/issues/2242)) ([35c092d](https://github.com/dynamic-labs/DynamicAuth/commit/35c092da3b8a76c74ae25558489d663ce963d72f))
|
|
6502
|
-
* wrong logger instance in UserProfileSocialAccount ([#2248](https://github.com/dynamic-labs/DynamicAuth/issues/2248)) ([814108d](https://github.com/dynamic-labs/DynamicAuth/commit/814108d416d9d730bed8976956bc7974c7fde2a8))
|
|
6503
|
-
|
|
6504
|
-
## [0.17.0-RC.25](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.24...v0.17.0-RC.25) (2023-06-05)
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
### Bug Fixes
|
|
6508
|
-
|
|
6509
|
-
* **EmailOTPMagicWalletConnector:** allow user to reconnect with email wallet ([#2230](https://github.com/dynamic-labs/DynamicAuth/issues/2230)) ([6059886](https://github.com/dynamic-labs/DynamicAuth/commit/605988650a783ae824bb8c45edc5533fecf8726a))
|
|
6510
|
-
* only set wagmi connector if connected chain is evm ([#2237](https://github.com/dynamic-labs/DynamicAuth/issues/2237)) ([a7be7d3](https://github.com/dynamic-labs/DynamicAuth/commit/a7be7d302d1e74088b0aa2b6848c879079e6f963))
|
|
6511
|
-
* Revert "fix(ViewContext): only set view when on wallet list" ([#2235](https://github.com/dynamic-labs/DynamicAuth/issues/2235)) ([e790315](https://github.com/dynamic-labs/DynamicAuth/commit/e79031577f640161cc5f0b9b2e695e22d9a98901)), closes [#2226](https://github.com/dynamic-labs/DynamicAuth/issues/2226)
|
|
6512
|
-
* set view to social-redirect-view while waiting to process magic redirect ([#2229](https://github.com/dynamic-labs/DynamicAuth/issues/2229)) ([f50a29c](https://github.com/dynamic-labs/DynamicAuth/commit/f50a29c0b9623c703f1577c7a41fcc5aee58abb8))
|
|
6513
|
-
* user profile does not extend on mobile ([#2236](https://github.com/dynamic-labs/DynamicAuth/issues/2236)) ([5bb7912](https://github.com/dynamic-labs/DynamicAuth/commit/5bb7912a865338fdf6eca1a19ff4b74a3fb18eeb))
|
|
6514
|
-
* **ViewContext:** only set view when on wallet list ([#2226](https://github.com/dynamic-labs/DynamicAuth/issues/2226)) ([85e8fc1](https://github.com/dynamic-labs/DynamicAuth/commit/85e8fc140069cabff41f4067ac93ea0c5cfaa161))
|
|
6515
|
-
|
|
6516
|
-
## [0.17.0-RC.24](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.23...v0.17.0-RC.24) (2023-06-02)
|
|
6517
|
-
|
|
6518
|
-
## [0.17.0-RC.23](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.22...v0.17.0-RC.23) (2023-06-02)
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
### Bug Fixes
|
|
6522
|
-
|
|
6523
|
-
* flow connection status improvements ([#2212](https://github.com/dynamic-labs/DynamicAuth/issues/2212)) ([5225e9f](https://github.com/dynamic-labs/DynamicAuth/commit/5225e9f3f19705cdde3c1d860ddf4e69689a839b))
|
|
6524
|
-
* **useSyncPrimaryWallet:** disables the hook while connect state is loaded ([#2193](https://github.com/dynamic-labs/DynamicAuth/issues/2193)) ([d2a69c8](https://github.com/dynamic-labs/DynamicAuth/commit/d2a69c8edfbb2a19305b0fd322e24d909bbf9b4f)), closes [#2155](https://github.com/dynamic-labs/DynamicAuth/issues/2155)
|
|
6525
|
-
|
|
6526
|
-
## [0.17.0-RC.22](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.21...v0.17.0-RC.22) (2023-06-02)
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
### Features
|
|
6530
|
-
|
|
6531
|
-
* social copy update ([#2215](https://github.com/dynamic-labs/DynamicAuth/issues/2215)) ([1fe7316](https://github.com/dynamic-labs/DynamicAuth/commit/1fe7316a94284db7227d5ab09026354269559752))
|
|
6532
|
-
|
|
6533
|
-
## [0.17.0-RC.21](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.20...v0.17.0-RC.21) (2023-06-02)
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
### Bug Fixes
|
|
6537
|
-
|
|
6538
|
-
* social icon is missing on some views ([#2211](https://github.com/dynamic-labs/DynamicAuth/issues/2211)) ([bddd255](https://github.com/dynamic-labs/DynamicAuth/commit/bddd255f0aa61aed4b767145c51624ac1eb9b963))
|
|
6539
|
-
|
|
6540
|
-
## [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)
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
### Features
|
|
6544
|
-
|
|
6545
|
-
* 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))
|
|
6546
|
-
* **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))
|
|
6547
|
-
* **DynamicWidget:** add send balance button ([#2183](https://github.com/dynamic-labs/DynamicAuth/issues/2183)) ([d76355e](https://github.com/dynamic-labs/DynamicAuth/commit/d76355e1f9c3a7b05cbb5b7b3144dad379586689))
|
|
6548
|
-
* handle magic redirect error ([#2203](https://github.com/dynamic-labs/DynamicAuth/issues/2203)) ([9a088c6](https://github.com/dynamic-labs/DynamicAuth/commit/9a088c6aad2eb2c1045f544a784083d2732df440))
|
|
6549
|
-
* **SendBalanceModal:** adds openSendBalanceModal in dynamic context ([#2159](https://github.com/dynamic-labs/DynamicAuth/issues/2159)) ([f89b21b](https://github.com/dynamic-labs/DynamicAuth/commit/f89b21bfcd65bb61ef33b17b460140404574b235))
|
|
6550
|
-
* social error handling improvements ([#2146](https://github.com/dynamic-labs/DynamicAuth/issues/2146)) ([a64a26a](https://github.com/dynamic-labs/DynamicAuth/commit/a64a26aa42c228654cb135cd6c4778e8bd2bd0e6))
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
### Bug Fixes
|
|
6554
|
-
|
|
6555
|
-
* amendments to user profile ([#2201](https://github.com/dynamic-labs/DynamicAuth/issues/2201)) ([5d12c17](https://github.com/dynamic-labs/DynamicAuth/commit/5d12c1716cdcd8d843ef3ff941e163bad28573b1))
|
|
6556
|
-
* **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))
|
|
6557
|
-
* 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))
|
|
6558
|
-
|
|
6559
|
-
## [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)
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
### Features
|
|
6563
|
-
|
|
6564
|
-
* add SocialWrongAccountView ([#2153](https://github.com/dynamic-labs/DynamicAuth/issues/2153)) ([531a29d](https://github.com/dynamic-labs/DynamicAuth/commit/531a29d7d87739d974ecc35c57ef0d333a5e7451))
|
|
6565
|
-
* 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))
|
|
6566
|
-
* **DYN-2402:** coinbase issues after disconnecting ([#2149](https://github.com/dynamic-labs/DynamicAuth/issues/2149)) ([91d49fb](https://github.com/dynamic-labs/DynamicAuth/commit/91d49fb7f8c6fca3ab03098f3fba53d277c836ad))
|
|
6567
|
-
* 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))
|
|
6568
|
-
* **social:** handle reconnect ([#2131](https://github.com/dynamic-labs/DynamicAuth/issues/2131)) ([2b3e5fb](https://github.com/dynamic-labs/DynamicAuth/commit/2b3e5fbb72bb7dafee3bd0bbfa73fae444055410))
|
|
6569
|
-
|
|
6570
|
-
## [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)
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
### Features
|
|
6574
|
-
|
|
6575
|
-
* add getReferencedAccount ([#2141](https://github.com/dynamic-labs/DynamicAuth/issues/2141)) ([ac170a6](https://github.com/dynamic-labs/DynamicAuth/commit/ac170a6dfac25ff9911feb390495974aa5dbede6))
|
|
6576
|
-
* add reconnectSocialWallet ([#2142](https://github.com/dynamic-labs/DynamicAuth/issues/2142)) ([fefd759](https://github.com/dynamic-labs/DynamicAuth/commit/fefd759b816b286dd8a7673cf6c839fee59768ac))
|
|
6577
|
-
* **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))
|
|
6578
|
-
* **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))
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
### Bug Fixes
|
|
6582
|
-
|
|
6583
|
-
* 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))
|
|
6584
|
-
* multi-wallet flows ([#2150](https://github.com/dynamic-labs/DynamicAuth/issues/2150)) ([c82ef4a](https://github.com/dynamic-labs/DynamicAuth/commit/c82ef4a5cc75c9f8edb30620e32dd64bbdb0eb7f))
|
|
6585
|
-
* 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))
|
|
6586
|
-
|
|
6587
|
-
## [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)
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
### Features
|
|
6591
|
-
|
|
6592
|
-
* distinguish walletconnect deeplink types ([#2093](https://github.com/dynamic-labs/DynamicAuth/issues/2093)) ([dcd29f7](https://github.com/dynamic-labs/DynamicAuth/commit/dcd29f7cfc5e6481aaaae502b3fc4e4d225f1fc1))
|
|
6593
|
-
* **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))
|
|
6594
|
-
* 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))
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
### Bug Fixes
|
|
6598
|
-
|
|
6599
|
-
* 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))
|
|
6600
|
-
* 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))
|
|
6601
|
-
* remove detect known secondary wallet modal ([#2117](https://github.com/dynamic-labs/DynamicAuth/issues/2117)) ([0e8bbd8](https://github.com/dynamic-labs/DynamicAuth/commit/0e8bbd8c385fe528a7af3ccc037812df9d6e0c84))
|
|
6602
|
-
* 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))
|
|
6603
|
-
* 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))
|
|
6604
|
-
* setPrimaryWallet and useSyncPrimaryWallet updates ([#2128](https://github.com/dynamic-labs/DynamicAuth/issues/2128)) ([fb47b17](https://github.com/dynamic-labs/DynamicAuth/commit/fb47b17ddc7f41c29f140a1a85a1e47dbf017fff))
|
|
6605
|
-
* 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))
|
|
6606
|
-
|
|
6607
|
-
## [0.17.0-RC.16](https://github.com/dynamic-labs/Dyna
|
|
6471
|
+
* **wcv2:** upgrade universal p
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.88.
|
|
3
|
+
"version": "4.88.2",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.1015",
|
|
6
6
|
"@dynamic-labs-sdk/client": "1.7.0",
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
"yup": "0.32.11",
|
|
18
18
|
"react-international-phone": "4.5.0",
|
|
19
19
|
"bs58": "5.0.0",
|
|
20
|
-
"@dynamic-labs/assert-package-version": "4.88.
|
|
21
|
-
"@dynamic-labs/iconic": "4.88.
|
|
22
|
-
"@dynamic-labs/locale": "4.88.
|
|
23
|
-
"@dynamic-labs/logger": "4.88.
|
|
24
|
-
"@dynamic-labs/multi-wallet": "4.88.
|
|
25
|
-
"@dynamic-labs/rpc-providers": "4.88.
|
|
26
|
-
"@dynamic-labs/store": "4.88.
|
|
27
|
-
"@dynamic-labs/types": "4.88.
|
|
28
|
-
"@dynamic-labs/utils": "4.88.
|
|
29
|
-
"@dynamic-labs/wallet-book": "4.88.
|
|
30
|
-
"@dynamic-labs/wallet-connector-core": "4.88.
|
|
20
|
+
"@dynamic-labs/assert-package-version": "4.88.2",
|
|
21
|
+
"@dynamic-labs/iconic": "4.88.2",
|
|
22
|
+
"@dynamic-labs/locale": "4.88.2",
|
|
23
|
+
"@dynamic-labs/logger": "4.88.2",
|
|
24
|
+
"@dynamic-labs/multi-wallet": "4.88.2",
|
|
25
|
+
"@dynamic-labs/rpc-providers": "4.88.2",
|
|
26
|
+
"@dynamic-labs/store": "4.88.2",
|
|
27
|
+
"@dynamic-labs/types": "4.88.2",
|
|
28
|
+
"@dynamic-labs/utils": "4.88.2",
|
|
29
|
+
"@dynamic-labs/wallet-book": "4.88.2",
|
|
30
|
+
"@dynamic-labs/wallet-connector-core": "4.88.2",
|
|
31
31
|
"eventemitter3": "5.0.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
@@ -9,6 +9,7 @@ var multiWallet = require('@dynamic-labs/multi-wallet');
|
|
|
9
9
|
var rpcProviders = require('@dynamic-labs/rpc-providers');
|
|
10
10
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
11
11
|
var useWalletItemActions = require('../../utils/hooks/useWalletItemActions/useWalletItemActions.cjs');
|
|
12
|
+
var useReconcileInstalledWallets = require('../../utils/hooks/useReconcileInstalledWallets/useReconcileInstalledWallets.cjs');
|
|
12
13
|
require('@dynamic-labs/iconic');
|
|
13
14
|
require('react/jsx-runtime');
|
|
14
15
|
require('../../context/ViewContext/ViewContext.cjs');
|
|
@@ -33,6 +34,11 @@ const WalletConnectorEvents = ({ connectorProps, }) => {
|
|
|
33
34
|
const injectedDebounceTimeoutRef = React.useRef();
|
|
34
35
|
const pendingReadyConnectorsRef = React.useRef([]);
|
|
35
36
|
const readyDebounceTimeoutRef = React.useRef();
|
|
37
|
+
// Re-check installed state for a short window after the wallet list is built,
|
|
38
|
+
// so a wallet whose provider injected just after the initial snapshot (common
|
|
39
|
+
// on typed/address-bar navigations) is upgraded to "installed" without a
|
|
40
|
+
// refresh (DYNT-1074).
|
|
41
|
+
useReconcileInstalledWallets.useReconcileInstalledWallets(walletBook.isWalletBookPopulated(connectorProps.walletBook));
|
|
36
42
|
// need to add the timeout to ensure the setConnectorInitializing call is
|
|
37
43
|
// not made in the same tick to avoid a bad setState call error from React
|
|
38
44
|
const waitAndSetState = (func) => {
|
|
@@ -5,6 +5,7 @@ import { getWalletConnectorConstructorOptions } from '@dynamic-labs/multi-wallet
|
|
|
5
5
|
import { ChainRpcProviders } from '@dynamic-labs/rpc-providers';
|
|
6
6
|
import { isWalletBookPopulated } from '@dynamic-labs/wallet-book';
|
|
7
7
|
import { useWalletItemActions } from '../../utils/hooks/useWalletItemActions/useWalletItemActions.js';
|
|
8
|
+
import { useReconcileInstalledWallets } from '../../utils/hooks/useReconcileInstalledWallets/useReconcileInstalledWallets.js';
|
|
8
9
|
import '@dynamic-labs/iconic';
|
|
9
10
|
import 'react/jsx-runtime';
|
|
10
11
|
import '../../context/ViewContext/ViewContext.js';
|
|
@@ -29,6 +30,11 @@ const WalletConnectorEvents = ({ connectorProps, }) => {
|
|
|
29
30
|
const injectedDebounceTimeoutRef = useRef();
|
|
30
31
|
const pendingReadyConnectorsRef = useRef([]);
|
|
31
32
|
const readyDebounceTimeoutRef = useRef();
|
|
33
|
+
// Re-check installed state for a short window after the wallet list is built,
|
|
34
|
+
// so a wallet whose provider injected just after the initial snapshot (common
|
|
35
|
+
// on typed/address-bar navigations) is upgraded to "installed" without a
|
|
36
|
+
// refresh (DYNT-1074).
|
|
37
|
+
useReconcileInstalledWallets(isWalletBookPopulated(connectorProps.walletBook));
|
|
32
38
|
// need to add the timeout to ensure the setConnectorInitializing call is
|
|
33
39
|
// not made in the same tick to avoid a bad setState call error from React
|
|
34
40
|
const waitAndSetState = (func) => {
|
|
@@ -56,11 +56,11 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
56
56
|
environmentId,
|
|
57
57
|
projectSettings,
|
|
58
58
|
});
|
|
59
|
-
const
|
|
59
|
+
const chainConfigurations = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.chainConfigurations;
|
|
60
60
|
const primaryEmbeddedChain = findPrimaryEmbeddedChain.findPrimaryEmbeddedChain(projectSettings);
|
|
61
|
-
const embeddedChains =
|
|
61
|
+
const embeddedChains = React.useMemo(() => (chainConfigurations || [])
|
|
62
62
|
.filter((chain) => chain.enabled)
|
|
63
|
-
.map((c) => getEmbeddedChain(c.name));
|
|
63
|
+
.map((c) => getEmbeddedChain(c.name)), [chainConfigurations]);
|
|
64
64
|
const createDynamicEmbeddedWalletMutation = React.useCallback((_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ environmentId, walletConnectorOptions, withAuthenticator, options, chains, }) {
|
|
65
65
|
var _d, _e;
|
|
66
66
|
setIsLoading(true);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { useState, useCallback } from 'react';
|
|
3
|
+
import { useState, useMemo, useCallback } from 'react';
|
|
4
4
|
import { EmbeddedWalletChainEnum } from '@dynamic-labs/sdk-api-core';
|
|
5
5
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
6
6
|
import '../../../context/DynamicContext/useDynamicContext/useDynamicContext.js';
|
|
@@ -52,11 +52,11 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
52
52
|
environmentId,
|
|
53
53
|
projectSettings,
|
|
54
54
|
});
|
|
55
|
-
const
|
|
55
|
+
const chainConfigurations = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.chainConfigurations;
|
|
56
56
|
const primaryEmbeddedChain = findPrimaryEmbeddedChain(projectSettings);
|
|
57
|
-
const embeddedChains =
|
|
57
|
+
const embeddedChains = useMemo(() => (chainConfigurations || [])
|
|
58
58
|
.filter((chain) => chain.enabled)
|
|
59
|
-
.map((c) => getEmbeddedChain(c.name));
|
|
59
|
+
.map((c) => getEmbeddedChain(c.name)), [chainConfigurations]);
|
|
60
60
|
const createDynamicEmbeddedWalletMutation = useCallback((_c) => __awaiter(void 0, [_c], void 0, function* ({ environmentId, walletConnectorOptions, withAuthenticator, options, chains, }) {
|
|
61
61
|
var _d, _e;
|
|
62
62
|
setIsLoading(true);
|
|
@@ -91,7 +91,7 @@ const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl,
|
|
|
91
91
|
return walletConnector;
|
|
92
92
|
};
|
|
93
93
|
const useDynamicWaas = () => {
|
|
94
|
-
var _a, _b, _c, _d, _e, _f
|
|
94
|
+
var _a, _b, _c, _d, _e, _f;
|
|
95
95
|
const { setShowAuthFlow, handleLogOutWithReason } = useInternalDynamicContext.useInternalDynamicContext();
|
|
96
96
|
const { addedWalletsIds, userWallets } = UserWalletsContext.useInternalUserWallets();
|
|
97
97
|
const user = useUser.useUser();
|
|
@@ -103,14 +103,15 @@ const useDynamicWaas = () => {
|
|
|
103
103
|
const relayUrl = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.waas) === null || _b === void 0 ? void 0 : _b.relayUrl;
|
|
104
104
|
const baseClientKeysharesRelayApiUrl = (_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _c === void 0 ? void 0 : _c.waas) === null || _d === void 0 ? void 0 : _d.customKeyshareRelayBaseUrl;
|
|
105
105
|
const embeddedWalletSettings = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets;
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
const
|
|
106
|
+
const chainConfigurations = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.chainConfigurations;
|
|
107
|
+
const enabledChains = React.useMemo(() => chainConfigurations === null || chainConfigurations === void 0 ? void 0 : chainConfigurations.filter((c) => c.enabled), [chainConfigurations]);
|
|
108
|
+
const primaryChain = React.useMemo(() => enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.find((chain) => chain.primary), [enabledChains]);
|
|
109
|
+
const enabledChainNames = React.useMemo(() => enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.map((chain) => chain.name), [enabledChains]);
|
|
109
110
|
const automaticEmbeddedWalletCreationEnabled = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.automaticEmbeddedWalletCreation;
|
|
110
111
|
const automaticEmbeddedWalletCreationForExternalEnabled = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.automaticEmbeddedWalletCreationForExternal;
|
|
111
112
|
const defaultWalletVersion = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.defaultWalletVersion;
|
|
112
113
|
const dynamicWaasIsEnabled = defaultWalletVersion === sdkApiCore.EmbeddedWalletVersionEnum.V3;
|
|
113
|
-
const svmGasSponsorshipEnabled = (
|
|
114
|
+
const svmGasSponsorshipEnabled = (_e = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.svmGasSponsorshipEnabled) !== null && _e !== void 0 ? _e : false;
|
|
114
115
|
const svmGasSponsorshipEnabledRef = React.useRef(svmGasSponsorshipEnabled);
|
|
115
116
|
svmGasSponsorshipEnabledRef.current = svmGasSponsorshipEnabled;
|
|
116
117
|
const authToken = getMinAuthToken.getMinAuthToken();
|
|
@@ -175,7 +176,7 @@ const useDynamicWaas = () => {
|
|
|
175
176
|
}, [
|
|
176
177
|
user === null || user === void 0 ? void 0 : user.id,
|
|
177
178
|
user === null || user === void 0 ? void 0 : user.sessionId,
|
|
178
|
-
(
|
|
179
|
+
(_f = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _f === void 0 ? void 0 : _f.length,
|
|
179
180
|
dynamicWaasIsEnabled,
|
|
180
181
|
enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.length,
|
|
181
182
|
walletConnectorOptions.length,
|
|
@@ -459,7 +460,7 @@ const useDynamicWaas = () => {
|
|
|
459
460
|
automaticEmbeddedWalletCreationForExternalEnabled,
|
|
460
461
|
enabledChainNames,
|
|
461
462
|
]);
|
|
462
|
-
const importPrivateKey = (
|
|
463
|
+
const importPrivateKey = (_g) => _tslib.__awaiter(void 0, [_g], void 0, function* ({ chainName, privateKey, addressType, legacyWalletId, password, }) {
|
|
463
464
|
const walletConnector = getWaasWalletConnector(chainName);
|
|
464
465
|
if (!walletConnector)
|
|
465
466
|
return;
|
|
@@ -472,7 +473,7 @@ const useDynamicWaas = () => {
|
|
|
472
473
|
});
|
|
473
474
|
yield refresh();
|
|
474
475
|
});
|
|
475
|
-
const upgradeToDynamicWaas = React.useCallback((
|
|
476
|
+
const upgradeToDynamicWaas = React.useCallback((_h) => _tslib.__awaiter(void 0, [_h], void 0, function* ({ privateKey, wallet, password, }) {
|
|
476
477
|
isUpgrading.current = true;
|
|
477
478
|
if (!wallet) {
|
|
478
479
|
throw new utils.DynamicError('Wallet to upgrade was not provided');
|
|
@@ -552,14 +553,14 @@ const useDynamicWaas = () => {
|
|
|
552
553
|
values.VerifiedCredentialNameToChainEnum[cred.chain]);
|
|
553
554
|
}, [user === null || user === void 0 ? void 0 : user.verifiedCredentials]);
|
|
554
555
|
const processSignOnWalletSettings = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
555
|
-
var
|
|
556
|
+
var _j;
|
|
556
557
|
if (!(user === null || user === void 0 ? void 0 : user.verifiedCredentials)) {
|
|
557
558
|
return;
|
|
558
559
|
}
|
|
559
560
|
const waasWallets = user.verifiedCredentials.filter((vc) => { var _a; return vc.walletName === 'dynamicwaas' && ((_a = vc.walletProperties) === null || _a === void 0 ? void 0 : _a.settings); });
|
|
560
561
|
for (const wallet of waasWallets) {
|
|
561
562
|
try {
|
|
562
|
-
const settings = (
|
|
563
|
+
const settings = (_j = wallet.walletProperties) === null || _j === void 0 ? void 0 : _j.settings;
|
|
563
564
|
const { address, chain } = wallet;
|
|
564
565
|
if (!settings || !address || !chain) {
|
|
565
566
|
continue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { useRef, useState, useCallback
|
|
3
|
+
import { useMemo, useRef, useState, useCallback } from 'react';
|
|
4
4
|
import { EmbeddedWalletVersionEnum, JwtVerifiedCredentialFormatEnum, WalletProviderEnum, ChainEnum } from '@dynamic-labs/sdk-api-core';
|
|
5
5
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
6
6
|
import { logger } from '@dynamic-labs/wallet-connector-core';
|
|
@@ -87,7 +87,7 @@ const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl,
|
|
|
87
87
|
return walletConnector;
|
|
88
88
|
};
|
|
89
89
|
const useDynamicWaas = () => {
|
|
90
|
-
var _a, _b, _c, _d, _e, _f
|
|
90
|
+
var _a, _b, _c, _d, _e, _f;
|
|
91
91
|
const { setShowAuthFlow, handleLogOutWithReason } = useInternalDynamicContext();
|
|
92
92
|
const { addedWalletsIds, userWallets } = useInternalUserWallets();
|
|
93
93
|
const user = useUser();
|
|
@@ -99,14 +99,15 @@ const useDynamicWaas = () => {
|
|
|
99
99
|
const relayUrl = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.waas) === null || _b === void 0 ? void 0 : _b.relayUrl;
|
|
100
100
|
const baseClientKeysharesRelayApiUrl = (_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _c === void 0 ? void 0 : _c.waas) === null || _d === void 0 ? void 0 : _d.customKeyshareRelayBaseUrl;
|
|
101
101
|
const embeddedWalletSettings = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets;
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
const
|
|
102
|
+
const chainConfigurations = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.chainConfigurations;
|
|
103
|
+
const enabledChains = useMemo(() => chainConfigurations === null || chainConfigurations === void 0 ? void 0 : chainConfigurations.filter((c) => c.enabled), [chainConfigurations]);
|
|
104
|
+
const primaryChain = useMemo(() => enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.find((chain) => chain.primary), [enabledChains]);
|
|
105
|
+
const enabledChainNames = useMemo(() => enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.map((chain) => chain.name), [enabledChains]);
|
|
105
106
|
const automaticEmbeddedWalletCreationEnabled = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.automaticEmbeddedWalletCreation;
|
|
106
107
|
const automaticEmbeddedWalletCreationForExternalEnabled = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.automaticEmbeddedWalletCreationForExternal;
|
|
107
108
|
const defaultWalletVersion = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.defaultWalletVersion;
|
|
108
109
|
const dynamicWaasIsEnabled = defaultWalletVersion === EmbeddedWalletVersionEnum.V3;
|
|
109
|
-
const svmGasSponsorshipEnabled = (
|
|
110
|
+
const svmGasSponsorshipEnabled = (_e = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.svmGasSponsorshipEnabled) !== null && _e !== void 0 ? _e : false;
|
|
110
111
|
const svmGasSponsorshipEnabledRef = useRef(svmGasSponsorshipEnabled);
|
|
111
112
|
svmGasSponsorshipEnabledRef.current = svmGasSponsorshipEnabled;
|
|
112
113
|
const authToken = getMinAuthToken();
|
|
@@ -171,7 +172,7 @@ const useDynamicWaas = () => {
|
|
|
171
172
|
}, [
|
|
172
173
|
user === null || user === void 0 ? void 0 : user.id,
|
|
173
174
|
user === null || user === void 0 ? void 0 : user.sessionId,
|
|
174
|
-
(
|
|
175
|
+
(_f = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _f === void 0 ? void 0 : _f.length,
|
|
175
176
|
dynamicWaasIsEnabled,
|
|
176
177
|
enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.length,
|
|
177
178
|
walletConnectorOptions.length,
|
|
@@ -455,7 +456,7 @@ const useDynamicWaas = () => {
|
|
|
455
456
|
automaticEmbeddedWalletCreationForExternalEnabled,
|
|
456
457
|
enabledChainNames,
|
|
457
458
|
]);
|
|
458
|
-
const importPrivateKey = (
|
|
459
|
+
const importPrivateKey = (_g) => __awaiter(void 0, [_g], void 0, function* ({ chainName, privateKey, addressType, legacyWalletId, password, }) {
|
|
459
460
|
const walletConnector = getWaasWalletConnector(chainName);
|
|
460
461
|
if (!walletConnector)
|
|
461
462
|
return;
|
|
@@ -468,7 +469,7 @@ const useDynamicWaas = () => {
|
|
|
468
469
|
});
|
|
469
470
|
yield refresh();
|
|
470
471
|
});
|
|
471
|
-
const upgradeToDynamicWaas = useCallback((
|
|
472
|
+
const upgradeToDynamicWaas = useCallback((_h) => __awaiter(void 0, [_h], void 0, function* ({ privateKey, wallet, password, }) {
|
|
472
473
|
isUpgrading.current = true;
|
|
473
474
|
if (!wallet) {
|
|
474
475
|
throw new DynamicError('Wallet to upgrade was not provided');
|
|
@@ -548,14 +549,14 @@ const useDynamicWaas = () => {
|
|
|
548
549
|
VerifiedCredentialNameToChainEnum[cred.chain]);
|
|
549
550
|
}, [user === null || user === void 0 ? void 0 : user.verifiedCredentials]);
|
|
550
551
|
const processSignOnWalletSettings = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
551
|
-
var
|
|
552
|
+
var _j;
|
|
552
553
|
if (!(user === null || user === void 0 ? void 0 : user.verifiedCredentials)) {
|
|
553
554
|
return;
|
|
554
555
|
}
|
|
555
556
|
const waasWallets = user.verifiedCredentials.filter((vc) => { var _a; return vc.walletName === 'dynamicwaas' && ((_a = vc.walletProperties) === null || _a === void 0 ? void 0 : _a.settings); });
|
|
556
557
|
for (const wallet of waasWallets) {
|
|
557
558
|
try {
|
|
558
|
-
const settings = (
|
|
559
|
+
const settings = (_j = wallet.walletProperties) === null || _j === void 0 ? void 0 : _j.settings;
|
|
559
560
|
const { address, chain } = wallet;
|
|
560
561
|
if (!settings || !address || !chain) {
|
|
561
562
|
continue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useReconcileInstalledWallets';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var walletOptions = require('../../../store/state/walletOptions/walletOptions.cjs');
|
|
8
|
+
|
|
9
|
+
// The wallet list's installed state is snapshotted once (in
|
|
10
|
+
// useCreateWalletConnectorOptions) and is otherwise only updated by
|
|
11
|
+
// providerReady events. On a typed/address-bar navigation a wallet extension
|
|
12
|
+
// (e.g. Backpack, Solflare) can inject its window provider just after that
|
|
13
|
+
// snapshot runs, so the connector is frozen as "not installed" with no event
|
|
14
|
+
// to recover it and only appears after a reload (DYNT-1074). Re-check the
|
|
15
|
+
// already-instantiated connectors for a short window after load and upgrade any
|
|
16
|
+
// that have since become installed.
|
|
17
|
+
const INSTALLED_WALLET_RECONCILE_INTERVAL_MS = 300;
|
|
18
|
+
const INSTALLED_WALLET_RECONCILE_DURATION_MS = 5000;
|
|
19
|
+
/**
|
|
20
|
+
* Polls the existing wallet connector options for a bounded window and upgrades
|
|
21
|
+
* any whose connector has become installed since the initial snapshot. This is
|
|
22
|
+
* upgrade-only (never downgrades), so a provider that momentarily fails to
|
|
23
|
+
* resolve cannot remove an already-installed wallet from the list.
|
|
24
|
+
*/
|
|
25
|
+
const useReconcileInstalledWallets = (enabled) => {
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
if (!enabled) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
const reconcileInstalledWallets = () => {
|
|
31
|
+
const options = walletOptions.getWalletConnectorOptions();
|
|
32
|
+
if (!options) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const upgradedOptions = options
|
|
36
|
+
.filter((option) => {
|
|
37
|
+
if (option.isInstalledOnBrowser) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
// isInstalledOnBrowser reads the window/registry fresh on each call,
|
|
42
|
+
// so this reflects providers injected after the initial snapshot.
|
|
43
|
+
return option.walletConnector.isInstalledOnBrowser();
|
|
44
|
+
}
|
|
45
|
+
catch (_a) {
|
|
46
|
+
// Third-party provider code may throw; treat as not installed.
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
.map((option) => (Object.assign(Object.assign({}, option), { isInstalledOnBrowser: true })));
|
|
51
|
+
if (upgradedOptions.length > 0) {
|
|
52
|
+
// mergeWalletConnectorOptions merges by key, so passing only the
|
|
53
|
+
// upgraded options is safe alongside concurrent providerReady updates.
|
|
54
|
+
walletOptions.mergeWalletConnectorOptions(upgradedOptions);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
reconcileInstalledWallets();
|
|
58
|
+
const intervalId = setInterval(reconcileInstalledWallets, INSTALLED_WALLET_RECONCILE_INTERVAL_MS);
|
|
59
|
+
const timeoutId = setTimeout(() => {
|
|
60
|
+
clearInterval(intervalId);
|
|
61
|
+
}, INSTALLED_WALLET_RECONCILE_DURATION_MS);
|
|
62
|
+
return () => {
|
|
63
|
+
clearInterval(intervalId);
|
|
64
|
+
clearTimeout(timeoutId);
|
|
65
|
+
};
|
|
66
|
+
}, [enabled]);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
exports.useReconcileInstalledWallets = useReconcileInstalledWallets;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polls the existing wallet connector options for a bounded window and upgrades
|
|
3
|
+
* any whose connector has become installed since the initial snapshot. This is
|
|
4
|
+
* upgrade-only (never downgrades), so a provider that momentarily fails to
|
|
5
|
+
* resolve cannot remove an already-installed wallet from the list.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useReconcileInstalledWallets: (enabled: boolean) => void;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { getWalletConnectorOptions, mergeWalletConnectorOptions } from '../../../store/state/walletOptions/walletOptions.js';
|
|
4
|
+
|
|
5
|
+
// The wallet list's installed state is snapshotted once (in
|
|
6
|
+
// useCreateWalletConnectorOptions) and is otherwise only updated by
|
|
7
|
+
// providerReady events. On a typed/address-bar navigation a wallet extension
|
|
8
|
+
// (e.g. Backpack, Solflare) can inject its window provider just after that
|
|
9
|
+
// snapshot runs, so the connector is frozen as "not installed" with no event
|
|
10
|
+
// to recover it and only appears after a reload (DYNT-1074). Re-check the
|
|
11
|
+
// already-instantiated connectors for a short window after load and upgrade any
|
|
12
|
+
// that have since become installed.
|
|
13
|
+
const INSTALLED_WALLET_RECONCILE_INTERVAL_MS = 300;
|
|
14
|
+
const INSTALLED_WALLET_RECONCILE_DURATION_MS = 5000;
|
|
15
|
+
/**
|
|
16
|
+
* Polls the existing wallet connector options for a bounded window and upgrades
|
|
17
|
+
* any whose connector has become installed since the initial snapshot. This is
|
|
18
|
+
* upgrade-only (never downgrades), so a provider that momentarily fails to
|
|
19
|
+
* resolve cannot remove an already-installed wallet from the list.
|
|
20
|
+
*/
|
|
21
|
+
const useReconcileInstalledWallets = (enabled) => {
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!enabled) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const reconcileInstalledWallets = () => {
|
|
27
|
+
const options = getWalletConnectorOptions();
|
|
28
|
+
if (!options) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const upgradedOptions = options
|
|
32
|
+
.filter((option) => {
|
|
33
|
+
if (option.isInstalledOnBrowser) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
// isInstalledOnBrowser reads the window/registry fresh on each call,
|
|
38
|
+
// so this reflects providers injected after the initial snapshot.
|
|
39
|
+
return option.walletConnector.isInstalledOnBrowser();
|
|
40
|
+
}
|
|
41
|
+
catch (_a) {
|
|
42
|
+
// Third-party provider code may throw; treat as not installed.
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
.map((option) => (Object.assign(Object.assign({}, option), { isInstalledOnBrowser: true })));
|
|
47
|
+
if (upgradedOptions.length > 0) {
|
|
48
|
+
// mergeWalletConnectorOptions merges by key, so passing only the
|
|
49
|
+
// upgraded options is safe alongside concurrent providerReady updates.
|
|
50
|
+
mergeWalletConnectorOptions(upgradedOptions);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
reconcileInstalledWallets();
|
|
54
|
+
const intervalId = setInterval(reconcileInstalledWallets, INSTALLED_WALLET_RECONCILE_INTERVAL_MS);
|
|
55
|
+
const timeoutId = setTimeout(() => {
|
|
56
|
+
clearInterval(intervalId);
|
|
57
|
+
}, INSTALLED_WALLET_RECONCILE_DURATION_MS);
|
|
58
|
+
return () => {
|
|
59
|
+
clearInterval(intervalId);
|
|
60
|
+
clearTimeout(timeoutId);
|
|
61
|
+
};
|
|
62
|
+
}, [enabled]);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export { useReconcileInstalledWallets };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var utils = require('@dynamic-labs/utils');
|
|
7
|
+
var index = require('../../functions/walletFilters/index.cjs');
|
|
8
|
+
var walletListBuilder = require('../../functions/walletListBuilder/walletListBuilder.cjs');
|
|
9
|
+
var getEffectiveRecommendedWallets = require('./utils/getEffectiveRecommendedWallets/getEffectiveRecommendedWallets.cjs');
|
|
10
|
+
var getEffectiveWalletFilter = require('./utils/getEffectiveWalletFilter/getEffectiveWalletFilter.cjs');
|
|
11
|
+
|
|
12
|
+
const buildWalletsList = ({ bridgeChainsToConnect, defaultNumberOfWalletsToShow, isWalletConnectList, lastUsedWalletKey, multiWallet, recommendedWallets, searchFilter, selectedTabSettings, userWallets, viewWalletsFilter, walletConnectorOptions, walletGroups, walletsFilter, }) => {
|
|
13
|
+
const getFilteredBridgeChains = (bridgeChainsToConnect === null || bridgeChainsToConnect === void 0 ? void 0 : bridgeChainsToConnect.length) &&
|
|
14
|
+
index.FilterBridgeChainsName(bridgeChainsToConnect[0].chain);
|
|
15
|
+
const filteredBridgeChains = getFilteredBridgeChains && getFilteredBridgeChains(walletConnectorOptions);
|
|
16
|
+
const effectiveRecommendedWallets = getEffectiveRecommendedWallets.getEffectiveRecommendedWallets(selectedTabSettings, recommendedWallets);
|
|
17
|
+
const effectiveWalletsFilter = getEffectiveWalletFilter.getEffectiveWalletFilter(selectedTabSettings, walletsFilter);
|
|
18
|
+
const { numberOfWallets, walletsList } = walletListBuilder.walletListBuilder({
|
|
19
|
+
groupWallets: true,
|
|
20
|
+
inputList: filteredBridgeChains || walletConnectorOptions,
|
|
21
|
+
isWalletConnectList,
|
|
22
|
+
lastUsedWalletKey,
|
|
23
|
+
multiWallet,
|
|
24
|
+
numberOfWalletsToShow: defaultNumberOfWalletsToShow,
|
|
25
|
+
recommendedWallets: effectiveRecommendedWallets,
|
|
26
|
+
searchFilter,
|
|
27
|
+
showMoreWalletsWithFilter: true,
|
|
28
|
+
userWallets,
|
|
29
|
+
walletGroups,
|
|
30
|
+
// use both filters if available, else use the viewWalletsFilter or effectiveWalletsFilter
|
|
31
|
+
walletsFilter: viewWalletsFilter && effectiveWalletsFilter
|
|
32
|
+
? utils.pipe(viewWalletsFilter).pipe(effectiveWalletsFilter)
|
|
33
|
+
: viewWalletsFilter || effectiveWalletsFilter,
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
numberOfWallets,
|
|
37
|
+
recommendedWallets: effectiveRecommendedWallets,
|
|
38
|
+
walletsList,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
exports.buildWalletsList = buildWalletsList;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IDynamicContext } from '../../../context/DynamicContext/types/IDynamicContext';
|
|
2
|
+
import type { useInternalUserWallets } from '../../../context/UserWalletsContext';
|
|
3
|
+
import { WalletGroups, WalletOption, WalletsFilter } from '../../../shared/types';
|
|
4
|
+
export type BuildWalletsListParams = Pick<IDynamicContext, 'bridgeChainsToConnect' | 'defaultNumberOfWalletsToShow' | 'multiWallet' | 'recommendedWallets' | 'selectedTabSettings' | 'walletsFilter'> & {
|
|
5
|
+
isWalletConnectList: boolean;
|
|
6
|
+
lastUsedWalletKey: string | undefined;
|
|
7
|
+
searchFilter: string | undefined;
|
|
8
|
+
userWallets: ReturnType<typeof useInternalUserWallets>['userWallets'];
|
|
9
|
+
viewWalletsFilter: WalletsFilter | undefined;
|
|
10
|
+
walletConnectorOptions: WalletOption[];
|
|
11
|
+
walletGroups: WalletGroups;
|
|
12
|
+
};
|
|
13
|
+
export declare const buildWalletsList: ({ bridgeChainsToConnect, defaultNumberOfWalletsToShow, isWalletConnectList, lastUsedWalletKey, multiWallet, recommendedWallets, searchFilter, selectedTabSettings, userWallets, viewWalletsFilter, walletConnectorOptions, walletGroups, walletsFilter, }: BuildWalletsListParams) => {
|
|
14
|
+
numberOfWallets: number;
|
|
15
|
+
recommendedWallets: import("../../../shared/types").RecommendedWallet[] | undefined;
|
|
16
|
+
walletsList: WalletOption[];
|
|
17
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { pipe } from '@dynamic-labs/utils';
|
|
3
|
+
import { FilterBridgeChainsName } from '../../functions/walletFilters/index.js';
|
|
4
|
+
import { walletListBuilder } from '../../functions/walletListBuilder/walletListBuilder.js';
|
|
5
|
+
import { getEffectiveRecommendedWallets } from './utils/getEffectiveRecommendedWallets/getEffectiveRecommendedWallets.js';
|
|
6
|
+
import { getEffectiveWalletFilter } from './utils/getEffectiveWalletFilter/getEffectiveWalletFilter.js';
|
|
7
|
+
|
|
8
|
+
const buildWalletsList = ({ bridgeChainsToConnect, defaultNumberOfWalletsToShow, isWalletConnectList, lastUsedWalletKey, multiWallet, recommendedWallets, searchFilter, selectedTabSettings, userWallets, viewWalletsFilter, walletConnectorOptions, walletGroups, walletsFilter, }) => {
|
|
9
|
+
const getFilteredBridgeChains = (bridgeChainsToConnect === null || bridgeChainsToConnect === void 0 ? void 0 : bridgeChainsToConnect.length) &&
|
|
10
|
+
FilterBridgeChainsName(bridgeChainsToConnect[0].chain);
|
|
11
|
+
const filteredBridgeChains = getFilteredBridgeChains && getFilteredBridgeChains(walletConnectorOptions);
|
|
12
|
+
const effectiveRecommendedWallets = getEffectiveRecommendedWallets(selectedTabSettings, recommendedWallets);
|
|
13
|
+
const effectiveWalletsFilter = getEffectiveWalletFilter(selectedTabSettings, walletsFilter);
|
|
14
|
+
const { numberOfWallets, walletsList } = walletListBuilder({
|
|
15
|
+
groupWallets: true,
|
|
16
|
+
inputList: filteredBridgeChains || walletConnectorOptions,
|
|
17
|
+
isWalletConnectList,
|
|
18
|
+
lastUsedWalletKey,
|
|
19
|
+
multiWallet,
|
|
20
|
+
numberOfWalletsToShow: defaultNumberOfWalletsToShow,
|
|
21
|
+
recommendedWallets: effectiveRecommendedWallets,
|
|
22
|
+
searchFilter,
|
|
23
|
+
showMoreWalletsWithFilter: true,
|
|
24
|
+
userWallets,
|
|
25
|
+
walletGroups,
|
|
26
|
+
// use both filters if available, else use the viewWalletsFilter or effectiveWalletsFilter
|
|
27
|
+
walletsFilter: viewWalletsFilter && effectiveWalletsFilter
|
|
28
|
+
? pipe(viewWalletsFilter).pipe(effectiveWalletsFilter)
|
|
29
|
+
: viewWalletsFilter || effectiveWalletsFilter,
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
numberOfWallets,
|
|
33
|
+
recommendedWallets: effectiveRecommendedWallets,
|
|
34
|
+
walletsList,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { buildWalletsList };
|
|
@@ -3,47 +3,48 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var React = require('react');
|
|
7
7
|
require('../../../context/DynamicContext/useDynamicContext/useDynamicContext.cjs');
|
|
8
8
|
var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
9
9
|
var UserWalletsContext = require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
10
10
|
var walletOptions = require('../../../store/state/walletOptions/walletOptions.cjs');
|
|
11
|
-
var
|
|
12
|
-
var walletListBuilder = require('../../functions/walletListBuilder/walletListBuilder.cjs');
|
|
13
|
-
var getEffectiveRecommendedWallets = require('./utils/getEffectiveRecommendedWallets/getEffectiveRecommendedWallets.cjs');
|
|
14
|
-
var getEffectiveWalletFilter = require('./utils/getEffectiveWalletFilter/getEffectiveWalletFilter.cjs');
|
|
11
|
+
var buildWalletsList = require('./buildWalletsList.cjs');
|
|
15
12
|
|
|
16
13
|
const useWalletList = ({ isWalletConnectList = false, viewWalletsFilter, searchFilter, lastUsedWalletKey, }) => {
|
|
17
14
|
const { walletsFilter, walletConnectorOptions, defaultNumberOfWalletsToShow, bridgeChainsToConnect, multiWallet, recommendedWallets, selectedTabSettings, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
18
15
|
const { userWallets } = UserWalletsContext.useInternalUserWallets();
|
|
19
16
|
const walletGroups = walletOptions.useWalletGroups();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const { numberOfWallets, walletsList } = walletListBuilder.walletListBuilder({
|
|
26
|
-
groupWallets: true,
|
|
27
|
-
inputList: filteredBridgeChains || walletConnectorOptions,
|
|
17
|
+
// Run the heavy list build once per real input change, not on every render —
|
|
18
|
+
// a modal close animation re-renders this hundreds of times.
|
|
19
|
+
return React.useMemo(() => buildWalletsList.buildWalletsList({
|
|
20
|
+
bridgeChainsToConnect,
|
|
21
|
+
defaultNumberOfWalletsToShow,
|
|
28
22
|
isWalletConnectList,
|
|
29
23
|
lastUsedWalletKey,
|
|
30
24
|
multiWallet,
|
|
31
|
-
|
|
32
|
-
recommendedWallets: effectiveRecommendedWallets,
|
|
25
|
+
recommendedWallets,
|
|
33
26
|
searchFilter,
|
|
34
|
-
|
|
27
|
+
selectedTabSettings,
|
|
35
28
|
userWallets,
|
|
29
|
+
viewWalletsFilter,
|
|
30
|
+
walletConnectorOptions,
|
|
36
31
|
walletGroups,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
recommendedWallets
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
walletsFilter,
|
|
33
|
+
}), [
|
|
34
|
+
bridgeChainsToConnect,
|
|
35
|
+
defaultNumberOfWalletsToShow,
|
|
36
|
+
isWalletConnectList,
|
|
37
|
+
lastUsedWalletKey,
|
|
38
|
+
multiWallet,
|
|
39
|
+
recommendedWallets,
|
|
40
|
+
searchFilter,
|
|
41
|
+
selectedTabSettings,
|
|
42
|
+
userWallets,
|
|
43
|
+
viewWalletsFilter,
|
|
44
|
+
walletConnectorOptions,
|
|
45
|
+
walletGroups,
|
|
46
|
+
walletsFilter,
|
|
47
|
+
]);
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
exports.useWalletList = useWalletList;
|
|
@@ -1,45 +1,46 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import {
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
3
|
import '../../../context/DynamicContext/useDynamicContext/useDynamicContext.js';
|
|
4
4
|
import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
5
5
|
import { useInternalUserWallets } from '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
6
6
|
import { useWalletGroups } from '../../../store/state/walletOptions/walletOptions.js';
|
|
7
|
-
import {
|
|
8
|
-
import { walletListBuilder } from '../../functions/walletListBuilder/walletListBuilder.js';
|
|
9
|
-
import { getEffectiveRecommendedWallets } from './utils/getEffectiveRecommendedWallets/getEffectiveRecommendedWallets.js';
|
|
10
|
-
import { getEffectiveWalletFilter } from './utils/getEffectiveWalletFilter/getEffectiveWalletFilter.js';
|
|
7
|
+
import { buildWalletsList } from './buildWalletsList.js';
|
|
11
8
|
|
|
12
9
|
const useWalletList = ({ isWalletConnectList = false, viewWalletsFilter, searchFilter, lastUsedWalletKey, }) => {
|
|
13
10
|
const { walletsFilter, walletConnectorOptions, defaultNumberOfWalletsToShow, bridgeChainsToConnect, multiWallet, recommendedWallets, selectedTabSettings, } = useInternalDynamicContext();
|
|
14
11
|
const { userWallets } = useInternalUserWallets();
|
|
15
12
|
const walletGroups = useWalletGroups();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const { numberOfWallets, walletsList } = walletListBuilder({
|
|
22
|
-
groupWallets: true,
|
|
23
|
-
inputList: filteredBridgeChains || walletConnectorOptions,
|
|
13
|
+
// Run the heavy list build once per real input change, not on every render —
|
|
14
|
+
// a modal close animation re-renders this hundreds of times.
|
|
15
|
+
return useMemo(() => buildWalletsList({
|
|
16
|
+
bridgeChainsToConnect,
|
|
17
|
+
defaultNumberOfWalletsToShow,
|
|
24
18
|
isWalletConnectList,
|
|
25
19
|
lastUsedWalletKey,
|
|
26
20
|
multiWallet,
|
|
27
|
-
|
|
28
|
-
recommendedWallets: effectiveRecommendedWallets,
|
|
21
|
+
recommendedWallets,
|
|
29
22
|
searchFilter,
|
|
30
|
-
|
|
23
|
+
selectedTabSettings,
|
|
31
24
|
userWallets,
|
|
25
|
+
viewWalletsFilter,
|
|
26
|
+
walletConnectorOptions,
|
|
32
27
|
walletGroups,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
recommendedWallets
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
walletsFilter,
|
|
29
|
+
}), [
|
|
30
|
+
bridgeChainsToConnect,
|
|
31
|
+
defaultNumberOfWalletsToShow,
|
|
32
|
+
isWalletConnectList,
|
|
33
|
+
lastUsedWalletKey,
|
|
34
|
+
multiWallet,
|
|
35
|
+
recommendedWallets,
|
|
36
|
+
searchFilter,
|
|
37
|
+
selectedTabSettings,
|
|
38
|
+
userWallets,
|
|
39
|
+
viewWalletsFilter,
|
|
40
|
+
walletConnectorOptions,
|
|
41
|
+
walletGroups,
|
|
42
|
+
walletsFilter,
|
|
43
|
+
]);
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
export { useWalletList };
|
|
@@ -10,7 +10,6 @@ var reactI18next = require('react-i18next');
|
|
|
10
10
|
var bs58 = require('bs58');
|
|
11
11
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
12
12
|
var utils = require('@dynamic-labs/utils');
|
|
13
|
-
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
14
13
|
require('../../context/DynamicContext/useDynamicContext/useDynamicContext.cjs');
|
|
15
14
|
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
16
15
|
require('../../events/dynamicEvents.cjs');
|
|
@@ -22,6 +21,7 @@ var logger = require('../../shared/logger.cjs');
|
|
|
22
21
|
require('@dynamic-labs/wallet-book');
|
|
23
22
|
require('../../utils/constants/colors.cjs');
|
|
24
23
|
require('../../utils/constants/values.cjs');
|
|
24
|
+
require('@dynamic-labs/sdk-api-core');
|
|
25
25
|
require('../../shared/consts/index.cjs');
|
|
26
26
|
require('@dynamic-labs/multi-wallet');
|
|
27
27
|
require('react-international-phone');
|
|
@@ -138,6 +138,12 @@ var SimulationStatus;
|
|
|
138
138
|
const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation, onClickBack, walletConnector, onClickClose, title, displayPoweredByDynamicFooter = false, copykey, hideModal, currentToken, isNativeToken, transactionValue, isModal, sendBalanceTransaction, }) => {
|
|
139
139
|
var _a, _b, _c;
|
|
140
140
|
const { primaryWallet, environmentId } = useInternalDynamicContext.useInternalDynamicContext();
|
|
141
|
+
// The connector that is actually signing this transaction. A transaction can
|
|
142
|
+
// be sent from a non-primary wallet (e.g. an EVM wallet while the primary
|
|
143
|
+
// wallet is BTC), so chain, key and simulation must be derived from this
|
|
144
|
+
// connector and never from primaryWallet, which would resolve the wrong
|
|
145
|
+
// chain/wallet and fail simulation.
|
|
146
|
+
const activeConnector = walletConnector !== null && walletConnector !== void 0 ? walletConnector : primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
141
147
|
const projectSettings = useProjectSettings.useProjectSettings();
|
|
142
148
|
const svmGasSponsorshipEnabled = (_c = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.svmGasSponsorshipEnabled) !== null && _c !== void 0 ? _c : false;
|
|
143
149
|
const [isGasSponsored, setIsGasSponsored] = React.useState(false);
|
|
@@ -147,12 +153,12 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
147
153
|
const { currency } = useFetchCurrency.useFetchCurrency(walletConnector);
|
|
148
154
|
// Update the chainId access to handle undefined case
|
|
149
155
|
const chainId = React.useMemo(() => {
|
|
150
|
-
if (!
|
|
156
|
+
if (!activeConnector) {
|
|
151
157
|
return undefined;
|
|
152
158
|
}
|
|
153
|
-
const connector =
|
|
159
|
+
const connector = activeConnector;
|
|
154
160
|
return connector._selectedChainId || connector.lastUsedChainId;
|
|
155
|
-
}, [
|
|
161
|
+
}, [activeConnector]);
|
|
156
162
|
const [simulationState, setSimulationState] = React.useState({
|
|
157
163
|
status: SimulationStatus.LOADING,
|
|
158
164
|
});
|
|
@@ -161,7 +167,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
161
167
|
const [preSubmitValidationError, setPreSubmitValidationError] = React.useState(undefined);
|
|
162
168
|
const isFetchingSimulationRef = React.useRef(false);
|
|
163
169
|
const fetchSimulationResult = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
164
|
-
var _d, _e, _f, _g, _h, _j
|
|
170
|
+
var _d, _e, _f, _g, _h, _j;
|
|
165
171
|
if (simulationState.status !== SimulationStatus.LOADING) {
|
|
166
172
|
return;
|
|
167
173
|
}
|
|
@@ -175,14 +181,14 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
175
181
|
isFetchingSimulationRef.current = false;
|
|
176
182
|
return;
|
|
177
183
|
}
|
|
178
|
-
if (!
|
|
184
|
+
if (!activeConnector ||
|
|
179
185
|
(!chainId &&
|
|
180
|
-
|
|
181
|
-
|
|
186
|
+
activeConnector.connectedChain !== 'SOL' &&
|
|
187
|
+
activeConnector.connectedChain !== 'TON')) {
|
|
182
188
|
logger.logger.error('[TransactionConfirmationView] Simulation failed:', {
|
|
183
|
-
chain:
|
|
189
|
+
chain: activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.connectedChain,
|
|
184
190
|
chainId,
|
|
185
|
-
|
|
191
|
+
walletConnector: activeConnector,
|
|
186
192
|
});
|
|
187
193
|
setSimulationState({ status: SimulationStatus.FAILED });
|
|
188
194
|
isFetchingSimulationRef.current = false;
|
|
@@ -190,8 +196,8 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
190
196
|
}
|
|
191
197
|
try {
|
|
192
198
|
let result;
|
|
193
|
-
if (
|
|
194
|
-
const connector =
|
|
199
|
+
if (activeConnector.key === 'zerodev') {
|
|
200
|
+
const connector = activeConnector;
|
|
195
201
|
const { userOperation, sponsored } = yield connector.getCurrentUserOperation(transaction);
|
|
196
202
|
setIsGasSponsored(sponsored);
|
|
197
203
|
setIsGasSponsoredLoading(false);
|
|
@@ -252,7 +258,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
252
258
|
return;
|
|
253
259
|
}
|
|
254
260
|
}
|
|
255
|
-
if (!result &&
|
|
261
|
+
if (!result && activeConnector.key !== 'zerodev') {
|
|
256
262
|
logger.logger.warn('[TransactionConfirmationView] Simulation failed: No result');
|
|
257
263
|
setSimulationState({ status: SimulationStatus.FAILED });
|
|
258
264
|
return;
|
|
@@ -271,7 +277,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
271
277
|
}), [
|
|
272
278
|
sendBalanceTransaction,
|
|
273
279
|
hideModal,
|
|
274
|
-
|
|
280
|
+
activeConnector,
|
|
275
281
|
chainId,
|
|
276
282
|
environmentId,
|
|
277
283
|
transaction,
|
|
@@ -285,7 +291,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
285
291
|
return;
|
|
286
292
|
}
|
|
287
293
|
fetchSimulationResult();
|
|
288
|
-
}, [fetchSimulationResult,
|
|
294
|
+
}, [fetchSimulationResult, activeConnector, simulationState.status]);
|
|
289
295
|
// Check destination account for chains that require it (e.g., Stellar)
|
|
290
296
|
React.useEffect(() => {
|
|
291
297
|
const checkDestination = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -303,10 +309,9 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
303
309
|
* to reflect the new fee on the UI
|
|
304
310
|
*/
|
|
305
311
|
const fetchTransactionFee = React.useCallback(() => {
|
|
306
|
-
|
|
307
|
-
if (((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain) === sdkApiCore.ChainEnum.Sol &&
|
|
312
|
+
if (((activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.connectedChain) === 'SOL' &&
|
|
308
313
|
transaction.fee.gas !== undefined) ||
|
|
309
|
-
(
|
|
314
|
+
(activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.key) === 'zerodev') {
|
|
310
315
|
return;
|
|
311
316
|
}
|
|
312
317
|
if (transaction.fetchFee) {
|
|
@@ -331,7 +336,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
331
336
|
});
|
|
332
337
|
}
|
|
333
338
|
}
|
|
334
|
-
}, [
|
|
339
|
+
}, [activeConnector, transaction, update]);
|
|
335
340
|
React.useEffect(() => {
|
|
336
341
|
// If SVM gas sponsorship is enabled in project settings, treat as sponsored
|
|
337
342
|
// before the fee payer is actually replaced (which happens at send time)
|
|
@@ -489,7 +494,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
489
494
|
transactionSignature: transactionSignatureForLink,
|
|
490
495
|
transactionValue,
|
|
491
496
|
walletConnector,
|
|
492
|
-
walletKey: (
|
|
497
|
+
walletKey: (activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.key) || '',
|
|
493
498
|
});
|
|
494
499
|
}, [
|
|
495
500
|
total,
|
|
@@ -513,7 +518,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
513
518
|
transaction,
|
|
514
519
|
isGasSponsored,
|
|
515
520
|
isGasSponsoredLoading,
|
|
516
|
-
|
|
521
|
+
activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.key,
|
|
517
522
|
simulationState.result,
|
|
518
523
|
sendBalanceTransaction,
|
|
519
524
|
fetchTransactionFee,
|
|
@@ -6,7 +6,6 @@ import { useTranslation } from 'react-i18next';
|
|
|
6
6
|
import bs58 from 'bs58';
|
|
7
7
|
import { isAccountAbstractionConnector } from '@dynamic-labs/wallet-connector-core';
|
|
8
8
|
import { TransactionGasCannotBeSponsoredError } from '@dynamic-labs/utils';
|
|
9
|
-
import { ChainEnum } from '@dynamic-labs/sdk-api-core';
|
|
10
9
|
import '../../context/DynamicContext/useDynamicContext/useDynamicContext.js';
|
|
11
10
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
12
11
|
import '../../events/dynamicEvents.js';
|
|
@@ -18,6 +17,7 @@ import { logger } from '../../shared/logger.js';
|
|
|
18
17
|
import '@dynamic-labs/wallet-book';
|
|
19
18
|
import '../../utils/constants/colors.js';
|
|
20
19
|
import '../../utils/constants/values.js';
|
|
20
|
+
import '@dynamic-labs/sdk-api-core';
|
|
21
21
|
import '../../shared/consts/index.js';
|
|
22
22
|
import '@dynamic-labs/multi-wallet';
|
|
23
23
|
import 'react-international-phone';
|
|
@@ -130,6 +130,12 @@ var SimulationStatus;
|
|
|
130
130
|
const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation, onClickBack, walletConnector, onClickClose, title, displayPoweredByDynamicFooter = false, copykey, hideModal, currentToken, isNativeToken, transactionValue, isModal, sendBalanceTransaction, }) => {
|
|
131
131
|
var _a, _b, _c;
|
|
132
132
|
const { primaryWallet, environmentId } = useInternalDynamicContext();
|
|
133
|
+
// The connector that is actually signing this transaction. A transaction can
|
|
134
|
+
// be sent from a non-primary wallet (e.g. an EVM wallet while the primary
|
|
135
|
+
// wallet is BTC), so chain, key and simulation must be derived from this
|
|
136
|
+
// connector and never from primaryWallet, which would resolve the wrong
|
|
137
|
+
// chain/wallet and fail simulation.
|
|
138
|
+
const activeConnector = walletConnector !== null && walletConnector !== void 0 ? walletConnector : primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
133
139
|
const projectSettings = useProjectSettings();
|
|
134
140
|
const svmGasSponsorshipEnabled = (_c = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.svmGasSponsorshipEnabled) !== null && _c !== void 0 ? _c : false;
|
|
135
141
|
const [isGasSponsored, setIsGasSponsored] = useState(false);
|
|
@@ -139,12 +145,12 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
139
145
|
const { currency } = useFetchCurrency(walletConnector);
|
|
140
146
|
// Update the chainId access to handle undefined case
|
|
141
147
|
const chainId = useMemo(() => {
|
|
142
|
-
if (!
|
|
148
|
+
if (!activeConnector) {
|
|
143
149
|
return undefined;
|
|
144
150
|
}
|
|
145
|
-
const connector =
|
|
151
|
+
const connector = activeConnector;
|
|
146
152
|
return connector._selectedChainId || connector.lastUsedChainId;
|
|
147
|
-
}, [
|
|
153
|
+
}, [activeConnector]);
|
|
148
154
|
const [simulationState, setSimulationState] = useState({
|
|
149
155
|
status: SimulationStatus.LOADING,
|
|
150
156
|
});
|
|
@@ -153,7 +159,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
153
159
|
const [preSubmitValidationError, setPreSubmitValidationError] = useState(undefined);
|
|
154
160
|
const isFetchingSimulationRef = useRef(false);
|
|
155
161
|
const fetchSimulationResult = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
156
|
-
var _d, _e, _f, _g, _h, _j
|
|
162
|
+
var _d, _e, _f, _g, _h, _j;
|
|
157
163
|
if (simulationState.status !== SimulationStatus.LOADING) {
|
|
158
164
|
return;
|
|
159
165
|
}
|
|
@@ -167,14 +173,14 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
167
173
|
isFetchingSimulationRef.current = false;
|
|
168
174
|
return;
|
|
169
175
|
}
|
|
170
|
-
if (!
|
|
176
|
+
if (!activeConnector ||
|
|
171
177
|
(!chainId &&
|
|
172
|
-
|
|
173
|
-
|
|
178
|
+
activeConnector.connectedChain !== 'SOL' &&
|
|
179
|
+
activeConnector.connectedChain !== 'TON')) {
|
|
174
180
|
logger.error('[TransactionConfirmationView] Simulation failed:', {
|
|
175
|
-
chain:
|
|
181
|
+
chain: activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.connectedChain,
|
|
176
182
|
chainId,
|
|
177
|
-
|
|
183
|
+
walletConnector: activeConnector,
|
|
178
184
|
});
|
|
179
185
|
setSimulationState({ status: SimulationStatus.FAILED });
|
|
180
186
|
isFetchingSimulationRef.current = false;
|
|
@@ -182,8 +188,8 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
182
188
|
}
|
|
183
189
|
try {
|
|
184
190
|
let result;
|
|
185
|
-
if (
|
|
186
|
-
const connector =
|
|
191
|
+
if (activeConnector.key === 'zerodev') {
|
|
192
|
+
const connector = activeConnector;
|
|
187
193
|
const { userOperation, sponsored } = yield connector.getCurrentUserOperation(transaction);
|
|
188
194
|
setIsGasSponsored(sponsored);
|
|
189
195
|
setIsGasSponsoredLoading(false);
|
|
@@ -244,7 +250,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
244
250
|
return;
|
|
245
251
|
}
|
|
246
252
|
}
|
|
247
|
-
if (!result &&
|
|
253
|
+
if (!result && activeConnector.key !== 'zerodev') {
|
|
248
254
|
logger.warn('[TransactionConfirmationView] Simulation failed: No result');
|
|
249
255
|
setSimulationState({ status: SimulationStatus.FAILED });
|
|
250
256
|
return;
|
|
@@ -263,7 +269,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
263
269
|
}), [
|
|
264
270
|
sendBalanceTransaction,
|
|
265
271
|
hideModal,
|
|
266
|
-
|
|
272
|
+
activeConnector,
|
|
267
273
|
chainId,
|
|
268
274
|
environmentId,
|
|
269
275
|
transaction,
|
|
@@ -277,7 +283,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
277
283
|
return;
|
|
278
284
|
}
|
|
279
285
|
fetchSimulationResult();
|
|
280
|
-
}, [fetchSimulationResult,
|
|
286
|
+
}, [fetchSimulationResult, activeConnector, simulationState.status]);
|
|
281
287
|
// Check destination account for chains that require it (e.g., Stellar)
|
|
282
288
|
useEffect(() => {
|
|
283
289
|
const checkDestination = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -295,10 +301,9 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
295
301
|
* to reflect the new fee on the UI
|
|
296
302
|
*/
|
|
297
303
|
const fetchTransactionFee = useCallback(() => {
|
|
298
|
-
|
|
299
|
-
if (((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain) === ChainEnum.Sol &&
|
|
304
|
+
if (((activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.connectedChain) === 'SOL' &&
|
|
300
305
|
transaction.fee.gas !== undefined) ||
|
|
301
|
-
(
|
|
306
|
+
(activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.key) === 'zerodev') {
|
|
302
307
|
return;
|
|
303
308
|
}
|
|
304
309
|
if (transaction.fetchFee) {
|
|
@@ -323,7 +328,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
323
328
|
});
|
|
324
329
|
}
|
|
325
330
|
}
|
|
326
|
-
}, [
|
|
331
|
+
}, [activeConnector, transaction, update]);
|
|
327
332
|
useEffect(() => {
|
|
328
333
|
// If SVM gas sponsorship is enabled in project settings, treat as sponsored
|
|
329
334
|
// before the fee payer is actually replaced (which happens at send time)
|
|
@@ -481,7 +486,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
481
486
|
transactionSignature: transactionSignatureForLink,
|
|
482
487
|
transactionValue,
|
|
483
488
|
walletConnector,
|
|
484
|
-
walletKey: (
|
|
489
|
+
walletKey: (activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.key) || '',
|
|
485
490
|
});
|
|
486
491
|
}, [
|
|
487
492
|
total,
|
|
@@ -505,7 +510,7 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
|
|
|
505
510
|
transaction,
|
|
506
511
|
isGasSponsored,
|
|
507
512
|
isGasSponsoredLoading,
|
|
508
|
-
|
|
513
|
+
activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.key,
|
|
509
514
|
simulationState.result,
|
|
510
515
|
sendBalanceTransaction,
|
|
511
516
|
fetchTransactionFee,
|