@chainflip/sdk 1.6.4 → 1.6.5
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.mts +13 -13
- package/dist/swap.d.ts +13 -13
- package/dist/swap.js +296 -288
- package/dist/swap.mjs +64 -56
- package/package.json +1 -1
package/dist/swap.d.mts
CHANGED
|
@@ -85,17 +85,17 @@ type QuoteDetails = {
|
|
|
85
85
|
lowLiquidityWarning: boolean | undefined;
|
|
86
86
|
estimatedDurationSeconds: number;
|
|
87
87
|
estimatedPrice: string;
|
|
88
|
+
dcaParams?: {
|
|
89
|
+
numberOfChunks: number;
|
|
90
|
+
chunkIntervalBlocks: number;
|
|
91
|
+
};
|
|
92
|
+
type: QuoteType;
|
|
88
93
|
};
|
|
89
94
|
type BoostedQuoteDetails = QuoteDetails & {
|
|
90
95
|
estimatedBoostFeeBps: number;
|
|
91
96
|
};
|
|
92
97
|
type QuoteQueryResponse = QuoteDetails & {
|
|
93
98
|
boostQuote?: BoostedQuoteDetails;
|
|
94
|
-
dcaParams?: {
|
|
95
|
-
numberOfChunks: number;
|
|
96
|
-
chunkIntervalBlocks: number;
|
|
97
|
-
};
|
|
98
|
-
type: QuoteType;
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
interface ExecuteSwapParams {
|
|
@@ -366,7 +366,7 @@ interface DepositChannelFields {
|
|
|
366
366
|
depositAddress: string;
|
|
367
367
|
srcChainExpiryBlock: string;
|
|
368
368
|
estimatedExpiryTime: number;
|
|
369
|
-
expectedDepositAmount: string;
|
|
369
|
+
expectedDepositAmount: string | undefined;
|
|
370
370
|
isExpired: boolean;
|
|
371
371
|
openedThroughBackend: boolean;
|
|
372
372
|
affiliateBrokers: AffiliateBroker[];
|
|
@@ -385,12 +385,12 @@ interface DepositFields {
|
|
|
385
385
|
}
|
|
386
386
|
type ChunkInfo = {
|
|
387
387
|
inputAmount: string;
|
|
388
|
-
intermediateAmount
|
|
389
|
-
outputAmount
|
|
388
|
+
intermediateAmount: string | undefined;
|
|
389
|
+
outputAmount: string | undefined;
|
|
390
390
|
scheduledAt: number;
|
|
391
391
|
scheduledBlockIndex: string;
|
|
392
|
-
executedAt
|
|
393
|
-
executedBlockIndex
|
|
392
|
+
executedAt: number | undefined;
|
|
393
|
+
executedBlockIndex: string | undefined;
|
|
394
394
|
retryCount: number;
|
|
395
395
|
};
|
|
396
396
|
type PickRequired<T> = {
|
|
@@ -402,13 +402,13 @@ interface SwapFields {
|
|
|
402
402
|
swappedInputAmount: string;
|
|
403
403
|
swappedIntermediateAmount: string;
|
|
404
404
|
swappedOutputAmount: string;
|
|
405
|
-
regular
|
|
406
|
-
dca
|
|
405
|
+
regular: ChunkInfo | undefined;
|
|
406
|
+
dca: {
|
|
407
407
|
lastExecutedChunk: ChunkInfo | null;
|
|
408
408
|
currentChunk: PickRequired<ChunkInfo> | null;
|
|
409
409
|
executedChunks: number;
|
|
410
410
|
remainingChunks: number;
|
|
411
|
-
};
|
|
411
|
+
} | undefined;
|
|
412
412
|
}
|
|
413
413
|
interface EgressFields {
|
|
414
414
|
amount: string;
|
package/dist/swap.d.ts
CHANGED
|
@@ -85,17 +85,17 @@ type QuoteDetails = {
|
|
|
85
85
|
lowLiquidityWarning: boolean | undefined;
|
|
86
86
|
estimatedDurationSeconds: number;
|
|
87
87
|
estimatedPrice: string;
|
|
88
|
+
dcaParams?: {
|
|
89
|
+
numberOfChunks: number;
|
|
90
|
+
chunkIntervalBlocks: number;
|
|
91
|
+
};
|
|
92
|
+
type: QuoteType;
|
|
88
93
|
};
|
|
89
94
|
type BoostedQuoteDetails = QuoteDetails & {
|
|
90
95
|
estimatedBoostFeeBps: number;
|
|
91
96
|
};
|
|
92
97
|
type QuoteQueryResponse = QuoteDetails & {
|
|
93
98
|
boostQuote?: BoostedQuoteDetails;
|
|
94
|
-
dcaParams?: {
|
|
95
|
-
numberOfChunks: number;
|
|
96
|
-
chunkIntervalBlocks: number;
|
|
97
|
-
};
|
|
98
|
-
type: QuoteType;
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
interface ExecuteSwapParams {
|
|
@@ -366,7 +366,7 @@ interface DepositChannelFields {
|
|
|
366
366
|
depositAddress: string;
|
|
367
367
|
srcChainExpiryBlock: string;
|
|
368
368
|
estimatedExpiryTime: number;
|
|
369
|
-
expectedDepositAmount: string;
|
|
369
|
+
expectedDepositAmount: string | undefined;
|
|
370
370
|
isExpired: boolean;
|
|
371
371
|
openedThroughBackend: boolean;
|
|
372
372
|
affiliateBrokers: AffiliateBroker[];
|
|
@@ -385,12 +385,12 @@ interface DepositFields {
|
|
|
385
385
|
}
|
|
386
386
|
type ChunkInfo = {
|
|
387
387
|
inputAmount: string;
|
|
388
|
-
intermediateAmount
|
|
389
|
-
outputAmount
|
|
388
|
+
intermediateAmount: string | undefined;
|
|
389
|
+
outputAmount: string | undefined;
|
|
390
390
|
scheduledAt: number;
|
|
391
391
|
scheduledBlockIndex: string;
|
|
392
|
-
executedAt
|
|
393
|
-
executedBlockIndex
|
|
392
|
+
executedAt: number | undefined;
|
|
393
|
+
executedBlockIndex: string | undefined;
|
|
394
394
|
retryCount: number;
|
|
395
395
|
};
|
|
396
396
|
type PickRequired<T> = {
|
|
@@ -402,13 +402,13 @@ interface SwapFields {
|
|
|
402
402
|
swappedInputAmount: string;
|
|
403
403
|
swappedIntermediateAmount: string;
|
|
404
404
|
swappedOutputAmount: string;
|
|
405
|
-
regular
|
|
406
|
-
dca
|
|
405
|
+
regular: ChunkInfo | undefined;
|
|
406
|
+
dca: {
|
|
407
407
|
lastExecutedChunk: ChunkInfo | null;
|
|
408
408
|
currentChunk: PickRequired<ChunkInfo> | null;
|
|
409
409
|
executedChunks: number;
|
|
410
410
|
remainingChunks: number;
|
|
411
|
-
};
|
|
411
|
+
} | undefined;
|
|
412
412
|
}
|
|
413
413
|
interface EgressFields {
|
|
414
414
|
amount: string;
|
package/dist/swap.js
CHANGED
|
@@ -6224,238 +6224,6 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
6224
6224
|
ZodError
|
|
6225
6225
|
});
|
|
6226
6226
|
|
|
6227
|
-
// ../shared/src/enums.ts
|
|
6228
|
-
var arrayToMap = /* @__PURE__ */ __name((array) => Object.fromEntries(array.map((key) => [
|
|
6229
|
-
key,
|
|
6230
|
-
key
|
|
6231
|
-
])), "arrayToMap");
|
|
6232
|
-
var InternalAssets = arrayToMap([
|
|
6233
|
-
"Flip",
|
|
6234
|
-
"Usdc",
|
|
6235
|
-
"Dot",
|
|
6236
|
-
"Eth",
|
|
6237
|
-
"Btc",
|
|
6238
|
-
"Usdt",
|
|
6239
|
-
"ArbUsdc",
|
|
6240
|
-
"ArbEth",
|
|
6241
|
-
"Sol",
|
|
6242
|
-
"SolUsdc"
|
|
6243
|
-
]);
|
|
6244
|
-
var Chains = arrayToMap([
|
|
6245
|
-
"Bitcoin",
|
|
6246
|
-
"Ethereum",
|
|
6247
|
-
"Polkadot",
|
|
6248
|
-
"Arbitrum",
|
|
6249
|
-
"Solana"
|
|
6250
|
-
]);
|
|
6251
|
-
var Assets = arrayToMap([
|
|
6252
|
-
"FLIP",
|
|
6253
|
-
"USDC",
|
|
6254
|
-
"DOT",
|
|
6255
|
-
"ETH",
|
|
6256
|
-
"BTC",
|
|
6257
|
-
"USDT",
|
|
6258
|
-
"SOL"
|
|
6259
|
-
]);
|
|
6260
|
-
var ChainflipNetworks = arrayToMap([
|
|
6261
|
-
"backspin",
|
|
6262
|
-
"sisyphos",
|
|
6263
|
-
"perseverance",
|
|
6264
|
-
"mainnet"
|
|
6265
|
-
]);
|
|
6266
|
-
var isTestnet = /* @__PURE__ */ __name((network) => network !== ChainflipNetworks.mainnet, "isTestnet");
|
|
6267
|
-
var assetConstants = {
|
|
6268
|
-
[InternalAssets.Eth]: {
|
|
6269
|
-
chain: Chains.Ethereum,
|
|
6270
|
-
asset: Assets.ETH,
|
|
6271
|
-
name: "Ether",
|
|
6272
|
-
decimals: 18,
|
|
6273
|
-
contractId: 1
|
|
6274
|
-
},
|
|
6275
|
-
[InternalAssets.Flip]: {
|
|
6276
|
-
chain: Chains.Ethereum,
|
|
6277
|
-
asset: Assets.FLIP,
|
|
6278
|
-
name: "FLIP",
|
|
6279
|
-
decimals: 18,
|
|
6280
|
-
contractId: 2
|
|
6281
|
-
},
|
|
6282
|
-
[InternalAssets.Usdc]: {
|
|
6283
|
-
chain: Chains.Ethereum,
|
|
6284
|
-
asset: Assets.USDC,
|
|
6285
|
-
name: "USDC",
|
|
6286
|
-
decimals: 6,
|
|
6287
|
-
contractId: 3
|
|
6288
|
-
},
|
|
6289
|
-
[InternalAssets.Usdt]: {
|
|
6290
|
-
chain: Chains.Ethereum,
|
|
6291
|
-
asset: Assets.USDT,
|
|
6292
|
-
name: "USDT",
|
|
6293
|
-
decimals: 6,
|
|
6294
|
-
contractId: 8
|
|
6295
|
-
},
|
|
6296
|
-
[InternalAssets.Dot]: {
|
|
6297
|
-
chain: Chains.Polkadot,
|
|
6298
|
-
asset: Assets.DOT,
|
|
6299
|
-
name: "Polkadot",
|
|
6300
|
-
decimals: 10,
|
|
6301
|
-
contractId: 4
|
|
6302
|
-
},
|
|
6303
|
-
[InternalAssets.Btc]: {
|
|
6304
|
-
chain: Chains.Bitcoin,
|
|
6305
|
-
asset: Assets.BTC,
|
|
6306
|
-
name: "Bitcoin",
|
|
6307
|
-
decimals: 8,
|
|
6308
|
-
contractId: 5
|
|
6309
|
-
},
|
|
6310
|
-
[InternalAssets.ArbEth]: {
|
|
6311
|
-
chain: Chains.Arbitrum,
|
|
6312
|
-
asset: Assets.ETH,
|
|
6313
|
-
name: "Arbitrum Ether",
|
|
6314
|
-
decimals: 18,
|
|
6315
|
-
contractId: 6
|
|
6316
|
-
},
|
|
6317
|
-
[InternalAssets.ArbUsdc]: {
|
|
6318
|
-
chain: Chains.Arbitrum,
|
|
6319
|
-
asset: Assets.USDC,
|
|
6320
|
-
name: "Arbitrum USDC",
|
|
6321
|
-
decimals: 6,
|
|
6322
|
-
contractId: 7
|
|
6323
|
-
},
|
|
6324
|
-
[InternalAssets.Sol]: {
|
|
6325
|
-
chain: Chains.Solana,
|
|
6326
|
-
asset: Assets.SOL,
|
|
6327
|
-
name: "Solana",
|
|
6328
|
-
decimals: 9,
|
|
6329
|
-
contractId: 9
|
|
6330
|
-
},
|
|
6331
|
-
[InternalAssets.SolUsdc]: {
|
|
6332
|
-
chain: Chains.Solana,
|
|
6333
|
-
asset: Assets.USDC,
|
|
6334
|
-
name: "Solana USDC",
|
|
6335
|
-
decimals: 6,
|
|
6336
|
-
contractId: 10
|
|
6337
|
-
}
|
|
6338
|
-
};
|
|
6339
|
-
var chainConstants = {
|
|
6340
|
-
[Chains.Ethereum]: {
|
|
6341
|
-
assets: [
|
|
6342
|
-
Assets.ETH,
|
|
6343
|
-
Assets.FLIP,
|
|
6344
|
-
Assets.USDC,
|
|
6345
|
-
Assets.USDT
|
|
6346
|
-
],
|
|
6347
|
-
gasAsset: Assets.ETH,
|
|
6348
|
-
contractId: 1,
|
|
6349
|
-
blockTimeSeconds: 12
|
|
6350
|
-
},
|
|
6351
|
-
[Chains.Polkadot]: {
|
|
6352
|
-
assets: [
|
|
6353
|
-
Assets.DOT
|
|
6354
|
-
],
|
|
6355
|
-
gasAsset: Assets.DOT,
|
|
6356
|
-
contractId: 2,
|
|
6357
|
-
blockTimeSeconds: 6
|
|
6358
|
-
},
|
|
6359
|
-
[Chains.Bitcoin]: {
|
|
6360
|
-
assets: [
|
|
6361
|
-
Assets.BTC
|
|
6362
|
-
],
|
|
6363
|
-
gasAsset: Assets.BTC,
|
|
6364
|
-
contractId: 3,
|
|
6365
|
-
blockTimeSeconds: 10 * 60
|
|
6366
|
-
},
|
|
6367
|
-
[Chains.Arbitrum]: {
|
|
6368
|
-
assets: [
|
|
6369
|
-
Assets.ETH,
|
|
6370
|
-
Assets.USDC
|
|
6371
|
-
],
|
|
6372
|
-
gasAsset: Assets.ETH,
|
|
6373
|
-
contractId: 4,
|
|
6374
|
-
blockTimeSeconds: 0.26
|
|
6375
|
-
},
|
|
6376
|
-
[Chains.Solana]: {
|
|
6377
|
-
assets: [
|
|
6378
|
-
Assets.SOL,
|
|
6379
|
-
Assets.USDC
|
|
6380
|
-
],
|
|
6381
|
-
gasAsset: Assets.SOL,
|
|
6382
|
-
contractId: 5,
|
|
6383
|
-
blockTimeSeconds: (400 + 800) / 2 / 1e3
|
|
6384
|
-
}
|
|
6385
|
-
};
|
|
6386
|
-
function isValidAssetAndChain(assetAndChain2) {
|
|
6387
|
-
const { asset: asset2, chain: chain2 } = assetAndChain2;
|
|
6388
|
-
if (!(chain2 in Chains)) return false;
|
|
6389
|
-
const validAssets = chainConstants[chain2].assets;
|
|
6390
|
-
return validAssets.includes(asset2);
|
|
6391
|
-
}
|
|
6392
|
-
__name(isValidAssetAndChain, "isValidAssetAndChain");
|
|
6393
|
-
var readChainAssetValue = /* @__PURE__ */ __name((map, asset2) => {
|
|
6394
|
-
const { chain: chain2, asset: symbol } = assetConstants[asset2];
|
|
6395
|
-
const chainValues = map[chain2];
|
|
6396
|
-
return chainValues[symbol];
|
|
6397
|
-
}, "readChainAssetValue");
|
|
6398
|
-
function getInternalAsset(asset2, assert3 = true) {
|
|
6399
|
-
if (!isValidAssetAndChain(asset2)) {
|
|
6400
|
-
if (assert3) {
|
|
6401
|
-
throw new Error(`invalid asset and chain combination: ${JSON.stringify(asset2)}`);
|
|
6402
|
-
}
|
|
6403
|
-
return null;
|
|
6404
|
-
}
|
|
6405
|
-
const map = {
|
|
6406
|
-
[Chains.Ethereum]: {
|
|
6407
|
-
[Assets.USDC]: InternalAssets.Usdc,
|
|
6408
|
-
[Assets.FLIP]: InternalAssets.Flip,
|
|
6409
|
-
[Assets.ETH]: InternalAssets.Eth,
|
|
6410
|
-
[Assets.USDT]: InternalAssets.Usdt
|
|
6411
|
-
},
|
|
6412
|
-
[Chains.Bitcoin]: {
|
|
6413
|
-
[Assets.BTC]: InternalAssets.Btc
|
|
6414
|
-
},
|
|
6415
|
-
[Chains.Polkadot]: {
|
|
6416
|
-
[Assets.DOT]: InternalAssets.Dot
|
|
6417
|
-
},
|
|
6418
|
-
[Chains.Arbitrum]: {
|
|
6419
|
-
[Assets.USDC]: InternalAssets.ArbUsdc,
|
|
6420
|
-
[Assets.ETH]: InternalAssets.ArbEth
|
|
6421
|
-
},
|
|
6422
|
-
[Chains.Solana]: {
|
|
6423
|
-
[Assets.SOL]: InternalAssets.Sol,
|
|
6424
|
-
[Assets.USDC]: InternalAssets.SolUsdc
|
|
6425
|
-
}
|
|
6426
|
-
};
|
|
6427
|
-
const chain2 = map[asset2.chain];
|
|
6428
|
-
return chain2[asset2.asset];
|
|
6429
|
-
}
|
|
6430
|
-
__name(getInternalAsset, "getInternalAsset");
|
|
6431
|
-
function getInternalAssets({ srcAsset, srcChain, destAsset, destChain }, assert3 = true) {
|
|
6432
|
-
return {
|
|
6433
|
-
srcAsset: getInternalAsset({
|
|
6434
|
-
asset: srcAsset,
|
|
6435
|
-
chain: srcChain
|
|
6436
|
-
}, assert3),
|
|
6437
|
-
destAsset: getInternalAsset({
|
|
6438
|
-
asset: destAsset,
|
|
6439
|
-
chain: destChain
|
|
6440
|
-
}, assert3)
|
|
6441
|
-
};
|
|
6442
|
-
}
|
|
6443
|
-
__name(getInternalAssets, "getInternalAssets");
|
|
6444
|
-
function getAssetAndChain(internalAsset, prefix) {
|
|
6445
|
-
const { chain: chain2, asset: asset2 } = assetConstants[internalAsset];
|
|
6446
|
-
if (prefix) {
|
|
6447
|
-
return {
|
|
6448
|
-
[`${prefix}Asset`]: asset2,
|
|
6449
|
-
[`${prefix}Chain`]: chain2
|
|
6450
|
-
};
|
|
6451
|
-
}
|
|
6452
|
-
return {
|
|
6453
|
-
chain: chain2,
|
|
6454
|
-
asset: asset2
|
|
6455
|
-
};
|
|
6456
|
-
}
|
|
6457
|
-
__name(getAssetAndChain, "getAssetAndChain");
|
|
6458
|
-
|
|
6459
6227
|
// ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/_assert.js
|
|
6460
6228
|
function isBytes(a) {
|
|
6461
6229
|
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
|
@@ -6925,6 +6693,238 @@ var isValidSolanaAddress = /* @__PURE__ */ __name((address) => {
|
|
|
6925
6693
|
}
|
|
6926
6694
|
}, "isValidSolanaAddress");
|
|
6927
6695
|
|
|
6696
|
+
// ../shared/src/enums.ts
|
|
6697
|
+
var arrayToMap = /* @__PURE__ */ __name((array) => Object.fromEntries(array.map((key) => [
|
|
6698
|
+
key,
|
|
6699
|
+
key
|
|
6700
|
+
])), "arrayToMap");
|
|
6701
|
+
var InternalAssets = arrayToMap([
|
|
6702
|
+
"Flip",
|
|
6703
|
+
"Usdc",
|
|
6704
|
+
"Dot",
|
|
6705
|
+
"Eth",
|
|
6706
|
+
"Btc",
|
|
6707
|
+
"Usdt",
|
|
6708
|
+
"ArbUsdc",
|
|
6709
|
+
"ArbEth",
|
|
6710
|
+
"Sol",
|
|
6711
|
+
"SolUsdc"
|
|
6712
|
+
]);
|
|
6713
|
+
var Chains = arrayToMap([
|
|
6714
|
+
"Bitcoin",
|
|
6715
|
+
"Ethereum",
|
|
6716
|
+
"Polkadot",
|
|
6717
|
+
"Arbitrum",
|
|
6718
|
+
"Solana"
|
|
6719
|
+
]);
|
|
6720
|
+
var Assets = arrayToMap([
|
|
6721
|
+
"FLIP",
|
|
6722
|
+
"USDC",
|
|
6723
|
+
"DOT",
|
|
6724
|
+
"ETH",
|
|
6725
|
+
"BTC",
|
|
6726
|
+
"USDT",
|
|
6727
|
+
"SOL"
|
|
6728
|
+
]);
|
|
6729
|
+
var ChainflipNetworks = arrayToMap([
|
|
6730
|
+
"backspin",
|
|
6731
|
+
"sisyphos",
|
|
6732
|
+
"perseverance",
|
|
6733
|
+
"mainnet"
|
|
6734
|
+
]);
|
|
6735
|
+
var isTestnet = /* @__PURE__ */ __name((network) => network !== ChainflipNetworks.mainnet, "isTestnet");
|
|
6736
|
+
var assetConstants = {
|
|
6737
|
+
[InternalAssets.Eth]: {
|
|
6738
|
+
chain: Chains.Ethereum,
|
|
6739
|
+
asset: Assets.ETH,
|
|
6740
|
+
name: "Ether",
|
|
6741
|
+
decimals: 18,
|
|
6742
|
+
contractId: 1
|
|
6743
|
+
},
|
|
6744
|
+
[InternalAssets.Flip]: {
|
|
6745
|
+
chain: Chains.Ethereum,
|
|
6746
|
+
asset: Assets.FLIP,
|
|
6747
|
+
name: "FLIP",
|
|
6748
|
+
decimals: 18,
|
|
6749
|
+
contractId: 2
|
|
6750
|
+
},
|
|
6751
|
+
[InternalAssets.Usdc]: {
|
|
6752
|
+
chain: Chains.Ethereum,
|
|
6753
|
+
asset: Assets.USDC,
|
|
6754
|
+
name: "USDC",
|
|
6755
|
+
decimals: 6,
|
|
6756
|
+
contractId: 3
|
|
6757
|
+
},
|
|
6758
|
+
[InternalAssets.Usdt]: {
|
|
6759
|
+
chain: Chains.Ethereum,
|
|
6760
|
+
asset: Assets.USDT,
|
|
6761
|
+
name: "USDT",
|
|
6762
|
+
decimals: 6,
|
|
6763
|
+
contractId: 8
|
|
6764
|
+
},
|
|
6765
|
+
[InternalAssets.Dot]: {
|
|
6766
|
+
chain: Chains.Polkadot,
|
|
6767
|
+
asset: Assets.DOT,
|
|
6768
|
+
name: "Polkadot",
|
|
6769
|
+
decimals: 10,
|
|
6770
|
+
contractId: 4
|
|
6771
|
+
},
|
|
6772
|
+
[InternalAssets.Btc]: {
|
|
6773
|
+
chain: Chains.Bitcoin,
|
|
6774
|
+
asset: Assets.BTC,
|
|
6775
|
+
name: "Bitcoin",
|
|
6776
|
+
decimals: 8,
|
|
6777
|
+
contractId: 5
|
|
6778
|
+
},
|
|
6779
|
+
[InternalAssets.ArbEth]: {
|
|
6780
|
+
chain: Chains.Arbitrum,
|
|
6781
|
+
asset: Assets.ETH,
|
|
6782
|
+
name: "Arbitrum Ether",
|
|
6783
|
+
decimals: 18,
|
|
6784
|
+
contractId: 6
|
|
6785
|
+
},
|
|
6786
|
+
[InternalAssets.ArbUsdc]: {
|
|
6787
|
+
chain: Chains.Arbitrum,
|
|
6788
|
+
asset: Assets.USDC,
|
|
6789
|
+
name: "Arbitrum USDC",
|
|
6790
|
+
decimals: 6,
|
|
6791
|
+
contractId: 7
|
|
6792
|
+
},
|
|
6793
|
+
[InternalAssets.Sol]: {
|
|
6794
|
+
chain: Chains.Solana,
|
|
6795
|
+
asset: Assets.SOL,
|
|
6796
|
+
name: "Solana",
|
|
6797
|
+
decimals: 9,
|
|
6798
|
+
contractId: 9
|
|
6799
|
+
},
|
|
6800
|
+
[InternalAssets.SolUsdc]: {
|
|
6801
|
+
chain: Chains.Solana,
|
|
6802
|
+
asset: Assets.USDC,
|
|
6803
|
+
name: "Solana USDC",
|
|
6804
|
+
decimals: 6,
|
|
6805
|
+
contractId: 10
|
|
6806
|
+
}
|
|
6807
|
+
};
|
|
6808
|
+
var chainConstants = {
|
|
6809
|
+
[Chains.Ethereum]: {
|
|
6810
|
+
assets: [
|
|
6811
|
+
Assets.ETH,
|
|
6812
|
+
Assets.FLIP,
|
|
6813
|
+
Assets.USDC,
|
|
6814
|
+
Assets.USDT
|
|
6815
|
+
],
|
|
6816
|
+
gasAsset: Assets.ETH,
|
|
6817
|
+
contractId: 1,
|
|
6818
|
+
blockTimeSeconds: 12
|
|
6819
|
+
},
|
|
6820
|
+
[Chains.Polkadot]: {
|
|
6821
|
+
assets: [
|
|
6822
|
+
Assets.DOT
|
|
6823
|
+
],
|
|
6824
|
+
gasAsset: Assets.DOT,
|
|
6825
|
+
contractId: 2,
|
|
6826
|
+
blockTimeSeconds: 6
|
|
6827
|
+
},
|
|
6828
|
+
[Chains.Bitcoin]: {
|
|
6829
|
+
assets: [
|
|
6830
|
+
Assets.BTC
|
|
6831
|
+
],
|
|
6832
|
+
gasAsset: Assets.BTC,
|
|
6833
|
+
contractId: 3,
|
|
6834
|
+
blockTimeSeconds: 10 * 60
|
|
6835
|
+
},
|
|
6836
|
+
[Chains.Arbitrum]: {
|
|
6837
|
+
assets: [
|
|
6838
|
+
Assets.ETH,
|
|
6839
|
+
Assets.USDC
|
|
6840
|
+
],
|
|
6841
|
+
gasAsset: Assets.ETH,
|
|
6842
|
+
contractId: 4,
|
|
6843
|
+
blockTimeSeconds: 0.26
|
|
6844
|
+
},
|
|
6845
|
+
[Chains.Solana]: {
|
|
6846
|
+
assets: [
|
|
6847
|
+
Assets.SOL,
|
|
6848
|
+
Assets.USDC
|
|
6849
|
+
],
|
|
6850
|
+
gasAsset: Assets.SOL,
|
|
6851
|
+
contractId: 5,
|
|
6852
|
+
blockTimeSeconds: (400 + 800) / 2 / 1e3
|
|
6853
|
+
}
|
|
6854
|
+
};
|
|
6855
|
+
function isValidAssetAndChain(assetAndChain2) {
|
|
6856
|
+
const { asset: asset2, chain: chain2 } = assetAndChain2;
|
|
6857
|
+
if (!(chain2 in Chains)) return false;
|
|
6858
|
+
const validAssets = chainConstants[chain2].assets;
|
|
6859
|
+
return validAssets.includes(asset2);
|
|
6860
|
+
}
|
|
6861
|
+
__name(isValidAssetAndChain, "isValidAssetAndChain");
|
|
6862
|
+
var readChainAssetValue = /* @__PURE__ */ __name((map, asset2) => {
|
|
6863
|
+
const { chain: chain2, asset: symbol } = assetConstants[asset2];
|
|
6864
|
+
const chainValues = map[chain2];
|
|
6865
|
+
return chainValues[symbol];
|
|
6866
|
+
}, "readChainAssetValue");
|
|
6867
|
+
function getInternalAsset(asset2, assert3 = true) {
|
|
6868
|
+
if (!isValidAssetAndChain(asset2)) {
|
|
6869
|
+
if (assert3) {
|
|
6870
|
+
throw new Error(`invalid asset and chain combination: ${JSON.stringify(asset2)}`);
|
|
6871
|
+
}
|
|
6872
|
+
return null;
|
|
6873
|
+
}
|
|
6874
|
+
const map = {
|
|
6875
|
+
[Chains.Ethereum]: {
|
|
6876
|
+
[Assets.USDC]: InternalAssets.Usdc,
|
|
6877
|
+
[Assets.FLIP]: InternalAssets.Flip,
|
|
6878
|
+
[Assets.ETH]: InternalAssets.Eth,
|
|
6879
|
+
[Assets.USDT]: InternalAssets.Usdt
|
|
6880
|
+
},
|
|
6881
|
+
[Chains.Bitcoin]: {
|
|
6882
|
+
[Assets.BTC]: InternalAssets.Btc
|
|
6883
|
+
},
|
|
6884
|
+
[Chains.Polkadot]: {
|
|
6885
|
+
[Assets.DOT]: InternalAssets.Dot
|
|
6886
|
+
},
|
|
6887
|
+
[Chains.Arbitrum]: {
|
|
6888
|
+
[Assets.USDC]: InternalAssets.ArbUsdc,
|
|
6889
|
+
[Assets.ETH]: InternalAssets.ArbEth
|
|
6890
|
+
},
|
|
6891
|
+
[Chains.Solana]: {
|
|
6892
|
+
[Assets.SOL]: InternalAssets.Sol,
|
|
6893
|
+
[Assets.USDC]: InternalAssets.SolUsdc
|
|
6894
|
+
}
|
|
6895
|
+
};
|
|
6896
|
+
const chain2 = map[asset2.chain];
|
|
6897
|
+
return chain2[asset2.asset];
|
|
6898
|
+
}
|
|
6899
|
+
__name(getInternalAsset, "getInternalAsset");
|
|
6900
|
+
function getInternalAssets({ srcAsset, srcChain, destAsset, destChain }, assert3 = true) {
|
|
6901
|
+
return {
|
|
6902
|
+
srcAsset: getInternalAsset({
|
|
6903
|
+
asset: srcAsset,
|
|
6904
|
+
chain: srcChain
|
|
6905
|
+
}, assert3),
|
|
6906
|
+
destAsset: getInternalAsset({
|
|
6907
|
+
asset: destAsset,
|
|
6908
|
+
chain: destChain
|
|
6909
|
+
}, assert3)
|
|
6910
|
+
};
|
|
6911
|
+
}
|
|
6912
|
+
__name(getInternalAssets, "getInternalAssets");
|
|
6913
|
+
function getAssetAndChain(internalAsset, prefix) {
|
|
6914
|
+
const { chain: chain2, asset: asset2 } = assetConstants[internalAsset];
|
|
6915
|
+
if (prefix) {
|
|
6916
|
+
return {
|
|
6917
|
+
[`${prefix}Asset`]: asset2,
|
|
6918
|
+
[`${prefix}Chain`]: chain2
|
|
6919
|
+
};
|
|
6920
|
+
}
|
|
6921
|
+
return {
|
|
6922
|
+
chain: chain2,
|
|
6923
|
+
asset: asset2
|
|
6924
|
+
};
|
|
6925
|
+
}
|
|
6926
|
+
__name(getAssetAndChain, "getAssetAndChain");
|
|
6927
|
+
|
|
6928
6928
|
// ../shared/src/guards.ts
|
|
6929
6929
|
var isString2 = /* @__PURE__ */ __name((value) => typeof value === "string", "isString");
|
|
6930
6930
|
var isNotNullish = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isNotNullish");
|
|
@@ -7192,6 +7192,15 @@ var fillOrKillParams = z.object({
|
|
|
7192
7192
|
refundAddress: z.string(),
|
|
7193
7193
|
minPriceX128: numericString
|
|
7194
7194
|
});
|
|
7195
|
+
var ensureDcaWithFok = /* @__PURE__ */ __name((args, ctx) => {
|
|
7196
|
+
if (args.dcaParams && !args.fillOrKillParams) {
|
|
7197
|
+
ctx.addIssue({
|
|
7198
|
+
code: "custom",
|
|
7199
|
+
message: "dcaParams requires fillOrKillParams"
|
|
7200
|
+
});
|
|
7201
|
+
return z.NEVER;
|
|
7202
|
+
}
|
|
7203
|
+
}, "ensureDcaWithFok");
|
|
7195
7204
|
z.object({
|
|
7196
7205
|
srcAsset: asset,
|
|
7197
7206
|
destAsset: asset,
|
|
@@ -7205,45 +7214,56 @@ z.object({
|
|
|
7205
7214
|
srcAddress: z.string().optional(),
|
|
7206
7215
|
fillOrKillParams: fillOrKillParams.optional(),
|
|
7207
7216
|
dcaParams: dcaParams.optional()
|
|
7208
|
-
}).transform(({ amount, ...rest }) => ({
|
|
7217
|
+
}).superRefine(ensureDcaWithFok).transform(({ amount, ...rest }) => ({
|
|
7209
7218
|
...rest,
|
|
7210
7219
|
expectedDepositAmount: amount
|
|
7211
7220
|
}));
|
|
7212
7221
|
|
|
7213
7222
|
// ../shared/src/broker.ts
|
|
7214
|
-
var
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7223
|
+
var paramOrder = [
|
|
7224
|
+
"srcAsset",
|
|
7225
|
+
"destAsset",
|
|
7226
|
+
"destAddress",
|
|
7227
|
+
"commissionBps",
|
|
7228
|
+
"ccmParams",
|
|
7229
|
+
"maxBoostFeeBps",
|
|
7230
|
+
"affiliates",
|
|
7231
|
+
"fillOrKillParams",
|
|
7232
|
+
"dcaParams"
|
|
7233
|
+
];
|
|
7234
|
+
var validateRequest = /* @__PURE__ */ __name((network, params) => {
|
|
7235
|
+
const parsed = z.object({
|
|
7236
|
+
srcAsset: assetAndChain,
|
|
7237
|
+
destAsset: assetAndChain,
|
|
7238
|
+
destAddress: z.union([
|
|
7239
|
+
numericString,
|
|
7240
|
+
hexString,
|
|
7241
|
+
btcAddress(network),
|
|
7242
|
+
solanaAddress
|
|
7243
|
+
]),
|
|
7244
|
+
commissionBps: z.number().optional().default(0),
|
|
7245
|
+
ccmParams: ccmParamsSchema.transform(({ message, ...rest }) => ({
|
|
7246
|
+
message,
|
|
7247
|
+
cf_parameters: rest.cfParameters,
|
|
7248
|
+
gas_budget: rest.gasBudget
|
|
7249
|
+
})).optional(),
|
|
7250
|
+
maxBoostFeeBps: z.number().optional(),
|
|
7251
|
+
affiliates: z.array(affiliateBroker).optional(),
|
|
7252
|
+
fillOrKillParams: fillOrKillParams.transform(({ retryDurationBlocks, refundAddress, minPriceX128 }) => ({
|
|
7253
|
+
retry_duration: retryDurationBlocks,
|
|
7254
|
+
refund_address: refundAddress,
|
|
7255
|
+
min_price: `0x${BigInt(minPriceX128).toString(16)}`
|
|
7256
|
+
})).optional(),
|
|
7257
|
+
dcaParams: dcaParams.transform(({ numberOfChunks, chunkIntervalBlocks }) => ({
|
|
7258
|
+
number_of_chunks: numberOfChunks,
|
|
7259
|
+
chunk_interval: chunkIntervalBlocks
|
|
7260
|
+
})).optional()
|
|
7261
|
+
}).superRefine(ensureDcaWithFok).parse(params);
|
|
7262
|
+
if (parsed.destAsset.chain === "Polkadot") {
|
|
7263
|
+
parsed.destAddress = parsed.destAddress.startsWith("0x") ? z.string().length(66).parse(parsed.destAddress) : ss582__namespace.toPublicKey(parsed.destAddress);
|
|
7264
|
+
}
|
|
7265
|
+
return paramOrder.map((key) => parsed[key]);
|
|
7266
|
+
}, "validateRequest");
|
|
7247
7267
|
var validateResponse = /* @__PURE__ */ __name((network, response) => z.object({
|
|
7248
7268
|
address: z.union([
|
|
7249
7269
|
dotAddress,
|
|
@@ -7263,30 +7283,18 @@ var validateResponse = /* @__PURE__ */ __name((network, response) => z.object({
|
|
|
7263
7283
|
channelOpeningFee: channel_opening_fee
|
|
7264
7284
|
})).parse(response), "validateResponse");
|
|
7265
7285
|
async function requestSwapDepositAddress(swapRequest, opts, chainflipNetwork2) {
|
|
7266
|
-
const { srcAsset, srcChain, destAsset, destChain, destAddress } = swapRequest;
|
|
7267
7286
|
const client = new rpc.HttpClient(opts.url);
|
|
7268
|
-
const params = validateRequest(chainflipNetwork2,
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
{
|
|
7274
|
-
asset: destAsset,
|
|
7275
|
-
chain: destChain
|
|
7287
|
+
const params = validateRequest(chainflipNetwork2, {
|
|
7288
|
+
...swapRequest,
|
|
7289
|
+
srcAsset: {
|
|
7290
|
+
asset: swapRequest.srcAsset,
|
|
7291
|
+
chain: swapRequest.srcChain
|
|
7276
7292
|
},
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
swapRequest.maxBoostFeeBps,
|
|
7281
|
-
swapRequest.affiliates,
|
|
7282
|
-
swapRequest.fillOrKillParams && {
|
|
7283
|
-
...swapRequest.fillOrKillParams,
|
|
7284
|
-
refundAddress: submitAddress(srcChain, swapRequest.fillOrKillParams.refundAddress)
|
|
7285
|
-
},
|
|
7286
|
-
swapRequest.dcaParams && {
|
|
7287
|
-
...swapRequest.dcaParams
|
|
7293
|
+
destAsset: {
|
|
7294
|
+
asset: swapRequest.destAsset,
|
|
7295
|
+
chain: swapRequest.destChain
|
|
7288
7296
|
}
|
|
7289
|
-
|
|
7297
|
+
});
|
|
7290
7298
|
const response = await client.sendRequest("broker_requestSwapDepositAddress", ...params);
|
|
7291
7299
|
return validateResponse(chainflipNetwork2, response);
|
|
7292
7300
|
}
|
|
@@ -10290,7 +10298,7 @@ var getChainData = /* @__PURE__ */ __name((chain2, network, env) => ({
|
|
|
10290
10298
|
}), "getChainData");
|
|
10291
10299
|
|
|
10292
10300
|
// package.json
|
|
10293
|
-
var version = "1.6.
|
|
10301
|
+
var version = "1.6.5";
|
|
10294
10302
|
|
|
10295
10303
|
// src/swap/consts.ts
|
|
10296
10304
|
var CF_SDK_VERSION_HEADERS = {
|
package/dist/swap.mjs
CHANGED
|
@@ -6917,6 +6917,15 @@ var fillOrKillParams = z.object({
|
|
|
6917
6917
|
refundAddress: z.string(),
|
|
6918
6918
|
minPriceX128: numericString
|
|
6919
6919
|
});
|
|
6920
|
+
var ensureDcaWithFok = /* @__PURE__ */ __name((args, ctx) => {
|
|
6921
|
+
if (args.dcaParams && !args.fillOrKillParams) {
|
|
6922
|
+
ctx.addIssue({
|
|
6923
|
+
code: "custom",
|
|
6924
|
+
message: "dcaParams requires fillOrKillParams"
|
|
6925
|
+
});
|
|
6926
|
+
return z.NEVER;
|
|
6927
|
+
}
|
|
6928
|
+
}, "ensureDcaWithFok");
|
|
6920
6929
|
z.object({
|
|
6921
6930
|
srcAsset: asset,
|
|
6922
6931
|
destAsset: asset,
|
|
@@ -6930,45 +6939,56 @@ z.object({
|
|
|
6930
6939
|
srcAddress: z.string().optional(),
|
|
6931
6940
|
fillOrKillParams: fillOrKillParams.optional(),
|
|
6932
6941
|
dcaParams: dcaParams.optional()
|
|
6933
|
-
}).transform(({ amount, ...rest }) => ({
|
|
6942
|
+
}).superRefine(ensureDcaWithFok).transform(({ amount, ...rest }) => ({
|
|
6934
6943
|
...rest,
|
|
6935
6944
|
expectedDepositAmount: amount
|
|
6936
6945
|
}));
|
|
6937
6946
|
|
|
6938
6947
|
// ../shared/src/broker.ts
|
|
6939
|
-
var
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6948
|
+
var paramOrder = [
|
|
6949
|
+
"srcAsset",
|
|
6950
|
+
"destAsset",
|
|
6951
|
+
"destAddress",
|
|
6952
|
+
"commissionBps",
|
|
6953
|
+
"ccmParams",
|
|
6954
|
+
"maxBoostFeeBps",
|
|
6955
|
+
"affiliates",
|
|
6956
|
+
"fillOrKillParams",
|
|
6957
|
+
"dcaParams"
|
|
6958
|
+
];
|
|
6959
|
+
var validateRequest = /* @__PURE__ */ __name((network, params) => {
|
|
6960
|
+
const parsed = z.object({
|
|
6961
|
+
srcAsset: assetAndChain,
|
|
6962
|
+
destAsset: assetAndChain,
|
|
6963
|
+
destAddress: z.union([
|
|
6964
|
+
numericString,
|
|
6965
|
+
hexString,
|
|
6966
|
+
btcAddress(network),
|
|
6967
|
+
solanaAddress
|
|
6968
|
+
]),
|
|
6969
|
+
commissionBps: z.number().optional().default(0),
|
|
6970
|
+
ccmParams: ccmParamsSchema.transform(({ message, ...rest }) => ({
|
|
6971
|
+
message,
|
|
6972
|
+
cf_parameters: rest.cfParameters,
|
|
6973
|
+
gas_budget: rest.gasBudget
|
|
6974
|
+
})).optional(),
|
|
6975
|
+
maxBoostFeeBps: z.number().optional(),
|
|
6976
|
+
affiliates: z.array(affiliateBroker).optional(),
|
|
6977
|
+
fillOrKillParams: fillOrKillParams.transform(({ retryDurationBlocks, refundAddress, minPriceX128 }) => ({
|
|
6978
|
+
retry_duration: retryDurationBlocks,
|
|
6979
|
+
refund_address: refundAddress,
|
|
6980
|
+
min_price: `0x${BigInt(minPriceX128).toString(16)}`
|
|
6981
|
+
})).optional(),
|
|
6982
|
+
dcaParams: dcaParams.transform(({ numberOfChunks, chunkIntervalBlocks }) => ({
|
|
6983
|
+
number_of_chunks: numberOfChunks,
|
|
6984
|
+
chunk_interval: chunkIntervalBlocks
|
|
6985
|
+
})).optional()
|
|
6986
|
+
}).superRefine(ensureDcaWithFok).parse(params);
|
|
6987
|
+
if (parsed.destAsset.chain === "Polkadot") {
|
|
6988
|
+
parsed.destAddress = parsed.destAddress.startsWith("0x") ? z.string().length(66).parse(parsed.destAddress) : ss582.toPublicKey(parsed.destAddress);
|
|
6989
|
+
}
|
|
6990
|
+
return paramOrder.map((key) => parsed[key]);
|
|
6991
|
+
}, "validateRequest");
|
|
6972
6992
|
var validateResponse = /* @__PURE__ */ __name((network, response) => z.object({
|
|
6973
6993
|
address: z.union([
|
|
6974
6994
|
dotAddress,
|
|
@@ -6988,30 +7008,18 @@ var validateResponse = /* @__PURE__ */ __name((network, response) => z.object({
|
|
|
6988
7008
|
channelOpeningFee: channel_opening_fee
|
|
6989
7009
|
})).parse(response), "validateResponse");
|
|
6990
7010
|
async function requestSwapDepositAddress(swapRequest, opts, chainflipNetwork2) {
|
|
6991
|
-
const { srcAsset, srcChain, destAsset, destChain, destAddress } = swapRequest;
|
|
6992
7011
|
const client = new HttpClient(opts.url);
|
|
6993
|
-
const params = validateRequest(chainflipNetwork2,
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
{
|
|
6999
|
-
asset: destAsset,
|
|
7000
|
-
chain: destChain
|
|
7012
|
+
const params = validateRequest(chainflipNetwork2, {
|
|
7013
|
+
...swapRequest,
|
|
7014
|
+
srcAsset: {
|
|
7015
|
+
asset: swapRequest.srcAsset,
|
|
7016
|
+
chain: swapRequest.srcChain
|
|
7001
7017
|
},
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
swapRequest.maxBoostFeeBps,
|
|
7006
|
-
swapRequest.affiliates,
|
|
7007
|
-
swapRequest.fillOrKillParams && {
|
|
7008
|
-
...swapRequest.fillOrKillParams,
|
|
7009
|
-
refundAddress: submitAddress(srcChain, swapRequest.fillOrKillParams.refundAddress)
|
|
7010
|
-
},
|
|
7011
|
-
swapRequest.dcaParams && {
|
|
7012
|
-
...swapRequest.dcaParams
|
|
7018
|
+
destAsset: {
|
|
7019
|
+
asset: swapRequest.destAsset,
|
|
7020
|
+
chain: swapRequest.destChain
|
|
7013
7021
|
}
|
|
7014
|
-
|
|
7022
|
+
});
|
|
7015
7023
|
const response = await client.sendRequest("broker_requestSwapDepositAddress", ...params);
|
|
7016
7024
|
return validateResponse(chainflipNetwork2, response);
|
|
7017
7025
|
}
|
|
@@ -8565,7 +8573,7 @@ var getChainData = /* @__PURE__ */ __name((chain2, network, env) => ({
|
|
|
8565
8573
|
}), "getChainData");
|
|
8566
8574
|
|
|
8567
8575
|
// package.json
|
|
8568
|
-
var version = "1.6.
|
|
8576
|
+
var version = "1.6.5";
|
|
8569
8577
|
|
|
8570
8578
|
// src/swap/consts.ts
|
|
8571
8579
|
var CF_SDK_VERSION_HEADERS = {
|