@chainflip/sdk 1.7.0 → 1.8.0-beta.1

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.
package/dist/funding.js CHANGED
@@ -3,10 +3,7 @@
3
3
  var ethers = require('ethers');
4
4
  var rpc = require('@chainflip/rpc');
5
5
 
6
- var __defProp = Object.defineProperty;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
+ // ../shared/src/abis/factories/ERC20__factory.ts
10
7
  var _abi = [
11
8
  {
12
9
  inputs: [
@@ -76,7 +73,7 @@ var _abi = [
76
73
  type: "function"
77
74
  }
78
75
  ];
79
- var _ERC20__factory = class _ERC20__factory {
76
+ var ERC20__factory = class {
80
77
  static createInterface() {
81
78
  return new ethers.Interface(_abi);
82
79
  }
@@ -84,9 +81,7 @@ var _ERC20__factory = class _ERC20__factory {
84
81
  return new ethers.Contract(address, _abi, runner);
85
82
  }
86
83
  };
87
- __name(_ERC20__factory, "ERC20__factory");
88
- __publicField(_ERC20__factory, "abi", _abi);
89
- var ERC20__factory = _ERC20__factory;
84
+ ERC20__factory.abi = _abi;
90
85
  var _abi2 = [
91
86
  {
92
87
  inputs: [
@@ -747,7 +742,7 @@ var _abi2 = [
747
742
  type: "function"
748
743
  }
749
744
  ];
750
- var _StateChainGateway__factory = class _StateChainGateway__factory {
745
+ var StateChainGateway__factory = class {
751
746
  static createInterface() {
752
747
  return new ethers.Interface(_abi2);
753
748
  }
@@ -755,16 +750,11 @@ var _StateChainGateway__factory = class _StateChainGateway__factory {
755
750
  return new ethers.Contract(address, _abi2, runner);
756
751
  }
757
752
  };
758
- __name(_StateChainGateway__factory, "StateChainGateway__factory");
759
- __publicField(_StateChainGateway__factory, "abi", _abi2);
760
- var StateChainGateway__factory = _StateChainGateway__factory;
753
+ StateChainGateway__factory.abi = _abi2;
761
754
 
762
755
  // ../shared/src/enums.ts
763
- var arrayToMap = /* @__PURE__ */ __name((array) => Object.fromEntries(array.map((key) => [
764
- key,
765
- key
766
- ])), "arrayToMap");
767
- var InternalAssets = arrayToMap([
756
+ var arrayToMap = (array) => Object.fromEntries(array.map((key) => [key, key]));
757
+ arrayToMap([
768
758
  "Flip",
769
759
  "Usdc",
770
760
  "Dot",
@@ -776,115 +766,9 @@ var InternalAssets = arrayToMap([
776
766
  "Sol",
777
767
  "SolUsdc"
778
768
  ]);
779
- var Chains = arrayToMap([
780
- "Bitcoin",
781
- "Ethereum",
782
- "Polkadot",
783
- "Arbitrum",
784
- "Solana"
785
- ]);
786
- var Assets = arrayToMap([
787
- "FLIP",
788
- "USDC",
789
- "DOT",
790
- "ETH",
791
- "BTC",
792
- "USDT",
793
- "SOL"
794
- ]);
795
- var ChainflipNetworks = arrayToMap([
796
- "backspin",
797
- "sisyphos",
798
- "perseverance",
799
- "mainnet"
800
- ]);
801
- var chainConstants = {
802
- [Chains.Ethereum]: {
803
- assets: [
804
- Assets.ETH,
805
- Assets.FLIP,
806
- Assets.USDC,
807
- Assets.USDT
808
- ],
809
- gasAsset: InternalAssets.Eth,
810
- contractId: 1,
811
- blockTimeSeconds: 12
812
- },
813
- [Chains.Polkadot]: {
814
- assets: [
815
- Assets.DOT
816
- ],
817
- gasAsset: InternalAssets.Dot,
818
- contractId: 2,
819
- blockTimeSeconds: 6
820
- },
821
- [Chains.Bitcoin]: {
822
- assets: [
823
- Assets.BTC
824
- ],
825
- gasAsset: InternalAssets.Btc,
826
- contractId: 3,
827
- blockTimeSeconds: 10 * 60
828
- },
829
- [Chains.Arbitrum]: {
830
- assets: [
831
- Assets.ETH,
832
- Assets.USDC
833
- ],
834
- gasAsset: InternalAssets.ArbEth,
835
- contractId: 4,
836
- blockTimeSeconds: 0.26
837
- },
838
- [Chains.Solana]: {
839
- assets: [
840
- Assets.SOL,
841
- Assets.USDC
842
- ],
843
- gasAsset: InternalAssets.Sol,
844
- contractId: 5,
845
- blockTimeSeconds: (400 + 800) / 2 / 1e3
846
- }
847
- };
848
- function isValidAssetAndChain(assetAndChain) {
849
- const { asset, chain } = assetAndChain;
850
- if (!(chain in Chains)) return false;
851
- const validAssets = chainConstants[chain].assets;
852
- return validAssets.includes(asset);
853
- }
854
- __name(isValidAssetAndChain, "isValidAssetAndChain");
855
- function getInternalAsset(asset, assert2 = true) {
856
- if (!isValidAssetAndChain(asset)) {
857
- if (assert2) {
858
- throw new Error(`invalid asset and chain combination: ${JSON.stringify(asset)}`);
859
- }
860
- return null;
861
- }
862
- const map = {
863
- [Chains.Ethereum]: {
864
- [Assets.USDC]: InternalAssets.Usdc,
865
- [Assets.FLIP]: InternalAssets.Flip,
866
- [Assets.ETH]: InternalAssets.Eth,
867
- [Assets.USDT]: InternalAssets.Usdt
868
- },
869
- [Chains.Bitcoin]: {
870
- [Assets.BTC]: InternalAssets.Btc
871
- },
872
- [Chains.Polkadot]: {
873
- [Assets.DOT]: InternalAssets.Dot
874
- },
875
- [Chains.Arbitrum]: {
876
- [Assets.USDC]: InternalAssets.ArbUsdc,
877
- [Assets.ETH]: InternalAssets.ArbEth
878
- },
879
- [Chains.Solana]: {
880
- [Assets.SOL]: InternalAssets.Sol,
881
- [Assets.USDC]: InternalAssets.SolUsdc
882
- }
883
- };
884
- const chain = map[asset.chain];
885
- return chain[asset.asset];
886
- }
887
- __name(getInternalAsset, "getInternalAsset");
769
+ arrayToMap(["Bitcoin", "Ethereum", "Polkadot", "Arbitrum", "Solana"]);
770
+ arrayToMap(["FLIP", "USDC", "DOT", "ETH", "BTC", "USDT", "SOL"]);
771
+ var ChainflipNetworks = arrayToMap(["backspin", "sisyphos", "perseverance", "mainnet"]);
888
772
  var SEPOLIA_USDC_CONTRACT_ADDRESS = "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238";
889
773
  var SEPOLIA_USDT_CONTRACT_ADDRESS = "0x27CEA6Eb8a21Aae05Eb29C91c5CA10592892F584";
890
774
  var ADDRESSES = {
@@ -893,20 +777,15 @@ var ADDRESSES = {
893
777
  USDC_CONTRACT_ADDRESS: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
894
778
  USDT_CONTRACT_ADDRESS: "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
895
779
  ARBUSDC_CONTRACT_ADDRESS: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
896
- VAULT_CONTRACT_ADDRESS: "0xB7A5bd0345EF1Cc5E66bf61BdeC17D2461fBd968",
897
780
  STATE_CHAIN_GATEWAY_ADDRESS: "0xeEBe00Ac0756308ac4AaBfD76c05c4F3088B8883",
898
- ARB_VAULT_CONTRACT_ADDRESS: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
899
- // TODO(solana)
900
- SOLUSDC_CONTRACT_ADDRESS: ""
781
+ SOLUSDC_CONTRACT_ADDRESS: "24PNhTaNtomHhoy3fTRaMhAFCRj4uHqhZEEoWrKDbR5p"
901
782
  },
902
783
  [ChainflipNetworks.sisyphos]: {
903
784
  FLIP_CONTRACT_ADDRESS: "0xcD079EAB6B5443b545788Fd210C8800FEADd87fa",
904
785
  USDC_CONTRACT_ADDRESS: SEPOLIA_USDC_CONTRACT_ADDRESS,
905
786
  USDT_CONTRACT_ADDRESS: SEPOLIA_USDT_CONTRACT_ADDRESS,
906
787
  ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
907
- VAULT_CONTRACT_ADDRESS: "0xa94d6b1853F3cb611Ed3cCb701b4fdA5a9DACe85",
908
788
  STATE_CHAIN_GATEWAY_ADDRESS: "0x1F7fE41C798cc7b1D34BdC8de2dDDA4a4bE744D9",
909
- ARB_VAULT_CONTRACT_ADDRESS: "0x8155BdD48CD011e1118b51A1C82be020A3E5c2f2",
910
789
  SOLUSDC_CONTRACT_ADDRESS: "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"
911
790
  },
912
791
  [ChainflipNetworks.perseverance]: {
@@ -914,9 +793,7 @@ var ADDRESSES = {
914
793
  USDC_CONTRACT_ADDRESS: SEPOLIA_USDC_CONTRACT_ADDRESS,
915
794
  USDT_CONTRACT_ADDRESS: SEPOLIA_USDT_CONTRACT_ADDRESS,
916
795
  ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
917
- VAULT_CONTRACT_ADDRESS: "0x36eaD71325604DC15d35FAE584D7b50646D81753",
918
796
  STATE_CHAIN_GATEWAY_ADDRESS: "0xA34a967197Ee90BB7fb28e928388a573c5CFd099",
919
- ARB_VAULT_CONTRACT_ADDRESS: "0x2bb150e6d4366A1BDBC4275D1F35892CD63F27e3",
920
797
  SOLUSDC_CONTRACT_ADDRESS: "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"
921
798
  },
922
799
  [ChainflipNetworks.mainnet]: {
@@ -924,90 +801,59 @@ var ADDRESSES = {
924
801
  USDC_CONTRACT_ADDRESS: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
925
802
  USDT_CONTRACT_ADDRESS: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
926
803
  ARBUSDC_CONTRACT_ADDRESS: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
927
- VAULT_CONTRACT_ADDRESS: "0xF5e10380213880111522dd0efD3dbb45b9f62Bcc",
928
804
  STATE_CHAIN_GATEWAY_ADDRESS: "0x6995Ab7c4D7F4B03f467Cf4c8E920427d9621DBd",
929
- ARB_VAULT_CONTRACT_ADDRESS: "0x79001a5e762f3bEFC8e5871b42F6734e00498920",
930
805
  SOLUSDC_CONTRACT_ADDRESS: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
931
806
  }
932
807
  };
933
808
 
934
809
  // ../shared/src/contracts.ts
935
- var extractOverrides = /* @__PURE__ */ __name((transactionOverrides) => {
810
+ var extractOverrides = (transactionOverrides) => {
936
811
  const { wait, ...ethersOverrides } = transactionOverrides;
937
812
  return ethersOverrides;
938
- }, "extractOverrides");
939
- function getTokenContractAddress(asset, network) {
940
- if (asset === InternalAssets.Flip) return ADDRESSES[network].FLIP_CONTRACT_ADDRESS;
941
- if (asset === InternalAssets.Usdc) return ADDRESSES[network].USDC_CONTRACT_ADDRESS;
942
- if (asset === InternalAssets.Usdt) return ADDRESSES[network].USDT_CONTRACT_ADDRESS;
943
- if (asset === InternalAssets.ArbUsdc) return ADDRESSES[network].ARBUSDC_CONTRACT_ADDRESS;
944
- if (asset === InternalAssets.SolUsdc) return ADDRESSES[network].SOLUSDC_CONTRACT_ADDRESS;
945
- throw new Error(`No contract address for ${asset} on ${network}`);
946
- }
947
- __name(getTokenContractAddress, "getTokenContractAddress");
948
- var getStateChainGatewayContractAddress = /* @__PURE__ */ __name((network) => ADDRESSES[network].STATE_CHAIN_GATEWAY_ADDRESS, "getStateChainGatewayContractAddress");
949
- var checkAllowance = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20Address, signer) => {
813
+ };
814
+ var getFlipContractAddress = (network) => ADDRESSES[network].FLIP_CONTRACT_ADDRESS;
815
+ var getStateChainGatewayContractAddress = (network) => ADDRESSES[network].STATE_CHAIN_GATEWAY_ADDRESS;
816
+ var checkAllowance = async (amount, spenderAddress, erc20Address, signer) => {
950
817
  const erc20 = ERC20__factory.connect(erc20Address, signer);
951
818
  const signerAddress = await signer.getAddress();
952
819
  const allowance = await erc20.allowance(signerAddress, spenderAddress);
953
- return {
954
- allowance,
955
- hasSufficientAllowance: allowance >= amount,
956
- erc20
957
- };
958
- }, "checkAllowance");
959
- var approve = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20, allowance, txOpts) => {
820
+ return { allowance, hasSufficientAllowance: allowance >= amount, erc20 };
821
+ };
822
+ var approve = async (amount, spenderAddress, erc20, allowance, txOpts) => {
960
823
  if (allowance >= amount) return null;
961
- const transaction = await erc20.approve(spenderAddress, amount - allowance, extractOverrides(txOpts));
824
+ const transaction = await erc20.approve(
825
+ spenderAddress,
826
+ amount - allowance,
827
+ extractOverrides(txOpts)
828
+ );
962
829
  await transaction.wait(txOpts.wait);
963
830
  return transaction;
964
- }, "approve");
965
- var getFlipBalance = /* @__PURE__ */ __name(async (network, signer) => {
966
- const flipAddress = getTokenContractAddress(InternalAssets.Flip, network);
831
+ };
832
+ var getFlipBalance = async (network, signer) => {
833
+ const flipAddress = getFlipContractAddress(network);
967
834
  const flip = ERC20__factory.connect(flipAddress, signer);
968
835
  return flip.balanceOf(await signer.getAddress());
969
- }, "getFlipBalance");
970
- var camelCase = /* @__PURE__ */ __name((str) => str.replace(/_([a-z])/g, (_, char) => char.toUpperCase()), "camelCase");
971
- var camelCaseKeys = /* @__PURE__ */ __name((obj) => {
836
+ };
837
+ var camelCase = (str) => str.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
838
+ var camelCaseKeys = (obj) => {
972
839
  if (typeof obj !== "object" || obj === null) return obj;
973
840
  if (Array.isArray(obj)) return obj.map((item) => camelCaseKeys(item));
974
- return Object.fromEntries(Object.entries(obj).map(([key, value]) => [
975
- camelCase(key),
976
- camelCaseKeys(value)
977
- ]));
978
- }, "camelCaseKeys");
979
- var createRequest = /* @__PURE__ */ __name((method) => async (urlOrNetwork, ...params) => {
841
+ return Object.fromEntries(
842
+ Object.entries(obj).map(([key, value]) => [camelCase(key), camelCaseKeys(value)])
843
+ );
844
+ };
845
+ var createRequest = (method) => async (urlOrNetwork, ...params) => {
980
846
  const url = "network" in urlOrNetwork ? rpc.constants.PUBLIC_RPC_ENDPOINTS[urlOrNetwork.network] : urlOrNetwork.rpcUrl;
981
847
  const result = await new rpc.HttpClient(url).sendRequest(method, ...params);
982
848
  return camelCaseKeys(result);
983
- }, "createRequest");
984
- var transform = /* @__PURE__ */ __name((fn, cb) => (...args) => fn(...args).then(cb), "transform");
849
+ };
985
850
  var getFundingEnvironment = createRequest("cf_funding_environment");
986
- createRequest("cf_swapping_environment");
987
- createRequest("cf_ingress_egress_environment");
988
- createRequest("cf_environment");
989
- createRequest("cf_swap_rate");
990
- createRequest("state_getMetadata");
991
- createRequest("cf_supported_assets");
992
- createRequest("state_getRuntimeVersion");
993
- createRequest("chain_getBlockHash");
994
- createRequest("cf_pool_depth");
995
- createRequest("cf_accounts");
996
- createRequest("cf_account_info");
997
- transform(createRequest("cf_boost_pools_depth"), (result) => result.map(({ chain, asset, ...rest }) => ({
998
- asset: getInternalAsset({
999
- chain,
1000
- asset
1001
- }),
1002
- ...rest
1003
- })));
1004
- createRequest("cf_swap_rate_v2");
1005
851
 
1006
852
  // ../shared/src/stateChainGateway/utils.ts
1007
- var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
853
+ var getStateChainGateway = (networkOpts) => {
1008
854
  const stateChainGatewayContractAddress = networkOpts.network === "localnet" ? networkOpts.stateChainGatewayContractAddress : getStateChainGatewayContractAddress(networkOpts.network);
1009
855
  return StateChainGateway__factory.connect(stateChainGatewayContractAddress, networkOpts.signer);
1010
- }, "getStateChainGateway");
856
+ };
1011
857
 
1012
858
  // ../shared/src/guards.ts
1013
859
  function assert(condition, message, Constructor = Error) {
@@ -1018,79 +864,91 @@ function assert(condition, message, Constructor = Error) {
1018
864
  }
1019
865
  throw error;
1020
866
  }
1021
- __name(assert, "assert");
1022
867
 
1023
868
  // ../shared/src/stateChainGateway/approval.ts
1024
- var checkStateChainGatewayAllowance = /* @__PURE__ */ __name(async (amount, networkOpts) => {
1025
- const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getTokenContractAddress(InternalAssets.Flip, networkOpts.network);
869
+ var checkStateChainGatewayAllowance = async (amount, networkOpts) => {
870
+ const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getFlipContractAddress(networkOpts.network);
1026
871
  const stateChainGatewayContractAddress = networkOpts.network === "localnet" ? networkOpts.stateChainGatewayContractAddress : getStateChainGatewayContractAddress(networkOpts.network);
1027
- return checkAllowance(amount, stateChainGatewayContractAddress, flipContractAddress, networkOpts.signer);
1028
- }, "checkStateChainGatewayAllowance");
1029
- var approveStateChainGateway = /* @__PURE__ */ __name(async (amount, networkOpts, txOpts) => {
1030
- const { allowance, erc20, hasSufficientAllowance } = await checkStateChainGatewayAllowance(amount, networkOpts);
872
+ return checkAllowance(
873
+ amount,
874
+ stateChainGatewayContractAddress,
875
+ flipContractAddress,
876
+ networkOpts.signer
877
+ );
878
+ };
879
+ var approveStateChainGateway = async (amount, networkOpts, txOpts) => {
880
+ const { allowance, erc20, hasSufficientAllowance } = await checkStateChainGatewayAllowance(
881
+ amount,
882
+ networkOpts
883
+ );
1031
884
  if (hasSufficientAllowance) return null;
1032
885
  const stateChainGatewayContractAddress = networkOpts.network === "localnet" ? networkOpts.stateChainGatewayContractAddress : getStateChainGatewayContractAddress(networkOpts.network);
1033
886
  return approve(amount, stateChainGatewayContractAddress, erc20, allowance, txOpts);
1034
- }, "approveStateChainGateway");
887
+ };
1035
888
 
1036
889
  // ../shared/src/stateChainGateway/index.ts
1037
- var fundStateChainAccount = /* @__PURE__ */ __name(async (accountId, amount, networkOpts, txOpts) => {
1038
- const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getTokenContractAddress(InternalAssets.Flip, networkOpts.network);
890
+ var fundStateChainAccount = async (accountId, amount, networkOpts, txOpts) => {
891
+ const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getFlipContractAddress(networkOpts.network);
1039
892
  const stateChainGateway = getStateChainGateway(networkOpts);
1040
- const { hasSufficientAllowance } = await checkAllowance(amount, await stateChainGateway.getAddress(), flipContractAddress, networkOpts.signer);
893
+ const { hasSufficientAllowance } = await checkAllowance(
894
+ amount,
895
+ await stateChainGateway.getAddress(),
896
+ flipContractAddress,
897
+ networkOpts.signer
898
+ );
1041
899
  assert(hasSufficientAllowance, "Insufficient allowance");
1042
- const transaction = await stateChainGateway.fundStateChainAccount(accountId, amount, extractOverrides(txOpts));
900
+ const transaction = await stateChainGateway.fundStateChainAccount(
901
+ accountId,
902
+ amount,
903
+ extractOverrides(txOpts)
904
+ );
1043
905
  await transaction.wait(txOpts.wait);
1044
906
  return transaction;
1045
- }, "fundStateChainAccount");
1046
- var executeRedemption = /* @__PURE__ */ __name(async (accountId, networkOpts, txOpts) => {
907
+ };
908
+ var executeRedemption = async (accountId, networkOpts, txOpts) => {
1047
909
  const stateChainGateway = getStateChainGateway(networkOpts);
1048
- const transaction = await stateChainGateway.executeRedemption(accountId, extractOverrides(txOpts));
910
+ const transaction = await stateChainGateway.executeRedemption(
911
+ accountId,
912
+ extractOverrides(txOpts)
913
+ );
1049
914
  await transaction.wait(txOpts.wait);
1050
915
  return transaction;
1051
- }, "executeRedemption");
1052
- var getMinimumFunding = /* @__PURE__ */ __name((networkOpts) => {
916
+ };
917
+ var getMinimumFunding = (networkOpts) => {
1053
918
  const stateChainGateway = getStateChainGateway(networkOpts);
1054
919
  return stateChainGateway.getMinimumFunding();
1055
- }, "getMinimumFunding");
1056
- var getRedemptionDelay = /* @__PURE__ */ __name((networkOpts) => {
920
+ };
921
+ var getRedemptionDelay = (networkOpts) => {
1057
922
  const stateChainGateway = getStateChainGateway(networkOpts);
1058
923
  return stateChainGateway.REDEMPTION_DELAY();
1059
- }, "getRedemptionDelay");
1060
- var getPendingRedemption = /* @__PURE__ */ __name(async (accountId, networkOpts) => {
924
+ };
925
+ var getPendingRedemption = async (accountId, networkOpts) => {
1061
926
  const stateChainGateway = getStateChainGateway(networkOpts);
1062
927
  const pendingRedemption = await stateChainGateway.getPendingRedemption(accountId);
1063
928
  return pendingRedemption.amount !== 0n ? stateChainGateway.getPendingRedemption(accountId) : void 0;
1064
- }, "getPendingRedemption");
929
+ };
1065
930
 
1066
931
  // src/funding/sdk.ts
1067
- var _FundingSDK = class _FundingSDK {
932
+ var FundingSDK = class {
1068
933
  constructor(options) {
1069
- __publicField(this, "options");
1070
- __publicField(this, "rpcConfig");
1071
- __publicField(this, "redemptionTax");
1072
934
  const network = options.network ?? ChainflipNetworks.perseverance;
1073
935
  this.options = {
1074
936
  ...options,
1075
937
  network
1076
938
  };
1077
- this.rpcConfig = options.rpcUrl ? {
1078
- rpcUrl: options.rpcUrl
1079
- } : {
1080
- network
1081
- };
939
+ this.rpcConfig = options.rpcUrl ? { rpcUrl: options.rpcUrl } : { network };
1082
940
  }
1083
941
  /**
1084
- * @param accountId the hex-encoded validator account id
1085
- * @param amount the amount to fund in base units of FLIP
1086
- */
942
+ * @param accountId the hex-encoded validator account id
943
+ * @param amount the amount to fund in base units of FLIP
944
+ */
1087
945
  async fundStateChainAccount(accountId, amount, txOpts = {}) {
1088
946
  const tx = await fundStateChainAccount(accountId, amount, this.options, txOpts);
1089
947
  return tx.hash;
1090
948
  }
1091
949
  /**
1092
- * @param accountId the hex-encoded validator account id
1093
- */
950
+ * @param accountId the hex-encoded validator account id
951
+ */
1094
952
  async executeRedemption(accountId, txOpts = {}) {
1095
953
  const tx = await executeRedemption(accountId, this.options, txOpts);
1096
954
  return tx.hash;
@@ -1108,9 +966,9 @@ var _FundingSDK = class _FundingSDK {
1108
966
  return getPendingRedemption(accountId, this.options);
1109
967
  }
1110
968
  /**
1111
- * @param the amount of FLIP to request approval for
1112
- * @returns the transaction hash or null if no approval was required
1113
- */
969
+ * @param the amount of FLIP to request approval for
970
+ * @returns the transaction hash or null if no approval was required
971
+ */
1114
972
  async approveStateChainGateway(amount, txOpts = {}) {
1115
973
  const tx = await approveStateChainGateway(amount, this.options, txOpts);
1116
974
  return tx ? tx.hash : null;
@@ -1120,7 +978,5 @@ var _FundingSDK = class _FundingSDK {
1120
978
  return this.redemptionTax;
1121
979
  }
1122
980
  };
1123
- __name(_FundingSDK, "FundingSDK");
1124
- var FundingSDK = _FundingSDK;
1125
981
 
1126
982
  exports.FundingSDK = FundingSDK;