@chainflip/sdk 1.5.0-alpha.0 → 1.5.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { z, assetAndChain, numericString, hexString, btcAddress, ccmParamsSchema, affiliateBroker, fillOrKillParams, dotAddress, ethereumAddress } from './chunk-7ENWS5RM.mjs';
1
+ import { z, assetAndChain, numericString, hexString, btcAddress, ccmParamsSchema, affiliateBroker, fillOrKillParams, dotAddress, ethereumAddress } from './chunk-HWJAHLL7.mjs';
2
2
  import { __name, Chains } from './chunk-3V7QJANN.mjs';
3
3
  import { HttpClient } from '@chainflip/rpc';
4
4
  import { bytesToHex } from '@chainflip/utils/bytes';
@@ -31,10 +31,10 @@ var validateRequest = /* @__PURE__ */ __name((network, params) => z.tuple([
31
31
  })).optional(),
32
32
  z.number().optional(),
33
33
  z.array(affiliateBroker).optional(),
34
- fillOrKillParams.transform(({ retryDurationBlocks, refundAddress, minPrice }) => ({
34
+ fillOrKillParams.transform(({ retryDurationBlocks, refundAddress, minPriceX128 }) => ({
35
35
  retry_duration: retryDurationBlocks,
36
36
  refund_address: refundAddress,
37
- min_price: `0x${BigInt(minPrice).toString(16)}`
37
+ min_price: `0x${BigInt(minPriceX128).toString(16)}`
38
38
  })).optional()
39
39
  ]).parse(params), "validateRequest");
