Skip to content

Commit

Permalink
Add GetTransactionDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
pustovalov committed Feb 9, 2024
1 parent 427f29e commit ba228e7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions near.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,26 @@ func (c *Connection) ViewAccessKeyList(accountID string) (map[string]interface{}
return r, nil
}

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

res, err := c.call("tx", 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 ba228e7

Please sign in to comment.