diff --git a/client/api_account.go b/client/api_account.go index 9e4567e8..8502f456 100644 --- a/client/api_account.go +++ b/client/api_account.go @@ -33,21 +33,8 @@ var ( // AccountAPIService AccountAPI service type AccountAPIService service -// AccountBalance Get an array of all AccountBalances for an AccountIdentifier and the -// BlockIdentifier at which the balance lookup was performed. The BlockIdentifier must always be -// returned because some consumers of account balance data need to know specifically at which block -// the balance was calculated to compare balances they compute from operations with the balance -// returned by the node. It is important to note that making a balance request for an account -// without populating the SubAccountIdentifier should not result in the balance of all possible -// SubAccountIdentifiers being returned. Rather, it should result in the balance pertaining to no -// SubAccountIdentifiers being returned (sometimes called the liquid balance). To get all balances -// associated with an account, it may be necessary to perform multiple balance requests with unique -// AccountIdentifiers. It is also possible to perform a historical balance lookup (if the server -// supports it) by passing in an optional BlockIdentifier. -func (a *AccountAPIService) AccountBalance( - ctx _context.Context, - accountBalanceRequest *types.AccountBalanceRequest, -) (*types.AccountBalanceResponse, *types.Error, error) { +// AccountBalance Get an array of all AccountBalances for an AccountIdentifier and the BlockIdentifier at which the balance lookup was performed. The BlockIdentifier must always be returned because some consumers of account balance data need to know specifically at which block the balance was calculated to compare balances they compute from operations with the balance returned by the node. It is important to note that making a balance request for an account without populating the SubAccountIdentifier should not result in the balance of all possible SubAccountIdentifiers being returned. Rather, it should result in the balance pertaining to no SubAccountIdentifiers being returned (sometimes called the liquid balance). To get all balances associated with an account, it may be necessary to perform multiple balance requests with unique AccountIdentifiers. It is also possible to perform a historical balance lookup (if the server supports it) by passing in an optional BlockIdentifier. +func (a *AccountAPIService) AccountBalance(ctx _context.Context, accountBalanceRequest *types.AccountBalanceRequest) (*types.AccountBalanceResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -100,11 +87,7 @@ func (a *AccountAPIService) AccountBalance( var v types.AccountBalanceResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -112,11 +95,7 @@ func (a *AccountAPIService) AccountBalance( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) @@ -139,21 +118,8 @@ func (a *AccountAPIService) AccountBalance( } } -// AccountCoins Get an array of all unspent coins for an AccountIdentifier and the BlockIdentifier -// at which the lookup was performed. If your implementation does not support coins (i.e. it is for -// an account-based blockchain), you do not need to implement this endpoint. If you implementation -// does support coins (i.e. it is fro a UTXO-based blockchain), you MUST also complete the -// /account/balance endpoint. It is important to note that making a coins request for an account -// without populating the SubAccountIdentifier should not result in the coins of all possible -// SubAccountIdentifiers being returned. Rather, it should result in the coins pertaining to no -// SubAccountIdentifiers being returned. To get all coins associated with an account, it may be -// necessary to perform multiple coin requests with unique AccountIdentifiers. Optionally, an -// implementation may choose to support updating an AccountIdentifier's unspent coins based on -// the contents of the mempool. Note, using this functionality breaks any guarantee of idempotency. -func (a *AccountAPIService) AccountCoins( - ctx _context.Context, - accountCoinsRequest *types.AccountCoinsRequest, -) (*types.AccountCoinsResponse, *types.Error, error) { +// AccountCoins Get an array of all unspent coins for an AccountIdentifier and the BlockIdentifier at which the lookup was performed. If your implementation does not support coins (i.e. it is for an account-based blockchain), you do not need to implement this endpoint. If you implementation does support coins (i.e. it is fro a UTXO-based blockchain), you MUST also complete the /account/balance endpoint. It is important to note that making a coins request for an account without populating the SubAccountIdentifier should not result in the coins of all possible SubAccountIdentifiers being returned. Rather, it should result in the coins pertaining to no SubAccountIdentifiers being returned. To get all coins associated with an account, it may be necessary to perform multiple coin requests with unique AccountIdentifiers. Optionally, an implementation may choose to support updating an AccountIdentifier's unspent coins based on the contents of the mempool. Note, using this functionality breaks any guarantee of idempotency. +func (a *AccountAPIService) AccountCoins(ctx _context.Context, accountCoinsRequest *types.AccountCoinsRequest) (*types.AccountCoinsResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -206,11 +172,7 @@ func (a *AccountAPIService) AccountCoins( var v types.AccountCoinsResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -218,11 +180,7 @@ func (a *AccountAPIService) AccountCoins( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) diff --git a/client/api_block.go b/client/api_block.go index cd12b8ce..c5433469 100644 --- a/client/api_block.go +++ b/client/api_block.go @@ -33,18 +33,8 @@ var ( // BlockAPIService BlockAPI service type BlockAPIService service -// Block Get a block by its Block Identifier. If transactions are returned in the same call to the -// node as fetching the block, the response should include these transactions in the Block object. -// If not, an array of Transaction Identifiers should be returned so /block/transaction fetches can -// be done to get all transaction information. When requesting a block by the hash component of the -// BlockIdentifier, this request MUST be idempotent: repeated invocations for the same -// hash-identified block must return the exact same block contents. No such restriction is imposed -// when requesting a block by height, given that a chain reorg event might cause the specific block -// at height n to be set to a different one. -func (a *BlockAPIService) Block( - ctx _context.Context, - blockRequest *types.BlockRequest, -) (*types.BlockResponse, *types.Error, error) { +// Block Get a block by its Block Identifier. If transactions are returned in the same call to the node as fetching the block, the response should include these transactions in the Block object. If not, an array of Transaction Identifiers should be returned so /block/transaction fetches can be done to get all transaction information. When requesting a block by the hash component of the BlockIdentifier, this request MUST be idempotent: repeated invocations for the same hash-identified block must return the exact same block contents. No such restriction is imposed when requesting a block by height, given that a chain reorg event might cause the specific block at height n to be set to a different one. +func (a *BlockAPIService) Block(ctx _context.Context, blockRequest *types.BlockRequest) (*types.BlockResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -97,11 +87,7 @@ func (a *BlockAPIService) Block( var v types.BlockResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -109,11 +95,7 @@ func (a *BlockAPIService) Block( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) @@ -136,24 +118,8 @@ func (a *BlockAPIService) Block( } } -// BlockTransaction Get a transaction in a block by its Transaction Identifier. This endpoint should -// only be used when querying a node for a block does not return all transactions contained within -// it. All transactions returned by this endpoint must be appended to any transactions returned by -// the /block method by consumers of this data. Fetching a transaction by hash is considered an -// Explorer Method (which is classified under the Future Work section). This method can be used to -// let consumers to paginate results when the block trasactions count is too big to be returned in -// a single BlockResponse. Calling this endpoint requires reference to a BlockIdentifier because -// transaction parsing can change depending on which block contains the transaction. For example, in -// Bitcoin it is necessary to know which block contains a transaction to determine the destination -// of fee payments. Without specifying a block identifier, the node would have to infer which block -// to use (which could change during a re-org). Implementations that require fetching previous -// transactions to populate the response (ex: Previous UTXOs in Bitcoin) may find it useful to run a -// cache within the Rosetta server in the /data directory (on a path that does not conflict with the -// node). -func (a *BlockAPIService) BlockTransaction( - ctx _context.Context, - blockTransactionRequest *types.BlockTransactionRequest, -) (*types.BlockTransactionResponse, *types.Error, error) { +// BlockTransaction Get a transaction in a block by its Transaction Identifier. This endpoint should only be used when querying a node for a block does not return all transactions contained within it. All transactions returned by this endpoint must be appended to any transactions returned by the /block method by consumers of this data. Fetching a transaction by hash is considered an Explorer Method (which is classified under the Future Work section). This method can be used to let consumers to paginate results when the block trasactions count is too big to be returned in a single BlockResponse. Calling this endpoint requires reference to a BlockIdentifier because transaction parsing can change depending on which block contains the transaction. For example, in Bitcoin it is necessary to know which block contains a transaction to determine the destination of fee payments. Without specifying a block identifier, the node would have to infer which block to use (which could change during a re-org). Implementations that require fetching previous transactions to populate the response (ex: Previous UTXOs in Bitcoin) may find it useful to run a cache within the Rosetta server in the /data directory (on a path that does not conflict with the node). +func (a *BlockAPIService) BlockTransaction(ctx _context.Context, blockTransactionRequest *types.BlockTransactionRequest) (*types.BlockTransactionResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -206,11 +172,7 @@ func (a *BlockAPIService) BlockTransaction( var v types.BlockTransactionResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -218,11 +180,7 @@ func (a *BlockAPIService) BlockTransaction( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) diff --git a/client/api_call.go b/client/api_call.go index 1e1caa5e..73a4f22a 100644 --- a/client/api_call.go +++ b/client/api_call.go @@ -33,21 +33,8 @@ var ( // CallAPIService CallAPI service type CallAPIService service -// Call Call invokes an arbitrary, network-specific procedure call with network-specific parameters. -// The guidance for what this endpoint should or could do is purposely left vague. In Ethereum, this -// could be used to invoke eth_call to implement an entire Rosetta API interface for some smart -// contract that is not parsed by the implementation creator (like a DEX). This endpoint could also -// be used to provide access to data that does not map to any Rosetta models instead of requiring an -// integrator to use some network-specific SDK and call some network-specific endpoint (like -// surfacing staking parameters). Call is NOT a replacement for implementing Rosetta API endpoints -// or mapping network-specific data to Rosetta models. Rather, it enables developers to build -// additional Rosetta API interfaces for things they care about without introducing complexity into -// a base-level Rosetta implementation. Simply put, imagine that the average integrator will use -// layered Rosetta API implementations that each surfaces unique data. -func (a *CallAPIService) Call( - ctx _context.Context, - callRequest *types.CallRequest, -) (*types.CallResponse, *types.Error, error) { +// Call Call invokes an arbitrary, network-specific procedure call with network-specific parameters. The guidance for what this endpoint should or could do is purposely left vague. In Ethereum, this could be used to invoke eth_call to implement an entire Rosetta API interface for some smart contract that is not parsed by the implementation creator (like a DEX). This endpoint could also be used to provide access to data that does not map to any Rosetta models instead of requiring an integrator to use some network-specific SDK and call some network-specific endpoint (like surfacing staking parameters). Call is NOT a replacement for implementing Rosetta API endpoints or mapping network-specific data to Rosetta models. Rather, it enables developers to build additional Rosetta API interfaces for things they care about without introducing complexity into a base-level Rosetta implementation. Simply put, imagine that the average integrator will use layered Rosetta API implementations that each surfaces unique data. +func (a *CallAPIService) Call(ctx _context.Context, callRequest *types.CallRequest) (*types.CallResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -100,11 +87,7 @@ func (a *CallAPIService) Call( var v types.CallResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -112,11 +95,7 @@ func (a *CallAPIService) Call( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) diff --git a/client/api_construction.go b/client/api_construction.go index f4939874..c8fc771f 100644 --- a/client/api_construction.go +++ b/client/api_construction.go @@ -33,13 +33,8 @@ var ( // ConstructionAPIService ConstructionAPI service type ConstructionAPIService service -// ConstructionCombine Combine creates a network-specific transaction from an unsigned transaction -// and an array of provided signatures. The signed transaction returned from this method will be -// sent to the /construction/submit endpoint by the caller. -func (a *ConstructionAPIService) ConstructionCombine( - ctx _context.Context, - constructionCombineRequest *types.ConstructionCombineRequest, -) (*types.ConstructionCombineResponse, *types.Error, error) { +// ConstructionCombine Combine creates a network-specific transaction from an unsigned transaction and an array of provided signatures. The signed transaction returned from this method will be sent to the /construction/submit endpoint by the caller. +func (a *ConstructionAPIService) ConstructionCombine(ctx _context.Context, constructionCombineRequest *types.ConstructionCombineRequest) (*types.ConstructionCombineResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -92,11 +87,7 @@ func (a *ConstructionAPIService) ConstructionCombine( var v types.ConstructionCombineResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -104,11 +95,7 @@ func (a *ConstructionAPIService) ConstructionCombine( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) @@ -131,12 +118,8 @@ func (a *ConstructionAPIService) ConstructionCombine( } } -// ConstructionDerive Derive returns the AccountIdentifier associated with a public key. Blockchains -// that require an on-chain action to create an account should not implement this method. -func (a *ConstructionAPIService) ConstructionDerive( - ctx _context.Context, - constructionDeriveRequest *types.ConstructionDeriveRequest, -) (*types.ConstructionDeriveResponse, *types.Error, error) { +// ConstructionDerive Derive returns the AccountIdentifier associated with a public key. Blockchains that require an on-chain action to create an account should not implement this method. +func (a *ConstructionAPIService) ConstructionDerive(ctx _context.Context, constructionDeriveRequest *types.ConstructionDeriveRequest) (*types.ConstructionDeriveResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -189,11 +172,7 @@ func (a *ConstructionAPIService) ConstructionDerive( var v types.ConstructionDeriveResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -201,11 +180,7 @@ func (a *ConstructionAPIService) ConstructionDerive( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) @@ -228,12 +203,8 @@ func (a *ConstructionAPIService) ConstructionDerive( } } -// ConstructionHash TransactionHash returns the network-specific transaction hash for a signed -// transaction. -func (a *ConstructionAPIService) ConstructionHash( - ctx _context.Context, - constructionHashRequest *types.ConstructionHashRequest, -) (*types.TransactionIdentifierResponse, *types.Error, error) { +// ConstructionHash TransactionHash returns the network-specific transaction hash for a signed transaction. +func (a *ConstructionAPIService) ConstructionHash(ctx _context.Context, constructionHashRequest *types.ConstructionHashRequest) (*types.TransactionIdentifierResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -286,11 +257,7 @@ func (a *ConstructionAPIService) ConstructionHash( var v types.TransactionIdentifierResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -298,11 +265,7 @@ func (a *ConstructionAPIService) ConstructionHash( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) @@ -325,19 +288,8 @@ func (a *ConstructionAPIService) ConstructionHash( } } -// ConstructionMetadata Get any information required to construct a transaction for a specific -// network. Metadata returned here could be a recent hash to use, an account sequence number, or -// even arbitrary chain state. The request used when calling this endpoint is created by calling -// /construction/preprocess in an offline environment. You should NEVER assume that the request sent -// to this endpoint will be created by the caller or populated with any custom parameters. This must -// occur in /construction/preprocess. It is important to clarify that this endpoint should not -// pre-construct any transactions for the client (this should happen in /construction/payloads). -// This endpoint is left purposely unstructured because of the wide scope of metadata that could be -// required. -func (a *ConstructionAPIService) ConstructionMetadata( - ctx _context.Context, - constructionMetadataRequest *types.ConstructionMetadataRequest, -) (*types.ConstructionMetadataResponse, *types.Error, error) { +// ConstructionMetadata Get any information required to construct a transaction for a specific network. Metadata returned here could be a recent hash to use, an account sequence number, or even arbitrary chain state. The request used when calling this endpoint is created by calling /construction/preprocess in an offline environment. You should NEVER assume that the request sent to this endpoint will be created by the caller or populated with any custom parameters. This must occur in /construction/preprocess. It is important to clarify that this endpoint should not pre-construct any transactions for the client (this should happen in /construction/payloads). This endpoint is left purposely unstructured because of the wide scope of metadata that could be required. +func (a *ConstructionAPIService) ConstructionMetadata(ctx _context.Context, constructionMetadataRequest *types.ConstructionMetadataRequest) (*types.ConstructionMetadataResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -390,11 +342,7 @@ func (a *ConstructionAPIService) ConstructionMetadata( var v types.ConstructionMetadataResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -402,11 +350,7 @@ func (a *ConstructionAPIService) ConstructionMetadata( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) @@ -429,13 +373,8 @@ func (a *ConstructionAPIService) ConstructionMetadata( } } -// ConstructionParse Parse is called on both unsigned and signed transactions to understand the -// intent of the formulated transaction. This is run as a sanity check before signing (after -// /construction/payloads) and before broadcast (after /construction/combine). -func (a *ConstructionAPIService) ConstructionParse( - ctx _context.Context, - constructionParseRequest *types.ConstructionParseRequest, -) (*types.ConstructionParseResponse, *types.Error, error) { +// ConstructionParse Parse is called on both unsigned and signed transactions to understand the intent of the formulated transaction. This is run as a sanity check before signing (after /construction/payloads) and before broadcast (after /construction/combine). +func (a *ConstructionAPIService) ConstructionParse(ctx _context.Context, constructionParseRequest *types.ConstructionParseRequest) (*types.ConstructionParseResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -488,11 +427,7 @@ func (a *ConstructionAPIService) ConstructionParse( var v types.ConstructionParseResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -500,11 +435,7 @@ func (a *ConstructionAPIService) ConstructionParse( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) @@ -527,18 +458,8 @@ func (a *ConstructionAPIService) ConstructionParse( } } -// ConstructionPayloads Payloads is called with an array of operations and the response from -// /construction/metadata. It returns an unsigned transaction blob and a collection of payloads that -// must be signed by particular AccountIdentifiers using a certain SignatureType. The array of -// operations provided in transaction construction often times can not specify all \effects\ of a -// transaction (consider invoked transactions in Ethereum). However, they can deterministically -// specify the \intent\ of the transaction, which is sufficient for construction. For this reason, -// parsing the corresponding transaction in the Data API (when it lands on chain) will contain a -// superset of whatever operations were provided during construction. -func (a *ConstructionAPIService) ConstructionPayloads( - ctx _context.Context, - constructionPayloadsRequest *types.ConstructionPayloadsRequest, -) (*types.ConstructionPayloadsResponse, *types.Error, error) { +// ConstructionPayloads Payloads is called with an array of operations and the response from /construction/metadata. It returns an unsigned transaction blob and a collection of payloads that must be signed by particular AccountIdentifiers using a certain SignatureType. The array of operations provided in transaction construction often times can not specify all \effects\ of a transaction (consider invoked transactions in Ethereum). However, they can deterministically specify the \intent\ of the transaction, which is sufficient for construction. For this reason, parsing the corresponding transaction in the Data API (when it lands on chain) will contain a superset of whatever operations were provided during construction. +func (a *ConstructionAPIService) ConstructionPayloads(ctx _context.Context, constructionPayloadsRequest *types.ConstructionPayloadsRequest) (*types.ConstructionPayloadsResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -591,11 +512,7 @@ func (a *ConstructionAPIService) ConstructionPayloads( var v types.ConstructionPayloadsResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -603,11 +520,7 @@ func (a *ConstructionAPIService) ConstructionPayloads( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) @@ -630,16 +543,8 @@ func (a *ConstructionAPIService) ConstructionPayloads( } } -// ConstructionPreprocess Preprocess is called prior to /construction/payloads to construct a -// request for any metadata that is needed for transaction construction given (i.e. account nonce). -// The options object returned from this endpoint will be sent to the /construction/metadata -// endpoint UNMODIFIED by the caller (in an offline execution environment). If your Construction API -// implementation has configuration options, they MUST be specified in the /construction/preprocess -// request (in the metadata field). -func (a *ConstructionAPIService) ConstructionPreprocess( - ctx _context.Context, - constructionPreprocessRequest *types.ConstructionPreprocessRequest, -) (*types.ConstructionPreprocessResponse, *types.Error, error) { +// ConstructionPreprocess Preprocess is called prior to /construction/payloads to construct a request for any metadata that is needed for transaction construction given (i.e. account nonce). The options object returned from this endpoint will be sent to the /construction/metadata endpoint UNMODIFIED by the caller (in an offline execution environment). If your Construction API implementation has configuration options, they MUST be specified in the /construction/preprocess request (in the metadata field). +func (a *ConstructionAPIService) ConstructionPreprocess(ctx _context.Context, constructionPreprocessRequest *types.ConstructionPreprocessRequest) (*types.ConstructionPreprocessResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -692,11 +597,7 @@ func (a *ConstructionAPIService) ConstructionPreprocess( var v types.ConstructionPreprocessResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -704,11 +605,7 @@ func (a *ConstructionAPIService) ConstructionPreprocess( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) @@ -731,15 +628,8 @@ func (a *ConstructionAPIService) ConstructionPreprocess( } } -// ConstructionSubmit Submit a pre-signed transaction to the node. This call should not block on the -// transaction being included in a block. Rather, it should return immediately with an indication of -// whether or not the transaction was included in the mempool. The transaction submission response -// should only return a 200 status if the submitted transaction could be included in the mempool. -// Otherwise, it should return an error. -func (a *ConstructionAPIService) ConstructionSubmit( - ctx _context.Context, - constructionSubmitRequest *types.ConstructionSubmitRequest, -) (*types.TransactionIdentifierResponse, *types.Error, error) { +// ConstructionSubmit Submit a pre-signed transaction to the node. This call should not block on the transaction being included in a block. Rather, it should return immediately with an indication of whether or not the transaction was included in the mempool. The transaction submission response should only return a 200 status if the submitted transaction could be included in the mempool. Otherwise, it should return an error. +func (a *ConstructionAPIService) ConstructionSubmit(ctx _context.Context, constructionSubmitRequest *types.ConstructionSubmitRequest) (*types.TransactionIdentifierResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -792,11 +682,7 @@ func (a *ConstructionAPIService) ConstructionSubmit( var v types.TransactionIdentifierResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -804,11 +690,7 @@ func (a *ConstructionAPIService) ConstructionSubmit( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) diff --git a/client/api_events.go b/client/api_events.go index e8ca8013..d5e29d8b 100644 --- a/client/api_events.go +++ b/client/api_events.go @@ -33,16 +33,8 @@ var ( // EventsAPIService EventsAPI service type EventsAPIService service -// EventsBlocks /events/blocks allows the caller to query a sequence of BlockEvents indicating which -// blocks were added and removed from storage to reach the current state. Following BlockEvents -// allows lightweight clients to update their state without needing to implement their own syncing -// logic (like finding the common parent in a reorg). /events/blocks is considered an \indexer\ -// endpoint and Rosetta implementations are not required to complete it to adhere to the Rosetta -// spec. However, any Rosetta \indexer\ MUST support this endpoint. -func (a *EventsAPIService) EventsBlocks( - ctx _context.Context, - eventsBlocksRequest *types.EventsBlocksRequest, -) (*types.EventsBlocksResponse, *types.Error, error) { +// EventsBlocks /events/blocks allows the caller to query a sequence of BlockEvents indicating which blocks were added and removed from storage to reach the current state. Following BlockEvents allows lightweight clients to update their state without needing to implement their own syncing logic (like finding the common parent in a reorg). /events/blocks is considered an \indexer\ endpoint and Rosetta implementations are not required to complete it to adhere to the Rosetta spec. However, any Rosetta \indexer\ MUST support this endpoint. +func (a *EventsAPIService) EventsBlocks(ctx _context.Context, eventsBlocksRequest *types.EventsBlocksRequest) (*types.EventsBlocksResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -95,11 +87,7 @@ func (a *EventsAPIService) EventsBlocks( var v types.EventsBlocksResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -107,11 +95,7 @@ func (a *EventsAPIService) EventsBlocks( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) diff --git a/client/api_mempool.go b/client/api_mempool.go index e263505c..df784cd9 100644 --- a/client/api_mempool.go +++ b/client/api_mempool.go @@ -34,10 +34,7 @@ var ( type MempoolAPIService service // Mempool Get all Transaction Identifiers in the mempool -func (a *MempoolAPIService) Mempool( - ctx _context.Context, - networkRequest *types.NetworkRequest, -) (*types.MempoolResponse, *types.Error, error) { +func (a *MempoolAPIService) Mempool(ctx _context.Context, networkRequest *types.NetworkRequest) (*types.MempoolResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -90,11 +87,7 @@ func (a *MempoolAPIService) Mempool( var v types.MempoolResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -102,11 +95,7 @@ func (a *MempoolAPIService) Mempool( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) @@ -129,17 +118,8 @@ func (a *MempoolAPIService) Mempool( } } -// MempoolTransaction Get a transaction in the mempool by its Transaction Identifier. This is a -// separate request than fetching a block transaction (/block/transaction) because some blockchain -// nodes need to know that a transaction query is for something in the mempool instead of a -// transaction in a block. Transactions may not be fully parsable until they are in a block (ex: may -// not be possible to determine the fee to pay before a transaction is executed). On this endpoint, -// it is ok that returned transactions are only estimates of what may actually be included in a -// block. -func (a *MempoolAPIService) MempoolTransaction( - ctx _context.Context, - mempoolTransactionRequest *types.MempoolTransactionRequest, -) (*types.MempoolTransactionResponse, *types.Error, error) { +// MempoolTransaction Get a transaction in the mempool by its Transaction Identifier. This is a separate request than fetching a block transaction (/block/transaction) because some blockchain nodes need to know that a transaction query is for something in the mempool instead of a transaction in a block. Transactions may not be fully parsable until they are in a block (ex: may not be possible to determine the fee to pay before a transaction is executed). On this endpoint, it is ok that returned transactions are only estimates of what may actually be included in a block. +func (a *MempoolAPIService) MempoolTransaction(ctx _context.Context, mempoolTransactionRequest *types.MempoolTransactionRequest) (*types.MempoolTransactionResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -192,11 +172,7 @@ func (a *MempoolAPIService) MempoolTransaction( var v types.MempoolTransactionResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -204,11 +180,7 @@ func (a *MempoolAPIService) MempoolTransaction( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) diff --git a/client/api_network.go b/client/api_network.go index ee15ec36..154336bb 100644 --- a/client/api_network.go +++ b/client/api_network.go @@ -34,10 +34,7 @@ var ( type NetworkAPIService service // NetworkList This endpoint returns a list of NetworkIdentifiers that the Rosetta server supports. -func (a *NetworkAPIService) NetworkList( - ctx _context.Context, - metadataRequest *types.MetadataRequest, -) (*types.NetworkListResponse, *types.Error, error) { +func (a *NetworkAPIService) NetworkList(ctx _context.Context, metadataRequest *types.MetadataRequest) (*types.NetworkListResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -90,11 +87,7 @@ func (a *NetworkAPIService) NetworkList( var v types.NetworkListResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -102,11 +95,7 @@ func (a *NetworkAPIService) NetworkList( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) @@ -129,14 +118,8 @@ func (a *NetworkAPIService) NetworkList( } } -// NetworkOptions This endpoint returns the version information and allowed network-specific types -// for a NetworkIdentifier. Any NetworkIdentifier returned by /network/list should be accessible -// here. Because options are retrievable in the context of a NetworkIdentifier, it is possible to -// define unique options for each network. -func (a *NetworkAPIService) NetworkOptions( - ctx _context.Context, - networkRequest *types.NetworkRequest, -) (*types.NetworkOptionsResponse, *types.Error, error) { +// NetworkOptions This endpoint returns the version information and allowed network-specific types for a NetworkIdentifier. Any NetworkIdentifier returned by /network/list should be accessible here. Because options are retrievable in the context of a NetworkIdentifier, it is possible to define unique options for each network. +func (a *NetworkAPIService) NetworkOptions(ctx _context.Context, networkRequest *types.NetworkRequest) (*types.NetworkOptionsResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -189,11 +172,7 @@ func (a *NetworkAPIService) NetworkOptions( var v types.NetworkOptionsResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -201,11 +180,7 @@ func (a *NetworkAPIService) NetworkOptions( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) @@ -228,12 +203,8 @@ func (a *NetworkAPIService) NetworkOptions( } } -// NetworkStatus This endpoint returns the current status of the network requested. Any -// NetworkIdentifier returned by /network/list should be accessible here. -func (a *NetworkAPIService) NetworkStatus( - ctx _context.Context, - networkRequest *types.NetworkRequest, -) (*types.NetworkStatusResponse, *types.Error, error) { +// NetworkStatus This endpoint returns the current status of the network requested. Any NetworkIdentifier returned by /network/list should be accessible here. +func (a *NetworkAPIService) NetworkStatus(ctx _context.Context, networkRequest *types.NetworkRequest) (*types.NetworkStatusResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -286,11 +257,7 @@ func (a *NetworkAPIService) NetworkStatus( var v types.NetworkStatusResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -298,11 +265,7 @@ func (a *NetworkAPIService) NetworkStatus( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) diff --git a/client/api_search.go b/client/api_search.go index 3deb12f8..45e444f1 100644 --- a/client/api_search.go +++ b/client/api_search.go @@ -33,16 +33,8 @@ var ( // SearchAPIService SearchAPI service type SearchAPIService service -// SearchTransactions /search/transactions allows the caller to search for transactions that meet -// certain conditions. Some conditions include matching a transaction hash, containing an operation -// with a certain status, or containing an operation that affects a certain account. -// /search/transactions is considered an \indexer\ endpoint and Rosetta implementations are not -// required to complete it to adhere to the Rosetta spec. However, any Rosetta \indexer\ MUST -// support this endpoint. -func (a *SearchAPIService) SearchTransactions( - ctx _context.Context, - searchTransactionsRequest *types.SearchTransactionsRequest, -) (*types.SearchTransactionsResponse, *types.Error, error) { +// SearchTransactions /search/transactions allows the caller to search for transactions that meet certain conditions. Some conditions include matching a transaction hash, containing an operation with a certain status, or containing an operation that affects a certain account. /search/transactions is considered an \indexer\ endpoint and Rosetta implementations are not required to complete it to adhere to the Rosetta spec. However, any Rosetta \indexer\ MUST support this endpoint. +func (a *SearchAPIService) SearchTransactions(ctx _context.Context, searchTransactionsRequest *types.SearchTransactionsRequest) (*types.SearchTransactionsResponse, *types.Error, error) { var ( localVarPostBody interface{} ) @@ -95,11 +87,7 @@ func (a *SearchAPIService) SearchTransactions( var v types.SearchTransactionsResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 200, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 200, response body %s: %w", string(localVarBody), err) } return &v, nil, nil @@ -107,11 +95,7 @@ func (a *SearchAPIService) SearchTransactions( var v types.Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return nil, nil, fmt.Errorf( - "failed to decode when hit status code 500, response body %s: %w", - string(localVarBody), - err, - ) + return nil, nil, fmt.Errorf("failed to decode when hit status code 500, response body %s: %w", string(localVarBody), err) } return nil, &v, fmt.Errorf("error %+v", v) diff --git a/client/client.go b/client/client.go index 9120180e..4aeba2dd 100644 --- a/client/client.go +++ b/client/client.go @@ -160,8 +160,7 @@ func (c *APIClient) ChangeBasePath(path string) { } // GetConfig allows for modification of underlying config for alternate implementations and testing -// Caution: modifying the configuration while live can cause data races and potentially unwanted -// behavior +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior func (c *APIClient) GetConfig() *Configuration { return c.cfg } diff --git a/client/configuration.go b/client/configuration.go index 83ce886b..2dd25430 100644 --- a/client/configuration.go +++ b/client/configuration.go @@ -46,8 +46,7 @@ var ( ContextAPIKey = contextKey("apikey") ) -// BasicAuth provides basic http authentication to a request passed via context using -// ContextBasicAuth +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth type BasicAuth struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` @@ -130,12 +129,7 @@ func (c *Configuration) ServerURL(index int, variables map[string]string) (strin } } if !found { - return "", fmt.Errorf( - "the variable %s in the server URL has invalid value %s. Must be %v", - name, - value, - variable.EnumValues, - ) + return "", fmt.Errorf("the variable %s in the server URL has invalid value %s. Must be %v", name, value, variable.EnumValues) } url = strings.ReplaceAll(url, "{"+name+"}", value) } else { diff --git a/server/api.go b/server/api.go index 354dd731..ce284704 100644 --- a/server/api.go +++ b/server/api.go @@ -23,39 +23,32 @@ import ( "github.com/coinbase/rosetta-sdk-go/types" ) -// AccountAPIRouter defines the required methods for binding the api requests to a responses for the -// AccountAPI +// AccountAPIRouter defines the required methods for binding the api requests to a responses for the AccountAPI // The AccountAPIRouter implementation should parse necessary information from the http request, -// pass the data to a AccountAPIServicer to perform the required actions, then write the service -// results to the http response. +// pass the data to a AccountAPIServicer to perform the required actions, then write the service results to the http response. type AccountAPIRouter interface { AccountBalance(http.ResponseWriter, *http.Request) AccountCoins(http.ResponseWriter, *http.Request) } -// BlockAPIRouter defines the required methods for binding the api requests to a responses for the -// BlockAPI +// BlockAPIRouter defines the required methods for binding the api requests to a responses for the BlockAPI // The BlockAPIRouter implementation should parse necessary information from the http request, -// pass the data to a BlockAPIServicer to perform the required actions, then write the service -// results to the http response. +// pass the data to a BlockAPIServicer to perform the required actions, then write the service results to the http response. type BlockAPIRouter interface { Block(http.ResponseWriter, *http.Request) BlockTransaction(http.ResponseWriter, *http.Request) } -// CallAPIRouter defines the required methods for binding the api requests to a responses for the -// CallAPI +// CallAPIRouter defines the required methods for binding the api requests to a responses for the CallAPI // The CallAPIRouter implementation should parse necessary information from the http request, -// pass the data to a CallAPIServicer to perform the required actions, then write the service -// results to the http response. +// pass the data to a CallAPIServicer to perform the required actions, then write the service results to the http response. type CallAPIRouter interface { Call(http.ResponseWriter, *http.Request) } -// ConstructionAPIRouter defines the required methods for binding the api requests to a responses -// for the ConstructionAPI The ConstructionAPIRouter implementation should parse necessary -// information from the http request, pass the data to a ConstructionAPIServicer to perform the -// required actions, then write the service results to the http response. +// ConstructionAPIRouter defines the required methods for binding the api requests to a responses for the ConstructionAPI +// The ConstructionAPIRouter implementation should parse necessary information from the http request, +// pass the data to a ConstructionAPIServicer to perform the required actions, then write the service results to the http response. type ConstructionAPIRouter interface { ConstructionCombine(http.ResponseWriter, *http.Request) ConstructionDerive(http.ResponseWriter, *http.Request) @@ -67,41 +60,33 @@ type ConstructionAPIRouter interface { ConstructionSubmit(http.ResponseWriter, *http.Request) } -// EventsAPIRouter defines the required methods for binding the api requests to a responses for the -// EventsAPI +// EventsAPIRouter defines the required methods for binding the api requests to a responses for the EventsAPI // The EventsAPIRouter implementation should parse necessary information from the http request, -// pass the data to a EventsAPIServicer to perform the required actions, then write the service -// results to the http response. +// pass the data to a EventsAPIServicer to perform the required actions, then write the service results to the http response. type EventsAPIRouter interface { EventsBlocks(http.ResponseWriter, *http.Request) } -// MempoolAPIRouter defines the required methods for binding the api requests to a responses for the -// MempoolAPI +// MempoolAPIRouter defines the required methods for binding the api requests to a responses for the MempoolAPI // The MempoolAPIRouter implementation should parse necessary information from the http request, -// pass the data to a MempoolAPIServicer to perform the required actions, then write the service -// results to the http response. +// pass the data to a MempoolAPIServicer to perform the required actions, then write the service results to the http response. type MempoolAPIRouter interface { Mempool(http.ResponseWriter, *http.Request) MempoolTransaction(http.ResponseWriter, *http.Request) } -// NetworkAPIRouter defines the required methods for binding the api requests to a responses for the -// NetworkAPI +// NetworkAPIRouter defines the required methods for binding the api requests to a responses for the NetworkAPI // The NetworkAPIRouter implementation should parse necessary information from the http request, -// pass the data to a NetworkAPIServicer to perform the required actions, then write the service -// results to the http response. +// pass the data to a NetworkAPIServicer to perform the required actions, then write the service results to the http response. type NetworkAPIRouter interface { NetworkList(http.ResponseWriter, *http.Request) NetworkOptions(http.ResponseWriter, *http.Request) NetworkStatus(http.ResponseWriter, *http.Request) } -// SearchAPIRouter defines the required methods for binding the api requests to a responses for the -// SearchAPI +// SearchAPIRouter defines the required methods for binding the api requests to a responses for the SearchAPI // The SearchAPIRouter implementation should parse necessary information from the http request, -// pass the data to a SearchAPIServicer to perform the required actions, then write the service -// results to the http response. +// pass the data to a SearchAPIServicer to perform the required actions, then write the service results to the http response. type SearchAPIRouter interface { SearchTransactions(http.ResponseWriter, *http.Request) } @@ -111,14 +96,8 @@ type SearchAPIRouter interface { // while the service implementation can ignored with the .openapi-generator-ignore file // and updated with the logic required for the API. type AccountAPIServicer interface { - AccountBalance( - context.Context, - *types.AccountBalanceRequest, - ) (*types.AccountBalanceResponse, *types.Error) - AccountCoins( - context.Context, - *types.AccountCoinsRequest, - ) (*types.AccountCoinsResponse, *types.Error) + AccountBalance(context.Context, *types.AccountBalanceRequest) (*types.AccountBalanceResponse, *types.Error) + AccountCoins(context.Context, *types.AccountCoinsRequest) (*types.AccountCoinsResponse, *types.Error) } // BlockAPIServicer defines the api actions for the BlockAPI service @@ -127,10 +106,7 @@ type AccountAPIServicer interface { // and updated with the logic required for the API. type BlockAPIServicer interface { Block(context.Context, *types.BlockRequest) (*types.BlockResponse, *types.Error) - BlockTransaction( - context.Context, - *types.BlockTransactionRequest, - ) (*types.BlockTransactionResponse, *types.Error) + BlockTransaction(context.Context, *types.BlockTransactionRequest) (*types.BlockTransactionResponse, *types.Error) } // CallAPIServicer defines the api actions for the CallAPI service @@ -146,38 +122,14 @@ type CallAPIServicer interface { // while the service implementation can ignored with the .openapi-generator-ignore file // and updated with the logic required for the API. type ConstructionAPIServicer interface { - ConstructionCombine( - context.Context, - *types.ConstructionCombineRequest, - ) (*types.ConstructionCombineResponse, *types.Error) - ConstructionDerive( - context.Context, - *types.ConstructionDeriveRequest, - ) (*types.ConstructionDeriveResponse, *types.Error) - ConstructionHash( - context.Context, - *types.ConstructionHashRequest, - ) (*types.TransactionIdentifierResponse, *types.Error) - ConstructionMetadata( - context.Context, - *types.ConstructionMetadataRequest, - ) (*types.ConstructionMetadataResponse, *types.Error) - ConstructionParse( - context.Context, - *types.ConstructionParseRequest, - ) (*types.ConstructionParseResponse, *types.Error) - ConstructionPayloads( - context.Context, - *types.ConstructionPayloadsRequest, - ) (*types.ConstructionPayloadsResponse, *types.Error) - ConstructionPreprocess( - context.Context, - *types.ConstructionPreprocessRequest, - ) (*types.ConstructionPreprocessResponse, *types.Error) - ConstructionSubmit( - context.Context, - *types.ConstructionSubmitRequest, - ) (*types.TransactionIdentifierResponse, *types.Error) + ConstructionCombine(context.Context, *types.ConstructionCombineRequest) (*types.ConstructionCombineResponse, *types.Error) + ConstructionDerive(context.Context, *types.ConstructionDeriveRequest) (*types.ConstructionDeriveResponse, *types.Error) + ConstructionHash(context.Context, *types.ConstructionHashRequest) (*types.TransactionIdentifierResponse, *types.Error) + ConstructionMetadata(context.Context, *types.ConstructionMetadataRequest) (*types.ConstructionMetadataResponse, *types.Error) + ConstructionParse(context.Context, *types.ConstructionParseRequest) (*types.ConstructionParseResponse, *types.Error) + ConstructionPayloads(context.Context, *types.ConstructionPayloadsRequest) (*types.ConstructionPayloadsResponse, *types.Error) + ConstructionPreprocess(context.Context, *types.ConstructionPreprocessRequest) (*types.ConstructionPreprocessResponse, *types.Error) + ConstructionSubmit(context.Context, *types.ConstructionSubmitRequest) (*types.TransactionIdentifierResponse, *types.Error) } // EventsAPIServicer defines the api actions for the EventsAPI service @@ -185,10 +137,7 @@ type ConstructionAPIServicer interface { // while the service implementation can ignored with the .openapi-generator-ignore file // and updated with the logic required for the API. type EventsAPIServicer interface { - EventsBlocks( - context.Context, - *types.EventsBlocksRequest, - ) (*types.EventsBlocksResponse, *types.Error) + EventsBlocks(context.Context, *types.EventsBlocksRequest) (*types.EventsBlocksResponse, *types.Error) } // MempoolAPIServicer defines the api actions for the MempoolAPI service @@ -197,10 +146,7 @@ type EventsAPIServicer interface { // and updated with the logic required for the API. type MempoolAPIServicer interface { Mempool(context.Context, *types.NetworkRequest) (*types.MempoolResponse, *types.Error) - MempoolTransaction( - context.Context, - *types.MempoolTransactionRequest, - ) (*types.MempoolTransactionResponse, *types.Error) + MempoolTransaction(context.Context, *types.MempoolTransactionRequest) (*types.MempoolTransactionResponse, *types.Error) } // NetworkAPIServicer defines the api actions for the NetworkAPI service @@ -209,14 +155,8 @@ type MempoolAPIServicer interface { // and updated with the logic required for the API. type NetworkAPIServicer interface { NetworkList(context.Context, *types.MetadataRequest) (*types.NetworkListResponse, *types.Error) - NetworkOptions( - context.Context, - *types.NetworkRequest, - ) (*types.NetworkOptionsResponse, *types.Error) - NetworkStatus( - context.Context, - *types.NetworkRequest, - ) (*types.NetworkStatusResponse, *types.Error) + NetworkOptions(context.Context, *types.NetworkRequest) (*types.NetworkOptionsResponse, *types.Error) + NetworkStatus(context.Context, *types.NetworkRequest) (*types.NetworkStatusResponse, *types.Error) } // SearchAPIServicer defines the api actions for the SearchAPI service @@ -224,8 +164,5 @@ type NetworkAPIServicer interface { // while the service implementation can ignored with the .openapi-generator-ignore file // and updated with the logic required for the API. type SearchAPIServicer interface { - SearchTransactions( - context.Context, - *types.SearchTransactionsRequest, - ) (*types.SearchTransactionsResponse, *types.Error) + SearchTransactions(context.Context, *types.SearchTransactionsRequest) (*types.SearchTransactionsResponse, *types.Error) } diff --git a/server/api_account.go b/server/api_account.go index af1e881a..bceb6340 100644 --- a/server/api_account.go +++ b/server/api_account.go @@ -25,8 +25,7 @@ import ( "github.com/coinbase/rosetta-sdk-go/types" ) -// A AccountAPIController binds http requests to an api service and writes the service results to -// the http response +// A AccountAPIController binds http requests to an api service and writes the service results to the http response type AccountAPIController struct { service AccountAPIServicer asserter *asserter.Asserter diff --git a/server/api_block.go b/server/api_block.go index 61655a6f..4e4f1fd1 100644 --- a/server/api_block.go +++ b/server/api_block.go @@ -25,8 +25,7 @@ import ( "github.com/coinbase/rosetta-sdk-go/types" ) -// A BlockAPIController binds http requests to an api service and writes the service results to the -// http response +// A BlockAPIController binds http requests to an api service and writes the service results to the http response type BlockAPIController struct { service BlockAPIServicer asserter *asserter.Asserter @@ -111,10 +110,7 @@ func (c *BlockAPIController) BlockTransaction(w http.ResponseWriter, r *http.Req return } - result, serviceErr := c.service.BlockTransaction( - r.Context(), - blockTransactionRequest, - ) + result, serviceErr := c.service.BlockTransaction(r.Context(), blockTransactionRequest) if serviceErr != nil { EncodeJSONResponse(serviceErr, http.StatusInternalServerError, w) diff --git a/server/api_call.go b/server/api_call.go index 20abff66..4a153fb0 100644 --- a/server/api_call.go +++ b/server/api_call.go @@ -25,8 +25,7 @@ import ( "github.com/coinbase/rosetta-sdk-go/types" ) -// A CallAPIController binds http requests to an api service and writes the service results to the -// http response +// A CallAPIController binds http requests to an api service and writes the service results to the http response type CallAPIController struct { service CallAPIServicer asserter *asserter.Asserter diff --git a/server/api_construction.go b/server/api_construction.go index de0e1187..e745adce 100644 --- a/server/api_construction.go +++ b/server/api_construction.go @@ -25,8 +25,7 @@ import ( "github.com/coinbase/rosetta-sdk-go/types" ) -// A ConstructionAPIController binds http requests to an api service and writes the service results -// to the http response +// A ConstructionAPIController binds http requests to an api service and writes the service results to the http response type ConstructionAPIController struct { service ConstructionAPIServicer asserter *asserter.Asserter @@ -117,10 +116,7 @@ func (c *ConstructionAPIController) ConstructionCombine(w http.ResponseWriter, r return } - result, serviceErr := c.service.ConstructionCombine( - r.Context(), - constructionCombineRequest, - ) + result, serviceErr := c.service.ConstructionCombine(r.Context(), constructionCombineRequest) if serviceErr != nil { EncodeJSONResponse(serviceErr, http.StatusInternalServerError, w) @@ -150,10 +146,7 @@ func (c *ConstructionAPIController) ConstructionDerive(w http.ResponseWriter, r return } - result, serviceErr := c.service.ConstructionDerive( - r.Context(), - constructionDeriveRequest, - ) + result, serviceErr := c.service.ConstructionDerive(r.Context(), constructionDeriveRequest) if serviceErr != nil { EncodeJSONResponse(serviceErr, http.StatusInternalServerError, w) @@ -183,10 +176,7 @@ func (c *ConstructionAPIController) ConstructionHash(w http.ResponseWriter, r *h return } - result, serviceErr := c.service.ConstructionHash( - r.Context(), - constructionHashRequest, - ) + result, serviceErr := c.service.ConstructionHash(r.Context(), constructionHashRequest) if serviceErr != nil { EncodeJSONResponse(serviceErr, http.StatusInternalServerError, w) @@ -216,10 +206,7 @@ func (c *ConstructionAPIController) ConstructionMetadata(w http.ResponseWriter, return } - result, serviceErr := c.service.ConstructionMetadata( - r.Context(), - constructionMetadataRequest, - ) + result, serviceErr := c.service.ConstructionMetadata(r.Context(), constructionMetadataRequest) if serviceErr != nil { EncodeJSONResponse(serviceErr, http.StatusInternalServerError, w) @@ -249,10 +236,7 @@ func (c *ConstructionAPIController) ConstructionParse(w http.ResponseWriter, r * return } - result, serviceErr := c.service.ConstructionParse( - r.Context(), - constructionParseRequest, - ) + result, serviceErr := c.service.ConstructionParse(r.Context(), constructionParseRequest) if serviceErr != nil { EncodeJSONResponse(serviceErr, http.StatusInternalServerError, w) @@ -282,10 +266,7 @@ func (c *ConstructionAPIController) ConstructionPayloads(w http.ResponseWriter, return } - result, serviceErr := c.service.ConstructionPayloads( - r.Context(), - constructionPayloadsRequest, - ) + result, serviceErr := c.service.ConstructionPayloads(r.Context(), constructionPayloadsRequest) if serviceErr != nil { EncodeJSONResponse(serviceErr, http.StatusInternalServerError, w) @@ -315,10 +296,7 @@ func (c *ConstructionAPIController) ConstructionPreprocess(w http.ResponseWriter return } - result, serviceErr := c.service.ConstructionPreprocess( - r.Context(), - constructionPreprocessRequest, - ) + result, serviceErr := c.service.ConstructionPreprocess(r.Context(), constructionPreprocessRequest) if serviceErr != nil { EncodeJSONResponse(serviceErr, http.StatusInternalServerError, w) @@ -348,10 +326,7 @@ func (c *ConstructionAPIController) ConstructionSubmit(w http.ResponseWriter, r return } - result, serviceErr := c.service.ConstructionSubmit( - r.Context(), - constructionSubmitRequest, - ) + result, serviceErr := c.service.ConstructionSubmit(r.Context(), constructionSubmitRequest) if serviceErr != nil { EncodeJSONResponse(serviceErr, http.StatusInternalServerError, w) diff --git a/server/api_events.go b/server/api_events.go index 73a1d5d5..d0743e67 100644 --- a/server/api_events.go +++ b/server/api_events.go @@ -25,8 +25,7 @@ import ( "github.com/coinbase/rosetta-sdk-go/types" ) -// A EventsAPIController binds http requests to an api service and writes the service results to the -// http response +// A EventsAPIController binds http requests to an api service and writes the service results to the http response type EventsAPIController struct { service EventsAPIServicer asserter *asserter.Asserter diff --git a/server/api_mempool.go b/server/api_mempool.go index 2100d8cc..1192b5f6 100644 --- a/server/api_mempool.go +++ b/server/api_mempool.go @@ -25,8 +25,7 @@ import ( "github.com/coinbase/rosetta-sdk-go/types" ) -// A MempoolAPIController binds http requests to an api service and writes the service results to -// the http response +// A MempoolAPIController binds http requests to an api service and writes the service results to the http response type MempoolAPIController struct { service MempoolAPIServicer asserter *asserter.Asserter @@ -111,10 +110,7 @@ func (c *MempoolAPIController) MempoolTransaction(w http.ResponseWriter, r *http return } - result, serviceErr := c.service.MempoolTransaction( - r.Context(), - mempoolTransactionRequest, - ) + result, serviceErr := c.service.MempoolTransaction(r.Context(), mempoolTransactionRequest) if serviceErr != nil { EncodeJSONResponse(serviceErr, http.StatusInternalServerError, w) diff --git a/server/api_network.go b/server/api_network.go index 75a8f0c1..5bbed616 100644 --- a/server/api_network.go +++ b/server/api_network.go @@ -25,8 +25,7 @@ import ( "github.com/coinbase/rosetta-sdk-go/types" ) -// A NetworkAPIController binds http requests to an api service and writes the service results to -// the http response +// A NetworkAPIController binds http requests to an api service and writes the service results to the http response type NetworkAPIController struct { service NetworkAPIServicer asserter *asserter.Asserter diff --git a/server/api_search.go b/server/api_search.go index 6fb4ddbc..5c050d2c 100644 --- a/server/api_search.go +++ b/server/api_search.go @@ -25,8 +25,7 @@ import ( "github.com/coinbase/rosetta-sdk-go/types" ) -// A SearchAPIController binds http requests to an api service and writes the service results to the -// http response +// A SearchAPIController binds http requests to an api service and writes the service results to the http response type SearchAPIController struct { service SearchAPIServicer asserter *asserter.Asserter @@ -75,10 +74,7 @@ func (c *SearchAPIController) SearchTransactions(w http.ResponseWriter, r *http. return } - result, serviceErr := c.service.SearchTransactions( - r.Context(), - searchTransactionsRequest, - ) + result, serviceErr := c.service.SearchTransactions(r.Context(), searchTransactionsRequest) if serviceErr != nil { EncodeJSONResponse(serviceErr, http.StatusInternalServerError, w) diff --git a/server/routers.go b/server/routers.go index 27e8b95c..2d2e118b 100644 --- a/server/routers.go +++ b/server/routers.go @@ -49,8 +49,7 @@ type Router interface { func CorsMiddleware(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") - w.Header(). - Set("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept") + w.Header().Set("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept") w.Header().Set("Access-Control-Allow-Methods", "GET, POST,OPTIONS") if r.Method == "OPTIONS" { w.WriteHeader(http.StatusOK) @@ -76,8 +75,7 @@ func NewRouter(routers ...Router) http.Handler { return router } -// EncodeJSONResponse uses the json encoder to write an interface to the http response with an -// optional status code +// EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code func EncodeJSONResponse(i interface{}, status int, w http.ResponseWriter) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") w.WriteHeader(status) diff --git a/types/account_balance_request.go b/types/account_balance_request.go index 5a4451a6..3d60b19f 100644 --- a/types/account_balance_request.go +++ b/types/account_balance_request.go @@ -16,15 +16,11 @@ package types -// AccountBalanceRequest An AccountBalanceRequest is utilized to make a balance request on the -// /account/balance endpoint. If the block_identifier is populated, a historical balance query -// should be performed. +// AccountBalanceRequest An AccountBalanceRequest is utilized to make a balance request on the /account/balance endpoint. If the block_identifier is populated, a historical balance query should be performed. type AccountBalanceRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` AccountIdentifier *AccountIdentifier `json:"account_identifier"` BlockIdentifier *PartialBlockIdentifier `json:"block_identifier,omitempty"` - // In some cases, the caller may not want to retrieve all available balances for an - // AccountIdentifier. If the currencies field is populated, only balances for the specified - // currencies will be returned. If not populated, all available balances will be returned. + // In some cases, the caller may not want to retrieve all available balances for an AccountIdentifier. If the currencies field is populated, only balances for the specified currencies will be returned. If not populated, all available balances will be returned. Currencies []*Currency `json:"currencies,omitempty"` } diff --git a/types/account_balance_response.go b/types/account_balance_response.go index 35dae095..f52e8700 100644 --- a/types/account_balance_response.go +++ b/types/account_balance_response.go @@ -16,16 +16,11 @@ package types -// AccountBalanceResponse An AccountBalanceResponse is returned on the /account/balance endpoint. If -// an account has a balance for each AccountIdentifier describing it (ex: an ERC-20 token balance on -// a few smart contracts), an account balance request must be made with each AccountIdentifier. The -// `coins` field was removed and replaced by by `/account/coins` in `v1.4.7`. +// AccountBalanceResponse An AccountBalanceResponse is returned on the /account/balance endpoint. If an account has a balance for each AccountIdentifier describing it (ex: an ERC-20 token balance on a few smart contracts), an account balance request must be made with each AccountIdentifier. The `coins` field was removed and replaced by by `/account/coins` in `v1.4.7`. type AccountBalanceResponse struct { BlockIdentifier *BlockIdentifier `json:"block_identifier"` // A single account may have a balance in multiple currencies. Balances []*Amount `json:"balances"` - // Account-based blockchains that utilize a nonce or sequence number should include that number - // in the metadata. This number could be unique to the identifier or global across the account - // address. + // Account-based blockchains that utilize a nonce or sequence number should include that number in the metadata. This number could be unique to the identifier or global across the account address. Metadata map[string]interface{} `json:"metadata,omitempty"` } diff --git a/types/account_coins_request.go b/types/account_coins_request.go index c4117fb1..3223d054 100644 --- a/types/account_coins_request.go +++ b/types/account_coins_request.go @@ -16,16 +16,12 @@ package types -// AccountCoinsRequest AccountCoinsRequest is utilized to make a request on the /account/coins -// endpoint. +// AccountCoinsRequest AccountCoinsRequest is utilized to make a request on the /account/coins endpoint. type AccountCoinsRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` AccountIdentifier *AccountIdentifier `json:"account_identifier"` - // Include state from the mempool when looking up an account's unspent coins. Note, using this - // functionality breaks any guarantee of idempotency. + // Include state from the mempool when looking up an account's unspent coins. Note, using this functionality breaks any guarantee of idempotency. IncludeMempool bool `json:"include_mempool"` - // In some cases, the caller may not want to retrieve coins for all currencies for an - // AccountIdentifier. If the currencies field is populated, only coins for the specified - // currencies will be returned. If not populated, all unspent coins will be returned. + // In some cases, the caller may not want to retrieve coins for all currencies for an AccountIdentifier. If the currencies field is populated, only coins for the specified currencies will be returned. If not populated, all unspent coins will be returned. Currencies []*Currency `json:"currencies,omitempty"` } diff --git a/types/account_coins_response.go b/types/account_coins_response.go index 04ab2cc2..3ccb102c 100644 --- a/types/account_coins_response.go +++ b/types/account_coins_response.go @@ -16,17 +16,11 @@ package types -// AccountCoinsResponse AccountCoinsResponse is returned on the /account/coins endpoint and includes -// all unspent Coins owned by an AccountIdentifier. +// AccountCoinsResponse AccountCoinsResponse is returned on the /account/coins endpoint and includes all unspent Coins owned by an AccountIdentifier. type AccountCoinsResponse struct { BlockIdentifier *BlockIdentifier `json:"block_identifier"` - // If a blockchain is UTXO-based, all unspent Coins owned by an account_identifier should be - // returned alongside the balance. It is highly recommended to populate this field so that users - // of the Rosetta API implementation don't need to maintain their own indexer to track their - // UTXOs. + // If a blockchain is UTXO-based, all unspent Coins owned by an account_identifier should be returned alongside the balance. It is highly recommended to populate this field so that users of the Rosetta API implementation don't need to maintain their own indexer to track their UTXOs. Coins []*Coin `json:"coins"` - // Account-based blockchains that utilize a nonce or sequence number should include that number - // in the metadata. This number could be unique to the identifier or global across the account - // address. + // Account-based blockchains that utilize a nonce or sequence number should include that number in the metadata. This number could be unique to the identifier or global across the account address. Metadata map[string]interface{} `json:"metadata,omitempty"` } diff --git a/types/account_identifier.go b/types/account_identifier.go index 67bb2a2c..e63d6c38 100644 --- a/types/account_identifier.go +++ b/types/account_identifier.go @@ -16,15 +16,11 @@ package types -// AccountIdentifier The account_identifier uniquely identifies an account within a network. All -// fields in the account_identifier are utilized to determine this uniqueness (including the -// metadata field, if populated). +// AccountIdentifier The account_identifier uniquely identifies an account within a network. All fields in the account_identifier are utilized to determine this uniqueness (including the metadata field, if populated). type AccountIdentifier struct { - // The address may be a cryptographic public key (or some encoding of it) or a provided - // username. + // The address may be a cryptographic public key (or some encoding of it) or a provided username. Address string `json:"address"` SubAccount *SubAccountIdentifier `json:"sub_account,omitempty"` - // Blockchains that utilize a username model (where the address is not a derivative of a - // cryptographic public key) should specify the public key(s) owned by the address in metadata. + // Blockchains that utilize a username model (where the address is not a derivative of a cryptographic public key) should specify the public key(s) owned by the address in metadata. Metadata map[string]interface{} `json:"metadata,omitempty"` } diff --git a/types/allow.go b/types/allow.go index ecac150a..924b995a 100644 --- a/types/allow.go +++ b/types/allow.go @@ -16,41 +16,23 @@ package types -// Allow Allow specifies supported Operation status, Operation types, and all possible error -// statuses. This Allow object is used by clients to validate the correctness of a Rosetta Server -// implementation. It is expected that these clients will error if they receive some response that -// contains any of the above information that is not specified here. +// Allow Allow specifies supported Operation status, Operation types, and all possible error statuses. This Allow object is used by clients to validate the correctness of a Rosetta Server implementation. It is expected that these clients will error if they receive some response that contains any of the above information that is not specified here. type Allow struct { - // All Operation.Status this implementation supports. Any status that is returned during parsing - // that is not listed here will cause client validation to error. + // All Operation.Status this implementation supports. Any status that is returned during parsing that is not listed here will cause client validation to error. OperationStatuses []*OperationStatus `json:"operation_statuses"` - // All Operation.Type this implementation supports. Any type that is returned during parsing - // that is not listed here will cause client validation to error. + // All Operation.Type this implementation supports. Any type that is returned during parsing that is not listed here will cause client validation to error. OperationTypes []string `json:"operation_types"` - // All Errors that this implementation could return. Any error that is returned during parsing - // that is not listed here will cause client validation to error. + // All Errors that this implementation could return. Any error that is returned during parsing that is not listed here will cause client validation to error. Errors []*Error `json:"errors"` - // Any Rosetta implementation that supports querying the balance of an account at any height in - // the past should set this to true. + // Any Rosetta implementation that supports querying the balance of an account at any height in the past should set this to true. HistoricalBalanceLookup bool `json:"historical_balance_lookup"` - // If populated, `timestamp_start_index` indicates the first block index where block timestamps - // are considered valid (i.e. all blocks less than `timestamp_start_index` could have invalid - // timestamps). This is useful when the genesis block (or blocks) of a network have timestamp 0. - // If not populated, block timestamps are assumed to be valid for all available blocks. + // If populated, `timestamp_start_index` indicates the first block index where block timestamps are considered valid (i.e. all blocks less than `timestamp_start_index` could have invalid timestamps). This is useful when the genesis block (or blocks) of a network have timestamp 0. If not populated, block timestamps are assumed to be valid for all available blocks. TimestampStartIndex *int64 `json:"timestamp_start_index,omitempty"` - // All methods that are supported by the /call endpoint. Communicating which parameters should - // be provided to /call is the responsibility of the implementer (this is en lieu of defining an - // entire type system and requiring the implementer to define that in Allow). + // All methods that are supported by the /call endpoint. Communicating which parameters should be provided to /call is the responsibility of the implementer (this is en lieu of defining an entire type system and requiring the implementer to define that in Allow). CallMethods []string `json:"call_methods"` - // BalanceExemptions is an array of BalanceExemption indicating which account balances could - // change without a corresponding Operation. BalanceExemptions should be used sparingly as they - // may introduce significant complexity for integrators that attempt to reconcile all account - // balance changes. If your implementation relies on any BalanceExemptions, you MUST implement - // historical balance lookup (the ability to query an account balance at any BlockIdentifier). + // BalanceExemptions is an array of BalanceExemption indicating which account balances could change without a corresponding Operation. BalanceExemptions should be used sparingly as they may introduce significant complexity for integrators that attempt to reconcile all account balance changes. If your implementation relies on any BalanceExemptions, you MUST implement historical balance lookup (the ability to query an account balance at any BlockIdentifier). BalanceExemptions []*BalanceExemption `json:"balance_exemptions"` - // 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. + // 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"` BlockHashCase Case `json:"block_hash_case,omitempty"` TransactionHashCase Case `json:"transaction_hash_case,omitempty"` diff --git a/types/amount.go b/types/amount.go index 6bf4dc40..65040ada 100644 --- a/types/amount.go +++ b/types/amount.go @@ -16,11 +16,9 @@ package types -// Amount Amount is some Value of a Currency. It is considered invalid to specify a Value without a -// Currency. +// Amount Amount is some Value of a Currency. It is considered invalid to specify a Value without a Currency. type Amount struct { - // Value of the transaction in atomic units represented as an arbitrary-sized signed integer. - // For example, 1 BTC would be represented by a value of 100000000. + // Value of the transaction in atomic units represented as an arbitrary-sized signed integer. For example, 1 BTC would be represented by a value of 100000000. Value string `json:"value"` Currency *Currency `json:"currency"` Metadata map[string]interface{} `json:"metadata,omitempty"` diff --git a/types/balance_exemption.go b/types/balance_exemption.go index 2383bb4f..c1279e80 100644 --- a/types/balance_exemption.go +++ b/types/balance_exemption.go @@ -16,18 +16,9 @@ package types -// BalanceExemption BalanceExemption indicates that the balance for an exempt account could change -// without a corresponding Operation. This typically occurs with staking rewards, vesting balances, -// and Currencies with a dynamic supply. Currently, it is possible to exempt an account from strict -// reconciliation by SubAccountIdentifier.Address or by Currency. This means that any account with -// SubAccountIdentifier.Address would be exempt or any balance of a particular Currency would be -// exempt, respectively. BalanceExemptions should be used sparingly as they may introduce -// significant complexity for integrators that attempt to reconcile all account balance changes. If -// your implementation relies on any BalanceExemptions, you MUST implement historical balance lookup -// (the ability to query an account balance at any BlockIdentifier). +// BalanceExemption BalanceExemption indicates that the balance for an exempt account could change without a corresponding Operation. This typically occurs with staking rewards, vesting balances, and Currencies with a dynamic supply. Currently, it is possible to exempt an account from strict reconciliation by SubAccountIdentifier.Address or by Currency. This means that any account with SubAccountIdentifier.Address would be exempt or any balance of a particular Currency would be exempt, respectively. BalanceExemptions should be used sparingly as they may introduce significant complexity for integrators that attempt to reconcile all account balance changes. If your implementation relies on any BalanceExemptions, you MUST implement historical balance lookup (the ability to query an account balance at any BlockIdentifier). type BalanceExemption struct { - // SubAccountAddress is the SubAccountIdentifier.Address that the BalanceExemption applies to - // (regardless of the value of SubAccountIdentifier.Metadata). + // SubAccountAddress is the SubAccountIdentifier.Address that the BalanceExemption applies to (regardless of the value of SubAccountIdentifier.Metadata). SubAccountAddress *string `json:"sub_account_address,omitempty"` Currency *Currency `json:"currency,omitempty"` ExemptionType ExemptionType `json:"exemption_type,omitempty"` diff --git a/types/block.go b/types/block.go index 6dc3465d..d8b89715 100644 --- a/types/block.go +++ b/types/block.go @@ -16,16 +16,11 @@ package types -// Block Blocks contain an array of Transactions that occurred at a particular BlockIdentifier. A -// hard requirement for blocks returned by Rosetta implementations is that they MUST be -// _inalterable_: once a client has requested and received a block identified by a specific -// BlockIndentifier, all future calls for that same BlockIdentifier must return the same block -// contents. +// Block Blocks contain an array of Transactions that occurred at a particular BlockIdentifier. A hard requirement for blocks returned by Rosetta implementations is that they MUST be _inalterable_: once a client has requested and received a block identified by a specific BlockIndentifier, all future calls for that same BlockIdentifier must return the same block contents. type Block struct { BlockIdentifier *BlockIdentifier `json:"block_identifier"` ParentBlockIdentifier *BlockIdentifier `json:"parent_block_identifier"` - // The timestamp of the block in milliseconds since the Unix Epoch. The timestamp is stored in - // milliseconds because some blockchains produce blocks more often than once a second. + // The timestamp of the block in milliseconds since the Unix Epoch. The timestamp is stored in milliseconds because some blockchains produce blocks more often than once a second. Timestamp int64 `json:"timestamp"` Transactions []*Transaction `json:"transactions"` Metadata map[string]interface{} `json:"metadata,omitempty"` diff --git a/types/block_event.go b/types/block_event.go index d543838e..e3a5a83e 100644 --- a/types/block_event.go +++ b/types/block_event.go @@ -16,9 +16,7 @@ package types -// BlockEvent BlockEvent represents the addition or removal of a BlockIdentifier from storage. -// Streaming BlockEvents allows lightweight clients to update their own state without needing to -// implement their own syncing logic. +// BlockEvent BlockEvent represents the addition or removal of a BlockIdentifier from storage. Streaming BlockEvents allows lightweight clients to update their own state without needing to implement their own syncing logic. type BlockEvent struct { // sequence is the unique identifier of a BlockEvent within the context of a NetworkIdentifier. Sequence int64 `json:"sequence"` diff --git a/types/block_event_type.go b/types/block_event_type.go index 9e5cac72..3e4cf76f 100644 --- a/types/block_event_type.go +++ b/types/block_event_type.go @@ -16,8 +16,7 @@ package types -// BlockEventType BlockEventType determines if a BlockEvent represents the addition or removal of a -// block. +// BlockEventType BlockEventType determines if a BlockEvent represents the addition or removal of a block. type BlockEventType string // List of BlockEventType diff --git a/types/block_identifier.go b/types/block_identifier.go index 8d56526d..8cfdf0a6 100644 --- a/types/block_identifier.go +++ b/types/block_identifier.go @@ -20,7 +20,6 @@ package types type BlockIdentifier struct { // This is also known as the block height. Index int64 `json:"index"` - // This should be normalized according to the case specified in the block_hash_case network - // options. + // This should be normalized according to the case specified in the block_hash_case network options. Hash string `json:"hash"` } diff --git a/types/block_response.go b/types/block_response.go index c5a6abdd..b7055c58 100644 --- a/types/block_response.go +++ b/types/block_response.go @@ -16,18 +16,9 @@ package types -// BlockResponse A BlockResponse includes a fully-populated block or a partially-populated block -// with a list of other transactions to fetch (other_transactions). As a result of the consensus -// algorithm of some blockchains, blocks can be omitted (i.e. certain block indices can be skipped). -// If a query for one of these omitted indices is made, the response should not include a `Block` -// object. It is VERY important to note that blocks MUST still form a canonical, connected chain of -// blocks where each block has a unique index. In other words, the `PartialBlockIdentifier` of a -// block after an omitted block should reference the last non-omitted block. +// BlockResponse A BlockResponse includes a fully-populated block or a partially-populated block with a list of other transactions to fetch (other_transactions). As a result of the consensus algorithm of some blockchains, blocks can be omitted (i.e. certain block indices can be skipped). If a query for one of these omitted indices is made, the response should not include a `Block` object. It is VERY important to note that blocks MUST still form a canonical, connected chain of blocks where each block has a unique index. In other words, the `PartialBlockIdentifier` of a block after an omitted block should reference the last non-omitted block. type BlockResponse struct { Block *Block `json:"block,omitempty"` - // Some blockchains may require additional transactions to be fetched that weren't returned in - // the block response (ex: block only returns transaction hashes). For blockchains with a lot of - // transactions in each block, this can be very useful as consumers can concurrently fetch all - // transactions returned. + // Some blockchains may require additional transactions to be fetched that weren't returned in the block response (ex: block only returns transaction hashes). For blockchains with a lot of transactions in each block, this can be very useful as consumers can concurrently fetch all transactions returned. OtherTransactions []*TransactionIdentifier `json:"other_transactions,omitempty"` } diff --git a/types/block_transaction.go b/types/block_transaction.go index 71b54e1f..49bb1cd8 100644 --- a/types/block_transaction.go +++ b/types/block_transaction.go @@ -16,8 +16,7 @@ package types -// BlockTransaction BlockTransaction contains a populated Transaction and the BlockIdentifier that -// contains it. +// BlockTransaction BlockTransaction contains a populated Transaction and the BlockIdentifier that contains it. type BlockTransaction struct { BlockIdentifier *BlockIdentifier `json:"block_identifier"` Transaction *Transaction `json:"transaction"` diff --git a/types/block_transaction_request.go b/types/block_transaction_request.go index d81f90bf..d3ea3b0f 100644 --- a/types/block_transaction_request.go +++ b/types/block_transaction_request.go @@ -16,8 +16,7 @@ package types -// BlockTransactionRequest A BlockTransactionRequest is used to fetch a Transaction included in a -// block that is not returned in a BlockResponse. +// BlockTransactionRequest A BlockTransactionRequest is used to fetch a Transaction included in a block that is not returned in a BlockResponse. type BlockTransactionRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` BlockIdentifier *BlockIdentifier `json:"block_identifier"` diff --git a/types/block_transaction_response.go b/types/block_transaction_response.go index de26b601..e5c0427f 100644 --- a/types/block_transaction_response.go +++ b/types/block_transaction_response.go @@ -16,8 +16,7 @@ package types -// BlockTransactionResponse A BlockTransactionResponse contains information about a block -// transaction. +// BlockTransactionResponse A BlockTransactionResponse contains information about a block transaction. type BlockTransactionResponse struct { Transaction *Transaction `json:"transaction"` } diff --git a/types/call_request.go b/types/call_request.go index eefdce10..afffab08 100644 --- a/types/call_request.go +++ b/types/call_request.go @@ -19,12 +19,8 @@ package types // CallRequest CallRequest is the input to the `/call` endpoint. type CallRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` - // Method is some network-specific procedure call. This method could map to a network-specific - // RPC endpoint, a method in an SDK generated from a smart contract, or some hybrid of the two. - // The implementation must define all available methods in the Allow object. However, it is up - // to the caller to determine which parameters to provide when invoking `/call`. + // Method is some network-specific procedure call. This method could map to a network-specific RPC endpoint, a method in an SDK generated from a smart contract, or some hybrid of the two. The implementation must define all available methods in the Allow object. However, it is up to the caller to determine which parameters to provide when invoking `/call`. Method string `json:"method"` - // Parameters is some network-specific argument for a method. It is up to the caller to - // determine which parameters to provide when invoking `/call`. + // Parameters is some network-specific argument for a method. It is up to the caller to determine which parameters to provide when invoking `/call`. Parameters map[string]interface{} `json:"parameters"` } diff --git a/types/call_response.go b/types/call_response.go index aaaa857e..93272983 100644 --- a/types/call_response.go +++ b/types/call_response.go @@ -18,13 +18,8 @@ package types // CallResponse CallResponse contains the result of a `/call` invocation. type CallResponse struct { - // Result contains the result of the `/call` invocation. This result will not be inspected or - // interpreted by Rosetta tooling and is left to the caller to decode. + // Result contains the result of the `/call` invocation. This result will not be inspected or interpreted by Rosetta tooling and is left to the caller to decode. Result map[string]interface{} `json:"result"` - // Idempotent indicates that if `/call` is invoked with the same CallRequest again, at any point - // in time, it will return the same CallResponse. Integrators may cache the CallResponse if this - // is set to true to avoid making unnecessary calls to the Rosetta implementation. For this - // reason, implementers should be very conservative about returning true here or they could - // cause issues for the caller. + // Idempotent indicates that if `/call` is invoked with the same CallRequest again, at any point in time, it will return the same CallResponse. Integrators may cache the CallResponse if this is set to true to avoid making unnecessary calls to the Rosetta implementation. For this reason, implementers should be very conservative about returning true here or they could cause issues for the caller. Idempotent bool `json:"idempotent"` } diff --git a/types/coin_action.go b/types/coin_action.go index 7d0df80b..b4ce759d 100644 --- a/types/coin_action.go +++ b/types/coin_action.go @@ -16,9 +16,7 @@ package types -// CoinAction CoinActions are different state changes that a Coin can undergo. When a Coin is -// created, it is coin_created. When a Coin is spent, it is coin_spent. It is assumed that a single -// Coin cannot be created or spent more than once. +// CoinAction CoinActions are different state changes that a Coin can undergo. When a Coin is created, it is coin_created. When a Coin is spent, it is coin_spent. It is assumed that a single Coin cannot be created or spent more than once. type CoinAction string // List of CoinAction diff --git a/types/coin_change.go b/types/coin_change.go index 5c5c0dc5..b84b8a05 100644 --- a/types/coin_change.go +++ b/types/coin_change.go @@ -16,11 +16,7 @@ package types -// CoinChange CoinChange is used to represent a change in state of a some coin identified by a -// coin_identifier. This object is part of the Operation model and must be populated for UTXO-based -// blockchains. Coincidentally, this abstraction of UTXOs allows for supporting both account-based -// transfers and UTXO-based transfers on the same blockchain (when a transfer is account-based, -// don't populate this model). +// CoinChange CoinChange is used to represent a change in state of a some coin identified by a coin_identifier. This object is part of the Operation model and must be populated for UTXO-based blockchains. Coincidentally, this abstraction of UTXOs allows for supporting both account-based transfers and UTXO-based transfers on the same blockchain (when a transfer is account-based, don't populate this model). type CoinChange struct { CoinIdentifier *CoinIdentifier `json:"coin_identifier"` CoinAction CoinAction `json:"coin_action"` diff --git a/types/coin_identifier.go b/types/coin_identifier.go index e971fb6e..e50323cf 100644 --- a/types/coin_identifier.go +++ b/types/coin_identifier.go @@ -18,7 +18,6 @@ package types // CoinIdentifier CoinIdentifier uniquely identifies a Coin. type CoinIdentifier struct { - // Identifier should be populated with a globally unique identifier of a Coin. In Bitcoin, this - // identifier would be transaction_hash:index. + // Identifier should be populated with a globally unique identifier of a Coin. In Bitcoin, this identifier would be transaction_hash:index. Identifier string `json:"identifier"` } diff --git a/types/construction_combine_request.go b/types/construction_combine_request.go index d0dd51b3..1a96c547 100644 --- a/types/construction_combine_request.go +++ b/types/construction_combine_request.go @@ -16,9 +16,7 @@ package types -// ConstructionCombineRequest ConstructionCombineRequest is the input to the `/construction/combine` -// endpoint. It contains the unsigned transaction blob returned by `/construction/payloads` and all -// required signatures to create a network transaction. +// ConstructionCombineRequest ConstructionCombineRequest is the input to the `/construction/combine` endpoint. It contains the unsigned transaction blob returned by `/construction/payloads` and all required signatures to create a network transaction. type ConstructionCombineRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` UnsignedTransaction string `json:"unsigned_transaction"` diff --git a/types/construction_combine_response.go b/types/construction_combine_response.go index 0fe4f4b2..cdd02fe2 100644 --- a/types/construction_combine_response.go +++ b/types/construction_combine_response.go @@ -16,8 +16,7 @@ package types -// ConstructionCombineResponse ConstructionCombineResponse is returned by `/construction/combine`. -// The network payload will be sent directly to the `construction/submit` endpoint. +// ConstructionCombineResponse ConstructionCombineResponse is returned by `/construction/combine`. The network payload will be sent directly to the `construction/submit` endpoint. type ConstructionCombineResponse struct { SignedTransaction string `json:"signed_transaction"` } diff --git a/types/construction_derive_request.go b/types/construction_derive_request.go index 3b077e29..60fc2e83 100644 --- a/types/construction_derive_request.go +++ b/types/construction_derive_request.go @@ -16,10 +16,7 @@ package types -// ConstructionDeriveRequest ConstructionDeriveRequest is passed to the `/construction/derive` -// endpoint. Network is provided in the request because some blockchains have different address -// formats for different networks. Metadata is provided in the request because some blockchains -// allow for multiple address types (i.e. different address for validators vs normal accounts). +// ConstructionDeriveRequest ConstructionDeriveRequest is passed to the `/construction/derive` endpoint. Network is provided in the request because some blockchains have different address formats for different networks. Metadata is provided in the request because some blockchains allow for multiple address types (i.e. different address for validators vs normal accounts). type ConstructionDeriveRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` PublicKey *PublicKey `json:"public_key"` diff --git a/types/construction_hash_request.go b/types/construction_hash_request.go index 2d15a4c2..bda93eea 100644 --- a/types/construction_hash_request.go +++ b/types/construction_hash_request.go @@ -16,8 +16,7 @@ package types -// ConstructionHashRequest ConstructionHashRequest is the input to the `/construction/hash` -// endpoint. +// ConstructionHashRequest ConstructionHashRequest is the input to the `/construction/hash` endpoint. type ConstructionHashRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` SignedTransaction string `json:"signed_transaction"` diff --git a/types/construction_metadata_request.go b/types/construction_metadata_request.go index e029be02..dad291bc 100644 --- a/types/construction_metadata_request.go +++ b/types/construction_metadata_request.go @@ -16,19 +16,10 @@ package types -// ConstructionMetadataRequest A ConstructionMetadataRequest is utilized to get information required -// to construct a transaction. The Options object used to specify which metadata to return is left -// purposely unstructured to allow flexibility for implementers. Options is not required in the case -// that there is network-wide metadata of interest. Optionally, the request can also include an -// array of PublicKeys associated with the AccountIdentifiers returned in -// ConstructionPreprocessResponse. +// ConstructionMetadataRequest A ConstructionMetadataRequest is utilized to get information required to construct a transaction. The Options object used to specify which metadata to return is left purposely unstructured to allow flexibility for implementers. Options is not required in the case that there is network-wide metadata of interest. Optionally, the request can also include an array of PublicKeys associated with the AccountIdentifiers returned in ConstructionPreprocessResponse. type ConstructionMetadataRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` - // Some blockchains require different metadata for different types of transaction construction - // (ex: delegation versus a transfer). Instead of requiring a blockchain node to return all - // possible types of metadata for construction (which may require multiple node fetches), the - // client can populate an options object to limit the metadata returned to only the subset - // required. + // Some blockchains require different metadata for different types of transaction construction (ex: delegation versus a transfer). Instead of requiring a blockchain node to return all possible types of metadata for construction (which may require multiple node fetches), the client can populate an options object to limit the metadata returned to only the subset required. Options map[string]interface{} `json:"options,omitempty"` PublicKeys []*PublicKey `json:"public_keys,omitempty"` } diff --git a/types/construction_metadata_response.go b/types/construction_metadata_response.go index 4823bc40..cd6d30f8 100644 --- a/types/construction_metadata_response.go +++ b/types/construction_metadata_response.go @@ -16,11 +16,7 @@ package types -// ConstructionMetadataResponse The ConstructionMetadataResponse returns network-specific metadata -// used for transaction construction. Optionally, the implementer can return the suggested fee -// associated with the transaction being constructed. The caller may use this info to adjust the -// intent of the transaction or to create a transaction with a different account that can pay the -// suggested fee. Suggested fee is an array in case fee payment must occur in multiple currencies. +// ConstructionMetadataResponse The ConstructionMetadataResponse returns network-specific metadata used for transaction construction. Optionally, the implementer can return the suggested fee associated with the transaction being constructed. The caller may use this info to adjust the intent of the transaction or to create a transaction with a different account that can pay the suggested fee. Suggested fee is an array in case fee payment must occur in multiple currencies. type ConstructionMetadataResponse struct { Metadata map[string]interface{} `json:"metadata"` SuggestedFee []*Amount `json:"suggested_fee,omitempty"` diff --git a/types/construction_parse_request.go b/types/construction_parse_request.go index aa5d3b07..fb315c5d 100644 --- a/types/construction_parse_request.go +++ b/types/construction_parse_request.go @@ -16,13 +16,11 @@ package types -// ConstructionParseRequest ConstructionParseRequest is the input to the `/construction/parse` -// endpoint. It allows the caller to parse either an unsigned or signed transaction. +// ConstructionParseRequest ConstructionParseRequest is the input to the `/construction/parse` endpoint. It allows the caller to parse either an unsigned or signed transaction. type ConstructionParseRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` // Signed is a boolean indicating whether the transaction is signed. Signed bool `json:"signed"` - // This must be either the unsigned transaction blob returned by `/construction/payloads` or the - // signed transaction blob returned by `/construction/combine`. + // This must be either the unsigned transaction blob returned by `/construction/payloads` or the signed transaction blob returned by `/construction/combine`. Transaction string `json:"transaction"` } diff --git a/types/construction_payloads_request.go b/types/construction_payloads_request.go index 111e7211..e156fe32 100644 --- a/types/construction_payloads_request.go +++ b/types/construction_payloads_request.go @@ -16,11 +16,7 @@ package types -// ConstructionPayloadsRequest ConstructionPayloadsRequest is the request to -// `/construction/payloads`. It contains the network, a slice of operations, and arbitrary metadata -// that was returned by the call to `/construction/metadata`. Optionally, the request can also -// include an array of PublicKeys associated with the AccountIdentifiers returned in -// ConstructionPreprocessResponse. +// ConstructionPayloadsRequest ConstructionPayloadsRequest is the request to `/construction/payloads`. It contains the network, a slice of operations, and arbitrary metadata that was returned by the call to `/construction/metadata`. Optionally, the request can also include an array of PublicKeys associated with the AccountIdentifiers returned in ConstructionPreprocessResponse. type ConstructionPayloadsRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` Operations []*Operation `json:"operations"` diff --git a/types/construction_payloads_response.go b/types/construction_payloads_response.go index 780aff81..c45f6f9f 100644 --- a/types/construction_payloads_response.go +++ b/types/construction_payloads_response.go @@ -16,10 +16,7 @@ package types -// ConstructionPayloadsResponse ConstructionTransactionResponse is returned by -// `/construction/payloads`. It contains an unsigned transaction blob (that is usually needed to -// construct the a network transaction from a collection of signatures) and an array of payloads -// that must be signed by the caller. +// ConstructionPayloadsResponse ConstructionTransactionResponse is returned by `/construction/payloads`. It contains an unsigned transaction blob (that is usually needed to construct the a network transaction from a collection of signatures) and an array of payloads that must be signed by the caller. type ConstructionPayloadsResponse struct { UnsignedTransaction string `json:"unsigned_transaction"` Payloads []*SigningPayload `json:"payloads"` diff --git a/types/construction_preprocess_request.go b/types/construction_preprocess_request.go index 970fbba5..cc568535 100644 --- a/types/construction_preprocess_request.go +++ b/types/construction_preprocess_request.go @@ -16,19 +16,7 @@ package types -// ConstructionPreprocessRequest ConstructionPreprocessRequest is passed to the -// `/construction/preprocess` endpoint so that a Rosetta implementation can determine which metadata -// it needs to request for construction. Metadata provided in this object should NEVER be a product -// of live data (i.e. the caller must follow some network-specific data fetching strategy outside of -// the Construction API to populate required Metadata). If live data is required for construction, -// it MUST be fetched in the call to `/construction/metadata`. The caller can provide a max fee they -// are willing to pay for a transaction. This is an array in the case fees must be paid in multiple -// currencies. The caller can also provide a suggested fee multiplier to indicate that the suggested -// fee should be scaled. This may be used to set higher fees for urgent transactions or to pay lower -// fees when there is less urgency. It is assumed that providing a very low multiplier (like 0.0001) -// will never lead to a transaction being created with a fee less than the minimum network fee (if -// applicable). In the case that the caller provides both a max fee and a suggested fee multiplier, -// the max fee will set an upper bound on the suggested fee (regardless of the multiplier provided). +// ConstructionPreprocessRequest ConstructionPreprocessRequest is passed to the `/construction/preprocess` endpoint so that a Rosetta implementation can determine which metadata it needs to request for construction. Metadata provided in this object should NEVER be a product of live data (i.e. the caller must follow some network-specific data fetching strategy outside of the Construction API to populate required Metadata). If live data is required for construction, it MUST be fetched in the call to `/construction/metadata`. The caller can provide a max fee they are willing to pay for a transaction. This is an array in the case fees must be paid in multiple currencies. The caller can also provide a suggested fee multiplier to indicate that the suggested fee should be scaled. This may be used to set higher fees for urgent transactions or to pay lower fees when there is less urgency. It is assumed that providing a very low multiplier (like 0.0001) will never lead to a transaction being created with a fee less than the minimum network fee (if applicable). In the case that the caller provides both a max fee and a suggested fee multiplier, the max fee will set an upper bound on the suggested fee (regardless of the multiplier provided). type ConstructionPreprocessRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` Operations []*Operation `json:"operations"` diff --git a/types/construction_preprocess_response.go b/types/construction_preprocess_response.go index b8ee4095..49062f08 100644 --- a/types/construction_preprocess_response.go +++ b/types/construction_preprocess_response.go @@ -16,13 +16,7 @@ package types -// ConstructionPreprocessResponse ConstructionPreprocessResponse contains `options` that will be -// sent unmodified to `/construction/metadata`. If it is not necessary to make a request to -// `/construction/metadata`, `options` should be omitted. Some blockchains require the PublicKey of -// particular AccountIdentifiers to construct a valid transaction. To fetch these PublicKeys, -// populate `required_public_keys` with the AccountIdentifiers associated with the desired -// PublicKeys. If it is not necessary to retrieve any PublicKeys for construction, -// `required_public_keys` should be omitted. +// ConstructionPreprocessResponse ConstructionPreprocessResponse contains `options` that will be sent unmodified to `/construction/metadata`. If it is not necessary to make a request to `/construction/metadata`, `options` should be omitted. Some blockchains require the PublicKey of particular AccountIdentifiers to construct a valid transaction. To fetch these PublicKeys, populate `required_public_keys` with the AccountIdentifiers associated with the desired PublicKeys. If it is not necessary to retrieve any PublicKeys for construction, `required_public_keys` should be omitted. type ConstructionPreprocessResponse struct { // The options that will be sent directly to `/construction/metadata` by the caller. Options map[string]interface{} `json:"options,omitempty"` diff --git a/types/currency.go b/types/currency.go index 2a8ae80f..289bfe7a 100644 --- a/types/currency.go +++ b/types/currency.go @@ -16,16 +16,12 @@ package types -// Currency Currency is composed of a canonical Symbol and Decimals. This Decimals value is used to -// convert an Amount.Value from atomic units (Satoshis) to standard units (Bitcoins). +// Currency Currency is composed of a canonical Symbol and Decimals. This Decimals value is used to convert an Amount.Value from atomic units (Satoshis) to standard units (Bitcoins). type Currency struct { // Canonical symbol associated with a currency. Symbol string `json:"symbol"` - // Number of decimal places in the standard unit representation of the amount. For example, BTC - // has 8 decimals. Note that it is not possible to represent the value of some currency in - // atomic units that is not base 10. + // Number of decimal places in the standard unit representation of the amount. For example, BTC has 8 decimals. Note that it is not possible to represent the value of some currency in atomic units that is not base 10. Decimals int32 `json:"decimals"` - // Any additional information related to the currency itself. For example, it would be useful to - // populate this object with the contract address of an ERC-20 token. + // Any additional information related to the currency itself. For example, it would be useful to populate this object with the contract address of an ERC-20 token. Metadata map[string]interface{} `json:"metadata,omitempty"` } diff --git a/types/curve_type.go b/types/curve_type.go index 10682ec8..7c8c285e 100644 --- a/types/curve_type.go +++ b/types/curve_type.go @@ -16,13 +16,7 @@ package types -// CurveType CurveType is the type of cryptographic curve associated with a PublicKey. * secp256k1: -// SEC compressed - `33 bytes` (https://secg.org/sec1-v2.pdf#subsubsection.2.3.3) * secp256r1: SEC -// compressed - `33 bytes` (https://secg.org/sec1-v2.pdf#subsubsection.2.3.3) * edwards25519: `y -// (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) +// CurveType CurveType is the type of cryptographic curve associated with a PublicKey. * secp256k1: SEC compressed - `33 bytes` (https://secg.org/sec1-v2.pdf#subsubsection.2.3.3) * secp256r1: SEC compressed - `33 bytes` (https://secg.org/sec1-v2.pdf#subsubsection.2.3.3) * edwards25519: `y (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 diff --git a/types/direction.go b/types/direction.go index cede3831..122d4782 100644 --- a/types/direction.go +++ b/types/direction.go @@ -16,10 +16,7 @@ package types -// Direction Used by RelatedTransaction to indicate the direction of the relation (i.e. -// cross-shard/cross-network sends may reference `backward` to an earlier transaction and async -// execution may reference `forward`). Can be used to indicate if a transaction relation is from -// child to parent or the reverse. +// Direction Used by RelatedTransaction to indicate the direction of the relation (i.e. cross-shard/cross-network sends may reference `backward` to an earlier transaction and async execution may reference `forward`). Can be used to indicate if a transaction relation is from child to parent or the reverse. type Direction string // List of Direction diff --git a/types/error.go b/types/error.go index 1229d7db..55478fbf 100644 --- a/types/error.go +++ b/types/error.go @@ -16,31 +16,16 @@ package types -// Error Instead of utilizing HTTP status codes to describe node errors (which often do not have a -// good analog), rich errors are returned using this object. Both the code and message fields can be -// individually used to correctly identify an error. Implementations MUST use unique values for both -// fields. +// Error Instead of utilizing HTTP status codes to describe node errors (which often do not have a good analog), rich errors are returned using this object. Both the code and message fields can be individually used to correctly identify an error. Implementations MUST use unique values for both fields. type Error struct { - // Code is a network-specific error code. If desired, this code can be equivalent to an HTTP - // status code. + // Code is a network-specific error code. If desired, this code can be equivalent to an HTTP status code. Code int32 `json:"code"` - // Message is a network-specific error message. The message MUST NOT change for a given code. In - // particular, this means that any contextual information should be included in the details - // field. + // Message is a network-specific error message. The message MUST NOT change for a given code. In particular, this means that any contextual information should be included in the details field. Message string `json:"message"` - // Description allows the implementer to optionally provide additional information about an - // error. In many cases, the content of this field will be a copy-and-paste from existing - // developer documentation. Description can ONLY be populated with generic information about a - // particular type of error. It MUST NOT be populated with information about a particular - // instantiation of an error (use `details` for this). Whereas the content of Error.Message - // should stay stable across releases, the content of Error.Description will likely change - // across releases (as implementers improve error documentation). For this reason, the content - // in this field is not part of any type assertion (unlike Error.Message). + // Description allows the implementer to optionally provide additional information about an error. In many cases, the content of this field will be a copy-and-paste from existing developer documentation. Description can ONLY be populated with generic information about a particular type of error. It MUST NOT be populated with information about a particular instantiation of an error (use `details` for this). Whereas the content of Error.Message should stay stable across releases, the content of Error.Description will likely change across releases (as implementers improve error documentation). For this reason, the content in this field is not part of any type assertion (unlike Error.Message). Description *string `json:"description,omitempty"` // An error is retriable if the same request may succeed if submitted again. Retriable bool `json:"retriable"` - // Often times it is useful to return context specific to the request that caused the error - // (i.e. a sample of the stack trace or impacted account) in addition to the standard error - // message. + // Often times it is useful to return context specific to the request that caused the error (i.e. a sample of the stack trace or impacted account) in addition to the standard error message. Details map[string]interface{} `json:"details,omitempty"` } diff --git a/types/events_blocks_request.go b/types/events_blocks_request.go index 1d685d61..27eeb268 100644 --- a/types/events_blocks_request.go +++ b/types/events_blocks_request.go @@ -16,15 +16,11 @@ package types -// EventsBlocksRequest EventsBlocksRequest is utilized to fetch a sequence of BlockEvents indicating -// which blocks were added and removed from storage to reach the current state. +// EventsBlocksRequest EventsBlocksRequest is utilized to fetch a sequence of BlockEvents indicating which blocks were added and removed from storage to reach the current state. type EventsBlocksRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` - // offset is the offset into the event stream to sync events from. If this field is not - // populated, we return the limit events backwards from tip. If this is set to 0, we start from - // the beginning. + // offset is the offset into the event stream to sync events from. If this field is not populated, we return the limit events backwards from tip. If this is set to 0, we start from the beginning. Offset *int64 `json:"offset,omitempty"` - // limit is the maximum number of events to fetch in one call. The implementation may return <= - // limit events. + // limit is the maximum number of events to fetch in one call. The implementation may return <= limit events. Limit *int64 `json:"limit,omitempty"` } diff --git a/types/events_blocks_response.go b/types/events_blocks_response.go index 94442b9f..25d97cd1 100644 --- a/types/events_blocks_response.go +++ b/types/events_blocks_response.go @@ -16,13 +16,10 @@ package types -// EventsBlocksResponse EventsBlocksResponse contains an ordered collection of BlockEvents and the -// max retrievable sequence. +// EventsBlocksResponse EventsBlocksResponse contains an ordered collection of BlockEvents and the max retrievable sequence. type EventsBlocksResponse struct { // max_sequence is the maximum available sequence number to fetch. MaxSequence int64 `json:"max_sequence"` - // events is an array of BlockEvents indicating the order to add and remove blocks to maintain a - // canonical view of blockchain state. Lightweight clients can use this event stream to update - // state without implementing their own block syncing logic. + // events is an array of BlockEvents indicating the order to add and remove blocks to maintain a canonical view of blockchain state. Lightweight clients can use this event stream to update state without implementing their own block syncing logic. Events []*BlockEvent `json:"events"` } diff --git a/types/exemption_type.go b/types/exemption_type.go index ae2b63f4..793af8a8 100644 --- a/types/exemption_type.go +++ b/types/exemption_type.go @@ -16,14 +16,7 @@ package types -// ExemptionType ExemptionType is used to indicate if the live balance for an account subject to a -// BalanceExemption could increase above, decrease below, or equal the computed balance. * -// greater_or_equal: The live balance may increase above or equal the computed balance. This -// typically occurs with staking rewards that accrue on each block. * less_or_equal: The live -// balance may decrease below or equal the computed balance. This typically occurs as balance -// moves from locked to spendable on a vesting account. * dynamic: The live balance may increase -// above, decrease below, or equal the computed balance. This typically occurs with tokens that -// have a dynamic supply. +// ExemptionType ExemptionType is used to indicate if the live balance for an account subject to a BalanceExemption could increase above, decrease below, or equal the computed balance. * greater_or_equal: The live balance may increase above or equal the computed balance. This typically occurs with staking rewards that accrue on each block. * less_or_equal: The live balance may decrease below or equal the computed balance. This typically occurs as balance moves from locked to spendable on a vesting account. * dynamic: The live balance may increase above, decrease below, or equal the computed balance. This typically occurs with tokens that have a dynamic supply. type ExemptionType string // List of ExemptionType diff --git a/types/go.mod b/types/go.mod index ea754603..01c91f39 100644 --- a/types/go.mod +++ b/types/go.mod @@ -2,13 +2,4 @@ module github.com/coinbase/rosetta-sdk-go/types go 1.19 -require ( - github.com/mitchellh/mapstructure v1.5.0 - github.com/stretchr/testify v1.9.0 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) +require github.com/mitchellh/mapstructure v1.5.0 diff --git a/types/go.sum b/types/go.sum index bbde9e17..59f4b8e6 100644 --- a/types/go.sum +++ b/types/go.sum @@ -1,12 +1,2 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/types/mempool_response.go b/types/mempool_response.go index ccb37f4d..56ad44ef 100644 --- a/types/mempool_response.go +++ b/types/mempool_response.go @@ -16,8 +16,7 @@ package types -// MempoolResponse A MempoolResponse contains all transaction identifiers in the mempool for a -// particular network_identifier. +// MempoolResponse A MempoolResponse contains all transaction identifiers in the mempool for a particular network_identifier. type MempoolResponse struct { TransactionIdentifiers []*TransactionIdentifier `json:"transaction_identifiers"` } diff --git a/types/mempool_transaction_request.go b/types/mempool_transaction_request.go index dcb068c4..30f30f48 100644 --- a/types/mempool_transaction_request.go +++ b/types/mempool_transaction_request.go @@ -16,8 +16,7 @@ package types -// MempoolTransactionRequest A MempoolTransactionRequest is utilized to retrieve a transaction from -// the mempool. +// MempoolTransactionRequest A MempoolTransactionRequest is utilized to retrieve a transaction from the mempool. type MempoolTransactionRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` TransactionIdentifier *TransactionIdentifier `json:"transaction_identifier"` diff --git a/types/mempool_transaction_response.go b/types/mempool_transaction_response.go index 4475dfd1..b612eba6 100644 --- a/types/mempool_transaction_response.go +++ b/types/mempool_transaction_response.go @@ -16,9 +16,7 @@ package types -// MempoolTransactionResponse A MempoolTransactionResponse contains an estimate of a mempool -// transaction. It may not be possible to know the full impact of a transaction in the mempool (ex: -// fee paid). +// MempoolTransactionResponse A MempoolTransactionResponse contains an estimate of a mempool transaction. It may not be possible to know the full impact of a transaction in the mempool (ex: fee paid). type MempoolTransactionResponse struct { Transaction *Transaction `json:"transaction"` Metadata map[string]interface{} `json:"metadata,omitempty"` diff --git a/types/metadata_request.go b/types/metadata_request.go index e71c7a15..0f6dda85 100644 --- a/types/metadata_request.go +++ b/types/metadata_request.go @@ -16,8 +16,7 @@ package types -// MetadataRequest A MetadataRequest is utilized in any request where the only argument is optional -// metadata. +// MetadataRequest A MetadataRequest is utilized in any request where the only argument is optional metadata. type MetadataRequest struct { Metadata map[string]interface{} `json:"metadata,omitempty"` } diff --git a/types/network_identifier.go b/types/network_identifier.go index 3309b761..cd6fed59 100644 --- a/types/network_identifier.go +++ b/types/network_identifier.go @@ -16,12 +16,10 @@ package types -// NetworkIdentifier The network_identifier specifies which network a particular object is -// associated with. +// NetworkIdentifier The network_identifier specifies which network a particular object is associated with. type NetworkIdentifier struct { Blockchain string `json:"blockchain"` - // If a blockchain has a specific chain-id or network identifier, it should go in this field. It - // is up to the client to determine which network-specific identifier is mainnet or testnet. + // If a blockchain has a specific chain-id or network identifier, it should go in this field. It is up to the client to determine which network-specific identifier is mainnet or testnet. Network string `json:"network"` SubNetworkIdentifier *SubNetworkIdentifier `json:"sub_network_identifier,omitempty"` } diff --git a/types/network_list_response.go b/types/network_list_response.go index b7ab5731..04f8d31d 100644 --- a/types/network_list_response.go +++ b/types/network_list_response.go @@ -16,8 +16,7 @@ package types -// NetworkListResponse A NetworkListResponse contains all NetworkIdentifiers that the node can serve -// information for. +// NetworkListResponse A NetworkListResponse contains all NetworkIdentifiers that the node can serve information for. type NetworkListResponse struct { NetworkIdentifiers []*NetworkIdentifier `json:"network_identifiers"` } diff --git a/types/network_options_response.go b/types/network_options_response.go index 505b6a3c..cb9ed4ad 100644 --- a/types/network_options_response.go +++ b/types/network_options_response.go @@ -16,8 +16,7 @@ package types -// NetworkOptionsResponse NetworkOptionsResponse contains information about the versioning of the -// node and the allowed operation statuses, operation types, and errors. +// NetworkOptionsResponse NetworkOptionsResponse contains information about the versioning of the node and the allowed operation statuses, operation types, and errors. type NetworkOptionsResponse struct { Version *Version `json:"version"` Allow *Allow `json:"allow"` diff --git a/types/network_request.go b/types/network_request.go index 75f9f6f1..a25ce8b6 100644 --- a/types/network_request.go +++ b/types/network_request.go @@ -16,8 +16,7 @@ package types -// NetworkRequest A NetworkRequest is utilized to retrieve some data specific exclusively to a -// NetworkIdentifier. +// NetworkRequest A NetworkRequest is utilized to retrieve some data specific exclusively to a NetworkIdentifier. type NetworkRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` Metadata map[string]interface{} `json:"metadata,omitempty"` diff --git a/types/network_status_response.go b/types/network_status_response.go index eedc3bca..7d30c9f9 100644 --- a/types/network_status_response.go +++ b/types/network_status_response.go @@ -16,19 +16,10 @@ package types -// NetworkStatusResponse NetworkStatusResponse contains basic information about the node's view of a -// blockchain network. It is assumed that any BlockIdentifier.Index less than or equal to -// CurrentBlockIdentifier.Index can be queried. If a Rosetta implementation prunes historical state, -// it should populate the optional `oldest_block_identifier` field with the oldest block available -// to query. If this is not populated, it is assumed that the `genesis_block_identifier` is the -// oldest queryable block. If a Rosetta implementation performs some pre-sync before it is possible -// to query blocks, sync_status should be populated so that clients can still monitor healthiness. -// Without this field, it may appear that the implementation is stuck syncing and needs to be -// terminated. +// NetworkStatusResponse NetworkStatusResponse contains basic information about the node's view of a blockchain network. It is assumed that any BlockIdentifier.Index less than or equal to CurrentBlockIdentifier.Index can be queried. If a Rosetta implementation prunes historical state, it should populate the optional `oldest_block_identifier` field with the oldest block available to query. If this is not populated, it is assumed that the `genesis_block_identifier` is the oldest queryable block. If a Rosetta implementation performs some pre-sync before it is possible to query blocks, sync_status should be populated so that clients can still monitor healthiness. Without this field, it may appear that the implementation is stuck syncing and needs to be terminated. type NetworkStatusResponse struct { CurrentBlockIdentifier *BlockIdentifier `json:"current_block_identifier"` - // The timestamp of the block in milliseconds since the Unix Epoch. The timestamp is stored in - // milliseconds because some blockchains produce blocks more often than once a second. + // The timestamp of the block in milliseconds since the Unix Epoch. The timestamp is stored in milliseconds because some blockchains produce blocks more often than once a second. CurrentBlockTimestamp int64 `json:"current_block_timestamp"` GenesisBlockIdentifier *BlockIdentifier `json:"genesis_block_identifier"` OldestBlockIdentifier *BlockIdentifier `json:"oldest_block_identifier,omitempty"` diff --git a/types/operation.go b/types/operation.go index ccd8df5a..f38a10d0 100644 --- a/types/operation.go +++ b/types/operation.go @@ -16,31 +16,14 @@ package types -// Operation Operations contain all balance-changing information within a transaction. They are -// always one-sided (only affect 1 AccountIdentifier) and can succeed or fail independently from a -// Transaction. Operations are used both to represent on-chain data (Data API) and to construct new -// transactions (Construction API), creating a standard interface for reading and writing to -// blockchains. +// Operation Operations contain all balance-changing information within a transaction. They are always one-sided (only affect 1 AccountIdentifier) and can succeed or fail independently from a Transaction. Operations are used both to represent on-chain data (Data API) and to construct new transactions (Construction API), creating a standard interface for reading and writing to blockchains. type Operation struct { OperationIdentifier *OperationIdentifier `json:"operation_identifier"` - // Restrict referenced related_operations to identifier indices < the current - // operation_identifier.index. This ensures there exists a clear DAG-structure of relations. - // Since operations are one-sided, one could imagine relating operations in a single transfer or - // linking operations in a call tree. + // Restrict referenced related_operations to identifier indices < the current operation_identifier.index. This ensures there exists a clear DAG-structure of relations. Since operations are one-sided, one could imagine relating operations in a single transfer or linking operations in a call tree. RelatedOperations []*OperationIdentifier `json:"related_operations,omitempty"` - // Type is the network-specific type of the operation. Ensure that any type that can be returned - // here is also specified in the NetworkOptionsResponse. This can be very useful to downstream - // consumers that parse all block data. + // Type is the network-specific type of the operation. Ensure that any type that can be returned here is also specified in the NetworkOptionsResponse. This can be very useful to downstream consumers that parse all block data. Type string `json:"type"` - // Status is the network-specific status of the operation. Status is not defined on the - // transaction object because blockchains with smart contracts may have transactions that - // partially apply (some operations are successful and some are not). Blockchains with atomic - // transactions (all operations succeed or all operations fail) will have the same status for - // each operation. On-chain operations (operations retrieved in the `/block` and - // `/block/transaction` endpoints) MUST have a populated status field (anything on-chain must - // have succeeded or failed). However, operations provided during transaction construction - // (often times called \"intent\" in the documentation) MUST NOT have a populated status field - // (operations yet to be included on-chain have not yet succeeded or failed). + // Status is the network-specific status of the operation. Status is not defined on the transaction object because blockchains with smart contracts may have transactions that partially apply (some operations are successful and some are not). Blockchains with atomic transactions (all operations succeed or all operations fail) will have the same status for each operation. On-chain operations (operations retrieved in the `/block` and `/block/transaction` endpoints) MUST have a populated status field (anything on-chain must have succeeded or failed). However, operations provided during transaction construction (often times called \"intent\" in the documentation) MUST NOT have a populated status field (operations yet to be included on-chain have not yet succeeded or failed). Status *string `json:"status,omitempty"` Account *AccountIdentifier `json:"account,omitempty"` Amount *Amount `json:"amount,omitempty"` diff --git a/types/operation_identifier.go b/types/operation_identifier.go index ae917914..22e48d30 100644 --- a/types/operation_identifier.go +++ b/types/operation_identifier.go @@ -16,17 +16,10 @@ package types -// OperationIdentifier The operation_identifier uniquely identifies an operation within a -// transaction. +// OperationIdentifier The operation_identifier uniquely identifies an operation within a transaction. type OperationIdentifier struct { - // The operation index is used to ensure each operation has a unique identifier within a - // transaction. This index is only relative to the transaction and NOT GLOBAL. The operations in - // each transaction should start from index 0. To clarify, there may not be any notion of an - // operation index in the blockchain being described. + // The operation index is used to ensure each operation has a unique identifier within a transaction. This index is only relative to the transaction and NOT GLOBAL. The operations in each transaction should start from index 0. To clarify, there may not be any notion of an operation index in the blockchain being described. Index int64 `json:"index"` - // Some blockchains specify an operation index that is essential for client use. For example, - // Bitcoin uses a network_index to identify which UTXO was used in a transaction. network_index - // should not be populated if there is no notion of an operation index in a blockchain - // (typically most account-based blockchains). + // Some blockchains specify an operation index that is essential for client use. For example, Bitcoin uses a network_index to identify which UTXO was used in a transaction. network_index should not be populated if there is no notion of an operation index in a blockchain (typically most account-based blockchains). NetworkIndex *int64 `json:"network_index,omitempty"` } diff --git a/types/operation_status.go b/types/operation_status.go index a8784780..25c963dd 100644 --- a/types/operation_status.go +++ b/types/operation_status.go @@ -16,16 +16,10 @@ package types -// OperationStatus OperationStatus is utilized to indicate which Operation status are considered -// successful. +// OperationStatus OperationStatus is utilized to indicate which Operation status are considered successful. type OperationStatus struct { // The status is the network-specific status of the operation. Status string `json:"status"` - // An Operation is considered successful if the Operation.Amount should affect the - // Operation.Account. Some blockchains (like Bitcoin) only include successful operations in - // blocks but other blockchains (like Ethereum) include unsuccessful operations that incur a - // fee. To reconcile the computed balance from the stream of Operations, it is critical to - // understand which Operation.Status indicate an Operation is successful and should affect an - // Account. + // An Operation is considered successful if the Operation.Amount should affect the Operation.Account. Some blockchains (like Bitcoin) only include successful operations in blocks but other blockchains (like Ethereum) include unsuccessful operations that incur a fee. To reconcile the computed balance from the stream of Operations, it is critical to understand which Operation.Status indicate an Operation is successful and should affect an Account. Successful bool `json:"successful"` } diff --git a/types/operator.go b/types/operator.go index 05938f31..259e7f14 100644 --- a/types/operator.go +++ b/types/operator.go @@ -16,8 +16,7 @@ package types -// Operator Operator is used by query-related endpoints to determine how to apply conditions. If -// this field is not populated, the default `and` value will be used. +// Operator Operator is used by query-related endpoints to determine how to apply conditions. If this field is not populated, the default `and` value will be used. type Operator string // List of Operator diff --git a/types/partial_block_identifier.go b/types/partial_block_identifier.go index db62012c..5e992ee9 100644 --- a/types/partial_block_identifier.go +++ b/types/partial_block_identifier.go @@ -16,9 +16,7 @@ package types -// PartialBlockIdentifier When fetching data by BlockIdentifier, it may be possible to only specify -// the index or hash. If neither property is specified, it is assumed that the client is making a -// request at the current block. +// PartialBlockIdentifier When fetching data by BlockIdentifier, it may be possible to only specify the index or hash. If neither property is specified, it is assumed that the client is making a request at the current block. type PartialBlockIdentifier struct { Index *int64 `json:"index,omitempty"` Hash *string `json:"hash,omitempty"` diff --git a/types/public_key.go b/types/public_key.go index 83a8ad8a..6f957304 100644 --- a/types/public_key.go +++ b/types/public_key.go @@ -21,8 +21,7 @@ import ( "encoding/json" ) -// PublicKey PublicKey contains a public key byte array for a particular CurveType encoded in hex. -// Note that there is no PrivateKey struct as this is NEVER the concern of an implementation. +// PublicKey PublicKey contains a public key byte array for a particular CurveType encoded in hex. Note that there is no PrivateKey struct as this is NEVER the concern of an implementation. type PublicKey struct { Bytes []byte `json:"hex_bytes"` CurveType CurveType `json:"curve_type"` diff --git a/types/related_transaction.go b/types/related_transaction.go index 3b55523f..e5ecb441 100644 --- a/types/related_transaction.go +++ b/types/related_transaction.go @@ -16,9 +16,7 @@ package types -// RelatedTransaction The related_transaction allows implementations to link together multiple -// transactions. An unpopulated network identifier indicates that the related transaction is on the -// same network. +// RelatedTransaction The related_transaction allows implementations to link together multiple transactions. An unpopulated network identifier indicates that the related transaction is on the same network. type RelatedTransaction struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier,omitempty"` TransactionIdentifier *TransactionIdentifier `json:"transaction_identifier"` diff --git a/types/search_transactions_request.go b/types/search_transactions_request.go index d59c7deb..d5129a4e 100644 --- a/types/search_transactions_request.go +++ b/types/search_transactions_request.go @@ -16,22 +16,15 @@ package types -// SearchTransactionsRequest SearchTransactionsRequest is used to search for transactions matching a -// set of provided conditions in canonical blocks. +// SearchTransactionsRequest SearchTransactionsRequest is used to search for transactions matching a set of provided conditions in canonical blocks. type SearchTransactionsRequest struct { NetworkIdentifier *NetworkIdentifier `json:"network_identifier"` Operator *Operator `json:"operator,omitempty"` - // max_block is the largest block index to consider when searching for transactions. If this - // field is not populated, the current block is considered the max_block. If you do not specify - // a max_block, it is possible a newly synced block will interfere with paginated transaction - // queries (as the offset could become invalid with newly added rows). + // max_block is the largest block index to consider when searching for transactions. If this field is not populated, the current block is considered the max_block. If you do not specify a max_block, it is possible a newly synced block will interfere with paginated transaction queries (as the offset could become invalid with newly added rows). MaxBlock *int64 `json:"max_block,omitempty"` - // offset is the offset into the query result to start returning transactions. If any search - // conditions are changed, the query offset will change and you must restart your search - // iteration. + // offset is the offset into the query result to start returning transactions. If any search conditions are changed, the query offset will change and you must restart your search iteration. Offset *int64 `json:"offset,omitempty"` - // limit is the maximum number of transactions to return in one call. The implementation may - // return <= limit transactions. + // limit is the maximum number of transactions to return in one call. The implementation may return <= limit transactions. Limit *int64 `json:"limit,omitempty"` TransactionIdentifier *TransactionIdentifier `json:"transaction_identifier,omitempty"` AccountIdentifier *AccountIdentifier `json:"account_identifier,omitempty"` @@ -41,10 +34,8 @@ type SearchTransactionsRequest struct { Status *string `json:"status,omitempty"` // type is the network-specific operation type. Type *string `json:"type,omitempty"` - // address is AccountIdentifier.Address. This is used to get all transactions related to an - // AccountIdentifier.Address, regardless of SubAccountIdentifier. + // address is AccountIdentifier.Address. This is used to get all transactions related to an AccountIdentifier.Address, regardless of SubAccountIdentifier. Address *string `json:"address,omitempty"` - // success is a synthetic condition populated by parsing network-specific operation statuses - // (using the mapping provided in `/network/options`). + // success is a synthetic condition populated by parsing network-specific operation statuses (using the mapping provided in `/network/options`). Success *bool `json:"success,omitempty"` } diff --git a/types/search_transactions_response.go b/types/search_transactions_response.go index b5626cbf..046e8e94 100644 --- a/types/search_transactions_response.go +++ b/types/search_transactions_response.go @@ -16,20 +16,12 @@ package types -// SearchTransactionsResponse SearchTransactionsResponse contains an ordered collection of -// BlockTransactions that match the query in SearchTransactionsRequest. These BlockTransactions are -// sorted from most recent block to oldest block. +// SearchTransactionsResponse SearchTransactionsResponse contains an ordered collection of BlockTransactions that match the query in SearchTransactionsRequest. These BlockTransactions are sorted from most recent block to oldest block. type SearchTransactionsResponse struct { - // transactions is an array of BlockTransactions sorted by most recent BlockIdentifier (meaning - // that transactions in recent blocks appear first). If there are many transactions for a - // particular search, transactions may not contain all matching transactions. It is up to the - // caller to paginate these transactions using the max_block field. + // transactions is an array of BlockTransactions sorted by most recent BlockIdentifier (meaning that transactions in recent blocks appear first). If there are many transactions for a particular search, transactions may not contain all matching transactions. It is up to the caller to paginate these transactions using the max_block field. Transactions []*BlockTransaction `json:"transactions"` - // total_count is the number of results for a given search. Callers typically use this value to - // concurrently fetch results by offset or to display a virtual page number associated with - // results. + // total_count is the number of results for a given search. Callers typically use this value to concurrently fetch results by offset or to display a virtual page number associated with results. TotalCount int64 `json:"total_count"` - // next_offset is the next offset to use when paginating through transaction results. If this - // field is not populated, there are no more transactions to query. + // next_offset is the next offset to use when paginating through transaction results. If this field is not populated, there are no more transactions to query. NextOffset *int64 `json:"next_offset,omitempty"` } diff --git a/types/signature.go b/types/signature.go index b287649e..a29cf01d 100644 --- a/types/signature.go +++ b/types/signature.go @@ -21,10 +21,7 @@ import ( "encoding/json" ) -// Signature Signature contains the payload that was signed, the public keys of the keypairs used to -// produce the signature, the signature (encoded in hex), and the SignatureType. PublicKey is often -// times not known during construction of the signing payloads but may be needed to combine -// signatures properly. +// Signature Signature contains the payload that was signed, the public keys of the keypairs used to produce the signature, the signature (encoded in hex), and the SignatureType. PublicKey is often times not known during construction of the signing payloads but may be needed to combine signatures properly. type Signature struct { SigningPayload *SigningPayload `json:"signing_payload"` PublicKey *PublicKey `json:"public_key"` diff --git a/types/signature_type.go b/types/signature_type.go index 228e4c7b..94c15aba 100644 --- a/types/signature_type.go +++ b/types/signature_type.go @@ -16,15 +16,7 @@ package types -// SignatureType SignatureType is the type of a cryptographic signature. * ecdsa: `r (32-bytes) || s -// (32-bytes)` - `64 bytes` * ecdsa_recovery: `r (32-bytes) || s (32-bytes) || v (1-byte)` - `65 -// bytes` * ed25519: `R (32-byte) || s (32-bytes)` - `64 bytes` * schnorr_1: `r (32-bytes) || s -// (32-bytes)` - `64 bytes` (schnorr signature implemented by Zilliqa where both `r` and `s` are -// scalars encoded as `32-bytes` values, most significant byte first.) * schnorr_poseidon: `r -// (32-bytes) || s (32-bytes)` where s = Hash(1st pk || 2nd pk || r) - `64 bytes` (schnorr -// signature w/ Poseidon hash function implemented by O(1) Labs where both `r` and `s` are scalars -// encoded as `32-bytes` values, least significant byte first. -// https://github.com/CodaProtocol/signer-reference/blob/master/schnorr.ml ) +// SignatureType SignatureType is the type of a cryptographic signature. * ecdsa: `r (32-bytes) || s (32-bytes)` - `64 bytes` * ecdsa_recovery: `r (32-bytes) || s (32-bytes) || v (1-byte)` - `65 bytes` * ed25519: `R (32-byte) || s (32-bytes)` - `64 bytes` * schnorr_1: `r (32-bytes) || s (32-bytes)` - `64 bytes` (schnorr signature implemented by Zilliqa where both `r` and `s` are scalars encoded as `32-bytes` values, most significant byte first.) * schnorr_poseidon: `r (32-bytes) || s (32-bytes)` where s = Hash(1st pk || 2nd pk || r) - `64 bytes` (schnorr signature w/ Poseidon hash function implemented by O(1) Labs where both `r` and `s` are scalars encoded as `32-bytes` values, least significant byte first. https://github.com/CodaProtocol/signer-reference/blob/master/schnorr.ml ) type SignatureType string // List of SignatureType diff --git a/types/sub_account_identifier.go b/types/sub_account_identifier.go index be398ae3..7a03618f 100644 --- a/types/sub_account_identifier.go +++ b/types/sub_account_identifier.go @@ -16,15 +16,10 @@ package types -// SubAccountIdentifier An account may have state specific to a contract address (ERC-20 token) -// and/or a stake (delegated balance). The sub_account_identifier should specify which state (if -// applicable) an account instantiation refers to. +// SubAccountIdentifier An account may have state specific to a contract address (ERC-20 token) and/or a stake (delegated balance). The sub_account_identifier should specify which state (if applicable) an account instantiation refers to. type SubAccountIdentifier struct { - // The SubAccount address may be a cryptographic value or some other identifier (ex: bonded) - // that uniquely specifies a SubAccount. + // The SubAccount address may be a cryptographic value or some other identifier (ex: bonded) that uniquely specifies a SubAccount. Address string `json:"address"` - // If the SubAccount address is not sufficient to uniquely specify a SubAccount, any other - // identifying information can be stored here. It is important to note that two SubAccounts with - // identical addresses but differing metadata will not be considered equal by clients. + // If the SubAccount address is not sufficient to uniquely specify a SubAccount, any other identifying information can be stored here. It is important to note that two SubAccounts with identical addresses but differing metadata will not be considered equal by clients. Metadata map[string]interface{} `json:"metadata,omitempty"` } diff --git a/types/sub_network_identifier.go b/types/sub_network_identifier.go index f760a85d..087f02ff 100644 --- a/types/sub_network_identifier.go +++ b/types/sub_network_identifier.go @@ -16,9 +16,7 @@ package types -// SubNetworkIdentifier In blockchains with sharded state, the SubNetworkIdentifier is required to -// query some object on a specific shard. This identifier is optional for all non-sharded -// blockchains. +// SubNetworkIdentifier In blockchains with sharded state, the SubNetworkIdentifier is required to query some object on a specific shard. This identifier is optional for all non-sharded blockchains. type SubNetworkIdentifier struct { Network string `json:"network"` Metadata map[string]interface{} `json:"metadata,omitempty"` diff --git a/types/sync_status.go b/types/sync_status.go index 7739781b..49436a8e 100644 --- a/types/sync_status.go +++ b/types/sync_status.go @@ -16,27 +16,14 @@ package types -// SyncStatus SyncStatus is used to provide additional context about an implementation's sync -// status. This object is often used by implementations to indicate healthiness when block data -// cannot be queried until some sync phase completes or cannot be determined by comparing the -// timestamp of the most recent block with the current time. +// SyncStatus SyncStatus is used to provide additional context about an implementation's sync status. This object is often used by implementations to indicate healthiness when block data cannot be queried until some sync phase completes or cannot be determined by comparing the timestamp of the most recent block with the current time. type SyncStatus struct { - // CurrentIndex is the index of the last synced block in the current stage. This is a separate - // field from current_block_identifier in NetworkStatusResponse because blocks with indices up - // to and including the current_index may not yet be queryable by the caller. To reiterate, all - // indices up to and including current_block_identifier in NetworkStatusResponse must be - // queryable via the /block endpoint (excluding indices less than oldest_block_identifier). + // CurrentIndex is the index of the last synced block in the current stage. This is a separate field from current_block_identifier in NetworkStatusResponse because blocks with indices up to and including the current_index may not yet be queryable by the caller. To reiterate, all indices up to and including current_block_identifier in NetworkStatusResponse must be queryable via the /block endpoint (excluding indices less than oldest_block_identifier). CurrentIndex *int64 `json:"current_index,omitempty"` - // TargetIndex is the index of the block that the implementation is attempting to sync to in the - // current stage. + // TargetIndex is the index of the block that the implementation is attempting to sync to in the current stage. TargetIndex *int64 `json:"target_index,omitempty"` // Stage is the phase of the sync process. Stage *string `json:"stage,omitempty"` - // 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 - // blockchains, the most recent block could have a timestamp far behind the current time but the - // node could be healthy and at tip. + // 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 blockchains, the most recent block could have a timestamp far behind the current time but the node could be healthy and at tip. Synced *bool `json:"synced,omitempty"` } diff --git a/types/transaction.go b/types/transaction.go index 5552866c..73b3e2fe 100644 --- a/types/transaction.go +++ b/types/transaction.go @@ -16,13 +16,11 @@ package types -// Transaction Transactions contain an array of Operations that are attributable to the same -// TransactionIdentifier. +// Transaction Transactions contain an array of Operations that are attributable to the same TransactionIdentifier. type Transaction struct { TransactionIdentifier *TransactionIdentifier `json:"transaction_identifier"` Operations []*Operation `json:"operations"` RelatedTransactions []*RelatedTransaction `json:"related_transactions,omitempty"` - // Transactions that are related to other transactions (like a cross-shard transaction) should - // include the tranaction_identifier of these transactions in the metadata. + // Transactions that are related to other transactions (like a cross-shard transaction) should include the tranaction_identifier of these transactions in the metadata. Metadata map[string]interface{} `json:"metadata,omitempty"` } diff --git a/types/transaction_identifier.go b/types/transaction_identifier.go index 511decca..88661d75 100644 --- a/types/transaction_identifier.go +++ b/types/transaction_identifier.go @@ -16,11 +16,8 @@ package types -// TransactionIdentifier The transaction_identifier uniquely identifies a transaction in a -// particular network and block or in the mempool. +// TransactionIdentifier The transaction_identifier uniquely identifies a transaction in a 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. This should be normalized according to the case - // specified in the transaction_hash_case in network options. + // Any transactions that are attributable only to a block (ex: a block event) should use the 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"` } diff --git a/types/transaction_identifier_response.go b/types/transaction_identifier_response.go index ba8d7560..44c33421 100644 --- a/types/transaction_identifier_response.go +++ b/types/transaction_identifier_response.go @@ -16,8 +16,7 @@ package types -// TransactionIdentifierResponse TransactionIdentifierResponse contains the transaction_identifier -// of a transaction that was submitted to either `/construction/hash` or `/construction/submit`. +// TransactionIdentifierResponse TransactionIdentifierResponse contains the transaction_identifier of a transaction that was submitted to either `/construction/hash` or `/construction/submit`. type TransactionIdentifierResponse struct { TransactionIdentifier *TransactionIdentifier `json:"transaction_identifier"` Metadata map[string]interface{} `json:"metadata,omitempty"` diff --git a/types/version.go b/types/version.go index 70f3fc26..f2c591a5 100644 --- a/types/version.go +++ b/types/version.go @@ -16,19 +16,14 @@ package types -// Version The Version object is utilized to inform the client of the versions of different -// components of the Rosetta implementation. +// Version The Version object is utilized to inform the client of the versions of different components of the Rosetta implementation. type Version struct { - // The rosetta_version is the version of the Rosetta interface the implementation adheres to. - // This can be useful for clients looking to reliably parse responses. + // The rosetta_version is the version of the Rosetta interface the implementation adheres to. This can be useful for clients looking to reliably parse responses. RosettaVersion string `json:"rosetta_version"` - // The node_version is the canonical version of the node runtime. This can help clients manage - // deployments. + // The node_version is the canonical version of the node runtime. This can help clients manage deployments. NodeVersion string `json:"node_version"` - // When a middleware server is used to adhere to the Rosetta interface, it should return its - // version here. This can help clients manage deployments. + // When a middleware server is used to adhere to the Rosetta interface, it should return its version here. This can help clients manage deployments. MiddlewareVersion *string `json:"middleware_version,omitempty"` - // Any other information that may be useful about versioning of dependent services should be - // returned here. + // Any other information that may be useful about versioning of dependent services should be returned here. Metadata map[string]interface{} `json:"metadata,omitempty"` }