Skip to content

Commit

Permalink
Merge branch 'master' into fixup-getEvents
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Nov 2, 2023
2 parents ebe0423 + bd4feff commit 0a6c4f9
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 24 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ A breaking change will get clearly marked in this log.

## Unreleased

### Fixed
* The `SorobanRpc.Server.getTransaction` method will now return the full response when encountering a `FAILED` transaction result ([#872](https://github.com/stellar/js-stellar-sdk/pull/872)).


## [v11.0.0-beta.5](https://github.com/stellar/js-stellar-sdk/compare/v11.0.0-beta.4...v11.0.0-beta.5)

Expand Down
8 changes: 8 additions & 0 deletions src/soroban/soroban_rpc.ts → src/soroban/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ export namespace Api {
export interface GetFailedTransactionResponse
extends GetAnyTransactionResponse {
status: GetTransactionStatus.FAILED;

ledger: number;
createdAt: number;
applicationOrder: number;
feeBump: boolean;
envelopeXdr: xdr.TransactionEnvelope;
resultXdr: xdr.TransactionResult;
resultMetaXdr: xdr.TransactionMeta;
}

export interface GetSuccessfulTransactionResponse
Expand Down
2 changes: 1 addition & 1 deletion src/soroban/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/// <reference path="../../types/dom-monkeypatch.d.ts" />

// Expose all types
export * from './soroban_rpc';
export * from './api';

// soroban-client classes to expose
export { Server, Durability } from './server';
Expand Down
2 changes: 1 addition & 1 deletion src/soroban/parsers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { xdr, Contract, SorobanDataBuilder } from 'stellar-base';
import { Api } from './soroban_rpc';
import { Api } from './api';

export function parseRawSendTransaction(
r: Api.RawSendTransactionResponse
Expand Down
15 changes: 8 additions & 7 deletions src/soroban/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import AxiosClient from './axios';
import { Api as FriendbotApi } from '../friendbot';
import * as jsonrpc from './jsonrpc';
import { Api } from './soroban_rpc';
import { Api } from './api';
import { assembleTransaction } from './transaction';
import {
parseRawSendTransaction,
Expand Down Expand Up @@ -307,14 +307,14 @@ export class Server {
hash: string
): Promise<Api.GetTransactionResponse> {
return this._getTransaction(hash).then((raw) => {
let successInfo: Omit<
let foundInfo: Omit<
Api.GetSuccessfulTransactionResponse,
keyof Api.GetFailedTransactionResponse
keyof Api.GetMissingTransactionResponse
> = {} as any;

if (raw.status === Api.GetTransactionStatus.SUCCESS) {
if (raw.status !== Api.GetTransactionStatus.NOT_FOUND) {
const meta = xdr.TransactionMeta.fromXDR(raw.resultMetaXdr!, 'base64');
successInfo = {
foundInfo = {
ledger: raw.ledger!,
createdAt: raw.createdAt!,
applicationOrder: raw.applicationOrder!,
Expand All @@ -326,7 +326,8 @@ export class Server {
resultXdr: xdr.TransactionResult.fromXDR(raw.resultXdr!, 'base64'),
resultMetaXdr: meta,
...(meta.switch() === 3 &&
meta.v3().sorobanMeta() !== null && {
meta.v3().sorobanMeta() !== null &&
raw.status === Api.GetTransactionStatus.SUCCESS && {
returnValue: meta.v3().sorobanMeta()?.returnValue()
})
};
Expand All @@ -338,7 +339,7 @@ export class Server {
latestLedgerCloseTime: raw.latestLedgerCloseTime,
oldestLedger: raw.oldestLedger,
oldestLedgerCloseTime: raw.oldestLedgerCloseTime,
...successInfo
...foundInfo
};

return result;
Expand Down
2 changes: 1 addition & 1 deletion src/soroban/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
TransactionBuilder
} from 'stellar-base';

import { Api } from './soroban_rpc';
import { Api } from './api';
import { parseRawSimulation } from './parsers';

/**
Expand Down
28 changes: 14 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2271,7 +2271,7 @@ bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9:
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88"
integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==

bn.js@^5.0.0, bn.js@^5.1.1:
bn.js@^5.0.0, bn.js@^5.2.1:
version "5.2.1"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70"
integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==
Expand Down Expand Up @@ -2364,7 +2364,7 @@ browserify-des@^1.0.0:
inherits "^2.0.1"
safe-buffer "^5.1.2"

browserify-rsa@^4.0.0, browserify-rsa@^4.0.1:
browserify-rsa@^4.0.0, browserify-rsa@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.1.0.tgz#b2fd06b5b75ae297f7ce2dc651f918f5be158c8d"
integrity sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==
Expand All @@ -2373,19 +2373,19 @@ browserify-rsa@^4.0.0, browserify-rsa@^4.0.1:
randombytes "^2.0.1"

browserify-sign@^4.0.0:
version "4.2.1"
resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.2.1.tgz#eaf4add46dd54be3bb3b36c0cf15abbeba7956c3"
integrity sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==
version "4.2.2"
resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.2.2.tgz#e78d4b69816d6e3dd1c747e64e9947f9ad79bc7e"
integrity sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg==
dependencies:
bn.js "^5.1.1"
browserify-rsa "^4.0.1"
bn.js "^5.2.1"
browserify-rsa "^4.1.0"
create-hash "^1.2.0"
create-hmac "^1.1.7"
elliptic "^6.5.3"
elliptic "^6.5.4"
inherits "^2.0.4"
parse-asn1 "^5.1.5"
readable-stream "^3.6.0"
safe-buffer "^5.2.0"
parse-asn1 "^5.1.6"
readable-stream "^3.6.2"
safe-buffer "^5.2.1"

browserify-zlib@^0.2.0:
version "0.2.0"
Expand Down Expand Up @@ -3178,7 +3178,7 @@ electron-to-chromium@^1.4.535:
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.566.tgz#5c5ba1d2dc895f4887043f0cc7e61798c7e5919a"
integrity sha512-mv+fAy27uOmTVlUULy15U3DVJ+jg+8iyKH1bpwboCRhtDC69GKf1PPTZvEIhCyDr81RFqfxZJYrbgp933a1vtg==

elliptic@^6.5.3:
elliptic@^6.5.3, elliptic@^6.5.4:
version "6.5.4"
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb"
integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==
Expand Down Expand Up @@ -5834,7 +5834,7 @@ parent-module@^1.0.0:
dependencies:
callsites "^3.0.0"

parse-asn1@^5.0.0, parse-asn1@^5.1.5:
parse-asn1@^5.0.0, parse-asn1@^5.1.6:
version "5.1.6"
resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.6.tgz#385080a3ec13cb62a62d39409cb3e88844cdaed4"
integrity sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==
Expand Down Expand Up @@ -6112,7 +6112,7 @@ readable-stream@^2.0.6:
string_decoder "~1.1.1"
util-deprecate "~1.0.1"

readable-stream@^3.0.2, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.5.0, readable-stream@^3.6.0:
readable-stream@^3.0.2, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.5.0, readable-stream@^3.6.0, readable-stream@^3.6.2:
version "3.6.2"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967"
integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==
Expand Down

0 comments on commit 0a6c4f9

Please sign in to comment.