@chainflip/sdk 1.4.1 → 1.4.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,5 +1,5 @@
1
- import { z, assetAndChain, numericString, hexString, btcAddress, ccmMetadataSchema, hexStringFromNumber, affiliateBroker, dotAddress, ethereumAddress } from './chunk-M2KPIR26.mjs';
2
- import { __name, Chains } from './chunk-VT6GEMQN.mjs';
1
+ import { z, assetAndChain, numericString, hexString, btcAddress, ccmMetadataSchema, hexStringFromNumber, affiliateBroker, dotAddress, ethereumAddress } from './chunk-YTHKYS6R.mjs';
2
+ import { __name, Chains } from './chunk-3V7QJANN.mjs';
3
3
  import { HttpClient } from '@chainflip/rpc';
4
4
  import { bytesToHex } from '@chainflip/utils/bytes';
5
5
  import * as ss58 from '@chainflip/utils/ss58';
@@ -1,10 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
- var __publicField = (obj, key, value) => {
5
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
- return value;
7
- };
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
5
 
9
6
  // ../shared/src/enums.ts
10
7
  var arrayToMap = /* @__PURE__ */ __name((array) => Object.fromEntries(array.map((key) => [
@@ -140,8 +137,7 @@ var chainConstants = {
140
137
  };
141
138
  function isValidAssetAndChain(assetAndChain) {
142
139
  const { asset, chain } = assetAndChain;
143
- if (!(chain in Chains))
144
- return false;
140
+ if (!(chain in Chains)) return false;
145
141
  const validAssets = chainConstants[chain].assets;
146
142
  return validAssets.includes(asset);
147
143
  }
@@ -193,13 +189,26 @@ function getInternalAssets({ srcAsset, srcChain, destAsset, destChain }, assert2
193
189
  };
194
190
  }
195
191
  __name(getInternalAssets, "getInternalAssets");
192
+ function getAssetAndChain(internalAsset, prefix) {
193
+ const { chain, asset } = assetConstants[internalAsset];
194
+ if (prefix) {
195
+ return {
196
+ [`${prefix}Asset`]: asset,
197
+ [`${prefix}Chain`]: chain
198
+ };
199
+ }
200
+ return {
201
+ chain,
202
+ asset
203
+ };
204
+ }
205
+ __name(getAssetAndChain, "getAssetAndChain");
196
206
 
197
207
  // ../shared/src/guards.ts
198
208
  var isString = /* @__PURE__ */ __name((value) => typeof value === "string", "isString");
199
209
  var isNotNullish = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isNotNullish");
200
210
  function assert(condition, message) {
201
- if (condition)
202
- return;
211
+ if (condition) return;
203
212
  const error = new Error(message);
204
213
  if (error.stack) {
205
214
  error.stack = error.stack.replace(/\n.+/, "\n");
@@ -208,4 +217,4 @@ function assert(condition, message) {
208
217
  }
209
218
  __name(assert, "assert");
210
219
 
211
- export { Assets, ChainflipNetworks, Chains, InternalAssets, __name, __publicField, assert, assetConstants, chainConstants, getInternalAsset, getInternalAssets, isNotNullish, isString, isTestnet, isValidAssetAndChain, readChainAssetValue };
220
+ export { Assets, ChainflipNetworks, Chains, InternalAssets, __name, __publicField, assert, assetConstants, chainConstants, getAssetAndChain, getInternalAsset, getInternalAssets, isNotNullish, isString, isTestnet, isValidAssetAndChain, readChainAssetValue };
@@ -1,13 +1,11 @@
1
- import { getInternalAsset, __name, __publicField, ChainflipNetworks, Chains, InternalAssets } from './chunk-VT6GEMQN.mjs';
1
+ import { getInternalAsset, __name, __publicField, ChainflipNetworks, Chains, InternalAssets } from './chunk-3V7QJANN.mjs';
2
2
  import { constants, HttpClient } from '@chainflip/rpc';
3
3
  import { Interface, Contract } from 'ethers';
4
4
 
5
5
  var camelCase = /* @__PURE__ */ __name((str) => str.replace(/_([a-z])/g, (_, char) => char.toUpperCase()), "camelCase");
6
6
  var camelCaseKeys = /* @__PURE__ */ __name((obj) => {
7
- if (typeof obj !== "object" || obj === null)
8
- return obj;
9
- if (Array.isArray(obj))
10
- return obj.map((item) => camelCaseKeys(item));
7
+ if (typeof obj !== "object" || obj === null) return obj;
8
+ if (Array.isArray(obj)) return obj.map((item) => camelCaseKeys(item));
11
9
  return Object.fromEntries(Object.entries(obj).map(([key, value]) => [
12
10
  camelCase(key),
13
11
  camelCaseKeys(value)
@@ -28,7 +26,7 @@ createRequest("state_getMetadata");
28
26
  var getSupportedAssets = createRequest("cf_supported_assets");
29
27
  createRequest("state_getRuntimeVersion");
30
28
  createRequest("chain_getBlockHash");
31
- transform(createRequest("cf_boost_pools_depth"), (result) => result.map(({ chain, asset, ...rest }) => ({
29
+ var getAllBoostPoolsDepth = transform(createRequest("cf_boost_pools_depth"), (result) => result.map(({ chain, asset, ...rest }) => ({
32
30
  asset: getInternalAsset({
33
31
  chain,
34
32
  asset
@@ -2088,14 +2086,10 @@ var extractOverrides = /* @__PURE__ */ __name((transactionOverrides) => {
2088
2086
  return ethersOverrides;
2089
2087
  }, "extractOverrides");
2090
2088
  function getTokenContractAddress(asset, network) {
2091
- if (asset === InternalAssets.Flip)
2092
- return ADDRESSES[network].FLIP_CONTRACT_ADDRESS;
2093
- if (asset === InternalAssets.Usdc)
2094
- return ADDRESSES[network].USDC_CONTRACT_ADDRESS;
2095
- if (asset === InternalAssets.Usdt)
2096
- return ADDRESSES[network].USDT_CONTRACT_ADDRESS;
2097
- if (asset === InternalAssets.ArbUsdc)
2098
- return ADDRESSES[network].ARBUSDC_CONTRACT_ADDRESS;
2089
+ if (asset === InternalAssets.Flip) return ADDRESSES[network].FLIP_CONTRACT_ADDRESS;
2090
+ if (asset === InternalAssets.Usdc) return ADDRESSES[network].USDC_CONTRACT_ADDRESS;
2091
+ if (asset === InternalAssets.Usdt) return ADDRESSES[network].USDT_CONTRACT_ADDRESS;
2092
+ if (asset === InternalAssets.ArbUsdc) return ADDRESSES[network].ARBUSDC_CONTRACT_ADDRESS;
2099
2093
  throw new Error(`No contract address for ${asset} on ${network}`);
2100
2094
  }
2101
2095
  __name(getTokenContractAddress, "getTokenContractAddress");
@@ -2111,17 +2105,14 @@ var checkAllowance = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20
2111
2105
  };
2112
2106
  }, "checkAllowance");
2113
2107
  var approve = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20, allowance, txOpts) => {
2114
- if (allowance >= amount)
2115
- return null;
2108
+ if (allowance >= amount) return null;
2116
2109
  const transaction = await erc20.approve(spenderAddress, amount - allowance, extractOverrides(txOpts));
2117
2110
  await transaction.wait(txOpts.wait);
2118
2111
  return transaction;
2119
2112
  }, "approve");
2120
2113
  var getVaultContractAddress = /* @__PURE__ */ __name((chain, network) => {
2121
- if (chain === Chains.Ethereum)
2122
- return ADDRESSES[network].VAULT_CONTRACT_ADDRESS;
2123
- if (chain === Chains.Arbitrum)
2124
- return ADDRESSES[network].ARB_VAULT_CONTRACT_ADDRESS;
2114
+ if (chain === Chains.Ethereum) return ADDRESSES[network].VAULT_CONTRACT_ADDRESS;
2115
+ if (chain === Chains.Arbitrum) return ADDRESSES[network].ARB_VAULT_CONTRACT_ADDRESS;
2125
2116
  throw new Error(`No vault contract address for ${chain} on ${network}`);
2126
2117
  }, "getVaultContractAddress");
2127
2118
  var getFlipBalance = /* @__PURE__ */ __name(async (network, signer) => {
@@ -2130,4 +2121,4 @@ var getFlipBalance = /* @__PURE__ */ __name(async (network, signer) => {
2130
2121
  return flip.balanceOf(await signer.getAddress());
2131
2122
  }, "getFlipBalance");
2132
2123
 
2133
- export { StateChainGateway__factory, Vault__factory, approve, checkAllowance, extractOverrides, getEnvironment, getEvmChainId, getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, getSupportedAssets, getTokenContractAddress, getVaultContractAddress };
2124
+ export { StateChainGateway__factory, Vault__factory, approve, checkAllowance, extractOverrides, getAllBoostPoolsDepth, getEnvironment, getEvmChainId, getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, getSupportedAssets, getTokenContractAddress, getVaultContractAddress };
@@ -1,4 +1,4 @@
1
- import { __name, isString, InternalAssets, Chains, Assets, ChainflipNetworks, isValidAssetAndChain, getInternalAssets, assert } from './chunk-VT6GEMQN.mjs';
1
+ import { __name, isString, InternalAssets, Chains, Assets, ChainflipNetworks, isValidAssetAndChain, getInternalAssets, assert } from './chunk-3V7QJANN.mjs';
2
2
  import * as ss582 from '@chainflip/utils/ss58';
3
3
  import '@chainflip/utils/string';
4
4
  import * as ethers from 'ethers';
@@ -471,20 +471,15 @@ var isDirty = /* @__PURE__ */ __name((x) => x.status === "dirty", "isDirty");
471
471
  var isValid = /* @__PURE__ */ __name((x) => x.status === "valid", "isValid");
472
472
  var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
473
473
  function __classPrivateFieldGet(receiver, state, kind, f) {
474
- if (kind === "a" && !f)
475
- throw new TypeError("Private accessor was defined without a getter");
476
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
477
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
474
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
475
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
478
476
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
479
477
  }
480
478
  __name(__classPrivateFieldGet, "__classPrivateFieldGet");
481
479
  function __classPrivateFieldSet(receiver, state, value, kind, f) {
482
- if (kind === "m")
483
- throw new TypeError("Private method is not writable");
484
- if (kind === "a" && !f)
485
- throw new TypeError("Private accessor was defined without a setter");
486
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
487
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
480
+ if (kind === "m") throw new TypeError("Private method is not writable");
481
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
482
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
488
483
  return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
489
484
  }
490
485
  __name(__classPrivateFieldSet, "__classPrivateFieldSet");
@@ -2161,7 +2156,7 @@ function deepPartialify(schema) {
2161
2156
  }
2162
2157
  return new ZodObject({
2163
2158
  ...schema._def,
2164
- shape: () => newShape
2159
+ shape: /* @__PURE__ */ __name(() => newShape, "shape")
2165
2160
  });
2166
2161
  } else if (schema instanceof ZodArray) {
2167
2162
  return new ZodArray({
@@ -2241,8 +2236,7 @@ var _ZodObject = class _ZodObject extends ZodType {
2241
2236
  });
2242
2237
  status.dirty();
2243
2238
  }
2244
- } else if (unknownKeys === "strip")
2245
- ;
2239
+ } else if (unknownKeys === "strip") ;
2246
2240
  else {
2247
2241
  throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
2248
2242
  }
@@ -2289,7 +2283,7 @@ var _ZodObject = class _ZodObject extends ZodType {
2289
2283
  ...this._def,
2290
2284
  unknownKeys: "strict",
2291
2285
  ...message !== void 0 ? {
2292
- errorMap: (issue, ctx) => {
2286
+ errorMap: /* @__PURE__ */ __name((issue, ctx) => {
2293
2287
  var _a, _b, _c, _d;
2294
2288
  const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
2295
2289
  if (issue.code === "unrecognized_keys")
@@ -2299,7 +2293,7 @@ var _ZodObject = class _ZodObject extends ZodType {
2299
2293
  return {
2300
2294
  message: defaultError
2301
2295
  };
2302
- }
2296
+ }, "errorMap")
2303
2297
  } : {}
2304
2298
  });
2305
2299
  }
@@ -2335,10 +2329,10 @@ var _ZodObject = class _ZodObject extends ZodType {
2335
2329
  extend(augmentation) {
2336
2330
  return new _ZodObject({
2337
2331
  ...this._def,
2338
- shape: () => ({
2332
+ shape: /* @__PURE__ */ __name(() => ({
2339
2333
  ...this._def.shape(),
2340
2334
  ...augmentation
2341
- })
2335
+ }), "shape")
2342
2336
  });
2343
2337
  }
2344
2338
  /**
@@ -2350,10 +2344,10 @@ var _ZodObject = class _ZodObject extends ZodType {
2350
2344
  const merged = new _ZodObject({
2351
2345
  unknownKeys: merging._def.unknownKeys,
2352
2346
  catchall: merging._def.catchall,
2353
- shape: () => ({
2347
+ shape: /* @__PURE__ */ __name(() => ({
2354
2348
  ...this._def.shape(),
2355
2349
  ...merging._def.shape()
2356
- }),
2350
+ }), "shape"),
2357
2351
  typeName: ZodFirstPartyTypeKind.ZodObject
2358
2352
  });
2359
2353
  return merged;
@@ -2432,7 +2426,7 @@ var _ZodObject = class _ZodObject extends ZodType {
2432
2426
  });
2433
2427
  return new _ZodObject({
2434
2428
  ...this._def,
2435
- shape: () => shape
2429
+ shape: /* @__PURE__ */ __name(() => shape, "shape")
2436
2430
  });
2437
2431
  }
2438
2432
  omit(mask) {
@@ -2444,7 +2438,7 @@ var _ZodObject = class _ZodObject extends ZodType {
2444
2438
  });
2445
2439
  return new _ZodObject({
2446
2440
  ...this._def,
2447
- shape: () => shape
2441
+ shape: /* @__PURE__ */ __name(() => shape, "shape")
2448
2442
  });
2449
2443
  }
2450
2444
  /**
@@ -2465,7 +2459,7 @@ var _ZodObject = class _ZodObject extends ZodType {
2465
2459
  });
2466
2460
  return new _ZodObject({
2467
2461
  ...this._def,
2468
- shape: () => newShape
2462
+ shape: /* @__PURE__ */ __name(() => newShape, "shape")
2469
2463
  });
2470
2464
  }
2471
2465
  required(mask) {
@@ -2484,7 +2478,7 @@ var _ZodObject = class _ZodObject extends ZodType {
2484
2478
  });
2485
2479
  return new _ZodObject({
2486
2480
  ...this._def,
2487
- shape: () => newShape
2481
+ shape: /* @__PURE__ */ __name(() => newShape, "shape")
2488
2482
  });
2489
2483
  }
2490
2484
  keyof() {
@@ -2495,7 +2489,7 @@ __name(_ZodObject, "ZodObject");
2495
2489
  var ZodObject = _ZodObject;
2496
2490
  ZodObject.create = (shape, params) => {
2497
2491
  return new ZodObject({
2498
- shape: () => shape,
2492
+ shape: /* @__PURE__ */ __name(() => shape, "shape"),
2499
2493
  unknownKeys: "strip",
2500
2494
  catchall: ZodNever.create(),
2501
2495
  typeName: ZodFirstPartyTypeKind.ZodObject,
@@ -2504,7 +2498,7 @@ ZodObject.create = (shape, params) => {
2504
2498
  };
2505
2499
  ZodObject.strictCreate = (shape, params) => {
2506
2500
  return new ZodObject({
2507
- shape: () => shape,
2501
+ shape: /* @__PURE__ */ __name(() => shape, "shape"),
2508
2502
  unknownKeys: "strict",
2509
2503
  catchall: ZodNever.create(),
2510
2504
  typeName: ZodFirstPartyTypeKind.ZodObject,
@@ -3429,14 +3423,14 @@ var _ZodEffects = class _ZodEffects extends ZodType {
3429
3423
  const { status, ctx } = this._processInputParams(input);
3430
3424
  const effect = this._def.effect || null;
3431
3425
  const checkCtx = {
3432
- addIssue: (arg) => {
3426
+ addIssue: /* @__PURE__ */ __name((arg) => {
3433
3427
  addIssueToContext(ctx, arg);
3434
3428
  if (arg.fatal) {
3435
3429
  status.abort();
3436
3430
  } else {
3437
3431
  status.dirty();
3438
3432
  }
3439
- },
3433
+ }, "addIssue"),
3440
3434
  get path() {
3441
3435
  return ctx.path;
3442
3436
  }
@@ -3898,14 +3892,14 @@ var ostring = /* @__PURE__ */ __name(() => stringType().optional(), "ostring");
3898
3892
  var onumber = /* @__PURE__ */ __name(() => numberType().optional(), "onumber");
3899
3893
  var oboolean = /* @__PURE__ */ __name(() => booleanType().optional(), "oboolean");
3900
3894
  var coerce = {
3901
- string: (arg) => ZodString.create({ ...arg, coerce: true }),
3902
- number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
3903
- boolean: (arg) => ZodBoolean.create({
3895
+ string: /* @__PURE__ */ __name((arg) => ZodString.create({ ...arg, coerce: true }), "string"),
3896
+ number: /* @__PURE__ */ __name((arg) => ZodNumber.create({ ...arg, coerce: true }), "number"),
3897
+ boolean: /* @__PURE__ */ __name((arg) => ZodBoolean.create({
3904
3898
  ...arg,
3905
3899
  coerce: true
3906
- }),
3907
- bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
3908
- date: (arg) => ZodDate.create({ ...arg, coerce: true })
3900
+ }), "boolean"),
3901
+ bigint: /* @__PURE__ */ __name((arg) => ZodBigInt.create({ ...arg, coerce: true }), "bigint"),
3902
+ date: /* @__PURE__ */ __name((arg) => ZodDate.create({ ...arg, coerce: true }), "date")
3909
3903
  };
3910
3904
  var NEVER = INVALID;
3911
3905
  var z = /* @__PURE__ */ Object.freeze({
@@ -4039,7 +4033,7 @@ var __copyProps = /* @__PURE__ */ __name((to, from, except, desc) => {
4039
4033
  if (from && typeof from === "object" || typeof from === "function") {
4040
4034
  for (let key of __getOwnPropNames(from))
4041
4035
  if (!__hasOwnProp.call(to, key) && key !== except)
4042
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
4036
+ __defProp(to, key, { get: /* @__PURE__ */ __name(() => from[key], "get"), enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
4043
4037
  }
4044
4038
  return to;
4045
4039
  }, "__copyProps");
@@ -69,4 +69,4 @@ type TransactionOptions = {
69
69
  wait?: number;
70
70
  };
71
71
 
72
- export { type AssetAndChain as A, type Chain as C, type InternalAsset as I, type TransactionOptions as T, type Asset as a, type AssetOfChain as b, type ChainflipNetwork as c, type ChainAssetMap as d, type ChainMap as e, Chains as f, Assets as g, InternalAssets as h, ChainflipNetworks as i, getInternalAsset as j };
72
+ export { type AssetAndChain as A, type Chain as C, type InternalAsset as I, type TransactionOptions as T, type UncheckedAssetAndChain as U, type Asset as a, type AssetOfChain as b, type ChainflipNetwork as c, type ChainAssetMap as d, type ChainMap as e, Chains as f, Assets as g, InternalAssets as h, ChainflipNetworks as i, getInternalAsset as j };
@@ -69,4 +69,4 @@ type TransactionOptions = {
69
69
  wait?: number;
70
70
  };
71
71
 
72
- export { type AssetAndChain as A, type Chain as C, type InternalAsset as I, type TransactionOptions as T, type Asset as a, type AssetOfChain as b, type ChainflipNetwork as c, type ChainAssetMap as d, type ChainMap as e, Chains as f, Assets as g, InternalAssets as h, ChainflipNetworks as i, getInternalAsset as j };
72
+ export { type AssetAndChain as A, type Chain as C, type InternalAsset as I, type TransactionOptions as T, type UncheckedAssetAndChain as U, type Asset as a, type AssetOfChain as b, type ChainflipNetwork as c, type ChainAssetMap as d, type ChainMap as e, Chains as f, Assets as g, InternalAssets as h, ChainflipNetworks as i, getInternalAsset as j };
@@ -1,5 +1,5 @@
1
1
  import { Signer } from 'ethers';
2
- import { c as ChainflipNetwork, T as TransactionOptions } from './contracts-49zdGryt.mjs';
2
+ import { c as ChainflipNetwork, T as TransactionOptions } from './contracts-Maix4eRX.mjs';
3
3
 
4
4
  type PendingRedemption = {
5
5
  amount: bigint;
package/dist/funding.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Signer } from 'ethers';
2
- import { c as ChainflipNetwork, T as TransactionOptions } from './contracts-49zdGryt.js';
2
+ import { c as ChainflipNetwork, T as TransactionOptions } from './contracts-Maix4eRX.js';
3
3
 
4
4
  type PendingRedemption = {
5
5
  amount: bigint;
package/dist/funding.js CHANGED
@@ -6,10 +6,7 @@ var rpc = require('@chainflip/rpc');
6
6
  var __defProp = Object.defineProperty;
7
7
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
8
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- var __publicField = (obj, key, value) => {
10
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
11
- return value;
12
- };
9
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
13
10
  var _abi = [
14
11
  {
15
12
  inputs: [
@@ -895,8 +892,7 @@ var chainConstants = {
895
892
  };
896
893
  function isValidAssetAndChain(assetAndChain) {
897
894
  const { asset, chain } = assetAndChain;
898
- if (!(chain in Chains))
899
- return false;
895
+ if (!(chain in Chains)) return false;
900
896
  const validAssets = chainConstants[chain].assets;
901
897
  return validAssets.includes(asset);
902
898
  }
@@ -997,14 +993,10 @@ var extractOverrides = /* @__PURE__ */ __name((transactionOverrides) => {
997
993
  return ethersOverrides;
998
994
  }, "extractOverrides");
999
995
  function getTokenContractAddress(asset, network) {
1000
- if (asset === InternalAssets.Flip)
1001
- return ADDRESSES[network].FLIP_CONTRACT_ADDRESS;
1002
- if (asset === InternalAssets.Usdc)
1003
- return ADDRESSES[network].USDC_CONTRACT_ADDRESS;
1004
- if (asset === InternalAssets.Usdt)
1005
- return ADDRESSES[network].USDT_CONTRACT_ADDRESS;
1006
- if (asset === InternalAssets.ArbUsdc)
1007
- return ADDRESSES[network].ARBUSDC_CONTRACT_ADDRESS;
996
+ if (asset === InternalAssets.Flip) return ADDRESSES[network].FLIP_CONTRACT_ADDRESS;
997
+ if (asset === InternalAssets.Usdc) return ADDRESSES[network].USDC_CONTRACT_ADDRESS;
998
+ if (asset === InternalAssets.Usdt) return ADDRESSES[network].USDT_CONTRACT_ADDRESS;
999
+ if (asset === InternalAssets.ArbUsdc) return ADDRESSES[network].ARBUSDC_CONTRACT_ADDRESS;
1008
1000
  throw new Error(`No contract address for ${asset} on ${network}`);
1009
1001
  }
1010
1002
  __name(getTokenContractAddress, "getTokenContractAddress");
@@ -1020,8 +1012,7 @@ var checkAllowance = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20
1020
1012
  };
1021
1013
  }, "checkAllowance");
1022
1014
  var approve = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20, allowance, txOpts) => {
1023
- if (allowance >= amount)
1024
- return null;
1015
+ if (allowance >= amount) return null;
1025
1016
  const transaction = await erc20.approve(spenderAddress, amount - allowance, extractOverrides(txOpts));
1026
1017
  await transaction.wait(txOpts.wait);
1027
1018
  return transaction;
@@ -1033,10 +1024,8 @@ var getFlipBalance = /* @__PURE__ */ __name(async (network, signer) => {
1033
1024
  }, "getFlipBalance");
1034
1025
  var camelCase = /* @__PURE__ */ __name((str) => str.replace(/_([a-z])/g, (_, char) => char.toUpperCase()), "camelCase");
1035
1026
  var camelCaseKeys = /* @__PURE__ */ __name((obj) => {
1036
- if (typeof obj !== "object" || obj === null)
1037
- return obj;
1038
- if (Array.isArray(obj))
1039
- return obj.map((item) => camelCaseKeys(item));
1027
+ if (typeof obj !== "object" || obj === null) return obj;
1028
+ if (Array.isArray(obj)) return obj.map((item) => camelCaseKeys(item));
1040
1029
  return Object.fromEntries(Object.entries(obj).map(([key, value]) => [
1041
1030
  camelCase(key),
1042
1031
  camelCaseKeys(value)
@@ -1074,8 +1063,7 @@ var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
1074
1063
 
1075
1064
  // ../shared/src/guards.ts
1076
1065
  function assert(condition, message) {
1077
- if (condition)
1078
- return;
1066
+ if (condition) return;
1079
1067
  const error = new Error(message);
1080
1068
  if (error.stack) {
1081
1069
  error.stack = error.stack.replace(/\n.+/, "\n");
@@ -1092,8 +1080,7 @@ var checkStateChainGatewayAllowance = /* @__PURE__ */ __name(async (amount, netw
1092
1080
  }, "checkStateChainGatewayAllowance");
1093
1081
  var approveStateChainGateway = /* @__PURE__ */ __name(async (amount, networkOpts, txOpts) => {
1094
1082
  const { allowance, erc20, hasSufficientAllowance } = await checkStateChainGatewayAllowance(amount, networkOpts);
1095
- if (hasSufficientAllowance)
1096
- return null;
1083
+ if (hasSufficientAllowance) return null;
1097
1084
  const stateChainGatewayContractAddress = networkOpts.network === "localnet" ? networkOpts.stateChainGatewayContractAddress : getStateChainGatewayContractAddress(networkOpts.network);
1098
1085
  return approve(amount, stateChainGatewayContractAddress, erc20, allowance, txOpts);
1099
1086
  }, "approveStateChainGateway");
package/dist/funding.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, checkAllowance, extractOverrides, StateChainGateway__factory } from './chunk-LFAWGKTO.mjs';
2
- import { __name, __publicField, ChainflipNetworks, InternalAssets, assert } from './chunk-VT6GEMQN.mjs';
1
+ import { getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, checkAllowance, extractOverrides, StateChainGateway__factory } from './chunk-IV2YVU2E.mjs';
2
+ import { __name, __publicField, ChainflipNetworks, InternalAssets, assert } from './chunk-3V7QJANN.mjs';
3
3
 
4
4
  // ../shared/src/stateChainGateway/utils.ts
5
5
  var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
@@ -15,8 +15,7 @@ var checkStateChainGatewayAllowance = /* @__PURE__ */ __name(async (amount, netw
15
15
  }, "checkStateChainGatewayAllowance");
16
16
  var approveStateChainGateway = /* @__PURE__ */ __name(async (amount, networkOpts, txOpts) => {
17
17
  const { allowance, erc20, hasSufficientAllowance } = await checkStateChainGatewayAllowance(amount, networkOpts);
18
- if (hasSufficientAllowance)
19
- return null;
18
+ if (hasSufficientAllowance) return null;
20
19
  const stateChainGatewayContractAddress = networkOpts.network === "localnet" ? networkOpts.stateChainGatewayContractAddress : getStateChainGatewayContractAddress(networkOpts.network);
21
20
  return approve(amount, stateChainGatewayContractAddress, erc20, allowance, txOpts);
22
21
  }, "approveStateChainGateway");
package/dist/swap.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Signer } from 'ethers';
2
- import { A as AssetAndChain, C as Chain, a as Asset, I as InternalAsset, b as AssetOfChain, c as ChainflipNetwork, T as TransactionOptions, d as ChainAssetMap, e as ChainMap } from './contracts-49zdGryt.mjs';
3
- export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, j as getChainflipId } from './contracts-49zdGryt.mjs';
2
+ import { A as AssetAndChain, C as Chain, a as Asset, I as InternalAsset, b as AssetOfChain, c as ChainflipNetwork, T as TransactionOptions, d as ChainAssetMap, e as ChainMap, U as UncheckedAssetAndChain } from './contracts-Maix4eRX.mjs';
3
+ export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, j as getChainflipId } from './contracts-Maix4eRX.mjs';
4
4
  import { z } from 'zod';
5
5
 
6
6
  declare const ccmMetadataSchema: z.ZodObject<{
@@ -262,6 +262,12 @@ type SwapState = {
262
262
  type DepositAddressStatusResponse = DepositAddressFields & SwapState;
263
263
  type VaultSwapStatusResponse = VaultSwapFields & SwapState;
264
264
  type SwapStatusResponse = DepositAddressStatusResponse | VaultSwapStatusResponse | FailedVaultSwapStatusResponse;
265
+ type BoostPoolDepth = {
266
+ feeTierBps: number;
267
+ availableAmount: bigint;
268
+ asset: Asset;
269
+ chain: Chain;
270
+ };
265
271
 
266
272
  type RequestOptions = {
267
273
  signal?: AbortSignal;
@@ -288,6 +294,7 @@ declare class SwapSDK {
288
294
  getChains(sourceChain?: Chain): Promise<ChainData[]>;
289
295
  private getStateChainEnvironment;
290
296
  private getSupportedAssets;
297
+ private getBoostPoolsDepth;
291
298
  getAssets(chain?: Chain): Promise<AssetData[]>;
292
299
  getQuote(quoteRequest: QuoteRequest, options?: RequestOptions): Promise<QuoteResponse>;
293
300
  requestDepositAddress(depositAddressRequest: DepositAddressRequest): Promise<DepositAddressResponse>;
@@ -305,6 +312,10 @@ declare class SwapSDK {
305
312
  }>;
306
313
  getRequiredBlockConfirmations(): Promise<ChainMap<number | null>>;
307
314
  getChannelOpeningFees(): Promise<ChainMap<bigint>>;
315
+ getBoostLiquidity({ chainAsset, feeTierBps, }?: {
316
+ chainAsset?: UncheckedAssetAndChain;
317
+ feeTierBps?: number;
318
+ }): Promise<BoostPoolDepth[]>;
308
319
  }
309
320
 
310
- export { Asset, type AssetData, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type DepositAddressRequest, type DepositAddressResponse, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type QuoteRequest, type QuoteResponse, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type VaultSwapStatusResponse };
321
+ export { Asset, type AssetData, type BoostPoolDepth, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type DepositAddressRequest, type DepositAddressResponse, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type QuoteRequest, type QuoteResponse, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, UncheckedAssetAndChain, type VaultSwapStatusResponse };
package/dist/swap.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Signer } from 'ethers';
2
- import { A as AssetAndChain, C as Chain, a as Asset, I as InternalAsset, b as AssetOfChain, c as ChainflipNetwork, T as TransactionOptions, d as ChainAssetMap, e as ChainMap } from './contracts-49zdGryt.js';
3
- export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, j as getChainflipId } from './contracts-49zdGryt.js';
2
+ import { A as AssetAndChain, C as Chain, a as Asset, I as InternalAsset, b as AssetOfChain, c as ChainflipNetwork, T as TransactionOptions, d as ChainAssetMap, e as ChainMap, U as UncheckedAssetAndChain } from './contracts-Maix4eRX.js';
3
+ export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, j as getChainflipId } from './contracts-Maix4eRX.js';
4
4
  import { z } from 'zod';
5
5
 
6
6
  declare const ccmMetadataSchema: z.ZodObject<{
@@ -262,6 +262,12 @@ type SwapState = {
262
262
  type DepositAddressStatusResponse = DepositAddressFields & SwapState;
263
263
  type VaultSwapStatusResponse = VaultSwapFields & SwapState;
264
264
  type SwapStatusResponse = DepositAddressStatusResponse | VaultSwapStatusResponse | FailedVaultSwapStatusResponse;
265
+ type BoostPoolDepth = {
266
+ feeTierBps: number;
267
+ availableAmount: bigint;
268
+ asset: Asset;
269
+ chain: Chain;
270
+ };
265
271
 
266
272
  type RequestOptions = {
267
273
  signal?: AbortSignal;
@@ -288,6 +294,7 @@ declare class SwapSDK {
288
294
  getChains(sourceChain?: Chain): Promise<ChainData[]>;
289
295
  private getStateChainEnvironment;
290
296
  private getSupportedAssets;
297
+ private getBoostPoolsDepth;
291
298
  getAssets(chain?: Chain): Promise<AssetData[]>;
292
299
  getQuote(quoteRequest: QuoteRequest, options?: RequestOptions): Promise<QuoteResponse>;
293
300
  requestDepositAddress(depositAddressRequest: DepositAddressRequest): Promise<DepositAddressResponse>;
@@ -305,6 +312,10 @@ declare class SwapSDK {
305
312
  }>;
306
313
  getRequiredBlockConfirmations(): Promise<ChainMap<number | null>>;
307
314
  getChannelOpeningFees(): Promise<ChainMap<bigint>>;
315
+ getBoostLiquidity({ chainAsset, feeTierBps, }?: {
316
+ chainAsset?: UncheckedAssetAndChain;
317
+ feeTierBps?: number;
318
+ }): Promise<BoostPoolDepth[]>;
308
319
  }
309
320
 
310
- export { Asset, type AssetData, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type DepositAddressRequest, type DepositAddressResponse, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type QuoteRequest, type QuoteResponse, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type VaultSwapStatusResponse };
321
+ export { Asset, type AssetData, type BoostPoolDepth, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type DepositAddressRequest, type DepositAddressResponse, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type QuoteRequest, type QuoteResponse, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, UncheckedAssetAndChain, type VaultSwapStatusResponse };