@chainflip/sdk 0.1.21 → 0.2.0

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 { BigNumber, utils, Contract } from 'ethers';
1
+ import { Interface, Contract } from 'ethers';
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
4
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -144,10 +144,10 @@ var _abi = [
144
144
  ];
145
145
  var _ERC20__factory = class _ERC20__factory {
146
146
  static createInterface() {
147
- return new utils.Interface(_abi);
147
+ return new Interface(_abi);
148
148
  }
149
- static connect(address, signerOrProvider) {
150
- return new Contract(address, _abi, signerOrProvider);
149
+ static connect(address, runner) {
150
+ return new Contract(address, _abi, runner);
151
151
  }
152
152
  };
153
153
  __name(_ERC20__factory, "ERC20__factory");
@@ -815,10 +815,10 @@ var _abi2 = [
815
815
  ];
816
816
  var _StateChainGateway__factory = class _StateChainGateway__factory {
817
817
  static createInterface() {
818
- return new utils.Interface(_abi2);
818
+ return new Interface(_abi2);
819
819
  }
820
- static connect(address, signerOrProvider) {
821
- return new Contract(address, _abi2, signerOrProvider);
820
+ static connect(address, runner) {
821
+ return new Contract(address, _abi2, runner);
822
822
  }
823
823
  };
824
824
  __name(_StateChainGateway__factory, "StateChainGateway__factory");
@@ -2039,10 +2039,10 @@ var _abi3 = [
2039
2039
  ];
2040
2040
  var _Vault__factory = class _Vault__factory {
2041
2041
  static createInterface() {
2042
- return new utils.Interface(_abi3);
2042
+ return new Interface(_abi3);
2043
2043
  }
2044
- static connect(address, signerOrProvider) {
2045
- return new Contract(address, _abi3, signerOrProvider);
2044
+ static connect(address, runner) {
2045
+ return new Contract(address, _abi3, runner);
2046
2046
  }
2047
2047
  };
2048
2048
  __name(_Vault__factory, "Vault__factory");
@@ -2126,17 +2126,14 @@ var checkAllowance = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20
2126
2126
  const allowance = await erc20.allowance(signerAddress, spenderAddress);
2127
2127
  return {
2128
2128
  allowance,
2129
- isAllowable: allowance.gte(amount),
2129
+ isAllowable: allowance >= amount,
2130
2130
  erc20
2131
2131
  };
2132
2132
  }, "checkAllowance");
2133
2133
  var approve = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20, allowance, txOpts) => {
2134
- const amountBigNumber = BigNumber.from(amount);
2135
- const allowanceBigNumber = BigNumber.from(allowance);
2136
- if (allowanceBigNumber.gte(amountBigNumber))
2134
+ if (allowance >= amount)
2137
2135
  return null;
2138
- const requiredAmount = amountBigNumber.sub(allowanceBigNumber);
2139
- const transaction = await erc20.approve(spenderAddress, requiredAmount, extractOverrides(txOpts));
2136
+ const transaction = await erc20.approve(spenderAddress, amount - allowance, extractOverrides(txOpts));
2140
2137
  return transaction.wait(txOpts.wait);
2141
2138
  }, "approve");
