rosetta-sdk-typescript
Version:
Typescript SDK to create and interact with Rosetta API implementations.
72 lines (66 loc) • 2.55 kB
text/typescript
/* tslint:disable */
/* eslint-disable */
/**
* Rosetta
* Build Once. Integrate Your Blockchain Everywhere.
*
* The version of the OpenAPI document: 1.4.10
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists } from '../runtime';
import { Amount, AmountFromJSON, AmountToJSON, BlockIdentifier, BlockIdentifierFromJSON, BlockIdentifierToJSON } from './';
/**
* 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`.
* @export
* @interface AccountBalanceResponse
*/
export interface AccountBalanceResponse {
/**
*
* @type {BlockIdentifier}
* @memberof AccountBalanceResponse
*/
block_identifier: BlockIdentifier;
/**
* A single account may have a balance in multiple currencies.
* @type {Array<Amount>}
* @memberof AccountBalanceResponse
*/
balances: Array<Amount>;
/**
* 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.
* @type {object}
* @memberof AccountBalanceResponse
*/
metadata?: object;
}
export function AccountBalanceResponseFromJSON(json: any): AccountBalanceResponse {
return AccountBalanceResponseFromJSONTyped(json, false);
}
export function AccountBalanceResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): AccountBalanceResponse {
if (json === undefined || json === null) {
return json;
}
return {
block_identifier: BlockIdentifierFromJSON(json['block_identifier']),
balances: (json['balances'] as Array<any>).map(AmountFromJSON),
metadata: !exists(json, 'metadata') ? undefined : json['metadata'],
};
}
export function AccountBalanceResponseToJSON(value?: AccountBalanceResponse | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
block_identifier: BlockIdentifierToJSON(value.block_identifier),
balances: (value.balances as Array<any>).map(AmountToJSON),
metadata: value.metadata,
};
}