-
Notifications
You must be signed in to change notification settings - Fork 29
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
Support Chained Transactions #427
Conversation
…en building tx params
const rootWallet = new PrivateKeyWallet({ privateKey: testPrivateKey }) | ||
const wallet = PrivateKeyWallet.Random(group) | ||
const destinations = [{ address: wallet.address, attoAlphAmount: alphAmount }] | ||
await rootWallet.signAndSubmitTransferTx({ signerAddress: testAddress, destinations }) | ||
if (alphAmount > 0n) { | ||
const destinations = [{ address: wallet.address, attoAlphAmount: alphAmount }] | ||
await rootWallet.signAndSubmitTransferTx({ signerAddress: testAddress, destinations }) | ||
} | ||
return wallet |
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.
I cannot make sense of it as a newcomer, we sign the transfer with rootWallet
and return PrivateKeyWallet.Random(group)
which does not seem to hold any important information 🤔 How can we later use it to sign transactions? As we do signer1.publicKey
/ signer1.address
SOLVED: Sorry I understand now, it is a generator
if (alphAmount > 0n) { | ||
const destinations = [{ address: wallet.address, attoAlphAmount: alphAmount }] | ||
await rootWallet.signAndSubmitTransferTx({ signerAddress: testAddress, destinations }) | ||
} | ||
return wallet | ||
} catch (_) { | ||
throw new Error('Failed to get signer, please restart the devnet') |
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.
Please print the error cause it reveals the reason of failure :
} catch (error) {
throw new Error(`Failed to get signer, please restart the devnet due to : ${error}`)
}
Signer/support chained txs
@Lbqds Please give a final review on this new feature, thanks! |
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.
LGTM 👍
The chained transaction might be signed by multiple signers, so the interface currently looks like this. Please let me know if we can improve it: