Account

Account

new Account()

Methods

(static) ACCOUNT(str)

Convert a string to class Account.

Example
import { ACCOUNT } from "ultrain-ts-lib/src/account";
 let ceo = ACCOUNT("jack.ma");
 let employ = ACCOUNT("miny");
 ceo.transfer(employ.code, "1000.000 UGS", "your annual award.");
Parameters:
Name Type Description
str

the account string to be converted.

(static) isValid(account)

to check if an account name is valid or not.

Parameters:
Name Type Description
account

account name to be checked.

Returns:

boolean

(static) NAME(str)

convert a string to account_name, a.k.a u64.

Example
import { NAME } from "ultrain-ts-lib/src/account";
Parameters:
Name Type Description
str

the account string to be converted.

(static) publicKeyOf(account, type) → {string}

get the public key of an account

Parameters:
Name Type Description
account account_name

whose public key you are interested.

type string

return value type, you can choose 'wif', or 'hex', default is 'wif'

Returns:

public key of this account, the MAX length is 128, if the length of public key oversized, return an empty string.

Type
string

(static) RNAME(code)

convert an account name to string.

Example
import { RNAME } from "ultrain-ts-lib/src/account";
Parameters:
Name Type Description
code

the value of account_name to be converted to string.

transfer(to, quantity, memo)

transfer Asset from this account to 'to' account.

Parameters:
Name Type Description
to

transfer Asset to 'to' account.

quantity

how much Asset to transfer.

memo

a memo note.

Account

new Account()

class Account stands for an account name, it wraps methods which operating the balance.

Example
import { Account } from "ultrain-ts-lib/src/account";

Methods

(static) ACCOUNT(str)

Convert a string to class Account.

Example
import { ACCOUNT } from "ultrain-ts-lib/src/account";
 let ceo = ACCOUNT("jack.ma");
 let employ = ACCOUNT("miny");
 ceo.transfer(employ.code, "1000.000 UGS", "your annual award.");
Parameters:
Name Type Description
str

the account string to be converted.

(static) isValid(account)

to check if an account name is valid or not.

Parameters:
Name Type Description
account

account name to be checked.

Returns:

boolean

(static) NAME(str)

convert a string to account_name, a.k.a u64.

Example
import { NAME } from "ultrain-ts-lib/src/account";
Parameters:
Name Type Description
str

the account string to be converted.

(static) publicKeyOf(account, type) → {string}

get the public key of an account

Parameters:
Name Type Description
account account_name

whose public key you are interested.

type string

return value type, you can choose 'wif', or 'hex', default is 'wif'

Returns:

public key of this account, the MAX length is 128, if the length of public key oversized, return an empty string.

Type
string

(static) RNAME(code)

convert an account name to string.

Example
import { RNAME } from "ultrain-ts-lib/src/account";
Parameters:
Name Type Description
code

the value of account_name to be converted to string.

transfer(to, quantity, memo)

transfer Asset from this account to 'to' account.

Parameters:
Name Type Description
to

transfer Asset to 'to' account.

quantity

how much Asset to transfer.

memo

a memo note.