-
Notifications
You must be signed in to change notification settings - Fork 5
/
ContractTest.java
54 lines (50 loc) · 1.76 KB
/
ContractTest.java
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
package ai.bianjie.avatasdktest.evm;
import ai.bianjie.avatasdk.AvataClient;
import ai.bianjie.avatasdk.model.PublicResponse;
import ai.bianjie.avatasdk.model.evm.contract.ContractCallReq;
import ai.bianjie.avatasdk.model.evm.contract.QueryContractCallReq;
import ai.bianjie.avatasdk.model.evm.contract.QueryContractCallRes;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import ai.bianjie.avatasdktest.AvataClientTest;
public class ContractTest{
private AvataClient client;
@BeforeEach
public void init() {
client = AvataClientTest.getAvataClient();
}
@Test
//请求调用合约接口示例
void TestContractCall() {
ContractCallReq req = new ContractCallReq();
req.setFrom(""); // 域名拥有者地址
req.setTo(""); // 解析器合约地址
req.setData("");
req.setGasLimit(400000);
req.setEstimation(1);
req.setOperationId("");
try {
PublicResponse res = client.evm.contract.contractCall(req);
System.out.println(res.getData());
System.out.println("no ai.bianjie.avatasdk.exception");
} catch (Exception e) {
System.out.println(e);
e.printStackTrace();
}
}
@Test
//请求查询合约接口示例
void TestQueryContractCall() {
QueryContractCallReq req = new QueryContractCallReq();
req.setData("");
req.setTo("");
try {
QueryContractCallRes res = client.evm.contract.queryContractCall(req);
System.out.println(res.getData());
System.out.println("no ai.bianjie.avatasdk.exception");
} catch (Exception e) {
System.out.println(e);
e.printStackTrace();
}
}
}