@wtflabs/x402 0.0.1-beta.4 → 0.0.1-beta.6

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.
Files changed (81) hide show
  1. package/dist/cjs/client/index.d.ts +1 -1
  2. package/dist/cjs/client/index.js +7 -2
  3. package/dist/cjs/client/index.js.map +1 -1
  4. package/dist/cjs/facilitator/index.d.ts +1 -1
  5. package/dist/cjs/facilitator/index.js +444 -87
  6. package/dist/cjs/facilitator/index.js.map +1 -1
  7. package/dist/cjs/index.d.ts +1 -1
  8. package/dist/cjs/index.js +445 -88
  9. package/dist/cjs/index.js.map +1 -1
  10. package/dist/cjs/{middleware-Brgsx32F.d.ts → middleware-nzDe-TDJ.d.ts} +1 -1
  11. package/dist/cjs/paywall/index.d.ts +1 -1
  12. package/dist/cjs/schemes/index.d.ts +25 -7
  13. package/dist/cjs/schemes/index.js +477 -95
  14. package/dist/cjs/schemes/index.js.map +1 -1
  15. package/dist/cjs/shared/index.d.ts +2 -2
  16. package/dist/cjs/shared/index.js +6 -1
  17. package/dist/cjs/shared/index.js.map +1 -1
  18. package/dist/cjs/types/index.d.ts +93 -4
  19. package/dist/cjs/types/index.js +64 -1
  20. package/dist/cjs/types/index.js.map +1 -1
  21. package/dist/cjs/verify/index.d.ts +2 -2
  22. package/dist/cjs/verify/index.js +6 -1
  23. package/dist/cjs/verify/index.js.map +1 -1
  24. package/dist/{esm/x402Specs-CYq5tSY1.d.mts → cjs/x402Specs-BtRXj67U.d.ts} +43 -10
  25. package/dist/esm/{chunk-G6WN2WYX.mjs → chunk-3SCH5JL2.mjs} +433 -98
  26. package/dist/esm/chunk-3SCH5JL2.mjs.map +1 -0
  27. package/dist/esm/{chunk-2AM3S66N.mjs → chunk-7MNUQUHN.mjs} +3 -3
  28. package/dist/esm/{chunk-34YNR4LY.mjs → chunk-KABV25HJ.mjs} +3 -3
  29. package/dist/esm/{chunk-UCBE7FDY.mjs → chunk-NPWDNT2P.mjs} +67 -2
  30. package/dist/esm/chunk-NPWDNT2P.mjs.map +1 -0
  31. package/dist/esm/{chunk-RX2JKK4O.mjs → chunk-VTLJOZXM.mjs} +3 -3
  32. package/dist/esm/chunk-VTLJOZXM.mjs.map +1 -0
  33. package/dist/esm/client/index.d.mts +1 -1
  34. package/dist/esm/client/index.mjs +3 -3
  35. package/dist/esm/facilitator/index.d.mts +1 -1
  36. package/dist/esm/facilitator/index.mjs +4 -4
  37. package/dist/esm/index.d.mts +1 -1
  38. package/dist/esm/index.mjs +5 -5
  39. package/dist/esm/{middleware-BSjsPDKM.d.mts → middleware-DSDucaQ5.d.mts} +1 -1
  40. package/dist/esm/paywall/index.d.mts +1 -1
  41. package/dist/esm/schemes/index.d.mts +25 -7
  42. package/dist/esm/schemes/index.mjs +3 -3
  43. package/dist/esm/shared/index.d.mts +2 -2
  44. package/dist/esm/shared/index.mjs +1 -1
  45. package/dist/esm/types/index.d.mts +93 -4
  46. package/dist/esm/types/index.mjs +1 -1
  47. package/dist/esm/verify/index.d.mts +2 -2
  48. package/dist/esm/verify/index.mjs +1 -1
  49. package/dist/{cjs/x402Specs-CYq5tSY1.d.ts → esm/x402Specs-BtRXj67U.d.mts} +43 -10
  50. package/package.json +15 -15
  51. package/dist/cjs/middleware-6_1ApcJn.d.ts +0 -93
  52. package/dist/cjs/middleware-B_ewwsQp.d.ts +0 -93
  53. package/dist/cjs/middleware-BwfW7mAs.d.ts +0 -93
  54. package/dist/cjs/middleware-CQb61c1k.d.ts +0 -93
  55. package/dist/cjs/middleware-DB9lqy9f.d.ts +0 -93
  56. package/dist/cjs/middleware-DcHctwQV.d.ts +0 -93
  57. package/dist/cjs/middleware-De0jD3Bp.d.ts +0 -93
  58. package/dist/cjs/middleware-HoFOmpgv.d.ts +0 -93
  59. package/dist/cjs/middleware-Y8AiAfYw.d.ts +0 -93
  60. package/dist/cjs/middleware-pnres9YM.d.ts +0 -93
  61. package/dist/cjs/network-RtNddYQk.d.ts +0 -11
  62. package/dist/cjs/rpc-Ca8eHCWz.d.ts +0 -35
  63. package/dist/cjs/wallet-BRWfOM5D.d.ts +0 -153
  64. package/dist/cjs/wallet-BYRAGtOB.d.ts +0 -153
  65. package/dist/cjs/wallet-BmEtlgEf.d.ts +0 -48
  66. package/dist/cjs/wallet-CNOAmyZ6.d.ts +0 -48
  67. package/dist/cjs/wallet-D1SoxFTw.d.ts +0 -48
  68. package/dist/cjs/wallet-SJ-hbjm9.d.ts +0 -153
  69. package/dist/cjs/wallet-ecnda4Aj.d.ts +0 -48
  70. package/dist/cjs/wallet-gP8Qoi-c.d.ts +0 -74
  71. package/dist/cjs/x402Specs-B7InXo2L.d.ts +0 -1065
  72. package/dist/cjs/x402Specs-BLH3j34O.d.ts +0 -1696
  73. package/dist/cjs/x402Specs-C7LipAZg.d.ts +0 -1715
  74. package/dist/cjs/x402Specs-CeajqonG.d.ts +0 -1696
  75. package/dist/cjs/x402Specs-qMujgEV5.d.ts +0 -1715
  76. package/dist/cjs/x402Specs-qUBCpcuz.d.ts +0 -1715
  77. package/dist/esm/chunk-G6WN2WYX.mjs.map +0 -1
  78. package/dist/esm/chunk-RX2JKK4O.mjs.map +0 -1
  79. package/dist/esm/chunk-UCBE7FDY.mjs.map +0 -1
  80. /package/dist/esm/{chunk-2AM3S66N.mjs.map → chunk-7MNUQUHN.mjs.map} +0 -0
  81. /package/dist/esm/{chunk-34YNR4LY.mjs.map → chunk-KABV25HJ.mjs.map} +0 -0
