@reown/appkit-react-native 0.0.1 → 2.0.0
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/lib/commonjs/AppKit.js +105 -52
- package/lib/commonjs/AppKit.js.map +1 -1
- package/lib/commonjs/client.js +0 -4
- package/lib/commonjs/client.js.map +1 -1
- package/lib/commonjs/connectors/WalletConnectConnector.js +37 -24
- package/lib/commonjs/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/commonjs/hooks/useAccount.js +5 -2
- package/lib/commonjs/hooks/useAccount.js.map +1 -1
- package/lib/commonjs/hooks/useAppKit.js +7 -1
- package/lib/commonjs/hooks/useAppKit.js.map +1 -1
- package/lib/commonjs/hooks/useAppKitEvents.js +4 -12
- package/lib/commonjs/hooks/useAppKitEvents.js.map +1 -1
- package/lib/commonjs/hooks/useProvider.js +14 -4
- package/lib/commonjs/hooks/useProvider.js.map +1 -1
- package/lib/commonjs/hooks/useWalletInfo.js +2 -6
- package/lib/commonjs/hooks/useWalletInfo.js.map +1 -1
- package/lib/commonjs/index.js +37 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-modal/index.js +9 -4
- package/lib/commonjs/modal/w3m-modal/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-activity/index.js +9 -0
- package/lib/commonjs/partials/w3m-account-activity/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-wallet-features/index.js +15 -16
- package/lib/commonjs/partials/w3m-account-wallet-features/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-send-input-token/index.js +1 -1
- package/lib/commonjs/partials/w3m-send-input-token/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-swap-details/index.js +1 -1
- package/lib/commonjs/partials/w3m-swap-details/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-swap-input/index.js +1 -1
- package/lib/commonjs/utils/HelpersUtil.js +5 -9
- package/lib/commonjs/utils/HelpersUtil.js.map +1 -1
- package/lib/commonjs/utils/NetworkUtil.js +22 -19
- package/lib/commonjs/utils/NetworkUtil.js.map +1 -1
- package/lib/commonjs/utils/UiUtil.js +5 -4
- package/lib/commonjs/utils/UiUtil.js.map +1 -1
- package/lib/commonjs/views/w3m-account-default-view/index.js +17 -18
- package/lib/commonjs/views/w3m-account-default-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connect-view/index.js +1 -0
- package/lib/commonjs/views/w3m-connect-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-view/index.js +10 -4
- package/lib/commonjs/views/w3m-connecting-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-preview-view/index.js +3 -3
- package/lib/commonjs/views/w3m-swap-preview-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/index.js +7 -2
- package/lib/commonjs/views/w3m-swap-view/index.js.map +1 -1
- package/lib/module/AppKit.js +106 -52
- package/lib/module/AppKit.js.map +1 -1
- package/lib/module/client.js +0 -4
- package/lib/module/client.js.map +1 -1
- package/lib/module/connectors/WalletConnectConnector.js +37 -24
- package/lib/module/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/module/hooks/useAccount.js +5 -2
- package/lib/module/hooks/useAccount.js.map +1 -1
- package/lib/module/hooks/useAppKit.js +7 -1
- package/lib/module/hooks/useAppKit.js.map +1 -1
- package/lib/module/hooks/useAppKitEvents.js +5 -13
- package/lib/module/hooks/useAppKitEvents.js.map +1 -1
- package/lib/module/hooks/useProvider.js +14 -4
- package/lib/module/hooks/useProvider.js.map +1 -1
- package/lib/module/hooks/useWalletInfo.js +3 -7
- package/lib/module/hooks/useWalletInfo.js.map +1 -1
- package/lib/module/index.js +4 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/modal/w3m-modal/index.js +9 -4
- package/lib/module/modal/w3m-modal/index.js.map +1 -1
- package/lib/module/partials/w3m-account-activity/index.js +10 -1
- package/lib/module/partials/w3m-account-activity/index.js.map +1 -1
- package/lib/module/partials/w3m-account-wallet-features/index.js +16 -17
- package/lib/module/partials/w3m-account-wallet-features/index.js.map +1 -1
- package/lib/module/partials/w3m-send-input-token/index.js +1 -1
- package/lib/module/partials/w3m-send-input-token/index.js.map +1 -1
- package/lib/module/partials/w3m-swap-details/index.js +2 -2
- package/lib/module/partials/w3m-swap-details/index.js.map +1 -1
- package/lib/module/partials/w3m-swap-input/index.js +1 -1
- package/lib/module/utils/HelpersUtil.js +1 -5
- package/lib/module/utils/HelpersUtil.js.map +1 -1
- package/lib/module/utils/NetworkUtil.js +22 -19
- package/lib/module/utils/NetworkUtil.js.map +1 -1
- package/lib/module/utils/UiUtil.js +5 -4
- package/lib/module/utils/UiUtil.js.map +1 -1
- package/lib/module/views/w3m-account-default-view/index.js +17 -18
- package/lib/module/views/w3m-account-default-view/index.js.map +1 -1
- package/lib/module/views/w3m-connect-view/index.js +1 -0
- package/lib/module/views/w3m-connect-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-view/index.js +10 -4
- package/lib/module/views/w3m-connecting-view/index.js.map +1 -1
- package/lib/module/views/w3m-swap-preview-view/index.js +3 -3
- package/lib/module/views/w3m-swap-preview-view/index.js.map +1 -1
- package/lib/module/views/w3m-swap-view/index.js +8 -3
- package/lib/module/views/w3m-swap-view/index.js.map +1 -1
- package/lib/typescript/AppKit.d.ts +11 -7
- package/lib/typescript/AppKit.d.ts.map +1 -1
- package/lib/typescript/AppKitContext.d.ts +1 -1
- package/lib/typescript/client.d.ts.map +1 -1
- package/lib/typescript/connectors/WalletConnectConnector.d.ts +11 -13
- package/lib/typescript/connectors/WalletConnectConnector.d.ts.map +1 -1
- package/lib/typescript/hooks/useAccount.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKit.d.ts +1 -0
- package/lib/typescript/hooks/useAppKit.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKitEvents.d.ts.map +1 -1
- package/lib/typescript/hooks/useProvider.d.ts +7 -2
- package/lib/typescript/hooks/useProvider.d.ts.map +1 -1
- package/lib/typescript/hooks/useWalletInfo.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +4 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-modal/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-account-activity/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-account-wallet-features/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-swap-details/index.d.ts.map +1 -1
- package/lib/typescript/utils/HelpersUtil.d.ts.map +1 -1
- package/lib/typescript/utils/NetworkUtil.d.ts +3 -2
- package/lib/typescript/utils/NetworkUtil.d.ts.map +1 -1
- package/lib/typescript/utils/UiUtil.d.ts +1 -2
- package/lib/typescript/utils/UiUtil.d.ts.map +1 -1
- package/lib/typescript/views/w3m-account-default-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connect-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connecting-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-preview-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/index.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/AppKit.ts +135 -55
- package/src/client.ts +0 -5
- package/src/connectors/WalletConnectConnector.ts +58 -33
- package/src/hooks/useAccount.ts +5 -2
- package/src/hooks/useAppKit.ts +7 -1
- package/src/hooks/useAppKitEvents.ts +3 -10
- package/src/hooks/useProvider.ts +16 -6
- package/src/hooks/useWalletInfo.ts +3 -6
- package/src/index.ts +7 -1
- package/src/modal/w3m-modal/index.tsx +7 -4
- package/src/partials/w3m-account-activity/index.tsx +15 -0
- package/src/partials/w3m-account-wallet-features/index.tsx +17 -20
- package/src/partials/w3m-send-input-token/index.tsx +1 -1
- package/src/partials/w3m-swap-details/index.tsx +6 -2
- package/src/partials/w3m-swap-input/index.tsx +1 -1
- package/src/utils/HelpersUtil.ts +1 -5
- package/src/utils/NetworkUtil.ts +25 -25
- package/src/utils/UiUtil.ts +5 -11
- package/src/views/w3m-account-default-view/index.tsx +25 -21
- package/src/views/w3m-connect-view/index.tsx +1 -0
- package/src/views/w3m-connecting-view/index.tsx +10 -4
- package/src/views/w3m-swap-preview-view/index.tsx +6 -3
- package/src/views/w3m-swap-view/index.tsx +9 -5
- package/CHANGELOG.md +0 -153
- package/lib/commonjs/networks/bitcoin.js +0 -40
- package/lib/commonjs/networks/bitcoin.js.map +0 -1
- package/lib/commonjs/networks/index.js +0 -28
- package/lib/commonjs/networks/index.js.map +0 -1
- package/lib/commonjs/networks/solana.js +0 -78
- package/lib/commonjs/networks/solana.js.map +0 -1
- package/lib/module/networks/bitcoin.js +0 -34
- package/lib/module/networks/bitcoin.js.map +0 -1
- package/lib/module/networks/index.js +0 -6
- package/lib/module/networks/index.js.map +0 -1
- package/lib/module/networks/solana.js +0 -72
- package/lib/module/networks/solana.js.map +0 -1
- package/lib/typescript/networks/bitcoin.d.ts +0 -4
- package/lib/typescript/networks/bitcoin.d.ts.map +0 -1
- package/lib/typescript/networks/index.d.ts +0 -4
- package/lib/typescript/networks/index.d.ts.map +0 -1
- package/lib/typescript/networks/solana.d.ts +0 -27
- package/lib/typescript/networks/solana.d.ts.map +0 -1
- package/src/networks/bitcoin.ts +0 -32
- package/src/networks/index.ts +0 -6
- package/src/networks/solana.ts +0 -44
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import type { Provider } from '@reown/appkit-common-react-native';
|
|
2
|
-
|
|
1
|
+
import type { Provider, ChainNamespace } from '@reown/appkit-common-react-native';
|
|
2
|
+
interface ProviderResult {
|
|
3
|
+
provider?: Provider;
|
|
4
|
+
providerType?: ChainNamespace;
|
|
5
|
+
}
|
|
6
|
+
export declare function useProvider(namespace?: ChainNamespace): ProviderResult;
|
|
7
|
+
export {};
|
|
3
8
|
//# sourceMappingURL=useProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProvider.d.ts","sourceRoot":"","sources":["../../../src/hooks/useProvider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"useProvider.d.ts","sourceRoot":"","sources":["../../../src/hooks/useProvider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAElF,UAAU,cAAc;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE,cAAc,CAAC;CAC/B;AAED,wBAAgB,WAAW,CAAC,SAAS,CAAC,EAAE,cAAc,GAAG,cAAc,CAetE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWalletInfo.d.ts","sourceRoot":"","sources":["../../../src/hooks/useWalletInfo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useWalletInfo.d.ts","sourceRoot":"","sources":["../../../src/hooks/useWalletInfo.ts"],"names":[],"mappings":"AAIA,wBAAgB,aAAa;;;;;;;;;;;;;;EAK5B"}
|
|
@@ -9,8 +9,8 @@ export type { LibraryOptions, ScaffoldOptions } from './client';
|
|
|
9
9
|
export type * from '@reown/appkit-core-react-native';
|
|
10
10
|
export { CoreHelperUtil } from '@reown/appkit-core-react-native';
|
|
11
11
|
export * from './AppKit';
|
|
12
|
-
export * from './networks';
|
|
13
12
|
export { AppKitProvider } from './AppKitContext';
|
|
13
|
+
export type { AppKitNetwork, Storage } from '@reown/appkit-common-react-native';
|
|
14
14
|
export { WalletConnectConnector } from './connectors/WalletConnectConnector';
|
|
15
15
|
/****** Hooks *******/
|
|
16
16
|
export { useAppKit } from './hooks/useAppKit';
|
|
@@ -18,4 +18,7 @@ export { useProvider } from './hooks/useProvider';
|
|
|
18
18
|
export { useAccount } from './hooks/useAccount';
|
|
19
19
|
export { useWalletInfo } from './hooks/useWalletInfo';
|
|
20
20
|
export { useAppKitEvents, useAppKitEventSubscription } from './hooks/useAppKitEvents';
|
|
21
|
+
/********** Networks **********/
|
|
22
|
+
export { solana, solanaDevnet, solanaTestnet } from '@reown/appkit-common-react-native';
|
|
23
|
+
export { bitcoin, bitcoinTestnet } from '@reown/appkit-common-react-native';
|
|
21
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,aAAa,EAC9B,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EACL,aAAa,IAAI,aAAa,EAC9B,KAAK,kBAAkB,IAAI,kBAAkB,EAC9C,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,aAAa,IAAI,aAAa,EAC9B,KAAK,kBAAkB,IAAI,kBAAkB,EAC9C,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhE,mBAAmB,iCAAiC,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,aAAa,EAC9B,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EACL,aAAa,IAAI,aAAa,EAC9B,KAAK,kBAAkB,IAAI,kBAAkB,EAC9C,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,aAAa,IAAI,aAAa,EAC9B,KAAK,kBAAkB,IAAI,kBAAkB,EAC9C,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhE,mBAAmB,iCAAiC,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAEhF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,sBAAsB;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAEtF,gCAAgC;AAChC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modal/w3m-modal/index.tsx"],"names":[],"mappings":"AA6BA,wBAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modal/w3m-modal/index.tsx"],"names":[],"mappings":"AA6BA,wBAAgB,MAAM,4CAkIrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-account-activity/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAkB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-account-activity/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAkB,MAAM,cAAc,CAAC;AAwBhG,UAAU,KAAK;IACb,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,KAAK,2CA+J/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-account-wallet-features/index.tsx"],"names":[],"mappings":"AAmBA,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-account-wallet-features/index.tsx"],"names":[],"mappings":"AAmBA,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,qBAAqB,4CAiIpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-swap-details/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-swap-details/index.tsx"],"names":[],"mappings":"AAsBA,UAAU,gBAAgB;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAKD,wBAAgB,WAAW,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CAqItE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpersUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/HelpersUtil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"HelpersUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/HelpersUtil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,KAAK,EACV,aAAa,EAEb,cAAc,EACf,MAAM,mCAAmC,CAAC;AAG3C,eAAO,MAAM,eAAe;;;;CAuC3B,CAAC;AAEF,eAAO,MAAM,aAAa;+CACmB,cAAc,GAAG,MAAM,EAAE;2CAI7B,cAAc,GAAG,SAAS;4CAU/C,eAAe,cACnB,GAAG,GACd,eAAe;mCA8FF,aAAa,EAAE,mBACZ,GAAG,GACnB,eAAe;CAuCnB,CAAC;AAEF,yBAAiB,aAAa,CAAC;IAC7B,KAAY,gBAAgB,GAAG;QAC7B,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE;gBAAE,IAAI,EAAE,OAAO,CAAC;gBAAC,IAAI,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,CAAC;KACrE,CAAC;CACH"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { AppKitNetwork, CaipNetworkId } from '@reown/appkit-common-react-native';
|
|
1
|
+
import type { AppKitNetwork, CaipNetworkId, Network } from '@reown/appkit-common-react-native';
|
|
2
2
|
export declare const NetworkUtil: {
|
|
3
|
-
|
|
3
|
+
formatNetwork(network: Network, projectId: string): AppKitNetwork;
|
|
4
|
+
formatNetworks(networks: Network[], projectId: string): AppKitNetwork[];
|
|
4
5
|
getBlockchainApiRpcUrl(caipNetworkId: CaipNetworkId, projectId: string): string;
|
|
5
6
|
getDefaultChainId(network?: AppKitNetwork): CaipNetworkId | undefined;
|
|
6
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/NetworkUtil.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"NetworkUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/NetworkUtil.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAE/F,eAAO,MAAM,WAAW;2BACC,OAAO,aAAa,MAAM,GAAG,aAAa;6BAqBxC,OAAO,EAAE,aAAa,MAAM,GAAG,aAAa,EAAE;0CAMjC,aAAa,aAAa,MAAM;gCAQ1C,aAAa,GAAG,aAAa,GAAG,SAAS;CAatE,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { type WcWallet } from '@reown/appkit-core-react-native';
|
|
2
|
-
import { type LayoutAnimationProperty, type LayoutAnimationType } from 'react-native';
|
|
3
2
|
export declare const UiUtil: {
|
|
4
3
|
TOTAL_VISIBLE_WALLETS: number;
|
|
5
4
|
createViewTransition: () => void;
|
|
6
|
-
animateChange: (
|
|
5
|
+
animateChange: () => void;
|
|
7
6
|
storeConnectedWallet: (wcLinking: {
|
|
8
7
|
name: string;
|
|
9
8
|
href: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/UiUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,QAAQ,EACd,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"UiUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/UiUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,QAAQ,EACd,MAAM,iCAAiC,CAAC;AAEzC,eAAO,MAAM,MAAM;;;;sCAcJ;QAAE,MAAM,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,kBACzB,QAAQ;CAa3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-account-default-view/index.tsx"],"names":[],"mappings":"AAuCA,wBAAgB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-account-default-view/index.tsx"],"names":[],"mappings":"AAuCA,wBAAgB,kBAAkB,4CAySjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connect-view/index.tsx"],"names":[],"mappings":"AAyBA,wBAAgB,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connect-view/index.tsx"],"names":[],"mappings":"AAyBA,wBAAgB,WAAW,4CAoH1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-view/index.tsx"],"names":[],"mappings":"AAuBA,wBAAgB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-view/index.tsx"],"names":[],"mappings":"AAuBA,wBAAgB,cAAc,4CA8I7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-swap-preview-view/index.tsx"],"names":[],"mappings":"AAmBA,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-swap-preview-view/index.tsx"],"names":[],"mappings":"AAmBA,wBAAgB,eAAe,4CAgI9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-swap-view/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-swap-view/index.tsx"],"names":[],"mappings":"AAqBA,wBAAgB,QAAQ,4CA+LvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reown/appkit-react-native",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"types": "lib/typescript/index.d.ts",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@reown/appkit-common-react-native": "
|
|
41
|
-
"@reown/appkit-core-react-native": "
|
|
42
|
-
"@reown/appkit-siwe-react-native": "1.2.
|
|
43
|
-
"@reown/appkit-ui-react-native": "
|
|
40
|
+
"@reown/appkit-common-react-native": "2.0.0",
|
|
41
|
+
"@reown/appkit-core-react-native": "2.0.0",
|
|
42
|
+
"@reown/appkit-siwe-react-native": "1.2.4",
|
|
43
|
+
"@reown/appkit-ui-react-native": "2.0.0",
|
|
44
44
|
"@walletconnect/universal-provider": "2.20.2",
|
|
45
45
|
"valtio": "^1.13.2"
|
|
46
46
|
},
|
|
@@ -68,4 +68,4 @@
|
|
|
68
68
|
"node_modules/",
|
|
69
69
|
"lib/"
|
|
70
70
|
]
|
|
71
|
-
}
|
|
71
|
+
}
|
package/src/AppKit.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
type Features,
|
|
2
3
|
AccountController,
|
|
3
4
|
EventsController,
|
|
4
5
|
ModalController,
|
|
@@ -6,7 +7,6 @@ import {
|
|
|
6
7
|
OptionsController,
|
|
7
8
|
RouterController,
|
|
8
9
|
TransactionsController,
|
|
9
|
-
type Metadata,
|
|
10
10
|
StorageUtil,
|
|
11
11
|
type OptionsControllerState,
|
|
12
12
|
ThemeController,
|
|
@@ -19,12 +19,17 @@ import type {
|
|
|
19
19
|
ProposalNamespaces,
|
|
20
20
|
New_ConnectorType,
|
|
21
21
|
Namespaces,
|
|
22
|
+
Metadata,
|
|
22
23
|
CaipNetworkId,
|
|
23
24
|
AppKitNetwork,
|
|
24
25
|
Provider,
|
|
25
26
|
ThemeVariables,
|
|
26
27
|
ThemeMode,
|
|
27
|
-
WalletInfo
|
|
28
|
+
WalletInfo,
|
|
29
|
+
Network,
|
|
30
|
+
ChainNamespace,
|
|
31
|
+
ConnectOptions,
|
|
32
|
+
Storage
|
|
28
33
|
} from '@reown/appkit-common-react-native';
|
|
29
34
|
|
|
30
35
|
import { WalletConnectConnector } from './connectors/WalletConnectConnector';
|
|
@@ -37,7 +42,8 @@ interface AppKitConfig {
|
|
|
37
42
|
projectId: string;
|
|
38
43
|
metadata: Metadata;
|
|
39
44
|
adapters: BlockchainAdapter[];
|
|
40
|
-
networks:
|
|
45
|
+
networks: Network[];
|
|
46
|
+
storage: Storage;
|
|
41
47
|
extraConnectors?: WalletConnector[];
|
|
42
48
|
clipboardClient?: OptionsControllerState['clipboardClient'];
|
|
43
49
|
includeWalletIds?: OptionsControllerState['includeWalletIds'];
|
|
@@ -50,26 +56,44 @@ interface AppKitConfig {
|
|
|
50
56
|
themeMode?: ThemeMode;
|
|
51
57
|
themeVariables?: ThemeVariables;
|
|
52
58
|
siweConfig?: AppKitSIWEClient;
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
defaultNetwork?: Network;
|
|
60
|
+
features?: Features;
|
|
55
61
|
// chainImages?: Record<number, string>; //TODO: rename to networkImages
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
export class AppKit {
|
|
59
65
|
private projectId: string;
|
|
60
|
-
private metadata: Metadata;
|
|
61
66
|
private adapters: BlockchainAdapter[];
|
|
62
67
|
private networks: AppKitNetwork[];
|
|
68
|
+
private defaultNetwork?: AppKitNetwork;
|
|
63
69
|
private namespaces: ProposalNamespaces;
|
|
64
70
|
private config: AppKitConfig;
|
|
65
71
|
private extraConnectors: WalletConnector[];
|
|
66
72
|
|
|
67
73
|
constructor(config: AppKitConfig) {
|
|
68
74
|
this.projectId = config.projectId;
|
|
69
|
-
this.metadata = config.metadata;
|
|
70
75
|
this.adapters = config.adapters;
|
|
76
|
+
|
|
77
|
+
// Validate adapters to ensure no duplicate chainNamespaces
|
|
78
|
+
const namespaceMap = new Map<ChainNamespace, string>();
|
|
79
|
+
for (const adapter of this.adapters) {
|
|
80
|
+
const chainNamespace = adapter.supportedNamespace;
|
|
81
|
+
const adapterName = adapter.constructor.name;
|
|
82
|
+
if (namespaceMap.has(chainNamespace)) {
|
|
83
|
+
throw new Error(
|
|
84
|
+
`Duplicate adapter for namespace '${chainNamespace}'. Adapter "${adapterName}" conflicts with adapter "${namespaceMap.get(
|
|
85
|
+
chainNamespace
|
|
86
|
+
)}". Please provide only one adapter per chain namespace.`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
namespaceMap.set(chainNamespace, adapterName);
|
|
90
|
+
}
|
|
91
|
+
|
|
71
92
|
this.networks = NetworkUtil.formatNetworks(config.networks, this.projectId); //TODO: check this
|
|
72
|
-
this.
|
|
93
|
+
this.defaultNetwork = config.defaultNetwork
|
|
94
|
+
? NetworkUtil.formatNetwork(config.defaultNetwork, this.projectId)
|
|
95
|
+
: undefined;
|
|
96
|
+
this.namespaces = WcHelpersUtil.createNamespaces(this.networks) as ProposalNamespaces;
|
|
73
97
|
this.config = config;
|
|
74
98
|
this.extraConnectors = config.extraConnectors || [];
|
|
75
99
|
|
|
@@ -80,16 +104,17 @@ export class AppKit {
|
|
|
80
104
|
/**
|
|
81
105
|
* Handles the full connection flow for a given connector type.
|
|
82
106
|
* @param type - The type of connector to use.
|
|
83
|
-
* @param
|
|
107
|
+
* @param options - Optional connection options.
|
|
84
108
|
*/
|
|
85
|
-
async connect(type: New_ConnectorType,
|
|
109
|
+
async connect(type: New_ConnectorType, options?: ConnectOptions): Promise<void> {
|
|
86
110
|
try {
|
|
111
|
+
const { namespaces, defaultChain, universalLink } = options ?? {};
|
|
87
112
|
const connector = await this.createConnector(type);
|
|
88
|
-
const defaultChain = NetworkUtil.getDefaultChainId(this.config.defaultChain);
|
|
89
113
|
|
|
90
114
|
const approvedNamespaces = await connector.connect({
|
|
91
|
-
namespaces:
|
|
92
|
-
defaultChain
|
|
115
|
+
namespaces: namespaces ?? this.namespaces,
|
|
116
|
+
defaultChain,
|
|
117
|
+
universalLink
|
|
93
118
|
});
|
|
94
119
|
|
|
95
120
|
const walletInfo = connector.getWalletInfo();
|
|
@@ -142,10 +167,12 @@ export class AppKit {
|
|
|
142
167
|
return;
|
|
143
168
|
}
|
|
144
169
|
|
|
145
|
-
const connection = ConnectionsController.state.connections
|
|
170
|
+
const connection = ConnectionsController.state.connections.get(
|
|
171
|
+
activeNamespace as ChainNamespace
|
|
172
|
+
);
|
|
146
173
|
const connectorType = connection?.adapter?.connector?.type;
|
|
147
174
|
|
|
148
|
-
await ConnectionsController.disconnect(activeNamespace, isInternal);
|
|
175
|
+
await ConnectionsController.disconnect(activeNamespace as ChainNamespace, isInternal);
|
|
149
176
|
|
|
150
177
|
if (connectorType) {
|
|
151
178
|
await StorageUtil.removeConnectedConnectors(connectorType);
|
|
@@ -179,7 +206,9 @@ export class AppKit {
|
|
|
179
206
|
const activeNamespace = namespace ?? ConnectionsController.state.activeNamespace;
|
|
180
207
|
if (!activeNamespace) return null;
|
|
181
208
|
|
|
182
|
-
const connection = ConnectionsController.state.connections
|
|
209
|
+
const connection = ConnectionsController.state.connections.get(
|
|
210
|
+
activeNamespace as ChainNamespace
|
|
211
|
+
);
|
|
183
212
|
if (!connection || !connection.adapter || !connection.adapter.connector) return null;
|
|
184
213
|
|
|
185
214
|
return connection.adapter.connector.getProvider() as T;
|
|
@@ -203,16 +232,14 @@ export class AppKit {
|
|
|
203
232
|
}
|
|
204
233
|
});
|
|
205
234
|
|
|
206
|
-
ConnectionsController.
|
|
235
|
+
ConnectionsController.setActiveNetwork(
|
|
207
236
|
adapter.getSupportedNamespace(),
|
|
208
237
|
`${adapter.getSupportedNamespace()}:${network.id}` as CaipNetworkId
|
|
209
238
|
);
|
|
210
239
|
|
|
211
|
-
if (ConnectionsController.state.activeNamespace !==
|
|
212
|
-
ConnectionsController.setActiveNamespace(network.chainNamespace
|
|
240
|
+
if (ConnectionsController.state.activeNamespace !== network.chainNamespace) {
|
|
241
|
+
ConnectionsController.setActiveNamespace(network.chainNamespace);
|
|
213
242
|
}
|
|
214
|
-
|
|
215
|
-
// adapter.getBalance({ network, tokens: this.config.tokens });
|
|
216
243
|
}
|
|
217
244
|
|
|
218
245
|
open(options?: OpenOptions) {
|
|
@@ -226,15 +253,28 @@ export class AppKit {
|
|
|
226
253
|
private async createConnector(type: New_ConnectorType): Promise<WalletConnector> {
|
|
227
254
|
// Check if an extra connector was provided by the developer
|
|
228
255
|
const CustomConnector = this.extraConnectors.find(
|
|
229
|
-
connector => connector.
|
|
256
|
+
connector => connector.type.toLowerCase() === type.toLowerCase()
|
|
230
257
|
);
|
|
231
258
|
|
|
232
259
|
if (CustomConnector) {
|
|
260
|
+
await CustomConnector.init({
|
|
261
|
+
storage: this.config.storage,
|
|
262
|
+
metadata: this.config.metadata
|
|
263
|
+
});
|
|
264
|
+
|
|
233
265
|
return CustomConnector;
|
|
234
266
|
}
|
|
235
267
|
|
|
236
268
|
// Default to WalletConnectConnector if no custom connector matches
|
|
237
|
-
|
|
269
|
+
const walletConnectConnector = new WalletConnectConnector({
|
|
270
|
+
projectId: this.projectId
|
|
271
|
+
});
|
|
272
|
+
await walletConnectConnector.init({
|
|
273
|
+
storage: this.config.storage,
|
|
274
|
+
metadata: this.config.metadata
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
return walletConnectConnector;
|
|
238
278
|
}
|
|
239
279
|
|
|
240
280
|
//TODO: reuse logic with connect method
|
|
@@ -304,29 +344,37 @@ export class AppKit {
|
|
|
304
344
|
return adapters;
|
|
305
345
|
}
|
|
306
346
|
|
|
307
|
-
private getAdapterByNamespace(namespace:
|
|
308
|
-
const namespaceConnection = ConnectionsController.state.connections
|
|
347
|
+
private getAdapterByNamespace(namespace: ChainNamespace): BlockchainAdapter | null {
|
|
348
|
+
const namespaceConnection = ConnectionsController.state.connections.get(namespace);
|
|
349
|
+
if (namespaceConnection) {
|
|
350
|
+
return namespaceConnection.adapter;
|
|
351
|
+
}
|
|
309
352
|
|
|
310
|
-
return
|
|
353
|
+
return null;
|
|
311
354
|
}
|
|
312
355
|
|
|
313
356
|
private async syncAccounts(adapters: BlockchainAdapter[]) {
|
|
314
|
-
|
|
315
|
-
adapters.map(adapter => {
|
|
357
|
+
adapters.forEach(async adapter => {
|
|
316
358
|
const namespace = adapter.getSupportedNamespace();
|
|
317
|
-
const connection = ConnectionsController.state.connections
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
359
|
+
const connection = ConnectionsController.state.connections.get(namespace);
|
|
360
|
+
if (connection) {
|
|
361
|
+
const accounts = adapter.getAccounts();
|
|
362
|
+
if (accounts && accounts.length > 0) {
|
|
363
|
+
ConnectionsController.updateAccounts(namespace, accounts);
|
|
364
|
+
|
|
365
|
+
const network = this.networks.find(
|
|
366
|
+
n => n.id?.toString() === connection?.caipNetwork?.split(':')[1]
|
|
367
|
+
);
|
|
368
|
+
|
|
369
|
+
const address = accounts.find(
|
|
370
|
+
a => a.split(':')[1] === connection.caipNetwork?.split(':')[1]
|
|
371
|
+
);
|
|
372
|
+
|
|
373
|
+
if (address) {
|
|
374
|
+
adapter.getBalance({ address, network, tokens: this.config.tokens });
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
330
378
|
});
|
|
331
379
|
}
|
|
332
380
|
|
|
@@ -342,14 +390,14 @@ export class AppKit {
|
|
|
342
390
|
|
|
343
391
|
const accounts = namespaceDetails.accounts ?? [];
|
|
344
392
|
const chains = namespaceDetails.chains ?? [];
|
|
345
|
-
const
|
|
393
|
+
const caipNetwork = adapter?.connector?.getChainId(namespace);
|
|
346
394
|
|
|
347
395
|
ConnectionsController.storeConnection({
|
|
348
396
|
namespace,
|
|
349
397
|
adapter,
|
|
350
398
|
accounts,
|
|
351
399
|
chains,
|
|
352
|
-
|
|
400
|
+
caipNetwork,
|
|
353
401
|
wallet
|
|
354
402
|
});
|
|
355
403
|
});
|
|
@@ -365,16 +413,17 @@ export class AppKit {
|
|
|
365
413
|
}
|
|
366
414
|
|
|
367
415
|
private subscribeToAdapterEvents(adapter: BlockchainAdapter): void {
|
|
368
|
-
adapter.on('accountsChanged', ({ accounts
|
|
416
|
+
adapter.on('accountsChanged', ({ accounts }) => {
|
|
417
|
+
const namespace = adapter.getSupportedNamespace();
|
|
369
418
|
//eslint-disable-next-line no-console
|
|
370
419
|
console.log('accountsChanged', accounts, namespace);
|
|
371
420
|
//TODO: check this
|
|
372
421
|
});
|
|
373
422
|
|
|
374
|
-
adapter.on('chainChanged', ({ chainId
|
|
375
|
-
|
|
423
|
+
adapter.on('chainChanged', ({ chainId }) => {
|
|
424
|
+
const namespace = adapter.getSupportedNamespace();
|
|
376
425
|
const chain = `${namespace}:${chainId}` as CaipNetworkId;
|
|
377
|
-
ConnectionsController.
|
|
426
|
+
ConnectionsController.setActiveNetwork(namespace, chain);
|
|
378
427
|
|
|
379
428
|
const network = this.networks.find(n => n.id?.toString() === chainId);
|
|
380
429
|
if (network) {
|
|
@@ -385,12 +434,13 @@ export class AppKit {
|
|
|
385
434
|
}
|
|
386
435
|
});
|
|
387
436
|
|
|
388
|
-
adapter.on('disconnect', (
|
|
389
|
-
|
|
437
|
+
adapter.on('disconnect', () => {
|
|
438
|
+
const namespace = adapter.getSupportedNamespace();
|
|
390
439
|
this.disconnect(namespace, false);
|
|
391
440
|
});
|
|
392
441
|
|
|
393
|
-
adapter.on('balanceChanged', ({
|
|
442
|
+
adapter.on('balanceChanged', ({ address, balance }) => {
|
|
443
|
+
const namespace = adapter.getSupportedNamespace();
|
|
394
444
|
ConnectionsController.updateBalance(namespace, address, balance);
|
|
395
445
|
});
|
|
396
446
|
}
|
|
@@ -407,7 +457,8 @@ export class AppKit {
|
|
|
407
457
|
OptionsController.setCustomWallets(options.customWallets);
|
|
408
458
|
OptionsController.setEnableAnalytics(options.enableAnalytics);
|
|
409
459
|
OptionsController.setDebug(options.debug);
|
|
410
|
-
|
|
460
|
+
OptionsController.setFeatures(options.features);
|
|
461
|
+
OptionsController.setStorage(options.storage);
|
|
411
462
|
|
|
412
463
|
ThemeController.setThemeMode(options.themeMode);
|
|
413
464
|
ThemeController.setThemeVariables(options.themeVariables);
|
|
@@ -419,7 +470,7 @@ export class AppKit {
|
|
|
419
470
|
OptionsController.setClipboardClient(options.clipboardClient);
|
|
420
471
|
}
|
|
421
472
|
|
|
422
|
-
ConnectionsController.setNetworks(
|
|
473
|
+
ConnectionsController.setNetworks(this.networks);
|
|
423
474
|
|
|
424
475
|
if (options.siweConfig) {
|
|
425
476
|
SIWEController.setSIWEClient(options.siweConfig);
|
|
@@ -433,14 +484,43 @@ export class AppKit {
|
|
|
433
484
|
// }
|
|
434
485
|
}
|
|
435
486
|
|
|
436
|
-
private async
|
|
487
|
+
private async initActiveNamespace() {
|
|
437
488
|
const activeNamespace = await StorageUtil.getActiveNamespace();
|
|
438
489
|
if (activeNamespace) {
|
|
439
490
|
ConnectionsController.setActiveNamespace(activeNamespace);
|
|
440
|
-
} else if (
|
|
441
|
-
ConnectionsController.setActiveNamespace(
|
|
491
|
+
} else if (this.defaultNetwork) {
|
|
492
|
+
ConnectionsController.setActiveNamespace(this.defaultNetwork?.chainNamespace);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
private async initRecentWallets(options: AppKitConfig) {
|
|
497
|
+
const wallets = await StorageUtil.getRecentWallets();
|
|
498
|
+
const connectedWalletImage = await StorageUtil.getConnectedWalletImageUrl();
|
|
499
|
+
|
|
500
|
+
const filteredWallets = wallets.filter(wallet => {
|
|
501
|
+
const { includeWalletIds, excludeWalletIds } = options;
|
|
502
|
+
if (includeWalletIds) {
|
|
503
|
+
return includeWalletIds.includes(wallet.id);
|
|
504
|
+
}
|
|
505
|
+
if (excludeWalletIds) {
|
|
506
|
+
return !excludeWalletIds.includes(wallet.id);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
return true;
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
ConnectionController.setRecentWallets(filteredWallets);
|
|
513
|
+
|
|
514
|
+
if (connectedWalletImage) {
|
|
515
|
+
ConnectionController.setConnectedWalletImageUrl(connectedWalletImage);
|
|
442
516
|
}
|
|
443
517
|
}
|
|
518
|
+
|
|
519
|
+
private async initAsyncValues(options: AppKitConfig) {
|
|
520
|
+
await this.initActiveNamespace();
|
|
521
|
+
await this.initRecentWallets(options);
|
|
522
|
+
//disable coinbase if connector is not set
|
|
523
|
+
}
|
|
444
524
|
}
|
|
445
525
|
|
|
446
526
|
export function createAppKit(config: AppKitConfig): AppKit {
|
package/src/client.ts
CHANGED
|
@@ -343,7 +343,6 @@ export class AppKitScaffold {
|
|
|
343
343
|
|
|
344
344
|
private async initRecentWallets(options: ScaffoldOptions) {
|
|
345
345
|
const wallets = await StorageUtil.getRecentWallets();
|
|
346
|
-
const connectedWalletImage = await StorageUtil.getConnectedWalletImageUrl();
|
|
347
346
|
|
|
348
347
|
const filteredWallets = wallets.filter(wallet => {
|
|
349
348
|
const { includeWalletIds, excludeWalletIds } = options;
|
|
@@ -358,10 +357,6 @@ export class AppKitScaffold {
|
|
|
358
357
|
});
|
|
359
358
|
|
|
360
359
|
ConnectionController.setRecentWallets(filteredWallets);
|
|
361
|
-
|
|
362
|
-
if (connectedWalletImage) {
|
|
363
|
-
ConnectionController.setConnectedWalletImageUrl(connectedWalletImage);
|
|
364
|
-
}
|
|
365
360
|
}
|
|
366
361
|
|
|
367
362
|
private async initConnectedConnector() {
|