diff --git a/src/soroban/api.ts b/src/soroban/api.ts index 75f9e4a1c..e270bd066 100644 --- a/src/soroban/api.ts +++ b/src/soroban/api.ts @@ -175,7 +175,7 @@ export namespace Api { value: string; } - interface RawLedgerEntryDiff { + interface RawLedgerEntryChange { type: number; // This is LedgerKey in base64 key: string; @@ -185,7 +185,7 @@ export namespace Api { after?: string; } - interface LedgerEntryDiff{ + interface LedgerEntryChange{ type: number; key: xdr.LedgerKey; before?: xdr.LedgerEntry; @@ -279,7 +279,7 @@ export namespace Api { result?: SimulateHostFunctionResult; // State Difference information - stateDiff?: LedgerEntryDiff[]; + stateChanges?: LedgerEntryChange[]; } /** Includes details about why the simulation failed */ @@ -365,6 +365,6 @@ export namespace Api { }; // State Difference information - stateDiff?: RawLedgerEntryDiff[]; + stateChanges?: RawLedgerEntryChange[]; } } diff --git a/src/soroban/parsers.ts b/src/soroban/parsers.ts index 61d5740db..1900f310d 100644 --- a/src/soroban/parsers.ts +++ b/src/soroban/parsers.ts @@ -141,13 +141,13 @@ function parseSuccessful( })[0] }), - stateDiff: sim.stateDiff?.length ?? 0 > 0 - ? sim.stateDiff!.map((entryDiff) => { + stateChanges: sim.stateChanges?.length ?? 0 > 0 + ? sim.stateChanges!.map((entryChange) => { return { - type: entryDiff.type, - key: xdr.LedgerKey.fromXDR(entryDiff.key, 'base64'), - before: !!entryDiff.before ? xdr.LedgerEntry.fromXDR(entryDiff.before, 'base64') : undefined, - after: !!entryDiff.after ? xdr.LedgerEntry.fromXDR(entryDiff.after, 'base64') : undefined, + type: entryChange.type, + key: xdr.LedgerKey.fromXDR(entryChange.key, 'base64'), + before: !!entryChange.before ? xdr.LedgerEntry.fromXDR(entryChange.before, 'base64') : undefined, + after: !!entryChange.after ? xdr.LedgerEntry.fromXDR(entryChange.after, 'base64') : undefined, }; }) : undefined, diff --git a/test/unit/server/soroban/simulate_transaction_test.js b/test/unit/server/soroban/simulate_transaction_test.js index 2bff0ff88..5abe52fb5 100644 --- a/test/unit/server/soroban/simulate_transaction_test.js +++ b/test/unit/server/soroban/simulate_transaction_test.js @@ -32,7 +32,7 @@ describe("Server#simulateTransaction", async function (done) { retval: xdr.ScVal.fromXDR(simulationResponse.results[0].xdr, "base64"), }, cost: simulationResponse.cost, - stateDiff: [ + stateChanges: [ { type: 1, key: "example-key", @@ -189,7 +189,7 @@ describe("Server#simulateTransaction", async function (done) { delete expected.cost; delete expected.transactionData; delete expected.minResourceFee; - delete expected.stateDiff; + delete expected.stateChanges; expected.error = "This is an error"; expected.events = []; @@ -215,7 +215,7 @@ function cloneSimulation(sim) { retval: xdr.ScVal.fromXDR(sim.result.retval.toXDR()), }, cost: sim.cost, - stateDiff: sim.stateDiff, + stateChanges: sim.stateChanges, _parsed: sim._parsed, }; } @@ -278,7 +278,7 @@ function baseSimulationResponse(results) { cpuInsns: "1", memBytes: "2", }, - stateDiff: [ + stateChanges: [ { type: 1, key: "example-key",