@reown/appkit-wagmi-react-native 0.0.0-refactor-modal-migration-20241104195134 → 0.0.0-refactor-modal-migration-20241104195645
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/client.js +475 -0
- package/lib/commonjs/client.js.map +1 -0
- package/lib/commonjs/connectors/WalletConnectConnector.js +353 -0
- package/lib/commonjs/connectors/WalletConnectConnector.js.map +1 -0
- package/lib/commonjs/index.js +126 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/utils/defaultWagmiConfig.js +46 -0
- package/lib/commonjs/utils/defaultWagmiConfig.js.map +1 -0
- package/lib/commonjs/utils/helpers.js +63 -0
- package/lib/commonjs/utils/helpers.js.map +1 -0
- package/lib/module/client.js +467 -0
- package/lib/module/client.js.map +1 -0
- package/lib/module/connectors/WalletConnectConnector.js +348 -0
- package/lib/module/connectors/WalletConnectConnector.js.map +1 -0
- package/lib/module/index.js +81 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/utils/defaultWagmiConfig.js +40 -0
- package/lib/module/utils/defaultWagmiConfig.js.map +1 -0
- package/lib/module/utils/helpers.js +53 -0
- package/lib/module/utils/helpers.js.map +1 -0
- package/lib/typescript/client.d.ts +39 -0
- package/lib/typescript/client.d.ts.map +1 -0
- package/lib/typescript/connectors/WalletConnectConnector.d.ts +74 -0
- package/lib/typescript/connectors/WalletConnectConnector.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +24 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/utils/defaultWagmiConfig.d.ts +11 -0
- package/lib/typescript/utils/defaultWagmiConfig.d.ts.map +1 -0
- package/lib/typescript/utils/helpers.d.ts +18 -0
- package/lib/typescript/utils/helpers.d.ts.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type EthereumProviderOptions } from '@walletconnect/ethereum-provider/dist/types/EthereumProvider';
|
|
2
|
+
import { type Address, type ProviderConnectInfo } from 'viem';
|
|
3
|
+
export type WalletConnectParameters = {
|
|
4
|
+
/**
|
|
5
|
+
* Reown Cloud Project ID.
|
|
6
|
+
* @link https://cloud.reown.com/sign-in.
|
|
7
|
+
*/
|
|
8
|
+
projectId: EthereumProviderOptions['projectId'];
|
|
9
|
+
/**
|
|
10
|
+
* If a new chain is added to a previously existing configured connector `chains`, this flag
|
|
11
|
+
* will determine if that chain should be considered as stale. A stale chain is a chain that
|
|
12
|
+
* WalletConnect has yet to establish a relationship with (e.g. the user has not approved or
|
|
13
|
+
* rejected the chain).
|
|
14
|
+
*
|
|
15
|
+
* This flag mainly affects the behavior when a wallet does not support dynamic chain authorization
|
|
16
|
+
* with WalletConnect v2.
|
|
17
|
+
*
|
|
18
|
+
* If `true` (default), the new chain will be treated as a stale chain. If the user
|
|
19
|
+
* has yet to establish a relationship (approved/rejected) with this chain in their WalletConnect
|
|
20
|
+
* session, the connector will disconnect upon the dapp auto-connecting, and the user will have to
|
|
21
|
+
* reconnect to the dapp (revalidate the chain) in order to approve the newly added chain.
|
|
22
|
+
* This is the default behavior to avoid an unexpected error upon switching chains which may
|
|
23
|
+
* be a confusing user experience (e.g. the user will not know they have to reconnect
|
|
24
|
+
* unless the dapp handles these types of errors).
|
|
25
|
+
*
|
|
26
|
+
* If `false`, the new chain will be treated as a potentially valid chain. This means that if the user
|
|
27
|
+
* has yet to establish a relationship with the chain in their WalletConnect session, wagmi will successfully
|
|
28
|
+
* auto-connect the user. This comes with the trade-off that the connector will throw an error
|
|
29
|
+
* when attempting to switch to the unapproved chain if the wallet does not support dynamic session updates.
|
|
30
|
+
* This may be useful in cases where a dapp constantly
|
|
31
|
+
* modifies their configured chains, and they do not want to disconnect the user upon
|
|
32
|
+
* auto-connecting. If the user decides to switch to the unapproved chain, it is important that the
|
|
33
|
+
* dapp handles this error and prompts the user to reconnect to the dapp in order to approve
|
|
34
|
+
* the newly added chain.
|
|
35
|
+
*
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
isNewChainsStale?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Metadata for your app.
|
|
41
|
+
* @link https://docs.reown.com/appkit/react-native/core/installation#implementation
|
|
42
|
+
*/
|
|
43
|
+
metadata: EthereumProviderOptions['metadata'];
|
|
44
|
+
} & Omit<EthereumProviderOptions, 'chains' | 'events' | 'optionalChains' | 'optionalEvents' | 'optionalMethods' | 'methods' | 'rpcMap' | 'showQrModal' | 'qrModalOptions' | 'storageOptions'>;
|
|
45
|
+
type NamespaceMethods = 'wallet_addEthereumChain' | 'wallet_switchEthereumChain';
|
|
46
|
+
type Properties = {
|
|
47
|
+
connect(parameters?: {
|
|
48
|
+
chainId?: number;
|
|
49
|
+
pairingTopic?: string;
|
|
50
|
+
}): Promise<{
|
|
51
|
+
accounts: readonly Address[];
|
|
52
|
+
chainId: number;
|
|
53
|
+
}>;
|
|
54
|
+
getNamespaceChainsIds(): number[];
|
|
55
|
+
getNamespaceMethods(): NamespaceMethods[];
|
|
56
|
+
getRequestedChainsIds(): Promise<number[]>;
|
|
57
|
+
isChainsStale(): Promise<boolean>;
|
|
58
|
+
onConnect(connectInfo: ProviderConnectInfo): void;
|
|
59
|
+
onDisplayUri(uri: string): void;
|
|
60
|
+
onSessionDelete(data: {
|
|
61
|
+
topic: string;
|
|
62
|
+
}): void;
|
|
63
|
+
setRequestedChainsIds(chains: number[]): void;
|
|
64
|
+
requestedChainsStorageKey: `${string}.requestedChains`;
|
|
65
|
+
};
|
|
66
|
+
type StorageItem = {
|
|
67
|
+
[_ in Properties['requestedChainsStorageKey']]: number[];
|
|
68
|
+
};
|
|
69
|
+
export declare function walletConnect(parameters: WalletConnectParameters): import("@wagmi/core").CreateConnectorFn<import("@walletconnect/ethereum-provider").default, Properties, StorageItem>;
|
|
70
|
+
export declare namespace walletConnect {
|
|
71
|
+
var type: "walletConnect";
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=WalletConnectConnector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WalletConnectConnector.d.ts","sourceRoot":"","sources":["../../../src/connectors/WalletConnectConnector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,8DAA8D,CAAC;AAC5G,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,mBAAmB,EAQzB,MAAM,MAAM,CAAC;AAkBd,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,SAAS,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;IAChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,QAAQ,EAAE,uBAAuB,CAAC,UAAU,CAAC,CAAC;CAC/C,GAAG,IAAI,CACN,uBAAuB,EACrB,QAAQ,GACR,QAAQ,GACR,gBAAgB,GAChB,gBAAgB,GAChB,iBAAiB,GACjB,SAAS,GACT,QAAQ,GACR,aAAa,GACb,gBAAgB,GAChB,gBAAgB,CACnB,CAAC;AAIF,KAAK,gBAAgB,GAAG,yBAAyB,GAAG,4BAA4B,CAAC;AAEjF,KAAK,UAAU,GAAG;IAChB,OAAO,CAAC,UAAU,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QACzE,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;QAC7B,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,qBAAqB,IAAI,MAAM,EAAE,CAAC;IAClC,mBAAmB,IAAI,gBAAgB,EAAE,CAAC;IAC1C,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3C,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,SAAS,CAAC,WAAW,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAClD,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,eAAe,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/C,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC9C,yBAAyB,EAAE,GAAG,MAAM,kBAAkB,CAAC;CACxD,CAAC;AAEF,KAAK,WAAW,GAAG;KAChB,CAAC,IAAI,UAAU,CAAC,2BAA2B,CAAC,GAAG,MAAM,EAAE;CACzD,CAAC;AAGF,wBAAgB,aAAa,CAAC,UAAU,EAAE,uBAAuB,wHAuWhE;yBAvWe,aAAa"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import '@walletconnect/react-native-compat';
|
|
2
|
+
export { AccountButton, AppKitButton, ConnectButton, NetworkButton, AppKit } from '@reown/appkit-scaffold-react-native';
|
|
3
|
+
export { defaultWagmiConfig } from './utils/defaultWagmiConfig';
|
|
4
|
+
import type { AppKitOptions } from './client';
|
|
5
|
+
import { AppKit } from './client';
|
|
6
|
+
export type { AppKitOptions } from './client';
|
|
7
|
+
type OpenOptions = Parameters<AppKit['open']>[0];
|
|
8
|
+
export declare function createAppKit(options: AppKitOptions): AppKit;
|
|
9
|
+
export declare function useAppKit(): {
|
|
10
|
+
open: (options?: OpenOptions) => Promise<void>;
|
|
11
|
+
close: () => Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
export declare function useAppKitState(): {
|
|
14
|
+
selectedNetworkId: number | undefined;
|
|
15
|
+
open: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare function useWalletInfo(): {
|
|
18
|
+
walletInfo: import("@reown/appkit-scaffold-react-native").ConnectedWalletInfo;
|
|
19
|
+
};
|
|
20
|
+
export declare function useAppKitEvents(): {
|
|
21
|
+
timestamp: number;
|
|
22
|
+
data: import("@reown/appkit-scaffold-react-native").Event;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,oCAAoC,CAAC;AAC5C,OAAO,EACL,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,MAAM,EACP,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,KAAK,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAKjD,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,UASlD;AAGD,wBAAgB,SAAS;qBAKO,WAAW;;EAS1C;AAED,wBAAgB,cAAc;;;EAkB7B;AAED,wBAAgB,aAAa;;EAY5B;AAED,wBAAgB,eAAe;;;EAkB9B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CreateConnectorFn, type CreateConfigParameters } from 'wagmi';
|
|
2
|
+
import type { EthereumProviderOptions } from '@walletconnect/ethereum-provider/dist/types/EthereumProvider';
|
|
3
|
+
export type ConfigOptions = Partial<CreateConfigParameters> & {
|
|
4
|
+
projectId: string;
|
|
5
|
+
metadata: Exclude<EthereumProviderOptions['metadata'], undefined>;
|
|
6
|
+
chains: CreateConfigParameters['chains'];
|
|
7
|
+
enableWalletConnect?: boolean;
|
|
8
|
+
extraConnectors?: CreateConnectorFn[];
|
|
9
|
+
};
|
|
10
|
+
export declare function defaultWagmiConfig({ projectId, chains, metadata, enableWalletConnect, extraConnectors, ...wagmiConfig }: ConfigOptions): import("wagmi").Config<readonly [import("viem").Chain, ...import("viem").Chain[]], any>;
|
|
11
|
+
//# sourceMappingURL=defaultWagmiConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultWagmiConfig.d.ts","sourceRoot":"","sources":["../../../src/utils/defaultWagmiConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8DAA8D,CAAC;AAM5G,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,sBAAsB,CAAC,GAAG;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC,uBAAuB,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,CAAC;IAClE,MAAM,EAAE,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IACzC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,eAAe,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACvC,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,MAAM,EACN,QAAQ,EACR,mBAA0B,EAC1B,eAAe,EACf,GAAG,WAAW,EACf,EAAE,aAAa,2FAyBf"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type CaipNetwork } from '@reown/appkit-scaffold-react-native';
|
|
2
|
+
import type { Connector } from '@wagmi/core';
|
|
3
|
+
import type { AppKitClientOptions } from '../client';
|
|
4
|
+
export declare function getCaipDefaultChain(chain?: AppKitClientOptions['defaultChain']): CaipNetwork | undefined;
|
|
5
|
+
export declare function getWalletConnectCaipNetworks(connector?: Connector): Promise<{
|
|
6
|
+
supportsAllNetworks: boolean;
|
|
7
|
+
approvedCaipNetworkIds: `${string}:${string}`[];
|
|
8
|
+
}>;
|
|
9
|
+
export declare function getAuthCaipNetworks(): {
|
|
10
|
+
supportsAllNetworks: boolean;
|
|
11
|
+
approvedCaipNetworkIds: `${string}:${string}`[];
|
|
12
|
+
};
|
|
13
|
+
export declare function getTransport({ chainId, projectId }: {
|
|
14
|
+
chainId: number;
|
|
15
|
+
projectId: string;
|
|
16
|
+
}): import("viem").HttpTransport;
|
|
17
|
+
export declare function requireCaipAddress(caipAddress: string): `0x${string}`;
|
|
18
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAEjB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGrD,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC,cAAc,CAAC,2BAU9E;AAED,wBAAsB,4BAA4B,CAAC,SAAS,CAAC,EAAE,SAAS;;;GAevE;AAED,wBAAgB,mBAAmB;;;EAOlC;AAED,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,gCAQ1F;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,iBAUrD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reown/appkit-wagmi-react-native",
|
|
3
|
-
"version": "0.0.0-refactor-modal-migration-
|
|
3
|
+
"version": "0.0.0-refactor-modal-migration-20241104195645",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"types": "lib/typescript/index.d.ts",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@reown/appkit-common-react-native": "0.0.0-refactor-modal-migration-
|
|
43
|
-
"@reown/appkit-scaffold-react-native": "0.0.0-refactor-modal-migration-
|
|
44
|
-
"@reown/appkit-scaffold-utils-react-native": "0.0.0-refactor-modal-migration-
|
|
45
|
-
"@reown/appkit-siwe-react-native": "0.0.0-refactor-modal-migration-
|
|
42
|
+
"@reown/appkit-common-react-native": "0.0.0-refactor-modal-migration-20241104195645",
|
|
43
|
+
"@reown/appkit-scaffold-react-native": "0.0.0-refactor-modal-migration-20241104195645",
|
|
44
|
+
"@reown/appkit-scaffold-utils-react-native": "0.0.0-refactor-modal-migration-20241104195645",
|
|
45
|
+
"@reown/appkit-siwe-react-native": "0.0.0-refactor-modal-migration-20241104195645"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@react-native-async-storage/async-storage": ">=1.17.0",
|