@reown/appkit-utils 1.6.9-vfat.0 → 1.6.9
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/dist/esm/exports/ethers.js +0 -1
- package/dist/esm/exports/ethers.js.map +1 -1
- package/dist/esm/package.json +2 -2
- package/dist/esm/src/ConstantsUtil.js +2 -0
- package/dist/esm/src/ConstantsUtil.js.map +1 -1
- package/dist/esm/src/PresetsUtil.js +6 -3
- package/dist/esm/src/PresetsUtil.js.map +1 -1
- package/dist/esm/src/solana/SolanaConstantsUtil.js +1 -3
- package/dist/esm/src/solana/SolanaConstantsUtil.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/types/exports/ethers.d.ts +0 -1
- package/dist/types/src/CaipNetworkUtil.d.ts +1 -1
- package/dist/types/src/ConstantsUtil.d.ts +2 -0
- package/dist/types/src/ethers/EthersStoreUtil.d.ts +11 -9
- package/dist/types/src/solana/SolanaConstantsUtil.d.ts +0 -2
- package/package.json +6 -6
- package/dist/esm/src/MobileWallet.js +0 -16
- package/dist/esm/src/MobileWallet.js.map +0 -1
- package/dist/esm/src/ethers/EthersConstantsUtil.js +0 -5
- package/dist/esm/src/ethers/EthersConstantsUtil.js.map +0 -1
- package/dist/esm/tests/MobileWallet.test.js +0 -59
- package/dist/esm/tests/MobileWallet.test.js.map +0 -1
- package/dist/types/src/MobileWallet.d.ts +0 -5
- package/dist/types/src/ethers/EthersConstantsUtil.d.ts +0 -4
- package/dist/types/tests/MobileWallet.test.d.ts +0 -1
|
@@ -13,7 +13,7 @@ export declare const CaipNetworksUtil: {
|
|
|
13
13
|
getDefaultRpcUrl(caipNetwork: AppKitNetwork, caipNetworkId: CaipNetworkId, projectId: string): string;
|
|
14
14
|
extendCaipNetwork(caipNetwork: AppKitNetwork | CaipNetwork, { customNetworkImageUrls, projectId, customRpc }: ExtendCaipNetworkParams): CaipNetwork;
|
|
15
15
|
extendCaipNetworks(caipNetworks: AppKitNetwork[], { customNetworkImageUrls, projectId, customRpcChainIds }: ExtendCaipNetworkParams & {
|
|
16
|
-
customRpcChainIds?: number[]
|
|
16
|
+
customRpcChainIds?: number[];
|
|
17
17
|
}): [CaipNetwork, ...CaipNetwork[]];
|
|
18
18
|
getViemTransport(caipNetwork: CaipNetwork): import("viem").HttpTransport | import("viem").FallbackTransport<readonly [import("viem").HttpTransport, import("viem").HttpTransport]>;
|
|
19
19
|
};
|
|
@@ -9,6 +9,8 @@ export declare const ConstantsUtil: {
|
|
|
9
9
|
BACKPACK_CONNECTOR_NAME: string;
|
|
10
10
|
BITGET_CONNECTOR_NAME: string;
|
|
11
11
|
FRONTIER_CONNECTOR_NAME: string;
|
|
12
|
+
XVERSE_CONNECTOR_NAME: string;
|
|
13
|
+
LEATHER_CONNECTOR_NAME: string;
|
|
12
14
|
EIP155: ChainNamespace;
|
|
13
15
|
ADD_CHAIN_METHOD: string;
|
|
14
16
|
EIP6963_ANNOUNCE_EVENT: string;
|
|
@@ -11,17 +11,19 @@ export interface EthersStoreUtilState {
|
|
|
11
11
|
status: Status;
|
|
12
12
|
isConnected: boolean;
|
|
13
13
|
}
|
|
14
|
+
type StateKey = keyof EthersStoreUtilState;
|
|
14
15
|
export declare const EthersStoreUtil: {
|
|
15
16
|
state: EthersStoreUtilState;
|
|
16
|
-
subscribeKey<K extends
|
|
17
|
+
subscribeKey<K extends StateKey>(key: K, callback: (value: EthersStoreUtilState[K]) => void): () => void;
|
|
17
18
|
subscribe(callback: (newState: EthersStoreUtilState) => void): () => void;
|
|
18
|
-
setProvider(provider: EthersStoreUtilState[
|
|
19
|
-
setProviderType(providerType: EthersStoreUtilState[
|
|
20
|
-
setAddress(address: EthersStoreUtilState[
|
|
21
|
-
setPreferredAccountType(preferredAccountType: EthersStoreUtilState[
|
|
22
|
-
setChainId(chainId: EthersStoreUtilState[
|
|
23
|
-
setStatus(status: EthersStoreUtilState[
|
|
24
|
-
setIsConnected(isConnected: EthersStoreUtilState[
|
|
25
|
-
setError(error: EthersStoreUtilState[
|
|
19
|
+
setProvider(provider: EthersStoreUtilState["provider"]): void;
|
|
20
|
+
setProviderType(providerType: EthersStoreUtilState["providerType"]): void;
|
|
21
|
+
setAddress(address: EthersStoreUtilState["address"]): void;
|
|
22
|
+
setPreferredAccountType(preferredAccountType: EthersStoreUtilState["preferredAccountType"]): void;
|
|
23
|
+
setChainId(chainId: EthersStoreUtilState["chainId"]): void;
|
|
24
|
+
setStatus(status: EthersStoreUtilState["status"]): void;
|
|
25
|
+
setIsConnected(isConnected: EthersStoreUtilState["isConnected"]): void;
|
|
26
|
+
setError(error: EthersStoreUtilState["error"]): void;
|
|
26
27
|
reset(): void;
|
|
27
28
|
};
|
|
29
|
+
export {};
|
|
@@ -6,8 +6,6 @@ export declare const SolConstantsUtil: {
|
|
|
6
6
|
readonly ROOT_DOMAIN_ACCOUNT: PublicKey;
|
|
7
7
|
readonly NAME_PROGRAM_ID: PublicKey;
|
|
8
8
|
readonly REVERSE_LOOKUP_CLASS: PublicKey;
|
|
9
|
-
readonly ERROR_CODE_UNRECOGNIZED_CHAIN_ID: 4902;
|
|
10
|
-
readonly ERROR_CODE_DEFAULT: 5000;
|
|
11
9
|
readonly DEFAULT_CHAIN: CaipNetwork;
|
|
12
10
|
readonly CHAIN_IDS: {
|
|
13
11
|
readonly Mainnet: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reown/appkit-utils",
|
|
3
|
-
"version": "1.6.9
|
|
3
|
+
"version": "1.6.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/esm/exports/index.js",
|
|
6
6
|
"types": "./dist/types/exports/index.d.ts",
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
"@walletconnect/universal-provider": "2.18.0",
|
|
41
41
|
"valtio": "1.13.2",
|
|
42
42
|
"viem": ">=2.23.0",
|
|
43
|
-
"@reown/appkit-common": "1.6.9
|
|
44
|
-
"@reown/appkit-
|
|
45
|
-
"@reown/appkit-
|
|
46
|
-
"@reown/appkit-wallet": "1.6.9
|
|
43
|
+
"@reown/appkit-common": "1.6.9",
|
|
44
|
+
"@reown/appkit-core": "1.6.9",
|
|
45
|
+
"@reown/appkit-polyfills": "1.6.9",
|
|
46
|
+
"@reown/appkit-wallet": "1.6.9"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@coinbase/wallet-sdk": "4.3.0",
|
|
50
50
|
"@solana/wallet-adapter-base": "0.9.23",
|
|
51
51
|
"@solana/web3.js": "1.95.8",
|
|
52
52
|
"@vitest/coverage-v8": "2.1.3",
|
|
53
|
-
"vitest": "2.1.
|
|
53
|
+
"vitest": "2.1.9"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"valtio": "1.13.2"
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export const MobileWalletUtil = {
|
|
2
|
-
handleMobileWalletRedirection(properties) {
|
|
3
|
-
const href = window.location.href;
|
|
4
|
-
const encodedHref = encodeURIComponent(href);
|
|
5
|
-
if (properties?.name === 'Phantom' && !('phantom' in window)) {
|
|
6
|
-
const protocol = href.startsWith('https') ? 'https' : 'http';
|
|
7
|
-
const host = href.split('/')[2];
|
|
8
|
-
const encodedRef = encodeURIComponent(`${protocol}://${host}`);
|
|
9
|
-
window.location.href = `https://phantom.app/ul/browse/${encodedHref}?ref=${encodedRef}`;
|
|
10
|
-
}
|
|
11
|
-
if (properties?.name === 'Coinbase Wallet' && !('coinbaseSolana' in window)) {
|
|
12
|
-
window.location.href = `https://go.cb-w.com/dapp?cb_url=${encodedHref}`;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=MobileWallet.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MobileWallet.js","sourceRoot":"","sources":["../../../src/MobileWallet.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAO9B,6BAA6B,CAAC,UAA4B;QACxD,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAA;QACjC,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAA;QAE5C,IAAI,UAAU,EAAE,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC,EAAE,CAAC;YAC7D,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAA;YAC5D,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;YAC/B,MAAM,UAAU,GAAG,kBAAkB,CAAC,GAAG,QAAQ,MAAM,IAAI,EAAE,CAAC,CAAA;YAE9D,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,iCAAiC,WAAW,QAAQ,UAAU,EAAE,CAAA;QACzF,CAAC;QAED,IAAI,UAAU,EAAE,IAAI,KAAK,iBAAiB,IAAI,CAAC,CAAC,gBAAgB,IAAI,MAAM,CAAC,EAAE,CAAC;YAC5E,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,mCAAmC,WAAW,EAAE,CAAA;QACzE,CAAC;IACH,CAAC;CACF,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EthersConstantsUtil.js","sourceRoot":"","sources":["../../../../src/ethers/EthersConstantsUtil.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,gCAAgC,EAAE,IAAI;IACtC,kBAAkB,EAAE,IAAI;CAChB,CAAA"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { MobileWalletUtil } from '../src/MobileWallet';
|
|
3
|
-
const ORIGINAL_HREF = 'https://example.com/path';
|
|
4
|
-
const mockWindow = {
|
|
5
|
-
location: {
|
|
6
|
-
href: ORIGINAL_HREF
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
describe('MobileWalletUtil', () => {
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
vi.stubGlobal('window', {
|
|
12
|
-
location: {
|
|
13
|
-
href: ORIGINAL_HREF
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
afterAll(() => {
|
|
18
|
-
vi.unstubAllGlobals();
|
|
19
|
-
});
|
|
20
|
-
describe('handleMobileWalletRedirection', () => {
|
|
21
|
-
it('should redirect to Phantom app when Phantom is not installed', () => {
|
|
22
|
-
MobileWalletUtil.handleMobileWalletRedirection({ name: 'Phantom' });
|
|
23
|
-
const encodedHref = encodeURIComponent(ORIGINAL_HREF);
|
|
24
|
-
const encodedRef = encodeURIComponent('https://example.com');
|
|
25
|
-
const expectedUrl = `https://phantom.app/ul/browse/${encodedHref}?ref=${encodedRef}`;
|
|
26
|
-
expect(window.location.href).toBe(expectedUrl);
|
|
27
|
-
});
|
|
28
|
-
it('should not redirect when Phantom is installed', () => {
|
|
29
|
-
vi.stubGlobal('window', {
|
|
30
|
-
...mockWindow,
|
|
31
|
-
phantom: {}
|
|
32
|
-
});
|
|
33
|
-
const originalHref = window.location.href;
|
|
34
|
-
MobileWalletUtil.handleMobileWalletRedirection({ name: 'Phantom' });
|
|
35
|
-
expect(window.location.href).toBe(originalHref);
|
|
36
|
-
});
|
|
37
|
-
it('should redirect to Coinbase Wallet when it is not installed', () => {
|
|
38
|
-
MobileWalletUtil.handleMobileWalletRedirection({ name: 'Coinbase Wallet' });
|
|
39
|
-
const encodedHref = encodeURIComponent(ORIGINAL_HREF);
|
|
40
|
-
const expectedUrl = `https://go.cb-w.com/dapp?cb_url=${encodedHref}`;
|
|
41
|
-
expect(window.location.href).toBe(expectedUrl);
|
|
42
|
-
});
|
|
43
|
-
it('should not redirect when Coinbase Wallet is installed', () => {
|
|
44
|
-
vi.stubGlobal('window', {
|
|
45
|
-
...mockWindow,
|
|
46
|
-
coinbaseSolana: {}
|
|
47
|
-
});
|
|
48
|
-
const originalHref = window.location.href;
|
|
49
|
-
MobileWalletUtil.handleMobileWalletRedirection({ name: 'Coinbase Wallet' });
|
|
50
|
-
expect(window.location.href).toBe(originalHref);
|
|
51
|
-
});
|
|
52
|
-
it('should not redirect for unknown wallet names', () => {
|
|
53
|
-
const originalHref = window.location.href;
|
|
54
|
-
MobileWalletUtil.handleMobileWalletRedirection({ name: 'Unknown Wallet' });
|
|
55
|
-
expect(window.location.href).toBe(originalHref);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
//# sourceMappingURL=MobileWallet.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MobileWallet.test.js","sourceRoot":"","sources":["../../../tests/MobileWallet.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,MAAM,aAAa,GAAG,0BAA0B,CAAA;AAChD,MAAM,UAAU,GAAG;IACjB,QAAQ,EAAE;QACR,IAAI,EAAE,aAAa;KACpB;CACF,CAAA;AAED,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,UAAU,CAAC,GAAG,EAAE;QAEd,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE;YACtB,QAAQ,EAAE;gBACR,IAAI,EAAE,aAAa;aACpB;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,GAAG,EAAE;QACZ,EAAE,CAAC,gBAAgB,EAAE,CAAA;IACvB,CAAC,CAAC,CAAA;IA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