history

history

Methods

(static) getActionsByAccount(page, pageSize, queryParams, sortParams)

get actions by account name

Example
import {getActionsByAccount} from "u3.js/src";
const u3 = createU3(config)
u3.getActionsByAccount({
     'page': 1,
     'pageSize': 10,
     'queryParams': {account:'ultrainio'},
     'sortParams': { _id: -1 }
})

json structure:
{ 
    "_id" : ObjectId("5b7d11b859bd97fab30ba7f3"), 
    "action_num" : NumberInt(0), 
    "trx_id" : "40ed51618da80804373fd84015548c8343da8c7ade8af00548ada4952d3e38b9", 
    "cfa" : false, 
    "account" : "ultrainio", 
    "name" : "onblock", 
    "authorization" : [
        {
            "actor" : "ultrainio", 
            "permission" : "active"
        }
    ], 
    "hex_data" : "80e34745000000000000000001000000000000..."
}
Parameters:
Name Type Description
page Number

page numbers

pageSize Number

how many records are displayed per page

queryParams Object

query parameter for Account

sortParams Object

sorting parameter

(static) getActionsByTxid(id)

get actions by transaction's id

Example
import {getActionsByTxid} from "u3.js/src";
const u3 = createU3(config)
u3.getActionsByTxid({
  'trx_id': "40ed51618da80804373fd84015548c8343da8c7ade8af00548ada4952d3e38b9"
})

json structure:
{ 
    "_id" : ObjectId("5b7d11b859bd97fab30ba7f3"), 
    "action_num" : NumberInt(0), 
    "trx_id" : "40ed51618da80804373fd84015548c8343da8c7ade8af00548ada4952d3e38b9", 
    "cfa" : false, 
    "account" : "ultrainio", 
    "name" : "onblock", 
    "authorization" : [
        {
            "actor" : "ultrainio", 
            "permission" : "active"
        }
    ], 
    "hex_data" : "80e3474500000000000000000100000000000..."
}
Parameters:
Name Type Description
id String

transaction's id

(async, static) getAllAccounts(page, pageSize, queryParams, sortParams)

get all accounts

Example
import {getAllAccounts} from "u3.js/src";
const u3 = createU3(config)
u3.getAllAccounts({
    'page': 1,
    'pageSize': 10,
    'queryParams': {},
    'sortParams': { _id: -1 }
})

json structure:
{ 
    "_id" : ObjectId("5b7d11cc59bd97fab30ba86b"), 
    "name" : "utrio.code", 
    "owner" : "UTR6uHKWW5tvmw6eQpbv92cVmkpDFhQ9q7xsee5Da2X2pVeYUNy4D",
    "active" : "UTR8uHKWW5tvmw6eQpbv92cVmkpDFhQ9q7xsee5Da2X2pVeYUNy4D",
    "createdAt" : ISODate("2018-08-22T07:33:32.092+0000")
}
Parameters:
Name Type Description
page Number

page numbers

pageSize Number

how many records are displayed per page

queryParams Object

query parameter for Accounts. Mongodb find({}) query condition

sortParams Object

sorting parameter

(static) getAllBlocks(page, pageSize, queryParams, sortParams)

fetch all blocks

Example
import {getAllBlocks} from "u3.js/src";
const u3 = createU3(config)
u3.getAllBlocks({
    'page': 1,
    'pageSize': 10,
    'queryParams': {"block.producer":"ultrainio"},
    'sortParams': { _id: -1 }
})

