diff --git a/client/schema.go b/client/schema.go index bd49502..2800341 100644 --- a/client/schema.go +++ b/client/schema.go @@ -24,7 +24,7 @@ const ( const ( ActiveEventVersion int = 0 UnbondingEventVersion int = 0 - WithdrawEventVersion int = 0 + WithdrawEventVersion int = 1 ExpiredEventVersion int = 0 StatsEventVersion int = 1 BtcInfoEventVersion int = 0 @@ -132,9 +132,12 @@ func NewUnbondingStakingEvent( } type WithdrawStakingEvent struct { - SchemaVersion int `json:"schema_version"` - EventType EventType `json:"event_type"` // always 3. WithdrawStakingEventType - StakingTxHashHex string `json:"staking_tx_hash_hex"` + SchemaVersion int `json:"schema_version"` + EventType EventType `json:"event_type"` // always 3. WithdrawStakingEventType + StakingTxHashHex string `json:"staking_tx_hash_hex"` + WithdrawTxHashHex string `json:"withdraw_tx_hash_hex"` + WithdrawTxBtcHeight uint64 `json:"withdraw_tx_btc_height"` + WithdrawTxHex string `json:"withdraw_tx_hex"` } func (e WithdrawStakingEvent) GetEventType() EventType { @@ -145,11 +148,19 @@ func (e WithdrawStakingEvent) GetStakingTxHashHex() string { return e.StakingTxHashHex } -func NewWithdrawStakingEvent(stakingTxHashHex string) WithdrawStakingEvent { +func NewWithdrawStakingEvent( + stakingTxHashHex string, + withdrawTxHashHex string, + withdrawTxBtcHeight uint64, + withdrawTxHex string, +) WithdrawStakingEvent { return WithdrawStakingEvent{ - SchemaVersion: WithdrawEventVersion, - EventType: WithdrawStakingEventType, - StakingTxHashHex: stakingTxHashHex, + SchemaVersion: WithdrawEventVersion, + EventType: WithdrawStakingEventType, + StakingTxHashHex: stakingTxHashHex, + WithdrawTxHashHex: withdrawTxHashHex, + WithdrawTxBtcHeight: withdrawTxBtcHeight, + WithdrawTxHex: withdrawTxHex, } } diff --git a/tests/e2e_test.go b/tests/e2e_test.go index 818f103..fbf9678 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -189,7 +189,10 @@ func TestWithdrawEvent(t *testing.T) { err := json.Unmarshal([]byte(receivedEv.Body), &withdrawEv) require.NoError(t, err) require.Equal(t, ev, &withdrawEv) - require.Equal(t, 0, withdrawEv.SchemaVersion) + require.Equal(t, 1, withdrawEv.SchemaVersion) + require.NotZero(t, withdrawEv.WithdrawTxBtcHeight) + require.NotEmpty(t, withdrawEv.WithdrawTxHashHex) + require.NotEmpty(t, withdrawEv.WithdrawTxHex) } } diff --git a/tests/setup.go b/tests/setup.go index 740fdc5..83181d3 100644 --- a/tests/setup.go +++ b/tests/setup.go @@ -127,7 +127,10 @@ func buildNWithdrawEvents(numOfEvent int) []*client.WithdrawStakingEvent { var withdrawEvents []*client.WithdrawStakingEvent for i := 0; i < numOfEvent; i++ { withdrawEv := client.NewWithdrawStakingEvent( - "0x1234567890abcdef" + fmt.Sprint(i), + "0x1234567890abcdef"+fmt.Sprint(i), + "0xabcdef1234567890"+fmt.Sprint(i), + 100+uint64(i), + "0xghijkl1234567890"+fmt.Sprint(i), ) withdrawEvents = append(withdrawEvents, &withdrawEv) }