diff --git a/README.md b/README.md
index c6b4b54..5929bdf 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,10 @@
## 快速开始
+### SDK 介绍
+
+该 SDK 为 Avata v3 版本。 AVATA V3 是基于 v1 和 V2 两个版本,在产品架构、接口功能、核心服务、整体性能等方面都做了较大提升,同时兼容原生模块和智能合约模块;为 AVATA 平台用户提供多种功能与服务的组合使用,助力广大企业及开发者通过 AVATA 平台更加灵活便捷地对接底层链平台,打造开放多元的分布式商业应用。
+
### 引入依赖
```
@@ -15,17 +19,36 @@
### 创建和使用客户端
```
-ai.bianjie.avatasdk.AvataClient client = new ai.bianjie.avatasdk.AvataClient.Builder()
- .setDoMain("")
- .setApiKey("")
- .setApiSecret("")
- .setHttpTimeout(10000)
- .init();
+public class AvataClientTest {
+
+ public static AvataClient getAvataClient() {
+ return new AvataClient.Builder()
+ .setDomain("域名,不同环境对应不同的域名,如测试环境: https://stage.apis.avata.bianjie.ai")
+ .setApiKey("项目参数 API KEY")
+ .setApiSecret("项目参数 API SECRET")
+ .setHttpTimeout(10000)
+ .init();
+ }
+}
```
+公共接口:
+
+- [链账户接口示例代码](src/test/java/ai/bianjie/avatasdktest/AccountTest.java)
+- [钱包用户接口示例代码](src/test/java/ai/bianjie/avatasdktest/UserTest.java)
+- [充值接口示例代码](src/test/java/ai/bianjie/avatasdktest/OrderTest.java)
+
+原生接口:
+
+- [NFT 接口示例代码](src/test/java/ai/bianjie/avatasdktest/nat/NftTest.java)
+- [MT 接口示例代码](src/test/java/ai/bianjie/avatasdktest/nat/MtTest.java)
+- [存证接口示例代码](src/test/java/ai/bianjie/avatasdktest/nat/RecordsTest.java)
+- [交易结果查询接口示例代码](src/test/java/ai/bianjie/avatasdktest/nat/TxTest.java)
+
+智能合约接口:
+
+- [NFT 接口示例代码](src/test/java/ai/bianjie/avatasdktest/evm/NftTest.java)
+- [Web3 域名服务接口示例代码](src/test/java/ai/bianjie/avatasdktest/evm/NsTest.java)
+- [智能合约服务接口示例代码](src/test/java/ai/bianjie/avatasdktest/evm/ContractTest.java)
+- [交易结果查询接口示例代码](src/test/java/ai/bianjie/avatasdktest/evm/TxTest.java)
-- [链账户接口示例代码](./src/test/java/AccountTest.java)
-- [交易结果查询接口示例代码](./src/test/java/TxTest.java)
-- [NFT 接口示例代码](./src/test/java/NftTest.java)
-- [MT 接口示例代码](./src/test/java/MtTest.java)
-- [充值接口示例代码](./src/test/java/OrderTest.java)
-- [存证接口示例代码](./src/test/java/RecordTest.java)
\ No newline at end of file
+[回调服务示例代码](src/test/java/ai/bianjie/avatasdktest/CallbackTest.java)
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 130c65e..3fec044 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,7 +56,12 @@
test
-
+
+ javax.servlet
+ servlet-api
+ 2.5
+ provided
+
com.squareup.okhttp3
diff --git a/src/main/java/ai/bianjie/avatasdk/AvataClient.java b/src/main/java/ai/bianjie/avatasdk/AvataClient.java
index 6b5e604..ccb705a 100644
--- a/src/main/java/ai/bianjie/avatasdk/AvataClient.java
+++ b/src/main/java/ai/bianjie/avatasdk/AvataClient.java
@@ -2,26 +2,25 @@
import ai.bianjie.avatasdk.config.ConfigInfo;
import ai.bianjie.avatasdk.exception.AvataException;
-import ai.bianjie.avatasdk.proxy.account.impl.AccountClient;
-import ai.bianjie.avatasdk.proxy.mt.impl.MtClient;
-import ai.bianjie.avatasdk.proxy.nft.impl.NftClient;
-import ai.bianjie.avatasdk.proxy.order.impl.OrderClient;
-import ai.bianjie.avatasdk.proxy.record.impl.RecordClient;
-import ai.bianjie.avatasdk.proxy.tx.impl.TxClient;
+import ai.bianjie.avatasdk.proxy.account.impl.Account;
+import ai.bianjie.avatasdk.proxy.order.impl.Order;
+import ai.bianjie.avatasdk.proxy.user.impl.User;
+import ai.bianjie.avatasdk.util.HttpClient;
import com.dtflys.forest.Forest;
import com.dtflys.forest.config.ForestConfiguration;
import com.dtflys.forest.http.ForestAsyncMode;
import com.dtflys.forest.retryer.BackOffRetryer;
import com.dtflys.forest.ssl.SSLUtils;
import com.dtflys.forest.utils.StringUtils;
+import lombok.Data;
public class AvataClient {
- public NftClient nftClient;
- public AccountClient accountClient;
- public MtClient mtClient;
- public OrderClient orderClient;
- public RecordClient recordsClient;
- public TxClient txClient;
+
+ public Account account;
+ public Order order;
+ public User user;
+ public Native nat;
+ public Evm evm;
/**
* SDK initialization method
@@ -33,14 +32,15 @@ private AvataClient(Builder builder) {
configInfo.setApiSecret(builder.apiSecret);
configInfo.setHttpTimeout(builder.httpTimeout);
- this.accountClient = new AccountClient(configInfo);
- this.nftClient = new NftClient(configInfo);
- this.mtClient = new MtClient(configInfo);
- this.orderClient = new OrderClient(configInfo);
- this.recordsClient = new RecordClient(configInfo);
- this.txClient = new TxClient(configInfo);
+ HttpClient httpClient = new HttpClient(configInfo);
+ this.account = new Account(httpClient);
+ this.order = new Order(httpClient);
+ this.user = new User(httpClient);
+ this.nat = new Native(httpClient);
+ this.evm = new Evm(httpClient);
}
+ @Data
public static class Builder {
private String domain;
private String apiKey;
@@ -126,3 +126,7 @@ public AvataClient init() {
}
}
}
+
+
+
+
diff --git a/src/main/java/ai/bianjie/avatasdk/Evm.java b/src/main/java/ai/bianjie/avatasdk/Evm.java
new file mode 100644
index 0000000..62c4ea9
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/Evm.java
@@ -0,0 +1,25 @@
+package ai.bianjie.avatasdk;
+
+import ai.bianjie.avatasdk.proxy.evm.contract.impl.Contract;
+import ai.bianjie.avatasdk.proxy.evm.nft.impl.Nft;
+import ai.bianjie.avatasdk.proxy.evm.ns.impl.Ns;
+import ai.bianjie.avatasdk.proxy.evm.tx.impl.Tx;
+import ai.bianjie.avatasdk.util.HttpClient;
+
+public class Evm {
+
+ public Nft nft;
+ public Tx tx;
+ public Contract contract;
+ public Ns ns;
+
+ /**
+ * SDK initialization method
+ */
+ public Evm(HttpClient httpClient) {
+ this.nft = new Nft(httpClient);
+ this.tx = new Tx(httpClient);
+ this.contract = new Contract(httpClient);
+ this.ns = new Ns(httpClient);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/ai/bianjie/avatasdk/Native.java b/src/main/java/ai/bianjie/avatasdk/Native.java
new file mode 100644
index 0000000..4a7d79c
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/Native.java
@@ -0,0 +1,25 @@
+package ai.bianjie.avatasdk;
+
+import ai.bianjie.avatasdk.proxy.nat.mt.impl.Mt;
+import ai.bianjie.avatasdk.proxy.nat.nft.impl.Nft;
+import ai.bianjie.avatasdk.proxy.nat.records.impl.Records;
+import ai.bianjie.avatasdk.proxy.nat.tx.impl.Tx;
+import ai.bianjie.avatasdk.util.HttpClient;
+
+public class Native {
+
+ public Nft nft;
+ public Mt mt;
+ public Records records;
+ public Tx tx;
+
+ /**
+ * SDK initialization method
+ */
+ public Native(HttpClient httpClient) {
+ this.nft = new Nft(httpClient);
+ this.mt = new Mt(httpClient);
+ this.records = new Records(httpClient);
+ this.tx = new Tx(httpClient);
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/config/ConfigInfo.java b/src/main/java/ai/bianjie/avatasdk/config/ConfigInfo.java
index 1e7f5cd..76fcb81 100644
--- a/src/main/java/ai/bianjie/avatasdk/config/ConfigInfo.java
+++ b/src/main/java/ai/bianjie/avatasdk/config/ConfigInfo.java
@@ -4,19 +4,16 @@
/**
* 配置项
- *
- * @author sxj
*/
@Data
public class ConfigInfo {
- private String doMain;
+ private String doMain; // 域名
- private String apiKey;
+ private String apiKey; // 项目参数 API KEY
- private String apiSecret;
-
- private Integer httpTimeout;
+ private String apiSecret; // 项目参数 API SECRET
+ private Integer httpTimeout; // 响应超时时间
public ConfigInfo() {
/**
diff --git a/src/main/java/ai/bianjie/avatasdk/exception/AvataException.java b/src/main/java/ai/bianjie/avatasdk/exception/AvataException.java
index 2527b29..c93060d 100644
--- a/src/main/java/ai/bianjie/avatasdk/exception/AvataException.java
+++ b/src/main/java/ai/bianjie/avatasdk/exception/AvataException.java
@@ -5,8 +5,6 @@
/**
* SDK custom ai.bianjie.avatasdk.exception
- *
- * @author sxj
*/
@Data
public class AvataException extends RuntimeException {
@@ -23,9 +21,9 @@ public class AvataException extends RuntimeException {
public static final String ErrAPISecret = "the api secret the project is required";
public static final String ErrAmount = "amount should be integer yuan";
- private final String codeSpace;
- private final String code;
- private final String message;
+ private final String codeSpace; // 命名空间
+ private final String code; // 错误码
+ private final String message; // 错误描述
public AvataException(String code, String codeSpace, String message) {
super(message);
diff --git a/src/main/java/ai/bianjie/avatasdk/model/ErrorResponse.java b/src/main/java/ai/bianjie/avatasdk/model/ErrorResponse.java
index 583ff5d..7bb31ab 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/ErrorResponse.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/ErrorResponse.java
@@ -13,11 +13,11 @@ public class ErrorResponse {
@NoArgsConstructor
@Data
public static class AvataError {
- @JSONField(name = "code")
- private String code;
@JSONField(name = "code_space")
- private String codeSpace;
+ private String codeSpace; // 命名空间
+ @JSONField(name = "code")
+ private String code;// 错误码
@JSONField(name = "message")
- private String message;
+ private String message;// 错误描述
}
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/PublicResponse.java b/src/main/java/ai/bianjie/avatasdk/model/PublicResponse.java
index c1eff5b..7573af3 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/PublicResponse.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/PublicResponse.java
@@ -13,8 +13,5 @@ public class PublicResponse {
@NoArgsConstructor
@Data
- public static class DataDTO {
- @JSONField(name = "operation_id")
- private String operationId;
- }
+ public static class DataDTO { }
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/account/BatchCreateAccountReq.java b/src/main/java/ai/bianjie/avatasdk/model/account/BatchCreateAccountReq.java
index 4f61221..8675e9a 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/account/BatchCreateAccountReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/account/BatchCreateAccountReq.java
@@ -6,15 +6,13 @@
/**
* 批量创建链账户请求体
- *
- * @author sxj
*/
@NoArgsConstructor
@Data
public class BatchCreateAccountReq {
@JSONField(name = "count")
- private Integer count;//批量创建链账户的数量
+ private Integer count;// 批量创建链账户的数量
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串组成。此操作 ID 仅限在查询链账户接口中使用,用于查询创建链账户的授权状态。
diff --git a/src/main/java/ai/bianjie/avatasdk/model/account/BatchCreateAccountRes.java b/src/main/java/ai/bianjie/avatasdk/model/account/BatchCreateAccountRes.java
index fb103d4..fab9882 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/account/BatchCreateAccountRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/account/BatchCreateAccountRes.java
@@ -6,6 +6,9 @@
import java.util.List;
+/**
+ * 批量创建链账户正确返回值
+ */
@NoArgsConstructor
@Data
public class BatchCreateAccountRes {
@@ -16,9 +19,20 @@ public class BatchCreateAccountRes {
@NoArgsConstructor
@Data
public static class DataDTO {
- @JSONField(name = "accounts")
- private List accounts;// 链账户地址列表
- @JSONField(name = "operation_id")
- private String operationId;// 操作 ID。此操作 ID 仅限在查询链账户接口中使用,用于查询创建链账户的授权状态。
+
+ @JSONField(name = "addresses")
+ private List addresses;// 链账户地址列表
+
+ @NoArgsConstructor
+ @Data
+ public static class AccountsDTO {
+
+ @JSONField(name = "native_address")
+ private String nativeAddress;// 原生地址格式
+
+ @JSONField(name = "hex_address")
+ private String hexAddress;// 以太坊地址格式
+
+ }
}
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/account/CreateAccountReq.java b/src/main/java/ai/bianjie/avatasdk/model/account/CreateAccountReq.java
index a816cd6..18ec64d 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/account/CreateAccountReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/account/CreateAccountReq.java
@@ -4,6 +4,9 @@
import lombok.Data;
import lombok.NoArgsConstructor;
+/**
+ * 创建链账户请求体
+ */
@NoArgsConstructor
@Data
public class CreateAccountReq {
@@ -11,6 +14,9 @@ public class CreateAccountReq {
@JSONField(name = "name")
private String name;// 链账户名称,支持 1-20 位汉字、大小写字母及数字组成的字符串
+ @JSONField(name = "user_id")
+ private String userId;// 此字段针对区块链钱包应用项目设置,通过区块链钱包给某一具体终端用户创建链账户地址时,必需传入该字段。该字段值是由「创建用户」接口返回。
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串组成。此操作 ID 仅限在查询链账户接口中使用,用于查询创建链账户的授权状态。
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/account/CreateAccountRes.java b/src/main/java/ai/bianjie/avatasdk/model/account/CreateAccountRes.java
index dccba62..1f8664e 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/account/CreateAccountRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/account/CreateAccountRes.java
@@ -4,6 +4,9 @@
import lombok.Data;
import lombok.NoArgsConstructor;
+/**
+ * 创建链账户正确返回值
+ */
@NoArgsConstructor
@Data
public class CreateAccountRes {
@@ -14,11 +17,13 @@ public class CreateAccountRes {
@NoArgsConstructor
@Data
public static class DataDTO {
- @JSONField(name = "account")
- private String account;// 链账户地址
- @JSONField(name = "name")
- private String name;// 链账户名称
- @JSONField(name = "operation_id")
- private String operationId;// 操作 ID。此操作 ID 仅限在查询链账户接口中使用,用于查询创建链账户的授权状态。
+
+ @JSONField(name = "native_address")
+ private String nativeAddress;// 原生地址格式
+
+ @JSONField(name = "hex_address")
+ private String hexAddress;// 以太坊地址格式
+
}
}
+
diff --git a/src/main/java/ai/bianjie/avatasdk/model/account/QueryAccountsHistoryReq.java b/src/main/java/ai/bianjie/avatasdk/model/account/QueryAccountsHistoryReq.java
index e4cccbf..d674024 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/account/QueryAccountsHistoryReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/account/QueryAccountsHistoryReq.java
@@ -4,25 +4,39 @@
import lombok.Data;
import lombok.NoArgsConstructor;
+/**
+ * 查询链账户操作记录请求体
+ */
@NoArgsConstructor
@Data
public class QueryAccountsHistoryReq {
- @JSONField(name = "offset")
- private String offset;// 游标,默认为 0
+ @JSONField(name = "page_key")
+ private String pageKey;// 分页数据的Key, Avata会根据该值进行上下页的查询, 该值请从返回的数据体中获取,首页查询可以不传该参数
+
@JSONField(name = "limit")
private String limit;// 每页记录数,默认为 10,上限为 50
+
@JSONField(name = "account")
private String account;// 链账户地址
+
@JSONField(name = "module")
- private String module;// 功能模块;Enum: "nft" "mt"
+ private String module;// 功能模块:请通过 查询枚举值列表 接口查看
+
@JSONField(name = "operation")
- private String operation;// 操作类型,仅 module 不为空时有效,默认为 "all"。 module = nft 时,可选:issue_class / transfer_class / mint / edit / transfer / burn; module = mt 时,可选: issue_class / transfer_class / issue / mint / edit / transfer / burn。
+ private String operation; //操作类型,仅 module 不为空时有效,默认为:"0"(all)。请通过 查询枚举值列表 接口查看
+
@JSONField(name = "tx_hash")
private String txHash;// Tx Hash
+
@JSONField(name = "start_date")
private String startDate;// 日期范围 - 开始,yyyy-MM-dd(UTC 时间)
+
@JSONField(name = "end_date")
private String endDate;// 日期范围 - 结束,yyyy-MM-dd(UTC 时间)
+
@JSONField(name = "sort_by")
private String sortBy;// 排序规则:DATE_ASC / DATE_DESC
+
+ @JSONField(name = "count_total")
+ private String countTotal;// 是否查询数据的总数量 0:不查询总数(默认)1:查询总数
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/account/QueryAccountsHistoryRes.java b/src/main/java/ai/bianjie/avatasdk/model/account/QueryAccountsHistoryRes.java
deleted file mode 100644
index d1b8c68..0000000
--- a/src/main/java/ai/bianjie/avatasdk/model/account/QueryAccountsHistoryRes.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package ai.bianjie.avatasdk.model.account;
-
-import com.alibaba.fastjson.annotation.JSONField;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.util.List;
-
-@NoArgsConstructor
-@Data
-public class QueryAccountsHistoryRes {
-
-
- @JSONField(name = "data")
- private DataDTO data;
-
- @NoArgsConstructor
- @Data
- public static class DataDTO {
- @JSONField(name = "offset")
- private Integer offset;// 游标
- @JSONField(name = "limit")
- private Integer limit;// 每页记录数
- @JSONField(name = "total_count")
- private Integer totalCount;// 总记录数
- @JSONField(name = "operation_records")
- private List operationRecords;// 操作记录列表
-
- @NoArgsConstructor
- @Data
- public static class OperationRecordsDTO {
- @JSONField(name = "tx_hash")
- private String txHash;// 操作 Tx Hash
- @JSONField(name = "module")
- private String module;// 功能模块;Enum: "nft" "mt"
- @JSONField(name = "operation")
- private String operation;// 操作类型;Enum: "issue_class" "transfer_class" "mint" "edit" "transfer" "burn" "issue"
- @JSONField(name = "signer")
- private String signer;// Tx 签名者地址
- @JSONField(name = "timestamp")
- private String timestamp;// 操作时间戳(UTC 时间)
- @JSONField(name = "gas_fee")
- private Integer gasFee;// 链上交易消耗的能量值;当前支持查询 2022 年 08 月 18 日 11:00:00(UTC 时间) 底层链升级固定 Gas 之后的数据,其它历史数据已归档,暂不支持查询对应结果
- @JSONField(name = "business_fee")
- private Integer businessFee;// 链上交易消耗的业务费
- @JSONField(name = "nft_msg")
- private DataDTO.OperationRecordsDTO.NftMsgDTO nftMsg;// 具体参考接口文档
- @JSONField(name = "mt_msg")
- private DataDTO.OperationRecordsDTO.MtMsgDTO mtMsg;// 具体参考接口文档
-
- @NoArgsConstructor
- @Data
- public static class NftMsgDTO {
- @JSONField(name = "id")
- private String id;
- @JSONField(name = "name")
- private String name;
- @JSONField(name = "class_id")
- private String classId;
- @JSONField(name = "class_name")
- private String className;
- @JSONField(name = "class_symbol")
- private String classSymbol;
- @JSONField(name = "symbol")
- private String symbol;
- @JSONField(name = "uri")
- private String uri;
- @JSONField(name = "recipient")
- private String recipient;
- }
-
- @NoArgsConstructor
- @Data
- public static class MtMsgDTO {
- @JSONField(name = "id")
- private String id;
- @JSONField(name = "class_id")
- private String classId;
- @JSONField(name = "class_name")
- private String className;
- @JSONField(name = "name")
- private String name;
- @JSONField(name = "recipient")
- private String recipient;
- @JSONField(name = "amount")
- private Integer amount;
- }
- }
- }
-}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/account/QueryAccountsReq.java b/src/main/java/ai/bianjie/avatasdk/model/account/QueryAccountsReq.java
index cfcf2d5..a4f1570 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/account/QueryAccountsReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/account/QueryAccountsReq.java
@@ -4,23 +4,36 @@
import lombok.Data;
import lombok.NoArgsConstructor;
+/**
+ * 查询链账户请求体
+ */
@NoArgsConstructor
@Data
public class QueryAccountsReq {
- @JSONField(name = "offset")
- private String offset;// 游标,默认为 0
+ @JSONField(name = "page_key")
+ private String pageKey;// 分页数据的Key, Avata会根据该值进行上下页的查询, 该值请从返回的数据体中获取,首页查询可以不传该参数
+
@JSONField(name = "limit")
private String limit;// 每页记录数,默认为 10,上限为 50
+
@JSONField(name = "account")
private String account;// 链账户地址
+
@JSONField(name = "name")
private String name;// 链账户名称,支持模糊查询
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID。此操作 ID 需要填写在请求创建链账户/批量创建链账户接口时,返回的 Operation ID。
+
@JSONField(name = "start_date")
private String startDate;// 创建日期范围 - 开始,yyyy-MM-dd(UTC 时间)
+
@JSONField(name = "end_date")
private String endDate;// 创建日期范围 - 结束,yyyy-MM-dd(UTC 时间)
+
@JSONField(name = "sort_by")
private String sortBy;// 排序规则:DATE_ASC / DATE_DESC
+
+ @JSONField(name = "count_total")
+ private String countTotal; // 是否查询数据的总数量 0:不查询总数(默认) 1:查询总数
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/account/QueryAccountsRes.java b/src/main/java/ai/bianjie/avatasdk/model/account/QueryAccountsRes.java
index a5de1f5..ac5cfb2 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/account/QueryAccountsRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/account/QueryAccountsRes.java
@@ -6,6 +6,9 @@
import java.util.List;
+/**
+ * 查询链账户正确返回值
+ */
@NoArgsConstructor
@Data
public class QueryAccountsRes {
@@ -16,30 +19,42 @@ public class QueryAccountsRes {
@NoArgsConstructor
@Data
public static class DataDTO {
- @JSONField(name = "offset")
- private Integer offset;// 游标
+
+ @JSONField(name = "prev_page_key")
+ private String prevPageKey;// 上一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "next_page_key")
+ private String nextPageKey;// 下一页数据的Key, Avata会根据该值进行上一页数据的查询
+
@JSONField(name = "limit")
private Integer limit;// 每页记录数
+
@JSONField(name = "total_count")
private Integer totalCount;// 总记录数
+
@JSONField(name = "accounts")
private List accounts;// 链账户列表
@NoArgsConstructor
@Data
public static class AccountsDTO {
- @JSONField(name = "account")
- private String account;// 链账户地址
+
+ @JSONField(name = "native_address")
+ private String nativeAddress;// 原生地址格式
+
+ @JSONField(name = "hex_address")
+ private String hexAddress;// 以太坊地址格式
+
@JSONField(name = "name")
private String name;// 链账户名称
- @JSONField(name = "gas")
- private Integer gas;// 文昌链能量值余额
- @JSONField(name = "biz_fee")
- private Integer bizFee;// 文昌链 DDC 业务费余额,单位:分
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID
- @JSONField(name = "status")
- private Integer status;// Enum: 0,1;链账户的授权状态,0 未授权;1 已授权。链账户授权成功后,可使用该链账户地址发起上链交易请求;未授权时不影响作为交易的接受者地址进行使用(DDC 业务除外)。
+
+ @JSONField(name = "read_only")
+ private String readOnly;// 如果使用【钱包应用】对应的项目参数调用该查询链账户接口时,会返回该字段。该字段用于区分某一指定链账户地址是否属于当前项目参数所对应的钱包应用。
+ //0: 由当前钱包创建,代表对某一指定地址拥有操作权限
+ //1: 由其他钱包创建,代表对某一指定地址只有只读权限,没有操作权限
}
}
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/account/QueryEvmAccountsHistoryRes.java b/src/main/java/ai/bianjie/avatasdk/model/account/QueryEvmAccountsHistoryRes.java
new file mode 100644
index 0000000..5c41a09
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/account/QueryEvmAccountsHistoryRes.java
@@ -0,0 +1,61 @@
+package ai.bianjie.avatasdk.model.account;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 查询 EVM 链账户操作记录正确返回值
+ */
+@NoArgsConstructor
+@Data
+public class QueryEvmAccountsHistoryRes {
+
+ @JSONField(name = "data")
+ private DataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class DataDTO {
+
+ @JSONField(name = "prev_page_key")
+ private String prevPageKey;// 上一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "next_page_key")
+ private String nextPageKey;// 下一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "limit")
+ private Integer limit;// 每页记录数
+
+ @JSONField(name = "total_count")
+ private Integer totalCount;// 总记录数
+
+ @JSONField(name = "operation_records")
+ private List operationRecords;// 操作记录列表
+
+ @NoArgsConstructor
+ @Data
+ public static class OperationRecordsDTO {
+ @JSONField(name = "tx_hash")
+ private String txHash;// 操作 Tx Hash
+
+ @JSONField(name = "module")
+ private Integer module;// 功能模块;Enum: "nft"
+
+ @JSONField(name = "operation")
+ private Integer operation;
+ // 操作类型: module = 1 时: 1:issue_class; 2:transfer_class 3:mint; 4:edit; 5:transfer; 6:burn;
+
+ @JSONField(name = "signer")
+ private String signer;// Tx 签名者地址
+
+ @JSONField(name = "timestamp")
+ private String timestamp;// 操作时间戳(UTC 时间)
+
+ @JSONField(name = "nft_msg")
+ private String nftMsg;// 具体参考接口文档
+ }
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/account/QueryNatAccountsHistoryRes.java b/src/main/java/ai/bianjie/avatasdk/model/account/QueryNatAccountsHistoryRes.java
new file mode 100644
index 0000000..4701819
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/account/QueryNatAccountsHistoryRes.java
@@ -0,0 +1,65 @@
+package ai.bianjie.avatasdk.model.account;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 查询原生链账户操作记录正确返回值
+ */
+@NoArgsConstructor
+@Data
+public class QueryNatAccountsHistoryRes {
+
+ @JSONField(name = "data")
+ private DataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class DataDTO {
+
+ @JSONField(name = "prev_page_key")
+ private String prevPageKey;// 上一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "next_page_key")
+ private String nextPageKey;// 下一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "limit")
+ private Integer limit;// 每页记录数
+
+ @JSONField(name = "total_count")
+ private Integer totalCount;// 总记录数
+
+ @JSONField(name = "operation_records")
+ private List operationRecords;// 操作记录列表
+
+ @NoArgsConstructor
+ @Data
+ public static class OperationRecordsDTO {
+ @JSONField(name = "tx_hash")
+ private String txHash;// 操作 Tx Hash
+
+ @JSONField(name = "module")
+ private Integer module;// 功能模块;Enum: "nft"
+
+ @JSONField(name = "operation")
+ private Integer operation;
+ // 操作类型: module = 1 时: 1:issue_class; 2:transfer_class 3:mint; 4:edit; 5:transfer; 6:burn;
+ // module = 2 时,可选:1:issue_class;2:transfer_class;3:issue;4:mint;5:edit;6:transfer;7:burn
+
+ @JSONField(name = "signer")
+ private String signer;// Tx 签名者地址
+
+ @JSONField(name = "timestamp")
+ private String timestamp;// 操作时间戳(UTC 时间)
+
+ @JSONField(name = "nft_msg")
+ private String nftMsg;// 具体参考接口文档
+
+ @JSONField(name = "mt_msg")
+ private String mtMsg;// 具体参考接口文档
+ }
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/contract/ContractCallReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/contract/ContractCallReq.java
new file mode 100644
index 0000000..a6d3c3a
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/contract/ContractCallReq.java
@@ -0,0 +1,31 @@
+package ai.bianjie.avatasdk.model.evm.contract;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 调用合约请求体
+ */
+@NoArgsConstructor
+@Data
+public class ContractCallReq {
+
+ @JSONField(name = "from")
+ private String from;// 签名交易链账户地址
+
+ @JSONField(name = "to")
+ private String to;// 合约地址
+
+ @JSONField(name = "data")
+ private String data;// ABI 编码待签名交易的 hex 字符串
+
+ @JSONField(name = "gas_limit")
+ private Integer gasLimit;// gas 使用上限大小
+
+ @JSONField(name = "estimation")
+ private Integer estimation;// 是否模拟执行交易 0 不模拟 1 模拟
+
+ @JSONField(name = "operation_id")
+ private String operationId;// 操作 ID
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/contract/QueryContractCallReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/contract/QueryContractCallReq.java
new file mode 100644
index 0000000..c481d92
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/contract/QueryContractCallReq.java
@@ -0,0 +1,18 @@
+package ai.bianjie.avatasdk.model.evm.contract;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 查询合约请求体
+ */
+@NoArgsConstructor
+@Data
+public class QueryContractCallReq {
+ @JSONField(name = "to")
+ private String to;// 目标合约地址
+
+ @JSONField(name = "data")
+ private String data;// ABI 编码待签名交易的 hex 字符串
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/contract/QueryContractCallRes.java b/src/main/java/ai/bianjie/avatasdk/model/evm/contract/QueryContractCallRes.java
new file mode 100644
index 0000000..2715e9e
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/contract/QueryContractCallRes.java
@@ -0,0 +1,22 @@
+package ai.bianjie.avatasdk.model.evm.contract;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 查询合约正确返回值
+ */
+@NoArgsConstructor
+@Data
+public class QueryContractCallRes {
+ @JSONField(name = "data")
+ private DataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class DataDTO {
+ @JSONField(name = "result")
+ private String result;// 合约调用结果 hex 字符串
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/BurnNftReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/BurnNftReq.java
similarity index 88%
rename from src/main/java/ai/bianjie/avatasdk/model/nft/BurnNftReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/evm/nft/BurnNftReq.java
index d64d5fb..c8ae146 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/BurnNftReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/BurnNftReq.java
@@ -1,15 +1,16 @@
-package ai.bianjie.avatasdk.model.nft;
+package ai.bianjie.avatasdk.model.evm.nft;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
- * 销毁 NFT :request
+ * 销毁 NFT 请求体
*/
@NoArgsConstructor
@Data
public class BurnNftReq {
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/nft/CreateNftClassReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/CreateNftClassReq.java
new file mode 100644
index 0000000..878e9f0
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/CreateNftClassReq.java
@@ -0,0 +1,34 @@
+package ai.bianjie.avatasdk.model.evm.nft;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 创建 NFT 类别请求体
+ */
+@NoArgsConstructor
+@Data
+public class CreateNftClassReq {
+
+ @JSONField(name = "name")
+ private String name;// NFT 类别名称,由创建者自定义
+
+ @JSONField(name = "uri")
+ private String uri;// 指该 NFT 类别在链外的元数据存储地址或其他链外资源的标识,元数据规范建议参考:https://forum.avata.bianjie.ai/t/topic/81
+
+ @JSONField(name = "symbol")
+ private String symbol;// NFT 类别标识,用于快速识别和查询该类 NFT 资产
+
+ @JSONField(name = "owner")
+ private String owner;// NFT 类别权属者地址,拥有在该 NFT 类别中发行 NFT 的权限。 支持任一 Avata 平台内合法链账户地址(Hex 格式)
+
+ @JSONField(name = "editable_by_owner")
+ private Integer editableByOwner;// NFT 类别权限的控制功能, 此类别下某一 NFT 的持有者可以编辑该 NFT, 1:可编辑, 0:不可编辑
+
+ @JSONField(name = "editable_by_class_owner")
+ private Integer editableByClassOwner;// NFT 类别权限的控制功能, 此 NFT 类别的权属者可以编辑这个类别下所有的 NFT, 1:可编辑, 0:不可编辑
+
+ @JSONField(name = "operation_id")
+ private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/BatchBurnNftReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/EditNftReq.java
similarity index 51%
rename from src/main/java/ai/bianjie/avatasdk/model/nft/BatchBurnNftReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/evm/nft/EditNftReq.java
index 6764493..004ccfb 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/BatchBurnNftReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/EditNftReq.java
@@ -1,29 +1,23 @@
-package ai.bianjie.avatasdk.model.nft;
+package ai.bianjie.avatasdk.model.evm.nft;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
-import java.util.List;
-
/**
- * 批量销毁 NFT :request
+ * 编辑 NFT 请求体
*/
@NoArgsConstructor
@Data
-public class BatchBurnNftReq {
- @JSONField(name = "nfts")
- private List nfts;
+public class EditNftReq {
+
+ @JSONField(name = "uri")
+ private String uri;// 指该 NFT 在链外的元数据存储地址或其他链外资源的标识 元数据规范建议参考:https://forum.avata.bianjie.ai/t/topic/81
+
+ @JSONField(name = "uri_hash")
+ private String uriHash;// 指通过某种哈希算法将链外元数据进行数字化加密处理后,得到的哈希值
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
- @NoArgsConstructor
- @Data
- public static class NftsDTO {
- @JSONField(name = "class_id")
- private String classId;// NFT 类别 ID
- @JSONField(name = "nft_id")
- private String nftId;// NFT ID
- }
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/nft/MintNftReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/MintNftReq.java
new file mode 100644
index 0000000..c623bce
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/MintNftReq.java
@@ -0,0 +1,25 @@
+package ai.bianjie.avatasdk.model.evm.nft;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 发行 NFT 请求体
+ */
+@NoArgsConstructor
+@Data
+public class MintNftReq {
+
+ @JSONField(name = "uri")
+ private String uri;// 指该 NFT 在链外的元数据存储地址或其他链外资源的标识 元数据规范建议参考:https://forum.avata.bianjie.ai/t/topic/81
+
+ @JSONField(name = "uri_hash")
+ private String uriHash;// 指通过某种哈希算法将链外元数据进行数字化加密处理后,得到的哈希值
+
+ @JSONField(name = "recipient")
+ private String recipient;// NFT 接收者地址,支持任一文昌链合法链账户地址,默认为 NFT 类别的权属者地址(Hex 格式)
+
+ @JSONField(name = "operation_id")
+ private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftClassRes.java b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftClassRes.java
new file mode 100644
index 0000000..181aa1e
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftClassRes.java
@@ -0,0 +1,49 @@
+package ai.bianjie.avatasdk.model.evm.nft;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 查询 NFT 类别详情正确返回值
+ */
+@NoArgsConstructor
+@Data
+public class QueryNftClassRes {
+ private DataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class DataDTO {
+
+ @JSONField(name = "id")
+ private String id;// NFT 合约地址
+
+ @JSONField(name = "name")
+ private String name;// NFT 类别名称
+
+ @JSONField(name = "uri")
+ private String uri;// 链外资源标识符
+
+ @JSONField(name = "symbol")
+ private String symbol;// NFT 类别标识
+
+ @JSONField(name = "nft_count")
+ private Integer nftCount;// NFT 类别包含的 NFT 总量
+
+ @JSONField(name = "owner")
+ private String owner;// NFT 类别权属者地址
+
+ @JSONField(name = "editable_by_owner")
+ private Integer editableByOwner;// NFT 类别权限的控制功能, 此类别下某一 NFT 的持有者可以编辑该 NFT, 1:可编辑, 0:不可编辑
+
+ @JSONField(name = "editable_by_class_owner")
+ private Integer editableByClassOwner;// NFT 类别权限的控制功能, 此 NFT 类别的权属者可以编辑这个类别下所有的 NFT, 1:可编辑, 0:不可编辑
+
+ @JSONField(name = "tx_hash")
+ private String txHash;// 部署合约的 Tx Hash
+
+ @JSONField(name = "timestamp")
+ private String timestamp;// 部署合约的时间戳(UTC 时间)
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftClassesReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftClassesReq.java
new file mode 100644
index 0000000..d482fca
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftClassesReq.java
@@ -0,0 +1,43 @@
+package ai.bianjie.avatasdk.model.evm.nft;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 查询 NFT 类别请求体
+ */
+@NoArgsConstructor
+@Data
+public class QueryNftClassesReq {
+
+ @JSONField(name = "page_key")
+ private String pageKey;// 分页数据的Key, Avata会根据该值进行上下页的查询, 该值请从返回的数据体中获取,首页查询可以不传该参数
+
+ @JSONField(name = "limit")
+ private String limit;// 每页记录数,默认为 10,上限为 50
+
+ @JSONField(name = "id")
+ private String id;// NFT 合约地址
+
+ @JSONField(name = "name")
+ private String name;// NFT 类别名称,支持模糊查询
+
+ @JSONField(name = "owner")
+ private String owner;// NFT 类别权属者地址
+
+ @JSONField(name = "tx_hash")
+ private String txHash;// 部署合约的 Tx Hash
+
+ @JSONField(name = "start_date")
+ private String startDate;// NFT 类别创建日期范围 - 开始,yyyy-MM-dd(UTC 时间)
+
+ @JSONField(name = "end_date")
+ private String endDate;// NFT 类别创建日期范围 - 结束,yyyy-MM-dd(UTC 时间)
+
+ @JSONField(name = "sort_by")
+ private String sortBy;// 排序规则:DATE_ASC / DATE_DESC
+
+ @JSONField(name = "count_total")
+ private String countTotal;// 是否查询数据的总数量 0:不查询总数(默认)1:查询总数
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftClassesRes.java b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftClassesRes.java
new file mode 100644
index 0000000..4e65434
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftClassesRes.java
@@ -0,0 +1,63 @@
+package ai.bianjie.avatasdk.model.evm.nft;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 查询 NFT 类别正确返回值
+ */
+@NoArgsConstructor
+@Data
+public class QueryNftClassesRes {
+ @JSONField(name = "data")
+ private DataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class DataDTO {
+
+ @JSONField(name = "prev_page_key")
+ private String prevPageKey;// 上一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "next_page_key")
+ private String nextPageKey;// 下一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "limit")
+ private Integer limit;// 每页记录数
+
+ @JSONField(name = "total_count")
+ private Integer totalCount;// 总记录数
+
+ @JSONField(name = "classes")
+ private List classes;
+
+
+ @NoArgsConstructor
+ @Data
+ public static class ClassesDTO {
+ @JSONField(name = "id")
+ private String id;// NFT 合约地址
+
+ @JSONField(name = "name")
+ private String name;// NFT 类别名称
+
+ @JSONField(name = "uri")
+ private String uri;// 链外数据链接
+
+ @JSONField(name = "symbol")
+ private String symbol;// NFT 类别标识
+
+ @JSONField(name = "owner")
+ private String owner;// NFT 类别权属者地址
+
+ @JSONField(name = "tx_hash")
+ private String txHash;// 部署合约的 Tx Hash
+
+ @JSONField(name = "timestamp")
+ private String timestamp;// 部署合约的时间戳(UTC 时间)
+ }
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftHistoryReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftHistoryReq.java
new file mode 100644
index 0000000..cca2e96
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftHistoryReq.java
@@ -0,0 +1,46 @@
+package ai.bianjie.avatasdk.model.evm.nft;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 查询 NFT 操作记录请求体
+ */
+@NoArgsConstructor
+@Data
+public class QueryNftHistoryReq {
+
+ @JSONField(name = "class_id")
+ private String classId;// NFT 合约地址
+
+ @JSONField(name = "nft_id")
+ private String nftId;// NFT ID
+
+ @JSONField(name = "page_key")
+ private String pageKey;// 分页数据的Key, Avata会根据该值进行上下页的查询, 该值请从返回的数据体中获取,首页查询可以不传该参数
+
+ @JSONField(name = "limit")
+ private String limit;// 每页记录数,默认为 10,上限为 50
+
+ @JSONField(name = "signer")
+ private String signer;// Tx 签名者地址
+
+ @JSONField(name = "tx_hash")
+ private String txHash;// NFT 操作 Tx Hash
+
+ @JSONField(name = "operation")
+ private String operation;// 操作类型:1:mint; 2:edit; 3:transfer; 4:burn;
+
+ @JSONField(name = "start_date")
+ private String startDate;// NFT 操作日期范围 - 开始,yyyy-MM-dd(UTC 时间)
+
+ @JSONField(name = "end_date")
+ private String endDate;// NFT 操作日期范围 - 结束,yyyy-MM-dd(UTC 时间)
+
+ @JSONField(name = "sort_by")
+ private String sortBy;// 排序规则:DATE_ASC / DATE_DESC
+
+ @JSONField(name = "count_total")
+ private String countTotal;// 是否查询数据的总数量 0:不查询总数(默认)1:查询总数
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftHistoryRes.java b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftHistoryRes.java
similarity index 65%
rename from src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftHistoryRes.java
rename to src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftHistoryRes.java
index 614ea16..ab58d54 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftHistoryRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftHistoryRes.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.nft;
+package ai.bianjie.avatasdk.model.evm.nft;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -7,7 +7,7 @@
import java.util.List;
/**
- * 查询 NFT 操作记录:Response
+ * 查询 NFT 操作记录正确返回值
*/
@NoArgsConstructor
@Data
@@ -20,8 +20,11 @@ public class QueryNftHistoryRes {
@Data
public static class DataDTO {
- @JSONField(name = "offset")
- private Integer offset;// 游标
+ @JSONField(name = "prev_page_key")
+ private String prevPageKey;// 上一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "next_page_key")
+ private String nextPageKey;// 下一页数据的Key, Avata会根据该值进行上一页数据的查询
@JSONField(name = "limit")
private Integer limit;// 每页记录数
@@ -30,7 +33,7 @@ public static class DataDTO {
private Integer totalCount;// 总记录数
@JSONField(name = "operation_records")
- private List operationRecords;
+ private List operationRecords;// 操作记录列表
@NoArgsConstructor
@Data
@@ -40,7 +43,7 @@ public static class OperationRecordsDTO {
private String txHash;// NFT 操作的 Tx Hash
@JSONField(name = "operation")
- private String operation;// NFT 操作类型;Enum: "mint" "edit" "transfer" "burn"
+ private Integer operation;// NFT 操作类型: 1:mint; 2:edit; 3:transfer; 4:burn;
@JSONField(name = "signer")
private String signer;// Tx 签名者地址
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftRes.java b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftRes.java
new file mode 100644
index 0000000..77b5be0
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftRes.java
@@ -0,0 +1,51 @@
+package ai.bianjie.avatasdk.model.evm.nft;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 查询 NFT 详情正确返回值
+ */
+@NoArgsConstructor
+@Data
+public class QueryNftRes {
+
+ @JSONField(name = "data")
+ private DataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class DataDTO {
+
+ @JSONField(name = "id")
+ private Integer id;// NFT ID
+
+ @JSONField(name = "class_id")
+ private String classId;// NFT 类别 ID
+
+ @JSONField(name = "class_name")
+ private String className;// NFT 类别名称
+
+ @JSONField(name = "class_symbol")
+ private String classSymbol;// NFT 类别标识
+
+ @JSONField(name = "uri")
+ private String uri;// 链外数据链接
+
+ @JSONField(name = "uri_hash")
+ private String uriHash;// 链外数据 Hash
+
+ @JSONField(name = "owner")
+ private String owner;// NFT 持有者地址
+
+ @JSONField(name = "status")
+ private Integer status;// NFT 状态 1:active 2:burned
+
+ @JSONField(name = "tx_hash")
+ private String txHash;// NFT 发行 Tx Hash
+
+ @JSONField(name = "timestamp")
+ private String timestamp;// NFT 发行时间戳(UTC 时间)
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftsReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftsReq.java
new file mode 100644
index 0000000..4e003fb
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftsReq.java
@@ -0,0 +1,47 @@
+package ai.bianjie.avatasdk.model.evm.nft;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 查询 NFT 请求体
+ */
+@NoArgsConstructor
+@Data
+public class QueryNftsReq {
+
+ @JSONField(name = "page_key")
+ private String pageKey;// 分页数据的Key, Avata会根据该值进行上下页的查询, 该值请从返回的数据体中获取,首页查询可以不传该参数
+
+ @JSONField(name = "limit")
+ private String limit;// 每页记录数,默认为 10,上限为 50
+
+ @JSONField(name = "id")
+ private String id;// NFT ID
+
+ @JSONField(name = "class_id")
+ private String classId;// NFT 合约地址
+
+ @JSONField(name = "owner")
+ private String owner;// NFT 持有者地址
+
+ @JSONField(name = "tx_hash")
+ private String txHash;// 创建 NFT 的 Tx Hash
+
+ @JSONField(name = "status")
+ private String status;// NFT 状态 1:active(默认) 2:burned
+
+ @JSONField(name = "start_date")
+ private String startDate;// NFT 创建日期范围 - 开始,yyyy-MM-dd(UTC 时间)
+
+ @JSONField(name = "end_date")
+ private String endDate;// NFT 创建日期范围 - 结束,yyyy-MM-dd(UTC 时间)
+
+ @JSONField(name = "sort_by")
+ private String sortBy;// 排序规则:DATE_ASC / DATE_DESC
+
+ @JSONField(name = "count_total")
+ private String countTotal;// 是否查询数据的总数量 0:不查询总数(默认)1:查询总数
+
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftsRes.java b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftsRes.java
new file mode 100644
index 0000000..2955afe
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/QueryNftsRes.java
@@ -0,0 +1,72 @@
+package ai.bianjie.avatasdk.model.evm.nft;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 查询 NFT 正确返回值
+ */
+@NoArgsConstructor
+@Data
+public class QueryNftsRes {
+
+ @JSONField(name = "data")
+ private DataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class DataDTO {
+
+ @JSONField(name = "prev_page_key")
+ private String prevPageKey;// 上一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "next_page_key")
+ private String nextPageKey;// 下一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "limit")
+ private Integer limit;// 每页记录数
+
+ @JSONField(name = "total_count")
+ private Integer totalCount;// 总记录数
+
+ @JSONField(name = "nfts")
+ private List nfts;
+
+ @NoArgsConstructor
+ @Data
+ public static class NftsDTO {
+ @JSONField(name = "id")
+ private Integer id;// NFT ID
+
+ @JSONField(name = "class_id")
+ private String classId;// NFT 合约地址
+
+ @JSONField(name = "class_name")
+ private String className;// NFT 类别名称
+
+ @JSONField(name = "class_symbol")
+ private String classSymbol;// NFT 类别标识
+
+ @JSONField(name = "uri")
+ private String uri;// 链外数据链接
+
+ @JSONField(name = "uri_hash")
+ private String uriHash;// 链外数据 Hash
+
+ @JSONField(name = "owner")
+ private String owner;// NFT 持有者地址
+
+ @JSONField(name = "status")
+ private Integer status;// NFT 状态 1:active 2:burned
+
+ @JSONField(name = "tx_hash")
+ private String txHash;// NFT 发行 Tx Hash
+
+ @JSONField(name = "timestamp")
+ private String timestamp;// NFT 发行时间戳(UTC 时间)
+ }
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/nft/TransferNftClassReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/TransferNftClassReq.java
new file mode 100644
index 0000000..2855824
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/TransferNftClassReq.java
@@ -0,0 +1,20 @@
+package ai.bianjie.avatasdk.model.evm.nft;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 转让 NFT 类别请求体
+ */
+@NoArgsConstructor
+@Data
+public class TransferNftClassReq {
+
+ @JSONField(name = "recipient")
+ private String recipient;// NFT 合约接收者地址,支持任一 Avata 平台内合法链账户地址(Hex 格式)
+
+ @JSONField(name = "operation_id")
+ private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
+
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/TransferNftReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/TransferNftReq.java
similarity index 89%
rename from src/main/java/ai/bianjie/avatasdk/model/nft/TransferNftReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/evm/nft/TransferNftReq.java
index be61976..6e493a0 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/TransferNftReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/nft/TransferNftReq.java
@@ -1,18 +1,19 @@
-package ai.bianjie.avatasdk.model.nft;
+package ai.bianjie.avatasdk.model.evm.nft;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
- * 转让 NFT :request
+ * 转让 NFT 请求体
*/
@NoArgsConstructor
@Data
public class TransferNftReq {
+
@JSONField(name = "recipient")
private String recipient;// NFT 接收者地址
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
-
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryDomainReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryDomainReq.java
new file mode 100644
index 0000000..44e1737
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryDomainReq.java
@@ -0,0 +1,19 @@
+package ai.bianjie.avatasdk.model.evm.ns;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 查询域名接口请求体
+ */
+@NoArgsConstructor
+@Data
+public class QueryDomainReq {
+
+ @JSONField(name = "name")
+ private String name;// 域名关键字,包含大小写英文字母、阿拉伯数字和连字符 -
+
+ @JSONField(name = "tld")
+ private String tld;// 根域名。文昌链目前支持的一级根域名有:【.w】、【.dao】、【.meta】、【.id】、【.wallet】
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryDomainRes.java b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryDomainRes.java
new file mode 100644
index 0000000..95442b6
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryDomainRes.java
@@ -0,0 +1,48 @@
+package ai.bianjie.avatasdk.model.evm.ns;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 查询域名接口正确返回值
+ */
+@NoArgsConstructor
+@Data
+public class QueryDomainRes {
+
+ @JSONField(name = "data")
+ private dataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class dataDTO {
+ @JSONField(name = "domains")
+ private List domainsDTO;
+ }
+
+ @NoArgsConstructor
+ @Data
+ public static class DomainsDTO {
+
+ @JSONField(name = "name")
+ private String name;// 一级域名 :如 test.wallet
+
+ @JSONField(name = "status")
+ private Integer status;// 当前域名状态 0 :未注册; 1: 已注册; 2: 不符合规则
+
+ @JSONField(name = "owner")
+ private String owner;// 当前域名拥有者的链账户地址
+
+ @JSONField(name = "expire")
+ private Integer expire;// 过期状态: 0:未过期;1:已过期
+
+ @JSONField(name = "expire_timestamp")
+ private Integer expireTimestamp;// 当前域名过期时间戳
+
+ @JSONField(name = "msg")
+ private String msg;// 提示信息
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryDomainResolvesReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryDomainResolvesReq.java
new file mode 100644
index 0000000..2e84ffe
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryDomainResolvesReq.java
@@ -0,0 +1,16 @@
+package ai.bianjie.avatasdk.model.evm.ns;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 查询域名解析接口请求体
+ */
+@NoArgsConstructor
+@Data
+public class QueryDomainResolvesReq {
+
+ @JSONField(name = "resolve_type")
+ private Integer resolveType;// 域名解析类型 0:全部 1:链账户 2:文本
+}
\ No newline at end of file
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryDomainResolvesRes.java b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryDomainResolvesRes.java
new file mode 100644
index 0000000..813134e
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryDomainResolvesRes.java
@@ -0,0 +1,52 @@
+package ai.bianjie.avatasdk.model.evm.ns;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 查询域名解析接口正确返回值
+ */
+@NoArgsConstructor
+@Data
+public class QueryDomainResolvesRes {
+
+
+ @JSONField(name = "data")
+ private dataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class dataDTO {
+
+
+ @JSONField(name = "addrs")
+ private List addrsDTO; // 链账户,resolve_type 为 1 时必填
+
+ @JSONField(name = "texts")
+ private List textsDTO; // 文本数据,resolve_type为 2 时必填
+ }
+ @NoArgsConstructor
+ @Data
+ public static class AddrsDTO {
+
+ @JSONField(name = "block_chain")
+ private Integer blockChain;// 地址链类型
+
+ @JSONField(name = "addr_value")
+ private String addrValue; // 链账户地址
+ }
+
+ @NoArgsConstructor
+ @Data
+ public static class TextsDTO {
+
+ @JSONField(name = "key")
+ private String key; // 内容 key
+
+ @JSONField(name = "text_value")
+ private String textValue; // 内容 value
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryOwnerDomainReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryOwnerDomainReq.java
new file mode 100644
index 0000000..37c4457
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryOwnerDomainReq.java
@@ -0,0 +1,28 @@
+package ai.bianjie.avatasdk.model.evm.ns;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 请求查询用户域名接口
+ */
+@NoArgsConstructor
+@Data
+public class QueryOwnerDomainReq {
+
+ @JSONField(name = "name")
+ private String name;// 域名关键字
+
+ @JSONField(name = "tld")
+ private String tld;// 根域名
+
+ @JSONField(name = "page_key")
+ private String pageKey;// 分页数据的Key, Avata会根据该值进行上下页的查询, 该值请从返回的数据体中获取,首页查询可以不传该参数
+
+ @JSONField(name = "limit")
+ private String limit;// 每页记录数,默认为 10,上限为 50
+
+ @JSONField(name = "count_total")
+ private String countTotal;// 是否查询数据的总数量, 0:不查询总数(默认); 1:查询总数
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryOwnerDomainRes.java b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryOwnerDomainRes.java
new file mode 100644
index 0000000..f94c873
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryOwnerDomainRes.java
@@ -0,0 +1,61 @@
+package ai.bianjie.avatasdk.model.evm.ns;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 请求查询域名接口正确返回值
+ */
+@NoArgsConstructor
+@Data
+public class QueryOwnerDomainRes {
+
+ @JSONField(name = "data")
+ private dataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class dataDTO {
+ @JSONField(name = "domains")
+ private List domainsDTO;
+
+ @JSONField(name = "prev_page_key")
+ private String prevPageKey;// 上一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "next_page_key")
+ private String nextPageKey;// 下一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "limit")
+ private Integer limit;// 每页记录数
+
+ @JSONField(name = "total_count")
+ private Integer totalCount;// 总记录数
+ }
+
+
+ @NoArgsConstructor
+ @Data
+ public static class DomainsDTO {
+
+ @JSONField(name = "name")
+ private String name;// 一级域名 :如 test.wallet
+
+ @JSONField(name = "status")
+ private Integer status;// 当前域名状态 0 :未注册; 1: 已注册
+
+ @JSONField(name = "owner")
+ private String owner;// 当前域名拥有者的链账户地址
+
+ @JSONField(name = "expire")
+ private Integer expire;// 过期状态: 0:未过期;1:已过期
+
+ @JSONField(name = "expire_timestamp")
+ private Integer expireTimestamp;// 当前域名过期时间戳
+
+ @JSONField(name = "msg")
+ private String msg;// 提示信息
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryReverseResolveDomainRes.java b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryReverseResolveDomainRes.java
new file mode 100644
index 0000000..cb2d0fc
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/QueryReverseResolveDomainRes.java
@@ -0,0 +1,22 @@
+package ai.bianjie.avatasdk.model.evm.ns;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 查询域名反向解析接口正确返回值
+ */
+@NoArgsConstructor
+@Data
+public class QueryReverseResolveDomainRes {
+ @JSONField(name = "data")
+ private dataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class dataDTO {
+ @JSONField(name = "name")
+ private String name; // 域名
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/ns/RegisterDomainReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/RegisterDomainReq.java
new file mode 100644
index 0000000..5381613
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/RegisterDomainReq.java
@@ -0,0 +1,24 @@
+package ai.bianjie.avatasdk.model.evm.ns;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 注册域名接口请求体
+ */
+@NoArgsConstructor
+@Data
+public class RegisterDomainReq {
+ @JSONField(name = "name")
+ private String name; // 包含大小写英文字母、阿拉伯数字和连字符 -;不区分大小写;长度不包括后缀
+
+ @JSONField(name = "owner")
+ private String owner;// 域名拥有者的链账户地址,支持任一 Avata 内托管的地址
+
+ @JSONField(name = "duration")
+ private Integer duration;// 购买年限,Enum:1,2,3,4,5
+
+ @JSONField(name = "operation_id")
+ private String operationId;// 保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成并自行维护、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/ns/ResolveDomainReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/ResolveDomainReq.java
new file mode 100644
index 0000000..8988cc7
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/ResolveDomainReq.java
@@ -0,0 +1,50 @@
+package ai.bianjie.avatasdk.model.evm.ns;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 设置域名解析接口请求体
+ */
+@NoArgsConstructor
+@Data
+public class ResolveDomainReq {
+
+ @JSONField(name = "resolve_type")
+ private Integer resolveType;// 域名解析类型 1:链账户 2:文本
+
+ @JSONField(name = "addr")
+ private AddrDTO addrDTO; // 链账户,resolve_type 为 1 时必填
+
+ @JSONField(name = "text")
+ private TextDTO textDTO; // 文本数据,resolve_type为 2 时必填
+
+ @JSONField(name = "operation_id")
+ private String operationId;// 保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成并自行维护、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
+
+
+ @NoArgsConstructor
+ @Data
+ public static class AddrDTO {
+
+ @JSONField(name = "addr_value")
+ private String addrValue; // 链账户地址,默认值为当前域名 owner
+
+ @JSONField(name = "block_chain")
+ private Integer blockChain;// 底层区块链 1000:天舟链 1001:天和链 1002: 神舟链 https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution
+ }
+
+ @NoArgsConstructor
+ @Data
+ public static class TextDTO {
+
+ @JSONField(name = "key")
+ private String key; //文本数据 key,key可选的标准值有:email(电子邮箱地址),url(网址),avatar(用作头像或标识的图像的网址),description(域名的描述信息),notice(关于域名的通知),keywords(逗号分隔的关键字列表,按重要性由高到低排列,与此字段有交互的客户端可以通过设置一个阈值来选择忽略哪些内容) https://learnblockchain.cn/docs/ens/contract-api-reference/publicresolver.html#%E8%8E%B7%E5%8F%96%E6%96%87%E6%9C%AC%E6%95%B0%E6%8D%AE
+
+ @JSONField(name = "text_value")
+ private String textValue; // 文本数据值
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/ns/ReverseResolveDomainReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/ReverseResolveDomainReq.java
new file mode 100644
index 0000000..e643750
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/ReverseResolveDomainReq.java
@@ -0,0 +1,18 @@
+package ai.bianjie.avatasdk.model.evm.ns;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 设置域名反向解析接口请求体
+ */
+@NoArgsConstructor
+@Data
+public class ReverseResolveDomainReq {
+ @JSONField(name = "name")
+ private String name; // 域名名称
+
+ @JSONField(name = "operation_id")
+ private String operationId; // 保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成并自行维护、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/ns/TransferDomainReq.java b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/TransferDomainReq.java
new file mode 100644
index 0000000..903f79f
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/ns/TransferDomainReq.java
@@ -0,0 +1,20 @@
+package ai.bianjie.avatasdk.model.evm.ns;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+
+/**
+ * 转让域名接口请求体
+ */
+@NoArgsConstructor
+@Data
+public class TransferDomainReq {
+
+ @JSONField(name = "recipient")
+ private String recipient;// 域名接收者地址,支持任一Avata 内托管的地址
+
+ @JSONField(name = "operation_id")
+ private String operationId;// 操作ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成并自行维护、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/tx/QueryTxRes.java b/src/main/java/ai/bianjie/avatasdk/model/evm/tx/QueryTxRes.java
new file mode 100644
index 0000000..14b4e63
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/tx/QueryTxRes.java
@@ -0,0 +1,77 @@
+package ai.bianjie.avatasdk.model.evm.tx;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 上链交易结果查询返回值
+ * 交易状态说明:
+ * status 为 3(未处理),上链请求还在等待处理,请稍等;
+ * status 为 0(处理中),上链请求正在处理,请等待处理完成;
+ * status 为 1(成功),交易已上链并执行成功;
+ * status 为 2(失败),说明该交易执行失败。请在业务侧做容错处理。可以参考接口返回的 message(交易失败的错误描述信息) 对 NFT / MT / 业务接口的请求参数做适当调整后,使用「新的 Operation ID 」重新发起 NFT / MT / 业务接口请求。
+ */
+
+
+@NoArgsConstructor
+@Data
+public class QueryTxRes {
+
+ @JSONField(name = "data")
+ private DataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class DataDTO {
+ @JSONField(name = "module")
+ private Integer module;// Enum:交易模块 请通过 查询枚举值列表 接口查看
+
+ @JSONField(name = "operation")
+ private Integer operation; // Enum: 用户操作类型 请通过 查询枚举值列表 接口查看
+
+ @JSONField(name = "tx_hash")
+ private String txHash;// 交易哈希
+
+ @JSONField(name = "status")
+ private Integer status;// 交易状态,Enum: 0:处理中; 1:成功; 2:失败; 3:未处理;
+
+ @JSONField(name = "message")
+ private String message;// 交易失败的错误描述信息
+
+ @JSONField(name = "block_height")
+ private Integer blockHeight;// 交易上链的区块高度
+
+ @JSONField(name = "timestamp")
+ private String timestamp;// 交易上链时间(UTC 时间)
+
+ @JSONField(name = "nft")
+ private Nft nft;// 具体参考接口文档
+
+ @JSONField(name = "ns")
+ private String ns;// 具体参考接口文档
+
+ @NoArgsConstructor
+ @Data
+ public static class Nft {
+
+ @JSONField(name = "class_id")
+ private String classId;// NFT 合约地址
+
+ @JSONField(name = "id")
+ private Integer id;// NFT ID
+ }
+
+ @NoArgsConstructor
+ @Data
+ public static class Record {
+
+ @JSONField(name = "record_id")
+ private Integer recordId;// 区块链存证 ID
+
+ @JSONField(name = "certificate_url")
+ private String certificateUrl;// 区块链存证证书的下载链接;证书下载链接并非长期有效,请您尽快将证书文件下载至本地并妥善保管。
+ }
+ }
+}
+
diff --git a/src/main/java/ai/bianjie/avatasdk/model/evm/tx/QueryTxTypesRes.java b/src/main/java/ai/bianjie/avatasdk/model/evm/tx/QueryTxTypesRes.java
new file mode 100644
index 0000000..9d1e47c
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/evm/tx/QueryTxTypesRes.java
@@ -0,0 +1,48 @@
+package ai.bianjie.avatasdk.model.evm.tx;
+
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 枚举值列表查询
+ */
+
+@NoArgsConstructor
+@Data
+public class QueryTxTypesRes {
+
+ @JSONField(name = "data")
+ private DataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class DataDTO {
+
+ @JSONField(name = "data")
+ private List data;
+
+ @NoArgsConstructor
+ @Data
+ public static class DataDTO1 {
+
+ @JSONField(name = "module")
+ private Integer module;// 交易模块
+
+ @JSONField(name = "operation")
+ private Integer operation;// 操作类型
+
+ @JSONField(name = "code")
+ private String code;// 标识
+
+ @JSONField(name = "name")
+ private String name;// 名称
+
+ @JSONField(name = "description")
+ private String description;// 描述
+ }
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtBalancesReq.java b/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtBalancesReq.java
deleted file mode 100644
index 0ef0dae..0000000
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtBalancesReq.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package ai.bianjie.avatasdk.model.mt;
-
-import com.alibaba.fastjson.annotation.JSONField;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-/**
- * 查询 MT 余额请求参数
- */
-@NoArgsConstructor
-@Data
-public class QueryMtBalancesReq {
- @JSONField(name = "offset")
- private Integer offset;// 游标,默认为 0
- @JSONField(name = "limit")
- private Integer limit;// 每页记录数,默认为 10,上限为 50
- @JSONField(name = "id")
- private Integer id;// MT ID
-}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/BurnMtReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/BurnMtReq.java
similarity index 80%
rename from src/main/java/ai/bianjie/avatasdk/model/mt/BurnMtReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/mt/BurnMtReq.java
index c90912b..350c4ed 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/BurnMtReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/BurnMtReq.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.mt;
+package ai.bianjie.avatasdk.model.nat.mt;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -12,7 +12,8 @@
public class BurnMtReq {
@JSONField(name = "amount")
- private Integer amount;// 销毁的数量
+ private Integer amount;// 销毁的数量,不填写数量时,默认销毁数量为 1
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/CreateMtClassReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/CreateMtClassReq.java
similarity index 94%
rename from src/main/java/ai/bianjie/avatasdk/model/mt/CreateMtClassReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/mt/CreateMtClassReq.java
index 6950569..12c75db 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/CreateMtClassReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/CreateMtClassReq.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.mt;
+package ai.bianjie.avatasdk.model.nat.mt;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -13,10 +13,13 @@ public class CreateMtClassReq {
@JSONField(name = "name")
private String name;// MT 类别名称
+
@JSONField(name = "owner")
private String owner;// MT 类别权属者地址,支持任一 Avata 平台内合法链账户地址
+
@JSONField(name = "data")
private String data;// 自定义链上元数据
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/EditMtReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/EditMtReq.java
similarity index 93%
rename from src/main/java/ai/bianjie/avatasdk/model/mt/EditMtReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/mt/EditMtReq.java
index e896aaf..d2253d3 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/EditMtReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/EditMtReq.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.mt;
+package ai.bianjie.avatasdk.model.nat.mt;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -13,6 +13,7 @@ public class EditMtReq {
@JSONField(name = "data")
private String data;// 自定义链上元数据
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/IssueMtReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/IssueMtReq.java
similarity index 95%
rename from src/main/java/ai/bianjie/avatasdk/model/mt/IssueMtReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/mt/IssueMtReq.java
index 0904e21..ef680e6 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/IssueMtReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/IssueMtReq.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.mt;
+package ai.bianjie.avatasdk.model.nat.mt;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -13,10 +13,13 @@ public class IssueMtReq {
@JSONField(name = "data")
private String data;// 自定义链上元数据
+
@JSONField(name = "amount")
private Integer amount;// MT 数量,不填写数量时,默认发行数量为 1
+
@JSONField(name = "recipient")
private String recipient;// MT 接收者地址,支持任一文昌链合法链账户地址,默认为 MT 类别的权属者地址
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/MintMtReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/MintMtReq.java
similarity index 83%
rename from src/main/java/ai/bianjie/avatasdk/model/mt/MintMtReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/mt/MintMtReq.java
index 0f7ddce..81bf3cc 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/MintMtReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/MintMtReq.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.mt;
+package ai.bianjie.avatasdk.model.nat.mt;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -12,9 +12,11 @@
public class MintMtReq {
@JSONField(name = "amount")
- private Integer amount;// MT 数量
+ private Integer amount;// MT 数量,不填写数量时,默认增发数量为 1
+
@JSONField(name = "recipient")
private String recipient;// MT 接收者地址
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtBalancesReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtBalancesReq.java
new file mode 100644
index 0000000..a5f9fe5
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtBalancesReq.java
@@ -0,0 +1,25 @@
+package ai.bianjie.avatasdk.model.nat.mt;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 查询 MT 余额请求参数
+ */
+@NoArgsConstructor
+@Data
+public class QueryMtBalancesReq {
+
+ @JSONField(name = "page_key")
+ private String pageKey;// 分页数据的Key, Avata会根据该值进行上下页的查询, 该值请从返回的数据体中获取,首页查询可以不传该参数
+
+ @JSONField(name = "limit")
+ private Integer limit;// 每页记录数,默认为 10,上限为 50
+
+ @JSONField(name = "id")
+ private String id;// MT ID
+
+ @JSONField(name = "count_total")
+ private String countTotal;// 是否查询数据的总数量 0:不查询总数(默认)1:查询总数
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtBalancesRes.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtBalancesRes.java
similarity index 66%
rename from src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtBalancesRes.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtBalancesRes.java
index 86ab1f8..82d9b1b 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtBalancesRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtBalancesRes.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.mt;
+package ai.bianjie.avatasdk.model.nat.mt;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -6,6 +6,9 @@
import java.util.List;
+/**
+ * 查询 MT 余额正确返回值
+ */
@NoArgsConstructor
@Data
public class QueryMtBalancesRes {
@@ -16,12 +19,19 @@ public class QueryMtBalancesRes {
@NoArgsConstructor
@Data
public static class DataDTO {
- @JSONField(name = "offset")
- private Integer offset;// 游标
+
+ @JSONField(name = "prev_page_key")
+ private String prevPageKey;// 上一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "next_page_key")
+ private String nextPageKey;// 下一页数据的Key, Avata会根据该值进行上一页数据的查询
+
@JSONField(name = "limit")
private Integer limit;// 每页记录数
+
@JSONField(name = "total_count")
private Integer totalCount;// 总记录数
+
@JSONField(name = "mts")
private List mts;
@@ -30,6 +40,7 @@ public static class DataDTO {
public static class MtsDTO {
@JSONField(name = "id")
private String id;// MT ID
+
@JSONField(name = "amount")
private Integer amount;// MT 数量
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtClassRes.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtClassRes.java
similarity index 91%
rename from src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtClassRes.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtClassRes.java
index 87996aa..bc658a2 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtClassRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtClassRes.java
@@ -1,11 +1,11 @@
-package ai.bianjie.avatasdk.model.mt;
+package ai.bianjie.avatasdk.model.nat.mt;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
- * 查询 MT 类别详情返回值
+ * 查询 MT 类别详情正确返回值
*/
@NoArgsConstructor
@Data
@@ -17,18 +17,25 @@ public class QueryMtClassRes {
@NoArgsConstructor
@Data
public static class DataDTO {
+
@JSONField(name = "id")
private String id;// MT 类别 ID
+
@JSONField(name = "name")
private String name;// MT 类别名称
- @JSONField(name = "mt_count")
- private Integer mtCount;// MT 类别包含的 MT 总量(AVATA 平台内)
+
@JSONField(name = "data")
private String data;// 自定义链上元数据
+
+ @JSONField(name = "mt_count")
+ private Integer mtCount;// MT 类别包含的 MT 总量(AVATA 平台内)
+
@JSONField(name = "owner")
private String owner;// MT 类别权属者地址
+
@JSONField(name = "tx_hash")
private String txHash;// 创建 MT 类别的 Tx Hash
+
@JSONField(name = "timestamp")
private String timestamp;// 创建 MT 类别的时间戳(UTC 时间)
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtClassesReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtClassesReq.java
similarity index 70%
rename from src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtClassesReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtClassesReq.java
index 188fa6e..72d4e67 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtClassesReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtClassesReq.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.mt;
+package ai.bianjie.avatasdk.model.nat.mt;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -10,22 +10,34 @@
@NoArgsConstructor
@Data
public class QueryMtClassesReq {
- @JSONField(name = "offset")
- private String offset;// 游标,默认为 0
+
+ @JSONField(name = "page_key")
+ private String pageKey;// 分页数据的Key, Avata会根据该值进行上下页的查询, 该值请从返回的数据体中获取,首页查询可以不传该参数
+
@JSONField(name = "limit")
private String limit;// 每页记录数,默认为 10,上限为 50
+
@JSONField(name = "id")
private String id;// MT 类别 ID
+
@JSONField(name = "name")
private String name;// MT 类别名称,支持模糊查询
+
@JSONField(name = "owner")
private String owner;// MT 类别权属者地址
+
@JSONField(name = "tx_hash")
private String txHash;// 创建 MT 类别的 Tx Hash
+
@JSONField(name = "start_date")
private String startDate;// MT 类别创建日期范围 - 开始,yyyy-MM-dd(UTC 时间)
+
@JSONField(name = "end_date")
private String endDate;// MT 类别创建日期范围 - 结束,yyyy-MM-dd(UTC 时间)
+
@JSONField(name = "sort_by")
private String sortBy;// 排序规则:DATE_ASC / DATE_DESC
+
+ @JSONField(name = "count_total")
+ private String countTotal;// 是否查询数据的总数量 0:不查询总数(默认)1:查询总数
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtClassesRes.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtClassesRes.java
similarity index 76%
rename from src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtClassesRes.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtClassesRes.java
index 0813025..f5843c3 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtClassesRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtClassesRes.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.mt;
+package ai.bianjie.avatasdk.model.nat.mt;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -7,7 +7,7 @@
import java.util.List;
/**
- * 查询 MT 类别返回值
+ * 查询 MT 类别正确返回值
*/
@NoArgsConstructor
@Data
@@ -19,28 +19,41 @@ public class QueryMtClassesRes {
@NoArgsConstructor
@Data
public static class DataDTO {
- @JSONField(name = "offset")
- private Integer offset;// 游标
+
+ @JSONField(name = "prev_page_key")
+ private String prevPageKey;// 上一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "next_page_key")
+ private String nextPageKey;// 下一页数据的Key, Avata会根据该值进行上一页数据的查询
+
@JSONField(name = "limit")
private Integer limit;// 每页记录数
+
@JSONField(name = "total_count")
private Integer totalCount;// 总记录数
+
@JSONField(name = "classes")
private List classes;
@NoArgsConstructor
@Data
public static class ClassesDTO {
+
@JSONField(name = "id")
private String id;// MT 类别 ID
+
@JSONField(name = "name")
private String name;// MT 类别名称
+
@JSONField(name = "mt_count")
private Integer mtCount;// MT 类别包含的 MT 总量(AVATA 平台内)
+
@JSONField(name = "owner")
private String owner;// MT 类别权属者地址
+
@JSONField(name = "tx_hash")
private String txHash;// 创建 MT 类别的 Tx Hash
+
@JSONField(name = "timestamp")
private String timestamp;// 创建 MT 类别的时间戳(UTC 时间)
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtHistoryReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtHistoryReq.java
similarity index 55%
rename from src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtHistoryReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtHistoryReq.java
index 5be3821..d4d955d 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtHistoryReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtHistoryReq.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.mt;
+package ai.bianjie.avatasdk.model.nat.mt;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -10,20 +10,32 @@
@NoArgsConstructor
@Data
public class QueryMtHistoryReq {
- @JSONField(name = "offset")
- private Integer offset;// 游标,默认为 0
+
+ @JSONField(name = "page_key")
+ private String pageKey;// 分页数据的Key, Avata会根据该值进行上下页的查询, 该值请从返回的数据体中获取,首页查询可以不传该参数
+
@JSONField(name = "limit")
- private Integer limit;// 每页记录数,默认为 10,上限为 50
+ private String limit;// 每页记录数,默认为 10,上限为 50
+
@JSONField(name = "signer")
private String signer;// Tx 签名者地址
+
@JSONField(name = "tx_hash")
private String txHash;// MT 操作 Tx Hash
+
@JSONField(name = "operation")
- private String operation;// 操作类型: issue(首发MT) / mint(增发MT) / edit(编辑MT) / transfer(转让MT) / burn(销毁MT)
+ private String operation;// 操作类型:1:issue(首发MT) 2:mint(增发MT) 3:edit(编辑MT) 4:transfer(转让MT) 5:burn(销毁MT)
+
@JSONField(name = "start_date")
private String startDate;// MT 操作日期范围 - 开始,yyyy-MM-dd(UTC 时间)
+
@JSONField(name = "end_date")
private String endDate;// MT 操作日期范围 - 结束,yyyy-MM-dd(UTC 时间)
+
@JSONField(name = "sort_by")
private String sortBy;// 排序规则:DATE_ASC / DATE_DESC
+
+ @JSONField(name = "count_total")
+ private String countTotal;// 是否查询数据的总数量 0:不查询总数(默认)1:查询总数
+
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtHistoryRes.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtHistoryRes.java
similarity index 72%
rename from src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtHistoryRes.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtHistoryRes.java
index 2c46074..306f132 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtHistoryRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtHistoryRes.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.mt;
+package ai.bianjie.avatasdk.model.nat.mt;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -19,28 +19,41 @@ public class QueryMtHistoryRes {
@NoArgsConstructor
@Data
public static class DataDTO {
- @JSONField(name = "offset")
- private Integer offset;// 游标
+
+ @JSONField(name = "prev_page_key")
+ private String prevPageKey;// 上一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "next_page_key")
+ private String nextPageKey;// 下一页数据的Key, Avata会根据该值进行上一页数据的查询
+
@JSONField(name = "limit")
private Integer limit;// 每页记录数
+
@JSONField(name = "total_count")
private Integer totalCount;// 总记录数
+
@JSONField(name = "operation_records")
private List operationRecords;
@NoArgsConstructor
@Data
public static class OperationRecordsDTO {
+
@JSONField(name = "tx_hash")
private String txHash;// MT 操作的 Tx Hash
+
@JSONField(name = "operation")
- private String operation;// MT 操作类型;Enum: "issue" "mint" "edit" "transfer" "burn"
+ private Integer operation;// MT 操作类型: 1:issue; 2:mint; 3:edit; 4:transfer; 5:burn;
+
@JSONField(name = "signer")
private String signer;// Tx 签名者地址
+
@JSONField(name = "recipient")
private String recipient;// MT 接收者地址
+
@JSONField(name = "amount")
private Integer amount;// MT 操作数量
+
@JSONField(name = "timestamp")
private String timestamp;// MT 操作时间戳(UTC 时间)
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtRes.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtRes.java
similarity index 94%
rename from src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtRes.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtRes.java
index f1249c6..ba35783 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtRes.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.mt;
+package ai.bianjie.avatasdk.model.nat.mt;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -17,20 +17,28 @@ public class QueryMtRes {
@NoArgsConstructor
@Data
public static class DataDTO {
+
@JSONField(name = "id")
private String id;// MT ID
+
@JSONField(name = "class_id")
private String classId;// MT 类别 ID
+
@JSONField(name = "class_name")
private String className;// MT 类别名称
+
@JSONField(name = "data")
private String data;// 自定义链上元数据
+
@JSONField(name = "owner_count")
private Integer ownerCount;// MT 拥有者数量(AVATA 平台内)
+
@JSONField(name = "issue_data")
- private DataDTO.IssueDataDTO issueData;
+ private IssueDataDTO issueData;
+
@JSONField(name = "mt_count")
private Integer mtCount;// MT 流通总量(全链)
+
@JSONField(name = "mint_times")
private Integer mintTimes;// MT 发行次数(AVATA 平台内累计发行次数(包括首次发行和增发))
@@ -39,10 +47,13 @@ public static class DataDTO {
public static class IssueDataDTO {
@JSONField(name = "issuer")
private String issuer;// 首次发行该 MT 的链账户地址
+
@JSONField(name = "timestamp")
private String timestamp;// 首次发行该 MT 的时间戳
+
@JSONField(name = "count")
private Integer count;// 首次发行该 MT 的数量
+
@JSONField(name = "tx_hash")
private String txHash;// 首次发行该 MT 的交易哈希
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtsReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtsReq.java
similarity index 69%
rename from src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtsReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtsReq.java
index 6f3f367..bf53b13 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtsReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtsReq.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.mt;
+package ai.bianjie.avatasdk.model.nat.mt;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -10,22 +10,34 @@
@NoArgsConstructor
@Data
public class QueryMtsReq {
- @JSONField(name = "offset")
- private String offset;// 游标,默认为 0
+
+ @JSONField(name = "page_key")
+ private String pageKey;// 分页数据的Key, Avata会根据该值进行上下页的查询, 该值请从返回的数据体中获取,首页查询可以不传该参数
+
@JSONField(name = "limit")
private String limit;// 每页记录数,默认为 10,上限为 50
+
@JSONField(name = "id")
private String id;// MT ID
+
@JSONField(name = "class_id")
private String classId;// MT 类别 ID
+
@JSONField(name = "issuer")
private String issuer;// MT 发行者地址
+
@JSONField(name = "tx_hash")
private String txHash;// 创建 MT 的 TX Hash
+
@JSONField(name = "start_date")
private String startDate;// MT 创建日期范围 - 开始,yyyy-MM-dd(UTC 时间)
+
@JSONField(name = "end_date")
private String endDate;// MT 创建日期范围 - 结束,yyyy-MM-dd(UTC 时间)
+
@JSONField(name = "sort_by")
private String sortBy;// 排序规则:DATE_ASC / DATE_DESC
+
+ @JSONField(name = "count_total")
+ private String countTotal;// 是否查询数据的总数量 0:不查询总数(默认)1:查询总数
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtsRes.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtsRes.java
similarity index 76%
rename from src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtsRes.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtsRes.java
index 2534a5a..5118ea5 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtsRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/QueryMtsRes.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.mt;
+package ai.bianjie.avatasdk.model.nat.mt;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -7,7 +7,7 @@
import java.util.List;
/**
- * 查询 MT 返回值
+ * 查询 MT 正确返回值
*/
@NoArgsConstructor
@Data
@@ -19,30 +19,44 @@ public class QueryMtsRes {
@NoArgsConstructor
@Data
public static class DataDTO {
- @JSONField(name = "offset")
- private Integer offset;// 游标
+
+ @JSONField(name = "prev_page_key")
+ private String prevPageKey;// 上一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "next_page_key")
+ private String nextPageKey;// 下一页数据的Key, Avata会根据该值进行上一页数据的查询
+
@JSONField(name = "limit")
private Integer limit;// 每页记录数
+
@JSONField(name = "total_count")
private Integer totalCount;// 总记录数
+
@JSONField(name = "mts")
private List mts;
@NoArgsConstructor
@Data
public static class MtsDTO {
+
@JSONField(name = "id")
private String id;// MT ID
+
@JSONField(name = "class_id")
private String classId;// MT 类别 ID
+
@JSONField(name = "class_name")
private String className;// MT 类别名称
+
@JSONField(name = "issuer")
private String issuer;// 首次发行该 MT 的链账户地址
+
@JSONField(name = "owner_count")
private Integer ownerCount;// MT 拥有者数量(AVATA 平台内)
+
@JSONField(name = "timestamp")
private String timestamp;// MT 首次发行时间戳(UTC 时间)
+
}
}
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/TransferMtClassReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/TransferMtClassReq.java
similarity index 94%
rename from src/main/java/ai/bianjie/avatasdk/model/mt/TransferMtClassReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/mt/TransferMtClassReq.java
index 54b7b87..a66e8a7 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/TransferMtClassReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/TransferMtClassReq.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.mt;
+package ai.bianjie.avatasdk.model.nat.mt;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -13,6 +13,7 @@ public class TransferMtClassReq {
@JSONField(name = "recipient")
private String recipient;// MT 类别接收者地址,支持任一 Avata 内合法链账户地址
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/TransferMtReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/TransferMtReq.java
similarity index 82%
rename from src/main/java/ai/bianjie/avatasdk/model/mt/TransferMtReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/mt/TransferMtReq.java
index 6e43f85..e675843 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/mt/TransferMtReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/mt/TransferMtReq.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.mt;
+package ai.bianjie.avatasdk.model.nat.mt;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -12,9 +12,11 @@
public class TransferMtReq {
@JSONField(name = "amount")
- private Integer amount;// 转移的数量(默认为 1 )
+ private Integer amount;// 转移的数量,不填写数量时,默认转移数量为 1
+
@JSONField(name = "recipient")
private String recipient;// MT 接收者地址
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nat/nft/BurnNftReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/BurnNftReq.java
new file mode 100644
index 0000000..c7b7f5d
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/BurnNftReq.java
@@ -0,0 +1,16 @@
+package ai.bianjie.avatasdk.model.nat.nft;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 销毁 NFT 请求体
+ */
+@NoArgsConstructor
+@Data
+public class BurnNftReq {
+
+ @JSONField(name = "operation_id")
+ private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/CreateNftClassReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/CreateNftClassReq.java
similarity index 81%
rename from src/main/java/ai/bianjie/avatasdk/model/nft/CreateNftClassReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/nft/CreateNftClassReq.java
index d6c88b8..0ab8367 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/CreateNftClassReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/CreateNftClassReq.java
@@ -1,31 +1,43 @@
-package ai.bianjie.avatasdk.model.nft;
+package ai.bianjie.avatasdk.model.nat.nft;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
- * 创建 NFT 类别:request
+ * 创建 NFT 类别请求体
*/
@NoArgsConstructor
@Data
public class CreateNftClassReq {
+
@JSONField(name = "name")
private String name;// NFT 类别名称
+
@JSONField(name = "class_id")
private String classId;// NFT 类别 ID,仅支持小写字母及数字,以字母开头
+
@JSONField(name = "symbol")
private String symbol;// 标识
+
@JSONField(name = "description")
private String description;// 描述
+
@JSONField(name = "uri")
private String uri;// 链外数据链接
+
@JSONField(name = "uri_hash")
private String uriHash;// 链外数据 Hash
+
@JSONField(name = "data")
private String data;// 自定义链上元数据
+
+ @JSONField(name = "editable_by_owner")
+ private Integer editableByOwner;// NFT 类别权限的控制功能, 此类别下某一 NFT 的持有者可以编辑该 NFT,1 可编辑,0 不可编辑,默认 1
+
@JSONField(name = "owner")
private String owner;// NFT 类别权属者地址,拥有在该 NFT 类别中发行 NFT 的权限和转让该 NFT 类别的权限。 支持任一 Avata 平台内合法链账户地址
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/EditNftReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/EditNftReq.java
similarity index 82%
rename from src/main/java/ai/bianjie/avatasdk/model/nft/EditNftReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/nft/EditNftReq.java
index e64fa4e..834dcf9 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/EditNftReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/EditNftReq.java
@@ -1,21 +1,28 @@
-package ai.bianjie.avatasdk.model.nft;
+package ai.bianjie.avatasdk.model.nat.nft;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
- * 编辑 NFT :request
+ * 编辑 NFT 请求体
*/
@NoArgsConstructor
@Data
public class EditNftReq {
+
@JSONField(name = "name")
private String name;// NFT 名称
+
@JSONField(name = "uri")
private String uri;// 链外数据链接
+
@JSONField(name = "data")
private String data;// 自定义链上元数据
+
+ @JSONField(name = "uri_hash")
+ private String uriHash;// 链外数据 Hash
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/MintNftReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/MintNftReq.java
similarity index 93%
rename from src/main/java/ai/bianjie/avatasdk/model/nft/MintNftReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/nft/MintNftReq.java
index 9eb7122..02dfd32 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/MintNftReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/MintNftReq.java
@@ -1,11 +1,11 @@
-package ai.bianjie.avatasdk.model.nft;
+package ai.bianjie.avatasdk.model.nat.nft;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
- * 发行 NFT:request
+ * 发行 NFT 请求体
*/
@NoArgsConstructor
@Data
@@ -13,14 +13,19 @@ public class MintNftReq {
@JSONField(name = "name")
private String name;// NFT 名称
+
@JSONField(name = "uri")
private String uri;// 链外数据链接
+
@JSONField(name = "uri_hash")
private String uriHash;// 链外数据 Hash
+
@JSONField(name = "data")
private String data;// 自定义链上元数据
+
@JSONField(name = "recipient")
private String recipient;// NFT 接收者地址,支持任一文昌链合法链账户地址,默认为 NFT 类别的权属者地址
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftClassRes.java b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftClassRes.java
similarity index 85%
rename from src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftClassRes.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftClassRes.java
index 3ed3449..9fec403 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftClassRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftClassRes.java
@@ -1,11 +1,11 @@
-package ai.bianjie.avatasdk.model.nft;
+package ai.bianjie.avatasdk.model.nat.nft;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
- * 查询 NFT 类别详情:Response
+ * 查询 NFT 类别详情正确返回值
*/
@NoArgsConstructor
@Data
@@ -15,27 +15,41 @@ public class QueryNftClassRes {
@NoArgsConstructor
@Data
public static class DataDTO {
+
@JSONField(name = "id")
private String id;// NFT 类别 ID
+
@JSONField(name = "name")
private String name;// NFT 类别名称
+
@JSONField(name = "symbol")
private String symbol;// NFT 类别标识
+
@JSONField(name = "description")
private String description;// NFT 类别描述
+
@JSONField(name = "nft_count")
private Integer nftCount;// NFT 类别包含的 NFT 总量
+
@JSONField(name = "uri")
private String uri;// 链外数据链接
+
@JSONField(name = "uri_hash")
private String uriHash;// 链外数据 Hash
+
@JSONField(name = "data")
private String data;// 自定义链上元数据
+
@JSONField(name = "owner")
private String owner;// NFT 类别权属者地址
+
@JSONField(name = "tx_hash")
private String txHash;// 创建 NFT 类别的 Tx Hash
+
@JSONField(name = "timestamp")
private String timestamp;// 创建 NFT 类别的时间戳(UTC 时间)
+
+ @JSONField(name = "edit_by_owner")
+ private Integer editByOwner;// 是否可编辑,1可以,0不可以
}
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftClassesReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftClassesReq.java
similarity index 62%
rename from src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftClassesReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftClassesReq.java
index 7b454bb..1c4fb54 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftClassesReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftClassesReq.java
@@ -1,31 +1,43 @@
-package ai.bianjie.avatasdk.model.nft;
+package ai.bianjie.avatasdk.model.nat.nft;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
- * 查询 NFT 类别:request
+ * 查询 NFT 类别请求体
*/
@NoArgsConstructor
@Data
public class QueryNftClassesReq {
- @JSONField(name = "offset")
- private String offset;// 游标,默认为 0
+
+ @JSONField(name = "page_key")
+ private String pageKey;// 分页数据的Key, Avata会根据该值进行上下页的查询, 该值请从返回的数据体中获取,首页查询可以不传该参数
+
@JSONField(name = "limit")
private String limit;// 每页记录数,默认为 10,上限为 50
+
@JSONField(name = "id")
private String id;// NFT 类别 ID
+
@JSONField(name = "name")
private String name;// NFT 类别名称,支持模糊查询
+
@JSONField(name = "owner")
private String owner;// NFT 类别权属者地址
- @JSONField(name = "txHash")
- private String tx_hash;// 创建 NFT 类别的 Tx Hash
+
+ @JSONField(name = "tx_hash")
+ private String txHash;// 创建 NFT 类别的 Tx Hash
+
@JSONField(name = "start_date")
private String startDate;// NFT 类别创建日期范围 - 开始,yyyy-MM-dd(UTC 时间)
+
@JSONField(name = "end_date")
private String endDate;// NFT 类别创建日期范围 - 结束,yyyy-MM-dd(UTC 时间)
+
@JSONField(name = "sort_by")
private String sortBy;// 排序规则:DATE_ASC / DATE_DESC
+
+ @JSONField(name = "count_total")
+ private String countTotal;// 是否查询数据的总数量 0:不查询总数(默认)1:查询总数
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftClassesRes.java b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftClassesRes.java
similarity index 76%
rename from src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftClassesRes.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftClassesRes.java
index c8d5b23..4a3d7e0 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftClassesRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftClassesRes.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.nft;
+package ai.bianjie.avatasdk.model.nat.nft;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -8,7 +8,7 @@
/**
- * 查询 NFT 类别:Response
+ * 查询 NFT 类别正确返回值
*/
@NoArgsConstructor
@Data
@@ -19,12 +19,19 @@ public class QueryNftClassesRes {
@NoArgsConstructor
@Data
public static class DataDTO {
- @JSONField(name = "offset")
- private Integer offset;// 游标
+
+ @JSONField(name = "prev_page_key")
+ private String prevPageKey;// 上一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "next_page_key")
+ private String nextPageKey;// 下一页数据的Key, Avata会根据该值进行上一页数据的查询
+
@JSONField(name = "limit")
private Integer limit;// 每页记录数
+
@JSONField(name = "total_count")
private Integer totalCount;// 总记录数
+
@JSONField(name = "classes")
private List classes;
@@ -34,20 +41,24 @@ public static class DataDTO {
public static class ClassesDTO {
@JSONField(name = "id")
private String id;// NFT 类别 ID
+
@JSONField(name = "name")
private String name;// NFT 类别名称
- @JSONField(name = "symbol")
- private String symbol;// NFT 类别标识
- @JSONField(name = "nft_count")
- private Integer nftCount;// NFT 类别包含的 NFT 总量
+
@JSONField(name = "uri")
private String uri;// 链外数据链接
+
+ @JSONField(name = "symbol")
+ private String symbol;// NFT 类别标识
+
@JSONField(name = "owner")
private String owner;// NFT 类别权属者地址
+
@JSONField(name = "tx_hash")
private String txHash;// 创建 NFT 类别的 Tx Hash
+
@JSONField(name = "timestamp")
- private String timestamp;// 创建 NFT 类别的时间戳(UTC 时间)
+ private String timestamp;// 创建 NFT 类别的时间戳
}
}
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftHistoryReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftHistoryReq.java
similarity index 60%
rename from src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftHistoryReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftHistoryReq.java
index c784df7..50b5304 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftHistoryReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftHistoryReq.java
@@ -1,18 +1,17 @@
-package ai.bianjie.avatasdk.model.nft;
-
+package ai.bianjie.avatasdk.model.nat.nft;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
- * 查询 NFT 操作记录:request
+ * 查询 NFT 操作记录请求体
*/
@NoArgsConstructor
@Data
public class QueryNftHistoryReq {
- @JSONField(name = "offset")
- private String offset;// 游标,默认为 0
+ @JSONField(name = "page_key")
+ private String pageKey;// 分页数据的Key, Avata会根据该值进行上下页的查询, 该值请从返回的数据体中获取,首页查询可以不传该参数
@JSONField(name = "limit")
private String limit;// 每页记录数,默认为 10,上限为 50
@@ -24,7 +23,7 @@ public class QueryNftHistoryReq {
private String txHash;// NFT 操作 Tx Hash
@JSONField(name = "operation")
- private String operation;// 操作类型:mint / edit / transfer / burn
+ private String operation;// 操作类型:1:mint; 2:edit; 3:transfer; 4:burn;
@JSONField(name = "start_date")
private String startDate;// NFT 操作日期范围 - 开始,yyyy-MM-dd(UTC 时间)
@@ -34,4 +33,7 @@ public class QueryNftHistoryReq {
@JSONField(name = "sort_by")
private String sortBy;// 排序规则:DATE_ASC / DATE_DESC
+
+ @JSONField(name = "count_total")
+ private String countTotal;// 是否查询数据的总数量 0:不查询总数(默认)1:查询总数
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftHistoryRes.java b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftHistoryRes.java
new file mode 100644
index 0000000..d08cdb7
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftHistoryRes.java
@@ -0,0 +1,58 @@
+package ai.bianjie.avatasdk.model.nat.nft;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 查询 NFT 操作记录正确返回值
+ */
+@NoArgsConstructor
+@Data
+public class QueryNftHistoryRes {
+
+ @JSONField(name = "data")
+ private DataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class DataDTO {
+
+ @JSONField(name = "prev_page_key")
+ private String prevPageKey;// 上一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "next_page_key")
+ private String nextPageKey;// 下一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "limit")
+ private Integer limit;// 每页记录数
+
+ @JSONField(name = "total_count")
+ private Integer totalCount;// 总记录数
+
+ @JSONField(name = "operation_records")
+ private List operationRecords;// 操作记录列表
+
+ @NoArgsConstructor
+ @Data
+ public static class OperationRecordsDTO {
+
+ @JSONField(name = "tx_hash")
+ private String txHash;// NFT 操作的 Tx Hash
+
+ @JSONField(name = "operation")
+ private Integer operation;// NFT 操作类型: 1:mint; 2:edit; 3:transfer; 4:burn;
+
+ @JSONField(name = "signer")
+ private String signer;// Tx 签名者地址
+
+ @JSONField(name = "recipient")
+ private String recipient;// NFT 接收者地址
+
+ @JSONField(name = "timestamp")
+ private String timestamp;// NFT 操作时间戳(UTC 时间)
+ }
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftRes.java b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftRes.java
similarity index 89%
rename from src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftRes.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftRes.java
index 09e528c..8906caa 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftRes.java
@@ -1,11 +1,11 @@
-package ai.bianjie.avatasdk.model.nft;
+package ai.bianjie.avatasdk.model.nat.nft;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
- * 查询 NFT 详情:Response
+ * 查询 NFT 详情正确返回值
*/
@NoArgsConstructor
@Data
@@ -13,6 +13,7 @@ public class QueryNftRes {
@JSONField(name = "data")
private DataDTO data;
+
@NoArgsConstructor
@Data
public static class DataDTO {
@@ -45,7 +46,7 @@ public static class DataDTO {
private String owner;// NFT 持有者地址
@JSONField(name = "status")
- private String status;// NFT 状态:active / burned;
+ private Integer status;// NFT 状态 1:active 2:burned
@JSONField(name = "tx_hash")
private String txHash;// NFT 发行 Tx Hash
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftsReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftsReq.java
similarity index 67%
rename from src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftsReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftsReq.java
index 93aea30..a713389 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftsReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftsReq.java
@@ -1,18 +1,18 @@
-package ai.bianjie.avatasdk.model.nft;
+package ai.bianjie.avatasdk.model.nat.nft;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
- * 查询 NFT :request
+ * 查询 NFT 请求体
*/
@NoArgsConstructor
@Data
public class QueryNftsReq {
- @JSONField(name = "offset")
- private String offset;// 游标,默认为 0
+ @JSONField(name = "page_key")
+ private String pageKey;// 分页数据的Key, Avata会根据该值进行上下页的查询, 该值请从返回的数据体中获取,首页查询可以不传该参数
@JSONField(name = "limit")
private String limit;// 每页记录数,默认为 10,上限为 50
@@ -33,7 +33,7 @@ public class QueryNftsReq {
private String txHash;// 创建 NFT 的 Tx Hash
@JSONField(name = "status")
- private String status;// NFT 状态:active / burned,默认为 active
+ private String status;// NFT 状态 1:active(默认) 2:burned
@JSONField(name = "start_date")
private String startDate;// NFT 创建日期范围 - 开始,yyyy-MM-dd(UTC 时间)
@@ -44,4 +44,7 @@ public class QueryNftsReq {
@JSONField(name = "sort_by")
private String sortBy;// 排序规则:DATE_ASC / DATE_DESC
+ @JSONField(name = "count_total")
+ private String countTotal;// 是否查询数据的总数量 0:不查询总数(默认)1:查询总数
+
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftsRes.java b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftsRes.java
similarity index 77%
rename from src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftsRes.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftsRes.java
index cb9b57d..b23794d 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/QueryNftsRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/QueryNftsRes.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.nft;
+package ai.bianjie.avatasdk.model.nat.nft;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -7,19 +7,24 @@
import java.util.List;
/**
- * 查询 NFT :Response
+ * 查询 NFT 正确返回值
*/
@NoArgsConstructor
@Data
public class QueryNftsRes {
+
@JSONField(name = "data")
private DataDTO data;
@NoArgsConstructor
@Data
public static class DataDTO {
- @JSONField(name = "offset")
- private Integer offset;// 游标
+
+ @JSONField(name = "prev_page_key")
+ private String prevPageKey;// 上一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "next_page_key")
+ private String nextPageKey;// 下一页数据的Key, Avata会根据该值进行上一页数据的查询
@JSONField(name = "limit")
private Integer limit;// 每页记录数
@@ -55,7 +60,7 @@ public static class NftsDTO {
private String owner;// NFT 持有者地址
@JSONField(name = "status")
- private String status;// NFT 状态:active / burned;
+ private Integer status;// NFT 状态 1:active 2:burned
@JSONField(name = "tx_hash")
private String txHash;// NFT 发行 Tx Hash
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/TransferNftClassReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/TransferNftClassReq.java
similarity index 89%
rename from src/main/java/ai/bianjie/avatasdk/model/nft/TransferNftClassReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/nft/TransferNftClassReq.java
index 39f5eec..b6f69bc 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/TransferNftClassReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/TransferNftClassReq.java
@@ -1,17 +1,19 @@
-package ai.bianjie.avatasdk.model.nft;
+package ai.bianjie.avatasdk.model.nat.nft;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
- * 转让 NFT 类别:request
+ * 转让 NFT 类别请求体
*/
@NoArgsConstructor
@Data
public class TransferNftClassReq {
+
@JSONField(name = "recipient")
private String recipient;// NFT 类别接收者地址,支持任一 Avata 平台内合法链账户地址
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nat/nft/TransferNftReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/TransferNftReq.java
new file mode 100644
index 0000000..69c76b2
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/nft/TransferNftReq.java
@@ -0,0 +1,20 @@
+package ai.bianjie.avatasdk.model.nat.nft;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 转让 NFT 请求体
+ */
+@NoArgsConstructor
+@Data
+public class TransferNftReq {
+
+ @JSONField(name = "recipient")
+ private String recipient;// NFT 接收者地址
+
+ @JSONField(name = "operation_id")
+ private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
+
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/records/CreateRecordReq.java b/src/main/java/ai/bianjie/avatasdk/model/nat/records/CreateRecordReq.java
similarity index 97%
rename from src/main/java/ai/bianjie/avatasdk/model/records/CreateRecordReq.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/records/CreateRecordReq.java
index 0446300..fed4227 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/records/CreateRecordReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/records/CreateRecordReq.java
@@ -1,4 +1,4 @@
-package ai.bianjie.avatasdk.model.records;
+package ai.bianjie.avatasdk.model.nat.records;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@@ -13,20 +13,28 @@ public class CreateRecordReq {
@JSONField(name = "identity_type")
private Integer identityType;// 存证主体;1:个人;2:企业
+
@JSONField(name = "identity_name")
private String identityName;// 个人姓名或企业名称,规范如下:个人姓名:长度限制 1-16 个字符(UTF-8 编码),首字符不能是特殊符号;企业名称:长度限制 1-50 个字符(UTF-8 编码),首字符不能是特殊符号;未传入存证主体字段时,不支持此字段;传入存证主体字段时,此字段必填
+
@JSONField(name = "identity_num")
private String identityNum;// 个人为身份证号码,企业为统一社会信用代码; 未传入存证主体字段时,不支持此字段;传入存证主体字段时,此字段选填
+
@JSONField(name = "type")
private Integer type;// 作品类型: Enum: 1 2 3 4 5 6 7 8 9 10 11 12 13 14,具体参考接口文档
+
@JSONField(name = "name")
private String name;// 作品名称
+
@JSONField(name = "description")
private String description;// 作品描述
+
@JSONField(name = "hash")
private String hash;// 作品哈希;将单个作品源文件使用单向散列函数(如 MD5,SHA 等)进行一次 Hash 计算;将多个作品源文件分别进行一次 Hash 计算,再将得到的 Hash 值进行二次 Hash 计算
+
@JSONField(name = "hash_type")
private Integer hashType;// 作品哈希类型 1:其它; 2:SHA256;3:MD5;4:SHA256-PFV;
+
@JSONField(name = "operation_id")
private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/tx/QueryTxRes.java b/src/main/java/ai/bianjie/avatasdk/model/nat/tx/QueryTxRes.java
similarity index 70%
rename from src/main/java/ai/bianjie/avatasdk/model/tx/QueryTxRes.java
rename to src/main/java/ai/bianjie/avatasdk/model/nat/tx/QueryTxRes.java
index 569d237..e1ea143 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/tx/QueryTxRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/tx/QueryTxRes.java
@@ -1,19 +1,19 @@
-package ai.bianjie.avatasdk.model.tx;
+package ai.bianjie.avatasdk.model.nat.tx;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
-
/**
* 上链交易结果查询返回值
- *
* 交易状态说明:
* status 为 3(未处理),上链请求还在等待处理,请稍等;
* status 为 0(处理中),上链请求正在处理,请等待处理完成;
* status 为 1(成功),交易已上链并执行成功;
* status 为 2(失败),说明该交易执行失败。请在业务侧做容错处理。可以参考接口返回的 message(交易失败的错误描述信息) 对 NFT / MT / 业务接口的请求参数做适当调整后,使用「新的 Operation ID 」重新发起 NFT / MT / 业务接口请求。
*/
+
+
@NoArgsConstructor
@Data
public class QueryTxRes {
@@ -24,52 +24,65 @@ public class QueryTxRes {
@NoArgsConstructor
@Data
public static class DataDTO {
- @JSONField(name = "type")
- private String type;// 用户操作类型;Enum: "issue_class" "transfer_class" "mint_nft" "edit_nft" "burn_nft" "transfer_nft" "issue_class_mt" "transfer_class_mt" "issue_mt" "mint_mt" "edit_mt" "burn_mt" "transfer_mt" "mint_nft_batch" "edit_nft_batch" "burn_nft_batch" "transfer_nft_batch" "create_record"
@JSONField(name = "module")
- private String module;// 交易模块;Enum: "nft" "mt" "record"
+ private Integer module;// 交易模块;Enum: 请通过 查询枚举值列表 接口查看
+
+ @JSONField(name = "operation")
+ private Integer operation; // Enum: 用户操作类型 请通过 查询枚举值列表 接口查看
+
@JSONField(name = "tx_hash")
private String txHash;// 交易哈希
+
@JSONField(name = "status")
- private Integer status;// 交易状态, 0 处理中; 1 成功; 2 失败; 3 未处理;Enum: 0 1 2 3
+ private Integer status;// 交易状态,Enum: 0:处理中; 1:成功; 2:失败; 3:未处理;
+
@JSONField(name = "message")
private String message;// 交易失败的错误描述信息
+
@JSONField(name = "block_height")
private Integer blockHeight;// 交易上链的区块高度
+
@JSONField(name = "timestamp")
private String timestamp;// 交易上链时间(UTC 时间)
+
@JSONField(name = "nft")
private Nft nft;// 具体参考接口文档
+
@JSONField(name = "mt")
private Mt mt;// 具体参考接口文档
+
@JSONField(name = "record")
private Record record;// 具体参考接口文档
@NoArgsConstructor
@Data
public static class Nft {
+
@JSONField(name = "class_id")
- private String classId;
- @JSONField(name = "nft_id")
- private String nftId;
+ private String classId;// NFT 类别 ID
+
+ @JSONField(name = "id")
+ private String id;// NFT ID
}
@NoArgsConstructor
@Data
public static class Mt {
@JSONField(name = "class_id")
- private String classId;
+ private String classId;// MT 类别 ID
@JSONField(name = "mt_id")
- private String mtId;
+ private String mtId;// MT ID
}
@NoArgsConstructor
@Data
public static class Record {
+
@JSONField(name = "record_id")
- private String recordId;
+ private String recordId;// 区块链存证 ID
+
@JSONField(name = "certificate_url")
- private String certificateUrl;
+ private String certificateUrl;// 区块链存证证书的下载链接;证书下载链接并非长期有效,请您尽快将证书文件下载至本地并妥善保管。
}
}
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nat/tx/QueryTxTypesRes.java b/src/main/java/ai/bianjie/avatasdk/model/nat/tx/QueryTxTypesRes.java
new file mode 100644
index 0000000..bdc665b
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/nat/tx/QueryTxTypesRes.java
@@ -0,0 +1,47 @@
+package ai.bianjie.avatasdk.model.nat.tx;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 枚举值列表查询
+ */
+
+@NoArgsConstructor
+@Data
+public class QueryTxTypesRes {
+
+ @JSONField(name = "data")
+ private DataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class DataDTO {
+
+ @JSONField(name = "data")
+ private List data;
+
+ @NoArgsConstructor
+ @Data
+ public static class DataDTO1 {
+
+ @JSONField(name = "module")
+ private Integer module;// 交易模块
+
+ @JSONField(name = "operation")
+ private Integer operation;// 操作类型
+
+ @JSONField(name = "code")
+ private String code;// 标识
+
+ @JSONField(name = "name")
+ private String name;// 名称
+
+ @JSONField(name = "description")
+ private String description;// 描述
+ }
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/BatchEditNftReq.java b/src/main/java/ai/bianjie/avatasdk/model/nft/BatchEditNftReq.java
deleted file mode 100644
index 7c30a34..0000000
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/BatchEditNftReq.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package ai.bianjie.avatasdk.model.nft;
-
-import com.alibaba.fastjson.annotation.JSONField;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.util.List;
-
-/**
- * 批量编辑 NFT :request
- */
-@NoArgsConstructor
-@Data
-public class BatchEditNftReq {
- @JSONField(name = "nfts")
- private List nfts;
-
- @JSONField(name = "operation_id")
- private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
-
- @NoArgsConstructor
- @Data
- public static class NftsDTO {
- @JSONField(name = "class_id")
- private String classId;// NFT 类别 ID
- @JSONField(name = "nft_id")
- private String nftId;// NFT ID
- @JSONField(name = "name")
- private String name;// NFT 名称
- @JSONField(name = "uri")
- private String uri;// 链外数据链接
- @JSONField(name = "data")
- private String data;// 自定义链上元数据
- }
-}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/BatchMintNftReq.java b/src/main/java/ai/bianjie/avatasdk/model/nft/BatchMintNftReq.java
deleted file mode 100644
index 5367291..0000000
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/BatchMintNftReq.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package ai.bianjie.avatasdk.model.nft;
-
-import com.alibaba.fastjson.annotation.JSONField;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.util.List;
-
-/**
- * 批量发行nft:request
- */
-@NoArgsConstructor
-@Data
-public class BatchMintNftReq {
- @JSONField(name = "name")
- private String name;// NFT 名称
- @JSONField(name = "uri")
- private String uri;// 链外数据链接
- @JSONField(name = "uri_hash")
- private String uriHash;// 链外数据 Hash
- @JSONField(name = "data")
- private String data;// 自定义链上元数据
- @JSONField(name = "recipients")
- private List recipients;// NFT 接收者地址和发行数量。以数组的方式进行组合,可以自定义多个组合,可面向多地址批量发行 NFT。
- @JSONField(name = "operation_id")
- private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
-
- @NoArgsConstructor
- @Data
- public static class RecipientsDTO {
- @JSONField(name = "amount")
- private Integer amount;// NFT 发行数量
- @JSONField(name = "recipient")
- private String recipient;// NFT 接收者地址,支持任一文昌链合法链账户地址。
- }
-}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/nft/BatchTransferNftReq.java b/src/main/java/ai/bianjie/avatasdk/model/nft/BatchTransferNftReq.java
deleted file mode 100644
index 0a3da77..0000000
--- a/src/main/java/ai/bianjie/avatasdk/model/nft/BatchTransferNftReq.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package ai.bianjie.avatasdk.model.nft;
-
-import com.alibaba.fastjson.annotation.JSONField;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.util.List;
-
-/**
- * 批量转让 NFT :request
- */
-@NoArgsConstructor
-@Data
-public class BatchTransferNftReq {
- @JSONField(name = "data")
- private List data;
-
- @JSONField(name = "operation_id")
- private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成的、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串
-
- @NoArgsConstructor
- @Data
- public static class DataDTO {
- @JSONField(name = "nfts")
- private List nfts;
- @JSONField(name = "recipient")
- private String recipient;// NFT 接收者地址
-
- @NoArgsConstructor
- @Data
- public static class NftsDTO {
- @JSONField(name = "class_id")
- private String classId;// NFT 类别 ID
- @JSONField(name = "nft_id")
- private String nftId;// NFT ID
- }
- }
-}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/onCallbackRes.java b/src/main/java/ai/bianjie/avatasdk/model/onCallbackRes.java
new file mode 100644
index 0000000..6a605ff
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/onCallbackRes.java
@@ -0,0 +1,200 @@
+package ai.bianjie.avatasdk.model;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+public class onCallbackRes {
+
+ // 验证签名时传入的 API 版本号
+ public static final String APIVersionV1 = "V1"; // V1 版本 AVATA Open API
+ public static final String APIVersionsOther = "";// 其它版本 AVATA Open API
+
+ // 区分调用不同服务模块的接口
+ public static final String Native = "native";
+ public static final String EVM = "evm";
+
+
+ @Data
+ @NoArgsConstructor
+ // OnCallbackResV1 AVATA Open API V1 版本回调服务参数
+ public static class onCallbackResV1 {
+
+ @JSONField(name = "operation_id")
+ private String operationId;// 操作 ID
+
+ @JSONField(name = "module")
+ private String module;// 交易模块
+
+ @JSONField(name = "type")
+ private String type;// 用户操作类型
+
+ @JSONField(name = "status")
+ private Integer status;// 交易状态,1 成功; 2 失败
+
+ @JSONField(name = "tx_hash")
+ private String txHash;// 交易哈希
+
+ @JSONField(name = "message")
+ private String message;// 交易失败的错误描述信息
+
+ @JSONField(name = "block_height")
+ private Integer blockHeight;// 交易上链的区块高度
+
+ @JSONField(name = "timestamp")
+ private String timestamp;// 交易上链时间(UTC 时间)
+
+ @JSONField(name = "nft")
+ private String nft;//对应不同操作类型的消息体
+
+ @JSONField(name = "mt")
+ private String mt;// 对应不同操作类型的消息体
+
+ @JSONField(name = "record")
+ private String record;// 对应不同操作类型的消息体
+ }
+
+
+ @Data
+ @NoArgsConstructor
+ // OnCallbackResNative AVATA Open API V2 及以上版本 Native 模块接口回调服务参数
+ public static class onCallbackResNative {
+
+ @JSONField(name = "kind")
+ private String kind;// 区分服务,native / evm
+
+ @JSONField(name = "operation_id")
+ private String operationId;// 操作 ID
+
+ @JSONField(name = "module")
+ private Integer module;// 交易模块
+
+ @JSONField(name = "operation")
+ private Integer operation;// 用户操作类型
+
+ @JSONField(name = "tx_hash")
+ private String txHash;// 交易哈希
+
+ @JSONField(name = "status")
+ private Integer status;// 交易状态,1 成功; 2 失败
+
+ @JSONField(name = "message")
+ private String message;// 交易失败的错误描述信息
+
+ @JSONField(name = "block_height")
+ private Integer blockHeight;// 交易上链的区块高度
+
+ @JSONField(name = "timestamp")
+ private String timestamp;// 交易上链时间(UTC 时间)
+
+ @JSONField(name = "nft")
+ private NftNative nft;//对应不同操作类型的消息体
+
+ @JSONField(name = "mt")
+ private Mt mt;// 对应不同操作类型的消息体
+
+ @JSONField(name = "record")
+ private Record record;// 对应不同操作类型的消息体
+ }
+
+
+ @Data
+ @NoArgsConstructor
+ // OnCallbackResEVM V2 及以上版本 EVM 模块接口回调服务参数
+ public static class onCallbackResEVM {
+
+ @JSONField(name = "kind")
+ private String kind;// 区分服务,native / evm
+
+ @JSONField(name = "operation_id")
+ private String operationId;// 操作 ID
+
+ @JSONField(name = "module")
+ private Integer module;// 交易模块
+
+ @JSONField(name = "operation")
+ private Integer operation;// 用户操作类型
+
+ @JSONField(name = "tx_hash")
+ private String txHash;// 交易哈希
+
+ @JSONField(name = "status")
+ private Integer status;// 交易状态,1 成功; 2 失败
+
+ @JSONField(name = "message")
+ private String message;// 交易失败的错误描述信息
+
+ @JSONField(name = "block_height")
+ private Integer blockHeight;// 交易上链的区块高度
+
+ @JSONField(name = "timestamp")
+ private String timestamp;// 交易上链时间(UTC 时间)
+
+ @JSONField(name = "nft")
+ private NftEVM nft;//对应不同操作类型的消息体
+ }
+
+ @Data
+ @NoArgsConstructor
+ // NftV1 V1 版本回调返回的 NFT 相关参数
+ public static class NftV1 {
+ @JSONField(name = "class_id")
+ private String classId;// 类别 ID
+
+ @JSONField(name = "nft_id")
+ private String nftId;// NFT ID
+ }
+
+ @Data
+ @NoArgsConstructor
+ // NftNative V2 及以上版本回调返回的原生模块 NFT 相关参数
+ public static class NftNative {
+ @JSONField(name = "class_id")
+ private String classId;// 类别 ID
+
+ @JSONField(name = "id")
+ private String Id;// NFT ID
+ }
+
+ @Data
+ @NoArgsConstructor
+ // NftEVM V2 及以上版本回调返回的 EVM 模块 NFT 相关参数
+ public static class NftEVM {
+ @JSONField(name = "class_id")
+ private String classId;// 类别 ID
+
+ @JSONField(name = "id")
+ private Integer Id;// NFT ID
+ }
+
+ @Data
+ @NoArgsConstructor
+ // Mt 回调返回的 MT 相关参数(不同版本通用)
+ public static class Mt {
+ @JSONField(name = "class_id")
+ private String classId;// MT 类别 ID
+
+ @JSONField(name = "mt_id")
+ private String mtId;// MT ID
+ }
+
+ @Data
+ @NoArgsConstructor
+ // Record 回调返回的 Record 相关参数(不同版本通用)
+ public static class Record {
+ @JSONField(name = "record_id")
+ private String recordId;// 区块链存证 ID
+
+ @JSONField(name = "certificate_url")
+ private String certificateUrl;// 区块链存证证书的下载链接;证书下载链接并非长期有效,请您尽快将证书文件下载至本地并妥善保管。
+ }
+
+ @Data
+ @NoArgsConstructor
+ public static class Kind {
+ @JSONField(name = "kind")
+ private String kind;//区分服务,native / evm
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/ai/bianjie/avatasdk/model/order/BatchCreateOrderReq.java b/src/main/java/ai/bianjie/avatasdk/model/order/BatchCreateOrderReq.java
index 2145dec..50be540 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/order/BatchCreateOrderReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/order/BatchCreateOrderReq.java
@@ -15,14 +15,17 @@ public class BatchCreateOrderReq {
@JSONField(name = "list")
private List list;// 充值信息
- @JSONField(name = "order_id")
- private String orderId;// 自定义订单流水号,必需且仅包含数字、下划线及英文字母大/小写
+
+ @JSONField(name = "operation_id")
+ private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成并自行维护、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串组成。
@NoArgsConstructor
@Data
public static class ListDTO {
+
@JSONField(name = "account")
private String account;// 链账户地址
+
@JSONField(name = "amount")
private Integer amount;// 购买金额 ,只能购买整数元金额;单位:分
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/order/CreateOrderReq.java b/src/main/java/ai/bianjie/avatasdk/model/order/CreateOrderReq.java
index 3c05ee7..2b65ba6 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/order/CreateOrderReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/order/CreateOrderReq.java
@@ -5,17 +5,21 @@
import lombok.NoArgsConstructor;
/**
- * 购买能量值/业务费接口请求参数
+ * 购买能量值接口请求体
*/
@NoArgsConstructor
@Data
public class CreateOrderReq {
+
@JSONField(name = "account")
private String account;// 链账户地址
+
@JSONField(name = "amount")
private Integer amount;// 购买金额 ,只能购买整数元金额;单位:分
+
@JSONField(name = "order_type")
- private String orderType;// 充值类型:gas:能量值;business:业务费;Enum: "gas" "business"
- @JSONField(name = "order_id")
- private String orderId;// 自定义订单流水号,必需且仅包含数字、下划线及英文字母大/小写
+ private Integer orderType;// 充值类型:Enum: 1:gas,能量值;
+
+ @JSONField(name = "operation_id")
+ private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成并自行维护、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串组成。
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/order/OrderRes.java b/src/main/java/ai/bianjie/avatasdk/model/order/OrderRes.java
deleted file mode 100644
index f3f2c48..0000000
--- a/src/main/java/ai/bianjie/avatasdk/model/order/OrderRes.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package ai.bianjie.avatasdk.model.order;
-
-import com.alibaba.fastjson.annotation.JSONField;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-/**
- * 购买能量值/业务费接口返回值/批量购买能量值接口返回值
- */
-@NoArgsConstructor
-@Data
-public class OrderRes {
- @JSONField(name = "data")
- private OrderRes.DataDTO data;
-
- @NoArgsConstructor
- @Data
- public static class DataDTO {
- @JSONField(name = "order_id")
- private String orderId;// 交易流水号(用户发起交易时传入的交易流水号)
- }
-}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrderRes.java b/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrderRes.java
index 80638cb..5a39255 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrderRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrderRes.java
@@ -5,7 +5,12 @@
import lombok.NoArgsConstructor;
/**
- * 查询能量值/业务费购买结果接口返回值
+ * 查询能量值购买结果接口正确返回值
+ *
+ * 订单状态说明:
+ * status 为 1(正在充值),请等待充值完成;
+ * status 为 2(充值成功),能量值/业务费充值成功;
+ * status 为 3(充值失败),说明该交易执行失败。请在业务侧做容错处理。可以参考接口返回的 message(订单失败的错误描述信息) 对业务接口的请求参数做适当调整后,使用「新的 Operation ID 」重新发起业务接口请求。
*/
@NoArgsConstructor
@Data
@@ -17,23 +22,31 @@ public class QueryOrderRes {
@NoArgsConstructor
@Data
public static class DataDTO {
- @JSONField(name = "order_id")
- private String orderId;// 订单流水号
+ @JSONField(name = "operation_id")
+ private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成并自行维护、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串组成。
+
@JSONField(name = "status")
- private String status;// 订单状态:success 充值成功 / failed 充值失败 / pending 正在充值
+ private Integer status;// 订单状态:1 正在充值;2 充值成功;3 充值失败
+
@JSONField(name = "message")
private String message;// 订单失败的错误描述信息
+
@JSONField(name = "account")
private String account;// 链账户地址 (调用「批量购买能量值」接口不展示此字段)
+
@JSONField(name = "amount")
private String amount;// 充值金额,为整数元金额;单位:分 (调用「批量购买能量值」接口不展示此字段)
+
@JSONField(name = "number")
- private String number;// 充值的数量,充值 gas 该值单位为 ugas,充值业务费单位为分(调用「批量购买能量值」接口不展示此字段)
+ private String number;// 充值的数量,充值 gas 该值单位为 ugas(调用「批量购买能量值」接口不展示此字段)
+
@JSONField(name = "create_time")
private String createTime;// 创建时间(UTC 时间)
+
@JSONField(name = "update_time")
private String updateTime;// 最后操作时间(UTC 时间)
+
@JSONField(name = "order_type")
- private String orderType;// 订单类型,gas / business
+ private Integer orderType;// 订单类型 1 gas,能量值;
}
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrdersReq.java b/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrdersReq.java
index fad4c06..365bffd 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrdersReq.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrdersReq.java
@@ -5,21 +5,30 @@
import lombok.NoArgsConstructor;
/**
- * 查询能量值/业务费购买结果列表接口请求参数
+ * 查询能量值购买结果列表接口请求体
*/
@NoArgsConstructor
@Data
public class QueryOrdersReq {
- @JSONField(name = "offset")
- private String offset;// 游标,默认为 0
+
+ @JSONField(name = "page_key")
+ private String pageKey;// 分页数据的Key, Avata会根据该值进行上下页的查询, 该值请从返回的数据体中获取,首页查询可以不传该参数
+
@JSONField(name = "limit")
private String limit;// 每页记录数,默认为 10,上限为 50
+
@JSONField(name = "status")
- private String status;// 订单状态:success 充值成功 / failed 充值失败 / pending 正在充值
+ private String status;// 订单状态: 1 正在充值;2 充值成功;3 充值失败;
+
@JSONField(name = "start_date")
private String startDate;// 充值订单创建日期范围 - 开始,yyyy-MM-dd(UTC 时间)
+
@JSONField(name = "end_date")
private String endDate;// 充值订单创建日期范围 - 结束,yyyy-MM-dd(UTC 时间)
+
@JSONField(name = "sort_by")
private String sortBy;// 排序规则:DATE_ASC / DATE_DESC,默认为 DATE_DESC
+
+ @JSONField(name = "count_total")
+ private String countTotal;// 是否查询数据的总数量 0:不查询总数(默认) 1:查询总数
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrdersRes.java b/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrdersRes.java
index e0b2048..76b4d6a 100644
--- a/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrdersRes.java
+++ b/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrdersRes.java
@@ -7,8 +7,14 @@
import java.util.List;
/**
- * 查询能量值/业务费购买结果列表接口返回值
+ * 查询能量值购买结果列表接口正确返回值
+ *
+ * 订单状态说明:
+ * status 为 1(正在充值),请等待充值完成;
+ * status 为 2(充值成功),能量值/业务费充值成功;
+ * status 为 3(充值失败),说明该交易执行失败。请在业务侧做容错处理。可以参考接口返回的 message(订单失败的错误描述信息) 对业务接口的请求参数做适当调整后,使用「新的 Operation ID 」重新发起业务接口请求。
*/
+
@NoArgsConstructor
@Data
public class QueryOrdersRes {
@@ -19,36 +25,50 @@ public class QueryOrdersRes {
@NoArgsConstructor
@Data
public static class DataDTO {
- @JSONField(name = "offset")
- private int offset;// 游标
+ @JSONField(name = "prev_page_key")
+ private String prevPageKey;// 上一页数据的Key, Avata会根据该值进行上一页数据的查询
+
+ @JSONField(name = "next_page_key")
+ private String nextPageKey;// 下一页数据的Key, Avata会根据该值进行上一页数据的查询
+
@JSONField(name = "limit")
private int limit;// 每页记录数
+
@JSONField(name = "total_count")
private int totalCount;// 总记录数
+
@JSONField(name = "order_infos")
- private List orderInfos;
+ private List orderInfos;// 能量值购买结果列表
@NoArgsConstructor
@Data
public static class OrderInfos {
- @JSONField(name = "order_id")
- private String orderId;// 订单流水号
+ @JSONField(name = "operation_id")
+ private String operationId;// 操作 ID,保证幂等性,避免重复请求,保证对于同一操作发起的一次请求或者多次请求的结果是一致的;由接入方生成并自行维护、针对每个 Project ID 唯一的、不超过 64 个大小写字母、数字、-、下划线的字符串组成。
+
@JSONField(name = "status")
- private String status;// 订单状态:success 充值成功 / failed 充值失败 / pending 正在充值
+ private Integer status;// 订单状态:1 正在充值;2 充值成功;3 充值失败
+
@JSONField(name = "message")
private String message;// 订单失败的错误描述信息
+
@JSONField(name = "account")
private String account;// 链账户地址 (调用「批量购买能量值」接口不展示此字段)
+
@JSONField(name = "amount")
private String amount;// 充值金额,为整数元金额;单位:分 (调用「批量购买能量值」接口不展示此字段)
+
@JSONField(name = "number")
- private String number;// 充值的数量,充值 gas 该值单位为 ugas,充值业务费单位为分(调用「批量购买能量值」接口不展示此字段)
+ private String number;// 充值的数量,充值 gas 该值单位为 ugas(调用「批量购买能量值」接口不展示此字段)
+
@JSONField(name = "create_time")
private String createTime;// 创建时间(UTC 时间)
+
@JSONField(name = "update_time")
private String updateTime;// 最后操作时间(UTC 时间)
+
@JSONField(name = "order_type")
- private String orderType;// 订单类型,gas / business
+ private Integer orderType;// 订单类型: 1:gas,能量值;
}
}
}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/tx/QueryQueueReq.java b/src/main/java/ai/bianjie/avatasdk/model/tx/QueryQueueReq.java
deleted file mode 100644
index 47cb5f6..0000000
--- a/src/main/java/ai/bianjie/avatasdk/model/tx/QueryQueueReq.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package ai.bianjie.avatasdk.model.tx;
-
-import com.alibaba.fastjson.annotation.JSONField;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-/**
- * 上链交易排队状态查询请求参数
- */
-@NoArgsConstructor
-@Data
-public class QueryQueueReq {
- @JSONField(name = "operation_id")
- private String operationId;// 操作 ID,是指用户在进行具体的NFT/MT/业务接口请求时,自定义的操作ID。注意:不支持创建链账户/批量创建链账户的操作 ID 查询。
-}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/tx/QueryQueueRes.java b/src/main/java/ai/bianjie/avatasdk/model/tx/QueryQueueRes.java
deleted file mode 100644
index 2feba48..0000000
--- a/src/main/java/ai/bianjie/avatasdk/model/tx/QueryQueueRes.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package ai.bianjie.avatasdk.model.tx;
-
-import com.alibaba.fastjson.annotation.JSONField;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-/**
- * 上链交易排队状态查询返回值
- */
-@NoArgsConstructor
-@Data
-public class QueryQueueRes {
-
- @JSONField(name = "data")
- private DataDTO data;
-
- @NoArgsConstructor
- @Data
- public static class DataDTO {
- @JSONField(name = "queue_total")
- private Integer queueTotal;// 当前队列中待处理交易总数
- @JSONField(name = "queue_request_time")
- private String queueRequestTime;// 当前队列即将被处理交易的请求时间(UTC 时间)
- @JSONField(name = "queue_cost_time")
- private Integer queueCostTime;// 当前队列中所有交易处理完预估时间(秒)
- @JSONField(name = "tx_queue_position")
- private Integer txQueuePosition;// Operation ID 对应交易所处队列中的位置;若交易存在队列中,0 则表示正在重试
- @JSONField(name = "tx_request_time")
- private String txRequestTime;// Operation ID 对应交易的请求时间(UTC 时间)
- @JSONField(name = "tx_cost_time")
- private Integer txCostTime;// Operation ID 对应交易预估处理所需时间(秒)
- @JSONField(name = "tx_message")
- private String txMessage;// Operation ID 对应交易排队描述信息
- }
-}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/user/CreateUserReq.java b/src/main/java/ai/bianjie/avatasdk/model/user/CreateUserReq.java
new file mode 100644
index 0000000..877bbfd
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/user/CreateUserReq.java
@@ -0,0 +1,43 @@
+package ai.bianjie.avatasdk.model.user;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 创建用户请求体
+ */
+@NoArgsConstructor
+@Data
+public class CreateUserReq {
+
+ @JSONField(name = "user_type")
+ private Integer userType;// 用户类型, 对于创建的钱包用户的类型属性 Enum:1:个人 2:企业
+
+ @JSONField(name = "name")
+ private String name; // 用户的真实姓名, 支持汉字以及大小写字母、空格
+
+ @JSONField(name = "region")
+ private Integer region;// 所属 国家/地区 Enum:1:其他 2:中国大陆(默认) 3:中国香港 4:中国台湾
+
+ @JSONField(name = "certificate_type")
+ private Integer certificateType;// 用户证件类型 Enum:1:身份证(默认) 2:护照
+
+ @JSONField(name = "certificate_num")
+ private String certificateNum;// 用户证件号码
+
+ @JSONField(name = "phone_num")
+ private String phoneNum;// 联系人或授权人手机号
+
+ @JSONField(name = "registration_region")
+ private Integer registrationRegion;// 企业注册地址 Enum: 1:其他 2:中国大陆(默认) 3:中国香港 4:中国台湾
+
+ @JSONField(name = "registration_num")
+ private String registrationNum;// 企业的统一社会信用代码或机构注册号
+
+ @JSONField(name = "business_license")
+ private String businessLicense;// 营业执照或认证授权人声明书
+
+ @JSONField(name = "email")
+ private String email;// 企业邮箱,不支持汉字以及非规范性特殊字符。
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/user/CreateUserRes.java b/src/main/java/ai/bianjie/avatasdk/model/user/CreateUserRes.java
new file mode 100644
index 0000000..e4d8151
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/user/CreateUserRes.java
@@ -0,0 +1,27 @@
+package ai.bianjie.avatasdk.model.user;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 创建用户正确返回值
+ */
+@NoArgsConstructor
+@Data
+public class CreateUserRes {
+
+ @JSONField(name = "data")
+ private DataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class DataDTO {
+ @JSONField(name = "user_id")
+ private String userId;// 用户唯一标识
+
+ @JSONField(name = "did")
+ private String did;// 用户身份标识(预留字段)
+ }
+
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/user/QueryUserReq.java b/src/main/java/ai/bianjie/avatasdk/model/user/QueryUserReq.java
new file mode 100644
index 0000000..a11c070
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/user/QueryUserReq.java
@@ -0,0 +1,19 @@
+package ai.bianjie.avatasdk.model.user;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 查询用户请求体
+ */
+@NoArgsConstructor
+@Data
+public class QueryUserReq {
+
+ @JSONField(name = "user_type")
+ private String userType;// 用户类型, 对于创建的钱包用户的类型属性 Enum:1:个人 2:企业
+
+ @JSONField(name = "code")
+ private String code;// user_type 为 "1" 时,请填写提交认证时对应的个人信息(身份证或护照号) user_type 为 "2" 时,请填写提交认证时对应的企业信息(企业的统一社会信用代码或机构注册号)参数需要进行 hash 操作,hash 算法为:sha-256
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/user/QueryUserRes.java b/src/main/java/ai/bianjie/avatasdk/model/user/QueryUserRes.java
new file mode 100644
index 0000000..94a50ba
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/user/QueryUserRes.java
@@ -0,0 +1,27 @@
+package ai.bianjie.avatasdk.model.user;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 查询用户正确返回值
+ */
+@NoArgsConstructor
+@Data
+public class QueryUserRes {
+
+ @JSONField(name = "data")
+ private DataDTO data;
+
+ @NoArgsConstructor
+ @Data
+ public static class DataDTO {
+
+ @JSONField(name = "user_id")
+ private String userId;// 用户唯一标识
+
+ @JSONField(name = "did")
+ private String did;// 用户身份标识(预留字段)
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/model/user/UpdateUserReq.java b/src/main/java/ai/bianjie/avatasdk/model/user/UpdateUserReq.java
new file mode 100644
index 0000000..d1de594
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/model/user/UpdateUserReq.java
@@ -0,0 +1,19 @@
+package ai.bianjie.avatasdk.model.user;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 更新用户请求体
+ */
+@NoArgsConstructor
+@Data
+public class UpdateUserReq {
+
+ @JSONField(name = "user_id")
+ private String userId;// 用户唯一标识
+
+ @JSONField(name = "phone_num")
+ private String phoneNum;// 手机号
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/account/AccountProxy.java b/src/main/java/ai/bianjie/avatasdk/proxy/account/AccountProxy.java
index 255bb1d..5afc4e9 100644
--- a/src/main/java/ai/bianjie/avatasdk/proxy/account/AccountProxy.java
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/account/AccountProxy.java
@@ -3,6 +3,7 @@
import ai.bianjie.avatasdk.model.account.*;
public interface AccountProxy {
+
/**
* 创建链账户
*
@@ -28,10 +29,20 @@ public interface AccountProxy {
QueryAccountsRes queryAccounts(QueryAccountsReq req);
/**
- * 查询链账户操作记录
+ * 原生模块 查询链账户操作记录
*
* @param req 查询链账户操作记录请求实体
* @return
*/
- QueryAccountsHistoryRes queryAccountsHistory(QueryAccountsHistoryReq req);
+ QueryNatAccountsHistoryRes queryNativeAccountsHistory(QueryAccountsHistoryReq req);
+
+ /**
+ * EVM 模块 查询链账户操作记录
+ *
+ * @param req 查询链账户操作记录请求实体
+ * @return
+ */
+ QueryEvmAccountsHistoryRes queryEvmAccountsHistory(QueryAccountsHistoryReq req);
}
+
+
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/account/impl/AccountClient.java b/src/main/java/ai/bianjie/avatasdk/proxy/account/impl/Account.java
similarity index 51%
rename from src/main/java/ai/bianjie/avatasdk/proxy/account/impl/AccountClient.java
rename to src/main/java/ai/bianjie/avatasdk/proxy/account/impl/Account.java
index f2a7bd5..051ce33 100644
--- a/src/main/java/ai/bianjie/avatasdk/proxy/account/impl/AccountClient.java
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/account/impl/Account.java
@@ -1,26 +1,26 @@
package ai.bianjie.avatasdk.proxy.account.impl;
-import ai.bianjie.avatasdk.config.ConfigInfo;
-import com.alibaba.fastjson.JSONObject;
-import com.dtflys.forest.http.ForestResponse;
import ai.bianjie.avatasdk.exception.AvataException;
-import lombok.extern.slf4j.Slf4j;
import ai.bianjie.avatasdk.model.account.*;
import ai.bianjie.avatasdk.proxy.account.AccountProxy;
import ai.bianjie.avatasdk.util.HttpClient;
+import com.alibaba.fastjson.JSONObject;
+import com.dtflys.forest.http.ForestResponse;
import com.dtflys.forest.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class AccountClient implements AccountProxy {
- private static final String CREATE_ACCOUNT = "/v1beta1/account";
- private static final String BATCH_CREATE_ACCOUNTS = "/v1beta1/accounts";
- private static final String QUERY_ACCOUNTS = "/v1beta1/accounts";
- private static final String QUERY_ACCOUNTS_HISTORY = "/v1beta1/accounts/history";
+public class Account implements AccountProxy {
- private ConfigInfo configInfo;
+ private static final String CREATE_ACCOUNT = "/v3/account";// 创建链账户接口
+ private static final String BATCH_CREATE_ACCOUNTS = "/v3/accounts";// 批量创建链账户接口
+ private static final String QUERY_ACCOUNTS = "/v3/accounts";// 查询链账户接口
+ private static final String QUERY_NATIVE_ACCOUNTS_HISTORY = "/v3/native/accounts/history";// 原生模块查询链账户操作记录接口
+ private static final String QUERY_EVM_ACCOUNTS_HISTORY = "/v3/evm/accounts/history";// EVM 模块查询链账户操作记录接口
+ private HttpClient httpClient;
- public AccountClient(ConfigInfo configInfo) {
- this.configInfo = configInfo;
+ public Account(HttpClient httpClient) {
+ this.httpClient = httpClient;
}
@Override
@@ -28,17 +28,12 @@ public CreateAccountRes createAccount(CreateAccountReq req) {
log.debug("CreateAccountReq {}", req);
log.debug("createAccount start");
// check params
- if (StringUtils.isEmpty(req.getName())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "name"));
- }
if (StringUtils.isEmpty(req.getOperationId())) {
throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
}
- ForestResponse response = HttpClient.Post(CREATE_ACCOUNT, JSONObject.toJSONString(req), configInfo);
-
+ ForestResponse response = httpClient.post(CREATE_ACCOUNT, JSONObject.toJSONString(req));
String result = response.readAsString();
CreateAccountRes res = JSONObject.parseObject(result, CreateAccountRes.class);
-
log.debug("createAccount end");
return res;
}
@@ -51,12 +46,9 @@ public BatchCreateAccountRes batchCreateAccounts(BatchCreateAccountReq req) {
if (StringUtils.isEmpty(req.getOperationId())) {
throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
}
- ForestResponse response = HttpClient.Post(BATCH_CREATE_ACCOUNTS, JSONObject.toJSONString(req), configInfo);
-
+ ForestResponse response = httpClient.post(BATCH_CREATE_ACCOUNTS, JSONObject.toJSONString(req));
String result = response.readAsString();
-
BatchCreateAccountRes res = JSONObject.parseObject(result, BatchCreateAccountRes.class);
-
log.debug("batchCreateAccounts end");
return res;
}
@@ -65,27 +57,34 @@ public BatchCreateAccountRes batchCreateAccounts(BatchCreateAccountReq req) {
public QueryAccountsRes queryAccounts(QueryAccountsReq req) {
log.debug("QueryAccountsReq {}", req);
log.debug("queryAccounts start");
- ForestResponse response = HttpClient.Get(QUERY_ACCOUNTS, JSONObject.toJSONString(req), configInfo);
-
+ ForestResponse response = httpClient.get(QUERY_ACCOUNTS, JSONObject.toJSONString(req));
String result = response.readAsString();
-
QueryAccountsRes res = JSONObject.parseObject(result, QueryAccountsRes.class);
-
log.debug("queryAccounts end");
return res;
}
+
@Override
- public QueryAccountsHistoryRes queryAccountsHistory(QueryAccountsHistoryReq req) {
+ public QueryNatAccountsHistoryRes queryNativeAccountsHistory(QueryAccountsHistoryReq req) {
log.debug("QueryAccountsHistoryReq {}", req);
- log.debug("queryAccountsHistory start");
- ForestResponse response = HttpClient.Get(QUERY_ACCOUNTS_HISTORY, JSONObject.toJSONString(req), configInfo);
+ log.debug("queryNatAccountsHistory start");
+ ForestResponse response = httpClient.get(QUERY_NATIVE_ACCOUNTS_HISTORY, JSONObject.toJSONString(req));
+ String result = response.readAsString();
+ QueryNatAccountsHistoryRes res = JSONObject.parseObject(result, QueryNatAccountsHistoryRes.class);
+ log.debug("queryNatAccountsHistory end");
+ return res;
+ }
+
+ @Override
+ public QueryEvmAccountsHistoryRes queryEvmAccountsHistory(QueryAccountsHistoryReq req) {
+ log.debug("QueryAccountsHistoryReq {}", req);
+ log.debug("queryEvmAccountsHistory start");
+ ForestResponse response = httpClient.get(QUERY_EVM_ACCOUNTS_HISTORY, JSONObject.toJSONString(req));
String result = response.readAsString();
-
- QueryAccountsHistoryRes res = JSONObject.parseObject(result, QueryAccountsHistoryRes.class);
-
- log.debug("queryAccountsHistory end");
+ QueryEvmAccountsHistoryRes res = JSONObject.parseObject(result, QueryEvmAccountsHistoryRes.class);
+ log.debug("queryEvmAccountsHistory end");
return res;
}
}
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/evm/contract/ContractProxy.java b/src/main/java/ai/bianjie/avatasdk/proxy/evm/contract/ContractProxy.java
new file mode 100644
index 0000000..10d46dd
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/evm/contract/ContractProxy.java
@@ -0,0 +1,24 @@
+package ai.bianjie.avatasdk.proxy.evm.contract;
+
+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;
+
+public interface ContractProxy {
+ /**
+ * 调用合约
+ *
+ * @param req 调用合约请求体
+ * @return
+ */
+ PublicResponse contractCall(ContractCallReq req);
+
+ /**
+ * 查询合约
+ *
+ * @param req 查询合约请求体
+ * @return
+ */
+ QueryContractCallRes queryContractCall(QueryContractCallReq req);
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/evm/contract/impl/Contract.java b/src/main/java/ai/bianjie/avatasdk/proxy/evm/contract/impl/Contract.java
new file mode 100644
index 0000000..5ad0ffd
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/evm/contract/impl/Contract.java
@@ -0,0 +1,70 @@
+package ai.bianjie.avatasdk.proxy.evm.contract.impl;
+
+import ai.bianjie.avatasdk.exception.AvataException;
+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 ai.bianjie.avatasdk.proxy.evm.contract.ContractProxy;
+import ai.bianjie.avatasdk.util.HttpClient;
+import com.alibaba.fastjson.JSONObject;
+import com.dtflys.forest.http.ForestResponse;
+import com.dtflys.forest.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class Contract implements ContractProxy {
+
+ private static final String CONTRACT_CALL = "/v3/evm/contract/calls";// 调用合约接口
+ private static final String QUERY_CONTRACT_CALL = "/v3/evm/contract/calls";// 查询合约接口
+ private HttpClient httpClient;
+
+ public Contract(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ }
+
+ @Override
+ public PublicResponse contractCall(ContractCallReq req) {
+ log.debug("ContractCallReq {}", req);
+ log.debug("contractCall start");
+ // check params
+ if (StringUtils.isEmpty(req.getTo())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "to"));
+ }
+ if (StringUtils.isEmpty(req.getData())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "data"));
+ }
+ if (req.getGasLimit() == null) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "gas_limit"));
+ }
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
+ }
+ if (StringUtils.isEmpty(req.getFrom())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "from"));
+ }
+ ForestResponse response = httpClient.post(CONTRACT_CALL, JSONObject.toJSONString(req));
+ String result = response.readAsString();
+ PublicResponse res = JSONObject.parseObject(result, PublicResponse.class);
+ log.debug("contractCall end");
+ return res;
+ }
+
+ @Override
+ public QueryContractCallRes queryContractCall(QueryContractCallReq req) {
+ log.debug("QueryContractCallReq {}", req);
+ log.debug("queryContractCall start");
+ // check params
+ if (StringUtils.isEmpty(req.getTo())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "to"));
+ }
+ if (StringUtils.isEmpty(req.getData())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "data"));
+ }
+ ForestResponse response = httpClient.get(QUERY_CONTRACT_CALL, JSONObject.toJSONString(req));
+ String result = response.readAsString();
+ QueryContractCallRes res = JSONObject.parseObject(result, QueryContractCallRes.class);
+ log.debug("queryContractCall end");
+ return res;
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/evm/nft/NftProxy.java b/src/main/java/ai/bianjie/avatasdk/proxy/evm/nft/NftProxy.java
new file mode 100644
index 0000000..dfe3f91
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/evm/nft/NftProxy.java
@@ -0,0 +1,111 @@
+package ai.bianjie.avatasdk.proxy.evm.nft;
+
+import ai.bianjie.avatasdk.model.PublicResponse;
+import ai.bianjie.avatasdk.model.evm.nft.*;
+
+public interface NftProxy {
+
+ /**
+ * 创建 NFT 类别
+ *
+ * @param req 创建 NFT 类别请求实体
+ * @return
+ */
+ PublicResponse createNftClass(CreateNftClassReq req);
+
+ /**
+ * 查询 NFT 类别
+ *
+ * @param req 查询 NFT 类别请求实体
+ * @return
+ */
+ QueryNftClassesRes queryNftClasses(QueryNftClassesReq req);
+
+ /**
+ * 查询 NFT 类别详情
+ *
+ * @param classId NFT 合约地址
+ * @return
+ */
+ QueryNftClassRes queryNftClass(String classId);
+
+ /**
+ * 转让 NFT 类别
+ *
+ * @param req 转让 NFT 类别请求实体
+ * @param classId NFT 合约地址
+ * @param owner NFT 类别权属者地址
+ * @return
+ */
+ PublicResponse transferNftClass(TransferNftClassReq req, String classId, String owner);
+
+ /**
+ * 发行 NFT
+ *
+ * @param req 发行 NFT 请求实体
+ * @param classId NFT 合约地址
+ * @return
+ */
+ PublicResponse mintNft(MintNftReq req, String classId);
+
+ /**
+ * 转让 NFT
+ *
+ * @param req 转让 NFT请求实体
+ * @param classId NFT 合约地址
+ * @param owner NFT 持有者地址
+ * @param nftId NFT ID
+ * @return
+ */
+ PublicResponse transferNft(TransferNftReq req, String classId, String owner, String nftId);
+
+ /**
+ * 编辑 NFT
+ *
+ * @param req 编辑 NFT 请求实体
+ * @param classId NFT 合约地址
+ * @param owner NFT NFT 持有者地址或者 NFT 类别权属者地址,也是 Tx 签名者地址
+ * @param nftId NFT ID
+ * @return
+ */
+ PublicResponse editNft(EditNftReq req, String classId, String owner, String nftId);
+
+ /**
+ * 销毁 NFT
+ *
+ * @param req 销毁 NFT 请求实体
+ * @param classId NFT 合约地址
+ * @param owner NFT 持有者地址,也是 Tx 签名者地址
+ * @param nftId NFT ID
+ * @return
+ */
+ PublicResponse burnNft(BurnNftReq req, String classId, String owner, String nftId);
+
+
+ /**
+ * 查询 NFT
+ *
+ * @param req 查询 NFT请求实体
+ * @return
+ */
+ QueryNftsRes queryNfts(QueryNftsReq req);
+
+ /**
+ * 查询 NFT 详情
+ *
+ * @param classId NFT 合约地址
+ * @param nftId NFT ID
+ * @return
+ */
+ QueryNftRes queryNft(String classId, String nftId);
+
+ /**
+ * 查询 NFT 操作记录
+ *
+ * @param classId NFT 合约地址
+ * @param nftId NFT ID
+ * @param req 查询 NFT 操作记录请求实体
+ * @return
+ */
+ QueryNftHistoryRes queryNftHistory(String classId, String nftId, QueryNftHistoryReq req);
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/evm/nft/impl/Nft.java b/src/main/java/ai/bianjie/avatasdk/proxy/evm/nft/impl/Nft.java
new file mode 100644
index 0000000..435a211
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/evm/nft/impl/Nft.java
@@ -0,0 +1,207 @@
+package ai.bianjie.avatasdk.proxy.evm.nft.impl;
+
+import ai.bianjie.avatasdk.exception.AvataException;
+import ai.bianjie.avatasdk.model.PublicResponse;
+import ai.bianjie.avatasdk.model.evm.nft.*;
+import ai.bianjie.avatasdk.proxy.evm.nft.NftProxy;
+import ai.bianjie.avatasdk.util.HttpClient;
+import com.alibaba.fastjson.JSONObject;
+import com.dtflys.forest.http.ForestResponse;
+import com.dtflys.forest.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class Nft implements NftProxy {
+ private static final String CREATE_NFT_CLASS = "/v3/evm/nft/classes"; // 创建 NFT 类别
+ private static final String QUERY_NFT_CLASSES = "/v3/evm/nft/classes";// 查询 NFT 类别
+ private static final String QUERY_NFT_CLASS = "/v3/evm/nft/classes/%s";// 查询 NFT 类别详情
+ private static final String TRANSFER_NFT_CLASS = "/v3/evm/nft/class-transfers/%s/%s";// 转让 NFT 类别
+ private static final String MINT_NFT = "/v3/evm/nft/nfts/%s";// 发行 NFT
+ private static final String TRANSFER_NFT = "/v3/evm/nft/nft-transfers/%s/%s/%s";// 转让 NFT
+ private static final String EDIT_NFT = "/v3/evm/nft/nfts/%s/%s/%s";// 编辑 NFT
+ private static final String DELETE_NFT = "/v3/evm/nft/nfts/%s/%s/%s";// 销毁 NFT
+ private static final String QUERY_NFTS = "/v3/evm/nft/nfts";// 查询 NFT
+ private static final String QUERY_NFT = "/v3/evm/nft/nfts/%s/%s";// 查询 NFT 详情
+ private static final String QUERY_NFT_HISTORY = "/v3/evm/nft/nfts/%s/%s/history";// 查询 NFT 操作记录
+
+ private HttpClient httpClient;
+
+ public Nft(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ }
+
+
+ @Override
+ public PublicResponse createNftClass(CreateNftClassReq req) {
+ log.debug("CreateNftClassReq {}", req);
+ log.debug("createNftClass start");
+ // check params
+ if (StringUtils.isEmpty(req.getName())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "name"));
+ }
+ if (StringUtils.isEmpty(req.getSymbol())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "symbol"));
+ }
+ if (StringUtils.isEmpty(req.getOwner())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "owner"));
+ }
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
+ }
+ ForestResponse response = httpClient.post(CREATE_NFT_CLASS, JSONObject.toJSONString(req));
+ PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
+ log.debug("createNftClass end");
+ return res;
+ }
+
+ @Override
+ public QueryNftClassesRes queryNftClasses(QueryNftClassesReq req) {
+ log.debug("QueryNftClassesReq {}", req);
+ log.debug("queryNftClasses start");
+ ForestResponse response = httpClient.get(QUERY_NFT_CLASSES, JSONObject.toJSONString(req));
+ String result = response.readAsString();
+ QueryNftClassesRes res = JSONObject.parseObject(result, QueryNftClassesRes.class);
+ log.debug("queryNftClasses end");
+ return res;
+ }
+
+ @Override
+ public QueryNftClassRes queryNftClass(String classId) {
+ log.debug("classId {}", classId);
+ log.debug("queryNftClass start");
+ String path = String.format(QUERY_NFT_CLASS, classId);
+ ForestResponse response = httpClient.get(path, "");
+ String result = response.readAsString();
+ QueryNftClassRes res = JSONObject.parseObject(result, QueryNftClassRes.class);
+ log.debug("queryNftClass end");
+ return res;
+ }
+
+ @Override
+ public PublicResponse transferNftClass(TransferNftClassReq req, String classId, String owner) {
+ log.debug("TransferNftClassReq {}, classId {}, owner {}", req, classId, owner);
+ log.debug("transferNftClass start");
+ // check params
+ if (StringUtils.isEmpty(req.getRecipient())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "recipient"));
+ }
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
+ }
+ String path = String.format(TRANSFER_NFT_CLASS, classId, owner);
+ ForestResponse response = httpClient.post(path, JSONObject.toJSONString(req));
+ PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
+ log.debug("transferNftClass end");
+ return res;
+
+ }
+
+ @Override
+ public PublicResponse mintNft(MintNftReq req, String classId) {
+ log.debug("MintNftReq {}, classId {}", req, classId);
+ log.debug("mintNft start");
+ // check params
+ if (StringUtils.isEmpty(req.getUri())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "uri"));
+ }
+ if (StringUtils.isEmpty(req.getRecipient())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "recipient"));
+ }
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
+ }
+ String path = String.format(MINT_NFT, classId);
+ ForestResponse response = httpClient.post(path, JSONObject.toJSONString(req));
+ PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
+ log.debug("mintNft end");
+ return res;
+ }
+
+ @Override
+ public PublicResponse transferNft(TransferNftReq req, String classId, String owner, String nftId) {
+ log.debug("TransferNftReq {}, classId {}, owner {}, nftId {}", req, classId, owner, nftId);
+ log.debug("transferNft start");
+ // check params
+ if (StringUtils.isEmpty(req.getRecipient())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "recipient"));
+ }
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
+ }
+ String path = String.format(TRANSFER_NFT, classId, owner, nftId);
+ ForestResponse response = httpClient.post(path, JSONObject.toJSONString(req));
+ String result = response.readAsString();
+ PublicResponse res = JSONObject.parseObject(result, PublicResponse.class);
+ log.debug("transferNft end");
+ return res;
+ }
+
+ @Override
+ public PublicResponse editNft(EditNftReq req, String classId, String owner, String nftId) {
+ log.debug("EditNftReq {}, classId {}, owner {}, nftId {}", req, classId, owner, nftId);
+ log.debug("editNft start");
+ // check params
+ if (StringUtils.isEmpty(req.getUri())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "uri"));
+ }
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
+ }
+ String path = String.format(EDIT_NFT, classId, owner, nftId);
+ ForestResponse response = httpClient.patch(path, JSONObject.toJSONString(req));
+ PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
+ log.debug("editNft end");
+ return res;
+ }
+
+ @Override
+ public PublicResponse burnNft(BurnNftReq req, String classId, String owner, String nftId) {
+ log.debug("BurnNftReq {}, classId {}, owner {}, nftId {}", req, classId, owner, nftId);
+ log.debug("burnNft start");
+ // check params
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
+ }
+ String path = String.format(DELETE_NFT, classId, owner, nftId);
+ ForestResponse response = httpClient.delete(path, JSONObject.toJSONString(req));
+ PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
+ log.debug("burnNft end");
+ return res;
+ }
+
+
+ @Override
+ public QueryNftsRes queryNfts(QueryNftsReq req) {
+ log.debug("QueryNftsReq {}", req);
+ log.debug("queryNfts start");
+ ForestResponse response = httpClient.get(QUERY_NFTS, JSONObject.toJSONString(req));
+ String result = response.readAsString();
+ QueryNftsRes res = JSONObject.parseObject(result, QueryNftsRes.class);
+ log.debug("queryNfts end");
+ return res;
+ }
+
+ @Override
+ public QueryNftRes queryNft(String classId, String nftId) {
+ log.debug("classId {}, nftId {}", classId, nftId);
+ log.debug("queryNft start");
+ String path = String.format(QUERY_NFT, classId, nftId);
+ ForestResponse response = httpClient.get(path, "");
+ String result = response.readAsString();
+ QueryNftRes res = JSONObject.parseObject(result, QueryNftRes.class);
+ log.debug("queryNft end");
+ return res;
+ }
+
+ @Override
+ public QueryNftHistoryRes queryNftHistory(String classId, String nftId, QueryNftHistoryReq req) {
+ log.debug("classId {}, nftId {}", classId, nftId);
+ log.debug("queryNftHistory start");
+ String path = String.format(QUERY_NFT_HISTORY, classId, nftId);
+ ForestResponse response = httpClient.get(path, JSONObject.toJSONString(req));
+ String result = response.readAsString();
+ QueryNftHistoryRes res = JSONObject.parseObject(result, QueryNftHistoryRes.class);
+ log.debug("queryNftHistory end");
+ return res;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/evm/ns/NsProxy.java b/src/main/java/ai/bianjie/avatasdk/proxy/evm/ns/NsProxy.java
new file mode 100644
index 0000000..4084532
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/evm/ns/NsProxy.java
@@ -0,0 +1,79 @@
+package ai.bianjie.avatasdk.proxy.evm.ns;
+
+import ai.bianjie.avatasdk.model.PublicResponse;
+import ai.bianjie.avatasdk.model.evm.ns.*;
+
+public interface NsProxy {
+
+ /**
+ * 注册域名
+ *
+ * @param req 注册域名请求实体
+ * @return
+ */
+ PublicResponse registerDomain(RegisterDomainReq req);
+
+ /**
+ * 查询域名
+ *
+ * @param req 查询域名请求实体
+ * @return
+ */
+ QueryDomainRes queryDomain(QueryDomainReq req);
+
+ /**
+ * 查询用户域名
+ *
+ * @param req 查询用户域名请求实体
+ * @return
+ */
+ QueryOwnerDomainRes queryOwnerDomain(QueryOwnerDomainReq req, String owner);
+
+ /**
+ * 转让域名
+ *
+ * @param req 转让域名请求实体
+ * @return
+ */
+ PublicResponse transferDomain(TransferDomainReq req, String owner, String name);
+
+
+ /**
+ * 设置域名解析
+ *
+ * @param req 设置域名解析请求实体
+ * @param owner 域名拥有者地址
+ * @param name 域名名称
+ * @return
+ */
+ PublicResponse resolveDomain(ResolveDomainReq req, String owner, String name);
+
+
+ /**
+ * 查询域名解析
+ *
+ * @param name 域名名称
+ * @param req 查询域名解析请求实体
+ * @return
+ */
+ QueryDomainResolvesRes queryDomainResolves(String name, QueryDomainResolvesReq req);
+
+ /**
+ * 设置域名反向解析
+ *
+ * @param req 设置域名反向解析请求实体
+ * @param owner 域名拥有者地址
+ * @return
+ */
+
+ PublicResponse reverseResolveDomain(ReverseResolveDomainReq req, String owner);
+
+
+ /**
+ * 查询域名反向解析
+ *
+ * @param owner 域名拥有者地址
+ */
+
+ QueryReverseResolveDomainRes queryReverseResolveDomain(String owner);
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/evm/ns/impl/Ns.java b/src/main/java/ai/bianjie/avatasdk/proxy/evm/ns/impl/Ns.java
new file mode 100644
index 0000000..0db154a
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/evm/ns/impl/Ns.java
@@ -0,0 +1,152 @@
+package ai.bianjie.avatasdk.proxy.evm.ns.impl;
+
+import ai.bianjie.avatasdk.exception.AvataException;
+import ai.bianjie.avatasdk.model.PublicResponse;
+import ai.bianjie.avatasdk.model.evm.ns.*;
+import ai.bianjie.avatasdk.proxy.evm.ns.NsProxy;
+import ai.bianjie.avatasdk.util.HttpClient;
+import com.alibaba.fastjson.JSONObject;
+import com.dtflys.forest.http.ForestResponse;
+import com.dtflys.forest.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class Ns implements NsProxy {
+ private static final String REGISTER_DOMAIN = "/v3/evm/ns/domains"; // 注册域名
+ private static final String QUERY_DOMAIN = "/v3/evm/ns/domains"; // 查询域名
+ private static final String QUERY_OWNER_DOMAIN = "/v3/evm/ns/domains/%s"; // 查询用户域名
+ private static final String TRANSFER_DOMAIN = "/v3/evm/ns/transfers/%s/%s"; // 转让域名
+ private static final String RESOLVE_DOMAIN = "/v3/evm/ns/resolves/%s/%s"; // 设置域名解析
+ private static final String QUERY_RESOLVE_DOMAIN = "/v3/evm/ns/resolves/%s"; // 设置域名解析
+ private static final String REVERSE_RESOLVE_DOMAIN = "/v3/evm/ns/reverse-resolves/%s"; // 设置域名反向解析
+
+ private static final String QUERY_REVERSE_RESOLVE_DOMAIN = "/v3/evm/ns/reverse-resolves/%s"; // 查询域名反向解析
+
+ private HttpClient httpClient;
+
+ public Ns(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ }
+
+ @Override
+ public PublicResponse registerDomain(RegisterDomainReq req) {
+ log.debug("RegisterDomainReq {}", req);
+ log.debug("RegisterDomain start");
+ // check params
+ if (StringUtils.isEmpty(req.getName())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "name"));
+ }
+ if (StringUtils.isEmpty(req.getOwner())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "owner"));
+ }
+ if (req.getDuration() == null) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "duration"));
+ }
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
+ }
+ ForestResponse response = httpClient.post(REGISTER_DOMAIN, JSONObject.toJSONString(req));
+ PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
+ log.debug("RegisterDomain end");
+ return res;
+ }
+
+ @Override
+ public QueryDomainRes queryDomain(QueryDomainReq req) {
+ log.debug("QueryDomainReq {}", req);
+ log.debug("queryDomain start");
+ // check params
+ if (StringUtils.isEmpty(req.getName())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "name"));
+ }
+ ForestResponse response = httpClient.get(QUERY_DOMAIN, JSONObject.toJSONString(req));
+ String result = response.readAsString();
+ QueryDomainRes res = JSONObject.parseObject(result, QueryDomainRes.class);
+ log.debug("queryDomain end");
+ return res;
+ }
+
+ @Override
+ public QueryOwnerDomainRes queryOwnerDomain(QueryOwnerDomainReq req, String owner) {
+ log.debug("QueryOwnerDomainReq {}", req);
+ log.debug("queryOwnerDomain start");
+ String path = String.format(QUERY_OWNER_DOMAIN, owner);
+ ForestResponse response = httpClient.get(path, JSONObject.toJSONString(req));
+ String result = response.readAsString();
+ QueryOwnerDomainRes res = JSONObject.parseObject(result, QueryOwnerDomainRes.class);
+ log.debug("queryOwnerDomain end");
+ return res;
+ }
+
+ @Override
+ public PublicResponse transferDomain(TransferDomainReq req, String owner, String name) {
+ log.debug("TransferDomainReq {}", req);
+ log.debug("transferDomain start");
+ // check params
+ if (StringUtils.isEmpty(req.getRecipient())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "recipient"));
+ }
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
+ }
+ String path = String.format(TRANSFER_DOMAIN, owner, name);
+ ForestResponse response = httpClient.post(path, JSONObject.toJSONString(req));
+ PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
+ log.debug("transferDomain end");
+ return res;
+ }
+
+ @Override
+ public PublicResponse resolveDomain(ResolveDomainReq req, String owner, String name) {
+ log.debug("ResolveDomainReq {},owner {}, name {}", req, owner, name);
+ log.debug("resolveDomain start");
+ // check params
+ if (req.getResolveType() == null) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "resolve_type"));
+ }
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
+ }
+ String path = String.format(RESOLVE_DOMAIN, owner, name);
+ ForestResponse response = httpClient.post(path, JSONObject.toJSONString(req));
+ PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
+ log.debug("resolveDomain end");
+ return res;
+ }
+
+ @Override
+ public QueryDomainResolvesRes queryDomainResolves(String name, QueryDomainResolvesReq req) {
+ log.debug("name {}, QueryDomainResolvesReq {}", name, req);
+ log.debug("queryDomainResolves start");
+ String path = String.format(QUERY_RESOLVE_DOMAIN, name, req);
+ ForestResponse response = httpClient.get(path, JSONObject.toJSONString(req));
+ String result = response.readAsString();
+ QueryDomainResolvesRes res = JSONObject.parseObject(result, QueryDomainResolvesRes.class);
+ log.debug("queryDomainResolves end");
+ return res;
+ }
+
+ @Override
+ public PublicResponse reverseResolveDomain(ReverseResolveDomainReq req, String owner) {
+ log.debug("ReverseResolveDomainReq {}, owner {}", req, owner);
+ log.debug("reverseResolveDomain start");
+ String path = String.format(REVERSE_RESOLVE_DOMAIN, owner);
+ ForestResponse response = httpClient.post(path, JSONObject.toJSONString(req));
+ PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
+ log.debug("reverseResolveDomain end");
+ return res;
+ }
+
+ @Override
+ public QueryReverseResolveDomainRes queryReverseResolveDomain(String owner) {
+ log.debug("owner {}", owner);
+ log.debug("queryReverseResolveDomain start");
+ String path = String.format(QUERY_REVERSE_RESOLVE_DOMAIN, owner);
+ ForestResponse response = httpClient.get(path, "");
+ String result = response.readAsString();
+ QueryReverseResolveDomainRes res = JSONObject.parseObject(result, QueryReverseResolveDomainRes.class);
+ log.debug("queryReverseResolveDomain end");
+ return res;
+ }
+}
+
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/evm/tx/TxProxy.java b/src/main/java/ai/bianjie/avatasdk/proxy/evm/tx/TxProxy.java
new file mode 100644
index 0000000..86488e9
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/evm/tx/TxProxy.java
@@ -0,0 +1,25 @@
+package ai.bianjie.avatasdk.proxy.evm.tx;
+
+import ai.bianjie.avatasdk.model.evm.tx.QueryTxRes;
+import ai.bianjie.avatasdk.model.evm.tx.QueryTxTypesRes;
+
+
+public interface TxProxy {
+ /**
+ * 上链交易结果查询
+ *
+ * @param operationId OPERATION ID
+ * @return QueryTxRes
+ */
+ QueryTxRes queryTx(String operationId);
+
+
+ /**
+ * EVM 枚举值列表查询
+ *
+ * @return QueryTxTypesRes
+ */
+
+ QueryTxTypesRes queryTxTypes();
+
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/evm/tx/impl/Tx.java b/src/main/java/ai/bianjie/avatasdk/proxy/evm/tx/impl/Tx.java
new file mode 100644
index 0000000..71846fb
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/evm/tx/impl/Tx.java
@@ -0,0 +1,46 @@
+package ai.bianjie.avatasdk.proxy.evm.tx.impl;
+
+import ai.bianjie.avatasdk.model.evm.tx.QueryTxRes;
+import ai.bianjie.avatasdk.model.evm.tx.QueryTxTypesRes;
+import ai.bianjie.avatasdk.proxy.evm.tx.TxProxy;
+import ai.bianjie.avatasdk.util.HttpClient;
+import com.alibaba.fastjson.JSONObject;
+import com.dtflys.forest.http.ForestResponse;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class Tx implements TxProxy {
+
+ private static final String QUERY_TX = "/v3/evm/tx/%s"; // EVM 上链交易结果查询
+ private static final String QUERY_TX_TYPES = "/v3/evm/dict/tx_types"; // EVM 枚举值列表查询
+
+ private HttpClient httpClient;
+
+ public Tx(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ }
+
+ @Override
+ public QueryTxRes queryTx(String operationId) {
+ log.debug("operationId {}", operationId);
+ log.debug("queryTx start");
+ String path = String.format(QUERY_TX, operationId);
+ ForestResponse response = httpClient.get(path, "");
+ String result = response.readAsString();
+ QueryTxRes res = JSONObject.parseObject(result, QueryTxRes.class);
+ log.debug("queryTx end");
+ return res;
+ }
+
+
+ @Override
+ public QueryTxTypesRes queryTxTypes(){
+ log.debug("queryTxTypes start");
+ ForestResponse response = httpClient.get(QUERY_TX_TYPES, "");
+ String result = response.readAsString();
+ QueryTxTypesRes res = JSONObject.parseObject(result, QueryTxTypesRes.class);
+ log.debug("queryTxTypes end");
+ return res;
+ }
+
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/mt/MtProxy.java b/src/main/java/ai/bianjie/avatasdk/proxy/nat/mt/MtProxy.java
similarity index 97%
rename from src/main/java/ai/bianjie/avatasdk/proxy/mt/MtProxy.java
rename to src/main/java/ai/bianjie/avatasdk/proxy/nat/mt/MtProxy.java
index 28176df..b17df14 100644
--- a/src/main/java/ai/bianjie/avatasdk/proxy/mt/MtProxy.java
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/nat/mt/MtProxy.java
@@ -1,7 +1,7 @@
-package ai.bianjie.avatasdk.proxy.mt;
+package ai.bianjie.avatasdk.proxy.nat.mt;
import ai.bianjie.avatasdk.model.PublicResponse;
-import ai.bianjie.avatasdk.model.mt.*;
+import ai.bianjie.avatasdk.model.nat.mt.*;
public interface MtProxy {
/**
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/mt/impl/MtClient.java b/src/main/java/ai/bianjie/avatasdk/proxy/nat/mt/impl/Mt.java
similarity index 75%
rename from src/main/java/ai/bianjie/avatasdk/proxy/mt/impl/MtClient.java
rename to src/main/java/ai/bianjie/avatasdk/proxy/nat/mt/impl/Mt.java
index 34a4e8b..ae51f13 100644
--- a/src/main/java/ai/bianjie/avatasdk/proxy/mt/impl/MtClient.java
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/nat/mt/impl/Mt.java
@@ -1,36 +1,35 @@
-package ai.bianjie.avatasdk.proxy.mt.impl;
+package ai.bianjie.avatasdk.proxy.nat.mt.impl;
-import ai.bianjie.avatasdk.config.ConfigInfo;
-import com.alibaba.fastjson.JSONObject;
-import com.dtflys.forest.http.ForestResponse;
import ai.bianjie.avatasdk.exception.AvataException;
-import lombok.extern.slf4j.Slf4j;
import ai.bianjie.avatasdk.model.PublicResponse;
-import ai.bianjie.avatasdk.model.mt.*;
-import ai.bianjie.avatasdk.proxy.mt.MtProxy;
+import ai.bianjie.avatasdk.model.nat.mt.*;
+import ai.bianjie.avatasdk.proxy.nat.mt.MtProxy;
import ai.bianjie.avatasdk.util.HttpClient;
+import com.alibaba.fastjson.JSONObject;
+import com.dtflys.forest.http.ForestResponse;
import com.dtflys.forest.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class MtClient implements MtProxy {
- private static final String CREATE_MT_CLASS = "/v1beta1/mt/classes";
- private static final String QUERY_MT_CLASSES = "/v1beta1/mt/classes";
- private static final String QUERY_MT_CLASS = "/v1beta1/mt/classes/%s";
- private static final String TRANSFER_MT_CLASS = "/v1beta1/mt/class-transfers/%s/%s";
- private static final String CREATE_MT = "/v1beta1/mt/mt-issues/%s";
- private static final String MINT_MT = "/v1beta1/mt/mt-mints/%s/%s";
- private static final String TRANSFER_MT = "/v1beta1/mt/mt-transfers/%s/%s/%s";
- private static final String EDIT_MT = "/v1beta1/mt/mts/%s/%s/%s";
- private static final String DELETE_MT = "/v1beta1/mt/mts/%s/%s/%s";
- private static final String QUERY_MTS = "/v1beta1/mt/mts";
- private static final String QUERY_MT = "/v1beta1/mt/mts/%s/%s";
- private static final String QUERY_MT_HISTORY = "/v1beta1/mt/mts/%s/%s/history";
- private static final String QUERY_MT_BALANCES = "/v1beta1/mt/mts/%s/%s/balances";
-
- private ConfigInfo configInfo;
-
- public MtClient(ConfigInfo configInfo) {
- this.configInfo = configInfo;
+public class Mt implements MtProxy {
+ private static final String CREATE_MT_CLASS = "/v3/native/mt/classes"; // 创建 MT 类别
+ private static final String QUERY_MT_CLASSES = "/v3/native/mt/classes"; // 查询 MT 类别
+ private static final String QUERY_MT_CLASS = "/v3/native/mt/classes/%s"; // 查询 MT 类别详情
+ private static final String TRANSFER_MT_CLASS = "/v3/native/mt/class-transfers/%s/%s"; // 转让 MT 类别
+ private static final String CREATE_MT = "/v3/native/mt/mt-issues/%s"; // 发行 MT
+ private static final String MINT_MT = "/v3/native/mt/mt-mints/%s/%s"; // 增发 MT
+ private static final String TRANSFER_MT = "/v3/native/mt/mt-transfers/%s/%s/%s"; // 转让 MT
+ private static final String EDIT_MT = "/v3/native/mt/mts/%s/%s/%s"; // 编辑 MT
+ private static final String DELETE_MT = "/v3/native/mt/mts/%s/%s/%s"; // 销毁 MT
+ private static final String QUERY_MTS = "/v3/native/mt/mts"; // 查询 MT
+ private static final String QUERY_MT = "/v3/native/mt/mts/%s/%s"; // 查询 MT 详情
+ private static final String QUERY_MT_HISTORY = "/v3/native/mt/mts/%s/%s/history"; // 查询 MT 操作记录
+ private static final String QUERY_MT_BALANCES = "/v3/native/mt/mts/%s/%s/balances"; // 查询 MT 余额
+
+ private HttpClient httpClient;
+
+ public Mt(HttpClient httpClient) {
+ this.httpClient = httpClient;
}
@Override
@@ -47,7 +46,7 @@ public PublicResponse createMtClass(CreateMtClassReq req) {
if (StringUtils.isEmpty(req.getOperationId())) {
throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
}
- ForestResponse response = HttpClient.Post(CREATE_MT_CLASS, JSONObject.toJSONString(req), configInfo);
+ ForestResponse response = httpClient.post(CREATE_MT_CLASS, JSONObject.toJSONString(req));
PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
log.debug("createMtClass end");
return res;
@@ -57,11 +56,9 @@ public PublicResponse createMtClass(CreateMtClassReq req) {
public QueryMtClassesRes queryMtClasses(QueryMtClassesReq req) {
log.debug("QueryMtClassesReq {}", req);
log.debug("queryMtClasses start");
- ForestResponse response = HttpClient.Get(QUERY_MT_CLASSES, JSONObject.toJSONString(req), configInfo);
+ ForestResponse response = httpClient.get(QUERY_MT_CLASSES, JSONObject.toJSONString(req));
String result = response.readAsString();
-
QueryMtClassesRes res = JSONObject.parseObject(result, QueryMtClassesRes.class);
-
log.debug("queryMtClasses end");
return res;
}
@@ -69,13 +66,12 @@ public QueryMtClassesRes queryMtClasses(QueryMtClassesReq req) {
@Override
public QueryMtClassRes queryMtClass(String classId) {
log.debug("classId {}", classId);
- log.debug("queryMtClasses start");
+ log.debug("queryMtClass start");
String path = String.format(QUERY_MT_CLASS, classId);
- ForestResponse response = HttpClient.Get(path, "", configInfo);
+ ForestResponse response = httpClient.get(path, "");
String result = response.readAsString();
-
QueryMtClassRes res = JSONObject.parseObject(result, QueryMtClassRes.class);
-
+ log.debug("queryMtClass end");
return res;
}
@@ -91,7 +87,7 @@ public PublicResponse transferMtClass(TransferMtClassReq req, String classId, St
throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
}
String path = String.format(TRANSFER_MT_CLASS, classId, owner);
- ForestResponse response = HttpClient.Post(path, JSONObject.toJSONString(req), configInfo);
+ ForestResponse response = httpClient.post(path, JSONObject.toJSONString(req));
PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
log.debug("transferMtClass end");
return res;
@@ -106,7 +102,7 @@ public PublicResponse createMt(IssueMtReq req, String classId) {
throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
}
String path = String.format(CREATE_MT, classId);
- ForestResponse response = HttpClient.Post(path, JSONObject.toJSONString(req), configInfo);
+ ForestResponse response = httpClient.post(path, JSONObject.toJSONString(req));
PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
log.debug("createMt end");
return res;
@@ -121,7 +117,7 @@ public PublicResponse mintMt(MintMtReq req, String classId, String mtId) {
throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
}
String path = String.format(MINT_MT, classId, mtId);
- ForestResponse response = HttpClient.Post(path, JSONObject.toJSONString(req), configInfo);
+ ForestResponse response = httpClient.post(path, JSONObject.toJSONString(req));
PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
log.debug("mintMt end");
return res;
@@ -139,7 +135,7 @@ public PublicResponse transferMt(TransferMtReq req, String classId, String owner
throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
}
String path = String.format(TRANSFER_MT, classId, owner, mtId);
- ForestResponse response = HttpClient.Post(path, JSONObject.toJSONString(req), configInfo);
+ ForestResponse response = httpClient.post(path, JSONObject.toJSONString(req));
PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
log.debug("transferMt end");
return res;
@@ -157,7 +153,7 @@ public PublicResponse editMt(EditMtReq req, String classId, String owner, String
throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
}
String path = String.format(EDIT_MT, classId, owner, mtId);
- ForestResponse response = HttpClient.Patch(path, JSONObject.toJSONString(req), configInfo);
+ ForestResponse response = httpClient.patch(path, JSONObject.toJSONString(req));
PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
log.debug("editMt end");
return res;
@@ -172,7 +168,7 @@ public PublicResponse deleteMt(BurnMtReq req, String classId, String owner, Stri
throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
}
String path = String.format(DELETE_MT, classId, owner, mtId);
- ForestResponse response = HttpClient.Delete(path, JSONObject.toJSONString(req), configInfo);
+ ForestResponse response = httpClient.delete(path, JSONObject.toJSONString(req));
PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
log.debug("deleteMt end");
return res;
@@ -182,11 +178,9 @@ public PublicResponse deleteMt(BurnMtReq req, String classId, String owner, Stri
public QueryMtsRes queryMts(QueryMtsReq req) {
log.debug("QueryMtsReq {}", req);
log.debug("queryMts start");
- ForestResponse response = HttpClient.Get(QUERY_MTS, JSONObject.toJSONString(req), configInfo);
+ ForestResponse response = httpClient.get(QUERY_MTS, JSONObject.toJSONString(req));
String result = response.readAsString();
-
QueryMtsRes res = JSONObject.parseObject(result, QueryMtsRes.class);
-
log.debug("queryMts end");
return res;
}
@@ -196,11 +190,9 @@ public QueryMtRes queryMt(String classId, String mtId) {
log.debug("classId {}, mtId {}", classId, mtId);
log.debug("queryMt start");
String path = String.format(QUERY_MT, classId, mtId);
- ForestResponse response = HttpClient.Get(path,"", configInfo);
+ ForestResponse response = httpClient.get(path,"");
String result = response.readAsString();
-
QueryMtRes res = JSONObject.parseObject(result, QueryMtRes.class);
-
log.debug("queryMt end");
return res;
}
@@ -210,11 +202,9 @@ public QueryMtHistoryRes queryMtHistory(QueryMtHistoryReq req, String classId, S
log.debug("QueryMtHistoryReq {}, classId {}, mtId {}", req, classId, mtId);
log.debug("queryMtHistory start");
String path = String.format(QUERY_MT_HISTORY, classId, mtId);
- ForestResponse response = HttpClient.Get(path, JSONObject.toJSONString(req), configInfo);
+ ForestResponse response = httpClient.get(path, JSONObject.toJSONString(req));
String result = response.readAsString();
-
QueryMtHistoryRes res = JSONObject.parseObject(result, QueryMtHistoryRes.class);
-
log.debug("queryMtHistory end");
return res;
}
@@ -224,11 +214,9 @@ public QueryMtBalancesRes queryMtBalances(QueryMtBalancesReq req, String classId
log.debug("QueryMtBalancesReq {}, classId {}, account {}", req, classId, account);
log.debug("queryMtBalances start");
String path = String.format(QUERY_MT_BALANCES, classId, account);
- ForestResponse response = HttpClient.Get(path, JSONObject.toJSONString(req), configInfo);
+ ForestResponse response = httpClient.get(path, JSONObject.toJSONString(req));
String result = response.readAsString();
-
QueryMtBalancesRes res = JSONObject.parseObject(result, QueryMtBalancesRes.class);
-
log.debug("queryMtBalances end");
return res;
}
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/nft/NftProxy.java b/src/main/java/ai/bianjie/avatasdk/proxy/nat/nft/NftProxy.java
similarity index 63%
rename from src/main/java/ai/bianjie/avatasdk/proxy/nft/NftProxy.java
rename to src/main/java/ai/bianjie/avatasdk/proxy/nat/nft/NftProxy.java
index 9c8c30d..154a929 100644
--- a/src/main/java/ai/bianjie/avatasdk/proxy/nft/NftProxy.java
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/nat/nft/NftProxy.java
@@ -1,7 +1,8 @@
-package ai.bianjie.avatasdk.proxy.nft;
+package ai.bianjie.avatasdk.proxy.nat.nft;
import ai.bianjie.avatasdk.model.PublicResponse;
-import ai.bianjie.avatasdk.model.nft.*;
+import ai.bianjie.avatasdk.model.nat.nft.*;
+
public interface NftProxy {
@@ -13,13 +14,14 @@ public interface NftProxy {
*/
PublicResponse createClass(CreateNftClassReq req);
+
/**
* 查询 NFT 类别
*
* @param req 查询 NFT 类别请求实体
* @return
*/
- QueryNftClassesRes queryClasses(QueryNftClassesReq req);
+ QueryNftClassesRes queryClasses(QueryNftClassesReq req);
/**
* 查询 NFT 类别详情
@@ -27,7 +29,7 @@ public interface NftProxy {
* @param classId NFT 类别 ID
* @return
*/
- QueryNftClassRes queryClass(String classId);
+QueryNftClassRes queryClass(String classId);
/**
* 转让 NFT 类别
@@ -81,41 +83,6 @@ public interface NftProxy {
*/
PublicResponse burnNft(BurnNftReq req, String classId, String owner, String nftId);
- /**
- * 批量发行 NFT
- *
- * @param req 批量发行 NFT 请求实体
- * @param classId NFT 类别 ID
- * @return
- */
- PublicResponse batchCreateNft(BatchMintNftReq req, String classId);
-
- /**
- * 批量转让 NFT
- *
- * @param req 批量转让 NFT 请求实体
- * @param owner NFT 持有者地址
- * @return
- */
- PublicResponse batchTransferNft(BatchTransferNftReq req, String owner);
-
- /**
- * 批量编辑 NFT
- *
- * @param req 批量编辑 NFT请求实体
- * @param owner NFT 持有者地址,也是 Tx 签名者地址
- * @return
- */
- PublicResponse batchEditNft(BatchEditNftReq req, String owner);
-
- /**
- * 批量销毁 NFT
- *
- * @param req 批量销毁 NFT请求实体
- * @param owner NFT 持有者地址,也是 Tx 签名者地址
- * @return
- */
- PublicResponse batchBurnNft(BatchBurnNftReq req, String owner);
/**
* 查询 NFT
@@ -123,7 +90,7 @@ public interface NftProxy {
* @param req 查询 NFT请求实体
* @return
*/
- QueryNftsRes queryNfts(QueryNftsReq req);
+ QueryNftsRes queryNfts(QueryNftsReq req);
/**
* 查询 NFT 详情
@@ -132,7 +99,7 @@ public interface NftProxy {
* @param nftId NFT ID
* @return
*/
- QueryNftRes queryNft(String classId, String nftId);
+ QueryNftRes queryNft(String classId, String nftId);
/**
* 查询 NFT 操作记录
@@ -142,5 +109,5 @@ public interface NftProxy {
* @param req 查询 NFT 操作记录请求实体
* @return
*/
- QueryNftHistoryRes queryNftHistory(String classId, String nftId,QueryNftHistoryReq req);
+ QueryNftHistoryRes queryNftHistory(String classId, String nftId, QueryNftHistoryReq req);
}
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/nat/nft/impl/Nft.java b/src/main/java/ai/bianjie/avatasdk/proxy/nat/nft/impl/Nft.java
new file mode 100644
index 0000000..b011e52
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/nat/nft/impl/Nft.java
@@ -0,0 +1,212 @@
+package ai.bianjie.avatasdk.proxy.nat.nft.impl;
+
+import ai.bianjie.avatasdk.exception.AvataException;
+import ai.bianjie.avatasdk.model.PublicResponse;
+import ai.bianjie.avatasdk.model.nat.nft.*;
+import ai.bianjie.avatasdk.proxy.nat.nft.NftProxy;
+import ai.bianjie.avatasdk.util.HttpClient;
+import com.alibaba.fastjson.JSONObject;
+import com.dtflys.forest.http.ForestResponse;
+import com.dtflys.forest.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class Nft implements NftProxy {
+ private static final String CREATE_CLASS = "/v3/native/nft/classes"; // 创建 NFT 类别
+ private static final String QUERY_CLASSES = "/v3/native/nft/classes";// 查询 NFT 类别
+ private static final String QUERY_CLASS = "/v3/native/nft/classes/%s";// 查询 NFT 类别详情
+ private static final String TRANSFER_CLASS = "/v3/native/nft/class-transfers/%s/%s";// 转让 NFT 类别
+ private static final String CREATE_NFT = "/v3/native/nft/nfts/%s";// 发行 NFT
+ private static final String TRANSFER_NFT = "/v3/native/nft/nft-transfers/%s/%s/%s";// 转让 NFT
+ private static final String EDIT_NFT = "/v3/native/nft/nfts/%s/%s/%s";// 编辑 NFT
+ private static final String DELETE_NFT = "/v3/native/nft/nfts/%s/%s/%s";// 销毁 NFT
+
+ private static final String QUERY_NFTS = "/v3/native/nft/nfts";// 查询 NFT
+ private static final String QUERY_NFT = "/v3/native/nft/nfts/%s/%s";// 查询 NFT 详情
+ private static final String QUERY_NFT_HISTORY = "/v3/native/nft/nfts/%s/%s/history";// 查询 NFT 操作记录
+
+ private HttpClient httpClient;
+
+ public Nft(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ }
+
+
+ @Override
+ public PublicResponse createClass(CreateNftClassReq req) {
+ log.debug("CreateNftClassReq {}", req);
+ log.debug("createClass start");
+ // check params
+ if (StringUtils.isEmpty(req.getName())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "name"));
+ }
+ if (StringUtils.isEmpty(req.getOwner())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "owner"));
+ }
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
+ }
+ ForestResponse response = httpClient.post(CREATE_CLASS, JSONObject.toJSONString(req));
+
+ PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
+ log.debug("createClass end");
+ return res;
+ }
+
+ @Override
+ public QueryNftClassesRes queryClasses(QueryNftClassesReq req) {
+ log.debug("QueryNftClassesReq {}", req);
+ log.debug("queryClasses start");
+ ForestResponse response = httpClient.get(QUERY_CLASSES, JSONObject.toJSONString(req));
+ String result = response.readAsString();
+
+ QueryNftClassesRes res = JSONObject.parseObject(result,QueryNftClassesRes.class);
+
+ log.debug("queryClasses end");
+ return res;
+ }
+
+ @Override
+ public QueryNftClassRes queryClass(String classId) {
+ log.debug("classId {}", classId);
+ log.debug("queryClass start");
+ String path = String.format(QUERY_CLASS, classId);
+ ForestResponse response = httpClient.get(path, "");
+ String result = response.readAsString();
+
+ QueryNftClassRes res = JSONObject.parseObject(result,QueryNftClassRes.class);
+
+ log.debug("queryClass end");
+ return res;
+ }
+
+ @Override
+ public PublicResponse transferClass(TransferNftClassReq req, String classId, String owner) {
+ log.debug("TransferNftClassReq {}, classId {}, owner {}", req, classId, owner);
+ log.debug("transferClass start");
+ // check params
+ if (StringUtils.isEmpty(req.getRecipient())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "recipient"));
+ }
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
+ }
+ String path = String.format(TRANSFER_CLASS, classId, owner);
+ ForestResponse response = httpClient.post(path, JSONObject.toJSONString(req));
+ PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
+ log.debug("transferClass end");
+ return res;
+
+ }
+
+ @Override
+ public PublicResponse createNft(MintNftReq req, String classId) {
+ log.debug("MintNftReq {}, classId {}", req, classId);
+ log.debug("createNft start");
+ // check params
+
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
+ }
+ String path = String.format(CREATE_NFT, classId);
+ ForestResponse response = httpClient.post(path, JSONObject.toJSONString(req));
+ PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
+ log.debug("createNft end");
+ return res;
+ }
+
+ @Override
+ public PublicResponse transferNft(TransferNftReq req, String classId, String owner, String nftId) {
+ log.debug("TransferNftReq {}, classId {}, owner {}, nftId {}", req, classId, owner, nftId);
+ log.debug("transferNft start");
+ // check params
+ if (StringUtils.isEmpty(req.getRecipient())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "recipient"));
+ }
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
+ }
+ String path = String.format(TRANSFER_NFT, classId, owner, nftId);
+ ForestResponse response = httpClient.post(path, JSONObject.toJSONString(req));
+ String result = response.readAsString();
+
+ PublicResponse res = JSONObject.parseObject(result, PublicResponse.class);
+
+ log.debug("transferNft end");
+ return res;
+ }
+
+ @Override
+ public PublicResponse editNft(EditNftReq req, String classId, String owner, String nftId) {
+ log.debug("EditNftReq {}, classId {}, owner {}, nftId {}", req, classId, owner, nftId);
+ log.debug("editNft start");
+ // check params
+
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
+ }
+ String path = String.format(EDIT_NFT, classId, owner, nftId);
+ ForestResponse response = httpClient.patch(path, JSONObject.toJSONString(req));
+ PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
+ log.debug("editNft end");
+ return res;
+ }
+
+ @Override
+ public PublicResponse burnNft(BurnNftReq req, String classId, String owner, String nftId) {
+ log.debug("BurnNftReq {}, classId {}, owner {}, nftId {}", req, classId, owner, nftId);
+ log.debug("deleteNft start");
+ // check params
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
+ }
+ String path = String.format(DELETE_NFT, classId, owner, nftId);
+ ForestResponse response = httpClient.delete(path, JSONObject.toJSONString(req));
+ PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
+ log.debug("deleteNft end");
+ return res;
+ }
+
+
+ @Override
+ public QueryNftsRes queryNfts(QueryNftsReq req) {
+ log.debug("QueryNftsReq {}", req);
+ log.debug("queryNfts start");
+ ForestResponse response = httpClient.get(QUERY_NFTS, JSONObject.toJSONString(req));
+ String result = response.readAsString();
+
+ QueryNftsRes res = JSONObject.parseObject(result,QueryNftsRes.class);
+
+ log.debug("queryNfts end");
+ return res;
+ }
+
+ @Override
+ public QueryNftRes queryNft(String classId, String nftId) {
+ log.debug("classId {}, nftId {}", classId, nftId);
+ log.debug("queryNft start");
+ String path = String.format(QUERY_NFT, classId, nftId);
+ ForestResponse response = httpClient.get(path, "");
+ String result = response.readAsString();
+
+ QueryNftRes res = JSONObject.parseObject(result,QueryNftRes.class);
+
+ log.debug("queryNft end");
+ return res;
+ }
+
+ @Override
+ public QueryNftHistoryRes queryNftHistory(String classId, String nftId, QueryNftHistoryReq req) {
+ log.debug("classId {}, nftId {}", classId, nftId);
+ log.debug("queryNftHistory start");
+ String path = String.format(QUERY_NFT_HISTORY, classId, nftId);
+ ForestResponse response = httpClient.get(path, "");
+ String result = response.readAsString();
+
+ QueryNftHistoryRes res = JSONObject.parseObject(result,QueryNftHistoryRes.class);
+
+ log.debug("queryNftHistory end");
+ return res;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/record/RecordProxy.java b/src/main/java/ai/bianjie/avatasdk/proxy/nat/records/RecordsProxy.java
similarity index 64%
rename from src/main/java/ai/bianjie/avatasdk/proxy/record/RecordProxy.java
rename to src/main/java/ai/bianjie/avatasdk/proxy/nat/records/RecordsProxy.java
index c238455..9f9c8ef 100644
--- a/src/main/java/ai/bianjie/avatasdk/proxy/record/RecordProxy.java
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/nat/records/RecordsProxy.java
@@ -1,9 +1,9 @@
-package ai.bianjie.avatasdk.proxy.record;
+package ai.bianjie.avatasdk.proxy.nat.records;
import ai.bianjie.avatasdk.model.PublicResponse;
-import ai.bianjie.avatasdk.model.records.CreateRecordReq;
+import ai.bianjie.avatasdk.model.nat.records.CreateRecordReq;
-public interface RecordProxy {
+public interface RecordsProxy {
/**
* 数字作品存证接口, 创建数字作品存证
*
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/record/impl/RecordClient.java b/src/main/java/ai/bianjie/avatasdk/proxy/nat/records/impl/Records.java
similarity index 75%
rename from src/main/java/ai/bianjie/avatasdk/proxy/record/impl/RecordClient.java
rename to src/main/java/ai/bianjie/avatasdk/proxy/nat/records/impl/Records.java
index 14dd3d7..d961770 100644
--- a/src/main/java/ai/bianjie/avatasdk/proxy/record/impl/RecordClient.java
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/nat/records/impl/Records.java
@@ -1,24 +1,24 @@
-package ai.bianjie.avatasdk.proxy.record.impl;
+package ai.bianjie.avatasdk.proxy.nat.records.impl;
-import ai.bianjie.avatasdk.config.ConfigInfo;
-import com.alibaba.fastjson.JSONObject;
-import com.dtflys.forest.http.ForestResponse;
import ai.bianjie.avatasdk.exception.AvataException;
-import lombok.extern.slf4j.Slf4j;
import ai.bianjie.avatasdk.model.PublicResponse;
-import ai.bianjie.avatasdk.model.records.CreateRecordReq;
-import ai.bianjie.avatasdk.proxy.record.RecordProxy;
+import ai.bianjie.avatasdk.model.nat.records.CreateRecordReq;
+import ai.bianjie.avatasdk.proxy.nat.records.RecordsProxy;
import ai.bianjie.avatasdk.util.HttpClient;
+import com.alibaba.fastjson.JSONObject;
+import com.dtflys.forest.http.ForestResponse;
import com.dtflys.forest.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class RecordClient implements RecordProxy {
- private static final String CREATE_RECORD = "/v1beta1/record/records";
+public class Records implements RecordsProxy {
+
+ private static final String CREATE_RECORD = "/v3/native/record/records";// 创建存证
- private ConfigInfo configInfo;
+ private HttpClient httpClient;
- public RecordClient(ConfigInfo configInfo) {
- this.configInfo = configInfo;
+ public Records(HttpClient httpClient) {
+ this.httpClient = httpClient;
}
@Override
@@ -44,7 +44,7 @@ public PublicResponse createRecord(CreateRecordReq req) {
if (StringUtils.isEmpty(req.getOperationId())) {
throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
}
- ForestResponse response = HttpClient.Post(CREATE_RECORD, JSONObject.toJSONString(req), configInfo);
+ ForestResponse response = httpClient.post(CREATE_RECORD, JSONObject.toJSONString(req));
PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
log.debug("createRecord end");
return res;
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/nat/tx/TxProxy.java b/src/main/java/ai/bianjie/avatasdk/proxy/nat/tx/TxProxy.java
new file mode 100644
index 0000000..efca203
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/nat/tx/TxProxy.java
@@ -0,0 +1,25 @@
+package ai.bianjie.avatasdk.proxy.nat.tx;
+
+import ai.bianjie.avatasdk.model.nat.tx.QueryTxRes;
+import ai.bianjie.avatasdk.model.nat.tx.QueryTxTypesRes;
+
+
+public interface TxProxy {
+ /**
+ * 上链交易结果查询
+ *
+ * @param operationId OPERATION ID
+ * @return QueryTxRes
+ */
+ QueryTxRes queryTx(String operationId);
+
+
+ /**
+ * 原生枚举值列表查询
+ *
+ * @return QueryTxTypesRes
+ */
+
+ QueryTxTypesRes queryTxTypes();
+
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/nat/tx/impl/Tx.java b/src/main/java/ai/bianjie/avatasdk/proxy/nat/tx/impl/Tx.java
new file mode 100644
index 0000000..3e698e7
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/nat/tx/impl/Tx.java
@@ -0,0 +1,46 @@
+package ai.bianjie.avatasdk.proxy.nat.tx.impl;
+
+
+import ai.bianjie.avatasdk.model.nat.tx.QueryTxRes;
+import ai.bianjie.avatasdk.model.nat.tx.QueryTxTypesRes;
+import ai.bianjie.avatasdk.proxy.nat.tx.TxProxy;
+import ai.bianjie.avatasdk.util.HttpClient;
+import com.alibaba.fastjson.JSONObject;
+import com.dtflys.forest.http.ForestResponse;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class Tx implements TxProxy {
+
+ private static final String QUERY_TX = "/v3/native/tx/%s"; // 原生上链交易结果查询
+ private static final String QUERY_TX_TYPES = "/v3/native/dict/tx_types"; // 原生枚举值列表查询
+
+ private HttpClient httpClient;
+
+ public Tx(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ }
+ @Override
+ public QueryTxRes queryTx(String operationId) {
+ log.debug("operationId {}", operationId);
+ log.debug("queryTx start");
+ String path = String.format(QUERY_TX, operationId);
+ ForestResponse response = httpClient.get(path, "");
+ String result = response.readAsString();
+ QueryTxRes res = JSONObject.parseObject(result, QueryTxRes.class);
+ log.debug("queryTx end");
+ return res;
+ }
+
+
+ @Override
+ public QueryTxTypesRes queryTxTypes(){
+ log.debug("queryTxTypes start");
+ ForestResponse response = httpClient.get(QUERY_TX_TYPES, "");
+ String result = response.readAsString();
+ QueryTxTypesRes res = JSONObject.parseObject(result, QueryTxTypesRes.class);
+ log.debug("queryTxTypes end");
+ return res;
+ }
+
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/nft/impl/NftClient.java b/src/main/java/ai/bianjie/avatasdk/proxy/nft/impl/NftClient.java
deleted file mode 100644
index ce3cbf7..0000000
--- a/src/main/java/ai/bianjie/avatasdk/proxy/nft/impl/NftClient.java
+++ /dev/null
@@ -1,295 +0,0 @@
-package ai.bianjie.avatasdk.proxy.nft.impl;
-
-import ai.bianjie.avatasdk.config.ConfigInfo;
-import com.alibaba.fastjson.JSONObject;
-import com.dtflys.forest.http.ForestResponse;
-import ai.bianjie.avatasdk.exception.AvataException;
-import lombok.extern.slf4j.Slf4j;
-import ai.bianjie.avatasdk.model.PublicResponse;
-import ai.bianjie.avatasdk.model.nft.*;
-import ai.bianjie.avatasdk.proxy.nft.NftProxy;
-import ai.bianjie.avatasdk.util.HttpClient;
-import com.dtflys.forest.utils.StringUtils;
-
-@Slf4j
-public class NftClient implements NftProxy {
- private static final String CREATE_CLASS = "/v1beta1/nft/classes";
- private static final String QUERY_CLASSES = "/v1beta1/nft/classes";
- private static final String QUERY_CLASS= "/v1beta1/nft/classes/%s";
- private static final String TRANSFER_CLASS = "/v1beta1/nft/class-transfers/%s/%s";
- private static final String CREATE_NFT = "/v1beta1/nft/nfts/%s";
- private static final String TRANSFER_NFT = "/v1beta1/nft/nft-transfers/%s/%s/%s";
- private static final String EDIT_NFT = "/v1beta1/nft/nfts/%s/%s/%s";
- private static final String DELETE_NFT = "/v1beta1/nft/nfts/%s/%s/%s";
- private static final String BATCH_CREATE_NFT = "/v1beta1/nft/batch/nfts/%s";
- private static final String BATCH_TRANSFER_NFT = "/v1beta1/nft/batch/nft-transfers/%s";
- private static final String BATCH_EDIT_NFT = "/v1beta1/nft/batch/nfts/%s";
- private static final String BATCH_DELETE_NFT = "/v1beta1/nft/batch/nfts/%s";
- private static final String QUERY_NFTS = "/v1beta1/nft/nfts";
- private static final String QUERY_NFT= "/v1beta1/nft/nfts/%s/%s";
- private static final String QUERY_NFT_HISTORY = "/v1beta1/nft/nfts/%s/%s/history";
-
- private ConfigInfo configInfo;
-
- public NftClient(ConfigInfo configInfo) {
- this.configInfo = configInfo;
- }
-
-
- @Override
- public PublicResponse createClass(CreateNftClassReq req) {
- log.debug("CreateMtClassReq {}", req);
- log.debug("createClass start");
- // check params
- if (StringUtils.isEmpty(req.getName())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "name"));
- }
- if (StringUtils.isEmpty(req.getOwner())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "owner"));
- }
- if (StringUtils.isEmpty(req.getOperationId())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
- }
- ForestResponse response = HttpClient.Post(CREATE_CLASS, JSONObject.toJSONString(req), configInfo);
-
- PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
- log.debug("createClass end");
- return res;
- }
-
- @Override
- public QueryNftClassesRes queryClasses(QueryNftClassesReq req) {
- log.debug("QueryNftClassesReq {}", req);
- log.debug("queryClasses start");
- ForestResponse response = HttpClient.Get(QUERY_CLASSES,JSONObject.toJSONString(req), configInfo);
- String result = response.readAsString();
-
- QueryNftClassesRes res = JSONObject.parseObject(result, QueryNftClassesRes.class);
-
- log.debug("queryClasses end");
- return res;
- }
-
- @Override
- public QueryNftClassRes queryClass(String classId) {
- log.debug("classId {}", classId);
- log.debug("queryClass start");
- String path = String.format(QUERY_CLASS, classId);
- ForestResponse response = HttpClient.Get(path, "", configInfo);
- String result = response.readAsString();
-
- QueryNftClassRes res = JSONObject.parseObject(result, QueryNftClassRes.class);
-
- log.debug("queryClass end");
- return res;
- }
-
- @Override
- public PublicResponse transferClass(TransferNftClassReq req, String classId, String owner) {
- log.debug("TransferNftClassReq {}, classId {}, owner {}", req, classId, owner);
- log.debug("transferClass start");
- // check params
- if (StringUtils.isEmpty(req.getRecipient())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "recipient"));
- }
- if (StringUtils.isEmpty(req.getOperationId())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
- }
- String path = String.format(TRANSFER_CLASS, classId, owner);
- ForestResponse response = HttpClient.Post(path, JSONObject.toJSONString(req), configInfo);
- PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
- log.debug("transferClass end");
- return res;
-
- }
-
- @Override
- public PublicResponse createNft(MintNftReq req, String classId) {
- log.debug("MintNftReq {}, classId {}", req, classId);
- log.debug("createNft start");
- // check params
- if (StringUtils.isEmpty(req.getName())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "name"));
- }
- if (StringUtils.isEmpty(req.getOperationId())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
- }
- String path = String.format(CREATE_NFT, classId);
- ForestResponse response = HttpClient.Post(path, JSONObject.toJSONString(req), configInfo);
- PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
- log.debug("createNft end");
- return res;
- }
-
- @Override
- public PublicResponse transferNft(TransferNftReq req, String classId, String owner, String nftId) {
- log.debug("TransferNftReq {}, classId {}, owner {}, nftId {}", req, classId, owner, nftId);
- log.debug("transferNft start");
- // check params
- if (StringUtils.isEmpty(req.getRecipient())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "recipient"));
- }
- if (StringUtils.isEmpty(req.getOperationId())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
- }
- String path = String.format(TRANSFER_NFT, classId, owner, nftId);
- ForestResponse response = HttpClient.Post(path, JSONObject.toJSONString(req), configInfo);
- String result = response.readAsString();
-
- PublicResponse res = JSONObject.parseObject(result, PublicResponse.class);
-
- log.debug("transferNft end");
- return res;
- }
-
- @Override
- public PublicResponse editNft(EditNftReq req, String classId, String owner, String nftId) {
- log.debug("EditNftReq {}, classId {}, owner {}, nftId {}", req, classId, owner, nftId);
- log.debug("editNft start");
- // check params
- if (StringUtils.isEmpty(req.getName())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "name"));
- }
- if (StringUtils.isEmpty(req.getOperationId())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
- }
- String path = String.format(EDIT_NFT, classId, owner, nftId);
- ForestResponse response = HttpClient.Patch(path, JSONObject.toJSONString(req), configInfo);
- PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
- log.debug("editNft end");
- return res;
- }
-
- @Override
- public PublicResponse burnNft(BurnNftReq req, String classId, String owner, String nftId) {
- log.debug("BurnNftReq {}, classId {}, owner {}, nftId {}", req, classId, owner, nftId);
- log.debug("deleteNft start");
- // check params
- if (StringUtils.isEmpty(req.getOperationId())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
- }
- String path = String.format(DELETE_NFT, classId, owner, nftId);
- ForestResponse response = HttpClient.Delete(path, JSONObject.toJSONString(req), configInfo);
- PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
- log.debug("deleteNft end");
- return res;
- }
-
- @Override
- public PublicResponse batchCreateNft(BatchMintNftReq req, String classId) {
- log.debug("BatchMintNftReq {}, classId {}", req, classId);
- log.debug("batchCreateNft start");
- // check params
- if (StringUtils.isEmpty(req.getName())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "name"));
- }
- if (req.getRecipients() == null) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "recipient"));
- }
- if (StringUtils.isEmpty(req.getOperationId())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
- }
- String path = String.format(BATCH_CREATE_NFT, classId);
- ForestResponse response = HttpClient.Post(path, JSONObject.toJSONString(req), configInfo);
- PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
- log.debug("batchCreateNft end");
- return res;
- }
-
- @Override
- public PublicResponse batchTransferNft(BatchTransferNftReq req, String owner) {
- log.debug("BatchTransferNftReq {}, owner {}", req, owner);
- log.debug("batchTransferNft start");
- // check params
- if (req.getData() == null) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "date"));
- }
- if (StringUtils.isEmpty(req.getOperationId())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
- }
- String path = String.format(BATCH_TRANSFER_NFT, owner);
- ForestResponse response = HttpClient.Post(path, JSONObject.toJSONString(req), configInfo);
- PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
- log.debug("batchTransferNft end");
- return res;
-
- }
-
- @Override
- public PublicResponse batchEditNft(BatchEditNftReq req, String owner) {
- log.debug("BatchEditNftReq {}, owner {}", req, owner);
- log.debug("batchEditNft start");
- // check params
- if (req.getNfts() == null) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "nfts"));
- }
- if (StringUtils.isEmpty(req.getOperationId())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
- }
- String path = String.format(BATCH_EDIT_NFT, owner);
- ForestResponse response = HttpClient.Patch(path, JSONObject.toJSONString(req), configInfo);
- PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
- log.debug("batchEditNft end");
- return res;
- }
-
- @Override
- public PublicResponse batchBurnNft(BatchBurnNftReq req, String owner) {
- log.debug("BatchBurnNftReq {}, owner {}", req, owner);
- log.debug("batchDeleteNft start");
- // check params
- if (req.getNfts() == null) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "nfts"));
- }
- if (StringUtils.isEmpty(req.getOperationId())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
- }
- String path = String.format(BATCH_DELETE_NFT, owner);
- ForestResponse response = HttpClient.Delete(path, JSONObject.toJSONString(req), configInfo);
- PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
- log.debug("batchDeleteNft end");
- return res;
- }
-
- @Override
- public QueryNftsRes queryNfts(QueryNftsReq req) {
- log.debug("QueryNftsReq {}", req);
- log.debug("queryNfts start");
- ForestResponse response = HttpClient.Get(QUERY_NFTS, JSONObject.toJSONString(req), configInfo);
- String result = response.readAsString();
-
- QueryNftsRes res = JSONObject.parseObject(result, QueryNftsRes.class);
-
- log.debug("queryNfts end");
- return res;
- }
-
- @Override
- public QueryNftRes queryNft(String classId, String nftId) {
- log.debug("classId {}, nftId {}", classId, nftId);
- log.debug("queryNft start");
- String path = String.format(QUERY_NFT, classId,nftId);
- ForestResponse response = HttpClient.Get(path, "", configInfo);
- String result = response.readAsString();
-
- QueryNftRes res = JSONObject.parseObject(result, QueryNftRes.class);
-
- log.debug("queryNft end");
- return res;
- }
-
- @Override
- public QueryNftHistoryRes queryNftHistory(String classId, String nftId,QueryNftHistoryReq req) {
- log.debug("classId {}, nftId {}", classId, nftId);
- log.debug("queryNftHistory start");
- String path = String.format(QUERY_NFT_HISTORY, classId,nftId);
- ForestResponse response = HttpClient.Get(path, "", configInfo);
- String result = response.readAsString();
-
- QueryNftHistoryRes res = JSONObject.parseObject(result, QueryNftHistoryRes.class);
-
- log.debug("queryNftHistory end");
- return res;
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/order/OrderProxy.java b/src/main/java/ai/bianjie/avatasdk/proxy/order/OrderProxy.java
index 8df3c44..56716f3 100644
--- a/src/main/java/ai/bianjie/avatasdk/proxy/order/OrderProxy.java
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/order/OrderProxy.java
@@ -1,15 +1,16 @@
package ai.bianjie.avatasdk.proxy.order;
+import ai.bianjie.avatasdk.model.PublicResponse;
import ai.bianjie.avatasdk.model.order.*;
public interface OrderProxy {
/**
- * 购买能量值/业务费
+ * 购买能量值
*
- * @param req 购买能量值/业务费请求实体
+ * @param req 购买能量值请求实体
* @return
*/
- OrderRes createOrder(CreateOrderReq req);
+ PublicResponse createOrder(CreateOrderReq req);
/**
* 批量购买能量值
@@ -17,20 +18,20 @@ public interface OrderProxy {
* @param req 批量购买能量值请求实体
* @return
*/
- OrderRes batchCreateOrders(BatchCreateOrderReq req);
+ PublicResponse batchCreateOrders(BatchCreateOrderReq req);
/**
- * 查询能量值/业务费购买结果
+ * 查询能量值购买结果
*
- * @param orderId Order ID
+ * @param operationId 操作id
* @return
*/
- QueryOrderRes queryOrder(String orderId);
+ QueryOrderRes queryOrder(String operationId);
/**
- * 查询能量值/业务费购买结果列表
+ * 查询能量值购买结果列表
*
- * @param req 查询能量值/业务费购买结果列表请求实体
+ * @param req 查询能量值购买结果列表请求实体
* @return
*/
QueryOrdersRes queryOrders(QueryOrdersReq req);
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/order/impl/OrderClient.java b/src/main/java/ai/bianjie/avatasdk/proxy/order/impl/Order.java
similarity index 58%
rename from src/main/java/ai/bianjie/avatasdk/proxy/order/impl/OrderClient.java
rename to src/main/java/ai/bianjie/avatasdk/proxy/order/impl/Order.java
index c2d8d84..d979dbf 100644
--- a/src/main/java/ai/bianjie/avatasdk/proxy/order/impl/OrderClient.java
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/order/impl/Order.java
@@ -1,65 +1,62 @@
package ai.bianjie.avatasdk.proxy.order.impl;
-import ai.bianjie.avatasdk.config.ConfigInfo;
-import com.alibaba.fastjson.JSONObject;
-import com.dtflys.forest.http.ForestResponse;
import ai.bianjie.avatasdk.exception.AvataException;
-import lombok.extern.slf4j.Slf4j;
+import ai.bianjie.avatasdk.model.PublicResponse;
import ai.bianjie.avatasdk.model.order.*;
import ai.bianjie.avatasdk.proxy.order.OrderProxy;
import ai.bianjie.avatasdk.util.HttpClient;
+import com.alibaba.fastjson.JSONObject;
+import com.dtflys.forest.http.ForestResponse;
import com.dtflys.forest.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class OrderClient implements OrderProxy {
- private static final String CREATE_ORDER = "/v1beta1/orders";
- private static final String BATCH_CREATE_ORDER = "/v1beta1/orders/batch";
- private static final String QUERY_ORDER = "/v1beta1/orders/%s";
- private static final String QUERY_ORDERS = "/v1beta1/orders";
+public class Order implements OrderProxy {
+ private static final String CREATE_ORDER = "/v3/orders";// 购买能量值
+ private static final String BATCH_CREATE_ORDER = "/v3/orders/batch";// 批量购买能量值
+ private static final String QUERY_ORDER = "/v3/orders/%s";// 查询能量值购买结果
+ private static final String QUERY_ORDERS = "/v3/orders";// 查询能量值购买结果列表
- private ConfigInfo configInfo;
+ private HttpClient httpClient;
- public OrderClient(ConfigInfo configInfo) {
- this.configInfo = configInfo;
+ public Order(HttpClient httpClient) {
+ this.httpClient = httpClient;
}
@Override
- public OrderRes createOrder(CreateOrderReq req) {
+ public PublicResponse createOrder(CreateOrderReq req) {
log.debug("CreateOrderReq {}", req);
log.debug("createOrder start");
// check params
- if (StringUtils.isEmpty(req.getOrderId())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "order_id"));
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
}
if (StringUtils.isEmpty(req.getAccount())) {
throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "account"));
}
- if (StringUtils.isEmpty(req.getOrderType())) {
+ if (req.getOrderType() == null) {
throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "order_type"));
}
if (req.getAmount() == null) {
throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "amount"));
}
- if (req.getAmount()%100 != 0){
+ if (req.getAmount() % 100 != 0) {
throw AvataException.InvalidParamException(AvataException.ErrAmount);
}
- ForestResponse response = HttpClient.Post(CREATE_ORDER, JSONObject.toJSONString(req), configInfo);
-
+ ForestResponse response = httpClient.post(CREATE_ORDER, JSONObject.toJSONString(req));
String result = response.readAsString();
-
- OrderRes res = JSONObject.parseObject(result, OrderRes.class);
-
+ PublicResponse res = JSONObject.parseObject(result, PublicResponse.class);
log.debug("createOrder end");
return res;
}
@Override
- public OrderRes batchCreateOrders(BatchCreateOrderReq req) {
+ public PublicResponse batchCreateOrders(BatchCreateOrderReq req) {
log.debug("BatchCreateOrderReq {}", req);
- log.debug("createClass start");
+ log.debug("batchCreateOrder start");
// check params
- if (StringUtils.isEmpty(req.getOrderId())) {
- throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "order_id"));
+ if (StringUtils.isEmpty(req.getOperationId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "operation_id"));
}
if (req.getList() == null) {
throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "order_list"));
@@ -71,30 +68,25 @@ public OrderRes batchCreateOrders(BatchCreateOrderReq req) {
if (l.getAmount() == null) {
throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "amount"));
}
- if (l.getAmount()%100 != 0) {
+ if (l.getAmount() % 100 != 0) {
throw AvataException.InvalidParamException(AvataException.ErrAmount);
}
});
-
- ForestResponse response = HttpClient.Post(BATCH_CREATE_ORDER, JSONObject.toJSONString(req), configInfo);
+ ForestResponse response = httpClient.post(BATCH_CREATE_ORDER, JSONObject.toJSONString(req));
String result = response.readAsString();
-
- OrderRes res = JSONObject.parseObject(result, OrderRes.class);
-
- log.debug("batchCreatrOrders end");
+ PublicResponse res = JSONObject.parseObject(result, PublicResponse.class);
+ log.debug("batchCreateOrder end");
return res;
}
@Override
- public QueryOrderRes queryOrder(String orderId) {
- log.debug("orderId {}", orderId);
- log.debug("createClass start");
- String path = String.format(QUERY_ORDER, orderId);
- ForestResponse response = HttpClient.Get(path, "", configInfo);
+ public QueryOrderRes queryOrder(String operationId) {
+ log.debug("operationId {}", operationId);
+ log.debug("queryOrder start");
+ String path = String.format(QUERY_ORDER, operationId);
+ ForestResponse response = httpClient.get(path, "");
String result = response.readAsString();
-
QueryOrderRes res = JSONObject.parseObject(result, QueryOrderRes.class);
-
log.debug("queryOrder end");
return res;
}
@@ -102,12 +94,10 @@ public QueryOrderRes queryOrder(String orderId) {
@Override
public QueryOrdersRes queryOrders(QueryOrdersReq req) {
log.debug("QueryOrdersReq {}", req);
- log.debug("createClass start");
- ForestResponse response = HttpClient.Get(QUERY_ORDERS, JSONObject.toJSONString(req), configInfo);
+ log.debug("queryOrders start");
+ ForestResponse response = httpClient.get(QUERY_ORDERS, JSONObject.toJSONString(req));
String result = response.readAsString();
-
QueryOrdersRes res = JSONObject.parseObject(result, QueryOrdersRes.class);
-
log.debug("queryOrders end");
return res;
}
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/tx/TxProxy.java b/src/main/java/ai/bianjie/avatasdk/proxy/tx/TxProxy.java
deleted file mode 100644
index 3cb4f64..0000000
--- a/src/main/java/ai/bianjie/avatasdk/proxy/tx/TxProxy.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package ai.bianjie.avatasdk.proxy.tx;
-
-import ai.bianjie.avatasdk.model.tx.QueryQueueReq;
-import ai.bianjie.avatasdk.model.tx.QueryQueueRes;
-import ai.bianjie.avatasdk.model.tx.QueryTxRes;
-
-public interface TxProxy {
- /**
- * 上链交易结果查询
- *
- * @param operationId OPERATION ID
- * @return QueryTxRes
- */
- QueryTxRes queryTx(String operationId);
-
- /**
- * 上链交易排队状态查询
- *
- * @param req query queue request
- * @return QueryQueueRes
- */
- QueryQueueRes queryQueueInfo(QueryQueueReq req);
-}
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/tx/impl/TxClient.java b/src/main/java/ai/bianjie/avatasdk/proxy/tx/impl/TxClient.java
deleted file mode 100644
index afd1791..0000000
--- a/src/main/java/ai/bianjie/avatasdk/proxy/tx/impl/TxClient.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package ai.bianjie.avatasdk.proxy.tx.impl;
-
-import ai.bianjie.avatasdk.config.ConfigInfo;
-import com.alibaba.fastjson.JSONObject;
-import com.dtflys.forest.http.ForestResponse;
-import lombok.extern.slf4j.Slf4j;
-import ai.bianjie.avatasdk.model.tx.QueryQueueReq;
-import ai.bianjie.avatasdk.model.tx.QueryQueueRes;
-import ai.bianjie.avatasdk.model.tx.QueryTxRes;
-import ai.bianjie.avatasdk.proxy.tx.TxProxy;
-import ai.bianjie.avatasdk.util.HttpClient;
-
-@Slf4j
-public class TxClient implements TxProxy {
- private static final String QUERY_TX = "/v1beta1/tx/%s";
- private static final String QUERY_QUEUE_INFO = "/v1beta1/tx/queue/info";
-
- private ConfigInfo configInfo;
-
- public TxClient(ConfigInfo configInfo) {
- this.configInfo = configInfo;
- }
-
- @Override
- public QueryTxRes queryTx(String operationId) {
- log.debug("operationId {}", operationId);
- log.debug("queryTx start");
- String path = String.format(QUERY_TX, operationId);
- ForestResponse response = HttpClient.Get(path, "", configInfo);
- String result = response.readAsString();
-
- QueryTxRes res = JSONObject.parseObject(result, QueryTxRes.class);
-
- log.debug("queryTx end");
- return res;
- }
-
- @Override
- public QueryQueueRes queryQueueInfo(QueryQueueReq req) {
- log.debug("QueryQueueReq {}", req);
- log.debug("queryQueueInfo start");
- ForestResponse response = HttpClient.Get(QUERY_QUEUE_INFO, JSONObject.toJSONString(req), configInfo);
- String result = response.readAsString();
-
- QueryQueueRes res = JSONObject.parseObject(result, QueryQueueRes.class);
-
- log.debug("queryQueueInfo end");
- return res;
- }
-}
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/user/UserProxy.java b/src/main/java/ai/bianjie/avatasdk/proxy/user/UserProxy.java
new file mode 100644
index 0000000..5b58cbe
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/user/UserProxy.java
@@ -0,0 +1,32 @@
+package ai.bianjie.avatasdk.proxy.user;
+
+import ai.bianjie.avatasdk.model.PublicResponse;
+import ai.bianjie.avatasdk.model.user.*;
+
+public interface UserProxy {
+
+ /**
+ * 创建用户
+ *
+ * @param req 创建用户请求实体
+ * @return
+ */
+ CreateUserRes createUser(CreateUserReq req);
+
+ /**
+ * 更新用户
+ *
+ * @param req 更新用户请求实体
+ * @return
+ */
+ PublicResponse updateUser(UpdateUserReq req);
+
+
+ /**
+ * 查询用户信息
+ *
+ * @param req 查询用户信息请求实体
+ * @return
+ */
+ QueryUserRes queryUser(QueryUserReq req);
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/proxy/user/impl/User.java b/src/main/java/ai/bianjie/avatasdk/proxy/user/impl/User.java
new file mode 100644
index 0000000..6de6c5e
--- /dev/null
+++ b/src/main/java/ai/bianjie/avatasdk/proxy/user/impl/User.java
@@ -0,0 +1,88 @@
+package ai.bianjie.avatasdk.proxy.user.impl;
+
+import ai.bianjie.avatasdk.exception.AvataException;
+import ai.bianjie.avatasdk.model.PublicResponse;
+import ai.bianjie.avatasdk.model.user.*;
+import ai.bianjie.avatasdk.proxy.user.UserProxy;
+import ai.bianjie.avatasdk.util.HttpClient;
+import com.alibaba.fastjson.JSONObject;
+import com.dtflys.forest.http.ForestResponse;
+import com.dtflys.forest.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class User implements UserProxy {
+
+ private static final String CREATE_USER = "/v3/users";// 创建用户
+
+ private static final String UPDATE_USER = "/v3/users";// 更新用户
+
+ private static final String QUERY_USER = "/v3/users";// 查询用户信息
+
+ private HttpClient httpClient;
+
+ public User(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ }
+
+ @Override
+ public CreateUserRes createUser(CreateUserReq req) {
+ log.debug("CreateUserReq {}", req);
+ log.debug("createUser start");
+ // check params
+ if (req.getUserType() == null) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "user_type"));
+ }
+ if (req.getName() == null) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "name"));
+ }
+ if (req.getPhoneNum() == null) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "phone_num"));
+ }
+ if (req.getUserType() == 1 && req.getCertificateNum() == null) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "certificate_num"));
+ }
+ if (req.getUserType() == 2 && req.getRegistrationNum() == null) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "registration_num"));
+ }
+ ForestResponse response = httpClient.post(CREATE_USER, JSONObject.toJSONString(req));
+ CreateUserRes res = JSONObject.parseObject(response.readAsString(), CreateUserRes.class);
+ log.debug("createUser end");
+ return res;
+ }
+
+ @Override
+ public PublicResponse updateUser(UpdateUserReq req) {
+ log.debug("UpdateUserReq {}", req);
+ log.debug("updateUser start");
+ // check params
+ if (StringUtils.isEmpty(req.getUserId())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "user_id"));
+ }
+ if (StringUtils.isEmpty(req.getPhoneNum())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "phone_num"));
+ }
+ ForestResponse response = httpClient.patch(UPDATE_USER, JSONObject.toJSONString(req));
+ PublicResponse res = JSONObject.parseObject(response.readAsString(), PublicResponse.class);
+ log.debug("updateUser end");
+ return res;
+ }
+
+ @Override
+ public QueryUserRes queryUser(QueryUserReq req) {
+ log.debug("QueryUserReq {}", req);
+ log.debug("queryUser start");
+ // check params
+ if (StringUtils.isEmpty(req.getUserType())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "user_type"));
+ }
+ if (StringUtils.isEmpty(req.getCode())) {
+ throw AvataException.InvalidParamException(String.format(AvataException.PARAM_ERROR, "code"));
+ }
+ ForestResponse response = httpClient.get(QUERY_USER, JSONObject.toJSONString(req));
+ String result = response.readAsString();
+ QueryUserRes res = JSONObject.parseObject(result, QueryUserRes.class);
+ log.debug("queryUser end");
+ return res;
+ }
+}
diff --git a/src/main/java/ai/bianjie/avatasdk/util/AvataUtils.java b/src/main/java/ai/bianjie/avatasdk/util/AvataUtils.java
index 1d8b3c5..a6fbf96 100644
--- a/src/main/java/ai/bianjie/avatasdk/util/AvataUtils.java
+++ b/src/main/java/ai/bianjie/avatasdk/util/AvataUtils.java
@@ -50,7 +50,7 @@ public static String sign(String path, Map query, Map getMap(String params) {
+ Map maps = JSON.parseObject(params);
+ return maps;
+ }
+
+ /**
+ * 业务接口,应用方需要实现业务逻辑,在验签成功后执行
+ */
+ public interface APP {
+ void onCallback(String version, String kind, Object object) throws Exception;
+ }
+}
+
+
+
diff --git a/src/main/java/ai/bianjie/avatasdk/util/HttpClient.java b/src/main/java/ai/bianjie/avatasdk/util/HttpClient.java
index baa2a28..1031b8c 100644
--- a/src/main/java/ai/bianjie/avatasdk/util/HttpClient.java
+++ b/src/main/java/ai/bianjie/avatasdk/util/HttpClient.java
@@ -14,12 +14,17 @@
@Slf4j
public class HttpClient {
+ private ConfigInfo configInfo;
+ public HttpClient(ConfigInfo configInfo) {
+ this.configInfo = configInfo;
+ }
+
/**
* Send a post request
* @param path The url of the post request
* @param content The body parameter of the post request
*/
- public static ForestResponse Post(String path, String content, ConfigInfo configInfo) {
+ public ForestResponse post(String path, String content) {
StringBuffer url = new StringBuffer();
url.append(configInfo.getDoMain());
url.append(path);
@@ -45,7 +50,7 @@ public static ForestResponse Post(String path, String content, ConfigInfo config
* @param path The url of the get request
* @param content The query parameter of the get request
*/
- public static ForestResponse Get(String path, String content, ConfigInfo configInfo) {
+ public ForestResponse get(String path, String content) {
StringBuffer url = new StringBuffer();
url.append(configInfo.getDoMain());
url.append(path);
@@ -71,7 +76,7 @@ public static ForestResponse Get(String path, String content, ConfigInfo configI
* @param path The url of the patch request
* @param content The body parameter of the patch request
*/
- public static ForestResponse Patch(String path, String content, ConfigInfo configInfo) {
+ public ForestResponse patch(String path, String content) {
StringBuffer url = new StringBuffer();
url.append(configInfo.getDoMain());
url.append(path);
@@ -97,7 +102,7 @@ public static ForestResponse Patch(String path, String content, ConfigInfo confi
* @param path The url of the delete request
* @param content The body parameter of the delete request
*/
- public static ForestResponse Delete(String path, String content, ConfigInfo configInfo) {
+ public ForestResponse delete(String path, String content) {
StringBuffer url = new StringBuffer();
url.append(configInfo.getDoMain());
url.append(path);
diff --git a/src/test/java/AccountTest.java b/src/test/java/AccountTest.java
deleted file mode 100644
index 8fed095..0000000
--- a/src/test/java/AccountTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-import ai.bianjie.avatasdk.AvataClient;
-import ai.bianjie.avatasdk.model.account.*;
-import org.junit.jupiter.api.Test;
-
-public class AccountTest {
- AvataClient client = new AvataClient.Builder()
- .setDomain("")
- .setApiKey("")
- .setApiSecret("")
- .setHttpTimeout(10000)
- .init();
-
- String OperationID = String.valueOf(System.currentTimeMillis());
-
- @Test
- //请求创建链账户接口示例
- void TestCreateAccount() {
- CreateAccountReq req = new CreateAccountReq();
- req.setName("21233");
- req.setOperationId("234231");
- try {
- CreateAccountRes account = client.accountClient.createAccount(req);
- System.out.println(account.getData());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求查询链账户接口示例
- void TestQueryAccount() {
- QueryAccountsReq req = new QueryAccountsReq();
- req.setLimit("3");
- try {
- QueryAccountsRes account = client.accountClient.queryAccounts(req);
- System.out.println(account.getData());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求批量创建链账户接口示例
- void TestBatchCreateAccount() {
- BatchCreateAccountReq req = new BatchCreateAccountReq();
- req.setCount(2);
- req.setOperationId(OperationID);
- try {
- BatchCreateAccountRes account = client.accountClient.batchCreateAccounts(req);
- System.out.println(account.getData());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求查询链账户操作记录接口示例
- void TestQueryAccountHistory() {
- QueryAccountsHistoryReq req = new QueryAccountsHistoryReq();
- req.setLimit("2");
- try {
- QueryAccountsHistoryRes account = client.accountClient.queryAccountsHistory(req);
- System.out.println(account.getData());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/test/java/MtTest.java b/src/test/java/MtTest.java
deleted file mode 100644
index f193ca8..0000000
--- a/src/test/java/MtTest.java
+++ /dev/null
@@ -1,202 +0,0 @@
-import ai.bianjie.avatasdk.AvataClient;
-import ai.bianjie.avatasdk.model.PublicResponse;
-import ai.bianjie.avatasdk.model.mt.*;
-import org.junit.jupiter.api.Test;
-
-public class MtTest {
- AvataClient client = new AvataClient.Builder()
- .setDomain("")
- .setApiKey("")
- .setApiSecret("")
- .setHttpTimeout(10000)
- .init();
- String OperationID = String.valueOf(System.currentTimeMillis());
-
- @Test
- //请求创建 MT 类别接口示例
- void TestCreateMtClass() {
- CreateMtClassReq req = new CreateMtClassReq();
- req.setName("lmhmtclassname01");
- req.setOwner("iaa14c3dul0xdh4javrxec5vvfzvy7qk0qnfrruvvl");
- req.setData("123");
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.mtClient.createMtClass(req);
- System.out.println(res.getData().getOperationId());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求查询 MT 类别列表接口示例
- void TestQueryMtClasses() {
- QueryMtClassesReq req = new QueryMtClassesReq();
- req.setId("4f15f17298001ffcdce757d068dba933ef73193e6a261cb9d0f472a2ced1d756");
- req.setOwner("iaa14c3dul0xdh4javrxec5vvfzvy7qk0qnfrruvvl");
- QueryMtClassesRes res = client.mtClient.queryMtClasses(req);
- System.out.println(res.getData());
- }
-
- @Test
- //请求查询 MT 类别详情接口示例
- void TestQueryMtClass() {
- QueryMtClassRes res = client.mtClient.queryMtClass("4f15f17298001ffcdce757d068dba933ef73193e6a261cb9d0f472a2ced1d756");
- System.out.println(res.getData());
- }
-
- @Test
- //请求转让 MT 类别接口示例
- void TestTransferMtClass() {
- TransferMtClassReq req = new TransferMtClassReq();
- req.setRecipient("iaa1jxf58dswgfqs84vw57wzucmttda3s3eu8dhcgr");
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.mtClient.transferMtClass(req,
- "4f15f17298001ffcdce757d068dba933ef73193e6a261cb9d0f472a2ced1d756",
- "iaa14c3dul0xdh4javrxec5vvfzvy7qk0qnfrruvvl");
- System.out.println(res.getData().getOperationId());
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求发行 MT 接口示例
- void TestCreateMt() {
- IssueMtReq req = new IssueMtReq();
- req.setData("datadata");
- req.setAmount(100);
- req.setRecipient("iaa1jxf58dswgfqs84vw57wzucmttda3s3eu8dhcgr");
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.mtClient.createMt(req, "4f15f17298001ffcdce757d068dba933ef73193e6a261cb9d0f472a2ced1d756");
- System.out.println(res.getData().getOperationId());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求增发 MT接口示例
- void TestMintMt() {
- MintMtReq req = new MintMtReq();
- req.setAmount(10);
- req.setRecipient("iaa14c3dul0xdh4javrxec5vvfzvy7qk0qnfrruvvl");
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.mtClient.mintMt(req,
- "4f15f17298001ffcdce757d068dba933ef73193e6a261cb9d0f472a2ced1d756",
- "f676009a34102e0f9396da8d2f372790ee813c96a17ba91b797bdee57aa041a9");
- System.out.println(res.getData().getOperationId());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求转让 MT 接口示例
- void TestTransferMt() {
- TransferMtReq req = new TransferMtReq();
- req.setAmount(10);
- req.setRecipient("iaa14c3dul0xdh4javrxec5vvfzvy7qk0qnfrruvvl");
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.mtClient.transferMt(req,
- "4f15f17298001ffcdce757d068dba933ef73193e6a261cb9d0f472a2ced1d756",
- "iaa1jxf58dswgfqs84vw57wzucmttda3s3eu8dhcgr",
- "f676009a34102e0f9396da8d2f372790ee813c96a17ba91b797bdee57aa041a9");
- System.out.println(res.getData().getOperationId());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求编辑 MT 接口示例
- void TestEditMt() {
- EditMtReq req = new EditMtReq();
- req.setData("789");
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.mtClient.editMt(req,
- "4f15f17298001ffcdce757d068dba933ef73193e6a261cb9d0f472a2ced1d756",
- "iaa1jxf58dswgfqs84vw57wzucmttda3s3eu8dhcgr",
- "f676009a34102e0f9396da8d2f372790ee813c96a17ba91b797bdee57aa041a9");
- System.out.println(res.getData().getOperationId());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求销毁 MT 接口示例
- void TestDeleteMt() {
- BurnMtReq req = new BurnMtReq();
- req.setAmount(1);
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.mtClient.deleteMt(req,
- "4f15f17298001ffcdce757d068dba933ef73193e6a261cb9d0f472a2ced1d756",
- "iaa1jxf58dswgfqs84vw57wzucmttda3s3eu8dhcgr",
- "f676009a34102e0f9396da8d2f372790ee813c96a17ba91b797bdee57aa041a9");
- System.out.println(res.getData().getOperationId());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
-
- @Test
- //请求查询 MT 列表接口示例
- void TestQueryMts() {
- QueryMtsReq req = new QueryMtsReq();
- req.setId("f676009a34102e0f9396da8d2f372790ee813c96a17ba91b797bdee57aa041a9");
- QueryMtsRes res = client.mtClient.queryMts(req);
- System.out.println(res.getData());
- }
-
- @Test
- //请求查询 MT 详情接口示例
- void TestQueryMt() {
- QueryMtRes res = client.mtClient.queryMt(
- "4f15f17298001ffcdce757d068dba933ef73193e6a261cb9d0f472a2ced1d756",
- "f676009a34102e0f9396da8d2f372790ee813c96a17ba91b797bdee57aa041a9");
- System.out.println(res.getData());
- }
-
- @Test
- //请求查询 MT 操作记录接口请求示例
- void TestQueryMtHistory() {
- QueryMtHistoryReq req = new QueryMtHistoryReq();
- req.getOffset();
- QueryMtHistoryRes res = client.mtClient.queryMtHistory(req,
- "4f15f17298001ffcdce757d068dba933ef73193e6a261cb9d0f472a2ced1d756",
- "f676009a34102e0f9396da8d2f372790ee813c96a17ba91b797bdee57aa041a9");
- System.out.println(res);
- }
-
- @Test
- //请求查询 MT 余额接口请求示例
- void TestQueryMtBalances() {
- QueryMtBalancesReq req = new QueryMtBalancesReq();
- req.getId();
- QueryMtBalancesRes res = client.mtClient.queryMtBalances(req,
- "4f15f17298001ffcdce757d068dba933ef73193e6a261cb9d0f472a2ced1d756",
- "iaa14c3dul0xdh4javrxec5vvfzvy7qk0qnfrruvvl");
- System.out.println(res);
- }
-}
diff --git a/src/test/java/NftTest.java b/src/test/java/NftTest.java
deleted file mode 100644
index 7ae1c76..0000000
--- a/src/test/java/NftTest.java
+++ /dev/null
@@ -1,283 +0,0 @@
-import ai.bianjie.avatasdk.AvataClient;
-import ai.bianjie.avatasdk.model.PublicResponse;
-import ai.bianjie.avatasdk.model.nft.*;
-import org.junit.jupiter.api.Test;
-import java.util.ArrayList;
-import java.util.List;
-
-public class NftTest {
- AvataClient client = new AvataClient.Builder()
- .setDomain("")
- .setApiKey("")
- .setApiSecret("")
- .setHttpTimeout(10000)
- .init();
-
- String OperationID = String.valueOf(System.currentTimeMillis());
-
- @Test
- //请求创建 NFT 类别接口示例
- void TestCreateClass() {
- CreateNftClassReq req = new CreateNftClassReq();
- req.setName("lmhnftclassname01");
- req.setClassId("111bakvavoy");
- req.setSymbol("123");
- req.setDescription("123");
- req.setUri("http://www.123.com");
- req.setUriHash("123");
- req.setData("123");
- req.setOwner("iaa14c3dul0xdh4javrxec5vvfzvy7qk0qnfrruvvl");
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.nftClient.createClass(req);
- System.out.println(res.getData().getOperationId());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求查询 NFT 类别列表接口示例
- void TestQueryClasses() {
- QueryNftClassesReq req = new QueryNftClassesReq();
- req.setId("bakvavoy");
- req.setOwner("iaa14c3dul0xdh4javrxec5vvfzvy7qk0qnfrruvvl");
- QueryNftClassesRes res = client.nftClient.queryClasses(req);
- System.out.println(res.getData());
- }
-
- @Test
- //请求查询 NFT 类别详情接口示例
- void TestQueryClass() {
- QueryNftClassRes res = client.nftClient.queryClass("bakvavoy");
- System.out.println(res.getData());
- }
-
- @Test
- //请求转让 NFT 类别接口示例
- void TestTransferClass() {
- TransferNftClassReq req = new TransferNftClassReq();
- req.setRecipient("iaa1jxf58dswgfqs84vw57wzucmttda3s3eu8dhcgr");
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.nftClient.transferClass(req,
- "bakvavoy",
- "iaa14c3dul0xdh4javrxec5vvfzvy7qk0qnfrruvvl");
- System.out.println(res.getData().getOperationId());
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求发行 NFT 接口示例
- void TestCreateNft() {
- MintNftReq req = new MintNftReq();
- req.setName("lmhnft023011");
- req.setUri("http://www.456.com");
- req.setUriHash("456");
- req.setData("456");
- req.setRecipient("iaa14c3dul0xdh4javrxec5vvfzvy7qk0qnfrruvvl");
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.nftClient.createNft(req, "bakvavoy");
- System.out.println(res.getData().getOperationId());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求转让 NFT 接口示例
- void TestTransferNft() {
- TransferNftReq req = new TransferNftReq();
- req.setRecipient("iaa1jxf58dswgfqs84vw57wzucmttda3s3eu8dhcgr");
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.nftClient.transferNft(req,
- "bakvavoy",
- "iaa14c3dul0xdh4javrxec5vvfzvy7qk0qnfrruvvl",
- "avatavgj7c3u5722k0oddsgyi3ps2ced");
- System.out.println(res.getData().getOperationId());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求编辑 NFT 接口示例
- void TestEditNft() {
- EditNftReq req = new EditNftReq();
- req.setName("lmhtesteditnft0001");
- req.setUri("http://www.789.com");
- req.setData("789");
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.nftClient.editNft(req,
- "bakvavoy",
- "iaa1jxf58dswgfqs84vw57wzucmttda3s3eu8dhcgr",
- "avatavgj7c3u5722k0oddsgyi3ps2ced");
- System.out.println(res.getData().getOperationId());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求销毁 NFT 接口示例
- void TestDeleteNft() {
- BurnNftReq req = new BurnNftReq();
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.nftClient.burnNft(req,
- "bakvavoy",
- "iaa1jxf58dswgfqs84vw57wzucmttda3s3eu8dhcgr",
- "avatavgj7c3u5722k0oddsgyi3ps2ced");
- System.out.println(res.getData().getOperationId());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求批量发行 NFT 接口示例
- void TestBatchCreateNft() {
- BatchMintNftReq req = new BatchMintNftReq();
- req.setName("lmhbatchnft111");
- req.setUri("http://www.000.com");
- req.setUriHash("000");
- req.setData("000");
- List list = new ArrayList<>();
- BatchMintNftReq.RecipientsDTO dto1 = new BatchMintNftReq.RecipientsDTO();
- dto1.setAmount(2);
- dto1.setRecipient("iaa1jxf58dswgfqs84vw57wzucmttda3s3eu8dhcgr");
-// BatchCreateNftReq.RecipientsDTO dto2 = new BatchCreateNftReq.RecipientsDTO();
-// dto2.setAmount(2);
-// dto2.setRecipient("iaa19lv0jz60plu6dd9kzycsp8l86ap4gmaynwxd9d");
- list.add(dto1);
-// list.add(dto2);
- req.setRecipients(list);
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.nftClient.batchCreateNft(req, "bakvavoy");
- System.out.println(res.getData().getOperationId());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求批量转让 NFT 接口示例
- void TestBatchTransferNft() {
- BatchTransferNftReq req = new BatchTransferNftReq();
- List datalist = new ArrayList<>();
- BatchTransferNftReq.DataDTO dataDTO = new BatchTransferNftReq.DataDTO();
- List nftlist = new ArrayList<>();
- BatchTransferNftReq.DataDTO.NftsDTO nftsDTO = new BatchTransferNftReq.DataDTO.NftsDTO();
- dataDTO.setNfts(nftlist);
- dataDTO.setRecipient("iaa14c3dul0xdh4javrxec5vvfzvy7qk0qnfrruvvl");
- nftsDTO.setClassId("bakvavoy");
- nftsDTO.setNftId("avataaeqov8gmo0xetsexyi7k7cvxngn");
- datalist.add(dataDTO);
- nftlist.add(nftsDTO);
- req.setData(datalist);
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.nftClient.batchTransferNft(req, "iaa1jxf58dswgfqs84vw57wzucmttda3s3eu8dhcgr");
- System.out.println(res.getData().getOperationId());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求批量编辑 NFT 接口示例
- void TestBatchEditNft() {
- BatchEditNftReq req = new BatchEditNftReq();
- List nftslist = new ArrayList<>();
- BatchEditNftReq.NftsDTO nftsDTO = new BatchEditNftReq.NftsDTO();
- nftsDTO.setClassId("bakvavoy");
- nftsDTO.setNftId("avataaeqov8gmo0xetsexyi7k7cvxngn");
- nftsDTO.setName("lmheditnftssss");
- nftsDTO.setUri("http://www.hasbocai.com");
- nftsDTO.setData("123");
- nftslist.add(nftsDTO);
- req.setNfts(nftslist);
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.nftClient.batchEditNft(req, "iaa14c3dul0xdh4javrxec5vvfzvy7qk0qnfrruvvl");
- System.out.println(res.getData().getOperationId());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
-
- }
-
- @Test
- //请求批量销毁 NFT 接口示例
- void TestBatchDeleteNft() {
- BatchBurnNftReq req = new BatchBurnNftReq();
- List nftslist = new ArrayList<>();
- BatchBurnNftReq.NftsDTO nftsDTO = new BatchBurnNftReq.NftsDTO();
- nftsDTO.setClassId("bakvavoy");
- nftsDTO.setNftId("avataaeqov8gmo0xetsexyi7k7cvxngn");
- nftslist.add(nftsDTO);
- req.setNfts(nftslist);
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.nftClient.batchBurnNft(req, "iaa14c3dul0xdh4javrxec5vvfzvy7qk0qnfrruvvl");
- System.out.println(res.getData().getOperationId());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
- @Test
- //请求查询 NFT 列表接口示例
- void TestQueryNfts() {
- QueryNftsReq req = new QueryNftsReq();
- req.setLimit("2");
- req.setStatus("burned");
- QueryNftsRes res = client.nftClient.queryNfts(req);
- System.out.println(res.getData());
- }
-
- @Test
- //请求查询 NFT 详情接口示例
- void TestQueryNft() {
- QueryNftRes res = client.nftClient.queryNft(
- "bakvavoy",
- "avatabpyev9ewlg25bz4v8lpehap5xor");
- System.out.println(res);
- }
-
- @Test
- //请求查询 NFT 操作记录接口示例
- void TestQueryNftHistory() {
- QueryNftHistoryReq req = new QueryNftHistoryReq();
- req.setLimit("2");
- QueryNftHistoryRes res = client.nftClient.queryNftHistory(
- "bakvavoy",
- "avatabpyev9ewlg25bz4v8lpehap5xor",req);
- System.out.println(res);
- }
-}
diff --git a/src/test/java/RecordTest.java b/src/test/java/RecordTest.java
deleted file mode 100644
index 4ef63ab..0000000
--- a/src/test/java/RecordTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-import ai.bianjie.avatasdk.AvataClient;
-import ai.bianjie.avatasdk.model.PublicResponse;
-import ai.bianjie.avatasdk.model.records.CreateRecordReq;
-import org.junit.jupiter.api.Test;
-
-public class RecordTest {
- AvataClient client = new AvataClient.Builder()
- .setDomain("")
- .setApiKey("")
- .setApiSecret("")
- .setHttpTimeout(10000)
- .init();
-
- String OperationID = String.valueOf(System.currentTimeMillis());
-
- @Test
- // 请求创建数字作品存证接口示例
- void TestCreateRecord() {
- CreateRecordReq req = new CreateRecordReq();
- req.setIdentityType(1);
- req.setIdentityName("和水果都啊");
- req.setIdentityNum("372522196912162618");
- req.setType(1);
- req.setName("ahscyu");
- req.setDescription("wefwas");
- req.setName("dwcwa");
- req.setHash("weqdfcac");
- req.setHashType(1);
- req.setOperationId(OperationID);
- try {
- PublicResponse res = client.recordsClient.createRecord(req);
- System.out.println(res.getData());
- System.out.println("no ai.bianjie.avatasdk.exception");
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/test/java/TxTest.java b/src/test/java/TxTest.java
deleted file mode 100644
index 3dda088..0000000
--- a/src/test/java/TxTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-
-import ai.bianjie.avatasdk.AvataClient;
-import ai.bianjie.avatasdk.model.tx.QueryQueueReq;
-import ai.bianjie.avatasdk.model.tx.QueryQueueRes;
-import ai.bianjie.avatasdk.model.tx.QueryTxRes;
-import org.junit.jupiter.api.Test;
-
-public class TxTest {
- AvataClient client = new AvataClient.Builder()
- .setDomain("")
- .setApiKey("")
- .setApiSecret("")
- .setHttpTimeout(10000)
- .init();
-
- @Test
- // 请求上链交易结果查询接口示例
- public void queryTx() {
-
- QueryTxRes txRes = client.txClient.queryTx("operationID1676014869");
-
- System.out.println(txRes.getData());
- }
-
- @Test
- //请求上链交易排队状态查询接口示例
- public void queryQueueInfo() {
- QueryQueueReq req = new QueryQueueReq();
- req.setOperationId("test");
- QueryQueueRes res = client.txClient.queryQueueInfo(req);
-
- System.out.println(res.getData());
- }
-}
diff --git a/src/test/java/ai/bianjie/avatasdktest/AccountTest.java b/src/test/java/ai/bianjie/avatasdktest/AccountTest.java
new file mode 100644
index 0000000..31a058c
--- /dev/null
+++ b/src/test/java/ai/bianjie/avatasdktest/AccountTest.java
@@ -0,0 +1,104 @@
+package ai.bianjie.avatasdktest;
+
+import ai.bianjie.avatasdk.AvataClient;
+import ai.bianjie.avatasdk.model.account.*;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+
+public class AccountTest {
+ private AvataClient client;
+
+ @BeforeEach
+ public void init() {
+ client = AvataClientTest.getAvataClient();
+ }
+
+ @Test
+ //请求创建链账户接口示例
+ void TestCreateAccount() {
+ CreateAccountReq req = new CreateAccountReq();
+ req.setName("lmhtest");
+ req.setOperationId("createaccount");
+ try {
+ CreateAccountRes account = client.account.createAccount(req);
+ System.out.println(account.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求查询链账户接口示例
+ void TestQueryAccount() {
+ QueryAccountsReq req = new QueryAccountsReq();
+ //req.setPageKey("");
+ //req.setLimit("3");
+ //req.setAccount("");
+ // req.setName("");
+ //req.setOperationId("");
+ //req.setStartDate("");
+ //req.setEndDate("");
+ //req.setSortBy("");
+ req.setCountTotal("1");
+ try {
+ QueryAccountsRes account = client.account.queryAccounts(req);
+ System.out.println(account.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求批量创建链账户接口示例
+ void TestBatchCreateAccount() {
+ BatchCreateAccountReq req = new BatchCreateAccountReq();
+ req.setCount(1);
+ req.setOperationId("batchcreateaccount");
+ try {
+ BatchCreateAccountRes account = client.account.batchCreateAccounts(req);
+ System.out.println(account.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //原生模块:请求查询链账户操作记录接口示例
+ void TestQueryNativeAccountHistory() {
+ QueryAccountsHistoryReq req = new QueryAccountsHistoryReq();
+ //req.setPageKey("");
+ //req.setLimit("");
+ req.setAccount("iaa1jjmwg5ah27aynuwt2phwa8sfvzh4lvvlelddxm");
+ try {
+ QueryNatAccountsHistoryRes account = client.account.queryNativeAccountsHistory(req);
+ System.out.println(account.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //EVM 模块:请求查询链账户操作记录接口示例
+ void TestQueryEvmAccountHistory() {
+ QueryAccountsHistoryReq req = new QueryAccountsHistoryReq();
+ //req.setPageKey("");
+ //req.setLimit("");
+ try {
+ QueryEvmAccountsHistoryRes account = client.account.queryEvmAccountsHistory(req);
+ System.out.println(account.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/ai/bianjie/avatasdktest/AvataClientTest.java b/src/test/java/ai/bianjie/avatasdktest/AvataClientTest.java
new file mode 100644
index 0000000..c07e302
--- /dev/null
+++ b/src/test/java/ai/bianjie/avatasdktest/AvataClientTest.java
@@ -0,0 +1,15 @@
+package ai.bianjie.avatasdktest;
+
+import ai.bianjie.avatasdk.AvataClient;
+
+public class AvataClientTest {
+
+ public static AvataClient getAvataClient() {
+ return new AvataClient.Builder()
+ .setDomain("域名,不同环境对应不同的域名,如测试环境: https://stage.apis.avata.bianjie.ai")
+ .setApiKey("项目参数 API KEY")
+ .setApiSecret("项目参数 API SECRET")
+ .setHttpTimeout(10000)
+ .init();
+ }
+}
diff --git a/src/test/java/ai/bianjie/avatasdktest/CallbackTest.java b/src/test/java/ai/bianjie/avatasdktest/CallbackTest.java
new file mode 100644
index 0000000..16102fa
--- /dev/null
+++ b/src/test/java/ai/bianjie/avatasdktest/CallbackTest.java
@@ -0,0 +1,57 @@
+package ai.bianjie.avatasdktest;
+
+import ai.bianjie.avatasdk.util.CallbackUtils;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+
+import javax.servlet.http.HttpServletRequest;
+
+import static ai.bianjie.avatasdk.model.onCallbackRes.*;
+
+public class CallbackTest {
+ public String callback(HttpServletRequest r) {
+ try {
+ String result = CallbackUtils.OnCallback(APIVersionV1, "", null, r, new CallbackUtils.APP() {
+ @Override
+ public void onCallback(String version, String kind, Object object) throws Exception {
+ System.out.println(version);
+ System.out.println(r.getHeader("X-Signature"));
+ System.out.println(r.getHeader("X-Timestamp"));
+ // Add your app logic here
+ //throw new CallbackUtils.AppException("error occurred in the app method");
+ if (object instanceof onCallbackResV1) {
+ // V1 版本回调结果
+ onCallbackResV1 v1Res = (onCallbackResV1) object;
+ System.out.println(v1Res);
+
+ Object nftObj = JSON.parseObject(v1Res.getNft(), NftV1.class);
+ NftV1 nftRes = (NftV1) nftObj;
+ System.out.println(nftRes.getClassId());
+
+ } else if (object instanceof onCallbackResNative) {
+ // V2 及以上版本原生模块接口回调结果
+ onCallbackResNative nativeRes = (onCallbackResNative) object;
+ System.out.println(nativeRes.getNft().getId());
+ } else if (object instanceof onCallbackResEVM) {
+ // V2 及以上版本 EVM 模块接口回调结果
+ onCallbackResEVM evmRes = (onCallbackResEVM) object;
+ System.out.println(evmRes.getNft().getId());
+ } else {
+ // 处理其他类型或默认情况
+ throw new Exception("Object is of unknown type");
+ }
+ }
+ });
+ if (result.equals("SUCCESS")) {
+ System.out.println("回调推送成功");
+ } else
+ System.out.println("回调推送失败");
+ return result; // 向 Avata 服务器返回结果
+ } catch (Exception e) {
+ e.printStackTrace();
+ return "FAILED"; // 向 Avata 服务器返回结果
+ }
+ }
+}
+
+
diff --git a/src/test/java/OrderTest.java b/src/test/java/ai/bianjie/avatasdktest/OrderTest.java
similarity index 57%
rename from src/test/java/OrderTest.java
rename to src/test/java/ai/bianjie/avatasdktest/OrderTest.java
index 162e952..fffa6b1 100644
--- a/src/test/java/OrderTest.java
+++ b/src/test/java/ai/bianjie/avatasdktest/OrderTest.java
@@ -1,29 +1,32 @@
+package ai.bianjie.avatasdktest;
+
import ai.bianjie.avatasdk.AvataClient;
+import ai.bianjie.avatasdk.model.PublicResponse;
import ai.bianjie.avatasdk.model.order.*;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
public class OrderTest {
- AvataClient client = new AvataClient.Builder()
- .setDomain("")
- .setApiKey("")
- .setApiSecret("")
- .setHttpTimeout(10000)
- .init();
+ private AvataClient client;
+ @BeforeEach
+ public void init() {
+ client = AvataClientTest.getAvataClient();
+ }
@Test
- //请求购买能量值/业务费接口示例
+ //请求购买能量值接口示例
void TestCreateOrder() {
CreateOrderReq req = new CreateOrderReq();
- req.setOrderId("sxjtesto_rde2rid0w2");
- req.setAccount("iaa1d3fmeputf2h3takuyz68sl42v3r5s3szdx8y80");
+ req.setAccount("");
req.setAmount(100);
- req.setOrderType("gas");
+ req.setOrderType(1);
+ req.setOperationId("buygas");
try {
- OrderRes res = client.orderClient.createOrder(req);
- System.out.println(res.getData().getOrderId());
+ PublicResponse res = client.order.createOrder(req);
+ System.out.println(res.getData());
System.out.println("no ai.bianjie.avatasdk.exception");
} catch (Exception e) {
System.out.println(e);
@@ -35,7 +38,8 @@ void TestCreateOrder() {
//请求查询能量值/业务费购买结果接口示例
void TestQueryOrder() {
try {
- QueryOrderRes res = client.orderClient.queryOrder("sxjtesto_rde2rid0w2");
+ QueryOrderRes res = client.order.queryOrder(
+ "");
System.out.println(res.getData());
System.out.println("no ai.bianjie.avatasdk.exception");
} catch (Exception e) {
@@ -45,12 +49,18 @@ void TestQueryOrder() {
}
@Test
- //请求查询能量值/业务费购买结果列表接口示例
+ //请求查询能量值购买结果列表接口示例
void TestQueryOrders() {
QueryOrdersReq req = new QueryOrdersReq();
- req.setStatus("success");
+ req.setPageKey("");
+ req.setLimit("1");
+ req.setStatus("2");
+ req.setStartDate("2023-04-26");
+ //req.setEndDate("");
+ //req.setSortBy("");
+ req.setCountTotal("1");
try {
- QueryOrdersRes res = client.orderClient.queryOrders(req);
+ QueryOrdersRes res = client.order.queryOrders(req);
System.out.println(res.getData());
System.out.println("no ai.bianjie.avatasdk.exception");
} catch (Exception e) {
@@ -63,21 +73,28 @@ void TestQueryOrders() {
//请求批量购买能量值接口示例
void TestBatchCreatrOrders() {
BatchCreateOrderReq req = new BatchCreateOrderReq();
+
List list = new ArrayList<>();
+
BatchCreateOrderReq.ListDTO dto1 = new BatchCreateOrderReq.ListDTO();
- dto1.setAccount("iaa1d3fmeputf2h3takuyz68sl42v3r5s3szdx8y80");
- dto1.setAmount(200);
+ dto1.setAccount("");
+ dto1.setAmount(100);
list.add(dto1);
+
+ BatchCreateOrderReq.ListDTO dto2 = new BatchCreateOrderReq.ListDTO();
+ dto2.setAccount("");
+ dto2.setAmount(100);
+ list.add(dto2);
+
req.setList(list);
- req.setOrderId("gaisbc3_b1627");
+ req.setOperationId("batchcreateorder");
try {
- OrderRes res = client.orderClient.batchCreateOrders(req);
- System.out.println(res.getData().getOrderId());
+ PublicResponse res = client.order.batchCreateOrders(req);
+ System.out.println(res.getData());
System.out.println("no ai.bianjie.avatasdk.exception");
} catch (Exception e) {
System.out.println(e);
e.printStackTrace();
}
}
-
}
diff --git a/src/test/java/ai/bianjie/avatasdktest/UserTest.java b/src/test/java/ai/bianjie/avatasdktest/UserTest.java
new file mode 100644
index 0000000..83bcdfc
--- /dev/null
+++ b/src/test/java/ai/bianjie/avatasdktest/UserTest.java
@@ -0,0 +1,70 @@
+package ai.bianjie.avatasdktest;
+
+import ai.bianjie.avatasdk.AvataClient;
+import ai.bianjie.avatasdk.model.PublicResponse;
+import ai.bianjie.avatasdk.model.user.*;
+import ai.bianjie.avatasdk.util.AvataUtils;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+public class UserTest {
+ private AvataClient client;
+
+ @BeforeEach
+ public void init() {
+ client = AvataClientTest.getAvataClient();
+ }
+ @Test
+ //请求创建用户接口示例
+ void TestCreateUser() {
+ CreateUserReq req = new CreateUserReq();
+ req.setUserType(1);
+ req.setName("");
+ req.setCertificateNum("");
+ req.setPhoneNum("");
+ try {
+ CreateUserRes user = client.user.createUser(req);
+ System.out.println(user.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求更新用户接口示例
+ void TestUpdateUser() {
+ UpdateUserReq req = new UpdateUserReq();
+ req.setUserId("");
+ req.setPhoneNum("");
+ try {
+ PublicResponse user = client.user.updateUser(req);
+ System.out.println(user.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求查询用户接口示例
+ void TestQueryUser() {
+ QueryUserReq req = new QueryUserReq();
+ // user_type为 "1" 时,请填写提交认证时对应的个人信息(身份证或护照号)
+ // user_type为 "2" 时,请填写提交认证时对应的企业信息(企业的统一社会信用代码或机构注册号)
+ // 📢 注意:参数需要进行 hash 操作,hash 算法为:sha-256
+ String code = AvataUtils.sha256Sum("");
+ req.setUserType("1");
+ req.setCode(code);
+ try {
+ QueryUserRes user = client.user.queryUser(req);
+ System.out.println(user.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/ai/bianjie/avatasdktest/evm/ContractTest.java b/src/test/java/ai/bianjie/avatasdktest/evm/ContractTest.java
new file mode 100644
index 0000000..4fcb274
--- /dev/null
+++ b/src/test/java/ai/bianjie/avatasdktest/evm/ContractTest.java
@@ -0,0 +1,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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/ai/bianjie/avatasdktest/evm/NftTest.java b/src/test/java/ai/bianjie/avatasdktest/evm/NftTest.java
new file mode 100644
index 0000000..314b275
--- /dev/null
+++ b/src/test/java/ai/bianjie/avatasdktest/evm/NftTest.java
@@ -0,0 +1,221 @@
+package ai.bianjie.avatasdktest.evm;
+
+import ai.bianjie.avatasdk.AvataClient;
+import ai.bianjie.avatasdk.model.PublicResponse;
+import ai.bianjie.avatasdk.model.evm.nft.*;
+import ai.bianjie.avatasdktest.AvataClientTest;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+public class NftTest {
+ private AvataClient client;
+
+ @BeforeEach
+ public void init() {
+ client = AvataClientTest.getAvataClient();
+ }
+ @Test
+ //请求创建 NFT 类别接口示例
+ void TestCreateClass() {
+ CreateNftClassReq req = new CreateNftClassReq();
+ req.setName("hhhh");
+ req.setSymbol("sdcs");
+ req.setOwner("0xd154Ed7CC897C71Bcd5765aBe6cb3F6bA195E5fA");
+ req.setEditableByOwner(1);
+ req.setEditableByClassOwner(1);
+ req.setOperationId("createnftclass");
+ try {
+ PublicResponse res = client.evm.nft.createNftClass(req);
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求查询 NFT 类别列表接口示例
+ void TestQueryNftClasses() {
+ QueryNftClassesReq req = new QueryNftClassesReq();
+ req.setPageKey("");
+ req.setLimit("");
+ req.setId("");
+ req.setName("");
+ req.setOwner("");
+ req.setTxHash("");
+ req.setStartDate("");
+ req.setEndDate("");
+ req.setCountTotal("1");
+ req.setId("");
+ try {
+ QueryNftClassesRes res = client.evm.nft.queryNftClasses(req);
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求查询 NFT 类别详情接口示例
+ void TestQueryNftClass() {
+ try {
+ QueryNftClassRes res = client.evm.nft.queryNftClass("");
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求转让 NFT 类别接口示例
+ void TestTransferNftClass() {
+ TransferNftClassReq req = new TransferNftClassReq();
+ req.setRecipient("");
+ req.setOperationId("transfernftclass");
+ try {
+ PublicResponse res = client.evm.nft.transferNftClass(req,
+ "",
+ "");
+ System.out.println(res.getData());
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求发行 NFT 接口示例
+ void TestMintNft() {
+ MintNftReq req = new MintNftReq();
+ req.setUri("");
+ req.setUriHash("");
+ req.setRecipient("");
+ req.setOperationId("mintnft");
+ try {
+ PublicResponse res =client.evm.nft.mintNft(req,
+ "");
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求转让 NFT 接口示例
+ void TestTransferNft() {
+ TransferNftReq req = new TransferNftReq();
+ req.setRecipient("");
+ req.setOperationId("transfernft");
+ try {
+ PublicResponse res = client.evm.nft.transferNft(req,
+ "",
+ "",
+ "");
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求编辑 NFT 接口示例
+ void TestEditNft() {
+ EditNftReq req = new EditNftReq();
+ req.setUri("");
+ req.setUriHash("");
+ req.setOperationId("editnft");
+ try {
+ PublicResponse res =client.evm.nft.editNft(req,
+ "",
+ "",
+ "");
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求销毁 NFT 接口示例
+ void TestDeleteNft() {
+ BurnNftReq req = new BurnNftReq();
+ req.setOperationId("burnnft");
+ try {
+ PublicResponse res =client.evm.nft.burnNft(req,
+ "",
+ "",
+ "");
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求查询 NFT 列表接口示例
+ void TestQueryNfts() {
+ try {
+ QueryNftsReq req = new QueryNftsReq();
+ req.setPageKey("");
+ req.setLimit("");
+ req.setId("");
+ req.setClassId("");
+ req.setOwner("");
+ req.setTxHash("");
+ req.setStatus("");
+ req.setStartDate("");
+ req.setEndDate("");
+ req.setSortBy("");
+ req.setCountTotal("1");
+ QueryNftsRes res =client.evm.nft.queryNfts(req);
+ System.out.println(res.getData());
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求查询 NFT 详情接口示例
+ void TestQueryNft() {
+ try {
+ QueryNftRes res = client.evm.nft.queryNft(
+ "",
+ "");
+ System.out.println(res.getData());
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求查询 NFT 操作记录接口示例
+ void TestQueryNftHistory() {
+ try {
+ QueryNftHistoryReq req = new QueryNftHistoryReq();
+ req.setLimit("2");
+ QueryNftHistoryRes res =client.evm.nft.queryNftHistory(
+ "",
+ "", req);
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/src/test/java/ai/bianjie/avatasdktest/evm/NsTest.java b/src/test/java/ai/bianjie/avatasdktest/evm/NsTest.java
new file mode 100644
index 0000000..97b7d6d
--- /dev/null
+++ b/src/test/java/ai/bianjie/avatasdktest/evm/NsTest.java
@@ -0,0 +1,162 @@
+package ai.bianjie.avatasdktest.evm;
+
+import ai.bianjie.avatasdk.AvataClient;
+import ai.bianjie.avatasdk.model.PublicResponse;
+import ai.bianjie.avatasdk.model.evm.ns.*;
+import ai.bianjie.avatasdktest.AvataClientTest;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+public class NsTest {
+ private AvataClient client;
+
+ @BeforeEach
+ public void init() {
+ client = AvataClientTest.getAvataClient();
+ }
+ @Test
+ //请求注册域名接口示例
+ void TestRegisterDomain() {
+ RegisterDomainReq req = new RegisterDomainReq();
+ req.setName("");
+ req.setOwner("");
+ req.setDuration(1);
+ req.setOperationId("registerdomain");
+ try {
+ PublicResponse res = client.evm.ns.registerDomain(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 TestQueryDomain() {
+ QueryDomainReq req = new QueryDomainReq();
+ req.setName("");
+ try {
+ QueryDomainRes res =client.evm.ns.queryDomain(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 TestQueryOwnerDomain() {
+ QueryOwnerDomainReq req = new QueryOwnerDomainReq();
+ req.setPageKey("");
+ req.setLimit("1");
+ req.setName("");
+ req.setTld("");
+ req.setCountTotal("1");
+ try {
+ QueryOwnerDomainRes res = client.evm.ns.queryOwnerDomain(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 TestTransferDomain() {
+ TransferDomainReq req = new TransferDomainReq();
+ req.setRecipient("");
+ req.setOperationId("transferDomian");
+ try {
+ PublicResponse res = client.evm.ns.transferDomain(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 TestResolveDomain() {
+ ResolveDomainReq req = new ResolveDomainReq();
+ req.setResolveType(1);
+ ResolveDomainReq.AddrDTO addrDTO = new ResolveDomainReq.AddrDTO();
+ req.setAddrDTO(addrDTO);
+ addrDTO.setAddrValue("");
+ addrDTO.setBlockChain(1002);
+ //req.setResolveType(2);
+ //ResolveDomainReq.TextDTO textDTO = new ResolveDomainReq.TextDTO();
+ //req.setTextDTO(textDTO);
+ //textDTO.setKey("");
+ //textDTO.setTextValue("");
+ req.setOperationId("resolveDomain");
+ try {
+ PublicResponse res = client.evm.ns.resolveDomain(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 TestQueryDomainResolves() {
+ QueryDomainResolvesReq req = new QueryDomainResolvesReq();
+ req.setResolveType(0);
+ try {
+ QueryDomainResolvesRes res = client.evm.ns.queryDomainResolves(
+ "", 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 TestReverseResolveDomain() {
+ ReverseResolveDomainReq req = new ReverseResolveDomainReq();
+ req.setName("");
+ req.setOperationId("");
+ try {
+ PublicResponse res = client.evm.ns.reverseResolveDomain(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 TestQueryReverseResolveDomain() {
+ try {
+ QueryReverseResolveDomainRes res = client.evm.ns.queryReverseResolveDomain(
+ "");
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (
+ Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/ai/bianjie/avatasdktest/evm/TxTest.java b/src/test/java/ai/bianjie/avatasdktest/evm/TxTest.java
new file mode 100644
index 0000000..2f9f7a0
--- /dev/null
+++ b/src/test/java/ai/bianjie/avatasdktest/evm/TxTest.java
@@ -0,0 +1,31 @@
+package ai.bianjie.avatasdktest.evm;
+
+import ai.bianjie.avatasdk.AvataClient;
+import ai.bianjie.avatasdk.model.evm.tx.QueryTxRes;
+import ai.bianjie.avatasdk.model.evm.tx.QueryTxTypesRes;
+import ai.bianjie.avatasdktest.AvataClientTest;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+public class TxTest {
+
+ private AvataClient client;
+
+ @BeforeEach
+ public void init() {
+ client = AvataClientTest.getAvataClient();
+ }
+ @Test
+ // 请求上链交易结果查询接口示例
+ public void queryTx() {
+ QueryTxRes txRes = client.evm.tx.queryTx("");
+ System.out.println(txRes.getData());
+ }
+
+ @Test
+ // 枚举值列表查询
+ public void queryTxTypes() {
+ QueryTxTypesRes txRes = client.evm.tx.queryTxTypes();
+ System.out.println(txRes.getData());
+ }
+}
diff --git a/src/test/java/ai/bianjie/avatasdktest/nat/MtTest.java b/src/test/java/ai/bianjie/avatasdktest/nat/MtTest.java
new file mode 100644
index 0000000..d4ebb1d
--- /dev/null
+++ b/src/test/java/ai/bianjie/avatasdktest/nat/MtTest.java
@@ -0,0 +1,203 @@
+package ai.bianjie.avatasdktest.nat;
+
+import ai.bianjie.avatasdk.AvataClient;
+import ai.bianjie.avatasdk.model.PublicResponse;
+import ai.bianjie.avatasdk.model.nat.mt.*;
+import ai.bianjie.avatasdktest.AvataClientTest;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+public class MtTest {
+ private AvataClient client;
+
+ @BeforeEach
+ public void init() {
+ client = AvataClientTest.getAvataClient();
+ }
+ @Test
+ //请求创建 MT 类别接口示例
+ void TestCreateMtClass() {
+ CreateMtClassReq req = new CreateMtClassReq();
+ req.setName("");
+ req.setOwner("");
+ req.setData("");
+ req.setOperationId("createmtclass");
+ try {
+ PublicResponse res = client.nat.mt.createMtClass(req);
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求查询 MT 类别列表接口示例
+ void TestQueryMtClasses() {
+ QueryMtClassesReq req = new QueryMtClassesReq();
+ req.setId("");
+ req.setOwner("");
+ QueryMtClassesRes res = client.nat.mt.queryMtClasses(req);
+ System.out.println(res.getData());
+ }
+
+ @Test
+ //请求查询 MT 类别详情接口示例
+ void TestQueryMtClass() {
+ QueryMtClassRes res = client.nat.mt.queryMtClass("");
+ System.out.println(res.getData());
+ }
+
+ @Test
+ //请求转让 MT 类别接口示例
+ void TestTransferMtClass() {
+ TransferMtClassReq req = new TransferMtClassReq();
+ req.setRecipient("");
+ req.setOperationId("transfermtclass");
+ try {
+ PublicResponse res = client.nat.mt.transferMtClass(req,
+ "",
+ "");
+ System.out.println(res.getData());
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求发行 MT 接口示例
+ void TestCreateMt() {
+ IssueMtReq req = new IssueMtReq();
+ req.setData("");
+ req.setAmount(1);
+ req.setRecipient("");
+ req.setOperationId("createmt");
+ try {
+ PublicResponse res =client.nat.mt.createMt(req, "");
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求增发 MT接口示例
+ void TestMintMt() {
+ MintMtReq req = new MintMtReq();
+ req.setAmount(10);
+ req.setRecipient("");
+ req.setOperationId("mintmt");
+ try {
+ PublicResponse res = client.nat.mt.mintMt(req,
+ "",
+ "");
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求转让 MT 接口示例
+ void TestTransferMt() {
+ TransferMtReq req = new TransferMtReq();
+ req.setAmount(10);
+ req.setRecipient("");
+ req.setOperationId("transfermt");
+ try {
+ PublicResponse res = client.nat.mt.transferMt(req,
+ "",
+ "",
+ "");
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求编辑 MT 接口示例
+ void TestEditMt() {
+ EditMtReq req = new EditMtReq();
+ req.setData("789");
+ req.setOperationId("editmt");
+ try {
+ PublicResponse res = client.nat.mt.editMt(req,
+ "",
+ "",
+ "");
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求销毁 MT 接口示例
+ void TestDeleteMt() {
+ BurnMtReq req = new BurnMtReq();
+ req.setAmount(1);
+ req.setOperationId("burnmt");
+ try {
+ PublicResponse res = client.nat.mt.deleteMt(req,
+ "",
+ "",
+ "");
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ //请求查询 MT 列表接口示例
+ void TestQueryMts() {
+ QueryMtsReq req = new QueryMtsReq();
+ req.setId("");
+ QueryMtsRes res = client.nat.mt.queryMts(req);
+ System.out.println(res.getData());
+ }
+
+ @Test
+ //请求查询 MT 详情接口示例
+ void TestQueryMt() {
+ QueryMtRes res = client.nat.mt.queryMt(
+ "",
+ "");
+ System.out.println(res.getData());
+ }
+
+ @Test
+ //请求查询 MT 操作记录接口请求示例
+ void TestQueryMtHistory() {
+ QueryMtHistoryReq req = new QueryMtHistoryReq();
+ QueryMtHistoryRes res =client.nat.mt.queryMtHistory(req,
+ "",
+ "");
+ System.out.println(res);
+ }
+
+ @Test
+ //请求查询 MT 余额接口请求示例
+ void TestQueryMtBalances() {
+ QueryMtBalancesReq req = new QueryMtBalancesReq();
+ req.setId("");
+ QueryMtBalancesRes res = client.nat.mt.queryMtBalances(req,
+ "",
+ "");
+ System.out.println(res);
+ }
+}
diff --git a/src/test/java/ai/bianjie/avatasdktest/nat/NftTest.java b/src/test/java/ai/bianjie/avatasdktest/nat/NftTest.java
new file mode 100644
index 0000000..2ecbd2c
--- /dev/null
+++ b/src/test/java/ai/bianjie/avatasdktest/nat/NftTest.java
@@ -0,0 +1,183 @@
+package ai.bianjie.avatasdktest.nat;
+
+import ai.bianjie.avatasdk.AvataClient;
+import ai.bianjie.avatasdk.model.PublicResponse;
+import ai.bianjie.avatasdk.model.nat.nft.*;
+import ai.bianjie.avatasdktest.AvataClientTest;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+public class NftTest {
+ private AvataClient client;
+
+ @BeforeEach
+ public void init() {
+ client = AvataClientTest.getAvataClient();
+ }
+
+ @Test
+ //请求创建 NFT 类别接口示例
+ void TestCreateClass() {
+ CreateNftClassReq req = new CreateNftClassReq();
+ req.setName("");
+ req.setClassId("");
+ req.setSymbol("");
+ req.setDescription("");
+ req.setUri("");
+ req.setUriHash("");
+ req.setData("");
+ req.setOwner("");
+ req.setOperationId("createnftclass");
+ try {
+ PublicResponse res = client.nat.nft.createClass(req);
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求查询 NFT 类别列表接口示例
+ void TestQueryClasses() {
+ QueryNftClassesReq req = new QueryNftClassesReq();
+ req.setId("");
+ req.setOwner("");
+ QueryNftClassesRes res = client.nat.nft.queryClasses(req);
+ System.out.println(res.getData());
+ }
+
+ @Test
+ //请求查询 NFT 类别详情接口示例
+ void TestQueryClass() {
+ QueryNftClassRes res = client.nat.nft.queryClass("");
+ System.out.println(res.getData());
+ }
+
+ @Test
+ //请求转让 NFT 类别接口示例
+ void TestTransferClass() {
+ TransferNftClassReq req = new TransferNftClassReq();
+ req.setRecipient("");
+ req.setOperationId("transfernftclass");
+ try {
+ PublicResponse res =client.nat.nft.transferClass(req,
+ "",
+ "");
+ System.out.println(res.getData());
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求发行 NFT 接口示例
+ void TestCreateNft() {
+ MintNftReq req = new MintNftReq();
+ req.setName("");
+ req.setUri("");
+ req.setUriHash("");
+ req.setData("");
+ req.setRecipient("");
+ req.setOperationId("mintnft");
+ try {
+ PublicResponse res = client.nat.nft.createNft(req, "bakvavoy");
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求转让 NFT 接口示例
+ void TestTransferNft() {
+ TransferNftReq req = new TransferNftReq();
+ req.setRecipient("");
+ req.setOperationId("transfernft");
+ try {
+ PublicResponse res = client.nat.nft.transferNft(req,
+ "",
+ "",
+ "");
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求编辑 NFT 接口示例
+ void TestEditNft() {
+ EditNftReq req = new EditNftReq();
+ req.setName("");
+ req.setUri("");
+ req.setData("");
+ req.setOperationId("editnft");
+ try {
+ PublicResponse res = client.nat.nft.editNft(req,
+ "",
+ "",
+ "");
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ //请求销毁 NFT 接口示例
+ void TestDeleteNft() {
+ BurnNftReq req = new BurnNftReq();
+ req.setOperationId("burnnft");
+ try {
+ PublicResponse res = client.nat.nft.burnNft(req,
+ "",
+ "",
+ "");
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ //请求查询 NFT 列表接口示例
+ void TestQueryNfts() {
+ QueryNftsReq req = new QueryNftsReq();
+ req.setLimit("2");
+ req.setStatus("2");
+ QueryNftsRes res = client.nat.nft.queryNfts(req);
+ System.out.println(res.getData());
+ }
+
+ @Test
+ //请求查询 NFT 详情接口示例
+ void TestQueryNft() {
+ QueryNftRes res = client.nat.nft.queryNft(
+ "",
+ "");
+ System.out.println(res.getData());
+ }
+
+ @Test
+ //请求查询 NFT 操作记录接口示例
+ void TestQueryNftHistory() {
+ QueryNftHistoryReq req = new QueryNftHistoryReq();
+ req.setLimit("2");
+ QueryNftHistoryRes res = client.nat.nft.queryNftHistory(
+ "",
+ "", req);
+ System.out.println(res.getData());
+ }
+}
diff --git a/src/test/java/ai/bianjie/avatasdktest/nat/RecordsTest.java b/src/test/java/ai/bianjie/avatasdktest/nat/RecordsTest.java
new file mode 100644
index 0000000..7a35918
--- /dev/null
+++ b/src/test/java/ai/bianjie/avatasdktest/nat/RecordsTest.java
@@ -0,0 +1,39 @@
+package ai.bianjie.avatasdktest.nat;
+
+import ai.bianjie.avatasdk.AvataClient;
+import ai.bianjie.avatasdk.model.PublicResponse;
+import ai.bianjie.avatasdk.model.nat.records.CreateRecordReq;
+import ai.bianjie.avatasdktest.AvataClientTest;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+public class RecordsTest {
+ private AvataClient client;
+
+ @BeforeEach
+ public void init() {
+ client = AvataClientTest.getAvataClient();
+ }
+ @Test
+ // 请求创建数字作品存证接口示例
+ void TestCreateRecord() {
+ CreateRecordReq req = new CreateRecordReq();
+ req.setIdentityType(1);
+ req.setIdentityName("");
+ req.setIdentityNum("");
+ req.setType(1);
+ req.setDescription("");
+ req.setName("");
+ req.setHash("");
+ req.setHashType(1);
+ req.setOperationId("createrecord");
+ try {
+ PublicResponse res = client.nat.records.createRecord(req);
+ System.out.println(res.getData());
+ System.out.println("no ai.bianjie.avatasdk.exception");
+ } catch (Exception e) {
+ System.out.println(e);
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/src/test/java/ai/bianjie/avatasdktest/nat/TxTest.java b/src/test/java/ai/bianjie/avatasdktest/nat/TxTest.java
new file mode 100644
index 0000000..015c4a4
--- /dev/null
+++ b/src/test/java/ai/bianjie/avatasdktest/nat/TxTest.java
@@ -0,0 +1,30 @@
+package ai.bianjie.avatasdktest.nat;
+
+import ai.bianjie.avatasdk.AvataClient;
+import ai.bianjie.avatasdk.model.nat.tx.QueryTxRes;
+import ai.bianjie.avatasdk.model.nat.tx.QueryTxTypesRes;
+import ai.bianjie.avatasdktest.AvataClientTest;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+public class TxTest {
+ private AvataClient client;
+
+ @BeforeEach
+ public void init() {
+ client = AvataClientTest.getAvataClient();
+ }
+ @Test
+ // 请求上链交易结果查询接口示例
+ public void queryTx() {
+ QueryTxRes txRes = client.nat.tx.queryTx("");
+ System.out.println(txRes.getData());
+ }
+
+ @Test
+ // 枚举值列表查询
+ public void queryTxTypes() {
+ QueryTxTypesRes txRes = client.nat.tx.queryTxTypes();
+ System.out.println(txRes.getData());
+ }
+}