-
Notifications
You must be signed in to change notification settings - Fork 2
temp: add wasm-dot package for Polkadot #145
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
Draft
lcovar
wants to merge
12
commits into
master
Choose a base branch
from
BTC-0.dot-wasm
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Remove ensureWasmInitialized() pattern (WASM loads synchronously in Node.js) - Fix import paths from ../pkg/wasm_dot to ./wasm/wasm_dot - Add fromInner() static method to DotTransaction for builder usage BTC-0
- Remove manual SCALE encoding fallback, always use metadata - Add clean call encoding via subxt dynamic API (calls.rs) - Implement batch support matching txwrapper-polkadot pattern - Make metadataHex required in Material type - Add builder tests with westend metadata fixture - Verify batch encoding matches standalone call encoding BTC-0
Replace manual base58 implementation with official bs58 crate for SS58 address encoding/decoding. This reduces code complexity and improves reliability by using a well-tested library matching the Substrate ecosystem.
481b7ac to
ede6160
Compare
Align field naming with BitGoJS Material interface so material objects can be passed directly without field mapping.
Replace manual byte concatenation with subxt-core APIs: - Add PreEncodedPayload wrapper implementing Payload trait - Use tx::create_partial_signed() + partial.signer_payload() for signable payload construction - Use partial.sign_with_address_and_signature() for signed tx creation - Use subxt_core::utils::Era for era encoding - Use PolkadotExtrinsicParamsBuilder for extrinsic params This ensures correct SCALE encoding and signed extension handling by leveraging the official substrate crate instead of custom code. BTC-0
- Add setNonce and setTip methods to DotTransaction JS bindings - Include era/nonce/tip in unsigned extrinsic bytes for roundtrip parsing - Enhance parser to extract era/nonce/tip from serialized unsigned txs - Update builder to encode era/nonce/tip inline in unsigned bytes - Rebuild tgz artifact
Replace instruction-based Transaction class design (copied from Solana) with DOT-specific DotTransaction class that models extrinsic structure: call data + envelope (nonce, tip, era). Add guidance that DOT uses extrinsic calls, not instructions. Update parse API reference to DotParser.parseTransactionHex() which is the actual implementation. BTC-0
Adds toBroadcastFormat() method to DotTransaction class, matching the standard BitGo convention used across all coins (e.g. wasm-solana). Delegates to toHex() since DOT broadcast format is hex-encoded SCALE. BTC-0
…saction() Export a standalone parseTransaction() function matching the pattern used by wasm-solana. Accepts Uint8Array, hex string, or DotTransaction object. Removes the DotParser class pattern. BTC-0
The WASM wrapper's addSignature(signature, pubkey) was passing args to the inner add_signature(pubkey, signature) without swapping order, causing "Public key must be 32 bytes, got 64" errors when the 64-byte signature was interpreted as the pubkey. Also adds DotParser as an alias for ParserNamespace to maintain backwards compatibility with consumers using the old export name. BTC-0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BTC-0