Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/sdk-coin-dot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@bitgo/sdk-core": "^36.33.2",
"@bitgo/sdk-lib-mpc": "^10.9.0",
"@bitgo/statics": "^58.29.0",
"@bitgo/wasm-dot": "^1.3.0",
"@polkadot/api": "14.1.1",
"@polkadot/api-augment": "14.1.1",
"@polkadot/keyring": "13.5.6",
Expand Down
2 changes: 2 additions & 0 deletions modules/sdk-coin-dot/src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ export { TransactionBuilderFactory } from './transactionBuilderFactory';
export { SingletonRegistry } from './singletonRegistry';
export { NativeTransferBuilder } from './nativeTransferBuilder';
export { RemoveProxyBuilder } from './proxyBuilder';
export { explainDotTransaction } from './wasmParser';
export type { ExplainDotTransactionParams, DotWasmExplanation, DotInput } from './wasmParser';
export { Interface, Utils };
18 changes: 18 additions & 0 deletions modules/sdk-coin-dot/src/lib/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
} from './iface';
import { getAddress, getDelegateAddress } from './iface_utils';
import utils from './utils';
import { toJsonFromWasm } from './wasmParser';
import BigNumber from 'bignumber.js';
import { Vec } from '@polkadot/types';
import { PalletConstantMetadataV14 } from '@polkadot/types/interfaces';
Expand Down Expand Up @@ -161,6 +162,23 @@ export class Transaction extends BaseTransaction {
if (!this._dotTransaction) {
throw new InvalidTransactionError('Empty transaction');
}

// Use WASM-based parsing for signed tdot transactions.
// Only signed transactions produce a broadcast-ready extrinsic that the WASM
// parser can decode. Unsigned transactions produce a signing payload in a
// different format, so those continue to use the legacy txwrapper path.
// Mainnet dot stays on the legacy path until WASM validation is complete.
if (this._coinConfig.name === 'tdot' && this._signedTransaction) {
return toJsonFromWasm({
txHex: this._signedTransaction,
material: utils.getMaterial(this._coinConfig),
senderAddress: this._sender,
coinConfigName: this._coinConfig.name,
referenceBlock: this._dotTransaction.blockHash,
blockNumber: Number(this._dotTransaction.blockNumber),
});
}

const decodedTx = decode(this._dotTransaction, {
metadataRpc: this._dotTransaction.metadataRpc,
registry: this._registry,
Expand Down
Loading
Loading