Adding #[ink(payable)]
to a #[ink(message)]
prevents ink_env::debug_println!
messages to be logged in console when executing the smart contract call.
Any additional config needed in this case to have ink_env::debug_println!
in console?
Substrate and Polkadot Stack Exchange is a question and answer site for developers building blockchains with the Substrate SDK. It only takes a minute to sign up.
Sign up to join this communityAdding #[ink(payable)]
to a #[ink(message)]
prevents ink_env::debug_println!
messages to be logged in console when executing the smart contract call.
Any additional config needed in this case to have ink_env::debug_println!
in console?
Debug messages are only emitted during a dry run (query
), not during the actual transaction (tx
)(Source).
When you're calling the contract, first query it. Then perform your transaction if there are no error messages.
e.g.
public async transaction(signer: Signer, method: string, args: any[]): Promise<Partial<TransactionResponse>> {
// View any debug in substrate logs and catch any errors here
const queryBeforeTx = await await this.contract.query[method](this.account.address, {}, ...args);
// Then run your transaction
const extrinsic = this.contract.tx[method]({}, ...args);
-lerror,runtime::contracts=debug