@chainflip/sdk 0.2.17 → 0.2.18

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,10 +1,13 @@
1
- import { chainflipAssetAndChain, numericString, hexString, btcAddress, ccmMetadataSchema, hexStringFromNumber, dotAddress, unsignedInteger, camelToSnakeCase } from './chunk-5DBPJECX.mjs';
2
- import { isNotNullish, __name, Assets } from './chunk-NX4K76K7.mjs';
1
+ import { chainflipAssetAndChain, numericString, hexString, btcAddress, ccmMetadataSchema, hexStringFromNumber, dotAddress, unsignedInteger } from './chunk-2HHAR3ZI.mjs';
2
+ import { z, isNotNullish, __name, Assets } from './chunk-6B4B7WKD.mjs';
3
3
  import { u8aToHex } from '@polkadot/util';
4
4
  import { decodeAddress } from '@polkadot/util-crypto';
5
5
  import axios from 'axios';
6
- import { z } from 'zod';
7
6
 
7
+ // ../shared/src/strings.ts
8
+ var camelToSnakeCase = /* @__PURE__ */ __name((str) => str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), "camelToSnakeCase");
9
+
10
+ // ../shared/src/broker.ts
8
11
  var transformObjToSnakeCase = /* @__PURE__ */ __name((obj) => {
9
12
  if (!obj)
10
13
  return void 0;
@@ -1,8 +1,7 @@
1
- import { isString, Chains, Assets, assetChains, ChainflipNetworks, __name, assert } from './chunk-NX4K76K7.mjs';
1
+ import { z, isString, Chains, Assets, assetChains, ChainflipNetworks, __name, assert } from './chunk-6B4B7WKD.mjs';
2
2
  import { hexToU8a } from '@polkadot/util';
3
3
  import { encodeAddress, decodeAddress, base58Decode } from '@polkadot/util-crypto';
4
4
  import * as ethers from 'ethers';
5
- import { z } from 'zod';
6
5
 
7
6
  // ../shared/src/validation/segwitAddr.ts
8
7
  var CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
@@ -249,7 +248,7 @@ var errorMap = /* @__PURE__ */ __name((_issue, context) => ({
249
248
  var string = z.string({
250
249
  errorMap
251
250
  });
252
- var number = z.number({
251
+ z.number({
253
252
  errorMap
254
253
  });
255
254
  var numericString = string.regex(/^[0-9]+$/);
@@ -343,9 +342,7 @@ z.union([
343
342
  }))
344
343
  ]);
345
344
 
346
- // ../shared/src/strings.ts
347
- var camelToSnakeCase = /* @__PURE__ */ __name((str) => str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), "camelToSnakeCase");
348
- var channelIdRegex = /^(?<issuedBlock>\d+)-(?<srcChain>[a-z]+)-(?<channelId>\d+)$/i;
345
+ // ../shared/src/schemas.ts
349
346
  z.object({
350
347
  srcAsset: chainflipAssetAndChain,
351
348
  destAsset: chainflipAssetAndChain,
@@ -367,93 +364,5 @@ z.object({
367
364
  ...rest,
368
365
  expectedDepositAmount: amount
369
366
  }));
370
- var depositChannelIdRegex = z.string().regex(channelIdRegex);
371
- var swapIdRegex = z.string().regex(/^\d+$/i);
372
- var txHashRegex = z.string().regex(/^0x[a-f\d]+$/i);
373
- var swapStatusId = z.union([
374
- depositChannelIdRegex,
375
- swapIdRegex,
376
- txHashRegex
377
- ]);
378
- z.object({
379
- id: swapStatusId
380
- });
381
- var swapState = z.enum([
382
- "AWAITING_DEPOSIT",
383
- "DEPOSIT_RECEIVED",
384
- "SWAP_EXECUTED",
385
- "EGRESS_SCHEDULED",
386
- "BROADCAST_REQUESTED",
387
- "BROADCAST_ABORTED",
388
- "COMPLETE"
389
- ]);
390
- var baseSwapResponseSchema = z.object({
391
- srcChain: chainflipChain,
392
- destChain: chainflipChain,
393
- srcAsset: chainflipAsset,
394
- destAsset: chainflipAsset,
395
- destAddress: string.optional(),
396
- depositAddress: string.optional(),
397
- depositChannelCreatedAt: number.optional(),
398
- expectedDepositAmount: string.optional(),
399
- depositChannelExpiryBlock: z.bigint().optional().nullable(),
400
- estimatedDepositChannelExpiryTime: number.optional(),
401
- isDepositChannelExpired: z.boolean(),
402
- ccmDepositReceivedBlockIndex: string.optional().nullable(),
403
- ccmMetadata: z.object({
404
- gasBudget: string,
405
- message: string.nullable()
406
- }).optional().nullable()
407
- });
408
- var awaitingState = baseSwapResponseSchema.extend({
409
- state: swapState.refine((state) => state === swapState.Enum.AWAITING_DEPOSIT),
410
- depositAmount: string.optional(),
411
- depositTransactionHash: string.optional(),
412
- depositTransactionConfirmations: number.optional()
413
- });
414
- var depositReceivedState = awaitingState.extend({
415
- state: swapState.refine((state) => state === swapState.Enum.DEPOSIT_RECEIVED),
416
- swapId: string,
417
- depositAmount: string,
418
- depositReceivedAt: number,
419
- depositReceivedBlockIndex: string
420
- });
421
- var swapExecutedState = depositReceivedState.extend({
422
- state: swapState.refine((state) => state === swapState.Enum.SWAP_EXECUTED),
423
- intermediateAmount: string.optional(),
424
- swapExecutedAt: number,
425
- swapExecutedBlockIndex: string
426
- });
427
- var egressScheduledState = swapExecutedState.extend({
428
- state: swapState.refine((state) => state === swapState.Enum.EGRESS_SCHEDULED),
429
- egressAmount: string,
430
- egressScheduledAt: number,
431
- egressScheduledBlockIndex: string
432
- });
433
- var broadcastRequestedState = egressScheduledState.extend({
434
- state: swapState.refine((state) => state === swapState.Enum.BROADCAST_REQUESTED),
435
- broadcastRequestedAt: number,
436
- broadcastRequestedBlockIndex: string
437
- });
438
- var broadcastAbortedState = broadcastRequestedState.extend({
439
- state: swapState.refine((state) => state === swapState.Enum.BROADCAST_ABORTED),
440
- broadcastAbortedAt: number,
441
- broadcastAbortedBlockIndex: string
442
- });
443
- var broadcastSucceededState = broadcastRequestedState.extend({
444
- state: swapState.refine((state) => state === swapState.Enum.COMPLETE),
445
- swapExecutedBlockIndex: string,
446
- broadcastSucceededAt: number,
447
- broadcastSucceededBlockIndex: string
448
- });
449
- z.union([
450
- awaitingState,
451
- depositReceivedState,
452
- swapExecutedState,
453
- egressScheduledState,
454
- broadcastRequestedState,
455
- broadcastAbortedState,
456
- broadcastSucceededState
457
- ]);
458
367
 
459
- export { btcAddress, camelToSnakeCase, ccmMetadataSchema, chainflipAssetAndChain, dotAddress, ethereumAddress, hexString, hexStringFromNumber, numericString, unsignedInteger };
368
+ export { btcAddress, ccmMetadataSchema, chainflipAssetAndChain, dotAddress, ethereumAddress, hexString, hexStringFromNumber, numericString, unsignedInteger };