Skip to content

Fix CI and add test for ERC721Transfers() #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
}