You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I tested the contract rpc call method, the main code is as follows:
import { Abi, PromiseContract as ApiContract } from '@polkadot/api-contract';
import { ContractCallOutcome } from '@polkadot/api-contract/types';
import { ApiPromise } from '@polkadot/api';
import { stringToU8a,hexToU8a,hexToString,u8aToHex } from'@polkadot/util';
import * as get_method_test from "../contract_test.json";
const abi_str = (<any>get_method_test);
const abi = getAbiObj(abi_str);
new ApiPromise().isReady.then((api) => {
const contractApi = new ApiContract(api, abi, "5EUE4FAE9wGyxhKdFkhNsm9T8x55VRACzzpPpMDyWEE6h1is");
const {fn,def} = contractApi.getMessage("get_original_nonce");
let data = fn();
console.log("message data:"+u8aToHex(data));
const contract_method = contractApi.call('rpc',def.name,0,500000);
contract_method.send("5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY").then(
(outcome:ContractCallOutcome):void =>{
console.log("isSuccess:"+outcome.isSuccess+",value:"+outcome.output.toString());
}
);
});
An error message appears when I run:
(node:26072) UnhandledPromiseRejectionWarning: ReferenceError: name is not defined
at PromiseContract.getMessage (/home/jeremy/work/demo/typescript/substrate-ts-api-test/node_modules/@polkadot/api-contract/base/util.js:38:100)
at /home/jeremy/work/demo/typescript/substrate-ts-api-test/src/index.ts:13:11
According to the prompt, I find the corresponding file and modify the field corresponding to the line 31,38: After the name is changed to def.name, the program can run normally.But seeing that your apps is working fine, I don't know if I am calling the wrong way.
I use @polkadot/api-contract,@polkadot/api version is 0.96.0-beta.34,test using ABI
The text was updated successfully, but these errors were encountered:
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.
When I tested the contract rpc call method, the main code is as follows:
An error message appears when I run:
According to the prompt, I find the corresponding file and modify the field corresponding to the line
31,38
: After thename
is changed todef.name
, the program can run normally.But seeing that your apps is working fine, I don't know if I am calling the wrong way.I use
@polkadot/api-contract,@polkadot/api
version is0.96.0-beta.34
,test using ABIThe text was updated successfully, but these errors were encountered: