@moonbeam-network/xcm-builder 4.2.6 → 4.3.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/build/index.d.ts CHANGED
@@ -204,7 +204,10 @@ declare function assets(): {
204
204
  account: () => BalanceConfigBuilder;
205
205
  };
206
206
  declare function foreignAssets(): {
207
- account: () => BalanceConfigBuilder;
207
+ account: () => {
208
+ globalConsensus: () => BalanceConfigBuilder;
209
+ id: () => BalanceConfigBuilder;
210
+ };
208
211
  };
209
212
  declare function system(): {
210
213
  account: () => BalanceConfigBuilder;
package/build/index.mjs CHANGED
@@ -1706,28 +1706,40 @@ function assets2() {
1706
1706
  function foreignAssets2() {
1707
1707
  return {
1708
1708
  account: () => ({
1709
- build: ({ address, asset }) => {
1710
- if (!asset.address) {
1711
- throw new Error(
1712
- "Asset address is needed to calculate balance with foreignAssets.account function"
1713
- );
1714
- }
1715
- const multilocation = {
1716
- parents: 2,
1717
- interior: {
1718
- X2: [
1719
- { GlobalConsensus: { ethereum: { chainId: 1 } } },
1720
- getExtrinsicAccount(asset.address)
1721
- ]
1709
+ globalConsensus: () => ({
1710
+ build: ({ address, asset }) => {
1711
+ if (!asset.address) {
1712
+ throw new Error(
1713
+ "Asset address is needed to calculate balance with foreignAssets.account function"
1714
+ );
1722
1715
  }
1723
- };
1724
- return new SubstrateQueryConfig({
1725
- module: "foreignAssets",
1726
- func: "account",
1727
- args: [multilocation, address],
1728
- transform: async (response) => response.unwrapOrDefault().balance.toBigInt()
1729
- });
1730
- }
1716
+ const multilocation = {
1717
+ parents: 2,
1718
+ interior: {
1719
+ X2: [
1720
+ { GlobalConsensus: { ethereum: { chainId: 1 } } },
1721
+ getExtrinsicAccount(asset.address)
1722
+ ]
1723
+ }
1724
+ };
1725
+ return new SubstrateQueryConfig({
1726
+ module: "foreignAssets",
1727
+ func: "account",
1728
+ args: [multilocation, address],
1729
+ transform: async (response) => response.unwrapOrDefault().balance.toBigInt()
1730
+ });
1731
+ }
1732
+ }),
1733
+ id: () => ({
1734
+ build: ({ address, asset }) => {
1735
+ return new SubstrateQueryConfig({
1736
+ module: "foreignAssets",
1737
+ func: "account",
1738
+ args: [asset.getBalanceAssetId(), address],
1739
+ transform: async (response) => response.unwrapOrDefault().balance.toBigInt()
1740
+ });
1741
+ }
1742
+ })
1731
1743
  })
1732
1744
  };
1733
1745
  }