@chainflip/sdk 1.8.4-beta.0 → 1.9.0-beta.1
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-6IYYRTHK.js +106 -0
- package/dist/{funding.mjs → funding.cjs} +73 -8
- package/dist/{funding.d.mts → funding.d.cts} +1 -1
- package/dist/funding.d.ts +1 -1
- package/dist/funding.js +8 -89
- package/dist/{swap.mjs → swap.cjs} +396 -451
- package/dist/{swap.d.mts → swap.d.cts} +326 -206
- package/dist/swap.d.ts +326 -206
- package/dist/swap.js +249 -763
- package/package.json +24 -23
- package/dist/chunk-HBQFFIRA.mjs +0 -292
- package/dist/enums-_AFEOA70.d.mts +0 -69
- package/dist/enums-_AFEOA70.d.ts +0 -69
package/dist/swap.d.ts
CHANGED
|
@@ -1,7 +1,265 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as _chainflip_utils_chainflip from '@chainflip/utils/chainflip';
|
|
2
|
+
import { AssetAndChain, UncheckedAssetAndChain, ChainflipChain, ChainflipAsset, AssetOfChain, AssetSymbol, ChainflipNetwork, ChainAssetMap, ChainMap } from '@chainflip/utils/chainflip';
|
|
3
|
+
export { AssetSymbol as Asset, ChainflipChain as Chain, ChainflipAsset as ChainflipId, ChainflipNetwork, UncheckedAssetAndChain, getInternalAsset as getChainflipId } from '@chainflip/utils/chainflip';
|
|
4
|
+
import * as _trpc_server from '@trpc/server';
|
|
5
|
+
import { inferRouterOutputs } from '@trpc/server';
|
|
6
|
+
import superjson from 'superjson';
|
|
3
7
|
import { z } from 'zod';
|
|
4
8
|
|
|
9
|
+
declare const appRouter: _trpc_server.CreateRouterInner<_trpc_server.RootConfig<{
|
|
10
|
+
ctx: object;
|
|
11
|
+
meta: object;
|
|
12
|
+
errorShape: _trpc_server.DefaultErrorShape;
|
|
13
|
+
transformer: typeof superjson;
|
|
14
|
+
}>, {
|
|
15
|
+
openSwapDepositChannel: _trpc_server.BuildProcedure<"mutation", {
|
|
16
|
+
_config: _trpc_server.RootConfig<{
|
|
17
|
+
ctx: object;
|
|
18
|
+
meta: object;
|
|
19
|
+
errorShape: _trpc_server.DefaultErrorShape;
|
|
20
|
+
transformer: typeof superjson;
|
|
21
|
+
}>;
|
|
22
|
+
_meta: object;
|
|
23
|
+
_ctx_out: object;
|
|
24
|
+
_input_in: {
|
|
25
|
+
srcChain: "Ethereum" | "Arbitrum" | "Bitcoin" | "Polkadot" | "Solana" | "Assethub";
|
|
26
|
+
srcAsset: "USDC" | "USDT" | "FLIP" | "DOT" | "ETH" | "BTC" | "SOL";
|
|
27
|
+
destChain: "Ethereum" | "Arbitrum" | "Bitcoin" | "Polkadot" | "Solana" | "Assethub";
|
|
28
|
+
destAsset: "USDC" | "USDT" | "FLIP" | "DOT" | "ETH" | "BTC" | "SOL";
|
|
29
|
+
amount: string;
|
|
30
|
+
destAddress: string;
|
|
31
|
+
fillOrKillParams: {
|
|
32
|
+
retryDurationBlocks: number;
|
|
33
|
+
refundAddress: string;
|
|
34
|
+
minPriceX128: string;
|
|
35
|
+
};
|
|
36
|
+
ccmParams?: {
|
|
37
|
+
message: string;
|
|
38
|
+
gasBudget: string;
|
|
39
|
+
ccmAdditionalData?: string | undefined;
|
|
40
|
+
cfParameters?: string | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
dcaParams?: {
|
|
43
|
+
numberOfChunks: number;
|
|
44
|
+
chunkIntervalBlocks: number;
|
|
45
|
+
} | undefined;
|
|
46
|
+
maxBoostFeeBps?: number | undefined;
|
|
47
|
+
srcAddress?: string | undefined;
|
|
48
|
+
quote?: {
|
|
49
|
+
egressAmount: string;
|
|
50
|
+
estimatedPrice: string;
|
|
51
|
+
intermediateAmount?: string | undefined;
|
|
52
|
+
recommendedSlippageTolerancePercent?: number | undefined;
|
|
53
|
+
} | undefined;
|
|
54
|
+
};
|
|
55
|
+
_input_out: {
|
|
56
|
+
expectedDepositAmount: string;
|
|
57
|
+
srcChain: "Ethereum" | "Arbitrum" | "Bitcoin" | "Polkadot" | "Solana" | "Assethub";
|
|
58
|
+
srcAsset: "USDC" | "USDT" | "FLIP" | "DOT" | "ETH" | "BTC" | "SOL";
|
|
59
|
+
destChain: "Ethereum" | "Arbitrum" | "Bitcoin" | "Polkadot" | "Solana" | "Assethub";
|
|
60
|
+
destAsset: "USDC" | "USDT" | "FLIP" | "DOT" | "ETH" | "BTC" | "SOL";
|
|
61
|
+
destAddress: string;
|
|
62
|
+
fillOrKillParams: {
|
|
63
|
+
retryDurationBlocks: number;
|
|
64
|
+
refundAddress: string;
|
|
65
|
+
minPriceX128: string;
|
|
66
|
+
};
|
|
67
|
+
ccmParams?: {
|
|
68
|
+
gasBudget: `0x${string}`;
|
|
69
|
+
message: `0x${string}`;
|
|
70
|
+
ccmAdditionalData: `0x${string}` | undefined;
|
|
71
|
+
} | undefined;
|
|
72
|
+
dcaParams?: {
|
|
73
|
+
numberOfChunks: number;
|
|
74
|
+
chunkIntervalBlocks: number;
|
|
75
|
+
} | undefined;
|
|
76
|
+
maxBoostFeeBps?: number | undefined;
|
|
77
|
+
srcAddress?: string | undefined;
|
|
78
|
+
quote?: {
|
|
79
|
+
egressAmount: string;
|
|
80
|
+
estimatedPrice: string;
|
|
81
|
+
intermediateAmount?: string | undefined;
|
|
82
|
+
recommendedSlippageTolerancePercent?: number | undefined;
|
|
83
|
+
} | undefined;
|
|
84
|
+
};
|
|
85
|
+
_output_in: typeof _trpc_server.unsetMarker;
|
|
86
|
+
_output_out: typeof _trpc_server.unsetMarker;
|
|
87
|
+
}, {
|
|
88
|
+
id: string;
|
|
89
|
+
depositAddress: string;
|
|
90
|
+
brokerCommissionBps: number;
|
|
91
|
+
maxBoostFeeBps: number;
|
|
92
|
+
issuedBlock: number;
|
|
93
|
+
srcChainExpiryBlock: bigint;
|
|
94
|
+
estimatedExpiryTime: number | undefined;
|
|
95
|
+
channelOpeningFee: bigint;
|
|
96
|
+
}>;
|
|
97
|
+
encodeVaultSwapData: _trpc_server.BuildProcedure<"mutation", {
|
|
98
|
+
_config: _trpc_server.RootConfig<{
|
|
99
|
+
ctx: object;
|
|
100
|
+
meta: object;
|
|
101
|
+
errorShape: _trpc_server.DefaultErrorShape;
|
|
102
|
+
transformer: typeof superjson;
|
|
103
|
+
}>;
|
|
104
|
+
_meta: object;
|
|
105
|
+
_ctx_out: object;
|
|
106
|
+
_input_in: {
|
|
107
|
+
srcAsset: {
|
|
108
|
+
asset: string;
|
|
109
|
+
chain: string;
|
|
110
|
+
};
|
|
111
|
+
destAsset: {
|
|
112
|
+
asset: string;
|
|
113
|
+
chain: string;
|
|
114
|
+
};
|
|
115
|
+
amount: string | number;
|
|
116
|
+
destAddress: string;
|
|
117
|
+
fillOrKillParams: {
|
|
118
|
+
retryDurationBlocks: number;
|
|
119
|
+
refundAddress: string;
|
|
120
|
+
minPriceX128: string;
|
|
121
|
+
};
|
|
122
|
+
ccmParams?: {
|
|
123
|
+
message: string;
|
|
124
|
+
gasBudget: string;
|
|
125
|
+
ccmAdditionalData?: string | undefined;
|
|
126
|
+
cfParameters?: string | undefined;
|
|
127
|
+
} | undefined;
|
|
128
|
+
commissionBps?: number | undefined;
|
|
129
|
+
dcaParams?: {
|
|
130
|
+
numberOfChunks: number;
|
|
131
|
+
chunkIntervalBlocks: number;
|
|
132
|
+
} | undefined;
|
|
133
|
+
maxBoostFeeBps?: number | undefined;
|
|
134
|
+
affiliates?: {
|
|
135
|
+
account: string;
|
|
136
|
+
commissionBps: number;
|
|
137
|
+
}[] | undefined;
|
|
138
|
+
srcAddress?: string | undefined;
|
|
139
|
+
extraParams?: {
|
|
140
|
+
solanaDataAccount?: string | undefined;
|
|
141
|
+
} | undefined;
|
|
142
|
+
} & {
|
|
143
|
+
brokerCommissionBps?: number | undefined;
|
|
144
|
+
brokerAccount?: string | undefined;
|
|
145
|
+
};
|
|
146
|
+
_input_out: {
|
|
147
|
+
extraParams: {
|
|
148
|
+
readonly chain: "Bitcoin";
|
|
149
|
+
readonly min_output_amount: `0x${string}`;
|
|
150
|
+
readonly retry_duration: number;
|
|
151
|
+
readonly input_amount?: undefined;
|
|
152
|
+
readonly refund_parameters?: undefined;
|
|
153
|
+
readonly from?: undefined;
|
|
154
|
+
readonly event_data_account?: undefined;
|
|
155
|
+
} | {
|
|
156
|
+
readonly chain: "Ethereum" | "Arbitrum";
|
|
157
|
+
readonly input_amount: `0x${string}`;
|
|
158
|
+
readonly refund_parameters: {
|
|
159
|
+
retry_duration: number;
|
|
160
|
+
refund_address: string;
|
|
161
|
+
min_price: `0x${string}`;
|
|
162
|
+
};
|
|
163
|
+
readonly min_output_amount?: undefined;
|
|
164
|
+
readonly retry_duration?: undefined;
|
|
165
|
+
readonly from?: undefined;
|
|
166
|
+
readonly event_data_account?: undefined;
|
|
167
|
+
} | {
|
|
168
|
+
readonly chain: "Solana";
|
|
169
|
+
readonly from: string;
|
|
170
|
+
readonly event_data_account: string;
|
|
171
|
+
readonly input_amount: `0x${string}`;
|
|
172
|
+
readonly refund_parameters: {
|
|
173
|
+
retry_duration: number;
|
|
174
|
+
refund_address: string;
|
|
175
|
+
min_price: `0x${string}`;
|
|
176
|
+
};
|
|
177
|
+
readonly min_output_amount?: undefined;
|
|
178
|
+
readonly retry_duration?: undefined;
|
|
179
|
+
};
|
|
180
|
+
srcAsset: _chainflip_utils_chainflip.AssetAndChain;
|
|
181
|
+
destAsset: _chainflip_utils_chainflip.AssetAndChain;
|
|
182
|
+
amount: bigint;
|
|
183
|
+
commissionBps: number;
|
|
184
|
+
destAddress: string;
|
|
185
|
+
fillOrKillParams: {
|
|
186
|
+
retry_duration: number;
|
|
187
|
+
refund_address: string;
|
|
188
|
+
min_price: `0x${string}`;
|
|
189
|
+
};
|
|
190
|
+
ccmParams?: {
|
|
191
|
+
message: `0x${string}`;
|
|
192
|
+
gas_budget: `0x${string}`;
|
|
193
|
+
ccm_additional_data: `0x${string}` | undefined;
|
|
194
|
+
cf_parameters: `0x${string}` | undefined;
|
|
195
|
+
} | undefined;
|
|
196
|
+
dcaParams?: {
|
|
197
|
+
number_of_chunks: number;
|
|
198
|
+
chunk_interval: number;
|
|
199
|
+
} | undefined;
|
|
200
|
+
maxBoostFeeBps?: number | undefined;
|
|
201
|
+
affiliates?: {
|
|
202
|
+
account: string;
|
|
203
|
+
bps: number;
|
|
204
|
+
}[] | undefined;
|
|
205
|
+
srcAddress?: string | undefined;
|
|
206
|
+
} & {
|
|
207
|
+
brokerCommissionBps?: number | undefined;
|
|
208
|
+
brokerAccount?: string | undefined;
|
|
209
|
+
};
|
|
210
|
+
_output_in: typeof _trpc_server.unsetMarker;
|
|
211
|
+
_output_out: typeof _trpc_server.unsetMarker;
|
|
212
|
+
}, {
|
|
213
|
+
chain: "Bitcoin";
|
|
214
|
+
nulldataPayload: `0x${string}`;
|
|
215
|
+
depositAddress: string;
|
|
216
|
+
} | {
|
|
217
|
+
value: bigint;
|
|
218
|
+
chain: "Ethereum";
|
|
219
|
+
to: `0x${string}`;
|
|
220
|
+
calldata: `0x${string}`;
|
|
221
|
+
sourceTokenAddress?: `0x${string}` | undefined;
|
|
222
|
+
} | {
|
|
223
|
+
value: bigint;
|
|
224
|
+
chain: "Arbitrum";
|
|
225
|
+
to: `0x${string}`;
|
|
226
|
+
calldata: `0x${string}`;
|
|
227
|
+
sourceTokenAddress?: `0x${string}` | undefined;
|
|
228
|
+
} | {
|
|
229
|
+
chain: "Solana";
|
|
230
|
+
programId: string;
|
|
231
|
+
data: `0x${string}`;
|
|
232
|
+
accounts: {
|
|
233
|
+
pubkey: string;
|
|
234
|
+
isSigner: boolean;
|
|
235
|
+
isWritable: boolean;
|
|
236
|
+
}[];
|
|
237
|
+
}>;
|
|
238
|
+
networkStatus: _trpc_server.BuildProcedure<"query", {
|
|
239
|
+
_config: _trpc_server.RootConfig<{
|
|
240
|
+
ctx: object;
|
|
241
|
+
meta: object;
|
|
242
|
+
errorShape: _trpc_server.DefaultErrorShape;
|
|
243
|
+
transformer: typeof superjson;
|
|
244
|
+
}>;
|
|
245
|
+
_ctx_out: object;
|
|
246
|
+
_input_in: typeof _trpc_server.unsetMarker;
|
|
247
|
+
_input_out: typeof _trpc_server.unsetMarker;
|
|
248
|
+
_output_in: typeof _trpc_server.unsetMarker;
|
|
249
|
+
_output_out: typeof _trpc_server.unsetMarker;
|
|
250
|
+
_meta: object;
|
|
251
|
+
}, {
|
|
252
|
+
assets: {
|
|
253
|
+
deposit: _chainflip_utils_chainflip.ChainflipAsset[];
|
|
254
|
+
destination: _chainflip_utils_chainflip.ChainflipAsset[];
|
|
255
|
+
all: _chainflip_utils_chainflip.ChainflipAsset[];
|
|
256
|
+
};
|
|
257
|
+
boostDepositsEnabled: boolean;
|
|
258
|
+
cfBrokerCommissionBps: number;
|
|
259
|
+
}>;
|
|
260
|
+
}>;
|
|
261
|
+
type AppRouter = typeof appRouter;
|
|
262
|
+
|
|
5
263
|
declare const ccmParamsSchema: z.ZodEffects<z.ZodObject<{
|
|
6
264
|
gasBudget: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, `0x${string}`, string>]>, `0x${string}`, string>;
|
|
7
265
|
message: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
@@ -75,12 +333,10 @@ type FillOrKillParamsX128 = z.input<typeof fillOrKillParams>;
|
|
|
75
333
|
type FillOrKillParamsWithMinPrice = Omit<FillOrKillParamsX128, 'minPriceX128'> & {
|
|
76
334
|
minPrice: string;
|
|
77
335
|
};
|
|
78
|
-
|
|
336
|
+
interface Fee<T> extends UncheckedAssetAndChain {
|
|
79
337
|
type: T;
|
|
80
|
-
chain: Chain;
|
|
81
|
-
asset: Asset;
|
|
82
338
|
amount: string;
|
|
83
|
-
}
|
|
339
|
+
}
|
|
84
340
|
type SwapFee = Fee<'NETWORK' | 'INGRESS' | 'EGRESS' | 'BROKER' | 'BOOST'>;
|
|
85
341
|
type PoolFee = Fee<'LIQUIDITY'>;
|
|
86
342
|
type PaidFee = SwapFee | PoolFee;
|
|
@@ -135,7 +391,7 @@ type FillOrKillParamsWithSlippage$1 = Omit<FillOrKillParamsX128, 'minPriceX128'>
|
|
|
135
391
|
};
|
|
136
392
|
|
|
137
393
|
interface ChainData {
|
|
138
|
-
chain:
|
|
394
|
+
chain: ChainflipChain;
|
|
139
395
|
name: string;
|
|
140
396
|
evmChainId: number | undefined;
|
|
141
397
|
isMainnet: boolean;
|
|
@@ -143,25 +399,25 @@ interface ChainData {
|
|
|
143
399
|
maxRetryDurationBlocks: number | undefined;
|
|
144
400
|
}
|
|
145
401
|
type AssetData = {
|
|
146
|
-
[C in
|
|
147
|
-
chainflipId:
|
|
402
|
+
[C in ChainflipChain]: {
|
|
403
|
+
chainflipId: ChainflipAsset;
|
|
148
404
|
asset: AssetOfChain<C>;
|
|
149
405
|
chain: C;
|
|
150
406
|
contractAddress: string | undefined;
|
|
151
407
|
decimals: number;
|
|
152
408
|
name: string;
|
|
153
|
-
symbol:
|
|
409
|
+
symbol: AssetSymbol;
|
|
154
410
|
isMainnet: boolean;
|
|
155
411
|
minimumSwapAmount: string;
|
|
156
412
|
maximumSwapAmount: string | null;
|
|
157
413
|
minimumEgressAmount: string;
|
|
158
414
|
};
|
|
159
|
-
}[
|
|
415
|
+
}[ChainflipChain];
|
|
160
416
|
interface ChainsAndAssets {
|
|
161
|
-
srcChain:
|
|
162
|
-
srcAsset:
|
|
163
|
-
destChain:
|
|
164
|
-
destAsset:
|
|
417
|
+
srcChain: ChainflipChain;
|
|
418
|
+
srcAsset: AssetSymbol;
|
|
419
|
+
destChain: ChainflipChain;
|
|
420
|
+
destAsset: AssetSymbol;
|
|
165
421
|
}
|
|
166
422
|
interface QuoteRequest extends ChainsAndAssets {
|
|
167
423
|
amount: string;
|
|
@@ -173,196 +429,20 @@ interface QuoteRequest extends ChainsAndAssets {
|
|
|
173
429
|
messageLengthBytes: number;
|
|
174
430
|
};
|
|
175
431
|
}
|
|
176
|
-
interface QuoteResponse extends QuoteRequest {
|
|
177
|
-
quote: Quote;
|
|
178
|
-
}
|
|
179
432
|
interface QuoteResponseV2 extends QuoteRequest {
|
|
180
433
|
quotes: Quote[];
|
|
181
434
|
}
|
|
182
435
|
type FillOrKillParamsWithSlippage = Omit<FillOrKillParamsWithMinPrice, 'minPrice'> & {
|
|
183
436
|
slippageTolerancePercent: string | number;
|
|
184
437
|
};
|
|
185
|
-
interface DepositAddressRequest extends Omit<QuoteRequest, 'ccmParams'> {
|
|
186
|
-
destAddress: string;
|
|
187
|
-
ccmParams?: CcmParams;
|
|
188
|
-
maxBoostFeeBps?: number;
|
|
189
|
-
srcAddress?: string;
|
|
190
|
-
fillOrKillParams: FillOrKillParamsWithMinPrice;
|
|
191
|
-
dcaParams?: DcaParams;
|
|
192
|
-
}
|
|
193
|
-
interface DepositAddressResponse extends DepositAddressRequest {
|
|
194
|
-
depositChannelId: string;
|
|
195
|
-
depositAddress: string;
|
|
196
|
-
brokerCommissionBps: number;
|
|
197
|
-
affiliateBrokers: AffiliateBroker[];
|
|
198
|
-
depositChannelExpiryBlock: bigint;
|
|
199
|
-
estimatedDepositChannelExpiryTime: number | undefined;
|
|
200
|
-
channelOpeningFee: bigint;
|
|
201
|
-
}
|
|
202
438
|
interface SwapStatusRequest {
|
|
203
439
|
id: string;
|
|
204
440
|
}
|
|
205
|
-
interface SwapStatusResponseCommonFields$1 extends ChainsAndAssets {
|
|
206
|
-
destAddress: string;
|
|
207
|
-
ccmParams: CcmParams | undefined;
|
|
208
|
-
feesPaid: SwapFee[];
|
|
209
|
-
estimatedDefaultDurationSeconds: number | undefined;
|
|
210
|
-
srcChainRequiredBlockConfirmations: number | undefined;
|
|
211
|
-
depositTransactionRef: string | undefined;
|
|
212
|
-
swapScheduledAt: number | undefined;
|
|
213
|
-
swapScheduledBlockIndex: string | undefined;
|
|
214
|
-
lastStatechainUpdateAt: number | undefined;
|
|
215
|
-
}
|
|
216
|
-
interface DepositAddressFields extends SwapStatusResponseCommonFields$1 {
|
|
217
|
-
depositAddress: string;
|
|
218
|
-
depositChannelCreatedAt: number;
|
|
219
|
-
depositChannelBrokerCommissionBps: number;
|
|
220
|
-
expectedDepositAmount: string | undefined;
|
|
221
|
-
depositChannelExpiryBlock: string;
|
|
222
|
-
estimatedDepositChannelExpiryTime: number;
|
|
223
|
-
isDepositChannelExpired: boolean;
|
|
224
|
-
depositChannelOpenedThroughBackend: boolean;
|
|
225
|
-
depositChannelAffiliateBrokers?: {
|
|
226
|
-
account: string;
|
|
227
|
-
commissionBps: number;
|
|
228
|
-
}[];
|
|
229
|
-
depositChannelMaxBoostFeeBps: number;
|
|
230
|
-
effectiveBoostFeeBps?: number;
|
|
231
|
-
boostSkippedAt?: number;
|
|
232
|
-
boostSkippedBlockIndex?: string;
|
|
233
|
-
fillOrKillParams: FillOrKillParamsWithMinPrice;
|
|
234
|
-
}
|
|
235
|
-
type EgressScheduled = {
|
|
236
|
-
swapId: string;
|
|
237
|
-
depositAmount: string;
|
|
238
|
-
depositReceivedAt: number;
|
|
239
|
-
depositReceivedBlockIndex: string;
|
|
240
|
-
egressAmount: string;
|
|
241
|
-
egressScheduledAt: number;
|
|
242
|
-
egressScheduledBlockIndex: string;
|
|
243
|
-
} & ({
|
|
244
|
-
egressType: 'SWAP';
|
|
245
|
-
intermediateAmount: string | undefined;
|
|
246
|
-
swapExecutedAt: number;
|
|
247
|
-
swapExecutedBlockIndex: string;
|
|
248
|
-
} | {
|
|
249
|
-
egressType: 'REFUND';
|
|
250
|
-
});
|
|
251
|
-
type CopyFields<T, U> = {
|
|
252
|
-
[K in Exclude<keyof T, keyof U>]: undefined;
|
|
253
|
-
} & U;
|
|
254
|
-
type VaultSwapFields = CopyFields<DepositAddressFields, SwapStatusResponseCommonFields$1>;
|
|
255
|
-
type FailedVaultSwapStatusResponse = CopyFields<DepositAddressFields, {
|
|
256
|
-
depositAmount: string;
|
|
257
|
-
destAddress: string;
|
|
258
|
-
error: {
|
|
259
|
-
message: string;
|
|
260
|
-
name: string;
|
|
261
|
-
};
|
|
262
|
-
failedAt: number;
|
|
263
|
-
failedBlockIndex: string;
|
|
264
|
-
failure: string;
|
|
265
|
-
feesPaid: [];
|
|
266
|
-
srcAsset: Asset;
|
|
267
|
-
srcChain: Chain;
|
|
268
|
-
state: 'FAILED';
|
|
269
|
-
depositAddress: undefined;
|
|
270
|
-
}>;
|
|
271
|
-
type SwapState = {
|
|
272
|
-
state: 'AWAITING_DEPOSIT';
|
|
273
|
-
depositAmount: string | undefined;
|
|
274
|
-
depositTransactionConfirmations: number | undefined;
|
|
275
|
-
} | {
|
|
276
|
-
state: 'DEPOSIT_RECEIVED';
|
|
277
|
-
swapId: string;
|
|
278
|
-
depositAmount: string;
|
|
279
|
-
depositReceivedAt: number;
|
|
280
|
-
depositReceivedBlockIndex: string;
|
|
281
|
-
depositBoostedAt?: number;
|
|
282
|
-
depositBoostedBlockIndex?: string;
|
|
283
|
-
} | {
|
|
284
|
-
state: 'SWAP_EXECUTED';
|
|
285
|
-
swapId: string;
|
|
286
|
-
depositAmount: string;
|
|
287
|
-
depositReceivedAt: number;
|
|
288
|
-
depositReceivedBlockIndex: string;
|
|
289
|
-
intermediateAmount: string | undefined;
|
|
290
|
-
swapExecutedAt: number;
|
|
291
|
-
swapExecutedBlockIndex: string;
|
|
292
|
-
} | ({
|
|
293
|
-
state: 'EGRESS_SCHEDULED';
|
|
294
|
-
} & EgressScheduled) | ({
|
|
295
|
-
state: 'BROADCAST_REQUESTED';
|
|
296
|
-
broadcastRequestedAt: number;
|
|
297
|
-
broadcastRequestedBlockIndex: string;
|
|
298
|
-
} & EgressScheduled) | ({
|
|
299
|
-
state: 'BROADCASTED';
|
|
300
|
-
broadcastRequestedAt: number;
|
|
301
|
-
broadcastRequestedBlockIndex: string;
|
|
302
|
-
broadcastTransactionRef: string;
|
|
303
|
-
} & EgressScheduled) | ({
|
|
304
|
-
state: 'COMPLETE';
|
|
305
|
-
broadcastRequestedAt: number;
|
|
306
|
-
broadcastRequestedBlockIndex: string;
|
|
307
|
-
broadcastTransactionRef: string;
|
|
308
|
-
broadcastSucceededAt: number;
|
|
309
|
-
broadcastSucceededBlockIndex: string;
|
|
310
|
-
} & EgressScheduled) | ({
|
|
311
|
-
state: 'BROADCAST_ABORTED';
|
|
312
|
-
broadcastRequestedAt: number;
|
|
313
|
-
broadcastRequestedBlockIndex: string;
|
|
314
|
-
broadcastAbortedAt: number;
|
|
315
|
-
broadcastAbortedBlockIndex: string;
|
|
316
|
-
} & EgressScheduled) | {
|
|
317
|
-
state: 'FAILED';
|
|
318
|
-
failure: 'INGRESS_IGNORED';
|
|
319
|
-
error: {
|
|
320
|
-
name: string;
|
|
321
|
-
message: string;
|
|
322
|
-
};
|
|
323
|
-
depositAmount: string;
|
|
324
|
-
failedAt: number;
|
|
325
|
-
failedBlockIndex: string;
|
|
326
|
-
} | {
|
|
327
|
-
state: 'FAILED';
|
|
328
|
-
failure: 'EGRESS_IGNORED';
|
|
329
|
-
error: {
|
|
330
|
-
name: string;
|
|
331
|
-
message: string;
|
|
332
|
-
};
|
|
333
|
-
swapId: string;
|
|
334
|
-
depositAmount: string;
|
|
335
|
-
depositReceivedAt: number;
|
|
336
|
-
depositReceivedBlockIndex: string;
|
|
337
|
-
intermediateAmount: string | undefined;
|
|
338
|
-
swapExecutedAt: number;
|
|
339
|
-
swapExecutedBlockIndex: string;
|
|
340
|
-
ignoredEgressAmount: string;
|
|
341
|
-
egressIgnoredAt: number;
|
|
342
|
-
egressIgnoredBlockIndex: string;
|
|
343
|
-
} | {
|
|
344
|
-
state: 'FAILED';
|
|
345
|
-
failure: 'REFUND_EGRESS_IGNORED';
|
|
346
|
-
error: {
|
|
347
|
-
name: string;
|
|
348
|
-
message: string;
|
|
349
|
-
};
|
|
350
|
-
swapId: string;
|
|
351
|
-
depositAmount: string;
|
|
352
|
-
depositReceivedAt: number;
|
|
353
|
-
depositReceivedBlockIndex: string;
|
|
354
|
-
ignoredEgressAmount: string;
|
|
355
|
-
egressIgnoredAt: number;
|
|
356
|
-
egressIgnoredBlockIndex: string;
|
|
357
|
-
};
|
|
358
|
-
type DepositAddressStatusResponse = DepositAddressFields & SwapState;
|
|
359
|
-
type VaultSwapStatusResponse = VaultSwapFields & SwapState;
|
|
360
|
-
type SwapStatusResponse = DepositAddressStatusResponse | VaultSwapStatusResponse | FailedVaultSwapStatusResponse;
|
|
361
441
|
type BoostPoolDepth = {
|
|
362
442
|
feeTierBps: number;
|
|
363
443
|
availableAmount: bigint;
|
|
364
|
-
asset:
|
|
365
|
-
chain:
|
|
444
|
+
asset: AssetSymbol;
|
|
445
|
+
chain: ChainflipChain;
|
|
366
446
|
};
|
|
367
447
|
|
|
368
448
|
interface Failure {
|
|
@@ -515,7 +595,12 @@ interface DepositAddressRequestV2 {
|
|
|
515
595
|
ccmParams?: CcmParams;
|
|
516
596
|
brokerCommissionBps?: number;
|
|
517
597
|
}
|
|
518
|
-
interface DepositAddressResponseV2 extends Omit<
|
|
598
|
+
interface DepositAddressResponseV2 extends Omit<QuoteRequest, 'ccmParams'> {
|
|
599
|
+
destAddress: string;
|
|
600
|
+
ccmParams?: CcmParams;
|
|
601
|
+
maxBoostFeeBps?: number;
|
|
602
|
+
srcAddress?: string;
|
|
603
|
+
dcaParams?: DcaParams;
|
|
519
604
|
fillOrKillParams: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1;
|
|
520
605
|
depositChannelId: string;
|
|
521
606
|
depositAddress: string;
|
|
@@ -578,23 +663,20 @@ type SwapSDKOptions = {
|
|
|
578
663
|
dca?: boolean;
|
|
579
664
|
};
|
|
580
665
|
};
|
|
666
|
+
type NetworkStatus = inferRouterOutputs<AppRouter>['networkStatus'];
|
|
581
667
|
declare class SwapSDK {
|
|
582
668
|
private readonly options;
|
|
583
669
|
private readonly rpcConfig;
|
|
584
670
|
private readonly trpc;
|
|
585
|
-
private
|
|
586
|
-
private supportedAssets?;
|
|
671
|
+
private cache;
|
|
587
672
|
private dcaEnabled;
|
|
588
673
|
constructor(options?: SwapSDKOptions);
|
|
589
|
-
getChains(sourceChain?:
|
|
674
|
+
getChains(sourceChain?: ChainflipChain, type?: keyof NetworkStatus['assets']): Promise<ChainData[]>;
|
|
590
675
|
private getStateChainEnvironment;
|
|
591
676
|
private getSupportedAssets;
|
|
592
677
|
private getBoostPoolsDepth;
|
|
593
|
-
getAssets(chain?:
|
|
594
|
-
getQuote(quoteRequest: QuoteRequest, options?: RequestOptions): Promise<QuoteResponse>;
|
|
678
|
+
getAssets(chain?: ChainflipChain, type?: keyof NetworkStatus['assets']): Promise<AssetData[]>;
|
|
595
679
|
getQuoteV2(quoteRequest: QuoteRequest, options?: RequestOptions): Promise<QuoteResponseV2>;
|
|
596
|
-
requestDepositAddress(depositAddressRequest: DepositAddressRequest): Promise<DepositAddressResponse>;
|
|
597
|
-
getStatus(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponse>;
|
|
598
680
|
getStatusV2(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponseV2>;
|
|
599
681
|
private validateSwapAmount;
|
|
600
682
|
getSwapLimits(): Promise<{
|
|
@@ -605,13 +687,51 @@ declare class SwapSDK {
|
|
|
605
687
|
getChannelOpeningFees(): Promise<ChainMap<bigint>>;
|
|
606
688
|
getBoostLiquidity(params?: {
|
|
607
689
|
feeTierBps?: number;
|
|
608
|
-
} | {
|
|
690
|
+
} | ({
|
|
609
691
|
feeTierBps?: number;
|
|
610
|
-
|
|
611
|
-
chain: Chain;
|
|
612
|
-
}): Promise<BoostPoolDepth[]>;
|
|
692
|
+
} & UncheckedAssetAndChain)): Promise<BoostPoolDepth[]>;
|
|
613
693
|
requestDepositAddressV2({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): Promise<DepositAddressResponseV2>;
|
|
614
694
|
encodeVaultSwapData({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerAccount, brokerCommissionBps, extraParams, }: VaultSwapRequest): Promise<VaultSwapResponse>;
|
|
695
|
+
checkBoostEnabled(): Promise<boolean>;
|
|
615
696
|
}
|
|
616
697
|
|
|
617
|
-
|
|
698
|
+
declare const ChainflipNetworks: {
|
|
699
|
+
mainnet: "mainnet";
|
|
700
|
+
backspin: "backspin";
|
|
701
|
+
sisyphos: "sisyphos";
|
|
702
|
+
perseverance: "perseverance";
|
|
703
|
+
};
|
|
704
|
+
declare const InternalAssets: {
|
|
705
|
+
Usdc: "Usdc";
|
|
706
|
+
Usdt: "Usdt";
|
|
707
|
+
Flip: "Flip";
|
|
708
|
+
Eth: "Eth";
|
|
709
|
+
Dot: "Dot";
|
|
710
|
+
Btc: "Btc";
|
|
711
|
+
ArbUsdc: "ArbUsdc";
|
|
712
|
+
ArbEth: "ArbEth";
|
|
713
|
+
Sol: "Sol";
|
|
714
|
+
SolUsdc: "SolUsdc";
|
|
715
|
+
HubDot: "HubDot";
|
|
716
|
+
HubUsdt: "HubUsdt";
|
|
717
|
+
HubUsdc: "HubUsdc";
|
|
718
|
+
};
|
|
719
|
+
declare const Chains: {
|
|
720
|
+
Ethereum: "Ethereum";
|
|
721
|
+
Arbitrum: "Arbitrum";
|
|
722
|
+
Bitcoin: "Bitcoin";
|
|
723
|
+
Polkadot: "Polkadot";
|
|
724
|
+
Solana: "Solana";
|
|
725
|
+
Assethub: "Assethub";
|
|
726
|
+
};
|
|
727
|
+
declare const Assets: {
|
|
728
|
+
USDC: "USDC";
|
|
729
|
+
USDT: "USDT";
|
|
730
|
+
FLIP: "FLIP";
|
|
731
|
+
DOT: "DOT";
|
|
732
|
+
ETH: "ETH";
|
|
733
|
+
BTC: "BTC";
|
|
734
|
+
SOL: "SOL";
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
export { type AssetData, Assets, type BoostPoolDepth, type BoostQuote, type ChainData, InternalAssets as ChainflipIds, ChainflipNetworks, Chains, type ChainsAndAssets, type DCABoostQuote, type DCAQuote, type DepositAddressRequestV2, type DepositAddressResponseV2, type FillOrKillParamsWithSlippage, type Quote, type QuoteRequest, type QuoteResponseV2, type RegularQuote, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponseV2, type VaultSwapRequest, type VaultSwapResponse };
|