@chainflip/sdk 1.8.3 → 1.9.0-beta.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-GWPJTKIG.mjs +106 -0
- package/dist/funding.d.mts +1 -1
- package/dist/funding.d.ts +1 -1
- package/dist/funding.js +12 -25
- package/dist/funding.mjs +8 -5
- package/dist/swap.d.mts +326 -215
- package/dist/swap.d.ts +326 -215
- package/dist/swap.js +214 -587
- package/dist/swap.mjs +183 -377
- package/package.json +5 -5
- 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,264 @@
|
|
|
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
|
+
}>;
|
|
259
|
+
}>;
|
|
260
|
+
type AppRouter = typeof appRouter;
|
|
261
|
+
|
|
5
262
|
declare const ccmParamsSchema: z.ZodEffects<z.ZodObject<{
|
|
6
263
|
gasBudget: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, `0x${string}`, string>]>, `0x${string}`, string>;
|
|
7
264
|
message: z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>;
|
|
@@ -75,12 +332,10 @@ type FillOrKillParamsX128 = z.input<typeof fillOrKillParams>;
|
|
|
75
332
|
type FillOrKillParamsWithMinPrice = Omit<FillOrKillParamsX128, 'minPriceX128'> & {
|
|
76
333
|
minPrice: string;
|
|
77
334
|
};
|
|
78
|
-
|
|
335
|
+
interface Fee<T> extends UncheckedAssetAndChain {
|
|
79
336
|
type: T;
|
|
80
|
-
chain: Chain;
|
|
81
|
-
asset: Asset;
|
|
82
337
|
amount: string;
|
|
83
|
-
}
|
|
338
|
+
}
|
|
84
339
|
type SwapFee = Fee<'NETWORK' | 'INGRESS' | 'EGRESS' | 'BROKER' | 'BOOST'>;
|
|
85
340
|
type PoolFee = Fee<'LIQUIDITY'>;
|
|
86
341
|
type PaidFee = SwapFee | PoolFee;
|
|
@@ -135,7 +390,7 @@ type FillOrKillParamsWithSlippage$1 = Omit<FillOrKillParamsX128, 'minPriceX128'>
|
|
|
135
390
|
};
|
|
136
391
|
|
|
137
392
|
interface ChainData {
|
|
138
|
-
chain:
|
|
393
|
+
chain: ChainflipChain;
|
|
139
394
|
name: string;
|
|
140
395
|
evmChainId: number | undefined;
|
|
141
396
|
isMainnet: boolean;
|
|
@@ -143,25 +398,25 @@ interface ChainData {
|
|
|
143
398
|
maxRetryDurationBlocks: number | undefined;
|
|
144
399
|
}
|
|
145
400
|
type AssetData = {
|
|
146
|
-
[C in
|
|
147
|
-
chainflipId:
|
|
401
|
+
[C in ChainflipChain]: {
|
|
402
|
+
chainflipId: ChainflipAsset;
|
|
148
403
|
asset: AssetOfChain<C>;
|
|
149
404
|
chain: C;
|
|
150
405
|
contractAddress: string | undefined;
|
|
151
406
|
decimals: number;
|
|
152
407
|
name: string;
|
|
153
|
-
symbol:
|
|
408
|
+
symbol: AssetSymbol;
|
|
154
409
|
isMainnet: boolean;
|
|
155
410
|
minimumSwapAmount: string;
|
|
156
411
|
maximumSwapAmount: string | null;
|
|
157
412
|
minimumEgressAmount: string;
|
|
158
413
|
};
|
|
159
|
-
}[
|
|
414
|
+
}[ChainflipChain];
|
|
160
415
|
interface ChainsAndAssets {
|
|
161
|
-
srcChain:
|
|
162
|
-
srcAsset:
|
|
163
|
-
destChain:
|
|
164
|
-
destAsset:
|
|
416
|
+
srcChain: ChainflipChain;
|
|
417
|
+
srcAsset: AssetSymbol;
|
|
418
|
+
destChain: ChainflipChain;
|
|
419
|
+
destAsset: AssetSymbol;
|
|
165
420
|
}
|
|
166
421
|
interface QuoteRequest extends ChainsAndAssets {
|
|
167
422
|
amount: string;
|
|
@@ -173,210 +428,26 @@ interface QuoteRequest extends ChainsAndAssets {
|
|
|
173
428
|
messageLengthBytes: number;
|
|
174
429
|
};
|
|
175
430
|
}
|
|
176
|
-
interface QuoteResponse extends QuoteRequest {
|
|
177
|
-
quote: Quote;
|
|
178
|
-
}
|
|
179
431
|
interface QuoteResponseV2 extends QuoteRequest {
|
|
180
432
|
quotes: Quote[];
|
|
181
433
|
}
|
|
182
434
|
type FillOrKillParamsWithSlippage = Omit<FillOrKillParamsWithMinPrice, 'minPrice'> & {
|
|
183
435
|
slippageTolerancePercent: string | number;
|
|
184
436
|
};
|
|
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
437
|
interface SwapStatusRequest {
|
|
203
438
|
id: string;
|
|
204
439
|
}
|
|
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
440
|
type BoostPoolDepth = {
|
|
362
441
|
feeTierBps: number;
|
|
363
442
|
availableAmount: bigint;
|
|
364
|
-
asset:
|
|
365
|
-
chain:
|
|
443
|
+
asset: AssetSymbol;
|
|
444
|
+
chain: ChainflipChain;
|
|
366
445
|
};
|
|
367
446
|
|
|
368
|
-
declare enum FailureMode {
|
|
369
|
-
IngressIgnored = "DEPOSIT_IGNORED",
|
|
370
|
-
SwapEgressIgnored = "SWAP_OUTPUT_TOO_SMALL",
|
|
371
|
-
RefundEgressIgnored = "REFUND_OUTPUT_TOO_SMALL",
|
|
372
|
-
BroadcastAborted = "SENDING_FAILED",
|
|
373
|
-
DepositRejected = "DEPOSIT_REJECTED"
|
|
374
|
-
}
|
|
375
|
-
|
|
376
447
|
interface Failure {
|
|
377
448
|
failedAt: number;
|
|
378
449
|
failedBlockIndex: string;
|
|
379
|
-
mode:
|
|
450
|
+
mode: string;
|
|
380
451
|
reason: {
|
|
381
452
|
code: string;
|
|
382
453
|
message: string;
|
|
@@ -523,7 +594,12 @@ interface DepositAddressRequestV2 {
|
|
|
523
594
|
ccmParams?: CcmParams;
|
|
524
595
|
brokerCommissionBps?: number;
|
|
525
596
|
}
|
|
526
|
-
interface DepositAddressResponseV2 extends Omit<
|
|
597
|
+
interface DepositAddressResponseV2 extends Omit<QuoteRequest, 'ccmParams'> {
|
|
598
|
+
destAddress: string;
|
|
599
|
+
ccmParams?: CcmParams;
|
|
600
|
+
maxBoostFeeBps?: number;
|
|
601
|
+
srcAddress?: string;
|
|
602
|
+
dcaParams?: DcaParams;
|
|
527
603
|
fillOrKillParams: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1;
|
|
528
604
|
depositChannelId: string;
|
|
529
605
|
depositAddress: string;
|
|
@@ -586,23 +662,20 @@ type SwapSDKOptions = {
|
|
|
586
662
|
dca?: boolean;
|
|
587
663
|
};
|
|
588
664
|
};
|
|
665
|
+
type NetworkStatus = inferRouterOutputs<AppRouter>['networkStatus'];
|
|
589
666
|
declare class SwapSDK {
|
|
590
667
|
private readonly options;
|
|
591
668
|
private readonly rpcConfig;
|
|
592
669
|
private readonly trpc;
|
|
593
|
-
private
|
|
594
|
-
private supportedAssets?;
|
|
670
|
+
private cache;
|
|
595
671
|
private dcaEnabled;
|
|
596
672
|
constructor(options?: SwapSDKOptions);
|
|
597
|
-
getChains(sourceChain?:
|
|
673
|
+
getChains(sourceChain?: ChainflipChain, type?: keyof NetworkStatus['assets']): Promise<ChainData[]>;
|
|
598
674
|
private getStateChainEnvironment;
|
|
599
675
|
private getSupportedAssets;
|
|
600
676
|
private getBoostPoolsDepth;
|
|
601
|
-
getAssets(chain?:
|
|
602
|
-
getQuote(quoteRequest: QuoteRequest, options?: RequestOptions): Promise<QuoteResponse>;
|
|
677
|
+
getAssets(chain?: ChainflipChain, type?: keyof NetworkStatus['assets']): Promise<AssetData[]>;
|
|
603
678
|
getQuoteV2(quoteRequest: QuoteRequest, options?: RequestOptions): Promise<QuoteResponseV2>;
|
|
604
|
-
requestDepositAddress(depositAddressRequest: DepositAddressRequest): Promise<DepositAddressResponse>;
|
|
605
|
-
getStatus(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponse>;
|
|
606
679
|
getStatusV2(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponseV2>;
|
|
607
680
|
private validateSwapAmount;
|
|
608
681
|
getSwapLimits(): Promise<{
|
|
@@ -613,13 +686,51 @@ declare class SwapSDK {
|
|
|
613
686
|
getChannelOpeningFees(): Promise<ChainMap<bigint>>;
|
|
614
687
|
getBoostLiquidity(params?: {
|
|
615
688
|
feeTierBps?: number;
|
|
616
|
-
} | {
|
|
689
|
+
} | ({
|
|
617
690
|
feeTierBps?: number;
|
|
618
|
-
|
|
619
|
-
chain: Chain;
|
|
620
|
-
}): Promise<BoostPoolDepth[]>;
|
|
691
|
+
} & UncheckedAssetAndChain)): Promise<BoostPoolDepth[]>;
|
|
621
692
|
requestDepositAddressV2({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): Promise<DepositAddressResponseV2>;
|
|
622
693
|
encodeVaultSwapData({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerAccount, brokerCommissionBps, extraParams, }: VaultSwapRequest): Promise<VaultSwapResponse>;
|
|
694
|
+
checkBoostEnabled(): Promise<boolean>;
|
|
623
695
|
}
|
|
624
696
|
|
|
625
|
-
|
|
697
|
+
declare const ChainflipNetworks: {
|
|
698
|
+
mainnet: "mainnet";
|
|
699
|
+
backspin: "backspin";
|
|
700
|
+
sisyphos: "sisyphos";
|
|
701
|
+
perseverance: "perseverance";
|
|
702
|
+
};
|
|
703
|
+
declare const InternalAssets: {
|
|
704
|
+
Usdc: "Usdc";
|
|
705
|
+
Usdt: "Usdt";
|
|
706
|
+
Flip: "Flip";
|
|
707
|
+
Eth: "Eth";
|
|
708
|
+
Dot: "Dot";
|
|
709
|
+
Btc: "Btc";
|
|
710
|
+
ArbUsdc: "ArbUsdc";
|
|
711
|
+
ArbEth: "ArbEth";
|
|
712
|
+
Sol: "Sol";
|
|
713
|
+
SolUsdc: "SolUsdc";
|
|
714
|
+
HubDot: "HubDot";
|
|
715
|
+
HubUsdt: "HubUsdt";
|
|
716
|
+
HubUsdc: "HubUsdc";
|
|
717
|
+
};
|
|
718
|
+
declare const Chains: {
|
|
719
|
+
Ethereum: "Ethereum";
|
|
720
|
+
Arbitrum: "Arbitrum";
|
|
721
|
+
Bitcoin: "Bitcoin";
|
|
722
|
+
Polkadot: "Polkadot";
|
|
723
|
+
Solana: "Solana";
|
|
724
|
+
Assethub: "Assethub";
|
|
725
|
+
};
|
|
726
|
+
declare const Assets: {
|
|
727
|
+
USDC: "USDC";
|
|
728
|
+
USDT: "USDT";
|
|
729
|
+
FLIP: "FLIP";
|
|
730
|
+
DOT: "DOT";
|
|
731
|
+
ETH: "ETH";
|
|
732
|
+
BTC: "BTC";
|
|
733
|
+
SOL: "SOL";
|
|
734
|
+
};
|
|
735
|
+
|
|
736
|
+
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 };
|