@chainflip/sdk 1.6.5 → 1.6.7-rc.0
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/{chunk-35BXEUA4.mjs → chunk-G76RI3QK.mjs} +36 -8
- package/dist/{contracts-DmShvHR7.d.mts → contracts-Bgib7w_h.d.mts} +5 -5
- package/dist/{contracts-DmShvHR7.d.ts → contracts-Bgib7w_h.d.ts} +5 -5
- package/dist/funding.d.mts +1 -1
- package/dist/funding.d.ts +1 -1
- package/dist/funding.js +7 -7
- package/dist/funding.mjs +1 -1
- package/dist/swap.d.mts +83 -23
- package/dist/swap.d.ts +83 -23
- package/dist/swap.js +9399 -5652
- package/dist/swap.mjs +9337 -5619
- package/package.json +4 -2
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
import { constants, HttpClient } from '@chainflip/rpc';
|
|
2
2
|
import { Interface, Contract } from 'ethers';
|
|
3
3
|
|
|
4
|
+
var __create = Object.create;
|
|
4
5
|
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
10
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
11
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
12
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
13
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
|
+
};
|
|
15
|
+
var __export = (target, all) => {
|
|
16
|
+
for (var name in all)
|
|
17
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
18
|
+
};
|
|
19
|
+
var __copyProps = (to, from, except, desc) => {
|
|
20
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
+
for (let key of __getOwnPropNames(from))
|
|
22
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
23
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
24
|
+
}
|
|
25
|
+
return to;
|
|
26
|
+
};
|
|
27
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
28
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
29
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
30
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
31
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
32
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
33
|
+
mod
|
|
34
|
+
));
|
|
7
35
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
36
|
|
|
9
37
|
// ../shared/src/enums.ts
|
|
@@ -126,7 +154,7 @@ var chainConstants = {
|
|
|
126
154
|
Assets.USDC,
|
|
127
155
|
Assets.USDT
|
|
128
156
|
],
|
|
129
|
-
gasAsset:
|
|
157
|
+
gasAsset: InternalAssets.Eth,
|
|
130
158
|
contractId: 1,
|
|
131
159
|
blockTimeSeconds: 12
|
|
132
160
|
},
|
|
@@ -134,7 +162,7 @@ var chainConstants = {
|
|
|
134
162
|
assets: [
|
|
135
163
|
Assets.DOT
|
|
136
164
|
],
|
|
137
|
-
gasAsset:
|
|
165
|
+
gasAsset: InternalAssets.Dot,
|
|
138
166
|
contractId: 2,
|
|
139
167
|
blockTimeSeconds: 6
|
|
140
168
|
},
|
|
@@ -142,7 +170,7 @@ var chainConstants = {
|
|
|
142
170
|
assets: [
|
|
143
171
|
Assets.BTC
|
|
144
172
|
],
|
|
145
|
-
gasAsset:
|
|
173
|
+
gasAsset: InternalAssets.Btc,
|
|
146
174
|
contractId: 3,
|
|
147
175
|
blockTimeSeconds: 10 * 60
|
|
148
176
|
},
|
|
@@ -151,7 +179,7 @@ var chainConstants = {
|
|
|
151
179
|
Assets.ETH,
|
|
152
180
|
Assets.USDC
|
|
153
181
|
],
|
|
154
|
-
gasAsset:
|
|
182
|
+
gasAsset: InternalAssets.ArbEth,
|
|
155
183
|
contractId: 4,
|
|
156
184
|
blockTimeSeconds: 0.26
|
|
157
185
|
},
|
|
@@ -160,7 +188,7 @@ var chainConstants = {
|
|
|
160
188
|
Assets.SOL,
|
|
161
189
|
Assets.USDC
|
|
162
190
|
],
|
|
163
|
-
gasAsset:
|
|
191
|
+
gasAsset: InternalAssets.Sol,
|
|
164
192
|
contractId: 5,
|
|
165
193
|
blockTimeSeconds: (400 + 800) / 2 / 1e3
|
|
166
194
|
}
|
|
@@ -241,9 +269,9 @@ __name(getAssetAndChain, "getAssetAndChain");
|
|
|
241
269
|
// ../shared/src/guards.ts
|
|
242
270
|
var isString = /* @__PURE__ */ __name((value) => typeof value === "string", "isString");
|
|
243
271
|
var isNotNullish = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isNotNullish");
|
|
244
|
-
function assert(condition, message) {
|
|
272
|
+
function assert(condition, message, Constructor = Error) {
|
|
245
273
|
if (condition) return;
|
|
246
|
-
const error = new
|
|
274
|
+
const error = new Constructor(message);
|
|
247
275
|
if (error.stack) {
|
|
248
276
|
error.stack = error.stack.replace(/\n.+/, "\n");
|
|
249
277
|
}
|
|
@@ -2378,4 +2406,4 @@ var getFlipBalance = /* @__PURE__ */ __name(async (network, signer) => {
|
|
|
2378
2406
|
return flip.balanceOf(await signer.getAddress());
|
|
2379
2407
|
}, "getFlipBalance");
|
|
2380
2408
|
|
|
2381
|
-
export { Assets, ChainflipNetworks, Chains, InternalAssets, StateChainGateway__factory, Vault__factory, __name, __publicField, approve, assert, assetConstants, chainConstants, checkAllowance, extractOverrides, getAllBoostPoolsDepth, getAssetAndChain, getEnvironment, getEvmChainId, getFlipBalance, getFundingEnvironment, getInternalAsset, getInternalAssets, getStateChainGatewayContractAddress, getSupportedAssets, getTokenContractAddress, getVaultContractAddress, isNotNullish, isString, isTestnet, isValidAssetAndChain, readChainAssetValue };
|
|
2409
|
+
export { Assets, ChainflipNetworks, Chains, InternalAssets, StateChainGateway__factory, Vault__factory, __commonJS, __export, __name, __publicField, __toESM, approve, assert, assetConstants, chainConstants, checkAllowance, extractOverrides, getAllBoostPoolsDepth, getAssetAndChain, getEnvironment, getEvmChainId, getFlipBalance, getFundingEnvironment, getInternalAsset, getInternalAssets, getStateChainGatewayContractAddress, getSupportedAssets, getTokenContractAddress, getVaultContractAddress, isNotNullish, isString, isTestnet, isValidAssetAndChain, readChainAssetValue };
|
|
@@ -12,31 +12,31 @@ type ChainflipNetwork = (typeof ChainflipNetworks)[keyof typeof ChainflipNetwork
|
|
|
12
12
|
declare const chainConstants: {
|
|
13
13
|
readonly Ethereum: {
|
|
14
14
|
readonly assets: ["ETH", "FLIP", "USDC", "USDT"];
|
|
15
|
-
readonly gasAsset: "
|
|
15
|
+
readonly gasAsset: "Eth";
|
|
16
16
|
readonly contractId: 1;
|
|
17
17
|
readonly blockTimeSeconds: 12;
|
|
18
18
|
};
|
|
19
19
|
readonly Polkadot: {
|
|
20
20
|
readonly assets: ["DOT"];
|
|
21
|
-
readonly gasAsset: "
|
|
21
|
+
readonly gasAsset: "Dot";
|
|
22
22
|
readonly contractId: 2;
|
|
23
23
|
readonly blockTimeSeconds: 6;
|
|
24
24
|
};
|
|
25
25
|
readonly Bitcoin: {
|
|
26
26
|
readonly assets: ["BTC"];
|
|
27
|
-
readonly gasAsset: "
|
|
27
|
+
readonly gasAsset: "Btc";
|
|
28
28
|
readonly contractId: 3;
|
|
29
29
|
readonly blockTimeSeconds: number;
|
|
30
30
|
};
|
|
31
31
|
readonly Arbitrum: {
|
|
32
32
|
readonly assets: ["ETH", "USDC"];
|
|
33
|
-
readonly gasAsset: "
|
|
33
|
+
readonly gasAsset: "ArbEth";
|
|
34
34
|
readonly contractId: 4;
|
|
35
35
|
readonly blockTimeSeconds: 0.26;
|
|
36
36
|
};
|
|
37
37
|
readonly Solana: {
|
|
38
38
|
readonly assets: ["SOL", "USDC"];
|
|
39
|
-
readonly gasAsset: "
|
|
39
|
+
readonly gasAsset: "Sol";
|
|
40
40
|
readonly contractId: 5;
|
|
41
41
|
readonly blockTimeSeconds: number;
|
|
42
42
|
};
|
|
@@ -12,31 +12,31 @@ type ChainflipNetwork = (typeof ChainflipNetworks)[keyof typeof ChainflipNetwork
|
|
|
12
12
|
declare const chainConstants: {
|
|
13
13
|
readonly Ethereum: {
|
|
14
14
|
readonly assets: ["ETH", "FLIP", "USDC", "USDT"];
|
|
15
|
-
readonly gasAsset: "
|
|
15
|
+
readonly gasAsset: "Eth";
|
|
16
16
|
readonly contractId: 1;
|
|
17
17
|
readonly blockTimeSeconds: 12;
|
|
18
18
|
};
|
|
19
19
|
readonly Polkadot: {
|
|
20
20
|
readonly assets: ["DOT"];
|
|
21
|
-
readonly gasAsset: "
|
|
21
|
+
readonly gasAsset: "Dot";
|
|
22
22
|
readonly contractId: 2;
|
|
23
23
|
readonly blockTimeSeconds: 6;
|
|
24
24
|
};
|
|
25
25
|
readonly Bitcoin: {
|
|
26
26
|
readonly assets: ["BTC"];
|
|
27
|
-
readonly gasAsset: "
|
|
27
|
+
readonly gasAsset: "Btc";
|
|
28
28
|
readonly contractId: 3;
|
|
29
29
|
readonly blockTimeSeconds: number;
|
|
30
30
|
};
|
|
31
31
|
readonly Arbitrum: {
|
|
32
32
|
readonly assets: ["ETH", "USDC"];
|
|
33
|
-
readonly gasAsset: "
|
|
33
|
+
readonly gasAsset: "ArbEth";
|
|
34
34
|
readonly contractId: 4;
|
|
35
35
|
readonly blockTimeSeconds: 0.26;
|
|
36
36
|
};
|
|
37
37
|
readonly Solana: {
|
|
38
38
|
readonly assets: ["SOL", "USDC"];
|
|
39
|
-
readonly gasAsset: "
|
|
39
|
+
readonly gasAsset: "Sol";
|
|
40
40
|
readonly contractId: 5;
|
|
41
41
|
readonly blockTimeSeconds: number;
|
|
42
42
|
};
|
package/dist/funding.d.mts
CHANGED
package/dist/funding.d.ts
CHANGED
package/dist/funding.js
CHANGED
|
@@ -878,7 +878,7 @@ var chainConstants = {
|
|
|
878
878
|
Assets.USDC,
|
|
879
879
|
Assets.USDT
|
|
880
880
|
],
|
|
881
|
-
gasAsset:
|
|
881
|
+
gasAsset: InternalAssets.Eth,
|
|
882
882
|
contractId: 1,
|
|
883
883
|
blockTimeSeconds: 12
|
|
884
884
|
},
|
|
@@ -886,7 +886,7 @@ var chainConstants = {
|
|
|
886
886
|
assets: [
|
|
887
887
|
Assets.DOT
|
|
888
888
|
],
|
|
889
|
-
gasAsset:
|
|
889
|
+
gasAsset: InternalAssets.Dot,
|
|
890
890
|
contractId: 2,
|
|
891
891
|
blockTimeSeconds: 6
|
|
892
892
|
},
|
|
@@ -894,7 +894,7 @@ var chainConstants = {
|
|
|
894
894
|
assets: [
|
|
895
895
|
Assets.BTC
|
|
896
896
|
],
|
|
897
|
-
gasAsset:
|
|
897
|
+
gasAsset: InternalAssets.Btc,
|
|
898
898
|
contractId: 3,
|
|
899
899
|
blockTimeSeconds: 10 * 60
|
|
900
900
|
},
|
|
@@ -903,7 +903,7 @@ var chainConstants = {
|
|
|
903
903
|
Assets.ETH,
|
|
904
904
|
Assets.USDC
|
|
905
905
|
],
|
|
906
|
-
gasAsset:
|
|
906
|
+
gasAsset: InternalAssets.ArbEth,
|
|
907
907
|
contractId: 4,
|
|
908
908
|
blockTimeSeconds: 0.26
|
|
909
909
|
},
|
|
@@ -912,7 +912,7 @@ var chainConstants = {
|
|
|
912
912
|
Assets.SOL,
|
|
913
913
|
Assets.USDC
|
|
914
914
|
],
|
|
915
|
-
gasAsset:
|
|
915
|
+
gasAsset: InternalAssets.Sol,
|
|
916
916
|
contractId: 5,
|
|
917
917
|
blockTimeSeconds: (400 + 800) / 2 / 1e3
|
|
918
918
|
}
|
|
@@ -1102,9 +1102,9 @@ var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
|
|
|
1102
1102
|
}, "getStateChainGateway");
|
|
1103
1103
|
|
|
1104
1104
|
// ../shared/src/guards.ts
|
|
1105
|
-
function assert(condition, message) {
|
|
1105
|
+
function assert(condition, message, Constructor = Error) {
|
|
1106
1106
|
if (condition) return;
|
|
1107
|
-
const error = new
|
|
1107
|
+
const error = new Constructor(message);
|
|
1108
1108
|
if (error.stack) {
|
|
1109
1109
|
error.stack = error.stack.replace(/\n.+/, "\n");
|
|
1110
1110
|
}
|
package/dist/funding.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __name, __publicField, ChainflipNetworks, getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, InternalAssets, checkAllowance, assert, extractOverrides, StateChainGateway__factory } from './chunk-
|
|
1
|
+
import { __name, __publicField, ChainflipNetworks, getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, InternalAssets, checkAllowance, assert, extractOverrides, StateChainGateway__factory } from './chunk-G76RI3QK.mjs';
|
|
2
2
|
|
|
3
3
|
// ../shared/src/stateChainGateway/utils.ts
|
|
4
4
|
var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
|
package/dist/swap.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-DmShvHR7.mjs';
|
|
1
|
+
import { A as AssetAndChain, C as Chain, a as Asset, I as InternalAsset, b as AssetOfChain, c as ChainflipNetwork, T as TransactionOptions, d as ChainAssetMap, e as ChainMap } from './contracts-Bgib7w_h.mjs';
|
|
2
|
+
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-Bgib7w_h.mjs';
|
|
4
3
|
import { z } from 'zod';
|
|
4
|
+
import { SwappingRequestSwapDepositAddressWithAffiliates } from '@chainflip/extrinsics/160/swapping/requestSwapDepositAddressWithAffiliates';
|
|
5
|
+
import { Signer } from 'ethers';
|
|
5
6
|
|
|
6
7
|
declare const ccmParamsSchema: z.ZodObject<{
|
|
7
8
|
gasBudget: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, `0x${string}`, string>]>, `0x${string}`, string>;
|
|
@@ -59,7 +60,7 @@ declare const fillOrKillParams: z.ZodObject<{
|
|
|
59
60
|
minPriceX128: string;
|
|
60
61
|
}>;
|
|
61
62
|
type FillOrKillParamsX128 = z.input<typeof fillOrKillParams>;
|
|
62
|
-
type
|
|
63
|
+
type FillOrKillParamsWithMinPrice = Omit<FillOrKillParamsX128, 'minPriceX128'> & {
|
|
63
64
|
minPrice: string;
|
|
64
65
|
};
|
|
65
66
|
type Fee<T> = {
|
|
@@ -71,31 +72,43 @@ type Fee<T> = {
|
|
|
71
72
|
type SwapFee = Fee<'NETWORK' | 'INGRESS' | 'EGRESS' | 'BROKER' | 'BOOST'>;
|
|
72
73
|
type PoolFee = Fee<'LIQUIDITY'>;
|
|
73
74
|
type PaidFee = SwapFee | PoolFee;
|
|
74
|
-
type QuoteType = 'REGULAR' | 'DCA';
|
|
75
75
|
type PoolInfo = {
|
|
76
76
|
baseAsset: AssetAndChain;
|
|
77
77
|
quoteAsset: AssetAndChain;
|
|
78
78
|
fee: Omit<PoolFee, 'type'>;
|
|
79
79
|
};
|
|
80
|
-
type
|
|
80
|
+
type BoostedQuoteDetails = {
|
|
81
|
+
estimatedBoostFeeBps: number;
|
|
82
|
+
maxBoostFeeBps: number;
|
|
83
|
+
};
|
|
84
|
+
interface BaseQuoteDetails {
|
|
85
|
+
srcAsset: AssetAndChain;
|
|
86
|
+
destAsset: AssetAndChain;
|
|
81
87
|
intermediateAmount?: string;
|
|
88
|
+
depositAmount: string;
|
|
82
89
|
egressAmount: string;
|
|
83
90
|
includedFees: SwapFee[];
|
|
84
91
|
poolInfo: PoolInfo[];
|
|
85
92
|
lowLiquidityWarning: boolean | undefined;
|
|
86
93
|
estimatedDurationSeconds: number;
|
|
87
94
|
estimatedPrice: string;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
}
|
|
96
|
+
type WithBoostQuote<T> = Omit<T, 'boostQuote'> & BoostedQuoteDetails;
|
|
97
|
+
interface RegularQuote extends BaseQuoteDetails {
|
|
98
|
+
type: 'REGULAR';
|
|
99
|
+
boostQuote?: WithBoostQuote<RegularQuote>;
|
|
100
|
+
}
|
|
101
|
+
interface DCAQuote extends BaseQuoteDetails {
|
|
102
|
+
type: 'DCA';
|
|
103
|
+
dcaParams: DcaParams;
|
|
104
|
+
boostQuote?: WithBoostQuote<DCAQuote>;
|
|
105
|
+
}
|
|
106
|
+
type Quote = RegularQuote | DCAQuote;
|
|
107
|
+
type DCABoostQuote = NonNullable<DCAQuote['boostQuote']>;
|
|
108
|
+
type RegularBoostQuote = NonNullable<RegularQuote['boostQuote']>;
|
|
109
|
+
type BoostQuote = RegularBoostQuote | DCABoostQuote;
|
|
110
|
+
type FillOrKillParamsWithSlippage$1 = Omit<FillOrKillParamsX128, 'minPriceX128'> & {
|
|
111
|
+
slippageTolerancePercent: string | number;
|
|
99
112
|
};
|
|
100
113
|
|
|
101
114
|
interface ExecuteSwapParams {
|
|
@@ -144,17 +157,20 @@ interface QuoteRequest extends ChainsAndAssets {
|
|
|
144
157
|
affiliateBrokers?: AffiliateBroker[];
|
|
145
158
|
}
|
|
146
159
|
interface QuoteResponse extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers'> {
|
|
147
|
-
quote:
|
|
160
|
+
quote: Quote;
|
|
148
161
|
}
|
|
149
162
|
interface QuoteResponseV2 extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers'> {
|
|
150
|
-
quotes:
|
|
163
|
+
quotes: Quote[];
|
|
151
164
|
}
|
|
165
|
+
type FillOrKillParamsWithSlippage = Omit<FillOrKillParamsWithMinPrice, 'minPrice'> & {
|
|
166
|
+
slippageTolerancePercent: string | number;
|
|
167
|
+
};
|
|
152
168
|
interface DepositAddressRequest extends QuoteRequest {
|
|
153
169
|
destAddress: string;
|
|
154
170
|
ccmParams?: CcmParams;
|
|
155
171
|
maxBoostFeeBps?: number;
|
|
156
172
|
srcAddress?: string;
|
|
157
|
-
fillOrKillParams?:
|
|
173
|
+
fillOrKillParams?: FillOrKillParamsWithMinPrice;
|
|
158
174
|
dcaParams?: DcaParams;
|
|
159
175
|
ccmMetadata?: CcmParams;
|
|
160
176
|
}
|
|
@@ -180,6 +196,7 @@ interface SwapStatusResponseCommonFields$1 extends ChainsAndAssets {
|
|
|
180
196
|
depositTransactionRef: string | undefined;
|
|
181
197
|
swapScheduledAt: number | undefined;
|
|
182
198
|
swapScheduledBlockIndex: string | undefined;
|
|
199
|
+
lastStatechainUpdateAt: number | undefined;
|
|
183
200
|
depositTransactionHash: string | undefined;
|
|
184
201
|
ccmMetadata?: CcmParams;
|
|
185
202
|
}
|
|
@@ -200,7 +217,7 @@ interface DepositAddressFields extends SwapStatusResponseCommonFields$1 {
|
|
|
200
217
|
effectiveBoostFeeBps?: number;
|
|
201
218
|
boostSkippedAt?: number;
|
|
202
219
|
boostSkippedBlockIndex?: string;
|
|
203
|
-
fillOrKillParams:
|
|
220
|
+
fillOrKillParams: FillOrKillParamsWithMinPrice;
|
|
204
221
|
}
|
|
205
222
|
type EgressScheduled = {
|
|
206
223
|
swapId: string;
|
|
@@ -370,7 +387,7 @@ interface DepositChannelFields {
|
|
|
370
387
|
isExpired: boolean;
|
|
371
388
|
openedThroughBackend: boolean;
|
|
372
389
|
affiliateBrokers: AffiliateBroker[];
|
|
373
|
-
fillOrKillParams:
|
|
390
|
+
fillOrKillParams: FillOrKillParamsWithMinPrice | undefined;
|
|
374
391
|
dcaParams: DcaParams | undefined;
|
|
375
392
|
}
|
|
376
393
|
interface DepositFields {
|
|
@@ -430,6 +447,7 @@ interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
|
430
447
|
estimatedDurationSeconds: number | null | undefined;
|
|
431
448
|
srcChainRequiredBlockConfirmations: number | null;
|
|
432
449
|
fees: PaidFee[];
|
|
450
|
+
lastStatechainUpdateAt: number | undefined;
|
|
433
451
|
}
|
|
434
452
|
interface Waiting extends SwapStatusResponseCommonFields {
|
|
435
453
|
depositChannel: DepositChannelFields;
|
|
@@ -461,6 +479,18 @@ type SwapStatusResponseV2 = ({
|
|
|
461
479
|
state: 'FAILED';
|
|
462
480
|
} & Sending);
|
|
463
481
|
|
|
482
|
+
interface DepositAddressRequestV2 {
|
|
483
|
+
quote: Quote | BoostQuote;
|
|
484
|
+
destAddress: string;
|
|
485
|
+
fillOrKillParams?: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1;
|
|
486
|
+
affiliateBrokers?: {
|
|
487
|
+
account: `cF${string}` | `0x${string}`;
|
|
488
|
+
commissionBps: number;
|
|
489
|
+
}[];
|
|
490
|
+
ccmParams?: CcmParams;
|
|
491
|
+
brokerCommissionBps?: number;
|
|
492
|
+
}
|
|
493
|
+
|
|
464
494
|
type RequestOptions = {
|
|
465
495
|
signal?: AbortSignal;
|
|
466
496
|
};
|
|
@@ -517,6 +547,36 @@ declare class SwapSDK {
|
|
|
517
547
|
asset: Asset;
|
|
518
548
|
chain: Chain;
|
|
519
549
|
}): Promise<BoostPoolDepth[]>;
|
|
550
|
+
requestDepositAddressV2({ quote, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): Promise<{
|
|
551
|
+
depositChannelId: string;
|
|
552
|
+
depositAddress: string;
|
|
553
|
+
brokerCommissionBps: number;
|
|
554
|
+
affiliateBrokers: {
|
|
555
|
+
account: `cF${string}` | `0x${string}`;
|
|
556
|
+
commissionBps: number;
|
|
557
|
+
}[];
|
|
558
|
+
maxBoostFeeBps: number;
|
|
559
|
+
depositChannelExpiryBlock: bigint;
|
|
560
|
+
estimatedDepositChannelExpiryTime: number | undefined;
|
|
561
|
+
channelOpeningFee: bigint;
|
|
562
|
+
fillOrKillParams: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1 | undefined;
|
|
563
|
+
srcAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
|
|
564
|
+
srcChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana";
|
|
565
|
+
destAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
|
|
566
|
+
destChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana";
|
|
567
|
+
destAddress: string;
|
|
568
|
+
dcaParams: {
|
|
569
|
+
numberOfChunks: number;
|
|
570
|
+
chunkIntervalBlocks: number;
|
|
571
|
+
} | undefined;
|
|
572
|
+
ccmParams: {
|
|
573
|
+
message: string;
|
|
574
|
+
gasBudget: string;
|
|
575
|
+
cfParameters?: string | undefined;
|
|
576
|
+
} | undefined;
|
|
577
|
+
amount: string;
|
|
578
|
+
}>;
|
|
579
|
+
buildRequestSwapDepositAddressWithAffiliatesParams({ quote, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): SwappingRequestSwapDepositAddressWithAffiliates;
|
|
520
580
|
}
|
|
521
581
|
|
|
522
|
-
export { Asset, type AssetData, type BoostPoolDepth, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DepositAddressRequest, type DepositAddressResponse, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type QuoteRequest, type QuoteResponse, type QuoteResponseV2, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type SwapStatusResponseV2, type VaultSwapStatusResponse };
|
|
582
|
+
export { Asset, type AssetData, type BoostPoolDepth, type BoostQuote, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DCABoostQuote, type DCAQuote, type DepositAddressRequest, type DepositAddressRequestV2, type DepositAddressResponse, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type FillOrKillParamsWithSlippage, type Quote, type QuoteRequest, type QuoteResponse, type QuoteResponseV2, type RegularQuote, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type SwapStatusResponseV2, type VaultSwapStatusResponse };
|
package/dist/swap.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-DmShvHR7.js';
|
|
1
|
+
import { A as AssetAndChain, C as Chain, a as Asset, I as InternalAsset, b as AssetOfChain, c as ChainflipNetwork, T as TransactionOptions, d as ChainAssetMap, e as ChainMap } from './contracts-Bgib7w_h.js';
|
|
2
|
+
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-Bgib7w_h.js';
|
|
4
3
|
import { z } from 'zod';
|
|
4
|
+
import { SwappingRequestSwapDepositAddressWithAffiliates } from '@chainflip/extrinsics/160/swapping/requestSwapDepositAddressWithAffiliates';
|
|
5
|
+
import { Signer } from 'ethers';
|
|
5
6
|
|
|
6
7
|
declare const ccmParamsSchema: z.ZodObject<{
|
|
7
8
|
gasBudget: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, `0x${string}`, string>]>, `0x${string}`, string>;
|
|
@@ -59,7 +60,7 @@ declare const fillOrKillParams: z.ZodObject<{
|
|
|
59
60
|
minPriceX128: string;
|
|
60
61
|
}>;
|
|
61
62
|
type FillOrKillParamsX128 = z.input<typeof fillOrKillParams>;
|
|
62
|
-
type
|
|
63
|
+
type FillOrKillParamsWithMinPrice = Omit<FillOrKillParamsX128, 'minPriceX128'> & {
|
|
63
64
|
minPrice: string;
|
|
64
65
|
};
|
|
65
66
|
type Fee<T> = {
|
|
@@ -71,31 +72,43 @@ type Fee<T> = {
|
|
|
71
72
|
type SwapFee = Fee<'NETWORK' | 'INGRESS' | 'EGRESS' | 'BROKER' | 'BOOST'>;
|
|
72
73
|
type PoolFee = Fee<'LIQUIDITY'>;
|
|
73
74
|
type PaidFee = SwapFee | PoolFee;
|
|
74
|
-
type QuoteType = 'REGULAR' | 'DCA';
|
|
75
75
|
type PoolInfo = {
|
|
76
76
|
baseAsset: AssetAndChain;
|
|
77
77
|
quoteAsset: AssetAndChain;
|
|
78
78
|
fee: Omit<PoolFee, 'type'>;
|
|
79
79
|
};
|
|
80
|
-
type
|
|
80
|
+
type BoostedQuoteDetails = {
|
|
81
|
+
estimatedBoostFeeBps: number;
|
|
82
|
+
maxBoostFeeBps: number;
|
|
83
|
+
};
|
|
84
|
+
interface BaseQuoteDetails {
|
|
85
|
+
srcAsset: AssetAndChain;
|
|
86
|
+
destAsset: AssetAndChain;
|
|
81
87
|
intermediateAmount?: string;
|
|
88
|
+
depositAmount: string;
|
|
82
89
|
egressAmount: string;
|
|
83
90
|
includedFees: SwapFee[];
|
|
84
91
|
poolInfo: PoolInfo[];
|
|
85
92
|
lowLiquidityWarning: boolean | undefined;
|
|
86
93
|
estimatedDurationSeconds: number;
|
|
87
94
|
estimatedPrice: string;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
}
|
|
96
|
+
type WithBoostQuote<T> = Omit<T, 'boostQuote'> & BoostedQuoteDetails;
|
|
97
|
+
interface RegularQuote extends BaseQuoteDetails {
|
|
98
|
+
type: 'REGULAR';
|
|
99
|
+
boostQuote?: WithBoostQuote<RegularQuote>;
|
|
100
|
+
}
|
|
101
|
+
interface DCAQuote extends BaseQuoteDetails {
|
|
102
|
+
type: 'DCA';
|
|
103
|
+
dcaParams: DcaParams;
|
|
104
|
+
boostQuote?: WithBoostQuote<DCAQuote>;
|
|
105
|
+
}
|
|
106
|
+
type Quote = RegularQuote | DCAQuote;
|
|
107
|
+
type DCABoostQuote = NonNullable<DCAQuote['boostQuote']>;
|
|
108
|
+
type RegularBoostQuote = NonNullable<RegularQuote['boostQuote']>;
|
|
109
|
+
type BoostQuote = RegularBoostQuote | DCABoostQuote;
|
|
110
|
+
type FillOrKillParamsWithSlippage$1 = Omit<FillOrKillParamsX128, 'minPriceX128'> & {
|
|
111
|
+
slippageTolerancePercent: string | number;
|
|
99
112
|
};
|
|
100
113
|
|
|
101
114
|
interface ExecuteSwapParams {
|
|
@@ -144,17 +157,20 @@ interface QuoteRequest extends ChainsAndAssets {
|
|
|
144
157
|
affiliateBrokers?: AffiliateBroker[];
|
|
145
158
|
}
|
|
146
159
|
interface QuoteResponse extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers'> {
|
|
147
|
-
quote:
|
|
160
|
+
quote: Quote;
|
|
148
161
|
}
|
|
149
162
|
interface QuoteResponseV2 extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers'> {
|
|
150
|
-
quotes:
|
|
163
|
+
quotes: Quote[];
|
|
151
164
|
}
|
|
165
|
+
type FillOrKillParamsWithSlippage = Omit<FillOrKillParamsWithMinPrice, 'minPrice'> & {
|
|
166
|
+
slippageTolerancePercent: string | number;
|
|
167
|
+
};
|
|
152
168
|
interface DepositAddressRequest extends QuoteRequest {
|
|
153
169
|
destAddress: string;
|
|
154
170
|
ccmParams?: CcmParams;
|
|
155
171
|
maxBoostFeeBps?: number;
|
|
156
172
|
srcAddress?: string;
|
|
157
|
-
fillOrKillParams?:
|
|
173
|
+
fillOrKillParams?: FillOrKillParamsWithMinPrice;
|
|
158
174
|
dcaParams?: DcaParams;
|
|
159
175
|
ccmMetadata?: CcmParams;
|
|
160
176
|
}
|
|
@@ -180,6 +196,7 @@ interface SwapStatusResponseCommonFields$1 extends ChainsAndAssets {
|
|
|
180
196
|
depositTransactionRef: string | undefined;
|
|
181
197
|
swapScheduledAt: number | undefined;
|
|
182
198
|
swapScheduledBlockIndex: string | undefined;
|
|
199
|
+
lastStatechainUpdateAt: number | undefined;
|
|
183
200
|
depositTransactionHash: string | undefined;
|
|
184
201
|
ccmMetadata?: CcmParams;
|
|
185
202
|
}
|
|
@@ -200,7 +217,7 @@ interface DepositAddressFields extends SwapStatusResponseCommonFields$1 {
|
|
|
200
217
|
effectiveBoostFeeBps?: number;
|
|
201
218
|
boostSkippedAt?: number;
|
|
202
219
|
boostSkippedBlockIndex?: string;
|
|
203
|
-
fillOrKillParams:
|
|
220
|
+
fillOrKillParams: FillOrKillParamsWithMinPrice;
|
|
204
221
|
}
|
|
205
222
|
type EgressScheduled = {
|
|
206
223
|
swapId: string;
|
|
@@ -370,7 +387,7 @@ interface DepositChannelFields {
|
|
|
370
387
|
isExpired: boolean;
|
|
371
388
|
openedThroughBackend: boolean;
|
|
372
389
|
affiliateBrokers: AffiliateBroker[];
|
|
373
|
-
fillOrKillParams:
|
|
390
|
+
fillOrKillParams: FillOrKillParamsWithMinPrice | undefined;
|
|
374
391
|
dcaParams: DcaParams | undefined;
|
|
375
392
|
}
|
|
376
393
|
interface DepositFields {
|
|
@@ -430,6 +447,7 @@ interface SwapStatusResponseCommonFields extends ChainsAndAssets {
|
|
|
430
447
|
estimatedDurationSeconds: number | null | undefined;
|
|
431
448
|
srcChainRequiredBlockConfirmations: number | null;
|
|
432
449
|
fees: PaidFee[];
|
|
450
|
+
lastStatechainUpdateAt: number | undefined;
|
|
433
451
|
}
|
|
434
452
|
interface Waiting extends SwapStatusResponseCommonFields {
|
|
435
453
|
depositChannel: DepositChannelFields;
|
|
@@ -461,6 +479,18 @@ type SwapStatusResponseV2 = ({
|
|
|
461
479
|
state: 'FAILED';
|
|
462
480
|
} & Sending);
|
|
463
481
|
|
|
482
|
+
interface DepositAddressRequestV2 {
|
|
483
|
+
quote: Quote | BoostQuote;
|
|
484
|
+
destAddress: string;
|
|
485
|
+
fillOrKillParams?: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1;
|
|
486
|
+
affiliateBrokers?: {
|
|
487
|
+
account: `cF${string}` | `0x${string}`;
|
|
488
|
+
commissionBps: number;
|
|
489
|
+
}[];
|
|
490
|
+
ccmParams?: CcmParams;
|
|
491
|
+
brokerCommissionBps?: number;
|
|
492
|
+
}
|
|
493
|
+
|
|
464
494
|
type RequestOptions = {
|
|
465
495
|
signal?: AbortSignal;
|
|
466
496
|
};
|
|
@@ -517,6 +547,36 @@ declare class SwapSDK {
|
|
|
517
547
|
asset: Asset;
|
|
518
548
|
chain: Chain;
|
|
519
549
|
}): Promise<BoostPoolDepth[]>;
|
|
550
|
+
requestDepositAddressV2({ quote, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): Promise<{
|
|
551
|
+
depositChannelId: string;
|
|
552
|
+
depositAddress: string;
|
|
553
|
+
brokerCommissionBps: number;
|
|
554
|
+
affiliateBrokers: {
|
|
555
|
+
account: `cF${string}` | `0x${string}`;
|
|
556
|
+
commissionBps: number;
|
|
557
|
+
}[];
|
|
558
|
+
maxBoostFeeBps: number;
|
|
559
|
+
depositChannelExpiryBlock: bigint;
|
|
560
|
+
estimatedDepositChannelExpiryTime: number | undefined;
|
|
561
|
+
channelOpeningFee: bigint;
|
|
562
|
+
fillOrKillParams: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1 | undefined;
|
|
563
|
+
srcAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
|
|
564
|
+
srcChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana";
|
|
565
|
+
destAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
|
|
566
|
+
destChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana";
|
|
567
|
+
destAddress: string;
|
|
568
|
+
dcaParams: {
|
|
569
|
+
numberOfChunks: number;
|
|
570
|
+
chunkIntervalBlocks: number;
|
|
571
|
+
} | undefined;
|
|
572
|
+
ccmParams: {
|
|
573
|
+
message: string;
|
|
574
|
+
gasBudget: string;
|
|
575
|
+
cfParameters?: string | undefined;
|
|
576
|
+
} | undefined;
|
|
577
|
+
amount: string;
|
|
578
|
+
}>;
|
|
579
|
+
buildRequestSwapDepositAddressWithAffiliatesParams({ quote, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): SwappingRequestSwapDepositAddressWithAffiliates;
|
|
520
580
|
}
|
|
521
581
|
|
|
522
|
-
export { Asset, type AssetData, type BoostPoolDepth, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DepositAddressRequest, type DepositAddressResponse, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type QuoteRequest, type QuoteResponse, type QuoteResponseV2, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type SwapStatusResponseV2, type VaultSwapStatusResponse };
|
|
582
|
+
export { Asset, type AssetData, type BoostPoolDepth, type BoostQuote, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DCABoostQuote, type DCAQuote, type DepositAddressRequest, type DepositAddressRequestV2, type DepositAddressResponse, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type FillOrKillParamsWithSlippage, type Quote, type QuoteRequest, type QuoteResponse, type QuoteResponseV2, type RegularQuote, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type SwapStatusResponseV2, type VaultSwapStatusResponse };
|