@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.
Files changed (112) hide show
  1. package/CHANGELOG.md +1275 -0
  2. package/LICENSE +228 -0
  3. package/README.md +274 -0
  4. package/dist/stellar-sdk.js +56470 -0
  5. package/dist/stellar-sdk.min.js +2 -0
  6. package/dist/stellar-sdk.min.js.LICENSE.txt +71 -0
  7. package/lib/browser.d.ts +6 -0
  8. package/lib/browser.js +37 -0
  9. package/lib/config.d.ts +52 -0
  10. package/lib/config.js +49 -0
  11. package/lib/contract_spec.d.ts +130 -0
  12. package/lib/contract_spec.js +549 -0
  13. package/lib/errors.d.ts +59 -0
  14. package/lib/errors.js +105 -0
  15. package/lib/federation/api.d.ts +11 -0
  16. package/lib/federation/api.js +7 -0
  17. package/lib/federation/index.d.ts +2 -0
  18. package/lib/federation/index.js +24 -0
  19. package/lib/federation/server.d.ts +118 -0
  20. package/lib/federation/server.js +253 -0
  21. package/lib/friendbot/index.d.ts +5 -0
  22. package/lib/friendbot/index.js +7 -0
  23. package/lib/horizon/account_call_builder.d.ts +55 -0
  24. package/lib/horizon/account_call_builder.js +64 -0
  25. package/lib/horizon/account_response.d.ts +58 -0
  26. package/lib/horizon/account_response.js +50 -0
  27. package/lib/horizon/assets_call_builder.d.ts +27 -0
  28. package/lib/horizon/assets_call_builder.js +45 -0
  29. package/lib/horizon/call_builder.d.ts +128 -0
  30. package/lib/horizon/call_builder.js +360 -0
  31. package/lib/horizon/claimable_balances_call_builder.d.ts +49 -0
  32. package/lib/horizon/claimable_balances_call_builder.js +58 -0
  33. package/lib/horizon/effect_call_builder.d.ts +53 -0
  34. package/lib/horizon/effect_call_builder.js +58 -0
  35. package/lib/horizon/friendbot_builder.d.ts +5 -0
  36. package/lib/horizon/friendbot_builder.js +33 -0
  37. package/lib/horizon/horizon_api.d.ts +523 -0
  38. package/lib/horizon/horizon_api.js +96 -0
  39. package/lib/horizon/horizon_axios_client.d.ts +30 -0
  40. package/lib/horizon/horizon_axios_client.js +48 -0
  41. package/lib/horizon/index.d.ts +7 -0
  42. package/lib/horizon/index.js +78 -0
  43. package/lib/horizon/ledger_call_builder.d.ts +22 -0
  44. package/lib/horizon/ledger_call_builder.js +39 -0
  45. package/lib/horizon/liquidity_pool_call_builder.d.ts +38 -0
  46. package/lib/horizon/liquidity_pool_call_builder.js +61 -0
  47. package/lib/horizon/offer_call_builder.d.ts +64 -0
  48. package/lib/horizon/offer_call_builder.js +81 -0
  49. package/lib/horizon/operation_call_builder.d.ts +68 -0
  50. package/lib/horizon/operation_call_builder.js +71 -0
  51. package/lib/horizon/orderbook_call_builder.d.ts +16 -0
  52. package/lib/horizon/orderbook_call_builder.js +46 -0
  53. package/lib/horizon/path_call_builder.d.ts +31 -0
  54. package/lib/horizon/path_call_builder.js +42 -0
  55. package/lib/horizon/payment_call_builder.d.ts +36 -0
  56. package/lib/horizon/payment_call_builder.js +48 -0
  57. package/lib/horizon/server.d.ts +361 -0
  58. package/lib/horizon/server.js +507 -0
  59. package/lib/horizon/server_api.d.ts +279 -0
  60. package/lib/horizon/server_api.js +19 -0
  61. package/lib/horizon/strict_receive_path_call_builder.d.ts +34 -0
  62. package/lib/horizon/strict_receive_path_call_builder.js +51 -0
  63. package/lib/horizon/strict_send_path_call_builder.d.ts +34 -0
  64. package/lib/horizon/strict_send_path_call_builder.js +51 -0
  65. package/lib/horizon/trade_aggregation_call_builder.d.ts +48 -0
  66. package/lib/horizon/trade_aggregation_call_builder.js +82 -0
  67. package/lib/horizon/trades_call_builder.d.ts +50 -0
  68. package/lib/horizon/trades_call_builder.js +74 -0
  69. package/lib/horizon/transaction_call_builder.d.ts +58 -0
  70. package/lib/horizon/transaction_call_builder.js +66 -0
  71. package/lib/horizon/types/account.d.ts +5 -0
  72. package/lib/horizon/types/account.js +5 -0
  73. package/lib/horizon/types/assets.d.ts +19 -0
  74. package/lib/horizon/types/assets.js +5 -0
  75. package/lib/horizon/types/effects.d.ts +285 -0
  76. package/lib/horizon/types/effects.js +62 -0
  77. package/lib/horizon/types/offer.d.ts +20 -0
  78. package/lib/horizon/types/offer.js +5 -0
  79. package/lib/horizon/types/trade.d.ts +13 -0
  80. package/lib/horizon/types/trade.js +5 -0
  81. package/lib/index.d.ts +14 -0
  82. package/lib/index.js +79 -0
  83. package/lib/soroban/api.d.ts +247 -0
  84. package/lib/soroban/api.js +32 -0
  85. package/lib/soroban/axios.d.ts +3 -0
  86. package/lib/soroban/axios.js +16 -0
  87. package/lib/soroban/browser.d.ts +6 -0
  88. package/lib/soroban/browser.js +37 -0
  89. package/lib/soroban/index.d.ts +8 -0
  90. package/lib/soroban/index.js +72 -0
  91. package/lib/soroban/jsonrpc.d.ts +33 -0
  92. package/lib/soroban/jsonrpc.js +93 -0
  93. package/lib/soroban/parsers.d.ts +17 -0
  94. package/lib/soroban/parsers.js +111 -0
  95. package/lib/soroban/server.d.ts +427 -0
  96. package/lib/soroban/server.js +598 -0
  97. package/lib/soroban/transaction.d.ts +20 -0
  98. package/lib/soroban/transaction.js +55 -0
  99. package/lib/soroban/utils.d.ts +1 -0
  100. package/lib/soroban/utils.js +9 -0
  101. package/lib/stellartoml/index.d.ts +121 -0
  102. package/lib/stellartoml/index.js +78 -0
  103. package/lib/utils.d.ts +12 -0
  104. package/lib/utils.js +32 -0
  105. package/lib/webauth/errors.d.ts +4 -0
  106. package/lib/webauth/errors.js +37 -0
  107. package/lib/webauth/index.d.ts +2 -0
  108. package/lib/webauth/index.js +27 -0
  109. package/lib/webauth/utils.d.ts +294 -0
  110. package/lib/webauth/utils.js +332 -0
  111. package/package.json +153 -0
  112. package/types/dom-monkeypatch.d.ts +126 -0
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.post = post;
7
+ exports.postObject = postObject;
8
+ var _axios = _interopRequireDefault(require("./axios"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ 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); }
11
+ function _regeneratorRuntime() { "use strict"; _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
12
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
13
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
14
+ function post(_x, _x2) {
15
+ return _post.apply(this, arguments);
16
+ }
17
+ function _post() {
18
+ _post = _asyncToGenerator(_regeneratorRuntime().mark(function _callee(url, method) {
19
+ var _len,
20
+ params,
21
+ _key,
22
+ response,
23
+ _response$data,
24
+ _args = arguments;
25
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
26
+ while (1) switch (_context.prev = _context.next) {
27
+ case 0:
28
+ for (_len = _args.length, params = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
29
+ params[_key - 2] = _args[_key];
30
+ }
31
+ if (params && params.length < 1) {
32
+ params = null;
33
+ }
34
+ _context.next = 4;
35
+ return _axios.default.post(url, {
36
+ jsonrpc: "2.0",
37
+ id: 1,
38
+ method: method,
39
+ params: params
40
+ });
41
+ case 4:
42
+ response = _context.sent;
43
+ if (!hasOwnProperty(response.data, "error")) {
44
+ _context.next = 9;
45
+ break;
46
+ }
47
+ throw response.data.error;
48
+ case 9:
49
+ return _context.abrupt("return", (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.result);
50
+ case 10:
51
+ case "end":
52
+ return _context.stop();
53
+ }
54
+ }, _callee);
55
+ }));
56
+ return _post.apply(this, arguments);
57
+ }
58
+ function postObject(_x3, _x4, _x5) {
59
+ return _postObject.apply(this, arguments);
60
+ }
61
+ function _postObject() {
62
+ _postObject = _asyncToGenerator(_regeneratorRuntime().mark(function _callee2(url, method, param) {
63
+ var response, _response$data2;
64
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
65
+ while (1) switch (_context2.prev = _context2.next) {
66
+ case 0:
67
+ _context2.next = 2;
68
+ return _axios.default.post(url, {
69
+ jsonrpc: "2.0",
70
+ id: 1,
71
+ method: method,
72
+ params: param
73
+ });
74
+ case 2:
75
+ response = _context2.sent;
76
+ if (!hasOwnProperty(response.data, "error")) {
77
+ _context2.next = 7;
78
+ break;
79
+ }
80
+ throw response.data.error;
81
+ case 7:
82
+ return _context2.abrupt("return", (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.result);
83
+ case 8:
84
+ case "end":
85
+ return _context2.stop();
86
+ }
87
+ }, _callee2);
88
+ }));
89
+ return _postObject.apply(this, arguments);
90
+ }
91
+ function hasOwnProperty(obj, prop) {
92
+ return obj.hasOwnProperty(prop);
93
+ }
@@ -0,0 +1,17 @@
1
+ import { Api } from './api';
2
+ export declare function parseRawSendTransaction(r: Api.RawSendTransactionResponse): Api.SendTransactionResponse;
3
+ export declare function parseRawEvents(r: Api.RawGetEventsResponse): Api.GetEventsResponse;
4
+ export declare function parseRawLedgerEntries(raw: Api.RawGetLedgerEntriesResponse): Api.GetLedgerEntriesResponse;
5
+ /**
6
+ * Converts a raw response schema into one with parsed XDR fields and a
7
+ * simplified interface.
8
+ *
9
+ * @param raw the raw response schema (parsed ones are allowed, best-effort
10
+ * detected, and returned untouched)
11
+ *
12
+ * @returns the original parameter (if already parsed), parsed otherwise
13
+ *
14
+ * @warning This API is only exported for testing purposes and should not be
15
+ * relied on or considered "stable".
16
+ */
17
+ export declare function parseRawSimulation(sim: Api.SimulateTransactionResponse | Api.RawSimulateTransactionResponse): Api.SimulateTransactionResponse;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.parseRawEvents = parseRawEvents;
7
+ exports.parseRawLedgerEntries = parseRawLedgerEntries;
8
+ exports.parseRawSendTransaction = parseRawSendTransaction;
9
+ exports.parseRawSimulation = parseRawSimulation;
10
+ var _stellarBase = require("@stellar/stellar-base");
11
+ var _api = require("./api");
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
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
15
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
17
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
18
+ function parseRawSendTransaction(r) {
19
+ var errResult = r.errorResultXdr;
20
+ delete r.errorResultXdr;
21
+ if (!!errResult) {
22
+ return _objectSpread(_objectSpread({}, r), {}, {
23
+ errorResult: _stellarBase.xdr.TransactionResult.fromXDR(errResult, 'base64')
24
+ });
25
+ }
26
+ return _objectSpread({}, r);
27
+ }
28
+ function parseRawEvents(r) {
29
+ var _r$events;
30
+ return {
31
+ latestLedger: r.latestLedger,
32
+ events: ((_r$events = r.events) !== null && _r$events !== void 0 ? _r$events : []).map(function (evt) {
33
+ var clone = _objectSpread({}, evt);
34
+ delete clone.contractId;
35
+ return _objectSpread(_objectSpread(_objectSpread({}, clone), evt.contractId !== '' && {
36
+ contractId: new _stellarBase.Contract(evt.contractId)
37
+ }), {}, {
38
+ topic: evt.topic.map(function (topic) {
39
+ return _stellarBase.xdr.ScVal.fromXDR(topic, 'base64');
40
+ }),
41
+ value: _stellarBase.xdr.ScVal.fromXDR(evt.value, 'base64')
42
+ });
43
+ })
44
+ };
45
+ }
46
+ function parseRawLedgerEntries(raw) {
47
+ var _raw$entries;
48
+ return {
49
+ latestLedger: raw.latestLedger,
50
+ entries: ((_raw$entries = raw.entries) !== null && _raw$entries !== void 0 ? _raw$entries : []).map(function (rawEntry) {
51
+ if (!rawEntry.key || !rawEntry.xdr) {
52
+ throw new TypeError("invalid ledger entry: ".concat(JSON.stringify(rawEntry)));
53
+ }
54
+ return _objectSpread({
55
+ lastModifiedLedgerSeq: rawEntry.lastModifiedLedgerSeq,
56
+ key: _stellarBase.xdr.LedgerKey.fromXDR(rawEntry.key, 'base64'),
57
+ val: _stellarBase.xdr.LedgerEntryData.fromXDR(rawEntry.xdr, 'base64')
58
+ }, rawEntry.liveUntilLedgerSeq !== undefined && {
59
+ liveUntilLedgerSeq: rawEntry.liveUntilLedgerSeq
60
+ });
61
+ })
62
+ };
63
+ }
64
+ function parseRawSimulation(sim) {
65
+ var _sim$events$map, _sim$events;
66
+ var looksRaw = _api.Api.isSimulationRaw(sim);
67
+ if (!looksRaw) {
68
+ return sim;
69
+ }
70
+ var base = {
71
+ _parsed: true,
72
+ id: sim.id,
73
+ latestLedger: sim.latestLedger,
74
+ events: (_sim$events$map = (_sim$events = sim.events) === null || _sim$events === void 0 ? void 0 : _sim$events.map(function (evt) {
75
+ return _stellarBase.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
76
+ })) !== null && _sim$events$map !== void 0 ? _sim$events$map : []
77
+ };
78
+ if (typeof sim.error === 'string') {
79
+ return _objectSpread(_objectSpread({}, base), {}, {
80
+ error: sim.error
81
+ });
82
+ }
83
+ return parseSuccessful(sim, base);
84
+ }
85
+ function parseSuccessful(sim, partial) {
86
+ var _sim$results$length, _sim$results;
87
+ var success = _objectSpread(_objectSpread({}, partial), {}, {
88
+ transactionData: new _stellarBase.SorobanDataBuilder(sim.transactionData),
89
+ minResourceFee: sim.minResourceFee,
90
+ cost: sim.cost
91
+ }, ((_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) && {
92
+ result: sim.results.map(function (row) {
93
+ var _row$auth;
94
+ return {
95
+ auth: ((_row$auth = row.auth) !== null && _row$auth !== void 0 ? _row$auth : []).map(function (entry) {
96
+ return _stellarBase.xdr.SorobanAuthorizationEntry.fromXDR(entry, 'base64');
97
+ }),
98
+ retval: !!row.xdr ? _stellarBase.xdr.ScVal.fromXDR(row.xdr, 'base64') : _stellarBase.xdr.ScVal.scvVoid()
99
+ };
100
+ })[0]
101
+ });
102
+ if (!sim.restorePreamble || sim.restorePreamble.transactionData === '') {
103
+ return success;
104
+ }
105
+ return _objectSpread(_objectSpread({}, success), {}, {
106
+ restorePreamble: {
107
+ minResourceFee: sim.restorePreamble.minResourceFee,
108
+ transactionData: new _stellarBase.SorobanDataBuilder(sim.restorePreamble.transactionData)
109
+ }
110
+ });
111
+ }
@@ -0,0 +1,427 @@
1
+ import URI from 'urijs';
2
+ import { Account, Address, Contract, FeeBumpTransaction, Transaction, xdr } from '@stellar/stellar-base';
3
+ import { Api } from './api';
4
+ export declare const SUBMIT_TRANSACTION_TIMEOUT: number;
5
+ /** Specifies the durability namespace of contract-related ledger entries. */
6
+ export declare enum Durability {
7
+ Temporary = "temporary",
8
+ Persistent = "persistent"
9
+ }
10
+ export declare namespace Server {
11
+ /** Describes the complex filter combinations available for event queries. */
12
+ interface GetEventsRequest {
13
+ filters: Api.EventFilter[];
14
+ startLedger?: number;
15
+ cursor?: string;
16
+ limit?: number;
17
+ }
18
+ interface Options {
19
+ allowHttp?: boolean;
20
+ timeout?: number;
21
+ headers?: Record<string, string>;
22
+ }
23
+ }
24
+ /**
25
+ * Handles the network connection to a Soroban RPC instance, exposing an
26
+ * interface for requests to that instance.
27
+ *
28
+ * @constructor
29
+ *
30
+ * @param {string} serverURL Soroban-RPC Server URL (ex.
31
+ * `http://localhost:8000/soroban/rpc`).
32
+ * @param {object} [opts] Options object
33
+ * @param {boolean} [opts.allowHttp] allows connecting to insecure http servers
34
+ * (default: `false`). This must be set to false in production deployments!
35
+ * You can also use {@link Config} class to set this globally.
36
+ * @param {Record<string, string>} [opts.headers] allows setting custom headers
37
+ *
38
+ * @see https://soroban.stellar.org/api/methods
39
+ */
40
+ export declare class Server {
41
+ /** Soroban RPC Server URL (ex. `http://localhost:8000/soroban/rpc`). */
42
+ readonly serverURL: URI;
43
+ constructor(serverURL: string, opts?: Server.Options);
44
+ /**
45
+ * Fetch a minimal set of current info about a Stellar account.
46
+ *
47
+ * Needed to get the current sequence number for the account so you can build
48
+ * a successful transaction with {@link TransactionBuilder}.
49
+ *
50
+ * @param {string} address - The public address of the account to load.
51
+ *
52
+ * @returns {Promise<Account>} a promise to the {@link Account} object with
53
+ * a populated sequence number
54
+ *
55
+ * @see https://soroban.stellar.org/api/methods/getLedgerEntries
56
+ * @example
57
+ * const accountId = "GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4";
58
+ * server.getAccount(accountId).then((account) => {
59
+ * console.log("sequence:", account.sequence);
60
+ * });
61
+ */
62
+ getAccount(address: string): Promise<Account>;
63
+ /**
64
+ * General node health check.
65
+ *
66
+ * @returns {Promise<Api.GetHealthResponse>} a promise to the
67
+ * {@link Api.GetHealthResponse} object with the status of the
68
+ * server (e.g. "healthy").
69
+ *
70
+ * @see https://soroban.stellar.org/api/methods/getHealth
71
+ * @example
72
+ * server.getHealth().then((health) => {
73
+ * console.log("status:", health.status);
74
+ * });
75
+ */
76
+ getHealth(): Promise<Api.GetHealthResponse>;
77
+ /**
78
+ * Reads the current value of contract data ledger entries directly.
79
+ *
80
+ * Allows you to directly inspect the current state of a contract. This is a
81
+ * backup way to access your contract data which may not be available via
82
+ * events or {@link Server.simulateTransaction}.
83
+ *
84
+ * @param {string|Address|Contract} contract the contract ID containing the
85
+ * data to load as a strkey (`C...` form), a {@link Contract}, or an
86
+ * {@link Address} instance
87
+ * @param {xdr.ScVal} key the key of the contract data to load
88
+ * @param {Durability} [durability=Durability.Persistent] the "durability
89
+ * keyspace" that this ledger key belongs to, which is either 'temporary'
90
+ * or 'persistent' (the default), see {@link Durability}.
91
+ *
92
+ * @returns {Promise<Api.LedgerEntryResult>} the current data value
93
+ *
94
+ * @warning If the data entry in question is a 'temporary' entry, it's
95
+ * entirely possible that it has expired out of existence.
96
+ *
97
+ * @see https://soroban.stellar.org/api/methods/getLedgerEntries
98
+ * @example
99
+ * const contractId = "CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5";
100
+ * const key = xdr.ScVal.scvSymbol("counter");
101
+ * server.getContractData(contractId, key, Durability.Temporary).then(data => {
102
+ * console.log("value:", data.val);
103
+ * console.log("liveUntilLedgerSeq:", data.liveUntilLedgerSeq);
104
+ * console.log("lastModified:", data.lastModifiedLedgerSeq);
105
+ * console.log("latestLedger:", data.latestLedger);
106
+ * });
107
+ */
108
+ getContractData(contract: string | Address | Contract, key: xdr.ScVal, durability?: Durability): Promise<Api.LedgerEntryResult>;
109
+ /**
110
+ * Reads the current value of arbitrary ledger entries directly.
111
+ *
112
+ * Allows you to directly inspect the current state of contracts, contract's
113
+ * code, accounts, or any other ledger entries.
114
+ *
115
+ * To fetch a contract's WASM byte-code, built the appropriate
116
+ * {@link xdr.LedgerKeyContractCode} ledger entry key (or see
117
+ * {@link Contract.getFootprint}).
118
+ *
119
+ * @param {xdr.ScVal[]} keys one or more ledger entry keys to load
120
+ *
121
+ * @returns {Promise<Api.GetLedgerEntriesResponse>} the current
122
+ * on-chain values for the given ledger keys
123
+ *
124
+ * @see Server._getLedgerEntries
125
+ * @see https://soroban.stellar.org/api/methods/getLedgerEntries
126
+ * @example
127
+ * const contractId = "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM";
128
+ * const key = xdr.LedgerKey.contractData(new xdr.LedgerKeyContractData({
129
+ * contractId: StrKey.decodeContract(contractId),
130
+ * key: xdr.ScVal.scvSymbol("counter"),
131
+ * }));
132
+ *
133
+ * server.getLedgerEntries([key]).then(response => {
134
+ * const ledgerData = response.entries[0];
135
+ * console.log("key:", ledgerData.key);
136
+ * console.log("value:", ledgerData.val);
137
+ * console.log("liveUntilLedgerSeq:", ledgerData.liveUntilLedgerSeq);
138
+ * console.log("lastModified:", ledgerData.lastModifiedLedgerSeq);
139
+ * console.log("latestLedger:", response.latestLedger);
140
+ * });
141
+ */
142
+ getLedgerEntries(...keys: xdr.LedgerKey[]): Promise<Api.GetLedgerEntriesResponse>;
143
+ _getLedgerEntries(...keys: xdr.LedgerKey[]): Promise<Api.RawGetLedgerEntriesResponse>;
144
+ /**
145
+ * Fetch the details of a submitted transaction.
146
+ *
147
+ * After submitting a transaction, clients should poll this to tell when the
148
+ * transaction has completed.
149
+ *
150
+ * @param {string} hash hex-encoded hash of the transaction to check
151
+ *
152
+ * @returns {Promise<Api.GetTransactionResponse>} the status,
153
+ * result, and other details about the transaction
154
+ *
155
+ * @see https://soroban.stellar.org/api/methods/getTransaction
156
+ * @example
157
+ * const transactionHash = "c4515e3bdc0897f21cc5dbec8c82cf0a936d4741cb74a8e158eb51b9fb00411a";
158
+ * server.getTransaction(transactionHash).then((tx) => {
159
+ * console.log("status:", tx.status);
160
+ * console.log("envelopeXdr:", tx.envelopeXdr);
161
+ * console.log("resultMetaXdr:", tx.resultMetaXdr);
162
+ * console.log("resultXdr:", tx.resultXdr);
163
+ * });
164
+ */
165
+ getTransaction(hash: string): Promise<Api.GetTransactionResponse>;
166
+ _getTransaction(hash: string): Promise<Api.RawGetTransactionResponse>;
167
+ /**
168
+ * Fetch all events that match a given set of filters.
169
+ *
170
+ * The given filters (see {@link Api.EventFilter} for detailed fields)
171
+ * are combined only in a logical OR fashion, and all of the fields in each
172
+ * filter are optional.
173
+ *
174
+ * To page through events, use the `pagingToken` field on the relevant
175
+ * {@link Api.EventResponse} object to set the `cursor` parameter.
176
+ *
177
+ * @param {Server.GetEventsRequest} request event filters
178
+ * @returns {Promise<Api.GetEventsResponse>} a paginatable set of the
179
+ * events matching the given event filters
180
+ *
181
+ * @see https://soroban.stellar.org/api/methods/getEvents
182
+ * @example
183
+ * server.getEvents({
184
+ * startLedger: "1000",
185
+ * filters: [
186
+ * {
187
+ * type: "contract",
188
+ * contractIds: [ "deadb33f..." ],
189
+ * topics: [[ "AAAABQAAAAh0cmFuc2Zlcg==", "AAAAAQB6Mcc=", "*" ]]
190
+ * }, {
191
+ * type: "system",
192
+ * contractIds: [ "...c4f3b4b3..." ],
193
+ * topics: [[ "*" ], [ "*", "AAAAAQB6Mcc=" ]]
194
+ * }, {
195
+ * contractIds: [ "...c4f3b4b3..." ],
196
+ * topics: [[ "AAAABQAAAAh0cmFuc2Zlcg==" ]]
197
+ * }, {
198
+ * type: "diagnostic",
199
+ * topics: [[ "AAAAAQB6Mcc=" ]]
200
+ * }
201
+ * ],
202
+ * limit: 10,
203
+ * });
204
+ */
205
+ getEvents(request: Server.GetEventsRequest): Promise<Api.GetEventsResponse>;
206
+ _getEvents(request: Server.GetEventsRequest): Promise<Api.RawGetEventsResponse>;
207
+ /**
208
+ * Fetch metadata about the network this Soroban RPC server is connected to.
209
+ *
210
+ * @returns {Promise<Api.GetNetworkResponse>} metadata about the
211
+ * current network this RPC server is connected to
212
+ *
213
+ * @see https://soroban.stellar.org/api/methods/getNetwork
214
+ * @example
215
+ * server.getNetwork().then((network) => {
216
+ * console.log("friendbotUrl:", network.friendbotUrl);
217
+ * console.log("passphrase:", network.passphrase);
218
+ * console.log("protocolVersion:", network.protocolVersion);
219
+ * });
220
+ */
221
+ getNetwork(): Promise<Api.GetNetworkResponse>;
222
+ /**
223
+ * Fetch the latest ledger meta info from network which this Soroban RPC
224
+ * server is connected to.
225
+ *
226
+ * @returns {Promise<Api.GetLatestLedgerResponse>} metadata about the
227
+ * latest ledger on the network that this RPC server is connected to
228
+ *
229
+ * @see https://soroban.stellar.org/api/methods/getLatestLedger
230
+ * @example
231
+ * server.getLatestLedger().then((response) => {
232
+ * console.log("hash:", response.id);
233
+ * console.log("sequence:", response.sequence);
234
+ * console.log("protocolVersion:", response.protocolVersion);
235
+ * });
236
+ */
237
+ getLatestLedger(): Promise<Api.GetLatestLedgerResponse>;
238
+ /**
239
+ * Submit a trial contract invocation to get back return values, expected
240
+ * ledger footprint, expected authorizations, and expected costs.
241
+ *
242
+ * @param {Transaction | FeeBumpTransaction} transaction the transaction to
243
+ * simulate, which should include exactly one operation (one of
244
+ * {@link xdr.InvokeHostFunctionOp}, {@link xdr.ExtendFootprintTTLOp}, or
245
+ * {@link xdr.RestoreFootprintOp}). Any provided footprint or auth
246
+ * information will be ignored.
247
+ *
248
+ * @returns {Promise<Api.SimulateTransactionResponse>} an object with the
249
+ * cost, footprint, result/auth requirements (if applicable), and error of
250
+ * the transaction
251
+ *
252
+ * @see https://developers.stellar.org/docs/glossary/transactions/
253
+ * @see https://soroban.stellar.org/api/methods/simulateTransaction
254
+ * @see Server.prepareTransaction
255
+ * @see assembleTransaction
256
+ *
257
+ * @example
258
+ * const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';
259
+ * const contract = new StellarSdk.Contract(contractId);
260
+ *
261
+ * // Right now, this is just the default fee for this example.
262
+ * const fee = StellarSdk.BASE_FEE;
263
+ * const transaction = new StellarSdk.TransactionBuilder(account, { fee })
264
+ * // Uncomment the following line to build transactions for the live network. Be
265
+ * // sure to also change the horizon hostname.
266
+ * //.setNetworkPassphrase(StellarSdk.Networks.PUBLIC)
267
+ * .setNetworkPassphrase(StellarSdk.Networks.FUTURENET)
268
+ * .setTimeout(30) // valid for the next 30s
269
+ * // Add an operation to call increment() on the contract
270
+ * .addOperation(contract.call("increment"))
271
+ * .build();
272
+ *
273
+ * server.simulateTransaction(transaction).then((sim) => {
274
+ * console.log("cost:", sim.cost);
275
+ * console.log("result:", sim.result);
276
+ * console.log("error:", sim.error);
277
+ * console.log("latestLedger:", sim.latestLedger);
278
+ * });
279
+ */
280
+ simulateTransaction(transaction: Transaction | FeeBumpTransaction): Promise<Api.SimulateTransactionResponse>;
281
+ _simulateTransaction(transaction: Transaction | FeeBumpTransaction): Promise<Api.RawSimulateTransactionResponse>;
282
+ /**
283
+ * Submit a trial contract invocation, first run a simulation of the contract
284
+ * invocation as defined on the incoming transaction, and apply the results to
285
+ * a new copy of the transaction which is then returned. Setting the ledger
286
+ * footprint and authorization, so the resulting transaction is ready for
287
+ * signing & sending.
288
+ *
289
+ * The returned transaction will also have an updated fee that is the sum of
290
+ * fee set on incoming transaction with the contract resource fees estimated
291
+ * from simulation. It is adviseable to check the fee on returned transaction
292
+ * and validate or take appropriate measures for interaction with user to
293
+ * confirm it is acceptable.
294
+ *
295
+ * You can call the {@link Server.simulateTransaction} method directly first
296
+ * if you want to inspect estimated fees for a given transaction in detail
297
+ * first, then re-assemble it manually or via {@link assembleTransaction}.
298
+ *
299
+ * @param {Transaction | FeeBumpTransaction} transaction the transaction to
300
+ * prepare. It should include exactly one operation, which must be one of
301
+ * {@link xdr.InvokeHostFunctionOp}, {@link xdr.ExtendFootprintTTLOp},
302
+ * or {@link xdr.RestoreFootprintOp}.
303
+ *
304
+ * Any provided footprint will be overwritten. However, if your operation
305
+ * has existing auth entries, they will be preferred over ALL auth entries
306
+ * from the simulation. In other words, if you include auth entries, you
307
+ * don't care about the auth returned from the simulation. Other fields
308
+ * (footprint, etc.) will be filled as normal.
309
+ *
310
+ * @returns {Promise<Transaction | FeeBumpTransaction>} a copy of the
311
+ * transaction with the expected authorizations (in the case of
312
+ * invocation), resources, and ledger footprints added. The transaction fee
313
+ * will also automatically be padded with the contract's minimum resource
314
+ * fees discovered from the simulation.
315
+ *
316
+ * @see assembleTransaction
317
+ * @see https://soroban.stellar.org/api/methods/simulateTransaction
318
+ * @throws {jsonrpc.Error<any>|Error|Api.SimulateTransactionErrorResponse}
319
+ * if simulation fails
320
+ * @example
321
+ * const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';
322
+ * const contract = new StellarSdk.Contract(contractId);
323
+ *
324
+ * // Right now, this is just the default fee for this example.
325
+ * const fee = StellarSdk.BASE_FEE;
326
+ * const transaction = new StellarSdk.TransactionBuilder(account, { fee })
327
+ * // Uncomment the following line to build transactions for the live network. Be
328
+ * // sure to also change the horizon hostname.
329
+ * //.setNetworkPassphrase(StellarSdk.Networks.PUBLIC)
330
+ * .setNetworkPassphrase(StellarSdk.Networks.FUTURENET)
331
+ * .setTimeout(30) // valid for the next 30s
332
+ * // Add an operation to call increment() on the contract
333
+ * .addOperation(contract.call("increment"))
334
+ * .build();
335
+ *
336
+ * const preparedTransaction = await server.prepareTransaction(transaction);
337
+ *
338
+ * // Sign this transaction with the secret key
339
+ * // NOTE: signing is transaction is network specific. Test network transactions
340
+ * // won't work in the public network. To switch networks, use the Network object
341
+ * // as explained above (look for StellarSdk.Network).
342
+ * const sourceKeypair = StellarSdk.Keypair.fromSecret(sourceSecretKey);
343
+ * preparedTransaction.sign(sourceKeypair);
344
+ *
345
+ * server.sendTransaction(transaction).then(result => {
346
+ * console.log("hash:", result.hash);
347
+ * console.log("status:", result.status);
348
+ * console.log("errorResultXdr:", result.errorResultXdr);
349
+ * });
350
+ */
351
+ prepareTransaction(tx: Transaction | FeeBumpTransaction): Promise<Transaction<import("@stellar/stellar-base").Memo<import("@stellar/stellar-base").MemoType>, import("@stellar/stellar-base").Operation[]>>;
352
+ /**
353
+ * Submit a real transaction to the Stellar network.
354
+ *
355
+ * Unlike Horizon, Soroban RPC does not wait for transaction completion. It
356
+ * simply validates the transaction and enqueues it. Clients should call
357
+ * {@link Server.getTransactionStatus} to learn about transaction
358
+ * success/failure.
359
+ *
360
+ * @param {Transaction | FeeBumpTransaction} transaction to submit
361
+ * @returns {Promise<Api.SendTransactionResponse>} the
362
+ * transaction id, status, and any error if available
363
+ *
364
+ * @see https://developers.stellar.org/docs/glossary/transactions/
365
+ * @see https://soroban.stellar.org/api/methods/sendTransaction
366
+ * @example
367
+ * const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';
368
+ * const contract = new StellarSdk.Contract(contractId);
369
+ *
370
+ * // Right now, this is just the default fee for this example.
371
+ * const fee = StellarSdk.BASE_FEE;
372
+ * const transaction = new StellarSdk.TransactionBuilder(account, { fee })
373
+ * // Uncomment the following line to build transactions for the live network. Be
374
+ * // sure to also change the horizon hostname.
375
+ * //.setNetworkPassphrase(StellarSdk.Networks.PUBLIC)
376
+ * .setNetworkPassphrase(StellarSdk.Networks.FUTURENET)
377
+ * .setTimeout(30) // valid for the next 30s
378
+ * // Add an operation to call increment() on the contract
379
+ * .addOperation(contract.call("increment"))
380
+ * .build();
381
+ *
382
+ * // Sign this transaction with the secret key
383
+ * // NOTE: signing is transaction is network specific. Test network transactions
384
+ * // won't work in the public network. To switch networks, use the Network object
385
+ * // as explained above (look for StellarSdk.Network).
386
+ * const sourceKeypair = StellarSdk.Keypair.fromSecret(sourceSecretKey);
387
+ * transaction.sign(sourceKeypair);
388
+ *
389
+ * server.sendTransaction(transaction).then((result) => {
390
+ * console.log("hash:", result.hash);
391
+ * console.log("status:", result.status);
392
+ * console.log("errorResultXdr:", result.errorResultXdr);
393
+ * });
394
+ */
395
+ sendTransaction(transaction: Transaction | FeeBumpTransaction): Promise<Api.SendTransactionResponse>;
396
+ _sendTransaction(transaction: Transaction | FeeBumpTransaction): Promise<Api.RawSendTransactionResponse>;
397
+ /**
398
+ * Fund a new account using the network's friendbot faucet, if any.
399
+ *
400
+ * @param {string | Account} address the address or account instance that we
401
+ * want to create and fund with friendbot
402
+ * @param {string} [friendbotUrl] optionally, an explicit address for
403
+ * friendbot (by default: this calls the Soroban RPC
404
+ * {@link Server.getNetwork} method to try to discover this network's
405
+ * Friendbot url).
406
+ *
407
+ * @returns {Promise<Account>} an {@link Account} object for the created
408
+ * account, or the existing account if it's already funded with the
409
+ * populated sequence number (note that the account will not be "topped
410
+ * off" if it already exists)
411
+ *
412
+ * @throws if Friendbot is not configured on this network or request failure
413
+ *
414
+ * @see
415
+ * https://developers.stellar.org/docs/fundamentals-and-concepts/testnet-and-pubnet#friendbot
416
+ * @see Friendbot.Response
417
+ * @example
418
+ * server
419
+ * .requestAirdrop("GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4")
420
+ * .then((accountCreated) => {
421
+ * console.log("accountCreated:", accountCreated);
422
+ * }).catch((error) => {
423
+ * console.error("error:", error);
424
+ * });
425
+ */
426
+ requestAirdrop(address: string | Pick<Account, 'accountId'>, friendbotUrl?: string): Promise<Account>;
427
+ }