json structure:
{ 
    "_id" : ObjectId("5b7d11b90fae3a7948ccc241"), 
    "block_id" : "00000002d99f33473ee5553e0993f6b821f68ce12787c7d5e8ba90393eb1f6e6", 
    "block" : {
        "timestamp" : "2018-08-22T07:33:13.000", 
        "producer" : "ultrainio", 
        "confirmed" : NumberInt(0), 
        "previous" : "00000001bcf2f448225d099685f14da76803028926af04d2607eafcf609c265c", 
        "transaction_mroot" : "0000000000000000000000000000000000000000000000000000000000000000", 
        "action_mroot" : "62c9c892ea1f9f7000a22c05d4aa6f2664637838536da3a7d3c16db447addaa8", 
        "schedule_version" : NumberInt(0), 
        "new_producers" : null, 
        "header_extensions" : [

        ], 
        "producer_signature" : "SIG_K1_K2fughyG1DWU21kahiCa7MCrc14Kg37dnW4Ck9PSH9b1c1LjbSmp...", 
        "transactions" : [

        ], 
        "block_extensions" : [

        ]
    }, 
    "block_num" : NumberInt(2), 
    "createdAt" : ISODate("2018-08-22T07:33:13.005+0000"), 
    "irreversible" : false
}
Parameters:
Name Type Description
page Number

page numbers

pageSize Number

how many records are displayed per page

queryParams Object

query parameter for Blocks. Mongodb find({}) query condition

sortParams Object

sorting parameter

(static) getAllBlocksHeader(page, pageSize, queryParams, sortParams)

get holders by symbol and creator

Example
import {createU3} from "u3.js/src";
const u3 = createU3(config)
u3.getHoldersBySymbol({
    'page': 1,
    'pageSize': 10,
    'queryParams': {"token_account":"ben","token_symbol":"BJMZ"},
    'sortParams': { current_balance: -1 }
})

json structure:
{
      "_id": "5be8fb7144ed468a4c348078",
      "block_id": "00002a69fd784315971f971571684d01dffd612efb791dabf12dff8b56dc2eb1",
      "block": {
          "timestamp": "2018-11-12T04:31:20.000",
          "proposer": "genesis",
          "proposerProof": "28bd727f9b9771cda08241fefab6426500e4d99a3083defef26d6860d02230abb2788a8a94aa009c05cee3fa05e82d57953008880de9fb74e31b31970a0c1c03",
          "version": 0,
          "previous": "00002a684784f9c27c0c22b749ec396aee458db7d4bb4aae9b2547ca1bfa6d22",
          "transaction_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
          "action_mroot": "bfc55c5a4cbf78b7bd5cfb3ab67dde8f3c048d1a95ad85e1e869fb8a5f6d5ad5",
          "committee_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
          "header_extensions": [],
          "signature": "",
          "block_extensions": []
      },
      "block_num": 10857,
      "createdAt": "2018-11-12T04:02:58.011Z",
      "irreversible": false,
      "id": "5be8fb7144ed468a4c348078"
    }
Parameters:
Name Type Description
page Number

page numbers

pageSize Number

how many records are displayed per page

queryParams Object

query parameter for transactions

sortParams Object

sorting parameter

(static) getAllTokens(page, pageSize, queryParams, sortParams)

get all tokens

Example
import {createU3} from "u3.js/src";
const u3 = createU3(config)
u3.getAllTokens({
    'page': 1,
    'pageSize': 10,
    'queryParams': {},
    'sortParams': { _id: -1 }
})

json structure:
{
      "_id": "5be2ccfe44ed468a4c33150c",
      "account": "ben",
      "symbol": "BJMZ",
      "__v": 0,
      "createdAt": "2018-11-07T11:31:10.065Z",
      "decimals": 4,
      "issue_time": "2018-11-07T11:30:57.654Z",
      "issuer": "ben",
      "max_supply": "10000000.0000",
      "supply": "10000000.0000",
      "updatedAt": "2018-11-08T01:51:10.074Z",
      "id": "5be2ccfe44ed468a4c33150c",
      "holders": 2
   }
Parameters:
Name Type Description
page Number

page numbers

pageSize Number

how many records are displayed per page

queryParams Object

query parameter for transactions. Mongodb find({}) query condition

sortParams Object

sorting parameter

(static) getAllTxs(page, pageSize, queryParams, sortParams)

get all transactions

