@stellar/stellar-sdk 13.0.0-beta.1 → 13.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/dist/stellar-sdk-minimal.js +224 -162
- package/dist/stellar-sdk-minimal.min.js +1 -1
- package/dist/stellar-sdk-no-axios.js +224 -162
- package/dist/stellar-sdk-no-axios.min.js +1 -1
- package/dist/stellar-sdk-no-eventsource.js +224 -162
- package/dist/stellar-sdk-no-eventsource.min.js +1 -1
- package/dist/stellar-sdk.js +224 -162
- package/dist/stellar-sdk.min.js +1 -1
- package/lib/contract/assembled_transaction.js +1 -1
- package/lib/contract/sent_transaction.d.ts +2 -3
- package/lib/contract/sent_transaction.js +4 -4
- package/lib/horizon/horizon_axios_client.js +1 -1
- package/lib/horizon/server_api.d.ts +0 -15
- package/lib/horizon/types/assets.d.ts +0 -2
- package/lib/index.d.ts +0 -4
- package/lib/index.js +1 -4
- package/lib/minimal/contract/assembled_transaction.js +1 -1
- package/lib/minimal/contract/sent_transaction.d.ts +2 -3
- package/lib/minimal/contract/sent_transaction.js +4 -4
- package/lib/minimal/horizon/horizon_axios_client.js +1 -1
- package/lib/minimal/horizon/server_api.d.ts +0 -15
- package/lib/minimal/horizon/types/assets.d.ts +0 -2
- package/lib/minimal/index.d.ts +0 -4
- package/lib/minimal/index.js +1 -4
- package/lib/minimal/rpc/api.d.ts +12 -9
- package/lib/minimal/rpc/axios.js +1 -1
- package/lib/minimal/rpc/index.d.ts +1 -1
- package/lib/minimal/rpc/index.js +14 -0
- package/lib/minimal/rpc/parsers.d.ts +1 -1
- package/lib/minimal/rpc/parsers.js +3 -3
- package/lib/minimal/rpc/server.d.ts +41 -3
- package/lib/minimal/rpc/server.js +203 -149
- package/lib/minimal/utils.d.ts +1 -0
- package/lib/minimal/utils.js +7 -0
- package/lib/no-axios/contract/assembled_transaction.js +1 -1
- package/lib/no-axios/contract/sent_transaction.d.ts +2 -3
- package/lib/no-axios/contract/sent_transaction.js +4 -4
- package/lib/no-axios/horizon/horizon_axios_client.js +1 -1
- package/lib/no-axios/horizon/server_api.d.ts +0 -15
- package/lib/no-axios/horizon/types/assets.d.ts +0 -2
- package/lib/no-axios/index.d.ts +0 -4
- package/lib/no-axios/index.js +1 -4
- package/lib/no-axios/rpc/api.d.ts +12 -9
- package/lib/no-axios/rpc/axios.js +1 -1
- package/lib/no-axios/rpc/index.d.ts +1 -1
- package/lib/no-axios/rpc/index.js +14 -0
- package/lib/no-axios/rpc/parsers.d.ts +1 -1
- package/lib/no-axios/rpc/parsers.js +3 -3
- package/lib/no-axios/rpc/server.d.ts +41 -3
- package/lib/no-axios/rpc/server.js +203 -149
- package/lib/no-axios/utils.d.ts +1 -0
- package/lib/no-axios/utils.js +7 -0
- package/lib/no-eventsource/contract/assembled_transaction.js +1 -1
- package/lib/no-eventsource/contract/sent_transaction.d.ts +2 -3
- package/lib/no-eventsource/contract/sent_transaction.js +4 -4
- package/lib/no-eventsource/horizon/horizon_axios_client.js +1 -1
- package/lib/no-eventsource/horizon/server_api.d.ts +0 -15
- package/lib/no-eventsource/horizon/types/assets.d.ts +0 -2
- package/lib/no-eventsource/index.d.ts +0 -4
- package/lib/no-eventsource/index.js +1 -4
- package/lib/no-eventsource/rpc/api.d.ts +12 -9
- package/lib/no-eventsource/rpc/axios.js +1 -1
- package/lib/no-eventsource/rpc/index.d.ts +1 -1
- package/lib/no-eventsource/rpc/index.js +14 -0
- package/lib/no-eventsource/rpc/parsers.d.ts +1 -1
- package/lib/no-eventsource/rpc/parsers.js +3 -3
- package/lib/no-eventsource/rpc/server.d.ts +41 -3
- package/lib/no-eventsource/rpc/server.js +203 -149
- package/lib/no-eventsource/utils.d.ts +1 -0
- package/lib/no-eventsource/utils.js +7 -0
- package/lib/rpc/api.d.ts +12 -9
- package/lib/rpc/axios.js +1 -1
- package/lib/rpc/index.d.ts +1 -1
- package/lib/rpc/index.js +14 -0
- package/lib/rpc/parsers.d.ts +1 -1
- package/lib/rpc/parsers.js +3 -3
- package/lib/rpc/server.d.ts +41 -3
- package/lib/rpc/server.js +203 -149
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +7 -0
- package/package.json +16 -16
package/lib/minimal/utils.d.ts
CHANGED
package/lib/minimal/utils.js
CHANGED
|
@@ -27,5 +27,12 @@ var Utils = exports.Utils = function () {
|
|
|
27
27
|
maxTime = _transaction$timeBoun.maxTime;
|
|
28
28
|
return now >= Number.parseInt(minTime, 10) - gracePeriod && now <= Number.parseInt(maxTime, 10) + gracePeriod;
|
|
29
29
|
}
|
|
30
|
+
}, {
|
|
31
|
+
key: "sleep",
|
|
32
|
+
value: function sleep(ms) {
|
|
33
|
+
return new Promise(function (resolve) {
|
|
34
|
+
return setTimeout(resolve, ms);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
30
37
|
}]);
|
|
31
38
|
}();
|
|
@@ -495,7 +495,7 @@ var AssembledTransaction = exports.AssembledTransaction = function () {
|
|
|
495
495
|
throw new Error("The transaction has not yet been signed. Run `sign` first, or use `signAndSend` instead.");
|
|
496
496
|
case 2:
|
|
497
497
|
_context8.next = 4;
|
|
498
|
-
return _sent_transaction.SentTransaction.init(
|
|
498
|
+
return _sent_transaction.SentTransaction.init(this);
|
|
499
499
|
case 4:
|
|
500
500
|
sent = _context8.sent;
|
|
501
501
|
return _context8.abrupt("return", sent);
|
|
@@ -73,13 +73,12 @@ export declare class SentTransaction<T> {
|
|
|
73
73
|
stackTraceLimit: number;
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
|
-
constructor(
|
|
77
|
-
assembled: AssembledTransaction<T>);
|
|
76
|
+
constructor(assembled: AssembledTransaction<T>);
|
|
78
77
|
/**
|
|
79
78
|
* Initialize a `SentTransaction` from `options` and a `signed`
|
|
80
79
|
* AssembledTransaction. This will also send the transaction to the network.
|
|
81
80
|
*/
|
|
82
|
-
static init: <U>(
|
|
81
|
+
static init: <U>(assembled: AssembledTransaction<U>) => Promise<SentTransaction<U>>;
|
|
83
82
|
private send;
|
|
84
83
|
get result(): T;
|
|
85
84
|
}
|
|
@@ -30,7 +30,7 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
30
30
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
31
31
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
32
32
|
var SentTransaction = exports.SentTransaction = function () {
|
|
33
|
-
function SentTransaction(
|
|
33
|
+
function SentTransaction(assembled) {
|
|
34
34
|
var _this = this,
|
|
35
35
|
_this$assembled$optio2;
|
|
36
36
|
_classCallCheck(this, SentTransaction);
|
|
@@ -128,12 +128,12 @@ _defineProperty(SentTransaction, "Errors", {
|
|
|
128
128
|
}(_wrapNativeSuper(Error))
|
|
129
129
|
});
|
|
130
130
|
_defineProperty(SentTransaction, "init", function () {
|
|
131
|
-
var _ref2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee2(
|
|
131
|
+
var _ref2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee2(assembled) {
|
|
132
132
|
var tx, sent;
|
|
133
133
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
134
134
|
while (1) switch (_context2.prev = _context2.next) {
|
|
135
135
|
case 0:
|
|
136
|
-
tx = new _SentTransaction(
|
|
136
|
+
tx = new _SentTransaction(assembled);
|
|
137
137
|
_context2.next = 3;
|
|
138
138
|
return tx.send();
|
|
139
139
|
case 3:
|
|
@@ -145,7 +145,7 @@ _defineProperty(SentTransaction, "init", function () {
|
|
|
145
145
|
}
|
|
146
146
|
}, _callee2);
|
|
147
147
|
}));
|
|
148
|
-
return function (_x
|
|
148
|
+
return function (_x) {
|
|
149
149
|
return _ref2.apply(this, arguments);
|
|
150
150
|
};
|
|
151
151
|
}());
|
|
@@ -10,7 +10,7 @@ var _urijs = _interopRequireDefault(require("urijs"));
|
|
|
10
10
|
var _httpClient = require("../http-client");
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
13
|
-
var version = exports.version = "13.0.0-
|
|
13
|
+
var version = exports.version = "13.0.0-rc.1";
|
|
14
14
|
var SERVER_TIME_MAP = exports.SERVER_TIME_MAP = {};
|
|
15
15
|
var AxiosClient = exports.AxiosClient = (0, _httpClient.create)({
|
|
16
16
|
headers: {
|
|
@@ -102,21 +102,6 @@ export declare namespace ServerApi {
|
|
|
102
102
|
header_xdr: string;
|
|
103
103
|
base_fee_in_stroops: number;
|
|
104
104
|
base_reserve_in_stroops: number;
|
|
105
|
-
/**
|
|
106
|
-
* @deprecated This will be removed in the next major version: the property
|
|
107
|
-
* no longer exists on the Horizon API
|
|
108
|
-
*/
|
|
109
|
-
transaction_count: number;
|
|
110
|
-
/**
|
|
111
|
-
* @deprecated This will be removed in the next major version: the property
|
|
112
|
-
* no longer exists on the Horizon API
|
|
113
|
-
*/
|
|
114
|
-
base_fee: number;
|
|
115
|
-
/**
|
|
116
|
-
* @deprecated This will be removed in the next major version: the property
|
|
117
|
-
* no longer exists on the Horizon API
|
|
118
|
-
*/
|
|
119
|
-
base_reserve: string;
|
|
120
105
|
effects: CallCollectionFunction<EffectRecord>;
|
|
121
106
|
operations: CallCollectionFunction<OperationRecord>;
|
|
122
107
|
self: CallFunction<LedgerRecord>;
|
|
@@ -10,8 +10,6 @@ export interface AssetRecord extends HorizonApi.BaseResponse {
|
|
|
10
10
|
num_claimable_balances: number;
|
|
11
11
|
num_liquidity_pools: number;
|
|
12
12
|
num_contracts: number;
|
|
13
|
-
num_accounts: number;
|
|
14
|
-
amount: string;
|
|
15
13
|
claimable_balances_amount: string;
|
|
16
14
|
liquidity_pools_amount: string;
|
|
17
15
|
contracts_amount: string;
|
package/lib/no-axios/index.d.ts
CHANGED
|
@@ -16,10 +16,6 @@ export * as Horizon from './horizon';
|
|
|
16
16
|
* import { Server } from '@stellar/stellar-sdk/rpc';
|
|
17
17
|
*/
|
|
18
18
|
export * as rpc from './rpc';
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated Use `rpc` instead
|
|
21
|
-
*/
|
|
22
|
-
export * as SorobanRpc from './rpc';
|
|
23
19
|
/**
|
|
24
20
|
* Tools for interacting with smart contracts, such as `Client`, `Spec`, and
|
|
25
21
|
* `AssembledTransaction`. You can import these from the `/contract`
|
package/lib/no-axios/index.js
CHANGED
|
@@ -13,7 +13,6 @@ var _exportNames = {
|
|
|
13
13
|
Friendbot: true,
|
|
14
14
|
Horizon: true,
|
|
15
15
|
rpc: true,
|
|
16
|
-
SorobanRpc: true,
|
|
17
16
|
contract: true
|
|
18
17
|
};
|
|
19
18
|
Object.defineProperty(exports, "Config", {
|
|
@@ -22,7 +21,7 @@ Object.defineProperty(exports, "Config", {
|
|
|
22
21
|
return _config.Config;
|
|
23
22
|
}
|
|
24
23
|
});
|
|
25
|
-
exports.StellarToml = exports.
|
|
24
|
+
exports.StellarToml = exports.Horizon = exports.Friendbot = exports.Federation = void 0;
|
|
26
25
|
Object.defineProperty(exports, "Utils", {
|
|
27
26
|
enumerable: true,
|
|
28
27
|
get: function get() {
|
|
@@ -55,9 +54,7 @@ exports.Friendbot = _Friendbot;
|
|
|
55
54
|
var _Horizon = _interopRequireWildcard(require("./horizon"));
|
|
56
55
|
exports.Horizon = _Horizon;
|
|
57
56
|
var _rpc = _interopRequireWildcard(require("./rpc"));
|
|
58
|
-
var _SorobanRpc = _rpc;
|
|
59
57
|
exports.rpc = _rpc;
|
|
60
|
-
exports.SorobanRpc = _rpc;
|
|
61
58
|
var _contract = _interopRequireWildcard(require("./contract"));
|
|
62
59
|
exports.contract = _contract;
|
|
63
60
|
var _stellarBase = require("@stellar/stellar-base");
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { Contract, SorobanDataBuilder, xdr } from '@stellar/stellar-base';
|
|
2
2
|
export declare namespace Api {
|
|
3
|
-
export interface Cost {
|
|
4
|
-
cpuInsns: string;
|
|
5
|
-
memBytes: string;
|
|
6
|
-
}
|
|
7
3
|
export interface GetHealthResponse {
|
|
8
4
|
status: 'healthy';
|
|
9
5
|
}
|
|
@@ -56,6 +52,7 @@ export declare namespace Api {
|
|
|
56
52
|
export type GetTransactionResponse = GetSuccessfulTransactionResponse | GetFailedTransactionResponse | GetMissingTransactionResponse;
|
|
57
53
|
interface GetAnyTransactionResponse {
|
|
58
54
|
status: GetTransactionStatus;
|
|
55
|
+
txHash: string;
|
|
59
56
|
latestLedger: number;
|
|
60
57
|
latestLedgerCloseTime: number;
|
|
61
58
|
oldestLedger: number;
|
|
@@ -93,13 +90,14 @@ export declare namespace Api {
|
|
|
93
90
|
latestLedgerCloseTime: number;
|
|
94
91
|
oldestLedger: number;
|
|
95
92
|
oldestLedgerCloseTime: number;
|
|
93
|
+
txHash: string;
|
|
96
94
|
applicationOrder?: number;
|
|
97
95
|
feeBump?: boolean;
|
|
96
|
+
ledger?: number;
|
|
97
|
+
createdAt?: number;
|
|
98
98
|
envelopeXdr?: string;
|
|
99
99
|
resultXdr?: string;
|
|
100
100
|
resultMetaXdr?: string;
|
|
101
|
-
ledger?: number;
|
|
102
|
-
createdAt?: number;
|
|
103
101
|
diagnosticEventsXdr?: string[];
|
|
104
102
|
}
|
|
105
103
|
export interface GetTransactionsRequest {
|
|
@@ -113,6 +111,7 @@ export declare namespace Api {
|
|
|
113
111
|
createdAt: number;
|
|
114
112
|
applicationOrder: number;
|
|
115
113
|
feeBump: boolean;
|
|
114
|
+
txHash: string;
|
|
116
115
|
envelopeXdr?: string;
|
|
117
116
|
resultXdr?: string;
|
|
118
117
|
resultMetaXdr?: string;
|
|
@@ -124,6 +123,7 @@ export declare namespace Api {
|
|
|
124
123
|
createdAt: number;
|
|
125
124
|
applicationOrder: number;
|
|
126
125
|
feeBump: boolean;
|
|
126
|
+
txHash: string;
|
|
127
127
|
envelopeXdr: xdr.TransactionEnvelope;
|
|
128
128
|
resultXdr: xdr.TransactionResult;
|
|
129
129
|
resultMetaXdr: xdr.TransactionMeta;
|
|
@@ -170,6 +170,7 @@ export declare namespace Api {
|
|
|
170
170
|
type: EventType;
|
|
171
171
|
ledger: number;
|
|
172
172
|
ledgerClosedAt: string;
|
|
173
|
+
cursor: string;
|
|
173
174
|
pagingToken: string;
|
|
174
175
|
inSuccessfulContractCall: boolean;
|
|
175
176
|
txHash: string;
|
|
@@ -255,7 +256,6 @@ export declare namespace Api {
|
|
|
255
256
|
export interface SimulateTransactionSuccessResponse extends BaseSimulateTransactionResponse {
|
|
256
257
|
transactionData: SorobanDataBuilder;
|
|
257
258
|
minResourceFee: string;
|
|
258
|
-
cost: Cost;
|
|
259
259
|
/** present only for invocation simulation */
|
|
260
260
|
result?: SimulateHostFunctionResult;
|
|
261
261
|
/** State Difference information */
|
|
@@ -304,7 +304,6 @@ export declare namespace Api {
|
|
|
304
304
|
* invokeHostFunctionOperation is supported per transaction.
|
|
305
305
|
* */
|
|
306
306
|
results?: RawSimulateHostFunctionResult[];
|
|
307
|
-
cost?: Cost;
|
|
308
307
|
/** Present if succeeded but has expired ledger entries */
|
|
309
308
|
restorePreamble?: {
|
|
310
309
|
minResourceFee: string;
|
|
@@ -315,8 +314,12 @@ export declare namespace Api {
|
|
|
315
314
|
}
|
|
316
315
|
export interface GetVersionInfoResponse {
|
|
317
316
|
version: string;
|
|
317
|
+
commitHash: string;
|
|
318
|
+
buildTimestamp: string;
|
|
319
|
+
captiveCoreVersion: string;
|
|
320
|
+
protocolVersion: number;
|
|
318
321
|
commit_hash: string;
|
|
319
|
-
|
|
322
|
+
build_timestamp: string;
|
|
320
323
|
captive_core_version: string;
|
|
321
324
|
protocol_version: number;
|
|
322
325
|
}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.default = exports.AxiosClient = void 0;
|
|
7
7
|
var _httpClient = require("../http-client");
|
|
8
|
-
var version = exports.version = "13.0.0-
|
|
8
|
+
var version = exports.version = "13.0.0-rc.1";
|
|
9
9
|
var AxiosClient = exports.AxiosClient = (0, _httpClient.create)({
|
|
10
10
|
headers: {
|
|
11
11
|
'X-Client-Name': 'js-soroban-client',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @module rpc */
|
|
2
2
|
export * from "./api";
|
|
3
|
-
export { RpcServer as Server, Durability } from "./server";
|
|
3
|
+
export { RpcServer as Server, BasicSleepStrategy, LinearSleepStrategy, Durability } from "./server";
|
|
4
4
|
export { default as AxiosClient } from "./axios";
|
|
5
5
|
export { parseRawSimulation, parseRawEvents } from "./parsers";
|
|
6
6
|
export * from "./transaction";
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
Server: true,
|
|
8
|
+
BasicSleepStrategy: true,
|
|
9
|
+
LinearSleepStrategy: true,
|
|
8
10
|
Durability: true,
|
|
9
11
|
AxiosClient: true,
|
|
10
12
|
parseRawSimulation: true,
|
|
@@ -16,12 +18,24 @@ Object.defineProperty(exports, "AxiosClient", {
|
|
|
16
18
|
return _axios.default;
|
|
17
19
|
}
|
|
18
20
|
});
|
|
21
|
+
Object.defineProperty(exports, "BasicSleepStrategy", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _server.BasicSleepStrategy;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
19
27
|
Object.defineProperty(exports, "Durability", {
|
|
20
28
|
enumerable: true,
|
|
21
29
|
get: function get() {
|
|
22
30
|
return _server.Durability;
|
|
23
31
|
}
|
|
24
32
|
});
|
|
33
|
+
Object.defineProperty(exports, "LinearSleepStrategy", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function get() {
|
|
36
|
+
return _server.LinearSleepStrategy;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
25
39
|
Object.defineProperty(exports, "Server", {
|
|
26
40
|
enumerable: true,
|
|
27
41
|
get: function get() {
|
|
@@ -8,7 +8,7 @@ import { Api } from './api';
|
|
|
8
8
|
* @returns {Api.SendTransactionResponse} transaction response parsed from the Soroban RPC server's response
|
|
9
9
|
*/
|
|
10
10
|
export declare function parseRawSendTransaction(raw: Api.RawSendTransactionResponse): Api.SendTransactionResponse;
|
|
11
|
-
export declare function parseTransactionInfo(raw: Api.RawTransactionInfo | Api.RawGetTransactionResponse): Omit<Api.TransactionInfo, 'status'>;
|
|
11
|
+
export declare function parseTransactionInfo(raw: Api.RawTransactionInfo | Api.RawGetTransactionResponse): Omit<Api.TransactionInfo, 'status' | 'txHash'>;
|
|
12
12
|
export declare function parseRawTransactions(r: Api.RawTransactionInfo): Api.TransactionInfo;
|
|
13
13
|
/**
|
|
14
14
|
* Parse and return the retrieved events, if any, from a raw response from a Soroban RPC server.
|
|
@@ -57,7 +57,8 @@ function parseTransactionInfo(raw) {
|
|
|
57
57
|
}
|
|
58
58
|
function parseRawTransactions(r) {
|
|
59
59
|
return _objectSpread({
|
|
60
|
-
status: r.status
|
|
60
|
+
status: r.status,
|
|
61
|
+
txHash: r.txHash
|
|
61
62
|
}, parseTransactionInfo(r));
|
|
62
63
|
}
|
|
63
64
|
function parseRawEvents(raw) {
|
|
@@ -100,8 +101,7 @@ function parseSuccessful(sim, partial) {
|
|
|
100
101
|
var _sim$results$length, _sim$results, _sim$stateChanges$len, _sim$stateChanges, _sim$stateChanges2;
|
|
101
102
|
var success = _objectSpread(_objectSpread(_objectSpread({}, partial), {}, {
|
|
102
103
|
transactionData: new _stellarBase.SorobanDataBuilder(sim.transactionData),
|
|
103
|
-
minResourceFee: sim.minResourceFee
|
|
104
|
-
cost: sim.cost
|
|
104
|
+
minResourceFee: sim.minResourceFee
|
|
105
105
|
}, ((_sim$results$length = (_sim$results = sim.results) === null || _sim$results === void 0 ? void 0 : _sim$results.length) !== null && _sim$results$length !== void 0 ? _sim$results$length : 0 > 0) && {
|
|
106
106
|
result: sim.results.map(function (row) {
|
|
107
107
|
var _row$auth;
|
|
@@ -48,6 +48,10 @@ export declare namespace RpcServer {
|
|
|
48
48
|
cursor?: string;
|
|
49
49
|
limit?: number;
|
|
50
50
|
}
|
|
51
|
+
interface PollingOptions {
|
|
52
|
+
attempts?: number;
|
|
53
|
+
sleepStrategy?: SleepStrategy;
|
|
54
|
+
}
|
|
51
55
|
interface ResourceLeeway {
|
|
52
56
|
cpuInstructions: number;
|
|
53
57
|
}
|
|
@@ -57,6 +61,13 @@ export declare namespace RpcServer {
|
|
|
57
61
|
headers?: Record<string, string>;
|
|
58
62
|
}
|
|
59
63
|
}
|
|
64
|
+
export declare const BasicSleepStrategy: SleepStrategy;
|
|
65
|
+
export declare const LinearSleepStrategy: SleepStrategy;
|
|
66
|
+
/**
|
|
67
|
+
* A function that returns the number of *milliseconds* to sleep
|
|
68
|
+
* on a given `iter`ation.
|
|
69
|
+
*/
|
|
70
|
+
export type SleepStrategy = (iter: number) => number;
|
|
60
71
|
/**
|
|
61
72
|
* Handles the network connection to a Soroban RPC instance, exposing an
|
|
62
73
|
* interface for requests to that instance.
|
|
@@ -220,6 +231,32 @@ export declare class RpcServer {
|
|
|
220
231
|
*/
|
|
221
232
|
getLedgerEntries(...keys: xdr.LedgerKey[]): Promise<Api.GetLedgerEntriesResponse>;
|
|
222
233
|
_getLedgerEntries(...keys: xdr.LedgerKey[]): Promise<Api.RawGetLedgerEntriesResponse>;
|
|
234
|
+
/**
|
|
235
|
+
* Poll for a particular transaction with certain parameters.
|
|
236
|
+
*
|
|
237
|
+
* After submitting a transaction, clients can use this to poll for
|
|
238
|
+
* transaction completion and return a definitive state of success or failure.
|
|
239
|
+
*
|
|
240
|
+
* @param {string} hash the transaction you're polling for
|
|
241
|
+
* @param {number} [opts.attempts] (optional) the number of attempts to make
|
|
242
|
+
* before returning the last-seen status. By default or on invalid inputs,
|
|
243
|
+
* try 5 times.
|
|
244
|
+
* @param {SleepStrategy} [opts.sleepStrategy] (optional) the amount of time
|
|
245
|
+
* to wait for between each attempt. By default, sleep for 1 second between
|
|
246
|
+
* each attempt.
|
|
247
|
+
*
|
|
248
|
+
* @return {Promise<Api.GetTransactionsResponse>} the response after a "found"
|
|
249
|
+
* response (which may be success or failure) or the last response obtained
|
|
250
|
+
* after polling the maximum number of specified attempts.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* const h = "c4515e3bdc0897f21cc5dbec8c82cf0a936d4741cb74a8e158eb51b9fb00411a";
|
|
254
|
+
* const txStatus = await server.pollTransaction(h, {
|
|
255
|
+
* attempts: 100, // I'm a maniac
|
|
256
|
+
* sleepStrategy: rpc.LinearSleepStrategy
|
|
257
|
+
* }); // this will take 5,050 seconds to complete
|
|
258
|
+
*/
|
|
259
|
+
pollTransaction(hash: string, opts?: RpcServer.PollingOptions): Promise<Api.GetTransactionResponse>;
|
|
223
260
|
/**
|
|
224
261
|
* Fetch the details of a submitted transaction.
|
|
225
262
|
*
|
|
@@ -227,10 +264,11 @@ export declare class RpcServer {
|
|
|
227
264
|
* transaction has completed.
|
|
228
265
|
*
|
|
229
266
|
* @param {string} hash Hex-encoded hash of the transaction to check
|
|
230
|
-
* @returns {Promise<Api.GetTransactionResponse>} The status,
|
|
231
|
-
*
|
|
267
|
+
* @returns {Promise<Api.GetTransactionResponse>} The status, result, and
|
|
268
|
+
* other details about the transaction
|
|
232
269
|
*
|
|
233
|
-
* @see
|
|
270
|
+
* @see
|
|
271
|
+
* {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getTransaction | getTransaction docs}
|
|
234
272
|
*
|
|
235
273
|
* @example
|
|
236
274
|
* const transactionHash = "c4515e3bdc0897f21cc5dbec8c82cf0a936d4741cb74a8e158eb51b9fb00411a";
|