Skip to content

Commit

Permalink
RPC: Improve GetConfirmedTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
gagliardetto committed Jul 14, 2021
1 parent a1ab3ba commit f4fcaeb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rpc/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func TestClient_GetConfirmedTransaction(t *testing.T) {
signature, err := solana.SignatureFromBase58("53hoZ98EsCMA6L63GWM65M3Bd3WqA4LxD8bcJkbKoKWhbJFqX9M1WZ4fSjt8bYyZn21NwNnV2A25zirBni9Qk6LR")
require.NoError(t, err)

assert.Equal(t, TransactionWithMeta{
assert.Equal(t, &TransactionWithMeta{
Transaction: &solana.Transaction{
Message: solana.Message{
Header: solana.MessageHeader{NumRequiredSignatures: 1, NumReadonlySignedAccounts: 0, NumReadonlyUnsignedAccounts: 3},
Expand Down
8 changes: 7 additions & 1 deletion rpc/deprecated.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,16 @@ func (cl *Client) GetConfirmedBlock(
func (cl *Client) GetConfirmedTransaction(
ctx context.Context,
signature solana.Signature,
) (out TransactionWithMeta, err error) {
) (out *TransactionWithMeta, err error) {
params := []interface{}{signature, "json"}

err = cl.rpcClient.CallFor(&out, "getConfirmedTransaction", params)
if err != nil {
return nil, err
}
if out == nil {
return nil, ErrNotFound
}
return
}

Expand Down

0 comments on commit f4fcaeb

Please sign in to comment.