Example
import {getAllTxs} from "u3.js/src";
const u3 = createU3(config)
let query = { $and: [{ "actions.0.account": "ben" }, { $or: [{ "actions.0.data.id": 1257 }, { "actions.0.data.id": "1257" }] }] };
u3.getAllTxs({
    'page': 1,
    'pageSize': 10,
    'queryParams': query,
    'sortParams': { _id: -1 }
})

json structure:
{ 
    "_id" : ObjectId("5b7d11b859bd97fab30ba7f4"), 
    "trx_id" : "40ed51618da80804373fd84015548c8343da8c7ade8af00548ada4952d3e38b9", 
    "irreversible" : false, 
    "transaction_header" : {
        "expiration" : "2018-08-22T07:33:13", 
        "ref_block_num" : NumberInt(1), 
        "ref_block_prefix" : NumberLong(2517196066), 
        "max_net_usage_words" : NumberInt(0), 
        "max_cpu_usage_ms" : NumberInt(0), 
        "delay_sec" : NumberInt(0)
    }, 
    "actions" : [
        {
            "action_num" : NumberInt(0), 
            "trx_id" : "40ed51618da80804373fd84015548c8343da8c7ade8af00548ada4952d3e38b9", 
            "cfa" : false, 
            "account" : "ultrainio", 
            "name" : "onblock", 
            "authorization" : [
                {
                    "actor" : "ultrainio", 
                    "permission" : "active"
                }
            ], 
            "hex_data" : "80e34745000000000000000001000000000000000000000000000...",
            "data":{"id":1257}
        }
    ], 
    "transaction_extensions" : {

    }, 
    "signatures" : {

    }, 
    "context_free_data" : {

    }, 
    "createdAt" : ISODate("2018-08-22T07:33:12.469+0000")
}
Parameters:
Name Type Description
page Number

page numbers

pageSize Number

how many records are displayed per page

queryParams Object

query parameter for transactions. Mongodb find({}) query condition

sortParams Object

sorting parameter

(static) getBalanceByAccount(account)

get balance by account

Example
import {createU3} from "u3.js/src";
const u3 = createU3(config)
u3.getBalanceByAccount()

json structure:
[
 {
        "_id": "5be2ccfe44ed468a4c331510",
        "holder_account": "ben",
        "token_account": "ben",
        "token_symbol": "BJMZ",
        "__v": 0,
        "createdAt": "2018-11-07T11:31:10.070Z",
        "current_balance": "9999998.0000",
        "updatedAt": "2018-11-08T01:51:10.080Z",
        "id": "5be2ccfe44ed468a4c331510"
      }
]
Parameters:
Name Type Description
account String

(static) getBaseInfo(symbol)

get base info

Example
import {createU3} from "u3.js/src";
const u3 = createU3(config)
u3.getBaseInfo()

json structure:
{
    "head_block_num": 1559,
    "tx_num": 37,
    "tps": 0,
    "token_num": 0,
    "account_num": 17,
    "contract_num": 3
    }
Parameters:
Name Type Description
symbol String

symbol of token

(static) getBlocksByContract(block_num, account, contract, contract_method)

get blocks by block_num、account_name、contract_name、contract_method

Example
import {getBlocksByContract} from "u3.js/src";
const u3 = createU3(config)
u3.getBlocksByContract({
    'block_num': 1,
    'account': "ultrainio",
    'contract': "utrio.token",
    'contract_method': "transfer"
})

