Socket
Book a DemoInstallSign in
Socket

@stellar-asset-lists/sdk

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stellar-asset-lists/sdk

Thin wrapper library for asset list catalogue

1.0.1
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

@stellar-asset-lists/sdk

Thin wrapper library for the Stellar asset list catalogue. The easiest way to start using SAL in your web app.

Installation

npm i @stellar-asset-lists/sdk

Usage

Fetch available asset lists from the community-managed catalogue

const allLists = await fetchAvailableAssetLists()
/*
[
  {
    "name": "AssetList1",
    "provider": "Stellar community",
    "description": "Assets approved by Stellar community members",
    "url": "https://stellar.community/asset-list",
    "icon": "https://gateway.ipfs.io/ipfs/bafkreibpzncuhbk5ozhdw7xkcdoyf3xhwhcwcf6sj7axjzimxw6vm6pvyy"
  }
]
 */

Fetch and parse specific asset list

const list = await fetchAssetList('https://stellar.community/asset-list')

/*
{
  "name": "Stellar Top 50",
  "provider": "StellarExpert",
  "description": "Assets approved by Stellar community members",
  "version": "1.0",
  "feedback": "https://stellar.community/feedback",
  "assets": [
    {
      "code": "yXLM",
      "issuer": "GARDNV3Q7YGT4AKSDF25LT32YSCCW4EV22Y2TV3I2PU2MMXJTEDL5T55",
      "org": "Ultra Stellar LLC dba Ultra Stellar",
      "domain": "ultrastellar.com",
      "icon": "https://ipfs.io/ipfs/bafkreihntcz2lpaxawmbhwidtuifladkgew6olwuly2dz5pewqillhhpay",
      "decimals": 7
    },
    {
      "code": "USDC",
      "issuer": "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
      "name": "USD Coin",
      "org": "Centre Consortium LLC dba Centre Consortium",
      "domain": "centre.io",
      "icon": "https://ipfs.io/ipfs/bafkreibpzncuhbk5ozhdw7xkcdoyf3xhwhcwcf6sj7axjzimxw6vm6pvyy",
      "decimals": 7
    }
  ]
}
*/

Change resolver parameters

setAssetListResolverOptions({
    catalogueUrl: 'https://stellar-asset-lists.github.io/index/', //replace the URL of the catalogue
    ipfsGatewayUrl: 'https://gateway.ipfs.io/ipfs/' //change default IPFS gateway URL
})

Testing

npm run test

Keywords

stellar

FAQs

Package last updated on 09 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.