2142
2139
  var getVaultManagerContractAddress = /* @__PURE__ */ __name((network) => {
@@ -2146,8 +2143,7 @@ var getVaultManagerContractAddress = /* @__PURE__ */ __name((network) => {
2146
2143
  var getFlipBalance = /* @__PURE__ */ __name(async (network, signer) => {
2147
2144
  const flipAddress = getTokenContractAddress("FLIP", network);
2148
2145
  const flip = ERC20__factory.connect(flipAddress, signer);
2149
- const balance = await flip.balanceOf(await signer.getAddress());
2150
- return balance.toBigInt();
2146
+ return flip.balanceOf(await signer.getAddress());
2151
2147
  }, "getFlipBalance");
2152
2148
 
2153
2149
  export { Assets, ChainflipNetworks, Chains, StateChainGateway__factory, Vault__factory, __name, __publicField, approve, assert, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds, checkAllowance, extractOverrides, getFlipBalance, getMinimumDepositAmount, getMinimumSwapAmount, getStateChainGatewayContractAddress, getTokenContractAddress, getVaultManagerContractAddress, isString, isTestnet, isTokenCall, isTokenSwap };
@@ -34,7 +34,7 @@ type TransactionOptions = {
34
34
  gasPrice?: bigint;
35
35
  maxFeePerGas?: bigint;
36
36
  maxPriorityFeePerGas?: bigint;
37
- nonce?: bigint;
37
+ nonce?: number;
38
38
  wait?: number;
39
39
  };
40
40
 
@@ -1,5 +1,5 @@
1
1
  import { Signer } from 'ethers';
2
- import { T as TransactionOptions, a as ChainflipNetwork } from './contracts-0eb81d54.js';
2
+ import { T as TransactionOptions, a as ChainflipNetwork } from './contracts-646d1727.js';
3
3
 
4
4
  type SDKOptions = {
5
5
  network?: Exclude<ChainflipNetwork, 'mainnet'>;
@@ -9,12 +9,12 @@ type TransactionHash = string;
9
9
  declare class FundingSDK {
10
10
  private readonly options;
11
11
  constructor(options: SDKOptions);
12
- fundStateChainAccount(accountId: `0x${string}`, amount: string, txOpts?: TransactionOptions): Promise<TransactionHash>;
12
+ fundStateChainAccount(accountId: `0x${string}`, amount: bigint, txOpts?: TransactionOptions): Promise<TransactionHash>;
13
13
  executeRedemption(accountId: `0x${string}`, txOpts?: TransactionOptions): Promise<TransactionHash>;
14
14
  getMinimumFunding(): Promise<bigint>;
15
- getRedemptionDelay(): Promise<number>;
15
+ getRedemptionDelay(): Promise<bigint>;
16
16
  getFlipBalance(): Promise<bigint>;
17
- approveStateChainGateway(amount: bigint | string | number, txOpts?: TransactionOptions): Promise<TransactionHash | null>;
17
+ approveStateChainGateway(amount: bigint, txOpts?: TransactionOptions): Promise<TransactionHash | null>;
18
18
  }
19
19
 
20
20
  export { FundingSDK };
package/dist/funding.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Signer } from 'ethers';
2
- import { T as TransactionOptions, a as ChainflipNetwork } from './contracts-0eb81d54.js';
2
+ import { T as TransactionOptions, a as ChainflipNetwork } from './contracts-646d1727.js';
3
3
 
4
4
  type SDKOptions = {
5
5
  network?: Exclude<ChainflipNetwork, 'mainnet'>;
@@ -9,12 +9,12 @@ type TransactionHash = string;
9
9
  declare class FundingSDK {
10
10
  private readonly options;
11
11
  constructor(options: SDKOptions);
12
- fundStateChainAccount(accountId: `0x${string}`, amount: string, txOpts?: TransactionOptions): Promise<TransactionHash>;
12
+ fundStateChainAccount(accountId: `0x${string}`, amount: bigint, txOpts?: TransactionOptions): Promise<TransactionHash>;
13
13
  executeRedemption(accountId: `0x${string}`, txOpts?: TransactionOptions): Promise<TransactionHash>;
14
14
  getMinimumFunding(): Promise<bigint>;
15
- getRedemptionDelay(): Promise<number>;
15
+ getRedemptionDelay(): Promise<bigint>;
16
16
  getFlipBalance(): Promise<bigint>;
17
- approveStateChainGateway(amount: bigint | string | number, txOpts?: TransactionOptions): Promise<TransactionHash | null>;
17
+ approveStateChainGateway(amount: bigint, txOpts?: TransactionOptions): Promise<TransactionHash | null>;
18
18
  }
19
19
 
20
20
  export { FundingSDK };
package/dist/funding.js CHANGED
@@ -80,10 +80,10 @@ var _abi = [
80
80
  ];
81
81
  var _ERC20__factory = class _ERC20__factory {
82
82
  static createInterface() {
83
- return new ethers.utils.Interface(_abi);
83
+ return new ethers.Interface(_abi);
84
84
  }
85
- static connect(address, signerOrProvider) {
86
- return new ethers.Contract(address, _abi, signerOrProvider);
85
+ static connect(address, runner) {
86
+ return new ethers.Contract(address, _abi, runner);
87
87
  }
88
88
  };
89
89
  __name(_ERC20__factory, "ERC20__factory");
@@ -751,10 +751,10 @@ var _abi2 = [
751
751
  ];
752
752
  var _StateChainGateway__factory = class _StateChainGateway__factory {
753
753
  static createInterface() {
754
- return new ethers.utils.Interface(_abi2);
754
+ return new ethers.Interface(_abi2);
755
755
  }
756
- static connect(address, signerOrProvider) {
757
- return new ethers.Contract(address, _abi2, signerOrProvider);
756
+ static connect(address, runner) {
757
+ return new ethers.Contract(address, _abi2, runner);
758
758
  }
759
759
  };
760
760
  __name(_StateChainGateway__factory, "StateChainGateway__factory");
@@ -898,24 +898,20 @@ var checkAllowance = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20
898
898
  const allowance = await erc20.allowance(signerAddress, spenderAddress);
899
899
  return {
900
900
  allowance,
901
- isAllowable: allowance.gte(amount),
901
+ isAllowable: allowance >= amount,
902
902
  erc20
903
903
  };
904
904
  }, "checkAllowance");
905
905
  var approve = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20, allowance, txOpts) => {
906
- const amountBigNumber = ethers.BigNumber.from(amount);
907
- const allowanceBigNumber = ethers.BigNumber.from(allowance);
908
- if (allowanceBigNumber.gte(amountBigNumber))
906
+ if (allowance >= amount)
909
907
  return null;
910
- const requiredAmount = amountBigNumber.sub(allowanceBigNumber);
911
- const transaction = await erc20.approve(spenderAddress, requiredAmount, extractOverrides(txOpts));
908
+ const transaction = await erc20.approve(spenderAddress, amount - allowance, extractOverrides(txOpts));
912
909
  return transaction.wait(txOpts.wait);
913
910
  }, "approve");
914
911
  var getFlipBalance = /* @__PURE__ */ __name(async (network, signer) => {
915
912
  const flipAddress = getTokenContractAddress("FLIP", network);
916
913
  const flip = ERC20__factory.connect(flipAddress, signer);
917
- const balance = await flip.balanceOf(await signer.getAddress());
918
- return balance.toBigInt();
914
+ return flip.balanceOf(await signer.getAddress());
919
915
  }, "getFlipBalance");
920
916
 
921
917
  // ../shared/src/stateChainGateway/utils.ts
@@ -942,7 +938,7 @@ var approveStateChainGateway = /* @__PURE__ */ __name(async (amount, networkOpts
942
938
  var fundStateChainAccount = /* @__PURE__ */ __name(async (accountId, amount, networkOpts, txOpts) => {
943
939
  const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getTokenContractAddress(Assets.FLIP, networkOpts.network);
944
940
  const stateChainGateway = getStateChainGateway(networkOpts);
945
- const { isAllowable } = await checkAllowance(amount, stateChainGateway.address, flipContractAddress, networkOpts.signer);
941
+ const { isAllowable } = await checkAllowance(amount, await stateChainGateway.getAddress(), flipContractAddress, networkOpts.signer);
946
942
  assert(isAllowable, "Insufficient allowance");
947
943
  const transaction = await stateChainGateway.fundStateChainAccount(accountId, amount, extractOverrides(txOpts));
948
944
  return transaction.wait(txOpts.wait);
@@ -976,18 +972,17 @@ var _FundingSDK = class _FundingSDK {
976
972
  */
977
973
  async fundStateChainAccount(accountId, amount, txOpts = {}) {
978
974
  const tx = await fundStateChainAccount(accountId, amount, this.options, txOpts);
979
- return tx.transactionHash;
975
+ return tx.hash;
980
976
  }
981
977
  /**
982
978
  * @param accountId the hex-encoded validator account id
983
979
  */
984
980
  async executeRedemption(accountId, txOpts = {}) {
985
981
  const tx = await executeRedemption(accountId, this.options, txOpts);
986
- return tx.transactionHash;
982
+ return tx.hash;
987
983
  }
988
984
  async getMinimumFunding() {
989
- const amount = await getMinimumFunding(this.options);
990
- return amount.toBigInt();
985
+ return getMinimumFunding(this.options);
991
986
  }
992
987
  async getRedemptionDelay() {
993
988
  return getRedemptionDelay(this.options);
@@ -1001,7 +996,7 @@ var _FundingSDK = class _FundingSDK {
1001
996
  */
1002
997
  async approveStateChainGateway(amount, txOpts = {}) {
1003
998
  const receipt = await approveStateChainGateway(amount, this.options, txOpts);
1004
- return receipt && receipt.transactionHash;
999
+ return receipt && receipt.hash;
1005
1000
  }
1006
1001
  };
1007
1002
  __name(_FundingSDK, "FundingSDK");
package/dist/funding.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { __name, __publicField, ChainflipNetworks, getFlipBalance, getStateChainGatewayContractAddress, approve, getTokenContractAddress, Assets, checkAllowance, assert, extractOverrides, StateChainGateway__factory } from './chunk-TH2B6MNX.mjs';
1
+ import { __name, __publicField, ChainflipNetworks, getFlipBalance, getStateChainGatewayContractAddress, approve, getTokenContractAddress, Assets, checkAllowance, assert, extractOverrides, StateChainGateway__factory } from './chunk-UBMU3BTF.mjs';
2
2
 
3
3
  // ../shared/src/stateChainGateway/utils.ts
4
4
  var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
@@ -24,7 +24,7 @@ var approveStateChainGateway = /* @__PURE__ */ __name(async (amount, networkOpts
24
24
  var fundStateChainAccount = /* @__PURE__ */ __name(async (accountId, amount, networkOpts, txOpts) => {
25
25
  const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getTokenContractAddress(Assets.FLIP, networkOpts.network);
26
26
  const stateChainGateway = getStateChainGateway(networkOpts);
27
- const { isAllowable } = await checkAllowance(amount, stateChainGateway.address, flipContractAddress, networkOpts.signer);
27
+ const { isAllowable } = await checkAllowance(amount, await stateChainGateway.getAddress(), flipContractAddress, networkOpts.signer);
28
28
  assert(isAllowable, "Insufficient allowance");
29
29
  const transaction = await stateChainGateway.fundStateChainAccount(accountId, amount, extractOverrides(txOpts));
30
30
  return transaction.wait(txOpts.wait);
@@ -58,18 +58,17 @@ var _FundingSDK = class _FundingSDK {
58
58
  */
59
59
  async fundStateChainAccount(accountId, amount, txOpts = {}) {
60
60
  const tx = await fundStateChainAccount(accountId, amount, this.options, txOpts);
61
- return tx.transactionHash;
61
+ return tx.hash;
62
62
  }
63
63
  /**
64
64
  * @param accountId the hex-encoded validator account id
65
65
  */
66
66
  async executeRedemption(accountId, txOpts = {}) {
67
67
  const tx = await executeRedemption(accountId, this.options, txOpts);
68
- return tx.transactionHash;
68
+ return tx.hash;
69
69
  }
70
70
  async getMinimumFunding() {
71
- const amount = await getMinimumFunding(this.options);
72
- return amount.toBigInt();
71
+ return getMinimumFunding(this.options);
73
72
  }
74
73
  async getRedemptionDelay() {
75
74
  return getRedemptionDelay(this.options);
@@ -83,7 +82,7 @@ var _FundingSDK = class _FundingSDK {
83
82
  */
84
83
  async approveStateChainGateway(amount, txOpts = {}) {
85
84
  const receipt = await approveStateChainGateway(amount, this.options, txOpts);
86
- return receipt && receipt.transactionHash;
85
+ return receipt && receipt.hash;
87
86
  }
88
87
  };
89
88
  __name(_FundingSDK, "FundingSDK");
package/dist/swap.d.mts CHANGED
@@ -1,87 +1,87 @@
1
1
  import { Signer } from 'ethers';
2
- import { C as Chain, c as chainAssets, A as Asset, a as ChainflipNetwork, T as TransactionOptions } from './contracts-0eb81d54.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-0eb81d54.js';
2
+ import { C as Chain, c as chainAssets, A as Asset, a as ChainflipNetwork, T as TransactionOptions } from './contracts-646d1727.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-646d1727.js';
4
4
  import { z } from 'zod';
5
5
 
6
6
  declare const tokenSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
7
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
7
+ amount: z.ZodBigInt;
8
8
  srcChain: z.ZodLiteral<"Ethereum">;
9
9
  destChain: z.ZodLiteral<"Ethereum">;
10
10
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
11
11
  srcAsset: z.ZodLiteral<"FLIP">;
12
12
  destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
13
13
  }, "strip", z.ZodTypeAny, {
14
- amount: string | bigint;
14
+ amount: bigint;
15
15
  srcChain: "Ethereum";
16
16
  srcAsset: "FLIP";
17
17
  destChain: "Ethereum";
18
18
  destAddress: `0x${string}`;
19
19
  destAsset: "USDC" | "ETH";
20
20
  }, {
21
- amount: string | bigint;
21
+ amount: bigint;
22
22
  srcChain: "Ethereum";
23
23
  srcAsset: "FLIP";
24
24
  destChain: "Ethereum";
25
25
  destAddress: `0x${string}`;
26
26
  destAsset: "USDC" | "ETH";
27
27
  }>, z.ZodObject<{
28
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
28
+ amount: z.ZodBigInt;
29
29
  srcChain: z.ZodLiteral<"Ethereum">;
30
30
  destChain: z.ZodLiteral<"Ethereum">;
31
31
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
32
32
  srcAsset: z.ZodLiteral<"USDC">;
33
33
  destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
34
34
  }, "strip", z.ZodTypeAny, {
35
- amount: string | bigint;
35
+ amount: bigint;
36
36
  srcChain: "Ethereum";
37
37
  srcAsset: "USDC";
38
38
  destChain: "Ethereum";
39
39
  destAddress: `0x${string}`;
40
40
  destAsset: "FLIP" | "ETH";
41
41
  }, {
42
- amount: string | bigint;
42
+ amount: bigint;
43
43
  srcChain: "Ethereum";
44
44
  srcAsset: "USDC";
45
45
  destChain: "Ethereum";
46
46
  destAddress: `0x${string}`;
47
47
  destAsset: "FLIP" | "ETH";
48
48
  }>, z.ZodObject<{
49
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
49
+ amount: z.ZodBigInt;
50
50
  srcChain: z.ZodLiteral<"Ethereum">;
51
51
  destChain: z.ZodLiteral<"Polkadot">;
52
52
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>]>, string | null, string>, string, string>, string, string>;
53
53
  destAsset: z.ZodLiteral<"DOT">;
54
54
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
55
55
  }, "strip", z.ZodTypeAny, {
56
- amount: string | bigint;
56
+ amount: bigint;
57
57
  srcChain: "Ethereum";
58
58
  srcAsset: "FLIP" | "USDC";
59
59
  destChain: "Polkadot";
60
60
  destAddress: string;
61
61
  destAsset: "DOT";
62
62
  }, {
63
- amount: string | bigint;
63
+ amount: bigint;
64
64
  srcChain: "Ethereum";
65
65
  srcAsset: "FLIP" | "USDC";
66
66
  destChain: "Polkadot";
67
67
  destAddress: string;
68
68
  destAsset: "DOT";
69
69
  }>, z.ZodObject<{
70
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
70
+ amount: z.ZodBigInt;
71
71
  srcChain: z.ZodLiteral<"Ethereum">;
72
72
  destChain: z.ZodLiteral<"Bitcoin">;
73
73
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
74
74
  destAsset: z.ZodLiteral<"BTC">;
75
75
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
76
76
  }, "strip", z.ZodTypeAny, {
77
- amount: string | bigint;
77
+ amount: bigint;
78
78
  srcChain: "Ethereum";
79
79
  srcAsset: "FLIP" | "USDC";
80
80
  destChain: "Bitcoin";
81
81
  destAddress: string;
82
82
  destAsset: "BTC";
83
83
  }, {
84
- amount: string | bigint;
84
+ amount: bigint;
85
85
  srcChain: "Ethereum";
86
86
  srcAsset: "FLIP" | "USDC";
87
87
  destChain: "Bitcoin";
@@ -89,7 +89,7 @@ declare const tokenSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
89
89
  destAsset: "BTC";
90
90
  }>]>;
91
91
  declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
92
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
92
+ amount: z.ZodBigInt;
93
93
  srcChain: z.ZodLiteral<"Ethereum">;
94
94
  srcAsset: z.ZodLiteral<"ETH">;
95
95
  destChain: z.ZodLiteral<"Ethereum">;
@@ -106,7 +106,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
106
106
  gasBudget: string;
107
107
  }>;
108
108
  }, "strip", z.ZodTypeAny, {
109
- amount: string | bigint;
109
+ amount: bigint;
110
110
  srcChain: "Ethereum";
111
111
  srcAsset: "ETH";
112
112
  destChain: "Ethereum";
@@ -117,7 +117,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
117
117
  gasBudget: string;
118
118
  };
119
119
  }, {
120
- amount: string | bigint;
120
+ amount: bigint;
121
121
  srcChain: "Ethereum";
122
122
  srcAsset: "ETH";
123
123
  destChain: "Ethereum";
@@ -128,7 +128,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
128
128
  gasBudget: string;
129
129
  };
130
130
  }>, z.ZodUnion<[z.ZodObject<{
131
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
131
+ amount: z.ZodBigInt;
132
132
  srcChain: z.ZodLiteral<"Ethereum">;
133
133
  srcAsset: z.ZodLiteral<"FLIP">;
134
134
  destChain: z.ZodLiteral<"Ethereum">;
@@ -145,7 +145,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
145
145
  gasBudget: string;
146
146
  }>;
147
147
  }, "strip", z.ZodTypeAny, {
148
- amount: string | bigint;
148
+ amount: bigint;
149
149
  srcChain: "Ethereum";
150
150
  srcAsset: "FLIP";
151
151
  destChain: "Ethereum";
@@ -156,7 +156,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
156
156
  gasBudget: string;
157
157
  };
158
158
  }, {
159
- amount: string | bigint;
159
+ amount: bigint;
160
160
  srcChain: "Ethereum";
161
161
  srcAsset: "FLIP";
162
162
  destChain: "Ethereum";
@@ -167,7 +167,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
167
167
  gasBudget: string;
168
168
  };
169
169
  }>, z.ZodObject<{
170
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
170
+ amount: z.ZodBigInt;
171
171
  srcChain: z.ZodLiteral<"Ethereum">;
172
172
  srcAsset: z.ZodLiteral<"USDC">;
173
173
  destChain: z.ZodLiteral<"Ethereum">;
@@ -184,7 +184,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
184
184
  gasBudget: string;
185
185
  }>;
186
186
  }, "strip", z.ZodTypeAny, {
187
- amount: string | bigint;
187
+ amount: bigint;
188
188
  srcChain: "Ethereum";
189
189
  srcAsset: "USDC";
190
190
  destChain: "Ethereum";
@@ -195,7 +195,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
195
195
  gasBudget: string;
196
196
  };
197
197
  }, {
198
- amount: string | bigint;
198
+ amount: bigint;
199
199
  srcChain: "Ethereum";
200
200
  srcAsset: "USDC";
201
201
  destChain: "Ethereum";
@@ -206,147 +206,147 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
206
206
  gasBudget: string;
207
207
  };
208
208
  }>]>, z.ZodUnion<[z.ZodObject<{
209
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
209
+ amount: z.ZodBigInt;
210
210
  srcChain: z.ZodLiteral<"Ethereum">;
211
211
  srcAsset: z.ZodLiteral<"ETH">;
212
212
  destChain: z.ZodLiteral<"Ethereum">;
213
213
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
214
214
  destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
215
215
  }, "strip", z.ZodTypeAny, {
216
- amount: string | bigint;
216
+ amount: bigint;
217
217
  srcChain: "Ethereum";
218
218
  srcAsset: "ETH";
219
219
  destChain: "Ethereum";
220
220
  destAddress: `0x${string}`;
221
221
  destAsset: "FLIP" | "USDC";
222
222
  }, {
223
- amount: string | bigint;
223
+ amount: bigint;
224
224
  srcChain: "Ethereum";
225
225
  srcAsset: "ETH";
226
226
  destChain: "Ethereum";
227
227
  destAddress: `0x${string}`;
228
228
  destAsset: "FLIP" | "USDC";
229
229
  }>, z.ZodObject<{
230
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
230
+ amount: z.ZodBigInt;
231
231
  srcChain: z.ZodLiteral<"Ethereum">;
232
232
  srcAsset: z.ZodLiteral<"ETH">;
233
233
  destChain: z.ZodLiteral<"Polkadot">;
234
234
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>]>, string | null, string>, string, string>, string, string>;
235
235
  destAsset: z.ZodLiteral<"DOT">;
236
236
  }, "strip", z.ZodTypeAny, {
237
- amount: string | bigint;
237
+ amount: bigint;
238
238
  srcChain: "Ethereum";
239
239
  srcAsset: "ETH";
240
240
  destChain: "Polkadot";
241
241
  destAddress: string;
242
242
  destAsset: "DOT";
243
243
  }, {
244
- amount: string | bigint;
244
+ amount: bigint;
245
245
  srcChain: "Ethereum";
246
246
  srcAsset: "ETH";
247
247
  destChain: "Polkadot";
248
248
  destAddress: string;
249
249
  destAsset: "DOT";
250
250
  }>, z.ZodObject<{
251
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
251
+ amount: z.ZodBigInt;
252
252
  srcChain: z.ZodLiteral<"Ethereum">;
253
253
  srcAsset: z.ZodLiteral<"ETH">;
254
254
  destChain: z.ZodLiteral<"Bitcoin">;
255
255
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
256
256
  destAsset: z.ZodLiteral<"BTC">;
257
257
  }, "strip", z.ZodTypeAny, {
258
- amount: string | bigint;
258
+ amount: bigint;
259
259
  srcChain: "Ethereum";
260
260
  srcAsset: "ETH";
261
261
  destChain: "Bitcoin";
262
262
  destAddress: string;
263
263
  destAsset: "BTC";
264
264
  }, {
265
- amount: string | bigint;
265
+ amount: bigint;
266
266
  srcChain: "Ethereum";
267
267
  srcAsset: "ETH";
268
268
  destChain: "Bitcoin";
269
269
  destAddress: string;
270
270
  destAsset: "BTC";
271
271
  }>]>, z.ZodUnion<[z.ZodObject<{
272
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
272
+ amount: z.ZodBigInt;
273
273
  srcChain: z.ZodLiteral<"Ethereum">;
274
274
  destChain: z.ZodLiteral<"Ethereum">;
275
275
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
276
276
  srcAsset: z.ZodLiteral<"FLIP">;
277
277
  destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
278
278
  }, "strip", z.ZodTypeAny, {
279
- amount: string | bigint;
279
+ amount: bigint;
280
280
  srcChain: "Ethereum";
281
281
  srcAsset: "FLIP";
282
282
  destChain: "Ethereum";
283
283
  destAddress: `0x${string}`;
284
284
  destAsset: "USDC" | "ETH";
285
285
  }, {
286
- amount: string | bigint;
286
+ amount: bigint;
287
287
  srcChain: "Ethereum";
288
288
  srcAsset: "FLIP";
289
289
  destChain: "Ethereum";
290
290
  destAddress: `0x${string}`;
291
291
  destAsset: "USDC" | "ETH";
292
292
  }>, z.ZodObject<{
293
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
293
+ amount: z.ZodBigInt;
294
294
  srcChain: z.ZodLiteral<"Ethereum">;
295
295
  destChain: z.ZodLiteral<"Ethereum">;
296
296
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
297
297
  srcAsset: z.ZodLiteral<"USDC">;
298
298
  destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
299
299
  }, "strip", z.ZodTypeAny, {
300
- amount: string | bigint;
300
+ amount: bigint;
301
301
  srcChain: "Ethereum";
302
302
  srcAsset: "USDC";
303
303
  destChain: "Ethereum";
304
304
  destAddress: `0x${string}`;
305
305
  destAsset: "FLIP" | "ETH";
306
306
  }, {
307
- amount: string | bigint;
307
+ amount: bigint;
308
308
  srcChain: "Ethereum";
309
309
  srcAsset: "USDC";
310
310
  destChain: "Ethereum";
311
311
  destAddress: `0x${string}`;
312
312
  destAsset: "FLIP" | "ETH";
313
313
  }>, z.ZodObject<{
314
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
314
+ amount: z.ZodBigInt;
315
315
  srcChain: z.ZodLiteral<"Ethereum">;
316
316
  destChain: z.ZodLiteral<"Polkadot">;
317
317
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>]>, string | null, string>, string, string>, string, string>;
318
318
  destAsset: z.ZodLiteral<"DOT">;
319
319
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
320
320
  }, "strip", z.ZodTypeAny, {
321
- amount: string | bigint;
321
+ amount: bigint;
322
322
  srcChain: "Ethereum";
323
323
  srcAsset: "FLIP" | "USDC";
324
324
  destChain: "Polkadot";
325
325
  destAddress: string;
326
326
  destAsset: "DOT";
327
327
  }, {
328
- amount: string | bigint;
328
+ amount: bigint;
329
329
  srcChain: "Ethereum";
330
330
  srcAsset: "FLIP" | "USDC";
331
331
  destChain: "Polkadot";
332
332
  destAddress: string;
333
333
  destAsset: "DOT";
334
334
  }>, z.ZodObject<{
335
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
335
+ amount: z.ZodBigInt;
336
336
  srcChain: z.ZodLiteral<"Ethereum">;
337
337
  destChain: z.ZodLiteral<"Bitcoin">;
338
338
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
339
339
  destAsset: z.ZodLiteral<"BTC">;
340
340
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
341
341
  }, "strip", z.ZodTypeAny, {
342
- amount: string | bigint;
342
+ amount: bigint;
343
343
  srcChain: "Ethereum";
344
344
  srcAsset: "FLIP" | "USDC";
345
345
  destChain: "Bitcoin";
346
346
  destAddress: string;
347
347
  destAsset: "BTC";
348
348
  }, {
349
- amount: string | bigint;
349
+ amount: bigint;
350
350
  srcChain: "Ethereum";
351
351
  srcAsset: "FLIP" | "USDC";
352
352
  destChain: "Bitcoin";
package/dist/swap.d.ts CHANGED
@@ -1,87 +1,87 @@
1
1
  import { Signer } from 'ethers';
2
- import { C as Chain, c as chainAssets, A as Asset, a as ChainflipNetwork, T as TransactionOptions } from './contracts-0eb81d54.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-0eb81d54.js';
2
+ import { C as Chain, c as chainAssets, A as Asset, a as ChainflipNetwork, T as TransactionOptions } from './contracts-646d1727.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-646d1727.js';
4
4
  import { z } from 'zod';
5
5
 
6
6
  declare const tokenSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
7
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
7
+ amount: z.ZodBigInt;
8
8
  srcChain: z.ZodLiteral<"Ethereum">;
9
9
  destChain: z.ZodLiteral<"Ethereum">;
10
10
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
11
11
  srcAsset: z.ZodLiteral<"FLIP">;
12
12
  destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
13
13
  }, "strip", z.ZodTypeAny, {
14
- amount: string | bigint;
14
+ amount: bigint;
15
15
  srcChain: "Ethereum";
16
16
  srcAsset: "FLIP";
17
17
  destChain: "Ethereum";
18
18
  destAddress: `0x${string}`;
19
19
  destAsset: "USDC" | "ETH";
20
20
  }, {
21
- amount: string | bigint;
21
+ amount: bigint;
22
22
  srcChain: "Ethereum";
23
23
  srcAsset: "FLIP";
24
24
  destChain: "Ethereum";
25
25
  destAddress: `0x${string}`;
26
26
  destAsset: "USDC" | "ETH";
27
27
  }>, z.ZodObject<{
28
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
28
+ amount: z.ZodBigInt;
29
29
  srcChain: z.ZodLiteral<"Ethereum">;
30
30
  destChain: z.ZodLiteral<"Ethereum">;
31
31
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
32
32
  srcAsset: z.ZodLiteral<"USDC">;
33
33
  destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
34
34
  }, "strip", z.ZodTypeAny, {
35
- amount: string | bigint;
35
+ amount: bigint;
36
36
  srcChain: "Ethereum";
37
37
  srcAsset: "USDC";
38
38
  destChain: "Ethereum";
39
39
  destAddress: `0x${string}`;
40
40
  destAsset: "FLIP" | "ETH";
41
41
  }, {
42
- amount: string | bigint;
42
+ amount: bigint;
43
43
  srcChain: "Ethereum";
44
44
  srcAsset: "USDC";
45
45
  destChain: "Ethereum";
46
46
  destAddress: `0x${string}`;
47
47
  destAsset: "FLIP" | "ETH";
48
48
  }>, z.ZodObject<{
49
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
49
+ amount: z.ZodBigInt;
50
50
  srcChain: z.ZodLiteral<"Ethereum">;
51
51
  destChain: z.ZodLiteral<"Polkadot">;
52
52
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>]>, string | null, string>, string, string>, string, string>;
53
53
  destAsset: z.ZodLiteral<"DOT">;
54
54
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
55
55
  }, "strip", z.ZodTypeAny, {
56
- amount: string | bigint;
56
+ amount: bigint;
57
57
  srcChain: "Ethereum";
58
58
  srcAsset: "FLIP" | "USDC";
59
59
  destChain: "Polkadot";
60
60
  destAddress: string;
61
61
  destAsset: "DOT";
62
62
  }, {
63
- amount: string | bigint;
63
+ amount: bigint;
64
64
  srcChain: "Ethereum";
65
65
  srcAsset: "FLIP" | "USDC";
66
66
  destChain: "Polkadot";
67
67
  destAddress: string;
68
68
  destAsset: "DOT";
69
69
  }>, z.ZodObject<{
70
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
70
+ amount: z.ZodBigInt;
71
71
  srcChain: z.ZodLiteral<"Ethereum">;
72
72
  destChain: z.ZodLiteral<"Bitcoin">;
73
73
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
74
74
  destAsset: z.ZodLiteral<"BTC">;
75
75
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
76
76
  }, "strip", z.ZodTypeAny, {
77
- amount: string | bigint;
77
+ amount: bigint;
78
78
  srcChain: "Ethereum";
79
79
  srcAsset: "FLIP" | "USDC";
80
80
  destChain: "Bitcoin";
81
81
  destAddress: string;
82
82
  destAsset: "BTC";
83
83
  }, {
84
- amount: string | bigint;
84
+ amount: bigint;
85
85
  srcChain: "Ethereum";
86
86
  srcAsset: "FLIP" | "USDC";
87
87
  destChain: "Bitcoin";
@@ -89,7 +89,7 @@ declare const tokenSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
89
89
  destAsset: "BTC";
90
90
  }>]>;
