@chainflip/sdk 0.1.10 → 0.1.11
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/swap.d.ts +37 -12
- package/dist/swap.js +7 -5
- package/dist/swap.mjs +7 -5
- package/package.json +1 -1
package/dist/swap.d.ts
CHANGED
|
@@ -272,26 +272,38 @@ declare const executeCallParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
272
272
|
destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
|
|
273
273
|
srcAsset: z.ZodLiteral<"FLIP">;
|
|
274
274
|
destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
ccmMetadata: z.ZodObject<{
|
|
276
|
+
message: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
277
|
+
gasBudget: z.ZodString;
|
|
278
|
+
}, "strip", z.ZodTypeAny, {
|
|
279
|
+
message: `0x${string}`;
|
|
280
|
+
gasBudget: string;
|
|
281
|
+
}, {
|
|
282
|
+
message: `0x${string}`;
|
|
283
|
+
gasBudget: string;
|
|
284
|
+
}>;
|
|
277
285
|
}, "strip", z.ZodTypeAny, {
|
|
278
286
|
amount: string | bigint;
|
|
279
|
-
message: `0x${string}`;
|
|
280
287
|
srcChain: "Ethereum";
|
|
281
288
|
srcAsset: "FLIP";
|
|
282
289
|
destChain: "Ethereum";
|
|
283
290
|
destAddress: `0x${string}`;
|
|
284
291
|
destAsset: "USDC" | "ETH";
|
|
285
|
-
|
|
292
|
+
ccmMetadata: {
|
|
293
|
+
message: `0x${string}`;
|
|
294
|
+
gasBudget: string;
|
|
295
|
+
};
|
|
286
296
|
}, {
|
|
287
297
|
amount: string | bigint;
|
|
288
|
-
message: `0x${string}`;
|
|
289
298
|
srcChain: "Ethereum";
|
|
290
299
|
srcAsset: "FLIP";
|
|
291
300
|
destChain: "Ethereum";
|
|
292
301
|
destAddress: `0x${string}`;
|
|
293
302
|
destAsset: "USDC" | "ETH";
|
|
294
|
-
|
|
303
|
+
ccmMetadata: {
|
|
304
|
+
message: `0x${string}`;
|
|
305
|
+
gasBudget: string;
|
|
306
|
+
};
|
|
295
307
|
}>, z.ZodObject<{
|
|
296
308
|
amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
|
|
297
309
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
@@ -299,26 +311,38 @@ declare const executeCallParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
299
311
|
destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
|
|
300
312
|
srcAsset: z.ZodLiteral<"USDC">;
|
|
301
313
|
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
|
|
302
|
-
|
|
303
|
-
|
|
314
|
+
ccmMetadata: z.ZodObject<{
|
|
315
|
+
message: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
316
|
+
gasBudget: z.ZodString;
|
|
317
|
+
}, "strip", z.ZodTypeAny, {
|
|
318
|
+
message: `0x${string}`;
|
|
319
|
+
gasBudget: string;
|
|
320
|
+
}, {
|
|
321
|
+
message: `0x${string}`;
|
|
322
|
+
gasBudget: string;
|
|
323
|
+
}>;
|
|
304
324
|
}, "strip", z.ZodTypeAny, {
|
|
305
325
|
amount: string | bigint;
|
|
306
|
-
message: `0x${string}`;
|
|
307
326
|
srcChain: "Ethereum";
|
|
308
327
|
srcAsset: "USDC";
|
|
309
328
|
destChain: "Ethereum";
|
|
310
329
|
destAddress: `0x${string}`;
|
|
311
330
|
destAsset: "FLIP" | "ETH";
|
|
312
|
-
|
|
331
|
+
ccmMetadata: {
|
|
332
|
+
message: `0x${string}`;
|
|
333
|
+
gasBudget: string;
|
|
334
|
+
};
|
|
313
335
|
}, {
|
|
314
336
|
amount: string | bigint;
|
|
315
|
-
message: `0x${string}`;
|
|
316
337
|
srcChain: "Ethereum";
|
|
317
338
|
srcAsset: "USDC";
|
|
318
339
|
destChain: "Ethereum";
|
|
319
340
|
destAddress: `0x${string}`;
|
|
320
341
|
destAsset: "FLIP" | "ETH";
|
|
321
|
-
|
|
342
|
+
ccmMetadata: {
|
|
343
|
+
message: `0x${string}`;
|
|
344
|
+
gasBudget: string;
|
|
345
|
+
};
|
|
322
346
|
}>]>]>;
|
|
323
347
|
type ExecuteCallParams = z.infer<typeof executeCallParamsSchema>;
|
|
324
348
|
|
|
@@ -413,6 +437,7 @@ interface SwapStatusRequest {
|
|
|
413
437
|
interface CommonStatusFields extends ChainsAndAssets {
|
|
414
438
|
destAddress: string;
|
|
415
439
|
depositAddress: string | undefined;
|
|
440
|
+
depositAddressCreatedAt: number | undefined;
|
|
416
441
|
expectedDepositAmount: string | undefined;
|
|
417
442
|
}
|
|
418
443
|
type SwapStatusResponse = CommonStatusFields & ({
|
package/dist/swap.js
CHANGED
|
@@ -1863,6 +1863,10 @@ var nativeCallParamsSchema = ethereumBase.extend({
|
|
|
1863
1863
|
message: zod.z.string(),
|
|
1864
1864
|
gasBudget: numericString
|
|
1865
1865
|
});
|
|
1866
|
+
var ccmMetadataSchema = zod.z.object({
|
|
1867
|
+
message: hexString,
|
|
1868
|
+
gasBudget: numericString
|
|
1869
|
+
});
|
|
1866
1870
|
var tokenCallParamsSchema = zod.z.union([
|
|
1867
1871
|
ethereumBase.extend({
|
|
1868
1872
|
srcAsset: zod.z.literal(Assets.FLIP),
|
|
@@ -1870,8 +1874,7 @@ var tokenCallParamsSchema = zod.z.union([
|
|
|
1870
1874
|
zod.z.literal(Assets.USDC),
|
|
1871
1875
|
zod.z.literal(Assets.ETH)
|
|
1872
1876
|
]),
|
|
1873
|
-
|
|
1874
|
-
gasBudget: numericString
|
|
1877
|
+
ccmMetadata: ccmMetadataSchema
|
|
1875
1878
|
}),
|
|
1876
1879
|
ethereumBase.extend({
|
|
1877
1880
|
srcAsset: zod.z.literal(Assets.USDC),
|
|
@@ -1879,8 +1882,7 @@ var tokenCallParamsSchema = zod.z.union([
|
|
|
1879
1882
|
zod.z.literal(Assets.FLIP),
|
|
1880
1883
|
zod.z.literal(Assets.ETH)
|
|
1881
1884
|
]),
|
|
1882
|
-
|
|
1883
|
-
gasBudget: numericString
|
|
1885
|
+
ccmMetadata: ccmMetadataSchema
|
|
1884
1886
|
})
|
|
1885
1887
|
]);
|
|
1886
1888
|
var executeCallParamsSchema = zod.z.union([
|
|
@@ -1951,7 +1953,7 @@ var callToken = /* @__PURE__ */ __name(async (params, { signer, ...opts }) => {
|
|
|
1951
1953
|
const { isAllowable } = await checkAllowance(params.amount, vaultContractAddress, erc20Address, signer);
|
|
1952
1954
|
assert(isAllowable, "Swap amount exceeds allowance");
|
|
1953
1955
|
const vault = Vault__factory.connect(vaultContractAddress, signer);
|
|
1954
|
-
const transaction = await vault.xCallToken(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], params.
|
|
1956
|
+
const transaction = await vault.xCallToken(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], params.ccmMetadata?.gasBudget, params.ccmMetadata?.message, erc20Address, params.amount, [], {
|
|
1955
1957
|
nonce: opts.nonce
|
|
1956
1958
|
});
|
|
1957
1959
|
return transaction.wait(1);
|
package/dist/swap.mjs
CHANGED
|
@@ -396,6 +396,10 @@ var nativeCallParamsSchema = ethereumBase.extend({
|
|
|
396
396
|
message: z.string(),
|
|
397
397
|
gasBudget: numericString
|
|
398
398
|
});
|
|
399
|
+
var ccmMetadataSchema = z.object({
|
|
400
|
+
message: hexString,
|
|
401
|
+
gasBudget: numericString
|
|
402
|
+
});
|
|
399
403
|
var tokenCallParamsSchema = z.union([
|
|
400
404
|
ethereumBase.extend({
|
|
401
405
|
srcAsset: z.literal(Assets.FLIP),
|
|
@@ -403,8 +407,7 @@ var tokenCallParamsSchema = z.union([
|
|
|
403
407
|
z.literal(Assets.USDC),
|
|
404
408
|
z.literal(Assets.ETH)
|
|
405
409
|
]),
|
|
406
|
-
|
|
407
|
-
gasBudget: numericString
|
|
410
|
+
ccmMetadata: ccmMetadataSchema
|
|
408
411
|
}),
|
|
409
412
|
ethereumBase.extend({
|
|
410
413
|
srcAsset: z.literal(Assets.USDC),
|
|
@@ -412,8 +415,7 @@ var tokenCallParamsSchema = z.union([
|
|
|
412
415
|
z.literal(Assets.FLIP),
|
|
413
416
|
z.literal(Assets.ETH)
|
|
414
417
|
]),
|
|
415
|
-
|
|
416
|
-
gasBudget: numericString
|
|
418
|
+
ccmMetadata: ccmMetadataSchema
|
|
417
419
|
})
|
|
418
420
|
]);
|
|
419
421
|
var executeCallParamsSchema = z.union([
|
|
@@ -484,7 +486,7 @@ var callToken = /* @__PURE__ */ __name(async (params, { signer, ...opts }) => {
|
|
|
484
486
|
const { isAllowable } = await checkAllowance(params.amount, vaultContractAddress, erc20Address, signer);
|
|
485
487
|
assert(isAllowable, "Swap amount exceeds allowance");
|
|
486
488
|
const vault = Vault__factory.connect(vaultContractAddress, signer);
|
|
487
|
-
const transaction = await vault.xCallToken(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], params.
|
|
489
|
+
const transaction = await vault.xCallToken(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], params.ccmMetadata?.gasBudget, params.ccmMetadata?.message, erc20Address, params.amount, [], {
|
|
488
490
|
nonce: opts.nonce
|
|
489
491
|
});
|
|
490
492
|
return transaction.wait(1);
|