This repository has been archived by the owner on Jun 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexincore_test.go
77 lines (68 loc) · 1.57 KB
/
exincore_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
65
66
67
68
69
70
71
72
73
74
75
76
77
package exincore_go
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"testing"
)
type keys struct {
MixinID string `json:"MixinId"`
ClientID string `json:"ClientId"`
ClientSecret string `json:"ClientSecret"`
Pin string `json:"Pin"`
PinToken string `json:"PinToken"`
SessionID string `json:"SessionId"`
PrivateKey string `json:"PrivateKey"`
}
func TestCreateOrder(t *testing.T) {
file, err := os.Open("key.txt")
if err != nil {
panic(err)
}
data, err := ioutil.ReadAll(file)
if err != nil {
log.Fatal(err)
}
var keys keys
err = json.Unmarshal(data, &keys)
if err != nil {
panic(err)
}
client := NewExinCoreClient(keys.ClientID, keys.SessionID, keys.Pin, keys.PinToken, keys.PrivateKey)
err = client.CreateOrder(context.TODO(), "815b0b1a-2764-3736-8faa-42d694fa620a", "43d61dcd-e413-450d-80b8-101d5e903357", "", 1)
if err != nil {
panic(err)
}
}
func TestReadPair(t *testing.T) {
base := "c94ac88f-4671-3976-b60a-09064f1811e8"
exchange := "c6d0c728-2624-429b-8e0d-d9d19b6592fa"
client := NewExinCoreClient("", "", "", "", "")
info, err := client.ReadPair(base, "")
if err != nil {
panic(err)
}
bytes, err := json.Marshal(*info)
if err != nil {
panic(err)
}
fmt.Printf("%s", bytes)
fmt.Println()
fmt.Println()
fmt.Println()
fmt.Println()
base = "c94ac88f-4671-3976-b60a-09064f1811e8"
exchange = "c6d0c728-2624-429b-8e0d-d9d19b6592fa"
info, err = client.ReadPair(base, exchange)
if err != nil {
panic(err)
}
bytes, err = json.Marshal(*info)
if err != nil {
panic(err)
}
fmt.Printf("%s", bytes)
}