From 1fc25a9463f6aefaf93860345278d54b812cdddd Mon Sep 17 00:00:00 2001 From: zhengjianhui <815168733@qq.com> Date: Mon, 21 Jun 2021 11:56:19 +0800 Subject: [PATCH 1/2] docs(README.md): Update README.md --- ckb-mercury-sdk/README.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ckb-mercury-sdk/README.md b/ckb-mercury-sdk/README.md index 4bc93c222..4949a7aa4 100644 --- a/ckb-mercury-sdk/README.md +++ b/ckb-mercury-sdk/README.md @@ -35,9 +35,9 @@ Mercury 提供的余额查询接口会按这三种类型分别显示余额。 1. 余额查询:查询指定代币和地址的余额,按不同的资金类型显示余额。 ``` -GetBalanceResponse getBalance(String udt_hash, String ident) throws IOException; // - udt_hash 用于指定代币类型:若 udt_hash 为空,返回 ckb 的余额;若 udt_hash 不为空,则返回指定 udt 代币的余额 // - ident 表示待查询的地址 +GetBalanceResponse getBalance(String udt_hash, String ident) throws IOException; public class GetBalanceResponse { private String unconstrained; @@ -54,23 +54,23 @@ public class GetBalanceResponse { TransactionCompletionResponse buildTransferTransaction(TransferPayload payload) throws IOException; public class TransferPayload { - private String udt_hash; // - udt_hash 用于指定代币类型:若 udt_hash 为空,表示 ckb 转账;若 udt_hash 不为空,则表示指定 udt 代币的转账 - private FromAccount from; + private String udt_hash; // - from 表示付款方的账号信息,只支持一个付款方 - private List items; + private FromAccount from; // - items 表示收款方的信息,可以支持多个收款方 + private List items; + // - change 表示找零地址:若 change 为空,则默认将 from 的第一个地址作为找零地址。 private String change; - // - change 表示找零地址:若 change 为空,则默认将 from 的第一个地址作为找零地址。 - private BigInteger fee; // - fee 表示交易费,金额单位是 Shannon,1 ckb = 10^8 Shannon + private BigInteger fee; } public class FromAccount { - private List idents; // - idents 表示付款方的付款地址,支持同时使用多个地址付款 - private Source source; + private List idents; // -source 用于指定用于付款的代币资金类型,包括两个选项:unconstrained 和 fleeting。 + private Source source; } public enum Source { @@ -79,17 +79,17 @@ public enum Source { } public class TransferItem { - private ToAccount to; // - to 表示收款方的收款信息 - private BigInteger amount; + private ToAccount to; // - amount 表示转账金额,金额单位是 ckb + private BigInteger amount; } public class ToAccount { - private String ident; // - ident 表示收款方的地址 - private Action action; + private String ident; // - action 指定收款方的账户由谁提供,包括三种选项:pay_by_from,lend_by_from 和 pay_by_to + private Action action; } public enum Action { @@ -99,10 +99,10 @@ public enum Action { } public class TransactionCompletionResponse { - private Transaction tx_view; // - tx_view 表示接口返回的未签名的交易内容 - private List sigs_entry; + private Transaction tx_view; // - sigs_entry 表示签名槽位,提供用于签名的必要信息 + private List sigs_entry; } ``` @@ -112,17 +112,17 @@ public class TransactionCompletionResponse { TransactionCompletionResponse buildWalletCreationTransaction(CreateWalletPayload payload) throws IOException; public class CreateWalletPayload { - private String ident; // - ident 表示用于创建资产账户的地址,该地址必须有足够创建资产账户的 ckb(一般是 142 ckb) - private List info; + private String ident; // - info 表示资产账户的资产类型 - private BigInteger fee; + private List info; // - fee 表示交易费,金额单位是 Shannon,1 ckb = 10^8 Shannon + private BigInteger fee; } public class WalletInfo { - private String udt_hash; // - udt_hash 指定资产账户的代币类型,不能为空 + private String udt_hash; } ``` From 28b91383e3c1c3010a5609cd75f1d47ccf9ddc70 Mon Sep 17 00:00:00 2001 From: zhengjianhui <815168733@qq.com> Date: Sat, 26 Jun 2021 10:40:44 +0800 Subject: [PATCH 2/2] feat: CKB 0.42.0 support --- .gitignore | 1 + CHANGELOG.md | 8 +++++++- build.gradle | 4 ++-- .../main/java/model/resp/GetBalanceResponse.java | 5 ----- ckb/src/main/java/org/nervos/ckb/service/Api.java | 15 --------------- ckb/src/test/java/service/ApiTest.java | 13 ------------- 6 files changed, 10 insertions(+), 36 deletions(-) diff --git a/.gitignore b/.gitignore index 10432eef1..d331b6ded 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ hs_err_pid* /out */build/ */out/ +*/build**/ gradle.properties local.properties diff --git a/CHANGELOG.md b/CHANGELOG.md index a638c69dd..1e39fe826 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,13 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [v0.41.0](https://github.com/nervosnetwork/ckb-sdk-java/compare/v0.41.0...v0.41.1) (2021-06-12) +# [v0.42.0](https://github.com/nervosnetwork/ckb-sdk-java/compare/v0.41.1...v0.42.0) (2021-06-25) + +### BreakingChanges +* Remove `get_peers_state` rpc +* Remove `get_cellbase_output_capacity_details` rpc + +# [v0.41.1](https://github.com/nervosnetwork/ckb-sdk-java/compare/v0.41.0...v0.41.1) (2021-06-12) ### Bugfix * Fix JDK version 15 to 8 diff --git a/build.gradle b/build.gradle index 3d13c6dec..940c8d2db 100644 --- a/build.gradle +++ b/build.gradle @@ -43,7 +43,7 @@ allprojects { targetCompatibility = 1.8 group 'org.nervos.ckb' - version '0.41.1' + version '0.42.0' apply plugin: 'java' repositories { @@ -112,7 +112,7 @@ configure(subprojects.findAll { it.name != 'tests' }) { publications { mavenJava(MavenPublication) { groupId 'org.nervos.ckb' - version '0.41.1' + version '0.42.0' from components.java } } diff --git a/ckb-mercury-sdk/src/main/java/model/resp/GetBalanceResponse.java b/ckb-mercury-sdk/src/main/java/model/resp/GetBalanceResponse.java index d0cbc2efe..fe3d8724a 100644 --- a/ckb-mercury-sdk/src/main/java/model/resp/GetBalanceResponse.java +++ b/ckb-mercury-sdk/src/main/java/model/resp/GetBalanceResponse.java @@ -1,15 +1,10 @@ package model.resp; -import com.google.gson.annotations.SerializedName; - public class GetBalanceResponse { - @SerializedName("owned") public String unconstrained; - @SerializedName("claimable") public String fleeting; - @SerializedName("locked") public String locked; } diff --git a/ckb/src/main/java/org/nervos/ckb/service/Api.java b/ckb/src/main/java/org/nervos/ckb/service/Api.java index b382a1d44..bcf10f29e 100644 --- a/ckb/src/main/java/org/nervos/ckb/service/Api.java +++ b/ckb/src/main/java/org/nervos/ckb/service/Api.java @@ -50,15 +50,6 @@ public String getBlockHash(String blockNumber) throws IOException { String.class); } - @Deprecated - public CellbaseOutputCapacity getCellbaseOutputCapacityDetails(String blockHash) - throws IOException { - return rpcService.post( - "get_cellbase_output_capacity_details", - Collections.singletonList(blockHash), - CellbaseOutputCapacity.class); - } - public BlockEconomicState getBlockEconomicState(String blockHash) throws IOException { return rpcService.post( "get_block_economic_state", Collections.singletonList(blockHash), BlockEconomicState.class); @@ -128,12 +119,6 @@ public BlockchainInfo getBlockchainInfo() throws IOException { return rpcService.post("get_blockchain_info", Collections.emptyList(), BlockchainInfo.class); } - @Deprecated - public List getPeersState() throws IOException { - return rpcService.post( - "get_peers_state", Collections.emptyList(), new TypeToken>() {}.getType()); - } - /** Pool RPC */ public TxPoolInfo txPoolInfo() throws IOException { return rpcService.post("tx_pool_info", Collections.emptyList(), TxPoolInfo.class); diff --git a/ckb/src/test/java/service/ApiTest.java b/ckb/src/test/java/service/ApiTest.java index d7a1f8f10..3a04a84d1 100644 --- a/ckb/src/test/java/service/ApiTest.java +++ b/ckb/src/test/java/service/ApiTest.java @@ -40,13 +40,6 @@ public void testGetBlockHashByNumber() throws IOException { Assertions.assertNotNull(blockHash); } - @Test - public void testGetCellbaseOutputCapacityDetails() throws IOException { - String blockHash = api.getBlockHash("0x1"); - CellbaseOutputCapacity cellbaseOutputCapacity = api.getCellbaseOutputCapacityDetails(blockHash); - Assertions.assertNotNull(cellbaseOutputCapacity); - } - @Test public void testGetBlockEconomicState() throws IOException { String blockHash = api.getBlockHash("0x2"); @@ -250,12 +243,6 @@ public void testGetBlockchainInfo() throws IOException { Assertions.assertNotNull(blockchainInfo); } - @Test - public void testGetPeersState() throws IOException { - List peerStates = api.getPeersState(); - Assertions.assertNotNull(peerStates); - } - @Test public void testGetLiveCell() throws IOException { CellWithStatus cellWithStatus =