From 4054d5f632ad1bf574ba54ef5415a03cfc386dc5 Mon Sep 17 00:00:00 2001 From: "a.h.babazadeh" Date: Thu, 31 Aug 2023 21:27:58 +0330 Subject: [PATCH] refactor: remove payload prefix from payload transaction type --- cmd/gtk/dialog_transaction_bond.go | 2 +- cmd/gtk/dialog_transaction_transfer.go | 2 +- execution/execution.go | 10 ++++----- state/mock.go | 10 ++++----- state/state.go | 10 ++++----- state/state_test.go | 22 +++++++++---------- txpool/pool.go | 30 +++++++++++++------------- types/tx/payload/bond.go | 2 +- types/tx/payload/bond_test.go | 2 +- types/tx/payload/payload.go | 22 +++++++++---------- types/tx/payload/sortition.go | 2 +- types/tx/payload/sortition_test.go | 2 +- types/tx/payload/transfer.go | 2 +- types/tx/payload/transfer_test.go | 2 +- types/tx/payload/unbond.go | 2 +- types/tx/payload/withdraw.go | 2 +- types/tx/tx.go | 22 +++++++++---------- wallet/tx_builder.go | 16 +++++++------- wallet/wallet.go | 8 +++---- wallet/wallet_test.go | 6 +++--- www/grpc/transaction.go | 10 ++++----- 21 files changed, 93 insertions(+), 93 deletions(-) diff --git a/cmd/gtk/dialog_transaction_bond.go b/cmd/gtk/dialog_transaction_bond.go index 42fe7dedc..71d676030 100644 --- a/cmd/gtk/dialog_transaction_bond.go +++ b/cmd/gtk/dialog_transaction_bond.go @@ -55,7 +55,7 @@ func broadcastTransactionBond(wallet *wallet.Wallet, valAddrs []crypto.Address) onAmountChanged := func() { amtStr, _ := amountEntry.GetText() - updateFeeHint(amountHint, amtStr, wallet, payload.PayloadTypeBond) + updateFeeHint(amountHint, amtStr, wallet, payload.TypeBond) } onSend := func() { diff --git a/cmd/gtk/dialog_transaction_transfer.go b/cmd/gtk/dialog_transaction_transfer.go index d93ca2090..cf048950e 100644 --- a/cmd/gtk/dialog_transaction_transfer.go +++ b/cmd/gtk/dialog_transaction_transfer.go @@ -47,7 +47,7 @@ func broadcastTransactionSend(wallet *wallet.Wallet) { onAmountChanged := func() { amtStr, _ := amountEntry.GetText() - updateFeeHint(amountHint, amtStr, wallet, payload.PayloadTypeTransfer) + updateFeeHint(amountHint, amtStr, wallet, payload.TypeTransfer) } onSend := func() { diff --git a/execution/execution.go b/execution/execution.go index 14ee52dd2..bf7c4841d 100644 --- a/execution/execution.go +++ b/execution/execution.go @@ -22,11 +22,11 @@ type Execution struct { func newExecution(strict bool) *Execution { execs := make(map[payload.Type]Executor) - execs[payload.PayloadTypeTransfer] = executor.NewTransferExecutor(strict) - execs[payload.PayloadTypeBond] = executor.NewBondExecutor(strict) - execs[payload.PayloadTypeSortition] = executor.NewSortitionExecutor(strict) - execs[payload.PayloadTypeUnbond] = executor.NewUnbondExecutor(strict) - execs[payload.PayloadTypeWithdraw] = executor.NewWithdrawExecutor(strict) + execs[payload.TypeTransfer] = executor.NewTransferExecutor(strict) + execs[payload.TypeBond] = executor.NewBondExecutor(strict) + execs[payload.TypeSortition] = executor.NewSortitionExecutor(strict) + execs[payload.TypeUnbound] = executor.NewUnbondExecutor(strict) + execs[payload.TypeWithdraw] = executor.NewWithdrawExecutor(strict) return &Execution{ executors: execs, diff --git a/state/mock.go b/state/mock.go index 5cbc4d66f..f57a9324a 100644 --- a/state/mock.go +++ b/state/mock.go @@ -240,15 +240,15 @@ func (m *MockState) Params() param.Params { func (m *MockState) CalculateFee(_ int64, payloadType payload.Type) (int64, error) { switch payloadType { - case payload.PayloadTypeTransfer, - payload.PayloadTypeBond, - payload.PayloadTypeWithdraw: + case payload.TypeTransfer, + payload.TypeBond, + payload.TypeWithdraw: { return m.ts.RandInt64(1e9), nil } - case payload.PayloadTypeUnbond, - payload.PayloadTypeSortition: + case payload.TypeUnbound, + payload.TypeSortition: { return 0, nil } diff --git a/state/state.go b/state/state.go index b82f10443..d5e3c1f92 100644 --- a/state/state.go +++ b/state/state.go @@ -715,15 +715,15 @@ func (st *state) publishEvents(height uint32, block *block.Block) { func (st *state) CalculateFee(amount int64, payloadType payload.Type) (int64, error) { switch payloadType { - case payload.PayloadTypeTransfer, - payload.PayloadTypeBond, - payload.PayloadTypeWithdraw: + case payload.TypeTransfer, + payload.TypeBond, + payload.TypeWithdraw: { return execution.CalculateFee(amount, st.params), nil } - case payload.PayloadTypeUnbond, - payload.PayloadTypeSortition: + case payload.TypeUnbound, + payload.TypeSortition: { return 0, nil } diff --git a/state/state_test.go b/state/state_test.go index d5af0c096..87413e8f5 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -755,20 +755,20 @@ func TestCalcFee(t *testing.T) { expectedFee int64 expectedErrCode int }{ - {1, payload.PayloadTypeTransfer, 1, td.state1.params.MinimumFee, errors.ErrInvalidFee}, - {1, payload.PayloadTypeWithdraw, 1001, td.state1.params.MinimumFee, errors.ErrInvalidFee}, - {1, payload.PayloadTypeBond, 1000, td.state1.params.MinimumFee, errors.ErrNone}, + {1, payload.TypeTransfer, 1, td.state1.params.MinimumFee, errors.ErrInvalidFee}, + {1, payload.TypeWithdraw, 1001, td.state1.params.MinimumFee, errors.ErrInvalidFee}, + {1, payload.TypeBond, 1000, td.state1.params.MinimumFee, errors.ErrNone}, - {1 * 1e9, payload.PayloadTypeTransfer, 1, 100000, errors.ErrInvalidFee}, - {1 * 1e9, payload.PayloadTypeWithdraw, 100001, 100000, errors.ErrInvalidFee}, - {1 * 1e9, payload.PayloadTypeBond, 100000, 100000, errors.ErrNone}, + {1 * 1e9, payload.TypeTransfer, 1, 100000, errors.ErrInvalidFee}, + {1 * 1e9, payload.TypeWithdraw, 100001, 100000, errors.ErrInvalidFee}, + {1 * 1e9, payload.TypeBond, 100000, 100000, errors.ErrNone}, - {1 * 1e12, payload.PayloadTypeTransfer, 1, 1000000, errors.ErrInvalidFee}, - {1 * 1e12, payload.PayloadTypeWithdraw, 1000001, 1000000, errors.ErrInvalidFee}, - {1 * 1e12, payload.PayloadTypeBond, 1000000, 1000000, errors.ErrNone}, + {1 * 1e12, payload.TypeTransfer, 1, 1000000, errors.ErrInvalidFee}, + {1 * 1e12, payload.TypeWithdraw, 1000001, 1000000, errors.ErrInvalidFee}, + {1 * 1e12, payload.TypeBond, 1000000, 1000000, errors.ErrNone}, - {1 * 1e12, payload.PayloadTypeSortition, 0, 0, errors.ErrInvalidFee}, - {1 * 1e12, payload.PayloadTypeUnbond, 0, 0, errors.ErrNone}, + {1 * 1e12, payload.TypeSortition, 0, 0, errors.ErrInvalidFee}, + {1 * 1e12, payload.TypeUnbound, 0, 0, errors.ErrNone}, } for _, test := range tests { fee, err := td.state2.CalculateFee(test.amount, test.pldType) diff --git a/txpool/pool.go b/txpool/pool.go index 3762b13c4..490941fe4 100644 --- a/txpool/pool.go +++ b/txpool/pool.go @@ -29,11 +29,11 @@ type txPool struct { func NewTxPool(conf *Config, broadcastCh chan message.Message) TxPool { pending := make(map[payload.Type]*linkedmap.LinkedMap[tx.ID, *tx.Tx]) - pending[payload.PayloadTypeTransfer] = linkedmap.NewLinkedMap[tx.ID, *tx.Tx](conf.sendPoolSize()) - pending[payload.PayloadTypeBond] = linkedmap.NewLinkedMap[tx.ID, *tx.Tx](conf.bondPoolSize()) - pending[payload.PayloadTypeUnbond] = linkedmap.NewLinkedMap[tx.ID, *tx.Tx](conf.unbondPoolSize()) - pending[payload.PayloadTypeWithdraw] = linkedmap.NewLinkedMap[tx.ID, *tx.Tx](conf.withdrawPoolSize()) - pending[payload.PayloadTypeSortition] = linkedmap.NewLinkedMap[tx.ID, *tx.Tx](conf.sortitionPoolSize()) + pending[payload.TypeTransfer] = linkedmap.NewLinkedMap[tx.ID, *tx.Tx](conf.sendPoolSize()) + pending[payload.TypeBond] = linkedmap.NewLinkedMap[tx.ID, *tx.Tx](conf.bondPoolSize()) + pending[payload.TypeUnbound] = linkedmap.NewLinkedMap[tx.ID, *tx.Tx](conf.unbondPoolSize()) + pending[payload.TypeWithdraw] = linkedmap.NewLinkedMap[tx.ID, *tx.Tx](conf.withdrawPoolSize()) + pending[payload.TypeSortition] = linkedmap.NewLinkedMap[tx.ID, *tx.Tx](conf.sortitionPoolSize()) pool := &txPool{ config: conf, @@ -152,31 +152,31 @@ func (p *txPool) PrepareBlockTransactions() block.Txs { defer p.lk.RUnlock() // Appending one sortition transaction - poolSortition := p.pools[payload.PayloadTypeSortition] + poolSortition := p.pools[payload.TypeSortition] for n := poolSortition.HeadNode(); n != nil; n = n.Next { trxs = append(trxs, n.Data.Value) } // Appending bond transactions - poolBond := p.pools[payload.PayloadTypeBond] + poolBond := p.pools[payload.TypeBond] for n := poolBond.HeadNode(); n != nil; n = n.Next { trxs = append(trxs, n.Data.Value) } // Appending unbond transactions - poolUnbond := p.pools[payload.PayloadTypeUnbond] + poolUnbond := p.pools[payload.TypeUnbound] for n := poolUnbond.HeadNode(); n != nil; n = n.Next { trxs = append(trxs, n.Data.Value) } // Appending withdraw transactions - poolWithdraw := p.pools[payload.PayloadTypeWithdraw] + poolWithdraw := p.pools[payload.TypeWithdraw] for n := poolWithdraw.HeadNode(); n != nil; n = n.Next { trxs = append(trxs, n.Data.Value) } // Appending transfer transactions - poolSend := p.pools[payload.PayloadTypeTransfer] + poolSend := p.pools[payload.TypeTransfer] for n := poolSend.HeadNode(); n != nil; n = n.Next { trxs = append(trxs, n.Data.Value) } @@ -210,10 +210,10 @@ func (p *txPool) Size() int { func (p *txPool) String() string { return fmt.Sprintf("{๐Ÿ’ธ %v ๐Ÿ” %v ๐Ÿ”“ %v ๐ŸŽฏ %v ๐Ÿงพ %v}", - p.pools[payload.PayloadTypeTransfer].Size(), - p.pools[payload.PayloadTypeBond].Size(), - p.pools[payload.PayloadTypeUnbond].Size(), - p.pools[payload.PayloadTypeSortition].Size(), - p.pools[payload.PayloadTypeWithdraw].Size(), + p.pools[payload.TypeTransfer].Size(), + p.pools[payload.TypeBond].Size(), + p.pools[payload.TypeUnbound].Size(), + p.pools[payload.TypeSortition].Size(), + p.pools[payload.TypeWithdraw].Size(), ) } diff --git a/types/tx/payload/bond.go b/types/tx/payload/bond.go index 9503e4bb6..cdd39e7db 100644 --- a/types/tx/payload/bond.go +++ b/types/tx/payload/bond.go @@ -18,7 +18,7 @@ type BondPayload struct { } func (p *BondPayload) Type() Type { - return PayloadTypeBond + return TypeBond } func (p *BondPayload) Signer() crypto.Address { diff --git a/types/tx/payload/bond_test.go b/types/tx/payload/bond_test.go index 3352041be..7d1ef780c 100644 --- a/types/tx/payload/bond_test.go +++ b/types/tx/payload/bond_test.go @@ -11,7 +11,7 @@ import ( func TestBondType(t *testing.T) { pld := BondPayload{} - assert.Equal(t, pld.Type(), PayloadTypeBond) + assert.Equal(t, pld.Type(), TypeBond) } func TestBondDecoding(t *testing.T) { diff --git a/types/tx/payload/payload.go b/types/tx/payload/payload.go index 5c3daa2b1..c9edc1bc4 100644 --- a/types/tx/payload/payload.go +++ b/types/tx/payload/payload.go @@ -10,24 +10,24 @@ import ( type Type uint8 const ( - PayloadTypeTransfer = Type(1) - PayloadTypeBond = Type(2) - PayloadTypeSortition = Type(3) - PayloadTypeUnbond = Type(4) - PayloadTypeWithdraw = Type(5) + TypeTransfer = Type(1) + TypeBond = Type(2) + TypeSortition = Type(3) + TypeUnbound = Type(4) + TypeWithdraw = Type(5) ) func (t Type) String() string { switch t { - case PayloadTypeTransfer: + case TypeTransfer: return "transfer" - case PayloadTypeBond: + case TypeBond: return "bond" - case PayloadTypeUnbond: - return "unbond" - case PayloadTypeWithdraw: + case TypeUnbound: + return "unbound" + case TypeWithdraw: return "withdraw" - case PayloadTypeSortition: + case TypeSortition: return "sortition" } return fmt.Sprintf("%d", t) diff --git a/types/tx/payload/sortition.go b/types/tx/payload/sortition.go index 33cae6402..cff82ed20 100644 --- a/types/tx/payload/sortition.go +++ b/types/tx/payload/sortition.go @@ -16,7 +16,7 @@ type SortitionPayload struct { } func (p *SortitionPayload) Type() Type { - return PayloadTypeSortition + return TypeSortition } func (p *SortitionPayload) Signer() crypto.Address { diff --git a/types/tx/payload/sortition_test.go b/types/tx/payload/sortition_test.go index 5e0d6be02..6bb3a0e2a 100644 --- a/types/tx/payload/sortition_test.go +++ b/types/tx/payload/sortition_test.go @@ -12,7 +12,7 @@ import ( func TestSortitionType(t *testing.T) { pld := SortitionPayload{} - assert.Equal(t, pld.Type(), PayloadTypeSortition) + assert.Equal(t, pld.Type(), TypeSortition) } func TestSortitionDecoding(t *testing.T) { diff --git a/types/tx/payload/transfer.go b/types/tx/payload/transfer.go index 62bf8eaec..60830f16a 100644 --- a/types/tx/payload/transfer.go +++ b/types/tx/payload/transfer.go @@ -15,7 +15,7 @@ type TransferPayload struct { } func (p *TransferPayload) Type() Type { - return PayloadTypeTransfer + return TypeTransfer } func (p *TransferPayload) Signer() crypto.Address { diff --git a/types/tx/payload/transfer_test.go b/types/tx/payload/transfer_test.go index 5569895f2..4b827aa79 100644 --- a/types/tx/payload/transfer_test.go +++ b/types/tx/payload/transfer_test.go @@ -12,7 +12,7 @@ import ( func TestTransferType(t *testing.T) { pld := TransferPayload{} - assert.Equal(t, pld.Type(), PayloadTypeTransfer) + assert.Equal(t, pld.Type(), TypeTransfer) } func TestTransferDecoding(t *testing.T) { diff --git a/types/tx/payload/unbond.go b/types/tx/payload/unbond.go index 3a714410d..0bde6bd43 100644 --- a/types/tx/payload/unbond.go +++ b/types/tx/payload/unbond.go @@ -14,7 +14,7 @@ type UnbondPayload struct { } func (p *UnbondPayload) Type() Type { - return PayloadTypeUnbond + return TypeUnbound } func (p *UnbondPayload) Signer() crypto.Address { diff --git a/types/tx/payload/withdraw.go b/types/tx/payload/withdraw.go index 70ec58be5..65179d902 100644 --- a/types/tx/payload/withdraw.go +++ b/types/tx/payload/withdraw.go @@ -16,7 +16,7 @@ type WithdrawPayload struct { } func (p *WithdrawPayload) Type() Type { - return PayloadTypeWithdraw + return TypeWithdraw } func (p *WithdrawPayload) Signer() crypto.Address { diff --git a/types/tx/tx.go b/types/tx/tx.go index 93d15012a..1384f06d0 100644 --- a/types/tx/tx.go +++ b/types/tx/tx.go @@ -335,15 +335,15 @@ func (tx *Tx) DecodeWithNoSignatory(r io.Reader) error { } switch payload.Type(payloadType) { - case payload.PayloadTypeTransfer: + case payload.TypeTransfer: tx.data.Payload = &payload.TransferPayload{} - case payload.PayloadTypeBond: + case payload.TypeBond: tx.data.Payload = &payload.BondPayload{} - case payload.PayloadTypeUnbond: + case payload.TypeUnbound: tx.data.Payload = &payload.UnbondPayload{} - case payload.PayloadTypeWithdraw: + case payload.TypeWithdraw: tx.data.Payload = &payload.WithdrawPayload{} - case payload.PayloadTypeSortition: + case payload.TypeSortition: tx.data.Payload = &payload.SortitionPayload{} default: @@ -412,29 +412,29 @@ func (tx *Tx) ID() ID { } func (tx *Tx) IsTransferTx() bool { - return tx.Payload().Type() == payload.PayloadTypeTransfer && + return tx.Payload().Type() == payload.TypeTransfer && !tx.data.Payload.Signer().EqualsTo(crypto.TreasuryAddress) } func (tx *Tx) IsBondTx() bool { - return tx.Payload().Type() == payload.PayloadTypeBond + return tx.Payload().Type() == payload.TypeBond } func (tx *Tx) IsSubsidyTx() bool { - return tx.Payload().Type() == payload.PayloadTypeTransfer && + return tx.Payload().Type() == payload.TypeTransfer && tx.data.Payload.Signer().EqualsTo(crypto.TreasuryAddress) } func (tx *Tx) IsSortitionTx() bool { - return tx.Payload().Type() == payload.PayloadTypeSortition + return tx.Payload().Type() == payload.TypeSortition } func (tx *Tx) IsUnbondTx() bool { - return tx.Payload().Type() == payload.PayloadTypeUnbond + return tx.Payload().Type() == payload.TypeUnbound } func (tx *Tx) IsWithdrawTx() bool { - return tx.Payload().Type() == payload.PayloadTypeWithdraw + return tx.Payload().Type() == payload.TypeWithdraw } // IsFreeTx will checks if transaction fee is 0. diff --git a/wallet/tx_builder.go b/wallet/tx_builder.go index f7e777006..f1db008dc 100644 --- a/wallet/tx_builder.go +++ b/wallet/tx_builder.go @@ -106,9 +106,9 @@ func (m *txBuilder) build() (*tx.Tx, error) { var trx *tx.Tx switch m.typ { - case payload.PayloadTypeTransfer: + case payload.TypeTransfer: trx = tx.NewTransferTx(*m.stamp, m.seq, *m.from, *m.to, m.amount, m.fee, m.memo) - case payload.PayloadTypeBond: + case payload.TypeBond: { pub := m.pub val, _ := m.client.getValidator(*m.to) @@ -118,9 +118,9 @@ func (m *txBuilder) build() (*tx.Tx, error) { } trx = tx.NewBondTx(*m.stamp, m.seq, *m.from, *m.to, pub, m.amount, m.fee, m.memo) } - case payload.PayloadTypeUnbond: + case payload.TypeUnbound: trx = tx.NewUnbondTx(*m.stamp, m.seq, *m.from, m.memo) - case payload.PayloadTypeWithdraw: + case payload.TypeWithdraw: trx = tx.NewWithdrawTx(*m.stamp, m.seq, *m.from, *m.to, m.amount, m.fee, m.memo) } @@ -150,8 +150,8 @@ func (m *txBuilder) setSequence() error { } switch m.typ { - case payload.PayloadTypeTransfer, - payload.PayloadTypeBond: + case payload.TypeTransfer, + payload.TypeBond: { acc, err := m.client.getAccount(*m.from) if err != nil { @@ -160,8 +160,8 @@ func (m *txBuilder) setSequence() error { m.seq = acc.Sequence + 1 } - case payload.PayloadTypeUnbond, - payload.PayloadTypeWithdraw: + case payload.TypeUnbound, + payload.TypeWithdraw: { val, err := m.client.getValidator(*m.from) if err != nil { diff --git a/wallet/wallet.go b/wallet/wallet.go index a4d545031..f722ffaba 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -299,7 +299,7 @@ func (w *Wallet) MakeTransferTx(sender, receiver string, amount int64, return nil, err } maker.amount = amount - maker.typ = payload.PayloadTypeTransfer + maker.typ = payload.TypeTransfer return maker.build() } @@ -334,7 +334,7 @@ func (w *Wallet) MakeBondTx(sender, receiver, pubKey string, amount int64, } } maker.amount = amount - maker.typ = payload.PayloadTypeBond + maker.typ = payload.TypeBond return maker.build() } @@ -349,7 +349,7 @@ func (w *Wallet) MakeUnbondTx(addr string, opts ...TxOption) (*tx.Tx, error) { if err != nil { return nil, err } - maker.typ = payload.PayloadTypeUnbond + maker.typ = payload.TypeUnbound return maker.build() } @@ -372,7 +372,7 @@ func (w *Wallet) MakeWithdrawTx(sender, receiver string, amount int64, return nil, err } maker.amount = amount - maker.typ = payload.PayloadTypeWithdraw + maker.typ = payload.TypeWithdraw return maker.build() } diff --git a/wallet/wallet_test.go b/wallet/wallet_test.go index 86e38fbfa..75d4e4efc 100644 --- a/wallet/wallet_test.go +++ b/wallet/wallet_test.go @@ -308,7 +308,7 @@ func TestMakeTransferTx(t *testing.T) { assert.NoError(t, err) assert.Equal(t, trx.Sequence(), seq+1) assert.Equal(t, trx.Payload().Value(), amount) - fee, err := td.wallet.CalculateFee(amount, payload.PayloadTypeTransfer) + fee, err := td.wallet.CalculateFee(amount, payload.TypeTransfer) assert.NoError(t, err) assert.Equal(t, trx.Fee(), fee) assert.Equal(t, trx.Stamp(), lastBlockHash.Stamp()) @@ -368,7 +368,7 @@ func TestMakeBondTx(t *testing.T) { assert.Equal(t, trx.Sequence(), seq+1) assert.True(t, trx.Payload().(*payload.BondPayload).PublicKey.EqualsTo(receiver.PublicKey())) assert.Equal(t, trx.Payload().Value(), amount) - fee, err := td.wallet.CalculateFee(amount, payload.PayloadTypeBond) + fee, err := td.wallet.CalculateFee(amount, payload.TypeBond) assert.NoError(t, err) assert.Equal(t, trx.Fee(), fee) assert.Equal(t, trx.Stamp(), lastBlockHash.Stamp()) @@ -540,7 +540,7 @@ func TestMakeWithdrawTx(t *testing.T) { assert.NoError(t, err) assert.Equal(t, trx.Sequence(), seq+1) assert.Equal(t, trx.Payload().Value(), amount) - fee, err := td.wallet.CalculateFee(amount, payload.PayloadTypeWithdraw) + fee, err := td.wallet.CalculateFee(amount, payload.TypeWithdraw) assert.NoError(t, err) assert.Equal(t, trx.Fee(), fee) assert.Equal(t, trx.Stamp(), lastBlockHash.Stamp()) diff --git a/www/grpc/transaction.go b/www/grpc/transaction.go index 1e6559bf8..b1b6729f9 100644 --- a/www/grpc/transaction.go +++ b/www/grpc/transaction.go @@ -100,7 +100,7 @@ func transactionToProto(trx *tx.Tx) *pactus.TransactionInfo { } switch trx.Payload().Type() { - case payload.PayloadTypeTransfer: + case payload.TypeTransfer: pld := trx.Payload().(*payload.TransferPayload) transaction.Payload = &pactus.TransactionInfo_Transfer{ Transfer: &pactus.PayloadTransfer{ @@ -109,7 +109,7 @@ func transactionToProto(trx *tx.Tx) *pactus.TransactionInfo { Amount: pld.Amount, }, } - case payload.PayloadTypeBond: + case payload.TypeBond: pld := trx.Payload().(*payload.BondPayload) transaction.Payload = &pactus.TransactionInfo_Bond{ Bond: &pactus.PayloadBond{ @@ -118,7 +118,7 @@ func transactionToProto(trx *tx.Tx) *pactus.TransactionInfo { Stake: pld.Stake, }, } - case payload.PayloadTypeSortition: + case payload.TypeSortition: pld := trx.Payload().(*payload.SortitionPayload) transaction.Payload = &pactus.TransactionInfo_Sortition{ Sortition: &pactus.PayloadSortition{ @@ -126,14 +126,14 @@ func transactionToProto(trx *tx.Tx) *pactus.TransactionInfo { Proof: pld.Proof[:], }, } - case payload.PayloadTypeUnbond: + case payload.TypeUnbound: pld := trx.Payload().(*payload.UnbondPayload) transaction.Payload = &pactus.TransactionInfo_Unbond{ Unbond: &pactus.PayloadUnbond{ Validator: pld.Validator.String(), }, } - case payload.PayloadTypeWithdraw: + case payload.TypeWithdraw: pld := trx.Payload().(*payload.WithdrawPayload) transaction.Payload = &pactus.TransactionInfo_Withdraw{ Withdraw: &pactus.PayloadWithdraw{