@chainflip/sdk 1.4.1 → 1.4.3

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, affiliateBroker, dotAddress, ethereumAddress } from './chunk-JHVSTX24.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';
@@ -20,7 +20,6 @@ var validateRequest = /* @__PURE__ */ __name((network, params) => z.tuple([
20
20
  ]),
21
21
  z.number(),
22
22
  ccmMetadataSchema.merge(z.object({
23
- gasBudget: hexStringFromNumber,
24
23
  cfParameters: z.union([
25
24
  hexString,
26
25
  z.string()
@@ -28,7 +27,7 @@ var validateRequest = /* @__PURE__ */ __name((network, params) => z.tuple([
28
27
  })).transform(({ message, ...rest }) => ({
29
28
  message,
30
29
  cf_parameters: rest.cfParameters,
31
- gas_budget: rest.gasBudget
30
+ gas_budget: `0x${BigInt(rest.gasBudget).toString(16)}`
32
31
  })).optional(),
33
32
  z.number().optional(),
34
33
  z.array(affiliateBroker).optional()
@@ -63,13 +62,13 @@ async function requestSwapDepositAddress(swapRequest, opts, chainflipNetwork) {
63
62
  chain: destChain
64
63
  },
65
64
  submitAddress(destChain, destAddress),
66
- opts.commissionBps,
65
+ swapRequest.commissionBps ?? 0,
67
66
  swapRequest.ccmMetadata && {
68
67
  ...swapRequest.ccmMetadata,
69
68
  cfParameters: void 0
70
69
  },
71
70
  maxBoostFeeBps,
72
- opts.affiliates
71
+ swapRequest.affiliates
73
72
  ]);
74
73
  const response = await client.sendRequest("broker_requestSwapDepositAddress", ...params);
75
74
  return validateResponse(chainflipNetwork, response);
@@ -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,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");
@@ -4293,7 +4287,6 @@ var hexString = string.refine((v) => /^0x[0-9a-f]*$/i.test(v));
4293
4287
  var hexStringWithMaxByteSize = /* @__PURE__ */ __name((maxByteSize) => hexString.refine((val) => val.length / 2 <= maxByteSize + 1, {
4294
4288
  message: `String must be less than or equal to ${maxByteSize} bytes`
4295
4289
  }), "hexStringWithMaxByteSize");
4296
- var hexStringFromNumber = numericString.transform((arg) => `0x${BigInt(arg).toString(16)}`);
4297
4290
  var btcAddress = /* @__PURE__ */ __name((network) => {
4298
4291
  if (network === "mainnet") {
4299
4292
  return string.regex(/^(1|3|bc1)/).refine(validateBitcoinMainnetAddress, (address) => ({
@@ -4468,10 +4461,11 @@ z.object({
4468
4461
  destAddress: z.string(),
4469
4462
  amount: numericString,
4470
4463
  ccmMetadata: ccmMetadataSchema.optional(),
4471
- maxBoostFeeBps: z.number().optional()
4464
+ maxBoostFeeBps: z.number().optional(),
4465
+ srcAddress: z.string().optional()
4472
4466
  }).transform(({ amount, ...rest }) => ({
4473
4467
  ...rest,
4474
4468
  expectedDepositAmount: amount
4475
4469
  }));
4476
4470
 
4477
- export { affiliateBroker, assertValidAddress, assetAndChain, btcAddress, ccmMetadataSchema, dotAddress, ethereumAddress, hexString, hexStringFromNumber, numericString, z };
4471
+ export { affiliateBroker, assertValidAddress, assetAndChain, btcAddress, ccmMetadataSchema, dotAddress, ethereumAddress, hexString, numericString, z };
@@ -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
@@ -2060,7 +2058,7 @@ var ADDRESSES = {
2060
2058
  ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
2061
2059
  VAULT_CONTRACT_ADDRESS: "0xa94d6b1853F3cb611Ed3cCb701b4fdA5a9DACe85",
2062
2060
  STATE_CHAIN_GATEWAY_ADDRESS: "0x1F7fE41C798cc7b1D34BdC8de2dDDA4a4bE744D9",
2063
- ARB_VAULT_CONTRACT_ADDRESS: ""
2061
+ ARB_VAULT_CONTRACT_ADDRESS: "0x8155BdD48CD011e1118b51A1C82be020A3E5c2f2"
2064
2062
  },
2065
2063
  [ChainflipNetworks.perseverance]: {
2066
2064
  FLIP_CONTRACT_ADDRESS: "0xdC27c60956cB065D19F08bb69a707E37b36d8086",
@@ -2069,7 +2067,7 @@ var ADDRESSES = {
2069
2067
  ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
2070
2068
  VAULT_CONTRACT_ADDRESS: "0x36eaD71325604DC15d35FAE584D7b50646D81753",
2071
2069
  STATE_CHAIN_GATEWAY_ADDRESS: "0xA34a967197Ee90BB7fb28e928388a573c5CFd099",
2072
- ARB_VAULT_CONTRACT_ADDRESS: ""
2070
+ ARB_VAULT_CONTRACT_ADDRESS: "0x2bb150e6d4366A1BDBC4275D1F35892CD63F27e3"
2073
2071
  },
2074
2072
  [ChainflipNetworks.mainnet]: {
2075
2073
  FLIP_CONTRACT_ADDRESS: "0x826180541412D574cf1336d22c0C0a287822678A",
@@ -2078,7 +2076,7 @@ var ADDRESSES = {
2078
2076
  ARBUSDC_CONTRACT_ADDRESS: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
2079
2077
  VAULT_CONTRACT_ADDRESS: "0xF5e10380213880111522dd0efD3dbb45b9f62Bcc",
2080
2078
  STATE_CHAIN_GATEWAY_ADDRESS: "0x6995Ab7c4D7F4B03f467Cf4c8E920427d9621DBd",
2081
- ARB_VAULT_CONTRACT_ADDRESS: ""
2079
+ ARB_VAULT_CONTRACT_ADDRESS: "0x79001a5e762f3bEFC8e5871b42F6734e00498920"
2082
2080
  }
2083
2081
  };
2084
2082
 
@@ -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 };
@@ -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
  }
@@ -969,7 +965,7 @@ var ADDRESSES = {
969
965
  ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
970
966
  VAULT_CONTRACT_ADDRESS: "0xa94d6b1853F3cb611Ed3cCb701b4fdA5a9DACe85",
971
967
  STATE_CHAIN_GATEWAY_ADDRESS: "0x1F7fE41C798cc7b1D34BdC8de2dDDA4a4bE744D9",
972
- ARB_VAULT_CONTRACT_ADDRESS: ""
968
+ ARB_VAULT_CONTRACT_ADDRESS: "0x8155BdD48CD011e1118b51A1C82be020A3E5c2f2"
973
969
  },
974
970
  [ChainflipNetworks.perseverance]: {
975
971
  FLIP_CONTRACT_ADDRESS: "0xdC27c60956cB065D19F08bb69a707E37b36d8086",
@@ -978,7 +974,7 @@ var ADDRESSES = {
978
974
  ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
979
975
  VAULT_CONTRACT_ADDRESS: "0x36eaD71325604DC15d35FAE584D7b50646D81753",
980
976
  STATE_CHAIN_GATEWAY_ADDRESS: "0xA34a967197Ee90BB7fb28e928388a573c5CFd099",
981
- ARB_VAULT_CONTRACT_ADDRESS: ""
977
+ ARB_VAULT_CONTRACT_ADDRESS: "0x2bb150e6d4366A1BDBC4275D1F35892CD63F27e3"
982
978
  },
983
979
  [ChainflipNetworks.mainnet]: {
984
980
  FLIP_CONTRACT_ADDRESS: "0x826180541412D574cf1336d22c0C0a287822678A",
@@ -987,7 +983,7 @@ var ADDRESSES = {
987
983
  ARBUSDC_CONTRACT_ADDRESS: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
988
984
  VAULT_CONTRACT_ADDRESS: "0xF5e10380213880111522dd0efD3dbb45b9f62Bcc",
989
985
  STATE_CHAIN_GATEWAY_ADDRESS: "0x6995Ab7c4D7F4B03f467Cf4c8E920427d9621DBd",
990
- ARB_VAULT_CONTRACT_ADDRESS: ""
986
+ ARB_VAULT_CONTRACT_ADDRESS: "0x79001a5e762f3bEFC8e5871b42F6734e00498920"
991
987
  }
992
988
  };
993
989
 
@@ -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-M32JHS3U.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<{
@@ -109,6 +109,7 @@ interface DepositAddressRequest extends QuoteRequest {
109
109
  destAddress: string;
110
110
  ccmMetadata?: CcmMetadata;
111
111
  maxBoostFeeBps?: number;
112
+ srcAddress?: string;
112
113
  }
113
114
  interface DepositAddressResponse extends DepositAddressRequest {
114
115
  depositChannelId: string;
@@ -167,7 +168,8 @@ type CopyFields<T, U> = {
167
168
  type VaultSwapFields = CopyFields<DepositAddressFields, SwapStatusResponseCommonFields>;
168
169
  type FailedVaultSwapStatusResponse = CopyFields<DepositAddressFields, {
169
170
  depositAmount: string;
170
- depositTransactionHash: string;
171
+ depositTransactionHash: string | undefined;
172
+ depositTransactionRef: string | undefined;
171
173
  destAddress: string;
172
174
  error: {
173
175
  message: string;
@@ -186,6 +188,7 @@ type SwapState = {
186
188
  state: 'AWAITING_DEPOSIT';
187
189
  depositAmount: string | undefined;
188
190
  depositTransactionHash: string | undefined;
191
+ depositTransactionRef: string | undefined;
189
192
  depositTransactionConfirmations: number | undefined;
190
193
  } | {
191
194
  state: 'DEPOSIT_RECEIVED';
@@ -239,6 +242,7 @@ type SwapState = {
239
242
  };
240
243
  depositAmount: string;
241
244
  depositTransactionHash: string | undefined;
245
+ depositTransactionRef: string | undefined;
242
246
  failedAt: number;
243
247
  failedBlockIndex: string;
244
248
  } | {
@@ -262,6 +266,12 @@ type SwapState = {
262
266
  type DepositAddressStatusResponse = DepositAddressFields & SwapState;
263
267
  type VaultSwapStatusResponse = VaultSwapFields & SwapState;
264
268
  type SwapStatusResponse = DepositAddressStatusResponse | VaultSwapStatusResponse | FailedVaultSwapStatusResponse;
269
+ type BoostPoolDepth = {
270
+ feeTierBps: number;
271
+ availableAmount: bigint;
272
+ asset: Asset;
273
+ chain: Chain;
274
+ };
265
275
 
266
276
  type RequestOptions = {
267
277
  signal?: AbortSignal;
@@ -288,6 +298,7 @@ declare class SwapSDK {
288
298
  getChains(sourceChain?: Chain): Promise<ChainData[]>;
289
299
  private getStateChainEnvironment;
290
300
  private getSupportedAssets;
301
+ private getBoostPoolsDepth;
291
302
  getAssets(chain?: Chain): Promise<AssetData[]>;
292
303
  getQuote(quoteRequest: QuoteRequest, options?: RequestOptions): Promise<QuoteResponse>;
293
304
  requestDepositAddress(depositAddressRequest: DepositAddressRequest): Promise<DepositAddressResponse>;
@@ -305,6 +316,10 @@ declare class SwapSDK {
305
316
  }>;
306
317
  getRequiredBlockConfirmations(): Promise<ChainMap<number | null>>;
307
318
  getChannelOpeningFees(): Promise<ChainMap<bigint>>;
319
+ getBoostLiquidity({ chainAsset, feeTierBps, }?: {
320
+ chainAsset?: UncheckedAssetAndChain;
321
+ feeTierBps?: number;
322
+ }): Promise<BoostPoolDepth[]>;
308
323
  }
309
324
 
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 };
325
+ 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 };