@chainflip/sdk 1.2.0 → 1.2.1-alpha.2
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/README.md +1 -1
- package/dist/{broker-4TC4FMSH.mjs → broker-6ALZEHLT.mjs} +11 -7
- package/dist/{chunk-X7E5C7CD.mjs → chunk-2GNHNTY7.mjs} +4 -4
- package/dist/{chunk-CLE2ZBJX.mjs → chunk-3LCS6BBP.mjs} +121 -95
- package/dist/chunk-KLVDY4K6.mjs +30 -0
- package/dist/contracts-b4ZS6VAh.d.mts +50 -0
- package/dist/contracts-b4ZS6VAh.d.ts +50 -0
- package/dist/funding.d.mts +1 -1
- package/dist/funding.d.ts +1 -1
- package/dist/funding.js +101 -90
- package/dist/funding.mjs +4 -4
- package/dist/swap.d.mts +44 -57
- package/dist/swap.d.ts +44 -57
- package/dist/swap.js +205 -167
- package/dist/swap.mjs +59 -50
- package/package.json +2 -2
- package/dist/chunk-GALKLAQ5.mjs +0 -32
- package/dist/contracts-auzntmd7.d.mts +0 -25
- package/dist/contracts-auzntmd7.d.ts +0 -25
package/dist/funding.js
CHANGED
|
@@ -1233,6 +1233,13 @@ var arrayToMap = /* @__PURE__ */ __name((array) => Object.fromEntries(array.map(
|
|
|
1233
1233
|
key,
|
|
1234
1234
|
key
|
|
1235
1235
|
])), "arrayToMap");
|
|
1236
|
+
var InternalAssets = arrayToMap([
|
|
1237
|
+
"Flip",
|
|
1238
|
+
"Usdc",
|
|
1239
|
+
"Dot",
|
|
1240
|
+
"Eth",
|
|
1241
|
+
"Btc"
|
|
1242
|
+
]);
|
|
1236
1243
|
var Chains = arrayToMap([
|
|
1237
1244
|
"Bitcoin",
|
|
1238
1245
|
"Ethereum",
|
|
@@ -1251,52 +1258,76 @@ var ChainflipNetworks = arrayToMap([
|
|
|
1251
1258
|
"perseverance",
|
|
1252
1259
|
"mainnet"
|
|
1253
1260
|
]);
|
|
1254
|
-
var assetChains = {
|
|
1255
|
-
[Assets.ETH]: Chains.Ethereum,
|
|
1256
|
-
[Assets.FLIP]: Chains.Ethereum,
|
|
1257
|
-
[Assets.USDC]: Chains.Ethereum,
|
|
1258
|
-
[Assets.BTC]: Chains.Bitcoin,
|
|
1259
|
-
[Assets.DOT]: Chains.Polkadot
|
|
1260
|
-
};
|
|
1261
|
-
({
|
|
1262
|
-
[Assets.DOT]: 10,
|
|
1263
|
-
[Assets.ETH]: 18,
|
|
1264
|
-
[Assets.FLIP]: 18,
|
|
1265
|
-
[Assets.USDC]: 6,
|
|
1266
|
-
[Assets.BTC]: 8
|
|
1267
|
-
});
|
|
1268
|
-
({
|
|
1269
|
-
// 0 is reservered for particular cross chain messaging scenarios where we want to pass
|
|
1270
|
-
// through a message without making a swap.
|
|
1271
|
-
[Assets.ETH]: 1,
|
|
1272
|
-
[Assets.FLIP]: 2,
|
|
1273
|
-
[Assets.USDC]: 3,
|
|
1274
|
-
[Assets.DOT]: 4,
|
|
1275
|
-
[Assets.BTC]: 5
|
|
1276
|
-
});
|
|
1277
|
-
({
|
|
1278
|
-
[Chains.Ethereum]: [
|
|
1279
|
-
Assets.ETH,
|
|
1280
|
-
Assets.USDC,
|
|
1281
|
-
Assets.FLIP
|
|
1282
|
-
],
|
|
1283
|
-
[Chains.Bitcoin]: [
|
|
1284
|
-
Assets.BTC
|
|
1285
|
-
],
|
|
1286
|
-
[Chains.Polkadot]: [
|
|
1287
|
-
Assets.DOT
|
|
1288
|
-
]
|
|
1289
|
-
});
|
|
1290
1261
|
({
|
|
1291
|
-
[
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
[
|
|
1262
|
+
[InternalAssets.Eth]: {
|
|
1263
|
+
chain: Chains.Ethereum,
|
|
1264
|
+
asset: Assets.ETH,
|
|
1265
|
+
name: "Ether",
|
|
1266
|
+
decimals: 18,
|
|
1267
|
+
contractId: 1
|
|
1268
|
+
},
|
|
1269
|
+
[InternalAssets.Flip]: {
|
|
1270
|
+
chain: Chains.Ethereum,
|
|
1271
|
+
asset: Assets.FLIP,
|
|
1272
|
+
name: "FLIP",
|
|
1273
|
+
decimals: 18,
|
|
1274
|
+
contractId: 2
|
|
1275
|
+
},
|
|
1276
|
+
[InternalAssets.Usdc]: {
|
|
1277
|
+
chain: Chains.Ethereum,
|
|
1278
|
+
asset: Assets.USDC,
|
|
1279
|
+
name: "USDC",
|
|
1280
|
+
decimals: 6,
|
|
1281
|
+
contractId: 3
|
|
1282
|
+
},
|
|
1283
|
+
[InternalAssets.Dot]: {
|
|
1284
|
+
chain: Chains.Polkadot,
|
|
1285
|
+
asset: Assets.DOT,
|
|
1286
|
+
name: "Polkadot",
|
|
1287
|
+
decimals: 10,
|
|
1288
|
+
contractId: 4
|
|
1289
|
+
},
|
|
1290
|
+
[InternalAssets.Btc]: {
|
|
1291
|
+
chain: Chains.Bitcoin,
|
|
1292
|
+
asset: Assets.BTC,
|
|
1293
|
+
name: "Bitcoin",
|
|
1294
|
+
decimals: 8,
|
|
1295
|
+
contractId: 5
|
|
1296
|
+
}
|
|
1299
1297
|
});
|
|
1298
|
+
var chainConstants = {
|
|
1299
|
+
[Chains.Ethereum]: {
|
|
1300
|
+
assets: [
|
|
1301
|
+
Assets.ETH,
|
|
1302
|
+
Assets.FLIP,
|
|
1303
|
+
Assets.USDC
|
|
1304
|
+
],
|
|
1305
|
+
gasAsset: Assets.ETH,
|
|
1306
|
+
contractId: 1
|
|
1307
|
+
},
|
|
1308
|
+
[Chains.Polkadot]: {
|
|
1309
|
+
assets: [
|
|
1310
|
+
Assets.DOT
|
|
1311
|
+
],
|
|
1312
|
+
gasAsset: Assets.DOT,
|
|
1313
|
+
contractId: 2
|
|
1314
|
+
},
|
|
1315
|
+
[Chains.Bitcoin]: {
|
|
1316
|
+
assets: [
|
|
1317
|
+
Assets.BTC
|
|
1318
|
+
],
|
|
1319
|
+
gasAsset: Assets.BTC,
|
|
1320
|
+
contractId: 3
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1323
|
+
function isValidAssetAndChain(assetAndChain2) {
|
|
1324
|
+
const { asset: asset2, chain: chain2 } = assetAndChain2;
|
|
1325
|
+
if (!(chain2 in Chains))
|
|
1326
|
+
return false;
|
|
1327
|
+
const validAssets = chainConstants[chain2].assets;
|
|
1328
|
+
return validAssets.includes(asset2);
|
|
1329
|
+
}
|
|
1330
|
+
__name(isValidAssetAndChain, "isValidAssetAndChain");
|
|
1300
1331
|
|
|
1301
1332
|
// ../shared/src/consts.ts
|
|
1302
1333
|
({
|
|
@@ -1338,10 +1369,10 @@ var extractOverrides = /* @__PURE__ */ __name((transactionOverrides) => {
|
|
|
1338
1369
|
const { wait, ...ethersOverrides } = transactionOverrides;
|
|
1339
1370
|
return ethersOverrides;
|
|
1340
1371
|
}, "extractOverrides");
|
|
1341
|
-
function getTokenContractAddress(
|
|
1342
|
-
if (
|
|
1372
|
+
function getTokenContractAddress(asset2, network, assert2 = true) {
|
|
1373
|
+
if (asset2 === InternalAssets.Flip)
|
|
1343
1374
|
return ADDRESSES[network].FLIP_CONTRACT_ADDRESS;
|
|
1344
|
-
if (
|
|
1375
|
+
if (asset2 === InternalAssets.Usdc)
|
|
1345
1376
|
return ADDRESSES[network].USDC_CONTRACT_ADDRESS;
|
|
1346
1377
|
if (assert2) {
|
|
1347
1378
|
throw new Error("Only FLIP and USDC are supported for now");
|
|
@@ -1367,7 +1398,7 @@ var approve = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20, allow
|
|
|
1367
1398
|
return transaction.wait(txOpts.wait);
|
|
1368
1399
|
}, "approve");
|
|
1369
1400
|
var getFlipBalance = /* @__PURE__ */ __name(async (network, signer) => {
|
|
1370
|
-
const flipAddress = getTokenContractAddress(
|
|
1401
|
+
const flipAddress = getTokenContractAddress(InternalAssets.Flip, network);
|
|
1371
1402
|
const flip = ERC20__factory.connect(flipAddress, signer);
|
|
1372
1403
|
return flip.balanceOf(await signer.getAddress());
|
|
1373
1404
|
}, "getFlipBalance");
|
|
@@ -4515,25 +4546,25 @@ var _ZodEnum = class _ZodEnum extends ZodType {
|
|
|
4515
4546
|
return this._def.values;
|
|
4516
4547
|
}
|
|
4517
4548
|
get enum() {
|
|
4518
|
-
const
|
|
4549
|
+
const enumValues2 = {};
|
|
4519
4550
|
for (const val of this._def.values) {
|
|
4520
|
-
|
|
4551
|
+
enumValues2[val] = val;
|
|
4521
4552
|
}
|
|
4522
|
-
return
|
|
4553
|
+
return enumValues2;
|
|
4523
4554
|
}
|
|
4524
4555
|
get Values() {
|
|
4525
|
-
const
|
|
4556
|
+
const enumValues2 = {};
|
|
4526
4557
|
for (const val of this._def.values) {
|
|
4527
|
-
|
|
4558
|
+
enumValues2[val] = val;
|
|
4528
4559
|
}
|
|
4529
|
-
return
|
|
4560
|
+
return enumValues2;
|
|
4530
4561
|
}
|
|
4531
4562
|
get Enum() {
|
|
4532
|
-
const
|
|
4563
|
+
const enumValues2 = {};
|
|
4533
4564
|
for (const val of this._def.values) {
|
|
4534
|
-
|
|
4565
|
+
enumValues2[val] = val;
|
|
4535
4566
|
}
|
|
4536
|
-
return
|
|
4567
|
+
return enumValues2;
|
|
4537
4568
|
}
|
|
4538
4569
|
extract(values) {
|
|
4539
4570
|
return _ZodEnum.create(values);
|
|
@@ -5218,6 +5249,7 @@ __name(assert, "assert");
|
|
|
5218
5249
|
__toESM(require_lib());
|
|
5219
5250
|
|
|
5220
5251
|
// ../shared/src/parsers.ts
|
|
5252
|
+
var enumValues = Object.values;
|
|
5221
5253
|
var safeStringify = /* @__PURE__ */ __name((obj) => JSON.stringify(obj, (key, value) => typeof value === "bigint" ? value.toString() : value), "safeStringify");
|
|
5222
5254
|
var errorMap2 = /* @__PURE__ */ __name((_issue, context) => ({
|
|
5223
5255
|
message: `received: ${safeStringify(context.data)}`
|
|
@@ -5231,7 +5263,6 @@ var number = z.number({
|
|
|
5231
5263
|
var numericString = string.regex(/^[0-9]+$/);
|
|
5232
5264
|
var hexString = string.refine((v) => /^0x[0-9a-f]*$/i.test(v));
|
|
5233
5265
|
numericString.transform((arg) => `0x${BigInt(arg).toString(16)}`);
|
|
5234
|
-
string.regex(/^[0-9a-f]+$/);
|
|
5235
5266
|
var DOT_PREFIX = 0;
|
|
5236
5267
|
z.union([
|
|
5237
5268
|
string,
|
|
@@ -5258,38 +5289,18 @@ var unsignedInteger = z.union([
|
|
|
5258
5289
|
u128,
|
|
5259
5290
|
z.number().transform((n) => BigInt(n))
|
|
5260
5291
|
]);
|
|
5292
|
+
var rustEnum = /* @__PURE__ */ __name((values) => z.object({
|
|
5293
|
+
__kind: z.enum(values)
|
|
5294
|
+
}).transform(({ __kind }) => __kind), "rustEnum");
|
|
5295
|
+
rustEnum(enumValues(InternalAssets));
|
|
5296
|
+
rustEnum(enumValues(Chains));
|
|
5297
|
+
var chain = z.nativeEnum(Chains);
|
|
5298
|
+
var asset = z.nativeEnum(Assets);
|
|
5299
|
+
z.nativeEnum(ChainflipNetworks);
|
|
5261
5300
|
z.object({
|
|
5262
|
-
__kind: z.enum([
|
|
5263
|
-
"Usdc",
|
|
5264
|
-
"Flip",
|
|
5265
|
-
"Dot",
|
|
5266
|
-
"Eth",
|
|
5267
|
-
"Btc"
|
|
5268
|
-
])
|
|
5269
|
-
}).transform(({ __kind }) => __kind.toUpperCase());
|
|
5270
|
-
var transformAsset = /* @__PURE__ */ __name((asset) => ({
|
|
5271
5301
|
asset,
|
|
5272
|
-
chain
|
|
5273
|
-
})
|
|
5274
|
-
z.nativeEnum(Chains);
|
|
5275
|
-
var chainflipAsset = z.nativeEnum(Assets);
|
|
5276
|
-
z.union([
|
|
5277
|
-
chainflipAsset.transform(transformAsset),
|
|
5278
|
-
z.object({
|
|
5279
|
-
asset: z.nativeEnum(Assets),
|
|
5280
|
-
chain: z.nativeEnum(Chains)
|
|
5281
|
-
})
|
|
5282
|
-
]).superRefine((obj, ctx) => {
|
|
5283
|
-
if (assetChains[obj.asset] !== obj.chain) {
|
|
5284
|
-
ctx.addIssue({
|
|
5285
|
-
code: z.ZodIssueCode.custom,
|
|
5286
|
-
message: `asset ${obj.asset} does not belong to chain ${obj.chain}`,
|
|
5287
|
-
path: []
|
|
5288
|
-
});
|
|
5289
|
-
}
|
|
5290
|
-
return z.NEVER;
|
|
5291
|
-
});
|
|
5292
|
-
z.nativeEnum(ChainflipNetworks);
|
|
5302
|
+
chain
|
|
5303
|
+
}).refine(isValidAssetAndChain);
|
|
5293
5304
|
z.union([
|
|
5294
5305
|
z.object({
|
|
5295
5306
|
__kind: z.literal("CcmPrincipal"),
|
|
@@ -5474,7 +5485,7 @@ var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
|
|
|
5474
5485
|
|
|
5475
5486
|
// ../shared/src/stateChainGateway/approval.ts
|
|
5476
5487
|
var checkStateChainGatewayAllowance = /* @__PURE__ */ __name(async (amount, networkOpts) => {
|
|
5477
|
-
const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getTokenContractAddress(
|
|
5488
|
+
const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getTokenContractAddress(InternalAssets.Flip, networkOpts.network);
|
|
5478
5489
|
const stateChainGatewayContractAddress = networkOpts.network === "localnet" ? networkOpts.stateChainGatewayContractAddress : getStateChainGatewayContractAddress(networkOpts.network);
|
|
5479
5490
|
return checkAllowance(amount, stateChainGatewayContractAddress, flipContractAddress, networkOpts.signer);
|
|
5480
5491
|
}, "checkStateChainGatewayAllowance");
|
|
@@ -5488,7 +5499,7 @@ var approveStateChainGateway = /* @__PURE__ */ __name(async (amount, networkOpts
|
|
|
5488
5499
|
|
|
5489
5500
|
// ../shared/src/stateChainGateway/index.ts
|
|
5490
5501
|
var fundStateChainAccount = /* @__PURE__ */ __name(async (accountId, amount, networkOpts, txOpts) => {
|
|
5491
|
-
const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getTokenContractAddress(
|
|
5502
|
+
const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getTokenContractAddress(InternalAssets.Flip, networkOpts.network);
|
|
5492
5503
|
const stateChainGateway = getStateChainGateway(networkOpts);
|
|
5493
5504
|
const { isAllowable } = await checkAllowance(amount, await stateChainGateway.getAddress(), flipContractAddress, networkOpts.signer);
|
|
5494
5505
|
assert(isAllowable, "Insufficient allowance");
|
package/dist/funding.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, checkAllowance, extractOverrides, StateChainGateway__factory } from './chunk-
|
|
2
|
-
import { __name, __publicField, ChainflipNetworks,
|
|
1
|
+
import { getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, checkAllowance, extractOverrides, StateChainGateway__factory } from './chunk-2GNHNTY7.mjs';
|
|
2
|
+
import { __name, __publicField, ChainflipNetworks, InternalAssets, assert } from './chunk-3LCS6BBP.mjs';
|
|
3
3
|
|
|
4
4
|
// ../shared/src/stateChainGateway/utils.ts
|
|
5
5
|
var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
|
|
@@ -9,7 +9,7 @@ var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
|
|
|
9
9
|
|
|
10
10
|
// ../shared/src/stateChainGateway/approval.ts
|
|
11
11
|
var checkStateChainGatewayAllowance = /* @__PURE__ */ __name(async (amount, networkOpts) => {
|
|
12
|
-
const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getTokenContractAddress(
|
|
12
|
+
const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getTokenContractAddress(InternalAssets.Flip, networkOpts.network);
|
|
13
13
|
const stateChainGatewayContractAddress = networkOpts.network === "localnet" ? networkOpts.stateChainGatewayContractAddress : getStateChainGatewayContractAddress(networkOpts.network);
|
|
14
14
|
return checkAllowance(amount, stateChainGatewayContractAddress, flipContractAddress, networkOpts.signer);
|
|
15
15
|
}, "checkStateChainGatewayAllowance");
|
|
@@ -23,7 +23,7 @@ var approveStateChainGateway = /* @__PURE__ */ __name(async (amount, networkOpts
|
|
|
23
23
|
|
|
24
24
|
// ../shared/src/stateChainGateway/index.ts
|
|
25
25
|
var fundStateChainAccount = /* @__PURE__ */ __name(async (accountId, amount, networkOpts, txOpts) => {
|
|
26
|
-
const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getTokenContractAddress(
|
|
26
|
+
const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getTokenContractAddress(InternalAssets.Flip, networkOpts.network);
|
|
27
27
|
const stateChainGateway = getStateChainGateway(networkOpts);
|
|
28
28
|
const { isAllowable } = await checkAllowance(amount, await stateChainGateway.getAddress(), flipContractAddress, networkOpts.signer);
|
|
29
29
|
assert(isAllowable, "Insufficient allowance");
|
package/dist/swap.d.mts
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
|
-
import { C as ChainflipNetwork, a as Chain, A as Asset,
|
|
3
|
-
export {
|
|
2
|
+
import { C as ChainflipNetwork, a as Chain, A as Asset, I as InternalAsset, b as AssetOfChain, T as TransactionOptions, c as ChainAssetMap } from './contracts-b4ZS6VAh.mjs';
|
|
3
|
+
export { e as Assets, f as ChainflipNetworks, d as Chains, g as getChainflipId } from './contracts-b4ZS6VAh.mjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
|
-
type ChainAssetMap<T> = {
|
|
7
|
-
Bitcoin: {
|
|
8
|
-
BTC: T;
|
|
9
|
-
};
|
|
10
|
-
Ethereum: {
|
|
11
|
-
ETH: T;
|
|
12
|
-
USDC: T;
|
|
13
|
-
FLIP: T;
|
|
14
|
-
};
|
|
15
|
-
Polkadot: {
|
|
16
|
-
DOT: T;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
|
|
20
6
|
declare const tokenSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion<[z.ZodObject<{
|
|
21
7
|
amount: z.ZodString;
|
|
22
8
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
@@ -28,15 +14,15 @@ declare const tokenSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion<[
|
|
|
28
14
|
amount: string;
|
|
29
15
|
srcChain: "Ethereum";
|
|
30
16
|
srcAsset: "FLIP";
|
|
31
|
-
destAsset: "USDC" | "ETH";
|
|
32
17
|
destChain: "Ethereum";
|
|
18
|
+
destAsset: "USDC" | "ETH";
|
|
33
19
|
destAddress: `0x${string}`;
|
|
34
20
|
}, {
|
|
35
21
|
amount: string;
|
|
36
22
|
srcChain: "Ethereum";
|
|
37
23
|
srcAsset: "FLIP";
|
|
38
|
-
destAsset: "USDC" | "ETH";
|
|
39
24
|
destChain: "Ethereum";
|
|
25
|
+
destAsset: "USDC" | "ETH";
|
|
40
26
|
destAddress: string;
|
|
41
27
|
}>, z.ZodObject<{
|
|
42
28
|
amount: z.ZodString;
|
|
@@ -49,65 +35,65 @@ declare const tokenSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion<[
|
|
|
49
35
|
amount: string;
|
|
50
36
|
srcChain: "Ethereum";
|
|
51
37
|
srcAsset: "USDC";
|
|
52
|
-
destAsset: "FLIP" | "ETH";
|
|
53
38
|
destChain: "Ethereum";
|
|
39
|
+
destAsset: "FLIP" | "ETH";
|
|
54
40
|
destAddress: `0x${string}`;
|
|
55
41
|
}, {
|
|
56
42
|
amount: string;
|
|
57
43
|
srcChain: "Ethereum";
|
|
58
44
|
srcAsset: "USDC";
|
|
59
|
-
destAsset: "FLIP" | "ETH";
|
|
60
45
|
destChain: "Ethereum";
|
|
46
|
+
destAsset: "FLIP" | "ETH";
|
|
61
47
|
destAddress: string;
|
|
62
48
|
}>, z.ZodObject<{
|
|
63
49
|
amount: z.ZodString;
|
|
64
50
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
65
|
-
destAsset: z.ZodLiteral<"DOT">;
|
|
66
51
|
destChain: z.ZodLiteral<"Polkadot">;
|
|
52
|
+
destAsset: z.ZodLiteral<"DOT">;
|
|
67
53
|
destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, `0x${string}`, string>]>, string | null, string>, string, string>, string, string>;
|
|
68
54
|
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
69
55
|
}, "strip", z.ZodTypeAny, {
|
|
70
56
|
amount: string;
|
|
71
57
|
srcChain: "Ethereum";
|
|
72
58
|
srcAsset: "FLIP" | "USDC";
|
|
73
|
-
destAsset: "DOT";
|
|
74
59
|
destChain: "Polkadot";
|
|
60
|
+
destAsset: "DOT";
|
|
75
61
|
destAddress: string;
|
|
76
62
|
}, {
|
|
77
63
|
amount: string;
|
|
78
64
|
srcChain: "Ethereum";
|
|
79
65
|
srcAsset: "FLIP" | "USDC";
|
|
80
|
-
destAsset: "DOT";
|
|
81
66
|
destChain: "Polkadot";
|
|
67
|
+
destAsset: "DOT";
|
|
82
68
|
destAddress: string;
|
|
83
69
|
}>, z.ZodObject<{
|
|
84
70
|
amount: z.ZodString;
|
|
85
71
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
86
|
-
destAsset: z.ZodLiteral<"BTC">;
|
|
87
72
|
destChain: z.ZodLiteral<"Bitcoin">;
|
|
73
|
+
destAsset: z.ZodLiteral<"BTC">;
|
|
88
74
|
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
|
|
89
75
|
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
90
76
|
}, "strip", z.ZodTypeAny, {
|
|
91
77
|
amount: string;
|
|
92
78
|
srcChain: "Ethereum";
|
|
93
79
|
srcAsset: "FLIP" | "USDC";
|
|
94
|
-
destAsset: "BTC";
|
|
95
80
|
destChain: "Bitcoin";
|
|
81
|
+
destAsset: "BTC";
|
|
96
82
|
destAddress: string;
|
|
97
83
|
}, {
|
|
98
84
|
amount: string;
|
|
99
85
|
srcChain: "Ethereum";
|
|
100
86
|
srcAsset: "FLIP" | "USDC";
|
|
101
|
-
destAsset: "BTC";
|
|
102
87
|
destChain: "Bitcoin";
|
|
88
|
+
destAsset: "BTC";
|
|
103
89
|
destAddress: string;
|
|
104
90
|
}>]>;
|
|
105
91
|
declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion<[z.ZodObject<{
|
|
106
92
|
amount: z.ZodString;
|
|
107
93
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
108
94
|
srcAsset: z.ZodLiteral<"ETH">;
|
|
109
|
-
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
110
95
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
96
|
+
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
111
97
|
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
112
98
|
ccmMetadata: z.ZodObject<{
|
|
113
99
|
gasBudget: z.ZodString;
|
|
@@ -123,8 +109,8 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
123
109
|
amount: string;
|
|
124
110
|
srcChain: "Ethereum";
|
|
125
111
|
srcAsset: "ETH";
|
|
126
|
-
destAsset: "FLIP" | "USDC";
|
|
127
112
|
destChain: "Ethereum";
|
|
113
|
+
destAsset: "FLIP" | "USDC";
|
|
128
114
|
destAddress: `0x${string}`;
|
|
129
115
|
ccmMetadata: {
|
|
130
116
|
message: `0x${string}`;
|
|
@@ -134,8 +120,8 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
134
120
|
amount: string;
|
|
135
121
|
srcChain: "Ethereum";
|
|
136
122
|
srcAsset: "ETH";
|
|
137
|
-
destAsset: "FLIP" | "USDC";
|
|
138
123
|
destChain: "Ethereum";
|
|
124
|
+
destAsset: "FLIP" | "USDC";
|
|
139
125
|
destAddress: string;
|
|
140
126
|
ccmMetadata: {
|
|
141
127
|
message: string;
|
|
@@ -145,8 +131,8 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
145
131
|
amount: z.ZodString;
|
|
146
132
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
147
133
|
srcAsset: z.ZodLiteral<"FLIP">;
|
|
148
|
-
destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
|
|
149
134
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
135
|
+
destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
|
|
150
136
|
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
151
137
|
ccmMetadata: z.ZodObject<{
|
|
152
138
|
gasBudget: z.ZodString;
|
|
@@ -162,8 +148,8 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
162
148
|
amount: string;
|
|
163
149
|
srcChain: "Ethereum";
|
|
164
150
|
srcAsset: "FLIP";
|
|
165
|
-
destAsset: "USDC" | "ETH";
|
|
166
151
|
destChain: "Ethereum";
|
|
152
|
+
destAsset: "USDC" | "ETH";
|
|
167
153
|
destAddress: `0x${string}`;
|
|
168
154
|
ccmMetadata: {
|
|
169
155
|
message: `0x${string}`;
|
|
@@ -173,8 +159,8 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
173
159
|
amount: string;
|
|
174
160
|
srcChain: "Ethereum";
|
|
175
161
|
srcAsset: "FLIP";
|
|
176
|
-
destAsset: "USDC" | "ETH";
|
|
177
162
|
destChain: "Ethereum";
|
|
163
|
+
destAsset: "USDC" | "ETH";
|
|
178
164
|
destAddress: string;
|
|
179
165
|
ccmMetadata: {
|
|
180
166
|
message: string;
|
|
@@ -184,8 +170,8 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
184
170
|
amount: z.ZodString;
|
|
185
171
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
186
172
|
srcAsset: z.ZodLiteral<"USDC">;
|
|
187
|
-
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
|
|
188
173
|
destChain: z.ZodLiteral<"Ethereum">;
|
|
174
|
+
destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
|
|
189
175
|
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
190
176
|
ccmMetadata: z.ZodObject<{
|
|
191
177
|
gasBudget: z.ZodString;
|
|
@@ -201,8 +187,8 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
201
187
|
amount: string;
|
|
202
188
|
srcChain: "Ethereum";
|
|
203
189
|
srcAsset: "USDC";
|
|
204
|
-
destAsset: "FLIP" | "ETH";
|
|
205
190
|
destChain: "Ethereum";
|
|
191
|
+
destAsset: "FLIP" | "ETH";
|
|
206
192
|
destAddress: `0x${string}`;
|
|
207
193
|
ccmMetadata: {
|
|
208
194
|
message: `0x${string}`;
|
|
@@ -212,8 +198,8 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
212
198
|
amount: string;
|
|
213
199
|
srcChain: "Ethereum";
|
|
214
200
|
srcAsset: "USDC";
|
|
215
|
-
destAsset: "FLIP" | "ETH";
|
|
216
201
|
destChain: "Ethereum";
|
|
202
|
+
destAsset: "FLIP" | "ETH";
|
|
217
203
|
destAddress: string;
|
|
218
204
|
ccmMetadata: {
|
|
219
205
|
message: string;
|
|
@@ -230,15 +216,15 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
230
216
|
amount: string;
|
|
231
217
|
srcChain: "Ethereum";
|
|
232
218
|
srcAsset: "ETH";
|
|
233
|
-
destAsset: "FLIP" | "USDC";
|
|
234
219
|
destChain: "Ethereum";
|
|
220
|
+
destAsset: "FLIP" | "USDC";
|
|
235
221
|
destAddress: `0x${string}`;
|
|
236
222
|
}, {
|
|
237
223
|
amount: string;
|
|
238
224
|
srcChain: "Ethereum";
|
|
239
225
|
srcAsset: "ETH";
|
|
240
|
-
destAsset: "FLIP" | "USDC";
|
|
241
226
|
destChain: "Ethereum";
|
|
227
|
+
destAsset: "FLIP" | "USDC";
|
|
242
228
|
destAddress: string;
|
|
243
229
|
}>, z.ZodObject<{
|
|
244
230
|
amount: z.ZodString;
|
|
@@ -251,15 +237,15 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
251
237
|
amount: string;
|
|
252
238
|
srcChain: "Ethereum";
|
|
253
239
|
srcAsset: "ETH";
|
|
254
|
-
destAsset: "DOT";
|
|
255
240
|
destChain: "Polkadot";
|
|
241
|
+
destAsset: "DOT";
|
|
256
242
|
destAddress: string;
|
|
257
243
|
}, {
|
|
258
244
|
amount: string;
|
|
259
245
|
srcChain: "Ethereum";
|
|
260
246
|
srcAsset: "ETH";
|
|
261
|
-
destAsset: "DOT";
|
|
262
247
|
destChain: "Polkadot";
|
|
248
|
+
destAsset: "DOT";
|
|
263
249
|
destAddress: string;
|
|
264
250
|
}>, z.ZodObject<{
|
|
265
251
|
amount: z.ZodString;
|
|
@@ -272,15 +258,15 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
272
258
|
amount: string;
|
|
273
259
|
srcChain: "Ethereum";
|
|
274
260
|
srcAsset: "ETH";
|
|
275
|
-
destAsset: "BTC";
|
|
276
261
|
destChain: "Bitcoin";
|
|
262
|
+
destAsset: "BTC";
|
|
277
263
|
destAddress: string;
|
|
278
264
|
}, {
|
|
279
265
|
amount: string;
|
|
280
266
|
srcChain: "Ethereum";
|
|
281
267
|
srcAsset: "ETH";
|
|
282
|
-
destAsset: "BTC";
|
|
283
268
|
destChain: "Bitcoin";
|
|
269
|
+
destAsset: "BTC";
|
|
284
270
|
destAddress: string;
|
|
285
271
|
}>]>, z.ZodUnion<[z.ZodObject<{
|
|
286
272
|
amount: z.ZodString;
|
|
@@ -293,15 +279,15 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
293
279
|
amount: string;
|
|
294
280
|
srcChain: "Ethereum";
|
|
295
281
|
srcAsset: "FLIP";
|
|
296
|
-
destAsset: "USDC" | "ETH";
|
|
297
282
|
destChain: "Ethereum";
|
|
283
|
+
destAsset: "USDC" | "ETH";
|
|
298
284
|
destAddress: `0x${string}`;
|
|
299
285
|
}, {
|
|
300
286
|
amount: string;
|
|
301
287
|
srcChain: "Ethereum";
|
|
302
288
|
srcAsset: "FLIP";
|
|
303
|
-
destAsset: "USDC" | "ETH";
|
|
304
289
|
destChain: "Ethereum";
|
|
290
|
+
destAsset: "USDC" | "ETH";
|
|
305
291
|
destAddress: string;
|
|
306
292
|
}>, z.ZodObject<{
|
|
307
293
|
amount: z.ZodString;
|
|
@@ -314,57 +300,57 @@ declare const executeSwapParamsSchema: (network: ChainflipNetwork) => z.ZodUnion
|
|
|
314
300
|
amount: string;
|
|
315
301
|
srcChain: "Ethereum";
|
|
316
302
|
srcAsset: "USDC";
|
|
317
|
-
destAsset: "FLIP" | "ETH";
|
|
318
303
|
destChain: "Ethereum";
|
|
304
|
+
destAsset: "FLIP" | "ETH";
|
|
319
305
|
destAddress: `0x${string}`;
|
|
320
306
|
}, {
|
|
321
307
|
amount: string;
|
|
322
308
|
srcChain: "Ethereum";
|
|
323
309
|
srcAsset: "USDC";
|
|
324
|
-
destAsset: "FLIP" | "ETH";
|
|
325
310
|
destChain: "Ethereum";
|
|
311
|
+
destAsset: "FLIP" | "ETH";
|
|
326
312
|
destAddress: string;
|
|
327
313
|
}>, z.ZodObject<{
|
|
328
314
|
amount: z.ZodString;
|
|
329
315
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
330
|
-
destAsset: z.ZodLiteral<"DOT">;
|
|
331
316
|
destChain: z.ZodLiteral<"Polkadot">;
|
|
317
|
+
destAsset: z.ZodLiteral<"DOT">;
|
|
332
318
|
destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, `0x${string}`, string>]>, string | null, string>, string, string>, string, string>;
|
|
333
319
|
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
334
320
|
}, "strip", z.ZodTypeAny, {
|
|
335
321
|
amount: string;
|
|
336
322
|
srcChain: "Ethereum";
|
|
337
323
|
srcAsset: "FLIP" | "USDC";
|
|
338
|
-
destAsset: "DOT";
|
|
339
324
|
destChain: "Polkadot";
|
|
325
|
+
destAsset: "DOT";
|
|
340
326
|
destAddress: string;
|
|
341
327
|
}, {
|
|
342
328
|
amount: string;
|
|
343
329
|
srcChain: "Ethereum";
|
|
344
330
|
srcAsset: "FLIP" | "USDC";
|
|
345
|
-
destAsset: "DOT";
|
|
346
331
|
destChain: "Polkadot";
|
|
332
|
+
destAsset: "DOT";
|
|
347
333
|
destAddress: string;
|
|
348
334
|
}>, z.ZodObject<{
|
|
349
335
|
amount: z.ZodString;
|
|
350
336
|
srcChain: z.ZodLiteral<"Ethereum">;
|
|
351
|
-
destAsset: z.ZodLiteral<"BTC">;
|
|
352
337
|
destChain: z.ZodLiteral<"Bitcoin">;
|
|
338
|
+
destAsset: z.ZodLiteral<"BTC">;
|
|
353
339
|
destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
|
|
354
340
|
srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
|
|
355
341
|
}, "strip", z.ZodTypeAny, {
|
|
356
342
|
amount: string;
|
|
357
343
|
srcChain: "Ethereum";
|
|
358
344
|
srcAsset: "FLIP" | "USDC";
|
|
359
|
-
destAsset: "BTC";
|
|
360
345
|
destChain: "Bitcoin";
|
|
346
|
+
destAsset: "BTC";
|
|
361
347
|
destAddress: string;
|
|
362
348
|
}, {
|
|
363
349
|
amount: string;
|
|
364
350
|
srcChain: "Ethereum";
|
|
365
351
|
srcAsset: "FLIP" | "USDC";
|
|
366
|
-
destAsset: "BTC";
|
|
367
352
|
destChain: "Bitcoin";
|
|
353
|
+
destAsset: "BTC";
|
|
368
354
|
destAddress: string;
|
|
369
355
|
}>]>]>;
|
|
370
356
|
type ExecuteSwapParams = z.infer<ReturnType<typeof executeSwapParamsSchema>>;
|
|
@@ -391,6 +377,7 @@ type QuoteQueryResponse = {
|
|
|
391
377
|
intermediateAmount?: string;
|
|
392
378
|
egressAmount: string;
|
|
393
379
|
includedFees: SwapFee[];
|
|
380
|
+
lowLiquidityWarning: boolean | undefined;
|
|
394
381
|
};
|
|
395
382
|
|
|
396
383
|
interface ChainData {
|
|
@@ -399,10 +386,10 @@ interface ChainData {
|
|
|
399
386
|
isMainnet: boolean;
|
|
400
387
|
}
|
|
401
388
|
type AssetData = {
|
|
402
|
-
[
|
|
403
|
-
chainflipId:
|
|
404
|
-
asset:
|
|
405
|
-
chain:
|
|
389
|
+
[C in Chain]: {
|
|
390
|
+
chainflipId: InternalAsset;
|
|
391
|
+
asset: AssetOfChain<C>;
|
|
392
|
+
chain: C;
|
|
406
393
|
contractAddress: string | undefined;
|
|
407
394
|
decimals: number;
|
|
408
395
|
name: string;
|
|
@@ -412,11 +399,11 @@ type AssetData = {
|
|
|
412
399
|
maximumSwapAmount: string | null;
|
|
413
400
|
minimumEgressAmount: string;
|
|
414
401
|
};
|
|
415
|
-
}[
|
|
402
|
+
}[Chain];
|
|
416
403
|
interface ChainsAndAssets {
|
|
417
404
|
srcChain: Chain;
|
|
418
|
-
destChain: Chain;
|
|
419
405
|
srcAsset: Asset;
|
|
406
|
+
destChain: Chain;
|
|
420
407
|
destAsset: Asset;
|
|
421
408
|
}
|
|
422
409
|
interface QuoteRequest extends ChainsAndAssets {
|