json structure:
{ 
    "_id" : ObjectId("5b7d11b90fae3a7948ccc241"), 
    "block_id" : "00000002d99f33473ee5553e0993f6b821f68ce12787c7d5e8ba90393eb1f6e6", 
    "block" : {
        "timestamp" : "2018-08-22T07:33:13.000", 
        "producer" : "ultrainio", 
        "confirmed" : NumberInt(0), 
        "previous" : "00000001bcf2f448225d099685f14da76803028926af04d2607eafcf609c265c", 
        "transaction_mroot" : "0000000000000000000000000000000000000000000000000000000000000000", 
        "action_mroot" : "62c9c892ea1f9f7000a22c05d4aa6f2664637838536da3a7d3c16db447addaa8", 
        "schedule_version" : NumberInt(0), 
        "new_producers" : null, 
        "header_extensions" : [

        ], 
        "producer_signature" : "SIG_K1_K2fughyG1DWU21kahiCa7MCrc14Kg37dnW4Ck9PSH9b1c1LjbSmp...", 
        "transactions" : [

        ], 
        "block_extensions" : [

        ]
    }, 
    "block_num" : NumberInt(2), 
    "createdAt" : ISODate("2018-08-22T07:33:13.005+0000"), 
    "irreversible" : false
}
Parameters:
Name Type Description
block_num Number

lasted block_num

account String

account name

contract String

contract name eg. utrio.token

contract_method String

contract method eg. transfer

(static) getContractByName(name)

get contract by name

Example
import {getContractByName} from "u3.js/src";
const u3 = createU3(config)
u3.getContractByName({
    'name': 'utrio.code'
})

json structure:
 {
    "_id" : ObjectId("5bd2e8347705c6005a6f4d12"),
    "name" : "utrio.code",
    "createdAt" : ISODate("2018-10-26T10:11:00.683+0000"),
    "abi" : {
        "version" : "ultrainio::abi/1.0",
        "types" : [...],
        "structs" : [...],
        "actions" : [...],
        "tables" : [...],
        "ricardian_clauses" : [],
        "error_messages" : [],
        "abi_extensions" : []
    },
    "updatedAt" : ISODate("2018-10-26T10:11:49.162+0000")
}
Parameters:
Name Type Description
name String

contract name eg. onblock

(static) getContracts(page, pageSize, queryParams, sortParams)

get all contracts

Example
import {getContracts} from "u3.js/src";
const u3 = createU3(config)
u3.getContracts({
    'page': 1,
    'pageSize': 10,
    'queryParams': {},
    'sortParams': { _id: -1 }
})

json structure:
 {
    "_id" : ObjectId("5bd2e8347705c6005a6f4d12"),
    "name" : "ultrainio",
    "createdAt" : ISODate("2018-10-26T10:11:00.683+0000"),
    "abi" : {
        "version" : "ultrainio::abi/1.0",
        "types" : [...],
        "structs" : [...],
        "actions" : [...],
        "tables" : [...],
        "ricardian_clauses" : [],
        "error_messages" : [],
        "abi_extensions" : []
    },
    "updatedAt" : ISODate("2018-10-26T10:11:49.162+0000")
}
Parameters:
Name Type Description
page Number

page numbers

pageSize Number

how many records are displayed per page

queryParams Object

query parameter for Contracts. Mongodb find({}) query condition

sortParams Object

sorting parameter

(static) getCreateAccountByName(name)

get createaccountbyname

Example
import {getCreateAccountByName} from "u3.js/src";
const u3 = createU3(config)
u3.getCreateAccountByName({
     'name': 'utrio.code'
})

json structure:
{ 
    "_id" : ObjectId("5b7d11cc59bd97fab30ba86b"), 
    "name" : "utrio.code", 
    "createdAt" : ISODate("2018-08-22T07:33:32.092+0000")
}
Parameters:
Name Type Description
name String

account name

(static) getExistAccount(name) → {account|null}

get account's info by its name if it is existed

Example
import {getExistAccount} from "u3.js/src";
const u3 = createU3(config)
u3.getExistAccount({
     'name': 'utrio.code'
})

json structure:
{ 
    "_id" : ObjectId("5b7d11cc59bd97fab30ba86b"), 
    "name" : "utrio.code", 
    "createdAt" : ISODate("2018-08-22T07:33:32.092+0000")
}
Parameters:
Name Type Description
name string

account name

Returns:
Type
account | null

