rosetta-sdk-typescript
Version:
Typescript SDK to create and interact with Rosetta API implementations.
60 lines (59 loc) • 2.41 kB
JavaScript
;
/* 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.OperationToJSON = exports.OperationFromJSONTyped = exports.OperationFromJSON = void 0;
const runtime_1 = require("../runtime");
const _1 = require("./");
function OperationFromJSON(json) {
return OperationFromJSONTyped(json, false);
}
exports.OperationFromJSON = OperationFromJSON;
function OperationFromJSONTyped(json, ignoreDiscriminator) {
if (json === undefined || json === null) {
return json;
}
return {
operation_identifier: _1.OperationIdentifierFromJSON(json['operation_identifier']),
related_operations: !runtime_1.exists(json, 'related_operations')
? undefined
: json['related_operations'].map(_1.OperationIdentifierFromJSON),
type: json['type'],
status: !runtime_1.exists(json, 'status') ? undefined : json['status'],
account: !runtime_1.exists(json, 'account') ? undefined : _1.AccountIdentifierFromJSON(json['account']),
amount: !runtime_1.exists(json, 'amount') ? undefined : _1.AmountFromJSON(json['amount']),
coin_change: !runtime_1.exists(json, 'coin_change') ? undefined : _1.CoinChangeFromJSON(json['coin_change']),
metadata: !runtime_1.exists(json, 'metadata') ? undefined : json['metadata'],
};
}
exports.OperationFromJSONTyped = OperationFromJSONTyped;
function OperationToJSON(value) {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
operation_identifier: _1.OperationIdentifierToJSON(value.operation_identifier),
related_operations: value.related_operations === undefined ? undefined : value.related_operations.map(_1.OperationIdentifierToJSON),
type: value.type,
status: value.status,
account: _1.AccountIdentifierToJSON(value.account),
amount: _1.AmountToJSON(value.amount),
coin_change: _1.CoinChangeToJSON(value.coin_change),
metadata: value.metadata,
};
}
exports.OperationToJSON = OperationToJSON;