-
Notifications
You must be signed in to change notification settings - Fork 375
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
8 Skipped Deployments
|
There was a problem hiding this 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 could you check please why it fails to 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. I ran ppm build and it didn't fix |
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.