(static) getHoldersBySymbol(page, pageSize, queryParams, sortParams)

get holders by symbol and creator

Example
import {createU3} from "u3.js/src";
const u3 = createU3(config)
u3.getHoldersBySymbol({
    'page': 1,
    'pageSize': 10,
    'queryParams': {"token_account":"ben","token_symbol":"BJMZ"},
    'sortParams': { current_balance: -1 }
})

json structure:
{
      "_id": "5be2ccfe44ed468a4c331510",
      "holder_account": "ben",
      "token_account": "ben",
      "token_symbol": "BJMZ",
      "__v": 0,
      "createdAt": "2018-11-07T11:31:10.070Z",
      "current_balance": "9999998.0000",
      "updatedAt": "2018-11-08T01:51:10.080Z",
      "id": "5be2ccfe44ed468a4c331510"
    }
Parameters:
Name Type Description
page Number

page numbers

pageSize Number

how many records are displayed per page

queryParams Object

query parameter for transactions

sortParams Object

sorting parameter

(static) getProposerList(page, pageSize)

get proposer list

Example
import {createU3} from "u3.js/src";
const u3 = createU3(config)
u3.getProposerList({
    'page': 1,
    'pageSize': 10
})

json structure:
{
      "_id": "genesis",
      "count": 972
    }
Parameters:
Name Type Description
page Number

page numbers

pageSize Number

how many records are displayed per page

(static) getTokenBySymbol(symbol, creator)

get token by symbol and creator

Example
import {createU3} from "u3.js/src";
const u3 = createU3(config)
u3.getTokenBySymbol("ZTPJ","ben")

json structure:
{
    "_id": "5be2ccc244ed468a4c331487",
    "account": "ben",
    "symbol": "ZTPJ",
    "__v": 0,
    "createdAt": "2018-11-07T11:30:10.057Z",
    "decimals": 4,
    "issue_time": "2018-11-07T11:29:57.777Z",
    "issuer": "ben",
    "max_supply": "10000000.0000",
    "supply": "10000000.0000",
    "updatedAt": "2018-11-08T01:51:10.049Z",
    "id": "5be2ccc244ed468a4c331487"
    }
Parameters:
Name Type Description
symbol String

symbol of token

creator String

creator of symbol

(static) getTxByTxId(id)

get transaction by its id

Example
import {getTxByTxId} from "u3.js/src";
const u3 = createU3(config)
u3.getTxByTxId({
    'id': '40ed51618da80804373fd84015548c8343da8c7ade8af00548ada4952d3e38b9',
})

json structure:
{ 
    "_id" : ObjectId("5b7d11b859bd97fab30ba7f4"), 
    "trx_id" : "40ed51618da80804373fd84015548c8343da8c7ade8af00548ada4952d3e38b9", 
    "irreversible" : false, 
    "transaction_header" : {
        "expiration" : "2018-08-22T07:33:13", 
        "ref_block_num" : NumberInt(1), 
        "ref_block_prefix" : NumberLong(2517196066), 
        "max_net_usage_words" : NumberInt(0), 
        "max_cpu_usage_ms" : NumberInt(0), 
        "delay_sec" : NumberInt(0)
    }, 
    "actions" : [
        {
            "action_num" : NumberInt(0), 
            "trx_id" : "40ed51618da80804373fd84015548c8343da8c7ade8af00548ada4952d3e38b9", 
            "cfa" : false, 
            "account" : "ultrainio", 
            "name" : "onblock", 
            "authorization" : [
                {
                    "actor" : "ultrainio", 
                    "permission" : "active"
                }
            ], 
            "hex_data" : "80e34745000000000000000001000000000000000000000000000..."
        }
    ], 
    "transaction_extensions" : {

    }, 
    "signatures" : {

    }, 
    "context_free_data" : {

    }, 
    "createdAt" : ISODate("2018-08-22T07:33:12.469+0000")
}
Parameters:
Name Type Description
id String

