@chainflip/sdk 0.2.19 → 0.2.21

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 { chainflipAssetAndChain, numericString, hexString, btcAddress, ccmMetadataSchema, hexStringFromNumber, dotAddress, unsignedInteger } from './chunk-Z7GY2ZBQ.mjs';
2
- import { z, isNotNullish, __name, Assets } from './chunk-6B4B7WKD.mjs';
1
+ import { chainflipAssetAndChain, numericString, hexString, btcAddress, ccmMetadataSchema, hexStringFromNumber, dotAddress, unsignedInteger } from './chunk-N4SMMWKH.mjs';
2
+ import { z, isNotNullish, __name, Assets } from './chunk-B2TZXL7C.mjs';
3
3
  import { u8aToHex } from '@polkadot/util';
4
4
  import { decodeAddress } from '@polkadot/util-crypto';
5
5
  import axios from 'axios';
@@ -1,4 +1,4 @@
1
- import { z, isString, Chains, Assets, assetChains, ChainflipNetworks, __name, assert } from './chunk-6B4B7WKD.mjs';
1
+ import { z, isString, Chains, Assets, assetChains, ChainflipNetworks, __name, assert } from './chunk-B2TZXL7C.mjs';
2
2
  import { hexToU8a } from '@polkadot/util';
3
3
  import { encodeAddress, decodeAddress, base58Decode } from '@polkadot/util-crypto';
4
4
  import * as ethers from 'ethers';
@@ -1,4 +1,4 @@
1
- import { z, ChainflipNetworks, __name, __publicField, assert, Assets } from './chunk-6B4B7WKD.mjs';
1
+ import { z, ChainflipNetworks, __name, __publicField, Assets } from './chunk-B2TZXL7C.mjs';
2
2
  import axios from 'axios';
3
3
  import { Interface, Contract } from 'ethers';
4
4
 
@@ -2117,6 +2117,12 @@ var ADDRESSES = {
2117
2117
  USDC_CONTRACT_ADDRESS: GOERLI_USDC_CONTRACT_ADDRESS,
2118
2118
  VAULT_CONTRACT_ADDRESS: "0x40caFF3f3B6706Da904a7895e0fC7F7922437e9B",
2119
2119
  STATE_CHAIN_GATEWAY_ADDRESS: "0x38AA40B7b5a70d738baBf6699a45DacdDBBEB3fc"
2120
+ },
2121
+ [ChainflipNetworks.mainnet]: {
2122
+ FLIP_CONTRACT_ADDRESS: "0x826180541412D574cf1336d22c0C0a287822678A",
2123
+ USDC_CONTRACT_ADDRESS: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
2124
+ VAULT_CONTRACT_ADDRESS: "0xF5e10380213880111522dd0efD3dbb45b9f62Bcc",
2125
+ STATE_CHAIN_GATEWAY_ADDRESS: "0x6995Ab7c4D7F4B03f467Cf4c8E920427d9621DBd"
2120
2126
  }
2121
2127
  };
2122
2128
 
@@ -2126,17 +2132,13 @@ var extractOverrides = /* @__PURE__ */ __name((transactionOverrides) => {
2126
2132
  return ethersOverrides;
2127
2133
  }, "extractOverrides");
2128
2134
  var getTokenContractAddress = /* @__PURE__ */ __name((asset, network) => {
2129
- assert(network !== ChainflipNetworks.mainnet, "Mainnet is not yet supported");
2130
2135
  if (asset === Assets.FLIP)
2131
2136
  return ADDRESSES[network].FLIP_CONTRACT_ADDRESS;
2132
2137
  if (asset === Assets.USDC)
2133
2138
  return ADDRESSES[network].USDC_CONTRACT_ADDRESS;
2134
2139
  throw new Error("Only FLIP and USDC are supported for now");
2135
2140
  }, "getTokenContractAddress");
2136
- var getStateChainGatewayContractAddress = /* @__PURE__ */ __name((network) => {
2137
- assert(network !== ChainflipNetworks.mainnet, "Mainnet is not yet supported");
2138
- return ADDRESSES[network].STATE_CHAIN_GATEWAY_ADDRESS;
2139
- }, "getStateChainGatewayContractAddress");
2141
+ var getStateChainGatewayContractAddress = /* @__PURE__ */ __name((network) => ADDRESSES[network].STATE_CHAIN_GATEWAY_ADDRESS, "getStateChainGatewayContractAddress");
2140
2142
  var checkAllowance = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20Address, signer) => {
2141
2143
  const erc20 = ERC20__factory.connect(erc20Address, signer);
2142
2144
  const signerAddress = await signer.getAddress();
@@ -2153,10 +2155,7 @@ var approve = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20, allow
2153
2155
  const transaction = await erc20.approve(spenderAddress, amount - allowance, extractOverrides(txOpts));
2154
2156
  return transaction.wait(txOpts.wait);
2155
2157
  }, "approve");
