Closed alzozov closed 6 years ago
> eos.getTableRows()
USAGE
getTableRows - Fetch smart contract data from an account.
PARAMETERS
{
"json": {
"type": "bool",
"default": false
},
"code": "name",
"scope": "name",
"table": "name",
"table_key": "string",
"lower_bound": {
"type": "string",
"default": "0"
},
"upper_bound": {
"type": "string",
"default": "-1"
},
"limit": {
"type": "uint32",
"default": "10"
}
}
RETURNS
{
"rows": {
"type": "vector",
"doc": "one row per item, either encoded as hex String or JSON object"
},
"more": {
"type": "bool",
"doc": "true if last element"
}
}
@jcalfee thx, but how can I know that the data generated from last executed action ?
Example :
you need to enable --contracts-console
on nodeosd
Hi @jcalfee, i am posting here to avoid duplicating issues as mine is very similar.
I am trying to execute an action on a contract, this action store data with a primary key value. I would like to get this primary key value as i need to use it to store other data with other actions that refer to that original set of data (via the primary key value). My understanding is to use the transaction id to read the result of the transaction/action and get the primary key from there somehow, but how do i get it from the result of the action ?
Second question is where could i read the documentation in how the action, the action result and the contract are structured (type, methods and properties, etc). I found the documentation to be unclear.
const signatureProvider = new JsSignatureProvider([privateKey]);
const rpc = new JsonRpc('http://127.0.0.1:8000', { fetch });
const api = new Api({ rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder() });
try {
var item = req.body;
api.getContract('contractname').then((contract) => {
//What is / How is formed "contract" ?
contract.additem (JSON.stringify(item )).then(result => {
//What is / How is formed "additem" ?
//What is / How is formed "result" ?
console.log("contract.additem 's result is : " + result);
});
});
My action in contract creates a record in persistent storage and creates new id of a product. How to get id (any other data) of this product using eosjs after action executed ?