@stellar/stellar-sdk 11.0.0
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 +1275 -0
- package/LICENSE +228 -0
- package/README.md +274 -0
- package/dist/stellar-sdk.js +56470 -0
- package/dist/stellar-sdk.min.js +2 -0
- package/dist/stellar-sdk.min.js.LICENSE.txt +71 -0
- package/lib/browser.d.ts +6 -0
- package/lib/browser.js +37 -0
- package/lib/config.d.ts +52 -0
- package/lib/config.js +49 -0
- package/lib/contract_spec.d.ts +130 -0
- package/lib/contract_spec.js +549 -0
- package/lib/errors.d.ts +59 -0
- package/lib/errors.js +105 -0
- package/lib/federation/api.d.ts +11 -0
- package/lib/federation/api.js +7 -0
- package/lib/federation/index.d.ts +2 -0
- package/lib/federation/index.js +24 -0
- package/lib/federation/server.d.ts +118 -0
- package/lib/federation/server.js +253 -0
- package/lib/friendbot/index.d.ts +5 -0
- package/lib/friendbot/index.js +7 -0
- package/lib/horizon/account_call_builder.d.ts +55 -0
- package/lib/horizon/account_call_builder.js +64 -0
- package/lib/horizon/account_response.d.ts +58 -0
- package/lib/horizon/account_response.js +50 -0
- package/lib/horizon/assets_call_builder.d.ts +27 -0
- package/lib/horizon/assets_call_builder.js +45 -0
- package/lib/horizon/call_builder.d.ts +128 -0
- package/lib/horizon/call_builder.js +360 -0
- package/lib/horizon/claimable_balances_call_builder.d.ts +49 -0
- package/lib/horizon/claimable_balances_call_builder.js +58 -0
- package/lib/horizon/effect_call_builder.d.ts +53 -0
- package/lib/horizon/effect_call_builder.js +58 -0
- package/lib/horizon/friendbot_builder.d.ts +5 -0
- package/lib/horizon/friendbot_builder.js +33 -0
- package/lib/horizon/horizon_api.d.ts +523 -0
- package/lib/horizon/horizon_api.js +96 -0
- package/lib/horizon/horizon_axios_client.d.ts +30 -0
- package/lib/horizon/horizon_axios_client.js +48 -0
- package/lib/horizon/index.d.ts +7 -0
- package/lib/horizon/index.js +78 -0
- package/lib/horizon/ledger_call_builder.d.ts +22 -0
- package/lib/horizon/ledger_call_builder.js +39 -0
- package/lib/horizon/liquidity_pool_call_builder.d.ts +38 -0
- package/lib/horizon/liquidity_pool_call_builder.js +61 -0
- package/lib/horizon/offer_call_builder.d.ts +64 -0
- package/lib/horizon/offer_call_builder.js +81 -0
- package/lib/horizon/operation_call_builder.d.ts +68 -0
- package/lib/horizon/operation_call_builder.js +71 -0
- package/lib/horizon/orderbook_call_builder.d.ts +16 -0
- package/lib/horizon/orderbook_call_builder.js +46 -0
- package/lib/horizon/path_call_builder.d.ts +31 -0
- package/lib/horizon/path_call_builder.js +42 -0
- package/lib/horizon/payment_call_builder.d.ts +36 -0
- package/lib/horizon/payment_call_builder.js +48 -0
- package/lib/horizon/server.d.ts +361 -0
- package/lib/horizon/server.js +507 -0
- package/lib/horizon/server_api.d.ts +279 -0
- package/lib/horizon/server_api.js +19 -0
- package/lib/horizon/strict_receive_path_call_builder.d.ts +34 -0
- package/lib/horizon/strict_receive_path_call_builder.js +51 -0
- package/lib/horizon/strict_send_path_call_builder.d.ts +34 -0
- package/lib/horizon/strict_send_path_call_builder.js +51 -0
- package/lib/horizon/trade_aggregation_call_builder.d.ts +48 -0
- package/lib/horizon/trade_aggregation_call_builder.js +82 -0
- package/lib/horizon/trades_call_builder.d.ts +50 -0
- package/lib/horizon/trades_call_builder.js +74 -0
- package/lib/horizon/transaction_call_builder.d.ts +58 -0
- package/lib/horizon/transaction_call_builder.js +66 -0
- package/lib/horizon/types/account.d.ts +5 -0
- package/lib/horizon/types/account.js +5 -0
- package/lib/horizon/types/assets.d.ts +19 -0
- package/lib/horizon/types/assets.js +5 -0
- package/lib/horizon/types/effects.d.ts +285 -0
- package/lib/horizon/types/effects.js +62 -0
- package/lib/horizon/types/offer.d.ts +20 -0
- package/lib/horizon/types/offer.js +5 -0
- package/lib/horizon/types/trade.d.ts +13 -0
- package/lib/horizon/types/trade.js +5 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.js +79 -0
- package/lib/soroban/api.d.ts +247 -0
- package/lib/soroban/api.js +32 -0
- package/lib/soroban/axios.d.ts +3 -0
- package/lib/soroban/axios.js +16 -0
- package/lib/soroban/browser.d.ts +6 -0
- package/lib/soroban/browser.js +37 -0
- package/lib/soroban/index.d.ts +8 -0
- package/lib/soroban/index.js +72 -0
- package/lib/soroban/jsonrpc.d.ts +33 -0
- package/lib/soroban/jsonrpc.js +93 -0
- package/lib/soroban/parsers.d.ts +17 -0
- package/lib/soroban/parsers.js +111 -0
- package/lib/soroban/server.d.ts +427 -0
- package/lib/soroban/server.js +598 -0
- package/lib/soroban/transaction.d.ts +20 -0
- package/lib/soroban/transaction.js +55 -0
- package/lib/soroban/utils.d.ts +1 -0
- package/lib/soroban/utils.js +9 -0
- package/lib/stellartoml/index.d.ts +121 -0
- package/lib/stellartoml/index.js +78 -0
- package/lib/utils.d.ts +12 -0
- package/lib/utils.js +32 -0
- package/lib/webauth/errors.d.ts +4 -0
- package/lib/webauth/errors.js +37 -0
- package/lib/webauth/index.d.ts +2 -0
- package/lib/webauth/index.js +27 -0
- package/lib/webauth/utils.d.ts +294 -0
- package/lib/webauth/utils.js +332 -0
- package/package.json +153 -0
- package/types/dom-monkeypatch.d.ts +126 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseEffectRecord } from "./effects";
|
|
2
|
+
export interface Trade extends BaseEffectRecord {
|
|
3
|
+
seller: string;
|
|
4
|
+
offer_id: number | string;
|
|
5
|
+
bought_amount: string;
|
|
6
|
+
bought_asset_type: string;
|
|
7
|
+
bought_asset_code: string;
|
|
8
|
+
bought_asset_issuer: string;
|
|
9
|
+
sold_amount: string;
|
|
10
|
+
sold_asset_type: string;
|
|
11
|
+
sold_asset_code: string;
|
|
12
|
+
sold_asset_issuer: string;
|
|
13
|
+
}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference path="../types/dom-monkeypatch.d.ts" />
|
|
2
|
+
export * from './errors';
|
|
3
|
+
export { Config } from './config';
|
|
4
|
+
export { Utils } from './utils';
|
|
5
|
+
export * as StellarToml from './stellartoml';
|
|
6
|
+
export * as Federation from './federation';
|
|
7
|
+
export * as WebAuth from './webauth';
|
|
8
|
+
export * as Friendbot from './friendbot';
|
|
9
|
+
export * as Horizon from './horizon';
|
|
10
|
+
export * as SorobanRpc from './soroban';
|
|
11
|
+
export { ContractSpec } from './contract_spec';
|
|
12
|
+
export * from '@stellar/stellar-base';
|
|
13
|
+
declare const _default: any;
|
|
14
|
+
export default _default;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
var _exportNames = {
|
|
8
|
+
Config: true,
|
|
9
|
+
Utils: true,
|
|
10
|
+
StellarToml: true,
|
|
11
|
+
Federation: true,
|
|
12
|
+
WebAuth: true,
|
|
13
|
+
Friendbot: true,
|
|
14
|
+
Horizon: true,
|
|
15
|
+
SorobanRpc: true,
|
|
16
|
+
ContractSpec: true
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "Config", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _config.Config;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "ContractSpec", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _contract_spec.ContractSpec;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
exports.StellarToml = exports.SorobanRpc = exports.Horizon = exports.Friendbot = exports.Federation = void 0;
|
|
31
|
+
Object.defineProperty(exports, "Utils", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function get() {
|
|
34
|
+
return _utils.Utils;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
exports.default = exports.WebAuth = void 0;
|
|
38
|
+
var _errors = require("./errors");
|
|
39
|
+
Object.keys(_errors).forEach(function (key) {
|
|
40
|
+
if (key === "default" || key === "__esModule") return;
|
|
41
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
42
|
+
if (key in exports && exports[key] === _errors[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function get() {
|
|
46
|
+
return _errors[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _config = require("./config");
|
|
51
|
+
var _utils = require("./utils");
|
|
52
|
+
var _StellarToml = _interopRequireWildcard(require("./stellartoml"));
|
|
53
|
+
exports.StellarToml = _StellarToml;
|
|
54
|
+
var _Federation = _interopRequireWildcard(require("./federation"));
|
|
55
|
+
exports.Federation = _Federation;
|
|
56
|
+
var _WebAuth = _interopRequireWildcard(require("./webauth"));
|
|
57
|
+
exports.WebAuth = _WebAuth;
|
|
58
|
+
var _Friendbot = _interopRequireWildcard(require("./friendbot"));
|
|
59
|
+
exports.Friendbot = _Friendbot;
|
|
60
|
+
var _Horizon = _interopRequireWildcard(require("./horizon"));
|
|
61
|
+
exports.Horizon = _Horizon;
|
|
62
|
+
var _SorobanRpc = _interopRequireWildcard(require("./soroban"));
|
|
63
|
+
exports.SorobanRpc = _SorobanRpc;
|
|
64
|
+
var _contract_spec = require("./contract_spec");
|
|
65
|
+
var _stellarBase = require("@stellar/stellar-base");
|
|
66
|
+
Object.keys(_stellarBase).forEach(function (key) {
|
|
67
|
+
if (key === "default" || key === "__esModule") return;
|
|
68
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
69
|
+
if (key in exports && exports[key] === _stellarBase[key]) return;
|
|
70
|
+
Object.defineProperty(exports, key, {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function get() {
|
|
73
|
+
return _stellarBase[key];
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
78
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
79
|
+
var _default = exports.default = module.exports;
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { AssetType, Contract, SorobanDataBuilder, xdr } from '@stellar/stellar-base';
|
|
2
|
+
/** @namespace Api */
|
|
3
|
+
export declare namespace Api {
|
|
4
|
+
export interface Balance {
|
|
5
|
+
asset_type: AssetType.credit4 | AssetType.credit12;
|
|
6
|
+
asset_code: string;
|
|
7
|
+
asset_issuer: string;
|
|
8
|
+
classic: string;
|
|
9
|
+
smart: string;
|
|
10
|
+
}
|
|
11
|
+
export interface Cost {
|
|
12
|
+
cpuInsns: string;
|
|
13
|
+
memBytes: string;
|
|
14
|
+
}
|
|
15
|
+
export interface GetHealthResponse {
|
|
16
|
+
status: 'healthy';
|
|
17
|
+
}
|
|
18
|
+
export interface LedgerEntryResult {
|
|
19
|
+
lastModifiedLedgerSeq?: number;
|
|
20
|
+
key: xdr.LedgerKey;
|
|
21
|
+
val: xdr.LedgerEntryData;
|
|
22
|
+
liveUntilLedgerSeq?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface RawLedgerEntryResult {
|
|
25
|
+
lastModifiedLedgerSeq?: number;
|
|
26
|
+
/** a base-64 encoded {@link xdr.LedgerKey} instance */
|
|
27
|
+
key: string;
|
|
28
|
+
/** a base-64 encoded {@link xdr.LedgerEntryData} instance */
|
|
29
|
+
xdr: string;
|
|
30
|
+
/** optional, a future ledger number upon which this entry will expire
|
|
31
|
+
* based on https://github.com/stellar/soroban-tools/issues/1010
|
|
32
|
+
*/
|
|
33
|
+
liveUntilLedgerSeq?: number;
|
|
34
|
+
}
|
|
35
|
+
/** An XDR-parsed version of {@link RawLedgerEntryResult} */
|
|
36
|
+
export interface GetLedgerEntriesResponse {
|
|
37
|
+
entries: LedgerEntryResult[];
|
|
38
|
+
latestLedger: number;
|
|
39
|
+
}
|
|
40
|
+
/** @see https://soroban.stellar.org/api/methods/getLedgerEntries */
|
|
41
|
+
export interface RawGetLedgerEntriesResponse {
|
|
42
|
+
entries?: RawLedgerEntryResult[];
|
|
43
|
+
latestLedger: number;
|
|
44
|
+
}
|
|
45
|
+
/** @see https://soroban.stellar.org/api/methods/getNetwork */
|
|
46
|
+
export interface GetNetworkResponse {
|
|
47
|
+
friendbotUrl?: string;
|
|
48
|
+
passphrase: string;
|
|
49
|
+
protocolVersion: string;
|
|
50
|
+
}
|
|
51
|
+
/** @see https://soroban.stellar.org/api/methods/getLatestLedger */
|
|
52
|
+
export interface GetLatestLedgerResponse {
|
|
53
|
+
id: string;
|
|
54
|
+
sequence: number;
|
|
55
|
+
protocolVersion: string;
|
|
56
|
+
}
|
|
57
|
+
export enum GetTransactionStatus {
|
|
58
|
+
SUCCESS = "SUCCESS",
|
|
59
|
+
NOT_FOUND = "NOT_FOUND",
|
|
60
|
+
FAILED = "FAILED"
|
|
61
|
+
}
|
|
62
|
+
/** @see https://soroban.stellar.org/api/methods/getTransaction */
|
|
63
|
+
export type GetTransactionResponse = GetSuccessfulTransactionResponse | GetFailedTransactionResponse | GetMissingTransactionResponse;
|
|
64
|
+
interface GetAnyTransactionResponse {
|
|
65
|
+
status: GetTransactionStatus;
|
|
66
|
+
latestLedger: number;
|
|
67
|
+
latestLedgerCloseTime: number;
|
|
68
|
+
oldestLedger: number;
|
|
69
|
+
oldestLedgerCloseTime: number;
|
|
70
|
+
}
|
|
71
|
+
export interface GetMissingTransactionResponse extends GetAnyTransactionResponse {
|
|
72
|
+
status: GetTransactionStatus.NOT_FOUND;
|
|
73
|
+
}
|
|
74
|
+
export interface GetFailedTransactionResponse extends GetAnyTransactionResponse {
|
|
75
|
+
status: GetTransactionStatus.FAILED;
|
|
76
|
+
ledger: number;
|
|
77
|
+
createdAt: number;
|
|
78
|
+
applicationOrder: number;
|
|
79
|
+
feeBump: boolean;
|
|
80
|
+
envelopeXdr: xdr.TransactionEnvelope;
|
|
81
|
+
resultXdr: xdr.TransactionResult;
|
|
82
|
+
resultMetaXdr: xdr.TransactionMeta;
|
|
83
|
+
}
|
|
84
|
+
export interface GetSuccessfulTransactionResponse extends GetAnyTransactionResponse {
|
|
85
|
+
status: GetTransactionStatus.SUCCESS;
|
|
86
|
+
ledger: number;
|
|
87
|
+
createdAt: number;
|
|
88
|
+
applicationOrder: number;
|
|
89
|
+
feeBump: boolean;
|
|
90
|
+
envelopeXdr: xdr.TransactionEnvelope;
|
|
91
|
+
resultXdr: xdr.TransactionResult;
|
|
92
|
+
resultMetaXdr: xdr.TransactionMeta;
|
|
93
|
+
returnValue?: xdr.ScVal;
|
|
94
|
+
}
|
|
95
|
+
export interface RawGetTransactionResponse {
|
|
96
|
+
status: GetTransactionStatus;
|
|
97
|
+
latestLedger: number;
|
|
98
|
+
latestLedgerCloseTime: number;
|
|
99
|
+
oldestLedger: number;
|
|
100
|
+
oldestLedgerCloseTime: number;
|
|
101
|
+
applicationOrder?: number;
|
|
102
|
+
feeBump?: boolean;
|
|
103
|
+
envelopeXdr?: string;
|
|
104
|
+
resultXdr?: string;
|
|
105
|
+
resultMetaXdr?: string;
|
|
106
|
+
ledger?: number;
|
|
107
|
+
createdAt?: number;
|
|
108
|
+
}
|
|
109
|
+
export type EventType = 'contract' | 'system' | 'diagnostic';
|
|
110
|
+
export interface EventFilter {
|
|
111
|
+
type?: EventType;
|
|
112
|
+
contractIds?: string[];
|
|
113
|
+
topics?: string[][];
|
|
114
|
+
}
|
|
115
|
+
export interface GetEventsResponse {
|
|
116
|
+
latestLedger: number;
|
|
117
|
+
events: EventResponse[];
|
|
118
|
+
}
|
|
119
|
+
interface EventResponse extends BaseEventResponse {
|
|
120
|
+
contractId?: Contract;
|
|
121
|
+
topic: xdr.ScVal[];
|
|
122
|
+
value: xdr.ScVal;
|
|
123
|
+
}
|
|
124
|
+
export interface RawGetEventsResponse {
|
|
125
|
+
latestLedger: number;
|
|
126
|
+
events: RawEventResponse[];
|
|
127
|
+
}
|
|
128
|
+
interface BaseEventResponse {
|
|
129
|
+
id: string;
|
|
130
|
+
type: EventType;
|
|
131
|
+
ledger: number;
|
|
132
|
+
ledgerClosedAt: string;
|
|
133
|
+
pagingToken: string;
|
|
134
|
+
inSuccessfulContractCall: boolean;
|
|
135
|
+
}
|
|
136
|
+
export interface RawEventResponse extends BaseEventResponse {
|
|
137
|
+
contractId: string;
|
|
138
|
+
topic: string[];
|
|
139
|
+
value: string;
|
|
140
|
+
}
|
|
141
|
+
export interface RequestAirdropResponse {
|
|
142
|
+
transaction_id: string;
|
|
143
|
+
}
|
|
144
|
+
export type SendTransactionStatus = 'PENDING' | 'DUPLICATE' | 'TRY_AGAIN_LATER' | 'ERROR';
|
|
145
|
+
export interface SendTransactionResponse extends BaseSendTransactionResponse {
|
|
146
|
+
errorResult?: xdr.TransactionResult;
|
|
147
|
+
}
|
|
148
|
+
export interface RawSendTransactionResponse extends BaseSendTransactionResponse {
|
|
149
|
+
/**
|
|
150
|
+
* This is a base64-encoded instance of {@link xdr.TransactionResult}, set
|
|
151
|
+
* only when `status` is `"ERROR"`.
|
|
152
|
+
*
|
|
153
|
+
* It contains details on why the network rejected the transaction.
|
|
154
|
+
*/
|
|
155
|
+
errorResultXdr?: string;
|
|
156
|
+
}
|
|
157
|
+
export interface BaseSendTransactionResponse {
|
|
158
|
+
status: SendTransactionStatus;
|
|
159
|
+
hash: string;
|
|
160
|
+
latestLedger: number;
|
|
161
|
+
latestLedgerCloseTime: number;
|
|
162
|
+
}
|
|
163
|
+
export interface SimulateHostFunctionResult {
|
|
164
|
+
auth: xdr.SorobanAuthorizationEntry[];
|
|
165
|
+
retval: xdr.ScVal;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Simplifies {@link RawSimulateTransactionResponse} into separate interfaces
|
|
169
|
+
* based on status:
|
|
170
|
+
* - on success, this includes all fields, though `result` is only present
|
|
171
|
+
* if an invocation was simulated (since otherwise there's nothing to
|
|
172
|
+
* "resultify")
|
|
173
|
+
* - if there was an expiration error, this includes error and restoration
|
|
174
|
+
* fields
|
|
175
|
+
* - for all other errors, this only includes error fields
|
|
176
|
+
*
|
|
177
|
+
* @see https://soroban.stellar.org/api/methods/simulateTransaction#returns
|
|
178
|
+
*/
|
|
179
|
+
export type SimulateTransactionResponse = SimulateTransactionSuccessResponse | SimulateTransactionRestoreResponse | SimulateTransactionErrorResponse;
|
|
180
|
+
export interface BaseSimulateTransactionResponse {
|
|
181
|
+
/** always present: the JSON-RPC request ID */
|
|
182
|
+
id: string;
|
|
183
|
+
/** always present: the LCL known to the server when responding */
|
|
184
|
+
latestLedger: number;
|
|
185
|
+
/**
|
|
186
|
+
* The field is always present, but may be empty in cases where:
|
|
187
|
+
* - you didn't simulate an invocation or
|
|
188
|
+
* - there were no events
|
|
189
|
+
* @see {@link humanizeEvents}
|
|
190
|
+
*/
|
|
191
|
+
events: xdr.DiagnosticEvent[];
|
|
192
|
+
/** a private field to mark the schema as parsed */
|
|
193
|
+
_parsed: boolean;
|
|
194
|
+
}
|
|
195
|
+
/** Includes simplified fields only present on success. */
|
|
196
|
+
export interface SimulateTransactionSuccessResponse extends BaseSimulateTransactionResponse {
|
|
197
|
+
transactionData: SorobanDataBuilder;
|
|
198
|
+
minResourceFee: string;
|
|
199
|
+
cost: Cost;
|
|
200
|
+
/** present only for invocation simulation */
|
|
201
|
+
result?: SimulateHostFunctionResult;
|
|
202
|
+
}
|
|
203
|
+
/** Includes details about why the simulation failed */
|
|
204
|
+
export interface SimulateTransactionErrorResponse extends BaseSimulateTransactionResponse {
|
|
205
|
+
error: string;
|
|
206
|
+
events: xdr.DiagnosticEvent[];
|
|
207
|
+
}
|
|
208
|
+
export interface SimulateTransactionRestoreResponse extends SimulateTransactionSuccessResponse {
|
|
209
|
+
result: SimulateHostFunctionResult;
|
|
210
|
+
/**
|
|
211
|
+
* Indicates that a restoration is necessary prior to submission.
|
|
212
|
+
*
|
|
213
|
+
* In other words, seeing a restoration preamble means that your invocation
|
|
214
|
+
* was executed AS IF the required ledger entries were present, and this
|
|
215
|
+
* field includes information about what you need to restore for the
|
|
216
|
+
* simulation to succeed.
|
|
217
|
+
*/
|
|
218
|
+
restorePreamble: {
|
|
219
|
+
minResourceFee: string;
|
|
220
|
+
transactionData: SorobanDataBuilder;
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
export function isSimulationError(sim: SimulateTransactionResponse): sim is SimulateTransactionErrorResponse;
|
|
224
|
+
export function isSimulationSuccess(sim: SimulateTransactionResponse): sim is SimulateTransactionSuccessResponse;
|
|
225
|
+
export function isSimulationRestore(sim: SimulateTransactionResponse): sim is SimulateTransactionRestoreResponse;
|
|
226
|
+
export function isSimulationRaw(sim: Api.SimulateTransactionResponse | Api.RawSimulateTransactionResponse): sim is Api.RawSimulateTransactionResponse;
|
|
227
|
+
interface RawSimulateHostFunctionResult {
|
|
228
|
+
auth?: string[];
|
|
229
|
+
xdr: string;
|
|
230
|
+
}
|
|
231
|
+
/** @see https://soroban.stellar.org/api/methods/simulateTransaction#returns */
|
|
232
|
+
export interface RawSimulateTransactionResponse {
|
|
233
|
+
id: string;
|
|
234
|
+
latestLedger: number;
|
|
235
|
+
error?: string;
|
|
236
|
+
transactionData?: string;
|
|
237
|
+
events?: string[];
|
|
238
|
+
minResourceFee?: string;
|
|
239
|
+
results?: RawSimulateHostFunctionResult[];
|
|
240
|
+
cost?: Cost;
|
|
241
|
+
restorePreamble?: {
|
|
242
|
+
minResourceFee: string;
|
|
243
|
+
transactionData: string;
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
export {};
|
|
247
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Api = void 0;
|
|
7
|
+
var Api;
|
|
8
|
+
(function (_Api) {
|
|
9
|
+
var GetTransactionStatus = function (GetTransactionStatus) {
|
|
10
|
+
GetTransactionStatus["SUCCESS"] = "SUCCESS";
|
|
11
|
+
GetTransactionStatus["NOT_FOUND"] = "NOT_FOUND";
|
|
12
|
+
GetTransactionStatus["FAILED"] = "FAILED";
|
|
13
|
+
return GetTransactionStatus;
|
|
14
|
+
}({});
|
|
15
|
+
_Api.GetTransactionStatus = GetTransactionStatus;
|
|
16
|
+
function isSimulationError(sim) {
|
|
17
|
+
return 'error' in sim;
|
|
18
|
+
}
|
|
19
|
+
_Api.isSimulationError = isSimulationError;
|
|
20
|
+
function isSimulationSuccess(sim) {
|
|
21
|
+
return 'transactionData' in sim;
|
|
22
|
+
}
|
|
23
|
+
_Api.isSimulationSuccess = isSimulationSuccess;
|
|
24
|
+
function isSimulationRestore(sim) {
|
|
25
|
+
return isSimulationSuccess(sim) && 'restorePreamble' in sim && !!sim.restorePreamble.transactionData;
|
|
26
|
+
}
|
|
27
|
+
_Api.isSimulationRestore = isSimulationRestore;
|
|
28
|
+
function isSimulationRaw(sim) {
|
|
29
|
+
return !sim._parsed;
|
|
30
|
+
}
|
|
31
|
+
_Api.isSimulationRaw = isSimulationRaw;
|
|
32
|
+
})(Api || (exports.Api = Api = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.version = exports.default = exports.AxiosClient = void 0;
|
|
7
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
var version = exports.version = require('../../package.json').version;
|
|
10
|
+
var AxiosClient = exports.AxiosClient = _axios.default.create({
|
|
11
|
+
headers: {
|
|
12
|
+
'X-Client-Name': 'js-soroban-client',
|
|
13
|
+
'X-Client-Version': version
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
var _default = exports.default = AxiosClient;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
var _exportNames = {
|
|
8
|
+
StellarBase: true,
|
|
9
|
+
axios: true
|
|
10
|
+
};
|
|
11
|
+
exports.StellarBase = void 0;
|
|
12
|
+
Object.defineProperty(exports, "axios", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _axios.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
exports.default = void 0;
|
|
19
|
+
var _index = require("./index");
|
|
20
|
+
Object.keys(_index).forEach(function (key) {
|
|
21
|
+
if (key === "default" || key === "__esModule") return;
|
|
22
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
23
|
+
if (key in exports && exports[key] === _index[key]) return;
|
|
24
|
+
Object.defineProperty(exports, key, {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _index[key];
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
var _StellarBase = _interopRequireWildcard(require("@stellar/stellar-base"));
|
|
32
|
+
exports.StellarBase = _StellarBase;
|
|
33
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
34
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
36
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
37
|
+
var _default = exports.default = module.exports;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference path="../../types/dom-monkeypatch.d.ts" />
|
|
2
|
+
export * from './api';
|
|
3
|
+
export { Server, Durability } from './server';
|
|
4
|
+
export { default as AxiosClient } from './axios';
|
|
5
|
+
export { parseRawSimulation, parseRawEvents } from './parsers';
|
|
6
|
+
export * from './transaction';
|
|
7
|
+
declare const _default: any;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
Server: true,
|
|
8
|
+
Durability: true,
|
|
9
|
+
AxiosClient: true,
|
|
10
|
+
parseRawSimulation: true,
|
|
11
|
+
parseRawEvents: true
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "AxiosClient", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _axios.default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "Durability", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function get() {
|
|
22
|
+
return _server.Durability;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "Server", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _server.Server;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
exports.default = void 0;
|
|
32
|
+
Object.defineProperty(exports, "parseRawEvents", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _parsers.parseRawEvents;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(exports, "parseRawSimulation", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function get() {
|
|
41
|
+
return _parsers.parseRawSimulation;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
var _api = require("./api");
|
|
45
|
+
Object.keys(_api).forEach(function (key) {
|
|
46
|
+
if (key === "default" || key === "__esModule") return;
|
|
47
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
48
|
+
if (key in exports && exports[key] === _api[key]) return;
|
|
49
|
+
Object.defineProperty(exports, key, {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function get() {
|
|
52
|
+
return _api[key];
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
var _server = require("./server");
|
|
57
|
+
var _axios = _interopRequireDefault(require("./axios"));
|
|
58
|
+
var _parsers = require("./parsers");
|
|
59
|
+
var _transaction = require("./transaction");
|
|
60
|
+
Object.keys(_transaction).forEach(function (key) {
|
|
61
|
+
if (key === "default" || key === "__esModule") return;
|
|
62
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
63
|
+
if (key in exports && exports[key] === _transaction[key]) return;
|
|
64
|
+
Object.defineProperty(exports, key, {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function get() {
|
|
67
|
+
return _transaction[key];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
72
|
+
var _default = exports.default = module.exports;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type Id = string | number;
|
|
2
|
+
export interface Request<T> {
|
|
3
|
+
jsonrpc: "2.0";
|
|
4
|
+
id: Id;
|
|
5
|
+
method: string;
|
|
6
|
+
params: T;
|
|
7
|
+
}
|
|
8
|
+
export interface Notification<T> {
|
|
9
|
+
jsonrpc: "2.0";
|
|
10
|
+
method: string;
|
|
11
|
+
params?: T;
|
|
12
|
+
}
|
|
13
|
+
export type Response<T, E = any> = {
|
|
14
|
+
jsonrpc: "2.0";
|
|
15
|
+
id: Id;
|
|
16
|
+
} & ({
|
|
17
|
+
error: Error<E>;
|
|
18
|
+
} | {
|
|
19
|
+
result: T;
|
|
20
|
+
});
|
|
21
|
+
export interface Error<E = any> {
|
|
22
|
+
code: number;
|
|
23
|
+
message?: string;
|
|
24
|
+
data?: E;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Sends the jsonrpc 'params' as an array.
|
|
28
|
+
*/
|
|
29
|
+
export declare function post<T>(url: string, method: string, ...params: any): Promise<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Sends the jsonrpc 'params' as the single 'param' obj, no array wrapper is applied.
|
|
32
|
+
*/
|
|
33
|
+
export declare function postObject<T>(url: string, method: string, param: any): Promise<T>;
|