Error while running asMulti right after approveAsMulti
See original GitHub issueHello!
I am trying to execute a multisig transaction, as the documentation says first I run the method approveAsMulti and then asMulti using the index and the height from the approveAsMulti result as I show in the following snnipet:
const promise = new Promise((resolve, reject) => {
tx.signAndSend(buyerPair, ({ events = [], status }) => {
console.debug(`Status: ${status.type}`);
let index;
let blockHash;
if (status.isFinalized) {
// If there is any error make it readable
const filteredEvents = events.filter(
({ event: { section, method } }) =>
section === "system" && method === "ExtrinsicFailed"
);
filteredEvents.forEach(
({
event: {
data: [error, info],
},
}) => {
if (error.isModule) {
// for module errors, we have the section indexed, lookup
const decoded = api.registry.findMetaError(error.asModule);
const { documentation, method, section } = decoded;
console.log(`${section}.${method}: ${documentation.join(" ")}`);
} else {
// Other, CannotLookup, BadOrigin, no extra info
console.log(error.toString());
}
}
);
// If there is any error make it readable END
console.debug(`Hash: ${status.asFinalized}`);
blockHash = `${status.asFinalized}`;
events.forEach(({ phase, event: { data, method, section } }) => {
console.debug(`\t' ${phase}: ${section}.${method}:: ${data}`);
if (`${method}` === "NewMultisig") {
// I am not sure if this is the problem since from another examples I see that what is used for the index is phase._raw
// anyway in my case phase._raw is undefined.
index = parseInt(phase.index, 10);
}
console.debug("Transaction index:", index);
});
resolve({ index, blockHash });
}
});
});
const { index, blockHash } = await promise;
const signedBlock = await api.rpc.chain.getBlock(blockHash);
const height = parseInt(signedBlock.block.header.number, 10); //Remember parseInt does not default to base 10 :P
The above piece of code prints:
Hash: 0x4f37681d73f1641cb321b546158ca564a7159af1e41ea742397faa439322ed3f
Transaction index: 0
' {"ApplyExtrinsic":1}: treasury.Deposit:: [3209584075]
Transaction index: 0
' {"ApplyExtrinsic":1}: balances.Deposit:: ["5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY",802396019]
Transaction index: 0
' {"ApplyExtrinsic":1}: system.ExtrinsicSuccess:: [{"weight":215137000,"class":"Normal","paysFee":"Yes"}]
Transaction index: 0
The height property matches correctly with the hash block number, but the index is always 0, I guess that should be correct since I am testing in local nodes.
Then I perform an asMulti as following:
const transactions = api.tx.utility.batch(txs);
const multi_tx = api.tx.multisig.asMulti(
threshold,
otherSignatoriesSorted,
timepoint, // This is passed from the approveAsMulti { height: <the block number>, index: 0 }
transactions.method.hash,
false,
640000000
);
The above code prints:
RAW_ERROR=======> {
documentation: [ ' A timepoint was given, yet no multisig operation is underway.' ],
index: 11,
name: 'UnexpectedTimepoint',
section: 'multisig'
}
multisig.undefined: A timepoint was given, yet no multisig operation is underway.
Hash: 0xcf61df3889fb5729497993d436a5db37ad56ec6b9d36d264548e1d58eb47fc48
' {"ApplyExtrinsic":1}: treasury.Deposit:: [4257055399]
' {"ApplyExtrinsic":1}: balances.Deposit:: ["5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY",1064263850]
' {"ApplyExtrinsic":1}: system.ExtrinsicFailed:: [{"Module":{"index":31,"error":11}},{"weight":1097389000,"class":"Normal","paysFee":"Yes"}]
I am using the version:
"@polkadot/api": "^2.3.1"
At this point I am not really sure if there were any changes between versions that I am not addressing correctly.
Thanks, any help will be appreciated!
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Extrinsics - polkadot{.js}
If the close operation completes successfully with disapproval, the transaction fee will be waived. Otherwise execution of the approved operation will be ...
Read more >How to Create and Use Multisigs - YouTube
In this video you will learn about multi-signature accounts on Kusama and Polkadot, how to create them and how to use them.
Read more >Errors and How to Resolve Them - Polkadot Wiki
Here's how to find out the detailed error description through Polkadot-JS Apps. A typical failed transactions looks something like this: Error ...
Read more >Extrinsics | acala
The following sections contain Extrinsics methods are part of the default Substrate runtime. ... if replacement runners exists, they are immediately used.
Read more >How to get a detailed error for a Solang-compiled contract with ...
Currently it is not yet possible to view the error message directly in the polkadot.js UI. To see your error message from the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello @jacogr I finally was able to finish the transaction, the problem was on how the
asMulti
was receiving thetransactions.method.hash
Thanks for all your help!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.