swapable
Version:
Swapable: Automated Liquidity Pools
81 lines (80 loc) • 2.83 kB
TypeScript
/**
* This file is part of Swapable shared under AGPL-3.0
* Copyright (C) 2021 Using Blockchain Ltd, Reg No.: 12658136, United Kingdom
*
* @package Swapable
* @author Grégory Saive for Using Blockchain Ltd <greg@ubc.digital>
* @license AGPL-3.0
*/
import { MosaicId, MosaicNonce, PublicAccount } from 'symbol-sdk';
import { AssetSource } from './AssetSource';
/**
* @class AssetIdentifier
* @package Swapable
* @subpackage Models
* @since v1.0.0
* @description Model that describes identifiers of digital assets. An identifier
* is created around an \a id (4 bytes), a \a source and an \a owner
* public account (32 bytes). The owner account is always the first
* liquidity provider of a pool `x:y`.
*/
export declare class AssetIdentifier {
/**
* @description A unique identifier for an asset.
*
* e.g.: "0a1f3e2c" (4 bytes)
*/
id: string;
/**
* @description The deterministic account that represents the digital asset.
* This account is also the owner of the mosaic on the network.
*/
target: PublicAccount;
/**
* Constructor for AssetIdentifier objects
*
* @param {string} id
* @param {AssetSource} source
* @param {PublicAccount} target
*/
constructor(
/**
* @description A unique identifier for an asset.
*
* e.g.: "0a1f3e2c" (4 bytes)
*/
id: string,
/**
* @description The deterministic account that represents the digital asset.
* This account is also the owner of the mosaic on the network.
*/
target: PublicAccount);
/**
* Getter for the readonly property `nonce`.
*
* @return {MosaicNonce}
*/
get nonce(): MosaicNonce;
/**
* Get mosaic id representation of an asset identifier.
*
* @return {MosaicId}
*/
toMosaicId(): MosaicId;
/**
* Creates an asset identifier from a \a name, a \a target
* public account and a \a source asset source blockchain
* network.
*
* This method returns a deterministic identifier build
* from its three arguments.
*
* @static
* @access public
* @param {string} name The cryptocurrency name (e.g.: "symbol.xym", "Bitcoin", etc.).
* @param {PublicAccount} target The target public account (public key of the ISSUER of the cryptocurrency).
* @param {AssetSource} source The source network information for the asset (i.e. where it is issued).
* @return {AssetIdentifier} Given a triplet of name, target account address and source network, returns a deterministic asset identifier.
*/
static createForSource(name: string, target: PublicAccount, source: AssetSource): AssetIdentifier;
}