-
Notifications
You must be signed in to change notification settings - Fork 294
Add support for Tron staking #5972
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
base: master
Are you sure you want to change the base?
Conversation
f32b13c
to
8325c1f
Compare
6d8f7a6
to
b6a3a71
Compare
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.
Am yet to fully review this, but I think we should do the tx building here in SDK just like we do for all coins
this.transaction.setTransactionType(this.transactionType); | ||
} | ||
|
||
validateTransaction(transaction: Transaction | TransactionReceipt): void { |
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.
Why the type is transaction: Transaction | TransactionReceipt
, why not just transaction: Transaction
as in case of validateTransaction in other builder classes like ContractCallBuilder and TransactionBuilder
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.
For flexibility, because 2 paths are being checked: if its a txn object or if it's raw txn data
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 are we calling this from, can you point me to that? Is the type there Transaction | TransactionReceipt
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.
In the tests (resources file), the type is TransactionReceipt, but since we are overriding the method from the base class which uses Transaction object for validation, we would need to have Transaction | TransactionReceipt
@@ -10,6 +10,8 @@ import { ContractType } from './enum'; | |||
import { ContractCallBuilder } from './contractCallBuilder'; | |||
import { TransactionReceipt } from './iface'; | |||
import { TokenTransferBuilder } from './tokenTransferBuilder'; | |||
import { FreezeTransactionBuilder } from './freezeBuilder'; |
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.
import { FreezeBalanceTxBuilder } from './freezeBalanceTxBuilder';
@@ -10,6 +10,8 @@ import { ContractType } from './enum'; | |||
import { ContractCallBuilder } from './contractCallBuilder'; | |||
import { TransactionReceipt } from './iface'; | |||
import { TokenTransferBuilder } from './tokenTransferBuilder'; | |||
import { FreezeTransactionBuilder } from './freezeBuilder'; | |||
import { VoteBuilder } from './voteBuilder'; |
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.
import { VoteWitnessTxBuilder } from './voteWitnessTxBuilder';
* @param {Transaction} [tx] The transaction to initialize builder | ||
* @returns {FreezeTransactionBuilder} The specific freeze balance builder | ||
*/ | ||
getFreezeBuilder(tx?: TransactionReceipt | string): FreezeTransactionBuilder { |
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.
getFreezeBalanceTxBuilder
* @param {Transaction} [tx] The transaction to initialize builder | ||
* @returns {VoteBuilder} The specific vote witness builder | ||
*/ | ||
getVoteBuilder(tx?: TransactionReceipt | string): VoteBuilder { |
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.
getVoteWitnessBuilder
/** | ||
* Vote data in a vote transaction | ||
*/ | ||
export interface VoteData { |
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.
export interface VoteWitnessData
import { VoteBuilder } from '../../src/lib/voteBuilder'; | ||
import { validVoteUnsignedTx } from '../resources'; | ||
import { getBuilder } from '../../src/lib/builder'; | ||
import { TransactionType } from '@bitgo/sdk-core'; |
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.
external imports should be on top for better readability
import { FreezeTransactionBuilder, FreezeResource } from '../../src/lib/freezeBuilder'; | ||
import { validFreezeUnsignedTx } from '../resources'; | ||
import { getBuilder } from '../../src/lib/builder'; | ||
import { TransactionType } from '@bitgo/sdk-core'; |
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.
external imports should be on top for better readability
|
||
describe('Tron VoteBuilder', function () { | ||
let voteBuilder: VoteBuilder; | ||
let wrappedBuilder; |
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.
assign type
wrappedBuilder = getBuilder('ttrx'); | ||
// Get VoteBuilder from the wrapped builder | ||
voteBuilder = wrappedBuilder.getVoteBuilder(); | ||
}); |
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.
this should be in before
ENERGY = 'ENERGY', | ||
} | ||
|
||
interface RawContract { |
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.
RawFreezeContract
90d066b
to
425ff10
Compare
08d4521
to
69134ff
Compare
69134ff
to
bbe7aeb
Compare
TICKET: SC-1632
Adding support for freeze and vote transactions for validating the transaction built by the WP (which calls the respective rpc methods via IMS)