@imtbl/sdk 0.9.0 → 0.12.0-alpha

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.
@@ -0,0 +1,281 @@
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
+
5
+ declare enum Environment {
6
+ PRODUCTION = "production",
7
+ SANDBOX = "sandbox"
8
+ }
9
+ declare class ImmutableConfiguration {
10
+ readonly environment: Environment;
11
+ readonly apiKey?: string;
12
+ constructor(options: {
13
+ environment: Environment;
14
+ apiKey?: string;
15
+ });
16
+ }
17
+ interface ModuleConfiguration<T> {
18
+ baseConfig: ImmutableConfiguration;
19
+ overrides?: T;
20
+ }
21
+
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
+ declare type Bytes = ArrayLike<number>;
89
+ declare type BytesLike = Bytes | string;
90
+ interface Hexable {
91
+ toHexString(): string;
92
+ }
93
+
94
+ declare type BigNumberish = BigNumber | Bytes | bigint | string | number;
95
+ declare class BigNumber implements Hexable {
96
+ readonly _hex: string;
97
+ readonly _isBigNumber: boolean;
98
+ constructor(constructorGuard: any, hex: string);
99
+ fromTwos(value: number): BigNumber;
100
+ toTwos(value: number): BigNumber;
101
+ abs(): BigNumber;
102
+ add(other: BigNumberish): BigNumber;
103
+ sub(other: BigNumberish): BigNumber;
104
+ div(other: BigNumberish): BigNumber;
105
+ mul(other: BigNumberish): BigNumber;
106
+ mod(other: BigNumberish): BigNumber;
107
+ pow(other: BigNumberish): BigNumber;
108
+ and(other: BigNumberish): BigNumber;
109
+ or(other: BigNumberish): BigNumber;
110
+ xor(other: BigNumberish): BigNumber;
111
+ mask(value: number): BigNumber;
112
+ shl(value: number): BigNumber;
113
+ shr(value: number): BigNumber;
114
+ eq(other: BigNumberish): boolean;
115
+ lt(other: BigNumberish): boolean;
116
+ lte(other: BigNumberish): boolean;
117
+ gt(other: BigNumberish): boolean;
118
+ gte(other: BigNumberish): boolean;
119
+ isNegative(): boolean;
120
+ isZero(): boolean;
121
+ toNumber(): number;
122
+ toBigInt(): bigint;
123
+ toString(): string;
124
+ toHexString(): string;
125
+ toJSON(key?: string): any;
126
+ static from(value: any): BigNumber;
127
+ static isBigNumber(value: any): value is BigNumber;
128
+ }
129
+
130
+ declare type AccessList = Array<{
131
+ address: string;
132
+ storageKeys: Array<string>;
133
+ }>;
134
+
135
+ interface TypedDataDomain {
136
+ name?: string;
137
+ version?: string;
138
+ chainId?: BigNumberish;
139
+ verifyingContract?: string;
140
+ salt?: BytesLike;
141
+ }
142
+ interface TypedDataField {
143
+ name: string;
144
+ type: string;
145
+ }
146
+
147
+ interface PopulatedTransaction {
148
+ to?: string;
149
+ from?: string;
150
+ nonce?: number;
151
+ gasLimit?: BigNumber;
152
+ gasPrice?: BigNumber;
153
+ data?: string;
154
+ value?: BigNumber;
155
+ chainId?: number;
156
+ type?: number;
157
+ accessList?: AccessList;
158
+ maxFeePerGas?: BigNumber;
159
+ maxPriorityFeePerGas?: BigNumber;
160
+ customData?: Record<string, any>;
161
+ ccipReadEnabled?: boolean;
162
+ }
163
+
164
+ declare enum OrderType {
165
+ FULL_OPEN = 0,
166
+ PARTIAL_OPEN = 1,
167
+ FULL_RESTRICTED = 2,
168
+ PARTIAL_RESTRICTED = 3
169
+ }
170
+ declare enum ItemType {
171
+ NATIVE = 0,
172
+ ERC20 = 1,
173
+ ERC721 = 2,
174
+ ERC1155 = 3,
175
+ ERC721_WITH_CRITERIA = 4,
176
+ ERC1155_WITH_CRITERIA = 5
177
+ }
178
+
179
+ type OfferItem = {
180
+ itemType: ItemType;
181
+ token: string;
182
+ identifierOrCriteria: string;
183
+ startAmount: string;
184
+ endAmount: string;
185
+ };
186
+ type ConsiderationItem = {
187
+ itemType: ItemType;
188
+ token: string;
189
+ identifierOrCriteria: string;
190
+ startAmount: string;
191
+ endAmount: string;
192
+ recipient: string;
193
+ };
194
+ type OrderParameters = {
195
+ offerer: string;
196
+ zone: string;
197
+ orderType: OrderType;
198
+ startTime: BigNumberish;
199
+ endTime: BigNumberish;
200
+ zoneHash: string;
201
+ salt: string;
202
+ offer: OfferItem[];
203
+ consideration: ConsiderationItem[];
204
+ totalOriginalConsiderationItems: BigNumberish;
205
+ conduitKey: string;
206
+ };
207
+ type OrderComponents = OrderParameters & {
208
+ counter: BigNumberish;
209
+ };
210
+
211
+ interface ERC721Item {
212
+ type: 'ERC721';
213
+ contractAddress: string;
214
+ tokenId: string;
215
+ }
216
+ interface ERC20Item {
217
+ type: 'ERC20';
218
+ contractAddress: string;
219
+ amount: string;
220
+ }
221
+ interface NativeItem {
222
+ type: 'NATIVE';
223
+ amount: string;
224
+ }
225
+ interface RoyaltyInfo {
226
+ recipient: string;
227
+ amountRequired: string;
228
+ }
229
+ interface PrepareListingParams {
230
+ makerAddress: string;
231
+ sell: ERC721Item;
232
+ buy: ERC20Item | NativeItem;
233
+ orderExpiry?: Date;
234
+ }
235
+ interface PrepareListingResponse {
236
+ actions: Action[];
237
+ orderComponents: OrderComponents;
238
+ orderHash: string;
239
+ }
240
+ interface CreateListingParams {
241
+ orderComponents: OrderComponents;
242
+ orderHash: string;
243
+ orderSignature: string;
244
+ makerFee?: Fee;
245
+ }
246
+ type ListListingsParams = Omit<Parameters<typeof OrdersService.prototype.listListings>[0], 'chainName'>;
247
+ declare enum TransactionPurpose {
248
+ APPROVAL = "APPROVAL",
249
+ FULFILL_ORDER = "FULFILL_ORDER"
250
+ }
251
+ declare enum SignablePurpose {
252
+ CREATE_LISTING = "CREATE_LISTING"
253
+ }
254
+ declare enum ActionType {
255
+ TRANSACTION = "TRANSACTION",
256
+ SIGNABLE = "SIGNABLE"
257
+ }
258
+ type TransactionBuilder = () => Promise<PopulatedTransaction>;
259
+ interface TransactionAction {
260
+ type: ActionType.TRANSACTION;
261
+ purpose: TransactionPurpose;
262
+ buildTransaction: TransactionBuilder;
263
+ }
264
+ interface SignableAction {
265
+ type: ActionType.SIGNABLE;
266
+ purpose: SignablePurpose;
267
+ message: {
268
+ domain: TypedDataDomain;
269
+ types: Record<string, TypedDataField[]>;
270
+ value: Record<string, any>;
271
+ };
272
+ }
273
+ type Action = TransactionAction | SignableAction;
274
+ interface FulfillOrderResponse {
275
+ actions: Action[];
276
+ }
277
+ interface CancelOrderResponse {
278
+ unsignedCancelOrderTransaction: PopulatedTransaction;
279
+ }
280
+
281
+ export { Action, ActionType, CancelOrderResponse, CreateListingParams, ERC20Item, ERC721Item, FulfillOrderResponse, ListListingsParams, NativeItem, Orderbook, PrepareListingParams, PrepareListingResponse, RoyaltyInfo, SignableAction, SignablePurpose, TransactionAction, TransactionBuilder, TransactionPurpose, constants };