2156
- var getVaultManagerContractAddress = /* @__PURE__ */ __name((network) => {
2157
- assert(network !== ChainflipNetworks.mainnet, "Mainnet is not yet supported");
2158
- return ADDRESSES[network].VAULT_CONTRACT_ADDRESS;
2159
- }, "getVaultManagerContractAddress");
2158
+ var getVaultManagerContractAddress = /* @__PURE__ */ __name((network) => ADDRESSES[network].VAULT_CONTRACT_ADDRESS, "getVaultManagerContractAddress");
2160
2159
  var getFlipBalance = /* @__PURE__ */ __name(async (network, signer) => {
2161
2160
  const flipAddress = getTokenContractAddress("FLIP", network);
2162
2161
  const flip = ERC20__factory.connect(flipAddress, signer);
@@ -38,4 +38,4 @@ type TransactionOptions = {
38
38
  wait?: number;
39
39
  };
40
40
 
41
- export { Asset as A, Chain as C, TransactionOptions as T, ChainflipNetwork as a, Chains as b, chainAssets as c, Assets as d, ChainflipNetworks as e, assetChains as f, assetDecimals as g, assetContractIds as h, chainContractIds as i };
41
+ export { type Asset as A, type Chain as C, type TransactionOptions as T, type ChainflipNetwork as a, Chains as b, chainAssets as c, Assets as d, ChainflipNetworks as e, assetChains as f, assetDecimals as g, assetContractIds as h, chainContractIds as i };
@@ -0,0 +1,41 @@
1
+ type ArrayToMap<T extends readonly string[]> = {
2
+ [K in T[number]]: K;
3
+ };
4
+ declare const Chains: ArrayToMap<readonly ["Bitcoin", "Ethereum", "Polkadot"]>;
5
+ type Chain = (typeof Chains)[keyof typeof Chains];
6
+ declare const Assets: ArrayToMap<readonly ["FLIP", "USDC", "DOT", "ETH", "BTC"]>;
7
+ type Asset = (typeof Assets)[keyof typeof Assets];
8
+ declare const ChainflipNetworks: ArrayToMap<readonly ["backspin", "sisyphos", "perseverance", "mainnet"]>;
9
+ type ChainflipNetwork = (typeof ChainflipNetworks)[keyof typeof ChainflipNetworks];
10
+ declare const assetChains: {
11
+ ETH: "Ethereum";
12
+ FLIP: "Ethereum";
13
+ USDC: "Ethereum";
14
+ BTC: "Bitcoin";
15
+ DOT: "Polkadot";
16
+ };
17
+ declare const assetDecimals: {
18
+ DOT: number;
19
+ ETH: number;
20
+ FLIP: number;
21
+ USDC: number;
22
+ BTC: number;
23
+ };
24
+ declare const assetContractIds: Record<Asset, number>;
25
+ declare const chainAssets: {
26
+ Ethereum: ("FLIP" | "USDC" | "ETH")[];
27
+ Bitcoin: "BTC"[];
28
+ Polkadot: "DOT"[];
29
+ };
30
+ declare const chainContractIds: Record<Chain, number>;
31
+
32
+ type TransactionOptions = {
33
+ gasLimit?: bigint;
34
+ gasPrice?: bigint;
35
+ maxFeePerGas?: bigint;
36
+ maxPriorityFeePerGas?: bigint;
37
+ nonce?: number;
38
+ wait?: number;
39
+ };
40
+
41
+ export { type Asset as A, type Chain as C, type TransactionOptions as T, type ChainflipNetwork as a, Chains as b, chainAssets as c, Assets as d, ChainflipNetworks as e, assetChains as f, assetDecimals as g, assetContractIds as h, chainContractIds as i };
@@ -1,5 +1,5 @@
1
1
  import { Signer } from 'ethers';
2
- import { a as ChainflipNetwork, T as TransactionOptions } from './contracts-fee99026.js';
2
+ import { a as ChainflipNetwork, T as TransactionOptions } from './contracts-rsXvYw7v.mjs';
3
3
 
4
4
  type PendingRedemption = {
5
5
  amount: bigint;
@@ -9,7 +9,7 @@ type PendingRedemption = {
9
9
  };
10
10
 
11
11
  type FundingSDKOption = {
12
- network?: Exclude<ChainflipNetwork, 'mainnet'>;
12
+ network?: ChainflipNetwork;
13
13
  signer: Signer;
14
14
  rpcUrl?: string;
15
15
  };
@@ -29,4 +29,4 @@ declare class FundingSDK {
29
29
  getRedemptionTax(): Promise<bigint>;
30
30
  }
31
31
 
32
- export { FundingSDK, FundingSDKOption, PendingRedemption };
32
+ export { FundingSDK, type FundingSDKOption, type PendingRedemption };
package/dist/funding.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Signer } from 'ethers';
2
- import { a as ChainflipNetwork, T as TransactionOptions } from './contracts-fee99026.js';
2
+ import { a as ChainflipNetwork, T as TransactionOptions } from './contracts-rsXvYw7v.js';
3
3
 
4
4
  type PendingRedemption = {
5
5
  amount: bigint;
@@ -9,7 +9,7 @@ type PendingRedemption = {
9
9
  };
10
10
 
11
11
  type FundingSDKOption = {
12
- network?: Exclude<ChainflipNetwork, 'mainnet'>;
12
+ network?: ChainflipNetwork;
13
13
  signer: Signer;
14
14
  rpcUrl?: string;
15
15
  };
@@ -29,4 +29,4 @@ declare class FundingSDK {
29
29
  getRedemptionTax(): Promise<bigint>;
30
30
  }
31
31
 
32
- export { FundingSDK, FundingSDKOption, PendingRedemption };
32
+ export { FundingSDK, type FundingSDKOption, type PendingRedemption };
package/dist/funding.js CHANGED
@@ -854,38 +854,28 @@ var ADDRESSES = {
854
854
  USDC_CONTRACT_ADDRESS: GOERLI_USDC_CONTRACT_ADDRESS,
855
855
  VAULT_CONTRACT_ADDRESS: "0x40caFF3f3B6706Da904a7895e0fC7F7922437e9B",
856
856
  STATE_CHAIN_GATEWAY_ADDRESS: "0x38AA40B7b5a70d738baBf6699a45DacdDBBEB3fc"
857
+ },
858
+ [ChainflipNetworks.mainnet]: {
859
+ FLIP_CONTRACT_ADDRESS: "0x826180541412D574cf1336d22c0C0a287822678A",
860
+ USDC_CONTRACT_ADDRESS: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
861
+ VAULT_CONTRACT_ADDRESS: "0xF5e10380213880111522dd0efD3dbb45b9f62Bcc",
862
+ STATE_CHAIN_GATEWAY_ADDRESS: "0x6995Ab7c4D7F4B03f467Cf4c8E920427d9621DBd"
857
863
  }
858
864
  };
859
865
 
860
- // ../shared/src/guards.ts
861
- function assert(condition, message) {
862
- if (condition)
863
- return;
864
- const error = new Error(message);
865
- if (error.stack) {
866
- error.stack = error.stack.replace(/\n.+/, "\n");
867
- }
868
- throw error;
869
- }
870
- __name(assert, "assert");
871
-
872
866
  // ../shared/src/contracts.ts
873
867
  var extractOverrides = /* @__PURE__ */ __name((transactionOverrides) => {
874
868
  const { wait, ...ethersOverrides } = transactionOverrides;
875
869
  return ethersOverrides;
876
870
  }, "extractOverrides");
877
871
  var getTokenContractAddress = /* @__PURE__ */ __name((asset, network) => {
878
- assert(network !== ChainflipNetworks.mainnet, "Mainnet is not yet supported");
879
872
  if (asset === Assets.FLIP)
880
873
  return ADDRESSES[network].FLIP_CONTRACT_ADDRESS;
881
874
  if (asset === Assets.USDC)
882
875
  return ADDRESSES[network].USDC_CONTRACT_ADDRESS;
883
876
  throw new Error("Only FLIP and USDC are supported for now");
884
877
  }, "getTokenContractAddress");
885
- var getStateChainGatewayContractAddress = /* @__PURE__ */ __name((network) => {
886
- assert(network !== ChainflipNetworks.mainnet, "Mainnet is not yet supported");
887
- return ADDRESSES[network].STATE_CHAIN_GATEWAY_ADDRESS;
888
- }, "getStateChainGatewayContractAddress");
878
+ var getStateChainGatewayContractAddress = /* @__PURE__ */ __name((network) => ADDRESSES[network].STATE_CHAIN_GATEWAY_ADDRESS, "getStateChainGatewayContractAddress");
889
879
  var checkAllowance = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20Address, signer) => {
890
880
  const erc20 = ERC20__factory.connect(erc20Address, signer);
891
881
  const signerAddress = await signer.getAddress();
@@ -4861,6 +4851,18 @@ var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
4861
4851
  return StateChainGateway__factory.connect(stateChainGatewayContractAddress, networkOpts.signer);
4862
4852
  }, "getStateChainGateway");