@@ -1,153 +0,0 @@
1
- import { Chain, Transport, Account, Client, RpcSchema, PublicActions, WalletActions, LocalAccount, PublicClient, Hex } from 'viem';
2
- import { baseSepolia, avalancheFuji } from 'viem/chains';
3
-
4
- /**
5
- * Chain configuration options for creating a signer
6
- */
7
- type EvmChainConfig = string | Chain | {
8
- chainId: number;
9
- name: string;
10
- rpcUrl: string;
11
- nativeCurrency?: {
12
- name: string;
13
- symbol: string;
14
- decimals: number;
15
- };
16
- blockExplorer?: {
17
- name: string;
18
- url: string;
19
- };
20
- };
21
- type SignerWallet<chain extends Chain = Chain, transport extends Transport = Transport, account extends Account = Account> = Client<transport, chain, account, RpcSchema, PublicActions<transport, chain, account> & WalletActions<chain, account>>;
22
- type ConnectedClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain, account extends Account | undefined = undefined> = PublicClient<transport, chain, account>;
23
- type EvmSigner = SignerWallet<Chain, Transport, Account> | LocalAccount;
24
- /**
25
- * Creates a public client configured for the specified network
26
- *
27
- * @param network - The network to connect to
28
- * @returns A public client instance connected to the specified chain
29
- */
30
- declare function createConnectedClient(network: string): ConnectedClient<Transport, Chain, undefined>;
31
- /**
32
- * Creates a public client configured for the Base Sepolia testnet
33
- *
34
- * @deprecated Use `createConnectedClient("base-sepolia")` instead
35
- * @returns A public client instance connected to Base Sepolia
36
- */
37
- declare function createClientSepolia(): ConnectedClient<Transport, typeof baseSepolia, undefined>;
38
- /**
39
- * Creates a public client configured for the Avalanche Fuji testnet
40
- *
41
- * @deprecated Use `createConnectedClient("avalanche-fuji")` instead
42
- * @returns A public client instance connected to Avalanche Fuji
43
- */
44
- declare function createClientAvalancheFuji(): ConnectedClient<Transport, typeof avalancheFuji, undefined>;
45
- /**
46
- * Creates a wallet client configured for the specified chain with a private key
47
- *
48
- * @param network - The network to connect to
49
- * @param privateKey - The private key to use for signing transactions
50
- * @returns A wallet client instance connected to the specified chain with the provided private key
51
- */
52
- declare function createSigner(network: string, privateKey: Hex): SignerWallet<Chain>;
53
- /**
54
- * Creates a wallet client configured for the Base Sepolia testnet with a private key
55
- *
56
- * @deprecated Use `createSigner("base-sepolia", privateKey)` instead
57
- * @param privateKey - The private key to use for signing transactions
58
- * @returns A wallet client instance connected to Base Sepolia with the provided private key
59
- */
60
- declare function createSignerSepolia(privateKey: Hex): SignerWallet<typeof baseSepolia>;
61
- /**
62
- * Creates a wallet client configured for the Avalanche Fuji testnet with a private key
63
- *
64
- * @deprecated Use `createSigner("avalanche-fuji", privateKey)` instead
65
- * @param privateKey - The private key to use for signing transactions
66
- * @returns A wallet client instance connected to Avalanche Fuji with the provided private key
67
- */
68
- declare function createSignerAvalancheFuji(privateKey: Hex): SignerWallet<typeof avalancheFuji>;
69
- /**
70
- * Checks if a wallet is a signer wallet
71
- *
72
- * @param wallet - The wallet to check
73
- * @returns True if the wallet is a signer wallet, false otherwise
74
- */
75
- declare function isSignerWallet<TChain extends Chain = Chain, TTransport extends Transport = Transport, TAccount extends Account = Account>(wallet: SignerWallet<TChain, TTransport, TAccount> | LocalAccount): wallet is SignerWallet<TChain, TTransport, TAccount>;
76
- /**
77
- * Checks if a wallet is an account
78
- *
79
- * @param wallet - The wallet to check
80
- * @returns True if the wallet is an account, false otherwise
81
- */
82
- declare function isAccount<TChain extends Chain = Chain, TTransport extends Transport = Transport, TAccount extends Account = Account>(wallet: SignerWallet<TChain, TTransport, TAccount> | LocalAccount): wallet is LocalAccount;
83
- /**
84
- * Maps network strings to Chain objects
85
- *
86
- * @param network - The network string to convert to a Chain object
87
- * @returns The corresponding Chain object
88
- */
89
- declare function getChainFromNetwork(network: string | undefined): Chain;
90
- /**
91
- * Resolves an EvmChainConfig into a viem Chain object
92
- *
93
- * @param config - The chain configuration (string, Chain object, or custom config)
94
- * @param customRpcUrl - Optional custom RPC URL to override the default
95
- * @returns A viem Chain object
96
- *
97
- * @example
98
- * ```typescript
99
- * // Using string
100
- * const chain = resolveChainConfig('bsc');
101
- *
102
- * // Using viem chain object
103
- * import { bsc } from 'viem/chains';
104
- * const chain = resolveChainConfig(bsc);
105
- *
106
- * // Using custom config
107
- * const chain = resolveChainConfig({
108
- * chainId: 56,
109
- * name: 'BSC',
110
- * rpcUrl: 'https://my-custom-rpc.com',
111
- * });
112
- *
113
- * // Override RPC for existing chain
114
- * const chain = resolveChainConfig('bsc', 'https://my-custom-rpc.com');
115
- * ```
116
- */
117
- declare function resolveChainConfig(config: EvmChainConfig, customRpcUrl?: string): Chain;
118
- /**
119
- * Creates a wallet client with flexible chain configuration
120
- *
121
- * @param chainConfig - The chain configuration (string, Chain object, or custom config)
122
- * @param privateKey - The private key to use for signing transactions
123
- * @param customRpcUrl - Optional custom RPC URL to override the default
124
- * @returns A wallet client instance
125
- *
126
- * @example
127
- * ```typescript
128
- * // Simple usage with network name
129
- * const signer = createEvmSigner('bsc', '0x...');
130
- *
131
- * // Using viem chain object
132
- * import { bsc } from 'viem/chains';
133
- * const signer = createEvmSigner(bsc, '0x...');
134
- *
135
- * // With custom RPC
136
- * const signer = createEvmSigner('bsc', '0x...', 'https://my-custom-rpc.com');
137
- *
138
- * // Full custom chain
139
- * const signer = createEvmSigner({
140
- * chainId: 56,
141
- * name: 'BSC Mainnet',
142
- * rpcUrl: 'https://bsc-dataseed.binance.org',
143
- * nativeCurrency: {
144
- * name: 'BNB',
145
- * symbol: 'BNB',
146
- * decimals: 18,
147
- * },
148
- * }, '0x...');
149
- * ```
150
- */
151
- declare function createEvmSigner(chainConfig: EvmChainConfig, privateKey: Hex, customRpcUrl?: string): SignerWallet<Chain>;
152
-
153
- export { type ConnectedClient as C, type EvmSigner as E, type SignerWallet as S, type EvmChainConfig as a, createClientSepolia as b, createClientAvalancheFuji as c, createConnectedClient as d, createEvmSigner as e, createSigner as f, createSignerAvalancheFuji as g, createSignerSepolia as h, getChainFromNetwork as i, isAccount as j, isSignerWallet as k, resolveChainConfig as r };
@@ -1,48 +0,0 @@
1
- import { E as EvmSigner, C as ConnectedClient$1 } from './wallet-BYRAGtOB.js';
2
- import { S as SvmSigner, a as SvmConnectedClient } from './wallet-BTqCm9Zp.js';
3
- import { Hex } from 'viem';
4
-
5
- type ConnectedClient = ConnectedClient$1 | SvmConnectedClient;
6
- type Signer = EvmSigner | SvmSigner;
7
- type MultiNetworkSigner = {
8
- evm: EvmSigner;
9
- svm: SvmSigner;
10
- };
11
- /**
12
- * Creates a public client configured for the specified network.
13
- *
14
- * @param network - The network to connect to.
15
- * @returns A public client instance connected to the specified chain.
16
- */
17
- declare function createConnectedClient(network: string): ConnectedClient;
18
- /**
19
- * Creates a wallet client configured for the specified chain with a private key.
20
- *
21
- * @param network - The network to connect to.
22
- * @param privateKey - The private key to use for signing transactions. This should be a hex string for EVM or a base58 encoded string for SVM.
23
- * @returns A wallet client instance connected to the specified chain with the provided private key.
24
- */
25
- declare function createSigner(network: string, privateKey: Hex | string): Promise<Signer>;
26
- /**
27
- * Checks if the given wallet is an EVM signer wallet.
28
- *
29
- * @param wallet - The object wallet to check.
30
- * @returns True if the wallet is an EVM signer wallet, false otherwise.
31
- */
32
- declare function isEvmSignerWallet(wallet: Signer): wallet is EvmSigner;
33
- /**
34
- * Checks if the given wallet is an SVM signer wallet
35
- *
36
- * @param wallet - The object wallet to check
37
- * @returns True if the wallet is an SVM signer wallet, false otherwise
38
- */
39
- declare function isSvmSignerWallet(wallet: Signer): wallet is SvmSigner;
40
- /**
41
- * Checks if the given wallet is a multi network signer wallet
42
- *
43
- * @param wallet - The object wallet to check
44
- * @returns True if the wallet is a multi network signer wallet, false otherwise
45
- */
46
- declare function isMultiNetworkSigner(wallet: object): wallet is MultiNetworkSigner;
47
-
48
- export { type ConnectedClient as C, type MultiNetworkSigner as M, type Signer as S, createSigner as a, isSvmSignerWallet as b, createConnectedClient as c, isMultiNetworkSigner as d, isEvmSignerWallet as i };
@@ -1,48 +0,0 @@
1
- import { E as EvmSigner, C as ConnectedClient$1 } from './wallet-BRWfOM5D.js';
2
- import { S as SvmSigner, a as SvmConnectedClient } from './wallet-BTqCm9Zp.js';
3
- import { Hex } from 'viem';
4
-
5
- type ConnectedClient = ConnectedClient$1 | SvmConnectedClient;
6
- type Signer = EvmSigner | SvmSigner;
7
- type MultiNetworkSigner = {
8
- evm: EvmSigner;
9
- svm: SvmSigner;
10
- };
11
- /**
12
- * Creates a public client configured for the specified network.
13
- *
14
- * @param network - The network to connect to.
15
- * @returns A public client instance connected to the specified chain.
16
- */
17
- declare function createConnectedClient(network: string): ConnectedClient;
18
- /**
19
- * Creates a wallet client configured for the specified chain with a private key.
20
- *
21
- * @param network - The network to connect to.
22
- * @param privateKey - The private key to use for signing transactions. This should be a hex string for EVM or a base58 encoded string for SVM.
23
- * @returns A wallet client instance connected to the specified chain with the provided private key.
24
- */
25
- declare function createSigner(network: string, privateKey: Hex | string): Promise<Signer>;
26
- /**
27
- * Checks if the given wallet is an EVM signer wallet.
28
- *
29
- * @param wallet - The object wallet to check.
30
- * @returns True if the wallet is an EVM signer wallet, false otherwise.
31
- */
32
- declare function isEvmSignerWallet(wallet: Signer): wallet is EvmSigner;
33
- /**
34
- * Checks if the given wallet is an SVM signer wallet
35
- *
36
- * @param wallet - The object wallet to check
37
- * @returns True if the wallet is an SVM signer wallet, false otherwise
38
- */
39
- declare function isSvmSignerWallet(wallet: Signer): wallet is SvmSigner;
40
- /**
41
- * Checks if the given wallet is a multi network signer wallet
42
- *
43
- * @param wallet - The object wallet to check
44
- * @returns True if the wallet is a multi network signer wallet, false otherwise
45
- */
46
- declare function isMultiNetworkSigner(wallet: object): wallet is MultiNetworkSigner;
47
-
48
- export { type ConnectedClient as C, type MultiNetworkSigner as M, type Signer as S, createSigner as a, isSvmSignerWallet as b, createConnectedClient as c, isMultiNetworkSigner as d, isEvmSignerWallet as i };
@@ -1,48 +0,0 @@
1
- import { E as EvmSigner, C as ConnectedClient$1 } from './wallet-gP8Qoi-c.js';
2
- import { S as SvmSigner, a as SvmConnectedClient } from './wallet-BTqCm9Zp.js';
3
- import { Hex } from 'viem';
4
-
5
- type ConnectedClient = ConnectedClient$1 | SvmConnectedClient;
6
- type Signer = EvmSigner | SvmSigner;
7
- type MultiNetworkSigner = {
8
- evm: EvmSigner;
9
- svm: SvmSigner;
10
- };
11
- /**
12
- * Creates a public client configured for the specified network.
13
- *
14
- * @param network - The network to connect to.
15
- * @returns A public client instance connected to the specified chain.
16
- */
17
- declare function createConnectedClient(network: string): ConnectedClient;
18
- /**
19
- * Creates a wallet client configured for the specified chain with a private key.
20
- *
21
- * @param network - The network to connect to.
22
- * @param privateKey - The private key to use for signing transactions. This should be a hex string for EVM or a base58 encoded string for SVM.
23
- * @returns A wallet client instance connected to the specified chain with the provided private key.
24
- */
25
- declare function createSigner(network: string, privateKey: Hex | string): Promise<Signer>;
26
- /**
27
- * Checks if the given wallet is an EVM signer wallet.
28
- *
29
- * @param wallet - The object wallet to check.
30
- * @returns True if the wallet is an EVM signer wallet, false otherwise.
31
- */
32
- declare function isEvmSignerWallet(wallet: Signer): wallet is EvmSigner;
33
- /**
34
- * Checks if the given wallet is an SVM signer wallet
35
- *
36
- * @param wallet - The object wallet to check
37
- * @returns True if the wallet is an SVM signer wallet, false otherwise
38
- */
39
- declare function isSvmSignerWallet(wallet: Signer): wallet is SvmSigner;
40
- /**
41
- * Checks if the given wallet is a multi network signer wallet
42
- *
43
- * @param wallet - The object wallet to check
44
- * @returns True if the wallet is a multi network signer wallet, false otherwise
45
- */
46
- declare function isMultiNetworkSigner(wallet: object): wallet is MultiNetworkSigner;
47
-
48
- export { type ConnectedClient as C, type MultiNetworkSigner as M, type Signer as S, createSigner as a, isSvmSignerWallet as b, createConnectedClient as c, isMultiNetworkSigner as d, isEvmSignerWallet as i };
@@ -1,153 +0,0 @@
1
- import { Chain, Transport, Account, Client, RpcSchema, PublicActions, WalletActions, LocalAccount, PublicClient, Hex } from 'viem';
2
- import { baseSepolia, avalancheFuji } from 'viem/chains';
3
-
4
- /**
5
- * Chain configuration options for creating a signer
6
- */
7
- type EvmChainConfig = string | Chain | {
8
- chainId: number;
9
- name: string;
10
- rpcUrl: string;
11
- nativeCurrency?: {
12
- name: string;
13
- symbol: string;
14
- decimals: number;
15
- };
16
- blockExplorer?: {
17
- name: string;
18
- url: string;
19
- };
20
- };
21
- type SignerWallet<chain extends Chain = Chain, transport extends Transport = Transport, account extends Account = Account> = Client<transport, chain, account, RpcSchema, PublicActions<transport, chain, account> & WalletActions<chain, account>>;
22
- type ConnectedClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain, account extends Account | undefined = undefined> = PublicClient<transport, chain, account>;
23
- type EvmSigner = SignerWallet<Chain, Transport, Account> | LocalAccount;
24
- /**
25
- * Creates a public client configured for the specified network
26
- *
27
- * @param network - The network to connect to
28
- * @returns A public client instance connected to the specified chain
29
- */
30
- declare function createConnectedClient(network: string): ConnectedClient<Transport, Chain, undefined>;
31
- /**
32
- * Creates a public client configured for the Base Sepolia testnet
33
- *
34
- * @deprecated Use `createConnectedClient("base-sepolia")` instead
35
- * @returns A public client instance connected to Base Sepolia
36
- */
37
- declare function createClientSepolia(): ConnectedClient<Transport, typeof baseSepolia, undefined>;
38
- /**
39
- * Creates a public client configured for the Avalanche Fuji testnet
40
- *
41
- * @deprecated Use `createConnectedClient("avalanche-fuji")` instead
42
- * @returns A public client instance connected to Avalanche Fuji
43
- */
44
- declare function createClientAvalancheFuji(): ConnectedClient<Transport, typeof avalancheFuji, undefined>;
45
- /**
46
- * Creates a wallet client configured for the specified chain with a private key
47
- *
48
- * @param network - The network to connect to
49
- * @param privateKey - The private key to use for signing transactions
50
- * @returns A wallet client instance connected to the specified chain with the provided private key
51
- */
52
- declare function createSigner(network: string, privateKey: Hex): SignerWallet<Chain>;
53
- /**
54
- * Creates a wallet client configured for the Base Sepolia testnet with a private key
55
- *
56
- * @deprecated Use `createSigner("base-sepolia", privateKey)` instead
57
- * @param privateKey - The private key to use for signing transactions
58
- * @returns A wallet client instance connected to Base Sepolia with the provided private key
59
- */
60
- declare function createSignerSepolia(privateKey: Hex): SignerWallet<typeof baseSepolia>;
61
- /**
62
- * Creates a wallet client configured for the Avalanche Fuji testnet with a private key
63
- *
64
- * @deprecated Use `createSigner("avalanche-fuji", privateKey)` instead
65
- * @param privateKey - The private key to use for signing transactions
66
- * @returns A wallet client instance connected to Avalanche Fuji with the provided private key
67
- */
68
- declare function createSignerAvalancheFuji(privateKey: Hex): SignerWallet<typeof avalancheFuji>;
69
- /**
70
- * Checks if a wallet is a signer wallet
71
- *
72
- * @param wallet - The wallet to check
73
- * @returns True if the wallet is a signer wallet, false otherwise
74
- */
75
- declare function isSignerWallet<TChain extends Chain = Chain, TTransport extends Transport = Transport, TAccount extends Account = Account>(wallet: SignerWallet<TChain, TTransport, TAccount> | LocalAccount): wallet is SignerWallet<TChain, TTransport, TAccount>;
76
- /**
77
- * Checks if a wallet is an account
78
- *
79
- * @param wallet - The wallet to check
80
- * @returns True if the wallet is an account, false otherwise
81
- */
82
- declare function isAccount<TChain extends Chain = Chain, TTransport extends Transport = Transport, TAccount extends Account = Account>(wallet: SignerWallet<TChain, TTransport, TAccount> | LocalAccount): wallet is LocalAccount;
83
- /**
84
- * Maps network strings to Chain objects
85
- *
86
- * @param network - The network string to convert to a Chain object
87
- * @returns The corresponding Chain object
88
- */
89
- declare function getChainFromNetwork(network: string | undefined): Chain;
90
- /**
91
- * Resolves an EvmChainConfig into a viem Chain object
92
- *
93
- * @param config - The chain configuration (string, Chain object, or custom config)
94
- * @param customRpcUrl - Optional custom RPC URL to override the default
95
- * @returns A viem Chain object
96
- *
97
- * @example
98
- * ```typescript
99
- * // Using string
100
- * const chain = resolveChainConfig('bsc');
101
- *
102
- * // Using viem chain object
103
- * import { bsc } from 'viem/chains';
104
- * const chain = resolveChainConfig(bsc);
105
- *
106
- * // Using custom config
107
- * const chain = resolveChainConfig({
108
- * chainId: 56,
109
- * name: 'BSC',
110
- * rpcUrl: 'https://my-custom-rpc.com',
111
- * });
112
- *
113
- * // Override RPC for existing chain
114
- * const chain = resolveChainConfig('bsc', 'https://my-custom-rpc.com');
115
- * ```
116
- */
117
- declare function resolveChainConfig(config: EvmChainConfig, customRpcUrl?: string): Chain;
118
- /**
119
- * Creates a wallet client with flexible chain configuration
120
- *
121
- * @param chainConfig - The chain configuration (string, Chain object, or custom config)
122
- * @param privateKey - The private key to use for signing transactions
123
- * @param customRpcUrl - Optional custom RPC URL to override the default
124
- * @returns A wallet client instance
125
- *
126
- * @example
127
- * ```typescript
128
- * // Simple usage with network name
129
- * const signer = createEvmSigner('bsc', '0x...');
130
- *
131
- * // Using viem chain object
132
- * import { bsc } from 'viem/chains';
133
- * const signer = createEvmSigner(bsc, '0x...');
134
- *
135
- * // With custom RPC
136
- * const signer = createEvmSigner('bsc', '0x...', 'https://my-custom-rpc.com');
137
- *
138
- * // Full custom chain
139
- * const signer = createEvmSigner({
140
- * chainId: 56,
141
- * name: 'BSC Mainnet',
142
- * rpcUrl: 'https://bsc-dataseed.binance.org',
143
- * nativeCurrency: {
144
- * name: 'BNB',
145
- * symbol: 'BNB',
146
- * decimals: 18,
147
- * },
148
- * }, '0x...');
149
- * ```
150
- */
151
- declare function createEvmSigner(chainConfig: EvmChainConfig, privateKey: Hex, customRpcUrl?: string): SignerWallet<Chain>;
152
-
153
- export { type ConnectedClient as C, type EvmSigner as E, type SignerWallet as S, type EvmChainConfig as a, createClientAvalancheFuji as b, createEvmSigner as c, createClientSepolia as d, createConnectedClient as e, createSigner as f, createSignerAvalancheFuji as g, createSignerSepolia as h, getChainFromNetwork as i, isAccount as j, isSignerWallet as k, resolveChainConfig as r };
@@ -1,48 +0,0 @@
1
- import { E as EvmSigner, C as ConnectedClient$1 } from './wallet-SJ-hbjm9.js';
2
- import { S as SvmSigner, a as SvmConnectedClient } from './wallet-BTqCm9Zp.js';
3
- import { Hex } from 'viem';
4
-
5
- type ConnectedClient = ConnectedClient$1 | SvmConnectedClient;
6
- type Signer = EvmSigner | SvmSigner;
7
- type MultiNetworkSigner = {
8
- evm: EvmSigner;
9
- svm: SvmSigner;
10
- };
11
- /**
12
- * Creates a public client configured for the specified network.
13
- *
14
- * @param network - The network to connect to.
15
- * @returns A public client instance connected to the specified chain.
16
- */
17
- declare function createConnectedClient(network: string): ConnectedClient;
18
- /**
19
- * Creates a wallet client configured for the specified chain with a private key.
20
- *
21
- * @param network - The network to connect to.
22
- * @param privateKey - The private key to use for signing transactions. This should be a hex string for EVM or a base58 encoded string for SVM.
23
- * @returns A wallet client instance connected to the specified chain with the provided private key.
24
- */
25
- declare function createSigner(network: string, privateKey: Hex | string): Promise<Signer>;
26
- /**
27
- * Checks if the given wallet is an EVM signer wallet.
28
- *
29
- * @param wallet - The object wallet to check.
30
- * @returns True if the wallet is an EVM signer wallet, false otherwise.
31
- */
32
- declare function isEvmSignerWallet(wallet: Signer): wallet is EvmSigner;
33
- /**
34
- * Checks if the given wallet is an SVM signer wallet
35
- *
36
- * @param wallet - The object wallet to check
37
- * @returns True if the wallet is an SVM signer wallet, false otherwise
38
- */
39
- declare function isSvmSignerWallet(wallet: Signer): wallet is SvmSigner;
40
- /**
41
- * Checks if the given wallet is a multi network signer wallet
42
- *
43
- * @param wallet - The object wallet to check
44
- * @returns True if the wallet is a multi network signer wallet, false otherwise
45
- */
46
- declare function isMultiNetworkSigner(wallet: object): wallet is MultiNetworkSigner;
47
-
48
- export { type ConnectedClient as C, type MultiNetworkSigner as M, type Signer as S, createSigner as a, isSvmSignerWallet as b, createConnectedClient as c, isMultiNetworkSigner as d, isEvmSignerWallet as i };
@@ -1,74 +0,0 @@
1
- import { Chain, Transport, Account, Client, RpcSchema, PublicActions, WalletActions, LocalAccount, PublicClient, Hex } from 'viem';
2
- import { baseSepolia, avalancheFuji } from 'viem/chains';
3
-
4
- type SignerWallet<chain extends Chain = Chain, transport extends Transport = Transport, account extends Account = Account> = Client<transport, chain, account, RpcSchema, PublicActions<transport, chain, account> & WalletActions<chain, account>>;
5
- type ConnectedClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain, account extends Account | undefined = undefined> = PublicClient<transport, chain, account>;
6
- type EvmSigner = SignerWallet<Chain, Transport, Account> | LocalAccount;
7
- /**
8
- * Creates a public client configured for the specified network
9
- *
10
- * @param network - The network to connect to
11
- * @returns A public client instance connected to the specified chain
12
- */
13
- declare function createConnectedClient(network: string): ConnectedClient<Transport, Chain, undefined>;
14
- /**
15
- * Creates a public client configured for the Base Sepolia testnet
16
- *
17
- * @deprecated Use `createConnectedClient("base-sepolia")` instead
18
- * @returns A public client instance connected to Base Sepolia
19
- */
20
- declare function createClientSepolia(): ConnectedClient<Transport, typeof baseSepolia, undefined>;
21
- /**
22
- * Creates a public client configured for the Avalanche Fuji testnet
23
- *
24
- * @deprecated Use `createConnectedClient("avalanche-fuji")` instead
25
- * @returns A public client instance connected to Avalanche Fuji
26
- */
27
- declare function createClientAvalancheFuji(): ConnectedClient<Transport, typeof avalancheFuji, undefined>;
28
- /**
29
- * Creates a wallet client configured for the specified chain with a private key
30
- *
31
- * @param network - The network to connect to
32
- * @param privateKey - The private key to use for signing transactions
33
- * @returns A wallet client instance connected to the specified chain with the provided private key
34
- */
35
- declare function createSigner(network: string, privateKey: Hex): SignerWallet<Chain>;
36
- /**
37
- * Creates a wallet client configured for the Base Sepolia testnet with a private key
38
- *
39
- * @deprecated Use `createSigner("base-sepolia", privateKey)` instead
40
- * @param privateKey - The private key to use for signing transactions
41
- * @returns A wallet client instance connected to Base Sepolia with the provided private key
42
- */
43
- declare function createSignerSepolia(privateKey: Hex): SignerWallet<typeof baseSepolia>;
44
- /**
45
- * Creates a wallet client configured for the Avalanche Fuji testnet with a private key
46
- *
47
- * @deprecated Use `createSigner("avalanche-fuji", privateKey)` instead
48
- * @param privateKey - The private key to use for signing transactions
49
- * @returns A wallet client instance connected to Avalanche Fuji with the provided private key
50
- */
51
- declare function createSignerAvalancheFuji(privateKey: Hex): SignerWallet<typeof avalancheFuji>;
52
- /**
53
- * Checks if a wallet is a signer wallet
54
- *
55
- * @param wallet - The wallet to check
56
- * @returns True if the wallet is a signer wallet, false otherwise
57
- */
58
- declare function isSignerWallet<TChain extends Chain = Chain, TTransport extends Transport = Transport, TAccount extends Account = Account>(wallet: SignerWallet<TChain, TTransport, TAccount> | LocalAccount): wallet is SignerWallet<TChain, TTransport, TAccount>;
59
- /**
60
- * Checks if a wallet is an account
61
- *
62
- * @param wallet - The wallet to check
63
- * @returns True if the wallet is an account, false otherwise
64
- */
65
- declare function isAccount<TChain extends Chain = Chain, TTransport extends Transport = Transport, TAccount extends Account = Account>(wallet: SignerWallet<TChain, TTransport, TAccount> | LocalAccount): wallet is LocalAccount;
66
- /**
67
- * Maps network strings to Chain objects
68
- *
69
- * @param network - The network string to convert to a Chain object
70
- * @returns The corresponding Chain object
71
- */
72
- declare function getChainFromNetwork(network: string | undefined): Chain;
73
-
74
- export { type ConnectedClient as C, type EvmSigner as E, type SignerWallet as S, createClientSepolia as a, createConnectedClient as b, createClientAvalancheFuji as c, createSigner as d, createSignerAvalancheFuji as e, createSignerSepolia as f, getChainFromNetwork as g, isSignerWallet as h, isAccount as i };