Skip to content

fix: foreign asset multilocation as hex - #1605

Merged
Imod7 merged 1 commit into
masterfrom
domi-fix-foreign
Mar 3, 2025
Merged

fix: foreign asset multilocation as hex#1605
Imod7 merged 1 commit into
masterfrom
domi-fix-foreign

Conversation

@Imod7

@Imod7 Imod7 commented Mar 2, 2025

Copy link
Copy Markdown
Contributor

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

@filvecchiato filvecchiato left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice! LGTM!

@TarikGul TarikGul left a comment

Copy link
Copy Markdown
Member

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
@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

3 participants