@chainflip/sdk 1.3.0 → 1.4.0-alpha.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/funding.js CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  var ethers2 = require('ethers');
4
4
  var axios = require('axios');
5
- var util$1 = require('@polkadot/util');
6
- var utilCrypto = require('@polkadot/util-crypto');
5
+ var ss582 = require('@chainflip/utils/ss58');
6
+ require('@chainflip/utils/base58');
7
7
 
8
8
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
9
 
@@ -27,6 +27,7 @@ function _interopNamespace(e) {
27
27
 
28
28
  var ethers2__namespace = /*#__PURE__*/_interopNamespace(ethers2);
29
29
  var axios__default = /*#__PURE__*/_interopDefault(axios);
30
+ var ss582__namespace = /*#__PURE__*/_interopNamespace(ss582);
30
31
 
31
32
  var __create = Object.create;
32
33
  var __defProp = Object.defineProperty;
@@ -132,10 +133,10 @@ var require_encoding = __commonJS({
132
133
  });
133
134
  exports.CHECKSUM_LENGTH = void 0;
134
135
  exports.createChecksum = createChecksum;
135
- exports.decode = decode;
136
+ exports.decode = decode4;
136
137
  exports.decodeWithPrefix = decodeWithPrefix;
137
138
  exports.detectCase = detectCase;
138
- exports.encode = encode;
139
+ exports.encode = encode2;
139
140
  exports.expandPrefix = expandPrefix;
140
141
  exports.verifyChecksum = verifyChecksum;
141
142
  var _bitConverter = require_bit_converter();
@@ -212,13 +213,13 @@ var require_encoding = __commonJS({
212
213
  }
213
214
  }
214
215
  __name(createChecksum, "createChecksum");
215
- function encode(buffer) {
216
+ function encode2(buffer) {
216
217
  return buffer.reduce(function(acc, bits) {
217
218
  return acc + CHARSET[bits];
218
219
  }, "");
219
220
  }
220
- __name(encode, "encode");
221
- function decode(message, dst) {
221
+ __name(encode2, "encode");
222
+ function decode4(message, dst) {
222
223
  var realDst = dst || (0, _bitConverter.createBitArray)(message.length);
223
224
  for (var i = 0; i < message.length; i += 1) {
224
225
  var idx = CHAR_LOOKUP.get(message[i]);
@@ -229,12 +230,12 @@ var require_encoding = __commonJS({
229
230
  }
230
231
  return realDst;
231
232
  }
232
- __name(decode, "decode");
233
+ __name(decode4, "decode");
233
234
  function decodeWithPrefix(prefix, message) {
234
235
  var len = message.length + 2 * prefix.length + 1;
235
236
  var dst = (0, _bitConverter.createBitArray)(len);
236
237
  expandPrefix(prefix, dst.subarray(0, 2 * prefix.length + 1));
237
- decode(message, dst.subarray(2 * prefix.length + 1));
238
+ decode4(message, dst.subarray(2 * prefix.length + 1));
238
239
  return dst;
239
240
  }
240
241
  __name(decodeWithPrefix, "decodeWithPrefix");
@@ -271,9 +272,9 @@ var require_lib = __commonJS({
271
272
  value: true
272
273
  });
273
274
  exports.BitcoinAddress = void 0;
274
- exports.decode = decode;
275
+ exports.decode = decode4;
275
276
  exports.decodeTo5BitArray = decodeTo5BitArray;
276
- exports.encode = encode;
277
+ exports.encode = encode2;
277
278
  exports.encode5BitArray = encode5BitArray;
278
279
  exports.from5BitArray = from5BitArray;
279
280
  exports.to5BitArray = to5BitArray;
@@ -340,11 +341,11 @@ var require_lib = __commonJS({
340
341
  return "".concat(prefix, "1").concat(encoded);
341
342
  }
342
343
  __name(encode5BitArray, "encode5BitArray");
343
- function encode(prefix, data) {
344
+ function encode2(prefix, data) {
344
345
  var encoding = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "bech32";
345
346
  return encode5BitArray(prefix, to5BitArray(data), encoding);
346
347
  }
347
- __name(encode, "encode");
348
+ __name(encode2, "encode");
348
349
  function decodeTo5BitArray(message) {
349
350
  if (message.length > MAX_ENC_LENGTH) {
350
351
  throw new TypeError("Message too long; max ".concat(MAX_ENC_LENGTH, " expected"));
@@ -372,7 +373,7 @@ var require_lib = __commonJS({
372
373
  };
373
374
  }
374
375
  __name(decodeTo5BitArray, "decodeTo5BitArray");
375
- function decode(message) {
376
+ function decode4(message) {
376
377
  var _decodeTo5BitArray = decodeTo5BitArray(message), prefix = _decodeTo5BitArray.prefix, encoding = _decodeTo5BitArray.encoding, bitArray = _decodeTo5BitArray.data;
377
378
  return {
378
379
  prefix,
@@ -380,7 +381,7 @@ var require_lib = __commonJS({
380
381
  data: from5BitArray(bitArray)
381
382
  };
382
383
  }
383
- __name(decode, "decode");
384
+ __name(decode4, "decode");
384
385
  var BitcoinAddress2 = /* @__PURE__ */ function() {
385
386
  function BitcoinAddress3(prefix, scriptVersion, data) {
386
387
  _classCallCheck(this, BitcoinAddress3);
@@ -420,7 +421,7 @@ var require_lib = __commonJS({
420
421
  },
421
422
  {
422
423
  key: "encode",
423
- value: /* @__PURE__ */ __name(function encode2() {
424
+ value: /* @__PURE__ */ __name(function encode3() {
424
425
  var len = Math.ceil(this.data.length * 8 / 5);
425
426
  var converted = (0, _bitConverter.createBitArray)(len + 1);
426
427
  converted[0] = this.scriptVersion;
@@ -454,7 +455,7 @@ var require_lib = __commonJS({
454
455
  * @param {string} message
455
456
  * @returns {BitcoinAddress}
456
457
  */
457
- /* @__PURE__ */ __name(function decode2(message) {
458
+ /* @__PURE__ */ __name(function decode5(message) {
458
459
  var _decodeTo5BitArray2 = decodeTo5BitArray(message), prefix = _decodeTo5BitArray2.prefix, data = _decodeTo5BitArray2.data, encoding = _decodeTo5BitArray2.encoding;
459
460
  if (prefix !== "bc" && prefix !== "tb" && prefix !== "bcrt") {
460
461
  throw new Error('Invalid human-readable prefix, "bc", "tb", or "bcrt" expected');
@@ -1460,7 +1461,8 @@ var approve = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20, allow
1460
1461
  if (allowance >= amount)
1461
1462
  return null;
1462
1463
  const transaction = await erc20.approve(spenderAddress, amount - allowance, extractOverrides(txOpts));
1463
- return transaction.wait(txOpts.wait);
1464
+ await transaction.wait(txOpts.wait);
1465
+ return transaction;
1464
1466
  }, "approve");
1465
1467
  var getFlipBalance = /* @__PURE__ */ __name(async (network, signer) => {
1466
1468
  const flipAddress = getTokenContractAddress(InternalAssets.Flip, network);
@@ -1468,7 +1470,7 @@ var getFlipBalance = /* @__PURE__ */ __name(async (network, signer) => {
1468
1470
  return flip.balanceOf(await signer.getAddress());
1469
1471
  }, "getFlipBalance");
1470
1472
 
1471
- // ../../node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs
1473
+ // ../../node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs
1472
1474
  var util;
1473
1475
  (function(util2) {
1474
1476
  util2.assertEqual = (val) => val;
@@ -1683,6 +1685,11 @@ var _ZodError = class _ZodError extends Error {
1683
1685
  processError(this);
1684
1686
  return fieldErrors;
1685
1687
  }
1688
+ static assert(value) {
1689
+ if (!(value instanceof _ZodError)) {
1690
+ throw new Error(`Not a ZodError: ${value}`);
1691
+ }
1692
+ }
1686
1693
  toString() {
1687
1694
  return this.message;
1688
1695
  }
@@ -1829,6 +1836,13 @@ var makeIssue = /* @__PURE__ */ __name((params) => {
1829
1836
  ...issueData,
1830
1837
  path: fullPath
1831
1838
  };
1839
+ if (issueData.message !== void 0) {
1840
+ return {
1841
+ ...issueData,
1842
+ path: fullPath,
1843
+ message: issueData.message
1844
+ };
1845
+ }
1832
1846
  let errorMessage = "";
1833
1847
  const maps = errorMaps.filter((m) => !!m).slice().reverse();
1834
1848
  for (const map of maps) {
@@ -1837,11 +1851,12 @@ var makeIssue = /* @__PURE__ */ __name((params) => {
1837
1851
  return {
1838
1852
  ...issueData,
1839
1853
  path: fullPath,
1840
- message: issueData.message || errorMessage
1854
+ message: errorMessage
1841
1855
  };
1842
1856
  }, "makeIssue");
1843
1857
  var EMPTY_PATH = [];
1844
1858
  function addIssueToContext(ctx, issueData) {
1859
+ const overrideMap = getErrorMap();
1845
1860
  const issue = makeIssue({
1846
1861
  issueData,
1847
1862
  data: ctx.data,
@@ -1849,8 +1864,8 @@ function addIssueToContext(ctx, issueData) {
1849
1864
  errorMaps: [
1850
1865
  ctx.common.contextualErrorMap,
1851
1866
  ctx.schemaErrorMap,
1852
- getErrorMap(),
1853
- errorMap
1867
+ overrideMap,
1868
+ overrideMap === errorMap ? void 0 : errorMap
1854
1869
  // then global default map
1855
1870
  ].filter((x) => !!x)
1856
1871
  });
@@ -1883,9 +1898,11 @@ var _ParseStatus = class _ParseStatus {
1883
1898
  static async mergeObjectAsync(status, pairs) {
1884
1899
  const syncPairs = [];
1885
1900
  for (const pair of pairs) {
1901
+ const key = await pair.key;
1902
+ const value = await pair.value;
1886
1903
  syncPairs.push({
1887
- key: await pair.key,
1888
- value: await pair.value
1904
+ key,
1905
+ value
1889
1906
  });
1890
1907
  }
1891
1908
  return _ParseStatus.mergeObjectSync(status, syncPairs);
@@ -1920,11 +1937,31 @@ var isAborted = /* @__PURE__ */ __name((x) => x.status === "aborted", "isAborted
1920
1937
  var isDirty = /* @__PURE__ */ __name((x) => x.status === "dirty", "isDirty");
1921
1938
  var isValid = /* @__PURE__ */ __name((x) => x.status === "valid", "isValid");
1922
1939
  var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
1940
+ function __classPrivateFieldGet(receiver, state, kind, f) {
1941
+ if (kind === "a" && !f)
1942
+ throw new TypeError("Private accessor was defined without a getter");
1943
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1944
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
1945
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1946
+ }
1947
+ __name(__classPrivateFieldGet, "__classPrivateFieldGet");
1948
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
1949
+ if (kind === "m")
1950
+ throw new TypeError("Private method is not writable");
1951
+ if (kind === "a" && !f)
1952
+ throw new TypeError("Private accessor was defined without a setter");
1953
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1954
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
1955
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
1956
+ }
1957
+ __name(__classPrivateFieldSet, "__classPrivateFieldSet");
1923
1958
  var errorUtil;
1924
1959
  (function(errorUtil2) {
1925
1960
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
1926
1961
  errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
1927
1962
  })(errorUtil || (errorUtil = {}));
1963
+ var _ZodEnum_cache;
1964
+ var _ZodNativeEnum_cache;
1928
1965
  var _ParseInputLazyPath = class _ParseInputLazyPath {
1929
1966
  constructor(parent, value, path, key) {
1930
1967
  this._cachedPath = [];
@@ -1975,12 +2012,17 @@ function processCreateParams(params) {
1975
2012
  if (errorMap3)
1976
2013
  return { errorMap: errorMap3, description };
1977
2014
  const customMap = /* @__PURE__ */ __name((iss, ctx) => {
1978
- if (iss.code !== "invalid_type")
1979
- return { message: ctx.defaultError };
2015
+ var _a, _b;
2016
+ const { message } = params;
2017
+ if (iss.code === "invalid_enum_value") {
2018
+ return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
2019
+ }
1980
2020
  if (typeof ctx.data === "undefined") {
1981
- return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
2021
+ return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
1982
2022
  }
1983
- return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
2023
+ if (iss.code !== "invalid_type")
2024
+ return { message: ctx.defaultError };
2025
+ return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
1984
2026
  }, "customMap");
1985
2027
  return { errorMap: customMap, description };
1986
2028
  }
@@ -2231,35 +2273,43 @@ var _ZodType = class _ZodType {
2231
2273
  __name(_ZodType, "ZodType");
2232
2274
  var ZodType = _ZodType;
2233
2275
  var cuidRegex = /^c[^\s-]{8,}$/i;
2234
- var cuid2Regex = /^[a-z][a-z0-9]*$/;
2276
+ var cuid2Regex = /^[0-9a-z]+$/;
2235
2277
  var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
2236
2278
  var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
2237
- var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
2279
+ var nanoidRegex = /^[a-z0-9_-]{21}$/i;
2280
+ var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
2281
+ var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
2238
2282
  var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
2239
2283
  var emojiRegex;
2240
- var ipv4Regex = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;
2284
+ var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
2241
2285
  var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
2242
- var datetimeRegex = /* @__PURE__ */ __name((args) => {
2286
+ var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
2287
+ var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
2288
+ var dateRegex = new RegExp(`^${dateRegexSource}$`);
2289
+ function timeRegexSource(args) {
2290
+ let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
2243
2291
  if (args.precision) {
2244
- if (args.offset) {
2245
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
2246
- } else {
2247
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
2248
- }
2249
- } else if (args.precision === 0) {
2250
- if (args.offset) {
2251
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
2252
- } else {
2253
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
2254
- }
2255
- } else {
2256
- if (args.offset) {
2257
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
2258
- } else {
2259
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
2260
- }
2292
+ regex = `${regex}\\.\\d{${args.precision}}`;
2293
+ } else if (args.precision == null) {
2294
+ regex = `${regex}(\\.\\d+)?`;
2261
2295
  }
2262
- }, "datetimeRegex");
2296
+ return regex;
2297
+ }
2298
+ __name(timeRegexSource, "timeRegexSource");
2299
+ function timeRegex(args) {
2300
+ return new RegExp(`^${timeRegexSource(args)}$`);
2301
+ }
2302
+ __name(timeRegex, "timeRegex");
2303
+ function datetimeRegex(args) {
2304
+ let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
2305
+ const opts = [];
2306
+ opts.push(args.local ? `Z?` : `Z`);
2307
+ if (args.offset)
2308
+ opts.push(`([+-]\\d{2}:?\\d{2})`);
2309
+ regex = `${regex}(${opts.join("|")})`;
2310
+ return new RegExp(`^${regex}$`);
2311
+ }
2312
+ __name(datetimeRegex, "datetimeRegex");
2263
2313
  function isValidIP(ip, version) {
2264
2314
  if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
2265
2315
  return true;
@@ -2278,15 +2328,11 @@ var _ZodString = class _ZodString extends ZodType {
2278
2328
  const parsedType = this._getType(input);
2279
2329
  if (parsedType !== ZodParsedType.string) {
2280
2330
  const ctx2 = this._getOrReturnCtx(input);
2281
- addIssueToContext(
2282
- ctx2,
2283
- {
2284
- code: ZodIssueCode.invalid_type,
2285
- expected: ZodParsedType.string,
2286
- received: ctx2.parsedType
2287
- }
2288
- //
2289
- );
2331
+ addIssueToContext(ctx2, {
2332
+ code: ZodIssueCode.invalid_type,
2333
+ expected: ZodParsedType.string,
2334
+ received: ctx2.parsedType
2335
+ });
2290
2336
  return INVALID;
2291
2337
  }
2292
2338
  const status = new ParseStatus();
@@ -2377,6 +2423,16 @@ var _ZodString = class _ZodString extends ZodType {
2377
2423
  });
2378
2424
  status.dirty();
2379
2425
  }
2426
+ } else if (check.kind === "nanoid") {
2427
+ if (!nanoidRegex.test(input.data)) {
2428
+ ctx = this._getOrReturnCtx(input, ctx);
2429
+ addIssueToContext(ctx, {
2430
+ validation: "nanoid",
2431
+ code: ZodIssueCode.invalid_string,
2432
+ message: check.message
2433
+ });
2434
+ status.dirty();
2435
+ }
2380
2436
  } else if (check.kind === "cuid") {
2381
2437
  if (!cuidRegex.test(input.data)) {
2382
2438
  ctx = this._getOrReturnCtx(input, ctx);
@@ -2478,6 +2534,38 @@ var _ZodString = class _ZodString extends ZodType {
2478
2534
  });
2479
2535
  status.dirty();
2480
2536
  }
2537
+ } else if (check.kind === "date") {
2538
+ const regex = dateRegex;
2539
+ if (!regex.test(input.data)) {
2540
+ ctx = this._getOrReturnCtx(input, ctx);
2541
+ addIssueToContext(ctx, {
2542
+ code: ZodIssueCode.invalid_string,
2543
+ validation: "date",
2544
+ message: check.message
2545
+ });
2546
+ status.dirty();
2547
+ }
2548
+ } else if (check.kind === "time") {
2549
+ const regex = timeRegex(check);
2550
+ if (!regex.test(input.data)) {
2551
+ ctx = this._getOrReturnCtx(input, ctx);
2552
+ addIssueToContext(ctx, {
2553
+ code: ZodIssueCode.invalid_string,
2554
+ validation: "time",
2555
+ message: check.message
2556
+ });
2557
+ status.dirty();
2558
+ }
2559
+ } else if (check.kind === "duration") {
2560
+ if (!durationRegex.test(input.data)) {
2561
+ ctx = this._getOrReturnCtx(input, ctx);
2562
+ addIssueToContext(ctx, {
2563
+ validation: "duration",
2564
+ code: ZodIssueCode.invalid_string,
2565
+ message: check.message
2566
+ });
2567
+ status.dirty();
2568
+ }
2481
2569
  } else if (check.kind === "ip") {
2482
2570
  if (!isValidIP(input.data, check.version)) {
2483
2571
  ctx = this._getOrReturnCtx(input, ctx);
@@ -2488,6 +2576,16 @@ var _ZodString = class _ZodString extends ZodType {
2488
2576
  });
2489
2577
  status.dirty();
2490
2578
  }
2579
+ } else if (check.kind === "base64") {
2580
+ if (!base64Regex.test(input.data)) {
2581
+ ctx = this._getOrReturnCtx(input, ctx);
2582
+ addIssueToContext(ctx, {
2583
+ validation: "base64",
2584
+ code: ZodIssueCode.invalid_string,
2585
+ message: check.message
2586
+ });
2587
+ status.dirty();
2588
+ }
2491
2589
  } else {
2492
2590
  util.assertNever(check);
2493
2591
  }
@@ -2519,6 +2617,9 @@ var _ZodString = class _ZodString extends ZodType {
2519
2617
  uuid(message) {
2520
2618
  return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
2521
2619
  }
2620
+ nanoid(message) {
2621
+ return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
2622
+ }
2522
2623
  cuid(message) {
2523
2624
  return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
2524
2625
  }
@@ -2528,16 +2629,20 @@ var _ZodString = class _ZodString extends ZodType {
2528
2629
  ulid(message) {
2529
2630
  return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
2530
2631
  }
2632
+ base64(message) {
2633
+ return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
2634
+ }
2531
2635
  ip(options) {
2532
2636
  return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
2533
2637
  }
2534
2638
  datetime(options) {
2535
- var _a;
2639
+ var _a, _b;
2536
2640
  if (typeof options === "string") {
2537
2641
  return this._addCheck({
2538
2642
  kind: "datetime",
2539
2643
  precision: null,
2540
2644
  offset: false,
2645
+ local: false,
2541
2646
  message: options
2542
2647
  });
2543
2648
  }
@@ -2545,9 +2650,30 @@ var _ZodString = class _ZodString extends ZodType {
2545
2650
  kind: "datetime",
2546
2651
  precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
2547
2652
  offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
2653
+ local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
2548
2654
  ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
2549
2655
  });
2550
2656
  }
2657
+ date(message) {
2658
+ return this._addCheck({ kind: "date", message });
2659
+ }
2660
+ time(options) {
2661
+ if (typeof options === "string") {
2662
+ return this._addCheck({
2663
+ kind: "time",
2664
+ precision: null,
2665
+ message: options
2666
+ });
2667
+ }
2668
+ return this._addCheck({
2669
+ kind: "time",
2670
+ precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
2671
+ ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
2672
+ });
2673
+ }
2674
+ duration(message) {
2675
+ return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
2676
+ }
2551
2677
  regex(regex, message) {
2552
2678
  return this._addCheck({
2553
2679
  kind: "regex",
@@ -2626,6 +2752,15 @@ var _ZodString = class _ZodString extends ZodType {
2626
2752
  get isDatetime() {
2627
2753
  return !!this._def.checks.find((ch) => ch.kind === "datetime");
2628
2754
  }
2755
+ get isDate() {
2756
+ return !!this._def.checks.find((ch) => ch.kind === "date");
2757
+ }
2758
+ get isTime() {
2759
+ return !!this._def.checks.find((ch) => ch.kind === "time");
2760
+ }
2761
+ get isDuration() {
2762
+ return !!this._def.checks.find((ch) => ch.kind === "duration");
2763
+ }
2629
2764
  get isEmail() {
2630
2765
  return !!this._def.checks.find((ch) => ch.kind === "email");
2631
2766
  }
@@ -2638,6 +2773,9 @@ var _ZodString = class _ZodString extends ZodType {
2638
2773
  get isUUID() {
2639
2774
  return !!this._def.checks.find((ch) => ch.kind === "uuid");
2640
2775
  }
2776
+ get isNANOID() {
2777
+ return !!this._def.checks.find((ch) => ch.kind === "nanoid");
2778
+ }
2641
2779
  get isCUID() {
2642
2780
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
2643
2781
  }
@@ -2650,6 +2788,9 @@ var _ZodString = class _ZodString extends ZodType {
2650
2788
  get isIP() {
2651
2789
  return !!this._def.checks.find((ch) => ch.kind === "ip");
2652
2790
  }
2791
+ get isBase64() {
2792
+ return !!this._def.checks.find((ch) => ch.kind === "base64");
2793
+ }
2653
2794
  get minLength() {
2654
2795
  let min = null;
2655
2796
  for (const ch of this._def.checks) {
@@ -3591,9 +3732,10 @@ var _ZodObject = class _ZodObject extends ZodType {
3591
3732
  const syncPairs = [];
3592
3733
  for (const pair of pairs) {
3593
3734
  const key = await pair.key;
3735
+ const value = await pair.value;
3594
3736
  syncPairs.push({
3595
3737
  key,
3596
- value: await pair.value,
3738
+ value,
3597
3739
  alwaysSet: pair.alwaysSet
3598
3740
  });
3599
3741
  }
@@ -3949,15 +4091,25 @@ var getDiscriminator = /* @__PURE__ */ __name((type) => {
3949
4091
  } else if (type instanceof ZodEnum) {
3950
4092
  return type.options;
3951
4093
  } else if (type instanceof ZodNativeEnum) {
3952
- return Object.keys(type.enum);
4094
+ return util.objectValues(type.enum);
3953
4095
  } else if (type instanceof ZodDefault) {
3954
4096
  return getDiscriminator(type._def.innerType);
3955
4097
  } else if (type instanceof ZodUndefined) {
3956
4098
  return [void 0];
3957
4099
  } else if (type instanceof ZodNull) {
3958
4100
  return [null];
4101
+ } else if (type instanceof ZodOptional) {
4102
+ return [void 0, ...getDiscriminator(type.unwrap())];
4103
+ } else if (type instanceof ZodNullable) {
4104
+ return [null, ...getDiscriminator(type.unwrap())];
4105
+ } else if (type instanceof ZodBranded) {
4106
+ return getDiscriminator(type.unwrap());
4107
+ } else if (type instanceof ZodReadonly) {
4108
+ return getDiscriminator(type.unwrap());
4109
+ } else if (type instanceof ZodCatch) {
4110
+ return getDiscriminator(type._def.innerType);
3959
4111
  } else {
3960
- return null;
4112
+ return [];
3961
4113
  }
3962
4114
  }, "getDiscriminator");
3963
4115
  var _ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
@@ -4017,7 +4169,7 @@ var _ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
4017
4169
  const optionsMap = /* @__PURE__ */ new Map();
4018
4170
  for (const type of options) {
4019
4171
  const discriminatorValues = getDiscriminator(type.shape[discriminator]);
4020
- if (!discriminatorValues) {
4172
+ if (!discriminatorValues.length) {
4021
4173
  throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
4022
4174
  }
4023
4175
  for (const value of discriminatorValues) {
@@ -4224,7 +4376,8 @@ var _ZodRecord = class _ZodRecord extends ZodType {
4224
4376
  for (const key in ctx.data) {
4225
4377
  pairs.push({
4226
4378
  key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
4227
- value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
4379
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
4380
+ alwaysSet: key in ctx.data
4228
4381
  });
4229
4382
  }
4230
4383
  if (ctx.common.async) {
@@ -4584,6 +4737,10 @@ function createZodEnum(values, params) {
4584
4737
  }
4585
4738
  __name(createZodEnum, "createZodEnum");
4586
4739
  var _ZodEnum = class _ZodEnum extends ZodType {
4740
+ constructor() {
4741
+ super(...arguments);
4742
+ _ZodEnum_cache.set(this, void 0);
4743
+ }
4587
4744
  _parse(input) {
4588
4745
  if (typeof input.data !== "string") {
4589
4746
  const ctx = this._getOrReturnCtx(input);
@@ -4595,7 +4752,10 @@ var _ZodEnum = class _ZodEnum extends ZodType {
4595
4752
  });
4596
4753
  return INVALID;
4597
4754
  }
4598
- if (this._def.values.indexOf(input.data) === -1) {
4755
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
4756
+ __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
4757
+ }
4758
+ if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
4599
4759
  const ctx = this._getOrReturnCtx(input);
4600
4760
  const expectedValues = this._def.values;
4601
4761
  addIssueToContext(ctx, {
@@ -4631,17 +4791,28 @@ var _ZodEnum = class _ZodEnum extends ZodType {
4631
4791
  }
4632
4792
  return enumValues2;
4633
4793
  }
4634
- extract(values) {
4635
- return _ZodEnum.create(values);
4794
+ extract(values, newDef = this._def) {
4795
+ return _ZodEnum.create(values, {
4796
+ ...this._def,
4797
+ ...newDef
4798
+ });
4636
4799
  }
4637
- exclude(values) {
4638
- return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
4800
+ exclude(values, newDef = this._def) {
4801
+ return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
4802
+ ...this._def,
4803
+ ...newDef
4804
+ });
4639
4805
  }
4640
4806
  };
4641
4807
  __name(_ZodEnum, "ZodEnum");
4642
4808
  var ZodEnum = _ZodEnum;
4809
+ _ZodEnum_cache = /* @__PURE__ */ new WeakMap();
4643
4810
  ZodEnum.create = createZodEnum;
4644
4811
  var _ZodNativeEnum = class _ZodNativeEnum extends ZodType {
4812
+ constructor() {
4813
+ super(...arguments);
4814
+ _ZodNativeEnum_cache.set(this, void 0);
4815
+ }
4645
4816
  _parse(input) {
4646
4817
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
4647
4818
  const ctx = this._getOrReturnCtx(input);
@@ -4654,7 +4825,10 @@ var _ZodNativeEnum = class _ZodNativeEnum extends ZodType {
4654
4825
  });
4655
4826
  return INVALID;
4656
4827
  }
4657
- if (nativeEnumValues.indexOf(input.data) === -1) {
4828
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
4829
+ __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
4830
+ }
4831
+ if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
4658
4832
  const expectedValues = util.objectValues(nativeEnumValues);
4659
4833
  addIssueToContext(ctx, {
4660
4834
  received: ctx.data,
@@ -4671,6 +4845,7 @@ var _ZodNativeEnum = class _ZodNativeEnum extends ZodType {
4671
4845
  };
4672
4846
  __name(_ZodNativeEnum, "ZodNativeEnum");
4673
4847
  var ZodNativeEnum = _ZodNativeEnum;
4848
+ _ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
4674
4849
  ZodNativeEnum.create = (values, params) => {
4675
4850
  return new ZodNativeEnum({
4676
4851
  values,
@@ -4736,26 +4911,38 @@ var _ZodEffects = class _ZodEffects extends ZodType {
4736
4911
  checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
4737
4912
  if (effect.type === "preprocess") {
4738
4913
  const processed = effect.transform(ctx.data, checkCtx);
4739
- if (ctx.common.issues.length) {
4740
- return {
4741
- status: "dirty",
4742
- value: ctx.data
4743
- };
4744
- }
4745
4914
  if (ctx.common.async) {
4746
- return Promise.resolve(processed).then((processed2) => {
4747
- return this._def.schema._parseAsync({
4915
+ return Promise.resolve(processed).then(async (processed2) => {
4916
+ if (status.value === "aborted")
4917
+ return INVALID;
4918
+ const result = await this._def.schema._parseAsync({
4748
4919
  data: processed2,
4749
4920
  path: ctx.path,
4750
4921
  parent: ctx
4751
4922
  });
4923
+ if (result.status === "aborted")
4924
+ return INVALID;
4925
+ if (result.status === "dirty")
4926
+ return DIRTY(result.value);
4927
+ if (status.value === "dirty")
4928
+ return DIRTY(result.value);
4929
+ return result;
4752
4930
  });
4753
4931
  } else {
4754
- return this._def.schema._parseSync({
4932
+ if (status.value === "aborted")
4933
+ return INVALID;
4934
+ const result = this._def.schema._parseSync({
4755
4935
  data: processed,
4756
4936
  path: ctx.path,
4757
4937
  parent: ctx
4758
4938
  });
4939
+ if (result.status === "aborted")
4940
+ return INVALID;
4941
+ if (result.status === "dirty")
4942
+ return DIRTY(result.value);
4943
+ if (status.value === "dirty")
4944
+ return DIRTY(result.value);
4945
+ return result;
4759
4946
  }
4760
4947
  }
4761
4948
  if (effect.type === "refinement") {
@@ -5060,10 +5247,16 @@ var ZodPipeline = _ZodPipeline;
5060
5247
  var _ZodReadonly = class _ZodReadonly extends ZodType {
5061
5248
  _parse(input) {
5062
5249
  const result = this._def.innerType._parse(input);
5063
- if (isValid(result)) {
5064
- result.value = Object.freeze(result.value);
5065
- }
5066
- return result;
5250
+ const freeze = /* @__PURE__ */ __name((data) => {
5251
+ if (isValid(data)) {
5252
+ data.value = Object.freeze(data.value);
5253
+ }
5254
+ return data;
5255
+ }, "freeze");
5256
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
5257
+ }
5258
+ unwrap() {
5259
+ return this._def.innerType;
5067
5260
  }
5068
5261
  };
5069
5262
  __name(_ZodReadonly, "ZodReadonly");
@@ -5075,7 +5268,7 @@ ZodReadonly.create = (type, params) => {
5075
5268
  ...processCreateParams(params)
5076
5269
  });
5077
5270
  };
5078
- var custom = /* @__PURE__ */ __name((check, params = {}, fatal) => {
5271
+ function custom(check, params = {}, fatal) {
5079
5272
  if (check)
5080
5273
  return ZodAny.create().superRefine((data, ctx) => {
5081
5274
  var _a, _b;
@@ -5087,7 +5280,8 @@ var custom = /* @__PURE__ */ __name((check, params = {}, fatal) => {
5087
5280
  }
5088
5281
  });
5089
5282
  return ZodAny.create();
5090
- }, "custom");
5283
+ }
5284
+ __name(custom, "custom");
5091
5285
  var late = {
5092
5286
  object: ZodObject.lazycreate
5093
5287
  };
@@ -5206,6 +5400,7 @@ var z = /* @__PURE__ */ Object.freeze({
5206
5400
  ZodParsedType,
5207
5401
  getParsedType,
5208
5402
  ZodType,
5403
+ datetimeRegex,
5209
5404
  ZodString,
5210
5405
  ZodNumber,
5211
5406
  ZodBigInt,
@@ -5336,10 +5531,15 @@ z.union([
5336
5531
  ]).transform((arg) => {
5337
5532
  try {
5338
5533
  if (arg.startsWith("0x")) {
5339
- return utilCrypto.encodeAddress(util$1.hexToU8a(arg), DOT_PREFIX);
5534
+ return ss582__namespace.encode({
5535
+ data: arg,
5536
+ ss58Format: DOT_PREFIX
5537
+ });
5340
5538
  }
5341
- const hex = util$1.u8aToHex(utilCrypto.decodeAddress(arg));
5342
- return utilCrypto.encodeAddress(hex, DOT_PREFIX);
5539
+ return ss582__namespace.encode({
5540
+ data: ss582__namespace.decode(arg).data,
5541
+ ss58Format: DOT_PREFIX
5542
+ });
5343
5543
  } catch {
5344
5544
  return null;
5345
5545
  }
@@ -5349,6 +5549,9 @@ z.union([
5349
5549
  hexString.refine((address) => ethers2__namespace.isAddress(address), (address) => ({
5350
5550
  message: `${address} is not a valid ethereum address`
5351
5551
  }));
5552
+ string.refine((address) => address.startsWith("cF") && ss582__namespace.decode(address), (address) => ({
5553
+ message: `${address} is not a valid chainflip address`
5554
+ }));
5352
5555
  numericString.transform((arg) => BigInt(arg));
5353
5556
  var u128 = z.union([
5354
5557
  number,
@@ -5371,7 +5574,7 @@ var uncheckedAssetAndChain = z.object({
5371
5574
  asset: z.string(),
5372
5575
  chain: z.string()
5373
5576
  });
5374
- uncheckedAssetAndChain.refine(isValidAssetAndChain);
5577
+ uncheckedAssetAndChain.refine((value) => isValidAssetAndChain(value));
5375
5578
  z.union([
5376
5579
  z.object({
5377
5580
  __kind: z.literal("CcmPrincipal"),
@@ -5393,6 +5596,36 @@ z.union([
5393
5596
  type: "SWAP"
5394
5597
  }))
5395
5598
  ]);
5599
+ var chainflipSS58Prefix = 2112;
5600
+ z.union([
5601
+ hexString,
5602
+ string.regex(/^[a-f\d]$/i).transform((value) => `0x${value}`)
5603
+ ]).transform((value) => ss582__namespace.encode({
5604
+ data: value,
5605
+ ss58Format: chainflipSS58Prefix
5606
+ }));
5607
+ z.union([
5608
+ z.object({
5609
+ __kind: z.literal("Swap"),
5610
+ swapId: u128
5611
+ }),
5612
+ z.object({
5613
+ __kind: z.literal("LiquidityProvision"),
5614
+ lpAccount: hexString
5615
+ }),
5616
+ z.object({
5617
+ __kind: z.literal("CcmTransfer"),
5618
+ principalSwapId: u128.nullable().optional(),
5619
+ gasSwapId: u128.nullable().optional()
5620
+ }),
5621
+ z.object({
5622
+ __kind: z.literal("NoAction")
5623
+ }),
5624
+ z.object({
5625
+ __kind: z.literal("BoostersCredited"),
5626
+ prewitnessedDepositId: u128
5627
+ })
5628
+ ]);
5396
5629
 
5397
5630
  // ../shared/src/rpc/index.ts
5398
5631
  var numberOrHex = z.union([
@@ -5401,8 +5634,10 @@ var numberOrHex = z.union([
5401
5634
  ]).transform((str) => BigInt(str));
5402
5635
  var camelCase = /* @__PURE__ */ __name((str) => str.replace(/_([a-z])/g, (_, char) => char.toUpperCase()), "camelCase");
5403
5636
  var camelCaseKeys = /* @__PURE__ */ __name((obj) => {
5404
- if (typeof obj !== "object" || Array.isArray(obj) || obj === null)
5637
+ if (typeof obj !== "object" || obj === null)
5405
5638
  return obj;
5639
+ if (Array.isArray(obj))
5640
+ return obj.map((item) => camelCaseKeys(item));
5406
5641
  return Object.fromEntries(Object.entries(obj).map(([key, value]) => [
5407
5642
  camelCase(key),
5408
5643
  camelCaseKeys(value)
@@ -5430,6 +5665,24 @@ var createRequest = /* @__PURE__ */ __name((method, responseParser) => async (ur
5430
5665
  cause: data.error
5431
5666
  });
5432
5667
  }, "createRequest");
5668
+ var createRequestWithoutParser = /* @__PURE__ */ __name((method) => async (urlOrNetwork, ...params) => {
5669
+ const url = "network" in urlOrNetwork ? RPC_URLS[urlOrNetwork.network] : urlOrNetwork.rpcUrl;
5670
+ const { data } = await axios__default.default.post(
5671
+ url,
5672
+ {
5673
+ jsonrpc: "2.0",
5674
+ method,
5675
+ params,
5676
+ id: 1
5677
+ },
5678
+ // prevent JSON.parse from being called because the RPC we are requesting
5679
+ // returns numbers that are unsafe to parse
5680
+ {
5681
+ transformResponse: (d) => d
5682
+ }
5683
+ );
5684
+ return data;
5685
+ }, "createRequestWithoutParser");
5433
5686
  var fundingEnvironment = z.object({
5434
5687
  redemption_tax: numberOrHex,
5435
5688
  minimum_funding_amount: numberOrHex
@@ -5488,28 +5741,23 @@ var ingressEgressEnvironment = z.object({
5488
5741
  egress_dust_limits: "minimum_egress_amounts"
5489
5742
  }));
5490
5743
  createRequest("cf_ingress_egress_environment", ingressEgressEnvironment);
5491
- var rpcAsset = z.union([
5492
- z.literal("BTC"),
5744
+ var rpcAssetSchema = z.union([
5493
5745
  z.object({
5494
5746
  chain: z.literal("Bitcoin"),
5495
5747
  asset: z.literal("BTC")
5496
5748
  }),
5497
- z.literal("DOT"),
5498
5749
  z.object({
5499
5750
  chain: z.literal("Polkadot"),
5500
5751
  asset: z.literal("DOT")
5501
5752
  }),
5502
- z.literal("FLIP"),
5503
5753
  z.object({
5504
5754
  chain: z.literal("Ethereum"),
5505
5755
  asset: z.literal("FLIP")
5506
5756
  }),
5507
- z.literal("ETH"),
5508
5757
  z.object({
5509
5758
  chain: z.literal("Ethereum"),
5510
5759
  asset: z.literal("ETH")
5511
5760
  }),
5512
- z.literal("USDC"),
5513
5761
  z.object({
5514
5762
  chain: z.literal("Ethereum"),
5515
5763
  asset: z.literal("USDC")
@@ -5527,39 +5775,6 @@ var rpcAsset = z.union([
5527
5775
  asset: z.literal("USDC")
5528
5776
  })
5529
5777
  ]);
5530
- var poolInfo = z.intersection(z.object({
5531
- limit_order_fee_hundredth_pips: z.number(),
5532
- range_order_fee_hundredth_pips: z.number()
5533
- }), z.union([
5534
- z.object({
5535
- quote_asset: rpcAsset
5536
- }),
5537
- z.object({
5538
- pair_asset: rpcAsset
5539
- }).transform(({ pair_asset }) => ({
5540
- quote_asset: pair_asset
5541
- }))
5542
- ]));
5543
- var feesInfo = z.object({
5544
- Bitcoin: z.object({
5545
- BTC: poolInfo
5546
- }),
5547
- Ethereum: z.object({
5548
- ETH: poolInfo,
5549
- FLIP: poolInfo
5550
- }),
5551
- Polkadot: z.object({
5552
- DOT: poolInfo
5553
- }),
5554
- Arbitrum: z.object({
5555
- ETH: poolInfo,
5556
- USDC: poolInfo
5557
- }).optional()
5558
- });
5559
- var poolsEnvironment = z.object({
5560
- fees: feesInfo
5561
- });
5562
- createRequest("cf_pool_info", poolsEnvironment);
5563
5778
  var environment = z.object({
5564
5779
  ingress_egress: ingressEgressEnvironment,
5565
5780
  swapping: swappingEnvironment,
@@ -5571,30 +5786,21 @@ var swapRate = z.object({
5571
5786
  });
5572
5787
  createRequest("cf_swap_rate", swapRate);
5573
5788
  createRequest("state_getMetadata", hexString);
5574
- var supportedAssetsV120 = z.object({
5575
- Bitcoin: z.array(z.string()),
5576
- Ethereum: z.array(z.string()),
5577
- Polkadot: z.array(z.string())
5578
- }).transform((data) => [
5579
- ...data.Bitcoin.map((asset2) => ({
5580
- chain: "Bitcoin",
5581
- asset: asset2
5582
- })),
5583
- ...data.Ethereum.map((asset2) => ({
5584
- chain: "Ethereum",
5585
- asset: asset2
5586
- })),
5587
- ...data.Polkadot.map((asset2) => ({
5588
- chain: "Polkadot",
5589
- asset: asset2
5590
- }))
5591
- ]);
5592
- var supportedAssetsV130 = z.array(uncheckedAssetAndChain);
5593
- var supportedAssets = z.union([
5594
- supportedAssetsV120,
5595
- supportedAssetsV130
5596
- ]);
5789
+ var supportedAssets = z.array(uncheckedAssetAndChain);
5597
5790
  createRequest("cf_supported_assets", supportedAssets);
5791
+ createRequest("state_getRuntimeVersion", z.object({
5792
+ specVersion: z.number()
5793
+ }));
5794
+ createRequestWithoutParser("cf_pool_orders");
5795
+ createRequest("cf_pool_price_v2", z.object({
5796
+ range_order: numberOrHex
5797
+ }));
5798
+ createRequest("chain_getBlockHash", hexString);
5799
+ var boostPoolsDepthResponseSchema = z.array(z.intersection(rpcAssetSchema, z.object({
5800
+ tier: number,
5801
+ available_amount: u128
5802
+ })));
5803
+ createRequest("cf_boost_pools_depth", boostPoolsDepthResponseSchema);
5598
5804
 
5599
5805
  // ../shared/src/stateChainGateway/utils.ts
5600
5806
  var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
@@ -5617,18 +5823,20 @@ var approveStateChainGateway = /* @__PURE__ */ __name(async (amount, networkOpts
5617
5823
  }, "approveStateChainGateway");
5618
5824
 
5619
5825
  // ../shared/src/stateChainGateway/index.ts
5620
- var fundStateChainAccount = /* @__PURE__ */ __name(async (accountId, amount, networkOpts, txOpts) => {
5826
+ var fundStateChainAccount = /* @__PURE__ */ __name(async (accountId2, amount, networkOpts, txOpts) => {
5621
5827
  const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getTokenContractAddress(InternalAssets.Flip, networkOpts.network);
5622
5828
  const stateChainGateway = getStateChainGateway(networkOpts);
5623
5829
  const { hasSufficientAllowance } = await checkAllowance(amount, await stateChainGateway.getAddress(), flipContractAddress, networkOpts.signer);
5624
5830
  assert(hasSufficientAllowance, "Insufficient allowance");
5625
- const transaction = await stateChainGateway.fundStateChainAccount(accountId, amount, extractOverrides(txOpts));
5626
- return transaction.wait(txOpts.wait);
5831
+ const transaction = await stateChainGateway.fundStateChainAccount(accountId2, amount, extractOverrides(txOpts));
5832
+ await transaction.wait(txOpts.wait);
5833
+ return transaction;
5627
5834
  }, "fundStateChainAccount");
5628
- var executeRedemption = /* @__PURE__ */ __name(async (accountId, networkOpts, txOpts) => {
5835
+ var executeRedemption = /* @__PURE__ */ __name(async (accountId2, networkOpts, txOpts) => {
5629
5836
  const stateChainGateway = getStateChainGateway(networkOpts);
5630
- const transaction = await stateChainGateway.executeRedemption(accountId, extractOverrides(txOpts));
5631
- return transaction.wait(txOpts.wait);
5837
+ const transaction = await stateChainGateway.executeRedemption(accountId2, extractOverrides(txOpts));
5838
+ await transaction.wait(txOpts.wait);
5839
+ return transaction;
5632
5840
  }, "executeRedemption");
5633
5841
  var getMinimumFunding = /* @__PURE__ */ __name((networkOpts) => {
5634
5842
  const stateChainGateway = getStateChainGateway(networkOpts);
@@ -5638,10 +5846,10 @@ var getRedemptionDelay = /* @__PURE__ */ __name((networkOpts) => {
5638
5846
  const stateChainGateway = getStateChainGateway(networkOpts);
5639
5847
  return stateChainGateway.REDEMPTION_DELAY();
5640
5848
  }, "getRedemptionDelay");
5641
- var getPendingRedemption = /* @__PURE__ */ __name(async (accountId, networkOpts) => {
5849
+ var getPendingRedemption = /* @__PURE__ */ __name(async (accountId2, networkOpts) => {
5642
5850
  const stateChainGateway = getStateChainGateway(networkOpts);
5643
- const pendingRedemption = await stateChainGateway.getPendingRedemption(accountId);
5644
- return pendingRedemption.amount !== 0n ? stateChainGateway.getPendingRedemption(accountId) : void 0;
5851
+ const pendingRedemption = await stateChainGateway.getPendingRedemption(accountId2);
5852
+ return pendingRedemption.amount !== 0n ? stateChainGateway.getPendingRedemption(accountId2) : void 0;
5645
5853
  }, "getPendingRedemption");
5646
5854
 
5647
5855
  // src/funding/sdk.ts
@@ -5665,15 +5873,15 @@ var _FundingSDK = class _FundingSDK {
5665
5873
  * @param accountId the hex-encoded validator account id
5666
5874
  * @param amount the amount to fund in base units of FLIP
5667
5875
  */
5668
- async fundStateChainAccount(accountId, amount, txOpts = {}) {
5669
- const tx = await fundStateChainAccount(accountId, amount, this.options, txOpts);
5876
+ async fundStateChainAccount(accountId2, amount, txOpts = {}) {
5877
+ const tx = await fundStateChainAccount(accountId2, amount, this.options, txOpts);
5670
5878
  return tx.hash;
5671
5879
  }
5672
5880
  /**
5673
5881
  * @param accountId the hex-encoded validator account id
5674
5882
  */
5675
- async executeRedemption(accountId, txOpts = {}) {
5676
- const tx = await executeRedemption(accountId, this.options, txOpts);
5883
+ async executeRedemption(accountId2, txOpts = {}) {
5884
+ const tx = await executeRedemption(accountId2, this.options, txOpts);
5677
5885
  return tx.hash;
5678
5886
  }
5679
5887
  async getMinimumFunding() {
@@ -5685,16 +5893,16 @@ var _FundingSDK = class _FundingSDK {
5685
5893
  async getFlipBalance() {
5686
5894
  return getFlipBalance(this.options.network, this.options.signer);
5687
5895
  }
5688
- async getPendingRedemption(accountId) {
5689
- return getPendingRedemption(accountId, this.options);
5896
+ async getPendingRedemption(accountId2) {
5897
+ return getPendingRedemption(accountId2, this.options);
5690
5898
  }
5691
5899
  /**
5692
5900
  * @param the amount of FLIP to request approval for
5693
5901
  * @returns the transaction hash or null if no approval was required
5694
5902
  */
5695
5903
  async approveStateChainGateway(amount, txOpts = {}) {
5696
- const receipt = await approveStateChainGateway(amount, this.options, txOpts);
5697
- return receipt ? receipt.hash : null;
5904
+ const tx = await approveStateChainGateway(amount, this.options, txOpts);
5905
+ return tx ? tx.hash : null;
5698
5906
  }
5699
5907
  async getRedemptionTax() {
5700
5908
  this.redemptionTax ?? (this.redemptionTax = (await getFundingEnvironment(this.rpcConfig)).redemptionTax);