2 * An asset is a type of value that can be issued on a blockchain. All units of
3 * a given asset are fungible. Units of an asset can be transacted directly
4 * between parties without the involvement of the issuer.
6 * @typedef {Object} Asset
9 * @property {String} id
10 * Globally unique identifier of the asset.
11 * Asset specifies the asset id as the hash of:
12 * - the asset's issuance program
13 * - the core's VM version
14 * - the hash of asset definition
16 * @property {String} alias
17 * User specified, unique identifier in one Bytom node.
19 * @property {String} issuanceProgram
21 * @property {Key[]} keys
22 * The list of keys used to issue units of the asset.
24 * @property {Number} quorum
25 * The number of signatures required to issue new units of the asset.
27 * @property {Object} defintion
28 * User-specified, arbitrary/unstructured data visible across Bytom
29 * blockchain networks. assets specify the definition in their
30 * issuance programs, rendering the definition immutable.
34 * API for interacting with {@link Asset assets}.
38 const assetsApi = (connection) => {
40 * @typedef {String[]} xpubs
41 * The list of keys used to issue units of the asset.
45 * @typedef {String} [alias]
46 * User specified, unique identifier.
50 * @typedef {Number} quorum
51 * The number of signatures required to issue new units of the asset.
55 * @typedef {String} id
56 * Unique account identifier in one Bytom node.
60 * @typedef {Object} definition
61 * User-specified, asset attributes accross Bytom blockchain network.
68 * @param {module:AssetsApi~xpubs} xpubs - Keys for asseet creation.
69 * @param {module:AssetsApi~quorum} quorum - The number of keys required to sign transactions for the account.
70 * @param {module:AssetsApi~alias} alias - Asset alias.
71 * @param {module:AssetsApi~definition} definition - Asset definition.
72 * @returns {Promise<Response>} Newly created asset response.
74 create: (xpubs, quorum, alias, definition) => connection.request('/create-asset', {
82 * List all assets in one Bytom node.
84 * @returns {Promise<Response>} target assets response.
86 listAssets: () => connection.request('/list-assets', {}),
89 * Get asset by the asset id.
91 * @param {module:AssetsApi~id} id - Asset id.
92 * @returns {Promise<Response>} target asset response.
94 getAsset: (id) => connection.request('/get-asset', {id}),
99 * @param {module:AssetsApi~id} id - Asset id.
100 * @param {String} newAlias - new alias.
101 * @returns {Promise<Response>} update response.
103 updateAssetAlias: (id, newAlias) => connection.request('/update-asset-alias', {id, alias: newAlias})
107 export default assetsApi