@reown/appkit-common-react-native 2.0.0 → 2.0.1
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/adapters/BitcoinBaseAdapter.js +10 -0
- package/lib/commonjs/adapters/BitcoinBaseAdapter.js.map +1 -0
- package/lib/commonjs/adapters/BlockchainAdapter.js +38 -14
- package/lib/commonjs/adapters/BlockchainAdapter.js.map +1 -1
- package/lib/commonjs/adapters/EvmAdapter.js +126 -16
- package/lib/commonjs/adapters/EvmAdapter.js.map +1 -1
- package/lib/commonjs/adapters/SolanaBaseAdapter.js +1 -3
- package/lib/commonjs/adapters/SolanaBaseAdapter.js.map +1 -1
- package/lib/commonjs/contracts/erc20.js.map +1 -1
- package/lib/commonjs/contracts/usdt.js.map +1 -1
- package/lib/commonjs/index.js +13 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/networks/bitcoin.js.map +1 -1
- package/lib/commonjs/networks/solana.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types/api/blockchain-api.js +15 -0
- package/lib/commonjs/types/api/blockchain-api.js.map +1 -0
- package/lib/commonjs/types/api/events.js +6 -0
- package/lib/commonjs/types/api/events.js.map +1 -0
- package/lib/commonjs/types/api/index.js +39 -0
- package/lib/commonjs/types/api/index.js.map +1 -0
- package/lib/commonjs/types/api/wallet-api.js +6 -0
- package/lib/commonjs/types/api/wallet-api.js.map +1 -0
- package/lib/commonjs/types/blockchain/adapter.js +6 -0
- package/lib/commonjs/types/blockchain/adapter.js.map +1 -0
- package/lib/commonjs/types/blockchain/balance.js +6 -0
- package/lib/commonjs/types/blockchain/balance.js.map +1 -0
- package/lib/commonjs/types/blockchain/index.js +50 -0
- package/lib/commonjs/types/blockchain/index.js.map +1 -0
- package/lib/commonjs/types/blockchain/network.js +6 -0
- package/lib/commonjs/types/blockchain/network.js.map +1 -0
- package/lib/commonjs/types/blockchain/transaction.js +2 -0
- package/lib/commonjs/types/blockchain/transaction.js.map +1 -0
- package/lib/commonjs/types/common.js +2 -0
- package/lib/commonjs/types/common.js.map +1 -0
- package/lib/commonjs/types/index.js +105 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/types/onramp/countries.js +2 -0
- package/lib/commonjs/types/onramp/countries.js.map +1 -0
- package/lib/commonjs/types/onramp/currencies.js +2 -0
- package/lib/commonjs/types/onramp/currencies.js.map +1 -0
- package/lib/commonjs/types/onramp/errors.js +22 -0
- package/lib/commonjs/types/onramp/errors.js.map +1 -0
- package/lib/commonjs/types/onramp/index.js +50 -0
- package/lib/commonjs/types/onramp/index.js.map +1 -0
- package/lib/commonjs/types/onramp/quotes.js +2 -0
- package/lib/commonjs/types/onramp/quotes.js.map +1 -0
- package/lib/commonjs/types/siwx/config.js +6 -0
- package/lib/commonjs/types/siwx/config.js.map +1 -0
- package/lib/commonjs/types/siwx/index.js +50 -0
- package/lib/commonjs/types/siwx/index.js.map +1 -0
- package/lib/commonjs/types/siwx/message.js +6 -0
- package/lib/commonjs/types/siwx/message.js.map +1 -0
- package/lib/commonjs/types/siwx/storage.js +6 -0
- package/lib/commonjs/types/siwx/storage.js.map +1 -0
- package/lib/commonjs/types/siwx/verifier.js +35 -0
- package/lib/commonjs/types/siwx/verifier.js.map +1 -0
- package/lib/commonjs/types/storage.js +24 -0
- package/lib/commonjs/types/storage.js.map +1 -0
- package/lib/commonjs/types/swap/index.js +17 -0
- package/lib/commonjs/types/swap/index.js.map +1 -0
- package/lib/commonjs/types/swap/tokens.js +6 -0
- package/lib/commonjs/types/swap/tokens.js.map +1 -0
- package/lib/commonjs/types/ui.js +6 -0
- package/lib/commonjs/types/ui.js.map +1 -0
- package/lib/commonjs/types/wallet/connection.js +6 -0
- package/lib/commonjs/types/wallet/connection.js.map +1 -0
- package/lib/commonjs/{utils/TypeUtil.js → types/wallet/connector.js} +7 -13
- package/lib/commonjs/types/wallet/connector.js.map +1 -0
- package/lib/commonjs/types/wallet/index.js +39 -0
- package/lib/commonjs/types/wallet/index.js.map +1 -0
- package/lib/commonjs/types/wallet/wallet-info.js +6 -0
- package/lib/commonjs/types/wallet/wallet-info.js.map +1 -0
- package/lib/commonjs/utils/ConstantsUtil.js +45 -6
- package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
- package/lib/commonjs/utils/ContractUtil.js.map +1 -1
- package/lib/commonjs/utils/DateUtil.js.map +1 -1
- package/lib/commonjs/utils/ErrorUtil.js +2 -2
- package/lib/commonjs/utils/ErrorUtil.js.map +1 -1
- package/lib/commonjs/utils/NamesUtil.js.map +1 -1
- package/lib/commonjs/utils/NetworkUtil.js +3 -0
- package/lib/commonjs/utils/NetworkUtil.js.map +1 -1
- package/lib/commonjs/utils/NumberUtil.js +1 -2
- package/lib/commonjs/utils/NumberUtil.js.map +1 -1
- package/lib/commonjs/utils/PresetsUtil.js +0 -18
- package/lib/commonjs/utils/PresetsUtil.js.map +1 -1
- package/lib/commonjs/utils/StringUtil.js +7 -0
- package/lib/commonjs/utils/StringUtil.js.map +1 -1
- package/lib/module/adapters/BitcoinBaseAdapter.js +5 -0
- package/lib/module/adapters/BitcoinBaseAdapter.js.map +1 -0
- package/lib/module/adapters/BlockchainAdapter.js +40 -14
- package/lib/module/adapters/BlockchainAdapter.js.map +1 -1
- package/lib/module/adapters/EvmAdapter.js +129 -16
- package/lib/module/adapters/EvmAdapter.js.map +1 -1
- package/lib/module/adapters/SolanaBaseAdapter.js +3 -3
- package/lib/module/adapters/SolanaBaseAdapter.js.map +1 -1
- package/lib/module/contracts/erc20.js +2 -0
- package/lib/module/contracts/erc20.js.map +1 -1
- package/lib/module/contracts/usdt.js +2 -0
- package/lib/module/contracts/usdt.js.map +1 -1
- package/lib/module/index.js +4 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/networks/bitcoin.js +2 -0
- package/lib/module/networks/bitcoin.js.map +1 -1
- package/lib/module/networks/solana.js +2 -0
- package/lib/module/networks/solana.js.map +1 -1
- package/lib/module/types/api/blockchain-api.js +10 -0
- package/lib/module/types/api/blockchain-api.js.map +1 -0
- package/lib/module/types/api/events.js +4 -0
- package/lib/module/types/api/events.js.map +1 -0
- package/lib/module/types/api/index.js +7 -0
- package/lib/module/types/api/index.js.map +1 -0
- package/lib/module/types/api/wallet-api.js +4 -0
- package/lib/module/types/api/wallet-api.js.map +1 -0
- package/lib/module/types/blockchain/adapter.js +4 -0
- package/lib/module/types/blockchain/adapter.js.map +1 -0
- package/lib/module/types/blockchain/balance.js +4 -0
- package/lib/module/types/blockchain/balance.js.map +1 -0
- package/lib/module/types/blockchain/index.js +8 -0
- package/lib/module/types/blockchain/index.js.map +1 -0
- package/lib/module/types/blockchain/network.js +4 -0
- package/lib/module/types/blockchain/network.js.map +1 -0
- package/lib/module/types/blockchain/transaction.js +2 -0
- package/lib/module/types/blockchain/transaction.js.map +1 -0
- package/lib/module/types/common.js +2 -0
- package/lib/module/types/common.js.map +1 -0
- package/lib/module/types/index.js +31 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/types/onramp/countries.js +2 -0
- package/lib/module/types/onramp/countries.js.map +1 -0
- package/lib/module/types/onramp/currencies.js +2 -0
- package/lib/module/types/onramp/currencies.js.map +1 -0
- package/lib/module/types/onramp/errors.js +18 -0
- package/lib/module/types/onramp/errors.js.map +1 -0
- package/lib/module/types/onramp/index.js +8 -0
- package/lib/module/types/onramp/index.js.map +1 -0
- package/lib/module/types/onramp/quotes.js +2 -0
- package/lib/module/types/onramp/quotes.js.map +1 -0
- package/lib/module/types/siwx/config.js +4 -0
- package/lib/module/types/siwx/config.js.map +1 -0
- package/lib/module/types/siwx/index.js +7 -0
- package/lib/module/types/siwx/index.js.map +1 -0
- package/lib/module/types/siwx/message.js +4 -0
- package/lib/module/types/siwx/message.js.map +1 -0
- package/lib/module/types/siwx/storage.js +4 -0
- package/lib/module/types/siwx/storage.js.map +1 -0
- package/lib/module/types/siwx/verifier.js +30 -0
- package/lib/module/types/siwx/verifier.js.map +1 -0
- package/lib/module/types/storage.js +20 -0
- package/lib/module/types/storage.js.map +1 -0
- package/lib/module/types/swap/index.js +5 -0
- package/lib/module/types/swap/index.js.map +1 -0
- package/lib/module/types/swap/tokens.js +4 -0
- package/lib/module/types/swap/tokens.js.map +1 -0
- package/lib/module/types/ui.js +4 -0
- package/lib/module/types/ui.js.map +1 -0
- package/lib/module/types/wallet/connection.js +4 -0
- package/lib/module/types/wallet/connection.js.map +1 -0
- package/lib/module/{utils/TypeUtil.js → types/wallet/connector.js} +9 -14
- package/lib/module/types/wallet/connector.js.map +1 -0
- package/lib/module/types/wallet/index.js +7 -0
- package/lib/module/types/wallet/index.js.map +1 -0
- package/lib/module/types/wallet/wallet-info.js +4 -0
- package/lib/module/types/wallet/wallet-info.js.map +1 -0
- package/lib/module/utils/ConstantsUtil.js +47 -6
- package/lib/module/utils/ConstantsUtil.js.map +1 -1
- package/lib/module/utils/ContractUtil.js +2 -0
- package/lib/module/utils/ContractUtil.js.map +1 -1
- package/lib/module/utils/DateUtil.js +2 -0
- package/lib/module/utils/DateUtil.js.map +1 -1
- package/lib/module/utils/ErrorUtil.js +4 -2
- package/lib/module/utils/ErrorUtil.js.map +1 -1
- package/lib/module/utils/NamesUtil.js +2 -0
- package/lib/module/utils/NamesUtil.js.map +1 -1
- package/lib/module/utils/NetworkUtil.js +5 -0
- package/lib/module/utils/NetworkUtil.js.map +1 -1
- package/lib/module/utils/NumberUtil.js +2 -0
- package/lib/module/utils/NumberUtil.js.map +1 -1
- package/lib/module/utils/PresetsUtil.js +2 -18
- package/lib/module/utils/PresetsUtil.js.map +1 -1
- package/lib/module/utils/StringUtil.js +9 -0
- package/lib/module/utils/StringUtil.js.map +1 -1
- package/lib/typescript/adapters/BitcoinBaseAdapter.d.ts +5 -0
- package/lib/typescript/adapters/BitcoinBaseAdapter.d.ts.map +1 -0
- package/lib/typescript/adapters/BlockchainAdapter.d.ts +6 -7
- package/lib/typescript/adapters/BlockchainAdapter.d.ts.map +1 -1
- package/lib/typescript/adapters/EvmAdapter.d.ts +21 -1
- package/lib/typescript/adapters/EvmAdapter.d.ts.map +1 -1
- package/lib/typescript/adapters/SolanaBaseAdapter.d.ts +3 -0
- package/lib/typescript/adapters/SolanaBaseAdapter.d.ts.map +1 -1
- package/lib/typescript/adapters/__tests__/EvmAdapter.test.d.ts +2 -0
- package/lib/typescript/adapters/__tests__/EvmAdapter.test.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/networks/bitcoin.d.ts +1 -1
- package/lib/typescript/networks/bitcoin.d.ts.map +1 -1
- package/lib/typescript/networks/solana.d.ts +1 -1
- package/lib/typescript/networks/solana.d.ts.map +1 -1
- package/lib/typescript/types/api/blockchain-api.d.ts +183 -0
- package/lib/typescript/types/api/blockchain-api.d.ts.map +1 -0
- package/lib/typescript/types/api/events.d.ts +357 -0
- package/lib/typescript/types/api/events.d.ts.map +1 -0
- package/lib/typescript/types/api/index.d.ts +4 -0
- package/lib/typescript/types/api/index.d.ts.map +1 -0
- package/lib/typescript/types/api/wallet-api.d.ts +51 -0
- package/lib/typescript/types/api/wallet-api.d.ts.map +1 -0
- package/lib/typescript/types/blockchain/adapter.d.ts +40 -0
- package/lib/typescript/types/blockchain/adapter.d.ts.map +1 -0
- package/lib/typescript/types/blockchain/balance.d.ts +28 -0
- package/lib/typescript/types/blockchain/balance.d.ts.map +1 -0
- package/lib/typescript/types/blockchain/index.d.ts +5 -0
- package/lib/typescript/types/blockchain/index.d.ts.map +1 -0
- package/lib/typescript/types/blockchain/network.d.ts +47 -0
- package/lib/typescript/types/blockchain/network.d.ts.map +1 -0
- package/lib/typescript/types/blockchain/transaction.d.ts +63 -0
- package/lib/typescript/types/blockchain/transaction.d.ts.map +1 -0
- package/lib/typescript/types/common.d.ts +24 -0
- package/lib/typescript/types/common.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +10 -0
- package/lib/typescript/types/index.d.ts.map +1 -0
- package/lib/typescript/types/onramp/countries.d.ts +11 -0
- package/lib/typescript/types/onramp/countries.d.ts.map +1 -0
- package/lib/typescript/types/onramp/currencies.d.ts +30 -0
- package/lib/typescript/types/onramp/currencies.d.ts.map +1 -0
- package/lib/typescript/types/onramp/errors.d.ts +21 -0
- package/lib/typescript/types/onramp/errors.d.ts.map +1 -0
- package/lib/typescript/types/onramp/index.d.ts +5 -0
- package/lib/typescript/types/onramp/index.d.ts.map +1 -0
- package/lib/typescript/types/onramp/quotes.d.ts +45 -0
- package/lib/typescript/types/onramp/quotes.d.ts.map +1 -0
- package/lib/typescript/types/siwx/config.d.ts +73 -0
- package/lib/typescript/types/siwx/config.d.ts.map +1 -0
- package/lib/typescript/types/siwx/index.d.ts +5 -0
- package/lib/typescript/types/siwx/index.d.ts.map +1 -0
- package/lib/typescript/types/siwx/message.d.ts +92 -0
- package/lib/typescript/types/siwx/message.d.ts.map +1 -0
- package/lib/typescript/types/siwx/storage.d.ts +41 -0
- package/lib/typescript/types/siwx/storage.d.ts.map +1 -0
- package/lib/typescript/types/siwx/verifier.d.ts +28 -0
- package/lib/typescript/types/siwx/verifier.d.ts.map +1 -0
- package/lib/typescript/types/storage.d.ts +59 -0
- package/lib/typescript/types/storage.d.ts.map +1 -0
- package/lib/typescript/types/swap/index.d.ts +2 -0
- package/lib/typescript/types/swap/index.d.ts.map +1 -0
- package/lib/typescript/types/swap/tokens.d.ts +19 -0
- package/lib/typescript/types/swap/tokens.d.ts.map +1 -0
- package/lib/typescript/types/ui.d.ts +26 -0
- package/lib/typescript/types/ui.d.ts.map +1 -0
- package/lib/typescript/types/wallet/connection.d.ts +31 -0
- package/lib/typescript/types/wallet/connection.d.ts.map +1 -0
- package/lib/typescript/types/wallet/connector.d.ts +59 -0
- package/lib/typescript/types/wallet/connector.d.ts.map +1 -0
- package/lib/typescript/types/wallet/index.d.ts +4 -0
- package/lib/typescript/types/wallet/index.d.ts.map +1 -0
- package/lib/typescript/types/wallet/wallet-info.d.ts +37 -0
- package/lib/typescript/types/wallet/wallet-info.d.ts.map +1 -0
- package/lib/typescript/utils/ConstantsUtil.d.ts +43 -4
- package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
- package/lib/typescript/utils/NetworkUtil.d.ts +2 -0
- package/lib/typescript/utils/NetworkUtil.d.ts.map +1 -1
- package/lib/typescript/utils/PresetsUtil.d.ts +0 -5
- package/lib/typescript/utils/PresetsUtil.d.ts.map +1 -1
- package/lib/typescript/utils/StringUtil.d.ts +1 -0
- package/lib/typescript/utils/StringUtil.d.ts.map +1 -1
- package/package.json +10 -19
- package/src/adapters/BitcoinBaseAdapter.ts +5 -0
- package/src/adapters/BlockchainAdapter.ts +48 -21
- package/src/adapters/EvmAdapter.ts +186 -18
- package/src/adapters/SolanaBaseAdapter.ts +3 -1
- package/src/adapters/__tests__/EvmAdapter.test.ts +126 -0
- package/src/index.ts +3 -1
- package/src/networks/bitcoin.ts +1 -1
- package/src/networks/solana.ts +1 -1
- package/src/types/api/blockchain-api.ts +213 -0
- package/src/types/api/events.ts +462 -0
- package/src/types/api/index.ts +4 -0
- package/src/types/api/wallet-api.ts +71 -0
- package/src/types/blockchain/adapter.ts +52 -0
- package/src/types/blockchain/balance.ts +31 -0
- package/src/types/blockchain/index.ts +5 -0
- package/src/types/blockchain/network.ts +39 -0
- package/src/types/blockchain/transaction.ts +71 -0
- package/src/types/common.ts +56 -0
- package/src/types/index.ts +28 -0
- package/src/types/onramp/countries.ts +11 -0
- package/src/types/onramp/currencies.ts +32 -0
- package/src/types/onramp/errors.ts +22 -0
- package/src/types/onramp/index.ts +5 -0
- package/src/types/onramp/quotes.ts +46 -0
- package/src/types/siwx/config.ts +73 -0
- package/src/types/siwx/index.ts +4 -0
- package/src/types/siwx/message.ts +92 -0
- package/src/types/siwx/storage.ts +44 -0
- package/src/types/siwx/verifier.ts +32 -0
- package/src/types/storage.ts +64 -0
- package/src/types/swap/index.ts +2 -0
- package/src/types/swap/tokens.ts +21 -0
- package/src/types/ui.ts +26 -0
- package/src/types/wallet/connection.ts +34 -0
- package/src/types/wallet/connector.ts +83 -0
- package/src/types/wallet/index.ts +4 -0
- package/src/types/wallet/wallet-info.ts +42 -0
- package/src/utils/ConstantsUtil.ts +48 -7
- package/src/utils/ErrorUtil.ts +2 -2
- package/src/utils/NetworkUtil.ts +5 -0
- package/src/utils/PresetsUtil.ts +0 -25
- package/src/utils/StringUtil.ts +7 -0
- package/lib/commonjs/utils/TypeUtil.js.map +0 -1
- package/lib/module/utils/TypeUtil.js.map +0 -1
- package/lib/typescript/utils/TypeUtil.d.ts +0 -276
- package/lib/typescript/utils/TypeUtil.d.ts.map +0 -1
- package/src/utils/TypeUtil.ts +0 -336
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import type { ChainNamespace, CaipAddress, CaipNetworkId } from '../common';
|
|
3
|
+
import type { AppKitNetwork } from '../blockchain/network';
|
|
4
|
+
import type { Provider } from '../blockchain/adapter';
|
|
5
|
+
import type { WalletInfo, Metadata } from './wallet-info';
|
|
6
|
+
import type { ConnectionProperties } from './connection';
|
|
7
|
+
import type { Storage } from '../storage';
|
|
8
|
+
import type { WcWallet } from '../api/wallet-api';
|
|
9
|
+
|
|
10
|
+
export type ConnectorType = 'walletconnect' | 'coinbase' | 'phantom' | 'solflare';
|
|
11
|
+
|
|
12
|
+
export interface BaseNamespace {
|
|
13
|
+
chains?: CaipNetworkId[];
|
|
14
|
+
accounts: CaipAddress[];
|
|
15
|
+
methods: string[];
|
|
16
|
+
events: string[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type Namespace = BaseNamespace;
|
|
20
|
+
|
|
21
|
+
export type Namespaces = Record<string, Namespace>;
|
|
22
|
+
|
|
23
|
+
export type ProposalNamespaces = Record<
|
|
24
|
+
string,
|
|
25
|
+
Omit<Namespace, 'accounts'> &
|
|
26
|
+
Required<Pick<Namespace, 'chains'>> & { rpcMap: Record<string, string> }
|
|
27
|
+
>;
|
|
28
|
+
|
|
29
|
+
export type ConnectOptions = {
|
|
30
|
+
namespaces?: ProposalNamespaces;
|
|
31
|
+
defaultNetwork?: AppKitNetwork;
|
|
32
|
+
universalLink?: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type ConnectorInitOptions = {
|
|
36
|
+
storage: Storage;
|
|
37
|
+
metadata: Metadata;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export abstract class WalletConnector extends EventEmitter {
|
|
41
|
+
public type: ConnectorType;
|
|
42
|
+
protected provider?: Provider;
|
|
43
|
+
protected namespaces?: Namespaces;
|
|
44
|
+
protected wallet?: WalletInfo;
|
|
45
|
+
protected storage?: Storage;
|
|
46
|
+
protected metadata?: Metadata;
|
|
47
|
+
protected properties?: ConnectionProperties;
|
|
48
|
+
|
|
49
|
+
constructor({ type }: { type: ConnectorType }) {
|
|
50
|
+
super();
|
|
51
|
+
this.type = type;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public async init(ops: ConnectorInitOptions) {
|
|
55
|
+
this.storage = ops.storage;
|
|
56
|
+
this.metadata = ops.metadata;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public setProvider(provider: Provider) {
|
|
60
|
+
this.provider = provider;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public async disconnect() {
|
|
64
|
+
await this.provider?.disconnect();
|
|
65
|
+
this.namespaces = undefined;
|
|
66
|
+
this.wallet = undefined;
|
|
67
|
+
this.properties = undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
abstract connect(opts: ConnectOptions): Promise<Namespaces | undefined>;
|
|
71
|
+
abstract getProvider(namespace?: ChainNamespace): Provider;
|
|
72
|
+
abstract getNamespaces(): Namespaces;
|
|
73
|
+
abstract getChainId(namespace: ChainNamespace): CaipNetworkId | undefined;
|
|
74
|
+
abstract getWalletInfo(): WalletInfo | undefined;
|
|
75
|
+
abstract getProperties(): ConnectionProperties | undefined;
|
|
76
|
+
abstract switchNetwork(network: AppKitNetwork): Promise<void>;
|
|
77
|
+
abstract restoreSession(): Promise<boolean>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export type AppKitConnectOptions = {
|
|
81
|
+
walletId?: string;
|
|
82
|
+
wallet?: WcWallet;
|
|
83
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { CaipNetworkId } from '../common';
|
|
2
|
+
|
|
3
|
+
export interface WalletInfo {
|
|
4
|
+
name?: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
icons?: string[];
|
|
9
|
+
redirect?: {
|
|
10
|
+
native?: string;
|
|
11
|
+
universal?: string;
|
|
12
|
+
linkMode?: boolean;
|
|
13
|
+
};
|
|
14
|
+
type?: 'walletconnect' | 'external' | 'unknown';
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type Metadata = {
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
url: string;
|
|
22
|
+
icons: string[];
|
|
23
|
+
redirect?: {
|
|
24
|
+
native?: string;
|
|
25
|
+
universal?: string;
|
|
26
|
+
linkMode?: boolean;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export interface Token {
|
|
31
|
+
address: string;
|
|
32
|
+
image?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type Tokens = Record<CaipNetworkId, Token>;
|
|
36
|
+
|
|
37
|
+
export interface Identity {
|
|
38
|
+
name: string;
|
|
39
|
+
avatar?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type ConnectedWalletInfo = WalletInfo | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const ConstantsUtil = {
|
|
2
|
-
VERSION: '2.0.
|
|
2
|
+
VERSION: '2.0.1',
|
|
3
3
|
|
|
4
4
|
EIP155: 'eip155',
|
|
5
5
|
ADD_CHAIN_METHOD: 'wallet_addEthereumChain',
|
|
@@ -11,12 +11,20 @@ export const ConstantsUtil = {
|
|
|
11
11
|
BLOCKCHAIN_API_RPC_URL_STAGING: 'https://staging.rpc.walletconnect.org',
|
|
12
12
|
PULSE_API_URL: 'https://pulse.walletconnect.org',
|
|
13
13
|
API_URL: 'https://api.web3modal.org',
|
|
14
|
+
WEB_WALLET_URL: 'https://web-wallet.walletconnect.org',
|
|
15
|
+
SECURE_SITE_DASHBOARD: `https://secure.reown.com/dashboard`,
|
|
16
|
+
SECURE_SITE_ICON: `https://secure.reown.com/images/favicon.png`,
|
|
17
|
+
REOWN_URL: `https://reown.com`,
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
CHAIN_NAME_MAP: {
|
|
20
|
+
eip155: 'EVM Networks',
|
|
21
|
+
solana: 'Solana',
|
|
22
|
+
polkadot: 'Polkadot',
|
|
23
|
+
bip122: 'Bitcoin',
|
|
24
|
+
cosmos: 'Cosmos',
|
|
25
|
+
sui: 'Sui',
|
|
26
|
+
stacks: 'Stacks'
|
|
27
|
+
},
|
|
20
28
|
|
|
21
29
|
USDT_CONTRACT_ADDRESSES: [
|
|
22
30
|
// Mainnet
|
|
@@ -33,5 +41,38 @@ export const ConstantsUtil = {
|
|
|
33
41
|
'0x55d398326f99059fF775485246999027B3197955',
|
|
34
42
|
// Arbitrum
|
|
35
43
|
'0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9'
|
|
36
|
-
]
|
|
44
|
+
],
|
|
45
|
+
|
|
46
|
+
PHANTOM_CUSTOM_WALLET: {
|
|
47
|
+
id: 'a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393',
|
|
48
|
+
name: 'Phantom Wallet',
|
|
49
|
+
image_id: 'b6ec7b81-bb4f-427d-e290-7631e6e50d00',
|
|
50
|
+
mobile_link: 'phantom://',
|
|
51
|
+
play_store: 'https://play.google.com/store/apps/details?id=app.phantom',
|
|
52
|
+
app_store: 'https://apps.apple.com/app/id1598432977',
|
|
53
|
+
android_app_id: 'app.phantom',
|
|
54
|
+
ios_schema: 'phantom://'
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
COINBASE_CUSTOM_WALLET: {
|
|
58
|
+
id: 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa',
|
|
59
|
+
name: 'Coinbase Wallet',
|
|
60
|
+
image_id: 'a5ebc364-8f91-4200-fcc6-be81310a0000',
|
|
61
|
+
mobile_link: 'https://wallet.coinbase.com/wsegue',
|
|
62
|
+
play_store: 'https://play.google.com/store/apps/details?id=org.toshi',
|
|
63
|
+
app_store: 'https://apps.apple.com/app/id1278383455',
|
|
64
|
+
android_app_id: 'org.toshi',
|
|
65
|
+
ios_schema: 'cbwallet://'
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
SOLFLARE_CUSTOM_WALLET: {
|
|
69
|
+
id: '1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79',
|
|
70
|
+
name: 'Solflare Wallet',
|
|
71
|
+
image_id: '34c0e38d-66c4-470e-1aed-a6fabe2d1e00',
|
|
72
|
+
mobile_link: 'solflare://',
|
|
73
|
+
play_store: 'https://play.google.com/store/apps/details?id=com.solflare.mobile',
|
|
74
|
+
app_store: 'https://apps.apple.com/app/id1580902717',
|
|
75
|
+
android_app_id: 'com.solflare.mobile',
|
|
76
|
+
ios_schema: 'solflare://'
|
|
77
|
+
}
|
|
37
78
|
};
|
package/src/utils/ErrorUtil.ts
CHANGED
|
@@ -16,12 +16,12 @@ export const ErrorUtil = {
|
|
|
16
16
|
ALERT_ERRORS: {
|
|
17
17
|
INVALID_APP_CONFIGURATION: {
|
|
18
18
|
shortMessage: 'Invalid App Configuration',
|
|
19
|
-
longMessage: `Bundle ID not found on Allowlist - Please verify that your bundle ID is allowed at https://
|
|
19
|
+
longMessage: `Bundle ID not found on Allowlist - Please verify that your bundle ID is allowed at https://dashboard.reown.com`
|
|
20
20
|
},
|
|
21
21
|
SOCIALS_TIMEOUT: {
|
|
22
22
|
shortMessage: 'Invalid App Configuration',
|
|
23
23
|
longMessage:
|
|
24
|
-
'There was an issue loading the embedded wallet. Please verify that your bundle ID is allowed at https://
|
|
24
|
+
'There was an issue loading the embedded wallet. Please verify that your bundle ID is allowed at https://dashboard.reown.com'
|
|
25
25
|
},
|
|
26
26
|
JWT_TOKEN_NOT_VALID: {
|
|
27
27
|
shortMessage: 'Session Expired',
|
package/src/utils/NetworkUtil.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import type { CaipAddress } from '../types';
|
|
2
|
+
|
|
1
3
|
export const NetworkUtil = {
|
|
2
4
|
caipNetworkIdToNumber(caipnetworkId?: `${string}:${string}`) {
|
|
3
5
|
return caipnetworkId ? Number(caipnetworkId.split(':')[1]) : undefined;
|
|
6
|
+
},
|
|
7
|
+
getPlainAddress(caipAddress?: CaipAddress) {
|
|
8
|
+
return caipAddress?.split(':')[2];
|
|
4
9
|
}
|
|
5
10
|
};
|
package/src/utils/PresetsUtil.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import type { ConnectorType } from './TypeUtil';
|
|
2
|
-
import { ConstantsUtil } from './ConstantsUtil';
|
|
3
|
-
|
|
4
1
|
export const PresetsUtil = {
|
|
5
|
-
ConnectorExplorerIds: {
|
|
6
|
-
[ConstantsUtil.COINBASE_CONNECTOR_ID]:
|
|
7
|
-
'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa'
|
|
8
|
-
} as Record<string, string>,
|
|
9
|
-
|
|
10
2
|
NetworkImageIds: {
|
|
11
3
|
// Ethereum
|
|
12
4
|
1: 'ba0ba0cd-17c6-4806-ad93-f9d174f17900',
|
|
@@ -81,23 +73,6 @@ export const PresetsUtil = {
|
|
|
81
73
|
'000000000933ea01ad0ee984209779ba': '39354064-d79b-420b-065d-f980c4b78200'
|
|
82
74
|
} as Record<string, string>,
|
|
83
75
|
|
|
84
|
-
ConnectorNamesMap: {
|
|
85
|
-
[ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID]: 'WalletConnect',
|
|
86
|
-
[ConstantsUtil.COINBASE_CONNECTOR_ID]: 'Coinbase Wallet',
|
|
87
|
-
[ConstantsUtil.AUTH_CONNECTOR_ID]: 'AppKit Universal Wallet'
|
|
88
|
-
} as Record<string, string>,
|
|
89
|
-
|
|
90
|
-
ConnectorImageIds: {
|
|
91
|
-
[ConstantsUtil.COINBASE_CONNECTOR_ID]: '0c2840c3-5b04-4c44-9661-fbd4b49e1800',
|
|
92
|
-
[ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID]: 'ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400'
|
|
93
|
-
} as Record<string, string>,
|
|
94
|
-
|
|
95
|
-
ConnectorTypesMap: {
|
|
96
|
-
[ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID]: 'WALLET_CONNECT',
|
|
97
|
-
[ConstantsUtil.COINBASE_CONNECTOR_ID]: 'COINBASE',
|
|
98
|
-
[ConstantsUtil.AUTH_CONNECTOR_ID]: 'AUTH'
|
|
99
|
-
} as Record<string, ConnectorType>,
|
|
100
|
-
|
|
101
76
|
RpcChainIds: [
|
|
102
77
|
// Ethereum
|
|
103
78
|
1,
|
package/src/utils/StringUtil.ts
CHANGED
|
@@ -5,5 +5,12 @@ export const StringUtil = {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
|
|
8
|
+
},
|
|
9
|
+
hexToString(hexValue: string) {
|
|
10
|
+
// Remove 0x prefix if present
|
|
11
|
+
const cleanHex = hexValue.startsWith('0x') ? hexValue.slice(2) : hexValue;
|
|
12
|
+
// Convert hex to decimal number, then to string
|
|
13
|
+
|
|
14
|
+
return parseInt(cleanHex, 16).toString();
|
|
8
15
|
}
|
|
9
16
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_events","require","WalletConnector","EventEmitter","constructor","type","init","ops","storage","metadata","setProvider","provider","exports"],"sourceRoot":"../../../src","sources":["utils/TypeUtil.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAgKA;;AAoBA;;AAsBA;;AA6BO,MAAeC,eAAe,SAASC,oBAAY,CAAC;EAQzDC,WAAWA,CAAC;IAAEC;EAAkC,CAAC,EAAE;IACjD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,IAAI,GAAGA,IAAI;EAClB;EAEA,MAAaC,IAAIA,CAACC,GAAyB,EAAE;IAC3C,IAAI,CAACC,OAAO,GAAGD,GAAG,CAACC,OAAO;IAC1B,IAAI,CAACC,QAAQ,GAAGF,GAAG,CAACE,QAAQ;EAC9B;EAEOC,WAAWA,CAACC,QAAkB,EAAE;IACrC,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC1B;AASF;;AAEA;;AAmBA;;AAGA;AAAAC,OAAA,CAAAV,eAAA,GAAAA,eAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["EventEmitter","WalletConnector","constructor","type","init","ops","storage","metadata","setProvider","provider"],"sourceRoot":"../../../src","sources":["utils/TypeUtil.ts"],"mappings":"AAAA,SAASA,YAAY,QAAQ,QAAQ;;AAgKrC;;AAoBA;;AAsBA;;AA6BA,OAAO,MAAeC,eAAe,SAASD,YAAY,CAAC;EAQzDE,WAAWA,CAAC;IAAEC;EAAkC,CAAC,EAAE;IACjD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,IAAI,GAAGA,IAAI;EAClB;EAEA,MAAaC,IAAIA,CAACC,GAAyB,EAAE;IAC3C,IAAI,CAACC,OAAO,GAAGD,GAAG,CAACC,OAAO;IAC1B,IAAI,CAACC,QAAQ,GAAGF,GAAG,CAACE,QAAQ;EAC9B;EAEOC,WAAWA,CAACC,QAAkB,EAAE;IACrC,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC1B;AASF;;AAEA;;AAmBA;;AAGA"}
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { EventEmitter } from 'events';
|
|
3
|
-
export type CaipAddress = `${string}:${string}:${string}`;
|
|
4
|
-
export type CaipNetworkId = `${string}:${string}`;
|
|
5
|
-
export type ChainNamespace = 'eip155' | 'solana' | 'polkadot' | 'bip122';
|
|
6
|
-
export type Network = {
|
|
7
|
-
id: number | string;
|
|
8
|
-
name: string;
|
|
9
|
-
nativeCurrency: {
|
|
10
|
-
name: string;
|
|
11
|
-
symbol: string;
|
|
12
|
-
decimals: number;
|
|
13
|
-
};
|
|
14
|
-
rpcUrls: {
|
|
15
|
-
default: {
|
|
16
|
-
http: readonly string[];
|
|
17
|
-
};
|
|
18
|
-
[key: string]: {
|
|
19
|
-
http: readonly string[];
|
|
20
|
-
} | undefined;
|
|
21
|
-
};
|
|
22
|
-
blockExplorers?: {
|
|
23
|
-
default: {
|
|
24
|
-
name: string;
|
|
25
|
-
url: string;
|
|
26
|
-
};
|
|
27
|
-
[key: string]: {
|
|
28
|
-
name: string;
|
|
29
|
-
url: string;
|
|
30
|
-
} | undefined;
|
|
31
|
-
};
|
|
32
|
-
chainNamespace?: ChainNamespace;
|
|
33
|
-
caipNetworkId?: CaipNetworkId;
|
|
34
|
-
testnet?: boolean;
|
|
35
|
-
deprecatedCaipNetworkId?: CaipNetworkId;
|
|
36
|
-
};
|
|
37
|
-
export type AppKitNetwork = Network & {
|
|
38
|
-
chainNamespace: ChainNamespace;
|
|
39
|
-
caipNetworkId: CaipNetworkId;
|
|
40
|
-
testnet?: boolean;
|
|
41
|
-
deprecatedCaipNetworkId?: CaipNetworkId;
|
|
42
|
-
};
|
|
43
|
-
export interface CaipNetwork {
|
|
44
|
-
id: CaipNetworkId;
|
|
45
|
-
name?: string;
|
|
46
|
-
imageId?: string;
|
|
47
|
-
imageUrl?: string;
|
|
48
|
-
}
|
|
49
|
-
export interface Balance {
|
|
50
|
-
name: string;
|
|
51
|
-
symbol: string;
|
|
52
|
-
chainId: string;
|
|
53
|
-
address?: CaipAddress;
|
|
54
|
-
value?: number;
|
|
55
|
-
price: number;
|
|
56
|
-
quantity: BalanceQuantity;
|
|
57
|
-
iconUrl: string;
|
|
58
|
-
}
|
|
59
|
-
type BalanceQuantity = {
|
|
60
|
-
decimals: string;
|
|
61
|
-
numeric: string;
|
|
62
|
-
};
|
|
63
|
-
export type TransactionStatus = 'confirmed' | 'failed' | 'pending';
|
|
64
|
-
export type TransactionDirection = 'in' | 'out' | 'self';
|
|
65
|
-
export type TransactionImage = {
|
|
66
|
-
type: 'FUNGIBLE' | 'NFT' | undefined;
|
|
67
|
-
url: string | undefined;
|
|
68
|
-
};
|
|
69
|
-
export interface Transaction {
|
|
70
|
-
id: string;
|
|
71
|
-
metadata: TransactionMetadata;
|
|
72
|
-
transfers: TransactionTransfer[];
|
|
73
|
-
}
|
|
74
|
-
export interface TransactionMetadata {
|
|
75
|
-
application: {
|
|
76
|
-
iconUrl: string | null;
|
|
77
|
-
name: string | null;
|
|
78
|
-
};
|
|
79
|
-
operationType: string;
|
|
80
|
-
hash: string;
|
|
81
|
-
minedAt: string;
|
|
82
|
-
sentFrom: string;
|
|
83
|
-
sentTo: string;
|
|
84
|
-
status: TransactionStatus;
|
|
85
|
-
nonce: number;
|
|
86
|
-
chain?: string;
|
|
87
|
-
}
|
|
88
|
-
export interface TransactionTransfer {
|
|
89
|
-
fungible_info?: {
|
|
90
|
-
name?: string;
|
|
91
|
-
symbol?: string;
|
|
92
|
-
icon?: {
|
|
93
|
-
url: string;
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
nft_info?: TransactionNftInfo;
|
|
97
|
-
direction: TransactionDirection;
|
|
98
|
-
quantity: TransactionQuantity;
|
|
99
|
-
value?: number;
|
|
100
|
-
price?: number;
|
|
101
|
-
}
|
|
102
|
-
export interface TransactionNftInfo {
|
|
103
|
-
name?: string;
|
|
104
|
-
content?: TransactionContent;
|
|
105
|
-
flags: TransactionNftInfoFlags;
|
|
106
|
-
}
|
|
107
|
-
export interface TransactionNftInfoFlags {
|
|
108
|
-
is_spam: boolean;
|
|
109
|
-
}
|
|
110
|
-
export interface TransactionContent {
|
|
111
|
-
preview?: TransactionPreview;
|
|
112
|
-
detail?: TransactionDetail;
|
|
113
|
-
}
|
|
114
|
-
export interface TransactionPreview {
|
|
115
|
-
url: string;
|
|
116
|
-
content_type?: null;
|
|
117
|
-
}
|
|
118
|
-
export interface TransactionDetail {
|
|
119
|
-
url: string;
|
|
120
|
-
content_type?: null;
|
|
121
|
-
}
|
|
122
|
-
export interface TransactionQuantity {
|
|
123
|
-
numeric: string;
|
|
124
|
-
}
|
|
125
|
-
export type SocialProvider = 'apple' | 'x' | 'discord' | 'farcaster';
|
|
126
|
-
export type ThemeMode = 'dark' | 'light';
|
|
127
|
-
export interface ThemeVariables {
|
|
128
|
-
accent?: string;
|
|
129
|
-
}
|
|
130
|
-
export interface Token {
|
|
131
|
-
address: string;
|
|
132
|
-
image?: string;
|
|
133
|
-
}
|
|
134
|
-
export type Tokens = Record<CaipNetworkId, Token>;
|
|
135
|
-
export type ConnectorType = 'WALLET_CONNECT' | 'COINBASE' | 'AUTH' | 'EXTERNAL';
|
|
136
|
-
export type Metadata = {
|
|
137
|
-
name: string;
|
|
138
|
-
description: string;
|
|
139
|
-
url: string;
|
|
140
|
-
icons: string[];
|
|
141
|
-
redirect?: {
|
|
142
|
-
native?: string;
|
|
143
|
-
universal?: string;
|
|
144
|
-
linkMode?: boolean;
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
export type AccountsChangedEvent = {
|
|
148
|
-
accounts: string[];
|
|
149
|
-
};
|
|
150
|
-
export type ChainChangedEvent = {
|
|
151
|
-
chainId: string;
|
|
152
|
-
};
|
|
153
|
-
export type DisconnectEvent = {};
|
|
154
|
-
export type BalanceChangedEvent = {
|
|
155
|
-
address: CaipAddress;
|
|
156
|
-
balance: {
|
|
157
|
-
amount: string;
|
|
158
|
-
symbol: string;
|
|
159
|
-
contractAddress?: ContractAddress;
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
export interface AdapterEvents {
|
|
163
|
-
accountsChanged: (event: AccountsChangedEvent) => void;
|
|
164
|
-
chainChanged: (event: ChainChangedEvent) => void;
|
|
165
|
-
disconnect: (event: DisconnectEvent) => void;
|
|
166
|
-
balanceChanged: (event: BalanceChangedEvent) => void;
|
|
167
|
-
}
|
|
168
|
-
export interface GetBalanceParams {
|
|
169
|
-
address?: CaipAddress;
|
|
170
|
-
network?: AppKitNetwork;
|
|
171
|
-
tokens?: Tokens;
|
|
172
|
-
}
|
|
173
|
-
type ContractAddress = CaipAddress;
|
|
174
|
-
export interface GetBalanceResponse {
|
|
175
|
-
amount: string;
|
|
176
|
-
symbol: string;
|
|
177
|
-
contractAddress?: ContractAddress;
|
|
178
|
-
}
|
|
179
|
-
interface BaseNamespace {
|
|
180
|
-
chains?: CaipNetworkId[];
|
|
181
|
-
accounts: CaipAddress[];
|
|
182
|
-
methods: string[];
|
|
183
|
-
events: string[];
|
|
184
|
-
}
|
|
185
|
-
type Namespace = BaseNamespace;
|
|
186
|
-
export type Namespaces = Record<string, Namespace>;
|
|
187
|
-
export type ProposalNamespaces = Record<string, Omit<Namespace, 'accounts'> & Required<Pick<Namespace, 'chains'>> & {
|
|
188
|
-
rpcMap: Record<string, string>;
|
|
189
|
-
}>;
|
|
190
|
-
export type ConnectOptions = {
|
|
191
|
-
namespaces?: ProposalNamespaces;
|
|
192
|
-
defaultChain?: CaipNetworkId;
|
|
193
|
-
universalLink?: string;
|
|
194
|
-
};
|
|
195
|
-
export type ConnectorInitOptions = {
|
|
196
|
-
storage: Storage;
|
|
197
|
-
metadata: Metadata;
|
|
198
|
-
};
|
|
199
|
-
export declare abstract class WalletConnector extends EventEmitter {
|
|
200
|
-
type: New_ConnectorType;
|
|
201
|
-
protected provider?: Provider;
|
|
202
|
-
protected namespaces?: Namespaces;
|
|
203
|
-
protected wallet?: WalletInfo;
|
|
204
|
-
protected storage?: Storage;
|
|
205
|
-
protected metadata?: Metadata;
|
|
206
|
-
constructor({ type }: {
|
|
207
|
-
type: New_ConnectorType;
|
|
208
|
-
});
|
|
209
|
-
init(ops: ConnectorInitOptions): Promise<void>;
|
|
210
|
-
setProvider(provider: Provider): void;
|
|
211
|
-
abstract connect(opts: ConnectOptions): Promise<Namespaces | undefined>;
|
|
212
|
-
abstract disconnect(): Promise<void>;
|
|
213
|
-
abstract getProvider(): Provider;
|
|
214
|
-
abstract getNamespaces(): Namespaces;
|
|
215
|
-
abstract getChainId(namespace: ChainNamespace): CaipNetworkId | undefined;
|
|
216
|
-
abstract getWalletInfo(): WalletInfo | undefined;
|
|
217
|
-
abstract switchNetwork(network: AppKitNetwork): Promise<void>;
|
|
218
|
-
}
|
|
219
|
-
export interface Provider {
|
|
220
|
-
connect<T>(params?: any): Promise<T>;
|
|
221
|
-
disconnect(): Promise<void>;
|
|
222
|
-
request<T = unknown>(args: RequestArguments, chain?: string | undefined, expiry?: number | undefined): Promise<T>;
|
|
223
|
-
on(event: string, listener: (args?: any) => void): any;
|
|
224
|
-
off(event: string, listener: (args?: any) => void): any;
|
|
225
|
-
}
|
|
226
|
-
export interface RequestArguments {
|
|
227
|
-
method: string;
|
|
228
|
-
params?: unknown[] | Record<string, unknown> | object | undefined;
|
|
229
|
-
}
|
|
230
|
-
export type New_ConnectorType = 'walletconnect' | 'coinbase' | 'auth' | 'phantom';
|
|
231
|
-
export interface ConnectionResponse {
|
|
232
|
-
accounts: string[];
|
|
233
|
-
chainId: string;
|
|
234
|
-
[key: string]: any;
|
|
235
|
-
}
|
|
236
|
-
export interface WalletInfo {
|
|
237
|
-
name?: string;
|
|
238
|
-
icon?: string;
|
|
239
|
-
description?: string;
|
|
240
|
-
url?: string;
|
|
241
|
-
icons?: string[];
|
|
242
|
-
redirect?: {
|
|
243
|
-
native?: string;
|
|
244
|
-
universal?: string;
|
|
245
|
-
linkMode?: boolean;
|
|
246
|
-
};
|
|
247
|
-
[key: string]: unknown;
|
|
248
|
-
}
|
|
249
|
-
export interface Storage {
|
|
250
|
-
/**
|
|
251
|
-
* Returns all keys in storage.
|
|
252
|
-
*/
|
|
253
|
-
getKeys(): Promise<string[]>;
|
|
254
|
-
/**
|
|
255
|
-
* Returns all key-value entries in storage.
|
|
256
|
-
*/
|
|
257
|
-
getEntries<T = any>(): Promise<[string, T][]>;
|
|
258
|
-
/**
|
|
259
|
-
* Get an item from storage for a given key.
|
|
260
|
-
* @param key The key to retrieve.
|
|
261
|
-
*/
|
|
262
|
-
getItem<T = any>(key: string): Promise<T | undefined>;
|
|
263
|
-
/**
|
|
264
|
-
* Set an item in storage for a given key.
|
|
265
|
-
* @param key The key to set.
|
|
266
|
-
* @param value The value to set.
|
|
267
|
-
*/
|
|
268
|
-
setItem<T = any>(key: string, value: T): Promise<void>;
|
|
269
|
-
/**
|
|
270
|
-
* Remove an item from storage for a given key.
|
|
271
|
-
* @param key The key to remove.
|
|
272
|
-
*/
|
|
273
|
-
removeItem(key: string): Promise<void>;
|
|
274
|
-
}
|
|
275
|
-
export {};
|
|
276
|
-
//# sourceMappingURL=TypeUtil.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TypeUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/TypeUtil.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,MAAM,WAAW,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEzE,MAAM,MAAM,OAAO,GAAG;IAEpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,EAA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