1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const client_common_1 = require("@neo-one/client-common");
|
4 | const InvocationResultBase_1 = require("./InvocationResultBase");
|
5 | class InvocationResultSuccess extends InvocationResultBase_1.InvocationResultBase {
|
6 | static deserializeWireBase(options) {
|
7 | const { state, gasConsumed, gasCost, stack } = super.deserializeInvocationResultWireBase(options);
|
8 | if (state !== client_common_1.VMState.Halt) {
|
9 | throw new client_common_1.InvalidFormatError(`Expected VMState state to be ${client_common_1.VMState.Halt}. Received: ${state}.`);
|
10 | }
|
11 | return new this({ gasConsumed, gasCost, stack });
|
12 | }
|
13 | constructor({ gasConsumed, gasCost, stack }) {
|
14 | super({ state: client_common_1.VMState.Halt, gasConsumed, gasCost, stack });
|
15 | }
|
16 | serializeJSON(context) {
|
17 | return {
|
18 | state: client_common_1.VMState.Halt,
|
19 | gas_consumed: client_common_1.JSONHelper.writeFixed8(this.gasConsumed),
|
20 | gas_cost: client_common_1.JSONHelper.writeFixed8(this.gasCost),
|
21 | stack: this.stack.map((value) => value.serializeJSON(context)),
|
22 | };
|
23 | }
|
24 | }
|
25 | exports.InvocationResultSuccess = InvocationResultSuccess;
|
26 |
|
27 |
|