Skip to content

Latest commit

 

History

History
448 lines (391 loc) · 10.8 KB

history-api.md

File metadata and controls

448 lines (391 loc) · 10.8 KB

History API

get_account_history(account, stop, limit, start)

Get operations relevant to the specificed account.

Parameters

Option Description
account_id_type account The account whose history should be queried
operation_history_id_type stop ID of the earliest operation to retrieve
unsigned limit Maximum number of operations to retrieve (must not exceed 100)
operation_history_id_type start ID of the most recent operation to retrieve

Example

{
    "id": 3,
    "method": "call",
    "params": [
        HISTORY_API_ID,
        "get_account_history",
        [
            "1.2.12",
            "1.6.0",
            "100",
            "1.6.10"
        ]
    ]
}

Returns

A list of operations performed by account, ordered from most recent to oldest.

{
    "id": 3,
    "jsonrpc": "2.0",
    "result": [
        {
            "id": "1.6.4",
            "op": [
                0,
                {
                    "fee": {
                        "amount": 20,
                        "asset_id": "1.3.0"
                    },
                    "from": "1.2.15",
                    "to": "1.2.12",
                    "amount": {
                        "amount": "1000000000000",
                        "asset_id": "1.3.0"
                    },
                    "extensions": []
                }
            ],
            "result": [
                0,
                {}
            ],
            "block_num": 2269,
            "trx_in_block": 0,
            "op_in_trx": 0,
            "virtual_op": 33,
            "extensions": []
        }
    ]
}

get_account_history_operations(account, operation_id, start, stop, limit)

Get only asked operations relevant to the specified account.

Parameters

Option Description
account_id_type account The account whose history should be queried
int operation_id The ID of the operation we want to get operations in the account( 0 = transfer , 1 = limit order create, ...)
operation_history_id_type start ID of the most recent operation to retrieve
operation_history_id_type stop ID of the earliest operation to retrieve
unsigned limit Maximum number of operations to retrieve (must not exceed 100)

Example

{
    "id": 3,
    "method": "call",
    "params": [
        HISTORY_API_ID,
        "get_account_history_operations",
        [
            "1.2.0",
            "0",
            "1.6.0",
            "1.6.10",
            "100"
        ]
    ]
}

Returns

A list of operations performed by account, ordered from most recent to oldest.

{
    "id": 3,
    "jsonrpc": "2.0",
    "result": [
        {
            "id": "1.6.3623",
            "op": [
                0,
                {
                    "fee": {
                        "amount": 20,
                        "asset_id": "1.3.0"
                    },
                    "from": "1.2.15",
                    "to": "1.2.0",
                    "amount": {
                        "amount": "10000000000",
                        "asset_id": "1.3.0"
                    },
                    "extensions": []
                }
            ],
            "result": [
                0,
                {}
            ],
            "block_num": 732031,
            "trx_in_block": 1,
            "op_in_trx": 0,
            "virtual_op": 3652,
            "extensions": []
        }
    ]
}

get_account_address_history(address, start, stop, limit)

Get only transfers of to the specified address.

Parameters

Option Description
ripemd160 address The address whose history should be queried
operation_history_id_type start ID of the most recent operation to retrieve
operation_history_id_type stop ID of the earliest operation to retrieve
unsigned limit Maximum number of operations to retrieve (must not exceed 100)

Example

{
    "id": 3,
    "method": "call",
    "params": [
        HISTORY_API_ID,
        "get_account_address_history",
        [
            "f149bd2883b1179965bd6706092573be4d68fec8",
            "0",
            "1.6.0",
            "1.6.10",
            "100"
        ]
    ]
}

Returns

A list of operations performed by address, ordered from most recent to oldest.

{
  "id": 3,
  "jsonrpc": "2.0",
  "result": [
    {
      "id": "1.6.24",
      "op": [
        1,
        {
          "fee": {
            "amount": 20,
            "asset_id": "1.3.0"
          },
          "from": "1.2.11",
          "to": "f149bd2883b1179965bd6706092573be4d68fec8",
          "amount": {
            "amount": 300000000,
            "asset_id": "1.3.0"
          },
          "extensions": [
            
          ]
        }
      ],
      "result": [
        0,
        {
          
        }
      ],
      "block_num": 68,
      "trx_in_block": 0,
      "op_in_trx": 0,
      "virtual_op": 77,
      "extensions": [
        
      ]
    }
  ]
}

get_relative_account_history(account, stop, limit, start)

Get operations relevant to the specified account referenced by an event numbering specific to the account. The current number of operations for the account can be found in the account statistics (or use 0 for start).