40
40
  var validateResponse = /* @__PURE__ */ __name((network, response) => z.object({
@@ -4456,7 +4456,7 @@ var affiliateBroker = z.object({
4456
4456
  var fillOrKillParams = z.object({
4457
4457
  retryDurationBlocks: number,
4458
4458
  refundAddress: z.string(),
4459
- minPrice: numericString
4459
+ minPriceX128: numericString
4460
4460
  });
4461
4461
  z.object({
4462
4462
  srcAsset: asset,
package/dist/swap.d.mts CHANGED
@@ -34,17 +34,20 @@ type AffiliateBroker = z.input<typeof affiliateBroker>;
34
34
  declare const fillOrKillParams: z.ZodObject<{
35
35
  retryDurationBlocks: z.ZodNumber;
36
36
  refundAddress: z.ZodString;
37
- minPrice: z.ZodString;
37
+ minPriceX128: z.ZodString;
38
38
  }, "strip", z.ZodTypeAny, {
39
39
  retryDurationBlocks: number;
40
40
  refundAddress: string;
41
- minPrice: string;
41
+ minPriceX128: string;
42
42
  }, {
43
43
  retryDurationBlocks: number;
44
44
  refundAddress: string;
45
- minPrice: string;
45
+ minPriceX128: string;
46
46
  }>;
47
- type FillOrKillParams = z.input<typeof fillOrKillParams>;
47
+ type FillOrKillParamsX128 = z.input<typeof fillOrKillParams>;
48
+ type FillOrKillParams = Omit<FillOrKillParamsX128, 'minPriceX128'> & {
49
+ minPrice: string;
50
+ };
48
51
  type Fee<T> = {
49
52
  type: T;
50
53
  chain: Chain;
@@ -91,6 +94,7 @@ interface ChainData {
91
94
  evmChainId: number | undefined;
92
95
  isMainnet: boolean;
93
96
  requiredBlockConfirmations: number | undefined;
97
+ maxRetryDurationBlocks: number | undefined;
94
98
  }
95
99
  type AssetData = {
96
100
  [C in Chain]: {
@@ -149,6 +153,8 @@ interface SwapStatusResponseCommonFields extends ChainsAndAssets {
149
153
  estimatedDefaultDurationSeconds: number | undefined;
150
154
  srcChainRequiredBlockConfirmations: number | undefined;
151
155
  depositTransactionRef: string | undefined;
156
+ latestSwapScheduledAt: number | undefined;
157
+ latestSwapScheduledBlockIndex: string | undefined;
152
158
  depositTransactionHash: string | undefined;
153
159
  ccmMetadata?: CcmParams;
154
160
  }
@@ -185,6 +191,7 @@ type BroadcastRequested = {
185
191
  broadcastRequestedAt: number;
186
192
  broadcastRequestedBlockIndex: string;
187
193
  };
194
+ type RefundBroadcastRequested = Omit<BroadcastRequested, 'swapExecutedAt' | 'swapExecutedBlockIndex'>;
188
195
  type CopyFields<T, U> = {
189
196
  [K in Exclude<keyof T, keyof U>]: undefined;
190
197
  } & U;
@@ -238,6 +245,15 @@ type SwapState = {
238
245
  egressAmount: string;
239
246
  egressScheduledAt: number;
240
247
  egressScheduledBlockIndex: string;
248
+ } | {
249
+ state: 'REFUND_EGRESS_SCHEDULED';
250
+ swapId: string;
251
+ depositAmount: string;
252
+ depositReceivedAt: number;
253
+ depositReceivedBlockIndex: string;
254
+ egressAmount: string;
255
+ egressScheduledAt: number;
256
+ egressScheduledBlockIndex: string;
241
257
  } | ({
242
258
  state: 'BROADCAST_REQUESTED';
243
259
  } & BroadcastRequested) | ({
@@ -252,7 +268,12 @@ type SwapState = {
252
268
  broadcastSucceededAt: number;
253
269
  broadcastSucceededBlockIndex: string;
254
270
  broadcastTransactionRef: string;
255
- } & BroadcastRequested) | {
271
+ } & BroadcastRequested) | ({
272
+ state: 'REFUNDED';
273
+ broadcastSucceededAt: number;
274
+ broadcastSucceededBlockIndex: string;
275
+ broadcastTransactionRef: string;
276
+ } & RefundBroadcastRequested) | {
256
277
  state: 'FAILED';
257
278
  failure: 'INGRESS_IGNORED';
258
279
  error: {
@@ -279,6 +300,33 @@ type SwapState = {
279
300
  ignoredEgressAmount: string;
280
301
  egressIgnoredAt: number;
281
302
  egressIgnoredBlockIndex: string;
303
+ } | {
304
+ state: 'FAILED';
305
+ failure: 'REFUND_EGRESS_IGNORED';
306
+ error: {
307
+ name: string;
308
+ message: string;
309
+ };
310
+ swapId: string;
311
+ depositAmount: string;
312
+ depositReceivedAt: number;
313
+ depositReceivedBlockIndex: string;
314
+ intermediateAmount: string | undefined;
315
+ ignoredEgressAmount: string;
316
+ egressIgnoredAt: number;
317
+ egressIgnoredBlockIndex: string;
318
+ } | {
319
+ state: 'FAILED';
320
+ failure: 'REFUND_BROADCAST_ABORTED';
321
+ swapId: string;
322
+ depositAmount: string;
323
+ depositReceivedAt: number;
324
+ depositReceivedBlockIndex: string;
325
+ intermediateAmount: string | undefined;
326
+ broadcastRequestedAt: number;
327
+ broadcastRequestedBlockIndex: string;
328
+ broadcastAbortedAt: number;
329
+ broadcastAbortedBlockIndex: string;
282
330
  };
283
331
  type DepositAddressStatusResponse = DepositAddressFields & SwapState;
284
332
  type VaultSwapStatusResponse = VaultSwapFields & SwapState;
package/dist/swap.d.ts CHANGED
@@ -34,17 +34,20 @@ type AffiliateBroker = z.input<typeof affiliateBroker>;
34
34
  declare const fillOrKillParams: z.ZodObject<{
35
35
  retryDurationBlocks: z.ZodNumber;
36
36
  refundAddress: z.ZodString;
37
- minPrice: z.ZodString;
37
+ minPriceX128: z.ZodString;
38
38
  }, "strip", z.ZodTypeAny, {
39
39
  retryDurationBlocks: number;
40
40
  refundAddress: string;
41
- minPrice: string;
41
+ minPriceX128: string;
42
42
  }, {
43
43
  retryDurationBlocks: number;
44
44
  refundAddress: string;
45
- minPrice: string;
45
+ minPriceX128: string;
46
46
  }>;
47
- type FillOrKillParams = z.input<typeof fillOrKillParams>;
47
+ type FillOrKillParamsX128 = z.input<typeof fillOrKillParams>;
48
+ type FillOrKillParams = Omit<FillOrKillParamsX128, 'minPriceX128'> & {
49
+ minPrice: string;
50
+ };
48
51
  type Fee<T> = {
49
52
  type: T;
50
53
  chain: Chain;
@@ -91,6 +94,7 @@ interface ChainData {
91
94
  evmChainId: number | undefined;
92
95
  isMainnet: boolean;
93
96
  requiredBlockConfirmations: number | undefined;
97
+ maxRetryDurationBlocks: number | undefined;
94
98
  }
95
99
  type AssetData = {
96
100
  [C in Chain]: {
@@ -149,6 +153,8 @@ interface SwapStatusResponseCommonFields extends ChainsAndAssets {
149
153
  estimatedDefaultDurationSeconds: number | undefined;
150
154
  srcChainRequiredBlockConfirmations: number | undefined;
151
155
  depositTransactionRef: string | undefined;
156
+ latestSwapScheduledAt: number | undefined;
157
+ latestSwapScheduledBlockIndex: string | undefined;
152
158
  depositTransactionHash: string | undefined;
153
159
  ccmMetadata?: CcmParams;
154
160
  }
@@ -185,6 +191,7 @@ type BroadcastRequested = {
185
191
  broadcastRequestedAt: number;
186
192
  broadcastRequestedBlockIndex: string;
187
193
  };
194
+ type RefundBroadcastRequested = Omit<BroadcastRequested, 'swapExecutedAt' | 'swapExecutedBlockIndex'>;
188
195
  type CopyFields<T, U> = {
189
196
  [K in Exclude<keyof T, keyof U>]: undefined;
190
197
  } & U;
@@ -238,6 +245,15 @@ type SwapState = {
238
245
  egressAmount: string;
239
246
  egressScheduledAt: number;
240
247
  egressScheduledBlockIndex: string;
248
+ } | {
249
+ state: 'REFUND_EGRESS_SCHEDULED';
250
+ swapId: string;
251
+ depositAmount: string;
252
+ depositReceivedAt: number;
253
+ depositReceivedBlockIndex: string;
254
+ egressAmount: string;
255
+ egressScheduledAt: number;
256
+ egressScheduledBlockIndex: string;
241
257
  } | ({
242
258
  state: 'BROADCAST_REQUESTED';
243
259
  } & BroadcastRequested) | ({
@@ -252,7 +268,12 @@ type SwapState = {
252
268
  broadcastSucceededAt: number;
253
269
  broadcastSucceededBlockIndex: string;
254
270
  broadcastTransactionRef: string;
255
- } & BroadcastRequested) | {
271
+ } & BroadcastRequested) | ({
272
+ state: 'REFUNDED';
273
+ broadcastSucceededAt: number;
274
+ broadcastSucceededBlockIndex: string;
275
+ broadcastTransactionRef: string;
276
+ } & RefundBroadcastRequested) | {
256
277
  state: 'FAILED';
257
278
  failure: 'INGRESS_IGNORED';
258
279
  error: {
@@ -279,6 +300,33 @@ type SwapState = {
279
300
  ignoredEgressAmount: string;
280
301
  egressIgnoredAt: number;
281
302
  egressIgnoredBlockIndex: string;
303
+ } | {
304
+ state: 'FAILED';
305
+ failure: 'REFUND_EGRESS_IGNORED';
306
+ error: {
307
+ name: string;
308
+ message: string;
309
+ };
310
+ swapId: string;
311
+ depositAmount: string;
312
+ depositReceivedAt: number;
313
+ depositReceivedBlockIndex: string;
314
+ intermediateAmount: string | undefined;
315
+ ignoredEgressAmount: string;
316
+ egressIgnoredAt: number;
317
+ egressIgnoredBlockIndex: string;
318
+ } | {
319
+ state: 'FAILED';
320
+ failure: 'REFUND_BROADCAST_ABORTED';
321
+ swapId: string;
322
+ depositAmount: string;
323
+ depositReceivedAt: number;
324
+ depositReceivedBlockIndex: string;
325
+ intermediateAmount: string | undefined;
326
+ broadcastRequestedAt: number;
327
+ broadcastRequestedBlockIndex: string;
328
+ broadcastAbortedAt: number;
329
+ broadcastAbortedBlockIndex: string;
282
330
  };
283
331
  type DepositAddressStatusResponse = DepositAddressFields & SwapState;
284
332
  type VaultSwapStatusResponse = VaultSwapFields & SwapState;