From 2b83d55d37c13024038793b3d874fe10b6296107 Mon Sep 17 00:00:00 2001 From: shaojunda Date: Tue, 13 Oct 2020 16:13:38 +0800 Subject: [PATCH 1/2] fix: wrong prefix --- server/services/construction_service.go | 5 ++++- server/services/misc.go | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/server/services/construction_service.go b/server/services/construction_service.go index faac024..94375f8 100644 --- a/server/services/construction_service.go +++ b/server/services/construction_service.go @@ -266,8 +266,11 @@ func (s *ConstructionAPIService) ConstructionDerive( return nil, wrapErr(ServerError, err) } + if _, ok := SupportedNetworks[s.network.Network]; !ok { + return nil, wrapErr(UnsupportedNetworkError, fmt.Errorf("network %s not supported", s.network.Network)) + } prefix := address.Mainnet - if s.network.Network != s.cfg.Network { + if s.network.Network != "mainnet" { prefix = address.Testnet } diff --git a/server/services/misc.go b/server/services/misc.go index 0629adc..b6928de 100644 --- a/server/services/misc.go +++ b/server/services/misc.go @@ -222,6 +222,12 @@ var ( Retriable: false, } + UnsupportedNetworkError = &types.Error{ + Code: 37, + Message: "unsupported network error.", + Retriable: false, + } + CkbCurrency = &types.Currency{ Symbol: "CKB", Decimals: 8, @@ -233,6 +239,12 @@ var ( ckb.RewardOpType, } + SupportedNetworks = map[string]bool{ + "mainnet": true, + "testnet": true, + "dev": true, + } + SupportedConstructionTypes = map[string]bool{ ckb.TransferCKB: true, } @@ -272,6 +284,7 @@ var ( TransactionParseError, InvalidAccountIdentifierMetadataError, AddressGenerationError, + UnsupportedNetworkError, } ) From 357312b7997467efac41b2a4c53680a69be8c6ce Mon Sep 17 00:00:00 2001 From: shaojunda Date: Tue, 13 Oct 2020 16:20:59 +0800 Subject: [PATCH 2/2] chore: Bump version to v0.3.5 --- CHANGELOG.md | 9 +++++++++ RELEASENOTES.md | 7 +++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efba175..21f02f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# [v0.3.5](https://github.com/nervosnetwork/ckb-rosetta-sdk/compare/v0.3.4...v0.3.5) (2020-10-13) + + +### Bug Fixes + +* wrong prefix ([2b83d55](https://github.com/nervosnetwork/ckb-rosetta-sdk/commit/2b83d55)) + + + # [v0.3.4](https://github.com/nervosnetwork/ckb-rosetta-sdk/compare/v0.3.3...v0.3.4) (2020-10-12) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 0c3a67a..3e4ac46 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -1,8 +1,7 @@ -# [v0.3.4](https://github.com/nervosnetwork/ckb-rosetta-sdk/compare/v0.3.3...v0.3.4) (2020-10-12) +# [v0.3.5](https://github.com/nervosnetwork/ckb-rosetta-sdk/compare/v0.3.4...v0.3.5) (2020-10-13) -### Features - -* use config Network replace string var ([d486aea](https://github.com/nervosnetwork/ckb-rosetta-sdk/commit/d486aea)) +### Bug Fixes +* wrong prefix ([2b83d55](https://github.com/nervosnetwork/ckb-rosetta-sdk/commit/2b83d55))