-
Notifications
You must be signed in to change notification settings - Fork 1
/
ns_test.go
64 lines (58 loc) · 1.43 KB
/
ns_test.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
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
package tests
import (
"testing"
"github.com/bianjieai/avata-sdk-go/v3/models"
)
// 注册域名接口请求示例
func TestRegisterDomain(t *testing.T) {
params := &models.RegisterDomainReq{
Name: "v3-ns-test-sh-xss-s.w",
Owner: "0xfb74240135ebCf3bB56F1CDe680FB85bd36E71F9",
OperationID: "v3_TestRegisterDomain11ss2121",
Duration: 1,
}
result, err := client.NS.RegisterDomain(params)
if err != nil {
t.Log(err)
return
}
t.Logf("%+v \n", result)
}
// 查询域名接口请求示例
func TestQueryDomain(t *testing.T) {
params := &models.QueryDomainReq{
Name: "v3-ns-test",
}
result, err := client.NS.QueryDomain(params)
if err != nil {
t.Log(err)
return
}
t.Logf("%+v \n", result)
}
// 查询用户域名接口请求示例
func TestQueryDomains(t *testing.T) {
owner := "0xfb74240135ebCf3bB56F1CDe680FB85bd36E71F9"
params := &models.QueryDomainsReq{}
result, err := client.NS.QueryDomains(params, owner)
if err != nil {
t.Log(err)
return
}
t.Logf("%+v \n", result)
}
// 转让域名接口请求示例
func TestTransferDomin(t *testing.T) {
owner := "0xfb74240135ebCf3bB56F1CDe680FB85bd36E71F9"
name := "v3-ns-test-sh-x-s.w"
params := &models.TransferDomainReq{
OperationID: "v3_TestTransferDomin",
Recipient: "0x849Ed8726B6D755721b0EeAd2Ea5BA371f9E3c22",
}
result, err := client.NS.TransferDomain(params, owner, name)
if err != nil {
t.Log(err)
return
}
t.Logf("%+v \n", result)
}