diff --git a/programs/serum/rpc.go b/programs/serum/rpc.go index 8b810b6..52c0933 100644 --- a/programs/serum/rpc.go +++ b/programs/serum/rpc.go @@ -110,7 +110,7 @@ func StreamOpenOrders(client *ws.Client) error { if err != nil { return fmt.Errorf("received error from programID subscription: %w", err) } - res := d.(*ws.ProgramResult) + res := d var f *AccountFlag err = bin.NewDecoder(res.Value.Account.Data.GetBytes()).Decode(&f) diff --git a/rpc/ws/client_test.go b/rpc/ws/client_test.go index 4b272c3..5e4950c 100644 --- a/rpc/ws/client_test.go +++ b/rpc/ws/client_test.go @@ -45,10 +45,9 @@ func Test_AccountSubscribe(t *testing.T) { return } text.NewEncoder(os.Stdout).Encode(data, nil) - fmt.Println("OpenOrders: ", data.(*AccountResult).Value.Account.Owner) - fmt.Println("data: ", data.(*AccountResult).Value.Account.Data) + fmt.Println("OpenOrders: ", data.Value.Account.Owner) + fmt.Println("data: ", data.Value.Account.Data) return - } func Test_ProgramSubscribe(t *testing.T) { @@ -72,7 +71,7 @@ func Test_ProgramSubscribe(t *testing.T) { fmt.Println("receive an error: ", err) return } - fmt.Println("data received: ", data.(*ProgramResult).Value.Pubkey) + fmt.Println("data received: ", data.Value.Pubkey) } } @@ -93,7 +92,6 @@ func Test_SlotSubscribe(t *testing.T) { fmt.Println("receive an error: ", err) return } - fmt.Println("data received: ", data.(*SlotResult).Parent) + fmt.Println("data received: ", data.Parent) return - }