Skip to content

Commit

Permalink
Merge pull request #65 from nanmu42/nanmu
Browse files Browse the repository at this point in the history
Fix CI and add test for ERC721Transfers()
  • Loading branch information
nanmu42 authored Dec 5, 2021
2 parents 2ceb77c + 9e13132 commit 0158ce5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ on:

jobs:
build:
environment: "CI Test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.x"
go-version: ">=1.17.4"

- name: Test
env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
coverage.txt
20 changes: 20 additions & 0 deletions account_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
package etherscan

import (
"encoding/json"
"fmt"
"math/big"
"testing"
)
Expand Down Expand Up @@ -149,3 +151,21 @@ func TestClient_TokenBalance(t *testing.T) {
t.Errorf("api.TokenBalance not working, got balance %s", balance.Int().String())
}
}

func TestClient_ERC721Transfers(t *testing.T) {
const (
wantLen = 351
)

var a, b = 4708442, 9231168
var contract, address = "0x06012c8cf97bead5deae237070f9587f8e7a266d", "0x6975be450864c02b4613023c2152ee0743572325"
txs, err := api.ERC721Transfers(&contract, &address, &a, &b, 1, 500, true)
noError(t, err, "api.ERC721Transfers")

j, _ := json.MarshalIndent(txs, "", " ")
fmt.Printf("%s\n", j)

if len(txs) != wantLen {
t.Errorf("got txs length %v, want %v", len(txs), wantLen)
}
}

0 comments on commit 0158ce5

Please sign in to comment.