Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Commit

Permalink
Merge pull request #18 from nervosnetwork/rc/v0.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
shaojunda authored Oct 13, 2020
2 parents fa7c0a4 + 357312b commit 7879eac
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
7 changes: 3 additions & 4 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -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))

5 changes: 4 additions & 1 deletion server/services/construction_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
13 changes: 13 additions & 0 deletions server/services/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -233,6 +239,12 @@ var (
ckb.RewardOpType,
}

SupportedNetworks = map[string]bool{
"mainnet": true,
"testnet": true,
"dev": true,
}

SupportedConstructionTypes = map[string]bool{
ckb.TransferCKB: true,
}
Expand Down Expand Up @@ -272,6 +284,7 @@ var (
TransactionParseError,
InvalidAccountIdentifierMetadataError,
AddressGenerationError,
UnsupportedNetworkError,
}
)

Expand Down

0 comments on commit 7879eac

Please sign in to comment.