@chainflip/sdk 1.4.2 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { z, assetAndChain, numericString, hexString, btcAddress, ccmMetadataSchema, hexStringFromNumber, affiliateBroker, dotAddress, ethereumAddress } from './chunk-YTHKYS6R.mjs';
1
+ import { z, assetAndChain, numericString, hexString, btcAddress, ccmMetadataSchema, affiliateBroker, dotAddress, ethereumAddress } from './chunk-JHVSTX24.mjs';
2
2
  import { __name, Chains } from './chunk-3V7QJANN.mjs';
3
3
  import { HttpClient } from '@chainflip/rpc';
4
4
  import { bytesToHex } from '@chainflip/utils/bytes';
@@ -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);
@@ -4287,7 +4287,6 @@ var hexString = string.refine((v) => /^0x[0-9a-f]*$/i.test(v));
4287
4287
  var hexStringWithMaxByteSize = /* @__PURE__ */ __name((maxByteSize) => hexString.refine((val) => val.length / 2 <= maxByteSize + 1, {
4288
4288
  message: `String must be less than or equal to ${maxByteSize} bytes`
4289
4289
  }), "hexStringWithMaxByteSize");
4290
- var hexStringFromNumber = numericString.transform((arg) => `0x${BigInt(arg).toString(16)}`);
4291
4290
  var btcAddress = /* @__PURE__ */ __name((network) => {
4292
4291
  if (network === "mainnet") {
4293
4292
  return string.regex(/^(1|3|bc1)/).refine(validateBitcoinMainnetAddress, (address) => ({
@@ -4462,10 +4461,11 @@ z.object({
4462
4461
  destAddress: z.string(),
4463
4462
  amount: numericString,
4464
4463
  ccmMetadata: ccmMetadataSchema.optional(),
4465
- maxBoostFeeBps: z.number().optional()
4464
+ maxBoostFeeBps: z.number().optional(),
4465
+ srcAddress: z.string().optional()
4466
4466
  }).transform(({ amount, ...rest }) => ({
4467
4467
  ...rest,
4468
4468
  expectedDepositAmount: amount
4469
4469
  }));
4470
4470
 
4471
- export { affiliateBroker, assertValidAddress, assetAndChain, btcAddress, ccmMetadataSchema, dotAddress, ethereumAddress, hexString, hexStringFromNumber, numericString, z };
4471
+ export { affiliateBroker, assertValidAddress, assetAndChain, btcAddress, ccmMetadataSchema, dotAddress, ethereumAddress, hexString, numericString, z };
@@ -2058,7 +2058,7 @@ var ADDRESSES = {
2058
2058
  ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
2059
2059
  VAULT_CONTRACT_ADDRESS: "0xa94d6b1853F3cb611Ed3cCb701b4fdA5a9DACe85",
2060
2060
  STATE_CHAIN_GATEWAY_ADDRESS: "0x1F7fE41C798cc7b1D34BdC8de2dDDA4a4bE744D9",
2061
- ARB_VAULT_CONTRACT_ADDRESS: ""
2061
+ ARB_VAULT_CONTRACT_ADDRESS: "0x8155BdD48CD011e1118b51A1C82be020A3E5c2f2"
2062
2062
  },
2063
2063
  [ChainflipNetworks.perseverance]: {
2064
2064
  FLIP_CONTRACT_ADDRESS: "0xdC27c60956cB065D19F08bb69a707E37b36d8086",
@@ -2067,7 +2067,7 @@ var ADDRESSES = {
2067
2067
  ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
2068
2068
  VAULT_CONTRACT_ADDRESS: "0x36eaD71325604DC15d35FAE584D7b50646D81753",
2069
2069
  STATE_CHAIN_GATEWAY_ADDRESS: "0xA34a967197Ee90BB7fb28e928388a573c5CFd099",
2070
- ARB_VAULT_CONTRACT_ADDRESS: ""
2070
+ ARB_VAULT_CONTRACT_ADDRESS: "0x2bb150e6d4366A1BDBC4275D1F35892CD63F27e3"
2071
2071
  },
2072
2072
  [ChainflipNetworks.mainnet]: {
2073
2073
  FLIP_CONTRACT_ADDRESS: "0x826180541412D574cf1336d22c0C0a287822678A",
@@ -2076,7 +2076,7 @@ var ADDRESSES = {
2076
2076
  ARBUSDC_CONTRACT_ADDRESS: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
2077
2077
  VAULT_CONTRACT_ADDRESS: "0xF5e10380213880111522dd0efD3dbb45b9f62Bcc",
2078
2078
  STATE_CHAIN_GATEWAY_ADDRESS: "0x6995Ab7c4D7F4B03f467Cf4c8E920427d9621DBd",
2079
- ARB_VAULT_CONTRACT_ADDRESS: ""
2079
+ ARB_VAULT_CONTRACT_ADDRESS: "0x79001a5e762f3bEFC8e5871b42F6734e00498920"
2080
2080
  }
2081
2081
  };
2082
2082
 
package/dist/funding.js CHANGED
@@ -965,7 +965,7 @@ var ADDRESSES = {
965
965
  ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
966
966
  VAULT_CONTRACT_ADDRESS: "0xa94d6b1853F3cb611Ed3cCb701b4fdA5a9DACe85",
967
967
  STATE_CHAIN_GATEWAY_ADDRESS: "0x1F7fE41C798cc7b1D34BdC8de2dDDA4a4bE744D9",
968
- ARB_VAULT_CONTRACT_ADDRESS: ""
968
+ ARB_VAULT_CONTRACT_ADDRESS: "0x8155BdD48CD011e1118b51A1C82be020A3E5c2f2"
969
969
  },
970
970
  [ChainflipNetworks.perseverance]: {
971
971
  FLIP_CONTRACT_ADDRESS: "0xdC27c60956cB065D19F08bb69a707E37b36d8086",
@@ -974,7 +974,7 @@ var ADDRESSES = {
974
974
  ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
975
975
  VAULT_CONTRACT_ADDRESS: "0x36eaD71325604DC15d35FAE584D7b50646D81753",
976
976
  STATE_CHAIN_GATEWAY_ADDRESS: "0xA34a967197Ee90BB7fb28e928388a573c5CFd099",
977
- ARB_VAULT_CONTRACT_ADDRESS: ""
977
+ ARB_VAULT_CONTRACT_ADDRESS: "0x2bb150e6d4366A1BDBC4275D1F35892CD63F27e3"
978
978
  },
979
979
  [ChainflipNetworks.mainnet]: {
980
980
  FLIP_CONTRACT_ADDRESS: "0x826180541412D574cf1336d22c0C0a287822678A",
@@ -983,7 +983,7 @@ var ADDRESSES = {
983
983
  ARBUSDC_CONTRACT_ADDRESS: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
984
984
  VAULT_CONTRACT_ADDRESS: "0xF5e10380213880111522dd0efD3dbb45b9f62Bcc",
985
985
  STATE_CHAIN_GATEWAY_ADDRESS: "0x6995Ab7c4D7F4B03f467Cf4c8E920427d9621DBd",
986
- ARB_VAULT_CONTRACT_ADDRESS: ""
986
+ ARB_VAULT_CONTRACT_ADDRESS: "0x79001a5e762f3bEFC8e5871b42F6734e00498920"
987
987
  }
988
988
  };
989
989
 
package/dist/funding.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, checkAllowance, extractOverrides, StateChainGateway__factory } from './chunk-IV2YVU2E.mjs';
1
+ import { getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, checkAllowance, extractOverrides, StateChainGateway__factory } from './chunk-M32JHS3U.mjs';
2
2
  import { __name, __publicField, ChainflipNetworks, InternalAssets, assert } from './chunk-3V7QJANN.mjs';
3
3
 
4
4
  // ../shared/src/stateChainGateway/utils.ts
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, 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';
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-Maix4eRX.mjs';
3
+ export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, 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;
@@ -128,6 +129,7 @@ interface SwapStatusResponseCommonFields extends ChainsAndAssets {
128
129
  ccmMetadata: CcmMetadata | undefined;
129
130
  feesPaid: SwapFee[];
130
131
  estimatedDefaultDurationSeconds: number | undefined;
132
+ srcChainRequiredBlockConfirmations: number | undefined;
131
133
  }
132
134
  interface DepositAddressFields extends SwapStatusResponseCommonFields {
133
135
  depositAddress: string;
@@ -167,7 +169,8 @@ type CopyFields<T, U> = {
167
169
  type VaultSwapFields = CopyFields<DepositAddressFields, SwapStatusResponseCommonFields>;
168
170
  type FailedVaultSwapStatusResponse = CopyFields<DepositAddressFields, {
169
171
  depositAmount: string;
170
- depositTransactionHash: string;
172
+ depositTransactionHash: string | undefined;
173
+ depositTransactionRef: string | undefined;
171
174
  destAddress: string;
172
175
  error: {
173
176
  message: string;
@@ -186,6 +189,7 @@ type SwapState = {
186
189
  state: 'AWAITING_DEPOSIT';
187
190
  depositAmount: string | undefined;
188
191
  depositTransactionHash: string | undefined;
192
+ depositTransactionRef: string | undefined;
189
193
  depositTransactionConfirmations: number | undefined;
190
194
  } | {
191
195
  state: 'DEPOSIT_RECEIVED';
@@ -239,6 +243,7 @@ type SwapState = {
239
243
  };
240
244
  depositAmount: string;
241
245
  depositTransactionHash: string | undefined;
246
+ depositTransactionRef: string | undefined;
242
247
  failedAt: number;
243
248
  failedBlockIndex: string;
244
249
  } | {
@@ -312,10 +317,13 @@ declare class SwapSDK {
312
317
  }>;
313
318
  getRequiredBlockConfirmations(): Promise<ChainMap<number | null>>;
314
319
  getChannelOpeningFees(): Promise<ChainMap<bigint>>;
315
- getBoostLiquidity({ chainAsset, feeTierBps, }?: {
316
- chainAsset?: UncheckedAssetAndChain;
320
+ getBoostLiquidity(params?: {
321
+ feeTierBps?: number;
322
+ } | {
317
323
  feeTierBps?: number;
324
+ asset: Asset;
325
+ chain: Chain;
318
326
  }): Promise<BoostPoolDepth[]>;
319
327
  }
320
328
 
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 };
329
+ 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, 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, 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';
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-Maix4eRX.js';
3
+ export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-Maix4eRX.js';
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;
@@ -128,6 +129,7 @@ interface SwapStatusResponseCommonFields extends ChainsAndAssets {
128
129
  ccmMetadata: CcmMetadata | undefined;
129
130
  feesPaid: SwapFee[];
130
131
  estimatedDefaultDurationSeconds: number | undefined;
132
+ srcChainRequiredBlockConfirmations: number | undefined;
131
133
  }
132
134
  interface DepositAddressFields extends SwapStatusResponseCommonFields {
133
135
  depositAddress: string;
@@ -167,7 +169,8 @@ type CopyFields<T, U> = {
167
169
  type VaultSwapFields = CopyFields<DepositAddressFields, SwapStatusResponseCommonFields>;
168
170
  type FailedVaultSwapStatusResponse = CopyFields<DepositAddressFields, {
169
171
  depositAmount: string;
170
- depositTransactionHash: string;
172
+ depositTransactionHash: string | undefined;
173
+ depositTransactionRef: string | undefined;
171
174
  destAddress: string;
172
175
  error: {
173
176
  message: string;
@@ -186,6 +189,7 @@ type SwapState = {
186
189
  state: 'AWAITING_DEPOSIT';
187
190
  depositAmount: string | undefined;
188
191
  depositTransactionHash: string | undefined;
192
+ depositTransactionRef: string | undefined;
189
193
  depositTransactionConfirmations: number | undefined;
190
194
  } | {
191
195
  state: 'DEPOSIT_RECEIVED';
@@ -239,6 +243,7 @@ type SwapState = {
239
243
  };
240
244
  depositAmount: string;
241
245
  depositTransactionHash: string | undefined;
246
+ depositTransactionRef: string | undefined;
242
247
  failedAt: number;
243
248
  failedBlockIndex: string;
244
249
  } | {
@@ -312,10 +317,13 @@ declare class SwapSDK {
312
317
  }>;
313
318
  getRequiredBlockConfirmations(): Promise<ChainMap<number | null>>;
314
319
  getChannelOpeningFees(): Promise<ChainMap<bigint>>;
315
- getBoostLiquidity({ chainAsset, feeTierBps, }?: {
316
- chainAsset?: UncheckedAssetAndChain;
320
+ getBoostLiquidity(params?: {
321
+ feeTierBps?: number;
322
+ } | {
317
323
  feeTierBps?: number;
324
+ asset: Asset;
325
+ chain: Chain;
318
326
  }): Promise<BoostPoolDepth[]>;
319
327
  }
320
328
 
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 };
329
+ 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, type VaultSwapStatusResponse };
package/dist/swap.js CHANGED
@@ -557,11 +557,11 @@ function datetimeRegex(args) {
557
557
  regex = `${regex}(${opts.join("|")})`;
558
558
  return new RegExp(`^${regex}$`);
559
559
  }
560
- function isValidIP(ip, version) {
561
- if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
560
+ function isValidIP(ip, version2) {
561
+ if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) {
562
562
  return true;
563
563
  }
564
- if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
564
+ if ((version2 === "v6" || !version2) && ipv6Regex.test(ip)) {
565
565
  return true;
566
566
  }
567
567
  return false;
@@ -4543,7 +4543,7 @@ var init_addressValidation = __esm({
4543
4543
  assertValidAddress = /* @__PURE__ */ __name((chain2, address, network) => assert(validators[network][chain2](address), `Address "${address}" is not a valid "${chain2}" address for "${network}"`), "assertValidAddress");
4544
4544
  }
4545
4545
  });
4546
- var enumValues, safeStringify, errorMap2, string, number, numericString, numericOrEmptyString, hexString, hexStringWithMaxByteSize, hexStringFromNumber, btcAddress, DOT_PREFIX, dotAddress, ethereumAddress, chainflipAddress, u128, unsignedInteger, rustEnum, chain, asset, uncheckedAssetAndChain, assetAndChain, chainflipSS58Prefix;
4546
+ var enumValues, safeStringify, errorMap2, string, number, numericString, numericOrEmptyString, hexString, hexStringWithMaxByteSize, btcAddress, DOT_PREFIX, dotAddress, ethereumAddress, chainflipAddress, u128, unsignedInteger, rustEnum, chain, asset, uncheckedAssetAndChain, assetAndChain, chainflipSS58Prefix;
4547
4547
  var init_parsers = __esm({
4548
4548
  "../shared/src/parsers.ts"() {
4549
4549
  init_dist();
@@ -4568,7 +4568,6 @@ var init_parsers = __esm({
4568
4568
  hexStringWithMaxByteSize = /* @__PURE__ */ __name((maxByteSize) => hexString.refine((val) => val.length / 2 <= maxByteSize + 1, {
4569
4569
  message: `String must be less than or equal to ${maxByteSize} bytes`
4570
4570
  }), "hexStringWithMaxByteSize");
4571
- hexStringFromNumber = numericString.transform((arg) => `0x${BigInt(arg).toString(16)}`);
4572
4571
  btcAddress = /* @__PURE__ */ __name((network) => {
4573
4572
  if (network === "mainnet") {
4574
4573
  return string.regex(/^(1|3|bc1)/).refine(validateBitcoinMainnetAddress, (address) => ({
@@ -4751,7 +4750,8 @@ var init_schemas = __esm({
4751
4750
  destAddress: z.string(),
4752
4751
  amount: numericString,
4753
4752
  ccmMetadata: ccmMetadataSchema.optional(),
4754
- maxBoostFeeBps: z.number().optional()
4753
+ maxBoostFeeBps: z.number().optional(),
4754
+ srcAddress: z.string().optional()
4755
4755
  }).transform(({ amount, ...rest }) => ({
4756
4756
  ...rest,
4757
4757
  expectedDepositAmount: amount
@@ -4777,13 +4777,13 @@ async function requestSwapDepositAddress(swapRequest, opts, chainflipNetwork2) {
4777
4777
  chain: destChain
4778
4778
  },
4779
4779
  submitAddress(destChain, destAddress),
4780
- opts.commissionBps,
4780
+ swapRequest.commissionBps ?? 0,
4781
4781
  swapRequest.ccmMetadata && {
4782
4782
  ...swapRequest.ccmMetadata,
4783
4783
  cfParameters: void 0
4784
4784
  },
4785
4785
  maxBoostFeeBps,
4786
- opts.affiliates
4786
+ swapRequest.affiliates
4787
4787
  ]);
4788
4788
  const response = await client.sendRequest("broker_requestSwapDepositAddress", ...params);
4789
4789
  return validateResponse(chainflipNetwork2, response);
@@ -4811,7 +4811,6 @@ var init_broker = __esm({
4811
4811
  ]),
4812
4812
  z.number(),
4813
4813
  ccmMetadataSchema.merge(z.object({
4814
- gasBudget: hexStringFromNumber,
4815
4814
  cfParameters: z.union([
4816
4815
  hexString,
4817
4816
  z.string()
@@ -4819,7 +4818,7 @@ var init_broker = __esm({
4819
4818
  })).transform(({ message, ...rest }) => ({
4820
4819
  message,
4821
4820
  cf_parameters: rest.cfParameters,
4822
- gas_budget: rest.gasBudget
4821
+ gas_budget: `0x${BigInt(rest.gasBudget).toString(16)}`
4823
4822
  })).optional(),
4824
4823
  z.number().optional(),
4825
4824
  z.array(affiliateBroker).optional()
@@ -8428,7 +8427,7 @@ var ADDRESSES = {
8428
8427
  ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
8429
8428
  VAULT_CONTRACT_ADDRESS: "0xa94d6b1853F3cb611Ed3cCb701b4fdA5a9DACe85",
8430
8429
  STATE_CHAIN_GATEWAY_ADDRESS: "0x1F7fE41C798cc7b1D34BdC8de2dDDA4a4bE744D9",
8431
- ARB_VAULT_CONTRACT_ADDRESS: ""
8430
+ ARB_VAULT_CONTRACT_ADDRESS: "0x8155BdD48CD011e1118b51A1C82be020A3E5c2f2"
8432
8431
  },
8433
8432
  [exports.ChainflipNetworks.perseverance]: {
8434
8433
  FLIP_CONTRACT_ADDRESS: "0xdC27c60956cB065D19F08bb69a707E37b36d8086",
@@ -8437,7 +8436,7 @@ var ADDRESSES = {
8437
8436
  ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
8438
8437
  VAULT_CONTRACT_ADDRESS: "0x36eaD71325604DC15d35FAE584D7b50646D81753",
8439
8438
  STATE_CHAIN_GATEWAY_ADDRESS: "0xA34a967197Ee90BB7fb28e928388a573c5CFd099",
8440
- ARB_VAULT_CONTRACT_ADDRESS: ""
8439
+ ARB_VAULT_CONTRACT_ADDRESS: "0x2bb150e6d4366A1BDBC4275D1F35892CD63F27e3"
8441
8440
  },
8442
8441
  [exports.ChainflipNetworks.mainnet]: {
8443
8442
  FLIP_CONTRACT_ADDRESS: "0x826180541412D574cf1336d22c0C0a287822678A",
@@ -8446,7 +8445,7 @@ var ADDRESSES = {
8446
8445
  ARBUSDC_CONTRACT_ADDRESS: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
8447
8446
  VAULT_CONTRACT_ADDRESS: "0xF5e10380213880111522dd0efD3dbb45b9f62Bcc",
8448
8447
  STATE_CHAIN_GATEWAY_ADDRESS: "0x6995Ab7c4D7F4B03f467Cf4c8E920427d9621DBd",
8449
- ARB_VAULT_CONTRACT_ADDRESS: ""
8448
+ ARB_VAULT_CONTRACT_ADDRESS: "0x79001a5e762f3bEFC8e5871b42F6734e00498920"
8450
8449
  }
8451
8450
  };
8452
8451
 
@@ -8654,6 +8653,14 @@ var getChainData = /* @__PURE__ */ __name((chain2, network, env) => ({
8654
8653
 
8655
8654
  // src/swap/consts.ts
8656
8655
  init_enums();
8656
+
8657
+ // package.json
8658
+ var version = "1.4.4";
8659
+
8660
+ // src/swap/consts.ts
8661
+ var CF_SDK_VERSION_HEADERS = {
8662
+ "Cf-Sdk-Version": version
8663
+ };
8657
8664
  var BACKEND_SERVICE_URLS = {
8658
8665
  [exports.ChainflipNetworks.backspin]: "https://chainflip-swap-backspin.staging/",
8659
8666
  [exports.ChainflipNetworks.sisyphos]: "https://chainflip-swap.staging/",
@@ -8672,10 +8679,11 @@ var getQuote = /* @__PURE__ */ __name(async (baseUrl, quoteRequest, { signal })
8672
8679
  brokerCommissionBps: String(brokerCommissionBps)
8673
8680
  }
8674
8681
  };
8675
- const queryParams = new URLSearchParams(params);
8676
- const url = new URL(`/quote?${queryParams.toString()}`, baseUrl).toString();
8677
- const { data } = await axios__default.default.get(url, {
8678
- signal
8682
+ const { data } = await axios__default.default.get("/quote", {
8683
+ baseURL: baseUrl,
8684
+ params,
8685
+ signal,
8686
+ headers: CF_SDK_VERSION_HEADERS
8679
8687
  });
8680
8688
  return {
8681
8689
  ...returnedRequestData,
@@ -8683,9 +8691,10 @@ var getQuote = /* @__PURE__ */ __name(async (baseUrl, quoteRequest, { signal })
8683
8691
  };
8684
8692
  }, "getQuote");
8685
8693
  var getStatus = /* @__PURE__ */ __name(async (baseUrl, { id }, { signal }) => {
8686
- const url = new URL(`/swaps/${id}`, baseUrl).toString();
8687
- const { data } = await axios__default.default.get(url, {
8688
- signal
8694
+ const { data } = await axios__default.default.get(`/swaps/${id}`, {
8695
+ baseURL: baseUrl,
8696
+ signal,
8697
+ headers: CF_SDK_VERSION_HEADERS
8689
8698
  });
8690
8699
  return data;
8691
8700
  }, "getStatus");
@@ -8713,7 +8722,8 @@ var _SwapSDK = class _SwapSDK {
8713
8722
  transformer: esm_default,
8714
8723
  links: [
8715
8724
  httpBatchLink({
8716
- url: new URL("/trpc", this.options.backendUrl)
8725
+ url: new URL("/trpc", this.options.backendUrl),
8726
+ headers: CF_SDK_VERSION_HEADERS
8717
8727
  })
8718
8728
  ]
8719
8729
  });
@@ -8766,10 +8776,12 @@ var _SwapSDK = class _SwapSDK {
8766
8776
  let response;
8767
8777
  if (this.options.broker !== void 0) {
8768
8778
  const { requestSwapDepositAddress: requestSwapDepositAddress2 } = await Promise.resolve().then(() => (init_broker(), broker_exports));
8769
- const result = await requestSwapDepositAddress2(depositAddressRequest, {
8770
- ...this.options.broker,
8779
+ const result = await requestSwapDepositAddress2({
8780
+ ...depositAddressRequest,
8771
8781
  commissionBps: brokerCommissionBps ?? this.options.broker.commissionBps,
8772
8782
  affiliates: affiliateBrokers
8783
+ }, {
8784
+ url: this.options.broker.url
8773
8785
  }, this.options.network);
8774
8786
  response = {
8775
8787
  id: `${result.issuedBlock}-${depositAddressRequest.srcChain}-${result.channelId}`,
@@ -8848,14 +8860,18 @@ var _SwapSDK = class _SwapSDK {
8848
8860
  const { ingressEgress: { channelOpeningFees } } = await this.getStateChainEnvironment();
8849
8861
  return channelOpeningFees;
8850
8862
  }
8851
- async getBoostLiquidity({ chainAsset, feeTierBps } = {}) {
8863
+ async getBoostLiquidity(params = {}) {
8852
8864
  let poolsDepth = await this.getBoostPoolsDepth();
8853
- if (chainAsset) {
8854
- const internalAsset = getInternalAsset(chainAsset);
8865
+ if ("chain" in params && "asset" in params) {
8866
+ const { chain: chain2, asset: asset2 } = params;
8867
+ const internalAsset = getInternalAsset({
8868
+ chain: chain2,
8869
+ asset: asset2
8870
+ });
8855
8871
  poolsDepth = poolsDepth.filter((boostPoolDepth) => boostPoolDepth.asset === internalAsset).sort((a, b) => b.tier - a.tier);
8856
8872
  }
8857
- if (feeTierBps) {
8858
- poolsDepth = poolsDepth.filter((boostPoolDepth) => boostPoolDepth.tier === feeTierBps);
8873
+ if ("feeTierBps" in params && params.feeTierBps !== void 0) {
8874
+ poolsDepth = poolsDepth.filter((boostPoolDepth) => boostPoolDepth.tier === params.feeTierBps);
8859
8875
  }
8860
8876
  return poolsDepth.map((depth) => ({
8861
8877
  availableAmount: depth.availableAmount,
package/dist/swap.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { getEnvironment, getSupportedAssets, getAllBoostPoolsDepth, getVaultContractAddress, approve, getTokenContractAddress, getEvmChainId, checkAllowance, extractOverrides, Vault__factory } from './chunk-IV2YVU2E.mjs';
2
- import { assertValidAddress, ccmMetadataSchema, dotAddress } from './chunk-YTHKYS6R.mjs';
1
+ import { getEnvironment, getSupportedAssets, getAllBoostPoolsDepth, getVaultContractAddress, approve, getTokenContractAddress, getEvmChainId, checkAllowance, extractOverrides, Vault__factory } from './chunk-M32JHS3U.mjs';
2
+ import { assertValidAddress, ccmMetadataSchema, dotAddress } from './chunk-JHVSTX24.mjs';
3
3
  import { __name, ChainflipNetworks, __publicField, Chains, assetConstants, getInternalAsset, isNotNullish, assert, getAssetAndChain, readChainAssetValue, isTestnet, chainConstants, getInternalAssets } from './chunk-3V7QJANN.mjs';
4
4
  export { Assets, InternalAssets as ChainflipIds, ChainflipNetworks, Chains, getInternalAsset as getChainflipId } from './chunk-3V7QJANN.mjs';
5
5
  import { bytesToHex } from '@chainflip/utils/bytes';
@@ -2348,7 +2348,13 @@ var getChainData = /* @__PURE__ */ __name((chain, network, env) => ({
2348
2348
  requiredBlockConfirmations: isNotNullish(env.ingressEgress.witnessSafetyMargins[chain]) ? Number(env.ingressEgress.witnessSafetyMargins[chain]) + 1 : void 0
2349
2349
  }), "getChainData");
2350
2350
 
2351
+ // package.json
2352
+ var version = "1.4.4";
2353
+
2351
2354
  // src/swap/consts.ts
2355
+ var CF_SDK_VERSION_HEADERS = {
2356
+ "Cf-Sdk-Version": version
2357
+ };
2352
2358
  var BACKEND_SERVICE_URLS = {
2353
2359
  [ChainflipNetworks.backspin]: "https://chainflip-swap-backspin.staging/",
2354
2360
  [ChainflipNetworks.sisyphos]: "https://chainflip-swap.staging/",
@@ -2367,10 +2373,11 @@ var getQuote = /* @__PURE__ */ __name(async (baseUrl, quoteRequest, { signal })
2367
2373
  brokerCommissionBps: String(brokerCommissionBps)
2368
2374
  }
2369
2375
  };
2370
- const queryParams = new URLSearchParams(params);
2371
- const url = new URL(`/quote?${queryParams.toString()}`, baseUrl).toString();
2372
- const { data } = await axios.get(url, {
2373
- signal
2376
+ const { data } = await axios.get("/quote", {
2377
+ baseURL: baseUrl,
2378
+ params,
2379
+ signal,
2380
+ headers: CF_SDK_VERSION_HEADERS
2374
2381
  });
2375
2382
  return {
2376
2383
  ...returnedRequestData,
@@ -2378,9 +2385,10 @@ var getQuote = /* @__PURE__ */ __name(async (baseUrl, quoteRequest, { signal })
2378
2385
  };
2379
2386
  }, "getQuote");
2380
2387
  var getStatus = /* @__PURE__ */ __name(async (baseUrl, { id }, { signal }) => {
2381
- const url = new URL(`/swaps/${id}`, baseUrl).toString();
2382
- const { data } = await axios.get(url, {
2383
- signal
2388
+ const { data } = await axios.get(`/swaps/${id}`, {
2389
+ baseURL: baseUrl,
2390
+ signal,
2391
+ headers: CF_SDK_VERSION_HEADERS
2384
2392
  });
2385
2393
  return data;
2386
2394
  }, "getStatus");
@@ -2408,7 +2416,8 @@ var _SwapSDK = class _SwapSDK {
2408
2416
  transformer: esm_default,
2409
2417
  links: [
2410
2418
  httpBatchLink({
2411
- url: new URL("/trpc", this.options.backendUrl)
2419
+ url: new URL("/trpc", this.options.backendUrl),
2420
+ headers: CF_SDK_VERSION_HEADERS
2412
2421
  })
2413
2422
  ]
2414
2423
  });
@@ -2460,11 +2469,13 @@ var _SwapSDK = class _SwapSDK {
2460
2469
  }, BigInt(amount));
2461
2470
  let response;
2462
2471
  if (this.options.broker !== void 0) {
2463
- const { requestSwapDepositAddress } = await import('./broker-IJDZMA3Y.mjs');
2464
- const result = await requestSwapDepositAddress(depositAddressRequest, {
2465
- ...this.options.broker,
2472
+ const { requestSwapDepositAddress } = await import('./broker-PBJJVRH4.mjs');
2473
+ const result = await requestSwapDepositAddress({
2474
+ ...depositAddressRequest,
2466
2475
  commissionBps: brokerCommissionBps ?? this.options.broker.commissionBps,
2467
2476
  affiliates: affiliateBrokers
2477
+ }, {
2478
+ url: this.options.broker.url
2468
2479
  }, this.options.network);
2469
2480
  response = {
2470
2481
  id: `${result.issuedBlock}-${depositAddressRequest.srcChain}-${result.channelId}`,
@@ -2543,14 +2554,18 @@ var _SwapSDK = class _SwapSDK {
2543
2554
  const { ingressEgress: { channelOpeningFees } } = await this.getStateChainEnvironment();
2544
2555
  return channelOpeningFees;
2545
2556
  }
2546
- async getBoostLiquidity({ chainAsset, feeTierBps } = {}) {
2557
+ async getBoostLiquidity(params = {}) {
2547
2558
  let poolsDepth = await this.getBoostPoolsDepth();
2548
- if (chainAsset) {
2549
- const internalAsset = getInternalAsset(chainAsset);
2559
+ if ("chain" in params && "asset" in params) {
2560
+ const { chain, asset } = params;
2561
+ const internalAsset = getInternalAsset({
2562
+ chain,
2563
+ asset
2564
+ });
2550
2565
  poolsDepth = poolsDepth.filter((boostPoolDepth) => boostPoolDepth.asset === internalAsset).sort((a, b) => b.tier - a.tier);
2551
2566
  }
2552
- if (feeTierBps) {
2553
- poolsDepth = poolsDepth.filter((boostPoolDepth) => boostPoolDepth.tier === feeTierBps);
2567
+ if ("feeTierBps" in params && params.feeTierBps !== void 0) {
2568
+ poolsDepth = poolsDepth.filter((boostPoolDepth) => boostPoolDepth.tier === params.feeTierBps);
2554
2569
  }
2555
2570
  return poolsDepth.map((depth) => ({
2556
2571
  availableAmount: depth.availableAmount,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainflip/sdk",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "",
5
5
  "exports": {
6
6
  "./swap": {
@@ -42,9 +42,9 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@chainflip/rpc": "^1.4.10",
45
- "@chainflip/utils": "^0.2.1",
45
+ "@chainflip/utils": "^0.4.0",
46
46
  "axios": "^1.6.8",
47
- "ethers": "^6.13.1"
47
+ "ethers": "^6.13.2"
48
48
  },
49
49
  "devDependencies": {
50
50
  "tsup": "^8.1.0"