4863
4853
 
4854
+ // ../shared/src/guards.ts
4855
+ function assert(condition, message) {
4856
+ if (condition)
4857
+ return;
4858
+ const error = new Error(message);
4859
+ if (error.stack) {
4860
+ error.stack = error.stack.replace(/\n.+/, "\n");
4861
+ }
4862
+ throw error;
4863
+ }
4864
+ __name(assert, "assert");
4865
+
4864
4866
  // ../shared/src/stateChainGateway/approval.ts
4865
4867
  var checkStateChainGatewayAllowance = /* @__PURE__ */ __name(async (amount, networkOpts) => {
4866
4868
  const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getTokenContractAddress(Assets.FLIP, networkOpts.network);
package/dist/funding.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, checkAllowance, extractOverrides, StateChainGateway__factory } from './chunk-JIK6G4FY.mjs';
2
- import { __name, __publicField, ChainflipNetworks, Assets, assert } from './chunk-6B4B7WKD.mjs';
1
+ import { getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, checkAllowance, extractOverrides, StateChainGateway__factory } from './chunk-TCRJUCSA.mjs';
2
+ import { __name, __publicField, ChainflipNetworks, Assets, assert } from './chunk-B2TZXL7C.mjs';
3
3
 
4
4
  // ../shared/src/stateChainGateway/utils.ts
5
5
  var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
package/dist/swap.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Signer } from 'ethers';
2
- import { A as Asset, C as Chain, c as chainAssets, a as ChainflipNetwork, T as TransactionOptions } from './contracts-fee99026.js';
3
- export { d as Assets, e as ChainflipNetworks, b as Chains, f as assetChains, h as assetContractIds, g as assetDecimals, i as chainContractIds } from './contracts-fee99026.js';
2
+ import { A as Asset, C as Chain, c as chainAssets, a as ChainflipNetwork, T as TransactionOptions } from './contracts-rsXvYw7v.mjs';
3
+ export { d as Assets, e as ChainflipNetworks, b as Chains, f as assetChains, h as assetContractIds, g as assetDecimals, i as chainContractIds } from './contracts-rsXvYw7v.mjs';
4
4
  import { z } from 'zod';
