1

I am using the substrate contracts node and my transactions are successfully submitted to the chain. I've checked using a dry run query and also checked in the explorer for the block after performing the tx. However, when I try to use the transaction result in polkadot-js, I cannot access fields such as status, as they are undefined.

I'm calling the signAndSend function of the extrinsic but the result: SubmittableResult I get is simply the extrinsic hash as a Uint8Array.

extrinsic
  .signAndSend(
    signerAddress,
    {
      ...options
    },
    (result: SubmittableResult) => {
      if (result.status.isInBlock) { //status is undefined here??

According to the SubmittableResult type in polkadot-js, status should be there:

export declare class SubmittableResult implements ISubmittableResult {
    readonly dispatchError?: DispatchError;
    readonly dispatchInfo?: DispatchInfo;
    readonly internalError?: Error;
    readonly events: EventRecord[];
    readonly status: ExtrinsicStatus;

1 Answer 1

2

This was because I was instantiating the contract with HttpProvider instead of WsProvider. Changing to WsProvider allows the extrinsic result to be a subscription and therefore update with extra information when available.

I had also missed the following helpful message in the console logs:

API/INIT: Api will be available in a limited mode since the provider does not support subscriptions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.