@moonbeam-network/xcm-sdk 1.0.0-dev.145 → 1.0.0-dev.147

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/build/index.mjs CHANGED
@@ -1,2 +1,750 @@
1
- import{CallType as xt}from"@moonbeam-network/xcm-builder";import{AssetAmount as k}from"@moonbeam-network/xcm-types";import{convertDecimals as W,toBigInt as Dt,toDecimal as Et}from"@moonbeam-network/xcm-utils";import tt from"big.js";import{Contract as pt}from"ethers";import{createPublicClient as gt,getContract as yt,http as ht}from"viem";function B(n){return"provider"in n}function C(n){return!("abi"in n)}var A=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}];var T=class{address;#t;#e;constructor(t,e){if(!t.address)throw new Error("Contract address is required");this.address=t.address,this.#t=t,this.#e=B(e)?new pt(this.address,A,e):yt({abi:A,address:this.address,client:{public:gt({chain:e.chain,transport:ht()}),wallet:e}})}async getBalance(){return C(this.#e)?(await this.#e.balanceOf(...this.#t.args)).toBigInt():this.#e.read.balanceOf(this.#t.args)}async getDecimals(){return C(this.#e)?await this.#e.decimals():this.#e.read.decimals()}};import{Contract as At}from"ethers";import{createPublicClient as J,getContract as bt,http as U}from"viem";var O=[{inputs:[{internalType:"address",name:"currencyAddress",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{components:[{internalType:"uint8",name:"parents",type:"uint8"},{internalType:"bytes[]",name:"interior",type:"bytes[]"}],internalType:"struct Xtokens.Multilocation",name:"destination",type:"tuple"},{internalType:"uint64",name:"weight",type:"uint64"}],name:"transfer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"currencyAddress",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct Xtokens.Currency[]",name:"currencies",type:"tuple[]"},{internalType:"uint32",name:"feeItem",type:"uint32"},{components:[{internalType:"uint8",name:"parents",type:"uint8"},{internalType:"bytes[]",name:"interior",type:"bytes[]"}],internalType:"struct Xtokens.Multilocation",name:"destination",type:"tuple"},{internalType:"uint64",name:"weight",type:"uint64"}],name:"transferMultiCurrencies",outputs:[],stateMutability:"nonpayable",type:"function"}];var x=class{defaultMoonChainAddress="0x0000000000000000000000000000000000000804";address;#t;#e;#a;constructor(t,e,a){this.#t=t,this.#a=e,this.address=a??this.defaultMoonChainAddress,this.#e=B(e)?new At(this.address,O,e):bt({abi:O,address:this.address,client:{public:J({chain:e.chain,transport:U()}),wallet:e}})}async transfer(){return C(this.#e)?this.#e[this.#t.func](...this.#t.args):this.#e.write[this.#t.func](this.#t.args)}async getEthersContractEstimatedGas(t){return t[this.#t.func].estimateGas(...this.#t.args)}async getViemContractEstimatedGas(t){return t?t.estimateGas[this.#t.func](this.#t.args):0n}async getFee(t){if(t===0n)return 0n;try{let e=C(this.#e)?await this.getEthersContractEstimatedGas(this.#e):await this.getViemContractEstimatedGas(this.#e),a=await this.getGasPrice();return e*a}catch(e){throw console.error(e),new Error("Can't get a fee. Make sure that you have enough balance!")}}async getGasPrice(){if(B(this.#a)){if(!this.#a.provider)return 0n;let{gasPrice:e,maxPriorityFeePerGas:a}=await this.#a.provider.getFeeData();return(e||0n)+(a||0n)}return J({chain:this.#a.chain,transport:U()}).getGasPrice()}};import{createPublicClient as Pt,http as St}from"viem";var F=class{address;#t;#e;constructor(t,e){if(!t.address)throw new Error("Contract address is required");this.address=t.address,this.#t=t,this.#e=Pt({chain:e,transport:St()})}async getBalance(){return await this.#e.readContract({abi:A,address:this.#t.address,args:this.#t.args,functionName:"balanceOf"})}async getDecimals(){return await this.#e.readContract({abi:A,address:this.#t.address,functionName:"decimals"})}};function wt(n,t,e){var a;if(n.module==="Erc20")return new T(n,t);if(n.module==="Xtokens"){if(e&&"contracts"in e){let s=(a=e==null?void 0:e.contracts)==null?void 0:a.Xtokens;return new x(n,t,s)}return new x(n,t)}throw new Error(`Contract ${n.module} not found`)}function b(n,t){if(n.module==="Erc20")return new F(n,t.getViemChain());throw new Error(`Public Contract ${n.module} not found`)}function M(n,t,e){return t?wt(n,t,e):b(n,e)}import{CallType as Y}from"@moonbeam-network/xcm-builder";import{convertDecimals as vt,toBigInt as Bt}from"@moonbeam-network/xcm-utils";async function y({address:n,chain:t,balanceBuilder:e,asset:a,decimals:s,polkadot:o}){let i=e.build({address:n,asset:o.chain.getBalanceAssetId(a)});if(i.type===Y.Substrate){let r=await o.query(i);return t.usesChainDecimals?vt(r,o.decimals,s):r}return await b(i,t).getBalance()}async function h({address:n,asset:t,config:e,polkadot:a,chain:s,assetBuiltConfig:o}){let i=o||e.balance.build({address:n,asset:a.chain.getBalanceAssetId(t||e.asset)});return i.type===Y.Substrate?a.getAssetDecimals(t||e.asset):b(i,s).getDecimals()}async function G(n,t){if(n.min)return t.query(n.min.build({asset:t.chain.getMinAssetId(n.asset)}));let e=t.chain.getAssetMin(n.asset);if(e){let a=await t.getAssetDecimals(n.asset);return Bt(e,a)}return 0n}function Z({amount:n,source:t,destination:e}){if(!e.chain.checkSovereignAccountBalances||!e.sovereignAccountBalances)return;let{feeAssetBalance:a,transferAssetBalance:s}=e.sovereignAccountBalances;if(n>s)throw new Error(`${t.chain.name} Sovereign account in ${e.chain.name} does not have enough balance for this transaction`);if(a&&t.destinationFee.amount>a)throw new Error(`${t.chain.name} Sovereign account in ${e.chain.name} does not have enough balance to pay for fees for this transaction`)}async function at({transferConfig:n,destinationAddress:t,destinationFee:e,polkadot:a,sourceAddress:s,evmSigner:o}){var _,V,z,K,j,L,H;let{asset:i,destination:m,source:{chain:c,config:r}}=n,u=k.fromAsset(i,{amount:0n,decimals:await h({address:t,chain:c,config:r,polkadot:a})}),f=a.chain.getBalanceAssetId(((_=r==null?void 0:r.fee)==null?void 0:_.asset)||r.asset),p=(V=r.fee)==null?void 0:V.balance.build({address:t,asset:f}),d=(z=r.fee)!=null&&z.asset?await h({address:t,asset:r.fee.asset,assetBuiltConfig:p,chain:c,config:r,polkadot:a}):void 0,l=(K=r.fee)!=null&&K.asset?k.fromAsset(r.fee.asset,{amount:0n,decimals:d||0}):u,w=(j=r.destinationFee)!=null&&j.asset?k.fromAsset(r.destinationFee.asset,{amount:0n,decimals:await h({address:t,asset:r.destinationFee.asset,chain:c,config:r,polkadot:a})}):u,g=await y({address:s,asset:r.asset,balanceBuilder:r.balance,chain:c,decimals:u.decimals,polkadot:a}),D=await et({address:s,balance:g,chain:c,decimals:l.decimals,feeConfig:r.fee,polkadot:a}),E=r.asset.isEqual(r.destinationFee.asset)?g:await et({address:s,balance:g,chain:c,decimals:w.decimals,feeConfig:r.destinationFee,polkadot:a}),I=await G(r,a),v=(L=r.extrinsic)==null?void 0:L.build({address:t,amount:g,asset:c.getAssetId(i),destination:m.chain,fee:e.amount,feeAsset:c.getAssetId(e),palletInstance:c.getAssetPalletInstance(i),source:c}),mt=(H=r.contract)==null?void 0:H.build({address:t,amount:g,asset:c.getAssetId(i),destination:m.chain,fee:e.amount,feeAsset:c.getAssetId(e)}),q=w.copyWith({amount:E}),ut=await It({balance:g,chain:c,contract:mt,decimals:l.decimals,destinationFeeBalanceAmount:q,destinationFeeConfig:r.destinationFee,evmSigner:o,extrinsic:v,feeConfig:r.fee,polkadot:a,sourceAddress:s}),$=u.copyWith({amount:g}),{existentialDeposit:N}=a,Q=l.copyWith({amount:ut}),lt=l.copyWith({amount:D}),X=u.copyWith({amount:I}),ft=Gt({balanceAmount:$,existentialDeposit:N,feeAmount:Q,minAmount:X});return{balance:$,chain:c,destinationFee:e,destinationFeeBalance:q,existentialDeposit:N,fee:Q,feeBalance:lt,max:ft,min:X}}async function et({address:n,balance:t,chain:e,decimals:a,feeConfig:s,polkadot:o}){if(!s)return t;let i=s.balance.build({address:n,asset:o.chain.getBalanceAssetId(s.asset)});if(i.type===xt.Evm){let c=b(i,e),r=await c.getDecimals(),u=await c.getBalance();return e.usesChainDecimals?W(u,o.decimals,r):u}let m=await o.query(i);return e.usesChainDecimals?W(m,o.decimals,a):m}async function It({balance:n,chain:t,contract:e,decimals:a,destinationFeeConfig:s,destinationFeeBalanceAmount:o,evmSigner:i,extrinsic:m,feeConfig:c,polkadot:r,sourceAddress:u}){if(e){if(!i)throw new Error("EVM Signer must be provided");if(s&&o&&typeof s.amount=="number"){let f=Number(Et(o.amount,o.decimals));if(f&&s.amount>f)throw new Error(`Can't get a fee, make sure you have ${s==null?void 0:s.amount} ${s==null?void 0:s.asset.originSymbol} in your source balance, needed for destination fees`)}return Tt({balance:n,chain:t,config:e,decimals:a,evmSigner:i})}if(m){let f=await Ft(n,m,r,u),p=Mt(a,c),d=f+p;return t.usesChainDecimals?W(d,r.decimals,a):d}throw new Error("Either contract or extrinsic must be provided")}async function Tt({balance:n,config:t,decimals:e,evmSigner:a,chain:s}){let i=await M(t,a,s).getFee(n);return W(i,18,e)}async function Ft(n,t,e,a){try{return await e.getFee(a,t)}catch(s){if(n)throw s;return 0n}}function Mt(n,t){return t!=null&&t.xcmDeliveryFeeAmount?Dt(t.xcmDeliveryFeeAmount,n):0n}function Gt({balanceAmount:n,existentialDeposit:t,feeAmount:e,minAmount:a}){let s=n.toBig().minus(a.toBig()).minus(n.isSame(t)?t.toBig():tt(0)).minus(n.isSame(e)?e.toBig():tt(0));return n.copyWith({amount:s.lt(0)?0n:BigInt(s.toFixed())})}async function nt({address:n,chain:t,assets:e,polkadot:a}){let s=e.reduce((i,m)=>i.some(c=>c.asset.isEqual(m.asset))?i:[m,...i],[]);return await Promise.all(s.map(async i=>{let m=await h({address:n,asset:i.asset,chain:t,config:i,polkadot:a}),c=await y({address:n,asset:i.asset,balanceBuilder:i.balance,chain:t,decimals:m,polkadot:a});return k.fromAsset(i.asset,{amount:c,decimals:m})}))}import{ConfigBuilder as ot,ConfigService as ct}from"@moonbeam-network/xcm-config";import{convertDecimals as Nt,toBigInt as it}from"@moonbeam-network/xcm-utils";import S from"big.js";import"@polkadot/api-augment";import{AssetAmount as kt}from"@moonbeam-network/xcm-types";import{getPolkadotApi as Wt}from"@moonbeam-network/xcm-utils";var P=class n{api;chain;configService;constructor(t,e,a){this.api=t,this.chain=e,this.configService=a}static async create(t,e){return new n(await Wt(t.ws),t,e)}static async createMulti(t,e){return Promise.all(t.map(a=>n.create(a,e)))}get decimals(){return this.api.registry.chainDecimals.at(0)||12}get asset(){let t=this.api.registry.chainTokens.at(0),e=t==null?void 0:t.toString().toLowerCase();if(!e)throw new Error("No native symbol key found");let a=this.configService.getAsset(e);if(!a)throw new Error(`No asset found for key "${e}" and symbol "${t}"`);return a}get existentialDeposit(){var s,o;let t=(s=this.api.consts.balances)==null?void 0:s.existentialDeposit,e=(o=this.api.consts.eqBalances)==null?void 0:o.existentialDeposit,a=(t==null?void 0:t.toBigInt())||(e==null?void 0:e.toBigInt())||0n;return kt.fromAsset(this.asset,{amount:a,decimals:this.decimals})}async getAssetMeta(t){var i,m,c,r,u,f;let e=((i=this.api.query.assets)==null?void 0:i.metadata)||((m=this.api.query.assetRegistry)==null?void 0:m.assets)||((c=this.api.query.assetRegistry)==null?void 0:c.metadata)||((r=this.api.query.assetRegistry)==null?void 0:r.currencyMetadatas)||((u=this.api.query.assetRegistry)==null?void 0:u.assetMetadatas)||((f=this.api.query.assetRegistry)==null?void 0:f.assetMetadataMap);if(!e)return;let a=await e(t),s="unwrapOrDefault"in a?a.unwrapOrDefault():a;return{decimals:("unwrapOrDefault"in s.decimals?s.decimals.unwrapOrDefault():s.decimals).toNumber(),symbol:s.symbol.toString()}}async getAssetDecimalsFromQuery(t){var s;let e=(s=this.api.query.assetsRegistry)==null?void 0:s.assetDecimals;return e?(await e(t)).unwrapOrDefault().toNumber():void 0}async getAssetDecimals(t){var s;let e=this.chain.getMetadataAssetId(t),a=this.chain.getAssetDecimals(t)||await this.getAssetDecimalsFromQuery(e)||((s=await this.getAssetMeta(e))==null?void 0:s.decimals)||this.decimals;if(!a)throw new Error(`No decimals found for asset ${t.originSymbol}`);return a}async query(t){let e=await this.api.query[t.module][t.func](...t.args);return t.transform(e)}async getFee(t,e){let a=this.api.tx[e.module][e.func],s=e.getArgs(a);return(await a(...s).paymentInfo(t,{nonce:-1})).partialFee.toBigInt()}async transfer(t,e,a){let s=this.api.tx[e.module][e.func],o=e.getArgs(s);return(await s(...o).signAndSend(this.#t(a)?t:a,{nonce:-1,signer:this.#t(a)?a:void 0,withSignedTransaction:!0})).toString()}#t(t){return"signPayload"in t}};import{AssetAmount as st}from"@moonbeam-network/xcm-types";import{getSovereignAccountAddresses as Rt,toBigInt as Ot}from"@moonbeam-network/xcm-utils";async function rt({transferConfig:n,destinationAddress:t,polkadot:e}){let{asset:a,destination:{chain:s,config:o}}=n,i=st.fromAsset(a,{amount:0n,decimals:await h({address:t,chain:s,config:o,polkadot:e})}),m=await y({address:t,asset:o.asset,balanceBuilder:o.balance,chain:s,decimals:i.decimals,polkadot:e}),c=await G(o,e),r=i.copyWith({amount:m}),{existentialDeposit:u}=e,f=await qt({address:t,config:n,polkadot:e}),p=i.copyWith({amount:c});return{balance:r,chain:s,existentialDeposit:u,fee:f,min:p,sovereignAccountBalances:s.checkSovereignAccountBalances?await $t({decimals:i.decimals,polkadot:e,transferConfig:n}):void 0}}async function qt({address:n,config:t,polkadot:e}){let{amount:a,asset:s}=t.source.config.destinationFee,o=await e.getAssetDecimals(s),i=st.fromAsset(s,{amount:0n,decimals:o});if(Number.isFinite(a))return i.copyWith({amount:Ot(a,o)});let m=a.build({address:n,api:e.api,chain:e.chain,feeAsset:e.chain.getRegisteredAssetIdOrAddress(s),transferAsset:e.chain.getRegisteredAssetIdOrAddress(t.asset)});return i.copyWith({amount:await m.call()})}async function $t({transferConfig:n,decimals:t,polkadot:e}){var f;let{destination:{chain:a,config:s},source:{config:o}}=n,i=Rt(n.source.chain.parachainId),m=(f=o.destinationFee)==null?void 0:f.destinationBalance,c=a.isRelay?i.relay:i.generic,r=await y({address:c,asset:s.asset,balanceBuilder:s.balance,chain:a,decimals:t,polkadot:e});return{feeAssetBalance:m?await y({address:c,asset:o.destinationFee.asset,balanceBuilder:m,chain:a,decimals:t,polkadot:e}):void 0,transferAssetBalance:r}}async function R({configService:n,destinationAddress:t,evmSigner:e,polkadotSigner:a,sourceAddress:s,transferConfig:o}){let[i,m]=await P.createMulti([o.destination.chain,o.source.chain],n),c=await rt({destinationAddress:t,polkadot:i,transferConfig:o}),r=await Xt(m,c.fee),u=await at({destinationAddress:t,destinationFee:r,evmSigner:e,polkadot:m,sourceAddress:s,transferConfig:o});return{destination:c,getEstimate(f){let d=S(it(f,u.balance.decimals).toString()).minus(u.balance.isSame(r)?r.toBig():S(0));return u.balance.copyWith({amount:d.lt(0)?0n:BigInt(d.toFixed())})},isSwapPossible:!0,max:u.max,min:Qt(c),source:u,async swap(){return R({configService:n,destinationAddress:s,evmSigner:e,polkadotSigner:a,sourceAddress:t,transferConfig:{...o,destination:o.source,source:o.destination}})},async transfer(f){var E,I;let p=it(f,u.balance.decimals);Z({amount:p,destination:c,source:u});let{asset:d,source:{chain:l,config:w}}=o,g=(E=w.contract)==null?void 0:E.build({address:t,amount:p,asset:l.getAssetId(d),destination:c.chain,fee:r.amount,feeAsset:l.getAssetId(r)}),D=(I=w.extrinsic)==null?void 0:I.build({address:t,amount:p,asset:l.getAssetId(d),destination:c.chain,fee:r.amount,feeAsset:l.getAssetId(r),palletInstance:l.getAssetPalletInstance(d),source:l});if(g){if(!e)throw new Error("EVM Signer must be provided");return M(g,e,l).transfer().then(v=>typeof v=="object"?v.hash:v)}if(D){if(!a)throw new Error("Polkadot signer must be provided");return m.transfer(s,D,a)}throw new Error("Either contract or extrinsic must be provided")}}}function Qt({balance:n,existentialDeposit:t,fee:e,min:a}){let s=S(0).plus(n.isSame(e)?e.toBig():S(0)).plus(n.isSame(t)&&n.toBig().lt(t.toBig())?t.toBig():S(0)).plus(n.toBig().lt(a.toBig())?a.toBig():S(0));return n.copyWith({amount:BigInt(s.toFixed())})}async function Xt(n,t){let e=await n.getAssetDecimals(t);return t.decimals===e?t:t.copyWith({amount:Nt(t.amount,t.decimals,e),decimals:e})}function va(n){let t=(n==null?void 0:n.configService)??new ct;return{assets(e){let{assets:a,asset:s}=ot(t).assets(e);return{assets:a,asset(o){let{sourceChains:i,source:m}=s(o);return{sourceChains:i,source(c){let{destinationChains:r,destination:u}=m(c);return{destinationChains:r,destination(f){return{async accounts(p,d,l){return R({...n,configService:t,destinationAddress:d,evmSigner:(l==null?void 0:l.evmSigner)??(l==null?void 0:l.ethersSigner),sourceAddress:p,transferConfig:u(f).build(),polkadotSigner:l==null?void 0:l.polkadotSigner})}}}}}}}}},async getTransferData({destinationAddress:e,destinationKeyOrChain:a,ethersSigner:s,evmSigner:o,keyOrAsset:i,polkadotSigner:m,sourceAddress:c,sourceKeyOrChain:r}){return R({configService:t,destinationAddress:e,evmSigner:o??s,polkadotSigner:m,sourceAddress:c,transferConfig:ot(t).assets().asset(i).source(r).destination(a).build()})}}}async function Ba(n,t){let e=new ct,s=e.getChainConfig(n).getAssetsConfigs(),o=await P.create(n,e);return await nt({chain:n,assets:s,address:t,polkadot:o})}export{va as Sdk,nt as getAssetsBalances,y as getBalance,Tt as getContractFee,h as getDecimals,Ft as getExtrinsicFee,It as getFee,et as getFeeBalance,Gt as getMax,G as getMin,Ba as getParachainBalances,at as getSourceData,Z as validateSovereignAccountBalances};
1
+ // src/services/polkadot/PolkadotService.ts
2
+ import "@polkadot/api-augment";
3
+ import { AssetAmount } from "@moonbeam-network/xcm-types";
4
+ import { getPolkadotApi } from "@moonbeam-network/xcm-utils";
5
+ var PolkadotService = class _PolkadotService {
6
+ api;
7
+ chain;
8
+ constructor(api, chain) {
9
+ this.api = api;
10
+ this.chain = chain;
11
+ }
12
+ static async create(chain) {
13
+ return new _PolkadotService(await getPolkadotApi(chain.ws), chain);
14
+ }
15
+ static async createMulti(chains) {
16
+ return Promise.all(
17
+ chains.map((chain) => _PolkadotService.create(chain))
18
+ );
19
+ }
20
+ get decimals() {
21
+ return this.api.registry.chainDecimals.at(0) || 12;
22
+ }
23
+ get existentialDeposit() {
24
+ const existentialDeposit = this.api.consts.balances?.existentialDeposit;
25
+ const eqExistentialDeposit = this.api.consts.eqBalances?.existentialDeposit;
26
+ const amount = existentialDeposit?.toBigInt() || eqExistentialDeposit?.toBigInt() || 0n;
27
+ return AssetAmount.fromChainAsset(this.chain.nativeAsset, { amount });
28
+ }
29
+ async query(config) {
30
+ const response = await this.api.query[config.module][config.func](
31
+ ...config.args
32
+ );
33
+ return config.transform(response);
34
+ }
35
+ getExtrinsic(config) {
36
+ const fn = this.api.tx[config.module][config.func];
37
+ const args = config.getArgs(fn);
38
+ return fn(...args);
39
+ }
40
+ getExtrinsicCallHash(config) {
41
+ return this.getExtrinsic(config).method.toHex();
42
+ }
43
+ async getPaymentInfo(account, config) {
44
+ const extrinsic = this.getExtrinsic(config);
45
+ return extrinsic.paymentInfo(account, { nonce: -1 });
46
+ }
47
+ async getFee(account, config) {
48
+ const info = await this.getPaymentInfo(account, config);
49
+ return info.partialFee.toBigInt();
50
+ }
51
+ async transfer(account, config, signer) {
52
+ const extrinsic = this.getExtrinsic(config);
53
+ const hash = await extrinsic.signAndSend(
54
+ this.#isSigner(signer) ? account : signer,
55
+ {
56
+ nonce: -1,
57
+ signer: this.#isSigner(signer) ? signer : void 0,
58
+ withSignedTransaction: true
59
+ }
60
+ );
61
+ return hash.toString();
62
+ }
63
+ #isSigner(signer) {
64
+ return "signPayload" in signer;
65
+ }
66
+ };
67
+
68
+ // src/getTransferData/getTransferData.utils.ts
69
+ import {
70
+ ContractConfig,
71
+ EvmQueryConfig,
72
+ SubstrateQueryConfig
73
+ } from "@moonbeam-network/xcm-builder";
74
+ import {
75
+ AssetAmount as AssetAmount2,
76
+ EvmChain,
77
+ EvmParachain,
78
+ Parachain
79
+ } from "@moonbeam-network/xcm-types";
80
+ import { convertDecimals, toBigInt } from "@moonbeam-network/xcm-utils";
81
+ import Big from "big.js";
82
+
83
+ // src/services/evm/EvmService.ts
84
+ import {
85
+ http,
86
+ createPublicClient
87
+ } from "viem";
88
+ var EvmService = class _EvmService {
89
+ chain;
90
+ client;
91
+ static create(chain) {
92
+ return new _EvmService(chain);
93
+ }
94
+ constructor(chain) {
95
+ this.chain = chain;
96
+ this.client = createPublicClient({
97
+ chain: chain.getViemChain(),
98
+ transport: http()
99
+ });
100
+ }
101
+ async query(query) {
102
+ return this.client[query.func](...query.args);
103
+ }
104
+ async getFee(address, contract) {
105
+ const gas = await this.client.estimateContractGas({
106
+ abi: contract.abi,
107
+ account: address,
108
+ address: contract.address,
109
+ args: contract.args,
110
+ functionName: contract.func
111
+ });
112
+ const gasPrice = await this.client.getGasPrice();
113
+ return gas * gasPrice;
114
+ }
115
+ async getBalance(address, contract) {
116
+ const balance = await this.client.readContract({
117
+ abi: contract.abi,
118
+ address: contract.address,
119
+ args: [address],
120
+ functionName: "balanceOf"
121
+ });
122
+ if (typeof balance !== "bigint") {
123
+ throw new Error(
124
+ `Could not get balance on ${this.chain.name} for ${address} from contract ${contract.address}`
125
+ );
126
+ }
127
+ return balance;
128
+ }
129
+ async transfer(signer, contract) {
130
+ const { request } = await this.client.simulateContract({
131
+ abi: contract.abi,
132
+ account: signer.account,
133
+ address: contract.address,
134
+ args: contract.args,
135
+ functionName: contract.func
136
+ });
137
+ const hash = await signer.writeContract(request);
138
+ return hash;
139
+ }
140
+ };
141
+
142
+ // src/getTransferData/getTransferData.utils.ts
143
+ async function getBalance({
144
+ address,
145
+ asset,
146
+ builder,
147
+ chain
148
+ }) {
149
+ const config = builder.build({
150
+ address,
151
+ asset
152
+ });
153
+ const amount = AssetAmount2.fromChainAsset(asset, { amount: 0n });
154
+ if (SubstrateQueryConfig.is(config) && EvmParachain.isAnyParachain(chain)) {
155
+ const polkadot = await PolkadotService.create(chain);
156
+ const balance = await polkadot.query(config);
157
+ const converted = chain.usesChainDecimals ? convertDecimals(balance, polkadot.decimals, asset.decimals) : balance;
158
+ return amount.copyWith({ amount: converted });
159
+ }
160
+ if (EvmChain.is(chain) || EvmParachain.is(chain)) {
161
+ const evm = EvmService.create(chain);
162
+ if (ContractConfig.is(config)) {
163
+ const balance = await evm.getBalance(address, config);
164
+ return amount.copyWith({ amount: balance });
165
+ }
166
+ if (EvmQueryConfig.is(config)) {
167
+ const balance = await evm.query(config);
168
+ return amount.copyWith({ amount: balance });
169
+ }
170
+ }
171
+ throw new Error(
172
+ `Can't get balance for ${address} on chain ${chain.name} and asset ${asset.symbol}`
173
+ );
174
+ }
175
+ async function getAssetMin({
176
+ asset,
177
+ builder,
178
+ chain
179
+ }) {
180
+ const zero = AssetAmount2.fromChainAsset(chain.getChainAsset(asset), {
181
+ amount: 0n
182
+ });
183
+ if (builder && EvmParachain.isAnyParachain(chain)) {
184
+ const polkadot = await PolkadotService.create(chain);
185
+ const min = await polkadot.query(
186
+ builder.build({ asset: zero.getMinAssetId() })
187
+ );
188
+ return zero.copyWith({ amount: min });
189
+ }
190
+ if (zero.min) {
191
+ return zero.copyWith({ amount: zero.min });
192
+ }
193
+ return zero;
194
+ }
195
+ function getMin({
196
+ balance,
197
+ existentialDeposit,
198
+ fee,
199
+ min
200
+ }) {
201
+ const result = Big(0).plus(balance.isSame(fee) ? fee.toBig() : Big(0)).plus(
202
+ existentialDeposit && balance.isSame(existentialDeposit) && balance.toBig().lt(existentialDeposit.toBig()) ? existentialDeposit.toBig() : Big(0)
203
+ ).plus(balance.toBig().lt(min.toBig()) ? min.toBig() : Big(0));
204
+ return balance.copyWith({
205
+ amount: BigInt(result.toFixed())
206
+ });
207
+ }
208
+ function getMax({
209
+ balance,
210
+ existentialDeposit,
211
+ fee,
212
+ min
213
+ }) {
214
+ const result = balance.toBig().minus(min.toBig()).minus(
215
+ existentialDeposit && balance.isSame(existentialDeposit) ? existentialDeposit.toBig() : Big(0)
216
+ ).minus(balance.isSame(fee) ? fee.toBig() : Big(0));
217
+ return balance.copyWith({
218
+ amount: result.lt(0) ? 0n : BigInt(result.toFixed())
219
+ });
220
+ }
221
+ async function getDestinationFee({
222
+ address,
223
+ asset,
224
+ destination,
225
+ fee,
226
+ feeAsset
227
+ }) {
228
+ const zero = AssetAmount2.fromChainAsset(destination.getChainAsset(feeAsset), {
229
+ amount: 0n
230
+ });
231
+ if (Number.isFinite(fee)) {
232
+ return zero.copyWith({
233
+ amount: fee
234
+ });
235
+ }
236
+ if (EvmParachain.isAnyParachain(destination)) {
237
+ const polkadot = await PolkadotService.create(destination);
238
+ const cfg = fee.build({
239
+ address,
240
+ api: polkadot.api,
241
+ asset: destination.getChainAsset(asset),
242
+ destination,
243
+ feeAsset: destination.getChainAsset(feeAsset)
244
+ });
245
+ return zero.copyWith({
246
+ amount: await cfg.call()
247
+ });
248
+ }
249
+ return zero;
250
+ }
251
+ function convertToChainDecimals({
252
+ asset,
253
+ target
254
+ }) {
255
+ return AssetAmount2.fromChainAsset(target, {
256
+ amount: asset.convertDecimals(target.decimals).amount
257
+ });
258
+ }
259
+ async function getExistentialDeposit(chain) {
260
+ if (EvmParachain.isAnyParachain(chain)) {
261
+ const polkadot = await PolkadotService.create(chain);
262
+ return polkadot.existentialDeposit;
263
+ }
264
+ return void 0;
265
+ }
266
+ async function getDestinationFeeBalance({
267
+ balance,
268
+ feeBalance,
269
+ route,
270
+ sourceAddress
271
+ }) {
272
+ if (route.destination.fee.asset.isEqual(balance)) {
273
+ return balance;
274
+ }
275
+ if (route.destination.fee.asset.isEqual(feeBalance)) {
276
+ return feeBalance;
277
+ }
278
+ if (!route.source.destinationFee?.balance) {
279
+ throw new Error(
280
+ "BalanceBuilder must be defined for source.destinationFee.balance for AssetRoute"
281
+ );
282
+ }
283
+ return getBalance({
284
+ address: sourceAddress,
285
+ asset: route.getDestinationFeeAssetOnSource(),
286
+ builder: route.source.destinationFee?.balance,
287
+ chain: route.source.chain
288
+ });
289
+ }
290
+ async function getExtrinsicFee({
291
+ address,
292
+ balance,
293
+ chain,
294
+ extrinsic,
295
+ feeBalance,
296
+ feeConfig
297
+ }) {
298
+ try {
299
+ const polkadot = await PolkadotService.create(chain);
300
+ const fee = await polkadot.getFee(address, extrinsic);
301
+ const extra = feeConfig?.extra ? toBigInt(feeConfig.extra, feeBalance.decimals) : 0n;
302
+ const totalFee = fee + extra;
303
+ const converted = chain.usesChainDecimals ? convertDecimals(totalFee, polkadot.decimals, feeBalance.decimals) : totalFee;
304
+ return feeBalance.copyWith({ amount: converted });
305
+ } catch (error) {
306
+ if (balance.amount) {
307
+ throw error;
308
+ }
309
+ return feeBalance.copyWith({ amount: 0n });
310
+ }
311
+ }
312
+ async function getContractFee({
313
+ address,
314
+ chain,
315
+ contract,
316
+ destinationFee,
317
+ feeBalance,
318
+ feeConfig
319
+ }) {
320
+ try {
321
+ const evm = EvmService.create(chain);
322
+ const fee = await evm.getFee(address, contract);
323
+ const extra = feeConfig?.extra ? toBigInt(feeConfig.extra, feeBalance.decimals) : 0n;
324
+ return feeBalance.copyWith({ amount: fee + extra });
325
+ } catch (error) {
326
+ throw new Error(
327
+ `Can't get a fee, make sure you have ${destinationFee.toDecimal()} ${destinationFee.getSymbol()} in your source balance, needed for destination fees`,
328
+ { cause: error }
329
+ );
330
+ }
331
+ }
332
+ function validateSovereignAccountBalances({
333
+ amount,
334
+ sourceData,
335
+ destinationData
336
+ }) {
337
+ if (!Parachain.is(destinationData.chain) || !destinationData.chain.checkSovereignAccountBalances || !destinationData.sovereignAccountBalances) {
338
+ return;
339
+ }
340
+ const { feeAssetBalance, transferAssetBalance } = destinationData.sovereignAccountBalances;
341
+ if (amount > transferAssetBalance) {
342
+ throw new Error(
343
+ `${sourceData.chain.name} Sovereign account in ${destinationData.chain.name} does not have enough balance for this transaction`
344
+ );
345
+ }
346
+ if (feeAssetBalance && sourceData.destinationFee.amount > feeAssetBalance) {
347
+ throw new Error(
348
+ `${sourceData.chain.name} Sovereign account in ${destinationData.chain.name} does not have enough balance to pay for fees for this transaction`
349
+ );
350
+ }
351
+ }
352
+
353
+ // src/getTransferData/getSourceData.ts
354
+ async function getSourceData({
355
+ route,
356
+ destinationAddress,
357
+ destinationFee,
358
+ sourceAddress
359
+ }) {
360
+ const source = route.source.chain;
361
+ const destination = route.destination.chain;
362
+ const [sourcePolkadot, destinationPolkadot] = await PolkadotService.createMulti([source, destination]);
363
+ const asset = source.getChainAsset(route.source.asset);
364
+ const feeAsset = route.source.fee ? source.getChainAsset(route.source.fee.asset) : asset;
365
+ const balance = await getBalance({
366
+ address: sourceAddress,
367
+ asset,
368
+ builder: route.source.balance,
369
+ chain: source
370
+ });
371
+ const feeBalance = route.source.fee ? await getBalance({
372
+ address: sourceAddress,
373
+ asset: feeAsset,
374
+ builder: route.source.fee.balance,
375
+ chain: source
376
+ }) : balance;
377
+ const destinationFeeBalance = await getDestinationFeeBalance({
378
+ balance,
379
+ feeBalance,
380
+ route,
381
+ sourceAddress
382
+ });
383
+ const existentialDeposit = await getExistentialDeposit(source);
384
+ const min = await getAssetMin({
385
+ asset,
386
+ builder: route.source.min,
387
+ chain: source
388
+ });
389
+ const extrinsic = route.extrinsic?.build({
390
+ asset: balance,
391
+ destination: route.destination.chain,
392
+ destinationAddress,
393
+ destinationApi: destinationPolkadot.api,
394
+ fee: destinationFee,
395
+ source,
396
+ sourceAddress,
397
+ sourceApi: sourcePolkadot.api
398
+ });
399
+ const contract = route.contract?.build({
400
+ asset: balance,
401
+ destination: route.destination.chain,
402
+ destinationAddress,
403
+ destinationApi: destinationPolkadot.api,
404
+ fee: destinationFee,
405
+ source,
406
+ sourceAddress,
407
+ sourceApi: sourcePolkadot.api
408
+ });
409
+ const fee = await getFee({
410
+ balance,
411
+ chain: source,
412
+ contract,
413
+ destinationFee,
414
+ extrinsic,
415
+ feeBalance,
416
+ feeConfig: route.source.fee,
417
+ sourceAddress
418
+ });
419
+ const max = getMax({
420
+ balance,
421
+ existentialDeposit,
422
+ fee,
423
+ min
424
+ });
425
+ return {
426
+ balance,
427
+ chain: source,
428
+ destinationFee,
429
+ destinationFeeBalance,
430
+ existentialDeposit,
431
+ fee,
432
+ feeBalance,
433
+ max,
434
+ min
435
+ };
436
+ }
437
+ async function getFee({
438
+ balance,
439
+ feeBalance,
440
+ chain,
441
+ contract,
442
+ destinationFee,
443
+ extrinsic,
444
+ feeConfig,
445
+ sourceAddress
446
+ }) {
447
+ if (!contract && !extrinsic) {
448
+ throw new Error("Either contract or extrinsic must be provided");
449
+ }
450
+ if (contract) {
451
+ return getContractFee({
452
+ address: sourceAddress,
453
+ chain,
454
+ contract,
455
+ destinationFee,
456
+ feeBalance,
457
+ feeConfig
458
+ });
459
+ }
460
+ return getExtrinsicFee({
461
+ address: sourceAddress,
462
+ balance,
463
+ chain,
464
+ extrinsic,
465
+ feeBalance,
466
+ feeConfig
467
+ });
468
+ }
469
+ async function getAssetsBalances({
470
+ address,
471
+ chain,
472
+ routes
473
+ }) {
474
+ const uniqueRoutes = routes.reduce((acc, route) => {
475
+ if (!acc.some((a) => a.source.asset.isEqual(route.source.asset))) {
476
+ return [route, ...acc];
477
+ }
478
+ return acc;
479
+ }, []);
480
+ const balances = await Promise.all(
481
+ uniqueRoutes.map(
482
+ async (route) => getBalance({
483
+ address,
484
+ asset: chain.getChainAsset(route.source.asset),
485
+ builder: route.source.balance,
486
+ chain
487
+ })
488
+ )
489
+ );
490
+ return balances;
491
+ }
492
+
493
+ // src/getTransferData/getDestinationData.ts
494
+ import { Parachain as Parachain2 } from "@moonbeam-network/xcm-types";
495
+ import { getSovereignAccountAddresses } from "@moonbeam-network/xcm-utils";
496
+ async function getDestinationData({
497
+ route,
498
+ destinationAddress
499
+ }) {
500
+ const destination = route.destination.chain;
501
+ const asset = destination.getChainAsset(route.destination.asset);
502
+ const balance = await getBalance({
503
+ address: destinationAddress,
504
+ asset,
505
+ builder: route.destination.balance,
506
+ chain: destination
507
+ });
508
+ const min = await getAssetMin({
509
+ asset,
510
+ builder: route.destination.min,
511
+ chain: destination
512
+ });
513
+ const fee = await getDestinationFee({
514
+ address: destinationAddress,
515
+ feeAsset: route.destination.fee.asset,
516
+ destination,
517
+ fee: route.destination.fee.amount,
518
+ asset: route.source.asset
519
+ });
520
+ const existentialDeposit = await getExistentialDeposit(destination);
521
+ return {
522
+ chain: destination,
523
+ balance,
524
+ existentialDeposit,
525
+ fee,
526
+ min,
527
+ sovereignAccountBalances: await getSovereignAccountBalances({
528
+ source: route.source,
529
+ destination: route.destination
530
+ })
531
+ };
532
+ }
533
+ async function getSovereignAccountBalances({
534
+ destination,
535
+ source
536
+ }) {
537
+ if (!Parachain2.is(source.chain) || !Parachain2.is(destination.chain) || !destination.chain.checkSovereignAccountBalances) {
538
+ return void 0;
539
+ }
540
+ const sovereignAccountAddresses = getSovereignAccountAddresses(
541
+ source.chain.parachainId
542
+ );
543
+ const destinationFeeAssetBalance = destination.fee.balance;
544
+ const sovereignAccountAddress = destination.chain.isRelay ? sovereignAccountAddresses.relay : sovereignAccountAddresses.generic;
545
+ const sovereignAccountBalance = await getBalance({
546
+ address: sovereignAccountAddress,
547
+ asset: destination.chain.getChainAsset(destination.asset),
548
+ builder: destination.balance,
549
+ chain: destination.chain
550
+ });
551
+ const sovereignAccountFeeAssetBalance = destinationFeeAssetBalance ? await getBalance({
552
+ address: sovereignAccountAddress,
553
+ asset: destination.chain.getChainAsset(destination.fee.asset),
554
+ builder: destinationFeeAssetBalance,
555
+ chain: destination.chain
556
+ }) : void 0;
557
+ return {
558
+ feeAssetBalance: sovereignAccountFeeAssetBalance?.amount,
559
+ transferAssetBalance: sovereignAccountBalance.amount
560
+ };
561
+ }
562
+
563
+ // src/sdk.ts
564
+ import { ConfigService, xcmRoutesMap } from "@moonbeam-network/xcm-config";
565
+ import {
566
+ EvmParachain as EvmParachain2
567
+ } from "@moonbeam-network/xcm-types";
568
+
569
+ // src/getTransferData/getTransferData.ts
570
+ import {
571
+ AssetAmount as AssetAmount3
572
+ } from "@moonbeam-network/xcm-types";
573
+ import { toBigInt as toBigInt2 } from "@moonbeam-network/xcm-utils";
574
+ import Big2 from "big.js";
575
+ async function getTransferData({
576
+ route,
577
+ sourceAddress,
578
+ destinationAddress
579
+ }) {
580
+ const destinationData = await getDestinationData({
581
+ route,
582
+ destinationAddress
583
+ });
584
+ const destinationFee = convertToChainDecimals({
585
+ asset: destinationData.fee,
586
+ target: route.getDestinationFeeAssetOnSource()
587
+ });
588
+ const sourceData = await getSourceData({
589
+ route,
590
+ destinationAddress,
591
+ destinationFee,
592
+ sourceAddress
593
+ });
594
+ return {
595
+ destination: destinationData,
596
+ getEstimate(amount) {
597
+ const bigAmount = Big2(
598
+ toBigInt2(amount, sourceData.balance.decimals).toString()
599
+ );
600
+ const result = bigAmount.minus(
601
+ sourceData.balance.isSame(destinationFee) ? destinationFee.toBig() : Big2(0)
602
+ );
603
+ return sourceData.balance.copyWith({
604
+ amount: result.lt(0) ? 0n : BigInt(result.toFixed())
605
+ });
606
+ },
607
+ max: sourceData.max,
608
+ min: getMin(destinationData),
609
+ source: sourceData,
610
+ async transfer(amount, { evmSigner, polkadotSigner }) {
611
+ const source = route.source.chain;
612
+ const destination = route.destination.chain;
613
+ const bigintAmount = toBigInt2(amount, sourceData.balance.decimals);
614
+ validateSovereignAccountBalances({
615
+ amount: bigintAmount,
616
+ destinationData,
617
+ sourceData
618
+ });
619
+ const asset = AssetAmount3.fromChainAsset(
620
+ route.source.chain.getChainAsset(route.source.asset),
621
+ { amount: bigintAmount }
622
+ );
623
+ const [sourcePolkadot, destinationPolkadot] = await PolkadotService.createMulti([source, destination]);
624
+ const contract = route.contract?.build({
625
+ asset,
626
+ destination,
627
+ destinationAddress,
628
+ destinationApi: destinationPolkadot.api,
629
+ fee: destinationFee,
630
+ source,
631
+ sourceAddress,
632
+ sourceApi: sourcePolkadot.api
633
+ });
634
+ const extrinsic = route.extrinsic?.build({
635
+ asset,
636
+ destination,
637
+ destinationAddress,
638
+ destinationApi: destinationPolkadot.api,
639
+ fee: destinationFee,
640
+ source,
641
+ sourceAddress,
642
+ sourceApi: sourcePolkadot.api
643
+ });
644
+ if (contract) {
645
+ if (!evmSigner) {
646
+ throw new Error("EVM Signer must be provided");
647
+ }
648
+ const evm = EvmService.create(source);
649
+ return evm.transfer(evmSigner, contract);
650
+ }
651
+ if (extrinsic) {
652
+ if (!polkadotSigner) {
653
+ throw new Error("Polkadot signer must be provided");
654
+ }
655
+ return sourcePolkadot.transfer(
656
+ sourceAddress,
657
+ extrinsic,
658
+ polkadotSigner
659
+ );
660
+ }
661
+ throw new Error("Either contract or extrinsic must be provided");
662
+ }
663
+ };
664
+ }
665
+
666
+ // src/sdk.ts
667
+ var DEFAULT_SERVICE = new ConfigService({ routes: xcmRoutesMap });
668
+ function Sdk({ configService, ecosystem } = {}) {
669
+ const service = configService ?? DEFAULT_SERVICE;
670
+ const assets = service.getEcosystemAssets(ecosystem);
671
+ return {
672
+ assets,
673
+ setAsset(asset) {
674
+ const sources = service.getSourceChains({ asset, ecosystem });
675
+ return {
676
+ sources,
677
+ setSource(source) {
678
+ const destinations = service.getDestinationChains({
679
+ asset,
680
+ source
681
+ });
682
+ return {
683
+ destinations,
684
+ setDestination(destination) {
685
+ const route = service.getAssetRoute({
686
+ asset,
687
+ source,
688
+ destination
689
+ });
690
+ return {
691
+ setAddresses({
692
+ sourceAddress,
693
+ destinationAddress
694
+ }) {
695
+ const sourceChain = service.getChain(source);
696
+ if (!EvmParachain2.isAnyParachain(sourceChain)) {
697
+ throw new Error(
698
+ "Source chain should be a Parachain or EvmParachain"
699
+ );
700
+ }
701
+ if (!EvmParachain2.isAnyParachain(route.destination.chain)) {
702
+ throw new Error(
703
+ "Destination chain should be a Parachain or EvmParachain"
704
+ );
705
+ }
706
+ return getTransferData({
707
+ route,
708
+ sourceAddress,
709
+ destinationAddress
710
+ });
711
+ }
712
+ };
713
+ }
714
+ };
715
+ }
716
+ };
717
+ }
718
+ };
719
+ }
720
+ async function getParachainBalances(chain, address, service = DEFAULT_SERVICE) {
721
+ const routes = service.getChainRoutes(chain).getRoutes();
722
+ const balances = await getAssetsBalances({
723
+ chain,
724
+ routes,
725
+ address
726
+ });
727
+ return balances;
728
+ }
729
+ export {
730
+ EvmService,
731
+ PolkadotService,
732
+ Sdk,
733
+ convertToChainDecimals,
734
+ getAssetMin,
735
+ getAssetsBalances,
736
+ getBalance,
737
+ getContractFee,
738
+ getDestinationData,
739
+ getDestinationFee,
740
+ getDestinationFeeBalance,
741
+ getExistentialDeposit,
742
+ getExtrinsicFee,
743
+ getFee,
744
+ getMax,
745
+ getMin,
746
+ getParachainBalances,
747
+ getSourceData,
748
+ validateSovereignAccountBalances
749
+ };
2
750
  //# sourceMappingURL=index.mjs.map