5
5
 
6
6
  declare const tokenSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
@@ -429,6 +429,7 @@ interface CommonStatusFields extends ChainsAndAssets {
429
429
  depositChannelExpiryBlock: bigint;
430
430
  estimatedDepositChannelExpiryTime: number | undefined;
431
431
  isDepositChanneExpired: boolean;
432
+ depositChannelOpenedThroughBackend: boolean;
432
433
  ccmDepositReceivedBlockIndex: string | undefined;
433
434
  ccmMetadata: {
434
435
  gasBudget: string;
@@ -549,4 +550,4 @@ declare class SwapSDK {
549
550
  approveVault(params: Pick<TokenSwapParams, 'srcAsset' | 'amount'>, txOpts?: TransactionOptions): Promise<TransactionHash | null>;
550
551
  }
551
552
 
552
- export { Asset, AssetData, Chain, ChainData, ChainflipNetwork, DepositAddressRequest, DepositAddressResponse, QuoteRequest, QuoteResponse, SwapSDK, SwapSDKOptions, SwapStatusRequest, SwapStatusResponse, chainAssets };
553
+ export { Asset, type AssetData, Chain, type ChainData, ChainflipNetwork, type DepositAddressRequest, type DepositAddressResponse, type QuoteRequest, type QuoteResponse, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, chainAssets };
package/dist/swap.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Signer } from 'ethers';
2
- import { A as Asset, C as Chain, c as chainAssets, a as ChainflipNetwork, T as TransactionOptions } from './contracts-fee99026.js';
3
- export { d as Assets, e as ChainflipNetworks, b as Chains, f as assetChains, h as assetContractIds, g as assetDecimals, i as chainContractIds } from './contracts-fee99026.js';
2
+ import { A as Asset, C as Chain, c as chainAssets, a as ChainflipNetwork, T as TransactionOptions } from './contracts-rsXvYw7v.js';
3
+ export { d as Assets, e as ChainflipNetworks, b as Chains, f as assetChains, h as assetContractIds, g as assetDecimals, i as chainContractIds } from './contracts-rsXvYw7v.js';
4
4
  import { z } from 'zod';
5
5
 
6
6
  declare const tokenSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
@@ -429,6 +429,7 @@ interface CommonStatusFields extends ChainsAndAssets {
429
429
  depositChannelExpiryBlock: bigint;
430
430
  estimatedDepositChannelExpiryTime: number | undefined;
431
431
  isDepositChanneExpired: boolean;
432
+ depositChannelOpenedThroughBackend: boolean;
432
433
  ccmDepositReceivedBlockIndex: string | undefined;
433
434
  ccmMetadata: {
434
435
  gasBudget: string;
@@ -549,4 +550,4 @@ declare class SwapSDK {
549
550
  approveVault(params: Pick<TokenSwapParams, 'srcAsset' | 'amount'>, txOpts?: TransactionOptions): Promise<TransactionHash | null>;
550
551
  }
551
552
 
552
- export { Asset, AssetData, Chain, ChainData, ChainflipNetwork, DepositAddressRequest, DepositAddressResponse, QuoteRequest, QuoteResponse, SwapSDK, SwapSDKOptions, SwapStatusRequest, SwapStatusResponse, chainAssets };
553
+ export { Asset, type AssetData, Chain, type ChainData, ChainflipNetwork, type DepositAddressRequest, type DepositAddressResponse, type QuoteRequest, type QuoteResponse, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, chainAssets };
package/dist/swap.js CHANGED
@@ -4478,7 +4478,7 @@ var init_broker = __esm({
4478
4478
  }
4479
4479
  });
4480
4480
 
4481
- // ../../node_modules/.pnpm/@trpc+server@10.43.1/node_modules/@trpc/server/dist/observable-ade1bad8.mjs
4481
+ // ../../node_modules/.pnpm/@trpc+server@10.44.1/node_modules/@trpc/server/dist/observable-ade1bad8.mjs
4482
4482
  function identity(x) {
4483
4483
  return x;
4484
4484
  }
@@ -4557,7 +4557,7 @@ function observable(subscribe) {
4557
4557
  }
4558
4558
  __name(observable, "observable");
4559
4559
 
4560
- // ../../node_modules/.pnpm/@trpc+server@10.43.1/node_modules/@trpc/server/dist/observable/index.mjs
4560
+ // ../../node_modules/.pnpm/@trpc+server@10.44.1/node_modules/@trpc/server/dist/observable/index.mjs
4561
4561
  function share(_opts) {
4562
4562
  return (originalObserver) => {
4563
4563
  let refCount = 0;
@@ -4662,7 +4662,7 @@ function observableToPromise(observable2) {
4662
4662
  }
4663
4663
  __name(observableToPromise, "observableToPromise");
4664
4664
 
4665
- // ../../node_modules/.pnpm/@trpc+client@10.43.1_@trpc+server@10.43.1/node_modules/@trpc/client/dist/splitLink-4c75f7be.mjs
4665
+ // ../../node_modules/.pnpm/@trpc+client@10.44.1_@trpc+server@10.44.1/node_modules/@trpc/client/dist/splitLink-4c75f7be.mjs
4666
4666
  function createChain(opts) {
4667
4667
  return observable((observer) => {
4668
4668
  function execute(index = 0, op = opts.op) {
@@ -4686,7 +4686,7 @@ function createChain(opts) {
4686
4686
  }
4687
4687
  __name(createChain, "createChain");
4688
4688
 
4689
- // ../../node_modules/.pnpm/@trpc+client@10.43.1_@trpc+server@10.43.1/node_modules/@trpc/client/dist/transformResult-ace864b8.mjs
4689
+ // ../../node_modules/.pnpm/@trpc+client@10.44.1_@trpc+server@10.44.1/node_modules/@trpc/client/dist/transformResult-ace864b8.mjs
4690
4690
  function isObject(value) {
4691
4691
  return !!value && !Array.isArray(value) && typeof value === "object";
4692
4692
  }
@@ -4739,7 +4739,7 @@ function transformResult(response, runtime) {
4739
4739
  }
4740
4740
  __name(transformResult, "transformResult");
4741
4741
 
4742
- // ../../node_modules/.pnpm/@trpc+client@10.43.1_@trpc+server@10.43.1/node_modules/@trpc/client/dist/TRPCClientError-0de4d231.mjs
4742
+ // ../../node_modules/.pnpm/@trpc+client@10.44.1_@trpc+server@10.44.1/node_modules/@trpc/client/dist/TRPCClientError-0de4d231.mjs
4743
4743
  function isTRPCClientError(cause) {
4744
4744
  return cause instanceof TRPCClientError || /**
4745
4745
  * @deprecated
@@ -4797,7 +4797,7 @@ var _TRPCClientError = class _TRPCClientError extends Error {
4797
4797
  __name(_TRPCClientError, "TRPCClientError");
4798
4798
  var TRPCClientError = _TRPCClientError;
4799
4799
 
4800
- // ../../node_modules/.pnpm/@trpc+server@10.43.1/node_modules/@trpc/server/dist/codes-c924c3db.mjs
4800
+ // ../../node_modules/.pnpm/@trpc+server@10.44.1/node_modules/@trpc/server/dist/codes-c924c3db.mjs
4801
4801
  function invert(obj) {
4802
4802
  const newObj = /* @__PURE__ */ Object.create(null);
4803
4803
  for (const key in obj) {
@@ -4835,7 +4835,7 @@ var TRPC_ERROR_CODES_BY_KEY = {
4835
4835
  };
4836
4836
  invert(TRPC_ERROR_CODES_BY_KEY);
4837
4837
 
4838
- // ../../node_modules/.pnpm/@trpc+server@10.43.1/node_modules/@trpc/server/dist/index-f91d720c.mjs
4838
+ // ../../node_modules/.pnpm/@trpc+server@10.44.1/node_modules/@trpc/server/dist/index-f91d720c.mjs
4839
4839
  invert(TRPC_ERROR_CODES_BY_KEY);
4840
4840
  var noop = /* @__PURE__ */ __name(() => {
4841
4841
  }, "noop");
@@ -4873,7 +4873,7 @@ var createFlatProxy = /* @__PURE__ */ __name((callback) => {
4873
4873
  });
4874
4874
  }, "createFlatProxy");
4875
4875
 
4876
- // ../../node_modules/.pnpm/@trpc+client@10.43.1_@trpc+server@10.43.1/node_modules/@trpc/client/dist/httpUtils-f58ceda1.mjs
4876
+ // ../../node_modules/.pnpm/@trpc+client@10.44.1_@trpc+server@10.44.1/node_modules/@trpc/client/dist/httpUtils-f58ceda1.mjs
4877
4877
  var isFunction = /* @__PURE__ */ __name((fn) => typeof fn === "function", "isFunction");
4878
4878
  function getFetch(customFetchImpl) {
4879
4879
  if (customFetchImpl) {
@@ -5017,7 +5017,7 @@ function httpRequest(opts) {
5017
5017
  }
5018
5018
  __name(httpRequest, "httpRequest");
5019
5019
 
5020
- // ../../node_modules/.pnpm/@trpc+client@10.43.1_@trpc+server@10.43.1/node_modules/@trpc/client/dist/httpBatchLink-204206a5.mjs
5020
+ // ../../node_modules/.pnpm/@trpc+client@10.44.1_@trpc+server@10.44.1/node_modules/@trpc/client/dist/httpBatchLink-204206a5.mjs
5021
5021
  var throwFatalError = /* @__PURE__ */ __name(() => {
5022
5022
  throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new");
5023
5023
  }, "throwFatalError");
@@ -5247,7 +5247,7 @@ var batchRequester = /* @__PURE__ */ __name((requesterOpts) => {
5247
5247
  }, "batchRequester");
5248
5248
  var httpBatchLink = createHTTPBatchLink(batchRequester);
5249
5249
 
5250
- // ../../node_modules/.pnpm/@trpc+client@10.43.1_@trpc+server@10.43.1/node_modules/@trpc/client/dist/links/httpLink.mjs
5250
+ // ../../node_modules/.pnpm/@trpc+client@10.44.1_@trpc+server@10.44.1/node_modules/@trpc/client/dist/links/httpLink.mjs
5251
5251
  function httpLinkFactory(factoryOpts) {
5252
5252
  return (opts) => {
5253
5253
  const resolvedOpts = resolveHTTPLinkOptions(opts);
@@ -5299,7 +5299,7 @@ function httpLinkFactory(factoryOpts) {
5299
5299
  }
5300
5300
  __name(httpLinkFactory, "httpLinkFactory");
5301
5301
 
5302
- // ../../node_modules/.pnpm/@trpc+client@10.43.1_@trpc+server@10.43.1/node_modules/@trpc/client/dist/index.mjs
5302
+ // ../../node_modules/.pnpm/@trpc+client@10.44.1_@trpc+server@10.44.1/node_modules/@trpc/client/dist/index.mjs
5303
5303
  var _TRPCUntypedClient = class _TRPCUntypedClient {
5304
5304
  $request({ type, input, path, context = {} }) {
5305
5305
  const chain$ = createChain({
@@ -5568,7 +5568,7 @@ var Registry = (
5568
5568
  );
5569
5569
 
5570
5570
  // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/class-registry.js
5571
- var __extends = function() {
5571
+ var __extends = /* @__PURE__ */ function() {
5572
5572
  var extendStatics = /* @__PURE__ */ __name(function(d, b) {
5573
5573
  extendStatics = Object.setPrototypeOf || {
5574
5574
  __proto__: []
@@ -8186,18 +8186,22 @@ var ADDRESSES = {
8186
8186
  USDC_CONTRACT_ADDRESS: GOERLI_USDC_CONTRACT_ADDRESS,
8187
8187
  VAULT_CONTRACT_ADDRESS: "0x40caFF3f3B6706Da904a7895e0fC7F7922437e9B",
8188
8188
  STATE_CHAIN_GATEWAY_ADDRESS: "0x38AA40B7b5a70d738baBf6699a45DacdDBBEB3fc"
8189
+ },
8190
+ [exports.ChainflipNetworks.mainnet]: {
8191
+ FLIP_CONTRACT_ADDRESS: "0x826180541412D574cf1336d22c0C0a287822678A",
8192
+ USDC_CONTRACT_ADDRESS: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
8193
+ VAULT_CONTRACT_ADDRESS: "0xF5e10380213880111522dd0efD3dbb45b9f62Bcc",
8194
+ STATE_CHAIN_GATEWAY_ADDRESS: "0x6995Ab7c4D7F4B03f467Cf4c8E920427d9621DBd"
8189
8195
  }
8190
8196
  };
8191
8197
 
8192
8198
  // ../shared/src/contracts.ts
8193
8199
  init_enums();
8194
- init_guards();
8195
8200
  var extractOverrides = /* @__PURE__ */ __name((transactionOverrides) => {
8196
8201
  const { wait, ...ethersOverrides } = transactionOverrides;
8197
8202
  return ethersOverrides;
8198
8203
  }, "extractOverrides");
8199
8204
  var getTokenContractAddress = /* @__PURE__ */ __name((asset, network) => {
8200
- assert(network !== exports.ChainflipNetworks.mainnet, "Mainnet is not yet supported");
8201
8205
  if (asset === exports.Assets.FLIP)
8202
8206
  return ADDRESSES[network].FLIP_CONTRACT_ADDRESS;
8203
8207
  if (asset === exports.Assets.USDC)
@@ -8220,10 +8224,7 @@ var approve = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20, allow
8220
8224
  const transaction = await erc20.approve(spenderAddress, amount - allowance, extractOverrides(txOpts));
8221
8225
  return transaction.wait(txOpts.wait);
8222
8226
  }, "approve");
8223
- var getVaultManagerContractAddress = /* @__PURE__ */ __name((network) => {
8224
- assert(network !== exports.ChainflipNetworks.mainnet, "Mainnet is not yet supported");
8225
- return ADDRESSES[network].VAULT_CONTRACT_ADDRESS;
8226
- }, "getVaultManagerContractAddress");
8227
+ var getVaultManagerContractAddress = /* @__PURE__ */ __name((network) => ADDRESSES[network].VAULT_CONTRACT_ADDRESS, "getVaultManagerContractAddress");
8227
8228
 
8228
8229
  // ../shared/src/vault/executeSwap.ts
8229
8230
  init_enums();
package/dist/swap.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { getEnvironment, getVaultManagerContractAddress, approve, getTokenContractAddress, checkAllowance, Vault__factory, extractOverrides } from './chunk-JIK6G4FY.mjs';
2
- import { numericString, ethereumAddress, dotAddress, btcAddress, ccmMetadataSchema } from './chunk-Z7GY2ZBQ.mjs';
3
- import { __name, z, Chains, Assets, ChainflipNetworks, __publicField, assert, isTokenCall, isTokenSwap, chainContractIds, assetContractIds, assetDecimals, isTestnet } from './chunk-6B4B7WKD.mjs';
4
- export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-6B4B7WKD.mjs';
1
+ import { getEnvironment, getVaultManagerContractAddress, approve, getTokenContractAddress, checkAllowance, Vault__factory, extractOverrides } from './chunk-TCRJUCSA.mjs';
2
+ import { numericString, ethereumAddress, dotAddress, btcAddress, ccmMetadataSchema } from './chunk-N4SMMWKH.mjs';
3
+ import { __name, z, Chains, Assets, ChainflipNetworks, __publicField, assert, isTokenCall, isTokenSwap, chainContractIds, assetContractIds, assetDecimals, isTestnet } from './chunk-B2TZXL7C.mjs';
4
+ export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-B2TZXL7C.mjs';
5
5
  import { decodeAddress } from '@polkadot/util-crypto';
6
6
  import axios from 'axios';
7
7
 
8
- // ../../node_modules/.pnpm/@trpc+server@10.43.1/node_modules/@trpc/server/dist/observable-ade1bad8.mjs
8
+ // ../../node_modules/.pnpm/@trpc+server@10.44.1/node_modules/@trpc/server/dist/observable-ade1bad8.mjs
9
9
  function identity(x) {
10
10
  return x;
11
11
  }
@@ -84,7 +84,7 @@ function observable(subscribe) {
84
84
  }
85
85
  __name(observable, "observable");
86
86
 
87
- // ../../node_modules/.pnpm/@trpc+server@10.43.1/node_modules/@trpc/server/dist/observable/index.mjs
87
+ // ../../node_modules/.pnpm/@trpc+server@10.44.1/node_modules/@trpc/server/dist/observable/index.mjs
88
88
  function share(_opts) {
89
89
  return (originalObserver) => {
90
90
  let refCount = 0;
@@ -189,7 +189,7 @@ function observableToPromise(observable2) {
189
189
  }
190
190
  __name(observableToPromise, "observableToPromise");
191
191
 
192
- // ../../node_modules/.pnpm/@trpc+client@10.43.1_@trpc+server@10.43.1/node_modules/@trpc/client/dist/splitLink-4c75f7be.mjs
192
+ // ../../node_modules/.pnpm/@trpc+client@10.44.1_@trpc+server@10.44.1/node_modules/@trpc/client/dist/splitLink-4c75f7be.mjs
193
193
  function createChain(opts) {
194
194
  return observable((observer) => {
195
195
  function execute(index = 0, op = opts.op) {
@@ -213,7 +213,7 @@ function createChain(opts) {
213
213
  }
214
214
  __name(createChain, "createChain");
215
215
 
216
- // ../../node_modules/.pnpm/@trpc+client@10.43.1_@trpc+server@10.43.1/node_modules/@trpc/client/dist/transformResult-ace864b8.mjs
216
+ // ../../node_modules/.pnpm/@trpc+client@10.44.1_@trpc+server@10.44.1/node_modules/@trpc/client/dist/transformResult-ace864b8.mjs
217
217
  function isObject(value) {
218
218
  return !!value && !Array.isArray(value) && typeof value === "object";
219
219
  }
@@ -266,7 +266,7 @@ function transformResult(response, runtime) {
266
266
  }
267
267
  __name(transformResult, "transformResult");
268
268
 
269
- // ../../node_modules/.pnpm/@trpc+client@10.43.1_@trpc+server@10.43.1/node_modules/@trpc/client/dist/TRPCClientError-0de4d231.mjs
269
+ // ../../node_modules/.pnpm/@trpc+client@10.44.1_@trpc+server@10.44.1/node_modules/@trpc/client/dist/TRPCClientError-0de4d231.mjs
270
270
  function isTRPCClientError(cause) {
271
271
  return cause instanceof TRPCClientError || /**
272
272
  * @deprecated
@@ -324,7 +324,7 @@ var _TRPCClientError = class _TRPCClientError extends Error {
324
324
  __name(_TRPCClientError, "TRPCClientError");
325
325
  var TRPCClientError = _TRPCClientError;
326
326
 
327
- // ../../node_modules/.pnpm/@trpc+server@10.43.1/node_modules/@trpc/server/dist/codes-c924c3db.mjs
327
+ // ../../node_modules/.pnpm/@trpc+server@10.44.1/node_modules/@trpc/server/dist/codes-c924c3db.mjs
328
328
  function invert(obj) {
329
329
  const newObj = /* @__PURE__ */ Object.create(null);
330
330
  for (const key in obj) {
@@ -362,7 +362,7 @@ var TRPC_ERROR_CODES_BY_KEY = {
362
362
  };
363
363
  invert(TRPC_ERROR_CODES_BY_KEY);
364
364
 
365
- // ../../node_modules/.pnpm/@trpc+server@10.43.1/node_modules/@trpc/server/dist/index-f91d720c.mjs
365
+ // ../../node_modules/.pnpm/@trpc+server@10.44.1/node_modules/@trpc/server/dist/index-f91d720c.mjs
366
366
  invert(TRPC_ERROR_CODES_BY_KEY);
367
367
  var noop = /* @__PURE__ */ __name(() => {
368
368
  }, "noop");
@@ -400,7 +400,7 @@ var createFlatProxy = /* @__PURE__ */ __name((callback) => {
400
400
  });
401
401
  }, "createFlatProxy");
402
402
 
403
- // ../../node_modules/.pnpm/@trpc+client@10.43.1_@trpc+server@10.43.1/node_modules/@trpc/client/dist/httpUtils-f58ceda1.mjs
403
+ // ../../node_modules/.pnpm/@trpc+client@10.44.1_@trpc+server@10.44.1/node_modules/@trpc/client/dist/httpUtils-f58ceda1.mjs
404
404
  var isFunction = /* @__PURE__ */ __name((fn) => typeof fn === "function", "isFunction");
405
405
  function getFetch(customFetchImpl) {
406
406
  if (customFetchImpl) {
@@ -544,7 +544,7 @@ function httpRequest(opts) {
544
544
  }
545
545
  __name(httpRequest, "httpRequest");
546
546
 
547
- // ../../node_modules/.pnpm/@trpc+client@10.43.1_@trpc+server@10.43.1/node_modules/@trpc/client/dist/httpBatchLink-204206a5.mjs
547
+ // ../../node_modules/.pnpm/@trpc+client@10.44.1_@trpc+server@10.44.1/node_modules/@trpc/client/dist/httpBatchLink-204206a5.mjs
548
548
  var throwFatalError = /* @__PURE__ */ __name(() => {
549
549
  throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new");
550
550
  }, "throwFatalError");
@@ -774,7 +774,7 @@ var batchRequester = /* @__PURE__ */ __name((requesterOpts) => {
774
774
  }, "batchRequester");
775
775
  var httpBatchLink = createHTTPBatchLink(batchRequester);
776
776
 
777
- // ../../node_modules/.pnpm/@trpc+client@10.43.1_@trpc+server@10.43.1/node_modules/@trpc/client/dist/links/httpLink.mjs
777
+ // ../../node_modules/.pnpm/@trpc+client@10.44.1_@trpc+server@10.44.1/node_modules/@trpc/client/dist/links/httpLink.mjs
778
778
  function httpLinkFactory(factoryOpts) {
779
779
  return (opts) => {
780
780
  const resolvedOpts = resolveHTTPLinkOptions(opts);
@@ -826,7 +826,7 @@ function httpLinkFactory(factoryOpts) {
826
826
  }
827
827
  __name(httpLinkFactory, "httpLinkFactory");
828
828
 
829
- // ../../node_modules/.pnpm/@trpc+client@10.43.1_@trpc+server@10.43.1/node_modules/@trpc/client/dist/index.mjs
829
+ // ../../node_modules/.pnpm/@trpc+client@10.44.1_@trpc+server@10.44.1/node_modules/@trpc/client/dist/index.mjs
830
830
  var _TRPCUntypedClient = class _TRPCUntypedClient {
831
831
  $request({ type, input, path, context = {} }) {
832
832
  const chain$ = createChain({
@@ -1095,7 +1095,7 @@ var Registry = (
1095
1095
  );
1096
1096
 
1097
1097
  // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/class-registry.js
1098
- var __extends = function() {
1098
+ var __extends = /* @__PURE__ */ function() {
1099
1099
  var extendStatics = /* @__PURE__ */ __name(function(d, b) {
1100
1100
  extendStatics = Object.setPrototypeOf || {
1101
1101
  __proto__: []
@@ -2520,7 +2520,7 @@ var _SwapSDK = class _SwapSDK {
2520
2520
  async requestDepositAddress(depositAddressRequest) {
2521
2521
  let response;
2522
2522
  if (this.brokerConfig !== void 0) {
2523
- const { requestSwapDepositAddress } = await import('./broker-6S6G34FM.mjs');
2523
+ const { requestSwapDepositAddress } = await import('./broker-LHEVQ6DT.mjs');
2524
2524
  const result = await requestSwapDepositAddress(depositAddressRequest, this.brokerConfig);
2525
2525
  response = {
2526
2526
  id: `${result.issuedBlock}-${depositAddressRequest.srcChain}-${result.channelId}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainflip/sdk",
3
- "version": "0.2.19",
3
+ "version": "0.2.21",
4
4
  "description": "",
5
5
  "exports": {
6
6
  "./swap": {
@@ -41,13 +41,13 @@
41
41
  "access": "public"
42
42
  },
43
43
  "dependencies": {
44
- "@polkadot/util": "^12.5.1",
45
- "@polkadot/util-crypto": "^12.5.1",
44
+ "@polkadot/util": "^12.6.1",
45
+ "@polkadot/util-crypto": "^12.6.1",
46
46
  "axios": "^1.6.0",
47
- "ethers": "6.8.1"
47
+ "ethers": "6.9.0"
48
48
  },
49
49
  "devDependencies": {
50
- "tsup": "^7.2.0"
50
+ "tsup": "^8.0.1"
51
51
  },
52
52
  "scripts": {
53
53
  "test": "jest --forceExit",
File without changes