Skip to content

Commit 0158ce5

Browse files
authored
Merge pull request nanmu42#65 from nanmu42/nanmu
Fix CI and add test for ERC721Transfers()
2 parents 2ceb77c + 9e13132 commit 0158ce5

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

.github/workflows/ci.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ on:
1010

1111
jobs:
1212
build:
13+
environment: "CI Test"
1314
runs-on: ubuntu-latest
1415
steps:
1516
- uses: actions/checkout@v2
1617

1718
- name: Set up Go
1819
uses: actions/setup-go@v2
1920
with:
20-
go-version: "1.x"
21+
go-version: ">=1.17.4"
2122

2223
- name: Test
2324
env:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313

1414
# Output of the go coverage tool, specifically when used with LiteIDE
1515
*.out
16+
coverage.txt

account_e2e_test.go

+20
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
package etherscan
99

1010
import (
11+
"encoding/json"
12+
"fmt"
1113
"math/big"
1214
"testing"
1315
)
@@ -149,3 +151,21 @@ func TestClient_TokenBalance(t *testing.T) {
149151
t.Errorf("api.TokenBalance not working, got balance %s", balance.Int().String())
150152
}
151153
}
154+
155+
func TestClient_ERC721Transfers(t *testing.T) {
156+
const (
157+
wantLen = 351
158+
)
159+
160+
var a, b = 4708442, 9231168
161+
var contract, address = "0x06012c8cf97bead5deae237070f9587f8e7a266d", "0x6975be450864c02b4613023c2152ee0743572325"
162+
txs, err := api.ERC721Transfers(&contract, &address, &a, &b, 1, 500, true)
163+
noError(t, err, "api.ERC721Transfers")
164+
165+
j, _ := json.MarshalIndent(txs, "", " ")
166+
fmt.Printf("%s\n", j)
167+
168+
if len(txs) != wantLen {
169+
t.Errorf("got txs length %v, want %v", len(txs), wantLen)
170+
}
171+
}

0 commit comments

Comments
 (0)