91
91
  declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
92
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
92
+ amount: z.ZodBigInt;
93
93
  srcChain: z.ZodLiteral<"Ethereum">;
94
94
  srcAsset: z.ZodLiteral<"ETH">;
95
95
  destChain: z.ZodLiteral<"Ethereum">;
@@ -106,7 +106,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
106
106
  gasBudget: string;
107
107
  }>;
108
108
  }, "strip", z.ZodTypeAny, {
109
- amount: string | bigint;
109
+ amount: bigint;
110
110
  srcChain: "Ethereum";
111
111
  srcAsset: "ETH";
112
112
  destChain: "Ethereum";
@@ -117,7 +117,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
117
117
  gasBudget: string;
118
118
  };
119
119
  }, {
120
- amount: string | bigint;
120
+ amount: bigint;
121
121
  srcChain: "Ethereum";
122
122
  srcAsset: "ETH";
123
123
  destChain: "Ethereum";
@@ -128,7 +128,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
128
128
  gasBudget: string;
129
129
  };
130
130
  }>, z.ZodUnion<[z.ZodObject<{
131
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
131
+ amount: z.ZodBigInt;
132
132
  srcChain: z.ZodLiteral<"Ethereum">;
133
133
  srcAsset: z.ZodLiteral<"FLIP">;
134
134
  destChain: z.ZodLiteral<"Ethereum">;
@@ -145,7 +145,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
145
145
  gasBudget: string;
146
146
  }>;
147
147
  }, "strip", z.ZodTypeAny, {
148
- amount: string | bigint;
148
+ amount: bigint;
149
149
  srcChain: "Ethereum";
150
150
  srcAsset: "FLIP";
151
151
  destChain: "Ethereum";
@@ -156,7 +156,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
156
156
  gasBudget: string;
157
157
  };
