getDataHistory(contract, dataKey, limit?, offset?, reverse?)
Feature
Get current state of the data with certain dataKey
Parameters
string
contract address,
string
dataKey,
number
| undefined
limit, // (Optional) limit the number of history to import
number
| undefined
offset, // (Optional) The Offset setting value based on block height true
| undefined
reverse // (Optional) Whether to return the history in reverse newest order.
data
of SuccessResponse
object[]
data information
example
const contractAddress = "0x41EFb6902ADcb1214a7123b01af66b1D13b89864fca";
const dataKey = "server_access_record"
// Note: an asynchronous request.
const dataInfo = async () => {
const info = await mitum.storage.getDataHistory(contractAddress, dataKey, 2, undefined, true);
console.log(info.data);
};
dataInfo();
// output
[
{
"_hint": "mitum-currency-hal-v0.0.1",
"_embedded": {
"data": [Object],
"height": 4,
"operation": "7aFsVp2Vbwvb2grMMcEVMgfXGKT8cLLB61bkLNqao8BZ",
"timestamp": "2024-08-22T06:52:24.393763Z"
},
"_links": {
"block": [Object],
"operation": [Object],
"self": [Object]
}
},
{
"_hint": "mitum-currency-hal-v0.0.1",
"_embedded": {
"data": [Object],
"height": 3,
"operation": "6RzMPtdLDbFyKFEdSwDch1gPEE9tTCVzufjBEBuS5AQB",
"timestamp": "2024-08-22T06:38:53.480539Z"
},
"_links": {
"block": [Object],
"operation": [Object],
"self": [Object]
}
}
]
Last updated