Skip to content

Commit

Permalink
Add GetTransactionDetailsWithReceipts
Browse files Browse the repository at this point in the history
  • Loading branch information
pustovalov committed Feb 27, 2024
1 parent 4b6bc27 commit 7cf57a2
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion near.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func (c *Connection) ViewAccessKeyList(accountID string) (map[string]interface{}
return r, nil
}

// GetTransaction returns information about a single transaction.
// GetTransactionDetails returns information about a single transaction.
//
// For details see
// https://docs.near.org/api/rpc/transactions#transaction-status
Expand All @@ -227,6 +227,26 @@ func (c *Connection) GetTransactionDetails(txHash, senderAccountId string) (map[
return r, nil
}

// GetTransactionDetailsWithReceipts returns information about a single transaction with receipts
//
// For details see
// https://docs.near.org/api/rpc/transactions#transaction-status-with-receipts
func (c *Connection) GetTransactionDetailsWithReceipts(txHash, senderAccountId string) (map[string]interface{}, error) {
params := []interface{}{txHash, senderAccountId}

res, err := c.call("EXPERIMENTAL_tx_status", params)
if err != nil {
return nil, err
}

r, ok := res.(map[string]interface{})
if !ok {
return nil, ErrNotObject
}

return r, nil
}

// GetTransactionLastResult decodes the last transaction result from a JSON
// map and tries to deterimine if we have an error condition.
func GetTransactionLastResult(txResult map[string]interface{}) (interface{}, error) {
Expand Down

0 comments on commit 7cf57a2

Please sign in to comment.