Parameters

Option Description
account_id_type account The account whose history should be queried
uint32_t stop Sequence number of earliest operation. 0 is default and will query 'limit' number of operations
unsigned limit Maximum number of operations to retrieve (must not exceed 100)
uint32_t start Sequence number of the most recent operation to retrieve. 0 is default, which will start querying from the most recent operation

Example

{
    "id": 3,
    "method": "call",
    "params": [
        HISTORY_API_ID,
        "get_relative_account_history",
        [
            "1.2.6",
            "0",
            "1",
            "10"
        ]
    ]
}

Returns

A list of operations performed by account, ordered from most recent to oldest.

{
    "id": 3,
    "jsonrpc": "2.0",
    "result": [
        {
            "id": "1.6.163",
            "op": [
                20,
                {
                    "fee": {
                        "amount": 0,
                        "asset_id": "1.3.0"
                    },
                    "committee_member_id": "1.2.6",
                    "malicious_committeemen": [],
                    "account": "1.2.46",
                    "eth_addr": "aCf5E99Db1b408E9CF5C2643CD9059D7E0fa6264",
                    "extensions": []
                }
            ],
            "result": [
                0,
                {}
            ],
            "block_num": 4550,
            "trx_in_block": 18,
            "op_in_trx": 0,
            "virtual_op": 192,
            "extensions": []
        }
    ]
}

get_contract_history(contract, stop, limit, start)

Get operations relevant to the specificed contract.

Parameters

Option Description
contract_id_type contract The contract whose history should be queried
operation_history_id_type stop ID of the earliest operation to retrieve
unsigned limit Maximum number of operations to retrieve (must not exceed 100)
operation_history_id_type start ID of the most recent operation to retrieve

Example

{
    "id": 3,
    "method": "call",
    "params": [
        HISTORY_API_ID,
        "get_contract_history",
        [
            "1.11.0",
            "1.6.0",
            "1",
            "1.6.20"
        ]
    ]
}

Returns

A list of operations performed by contract, ordered from most recent to oldest.

{
    "id": 3,
    "jsonrpc": "2.0",
    "result": [
        {
            "id": "1.6.0",
            "op": [
                34,
                {
                    "fee": {
                        "amount": 0,
                        "asset_id": "1.3.0"
                    },
                    "deposit_to_account": "1.2.15",
                    "balance_to_claim": "1.13.0",
                    "balance_owner_key": "ECHO3BhH6nPrPmh6wAtsNphRTcreo2uzZLxSP8JyNJoiRD6Q",
                    "total_claimed": {
                        "amount": "1000000000000000",
                        "asset_id": "1.3.0"
                    },
                    "extensions": []
                }
            ],
            "result": [
                0,
                {}
            ],
            "block_num": 2250,
            "trx_in_block": 0,
            "op_in_trx": 0,
            "virtual_op": 29,
            "extensions": []
        }
    ]
}

get_relative_contract_history(contract, stop, limit, start)

Get operations relevant to the specified contract referenced by an event numbering specific to the contract. The current number of operations for the contract can be found in the contract statistics (or use 0 for start).

Parameters

Option Description
contract_id_type contract The contract whose history should be queried
uint32_t stop Sequence number of earliest operation. 0 is default and will query 'limit' number of operations
unsigned limit Maximum number of operations to retrieve (must not exceed 100)
uint32_t start Sequence number of the most recent operation to retrieve. 0 is default, which will start querying from the most recent operation

Example

{
    "id": 3,
    "method": "call",
    "params": [
        HISTORY_API_ID,
        "get_relative_contract_history",
        [
            "1.11.0",
            "0",
            "1",
            "10"
        ]
    ]
}

Returns

A list of operations performed by contract, ordered from most recent to oldest.

{
    "id": 3,
    "jsonrpc": "2.0",
    "result": [
        {
            "id": "1.6.0",
            "op": [
                34,
                {
                    "fee": {
                        "amount": 0,
                        "asset_id": "1.3.0"
                    },
                    "deposit_to_account": "1.2.15",
                    "balance_to_claim": "1.13.0",
                    "balance_owner_key": "ECHO3BhH6nPrPmh6wAtsNphRTcreo2uzZLxSP8JyNJoiRD6Q",
                    "total_claimed": {
                        "amount": "1000000000000000",
                        "asset_id": "1.3.0"
                    },
                    "extensions": []
                }
            ],
            "result": [
                0,
                {}
            ],
            "block_num": 2250,
            "trx_in_block": 0,
            "op_in_trx": 0,
            "virtual_op": 29,
            "extensions": []
        }
    ]
}