Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Querying Fuel Explorer Asset data #3474

Open
maschad opened this issue Dec 12, 2024 · 0 comments
Open

Support Querying Fuel Explorer Asset data #3474

maschad opened this issue Dec 12, 2024 · 0 comments
Labels
feat Issue is a feature

Comments

@maschad
Copy link
Member

maschad commented Dec 12, 2024

Currently the Fuel Explorer Assets API allows a user to get information about any asset as well as querying which assets are owned by an account.

The SDK could expose two methods through the Provider that allow a consumer to get this info.

  • getAssetDataById
  • getAssetsOwnedByAccount

e.g.

// Get Asset Data by Id

const assetId = "0x010101..."

const assetData = await provider.getAssetDataById(assetId)
 
 // assetData
 {
  "assetId": "0x44b09d7143aa7b1aac7844ee9cfc38893b12d20c3822ecb18dbf2c6846ea63f0",
  "contractId": "0x6a209d27a050740dc2539dcc41914f07c35ecb21f0c02279e85777353b474801",
  "subId": "0x26f00b962a66e46a1b5197a2e52ad497867eb12dbc4670e1f439011d6bd46db1",
  "name": "@luizasfight",
  "symbol": "BID",
  "decimals": 0,
  "suspicious": false,
  "metadata": {
    "image:png": "https://assets.bako.id/luizasfight"
  },
  "isNFT": true,
  "verified": false,
  "owner": "0xc4d1e11937ed4521690a94ad2556f8919be16bebbb123259ce11fc12d36a7125",
  "uri": ""
}

// Get Asset Info by Account

const accountAddress = "0x196a68B..."
// Gets up to the last 10 assets if possible
const amountOfAssets = 10

const accountAssetData = await provider.getAssetsOwnedByAccount(accountAddress, amountOfAssets)

// accountAssetData
[
   {
      "amount": "7408637",
      "assetId": "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07",
      "owner": "0x196a68ba237e921fec5f01552e5e4df60b2619900254dd4cde42557814508f57",
      "name": "Ethereum",
      "symbol": "ETH",
      "icon": "https://verified-assets.fuel.network/images/eth.svg",
      "decimals": 9,
      "suspicious": false,
      "verified": true
    },
    {
      "amount": "1",
      "assetId": "0xad786a6b97333a134f2f69011a1d34387576ab377d60f529d60b90a803f3bcfe",
      "owner": "0x196a68ba237e921fec5f01552e5e4df60b2619900254dd4cde42557814508f57",
      "contractId": "0x6a209d27a050740dc2539dcc41914f07c35ecb21f0c02279e85777353b474801",
      "subId": "0xa6b6e68a754b6dd86a0753f3d2b727454415c14111dacb916eae0ad2dfd6f0f4",
      "name": "@helciofranco",
      "symbol": "BID",
      "decimals": 0,
      "suspicious": false,
      "metadata": {
        "image:png": "https://assets.bako.id/helciofranco"
      },
      "isNFT": true,
      "verified": false,
      "uri": ""
    },
    {
      "amount": "1",
      "assetId": "0x7d772ed34335e6020e510df2d4312e47a0c9fccdb9833bf332102e06c77befd0",
      "owner": "0x196a68ba237e921fec5f01552e5e4df60b2619900254dd4cde42557814508f57",
      "contractId": "0x6a209d27a050740dc2539dcc41914f07c35ecb21f0c02279e85777353b474801",
      "subId": "0xb95235081a3eaa4eac6f587716947ae2a6a644b8dd55a3d1115d0c21083b240f",
      "name": "@helcio",
      "symbol": "BID",
      "decimals": 0,
      "suspicious": false,
      "metadata": {
        "image:png": "https://assets.bako.id/helcio"
      },
      "isNFT": true,
      "verified": false,
      "uri": ""
    }
    ....
  ]
@maschad maschad added the feat Issue is a feature label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Issue is a feature
Projects
None yet
Development

No branches or pull requests

1 participant