-
Notifications
You must be signed in to change notification settings - Fork 274
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
feat(ton): add single nominator withdraw txn #4923
feat(ton): add single nominator withdraw txn #4923
Conversation
587134c
to
845ce0a
Compare
54d7e50
to
a27999e
Compare
f57e2bc
to
bb33dea
Compare
send(recipient: Recipient): SingleNominatorWithdrawBuilder { | ||
this.transaction.recipient = recipient; | ||
return this; | ||
} |
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.
you need add a method for withdrawAmount, and build message payload internally. And return error if user is trying to set a message.
txBuilder.publicKey(testData.sender.publicKey); | ||
txBuilder.expireTime(1234567890); | ||
txBuilder.send(testData.recipients[0]); | ||
txBuilder.setWithdrawMessage('1'); |
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.
where to set withdraw amount
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 split the message creation into setWithdrawAmount
and setWithdrawMessage
functions
txBuilder.bounceable(true); | ||
const tx = await txBuilder.build(); | ||
should.equal(tx.type, TransactionType.SingleNominatorWithdraw); | ||
should.equal(tx.toJson().bounceable, true); |
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.
tx.toJson should have a withdraw amount decoded.
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.
added the checks
jsonTx.amount.should.equal('10000000'); | ||
jsonTx.seqno.should.equal(6); | ||
jsonTx.expirationTime.should.equal(1695997582); | ||
|
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.
you should add a withdraw amount in toJson and verify in this test.
}); | ||
|
||
it('should build a signed withdraw tx and submit onchain', async function () { | ||
const tonweb = new TonWeb(new TonWeb.HttpProvider('https://testnet.toncenter.com/api/v2/jsonRPC')); |
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.
disable this test for ci
const explainedTransaction = (await basecoin.explainTransaction({ | ||
txHex: Buffer.from(testData.signedTransferTransaction.tx, 'base64').toString('hex'), | ||
})) as TransactionExplanation; | ||
explainedTransaction.should.deepEqual({ |
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.
you need add withdraw amount to explainTransaction for single nominator transaction
bb33dea
to
bc9ec3b
Compare
bc9ec3b
to
1a410f4
Compare
1a410f4
to
f89be52
Compare
Ticket: SC-370
Add TON single nominator withdraw transaction