Get Signatures For Address
Fetch tx histroy.
All
// get all (limit is between 1 ~ 1,000, default is 1,000)
{
res, err := c.GetSignaturesForAddress(context.Background(), target)
if err != nil {
log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
}
spew.Dump(res)
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Limit
// get latest X tx
{
res, err := c.GetSignaturesForAddressWithConfig(
context.Background(),
target,
rpc.GetSignaturesForAddressConfig{
Limit: 5,
},
)
if err != nil {
log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
}
spew.Dump(res)
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
Range
context:
/*
if a txhash list like:
(new)
3gwJwVorVprqZmm1ULAp9bKQy6sQ7skG11XYdMSQigA936MBANcSBy6NcNJF2yPf9ycgzZ6vFd4pjAY7qSko61Au
wTEnw3vpBthzLUD6gv9B3aC4dQNp4hews85ipM3w9MGZAh38HZ2im9LaWY7aRusVN5Wj33mNvqSRDNyC43u6GQs
3e6dRv5KnvpU43VjVjbsubvPR1yFK9b922WcTugyTBSdWdToeCK16NccSaxY6XJ5yi51UswP3ZDe3VJBZTVg2MCW
2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy
2uFaNDgQWZsgZvR6s3WQKwaCxFgS4ML7xrZyAqgmuTSEuGmrWyCcTrjtajr6baYR6FaVLZ4PWgyt55EmTcT8S7Sg
4XGVHHpLW99AUFEd6RivasG57vqu4EMMNdcQdmphepmW484dMYtWLkYw4nSNnSpKiDoYDbSu9ksxECNKBk2JEyHQ
3kjLJokcYqAhQjERCVutv5gdUuQ1HsxSCcFsJdQbqNkqd5ML8WRaZJguZgpWH8isCfyEN8YktxxPPNJURhAtvUKE
(old)
*/
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
Before
// you can fetch the last 3 tx by
{
res, err := c.GetSignaturesForAddressWithConfig(
context.Background(),
target,
rpc.GetSignaturesForAddressConfig{
Before: "2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy",
Limit: 3,
},
)
if err != nil {
log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
}
spew.Dump(res)
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Until
// you can fetch the latest 3 tx by `until`
// * the result will be different if there are some newer txs added.
{
res, err := c.GetSignaturesForAddressWithConfig(
context.Background(),
target,
rpc.GetSignaturesForAddressConfig{
Until: "2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy",
Limit: 3,
},
)
if err != nil {
log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
}
spew.Dump(res)
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Full Code
package main
import (
"context"
"log"
"github.com/blocto/solana-go-sdk/client"
"github.com/blocto/solana-go-sdk/rpc"
"github.com/davecgh/go-spew/spew"
)
func main() {
c := client.NewClient(rpc.DevnetRPCEndpoint)
target := "Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo"
// get all (limit is between 1 ~ 1,000, default is 1,000)
{
res, err := c.GetSignaturesForAddress(context.Background(), target)
if err != nil {
log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
}
spew.Dump(res)
}
// get latest X tx
{
res, err := c.GetSignaturesForAddressWithConfig(
context.Background(),
target,
rpc.GetSignaturesForAddressConfig{
Limit: 5,
},
)
if err != nil {
log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
}
spew.Dump(res)
}
/*
if a txhash list like:
(new)
3gwJwVorVprqZmm1ULAp9bKQy6sQ7skG11XYdMSQigA936MBANcSBy6NcNJF2yPf9ycgzZ6vFd4pjAY7qSko61Au
wTEnw3vpBthzLUD6gv9B3aC4dQNp4hews85ipM3w9MGZAh38HZ2im9LaWY7aRusVN5Wj33mNvqSRDNyC43u6GQs
3e6dRv5KnvpU43VjVjbsubvPR1yFK9b922WcTugyTBSdWdToeCK16NccSaxY6XJ5yi51UswP3ZDe3VJBZTVg2MCW
2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy
2uFaNDgQWZsgZvR6s3WQKwaCxFgS4ML7xrZyAqgmuTSEuGmrWyCcTrjtajr6baYR6FaVLZ4PWgyt55EmTcT8S7Sg
4XGVHHpLW99AUFEd6RivasG57vqu4EMMNdcQdmphepmW484dMYtWLkYw4nSNnSpKiDoYDbSu9ksxECNKBk2JEyHQ
3kjLJokcYqAhQjERCVutv5gdUuQ1HsxSCcFsJdQbqNkqd5ML8WRaZJguZgpWH8isCfyEN8YktxxPPNJURhAtvUKE
(old)
*/
// you can fetch the last 3 tx by
{
res, err := c.GetSignaturesForAddressWithConfig(
context.Background(),
target,
rpc.GetSignaturesForAddressConfig{
Before: "2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy",
Limit: 3,
},
)
if err != nil {
log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
}
spew.Dump(res)
}
// you can fetch the latest 3 tx by `until`
// * the result will be different if there are some newer txs added.
{
res, err := c.GetSignaturesForAddressWithConfig(
context.Background(),
target,
rpc.GetSignaturesForAddressConfig{
Until: "2nYnHvbVuwmYeara3VjoCt9uS8ZXrSra5DRK7QBT8i5acoBiSK3FQY2vsaDSJQ6QX5i1pkvyRRjL1oUATMLZEsqy",
Limit: 3,
},
)
if err != nil {
log.Fatalf("failed to GetSignaturesForAddress, err: %v", err)
}
spew.Dump(res)
}
}
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86