@dzapio/sdk 2.0.38 → 2.0.40
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/dist/index.d.mts +678 -674
- package/dist/index.d.ts +678 -674
- package/dist/index.js +111 -84
- package/dist/index.mjs +111 -84
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as viem from 'viem';
|
|
2
|
-
import { WalletCallReceipt as WalletCallReceipt$1,
|
|
2
|
+
import { WalletCallReceipt as WalletCallReceipt$1, Prettify, TypedDataDomain, WalletClient, TransactionReceipt, ChainFormatters, Chain as Chain$1, Assign } from 'viem';
|
|
3
3
|
import { Signer } from 'ethers';
|
|
4
4
|
import * as viemChains from 'viem/chains';
|
|
5
5
|
import { Chain as Chain$2 } from 'viem/chains';
|
|
@@ -153,782 +153,786 @@ declare const AllowanceTypes: {
|
|
|
153
153
|
};
|
|
154
154
|
type AllowanceType = (typeof AllowanceTypes)[keyof typeof AllowanceTypes];
|
|
155
155
|
|
|
156
|
-
declare
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
kind: AddressKind;
|
|
166
|
-
isNative: boolean;
|
|
167
|
-
isToken: boolean;
|
|
168
|
-
isContract: boolean;
|
|
169
|
-
address: string;
|
|
156
|
+
declare const zapPathAction: {
|
|
157
|
+
readonly swap: "swap";
|
|
158
|
+
readonly bridge: "bridge";
|
|
159
|
+
readonly deposit: "deposit";
|
|
160
|
+
readonly withdraw: "withdraw";
|
|
161
|
+
readonly stake: "stake";
|
|
162
|
+
readonly unstake: "unstake";
|
|
163
|
+
readonly increase: "increase";
|
|
164
|
+
readonly harvest: "harvest";
|
|
170
165
|
};
|
|
171
166
|
|
|
172
|
-
type
|
|
173
|
-
type
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
};
|
|
177
|
-
type NativeTokenInfo = {
|
|
178
|
-
contract: string;
|
|
167
|
+
type ZapPathAction = keyof typeof zapPathAction;
|
|
168
|
+
type ZapPathAsset = {
|
|
169
|
+
chainId: number;
|
|
170
|
+
address: HexString;
|
|
179
171
|
symbol: string;
|
|
172
|
+
logo: string;
|
|
180
173
|
decimals: number;
|
|
174
|
+
price: string;
|
|
175
|
+
type: string;
|
|
181
176
|
name: string;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
logo: string;
|
|
185
|
-
isErc20?: boolean;
|
|
186
|
-
};
|
|
187
|
-
declare const contractErrorActions: {
|
|
188
|
-
readonly TRY_ANOTHER_ROUTE: "TRY_ANOTHER_ROUTE";
|
|
189
|
-
readonly INCREASE_SLIPPAGE: "INCREASE_SLIPPAGE";
|
|
190
|
-
readonly INCREASE_ALLOWANCE: "INCREASE_ALLOWANCE";
|
|
191
|
-
};
|
|
192
|
-
type ContractErrorResponse = {
|
|
193
|
-
status: string;
|
|
194
|
-
txId: string;
|
|
195
|
-
code: number;
|
|
196
|
-
message: string;
|
|
197
|
-
error: unknown;
|
|
198
|
-
action: keyof typeof contractErrorActions;
|
|
199
|
-
details?: unknown;
|
|
177
|
+
provider?: ProviderDetails;
|
|
178
|
+
underlyingTokens?: ZapUnderlyingToken[];
|
|
200
179
|
};
|
|
201
|
-
type
|
|
202
|
-
|
|
180
|
+
type ZapPath = {
|
|
181
|
+
action: ZapPathAction;
|
|
182
|
+
protocol: ProviderDetails;
|
|
183
|
+
fee: ZapFee[];
|
|
184
|
+
estimatedDuration: number;
|
|
185
|
+
input: {
|
|
186
|
+
asset: ZapPathAsset;
|
|
203
187
|
amount: string;
|
|
204
|
-
|
|
205
|
-
decimals: number;
|
|
188
|
+
amountUSD: string;
|
|
206
189
|
}[];
|
|
207
|
-
|
|
190
|
+
output: {
|
|
191
|
+
asset: ZapPathAsset;
|
|
208
192
|
amount: string;
|
|
209
|
-
|
|
210
|
-
|
|
193
|
+
amountUSD: string;
|
|
194
|
+
minAmount: string;
|
|
211
195
|
}[];
|
|
212
|
-
providers: string[];
|
|
213
|
-
chainId: number;
|
|
214
|
-
account: string;
|
|
215
|
-
txType: 'swap' | 'bridge';
|
|
216
196
|
};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
rpcProviders: ApiRpcResponse[];
|
|
231
|
-
pricingAvailable: boolean;
|
|
232
|
-
balanceAvailable: boolean;
|
|
233
|
-
supportedAs: {
|
|
234
|
-
source: boolean;
|
|
235
|
-
destination: boolean;
|
|
236
|
-
};
|
|
237
|
-
contracts?: Partial<{
|
|
238
|
-
router: string;
|
|
239
|
-
dca: string;
|
|
240
|
-
zap: string;
|
|
241
|
-
}>;
|
|
242
|
-
coingecko?: {
|
|
243
|
-
chainKey: string;
|
|
244
|
-
nativeTokenKey: string;
|
|
245
|
-
};
|
|
246
|
-
defiLlama?: {
|
|
247
|
-
chainKey: string;
|
|
248
|
-
nativeTokenKey: string;
|
|
249
|
-
};
|
|
250
|
-
disableMultiTxn: boolean;
|
|
251
|
-
isEnabled: boolean;
|
|
252
|
-
mainnet: boolean;
|
|
253
|
-
tags?: Tag[];
|
|
254
|
-
version?: ContractVersion;
|
|
197
|
+
|
|
198
|
+
declare const chainTypes: {
|
|
199
|
+
readonly evm: "evm";
|
|
200
|
+
readonly bvm: "bvm";
|
|
201
|
+
readonly svm: "svm";
|
|
202
|
+
readonly aptosvm: "aptosvm";
|
|
203
|
+
readonly cosmos: "cosmos";
|
|
204
|
+
readonly nearvm: "nearvm";
|
|
205
|
+
readonly starknetvm: "starknetvm";
|
|
206
|
+
readonly stellarvm: "stellarvm";
|
|
207
|
+
readonly suivm: "suivm";
|
|
208
|
+
readonly tonvm: "tonvm";
|
|
209
|
+
readonly tronvm: "tronvm";
|
|
255
210
|
};
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
keyType?: 'ALCHEMY_KEY' | 'BLASTAPI_KEY';
|
|
211
|
+
|
|
212
|
+
declare const zapStepAction: {
|
|
213
|
+
readonly execute: "execute";
|
|
260
214
|
};
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
215
|
+
|
|
216
|
+
type StepAction = keyof typeof zapStepAction;
|
|
217
|
+
type ZapEvmTxnDetails = {
|
|
218
|
+
type: typeof chainTypes.evm;
|
|
219
|
+
txnId: HexString;
|
|
220
|
+
callData: HexString;
|
|
221
|
+
callTo: HexString;
|
|
222
|
+
value: string;
|
|
223
|
+
estimatedGas: string;
|
|
265
224
|
};
|
|
266
|
-
type
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
symbol: string;
|
|
271
|
-
logo?: string;
|
|
272
|
-
amount: string;
|
|
273
|
-
amountUSD: string;
|
|
274
|
-
included: boolean;
|
|
225
|
+
type ZapBvmTxnDetails = {
|
|
226
|
+
type: typeof chainTypes.bvm;
|
|
227
|
+
txnId: HexString;
|
|
228
|
+
data: string;
|
|
275
229
|
};
|
|
276
|
-
type
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
230
|
+
type SVMTxnDetails = {
|
|
231
|
+
type: typeof chainTypes.svm;
|
|
232
|
+
txnId: HexString;
|
|
233
|
+
data: string[];
|
|
234
|
+
blockhash?: {
|
|
235
|
+
blockhash: string;
|
|
236
|
+
lastValidBlockHeight: number;
|
|
237
|
+
};
|
|
238
|
+
estimatedGas: string;
|
|
239
|
+
isJitoTx?: boolean;
|
|
280
240
|
};
|
|
281
|
-
type
|
|
282
|
-
type
|
|
283
|
-
|
|
284
|
-
|
|
241
|
+
type ZapTxnDetails = ZapEvmTxnDetails | ZapBvmTxnDetails | SVMTxnDetails;
|
|
242
|
+
type ZapTransactionStep<T extends ZapTxnDetails = ZapTxnDetails> = {
|
|
243
|
+
action: StepAction;
|
|
244
|
+
data: T;
|
|
285
245
|
};
|
|
286
|
-
type
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
data: TradeQuotesRequestData[];
|
|
291
|
-
disableEstimation?: boolean;
|
|
292
|
-
account?: string;
|
|
293
|
-
bridges?: ProtocolFilter;
|
|
294
|
-
dexes?: ProtocolFilter;
|
|
295
|
-
filter?: QuoteFilter;
|
|
296
|
-
timingStrategy?: Partial<{
|
|
297
|
-
minWaitTimeMs: number;
|
|
298
|
-
maxWaitTimeMs: number;
|
|
299
|
-
subsequentDelayMs: number;
|
|
300
|
-
preferredResultCount: number;
|
|
301
|
-
relaxMinSuccessOnDelay: boolean;
|
|
302
|
-
}>;
|
|
246
|
+
type ZapStep = ZapTransactionStep;
|
|
247
|
+
|
|
248
|
+
type ZapRouteRequestPositionDetails = {
|
|
249
|
+
nftId: string;
|
|
303
250
|
};
|
|
304
|
-
type
|
|
305
|
-
|
|
251
|
+
type ZapRouteRequestPoolDetails = {
|
|
252
|
+
lowerTick: number;
|
|
253
|
+
upperTick: number;
|
|
254
|
+
metadata?: unknown;
|
|
255
|
+
};
|
|
256
|
+
type ZapIntegratorConfig = {
|
|
257
|
+
id: string;
|
|
258
|
+
feeBps: number;
|
|
259
|
+
wallet: string;
|
|
260
|
+
};
|
|
261
|
+
type ZapBuildTxnResponse = {
|
|
262
|
+
approvalData: {
|
|
263
|
+
callTo: HexString;
|
|
264
|
+
approveTo: HexString;
|
|
265
|
+
amount: string;
|
|
266
|
+
}[];
|
|
267
|
+
dust: ZapPath['output'];
|
|
268
|
+
output: ZapPath['output'];
|
|
269
|
+
steps: ZapStep[];
|
|
270
|
+
path: ZapPath[];
|
|
271
|
+
};
|
|
272
|
+
type ZapBuildTxnRequest = {
|
|
306
273
|
srcToken: string;
|
|
307
|
-
|
|
274
|
+
srcChainId: number;
|
|
308
275
|
destToken: string;
|
|
309
|
-
|
|
310
|
-
|
|
276
|
+
destChainId: number;
|
|
277
|
+
recipient: string;
|
|
278
|
+
refundee: string;
|
|
311
279
|
slippage: number;
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
280
|
+
account: string;
|
|
281
|
+
integrator?: ZapIntegratorConfig;
|
|
282
|
+
permitData?: string;
|
|
283
|
+
amount?: string;
|
|
284
|
+
estimateGas?: boolean;
|
|
285
|
+
positionDetails?: ZapRouteRequestPositionDetails;
|
|
286
|
+
poolDetails?: ZapRouteRequestPoolDetails;
|
|
287
|
+
allowedBridges?: string[];
|
|
288
|
+
allowedDexes?: string[];
|
|
320
289
|
};
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
srcAmount: string;
|
|
326
|
-
srcAmountUSD: string;
|
|
327
|
-
destToken: Token;
|
|
328
|
-
destAmount: string;
|
|
329
|
-
destAmountUSD: string;
|
|
330
|
-
fee: Fee;
|
|
290
|
+
|
|
291
|
+
type ZapBundleSrcToken = {
|
|
292
|
+
address: string;
|
|
293
|
+
amount?: string;
|
|
331
294
|
};
|
|
332
|
-
type
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
295
|
+
type ZapBundleAction = {
|
|
296
|
+
action: ZapPathAction;
|
|
297
|
+
srcToken: ZapBundleSrcToken | ZapBundleSrcToken[];
|
|
298
|
+
srcChainId: number;
|
|
299
|
+
destToken?: string;
|
|
300
|
+
destChainId?: number;
|
|
301
|
+
positionDetails?: ZapRouteRequestPositionDetails;
|
|
302
|
+
poolDetails?: ZapRouteRequestPoolDetails;
|
|
303
|
+
protocol?: string;
|
|
336
304
|
};
|
|
337
|
-
type
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
fee: Fee;
|
|
349
|
-
priceImpactPercent: string;
|
|
350
|
-
duration: string;
|
|
351
|
-
gasless: boolean;
|
|
352
|
-
steps: TradeStep[];
|
|
353
|
-
path: TradePath[];
|
|
354
|
-
tags?: Tag[];
|
|
355
|
-
additionalInfo?: AdditionalInfo;
|
|
305
|
+
type ZapBundleRequest = {
|
|
306
|
+
actions: ZapBundleAction[];
|
|
307
|
+
account: string;
|
|
308
|
+
recipient: string;
|
|
309
|
+
refundee: string;
|
|
310
|
+
slippage: number;
|
|
311
|
+
quotesOnly?: boolean;
|
|
312
|
+
estimateGas?: boolean;
|
|
313
|
+
integrator?: ZapIntegratorConfig;
|
|
314
|
+
allowedDexes?: string[];
|
|
315
|
+
allowedBridges?: string[];
|
|
356
316
|
};
|
|
357
|
-
|
|
358
|
-
|
|
317
|
+
|
|
318
|
+
type ZapPoolDetailsRequest = {
|
|
319
|
+
address: HexString;
|
|
320
|
+
chainId: number;
|
|
321
|
+
provider: string;
|
|
359
322
|
};
|
|
360
|
-
type
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
fastestSource?: string;
|
|
366
|
-
bestReturnSource: string;
|
|
367
|
-
questSource?: string;
|
|
368
|
-
quoteRates?: TradeQuotesByProviderId;
|
|
369
|
-
tokensWithoutPrice: Record<number, string[]>;
|
|
370
|
-
};
|
|
323
|
+
type ZapPoolsRequest = {
|
|
324
|
+
chainId: number;
|
|
325
|
+
provider: string;
|
|
326
|
+
limit?: number;
|
|
327
|
+
offset?: number;
|
|
371
328
|
};
|
|
372
|
-
type
|
|
373
|
-
|
|
329
|
+
type ZapPoolsResponse = {
|
|
330
|
+
pools: ZapPool[];
|
|
331
|
+
pages: number;
|
|
332
|
+
limit: number;
|
|
333
|
+
offset: number;
|
|
374
334
|
};
|
|
375
|
-
type
|
|
376
|
-
address:
|
|
377
|
-
decimals: number;
|
|
335
|
+
type ZapPool = {
|
|
336
|
+
address: string;
|
|
378
337
|
chainId: number;
|
|
379
|
-
|
|
338
|
+
name: string;
|
|
339
|
+
provider: string;
|
|
340
|
+
underlyingAssets: ZapUnderlyingToken[];
|
|
341
|
+
tvl: string;
|
|
342
|
+
apr: number;
|
|
343
|
+
metadata?: unknown;
|
|
380
344
|
symbol: string;
|
|
381
|
-
|
|
345
|
+
decimals: number;
|
|
382
346
|
};
|
|
383
|
-
type
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
};
|
|
390
|
-
permit2: {
|
|
391
|
-
supported: boolean;
|
|
347
|
+
type ZapPoolDetails = {
|
|
348
|
+
address: string;
|
|
349
|
+
slot0: {
|
|
350
|
+
sqrtPriceX96: string;
|
|
351
|
+
tick: number;
|
|
352
|
+
tickSpacing: number;
|
|
392
353
|
};
|
|
393
354
|
};
|
|
394
|
-
|
|
355
|
+
|
|
356
|
+
type ZapPositionsRequest = {
|
|
357
|
+
account: HexString;
|
|
395
358
|
chainId: number;
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
359
|
+
provider: string;
|
|
360
|
+
};
|
|
361
|
+
type ZapPosition = {
|
|
362
|
+
underlyingAssets: ZapUnderlyingTokenWithAmount[];
|
|
363
|
+
address: string;
|
|
364
|
+
apr: number;
|
|
365
|
+
name: string;
|
|
366
|
+
chainId: number;
|
|
367
|
+
provider: string;
|
|
368
|
+
amount: string;
|
|
369
|
+
amountUSD: string;
|
|
370
|
+
nftDetails?: {
|
|
371
|
+
id: string;
|
|
372
|
+
manager: HexString;
|
|
404
373
|
};
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
type TokenResponse = {
|
|
408
|
-
[key: string]: TokenInfo;
|
|
374
|
+
metadata?: unknown;
|
|
375
|
+
decimals: number;
|
|
409
376
|
};
|
|
410
|
-
type
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
fromChain: number;
|
|
414
|
-
gasless: boolean;
|
|
415
|
-
private?: boolean;
|
|
416
|
-
disableEstimation?: boolean;
|
|
417
|
-
data: TradeBuildTxnRequestData[];
|
|
418
|
-
hasPermit2ApprovalForAllTokens?: boolean;
|
|
419
|
-
publicKey?: string;
|
|
377
|
+
type ZapPositionsResponse = {
|
|
378
|
+
positions: ZapPosition[];
|
|
379
|
+
count: number;
|
|
420
380
|
};
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
destToken: string;
|
|
426
|
-
destDecimals?: number;
|
|
427
|
-
toChain: number;
|
|
428
|
-
protocol: string;
|
|
381
|
+
|
|
382
|
+
type ZapQuoteResponse = Omit<ZapBuildTxnResponse, 'steps'>;
|
|
383
|
+
type ZapQuoteRequest = Omit<ZapBuildTxnRequest, 'refundee' | 'recipient' | 'account'> & Partial<{
|
|
384
|
+
refundee: string;
|
|
429
385
|
recipient: string;
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
386
|
+
account: string;
|
|
387
|
+
}>;
|
|
388
|
+
|
|
389
|
+
type ZapStatus = 'PENDING' | 'COMPLETED' | 'FAILED' | 'REFUNDED';
|
|
390
|
+
type ZapStatusAsset = {
|
|
391
|
+
asset: ZapPathAsset;
|
|
392
|
+
amount: string;
|
|
393
|
+
amountUSD: string;
|
|
434
394
|
};
|
|
435
|
-
type
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
395
|
+
type ZapStatusStep = {
|
|
396
|
+
chainId: number;
|
|
397
|
+
hash?: string;
|
|
398
|
+
status: ZapStatus;
|
|
399
|
+
action: string;
|
|
400
|
+
protocol: ProviderDetails;
|
|
401
|
+
input: ZapStatusAsset[];
|
|
402
|
+
output: ZapStatusAsset[];
|
|
442
403
|
};
|
|
443
|
-
type
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
404
|
+
type ZapStatusResponse = {
|
|
405
|
+
status: ZapStatus;
|
|
406
|
+
account: string;
|
|
407
|
+
recipient: string;
|
|
408
|
+
input: ZapStatusAsset[];
|
|
409
|
+
output: ZapStatusAsset[];
|
|
410
|
+
steps: ZapStatusStep[];
|
|
411
|
+
timestamp: number;
|
|
412
|
+
completedAt: number;
|
|
449
413
|
};
|
|
450
|
-
type
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
blockhash?: string;
|
|
454
|
-
lastValidBlockHeight?: number;
|
|
414
|
+
type ZapStatusRequest = {
|
|
415
|
+
chainId: number;
|
|
416
|
+
txnHash: string;
|
|
455
417
|
};
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
418
|
+
|
|
419
|
+
type ZapProviders = Record<string, ProviderDetails>;
|
|
420
|
+
type ZapChains = {
|
|
421
|
+
[key: string]: {
|
|
422
|
+
name: string;
|
|
423
|
+
supportedProviders: string[];
|
|
424
|
+
};
|
|
462
425
|
};
|
|
463
|
-
type
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
426
|
+
type ZapFee = {
|
|
427
|
+
amount: string;
|
|
428
|
+
amountUSD: string;
|
|
429
|
+
asset: ZapPathAsset;
|
|
430
|
+
included: boolean;
|
|
467
431
|
};
|
|
468
|
-
type
|
|
469
|
-
type TxRequestData<T> = {
|
|
470
|
-
status: typeof STATUS.success;
|
|
471
|
-
txId: string;
|
|
432
|
+
type ZapUnderlyingToken = {
|
|
472
433
|
chainId: number;
|
|
473
|
-
|
|
434
|
+
address: HexString;
|
|
435
|
+
name?: string;
|
|
436
|
+
symbol: string;
|
|
437
|
+
decimals: number;
|
|
438
|
+
logo?: string | null;
|
|
474
439
|
};
|
|
475
|
-
type
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
private: boolean;
|
|
479
|
-
};
|
|
480
|
-
type TradeBuildTxnResponse = TradeGasBuildTxnResponse & {
|
|
481
|
-
data: string;
|
|
482
|
-
from: string;
|
|
483
|
-
to?: string;
|
|
484
|
-
value?: string;
|
|
485
|
-
gasLimit?: string;
|
|
486
|
-
svmTxData?: {
|
|
487
|
-
blockhash: string;
|
|
488
|
-
lastValidBlockHeight: number;
|
|
489
|
-
};
|
|
490
|
-
btcTxData?: {
|
|
491
|
-
inputs: PsbtInput[];
|
|
492
|
-
outputs: PsbtOutput[];
|
|
493
|
-
feeRate: number;
|
|
494
|
-
};
|
|
495
|
-
btclnTxData?: BtclnTxData;
|
|
496
|
-
additionalInfo: Record<string, Record<string, unknown>>;
|
|
497
|
-
updatedQuotes: Record<string, string>;
|
|
498
|
-
};
|
|
499
|
-
type BridgeGaslessTxData = {
|
|
500
|
-
executorFeesHash: HexString;
|
|
501
|
-
swapDataHash?: HexString;
|
|
502
|
-
adapterDataHash: HexString;
|
|
503
|
-
txType: typeof GaslessTxType.bridge;
|
|
504
|
-
value: string;
|
|
505
|
-
};
|
|
506
|
-
type SwapGaslessTxData = {
|
|
507
|
-
executorFeesHash: HexString;
|
|
508
|
-
swapDataHash: HexString;
|
|
509
|
-
txType: typeof GaslessTxType.swap;
|
|
510
|
-
value: string;
|
|
511
|
-
};
|
|
512
|
-
type GaslessTradeBuildTxnResponse = {
|
|
513
|
-
status: 'success';
|
|
514
|
-
txId: HexString;
|
|
515
|
-
transaction: BridgeGaslessTxData | SwapGaslessTxData;
|
|
516
|
-
quotes: Record<string, ParamQuotes>;
|
|
517
|
-
gasless: true;
|
|
518
|
-
onlySwapData: false;
|
|
440
|
+
type ZapUnderlyingTokenWithAmount = ZapUnderlyingToken & {
|
|
441
|
+
amount: string;
|
|
442
|
+
amountUSD: string;
|
|
519
443
|
};
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
444
|
+
|
|
445
|
+
declare enum AddressKind {
|
|
446
|
+
INVALID = "invalid",
|
|
447
|
+
NATIVE = "native",
|
|
448
|
+
TOKEN = "token",
|
|
449
|
+
CONTRACT = "contract",
|
|
450
|
+
WALLET = "wallet"
|
|
451
|
+
}
|
|
452
|
+
type AddressClassifyResult = {
|
|
453
|
+
valid: boolean;
|
|
454
|
+
kind: AddressKind;
|
|
455
|
+
isNative: boolean;
|
|
456
|
+
isToken: boolean;
|
|
457
|
+
isContract: boolean;
|
|
458
|
+
address: string;
|
|
531
459
|
};
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
returnToAmount: bigint;
|
|
460
|
+
|
|
461
|
+
type HexString = `0x${string}`;
|
|
462
|
+
type StatusResponse = keyof typeof STATUS_RESPONSE;
|
|
463
|
+
type ChainData = {
|
|
464
|
+
[key in number]: Chain;
|
|
538
465
|
};
|
|
539
|
-
type
|
|
466
|
+
type NativeTokenInfo = {
|
|
540
467
|
contract: string;
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
asset: StatusAsset;
|
|
549
|
-
amount: string;
|
|
550
|
-
amountUSD: number;
|
|
551
|
-
txHash: string;
|
|
552
|
-
account: string;
|
|
553
|
-
};
|
|
554
|
-
type TxStatusForPair = {
|
|
555
|
-
source: TransactionInfo;
|
|
556
|
-
destination: TransactionInfo & {
|
|
557
|
-
timestamp?: number;
|
|
558
|
-
};
|
|
559
|
-
expected?: Omit<TransactionInfo, 'txHash' | 'status'>;
|
|
560
|
-
status: StatusResponse;
|
|
561
|
-
provider: ProviderDetails;
|
|
562
|
-
allowUserTxOnDestChain: boolean;
|
|
563
|
-
message?: string;
|
|
564
|
-
protocolExplorerLink?: string;
|
|
565
|
-
};
|
|
566
|
-
type TradeStatusResponse = {
|
|
567
|
-
status: StatusResponse;
|
|
568
|
-
gasless: boolean;
|
|
569
|
-
txHash: string;
|
|
570
|
-
chainId: number;
|
|
571
|
-
timestamp: number;
|
|
572
|
-
transactions: TxStatusForPair[];
|
|
468
|
+
symbol: string;
|
|
469
|
+
decimals: number;
|
|
470
|
+
name: string;
|
|
471
|
+
balance: string;
|
|
472
|
+
price?: string;
|
|
473
|
+
logo: string;
|
|
474
|
+
isErc20?: boolean;
|
|
573
475
|
};
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
srcToken: HexString;
|
|
579
|
-
amount: string;
|
|
580
|
-
permitType: Exclude<PermitMode, keyof typeof PermitTypes.PermitBatchWitnessTransferFrom>;
|
|
476
|
+
declare const contractErrorActions: {
|
|
477
|
+
readonly TRY_ANOTHER_ROUTE: "TRY_ANOTHER_ROUTE";
|
|
478
|
+
readonly INCREASE_SLIPPAGE: "INCREASE_SLIPPAGE";
|
|
479
|
+
readonly INCREASE_ALLOWANCE: "INCREASE_ALLOWANCE";
|
|
581
480
|
};
|
|
582
|
-
type
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
481
|
+
type ContractErrorResponse = {
|
|
482
|
+
status: string;
|
|
483
|
+
txId: string;
|
|
484
|
+
code: number;
|
|
485
|
+
message: string;
|
|
486
|
+
error: unknown;
|
|
487
|
+
action: keyof typeof contractErrorActions;
|
|
488
|
+
details?: unknown;
|
|
589
489
|
};
|
|
590
|
-
type
|
|
591
|
-
|
|
592
|
-
chainId: number;
|
|
593
|
-
sender: HexString;
|
|
594
|
-
signer: WalletClient | Signer;
|
|
595
|
-
tokens: {
|
|
596
|
-
address: HexString;
|
|
597
|
-
permitData?: HexString;
|
|
490
|
+
type CalculatePointsRequest = {
|
|
491
|
+
srcTokens: {
|
|
598
492
|
amount: string;
|
|
599
|
-
|
|
493
|
+
address: string;
|
|
494
|
+
decimals: number;
|
|
600
495
|
}[];
|
|
601
|
-
|
|
602
|
-
rpcUrls: string[];
|
|
603
|
-
permitType: PermitMode;
|
|
604
|
-
isBatchPermitAllowed?: boolean;
|
|
605
|
-
signatureCallback?: (params: SignatureCallbackParams) => Promise<void>;
|
|
606
|
-
service: AvailableDZapServices;
|
|
607
|
-
contractVersion: ContractVersion;
|
|
608
|
-
};
|
|
609
|
-
type GasSignatureParams = SignatureParamsBase & {
|
|
610
|
-
gasless: false;
|
|
611
|
-
};
|
|
612
|
-
type SignPermitResponse = {
|
|
613
|
-
status: TxnStatus.success;
|
|
614
|
-
code: StatusCodes;
|
|
615
|
-
tokens: {
|
|
616
|
-
address: HexString;
|
|
617
|
-
permitData?: HexString;
|
|
496
|
+
destTokens: {
|
|
618
497
|
amount: string;
|
|
498
|
+
address: string;
|
|
499
|
+
decimals: number;
|
|
619
500
|
}[];
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
batchPermitData: HexString;
|
|
625
|
-
permitType: typeof PermitTypes.PermitBatchWitnessTransferFrom;
|
|
626
|
-
} | {
|
|
627
|
-
status: Exclude<TxnStatus, typeof TxnStatus.success>;
|
|
628
|
-
code: StatusCodes;
|
|
629
|
-
permitType: PermitMode;
|
|
501
|
+
providers: string[];
|
|
502
|
+
chainId: number;
|
|
503
|
+
account: string;
|
|
504
|
+
txType: 'swap' | 'bridge';
|
|
630
505
|
};
|
|
631
|
-
type
|
|
632
|
-
|
|
633
|
-
txId: string;
|
|
506
|
+
type Chain = {
|
|
507
|
+
coinKey: string;
|
|
634
508
|
chainId: number;
|
|
635
|
-
|
|
509
|
+
chainType: string;
|
|
510
|
+
name: string;
|
|
511
|
+
coin: string;
|
|
512
|
+
dcaContract: string;
|
|
513
|
+
swapBridgeContract: string;
|
|
514
|
+
logo: string;
|
|
515
|
+
tokenlistUrl?: string;
|
|
516
|
+
multicallAddress?: HexString;
|
|
517
|
+
blockExplorerUrl: string;
|
|
518
|
+
nativeToken: NativeTokenInfo;
|
|
519
|
+
rpcProviders: ApiRpcResponse[];
|
|
520
|
+
pricingAvailable: boolean;
|
|
521
|
+
balanceAvailable: boolean;
|
|
522
|
+
supportedAs: {
|
|
523
|
+
source: boolean;
|
|
524
|
+
destination: boolean;
|
|
525
|
+
};
|
|
526
|
+
contracts?: Partial<{
|
|
527
|
+
router: string;
|
|
528
|
+
dca: string;
|
|
529
|
+
zap: string;
|
|
530
|
+
}>;
|
|
531
|
+
coingecko?: {
|
|
532
|
+
chainKey: string;
|
|
533
|
+
nativeTokenKey: string;
|
|
534
|
+
};
|
|
535
|
+
defiLlama?: {
|
|
536
|
+
chainKey: string;
|
|
537
|
+
nativeTokenKey: string;
|
|
538
|
+
};
|
|
539
|
+
disableMultiTxn: boolean;
|
|
540
|
+
isEnabled: boolean;
|
|
541
|
+
mainnet: boolean;
|
|
542
|
+
tags?: Tag[];
|
|
543
|
+
version?: ContractVersion;
|
|
636
544
|
};
|
|
637
|
-
type
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
status: Exclude<TxnStatus, typeof TxnStatus.success>;
|
|
642
|
-
message: string;
|
|
545
|
+
type ApiRpcResponse = {
|
|
546
|
+
url: string;
|
|
547
|
+
keyRequired: boolean;
|
|
548
|
+
keyType?: 'ALCHEMY_KEY' | 'BLASTAPI_KEY';
|
|
643
549
|
};
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
readonly deposit: "deposit";
|
|
649
|
-
readonly withdraw: "withdraw";
|
|
650
|
-
readonly stake: "stake";
|
|
651
|
-
readonly unstake: "unstake";
|
|
652
|
-
readonly increase: "increase";
|
|
653
|
-
readonly harvest: "harvest";
|
|
550
|
+
type ProviderDetails = {
|
|
551
|
+
id: string;
|
|
552
|
+
name: string;
|
|
553
|
+
icon: string;
|
|
654
554
|
};
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
555
|
+
type FeeDetails = {
|
|
556
|
+
address: string;
|
|
557
|
+
decimals: number;
|
|
658
558
|
chainId: number;
|
|
659
|
-
address: HexString;
|
|
660
559
|
symbol: string;
|
|
661
|
-
logo
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
560
|
+
logo?: string;
|
|
561
|
+
amount: string;
|
|
562
|
+
amountUSD: string;
|
|
563
|
+
included: boolean;
|
|
564
|
+
};
|
|
565
|
+
type Fee = {
|
|
566
|
+
gasFee: FeeDetails[];
|
|
567
|
+
protocolFee: FeeDetails[];
|
|
568
|
+
providerFee: FeeDetails[];
|
|
569
|
+
};
|
|
570
|
+
type QuoteFilter = keyof typeof QuoteFilters;
|
|
571
|
+
type ProtocolFilter = {
|
|
572
|
+
allow?: string[];
|
|
573
|
+
deny?: string[];
|
|
574
|
+
};
|
|
575
|
+
type TradeQuotesRequest = {
|
|
576
|
+
fromChain: number;
|
|
577
|
+
gasless?: boolean;
|
|
578
|
+
private?: boolean;
|
|
579
|
+
data: TradeQuotesRequestData[];
|
|
580
|
+
disableEstimation?: boolean;
|
|
581
|
+
account?: string;
|
|
582
|
+
bridges?: ProtocolFilter;
|
|
583
|
+
dexes?: ProtocolFilter;
|
|
584
|
+
filter?: QuoteFilter;
|
|
585
|
+
timingStrategy?: Partial<{
|
|
586
|
+
minWaitTimeMs: number;
|
|
587
|
+
maxWaitTimeMs: number;
|
|
588
|
+
subsequentDelayMs: number;
|
|
589
|
+
preferredResultCount: number;
|
|
590
|
+
relaxMinSuccessOnDelay: boolean;
|
|
591
|
+
}>;
|
|
592
|
+
};
|
|
593
|
+
type TradeQuotesRequestData = {
|
|
594
|
+
amount: string;
|
|
595
|
+
srcToken: string;
|
|
596
|
+
srcDecimals?: number;
|
|
597
|
+
destToken: string;
|
|
598
|
+
destDecimals?: number;
|
|
599
|
+
toChain: number;
|
|
600
|
+
slippage: number;
|
|
601
|
+
selectedSource?: string;
|
|
668
602
|
};
|
|
669
|
-
type
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
asset: ZapPathAsset;
|
|
676
|
-
amount: string;
|
|
677
|
-
amountUSD: string;
|
|
678
|
-
}[];
|
|
679
|
-
output: {
|
|
680
|
-
asset: ZapPathAsset;
|
|
681
|
-
amount: string;
|
|
682
|
-
amountUSD: string;
|
|
683
|
-
minAmount: string;
|
|
684
|
-
}[];
|
|
603
|
+
type TradeStep = {
|
|
604
|
+
type: string;
|
|
605
|
+
exchange: {
|
|
606
|
+
logo: string;
|
|
607
|
+
name: string;
|
|
608
|
+
};
|
|
685
609
|
};
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
readonly suivm: "suivm";
|
|
697
|
-
readonly tonvm: "tonvm";
|
|
698
|
-
readonly tronvm: "tronvm";
|
|
610
|
+
type TradePath = {
|
|
611
|
+
type: string;
|
|
612
|
+
exchange: ProviderDetails;
|
|
613
|
+
srcToken: Token;
|
|
614
|
+
srcAmount: string;
|
|
615
|
+
srcAmountUSD: string;
|
|
616
|
+
destToken: Token;
|
|
617
|
+
destAmount: string;
|
|
618
|
+
destAmountUSD: string;
|
|
619
|
+
fee: Fee;
|
|
699
620
|
};
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
621
|
+
type Tag = {
|
|
622
|
+
title: string;
|
|
623
|
+
link?: string;
|
|
624
|
+
message?: string;
|
|
703
625
|
};
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
626
|
+
type TradeQuote = {
|
|
627
|
+
bridgeDetails?: ProviderDetails;
|
|
628
|
+
providerDetails: ProviderDetails;
|
|
629
|
+
srcAmount: string;
|
|
630
|
+
srcAmountUSD: string;
|
|
631
|
+
destAmount: string;
|
|
632
|
+
destAmountUSD: string;
|
|
633
|
+
minDestAmount: string;
|
|
634
|
+
swapPerUnit: string;
|
|
635
|
+
srcToken: Token;
|
|
636
|
+
destToken: Token;
|
|
637
|
+
fee: Fee;
|
|
638
|
+
priceImpactPercent: string;
|
|
639
|
+
duration: string;
|
|
640
|
+
gasless: boolean;
|
|
641
|
+
steps: TradeStep[];
|
|
642
|
+
path: TradePath[];
|
|
643
|
+
tags?: Tag[];
|
|
644
|
+
additionalInfo?: AdditionalInfo;
|
|
713
645
|
};
|
|
714
|
-
type
|
|
715
|
-
|
|
716
|
-
txnId: HexString;
|
|
717
|
-
data: string;
|
|
646
|
+
type TradeQuotesByProviderId = {
|
|
647
|
+
[providerAndBridge: string]: TradeQuote;
|
|
718
648
|
};
|
|
719
|
-
type
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
649
|
+
type TradeQuotesResponse = {
|
|
650
|
+
[pair: string]: {
|
|
651
|
+
status?: string;
|
|
652
|
+
message?: string;
|
|
653
|
+
recommendedSource: string;
|
|
654
|
+
fastestSource?: string;
|
|
655
|
+
bestReturnSource: string;
|
|
656
|
+
questSource?: string;
|
|
657
|
+
quoteRates?: TradeQuotesByProviderId;
|
|
658
|
+
tokensWithoutPrice: Record<number, string[]>;
|
|
726
659
|
};
|
|
727
|
-
estimatedGas: string;
|
|
728
|
-
isJitoTx?: boolean;
|
|
729
660
|
};
|
|
730
|
-
type
|
|
731
|
-
|
|
732
|
-
action: StepAction;
|
|
733
|
-
data: T;
|
|
661
|
+
type AdditionalInfo = {
|
|
662
|
+
[key: string]: unknown;
|
|
734
663
|
};
|
|
735
|
-
type
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
664
|
+
type Token = {
|
|
665
|
+
address: HexString;
|
|
666
|
+
decimals: number;
|
|
667
|
+
chainId: number;
|
|
668
|
+
logo: string;
|
|
669
|
+
symbol: string;
|
|
670
|
+
price?: string;
|
|
739
671
|
};
|
|
740
|
-
type
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
672
|
+
type TokenPermitData = {
|
|
673
|
+
eip2612: {
|
|
674
|
+
supported: boolean;
|
|
675
|
+
data?: {
|
|
676
|
+
domain?: TypedDataDomain;
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
permit2: {
|
|
680
|
+
supported: boolean;
|
|
681
|
+
};
|
|
744
682
|
};
|
|
745
|
-
type
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
683
|
+
type TokenInfo = Prettify<Omit<NativeTokenInfo, 'isErc20'> & {
|
|
684
|
+
chainId: number;
|
|
685
|
+
balanceInUsd?: number | null;
|
|
686
|
+
isDisabledOnSwapBridge?: {
|
|
687
|
+
source: boolean;
|
|
688
|
+
destination: boolean;
|
|
689
|
+
};
|
|
690
|
+
isDisabledOnZap?: {
|
|
691
|
+
source: boolean;
|
|
692
|
+
destination: boolean;
|
|
693
|
+
};
|
|
694
|
+
permit?: TokenPermitData;
|
|
695
|
+
}>;
|
|
696
|
+
type TokenResponse = {
|
|
697
|
+
[key: string]: TokenInfo;
|
|
749
698
|
};
|
|
750
|
-
type
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
699
|
+
type TradeBuildTxnRequest = {
|
|
700
|
+
sender: HexString;
|
|
701
|
+
refundee: HexString;
|
|
702
|
+
fromChain: number;
|
|
703
|
+
gasless: boolean;
|
|
704
|
+
private?: boolean;
|
|
705
|
+
disableEstimation?: boolean;
|
|
706
|
+
data: TradeBuildTxnRequestData[];
|
|
707
|
+
hasPermit2ApprovalForAllTokens?: boolean;
|
|
708
|
+
publicKey?: string;
|
|
760
709
|
};
|
|
761
|
-
type
|
|
710
|
+
type TradeBuildTxnRequestData = {
|
|
711
|
+
amount: string;
|
|
762
712
|
srcToken: string;
|
|
763
|
-
|
|
713
|
+
srcDecimals?: number;
|
|
764
714
|
destToken: string;
|
|
765
|
-
|
|
715
|
+
destDecimals?: number;
|
|
716
|
+
toChain: number;
|
|
717
|
+
protocol: string;
|
|
766
718
|
recipient: string;
|
|
767
|
-
refundee: string;
|
|
768
719
|
slippage: number;
|
|
769
|
-
|
|
770
|
-
integrator?: ZapIntegratorConfig;
|
|
720
|
+
additionalInfo?: AdditionalInfo;
|
|
771
721
|
permitData?: string;
|
|
772
|
-
amount?: string;
|
|
773
|
-
estimateGas?: boolean;
|
|
774
|
-
positionDetails?: ZapRouteRequestPositionDetails;
|
|
775
|
-
poolDetails?: ZapRouteRequestPoolDetails;
|
|
776
|
-
allowedBridges?: string[];
|
|
777
|
-
allowedDexes?: string[];
|
|
778
722
|
};
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
723
|
+
type ParamQuotes = {
|
|
724
|
+
additionalInfo?: Record<string, unknown>;
|
|
725
|
+
destAmount: string;
|
|
726
|
+
provider: string;
|
|
727
|
+
minDestAmount: string;
|
|
728
|
+
priceImpact?: string | null;
|
|
729
|
+
duration?: string;
|
|
730
|
+
};
|
|
731
|
+
type EvmTxData = {
|
|
732
|
+
from: HexString;
|
|
733
|
+
data: HexString;
|
|
734
|
+
to: HexString;
|
|
735
|
+
value: string;
|
|
736
|
+
gasLimit: string;
|
|
737
|
+
};
|
|
738
|
+
type SvmTxData = {
|
|
739
|
+
from: string;
|
|
740
|
+
data: string;
|
|
741
|
+
blockhash?: string;
|
|
742
|
+
lastValidBlockHeight?: number;
|
|
743
|
+
};
|
|
744
|
+
type BtcTxData = {
|
|
745
|
+
from: string;
|
|
746
|
+
data: string;
|
|
747
|
+
inputs: PsbtInput[];
|
|
748
|
+
outputs: PsbtOutput[];
|
|
749
|
+
feeRate: number;
|
|
750
|
+
};
|
|
751
|
+
type BtclnTxData = {
|
|
752
|
+
paymentRequestType: 'bolt11';
|
|
753
|
+
paymentRequest: string;
|
|
754
|
+
paymentExpiry: number;
|
|
755
|
+
};
|
|
756
|
+
type TxData = EvmTxData | SvmTxData | BtcTxData | BtclnTxData;
|
|
757
|
+
type TxRequestData<T> = {
|
|
758
|
+
status: typeof STATUS.success;
|
|
759
|
+
txId: string;
|
|
760
|
+
chainId: number;
|
|
761
|
+
transaction: T;
|
|
762
|
+
};
|
|
763
|
+
type TradeGasBuildTxnResponse<T = TxData> = TxRequestData<T> & {
|
|
764
|
+
quotes: Record<string, ParamQuotes>;
|
|
765
|
+
gasless: false;
|
|
766
|
+
private: boolean;
|
|
767
|
+
};
|
|
768
|
+
type TradeBuildTxnResponse = TradeGasBuildTxnResponse & {
|
|
769
|
+
data: string;
|
|
770
|
+
from: string;
|
|
771
|
+
to?: string;
|
|
772
|
+
value?: string;
|
|
773
|
+
gasLimit?: string;
|
|
774
|
+
svmTxData?: {
|
|
775
|
+
blockhash: string;
|
|
776
|
+
lastValidBlockHeight: number;
|
|
777
|
+
};
|
|
778
|
+
btcTxData?: {
|
|
779
|
+
inputs: PsbtInput[];
|
|
780
|
+
outputs: PsbtOutput[];
|
|
781
|
+
feeRate: number;
|
|
782
|
+
};
|
|
783
|
+
btclnTxData?: BtclnTxData;
|
|
784
|
+
additionalInfo: Record<string, Record<string, unknown>>;
|
|
785
|
+
updatedQuotes: Record<string, string>;
|
|
783
786
|
};
|
|
784
|
-
type
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
positionDetails?: ZapRouteRequestPositionDetails;
|
|
791
|
-
poolDetails?: ZapRouteRequestPoolDetails;
|
|
792
|
-
protocol?: string;
|
|
787
|
+
type BridgeGaslessTxData = {
|
|
788
|
+
executorFeesHash: HexString;
|
|
789
|
+
swapDataHash?: HexString;
|
|
790
|
+
adapterDataHash: HexString;
|
|
791
|
+
txType: typeof GaslessTxType.bridge;
|
|
792
|
+
value: string;
|
|
793
793
|
};
|
|
794
|
-
type
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
slippage: number;
|
|
800
|
-
quotesOnly?: boolean;
|
|
801
|
-
estimateGas?: boolean;
|
|
802
|
-
integrator?: ZapIntegratorConfig;
|
|
803
|
-
allowedDexes?: string[];
|
|
804
|
-
allowedBridges?: string[];
|
|
794
|
+
type SwapGaslessTxData = {
|
|
795
|
+
executorFeesHash: HexString;
|
|
796
|
+
swapDataHash: HexString;
|
|
797
|
+
txType: typeof GaslessTxType.swap;
|
|
798
|
+
value: string;
|
|
805
799
|
};
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
800
|
+
type GaslessTradeBuildTxnResponse = {
|
|
801
|
+
status: 'success';
|
|
802
|
+
txId: HexString;
|
|
803
|
+
transaction: BridgeGaslessTxData | SwapGaslessTxData;
|
|
804
|
+
quotes: Record<string, ParamQuotes>;
|
|
805
|
+
gasless: true;
|
|
806
|
+
onlySwapData: false;
|
|
811
807
|
};
|
|
812
|
-
type
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
808
|
+
type AvailableDZapServices = (typeof Services)[keyof typeof Services];
|
|
809
|
+
type OtherAvailableAbis = (typeof OtherAbis)[keyof typeof OtherAbis];
|
|
810
|
+
type DZapTransactionResponse = {
|
|
811
|
+
status: TxnStatus;
|
|
812
|
+
errorMsg?: string;
|
|
813
|
+
code: StatusCodes | number;
|
|
814
|
+
action?: keyof typeof contractErrorActions;
|
|
815
|
+
txnHash?: HexString;
|
|
816
|
+
error?: unknown;
|
|
817
|
+
additionalInfo?: Record<string, unknown>;
|
|
818
|
+
updatedQuotes?: Record<string, string>;
|
|
817
819
|
};
|
|
818
|
-
type
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
820
|
+
type SwapInfo = {
|
|
821
|
+
dex: string;
|
|
822
|
+
fromToken: string;
|
|
823
|
+
fromAmount: bigint;
|
|
824
|
+
toToken: string;
|
|
825
|
+
returnToAmount: bigint;
|
|
823
826
|
};
|
|
824
|
-
type
|
|
825
|
-
|
|
827
|
+
type StatusAsset = {
|
|
828
|
+
contract: string;
|
|
826
829
|
chainId: number;
|
|
827
|
-
name
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
metadata?: unknown;
|
|
833
|
-
symbol: string;
|
|
834
|
-
decimals: number;
|
|
830
|
+
name?: string;
|
|
831
|
+
symbol?: string;
|
|
832
|
+
decimals?: number;
|
|
833
|
+
logo?: string | undefined;
|
|
834
|
+
underlyingTokens?: ZapUnderlyingToken[];
|
|
835
835
|
};
|
|
836
|
-
type
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
836
|
+
type TransactionInfo = {
|
|
837
|
+
asset: StatusAsset;
|
|
838
|
+
amount: string;
|
|
839
|
+
amountUSD: number;
|
|
840
|
+
txHash: string;
|
|
841
|
+
account: string;
|
|
842
|
+
};
|
|
843
|
+
type TxStatusForPair = {
|
|
844
|
+
source: TransactionInfo;
|
|
845
|
+
destination: TransactionInfo & {
|
|
846
|
+
timestamp?: number;
|
|
842
847
|
};
|
|
848
|
+
expected?: Omit<TransactionInfo, 'txHash' | 'status'>;
|
|
849
|
+
status: StatusResponse;
|
|
850
|
+
provider: ProviderDetails;
|
|
851
|
+
allowUserTxOnDestChain: boolean;
|
|
852
|
+
message?: string;
|
|
853
|
+
protocolExplorerLink?: string;
|
|
843
854
|
};
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
855
|
+
type TradeStatusResponse = {
|
|
856
|
+
status: StatusResponse;
|
|
857
|
+
gasless: boolean;
|
|
858
|
+
txHash: string;
|
|
847
859
|
chainId: number;
|
|
848
|
-
|
|
860
|
+
timestamp: number;
|
|
861
|
+
transactions: TxStatusForPair[];
|
|
862
|
+
type: 'swap' | 'bridge' | 'zap';
|
|
849
863
|
};
|
|
850
|
-
type
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
chainId: number;
|
|
856
|
-
provider: string;
|
|
864
|
+
type PermitMode = keyof typeof PermitTypes;
|
|
865
|
+
type ApprovalMode = Exclude<keyof typeof ApprovalModes, 'EIP2612Permit'>;
|
|
866
|
+
type SinglePermitCallbackParams = {
|
|
867
|
+
permitData: HexString;
|
|
868
|
+
srcToken: HexString;
|
|
857
869
|
amount: string;
|
|
858
|
-
|
|
859
|
-
nftDetails?: {
|
|
860
|
-
id: string;
|
|
861
|
-
manager: HexString;
|
|
862
|
-
};
|
|
863
|
-
metadata?: unknown;
|
|
864
|
-
decimals: number;
|
|
865
|
-
};
|
|
866
|
-
type ZapPositionsResponse = {
|
|
867
|
-
positions: ZapPosition[];
|
|
868
|
-
count: number;
|
|
870
|
+
permitType: Exclude<PermitMode, keyof typeof PermitTypes.PermitBatchWitnessTransferFrom>;
|
|
869
871
|
};
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
type ZapStatus = 'PENDING' | 'COMPLETED' | 'FAILED' | 'REFUNDED';
|
|
879
|
-
type ZapStatusAsset = {
|
|
880
|
-
asset: ZapPathAsset;
|
|
881
|
-
amount: string;
|
|
882
|
-
amountUSD: string;
|
|
872
|
+
type BatchPermitCallbackParams = {
|
|
873
|
+
batchPermitData: HexString;
|
|
874
|
+
tokens: {
|
|
875
|
+
address: HexString;
|
|
876
|
+
amount: string;
|
|
877
|
+
}[];
|
|
878
|
+
permitType: typeof PermitTypes.PermitBatchWitnessTransferFrom;
|
|
883
879
|
};
|
|
884
|
-
type
|
|
880
|
+
type SignatureCallbackParams = SinglePermitCallbackParams | BatchPermitCallbackParams;
|
|
881
|
+
type SignatureParamsBase = {
|
|
885
882
|
chainId: number;
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
883
|
+
sender: HexString;
|
|
884
|
+
signer: WalletClient | Signer;
|
|
885
|
+
tokens: {
|
|
886
|
+
address: HexString;
|
|
887
|
+
permitData?: HexString;
|
|
888
|
+
amount: string;
|
|
889
|
+
permit?: TokenPermitData;
|
|
890
|
+
}[];
|
|
891
|
+
spender: HexString;
|
|
892
|
+
rpcUrls: string[];
|
|
893
|
+
permitType: PermitMode;
|
|
894
|
+
isBatchPermitAllowed?: boolean;
|
|
895
|
+
signatureCallback?: (params: SignatureCallbackParams) => Promise<void>;
|
|
896
|
+
service: AvailableDZapServices;
|
|
897
|
+
contractVersion: ContractVersion;
|
|
892
898
|
};
|
|
893
|
-
type
|
|
894
|
-
|
|
895
|
-
account: string;
|
|
896
|
-
recipient: string;
|
|
897
|
-
input: ZapStatusAsset[];
|
|
898
|
-
output: ZapStatusAsset[];
|
|
899
|
-
steps: ZapStatusStep[];
|
|
900
|
-
timestamp: number;
|
|
901
|
-
completedAt: number;
|
|
899
|
+
type GasSignatureParams = SignatureParamsBase & {
|
|
900
|
+
gasless: false;
|
|
902
901
|
};
|
|
903
|
-
type
|
|
904
|
-
|
|
905
|
-
|
|
902
|
+
type PermitSingleResponse = {
|
|
903
|
+
status: TxnStatus.success;
|
|
904
|
+
code: StatusCodes;
|
|
905
|
+
tokens: {
|
|
906
|
+
address: HexString;
|
|
907
|
+
permitData?: HexString;
|
|
908
|
+
amount: string;
|
|
909
|
+
}[];
|
|
910
|
+
permitType: PermitMode;
|
|
906
911
|
};
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
supportedProviders: string[];
|
|
913
|
-
};
|
|
912
|
+
type PermitBatchResponse = {
|
|
913
|
+
status: TxnStatus.success;
|
|
914
|
+
code: StatusCodes;
|
|
915
|
+
batchPermitData: HexString;
|
|
916
|
+
permitType: typeof PermitTypes.PermitBatchWitnessTransferFrom;
|
|
914
917
|
};
|
|
915
|
-
type
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
included: boolean;
|
|
918
|
+
type PermitErrorResponse = {
|
|
919
|
+
status: Exclude<TxnStatus, typeof TxnStatus.success>;
|
|
920
|
+
code: StatusCodes;
|
|
921
|
+
permitType: PermitMode;
|
|
920
922
|
};
|
|
921
|
-
type
|
|
923
|
+
type SignPermitResponse<T extends PermitMode = PermitMode> = T extends typeof PermitTypes.AutoPermit ? PermitSingleResponse | PermitBatchResponse | PermitErrorResponse : T extends typeof PermitTypes.PermitBatchWitnessTransferFrom ? PermitBatchResponse | PermitErrorResponse : PermitSingleResponse | PermitErrorResponse;
|
|
924
|
+
type BroadcastTxData = string;
|
|
925
|
+
type BroadcastTxParams = {
|
|
926
|
+
txId: string;
|
|
922
927
|
chainId: number;
|
|
923
|
-
|
|
924
|
-
name?: string;
|
|
925
|
-
symbol: string;
|
|
926
|
-
decimals: number;
|
|
927
|
-
logo?: string | null;
|
|
928
|
+
txData: BroadcastTxData;
|
|
928
929
|
};
|
|
929
|
-
type
|
|
930
|
-
|
|
931
|
-
|
|
930
|
+
type BroadcastTxResponse = {
|
|
931
|
+
status: TxnStatus.success;
|
|
932
|
+
txnHash: string;
|
|
933
|
+
} | {
|
|
934
|
+
status: Exclude<TxnStatus, typeof TxnStatus.success>;
|
|
935
|
+
message: string;
|
|
932
936
|
};
|
|
933
937
|
|
|
934
938
|
type BatchCallParams = {
|
|
@@ -1922,12 +1926,12 @@ declare class DZapClient {
|
|
|
1922
1926
|
status: TxnStatus;
|
|
1923
1927
|
code: StatusCodes;
|
|
1924
1928
|
}>;
|
|
1925
|
-
sign(params: Prettify<Omit<GasSignatureParams, 'spender' | 'permitType' | 'rpcUrls' | 'gasless' | 'contractVersion'> & {
|
|
1929
|
+
sign<T extends PermitMode = PermitMode>(params: Prettify<Omit<GasSignatureParams, 'spender' | 'permitType' | 'rpcUrls' | 'gasless' | 'contractVersion'> & {
|
|
1926
1930
|
spender?: HexString;
|
|
1927
|
-
permitType?:
|
|
1931
|
+
permitType?: T;
|
|
1928
1932
|
rpcUrls?: string[];
|
|
1929
1933
|
service: AvailableDZapServices;
|
|
1930
|
-
}>): Promise<SignPermitResponse
|
|
1934
|
+
}>): Promise<SignPermitResponse<T>>;
|
|
1931
1935
|
zap({ request, steps, signer, }: {
|
|
1932
1936
|
request: ZapBuildTxnRequest | ZapBundleRequest;
|
|
1933
1937
|
signer: WalletClient | Signer;
|