@imtbl/sdk 0.0.1-alpha.3 → 0.1.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.
@@ -1,692 +0,0 @@
1
- /// <reference types="node" />
2
- declare type Bytes = ArrayLike<number>;
3
- declare type BytesLike = Bytes | string;
4
- interface Hexable {
5
- toHexString(): string;
6
- }
7
-
8
- declare type BigNumberish = BigNumber | Bytes | bigint | string | number;
9
- declare class BigNumber implements Hexable {
10
- readonly _hex: string;
11
- readonly _isBigNumber: boolean;
12
- constructor(constructorGuard: any, hex: string);
13
- fromTwos(value: number): BigNumber;
14
- toTwos(value: number): BigNumber;
15
- abs(): BigNumber;
16
- add(other: BigNumberish): BigNumber;
17
- sub(other: BigNumberish): BigNumber;
18
- div(other: BigNumberish): BigNumber;
19
- mul(other: BigNumberish): BigNumber;
20
- mod(other: BigNumberish): BigNumber;
21
- pow(other: BigNumberish): BigNumber;
22
- and(other: BigNumberish): BigNumber;
23
- or(other: BigNumberish): BigNumber;
24
- xor(other: BigNumberish): BigNumber;
25
- mask(value: number): BigNumber;
26
- shl(value: number): BigNumber;
27
- shr(value: number): BigNumber;
28
- eq(other: BigNumberish): boolean;
29
- lt(other: BigNumberish): boolean;
30
- lte(other: BigNumberish): boolean;
31
- gt(other: BigNumberish): boolean;
32
- gte(other: BigNumberish): boolean;
33
- isNegative(): boolean;
34
- isZero(): boolean;
35
- toNumber(): number;
36
- toBigInt(): bigint;
37
- toString(): string;
38
- toHexString(): string;
39
- toJSON(key?: string): any;
40
- static from(value: any): BigNumber;
41
- static isBigNumber(value: any): value is BigNumber;
42
- }
43
-
44
- declare type Network = {
45
- name: string;
46
- chainId: number;
47
- ensAddress?: string;
48
- _defaultProvider?: (providers: any, options?: any) => any;
49
- };
50
- declare type Networkish = Network | string | number;
51
-
52
- declare type Deferrable<T> = {
53
- [K in keyof T]: T[K] | Promise<T[K]>;
54
- };
55
- declare class Description<T = any> {
56
- constructor(info: {
57
- [K in keyof T]: T[K];
58
- });
59
- }
60
-
61
- declare type AccessList = Array<{
62
- address: string;
63
- storageKeys: Array<string>;
64
- }>;
65
- declare type AccessListish = AccessList | Array<[string, Array<string>]> | Record<string, Array<string>>;
66
- interface Transaction$1 {
67
- hash?: string;
68
- to?: string;
69
- from?: string;
70
- nonce: number;
71
- gasLimit: BigNumber;
72
- gasPrice?: BigNumber;
73
- data: string;
74
- value: BigNumber;
75
- chainId: number;
76
- r?: string;
77
- s?: string;
78
- v?: number;
79
- type?: number | null;
80
- accessList?: AccessList;
81
- maxPriorityFeePerGas?: BigNumber;
82
- maxFeePerGas?: BigNumber;
83
- }
84
-
85
- declare type ConnectionInfo = {
86
- url: string;
87
- headers?: {
88
- [key: string]: string | number;
89
- };
90
- user?: string;
91
- password?: string;
92
- allowInsecureAuthentication?: boolean;
93
- allowGzip?: boolean;
94
- throttleLimit?: number;
95
- throttleSlotInterval?: number;
96
- throttleCallback?: (attempt: number, url: string) => Promise<boolean>;
97
- skipFetchSetup?: boolean;
98
- fetchOptions?: Record<string, string>;
99
- errorPassThrough?: boolean;
100
- timeout?: number;
101
- };
102
- interface OnceBlockable {
103
- once(eventName: "block", handler: () => void): void;
104
- }
105
-
106
- declare type TransactionRequest = {
107
- to?: string;
108
- from?: string;
109
- nonce?: BigNumberish;
110
- gasLimit?: BigNumberish;
111
- gasPrice?: BigNumberish;
112
- data?: BytesLike;
113
- value?: BigNumberish;
114
- chainId?: number;
115
- type?: number;
116
- accessList?: AccessListish;
117
- maxPriorityFeePerGas?: BigNumberish;
118
- maxFeePerGas?: BigNumberish;
119
- customData?: Record<string, any>;
120
- ccipReadEnabled?: boolean;
121
- };
122
- interface TransactionResponse extends Transaction$1 {
123
- hash: string;
124
- blockNumber?: number;
125
- blockHash?: string;
126
- timestamp?: number;
127
- confirmations: number;
128
- from: string;
129
- raw?: string;
130
- wait: (confirmations?: number) => Promise<TransactionReceipt>;
131
- }
132
- declare type BlockTag = string | number;
133
- interface _Block {
134
- hash: string;
135
- parentHash: string;
136
- number: number;
137
- timestamp: number;
138
- nonce: string;
139
- difficulty: number;
140
- _difficulty: BigNumber;
141
- gasLimit: BigNumber;
142
- gasUsed: BigNumber;
143
- miner: string;
144
- extraData: string;
145
- baseFeePerGas?: null | BigNumber;
146
- }
147
- interface Block extends _Block {
148
- transactions: Array<string>;
149
- }
150
- interface BlockWithTransactions extends _Block {
151
- transactions: Array<TransactionResponse>;
152
- }
153
- interface Log {
154
- blockNumber: number;
155
- blockHash: string;
156
- transactionIndex: number;
157
- removed: boolean;
158
- address: string;
159
- data: string;
160
- topics: Array<string>;
161
- transactionHash: string;
162
- logIndex: number;
163
- }
164
- interface TransactionReceipt {
165
- to: string;
166
- from: string;
167
- contractAddress: string;
168
- transactionIndex: number;
169
- root?: string;
170
- gasUsed: BigNumber;
171
- logsBloom: string;
172
- blockHash: string;
173
- transactionHash: string;
174
- logs: Array<Log>;
175
- blockNumber: number;
176
- confirmations: number;
177
- cumulativeGasUsed: BigNumber;
178
- effectiveGasPrice: BigNumber;
179
- byzantium: boolean;
180
- type: number;
181
- status?: number;
182
- }
183
- interface FeeData {
184
- lastBaseFeePerGas: null | BigNumber;
185
- maxFeePerGas: null | BigNumber;
186
- maxPriorityFeePerGas: null | BigNumber;
187
- gasPrice: null | BigNumber;
188
- }
189
- interface EventFilter {
190
- address?: string;
191
- topics?: Array<string | Array<string> | null>;
192
- }
193
- interface Filter extends EventFilter {
194
- fromBlock?: BlockTag;
195
- toBlock?: BlockTag;
196
- }
197
- interface FilterByBlockHash extends EventFilter {
198
- blockHash?: string;
199
- }
200
- declare abstract class ForkEvent extends Description {
201
- readonly expiry: number;
202
- readonly _isForkEvent?: boolean;
203
- static isForkEvent(value: any): value is ForkEvent;
204
- }
205
- declare type EventType = string | Array<string | Array<string>> | EventFilter | ForkEvent;
206
- declare type Listener = (...args: Array<any>) => void;
207
- declare abstract class Provider implements OnceBlockable {
208
- abstract getNetwork(): Promise<Network>;
209
- abstract getBlockNumber(): Promise<number>;
210
- abstract getGasPrice(): Promise<BigNumber>;
211
- getFeeData(): Promise<FeeData>;
212
- abstract getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;
213
- abstract getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;
214
- abstract getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
215
- abstract getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
216
- abstract sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
217
- abstract call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
218
- abstract estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
219
- abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
220
- abstract getBlockWithTransactions(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<BlockWithTransactions>;
221
- abstract getTransaction(transactionHash: string): Promise<TransactionResponse>;
222
- abstract getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
223
- abstract getLogs(filter: Filter): Promise<Array<Log>>;
224
- abstract resolveName(name: string | Promise<string>): Promise<null | string>;
225
- abstract lookupAddress(address: string | Promise<string>): Promise<null | string>;
226
- abstract on(eventName: EventType, listener: Listener): Provider;
227
- abstract once(eventName: EventType, listener: Listener): Provider;
228
- abstract emit(eventName: EventType, ...args: Array<any>): boolean;
229
- abstract listenerCount(eventName?: EventType): number;
230
- abstract listeners(eventName?: EventType): Array<Listener>;
231
- abstract off(eventName: EventType, listener?: Listener): Provider;
232
- abstract removeAllListeners(eventName?: EventType): Provider;
233
- addListener(eventName: EventType, listener: Listener): Provider;
234
- removeListener(eventName: EventType, listener: Listener): Provider;
235
- abstract waitForTransaction(transactionHash: string, confirmations?: number, timeout?: number): Promise<TransactionReceipt>;
236
- readonly _isProvider: boolean;
237
- constructor();
238
- static isProvider(value: any): value is Provider;
239
- }
240
-
241
- declare type FormatFunc = (value: any) => any;
242
- declare type FormatFuncs = {
243
- [key: string]: FormatFunc;
244
- };
245
- declare type Formats = {
246
- transaction: FormatFuncs;
247
- transactionRequest: FormatFuncs;
248
- receipt: FormatFuncs;
249
- receiptLog: FormatFuncs;
250
- block: FormatFuncs;
251
- blockWithTransactions: FormatFuncs;
252
- filter: FormatFuncs;
253
- filterLog: FormatFuncs;
254
- };
255
- declare class Formatter {
256
- readonly formats: Formats;
257
- constructor();
258
- getDefaultFormats(): Formats;
259
- accessList(accessList: Array<any>): AccessList;
260
- number(number: any): number;
261
- type(number: any): number;
262
- bigNumber(value: any): BigNumber;
263
- boolean(value: any): boolean;
264
- hex(value: any, strict?: boolean): string;
265
- data(value: any, strict?: boolean): string;
266
- address(value: any): string;
267
- callAddress(value: any): string;
268
- contractAddress(value: any): string;
269
- blockTag(blockTag: any): string;
270
- hash(value: any, strict?: boolean): string;
271
- difficulty(value: any): number;
272
- uint256(value: any): string;
273
- _block(value: any, format: any): Block;
274
- block(value: any): Block;
275
- blockWithTransactions(value: any): Block;
276
- transactionRequest(value: any): any;
277
- transactionResponse(transaction: any): TransactionResponse;
278
- transaction(value: any): any;
279
- receiptLog(value: any): any;
280
- receipt(value: any): TransactionReceipt;
281
- topics(value: any): any;
282
- filter(value: any): any;
283
- filterLog(value: any): any;
284
- static check(format: {
285
- [name: string]: FormatFunc;
286
- }, object: any): any;
287
- static allowNull(format: FormatFunc, nullValue?: any): FormatFunc;
288
- static allowFalsish(format: FormatFunc, replaceValue: any): FormatFunc;
289
- static arrayOf(format: FormatFunc): FormatFunc;
290
- }
291
-
292
- declare class Event {
293
- readonly listener: Listener;
294
- readonly once: boolean;
295
- readonly tag: string;
296
- _lastBlockNumber: number;
297
- _inflight: boolean;
298
- constructor(tag: string, listener: Listener, once: boolean);
299
- get event(): EventType;
300
- get type(): string;
301
- get hash(): string;
302
- get filter(): Filter;
303
- pollable(): boolean;
304
- }
305
- interface EnsResolver {
306
- readonly name: string;
307
- readonly address: string;
308
- getAddress(coinType?: 60): Promise<null | string>;
309
- getContentHash(): Promise<null | string>;
310
- getText(key: string): Promise<null | string>;
311
- }
312
- interface EnsProvider {
313
- resolveName(name: string): Promise<null | string>;
314
- lookupAddress(address: string): Promise<null | string>;
315
- getResolver(name: string): Promise<null | EnsResolver>;
316
- }
317
- interface Avatar {
318
- url: string;
319
- linkage: Array<{
320
- type: string;
321
- content: string;
322
- }>;
323
- }
324
- declare class Resolver implements EnsResolver {
325
- readonly provider: BaseProvider;
326
- readonly name: string;
327
- readonly address: string;
328
- readonly _resolvedAddress: null | string;
329
- _supportsEip2544: null | Promise<boolean>;
330
- constructor(provider: BaseProvider, address: string, name: string, resolvedAddress?: string);
331
- supportsWildcard(): Promise<boolean>;
332
- _fetch(selector: string, parameters?: string): Promise<null | string>;
333
- _fetchBytes(selector: string, parameters?: string): Promise<null | string>;
334
- _getAddress(coinType: number, hexBytes: string): string;
335
- getAddress(coinType?: number): Promise<string>;
336
- getAvatar(): Promise<null | Avatar>;
337
- getContentHash(): Promise<string>;
338
- getText(key: string): Promise<string>;
339
- }
340
- declare class BaseProvider extends Provider implements EnsProvider {
341
- _networkPromise: Promise<Network>;
342
- _network: Network;
343
- _events: Array<Event>;
344
- formatter: Formatter;
345
- _emitted: {
346
- [eventName: string]: number | "pending";
347
- };
348
- _pollingInterval: number;
349
- _poller: NodeJS.Timer;
350
- _bootstrapPoll: NodeJS.Timer;
351
- _lastBlockNumber: number;
352
- _maxFilterBlockRange: number;
353
- _fastBlockNumber: number;
354
- _fastBlockNumberPromise: Promise<number>;
355
- _fastQueryDate: number;
356
- _maxInternalBlockNumber: number;
357
- _internalBlockNumber: Promise<{
358
- blockNumber: number;
359
- reqTime: number;
360
- respTime: number;
361
- }>;
362
- readonly anyNetwork: boolean;
363
- disableCcipRead: boolean;
364
- /**
365
- * ready
366
- *
367
- * A Promise<Network> that resolves only once the provider is ready.
368
- *
369
- * Sub-classes that call the super with a network without a chainId
370
- * MUST set this. Standard named networks have a known chainId.
371
- *
372
- */
373
- constructor(network: Networkish | Promise<Network>);
374
- _ready(): Promise<Network>;
375
- get ready(): Promise<Network>;
376
- static getFormatter(): Formatter;
377
- static getNetwork(network: Networkish): Network;
378
- ccipReadFetch(tx: Transaction$1, calldata: string, urls: Array<string>): Promise<null | string>;
379
- _getInternalBlockNumber(maxAge: number): Promise<number>;
380
- poll(): Promise<void>;
381
- resetEventsBlock(blockNumber: number): void;
382
- get network(): Network;
383
- detectNetwork(): Promise<Network>;
384
- getNetwork(): Promise<Network>;
385
- get blockNumber(): number;
386
- get polling(): boolean;
387
- set polling(value: boolean);
388
- get pollingInterval(): number;
389
- set pollingInterval(value: number);
390
- _getFastBlockNumber(): Promise<number>;
391
- _setFastBlockNumber(blockNumber: number): void;
392
- waitForTransaction(transactionHash: string, confirmations?: number, timeout?: number): Promise<TransactionReceipt>;
393
- _waitForTransaction(transactionHash: string, confirmations: number, timeout: number, replaceable: {
394
- data: string;
395
- from: string;
396
- nonce: number;
397
- to: string;
398
- value: BigNumber;
399
- startBlock: number;
400
- }): Promise<TransactionReceipt>;
401
- getBlockNumber(): Promise<number>;
402
- getGasPrice(): Promise<BigNumber>;
403
- getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;
404
- getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;
405
- getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
406
- getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
407
- _wrapTransaction(tx: Transaction$1, hash?: string, startBlock?: number): TransactionResponse;
408
- sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
409
- _getTransactionRequest(transaction: Deferrable<TransactionRequest>): Promise<Transaction$1>;
410
- _getFilter(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Filter | FilterByBlockHash>;
411
- _call(transaction: TransactionRequest, blockTag: BlockTag, attempt: number): Promise<string>;
412
- call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
413
- estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
414
- _getAddress(addressOrName: string | Promise<string>): Promise<string>;
415
- _getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block | BlockWithTransactions>;
416
- getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
417
- getBlockWithTransactions(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<BlockWithTransactions>;
418
- getTransaction(transactionHash: string | Promise<string>): Promise<TransactionResponse>;
419
- getTransactionReceipt(transactionHash: string | Promise<string>): Promise<TransactionReceipt>;
420
- getLogs(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Array<Log>>;
421
- getEtherPrice(): Promise<number>;
422
- _getBlockTag(blockTag: BlockTag | Promise<BlockTag>): Promise<BlockTag>;
423
- getResolver(name: string): Promise<null | Resolver>;
424
- _getResolver(name: string, operation?: string): Promise<string>;
425
- resolveName(name: string | Promise<string>): Promise<null | string>;
426
- lookupAddress(address: string | Promise<string>): Promise<null | string>;
427
- getAvatar(nameOrAddress: string): Promise<null | string>;
428
- perform(method: string, params: any): Promise<any>;
429
- _startEvent(event: Event): void;
430
- _stopEvent(event: Event): void;
431
- _addEventListener(eventName: EventType, listener: Listener, once: boolean): this;
432
- on(eventName: EventType, listener: Listener): this;
433
- once(eventName: EventType, listener: Listener): this;
434
- emit(eventName: EventType, ...args: Array<any>): boolean;
435
- listenerCount(eventName?: EventType): number;
436
- listeners(eventName?: EventType): Array<Listener>;
437
- off(eventName: EventType, listener?: Listener): this;
438
- removeAllListeners(eventName?: EventType): this;
439
- }
440
-
441
- interface TypedDataDomain {
442
- name?: string;
443
- version?: string;
444
- chainId?: BigNumberish;
445
- verifyingContract?: string;
446
- salt?: BytesLike;
447
- }
448
- interface TypedDataField {
449
- name: string;
450
- type: string;
451
- }
452
- interface TypedDataSigner {
453
- _signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
454
- }
455
- declare abstract class Signer {
456
- readonly provider?: Provider;
457
- abstract getAddress(): Promise<string>;
458
- abstract signMessage(message: Bytes | string): Promise<string>;
459
- abstract signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
460
- abstract connect(provider: Provider): Signer;
461
- readonly _isSigner: boolean;
462
- constructor();
463
- getBalance(blockTag?: BlockTag): Promise<BigNumber>;
464
- getTransactionCount(blockTag?: BlockTag): Promise<number>;
465
- estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
466
- call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag): Promise<string>;
467
- sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse>;
468
- getChainId(): Promise<number>;
469
- getGasPrice(): Promise<BigNumber>;
470
- getFeeData(): Promise<FeeData>;
471
- resolveName(name: string): Promise<string>;
472
- checkTransaction(transaction: Deferrable<TransactionRequest>): Deferrable<TransactionRequest>;
473
- populateTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionRequest>;
474
- _checkProvider(operation?: string): void;
475
- static isSigner(value: any): value is Signer;
476
- }
477
-
478
- declare class JsonRpcSigner extends Signer implements TypedDataSigner {
479
- readonly provider: JsonRpcProvider;
480
- _index: number;
481
- _address: string;
482
- constructor(constructorGuard: any, provider: JsonRpcProvider, addressOrIndex?: string | number);
483
- connect(provider: Provider): JsonRpcSigner;
484
- connectUnchecked(): JsonRpcSigner;
485
- getAddress(): Promise<string>;
486
- sendUncheckedTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
487
- signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
488
- sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse>;
489
- signMessage(message: Bytes | string): Promise<string>;
490
- _legacySignMessage(message: Bytes | string): Promise<string>;
491
- _signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
492
- unlock(password: string): Promise<boolean>;
493
- }
494
- declare class UncheckedJsonRpcSigner extends JsonRpcSigner {
495
- sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse>;
496
- }
497
- declare class JsonRpcProvider extends BaseProvider {
498
- readonly connection: ConnectionInfo;
499
- _pendingFilter: Promise<number>;
500
- _nextId: number;
501
- _eventLoopCache: Record<string, Promise<any>>;
502
- get _cache(): Record<string, Promise<any>>;
503
- constructor(url?: ConnectionInfo | string, network?: Networkish);
504
- static defaultUrl(): string;
505
- detectNetwork(): Promise<Network>;
506
- _uncachedDetectNetwork(): Promise<Network>;
507
- getSigner(addressOrIndex?: string | number): JsonRpcSigner;
508
- getUncheckedSigner(addressOrIndex?: string | number): UncheckedJsonRpcSigner;
509
- listAccounts(): Promise<Array<string>>;
510
- send(method: string, params: Array<any>): Promise<any>;
511
- prepareRequest(method: string, params: any): [string, Array<any>];
512
- perform(method: string, params: any): Promise<any>;
513
- _startEvent(event: Event): void;
514
- _startPending(): void;
515
- _stopEvent(event: Event): void;
516
- static hexlifyTransaction(transaction: TransactionRequest, allowExtra?: {
517
- [key: string]: boolean;
518
- }): {
519
- [key: string]: string | AccessList;
520
- };
521
- }
522
-
523
- declare type ExternalProvider = {
524
- isMetaMask?: boolean;
525
- isStatus?: boolean;
526
- host?: string;
527
- path?: string;
528
- sendAsync?: (request: {
529
- method: string;
530
- params?: Array<any>;
531
- }, callback: (error: any, response: any) => void) => void;
532
- send?: (request: {
533
- method: string;
534
- params?: Array<any>;
535
- }, callback: (error: any, response: any) => void) => void;
536
- request?: (request: {
537
- method: string;
538
- params?: Array<any>;
539
- }) => Promise<any>;
540
- };
541
- declare type JsonRpcFetchFunc = (method: string, params?: Array<any>) => Promise<any>;
542
- declare class Web3Provider extends JsonRpcProvider {
543
- readonly provider: ExternalProvider;
544
- readonly jsonRpcFetchFunc: JsonRpcFetchFunc;
545
- constructor(provider: ExternalProvider | JsonRpcFetchFunc, network?: Networkish);
546
- send(method: string, params: Array<any>): Promise<any>;
547
- }
548
-
549
- interface TokenInfo {
550
- name: string;
551
- symbol: string;
552
- decimals: number;
553
- address?: string;
554
- icon?: string;
555
- }
556
- interface GetTokenAllowListParams {
557
- type: TokenFilterTypes;
558
- chainId: ChainId;
559
- exclude?: TokenFilter[];
560
- }
561
- interface GetTokenAllowListResult {
562
- tokens: TokenInfo[];
563
- }
564
- declare enum TokenFilterTypes {
565
- SWAP = "swap",
566
- BRIDGE = "bridge",
567
- ALL = "all"
568
- }
569
- interface TokenFilter {
570
- address: string;
571
- }
572
- declare enum ChainId {
573
- ETHEREUM = 1,
574
- GOERLI = 5,
575
- POLYGON = 137
576
- }
577
- interface NetworkInfo {
578
- name: string;
579
- chainId: number;
580
- nativeCurrency: TokenInfo;
581
- isSupported: boolean;
582
- }
583
- interface SwitchNetworkParams {
584
- provider: Web3Provider;
585
- chainId: ChainId;
586
- }
587
- interface SwitchNetworkResult {
588
- network: NetworkInfo;
589
- }
590
- interface GetNetworkParams {
591
- provider: Web3Provider;
592
- }
593
- declare enum NetworkFilterTypes {
594
- ALL = "all"
595
- }
596
- interface NetworkFilter {
597
- chainId: ChainId;
598
- }
599
- interface GetNetworkAllowListParams {
600
- type: NetworkFilterTypes;
601
- exclude?: NetworkFilter[];
602
- }
603
- interface GetNetworkAllowListResult {
604
- networks: NetworkInfo[];
605
- }
606
- interface GetBalanceParams {
607
- provider: Web3Provider;
608
- walletAddress: string;
609
- contractAddress?: string;
610
- }
611
- interface GetBalanceResult {
612
- balance: BigNumber;
613
- formattedBalance: string;
614
- token: TokenInfo;
615
- }
616
- interface GetAllBalancesParams {
617
- provider: Web3Provider;
618
- walletAddress: string;
619
- chainId: ChainId;
620
- }
621
- interface GetAllBalancesResult {
622
- balances: GetBalanceResult[];
623
- }
624
- declare enum ConnectionProviders {
625
- METAMASK = "metamask"
626
- }
627
- type ConnectParams = {
628
- providerPreference: ConnectionProviders;
629
- };
630
- interface ConnectResult {
631
- provider: Web3Provider;
632
- network: NetworkInfo;
633
- }
634
- interface CheckConnectionParams {
635
- providerPreference: ConnectionProviders;
636
- }
637
- interface CheckConnectionResult {
638
- isConnected: boolean;
639
- walletAddress: string;
640
- }
641
- interface SendTransactionParams {
642
- provider: Web3Provider;
643
- transaction: Transaction;
644
- }
645
- interface SendTransactionResult {
646
- transactionResponse: TransactionResponse;
647
- }
648
- interface Transaction {
649
- nonce: string;
650
- gasPrice: string;
651
- gas: string;
652
- to: string;
653
- from: string;
654
- value: string;
655
- data: string;
656
- chainId: number;
657
- }
658
- declare enum WalletFilterTypes {
659
- ALL = "all",
660
- DESKTOP = "desktop",
661
- MOBILE = "mobile"
662
- }
663
- interface WalletFilter {
664
- connectionProvider: ConnectionProviders;
665
- }
666
- interface GetWalletAllowListParams {
667
- type: WalletFilterTypes;
668
- exclude?: WalletFilter[];
669
- }
670
- interface WalletInfo {
671
- connectionProvider: ConnectionProviders;
672
- name: string;
673
- description: string;
674
- icon: string;
675
- }
676
- interface GetWalletAllowListResult {
677
- wallets: WalletInfo[];
678
- }
679
- declare class Checkout {
680
- checkIsWalletConnected(params: CheckConnectionParams): Promise<CheckConnectionResult>;
681
- connect(params: ConnectParams): Promise<ConnectResult>;
682
- switchNetwork(params: SwitchNetworkParams): Promise<SwitchNetworkResult>;
683
- getBalance(params: GetBalanceParams): Promise<GetBalanceResult>;
684
- getAllBalances(params: GetAllBalancesParams): Promise<GetAllBalancesResult>;
685
- getNetworkAllowList(params: GetNetworkAllowListParams): Promise<GetNetworkAllowListResult>;
686
- getTokenAllowList(params: GetTokenAllowListParams): Promise<GetTokenAllowListResult>;
687
- getWalletsAllowList(params: GetWalletAllowListParams): Promise<GetWalletAllowListResult>;
688
- sendTransaction(params: SendTransactionParams): Promise<SendTransactionResult>;
689
- getNetworkInfo(params: GetNetworkParams): Promise<NetworkInfo>;
690
- }
691
-
692
- export { ChainId, CheckConnectionParams, CheckConnectionResult, Checkout, ConnectParams, ConnectResult, ConnectionProviders, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetTokenAllowListParams, GetTokenAllowListResult, GetWalletAllowListParams, GetWalletAllowListResult, NetworkFilter, NetworkFilterTypes, NetworkInfo, SendTransactionParams, SendTransactionResult, SwitchNetworkParams, SwitchNetworkResult, TokenFilter, TokenFilterTypes, TokenInfo, WalletFilter, WalletFilterTypes, WalletInfo };