Skip to content

Commit

Permalink
update spec to 1.4.12 (#379)
Browse files Browse the repository at this point in the history
* update spec to 1.4.12

* fix lint

* update version
  • Loading branch information
shrimalmadhur committed Feb 9, 2022
1 parent 893ad4a commit 42733ef
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 9 deletions.
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var (
ErrRetriable = errors.New("retriable http status code received")
)

// APIClient manages communication with the Rosetta API v1.4.10
// APIClient manages communication with the Rosetta API v1.4.12
// In most cases there should be only one, shared, APIClient.
type APIClient struct {
cfg *Configuration
Expand Down
10 changes: 8 additions & 2 deletions codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ done
rm -rf tmp;

# Download spec file from releases
ROSETTA_SPEC_VERSION=1.4.10
ROSETTA_SPEC_VERSION=1.4.12
curl -L https://github.com/coinbase/rosetta-specifications/releases/download/v${ROSETTA_SPEC_VERSION}/api.json -o api.json;

# Generate client + types code
Expand Down Expand Up @@ -121,8 +121,9 @@ sed "${SED_IFLAG[@]}" 's/*CoinAction/CoinAction/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/*ExemptionType/ExemptionType/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/*BlockEventType/BlockEventType/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/*Direction/Direction/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/*Case/Case/g' client/* server/*;

# Fix CurveTypes, SignatureTypes, CoinActions, ExemptionTypes, Direction
# Fix CurveTypes, SignatureTypes, CoinActions, ExemptionTypes, Direction, Case
sed "${SED_IFLAG[@]}" 's/SECP256K1/Secp256k1/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/SECP256R1/Secp256r1/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/EDWARDS25519/Edwards25519/g' client/* server/*;
Expand All @@ -132,13 +133,18 @@ sed "${SED_IFLAG[@]}" 's/ECDSA/Ecdsa/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/ED25519/Ed25519/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/SCHNORR_1/Schnorr1/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/SCHNORR_POSEIDON/SchnorrPoseidon/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/PALLAS/Pallas/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/CREATED/CoinCreated/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/SPENT/CoinSpent/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/GREATER_OR_EQUAL/BalanceGreaterOrEqual/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/LESS_OR_EQUAL/BalanceLessOrEqual/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/DYNAMIC/BalanceDynamic/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/FORWARD/Forward/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/BACKWARD/Backward/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/UPPER_CASE/UpperCase/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/LOWER_CASE/LowerCase/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/CASE_SENSITIVE/CaseSensitive/g' client/* server/*;
sed "${SED_IFLAG[@]}" 's/NULL/Null/g' client/* server/*;

# Convert HexBytes to Bytes
sed "${SED_IFLAG[@]}" '/Hex-encoded public key bytes in the format specified by the CurveType/d' client/* server/*;
Expand Down
4 changes: 3 additions & 1 deletion types/allow.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,7 @@ type Allow struct {
// Any Rosetta implementation that can update an AccountIdentifier's unspent coins based on the
// contents of the mempool should populate this field as true. If false, requests to
// `/account/coins` that set `include_mempool` as true will be automatically rejected.
MempoolCoins bool `json:"mempool_coins"`
MempoolCoins bool `json:"mempool_coins"`
BlockHashCase Case `json:"block_hash_case,omitempty"`
TransactionHashCase Case `json:"transaction_hash_case,omitempty"`
}
6 changes: 4 additions & 2 deletions types/block_identifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package types
// BlockIdentifier The block_identifier uniquely identifies a block in a particular network.
type BlockIdentifier struct {
// This is also known as the block height.
Index int64 `json:"index"`
Hash string `json:"hash"`
Index int64 `json:"index"`
// This should be normalized according to the case specified in the block_hash_case network
// options.
Hash string `json:"hash"`
}
28 changes: 28 additions & 0 deletions types/case.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2022 Coinbase, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated by: OpenAPI Generator (https://openapi-generator.tech)

package types

// Case Case specifies the expected case for strings and hashes.
type Case string

// List of Case
const (
UpperCase Case = "upper_case"
LowerCase Case = "lower_case"
CaseSensitive Case = "case_sensitive"
Null Case = "null"
)
2 changes: 2 additions & 0 deletions types/curve_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package types
// (255-bits) || x-sign-bit (1-bit)` - `32 bytes` (https://ed25519.cr.yp.to/ed25519-20110926.pdf) *
// tweedle: 1st pk : Fq.t (32 bytes) || 2nd pk : Fq.t (32 bytes)
// (https://github.com/CodaProtocol/coda/blob/develop/rfcs/0038-rosetta-construction-api.md#marshal-keys)
// * pallas: `x (255 bits) || y-parity-bit (1-bit) - 32 bytes` (https://github.com/zcash/pasta)
type CurveType string

// List of CurveType
Expand All @@ -30,4 +31,5 @@ const (
Secp256r1 CurveType = "secp256r1"
Edwards25519 CurveType = "edwards25519"
Tweedle CurveType = "tweedle"
Pallas CurveType = "pallas"
)
2 changes: 1 addition & 1 deletion types/sync_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type SyncStatus struct {
TargetIndex *int64 `json:"target_index,omitempty"`
// Stage is the phase of the sync process.
Stage *string `json:"stage,omitempty"`
// sycned is a boolean that indicates if an implementation has synced up to the most recent
// synced is a boolean that indicates if an implementation has synced up to the most recent
// block. If this field is not populated, the caller should rely on a traditional tip timestamp
// comparison to determine if an implementation is synced. This field is particularly useful for
// quiescent blockchains (blocks only produced when there are pending transactions). In these
Expand Down
3 changes: 2 additions & 1 deletion types/transaction_identifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package types
// particular network and block or in the mempool.
type TransactionIdentifier struct {
// Any transactions that are attributable only to a block (ex: a block event) should use the
// hash of the block as the identifier.
// hash of the block as the identifier. This should be normalized according to the case
// specified in the transaction_hash_case in network options.
Hash string `json:"hash"`
}
2 changes: 1 addition & 1 deletion types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ const (
// RosettaAPIVersion is the version of the Rosetta API
// specification used to generate code for this release
// of the SDK.
RosettaAPIVersion = "1.4.10"
RosettaAPIVersion = "1.4.12"
)

0 comments on commit 42733ef

Please sign in to comment.