Descriptor Data Client

 const ledger = LedgerClientFactory.create({nodeHost: "https://europe.signum.network"})
const client = new DescriptorDataClient(ledger);
const descriptorData = DescriptorDataBuilder
.create('ohager')
.setType('hum')
.setBackground('QmUFc4dyX7TJn5dPxp8CrcDeedoV18owTBUWApYMuF6Koc', 'image/jpeg')
.setAvatar('QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR', 'image/gif')
.setSocialMediaLinks(['https://somelink.com'])
.setDescription('Just a humble dev...')
.setHomePage('https://digital-independence.dev')
.build();
const transaction = await client.setAccountDescriptor({
descriptorData: DescriptorDataBuilder.create('descriptor').build(),
senderPublicKey: '497d559d18d989b8....ed2716a4b2121902',
senderPrivateKey: '**********************************'
});

A helper class to get Descriptor information from accounts, contracts, assets, and/or aliases. It even resolves Descriptor data from referenced aliases. Furthermore, it helps on updating descriptor data according to SRC44 specifications.

Constructors

Methods

  • Tries to resolve an account by its alias Name

    Parameters

    • aliasName: string

    Returns Promise<Account>

    The account, if resolvable (alias exists, and points to an account), or null

  • Branded Assets are constructed indirectly to allow already existing Tokens/Assets to have additional (brand) data. Branded Assets link an alias with SRC44 compliant data checking for identity of issuer and alias owner. Only if those match, the descriptor data is being returned.

    If the token issuer is a contract, then the contracts creator is being used for identity matching Due to the indirection it's possible to have multiple brands.

    See also setAssetBranding

    Parameters

    • tokenId: string

    Returns Promise<Descriptor[]>

    An array of descriptors/brands - can be empty

  • Gets the descriptor data from an asset/token. It also resolved referenced alias descriptor

    Asset descriptions are immutable and can be set only on issuance. As this client does not issue assets, no setters/updaters are provided

    Parameters

    • assetId: string

      The token/asset id

    Returns Promise<Descriptor>

    The fetched Descriptor data. It might throw exceptions if it has no compatible data.

  • Gets the descriptor data from a contract. It also resolved referenced alias descriptor

    Contract descriptions are immutable and can be set only on contract deployment. As this client does not deploy contracts, no setters/updaters for contracts are provided

    Parameters

    • contractId: string

      The contract id

    Returns Promise<Descriptor>

    The fetched Descriptor data. It might throw exceptions if it has no compatible data.

  • Sets an accounts descriptor data. If feePlanck is not given, the minimum costs will be calculated automatically

    Parameters

    • args: SetAccountDescriptorArgs

      The arguments

    Returns Promise<TransactionId | UnsignedTransaction>

  • Sets an alias descriptor data. If feePlanck is not given, the minimum costs will be calculated automatically

    Parameters

    • args: SetAliasDescriptorArgs

      The arguments

    Returns Promise<TransactionId | UnsignedTransaction>

  • Creates a brand for an asset. See also getAssetBranding

    If the asset is issued by a contract, the contracts creator is being checked for ownership.

    Parameters

    • args: SetAssetBrandingArgs

      The args

    Returns Promise<TransactionId | UnsignedTransaction>

    Transaction Id if successful

    Error on not found asset, or if sender is not owner of the asset