From 34ccf20d786172c5352361fb41a98a3cf6f6f908 Mon Sep 17 00:00:00 2001 From: George Date: Fri, 26 Apr 2024 16:15:24 -0700 Subject: [PATCH] Add transaction hash field to each item in the `getEvents` response (#939) --- CHANGELOG.md | 7 ++----- src/soroban/api.ts | 1 + test/unit/server/soroban/get_events_test.js | 4 ++++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6aecdf6cf..86efd606a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,15 +7,12 @@ A breaking change will get clearly marked in this log. ## Unreleased ### Fixed - +* Each item in the `GetEventsResponse.events` list will now have a `txHash` item corresponding to the transaction hash that triggered a particular event ([#939](https://github.com/stellar/js-stellar-sdk/pull/939)). * ContractClient now properly handles methods that take no arguments. While most methods take two arguments (arguments for the function, `args`, as well as various `MethodOptions`), if there are no arguments for the functions, then we can omit the first. This brings the ContractClient inline with the types generated by Soroban CLI's `soroban contract bindings typescript`. Full details: [#940](https://github.com/stellar/js-stellar-sdk/pull/940) +* `ContractClient` new allows `publicKey` to be undefined, returning functionality that had been in the bindings previously generated by `soroban contract bindings typescript`. More details: [#941](https://github.com/stellar/js-stellar-sdk/pull/941) ## [v11.3.0](https://github.com/stellar/js-stellar-sdk/compare/v11.2.2...v11.3.0) -### Fixed - -* `ContractClient` new allows `publicKey` to be undefined, returning functionality that had been in the bindings previously generated by `soroban contract bindings typescript`. More details: [#941](https://github.com/stellar/js-stellar-sdk/pull/941) - ### Added * Introduces an entire suite of helpers to assist with interacting with smart contracts ([#929](https://github.com/stellar/js-stellar-sdk/pull/929)): - `ContractClient`: generate a class from the contract specification where each Rust contract method gets a matching method in this class. Each method returns an `AssembledTransaction` that can be used to modify, simulate, decode results, and possibly sign, & submit the transaction. diff --git a/src/soroban/api.ts b/src/soroban/api.ts index 998e82571..3c8d7806f 100644 --- a/src/soroban/api.ts +++ b/src/soroban/api.ts @@ -166,6 +166,7 @@ export namespace Api { ledgerClosedAt: string; pagingToken: string; inSuccessfulContractCall: boolean; + txHash: string; } export interface RawEventResponse extends BaseEventResponse { diff --git a/test/unit/server/soroban/get_events_test.js b/test/unit/server/soroban/get_events_test.js index 6709f0ac0..8b3f4f8e7 100644 --- a/test/unit/server/soroban/get_events_test.js +++ b/test/unit/server/soroban/get_events_test.js @@ -246,6 +246,7 @@ let getEventsResponseFixture = [ inSuccessfulContractCall: true, topic: topicVals.slice(0, 2), value: eventVal, + txHash: "d7d09af2ca4f2929ee701cf86d05e4ca5f849a726d0db344785a8f9894e79e6c" }, { type: "contract", @@ -257,6 +258,7 @@ let getEventsResponseFixture = [ inSuccessfulContractCall: true, topic: topicVals.slice(0, 2), value: eventVal, + txHash: "d7d09af2ca4f2929ee701cf86d05e4ca5f849a726d0db344785a8f9894e79e6c" }, { type: "diagnostic", @@ -268,6 +270,7 @@ let getEventsResponseFixture = [ inSuccessfulContractCall: true, topic: [topicVals[0]], value: eventVal, + txHash: "d7d09af2ca4f2929ee701cf86d05e4ca5f849a726d0db344785a8f9894e79e6c" }, { type: "contract", @@ -279,5 +282,6 @@ let getEventsResponseFixture = [ inSuccessfulContractCall: true, topic: topicVals, value: eventVal, + txHash: "d7d09af2ca4f2929ee701cf86d05e4ca5f849a726d0db344785a8f9894e79e6c" }, ];