Skip to content

Added polkadot/api and rewrite sendTransaction #882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

quetool
Copy link
Member

@quetool quetool commented May 16, 2025

Installed and using "@polkadot/api" to sign and send transaction and verify that we can obtain a transaction hash.

Needs to be ran with some coins either on Polkadot mainnet or westend. I wasn't able to get them on any faucet.

Copy link

vercel bot commented May 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
decentralized-relay-app ❌ Failed (Inspect) May 16, 2025 11:17am
malicious-dapp-verify-simulation ❌ Failed (Inspect) May 16, 2025 11:17am
react-dapp-v2 ❌ Failed (Inspect) May 16, 2025 11:17am
8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
appkit-react-wagmi-example ⬜️ Ignored (Inspect) May 16, 2025 11:17am
appkit-solana ⬜️ Ignored (Inspect) May 16, 2025 11:17am
chain-abstraction-demo ⬜️ Ignored (Inspect) Visit Preview May 16, 2025 11:17am
decentralized-relay-wallet ⬜️ Ignored (Inspect) Visit Preview May 16, 2025 11:17am
react-dapp-v2-cosmos-provider ⬜️ Ignored (Inspect) May 16, 2025 11:17am
react-dapp-v2-with-ethers ⬜️ Ignored (Inspect) Visit Preview May 16, 2025 11:17am
react-wallet-v2 ⬜️ Ignored (Inspect) Visit Preview 💬 Add feedback May 16, 2025 11:17am
smart-sessions-demo ⬜️ Ignored (Inspect) Visit Preview May 16, 2025 11:17am

Copy link

Deploying demo-ai-agents with  Cloudflare Pages  Cloudflare Pages

Latest commit: 685c7f8
Status:🚫  Build failed.

View logs

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR integrates polkadot/api into the project and rewrites the sendTransaction logic to utilize Polkadot blockchain constructs. Key changes include:

  • Adding imports and instantiation of the Polkadot API and related modules.
  • Rewriting the transaction payload derivation and extrinsic signature logic.
  • Updating package.json to include the newest "@polkadot/api" dependency.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
advanced/dapps/react-dapp-v2/src/contexts/JsonRpcContext.tsx Integrates Polkadot API calls and creates a new extrinsic signature flow for transactions.
advanced/dapps/react-dapp-v2/package.json Adds the "@polkadot/api" dependency required for new blockchain functionalities.
Comments suppressed due to low confidence (2)

advanced/dapps/react-dapp-v2/src/contexts/JsonRpcContext.tsx:978

  • [nitpick] The variable name 'call' is ambiguous; consider renaming it to 'transferCall' to better reflect its purpose.
const call = api.tx.balances.transfer(address, 1000000000000); // 1 DOT

advanced/dapps/react-dapp-v2/src/contexts/JsonRpcContext.tsx:1024

  • There is an inconsistency in the representation of 'specVersion' and 'transactionVersion'; while the transactionPayload formats these as hex strings, the addSignature call uses raw numeric values. Consider aligning these formats for consistency.
extrinsic.addSignature(address, `0x${result.signature.replaceAll('0x', '')}`, { ...transactionPayload, specVersion: api.runtimeVersion.specVersion, transactionVersion: api.runtimeVersion.transactionVersion, });

@quetool quetool marked this pull request as ready for review May 16, 2025 14:29
@ganchoradkov
Copy link
Member

@quetool could you check please why it fails to build? pnpm build

@quetool
Copy link
Member Author

quetool commented May 16, 2025

@quetool could you check please why it fails to build? pnpm build

Maybe it's this? I don't know, I'm not expert here, better you checkout that branch and check cause I didn't introduce this.

Screenshot 2025-05-16 at 17 26 49

I ran ppm build and it didn't fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants