Skip to content

Transaction stuck in broadcasted status when using polkadot-api #10

@AlexD10S

Description

@AlexD10S

When attempting to submit a transaction using polkadot-api the transaction fails to progress beyond the broadcasted status, it never gets included in a block.

Fix

This issue was addressed by the PAPI team through:

To resolve the issue in ink-node, we need to upgrade ink-node to a version of polkadot-sdk that includes paritytech/polkadot-sdk#8162

Steps to Reproduce

  1. Run the ink-node: cargo run --release
  2. Run pnpm papi add -w ws://127.0.0.1:9944 inknode
  3. Execute the following JS snippet:
import { inknode } from "./.papi/descriptors/dist"
import { createClient } from "polkadot-api"
import { withPolkadotSdkCompat } from "polkadot-api/polkadot-sdk-compat"
import { getWsProvider } from "polkadot-api/ws-provider/web"
import { aliceSigner } from "./signer.js";

const client = createClient(
  withPolkadotSdkCompat(
    getWsProvider("ws://localhost:9944"),
  ),
);
const clientApi = client.getTypedApi(inknode);
const BOB = "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty"
const transfer = clientApi.tx.Balances.transfer_allow_death({
  dest: MultiAddress.Id(BOB),
  value: 12345n,
});
transfer.signSubmitAndWatch(aliceSigner).subscribe({
  next: (event) => {
    console.log("Tx event: ", event.type)
    if (event.type === "txBestBlocksState") {
      console.log("The tx is now in a best block, check it out:")
      console.log(`https://westend.subscan.io/extrinsic/${event.txHash}`)
    }
  },
  error: console.error,
});

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions