-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathget_signatures_for_address.go
37 lines (30 loc) · 1.64 KB
/
get_signatures_for_address.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package rpc
import (
"context"
)
type GetSignaturesForAddressResponse JsonRpcResponse[GetSignaturesForAddress]
type GetSignaturesForAddress []SignatureWithStatus
type SignatureWithStatus struct {
Signature string `json:"signature"`
Slot uint64 `json:"slot"`
BlockTime *int64 `json:"blockTime"`
Err any `json:"err"`
Memo *string `json:"memo"`
}
// GetSignaturesForAddressConfig is option config of `getSignaturesForAddress`
type GetSignaturesForAddressConfig struct {
Limit int `json:"limit,omitempty"` // between 1 and 1000, default: 1000
Before string `json:"before,omitempty"`
Until string `json:"until,omitempty"`
Commitment Commitment `json:"commitment,omitempty"` // "processed" is not supported, default is "finalized"
}
// GetSignaturesForAddress returns confirmed signatures for transactions involving an address backwards
// in time from the provided signature or most recent confirmed block
func (c *RpcClient) GetSignaturesForAddress(ctx context.Context, base58Addr string) (JsonRpcResponse[GetSignaturesForAddress], error) {
return call[JsonRpcResponse[GetSignaturesForAddress]](c, ctx, "getSignaturesForAddress", base58Addr)
}
// GetSignaturesForAddressWithConfig returns confirmed signatures for transactions involving an address backwards
// in time from the provided signature or most recent confirmed block
func (c *RpcClient) GetSignaturesForAddressWithConfig(ctx context.Context, base58Addr string, cfg GetSignaturesForAddressConfig) (JsonRpcResponse[GetSignaturesForAddress], error) {
return call[JsonRpcResponse[GetSignaturesForAddress]](c, ctx, "getSignaturesForAddress", base58Addr, cfg)
}