/** * Copyright (c) 2022 Signum Network */ import { Ledger, Account } from '@signumjs/core'; import { Descriptor } from './typings'; import { SetAccountDescriptorArgs } from './typings/args/setAccountDescriptorArgs'; import { SetAliasDescriptorArgs } from './typings/args/setAliasDescriptorArgs'; import { SetAssetBrandingArgs } from './typings/args/setAssetBrandingArgs'; import { SetContractBrandingArgs } from './typings/args/setContractBrandingArgs'; /** * Descriptor Data Client * * ```ts * 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. * */ export declare class DescriptorDataClient { private readonly ledger; private static readonly SmartContractPublicKey; /** * Instantiates the client. * Mind the dependency of the ledger client. * @param ledger */ constructor(ledger: Ledger); /** * 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 * * @param contractId The contract id * @return The fetched Descriptor data. It might throw exceptions if it has no compatible data. */ getFromContract(contractId: string): Promise; /** * 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 * * @param assetId The token/asset id * @return The fetched Descriptor data. It might throw exceptions if it has no compatible data. */ getFromAsset(assetId: string): Promise; /** * Sets an accounts descriptor data. * If `feePlanck` is not given, the minimum costs will be calculated automatically * @param args The arguments */ setAccountDescriptor(args: SetAccountDescriptorArgs): Promise; /** * Tries to resolve an account by its alias Name * @param aliasName * @return The account, if resolvable (alias exists, and points to an account), or null */ getAccountByAlias(aliasName: string): Promise; /** * 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 {@link setAssetBranding} * @param tokenId * @returns An array of descriptors/brands - can be empty */ getAssetBranding(tokenId: string): Promise; /** * Creates a brand for an asset. * See also {@link getAssetBranding} * * If the asset is issued by a contract, the contracts creator is being checked for ownership. * * @param args The args * @return Transaction Id if successful * @throws Error on not found asset, or if sender is not owner of the asset */ setAssetBranding(args: SetAssetBrandingArgs): Promise; /** * Branded Contracts are almost identical with Branded Assets. See {@link getAssetBranding} and {@link setContractBranding} * @param contractId The contract Id * @returns An array of descriptors/brands - can be empty */ getContractBranding(contractId: string): Promise; /** * Set contract branding. See {@link getContractBranding} * @param args The args * @throws Error on not found contract, or if sender is not owner of the contract * */ setContractBranding(args: SetContractBrandingArgs): Promise; /** * Gets the descriptor data from an account. It also resolved referenced alias descriptor * @param accountId The account id * @return The fetched Descriptor data. It might throw exceptions if it has no compatible data. */ getFromAccount(accountId: string): Promise; /** * Sets an alias descriptor data. * If `feePlanck` is not given, the minimum costs will be calculated automatically * @param args The arguments */ setAliasDescriptor(args: SetAliasDescriptorArgs): Promise; /** * Gets descriptor data from an alias. * @param aliasName The unique alias name (can have a TLD attached using `:`, like `myalias:mytld`) * @throws If the alias does not have compatible descriptor data */ getFromAlias(aliasName: string): Promise; }