Skip to content

Conversation

@Imod7
Copy link
Contributor

@Imod7 Imod7 commented Mar 2, 2025

Description

Closes #1599

Changes

  • Added Foreign Assets controller to Westend Asset Hub and Westend Asset Hub Next chain config.
  • Implemented a fallback when multilocation is given as a hexadecimal value to still return the AssetInfo and Metadata (as empty).
  • Added the multiLocation of the foreign asset in the response.
  • Updated existing test to include the multiLocation.
  • Created a new test that has a hexadecimal value as multiLocation.
  • Updated docs.

Testing

When connecting Sidecar to Westend Asset Hub (wss://westend-asset-hub-rpc.polkadot.io) and querying the endpoint http://127.0.0.1:8080/pallets/foreign-assets, the response is now returned with no errors:

{
  "at": {
    "hash": "0x2e75bb2ed5541d6fc754aa75f604bdd9cbe1de1511710e47405a54e9eb38c2e0",
    "height": "11052065"
  },
  "items": [
    {
      "multiLocation": {
        "parents": "2",
        "interior": {
          "X1": [
            {
              "GlobalConsensus": {
                "Ethereum": {
                  "chainId": "11,155,111"
                }
              }
            }
          ]
        }
      },
      "foreignAssetInfo": {
        "owner": "5GjRnmh5o3usSYzVmsxBWzHEpvJyHK4tKNPhjpUR3ASrruBy",
        "issuer": "5GjRnmh5o3usSYzVmsxBWzHEpvJyHK4tKNPhjpUR3ASrruBy",
        "admin": "5GjRnmh5o3usSYzVmsxBWzHEpvJyHK4tKNPhjpUR3ASrruBy",
        "freezer": "5GjRnmh5o3usSYzVmsxBWzHEpvJyHK4tKNPhjpUR3ASrruBy",
        "supply": "0",
        "deposit": "0",
        "minBalance": "15000",
        "isSufficient": true,
        "accounts": "0",
        "sufficients": "0",
        "approvals": "0",
        "status": "Live"
      },
      "foreignAssetMetadata": {
        "deposit": "0",
        "name": "0x",
        "symbol": "0x",
        "decimals": "0",
        "isFrozen": false
      }
    },
    {
      "multiLocation": "0x30e64a56026f4b5e3c2d196283a9a17dd34371a193a751eea5883e9553457b2e6bfbb13fd9927e49c4a09ac55ab47d05020209049edaa8020300fff9976782d46cc05630d1f6ebab18b2324d6b14",
      "foreignAssetInfo": {
        "owner": "5GjRnmh5o3usSYzVmsxBWzHEpvJyHK4tKNPhjpUR3ASrruBy",
        "issuer": "5GjRnmh5o3usSYzVmsxBWzHEpvJyHK4tKNPhjpUR3ASrruBy",
        "admin": "5GjRnmh5o3usSYzVmsxBWzHEpvJyHK4tKNPhjpUR3ASrruBy",
        "freezer": "5GjRnmh5o3usSYzVmsxBWzHEpvJyHK4tKNPhjpUR3ASrruBy",
        "supply": "106000000000000",
        "deposit": "100000000000",
        "minBalance": "1",
        "isSufficient": false,
        "accounts": "2",
        "sufficients": "0",
        "approvals": "0",
        "status": "Live"
      },
      "foreignAssetMetadata": {}
    },
  ...

Note: The second item in this example is the one with multiLocation as a hexadecimal value.

@Imod7 Imod7 requested a review from a team as a code owner March 2, 2025 20:09
Copy link
Contributor

@filvecchiato filvecchiato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! LGTM!

Copy link
Member

@TarikGul TarikGul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@Imod7 Imod7 merged commit e65ba2b into master Mar 3, 2025
14 checks passed
@Imod7 Imod7 deleted the domi-fix-foreign branch March 3, 2025 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Foreign Assets in WAH is broken

4 participants