158
158
  }, {
159
- amount: string | bigint;
159
+ amount: bigint;
160
160
  srcChain: "Ethereum";
161
161
  srcAsset: "FLIP";
162
162
  destChain: "Ethereum";
@@ -167,7 +167,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
167
167
  gasBudget: string;
168
168
  };
169
169
  }>, z.ZodObject<{
170
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
170
+ amount: z.ZodBigInt;
171
171
  srcChain: z.ZodLiteral<"Ethereum">;
172
172
  srcAsset: z.ZodLiteral<"USDC">;
173
173
  destChain: z.ZodLiteral<"Ethereum">;
@@ -184,7 +184,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
184
184
  gasBudget: string;
185
185
  }>;
186
186
  }, "strip", z.ZodTypeAny, {
187
- amount: string | bigint;
187
+ amount: bigint;
188
188
  srcChain: "Ethereum";
189
189
  srcAsset: "USDC";
190
190
  destChain: "Ethereum";
@@ -195,7 +195,7 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
195
195
  gasBudget: string;
196
196
  };
197
197
  }, {
198
- amount: string | bigint;
198
+ amount: bigint;
199
199
  srcChain: "Ethereum";
200
200
  srcAsset: "USDC";
201
201
  destChain: "Ethereum";
@@ -206,147 +206,147 @@ declare const executeSwapParamsSchema: z.ZodUnion<[z.ZodObject<{
206
206
  gasBudget: string;
207
207
  };
208
208
  }>]>, z.ZodUnion<[z.ZodObject<{
209
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
209
+ amount: z.ZodBigInt;
210
210
  srcChain: z.ZodLiteral<"Ethereum">;
211
211
  srcAsset: z.ZodLiteral<"ETH">;
212
212
  destChain: z.ZodLiteral<"Ethereum">;
213
213
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
214
214
  destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
215
215
  }, "strip", z.ZodTypeAny, {
216
- amount: string | bigint;
216
+ amount: bigint;
217
217
  srcChain: "Ethereum";
218
218
  srcAsset: "ETH";
219
219
  destChain: "Ethereum";
220
220
  destAddress: `0x${string}`;
221
221
  destAsset: "FLIP" | "USDC";
222
222
  }, {
223
- amount: string | bigint;
223
+ amount: bigint;
224
224
  srcChain: "Ethereum";
225
225
  srcAsset: "ETH";
226
226
  destChain: "Ethereum";
227
227
  destAddress: `0x${string}`;
228
228
  destAsset: "FLIP" | "USDC";
229
229
  }>, z.ZodObject<{
230
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
230
+ amount: z.ZodBigInt;
231
231
  srcChain: z.ZodLiteral<"Ethereum">;
232
232
  srcAsset: z.ZodLiteral<"ETH">;
233
233
  destChain: z.ZodLiteral<"Polkadot">;
234
234
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>]>, string | null, string>, string, string>, string, string>;
235
235
  destAsset: z.ZodLiteral<"DOT">;
236
236
  }, "strip", z.ZodTypeAny, {
237
- amount: string | bigint;
237
+ amount: bigint;
238
238
  srcChain: "Ethereum";
239
239
  srcAsset: "ETH";
240
240
  destChain: "Polkadot";
241
241
  destAddress: string;
242
242
  destAsset: "DOT";
243
243
  }, {
244
- amount: string | bigint;
244
+ amount: bigint;
245
245
  srcChain: "Ethereum";
246
246
  srcAsset: "ETH";
247
247
  destChain: "Polkadot";
248
248
  destAddress: string;
249
249
  destAsset: "DOT";
250
250
  }>, z.ZodObject<{
251
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
251
+ amount: z.ZodBigInt;
252
252
  srcChain: z.ZodLiteral<"Ethereum">;
253
253
  srcAsset: z.ZodLiteral<"ETH">;
254
254
  destChain: z.ZodLiteral<"Bitcoin">;
255
255
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
256
256
  destAsset: z.ZodLiteral<"BTC">;
257
257
  }, "strip", z.ZodTypeAny, {
258
- amount: string | bigint;
258
+ amount: bigint;
259
259
  srcChain: "Ethereum";
260
260
  srcAsset: "ETH";
261
261
  destChain: "Bitcoin";
262
262
  destAddress: string;
263
263
  destAsset: "BTC";
264
264
  }, {
265
- amount: string | bigint;
265
+ amount: bigint;
266
266
  srcChain: "Ethereum";
267
267
  srcAsset: "ETH";
268
268
  destChain: "Bitcoin";
269
269
  destAddress: string;
270
270
  destAsset: "BTC";
271
271
  }>]>, z.ZodUnion<[z.ZodObject<{
272
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
272
+ amount: z.ZodBigInt;
273
273
  srcChain: z.ZodLiteral<"Ethereum">;
274
274
  destChain: z.ZodLiteral<"Ethereum">;
275
275
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
276
276
  srcAsset: z.ZodLiteral<"FLIP">;
277
277
  destAsset: z.ZodUnion<[z.ZodLiteral<"USDC">, z.ZodLiteral<"ETH">]>;
278
278
  }, "strip", z.ZodTypeAny, {
279
- amount: string | bigint;
279
+ amount: bigint;
280
280
  srcChain: "Ethereum";
281
281
  srcAsset: "FLIP";
282
282
  destChain: "Ethereum";
283
283
  destAddress: `0x${string}`;
284
284
  destAsset: "USDC" | "ETH";
285
285
  }, {
286
- amount: string | bigint;
286
+ amount: bigint;
287
287
  srcChain: "Ethereum";
288
288
  srcAsset: "FLIP";
289
289
  destChain: "Ethereum";
290
290
  destAddress: `0x${string}`;
291
291
  destAsset: "USDC" | "ETH";
292
292
  }>, z.ZodObject<{
293
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
293
+ amount: z.ZodBigInt;
294
294
  srcChain: z.ZodLiteral<"Ethereum">;
295
295
  destChain: z.ZodLiteral<"Ethereum">;
296
296
  destAddress: z.ZodEffects<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, `0x${string}`, `0x${string}`>;
297
297
  srcAsset: z.ZodLiteral<"USDC">;
298
298
  destAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"ETH">]>;
299
299
  }, "strip", z.ZodTypeAny, {
300
- amount: string | bigint;
300
+ amount: bigint;
301
301
  srcChain: "Ethereum";
302
302
  srcAsset: "USDC";
303
303
  destChain: "Ethereum";
304
304
  destAddress: `0x${string}`;
305
305
  destAsset: "FLIP" | "ETH";
306
306
  }, {
307
- amount: string | bigint;
307
+ amount: bigint;
308
308
  srcChain: "Ethereum";
309
309
  srcAsset: "USDC";
310
310
  destChain: "Ethereum";
311
311
  destAddress: `0x${string}`;
312
312
  destAsset: "FLIP" | "ETH";
313
313
  }>, z.ZodObject<{
314
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
314
+ amount: z.ZodBigInt;
315
315
  srcChain: z.ZodLiteral<"Ethereum">;
316
316
  destChain: z.ZodLiteral<"Polkadot">;
317
317
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>]>, string | null, string>, string, string>, string, string>;
318
318
  destAsset: z.ZodLiteral<"DOT">;
