@imtbl/sdk 0.13.1-alpha → 0.13.1-alpha.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,7 +1,4 @@
1
- import { OrderbookOverrides, OrderbookModuleConfiguration } from 'config/config';
2
- import { ListingResult, ListListingsResult, Fee, OrdersService } from 'openapi/sdk';
3
- import { ListListingsParams as ListListingsParams$1, PrepareListingParams as PrepareListingParams$1, PrepareListingResponse as PrepareListingResponse$1, CreateListingParams as CreateListingParams$1, FulfillOrderResponse as FulfillOrderResponse$1, CancelOrderResponse as CancelOrderResponse$1 } from 'types';
4
-
1
+ /// <reference types="node" />
5
2
  declare enum Environment {
6
3
  PRODUCTION = "production",
7
4
  SANDBOX = "sandbox"
@@ -19,72 +16,6 @@ interface ModuleConfiguration<T> {
19
16
  overrides?: T;
20
17
  }
21
18
 
22
- /**
23
- * zkEVM orderbook SDK
24
- * @constructor
25
- * @param {OrderbookModuleConfiguration} config - Configuration for Immutable services.
26
- */
27
- declare class Orderbook {
28
- private apiClient;
29
- private seaport;
30
- private orderbookConfig;
31
- constructor(config: ModuleConfiguration<OrderbookOverrides>);
32
- /**
33
- * Return the configuration for the orderbook module.
34
- * @return {OrderbookModuleConfiguration} The configuration for the orderbook module.
35
- */
36
- config(): OrderbookModuleConfiguration;
37
- /**
38
- * Get an order by ID
39
- * @param {string} listingId - The listingId to find.
40
- * @return {ListingResult} The returned order result.
41
- */
42
- getListing(listingId: string): Promise<ListingResult>;
43
- /**
44
- * List orders. This method is used to get a list of orders filtered by conditions specified
45
- * in the params object.
46
- * @param {ListListingsParams} listOrderParams - Filtering, ordering and page parameters.
47
- * @return {ListListingsResult} The paged orders.
48
- */
49
- listListings(listOrderParams: ListListingsParams$1): Promise<ListListingsResult>;
50
- /**
51
- * Get required transactions and messages for signing prior to creating a listing
52
- * through the createListing method
53
- * @param {PrepareListingParams} prepareListingParams - Details about the listing to be created.
54
- * @return {PrepareListingResponse} PrepareListingResponse includes
55
- * the unsigned approval transaction, the typed order message for signing and
56
- * the order components that can be submitted to `createListing` with a signature.
57
- */
58
- prepareListing({ makerAddress, sell, buy, orderExpiry, }: PrepareListingParams$1): Promise<PrepareListingResponse$1>;
59
- /**
60
- * Create an order
61
- * @param {CreateListingParams} createListingParams - create an order with the given params.
62
- * @return {ListingResult} The result of the order created in the Immutable services.
63
- */
64
- createListing(createListingParams: CreateListingParams$1): Promise<ListingResult>;
65
- /**
66
- * Get unsigned transactions that can be submitted to fulfil an open order. If the approval
67
- * transaction exists it must be signed and submitted to the chain before the fulfilment
68
- * transaction can be submitted or it will be reverted.
69
- * @param {string} listingId - The listingId to fulfil.
70
- * @param {string} fulfillerAddress - The address of the account fulfilling the order.
71
- * @return {FulfillOrderResponse} Approval and fulfilment transactions.
72
- */
73
- fulfillOrder(listingId: string, takerAddress: string, takerFee?: Fee): Promise<FulfillOrderResponse$1>;
74
- /**
75
- * Get an unsigned cancel order transaction. Orders can only be cancelled by
76
- * the account that created them.
77
- * @param {string} listingId - The listingId to cancel.
78
- * @param {string} accountAddress - The address of the account cancelling the order.
79
- * @return {CancelOrderResponse} The unsigned cancel order transaction
80
- */
81
- cancelOrder(listingId: string, accountAddress: string): Promise<CancelOrderResponse$1>;
82
- }
83
-
84
- declare const constants: {
85
- estimatedFulfillmentGasGwei: number;
86
- };
87
-
88
19
  declare type Bytes = ArrayLike<number>;
89
20
  declare type BytesLike = Bytes | string;
90
21
  interface Hexable {
@@ -127,10 +58,202 @@ declare class BigNumber implements Hexable {
127
58
  static isBigNumber(value: any): value is BigNumber;
128
59
  }
129
60
 
61
+ declare type Deferrable<T> = {
62
+ [K in keyof T]: T[K] | Promise<T[K]>;
63
+ };
64
+ declare class Description<T = any> {
65
+ constructor(info: {
66
+ [K in keyof T]: T[K];
67
+ });
68
+ }
69
+
70
+ declare type Network = {
71
+ name: string;
72
+ chainId: number;
73
+ ensAddress?: string;
74
+ _defaultProvider?: (providers: any, options?: any) => any;
75
+ };
76
+ declare type Networkish = Network | string | number;
77
+
130
78
  declare type AccessList = Array<{
131
79
  address: string;
132
80
  storageKeys: Array<string>;
133
81
  }>;
82
+ declare type AccessListish = AccessList | Array<[string, Array<string>]> | Record<string, Array<string>>;
83
+ interface Transaction {
84
+ hash?: string;
85
+ to?: string;
86
+ from?: string;
87
+ nonce: number;
88
+ gasLimit: BigNumber;
89
+ gasPrice?: BigNumber;
90
+ data: string;
91
+ value: BigNumber;
92
+ chainId: number;
93
+ r?: string;
94
+ s?: string;
95
+ v?: number;
96
+ type?: number | null;
97
+ accessList?: AccessList;
98
+ maxPriorityFeePerGas?: BigNumber;
99
+ maxFeePerGas?: BigNumber;
100
+ }
101
+
102
+ declare type ConnectionInfo = {
103
+ url: string;
104
+ headers?: {
105
+ [key: string]: string | number;
106
+ };
107
+ user?: string;
108
+ password?: string;
109
+ allowInsecureAuthentication?: boolean;
110
+ allowGzip?: boolean;
111
+ throttleLimit?: number;
112
+ throttleSlotInterval?: number;
113
+ throttleCallback?: (attempt: number, url: string) => Promise<boolean>;
114
+ skipFetchSetup?: boolean;
115
+ fetchOptions?: Record<string, string>;
116
+ errorPassThrough?: boolean;
117
+ timeout?: number;
118
+ };
119
+ interface OnceBlockable {
120
+ once(eventName: "block", handler: () => void): void;
121
+ }
122
+
123
+ declare type TransactionRequest = {
124
+ to?: string;
125
+ from?: string;
126
+ nonce?: BigNumberish;
127
+ gasLimit?: BigNumberish;
128
+ gasPrice?: BigNumberish;
129
+ data?: BytesLike;
130
+ value?: BigNumberish;
131
+ chainId?: number;
132
+ type?: number;
133
+ accessList?: AccessListish;
134
+ maxPriorityFeePerGas?: BigNumberish;
135
+ maxFeePerGas?: BigNumberish;
136
+ customData?: Record<string, any>;
137
+ ccipReadEnabled?: boolean;
138
+ };
139
+ interface TransactionResponse extends Transaction {
140
+ hash: string;
141
+ blockNumber?: number;
142
+ blockHash?: string;
143
+ timestamp?: number;
144
+ confirmations: number;
145
+ from: string;
146
+ raw?: string;
147
+ wait: (confirmations?: number) => Promise<TransactionReceipt>;
148
+ }
149
+ declare type BlockTag = string | number;
150
+ interface _Block {
151
+ hash: string;
152
+ parentHash: string;
153
+ number: number;
154
+ timestamp: number;
155
+ nonce: string;
156
+ difficulty: number;
157
+ _difficulty: BigNumber;
158
+ gasLimit: BigNumber;
159
+ gasUsed: BigNumber;
160
+ miner: string;
161
+ extraData: string;
162
+ baseFeePerGas?: null | BigNumber;
163
+ }
164
+ interface Block extends _Block {
165
+ transactions: Array<string>;
166
+ }
167
+ interface BlockWithTransactions extends _Block {
168
+ transactions: Array<TransactionResponse>;
169
+ }
170
+ interface Log {
171
+ blockNumber: number;
172
+ blockHash: string;
173
+ transactionIndex: number;
174
+ removed: boolean;
175
+ address: string;
176
+ data: string;
177
+ topics: Array<string>;
178
+ transactionHash: string;
179
+ logIndex: number;
180
+ }
181
+ interface TransactionReceipt {
182
+ to: string;
183
+ from: string;
184
+ contractAddress: string;
185
+ transactionIndex: number;
186
+ root?: string;
187
+ gasUsed: BigNumber;
188
+ logsBloom: string;
189
+ blockHash: string;
190
+ transactionHash: string;
191
+ logs: Array<Log>;
192
+ blockNumber: number;
193
+ confirmations: number;
194
+ cumulativeGasUsed: BigNumber;
195
+ effectiveGasPrice: BigNumber;
196
+ byzantium: boolean;
197
+ type: number;
198
+ status?: number;
199
+ }
200
+ interface FeeData {
201
+ lastBaseFeePerGas: null | BigNumber;
202
+ maxFeePerGas: null | BigNumber;
203
+ maxPriorityFeePerGas: null | BigNumber;
204
+ gasPrice: null | BigNumber;
205
+ }
206
+ interface EventFilter {
207
+ address?: string;
208
+ topics?: Array<string | Array<string> | null>;
209
+ }
210
+ interface Filter extends EventFilter {
211
+ fromBlock?: BlockTag;
212
+ toBlock?: BlockTag;
213
+ }
214
+ interface FilterByBlockHash extends EventFilter {
215
+ blockHash?: string;
216
+ }
217
+ declare abstract class ForkEvent extends Description {
218
+ readonly expiry: number;
219
+ readonly _isForkEvent?: boolean;
220
+ static isForkEvent(value: any): value is ForkEvent;
221
+ }
222
+ declare type EventType = string | Array<string | Array<string>> | EventFilter | ForkEvent;
223
+ declare type Listener = (...args: Array<any>) => void;
224
+ declare abstract class Provider implements OnceBlockable {
225
+ abstract getNetwork(): Promise<Network>;
226
+ abstract getBlockNumber(): Promise<number>;
227
+ abstract getGasPrice(): Promise<BigNumber>;
228
+ getFeeData(): Promise<FeeData>;
229
+ abstract getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;
230
+ abstract getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;
231
+ abstract getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
232
+ abstract getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
233
+ abstract sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
234
+ abstract call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
235
+ abstract estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
236
+ abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
237
+ abstract getBlockWithTransactions(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<BlockWithTransactions>;
238
+ abstract getTransaction(transactionHash: string): Promise<TransactionResponse>;
239
+ abstract getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
240
+ abstract getLogs(filter: Filter): Promise<Array<Log>>;
241
+ abstract resolveName(name: string | Promise<string>): Promise<null | string>;
242
+ abstract lookupAddress(address: string | Promise<string>): Promise<null | string>;
243
+ abstract on(eventName: EventType, listener: Listener): Provider;
244
+ abstract once(eventName: EventType, listener: Listener): Provider;
245
+ abstract emit(eventName: EventType, ...args: Array<any>): boolean;
246
+ abstract listenerCount(eventName?: EventType): number;
247
+ abstract listeners(eventName?: EventType): Array<Listener>;
248
+ abstract off(eventName: EventType, listener?: Listener): Provider;
249
+ abstract removeAllListeners(eventName?: EventType): Provider;
250
+ addListener(eventName: EventType, listener: Listener): Provider;
251
+ removeListener(eventName: EventType, listener: Listener): Provider;
252
+ abstract waitForTransaction(transactionHash: string, confirmations?: number, timeout?: number): Promise<TransactionReceipt>;
253
+ readonly _isProvider: boolean;
254
+ constructor();
255
+ static isProvider(value: any): value is Provider;
256
+ }
134
257
 
135
258
  interface TypedDataDomain {
136
259
  name?: string;
@@ -143,6 +266,31 @@ interface TypedDataField {
143
266
  name: string;
144
267
  type: string;
145
268
  }
269
+ interface TypedDataSigner {
270
+ _signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
271
+ }
272
+ declare abstract class Signer {
273
+ readonly provider?: Provider;
274
+ abstract getAddress(): Promise<string>;
275
+ abstract signMessage(message: Bytes | string): Promise<string>;
276
+ abstract signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
277
+ abstract connect(provider: Provider): Signer;
278
+ readonly _isSigner: boolean;
279
+ constructor();
280
+ getBalance(blockTag?: BlockTag): Promise<BigNumber>;
281
+ getTransactionCount(blockTag?: BlockTag): Promise<number>;
282
+ estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
283
+ call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag): Promise<string>;
284
+ sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse>;
285
+ getChainId(): Promise<number>;
286
+ getGasPrice(): Promise<BigNumber>;
287
+ getFeeData(): Promise<FeeData>;
288
+ resolveName(name: string): Promise<string>;
289
+ checkTransaction(transaction: Deferrable<TransactionRequest>): Deferrable<TransactionRequest>;
290
+ populateTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionRequest>;
291
+ _checkProvider(operation?: string): void;
292
+ static isSigner(value: any): value is Signer;
293
+ }
146
294
 
147
295
  interface PopulatedTransaction {
148
296
  to?: string;
@@ -161,6 +309,292 @@ interface PopulatedTransaction {
161
309
  ccipReadEnabled?: boolean;
162
310
  }
163
311
 
312
+ declare type FormatFunc = (value: any) => any;
313
+ declare type FormatFuncs = {
314
+ [key: string]: FormatFunc;
315
+ };
316
+ declare type Formats = {
317
+ transaction: FormatFuncs;
318
+ transactionRequest: FormatFuncs;
319
+ receipt: FormatFuncs;
320
+ receiptLog: FormatFuncs;
321
+ block: FormatFuncs;
322
+ blockWithTransactions: FormatFuncs;
323
+ filter: FormatFuncs;
324
+ filterLog: FormatFuncs;
325
+ };
326
+ declare class Formatter {
327
+ readonly formats: Formats;
328
+ constructor();
329
+ getDefaultFormats(): Formats;
330
+ accessList(accessList: Array<any>): AccessList;
331
+ number(number: any): number;
332
+ type(number: any): number;
333
+ bigNumber(value: any): BigNumber;
334
+ boolean(value: any): boolean;
335
+ hex(value: any, strict?: boolean): string;
336
+ data(value: any, strict?: boolean): string;
337
+ address(value: any): string;
338
+ callAddress(value: any): string;
339
+ contractAddress(value: any): string;
340
+ blockTag(blockTag: any): string;
341
+ hash(value: any, strict?: boolean): string;
342
+ difficulty(value: any): number;
343
+ uint256(value: any): string;
344
+ _block(value: any, format: any): Block;
345
+ block(value: any): Block;
346
+ blockWithTransactions(value: any): Block;
347
+ transactionRequest(value: any): any;
348
+ transactionResponse(transaction: any): TransactionResponse;
349
+ transaction(value: any): any;
350
+ receiptLog(value: any): any;
351
+ receipt(value: any): TransactionReceipt;
352
+ topics(value: any): any;
353
+ filter(value: any): any;
354
+ filterLog(value: any): any;
355
+ static check(format: {
356
+ [name: string]: FormatFunc;
357
+ }, object: any): any;
358
+ static allowNull(format: FormatFunc, nullValue?: any): FormatFunc;
359
+ static allowFalsish(format: FormatFunc, replaceValue: any): FormatFunc;
360
+ static arrayOf(format: FormatFunc): FormatFunc;
361
+ }
362
+
363
+ declare class Event {
364
+ readonly listener: Listener;
365
+ readonly once: boolean;
366
+ readonly tag: string;
367
+ _lastBlockNumber: number;
368
+ _inflight: boolean;
369
+ constructor(tag: string, listener: Listener, once: boolean);
370
+ get event(): EventType;
371
+ get type(): string;
372
+ get hash(): string;
373
+ get filter(): Filter;
374
+ pollable(): boolean;
375
+ }
376
+ interface EnsResolver {
377
+ readonly name: string;
378
+ readonly address: string;
379
+ getAddress(coinType?: 60): Promise<null | string>;
380
+ getContentHash(): Promise<null | string>;
381
+ getText(key: string): Promise<null | string>;
382
+ }
383
+ interface EnsProvider {
384
+ resolveName(name: string): Promise<null | string>;
385
+ lookupAddress(address: string): Promise<null | string>;
386
+ getResolver(name: string): Promise<null | EnsResolver>;
387
+ }
388
+ interface Avatar {
389
+ url: string;
390
+ linkage: Array<{
391
+ type: string;
392
+ content: string;
393
+ }>;
394
+ }
395
+ declare class Resolver$1 implements EnsResolver {
396
+ readonly provider: BaseProvider;
397
+ readonly name: string;
398
+ readonly address: string;
399
+ readonly _resolvedAddress: null | string;
400
+ _supportsEip2544: null | Promise<boolean>;
401
+ constructor(provider: BaseProvider, address: string, name: string, resolvedAddress?: string);
402
+ supportsWildcard(): Promise<boolean>;
403
+ _fetch(selector: string, parameters?: string): Promise<null | string>;
404
+ _fetchBytes(selector: string, parameters?: string): Promise<null | string>;
405
+ _getAddress(coinType: number, hexBytes: string): string;
406
+ getAddress(coinType?: number): Promise<string>;
407
+ getAvatar(): Promise<null | Avatar>;
408
+ getContentHash(): Promise<string>;
409
+ getText(key: string): Promise<string>;
410
+ }
411
+ declare class BaseProvider extends Provider implements EnsProvider {
412
+ _networkPromise: Promise<Network>;
413
+ _network: Network;
414
+ _events: Array<Event>;
415
+ formatter: Formatter;
416
+ _emitted: {
417
+ [eventName: string]: number | "pending";
418
+ };
419
+ _pollingInterval: number;
420
+ _poller: NodeJS.Timer;
421
+ _bootstrapPoll: NodeJS.Timer;
422
+ _lastBlockNumber: number;
423
+ _maxFilterBlockRange: number;
424
+ _fastBlockNumber: number;
425
+ _fastBlockNumberPromise: Promise<number>;
426
+ _fastQueryDate: number;
427
+ _maxInternalBlockNumber: number;
428
+ _internalBlockNumber: Promise<{
429
+ blockNumber: number;
430
+ reqTime: number;
431
+ respTime: number;
432
+ }>;
433
+ readonly anyNetwork: boolean;
434
+ disableCcipRead: boolean;
435
+ /**
436
+ * ready
437
+ *
438
+ * A Promise<Network> that resolves only once the provider is ready.
439
+ *
440
+ * Sub-classes that call the super with a network without a chainId
441
+ * MUST set this. Standard named networks have a known chainId.
442
+ *
443
+ */
444
+ constructor(network: Networkish | Promise<Network>);
445
+ _ready(): Promise<Network>;
446
+ get ready(): Promise<Network>;
447
+ static getFormatter(): Formatter;
448
+ static getNetwork(network: Networkish): Network;
449
+ ccipReadFetch(tx: Transaction, calldata: string, urls: Array<string>): Promise<null | string>;
450
+ _getInternalBlockNumber(maxAge: number): Promise<number>;
451
+ poll(): Promise<void>;
452
+ resetEventsBlock(blockNumber: number): void;
453
+ get network(): Network;
454
+ detectNetwork(): Promise<Network>;
455
+ getNetwork(): Promise<Network>;
456
+ get blockNumber(): number;
457
+ get polling(): boolean;
458
+ set polling(value: boolean);
459
+ get pollingInterval(): number;
460
+ set pollingInterval(value: number);
461
+ _getFastBlockNumber(): Promise<number>;
462
+ _setFastBlockNumber(blockNumber: number): void;
463
+ waitForTransaction(transactionHash: string, confirmations?: number, timeout?: number): Promise<TransactionReceipt>;
464
+ _waitForTransaction(transactionHash: string, confirmations: number, timeout: number, replaceable: {
465
+ data: string;
466
+ from: string;
467
+ nonce: number;
468
+ to: string;
469
+ value: BigNumber;
470
+ startBlock: number;
471
+ }): Promise<TransactionReceipt>;
472
+ getBlockNumber(): Promise<number>;
473
+ getGasPrice(): Promise<BigNumber>;
474
+ getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;
475
+ getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;
476
+ getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
477
+ getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
478
+ _wrapTransaction(tx: Transaction, hash?: string, startBlock?: number): TransactionResponse;
479
+ sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
480
+ _getTransactionRequest(transaction: Deferrable<TransactionRequest>): Promise<Transaction>;
481
+ _getFilter(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Filter | FilterByBlockHash>;
482
+ _call(transaction: TransactionRequest, blockTag: BlockTag, attempt: number): Promise<string>;
483
+ call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
484
+ estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
485
+ _getAddress(addressOrName: string | Promise<string>): Promise<string>;
486
+ _getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block | BlockWithTransactions>;
487
+ getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
488
+ getBlockWithTransactions(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<BlockWithTransactions>;
489
+ getTransaction(transactionHash: string | Promise<string>): Promise<TransactionResponse>;
490
+ getTransactionReceipt(transactionHash: string | Promise<string>): Promise<TransactionReceipt>;
491
+ getLogs(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Array<Log>>;
492
+ getEtherPrice(): Promise<number>;
493
+ _getBlockTag(blockTag: BlockTag | Promise<BlockTag>): Promise<BlockTag>;
494
+ getResolver(name: string): Promise<null | Resolver$1>;
495
+ _getResolver(name: string, operation?: string): Promise<string>;
496
+ resolveName(name: string | Promise<string>): Promise<null | string>;
497
+ lookupAddress(address: string | Promise<string>): Promise<null | string>;
498
+ getAvatar(nameOrAddress: string): Promise<null | string>;
499
+ perform(method: string, params: any): Promise<any>;
500
+ _startEvent(event: Event): void;
501
+ _stopEvent(event: Event): void;
502
+ _addEventListener(eventName: EventType, listener: Listener, once: boolean): this;
503
+ on(eventName: EventType, listener: Listener): this;
504
+ once(eventName: EventType, listener: Listener): this;
505
+ emit(eventName: EventType, ...args: Array<any>): boolean;
506
+ listenerCount(eventName?: EventType): number;
507
+ listeners(eventName?: EventType): Array<Listener>;
508
+ off(eventName: EventType, listener?: Listener): this;
509
+ removeAllListeners(eventName?: EventType): this;
510
+ }
511
+
512
+ declare class JsonRpcSigner extends Signer implements TypedDataSigner {
513
+ readonly provider: JsonRpcProvider;
514
+ _index: number;
515
+ _address: string;
516
+ constructor(constructorGuard: any, provider: JsonRpcProvider, addressOrIndex?: string | number);
517
+ connect(provider: Provider): JsonRpcSigner;
518
+ connectUnchecked(): JsonRpcSigner;
519
+ getAddress(): Promise<string>;
520
+ sendUncheckedTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
521
+ signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
522
+ sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse>;
523
+ signMessage(message: Bytes | string): Promise<string>;
524
+ _legacySignMessage(message: Bytes | string): Promise<string>;
525
+ _signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
526
+ unlock(password: string): Promise<boolean>;
527
+ }
528
+ declare class UncheckedJsonRpcSigner extends JsonRpcSigner {
529
+ sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse>;
530
+ }
531
+ declare class JsonRpcProvider extends BaseProvider {
532
+ readonly connection: ConnectionInfo;
533
+ _pendingFilter: Promise<number>;
534
+ _nextId: number;
535
+ _eventLoopCache: Record<string, Promise<any>>;
536
+ get _cache(): Record<string, Promise<any>>;
537
+ constructor(url?: ConnectionInfo | string, network?: Networkish);
538
+ static defaultUrl(): string;
539
+ detectNetwork(): Promise<Network>;
540
+ _uncachedDetectNetwork(): Promise<Network>;
541
+ getSigner(addressOrIndex?: string | number): JsonRpcSigner;
542
+ getUncheckedSigner(addressOrIndex?: string | number): UncheckedJsonRpcSigner;
543
+ listAccounts(): Promise<Array<string>>;
544
+ send(method: string, params: Array<any>): Promise<any>;
545
+ prepareRequest(method: string, params: any): [string, Array<any>];
546
+ perform(method: string, params: any): Promise<any>;
547
+ _startEvent(event: Event): void;
548
+ _startPending(): void;
549
+ _stopEvent(event: Event): void;
550
+ static hexlifyTransaction(transaction: TransactionRequest, allowExtra?: {
551
+ [key: string]: boolean;
552
+ }): {
553
+ [key: string]: string | AccessList;
554
+ };
555
+ }
556
+
557
+ declare type ExternalProvider = {
558
+ isMetaMask?: boolean;
559
+ isStatus?: boolean;
560
+ host?: string;
561
+ path?: string;
562
+ sendAsync?: (request: {
563
+ method: string;
564
+ params?: Array<any>;
565
+ }, callback: (error: any, response: any) => void) => void;
566
+ send?: (request: {
567
+ method: string;
568
+ params?: Array<any>;
569
+ }, callback: (error: any, response: any) => void) => void;
570
+ request?: (request: {
571
+ method: string;
572
+ params?: Array<any>;
573
+ }) => Promise<any>;
574
+ };
575
+ declare type JsonRpcFetchFunc = (method: string, params?: Array<any>) => Promise<any>;
576
+ declare class Web3Provider extends JsonRpcProvider {
577
+ readonly provider: ExternalProvider;
578
+ readonly jsonRpcFetchFunc: JsonRpcFetchFunc;
579
+ constructor(provider: ExternalProvider | JsonRpcFetchFunc, network?: Networkish);
580
+ send(method: string, params: Array<any>): Promise<any>;
581
+ }
582
+
583
+ interface OrderbookOverrides {
584
+ provider?: JsonRpcProvider | Web3Provider;
585
+ seaportContractAddress?: string;
586
+ zoneContractAddress?: string;
587
+ chainName?: string;
588
+ apiEndpoint?: string;
589
+ }
590
+ interface OrderbookModuleConfiguration {
591
+ seaportContractAddress: string;
592
+ zoneContractAddress: string;
593
+ apiEndpoint: string;
594
+ chainName: string;
595
+ provider: JsonRpcProvider | Web3Provider;
596
+ }
597
+
164
598
  declare enum OrderType {
165
599
  FULL_OPEN = 0,
166
600
  PARTIAL_OPEN = 1,
@@ -208,6 +642,387 @@ type OrderComponents = OrderParameters & {
208
642
  counter: BigNumberish;
209
643
  };
210
644
 
645
+ type ApiRequestOptions = {
646
+ readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
647
+ readonly url: string;
648
+ readonly path?: Record<string, any>;
649
+ readonly cookies?: Record<string, any>;
650
+ readonly headers?: Record<string, any>;
651
+ readonly query?: Record<string, any>;
652
+ readonly formData?: Record<string, any>;
653
+ readonly body?: any;
654
+ readonly mediaType?: string;
655
+ readonly responseHeader?: string;
656
+ readonly errors?: Record<number, string>;
657
+ };
658
+
659
+ interface OnCancel {
660
+ readonly isResolved: boolean;
661
+ readonly isRejected: boolean;
662
+ readonly isCancelled: boolean;
663
+ (cancelHandler: () => void): void;
664
+ }
665
+ declare class CancelablePromise<T> implements Promise<T> {
666
+ readonly [Symbol.toStringTag]: string;
667
+ private _isResolved;
668
+ private _isRejected;
669
+ private _isCancelled;
670
+ private readonly _cancelHandlers;
671
+ private readonly _promise;
672
+ private _resolve?;
673
+ private _reject?;
674
+ constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
675
+ then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
676
+ catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
677
+ finally(onFinally?: (() => void) | null): Promise<T>;
678
+ cancel(): void;
679
+ get isCancelled(): boolean;
680
+ }
681
+
682
+ type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
683
+ type Headers = Record<string, string>;
684
+ type OpenAPIConfig = {
685
+ BASE: string;
686
+ VERSION: string;
687
+ WITH_CREDENTIALS: boolean;
688
+ CREDENTIALS: 'include' | 'omit' | 'same-origin';
689
+ TOKEN?: string | Resolver<string>;
690
+ USERNAME?: string | Resolver<string>;
691
+ PASSWORD?: string | Resolver<string>;
692
+ HEADERS?: Headers | Resolver<Headers>;
693
+ ENCODE_PATH?: (path: string) => string;
694
+ };
695
+
696
+ declare abstract class BaseHttpRequest {
697
+ readonly config: OpenAPIConfig;
698
+ constructor(config: OpenAPIConfig);
699
+ abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
700
+ }
701
+
702
+ /**
703
+ * The name of chain
704
+ */
705
+ type ChainName = string;
706
+
707
+ type Fee$1 = {
708
+ /**
709
+ * Fee payable to recipient upon settlement
710
+ */
711
+ amount: string;
712
+ /**
713
+ * Fee type
714
+ */
715
+ fee_type: Fee$1.fee_type;
716
+ /**
717
+ * Wallet address of fee recipient
718
+ */
719
+ recipient: string;
720
+ };
721
+ declare namespace Fee$1 {
722
+ /**
723
+ * Fee type
724
+ */
725
+ enum fee_type {
726
+ ROYALTY = "ROYALTY",
727
+ MAKER_MARKETPLACE = "MAKER_MARKETPLACE",
728
+ TAKER_MARKETPLACE = "TAKER_MARKETPLACE",
729
+ PROTOCOL = "PROTOCOL"
730
+ }
731
+ }
732
+
733
+ type ERC20Item$1 = {
734
+ /**
735
+ * Token type user is offering, which in this case is ERC20
736
+ */
737
+ item_type: 'ERC20';
738
+ /**
739
+ * Address of ERC20 token
740
+ */
741
+ contract_address: string;
742
+ /**
743
+ * A string representing the starting price at which the user is willing to sell the token. This value is provided in the smallest unit of the token (e.g., wei for Ethereum).
744
+ */
745
+ start_amount: string;
746
+ };
747
+
748
+ type ERC721Item$1 = {
749
+ /**
750
+ * Token type user is offering, which in this case is ERC721
751
+ */
752
+ item_type: 'ERC721';
753
+ /**
754
+ * Address of ERC721 token
755
+ */
756
+ contract_address: string;
757
+ /**
758
+ * ID of ERC721 token
759
+ */
760
+ token_id: string;
761
+ };
762
+
763
+ type NativeItem$1 = {
764
+ /**
765
+ * Token type user is offering, which in this case is the native IMX token
766
+ */
767
+ item_type: 'NATIVE';
768
+ /**
769
+ * A string representing the starting price at which the user is willing to sell the token. This value is provided in the smallest unit of the token (e.g., wei for Ethereum).
770
+ */
771
+ start_amount: string;
772
+ };
773
+
774
+ type Item = (NativeItem$1 | ERC20Item$1 | ERC721Item$1);
775
+
776
+ type ProtocolData = {
777
+ /**
778
+ * The Order type
779
+ */
780
+ order_type: ProtocolData.order_type;
781
+ /**
782
+ * Immutable zone address
783
+ */
784
+ zone_address: string;
785
+ /**
786
+ * big.Int or uint256 string for order counter
787
+ */
788
+ counter: string;
789
+ /**
790
+ * Immutable Seaport contract address
791
+ */
792
+ seaport_address: string;
793
+ /**
794
+ * Immutable Seaport contract version
795
+ */
796
+ seaport_version: string;
797
+ };
798
+ declare namespace ProtocolData {
799
+ /**
800
+ * The Order type
801
+ */
802
+ enum order_type {
803
+ FULL_RESTRICTED = "FULL_RESTRICTED"
804
+ }
805
+ }
806
+
807
+ type CreateListingRequestBody = {
808
+ account_address: string;
809
+ order_hash: string;
810
+ /**
811
+ * Buy item for listing should either be NATIVE or ERC20 item
812
+ */
813
+ buy: Array<Item>;
814
+ fees: Array<Fee$1>;
815
+ /**
816
+ * Time after which the Order is considered expired
817
+ */
818
+ end_time: string;
819
+ protocol_data: ProtocolData;
820
+ /**
821
+ * A random value added to the create Order request
822
+ */
823
+ salt: string;
824
+ /**
825
+ * Sell item for listing should be an ERC721 item
826
+ */
827
+ sell: Array<Item>;
828
+ /**
829
+ * Digital signature generated by the user for the specific Order
830
+ */
831
+ signature: string;
832
+ /**
833
+ * Time after which Order is considered active
834
+ */
835
+ start_time: string;
836
+ };
837
+
838
+ type FulfillmentDataRequest = {
839
+ order_id: string;
840
+ fee?: Fee$1;
841
+ };
842
+
843
+ /**
844
+ * The chain details
845
+ */
846
+ type Chain = {
847
+ /**
848
+ * The id of chain
849
+ */
850
+ id: string;
851
+ /**
852
+ * The name of chain
853
+ */
854
+ name: string;
855
+ };
856
+
857
+ /**
858
+ * The Order status
859
+ */
860
+ declare enum OrderStatus {
861
+ PENDING = "PENDING",
862
+ ACTIVE = "ACTIVE",
863
+ INACTIVE = "INACTIVE",
864
+ FILLED = "FILLED",
865
+ CANCELLED = "CANCELLED",
866
+ EXPIRED = "EXPIRED"
867
+ }
868
+
869
+ type Order = {
870
+ account_address: string;
871
+ buy: Array<Item>;
872
+ fees: Array<Fee$1>;
873
+ chain: Chain;
874
+ /**
875
+ * Time the Order is created
876
+ */
877
+ create_time: string;
878
+ /**
879
+ * Time after which the Order is considered expired
880
+ */
881
+ end_time: string;
882
+ /**
883
+ * Global Order identifier
884
+ */
885
+ id: string;
886
+ protocol_data: ProtocolData;
887
+ /**
888
+ * A random value added to the create Order request
889
+ */
890
+ salt: string;
891
+ sell: Array<Item>;
892
+ /**
893
+ * Digital signature generated by the user for the specific Order
894
+ */
895
+ signature: string;
896
+ /**
897
+ * Time after which Order is considered active
898
+ */
899
+ start_time: string;
900
+ status: OrderStatus;
901
+ /**
902
+ * Time the Order is last updated
903
+ */
904
+ update_time: string;
905
+ };
906
+
907
+ type FulfillmentDataResult = {
908
+ extra_data: string;
909
+ order: Order;
910
+ };
911
+
912
+ type ListingResult = {
913
+ result: Order;
914
+ };
915
+
916
+ /**
917
+ * Pagination properties
918
+ */
919
+ type Page = {
920
+ /**
921
+ * First item as an encoded string
922
+ */
923
+ previous_cursor: string | null;
924
+ /**
925
+ * Last item as an encoded string
926
+ */
927
+ next_cursor: string | null;
928
+ };
929
+
930
+ type ListListingsResult = {
931
+ page: Page;
932
+ result: Array<Order>;
933
+ };
934
+
935
+ /**
936
+ * Encoded page cursor to retrieve previous or next page. Use the value returned in the response.
937
+ */
938
+ type PageCursor = string;
939
+
940
+ /**
941
+ * Maximum number of items to return
942
+ */
943
+ type PageSize = number;
944
+
945
+ declare class OrdersService {
946
+ readonly httpRequest: BaseHttpRequest;
947
+ constructor(httpRequest: BaseHttpRequest);
948
+ /**
949
+ * List all listings
950
+ * List all listings
951
+ * @returns ListListingsResult OK response.
952
+ * @throws ApiError
953
+ */
954
+ listListings({ chainName, status, sellItemContractAddress, buyItemContractAddress, sellItemTokenId, pageSize, sortBy, sortDirection, pageCursor, }: {
955
+ chainName: ChainName;
956
+ /**
957
+ * Order status to filter by
958
+ */
959
+ status?: OrderStatus;
960
+ /**
961
+ * Sell item contract address to filter by
962
+ */
963
+ sellItemContractAddress?: string;
964
+ /**
965
+ * Buy item contract address to filter by
966
+ */
967
+ buyItemContractAddress?: string;
968
+ /**
969
+ * Sell item token identifier to filter by
970
+ */
971
+ sellItemTokenId?: string;
972
+ /**
973
+ * Maximum number of orders to return per page
974
+ */
975
+ pageSize?: PageSize;
976
+ /**
977
+ * Order field to sort by
978
+ */
979
+ sortBy?: 'created_at' | 'updated_at' | 'buy_item_amount';
980
+ /**
981
+ * Ascending or descending direction for sort
982
+ */
983
+ sortDirection?: 'asc' | 'desc';
984
+ /**
985
+ * Page cursor to retrieve previous or next page. Use the value returned in the response.
986
+ */
987
+ pageCursor?: PageCursor;
988
+ }): CancelablePromise<ListListingsResult>;
989
+ /**
990
+ * Create a listing
991
+ * Create a listing
992
+ * @returns ListingResult Created response.
993
+ * @throws ApiError
994
+ */
995
+ createListing({ chainName, requestBody, }: {
996
+ chainName: ChainName;
997
+ requestBody: CreateListingRequestBody;
998
+ }): CancelablePromise<ListingResult>;
999
+ /**
1000
+ * Get a single listing by ID
1001
+ * Get a single listing by ID
1002
+ * @returns ListingResult OK response.
1003
+ * @throws ApiError
1004
+ */
1005
+ getListing({ chainName, listingId, }: {
1006
+ chainName: ChainName;
1007
+ /**
1008
+ * Global Order identifier
1009
+ */
1010
+ listingId: string;
1011
+ }): CancelablePromise<ListingResult>;
1012
+ /**
1013
+ * Retrieve fulfillment data for orders
1014
+ * Retrieve signed fulfillment data based on the list of order IDs and corresponding fees.
1015
+ * @returns any Successful response
1016
+ * @throws ApiError
1017
+ */
1018
+ fulfillmentData({ chainName, requestBody, }: {
1019
+ chainName: ChainName;
1020
+ requestBody: Array<FulfillmentDataRequest>;
1021
+ }): CancelablePromise<{
1022
+ result: Array<FulfillmentDataResult>;
1023
+ }>;
1024
+ }
1025
+
211
1026
  interface ERC721Item {
212
1027
  type: 'ERC721';
213
1028
  contractAddress: string;
@@ -244,6 +1059,17 @@ interface CreateListingParams {
244
1059
  makerFee?: Fee;
245
1060
  }
246
1061
  type ListListingsParams = Omit<Parameters<typeof OrdersService.prototype.listListings>[0], 'chainName'>;
1062
+ declare enum FeeType {
1063
+ MAKER_MARKETPLACE = "MAKER_MARKETPLACE",
1064
+ TAKER_MARKETPLACE = "TAKER_MARKETPLACE",
1065
+ PROTOCOL = "PROTOCOL",
1066
+ ROYALTY = "ROYALTY"
1067
+ }
1068
+ interface Fee {
1069
+ type: FeeType;
1070
+ recipient: string;
1071
+ amount: string;
1072
+ }
247
1073
  declare enum TransactionPurpose {
248
1074
  APPROVAL = "APPROVAL",
249
1075
  FULFILL_ORDER = "FULFILL_ORDER"
@@ -278,4 +1104,70 @@ interface CancelOrderResponse {
278
1104
  unsignedCancelOrderTransaction: PopulatedTransaction;
279
1105
  }
280
1106
 
281
- export { Action, ActionType, CancelOrderResponse, CreateListingParams, ERC20Item, ERC721Item, FulfillOrderResponse, ListListingsParams, NativeItem, Orderbook, PrepareListingParams, PrepareListingResponse, RoyaltyInfo, SignableAction, SignablePurpose, TransactionAction, TransactionBuilder, TransactionPurpose, constants };
1107
+ /**
1108
+ * zkEVM orderbook SDK
1109
+ * @constructor
1110
+ * @param {OrderbookModuleConfiguration} config - Configuration for Immutable services.
1111
+ */
1112
+ declare class Orderbook {
1113
+ private apiClient;
1114
+ private seaport;
1115
+ private orderbookConfig;
1116
+ constructor(config: ModuleConfiguration<OrderbookOverrides>);
1117
+ /**
1118
+ * Return the configuration for the orderbook module.
1119
+ * @return {OrderbookModuleConfiguration} The configuration for the orderbook module.
1120
+ */
1121
+ config(): OrderbookModuleConfiguration;
1122
+ /**
1123
+ * Get an order by ID
1124
+ * @param {string} listingId - The listingId to find.
1125
+ * @return {ListingResult} The returned order result.
1126
+ */
1127
+ getListing(listingId: string): Promise<ListingResult>;
1128
+ /**
1129
+ * List orders. This method is used to get a list of orders filtered by conditions specified
1130
+ * in the params object.
1131
+ * @param {ListListingsParams} listOrderParams - Filtering, ordering and page parameters.
1132
+ * @return {ListListingsResult} The paged orders.
1133
+ */
1134
+ listListings(listOrderParams: ListListingsParams): Promise<ListListingsResult>;
1135
+ /**
1136
+ * Get required transactions and messages for signing prior to creating a listing
1137
+ * through the createListing method
1138
+ * @param {PrepareListingParams} prepareListingParams - Details about the listing to be created.
1139
+ * @return {PrepareListingResponse} PrepareListingResponse includes
1140
+ * the unsigned approval transaction, the typed order message for signing and
1141
+ * the order components that can be submitted to `createListing` with a signature.
1142
+ */
1143
+ prepareListing({ makerAddress, sell, buy, orderExpiry, }: PrepareListingParams): Promise<PrepareListingResponse>;
1144
+ /**
1145
+ * Create an order
1146
+ * @param {CreateListingParams} createListingParams - create an order with the given params.
1147
+ * @return {ListingResult} The result of the order created in the Immutable services.
1148
+ */
1149
+ createListing(createListingParams: CreateListingParams): Promise<ListingResult>;
1150
+ /**
1151
+ * Get unsigned transactions that can be submitted to fulfil an open order. If the approval
1152
+ * transaction exists it must be signed and submitted to the chain before the fulfilment
1153
+ * transaction can be submitted or it will be reverted.
1154
+ * @param {string} listingId - The listingId to fulfil.
1155
+ * @param {string} fulfillerAddress - The address of the account fulfilling the order.
1156
+ * @return {FulfillOrderResponse} Approval and fulfilment transactions.
1157
+ */
1158
+ fulfillOrder(listingId: string, takerAddress: string, takerFee?: Fee): Promise<FulfillOrderResponse>;
1159
+ /**
1160
+ * Get an unsigned cancel order transaction. Orders can only be cancelled by
1161
+ * the account that created them.
1162
+ * @param {string} listingId - The listingId to cancel.
1163
+ * @param {string} accountAddress - The address of the account cancelling the order.
1164
+ * @return {CancelOrderResponse} The unsigned cancel order transaction
1165
+ */
1166
+ cancelOrder(listingId: string, accountAddress: string): Promise<CancelOrderResponse>;
1167
+ }
1168
+
1169
+ declare const constants: {
1170
+ estimatedFulfillmentGasGwei: number;
1171
+ };
1172
+
1173
+ export { Action, ActionType, CancelOrderResponse, CreateListingParams, ERC20Item, ERC721Item, Fee, FeeType, FulfillOrderResponse, ListListingsParams, ListListingsResult, ListingResult, NativeItem, Order, OrderStatus, Orderbook, PrepareListingParams, PrepareListingResponse, RoyaltyInfo, SignableAction, SignablePurpose, TransactionAction, TransactionBuilder, TransactionPurpose, constants };