transaction's id

(static) getTxsByBlockNum(page, pageSize, queryParams, sortParams)

get transactions by block_num

Example
import {getTxsByBlockNum} from "u3.js/src";
const u3 = createU3(config)
u3.getTxsByBlockNum({
    'page': 1,
    'pageSize': 10,
    'queryParams': {
      'block_num': 1
    },
    'sortParams': { _id: -1 }
})

json structure:
{ 
    "_id" : ObjectId("5b7d11b859bd97fab30ba7f4"), 
    "trx_id" : "40ed51618da80804373fd84015548c8343da8c7ade8af00548ada4952d3e38b9", 
    "irreversible" : false, 
    "transaction_header" : {
        "expiration" : "2018-08-22T07:33:13", 
        "ref_block_num" : NumberInt(1), 
        "ref_block_prefix" : NumberLong(2517196066), 
        "max_net_usage_words" : NumberInt(0), 
        "max_cpu_usage_ms" : NumberInt(0), 
        "delay_sec" : NumberInt(0)
    }, 
    "actions" : [
        {
            "action_num" : NumberInt(0), 
            "trx_id" : "40ed51618da80804373fd84015548c8343da8c7ade8af00548ada4952d3e38b9", 
            "cfa" : false, 
            "account" : "ultrainio", 
            "name" : "onblock", 
            "authorization" : [
                {
                    "actor" : "ultrainio", 
                    "permission" : "active"
                }
            ], 
            "hex_data" : "80e347450000000000000000010000000000000000000000..."
        }
    ], 
    "transaction_extensions" : {

    }, 
    "signatures" : {

    }, 
    "context_free_data" : {

    }, 
    "createdAt" : ISODate("2018-08-22T07:33:12.469+0000")
}
Parameters:
Name Type Description
page Number

page numbers

pageSize Number

how many records are displayed per page

queryParams Object

query parameter for Blocks. Mongodb find({}) query condition

sortParams Object

sorting parameter

(static) getTxTraceByTxid(id)

get transaction trace by transaction's id

Example
import {getTxTraceByTxid} from "u3.js/src";
const u3 = createU3(config)
u3.getTxTraceByTxid({
    'id': '40ed51618da80804373fd84015548c8343da8c7ade8af00548ada4952d3e38b9'
})

json structure:

 "_id" : ObjectId("5b7d11b859bd97fab30ba7f4"),
 "trx_id" : "40ed51618da80804373fd84015548c8343da8c7ade8af00548ada4952d3e38b9",
 "irreversible" : false,
 "transaction_header" : {
        "expiration" : "2018-08-22T07:33:13", 
        "ref_block_num" : NumberInt(1), 
        "ref_block_prefix" : NumberLong(2517196066), 
        "max_net_usage_words" : NumberInt(0), 
        "max_cpu_usage_ms" : NumberInt(0), 
        "delay_sec" : NumberInt(0)
    },
 "actions" : [
 {
            "action_num" : NumberInt(0), 
            "trx_id" : "40ed51618da80804373fd84015548c8343da8c7ade8af00548ada4952d3e38b9", 
            "cfa" : false, 
            "account" : "ultrainio", 
            "name" : "onblock", 
            "authorization" : [
                {
                    "actor" : "ultrainio", 
                    "permission" : "active"
                }
            ], 
            "hex_data" : "80e347450000000000000000010000000000000000000000..."
        }
 ],
 "transaction_extensions" : {

    },
 "signatures" : {

    },
 "context_free_data" : {

    },
 "createdAt" : ISODate("2018-08-22T07:33:12.469+0000")
 }
Parameters:
Name Type Description
id String

transaction's id

(async, static) search(param)

search block/transaction/account by a query string

Example
import {search} from "u3.js/src";
const u3 = createU3(config)
u3.search(5b7d11b859bd97fab30ba7f5)
Parameters:
Name Type Description
param String

Account/Block Height/Txhash/Contract account