319
319
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
320
320
  }, "strip", z.ZodTypeAny, {
321
- amount: string | bigint;
321
+ amount: bigint;
322
322
  srcChain: "Ethereum";
323
323
  srcAsset: "FLIP" | "USDC";
324
324
  destChain: "Polkadot";
325
325
  destAddress: string;
326
326
  destAsset: "DOT";
327
327
  }, {
328
- amount: string | bigint;
328
+ amount: bigint;
329
329
  srcChain: "Ethereum";
330
330
  srcAsset: "FLIP" | "USDC";
331
331
  destChain: "Polkadot";
332
332
  destAddress: string;
333
333
  destAsset: "DOT";
334
334
  }>, z.ZodObject<{
335
- amount: z.ZodUnion<[z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodBigInt]>;
335
+ amount: z.ZodBigInt;
336
336
  srcChain: z.ZodLiteral<"Ethereum">;
337
337
  destChain: z.ZodLiteral<"Bitcoin">;
338
338
  destAddress: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, string, string>;
339
339
  destAsset: z.ZodLiteral<"BTC">;
340
340
  srcAsset: z.ZodUnion<[z.ZodLiteral<"FLIP">, z.ZodLiteral<"USDC">]>;
341
341
  }, "strip", z.ZodTypeAny, {
342
- amount: string | bigint;
342
+ amount: bigint;
343
343
  srcChain: "Ethereum";
344
344
  srcAsset: "FLIP" | "USDC";
345
345
  destChain: "Bitcoin";
346
346
  destAddress: string;
347
347
  destAsset: "BTC";
348
348
  }, {
349
- amount: string | bigint;
349
+ amount: bigint;
350
350
  srcChain: "Ethereum";
351
351
  srcAsset: "FLIP" | "USDC";
352
352
  destChain: "Bitcoin";
package/dist/swap.js CHANGED
@@ -321,7 +321,7 @@ var assertArraylikeEqual = /* @__PURE__ */ __name((a, b) => {
321
321
  }, "assertArraylikeEqual");
322
322
  var validateP2PKHOrP2SHAddress = /* @__PURE__ */ __name((address, network) => {
323
323
  try {
324
- const decoded = ethers__namespace.utils.base58.decode(address);
324
+ const decoded = utilCrypto.base58Decode(address);
325
325
  assert(decoded.length === 25, "decoded address must be 25 bytes long");
326
326
  if (network === "mainnet") {
327
327
  assert(decoded[0] === 0 || decoded[0] === 5, "decoded address must start with 0x00 or 0x05");
@@ -329,7 +329,7 @@ var validateP2PKHOrP2SHAddress = /* @__PURE__ */ __name((address, network) => {
329
329
  assert(decoded[0] === 111 || decoded[0] === 196, "decoded address must start with 0x6f or 0xc4");
330
330
  }
331
331
  const checksum = decoded.slice(-4);
332
- const doubleHash = ethers__namespace.utils.arrayify(ethers__namespace.utils.sha256(ethers__namespace.utils.sha256(decoded.slice(0, 21))));
332
+ const doubleHash = ethers__namespace.getBytes(ethers__namespace.sha256(ethers__namespace.sha256(decoded.slice(0, 21))));
333
333
  assertArraylikeEqual(checksum, doubleHash.slice(0, 4));
334
334
  return true;
335
335
  } catch (error) {
@@ -367,7 +367,7 @@ zod.z.number({
367
367
  });
368
368
  var numericString = string.regex(/^[0-9]+$/);
369
369
  var hexString = zod.z.custom((val) => typeof val === "string" && /^0x[0-9a-f]+$/i.test(val));
370
- numericString.transform((arg) => ethers__namespace.BigNumber.from(arg).toHexString()).refine((arg) => arg.startsWith("0x"));
370
+ numericString.transform((arg) => `0x${BigInt(arg).toString(16)}`);
371
371
  string.regex(/^[0-9a-f]+$/);
372
372
  var btcAddress = /* @__PURE__ */ __name((env) => {
373
373
  const network = env ?? process.env.CHAINFLIP_NETWORK;
@@ -392,7 +392,7 @@ var dotAddress = zod.z.union([
392
392
  return null;
393
393
  }
394
394
  }).refine(isString);
395
- var ethereumAddress = hexString.refine((address) => ethers__namespace.utils.isAddress(address));
395
+ var ethereumAddress = hexString.refine((address) => ethers__namespace.isAddress(address));
396
396
  numericString.transform((arg) => BigInt(arg));
397
397
  var u128 = zod.z.union([
398
398
  numericString,
@@ -442,11 +442,7 @@ var bytesToHex = /* @__PURE__ */ __name((arr) => `0x${[
442
442
  ].map((v) => v.toString(16).padStart(2, "0")).join("")}`, "bytesToHex");
443
443
  var utf8ToHex = /* @__PURE__ */ __name((str) => `0x${Buffer.from(str).toString("hex")}`, "utf8ToHex");
444
444
  var eth = zod.z.object({
445
- amount: zod.z.union([
446
- numericString,
447
- hexString,
448
- zod.z.bigint()
449
- ]),
445
+ amount: zod.z.bigint(),
450
446
  srcChain: zod.z.literal(Chains.Ethereum),
451
447
  srcAsset: zod.z.literal(Assets.ETH)
452
448
  });
@@ -597,10 +593,10 @@ var _abi = [
597
593
  ];
598
594
  var _ERC20__factory = class _ERC20__factory {
599
595
  static createInterface() {
600
- return new ethers.utils.Interface(_abi);
596
+ return new ethers.Interface(_abi);
601
597
  }
602
- static connect(address, signerOrProvider) {
603
- return new ethers.Contract(address, _abi, signerOrProvider);
598
+ static connect(address, runner) {
599
+ return new ethers.Contract(address, _abi, runner);
604
600
  }
605
601
  };
606
602
  __name(_ERC20__factory, "ERC20__factory");
@@ -1821,10 +1817,10 @@ var _abi2 = [
1821
1817
  ];
1822
1818
  var _Vault__factory = class _Vault__factory {
1823
1819
  static createInterface() {
1824
- return new ethers.utils.Interface(_abi2);
1820
+ return new ethers.Interface(_abi2);
1825
1821
  }
1826
- static connect(address, signerOrProvider) {
1827
- return new ethers.Contract(address, _abi2, signerOrProvider);
1822
+ static connect(address, runner) {
1823
+ return new ethers.Contract(address, _abi2, runner);
1828
1824
  }
1829
1825
  };
1830
1826
  __name(_Vault__factory, "Vault__factory");
@@ -1889,17 +1885,14 @@ var checkAllowance = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20
1889
1885
  const allowance = await erc20.allowance(signerAddress, spenderAddress);
1890
1886
  return {
1891
1887
  allowance,
1892
- isAllowable: allowance.gte(amount),
1888
+ isAllowable: allowance >= amount,
1893
1889
  erc20
1894
1890
  };
1895
1891
  }, "checkAllowance");
1896
1892
  var approve = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20, allowance, txOpts) => {
1897
- const amountBigNumber = ethers.BigNumber.from(amount);
1898
- const allowanceBigNumber = ethers.BigNumber.from(allowance);
1899
- if (allowanceBigNumber.gte(amountBigNumber))
1893
+ if (allowance >= amount)
1900
1894
  return null;
1901
- const requiredAmount = amountBigNumber.sub(allowanceBigNumber);
1902
- const transaction = await erc20.approve(spenderAddress, requiredAmount, extractOverrides(txOpts));
1895
+ const transaction = await erc20.approve(spenderAddress, amount - allowance, extractOverrides(txOpts));
1903
1896
  return transaction.wait(txOpts.wait);
1904
1897
  }, "approve");
1905
1898
  var getVaultManagerContractAddress = /* @__PURE__ */ __name((network) => {
@@ -1911,7 +1904,7 @@ var getVaultManagerContractAddress = /* @__PURE__ */ __name((network) => {
1911
1904
  var swapNative = /* @__PURE__ */ __name(async ({ destChain, destAsset, destAddress, amount }, networkOpts, txOpts) => {
1912
1905
  const vaultContractAddress = networkOpts.network === "localnet" ? networkOpts.vaultContractAddress : getVaultManagerContractAddress(networkOpts.network);
1913
1906
  const vault = Vault__factory.connect(vaultContractAddress, networkOpts.signer);
1914
- const transaction = await vault.xSwapNative(chainContractIds[destChain], destAddress, assetContractIds[destAsset], [], {
1907
+ const transaction = await vault.xSwapNative(chainContractIds[destChain], destAddress, assetContractIds[destAsset], "", {
1915
1908
  value: amount,
1916
1909
  ...extractOverrides(txOpts)
1917
1910
  });
@@ -1924,13 +1917,13 @@ var swapToken = /* @__PURE__ */ __name(async (params, networkOpts, txOpts) => {
1924
1917
  const { isAllowable } = await checkAllowance(params.amount, vaultContractAddress, erc20Address, networkOpts.signer);
1925
1918
  assert(isAllowable, "Swap amount exceeds allowance");
1926
1919
  const vault = Vault__factory.connect(vaultContractAddress, networkOpts.signer);
1927
- const transaction = await vault.xSwapToken(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], erc20Address, params.amount, [], extractOverrides(txOpts));
1920
+ const transaction = await vault.xSwapToken(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], erc20Address, params.amount, "", extractOverrides(txOpts));
1928
1921
  return transaction.wait(txOpts.wait);
1929
1922
  }, "swapToken");
1930
1923
  var callNative = /* @__PURE__ */ __name(async (params, networkOpts, txOpts) => {
1931
1924
  const vaultContractAddress = networkOpts.network === "localnet" ? networkOpts.vaultContractAddress : getVaultManagerContractAddress(networkOpts.network);
1932
1925
  const vault = Vault__factory.connect(vaultContractAddress, networkOpts.signer);
1933
- const transaction = await vault.xCallNative(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], params.ccmMetadata.message, params.ccmMetadata.gasBudget, [], {
1926
+ const transaction = await vault.xCallNative(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], params.ccmMetadata.message, params.ccmMetadata.gasBudget, "", {
1934
1927
  value: params.amount,
1935
1928
  ...extractOverrides(txOpts)
1936
1929
  });
@@ -1943,7 +1936,7 @@ var callToken = /* @__PURE__ */ __name(async (params, networkOpts, txOpts) => {
1943
1936
  const { isAllowable } = await checkAllowance(params.amount, vaultContractAddress, erc20Address, networkOpts.signer);
1944
1937
  assert(isAllowable, "Swap amount exceeds allowance");
1945
1938
  const vault = Vault__factory.connect(vaultContractAddress, networkOpts.signer);
1946
- const transaction = await vault.xCallToken(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], params.ccmMetadata.message, params.ccmMetadata.gasBudget, erc20Address, params.amount, [], extractOverrides(txOpts));
1939
+ const transaction = await vault.xCallToken(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], params.ccmMetadata.message, params.ccmMetadata.gasBudget, erc20Address, params.amount, "", extractOverrides(txOpts));
1947
1940
  return transaction.wait(txOpts.wait);
1948
1941
  }, "callToken");
1949
1942
  var executeSwap = /* @__PURE__ */ __name(async (params, networkOpts, txOpts) => {
@@ -2179,7 +2172,7 @@ var _SwapSDK = class _SwapSDK {
2179
2172
  network: this.network,
2180
2173
  signer: this.signer
2181
2174
  }, txOpts);
2182
- return receipt.transactionHash;
2175
+ return receipt.hash;
2183
2176
  }
2184
2177
  async approveVault(params, txOpts = {}) {
2185
2178
  if (!("srcAsset" in params))
@@ -2189,7 +2182,7 @@ var _SwapSDK = class _SwapSDK {
2189
2182
  signer: this.signer,
2190
2183
  network: this.network
2191
2184
  }, txOpts);
2192
- return receipt && receipt.transactionHash;
2185
+ return receipt && receipt.hash;
2193
2186
  }
2194
2187
  };
2195
2188
  __name(_SwapSDK, "SwapSDK");
package/dist/swap.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { isString, Chains, Assets, ChainflipNetworks, __name, __publicField, assert, getVaultManagerContractAddress, approve, isTokenCall, isTokenSwap, getTokenContractAddress, checkAllowance, Vault__factory, chainContractIds, assetContractIds, extractOverrides, assetDecimals, isTestnet, getMinimumDepositAmount, getMinimumSwapAmount } from './chunk-TH2B6MNX.mjs';
2
- export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-TH2B6MNX.mjs';
3
- import { encodeAddress, decodeAddress } from '@polkadot/util-crypto';
1
+ import { isString, Chains, Assets, ChainflipNetworks, __name, __publicField, assert, getVaultManagerContractAddress, approve, isTokenCall, isTokenSwap, getTokenContractAddress, checkAllowance, Vault__factory, chainContractIds, assetContractIds, extractOverrides, assetDecimals, isTestnet, getMinimumDepositAmount, getMinimumSwapAmount } from './chunk-UBMU3BTF.mjs';
2
+ export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-UBMU3BTF.mjs';
3
+ import { encodeAddress, decodeAddress, base58Decode } from '@polkadot/util-crypto';
4
4
  import { z } from 'zod';
5
5
  import { hexToU8a } from '@polkadot/util';
6
6
  import * as ethers from 'ethers';
@@ -209,7 +209,7 @@ var assertArraylikeEqual = /* @__PURE__ */ __name((a, b) => {
209
209
  }, "assertArraylikeEqual");
210
210
  var validateP2PKHOrP2SHAddress = /* @__PURE__ */ __name((address, network) => {
211
211
  try {
212
- const decoded = ethers.utils.base58.decode(address);
212
+ const decoded = base58Decode(address);
213
213
  assert(decoded.length === 25, "decoded address must be 25 bytes long");
214
214
  if (network === "mainnet") {
215
215
  assert(decoded[0] === 0 || decoded[0] === 5, "decoded address must start with 0x00 or 0x05");
@@ -217,7 +217,7 @@ var validateP2PKHOrP2SHAddress = /* @__PURE__ */ __name((address, network) => {
217
217
  assert(decoded[0] === 111 || decoded[0] === 196, "decoded address must start with 0x6f or 0xc4");
218
218
  }
219
219
  const checksum = decoded.slice(-4);
220
- const doubleHash = ethers.utils.arrayify(ethers.utils.sha256(ethers.utils.sha256(decoded.slice(0, 21))));
220
+ const doubleHash = ethers.getBytes(ethers.sha256(ethers.sha256(decoded.slice(0, 21))));
221
221
  assertArraylikeEqual(checksum, doubleHash.slice(0, 4));
222
222
  return true;
223
223
  } catch (error) {
@@ -255,7 +255,7 @@ z.number({
255
255
  });
256
256
  var numericString = string.regex(/^[0-9]+$/);
257
257
  var hexString = z.custom((val) => typeof val === "string" && /^0x[0-9a-f]+$/i.test(val));
258
- numericString.transform((arg) => ethers.BigNumber.from(arg).toHexString()).refine((arg) => arg.startsWith("0x"));
258
+ numericString.transform((arg) => `0x${BigInt(arg).toString(16)}`);
259
259
  string.regex(/^[0-9a-f]+$/);
260
260
  var btcAddress = /* @__PURE__ */ __name((env) => {
261
261
  const network = env ?? process.env.CHAINFLIP_NETWORK;
@@ -280,7 +280,7 @@ var dotAddress = z.union([
280
280
  return null;
281
281
  }
282
282
  }).refine(isString);
283
- var ethereumAddress = hexString.refine((address) => ethers.utils.isAddress(address));
283
+ var ethereumAddress = hexString.refine((address) => ethers.isAddress(address));
284
284
  numericString.transform((arg) => BigInt(arg));
285
285
  var u128 = z.union([
286
286
  numericString,
@@ -330,11 +330,7 @@ var bytesToHex = /* @__PURE__ */ __name((arr) => `0x${[
330
330
  ].map((v) => v.toString(16).padStart(2, "0")).join("")}`, "bytesToHex");
331
331
  var utf8ToHex = /* @__PURE__ */ __name((str) => `0x${Buffer.from(str).toString("hex")}`, "utf8ToHex");
332
332
  var eth = z.object({
333
- amount: z.union([
334
- numericString,
335
- hexString,
336
- z.bigint()
337
- ]),
333
+ amount: z.bigint(),
338
334
  srcChain: z.literal(Chains.Ethereum),
339
335
  srcAsset: z.literal(Assets.ETH)
340
336
  });
@@ -419,7 +415,7 @@ var executeSwapParamsSchema = z.union([
419
415
  var swapNative = /* @__PURE__ */ __name(async ({ destChain, destAsset, destAddress, amount }, networkOpts, txOpts) => {
420
416
  const vaultContractAddress = networkOpts.network === "localnet" ? networkOpts.vaultContractAddress : getVaultManagerContractAddress(networkOpts.network);
421
417
  const vault = Vault__factory.connect(vaultContractAddress, networkOpts.signer);
422
- const transaction = await vault.xSwapNative(chainContractIds[destChain], destAddress, assetContractIds[destAsset], [], {
418
+ const transaction = await vault.xSwapNative(chainContractIds[destChain], destAddress, assetContractIds[destAsset], "", {
423
419
  value: amount,
424
420
  ...extractOverrides(txOpts)
425
421
  });
@@ -432,13 +428,13 @@ var swapToken = /* @__PURE__ */ __name(async (params, networkOpts, txOpts) => {
432
428
  const { isAllowable } = await checkAllowance(params.amount, vaultContractAddress, erc20Address, networkOpts.signer);
433
429
  assert(isAllowable, "Swap amount exceeds allowance");
434
430
  const vault = Vault__factory.connect(vaultContractAddress, networkOpts.signer);
435
- const transaction = await vault.xSwapToken(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], erc20Address, params.amount, [], extractOverrides(txOpts));
431
+ const transaction = await vault.xSwapToken(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], erc20Address, params.amount, "", extractOverrides(txOpts));
436
432
  return transaction.wait(txOpts.wait);
437
433
  }, "swapToken");
438
434
  var callNative = /* @__PURE__ */ __name(async (params, networkOpts, txOpts) => {
439
435
  const vaultContractAddress = networkOpts.network === "localnet" ? networkOpts.vaultContractAddress : getVaultManagerContractAddress(networkOpts.network);
440
436
  const vault = Vault__factory.connect(vaultContractAddress, networkOpts.signer);
441
- const transaction = await vault.xCallNative(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], params.ccmMetadata.message, params.ccmMetadata.gasBudget, [], {
437
+ const transaction = await vault.xCallNative(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], params.ccmMetadata.message, params.ccmMetadata.gasBudget, "", {
442
438
  value: params.amount,
443
439
  ...extractOverrides(txOpts)
444
440
  });
@@ -451,7 +447,7 @@ var callToken = /* @__PURE__ */ __name(async (params, networkOpts, txOpts) => {
451
447
  const { isAllowable } = await checkAllowance(params.amount, vaultContractAddress, erc20Address, networkOpts.signer);
452
448
  assert(isAllowable, "Swap amount exceeds allowance");
453
449
  const vault = Vault__factory.connect(vaultContractAddress, networkOpts.signer);
454
- const transaction = await vault.xCallToken(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], params.ccmMetadata.message, params.ccmMetadata.gasBudget, erc20Address, params.amount, [], extractOverrides(txOpts));
450
+ const transaction = await vault.xCallToken(chainContractIds[params.destChain], params.destAddress, assetContractIds[params.destAsset], params.ccmMetadata.message, params.ccmMetadata.gasBudget, erc20Address, params.amount, "", extractOverrides(txOpts));
455
451
  return transaction.wait(txOpts.wait);
456
452
  }, "callToken");
457
453
  var executeSwap = /* @__PURE__ */ __name(async (params, networkOpts, txOpts) => {
@@ -687,7 +683,7 @@ var _SwapSDK = class _SwapSDK {
687
683
  network: this.network,
688
684
  signer: this.signer
689
685
  }, txOpts);
690
- return receipt.transactionHash;
686
+ return receipt.hash;
691
687
  }
692
688
  async approveVault(params, txOpts = {}) {
693
689
  if (!("srcAsset" in params))
@@ -697,7 +693,7 @@ var _SwapSDK = class _SwapSDK {
697
693
  signer: this.signer,
698
694
  network: this.network
699
695
  }, txOpts);
700
- return receipt && receipt.transactionHash;
696
+ return receipt && receipt.hash;
701
697
  }
702
698
  };
703
699
  __name(_SwapSDK, "SwapSDK");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainflip/sdk",
3
- "version": "0.1.21",
3
+ "version": "0.2.0",
4
4
  "description": "",
5
5
  "exports": {
6
6
  "./swap": {
@@ -44,7 +44,7 @@
44
44
  "@polkadot/util": "^12.4.2",
45
45
  "@polkadot/util-crypto": "^12.4.2",
46
46
  "axios": "^1.5.0",
47
- "ethers": "5.7.2",
47
+ "ethers": "6.7.1",
48
48
  "zod": "^3.22.2"
49
49
  },
50
50
  "devDependencies": {