Methods
# addTagToAddress(params) → {Promise.<string>}
Assign a tag to a address
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
|||
param.tag_name |
string
|
The name of the tag you are assigning to the address, if it doesn'thave '#' at the front it will be added |
|
param.to_address |
string
|
The address that will be assigned the tag |
|
param.change_address |
string
|
<optional> |
The change address for the qualifier token to be sent to |
param.asset_data |
string
|
<optional> |
The asset data (ipfs or a hash) to be applied to the transfer of the qualifier token |
txid
Promise.<string>
# checkAddressRestriction(params) → {Promise.<boolean>}
Checks to see if an address has been frozen by the given restricted asset
Parameters:
Name | Type | Description |
---|---|---|
params |
||
address |
string
|
The RVN address to search |
restricted_name |
string
|
The restricted asset to search |
boolean - If the address is frozen
Promise.<boolean>
Example
client.assets.checkAddressRestriction({ address: 'n1VH67GpxMxgsEAPWNhGKcnZVdNSZpMXHZ', restricted_name: 'FE271D55A604409E8C50' });
# checkAddressTag(params) → {Promise.<boolean>}
Checks to see if an address has the given tag
Parameters:
Name | Type | Description |
---|---|---|
params |
||
address |
string
|
The RVN address to search |
tag_name |
string
|
The tag to search |
boolean - If the address has the tag
Promise.<boolean>
Example
client.assets.checkAddressTag({ address: 'n1VH67GpxMxgsEAPWNhGKcnZVdNSZpMXHZ', tag_name: 'ASSET_ONE' });
# checkGlobalRestriction(params) → {Promise.<boolean>}
Checks to see if a restricted asset is globally frozen
Parameters:
Name | Type | Description |
---|---|---|
params |
||
restricted_name |
string
|
The restricted asset to search |
boolean - If the restricted asset is frozen globally
Promise.<boolean>
Example
client.assets.checkGlobalRestriction({ restricted_name: 'FE271D55A604409E8C50' });
# freezeAddress(params) → {Promise.<string>}
Freeze an address from transferring a restricted asset
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
|||
asset_name |
string
|
The name of the restricted asset you want to freeze |
|
address |
string
|
The address that will be frozen |
|
change_address |
string
|
<optional> |
The change address for the owner token of the restricted asset |
asset_data |
string
|
<optional> |
The asset data (ipfs or a hash) to be applied to the transfer of the owner token |
txid
Promise.<string>
# freezeRestrictedAsset(params) → {Promise.<string>}
Freeze all trading for a specific restricted asset
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
|||
asset_name |
string
|
The name of the restricted asset you want to unfreeze |
|
change_address |
string
|
<optional> |
The change address for the owner token of the restricted asset |
asset_data |
string
|
<optional> |
The asset data (ipfs or a hash) to be applied to the transfer of the owner token |
txid
Promise.<string>
# getAssetData(params) → {Promise.<GetAssetDataResponse>}
Returns assets metadata if that asset exists
Parameters:
Name | Type | Description |
---|---|---|
params |
||
asset_name |
string
|
The name of the asset |
Asset data
Promise.<GetAssetDataResponse>
Example
client.assets.getAssetData({ asset_name: 'FE271D55A604409E8C48' });
# getCacheInfo() → {Promise.<Array.<GetCacheInfoResponse>>}
Returns an array of a single cache object
Promise.<Array.<GetCacheInfoResponse>>
# getSnapshot(params) → {Promise.<GetSnapshotResponse>}
Returns details for the asset snapshot, at the specified height
Parameters:
Name | Type | Description |
---|---|---|
params |
||
asset_name |
string
|
The name of the asset |
block_height |
number
|
The block height of the snapshot |
name, height, owners: [{ address, amount_owned }]
Promise.<GetSnapshotResponse>
# getVerifierString(params) → {Promise.<string>}
Retrieve the verifier string that belongs to the given restricted asset
Parameters:
Name | Type | Description |
---|---|---|
params |
||
param.restricted_name |
string
|
The asset_name |
The verifier for the asset
Promise.<string>
# issue(params) → {Promise}
Issue an asset, subasset or unique asset.
Asset name must not conflict with any existing asset.
Unit as the number of decimals precision for the asset (0 for whole units ("1"), 8 for max precision ("1.00000000")
Reissuable is true/false for whether additional units can be issued by the original issuer.
If issuing a unique asset these values are required (and will be defaulted to): qty=1, units=0, reissuable=false.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
asset_name |
string
|
A unique name. |
||
qty |
number
|
<optional> |
1 | The number of units to be issued. |
to_address |
string
|
<optional> |
'' | Address asset will be sent to, if it is empty, address will be generated for you. |
change_address |
string
|
<optional> |
'' | Address the the rvn change will be sent to, if it is empty, change address will be generated for you. |
units |
number
|
<optional> |
0 | Min = 0. Max = 8. The number of decimals precision for the asset (0 for whole units ("1"), 8 for max precision ("1.00000000"). |
reissuable |
boolean
|
<optional> |
true | False for unique assets. Whether future reissuance is allowed. |
has_ipfs |
boolean
|
<optional> |
false | Whether ipfs hash is going to be added to the asset. |
ipfs_hash |
string
|
<optional> |
Required if has_ipfs is true. An ipfs hash or a txid hash once RIP5 is activate |
txid
Promise
Example
client.assets.issue({ asset_name: 'FE271D55A604409E8C48 });
# issueQualifierAsset(params) → {Promise.<string>}
Issue an qualifier or sub qualifier asset.
If the '#' character isn't added, it will be added automatically.
Amount is a number between 1 and 10.
Asset name must not conflict with any existing asset..
Unit is always set to Zero (0) for qualifier assets.
Reissuable is always set to false for qualifier assets.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
asset_name |
string
|
A unique name |
||
qty |
string
|
<optional> |
1 | The number of units to be issued |
to_address |
string
|
<optional> |
'' | Address asset will be sent to, if it is empty, address will be generated for you |
change_address |
string
|
<optional> |
'' | Address the the rvn change will be sent to, if it is empty, change address will be generated for you |
has_ipfs |
string
|
<optional> |
false | Whether ipfs hash is going to be added to the asset |
ipfs_hash |
string
|
<optional> |
Required if has_ipfs is true. An ipfs hash or a txid hash once RIP5 is activated |
txid
Promise.<string>
Example
client.assets.issueQualifierAsset({ asset_name: 'FE271D55A604409E8C48', qty: 1, to_address: 'n1VH67GpxMxgsEAPWNhGKcnZVdNSZpMXHZ' });
# issueRestrictedAsset(params) → {Promise.<string>}
Issue a restricted asset.
Restricted asset names must not conflict with any existing restricted asset.
Restricted assets have units set to 0.
Reissuable is true/false for whether additional asset quantity can be created and if the verifier string can be changed.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
asset_name |
string
|
unique name, starts with '$', if '$' is not there it will be added automatically |
||
qty |
number
|
The quantity of the asset to be issued |
||
verifier |
string
|
Tthe verifier string that will be evaluated when restricted asset transfers are made |
||
to_address |
string
|
Address asset will be sent to, this address must meet the verifier string requirements |
||
change_address |
string
|
<optional> |
'' | Address that the rvn change will be sent to, if it is empty, change address will be generated for you |
units |
number
|
<optional> |
0 | (min=0, max=8) The number of decimals precision for the asset (0 for whole units ("1"), 8 for max precision ("1.00000000") |
reissuable |
boolean
|
<optional> |
true | (false for unique assets)) whether future reissuance is allowed |
has_ipfs |
boolean
|
<optional> |
false | Whether an ipfs hash or txid hash is going to be added to the asset |
ipfs_hash |
string
|
Required if has_ipfs is true. An ipfs hash or a txid hash once RIP5 is activated |
txid
Promise.<string>
# issueUnique(params) → {Promise}
Issue unique asset(s).
root_name must be an asset you own.
An asset will be created for each element of asset_tags.
If provided ipfs_hashes must be the same length as asset_tags.
Five (5) RVN will be burned for each asset created.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
root_name |
string
|
Name of the asset the unique asset(s) are being issued under |
||
asset_tags |
array
|
The unique tag for each asset which is to be issued |
||
ipfs_hashes |
array
|
<optional> |
Ipfs hashes or txid hashes corresponding to each supplied tag (should be same size as "asset_tags") |
|
to_address |
string
|
<optional> |
'' | Address assets will be sent to, if it is empty, address will be generated for you |
change_address |
string
|
<optional> |
'' | Address the the rvn change will be sent to, if it is empty, change address will be generated for you |
txid
Promise
Example
client.assets.issueUnique({ root_name: 'FE271D55A604409E8C48', asset_tags: ['ASSET_ONE', 'ASSET_TWO'] });
# isValidVerifierString(params) → {Promise.<string>}
Checks to see if the given verifier string is valid
Parameters:
Name | Type | Description |
---|---|---|
params |
||
verifier_string |
string
|
The verifier string to check |
If the verifier string is valid, and the reason
Promise.<string>
# listAddressesByAsset(params) → {Promise.<any>}
Returns a list of all address that own the given asset (with balances). (requires assetindex to be enabled)
Or returns the total size of how many address own the given asset
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
asset_name |
string
|
Name of asset |
||
onlytotal |
string
|
<optional> |
false | When false result is just a list of addresses with balances -- when true the result is just a single number representing the number of addresses |
count |
string
|
<optional> |
50000 | Truncates results to include only the first count assets found (MAX=50000) |
start |
string
|
<optional> |
0 | Results skip over the first start assets found (if negative it skips back from the end) |
TODO: Get return type
Promise.<any>
Example
client.assets.listAddressesByAsset({ asset_name: 'FE271D55A604409E8C48' });
# listAddressesForTag(params) → {Promise.<Array.<any>>}
List all addresses that have been assigned a given tag
Parameters:
Name | Type | Description |
---|---|---|
params |
||
tag_name |
string
|
The tag asset name to search for |
TODO: Get Address type
Promise.<Array.<any>>
Example
client.assets.listAddressesForTag({ tag_name: '#ASSET_ONE' });
# listAddressRestrictions(params) → {Promise.<Array.<string>>}
List all assets that have frozen this address client.assets.listAddressRestrictions({ address: 'mwc5mCPAMWG2cVbvxG3dSqxKbxeLR1UMtu' })
Parameters:
Name | Type | Description |
---|---|---|
params |
||
address |
string
|
The address to list restrictions for |
Array of asset names
Promise.<Array.<string>>
# listAssetBalancesByAddress(params) → {Promise.<any>}
Returns a list of all asset balances for an address. (requires assetindex to be enabled)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
address |
string
|
<optional> |
A raven address |
|
onlytotal |
boolean
|
<optional> |
false | When false result is just a list of assets balances -- when true the result is just a single number representing the number of assets |
count |
number
|
<optional> |
50000 | Truncates results to include only the first count assets found (MAX=50000) |
start |
number
|
<optional> |
0 | Results skip over the first start assets found (if negative it skips back from the end) |
TODO: Get return data
Promise.<any>
Example
client.assets.listAssetBalancesByAddress({ address: 'mwc5mCPAMWG2cVbvxG3dSqxKbxeLR1UMtu', onlytotal: true });
# listAssets(params) → {Promise.<(Array.<string>|Array.<ListAssetsResponse>)>}
Returns a list of all assets. This could be a slow/expensive operation as it reads from the database.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
asset |
string
|
<optional> |
'*' | Filters results -- must be an asset name or a partial asset name followed by '' ('' matches all trailing characters) |
verbose |
string
|
<optional> |
false | When false result is just a list of asset names -- when true results are asset name mapped to metadata |
count |
string
|
<optional> |
Truncates results to include only the first count assets found |
|
start |
string
|
<optional> |
0 | Results skip over the first start assets found (if negative it skips back from the end) |
List of assets
Promise.<(Array.<string>|Array.<ListAssetsResponse>)>
# listGlobalRestrictions() → {Promise.<Array.<string>>}
List all global restricted assets
Array of asset names;
Promise.<Array.<string>>
Example
client.assets.listGlobalRestrictions();
# listMyAssets(params) → {Promise.<any>}
Returns a list of all asset that are owned by this wallet
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
asset |
string
|
<optional> |
'*' | Filters results -- must be an asset name or a partial asset name followed by '' ('' matches all trailing characters) |
verbose |
boolean
|
<optional> |
false | When false results only contain balances -- when true results include outpoints |
count |
number
|
<optional> |
Truncates results to include only the first count assets found |
|
start |
number
|
<optional> |
0 | Results skip over the first start assets found (if negative it skips back from the end) |
confs |
number
|
<optional> |
0 | Results are skipped if they don't have this number of confirmations |
TODO: Get return data
Promise.<any>
Example
client.assets.listMyAssets();
# listTagsForAddress(params) → {Promise.<Array.<string>>}
List all tags assigned to an address
Parameters:
Name | Type | Description |
---|---|---|
params |
||
address |
string
|
The address to list tags for |
Array of tag names
Promise.<Array.<string>>
Example
client.assets.listTagsForAddress({ address: 'mwc5mCPAMWG2cVbvxG3dSqxKbxeLR1UMtu' });
# purgeSnapshot(params) → {Promise.<PurgeSnapshotResponse>}
Removes details for the asset snapshot, at the specified height
Parameters:
Name | Type | Description |
---|---|---|
params |
||
asset_name |
string
|
The name of the asset |
block_height |
number
|
The block height of the snapshot |
name, height
Promise.<PurgeSnapshotResponse>
# reissue(params) → {Promise.<string>}
Reissues a quantity of an asset to an owned address if you own the Owner Token.
Can change the reissuable flag during reissuance.
Can change the ipfs hash during reissuance.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
asset_name |
string
|
Name of asset that is being reissued |
||
qty |
number
|
Number of assets to reissue |
||
to_address |
string
|
Address to send the asset to |
||
change_address |
string
|
<optional> |
Address that the change of the transaction will be sent to |
|
reissuable |
boolean
|
<optional> |
true | Whether future reissuance is allowed |
new_units |
number
|
<optional> |
1 | The new units that will be associated with the asset |
new_ipfs |
string
|
<optional> |
'' | Whether to update the current ipfs hash or txid once RIP5 is active |
txid
Promise.<string>
Example
client.assets.reissue({ asset_name: 'FE271D55A604409E8C48', qty: 1, to_address: 'n1VH67GpxMxgsEAPWNhGKcnZVdNSZpMXHZ' });
# reissueRestrictedAsset(params) → {Promise.<string>}
Reissue an already created restricted asset
Reissuable is true/false for whether additional asset quantity can be created and if the verifier string can be changed.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
asset_name |
string
|
A unique name, starts with '$' |
||
qty |
number
|
The additional quantity of the asset to be issued |
||
to_address |
string
|
Address asset will be sent to, this address must meet the verifier string requirements |
||
change_verifier |
boolean
|
<optional> |
false | If the verifier string will get changed |
new_verifier |
string
|
<optional> |
'' | The new verifier string that will be evaluated when restricted asset transfers are made |
change_address |
string
|
<optional> |
'' | Address that the rvn change will be sent to, if it is empty, change address will be generated for you |
new_units |
number
|
<optional> |
-1 | The new units that will be associated with the asset |
reissuable |
boolean
|
<optional> |
true | False for unique assets. Whether future reissuance is allowed |
new_ipfs |
string
|
<optional> |
'' | Whether to update the current ipfs hash or txid once RIP5 is active |
txid
Promise.<string>
# removeTagFromAddress(params) → {Promise.<string>}
Remove a tag from a address
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
|||
param.tag_name |
string
|
The name of the tag you are removing from the address |
|
param.to_address |
string
|
The address that the tag will be removed from |
|
param.change_address |
string
|
<optional> |
The change address for the qualifier token to be sent to |
param.asset_data |
string
|
<optional> |
The asset data (ipfs or a hash) to be applied to the transfer of the qualifier token |
txid
Promise.<string>
# transfer(params) → {Promise.<(string|Array.<string>)>}
Transfers a quantity of an owned asset to a given address
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
asset_name |
string
|
Name of asset |
||
qty |
number
|
Number of assets you want to send to the address |
||
to_address |
string
|
Address to send the asset to |
||
message |
string
|
<optional> |
Once RIP5 is voted in ipfs hash or txid hash to send along with the transfer |
|
expire_time |
number
|
<optional> |
UTC timestamp of when the message expires |
|
change_address |
string
|
<optional> |
'' | The transactions RVN change will be sent to this address |
asset_change_address |
string
|
<optional> |
'' | The transactions Asset change will be sent to this address |
txid or array of txid
Promise.<(string|Array.<string>)>
Example
client.assets.transfer({ asset_name: 'FE271D55A604409E8C48', qty: 1, to_address: 'n1VH67GpxMxgsEAPWNhGKcnZVdNSZpMXHZ' });
# transferFromAddress(params) → {Promise.<(string|Array.<string>)>}
Transfer a quantity of an owned asset in a specific address to a given address
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
asset_name |
string
|
Name of asset |
||
from_addresses |
string
|
Address that the asset will be transferred from |
||
qty |
number
|
Number of assets you want to send to the address |
||
to_address |
string
|
Address to send the asset to |
||
message |
string
|
<optional> |
Once RIP5 is voted in ipfs hash or txid hash to send along with the transfer |
|
expire_time |
number
|
<optional> |
UTC timestamp of when the message expires |
|
rvn_change_address |
string
|
<optional> |
'' | The transaction RVN change will be sent to this address |
asset_change_address |
string
|
<optional> |
'' | The transaction Asset change will be sent to this address |
txid
Promise.<(string|Array.<string>)>
Example
client.assets.transferFromAddress({ asset_name: 'FE271D55A604409E8C48', from_address: 'n1VH67GpxMxgsEAPWNhGKcnZVdNSZpMXHZ', qty: 1, to_address: 'mwc5mCPAMWG2cVbvxG3dSqxKbxeLR1UMtu' });
# transferFromAddresses(params) → {Promise.<(string|Array.<string>)>}
Transfer a quantity of an owned asset in specific address(es) to a given address
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
asset_name |
string
|
Name of asset |
||
from_addresses |
Array
|
List of from addresses to send from |
||
qty |
number
|
Number of assets you want to send to the address |
||
to_address |
string
|
Address to send the asset to |
||
message |
string
|
<optional> |
Once RIP5 is voted in ipfs hash or txid hash to send along with the transfer |
|
expire_time |
number
|
<optional> |
UTC timestamp of when the message expires |
|
rvn_change_address |
string
|
<optional> |
'' | The transactions RVN change will be sent to this address |
asset_change_address |
string
|
<optional> |
'' | The transactions Asset change will be sent to this address |
txid or array of txid
Promise.<(string|Array.<string>)>
Example
client.assets.transferFromAddresses({ asset_name: 'FE271D55A604409E8C48', from_addresses: ['mwc5mCPAMWG2cVbvxG3dSqxKbxeLR1UMtu'], qty: 1, to_address: 'n1VH67GpxMxgsEAPWNhGKcnZVdNSZpMXHZ' });
# transferQualifier(params) → {Promise.<(string|Array.<string>)>}
Transfer a qualifier asset owned by this wallet to the given address
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
qualifier_name |
string
|
Name of qualifier asset |
||
qty |
number
|
Number of assets you want to send to the address |
||
to_address |
string
|
Address to send the asset to |
||
change_address |
string
|
<optional> |
'' | The transaction change will be sent to this address |
message |
string
|
<optional> |
Once RIP5 is voted in ipfs hash or txid hash to send along with the transfer |
|
expire_time |
number
|
<optional> |
UTC timestamp of when the message expires |
txid or array of txid
Promise.<(string|Array.<string>)>
Example
client.assets.transferQualifier({ qualifier_name: '#FE271D55A604409E8C48', qty: 1, to_address: 'mwc5mCPAMWG2cVbvxG3dSqxKbxeLR1UMtu' });
# unfreezeAddress(params) → {Promise.<string>}
Unfreeze an address from transferring a restricted asset
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
|||
asset_name |
string
|
The name of the restricted asset you want to unfreeze |
|
address |
string
|
The address that will be unfrozen |
|
change_address |
string
|
<optional> |
The change address for the owner token of the restricted asset |
asset_data |
string
|
<optional> |
The asset data (ipfs or a hash) to be applied to the transfer of the owner token |
txid
Promise.<string>
# unfreezeRestrictedAsset(params) → {Promise.<string>}
Unfreeze all trading for a specific restricted asset
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
|||
asset_name |
string
|
The name of the restricted asset you want to unfreeze |
|
change_address |
string
|
<optional> |
The change address for the owner token of the restricted asset |
asset_data |
string
|
<optional> |
The asset data (ipfs or a hash) to be applied to the transfer of the owner token |
txid
Promise.<string>