@cosmosapp/pay_sdk 2.3.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +97 -61
- package/dist/{chunk-B3HT6MCO.js → chunk-6FIALX2E.js} +3 -3
- package/dist/{chunk-B3HT6MCO.js.map → chunk-6FIALX2E.js.map} +1 -1
- package/dist/{chunk-AYVWYEOK.js → chunk-6PHQBYQ4.js} +2 -2
- package/dist/chunk-6PHQBYQ4.js.map +1 -0
- package/dist/chunk-ALFITFBN.js +105 -0
- package/dist/chunk-ALFITFBN.js.map +1 -0
- package/dist/chunk-PAQHOXQ6.js +392 -0
- package/dist/chunk-PAQHOXQ6.js.map +1 -0
- package/dist/{cosmosProvider-DTz0Y8xZ.d.cts → cosmosProvider-BrpOdL_b.d.cts} +3 -3
- package/dist/{cosmosProvider-DTz0Y8xZ.d.ts → cosmosProvider-BrpOdL_b.d.ts} +3 -3
- package/dist/errors-CZu5mmz1.d.cts +293 -0
- package/dist/errors-Cqh7UdUO.d.ts +293 -0
- package/dist/index.cjs +18 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -7
- package/dist/index.d.ts +12 -7
- package/dist/index.js +19 -6
- package/dist/index.js.map +1 -1
- package/dist/intent-input-BybnwL83.d.ts +126 -0
- package/dist/intent-input-C2PTr2XH.d.cts +126 -0
- package/dist/swk/index.cjs +2 -2
- package/dist/swk/index.cjs.map +1 -1
- package/dist/swk/index.d.cts +7 -7
- package/dist/swk/index.d.ts +7 -7
- package/dist/swk/index.js +2 -104
- package/dist/swk/index.js.map +1 -1
- package/dist/wallets/index.cjs +1043 -0
- package/dist/wallets/index.cjs.map +1 -0
- package/dist/wallets/index.d.cts +384 -0
- package/dist/wallets/index.d.ts +384 -0
- package/dist/wallets/index.js +629 -0
- package/dist/wallets/index.js.map +1 -0
- package/dist/{intent-input-CP5bkBYI.d.cts → wallets-CeIjESt5.d.cts} +39 -126
- package/dist/{intent-input-CP5bkBYI.d.ts → wallets-CeIjESt5.d.ts} +39 -126
- package/dist/web/index.cjs +4 -4
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.d.cts +11 -296
- package/dist/web/index.d.ts +11 -296
- package/dist/web/index.js +6 -392
- package/dist/web/index.js.map +1 -1
- package/llms/07-webhooks.md +2 -0
- package/llms/15-swaps.md +2 -0
- package/llms/18-wallets.md +94 -0
- package/llms/llms-full.txt +101 -0
- package/llms/llms.txt +1 -0
- package/package.json +22 -8
- package/dist/chunk-AYVWYEOK.js.map +0 -1
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import { StellarNetwork, InjectedWallets, WalletAdapter } from '../web/index.js';
|
|
2
|
+
export { a as WalletError } from '../errors-Cqh7UdUO.js';
|
|
3
|
+
import '../wallets-CeIjESt5.js';
|
|
4
|
+
import '../cosmosProvider-BrpOdL_b.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The wallets a person can sign with, across the networks Cosmos Pay works with: one shape per
|
|
8
|
+
* ecosystem, all discovered from the browser by {@link discoverWallets}. Nothing here imports a
|
|
9
|
+
* wallet library: each ecosystem is reached through its own open standard (a wallet's injected
|
|
10
|
+
* provider, EIP-6963 for EVM wallets, Wallet Standard for Solana wallets), or through a Stellar
|
|
11
|
+
* Wallets Kit instance the app passes in.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** The families of wallets this module reaches. */
|
|
15
|
+
type Ecosystem = 'stellar' | 'evm' | 'solana';
|
|
16
|
+
/** What every wallet tells about itself. */
|
|
17
|
+
interface WalletDescriptor {
|
|
18
|
+
/** Stable id, unique across ecosystems (`stellar:freighter`, `evm:io.metamask`, `solana:phantom`). */
|
|
19
|
+
readonly id: string;
|
|
20
|
+
/** The wallet's own name, as it presents itself. */
|
|
21
|
+
readonly name: string;
|
|
22
|
+
/** The wallet's own icon (a data: or https: URL), when it gives one. */
|
|
23
|
+
readonly icon?: string;
|
|
24
|
+
readonly ecosystem: Ecosystem;
|
|
25
|
+
}
|
|
26
|
+
/** Options for signing a Stellar transaction. */
|
|
27
|
+
interface StellarSignOptions {
|
|
28
|
+
/** `public` (mainnet) or `testnet`: the passphrase is derived from it. */
|
|
29
|
+
network: StellarNetwork;
|
|
30
|
+
/** The account expected to sign (multi-account wallets pick the right key). */
|
|
31
|
+
address?: string;
|
|
32
|
+
}
|
|
33
|
+
/** A Stellar wallet: connects for a `G…` address and signs a transaction envelope (base64 XDR). */
|
|
34
|
+
interface StellarWallet extends WalletDescriptor {
|
|
35
|
+
readonly ecosystem: 'stellar';
|
|
36
|
+
/** Ask the wallet for its address (it may prompt for permission). */
|
|
37
|
+
connect(network: StellarNetwork): Promise<string>;
|
|
38
|
+
/** Sign `xdr` and answer the signed envelope (base64 XDR). Nothing is submitted. */
|
|
39
|
+
signTransaction(xdr: string, options: StellarSignOptions): Promise<string>;
|
|
40
|
+
}
|
|
41
|
+
/** An EIP-1193 provider, the interface every EVM wallet exposes. */
|
|
42
|
+
interface Eip1193Provider {
|
|
43
|
+
request(args: {
|
|
44
|
+
method: string;
|
|
45
|
+
params?: unknown[] | Record<string, unknown>;
|
|
46
|
+
}): Promise<unknown>;
|
|
47
|
+
on?(event: string, listener: (...args: unknown[]) => void): void;
|
|
48
|
+
removeListener?(event: string, listener: (...args: unknown[]) => void): void;
|
|
49
|
+
}
|
|
50
|
+
/** An EVM chain a wallet may need to switch to (or add first). */
|
|
51
|
+
interface EvmChain {
|
|
52
|
+
/** EIP-155 id (143 for Monad, 1 for Ethereum...). */
|
|
53
|
+
chainId: number;
|
|
54
|
+
/** Shown by the wallet when it adds the chain. */
|
|
55
|
+
chainName: string;
|
|
56
|
+
nativeCurrency: {
|
|
57
|
+
name: string;
|
|
58
|
+
symbol: string;
|
|
59
|
+
decimals: number;
|
|
60
|
+
};
|
|
61
|
+
rpcUrls: string[];
|
|
62
|
+
blockExplorerUrls?: string[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A transaction an EVM wallet sends (`eth_sendTransaction`). Amounts are decimal strings of wei
|
|
66
|
+
* (or 0x-hex); the wallet estimates gas and fees unless given.
|
|
67
|
+
*/
|
|
68
|
+
interface EvmTransaction {
|
|
69
|
+
/** The sender: the connected account. */
|
|
70
|
+
from: string;
|
|
71
|
+
to: string;
|
|
72
|
+
data?: string;
|
|
73
|
+
value?: string;
|
|
74
|
+
gas?: string;
|
|
75
|
+
maxFeePerGas?: string;
|
|
76
|
+
maxPriorityFeePerGas?: string;
|
|
77
|
+
/** The chain the transaction is for: the wallet is asked to switch to it first. */
|
|
78
|
+
chainId?: number;
|
|
79
|
+
}
|
|
80
|
+
/** An EVM wallet (MetaMask, Rabby, Coinbase Wallet, any EIP-6963 wallet). */
|
|
81
|
+
interface EvmWallet extends WalletDescriptor {
|
|
82
|
+
readonly ecosystem: 'evm';
|
|
83
|
+
/** The wallet's provider, for anything this module does not wrap. */
|
|
84
|
+
readonly provider: Eip1193Provider;
|
|
85
|
+
/** The wallet's reverse-DNS id from EIP-6963 (`io.metamask`), when announced. */
|
|
86
|
+
readonly rdns?: string;
|
|
87
|
+
/** Ask for the accounts and answer the first one (0x, as the wallet gives it). */
|
|
88
|
+
connect(): Promise<string>;
|
|
89
|
+
/** The chain the wallet is on (EIP-155 id). */
|
|
90
|
+
chainId(): Promise<number>;
|
|
91
|
+
/** Switch the wallet to `chain`, adding it first when the wallet does not know it. */
|
|
92
|
+
switchChain(chain: EvmChain | number): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Send `tx` from the wallet (it signs and broadcasts; EVM wallets cannot hand a signed
|
|
95
|
+
* transaction back) and answer its hash. Switches chain first when `tx.chainId` is set.
|
|
96
|
+
*/
|
|
97
|
+
sendTransaction(tx: EvmTransaction, chain?: EvmChain): Promise<string>;
|
|
98
|
+
}
|
|
99
|
+
/** Solana clusters, as Wallet Standard names them. */
|
|
100
|
+
type SolanaChain = 'solana:mainnet' | 'solana:devnet' | 'solana:testnet';
|
|
101
|
+
/** A Solana wallet (Phantom, Solflare, Backpack, any Wallet Standard wallet). */
|
|
102
|
+
interface SolanaWallet extends WalletDescriptor {
|
|
103
|
+
readonly ecosystem: 'solana';
|
|
104
|
+
/** The clusters the wallet supports. */
|
|
105
|
+
readonly chains: readonly string[];
|
|
106
|
+
/** Ask the wallet for its account and answer its address (base58). */
|
|
107
|
+
connect(): Promise<string>;
|
|
108
|
+
/**
|
|
109
|
+
* Sign a serialized transaction (base64 wire bytes) and answer the signed one (base64):
|
|
110
|
+
* nothing is broadcast, so a service can check it and relay it.
|
|
111
|
+
*/
|
|
112
|
+
signTransaction(transaction: string, chain?: SolanaChain): Promise<string>;
|
|
113
|
+
/** Whether the wallet can also sign and send in one step. */
|
|
114
|
+
readonly canSignAndSend: boolean;
|
|
115
|
+
/** Sign and broadcast (base64 wire bytes in), answering the signature (base58). */
|
|
116
|
+
signAndSendTransaction(transaction: string, chain?: SolanaChain): Promise<string>;
|
|
117
|
+
}
|
|
118
|
+
type AnyWallet = StellarWallet | EvmWallet | SolanaWallet;
|
|
119
|
+
/** A wallet as a Stellar Wallets Kit lists it. */
|
|
120
|
+
interface StellarKitWallet {
|
|
121
|
+
id: string;
|
|
122
|
+
name: string;
|
|
123
|
+
icon?: string;
|
|
124
|
+
isAvailable?: boolean;
|
|
125
|
+
type?: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* The parts of a Stellar Wallets Kit this module uses, in the kit's own API: v2's static class
|
|
129
|
+
* (`StellarWalletsKit` after `StellarWalletsKit.init({ modules })`) and a v1 instance
|
|
130
|
+
* (`new StellarWalletsKit({...})`) both fit.
|
|
131
|
+
*/
|
|
132
|
+
interface StellarWalletsKitLike {
|
|
133
|
+
/** v2: the kit's wallets, each checked for availability. */
|
|
134
|
+
refreshSupportedWallets?(): Promise<StellarKitWallet[]>;
|
|
135
|
+
/** v1: the kit's wallets. */
|
|
136
|
+
getSupportedWallets?(): Promise<StellarKitWallet[]>;
|
|
137
|
+
setWallet(id: string): void;
|
|
138
|
+
/** v2: asks the selected wallet for its address (`getAddress` only reads the kit's memory). */
|
|
139
|
+
fetchAddress?(): Promise<{
|
|
140
|
+
address: string;
|
|
141
|
+
}>;
|
|
142
|
+
getAddress(): Promise<{
|
|
143
|
+
address: string;
|
|
144
|
+
}>;
|
|
145
|
+
signTransaction(xdr: string, opts?: {
|
|
146
|
+
networkPassphrase?: string;
|
|
147
|
+
address?: string;
|
|
148
|
+
}): Promise<{
|
|
149
|
+
signedTxXdr: string;
|
|
150
|
+
signerAddress?: string;
|
|
151
|
+
}>;
|
|
152
|
+
}
|
|
153
|
+
/** The browser objects discovery listens on (the page's `window`, or a stand-in in tests). */
|
|
154
|
+
interface WalletWindow extends EventTarget {
|
|
155
|
+
ethereum?: unknown;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Stellar wallets: the SDK's own adapters (Freighter, xBull, Rabet, LOBSTR, Albedo, Cosmos Pay
|
|
160
|
+
* Wallet), the wallets that inject a provider (Hana, Klever, OneKey, Bitget, Cactus Link, D'CENT,
|
|
161
|
+
* Scopuly), plus every wallet of a Stellar Wallets Kit the app passes in (MetaMask's Stellar Snap,
|
|
162
|
+
* Ledger, Trezor, WalletConnect...). A wallet several reach is listed once, the first way, with the
|
|
163
|
+
* kit's name and icon.
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
interface StellarDiscoveryOptions {
|
|
167
|
+
/** Wallet libraries for the adapters that have no global (see `InjectedWallets`). */
|
|
168
|
+
injected?: InjectedWallets;
|
|
169
|
+
/** Adapters to use in place of the default set. */
|
|
170
|
+
adapters?: WalletAdapter[];
|
|
171
|
+
/** A Stellar Wallets Kit instance: its wallets join the list. */
|
|
172
|
+
kit?: StellarWalletsKitLike;
|
|
173
|
+
/** Look for the wallets that inject a provider (default true). */
|
|
174
|
+
injectedProviders?: boolean;
|
|
175
|
+
/** The window those wallets inject into (default the page's). */
|
|
176
|
+
window?: WalletWindow;
|
|
177
|
+
/**
|
|
178
|
+
* How long an adapter has to say it is available (default 2500 ms). An extension that is not
|
|
179
|
+
* installed may never answer its probe; past this it counts as absent.
|
|
180
|
+
*/
|
|
181
|
+
availabilityTimeoutMs?: number;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* The Stellar wallets this browser can sign with right now: the installed or configured
|
|
185
|
+
* adapters first, in their detection order, then the wallets that injected a provider, then the
|
|
186
|
+
* kit's other available wallets.
|
|
187
|
+
*/
|
|
188
|
+
declare function discoverStellarWallets(options?: StellarDiscoveryOptions): Promise<StellarWallet[]>;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* EVM wallets (MetaMask, Rabby, Coinbase Wallet, OKX, Phantom's EVM side, any EIP-6963 wallet):
|
|
192
|
+
* each announces its provider on `eip6963:announceProvider` when the page asks with
|
|
193
|
+
* `eip6963:requestProvider`. A wallet too old to announce is reached through `window.ethereum`.
|
|
194
|
+
*/
|
|
195
|
+
|
|
196
|
+
/** A mined transaction, as {@link EvmWallet.waitForTransaction} answers it. */
|
|
197
|
+
interface EvmReceipt {
|
|
198
|
+
hash: string;
|
|
199
|
+
status: 'success' | 'reverted';
|
|
200
|
+
blockNumber: number;
|
|
201
|
+
}
|
|
202
|
+
interface EvmWaitOptions {
|
|
203
|
+
/** Give up after this long (default two minutes). */
|
|
204
|
+
timeoutMs?: number;
|
|
205
|
+
/** How often to ask (default 1.5 s). */
|
|
206
|
+
intervalMs?: number;
|
|
207
|
+
}
|
|
208
|
+
/** An EVM wallet, with a wait for a transaction it sent. */
|
|
209
|
+
interface DiscoveredEvmWallet extends EvmWallet {
|
|
210
|
+
/** Wait until `hash` is mined and answer its receipt (asked through the wallet's own node). */
|
|
211
|
+
waitForTransaction(hash: string, options?: EvmWaitOptions): Promise<EvmReceipt>;
|
|
212
|
+
}
|
|
213
|
+
/** Wrap one EIP-1193 provider. */
|
|
214
|
+
declare function evmWallet(provider: Eip1193Provider, info: {
|
|
215
|
+
id: string;
|
|
216
|
+
name: string;
|
|
217
|
+
icon?: string;
|
|
218
|
+
rdns?: string;
|
|
219
|
+
}): DiscoveredEvmWallet;
|
|
220
|
+
interface EvmDiscoveryOptions {
|
|
221
|
+
/** How long to listen for announcements (default 200 ms). */
|
|
222
|
+
timeoutMs?: number;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* The EVM wallets in this browser: every EIP-6963 announcement (one per wallet, by `rdns`), or
|
|
226
|
+
* the `window.ethereum` provider when nothing announced.
|
|
227
|
+
*/
|
|
228
|
+
declare function discoverEvmWallets(win: WalletWindow | undefined, options?: EvmDiscoveryOptions): Promise<DiscoveredEvmWallet[]>;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Stellar wallets that inject a provider into the page and need no library: Hana, Klever, OneKey,
|
|
232
|
+
* Bitget, Cactus Link, D'CENT and Scopuly. Each is reached the way the wallet documents (and the
|
|
233
|
+
* Stellar Wallets Kit's own modules do), so an app gets them without depending on the kit.
|
|
234
|
+
*/
|
|
235
|
+
|
|
236
|
+
type Provider = Record<string, (...args: unknown[]) => Promise<unknown>>;
|
|
237
|
+
interface InjectedStellarSpec {
|
|
238
|
+
id: string;
|
|
239
|
+
name: string;
|
|
240
|
+
provider(win: Record<string, any>): Provider | undefined;
|
|
241
|
+
address(provider: Provider): Promise<unknown>;
|
|
242
|
+
sign(provider: Provider, xdr: string, opts: {
|
|
243
|
+
networkPassphrase: string;
|
|
244
|
+
address?: string;
|
|
245
|
+
}): Promise<unknown>;
|
|
246
|
+
}
|
|
247
|
+
declare const INJECTED_STELLAR_WALLETS: readonly InjectedStellarSpec[];
|
|
248
|
+
/** The injected Stellar wallets present in `win`. */
|
|
249
|
+
declare function discoverInjectedStellarWallets(win: WalletWindow | undefined): StellarWallet[];
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Solana wallets (Phantom, Solflare, Backpack, any Wallet Standard wallet). A wallet registers
|
|
253
|
+
* itself by dispatching `wallet-standard:register-wallet`; the page announces itself with
|
|
254
|
+
* `wallet-standard:app-ready` so wallets that loaded first register too. Same protocol as
|
|
255
|
+
* `@wallet-standard/app`, without the dependency.
|
|
256
|
+
*/
|
|
257
|
+
|
|
258
|
+
/** A Wallet Standard account (the parts used here). */
|
|
259
|
+
interface StandardAccount {
|
|
260
|
+
address: string;
|
|
261
|
+
publicKey?: Uint8Array;
|
|
262
|
+
chains?: readonly string[];
|
|
263
|
+
features?: readonly string[];
|
|
264
|
+
}
|
|
265
|
+
/** A Wallet Standard wallet (the parts used here). */
|
|
266
|
+
interface StandardWallet {
|
|
267
|
+
name: string;
|
|
268
|
+
icon?: string;
|
|
269
|
+
chains: readonly string[];
|
|
270
|
+
accounts: readonly StandardAccount[];
|
|
271
|
+
features: Record<string, unknown>;
|
|
272
|
+
}
|
|
273
|
+
/** Bytes to base58 (Solana addresses and signatures). */
|
|
274
|
+
declare function bytesToBase58(bytes: Uint8Array): string;
|
|
275
|
+
/** Wrap one Wallet Standard wallet. */
|
|
276
|
+
declare function solanaWallet(wallet: StandardWallet): SolanaWallet;
|
|
277
|
+
/** The Solana wallets registered in this browser (Wallet Standard). */
|
|
278
|
+
declare function discoverSolanaWallets(win: WalletWindow | undefined): SolanaWallet[];
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Small, dependency-free encodings the wallets need in a browser (no Node `Buffer` there):
|
|
282
|
+
* base64 to bytes and back, and amounts to the 0x-hex an EVM wallet takes.
|
|
283
|
+
*/
|
|
284
|
+
/** base64 (standard alphabet) to bytes. */
|
|
285
|
+
declare function base64ToBytes(base64: string): Uint8Array;
|
|
286
|
+
/** Bytes to base64 (standard alphabet). */
|
|
287
|
+
declare function bytesToBase64(bytes: Uint8Array): string;
|
|
288
|
+
/**
|
|
289
|
+
* A wei amount as an EVM wallet takes it: 0x-hex. Accepts a decimal string of wei, a 0x-hex
|
|
290
|
+
* string, a bigint or a safe integer, from 0 to 2^256 - 1.
|
|
291
|
+
*/
|
|
292
|
+
declare function toQuantity(value: string | number | bigint): string;
|
|
293
|
+
/**
|
|
294
|
+
* The call data of an ERC-20 `transfer(to, amount)`: selector a9059cbb, the recipient and the
|
|
295
|
+
* amount (in the token's smallest unit) each as a 32-byte word.
|
|
296
|
+
*/
|
|
297
|
+
declare function erc20TransferData(to: string, amount: string | bigint): string;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* EIP-681 payment links (`ethereum:...`), the EVM links Cosmos Pay hands out for a deposit, as the
|
|
301
|
+
* transaction an EVM wallet sends: a native payment (`ethereum:<to>@<chainId>?value=<wei>`) or an
|
|
302
|
+
* ERC-20 transfer (`ethereum:<token>@<chainId>/transfer?address=<to>&uint256=<amount>`).
|
|
303
|
+
*/
|
|
304
|
+
/** The transaction a link asks for, without its sender. */
|
|
305
|
+
interface Eip681Transaction {
|
|
306
|
+
chainId: number;
|
|
307
|
+
to: string;
|
|
308
|
+
/** Wei, 0x-hex (absent for a token transfer). */
|
|
309
|
+
value?: string;
|
|
310
|
+
/** The ERC-20 `transfer` call (absent for a native payment). */
|
|
311
|
+
data?: string;
|
|
312
|
+
}
|
|
313
|
+
/** Read an EIP-681 payment link. Throws on any other kind of link. */
|
|
314
|
+
declare function parseEip681(uri: string): Eip681Transaction;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* `@cosmosapp/pay_sdk/wallets`: every wallet a person can sign with, across ecosystems, from one
|
|
318
|
+
* call. Stellar wallets through the SDK's adapters (and a Stellar Wallets Kit, when passed), EVM
|
|
319
|
+
* wallets through EIP-6963 (MetaMask, Rabby, Coinbase Wallet...), Solana wallets through Wallet
|
|
320
|
+
* Standard (Phantom, Solflare, Backpack...). No wallet library is bundled or required.
|
|
321
|
+
*
|
|
322
|
+
* @example
|
|
323
|
+
* import { discoverWallets } from '@cosmosapp/pay_sdk/wallets';
|
|
324
|
+
*
|
|
325
|
+
* const wallets = await discoverWallets({ ecosystems: ['evm'] });
|
|
326
|
+
* const metamask = wallets.find((w) => w.ecosystem === 'evm');
|
|
327
|
+
* const from = await metamask.connect();
|
|
328
|
+
* const hash = await metamask.sendTransaction({ from, to, data, value, chainId: 143 }, EvmChains.monad);
|
|
329
|
+
*/
|
|
330
|
+
|
|
331
|
+
/** EVM chains Cosmos Pay works on, ready for {@link EvmWallet.switchChain}. */
|
|
332
|
+
declare const EvmChains: {
|
|
333
|
+
readonly monad: {
|
|
334
|
+
readonly chainId: 143;
|
|
335
|
+
readonly chainName: "Monad";
|
|
336
|
+
readonly nativeCurrency: {
|
|
337
|
+
readonly name: "Monad";
|
|
338
|
+
readonly symbol: "MON";
|
|
339
|
+
readonly decimals: 18;
|
|
340
|
+
};
|
|
341
|
+
readonly rpcUrls: ["https://rpc.monad.xyz"];
|
|
342
|
+
readonly blockExplorerUrls: ["https://monadscan.com"];
|
|
343
|
+
};
|
|
344
|
+
readonly monadTestnet: {
|
|
345
|
+
readonly chainId: 10143;
|
|
346
|
+
readonly chainName: "Monad Testnet";
|
|
347
|
+
readonly nativeCurrency: {
|
|
348
|
+
readonly name: "Monad";
|
|
349
|
+
readonly symbol: "MON";
|
|
350
|
+
readonly decimals: 18;
|
|
351
|
+
};
|
|
352
|
+
readonly rpcUrls: ["https://testnet-rpc.monad.xyz"];
|
|
353
|
+
readonly blockExplorerUrls: ["https://testnet.monadexplorer.com"];
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
interface DiscoverWalletsOptions {
|
|
357
|
+
/** Which ecosystems to look in (default all three). */
|
|
358
|
+
ecosystems?: Ecosystem[];
|
|
359
|
+
/** Stellar: injected wallet libraries, adapters, a Stellar Wallets Kit. */
|
|
360
|
+
stellar?: StellarDiscoveryOptions;
|
|
361
|
+
/** The window to look in (default the page's; none outside a browser). */
|
|
362
|
+
window?: WalletWindow;
|
|
363
|
+
/** How long EVM wallets get to announce themselves (default 200 ms). */
|
|
364
|
+
timeoutMs?: number;
|
|
365
|
+
}
|
|
366
|
+
/** The wallets of each ecosystem, as {@link discoverWallets} answers them. */
|
|
367
|
+
interface DiscoveredWallets {
|
|
368
|
+
stellar: StellarWallet[];
|
|
369
|
+
evm: DiscoveredEvmWallet[];
|
|
370
|
+
solana: SolanaWallet[];
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Every wallet this browser can sign with, by ecosystem. Outside a browser (SSR) every list is
|
|
374
|
+
* empty, unless `window` is given.
|
|
375
|
+
*/
|
|
376
|
+
declare function discoverWallets(options?: DiscoverWalletsOptions): Promise<DiscoveredWallets>;
|
|
377
|
+
/**
|
|
378
|
+
* Whether `error` is the person declining in their wallet (closing the prompt, pressing
|
|
379
|
+
* reject), as opposed to a failure worth reporting.
|
|
380
|
+
*/
|
|
381
|
+
declare function isUserRejection(error: unknown): boolean;
|
|
382
|
+
|
|
383
|
+
export { EvmChains, INJECTED_STELLAR_WALLETS, base64ToBytes, bytesToBase58, bytesToBase64, discoverEvmWallets, discoverInjectedStellarWallets, discoverSolanaWallets, discoverStellarWallets, discoverWallets, erc20TransferData, evmWallet, isUserRejection, parseEip681, solanaWallet, toQuantity };
|
|
384
|
+
export type { AnyWallet, DiscoverWalletsOptions, DiscoveredEvmWallet, DiscoveredWallets, Ecosystem, Eip1193Provider, Eip681Transaction, EvmChain, EvmDiscoveryOptions, EvmReceipt, EvmTransaction, EvmWaitOptions, EvmWallet, SolanaChain, SolanaWallet, StandardWallet, StellarDiscoveryOptions, StellarKitWallet, StellarSignOptions, StellarWallet, StellarWalletsKitLike, WalletDescriptor, WalletWindow };
|