Closed vipertechofficial closed 3 years ago
This API may help. But it use offset number, not txID, to do paging.
I am reopening this issue because in the documentation the method chain.getTxHistory
refuse to take more than two parameters (address and num).
I have tested to provide a third parameter which is offset and it doesn't work :/
This API may help. But it use offset number, not txID, to do paging.
@SheldonYS Could it be possible to update the file (js-v-sdk/src/blockchain.js) ? :)
You can use getTxByType(...)
method in chain object. Here is sample code:
const vsys = require("@virtualeconomy/js-v-sdk");
const constants = vsys.constants;
const node_address = "https://wallet.v.systems/api"; // change to your node address
const network_byte = constants.MAINNET_BYTE;
let chain = new vsys.Blockchain(node_address, network_byte);
let type_id = 2;
chain.getTxByType("<address>", "<limit>", type_id);
@SheldonYS
If I remember type one, two or three aren't offset but "payment transaction", "lease transaction", and "contract transaction", the issue motionned by @Haynar216 seem to answers it. getTxByType
could take more than address
, limit
, type
, it could take offset
, now if we look at getTxByType
it doesn't consider the offset dimension to it's query when it is called...
Maybe one could add:
async getTxByType(address, record_limit, type, offset = 0) {
let response = await getRequest(this.host_ip, '/transactions/list?address=' + address + '&limit=' + record_limit + '&txType=' + type + '&offset=' + offset)
let keys =['amount']
return textToSafeJson(response, keys)
}
@vipertechofficial js-v-sdk
v2.0.6 is released. In new version, offset
is added (see https://github.com/virtualeconomy/js-v-sdk/blob/master/src/blockchain.js#L95 ). You can update SDK version and use it now.
Thanks @SheldonYS
Hey guys, I am wondering if it would be possible to implement a functionality that would enable the query of transactions from a specific trxID to the number of record to be returned?