@stellar/stellar-sdk 12.0.0-rc.1 → 12.0.0-rc.3
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 +80 -1
- package/README.md +1 -1
- package/dist/stellar-sdk.js +1643 -466
- package/dist/stellar-sdk.min.js +1 -1
- package/lib/{contract_client → contract}/assembled_transaction.d.ts +59 -40
- package/lib/{contract_client → contract}/assembled_transaction.js +128 -146
- package/lib/{contract_client → contract}/basic_node_signer.d.ts +2 -2
- package/lib/{contract_client → contract}/basic_node_signer.js +3 -3
- package/lib/contract/client.d.ts +51 -0
- package/lib/contract/client.js +177 -0
- package/lib/contract/index.d.ts +7 -0
- package/lib/{contract_client → contract}/index.js +19 -8
- package/lib/{contract_client → contract}/sent_transaction.d.ts +21 -10
- package/lib/{contract_client → contract}/sent_transaction.js +38 -19
- package/lib/{contract_spec.d.ts → contract/spec.d.ts} +3 -3
- package/lib/{contract_spec.js → contract/spec.js} +160 -160
- package/lib/{contract_client → contract}/types.d.ts +10 -8
- package/lib/contract/utils.d.ts +40 -0
- package/lib/{contract_client → contract}/utils.js +13 -3
- package/lib/index.d.ts +26 -2
- package/lib/index.js +10 -16
- package/lib/rpc/index.d.ts +7 -0
- package/lib/{soroban → rpc}/server.d.ts +49 -0
- package/lib/{soroban → rpc}/server.js +199 -118
- package/package.json +20 -3
- package/lib/contract_client/client.d.ts +0 -17
- package/lib/contract_client/client.js +0 -57
- package/lib/contract_client/index.d.ts +0 -6
- package/lib/contract_client/utils.d.ts +0 -23
- package/lib/rust_types/index.d.ts +0 -1
- package/lib/rust_types/index.js +0 -16
- package/lib/soroban/index.d.ts +0 -7
- /package/lib/{rust_types/result.d.ts → contract/rust_result.d.ts} +0 -0
- /package/lib/{rust_types/result.js → contract/rust_result.js} +0 -0
- /package/lib/{contract_client → contract}/types.js +0 -0
- /package/lib/{soroban → rpc}/api.d.ts +0 -0
- /package/lib/{soroban → rpc}/api.js +0 -0
- /package/lib/{soroban → rpc}/axios.d.ts +0 -0
- /package/lib/{soroban → rpc}/axios.js +0 -0
- /package/lib/{soroban → rpc}/browser.d.ts +0 -0
- /package/lib/{soroban → rpc}/browser.js +0 -0
- /package/lib/{soroban → rpc}/index.js +0 -0
- /package/lib/{soroban → rpc}/jsonrpc.d.ts +0 -0
- /package/lib/{soroban → rpc}/jsonrpc.js +0 -0
- /package/lib/{soroban → rpc}/parsers.d.ts +0 -0
- /package/lib/{soroban → rpc}/parsers.js +0 -0
- /package/lib/{soroban → rpc}/transaction.d.ts +0 -0
- /package/lib/{soroban → rpc}/transaction.js +0 -0
- /package/lib/{soroban → rpc}/utils.d.ts +0 -0
- /package/lib/{soroban → rpc}/utils.js +0 -0
package/dist/stellar-sdk.js
CHANGED
|
@@ -10034,6 +10034,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
10034
10034
|
}));
|
|
10035
10035
|
var _exportNames = {
|
|
10036
10036
|
xdr: true,
|
|
10037
|
+
cereal: true,
|
|
10037
10038
|
hash: true,
|
|
10038
10039
|
sign: true,
|
|
10039
10040
|
verify: true,
|
|
@@ -10239,6 +10240,12 @@ Object.defineProperty(exports, "UnsignedHyper", ({
|
|
|
10239
10240
|
return _jsXdr.UnsignedHyper;
|
|
10240
10241
|
}
|
|
10241
10242
|
}));
|
|
10243
|
+
Object.defineProperty(exports, "cereal", ({
|
|
10244
|
+
enumerable: true,
|
|
10245
|
+
get: function get() {
|
|
10246
|
+
return _jsxdr["default"];
|
|
10247
|
+
}
|
|
10248
|
+
}));
|
|
10242
10249
|
Object.defineProperty(exports, "decodeAddressToMuxedAccount", ({
|
|
10243
10250
|
enumerable: true,
|
|
10244
10251
|
get: function get() {
|
|
@@ -10295,6 +10302,7 @@ Object.defineProperty(exports, "xdr", ({
|
|
|
10295
10302
|
}
|
|
10296
10303
|
}));
|
|
10297
10304
|
var _xdr = _interopRequireDefault(__webpack_require__(1918));
|
|
10305
|
+
var _jsxdr = _interopRequireDefault(__webpack_require__(3335));
|
|
10298
10306
|
var _hashing = __webpack_require__(9152);
|
|
10299
10307
|
var _signing = __webpack_require__(15);
|
|
10300
10308
|
var _get_liquidity_pool_id = __webpack_require__(5578);
|
|
@@ -10613,6 +10621,25 @@ function walkHelper(node, depth, callback, parent) {
|
|
|
10613
10621
|
|
|
10614
10622
|
/***/ }),
|
|
10615
10623
|
|
|
10624
|
+
/***/ 3335:
|
|
10625
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
10626
|
+
|
|
10627
|
+
"use strict";
|
|
10628
|
+
|
|
10629
|
+
|
|
10630
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
10631
|
+
value: true
|
|
10632
|
+
}));
|
|
10633
|
+
exports["default"] = void 0;
|
|
10634
|
+
var _jsXdr = __webpack_require__(3740);
|
|
10635
|
+
var cereal = {
|
|
10636
|
+
XdrWriter: _jsXdr.XdrWriter,
|
|
10637
|
+
XdrReader: _jsXdr.XdrReader
|
|
10638
|
+
};
|
|
10639
|
+
var _default = exports["default"] = cereal;
|
|
10640
|
+
|
|
10641
|
+
/***/ }),
|
|
10642
|
+
|
|
10616
10643
|
/***/ 6691:
|
|
10617
10644
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
10618
10645
|
|
|
@@ -16637,7 +16664,7 @@ function encodeCheck(versionByteName, data) {
|
|
|
16637
16664
|
data = Buffer.from(data);
|
|
16638
16665
|
var versionBuffer = Buffer.from([versionByte]);
|
|
16639
16666
|
var payload = Buffer.concat([versionBuffer, data]);
|
|
16640
|
-
var checksum = calculateChecksum(payload);
|
|
16667
|
+
var checksum = Buffer.from(calculateChecksum(payload));
|
|
16641
16668
|
var unencoded = Buffer.concat([payload, checksum]);
|
|
16642
16669
|
return _base["default"].encode(unencoded);
|
|
16643
16670
|
}
|
|
@@ -20798,19 +20825,34 @@ var Config = function () {
|
|
|
20798
20825
|
|
|
20799
20826
|
/***/ }),
|
|
20800
20827
|
|
|
20801
|
-
/***/
|
|
20828
|
+
/***/ 145:
|
|
20802
20829
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
20803
20830
|
|
|
20804
20831
|
"use strict";
|
|
20832
|
+
// ESM COMPAT FLAG
|
|
20833
|
+
__webpack_require__.r(__webpack_exports__);
|
|
20805
20834
|
|
|
20806
20835
|
// EXPORTS
|
|
20807
20836
|
__webpack_require__.d(__webpack_exports__, {
|
|
20808
|
-
|
|
20837
|
+
AssembledTransaction: () => (/* reexport */ AssembledTransaction),
|
|
20838
|
+
Client: () => (/* reexport */ Client),
|
|
20839
|
+
Err: () => (/* reexport */ Err),
|
|
20840
|
+
NULL_ACCOUNT: () => (/* reexport */ NULL_ACCOUNT),
|
|
20841
|
+
Ok: () => (/* reexport */ Ok),
|
|
20842
|
+
SentTransaction: () => (/* reexport */ SentTransaction),
|
|
20843
|
+
Spec: () => (/* reexport */ Spec),
|
|
20844
|
+
basicNodeSigner: () => (/* reexport */ basicNodeSigner)
|
|
20809
20845
|
});
|
|
20810
20846
|
|
|
20811
|
-
// EXTERNAL MODULE: ./
|
|
20812
|
-
var
|
|
20813
|
-
|
|
20847
|
+
// EXTERNAL MODULE: ./node_modules/@stellar/stellar-base/lib/index.js
|
|
20848
|
+
var lib = __webpack_require__(356);
|
|
20849
|
+
// EXTERNAL MODULE: ./src/rpc/server.ts + 1 modules
|
|
20850
|
+
var server = __webpack_require__(1575);
|
|
20851
|
+
// EXTERNAL MODULE: ./src/rpc/api.ts
|
|
20852
|
+
var api = __webpack_require__(4076);
|
|
20853
|
+
// EXTERNAL MODULE: ./src/rpc/transaction.ts
|
|
20854
|
+
var transaction = __webpack_require__(8680);
|
|
20855
|
+
;// CONCATENATED MODULE: ./src/contract/rust_result.ts
|
|
20814
20856
|
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); }
|
|
20815
20857
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
20816
20858
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
@@ -20871,32 +20913,828 @@ var Err = function () {
|
|
|
20871
20913
|
}
|
|
20872
20914
|
}]);
|
|
20873
20915
|
}();
|
|
20874
|
-
;// CONCATENATED MODULE: ./src/
|
|
20916
|
+
;// CONCATENATED MODULE: ./src/contract/utils.ts
|
|
20917
|
+
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" == utils_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 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(utils_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 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 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; }
|
|
20918
|
+
function utils_typeof(o) { "@babel/helpers - typeof"; return utils_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; }, utils_typeof(o); }
|
|
20919
|
+
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); } }
|
|
20920
|
+
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); }); }; }
|
|
20875
20921
|
|
|
20876
|
-
|
|
20922
|
+
var DEFAULT_TIMEOUT = 5 * 60;
|
|
20923
|
+
function withExponentialBackoff(_x, _x2, _x3) {
|
|
20924
|
+
return _withExponentialBackoff.apply(this, arguments);
|
|
20925
|
+
}
|
|
20926
|
+
function _withExponentialBackoff() {
|
|
20927
|
+
_withExponentialBackoff = _asyncToGenerator(_regeneratorRuntime().mark(function _callee(fn, keepWaitingIf, timeoutInSeconds) {
|
|
20928
|
+
var exponentialFactor,
|
|
20929
|
+
verbose,
|
|
20930
|
+
attempts,
|
|
20931
|
+
count,
|
|
20932
|
+
waitUntil,
|
|
20933
|
+
waitTime,
|
|
20934
|
+
totalWaitTime,
|
|
20935
|
+
_args = arguments;
|
|
20936
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
20937
|
+
while (1) switch (_context.prev = _context.next) {
|
|
20938
|
+
case 0:
|
|
20939
|
+
exponentialFactor = _args.length > 3 && _args[3] !== undefined ? _args[3] : 1.5;
|
|
20940
|
+
verbose = _args.length > 4 && _args[4] !== undefined ? _args[4] : false;
|
|
20941
|
+
attempts = [];
|
|
20942
|
+
count = 0;
|
|
20943
|
+
_context.t0 = attempts;
|
|
20944
|
+
_context.next = 7;
|
|
20945
|
+
return fn();
|
|
20946
|
+
case 7:
|
|
20947
|
+
_context.t1 = _context.sent;
|
|
20948
|
+
_context.t0.push.call(_context.t0, _context.t1);
|
|
20949
|
+
if (keepWaitingIf(attempts[attempts.length - 1])) {
|
|
20950
|
+
_context.next = 11;
|
|
20951
|
+
break;
|
|
20952
|
+
}
|
|
20953
|
+
return _context.abrupt("return", attempts);
|
|
20954
|
+
case 11:
|
|
20955
|
+
waitUntil = new Date(Date.now() + timeoutInSeconds * 1000).valueOf();
|
|
20956
|
+
waitTime = 1000;
|
|
20957
|
+
totalWaitTime = waitTime;
|
|
20958
|
+
case 14:
|
|
20959
|
+
if (!(Date.now() < waitUntil && keepWaitingIf(attempts[attempts.length - 1]))) {
|
|
20960
|
+
_context.next = 30;
|
|
20961
|
+
break;
|
|
20962
|
+
}
|
|
20963
|
+
count += 1;
|
|
20964
|
+
if (verbose) {
|
|
20965
|
+
console.info("Waiting ".concat(waitTime, "ms before trying again (bringing the total wait time to ").concat(totalWaitTime, "ms so far, of total ").concat(timeoutInSeconds * 1000, "ms)"));
|
|
20966
|
+
}
|
|
20967
|
+
_context.next = 19;
|
|
20968
|
+
return new Promise(function (res) {
|
|
20969
|
+
return setTimeout(res, waitTime);
|
|
20970
|
+
});
|
|
20971
|
+
case 19:
|
|
20972
|
+
waitTime *= exponentialFactor;
|
|
20973
|
+
if (new Date(Date.now() + waitTime).valueOf() > waitUntil) {
|
|
20974
|
+
waitTime = waitUntil - Date.now();
|
|
20975
|
+
if (verbose) {
|
|
20976
|
+
console.info("was gonna wait too long; new waitTime: ".concat(waitTime, "ms"));
|
|
20977
|
+
}
|
|
20978
|
+
}
|
|
20979
|
+
totalWaitTime = waitTime + totalWaitTime;
|
|
20980
|
+
_context.t2 = attempts;
|
|
20981
|
+
_context.next = 25;
|
|
20982
|
+
return fn(attempts[attempts.length - 1]);
|
|
20983
|
+
case 25:
|
|
20984
|
+
_context.t3 = _context.sent;
|
|
20985
|
+
_context.t2.push.call(_context.t2, _context.t3);
|
|
20986
|
+
if (verbose && keepWaitingIf(attempts[attempts.length - 1])) {
|
|
20987
|
+
console.info("".concat(count, ". Called ").concat(fn, "; ").concat(attempts.length, " prev attempts. Most recent: ").concat(JSON.stringify(attempts[attempts.length - 1], null, 2)));
|
|
20988
|
+
}
|
|
20989
|
+
_context.next = 14;
|
|
20990
|
+
break;
|
|
20991
|
+
case 30:
|
|
20992
|
+
return _context.abrupt("return", attempts);
|
|
20993
|
+
case 31:
|
|
20994
|
+
case "end":
|
|
20995
|
+
return _context.stop();
|
|
20996
|
+
}
|
|
20997
|
+
}, _callee);
|
|
20998
|
+
}));
|
|
20999
|
+
return _withExponentialBackoff.apply(this, arguments);
|
|
21000
|
+
}
|
|
21001
|
+
var contractErrorPattern = /Error\(Contract, #(\d+)\)/;
|
|
21002
|
+
function implementsToString(obj) {
|
|
21003
|
+
return utils_typeof(obj) === "object" && obj !== null && "toString" in obj;
|
|
21004
|
+
}
|
|
21005
|
+
function processSpecEntryStream(buffer) {
|
|
21006
|
+
var reader = new lib.cereal.XdrReader(buffer);
|
|
21007
|
+
var res = [];
|
|
21008
|
+
while (!reader.eof) {
|
|
21009
|
+
res.push(lib.xdr.ScSpecEntry.read(reader));
|
|
21010
|
+
}
|
|
21011
|
+
return res;
|
|
21012
|
+
}
|
|
21013
|
+
;// CONCATENATED MODULE: ./src/contract/sent_transaction.ts
|
|
21014
|
+
var _SentTransaction;
|
|
21015
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
21016
|
+
function _possibleConstructorReturn(self, call) { if (call && (sent_transaction_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
21017
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
21018
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
21019
|
+
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
|
21020
|
+
function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
|
|
21021
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21022
|
+
function _isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf("[native code]") !== -1; } catch (e) { return typeof fn === "function"; } }
|
|
21023
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21024
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
21025
|
+
function sent_transaction_typeof(o) { "@babel/helpers - typeof"; return sent_transaction_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; }, sent_transaction_typeof(o); }
|
|
21026
|
+
function sent_transaction_regeneratorRuntime() { "use strict"; sent_transaction_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" == sent_transaction_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 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(sent_transaction_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 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 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; }
|
|
21027
|
+
function sent_transaction_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); } }
|
|
21028
|
+
function sent_transaction_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { sent_transaction_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { sent_transaction_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
21029
|
+
function sent_transaction_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21030
|
+
function sent_transaction_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, sent_transaction_toPropertyKey(descriptor.key), descriptor); } }
|
|
21031
|
+
function sent_transaction_createClass(Constructor, protoProps, staticProps) { if (protoProps) sent_transaction_defineProperties(Constructor.prototype, protoProps); if (staticProps) sent_transaction_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
21032
|
+
function _defineProperty(obj, key, value) { key = sent_transaction_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21033
|
+
function sent_transaction_toPropertyKey(t) { var i = sent_transaction_toPrimitive(t, "string"); return "symbol" == sent_transaction_typeof(i) ? i : i + ""; }
|
|
21034
|
+
function sent_transaction_toPrimitive(t, r) { if ("object" != sent_transaction_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != sent_transaction_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21035
|
+
|
|
21036
|
+
|
|
21037
|
+
|
|
21038
|
+
|
|
21039
|
+
var SentTransaction = function () {
|
|
21040
|
+
function SentTransaction(signTransaction, assembled) {
|
|
21041
|
+
var _this = this,
|
|
21042
|
+
_this$assembled$optio2;
|
|
21043
|
+
sent_transaction_classCallCheck(this, SentTransaction);
|
|
21044
|
+
_defineProperty(this, "send", sent_transaction_asyncToGenerator(sent_transaction_regeneratorRuntime().mark(function _callee() {
|
|
21045
|
+
var _this$assembled$optio;
|
|
21046
|
+
var timeoutInSeconds, signature, hash;
|
|
21047
|
+
return sent_transaction_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
21048
|
+
while (1) switch (_context.prev = _context.next) {
|
|
21049
|
+
case 0:
|
|
21050
|
+
timeoutInSeconds = (_this$assembled$optio = _this.assembled.options.timeoutInSeconds) !== null && _this$assembled$optio !== void 0 ? _this$assembled$optio : DEFAULT_TIMEOUT;
|
|
21051
|
+
_this.assembled.built = lib.TransactionBuilder.cloneFrom(_this.assembled.built, {
|
|
21052
|
+
fee: _this.assembled.built.fee,
|
|
21053
|
+
timebounds: undefined,
|
|
21054
|
+
sorobanData: new lib.SorobanDataBuilder(_this.assembled.simulationData.transactionData.toXDR()).build()
|
|
21055
|
+
}).setTimeout(timeoutInSeconds).build();
|
|
21056
|
+
_context.next = 4;
|
|
21057
|
+
return _this.signTransaction(_this.assembled.built.toXDR(), {
|
|
21058
|
+
networkPassphrase: _this.assembled.options.networkPassphrase
|
|
21059
|
+
});
|
|
21060
|
+
case 4:
|
|
21061
|
+
signature = _context.sent;
|
|
21062
|
+
_this.signed = lib.TransactionBuilder.fromXDR(signature, _this.assembled.options.networkPassphrase);
|
|
21063
|
+
_context.next = 8;
|
|
21064
|
+
return _this.server.sendTransaction(_this.signed);
|
|
21065
|
+
case 8:
|
|
21066
|
+
_this.sendTransactionResponse = _context.sent;
|
|
21067
|
+
if (!(_this.sendTransactionResponse.status !== "PENDING")) {
|
|
21068
|
+
_context.next = 11;
|
|
21069
|
+
break;
|
|
21070
|
+
}
|
|
21071
|
+
throw new SentTransaction.Errors.SendFailed("Sending the transaction to the network failed!\n".concat(JSON.stringify(_this.sendTransactionResponse, null, 2)));
|
|
21072
|
+
case 11:
|
|
21073
|
+
hash = _this.sendTransactionResponse.hash;
|
|
21074
|
+
_context.next = 14;
|
|
21075
|
+
return withExponentialBackoff(function () {
|
|
21076
|
+
return _this.server.getTransaction(hash);
|
|
21077
|
+
}, function (resp) {
|
|
21078
|
+
return resp.status === api/* Api */.j.GetTransactionStatus.NOT_FOUND;
|
|
21079
|
+
}, timeoutInSeconds);
|
|
21080
|
+
case 14:
|
|
21081
|
+
_this.getTransactionResponseAll = _context.sent;
|
|
21082
|
+
_this.getTransactionResponse = _this.getTransactionResponseAll[_this.getTransactionResponseAll.length - 1];
|
|
21083
|
+
if (!(_this.getTransactionResponse.status === api/* Api */.j.GetTransactionStatus.NOT_FOUND)) {
|
|
21084
|
+
_context.next = 18;
|
|
21085
|
+
break;
|
|
21086
|
+
}
|
|
21087
|
+
throw new SentTransaction.Errors.TransactionStillPending("Waited ".concat(timeoutInSeconds, " seconds for transaction to complete, but it did not. ") + "Returning anyway. Check the transaction status manually. " + "Sent transaction: ".concat(JSON.stringify(_this.sendTransactionResponse, null, 2), "\n") + "All attempts to get the result: ".concat(JSON.stringify(_this.getTransactionResponseAll, null, 2)));
|
|
21088
|
+
case 18:
|
|
21089
|
+
return _context.abrupt("return", _this);
|
|
21090
|
+
case 19:
|
|
21091
|
+
case "end":
|
|
21092
|
+
return _context.stop();
|
|
21093
|
+
}
|
|
21094
|
+
}, _callee);
|
|
21095
|
+
})));
|
|
21096
|
+
this.signTransaction = signTransaction;
|
|
21097
|
+
this.assembled = assembled;
|
|
21098
|
+
if (!signTransaction) {
|
|
21099
|
+
throw new Error("You must provide a `signTransaction` function to send a transaction");
|
|
21100
|
+
}
|
|
21101
|
+
this.server = new server/* Server */.gq(this.assembled.options.rpcUrl, {
|
|
21102
|
+
allowHttp: (_this$assembled$optio2 = this.assembled.options.allowHttp) !== null && _this$assembled$optio2 !== void 0 ? _this$assembled$optio2 : false
|
|
21103
|
+
});
|
|
21104
|
+
}
|
|
21105
|
+
return sent_transaction_createClass(SentTransaction, [{
|
|
21106
|
+
key: "result",
|
|
21107
|
+
get: function get() {
|
|
21108
|
+
if ("getTransactionResponse" in this && this.getTransactionResponse) {
|
|
21109
|
+
if ("returnValue" in this.getTransactionResponse) {
|
|
21110
|
+
return this.assembled.options.parseResultXdr(this.getTransactionResponse.returnValue);
|
|
21111
|
+
}
|
|
21112
|
+
throw new Error("Transaction failed! Cannot parse result.");
|
|
21113
|
+
}
|
|
21114
|
+
if (this.sendTransactionResponse) {
|
|
21115
|
+
var _this$sendTransaction;
|
|
21116
|
+
var errorResult = (_this$sendTransaction = this.sendTransactionResponse.errorResult) === null || _this$sendTransaction === void 0 ? void 0 : _this$sendTransaction.result();
|
|
21117
|
+
if (errorResult) {
|
|
21118
|
+
throw new SentTransaction.Errors.SendFailed("Transaction simulation looked correct, but attempting to send the transaction failed. Check `simulation` and `sendTransactionResponseAll` to troubleshoot. Decoded `sendTransactionResponse.errorResultXdr`: ".concat(errorResult));
|
|
21119
|
+
}
|
|
21120
|
+
throw new SentTransaction.Errors.SendResultOnly("Transaction was sent to the network, but not yet awaited. No result to show. Await transaction completion with `getTransaction(sendTransactionResponse.hash)`");
|
|
21121
|
+
}
|
|
21122
|
+
throw new Error("Sending transaction failed: ".concat(JSON.stringify(this.assembled)));
|
|
21123
|
+
}
|
|
21124
|
+
}]);
|
|
21125
|
+
}();
|
|
21126
|
+
_SentTransaction = SentTransaction;
|
|
21127
|
+
_defineProperty(SentTransaction, "Errors", {
|
|
21128
|
+
SendFailed: function (_Error) {
|
|
21129
|
+
function SendFailedError() {
|
|
21130
|
+
sent_transaction_classCallCheck(this, SendFailedError);
|
|
21131
|
+
return _callSuper(this, SendFailedError, arguments);
|
|
21132
|
+
}
|
|
21133
|
+
_inherits(SendFailedError, _Error);
|
|
21134
|
+
return sent_transaction_createClass(SendFailedError);
|
|
21135
|
+
}(_wrapNativeSuper(Error)),
|
|
21136
|
+
SendResultOnly: function (_Error2) {
|
|
21137
|
+
function SendResultOnlyError() {
|
|
21138
|
+
sent_transaction_classCallCheck(this, SendResultOnlyError);
|
|
21139
|
+
return _callSuper(this, SendResultOnlyError, arguments);
|
|
21140
|
+
}
|
|
21141
|
+
_inherits(SendResultOnlyError, _Error2);
|
|
21142
|
+
return sent_transaction_createClass(SendResultOnlyError);
|
|
21143
|
+
}(_wrapNativeSuper(Error)),
|
|
21144
|
+
TransactionStillPending: function (_Error3) {
|
|
21145
|
+
function TransactionStillPendingError() {
|
|
21146
|
+
sent_transaction_classCallCheck(this, TransactionStillPendingError);
|
|
21147
|
+
return _callSuper(this, TransactionStillPendingError, arguments);
|
|
21148
|
+
}
|
|
21149
|
+
_inherits(TransactionStillPendingError, _Error3);
|
|
21150
|
+
return sent_transaction_createClass(TransactionStillPendingError);
|
|
21151
|
+
}(_wrapNativeSuper(Error))
|
|
21152
|
+
});
|
|
21153
|
+
_defineProperty(SentTransaction, "init", function () {
|
|
21154
|
+
var _ref2 = sent_transaction_asyncToGenerator(sent_transaction_regeneratorRuntime().mark(function _callee2(signTransaction, assembled) {
|
|
21155
|
+
var tx, sent;
|
|
21156
|
+
return sent_transaction_regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
21157
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
21158
|
+
case 0:
|
|
21159
|
+
tx = new _SentTransaction(signTransaction, assembled);
|
|
21160
|
+
_context2.next = 3;
|
|
21161
|
+
return tx.send();
|
|
21162
|
+
case 3:
|
|
21163
|
+
sent = _context2.sent;
|
|
21164
|
+
return _context2.abrupt("return", sent);
|
|
21165
|
+
case 5:
|
|
21166
|
+
case "end":
|
|
21167
|
+
return _context2.stop();
|
|
21168
|
+
}
|
|
21169
|
+
}, _callee2);
|
|
21170
|
+
}));
|
|
21171
|
+
return function (_x, _x2) {
|
|
21172
|
+
return _ref2.apply(this, arguments);
|
|
21173
|
+
};
|
|
21174
|
+
}());
|
|
21175
|
+
;// CONCATENATED MODULE: ./src/contract/assembled_transaction.ts
|
|
20877
21176
|
/* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"];
|
|
20878
|
-
function
|
|
20879
|
-
function
|
|
20880
|
-
function
|
|
20881
|
-
function
|
|
20882
|
-
function
|
|
20883
|
-
function
|
|
20884
|
-
function
|
|
20885
|
-
function
|
|
20886
|
-
function
|
|
20887
|
-
function
|
|
21177
|
+
function assembled_transaction_callSuper(t, o, e) { return o = assembled_transaction_getPrototypeOf(o), assembled_transaction_possibleConstructorReturn(t, assembled_transaction_isNativeReflectConstruct() ? Reflect.construct(o, e || [], assembled_transaction_getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
21178
|
+
function assembled_transaction_possibleConstructorReturn(self, call) { if (call && (assembled_transaction_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return assembled_transaction_assertThisInitialized(self); }
|
|
21179
|
+
function assembled_transaction_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
21180
|
+
function assembled_transaction_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) assembled_transaction_setPrototypeOf(subClass, superClass); }
|
|
21181
|
+
function assembled_transaction_wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; assembled_transaction_wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !assembled_transaction_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return assembled_transaction_construct(Class, arguments, assembled_transaction_getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return assembled_transaction_setPrototypeOf(Wrapper, Class); }; return assembled_transaction_wrapNativeSuper(Class); }
|
|
21182
|
+
function assembled_transaction_construct(t, e, r) { if (assembled_transaction_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && assembled_transaction_setPrototypeOf(p, r.prototype), p; }
|
|
21183
|
+
function assembled_transaction_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (assembled_transaction_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21184
|
+
function assembled_transaction_isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf("[native code]") !== -1; } catch (e) { return typeof fn === "function"; } }
|
|
21185
|
+
function assembled_transaction_setPrototypeOf(o, p) { assembled_transaction_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return assembled_transaction_setPrototypeOf(o, p); }
|
|
21186
|
+
function assembled_transaction_getPrototypeOf(o) { assembled_transaction_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return assembled_transaction_getPrototypeOf(o); }
|
|
21187
|
+
function assembled_transaction_typeof(o) { "@babel/helpers - typeof"; return assembled_transaction_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; }, assembled_transaction_typeof(o); }
|
|
20888
21188
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
20889
21189
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20890
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
20891
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
20892
21190
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
20893
21191
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21192
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
21193
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
21194
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21195
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21196
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
21197
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
21198
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
21199
|
+
function assembled_transaction_regeneratorRuntime() { "use strict"; assembled_transaction_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" == assembled_transaction_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 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(assembled_transaction_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 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 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; }
|
|
21200
|
+
function assembled_transaction_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); } }
|
|
21201
|
+
function assembled_transaction_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { assembled_transaction_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { assembled_transaction_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
21202
|
+
function assembled_transaction_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21203
|
+
function assembled_transaction_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, assembled_transaction_toPropertyKey(descriptor.key), descriptor); } }
|
|
21204
|
+
function assembled_transaction_createClass(Constructor, protoProps, staticProps) { if (protoProps) assembled_transaction_defineProperties(Constructor.prototype, protoProps); if (staticProps) assembled_transaction_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
21205
|
+
function assembled_transaction_defineProperty(obj, key, value) { key = assembled_transaction_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21206
|
+
function assembled_transaction_toPropertyKey(t) { var i = assembled_transaction_toPrimitive(t, "string"); return "symbol" == assembled_transaction_typeof(i) ? i : i + ""; }
|
|
21207
|
+
function assembled_transaction_toPrimitive(t, r) { if ("object" != assembled_transaction_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != assembled_transaction_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21208
|
+
|
|
21209
|
+
|
|
21210
|
+
|
|
21211
|
+
|
|
21212
|
+
|
|
21213
|
+
|
|
21214
|
+
|
|
21215
|
+
var NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
|
|
21216
|
+
var AssembledTransaction = function () {
|
|
21217
|
+
function AssembledTransaction(options) {
|
|
21218
|
+
var _this = this,
|
|
21219
|
+
_this$options$simulat,
|
|
21220
|
+
_this$options$allowHt;
|
|
21221
|
+
assembled_transaction_classCallCheck(this, AssembledTransaction);
|
|
21222
|
+
assembled_transaction_defineProperty(this, "simulate", assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee() {
|
|
21223
|
+
return assembled_transaction_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
21224
|
+
while (1) switch (_context.prev = _context.next) {
|
|
21225
|
+
case 0:
|
|
21226
|
+
if (_this.raw) {
|
|
21227
|
+
_context.next = 2;
|
|
21228
|
+
break;
|
|
21229
|
+
}
|
|
21230
|
+
throw new Error("Transaction has not yet been assembled; " + "call `AssembledTransaction.build` first.");
|
|
21231
|
+
case 2:
|
|
21232
|
+
_this.built = _this.raw.build();
|
|
21233
|
+
_context.next = 5;
|
|
21234
|
+
return _this.server.simulateTransaction(_this.built);
|
|
21235
|
+
case 5:
|
|
21236
|
+
_this.simulation = _context.sent;
|
|
21237
|
+
if (api/* Api */.j.isSimulationSuccess(_this.simulation)) {
|
|
21238
|
+
_this.built = (0,transaction/* assembleTransaction */.X)(_this.built, _this.simulation).build();
|
|
21239
|
+
}
|
|
21240
|
+
return _context.abrupt("return", _this);
|
|
21241
|
+
case 8:
|
|
21242
|
+
case "end":
|
|
21243
|
+
return _context.stop();
|
|
21244
|
+
}
|
|
21245
|
+
}, _callee);
|
|
21246
|
+
})));
|
|
21247
|
+
assembled_transaction_defineProperty(this, "signAndSend", assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee2() {
|
|
21248
|
+
var _ref3,
|
|
21249
|
+
_ref3$force,
|
|
21250
|
+
force,
|
|
21251
|
+
_ref3$signTransaction,
|
|
21252
|
+
signTransaction,
|
|
21253
|
+
typeChecked,
|
|
21254
|
+
sent,
|
|
21255
|
+
_args2 = arguments;
|
|
21256
|
+
return assembled_transaction_regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
21257
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
21258
|
+
case 0:
|
|
21259
|
+
_ref3 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, _ref3$force = _ref3.force, force = _ref3$force === void 0 ? false : _ref3$force, _ref3$signTransaction = _ref3.signTransaction, signTransaction = _ref3$signTransaction === void 0 ? _this.options.signTransaction : _ref3$signTransaction;
|
|
21260
|
+
if (_this.built) {
|
|
21261
|
+
_context2.next = 3;
|
|
21262
|
+
break;
|
|
21263
|
+
}
|
|
21264
|
+
throw new Error("Transaction has not yet been simulated");
|
|
21265
|
+
case 3:
|
|
21266
|
+
if (!(!force && _this.isReadCall)) {
|
|
21267
|
+
_context2.next = 5;
|
|
21268
|
+
break;
|
|
21269
|
+
}
|
|
21270
|
+
throw new AssembledTransaction.Errors.NoSignatureNeeded("This is a read call. It requires no signature or sending. " + "Use `force: true` to sign and send anyway.");
|
|
21271
|
+
case 5:
|
|
21272
|
+
if (signTransaction) {
|
|
21273
|
+
_context2.next = 7;
|
|
21274
|
+
break;
|
|
21275
|
+
}
|
|
21276
|
+
throw new AssembledTransaction.Errors.NoSigner("You must provide a signTransaction function, either when calling " + "`signAndSend` or when initializing your Client");
|
|
21277
|
+
case 7:
|
|
21278
|
+
if (!_this.needsNonInvokerSigningBy().length) {
|
|
21279
|
+
_context2.next = 9;
|
|
21280
|
+
break;
|
|
21281
|
+
}
|
|
21282
|
+
throw new AssembledTransaction.Errors.NeedsMoreSignatures("Transaction requires more signatures. " + "See `needsNonInvokerSigningBy` for details.");
|
|
21283
|
+
case 9:
|
|
21284
|
+
typeChecked = _this;
|
|
21285
|
+
_context2.next = 12;
|
|
21286
|
+
return SentTransaction.init(signTransaction, typeChecked);
|
|
21287
|
+
case 12:
|
|
21288
|
+
sent = _context2.sent;
|
|
21289
|
+
return _context2.abrupt("return", sent);
|
|
21290
|
+
case 14:
|
|
21291
|
+
case "end":
|
|
21292
|
+
return _context2.stop();
|
|
21293
|
+
}
|
|
21294
|
+
}, _callee2);
|
|
21295
|
+
})));
|
|
21296
|
+
assembled_transaction_defineProperty(this, "getStorageExpiration", assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee3() {
|
|
21297
|
+
var entryRes;
|
|
21298
|
+
return assembled_transaction_regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
21299
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
21300
|
+
case 0:
|
|
21301
|
+
_context3.next = 2;
|
|
21302
|
+
return _this.server.getLedgerEntries(new lib.Contract(_this.options.contractId).getFootprint());
|
|
21303
|
+
case 2:
|
|
21304
|
+
entryRes = _context3.sent;
|
|
21305
|
+
if (!(!entryRes.entries || !entryRes.entries.length || !entryRes.entries[0].liveUntilLedgerSeq)) {
|
|
21306
|
+
_context3.next = 5;
|
|
21307
|
+
break;
|
|
21308
|
+
}
|
|
21309
|
+
throw new Error("failed to get ledger entry");
|
|
21310
|
+
case 5:
|
|
21311
|
+
return _context3.abrupt("return", entryRes.entries[0].liveUntilLedgerSeq);
|
|
21312
|
+
case 6:
|
|
21313
|
+
case "end":
|
|
21314
|
+
return _context3.stop();
|
|
21315
|
+
}
|
|
21316
|
+
}, _callee3);
|
|
21317
|
+
})));
|
|
21318
|
+
assembled_transaction_defineProperty(this, "needsNonInvokerSigningBy", function () {
|
|
21319
|
+
var _rawInvokeHostFunctio;
|
|
21320
|
+
var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
21321
|
+
_ref5$includeAlreadyS = _ref5.includeAlreadySigned,
|
|
21322
|
+
includeAlreadySigned = _ref5$includeAlreadyS === void 0 ? false : _ref5$includeAlreadyS;
|
|
21323
|
+
if (!_this.built) {
|
|
21324
|
+
throw new Error("Transaction has not yet been simulated");
|
|
21325
|
+
}
|
|
21326
|
+
if (!("operations" in _this.built)) {
|
|
21327
|
+
throw new Error("Unexpected Transaction type; no operations: ".concat(JSON.stringify(_this.built)));
|
|
21328
|
+
}
|
|
21329
|
+
var rawInvokeHostFunctionOp = _this.built.operations[0];
|
|
21330
|
+
return _toConsumableArray(new Set(((_rawInvokeHostFunctio = rawInvokeHostFunctionOp.auth) !== null && _rawInvokeHostFunctio !== void 0 ? _rawInvokeHostFunctio : []).filter(function (entry) {
|
|
21331
|
+
return entry.credentials().switch() === lib.xdr.SorobanCredentialsType.sorobanCredentialsAddress() && (includeAlreadySigned || entry.credentials().address().signature().switch().name === "scvVoid");
|
|
21332
|
+
}).map(function (entry) {
|
|
21333
|
+
return lib.StrKey.encodeEd25519PublicKey(entry.credentials().address().address().accountId().ed25519());
|
|
21334
|
+
})));
|
|
21335
|
+
});
|
|
21336
|
+
assembled_transaction_defineProperty(this, "signAuthEntries", assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee5() {
|
|
21337
|
+
var _rawInvokeHostFunctio2;
|
|
21338
|
+
var _ref7,
|
|
21339
|
+
_ref7$expiration,
|
|
21340
|
+
expiration,
|
|
21341
|
+
_ref7$signAuthEntry,
|
|
21342
|
+
signAuthEntry,
|
|
21343
|
+
_ref7$publicKey,
|
|
21344
|
+
publicKey,
|
|
21345
|
+
needsNonInvokerSigningBy,
|
|
21346
|
+
rawInvokeHostFunctionOp,
|
|
21347
|
+
authEntries,
|
|
21348
|
+
_iterator,
|
|
21349
|
+
_step,
|
|
21350
|
+
_step$value,
|
|
21351
|
+
i,
|
|
21352
|
+
entry,
|
|
21353
|
+
pk,
|
|
21354
|
+
_args5 = arguments;
|
|
21355
|
+
return assembled_transaction_regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
21356
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
21357
|
+
case 0:
|
|
21358
|
+
_ref7 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, _ref7$expiration = _ref7.expiration, expiration = _ref7$expiration === void 0 ? _this.getStorageExpiration() : _ref7$expiration, _ref7$signAuthEntry = _ref7.signAuthEntry, signAuthEntry = _ref7$signAuthEntry === void 0 ? _this.options.signAuthEntry : _ref7$signAuthEntry, _ref7$publicKey = _ref7.publicKey, publicKey = _ref7$publicKey === void 0 ? _this.options.publicKey : _ref7$publicKey;
|
|
21359
|
+
if (_this.built) {
|
|
21360
|
+
_context5.next = 3;
|
|
21361
|
+
break;
|
|
21362
|
+
}
|
|
21363
|
+
throw new Error("Transaction has not yet been assembled or simulated");
|
|
21364
|
+
case 3:
|
|
21365
|
+
needsNonInvokerSigningBy = _this.needsNonInvokerSigningBy();
|
|
21366
|
+
if (needsNonInvokerSigningBy) {
|
|
21367
|
+
_context5.next = 6;
|
|
21368
|
+
break;
|
|
21369
|
+
}
|
|
21370
|
+
throw new AssembledTransaction.Errors.NoUnsignedNonInvokerAuthEntries("No unsigned non-invoker auth entries; maybe you already signed?");
|
|
21371
|
+
case 6:
|
|
21372
|
+
if (!(needsNonInvokerSigningBy.indexOf(publicKey !== null && publicKey !== void 0 ? publicKey : "") === -1)) {
|
|
21373
|
+
_context5.next = 8;
|
|
21374
|
+
break;
|
|
21375
|
+
}
|
|
21376
|
+
throw new AssembledTransaction.Errors.NoSignatureNeeded("No auth entries for public key \"".concat(publicKey, "\""));
|
|
21377
|
+
case 8:
|
|
21378
|
+
if (signAuthEntry) {
|
|
21379
|
+
_context5.next = 10;
|
|
21380
|
+
break;
|
|
21381
|
+
}
|
|
21382
|
+
throw new AssembledTransaction.Errors.NoSigner("You must provide `signAuthEntry` when calling `signAuthEntries`, " + "or when constructing the `Client` or `AssembledTransaction`");
|
|
21383
|
+
case 10:
|
|
21384
|
+
rawInvokeHostFunctionOp = _this.built.operations[0];
|
|
21385
|
+
authEntries = (_rawInvokeHostFunctio2 = rawInvokeHostFunctionOp.auth) !== null && _rawInvokeHostFunctio2 !== void 0 ? _rawInvokeHostFunctio2 : [];
|
|
21386
|
+
_iterator = _createForOfIteratorHelper(authEntries.entries());
|
|
21387
|
+
_context5.prev = 13;
|
|
21388
|
+
_iterator.s();
|
|
21389
|
+
case 15:
|
|
21390
|
+
if ((_step = _iterator.n()).done) {
|
|
21391
|
+
_context5.next = 34;
|
|
21392
|
+
break;
|
|
21393
|
+
}
|
|
21394
|
+
_step$value = _slicedToArray(_step.value, 2), i = _step$value[0], entry = _step$value[1];
|
|
21395
|
+
if (!(entry.credentials().switch() !== lib.xdr.SorobanCredentialsType.sorobanCredentialsAddress())) {
|
|
21396
|
+
_context5.next = 19;
|
|
21397
|
+
break;
|
|
21398
|
+
}
|
|
21399
|
+
return _context5.abrupt("continue", 32);
|
|
21400
|
+
case 19:
|
|
21401
|
+
pk = lib.StrKey.encodeEd25519PublicKey(entry.credentials().address().address().accountId().ed25519());
|
|
21402
|
+
if (!(pk !== publicKey)) {
|
|
21403
|
+
_context5.next = 22;
|
|
21404
|
+
break;
|
|
21405
|
+
}
|
|
21406
|
+
return _context5.abrupt("continue", 32);
|
|
21407
|
+
case 22:
|
|
21408
|
+
_context5.t0 = lib.authorizeEntry;
|
|
21409
|
+
_context5.t1 = entry;
|
|
21410
|
+
_context5.t2 = function () {
|
|
21411
|
+
var _ref8 = assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee4(preimage) {
|
|
21412
|
+
return assembled_transaction_regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
21413
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
21414
|
+
case 0:
|
|
21415
|
+
_context4.t0 = Buffer;
|
|
21416
|
+
_context4.next = 3;
|
|
21417
|
+
return signAuthEntry(preimage.toXDR("base64"));
|
|
21418
|
+
case 3:
|
|
21419
|
+
_context4.t1 = _context4.sent;
|
|
21420
|
+
return _context4.abrupt("return", _context4.t0.from.call(_context4.t0, _context4.t1, "base64"));
|
|
21421
|
+
case 5:
|
|
21422
|
+
case "end":
|
|
21423
|
+
return _context4.stop();
|
|
21424
|
+
}
|
|
21425
|
+
}, _callee4);
|
|
21426
|
+
}));
|
|
21427
|
+
return function (_x) {
|
|
21428
|
+
return _ref8.apply(this, arguments);
|
|
21429
|
+
};
|
|
21430
|
+
}();
|
|
21431
|
+
_context5.next = 27;
|
|
21432
|
+
return expiration;
|
|
21433
|
+
case 27:
|
|
21434
|
+
_context5.t3 = _context5.sent;
|
|
21435
|
+
_context5.t4 = _this.options.networkPassphrase;
|
|
21436
|
+
_context5.next = 31;
|
|
21437
|
+
return (0, _context5.t0)(_context5.t1, _context5.t2, _context5.t3, _context5.t4);
|
|
21438
|
+
case 31:
|
|
21439
|
+
authEntries[i] = _context5.sent;
|
|
21440
|
+
case 32:
|
|
21441
|
+
_context5.next = 15;
|
|
21442
|
+
break;
|
|
21443
|
+
case 34:
|
|
21444
|
+
_context5.next = 39;
|
|
21445
|
+
break;
|
|
21446
|
+
case 36:
|
|
21447
|
+
_context5.prev = 36;
|
|
21448
|
+
_context5.t5 = _context5["catch"](13);
|
|
21449
|
+
_iterator.e(_context5.t5);
|
|
21450
|
+
case 39:
|
|
21451
|
+
_context5.prev = 39;
|
|
21452
|
+
_iterator.f();
|
|
21453
|
+
return _context5.finish(39);
|
|
21454
|
+
case 42:
|
|
21455
|
+
case "end":
|
|
21456
|
+
return _context5.stop();
|
|
21457
|
+
}
|
|
21458
|
+
}, _callee5, null, [[13, 36, 39, 42]]);
|
|
21459
|
+
})));
|
|
21460
|
+
this.options = options;
|
|
21461
|
+
this.options.simulate = (_this$options$simulat = this.options.simulate) !== null && _this$options$simulat !== void 0 ? _this$options$simulat : true;
|
|
21462
|
+
this.server = new server/* Server */.gq(this.options.rpcUrl, {
|
|
21463
|
+
allowHttp: (_this$options$allowHt = this.options.allowHttp) !== null && _this$options$allowHt !== void 0 ? _this$options$allowHt : false
|
|
21464
|
+
});
|
|
21465
|
+
}
|
|
21466
|
+
return assembled_transaction_createClass(AssembledTransaction, [{
|
|
21467
|
+
key: "toJSON",
|
|
21468
|
+
value: function toJSON() {
|
|
21469
|
+
var _this$built;
|
|
21470
|
+
return JSON.stringify({
|
|
21471
|
+
method: this.options.method,
|
|
21472
|
+
tx: (_this$built = this.built) === null || _this$built === void 0 ? void 0 : _this$built.toXDR(),
|
|
21473
|
+
simulationResult: {
|
|
21474
|
+
auth: this.simulationData.result.auth.map(function (a) {
|
|
21475
|
+
return a.toXDR("base64");
|
|
21476
|
+
}),
|
|
21477
|
+
retval: this.simulationData.result.retval.toXDR("base64")
|
|
21478
|
+
},
|
|
21479
|
+
simulationTransactionData: this.simulationData.transactionData.toXDR("base64")
|
|
21480
|
+
});
|
|
21481
|
+
}
|
|
21482
|
+
}, {
|
|
21483
|
+
key: "simulationData",
|
|
21484
|
+
get: function get() {
|
|
21485
|
+
if (this.simulationResult && this.simulationTransactionData) {
|
|
21486
|
+
return {
|
|
21487
|
+
result: this.simulationResult,
|
|
21488
|
+
transactionData: this.simulationTransactionData
|
|
21489
|
+
};
|
|
21490
|
+
}
|
|
21491
|
+
var simulation = this.simulation;
|
|
21492
|
+
if (!simulation) {
|
|
21493
|
+
throw new AssembledTransaction.Errors.NotYetSimulated("Transaction has not yet been simulated");
|
|
21494
|
+
}
|
|
21495
|
+
if (api/* Api */.j.isSimulationError(simulation)) {
|
|
21496
|
+
throw new Error("Transaction simulation failed: \"".concat(simulation.error, "\""));
|
|
21497
|
+
}
|
|
21498
|
+
if (api/* Api */.j.isSimulationRestore(simulation)) {
|
|
21499
|
+
throw new AssembledTransaction.Errors.ExpiredState("You need to restore some contract state before you can invoke this method. ".concat(JSON.stringify(simulation, null, 2)));
|
|
21500
|
+
}
|
|
21501
|
+
if (!simulation.result) {
|
|
21502
|
+
throw new Error("Expected an invocation simulation, but got no 'result' field. Simulation: ".concat(JSON.stringify(simulation, null, 2)));
|
|
21503
|
+
}
|
|
21504
|
+
this.simulationResult = simulation.result;
|
|
21505
|
+
this.simulationTransactionData = simulation.transactionData.build();
|
|
21506
|
+
return {
|
|
21507
|
+
result: this.simulationResult,
|
|
21508
|
+
transactionData: this.simulationTransactionData
|
|
21509
|
+
};
|
|
21510
|
+
}
|
|
21511
|
+
}, {
|
|
21512
|
+
key: "result",
|
|
21513
|
+
get: function get() {
|
|
21514
|
+
try {
|
|
21515
|
+
return this.options.parseResultXdr(this.simulationData.result.retval);
|
|
21516
|
+
} catch (e) {
|
|
21517
|
+
if (!implementsToString(e)) throw e;
|
|
21518
|
+
var err = this.parseError(e.toString());
|
|
21519
|
+
if (err) return err;
|
|
21520
|
+
throw e;
|
|
21521
|
+
}
|
|
21522
|
+
}
|
|
21523
|
+
}, {
|
|
21524
|
+
key: "parseError",
|
|
21525
|
+
value: function parseError(errorMessage) {
|
|
21526
|
+
if (!this.options.errorTypes) return undefined;
|
|
21527
|
+
var match = errorMessage.match(contractErrorPattern);
|
|
21528
|
+
if (!match) return undefined;
|
|
21529
|
+
var i = parseInt(match[1], 10);
|
|
21530
|
+
var err = this.options.errorTypes[i];
|
|
21531
|
+
if (!err) return undefined;
|
|
21532
|
+
return new Err(err);
|
|
21533
|
+
}
|
|
21534
|
+
}, {
|
|
21535
|
+
key: "isReadCall",
|
|
21536
|
+
get: function get() {
|
|
21537
|
+
var authsCount = this.simulationData.result.auth.length;
|
|
21538
|
+
var writeLength = this.simulationData.transactionData.resources().footprint().readWrite().length;
|
|
21539
|
+
return authsCount === 0 && writeLength === 0;
|
|
21540
|
+
}
|
|
21541
|
+
}], [{
|
|
21542
|
+
key: "fromJSON",
|
|
21543
|
+
value: function fromJSON(options, _ref9) {
|
|
21544
|
+
var tx = _ref9.tx,
|
|
21545
|
+
simulationResult = _ref9.simulationResult,
|
|
21546
|
+
simulationTransactionData = _ref9.simulationTransactionData;
|
|
21547
|
+
var txn = new AssembledTransaction(options);
|
|
21548
|
+
txn.built = lib.TransactionBuilder.fromXDR(tx, options.networkPassphrase);
|
|
21549
|
+
txn.simulationResult = {
|
|
21550
|
+
auth: simulationResult.auth.map(function (a) {
|
|
21551
|
+
return lib.xdr.SorobanAuthorizationEntry.fromXDR(a, "base64");
|
|
21552
|
+
}),
|
|
21553
|
+
retval: lib.xdr.ScVal.fromXDR(simulationResult.retval, "base64")
|
|
21554
|
+
};
|
|
21555
|
+
txn.simulationTransactionData = lib.xdr.SorobanTransactionData.fromXDR(simulationTransactionData, "base64");
|
|
21556
|
+
return txn;
|
|
21557
|
+
}
|
|
21558
|
+
}, {
|
|
21559
|
+
key: "build",
|
|
21560
|
+
value: (function () {
|
|
21561
|
+
var _build = assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee6(options) {
|
|
21562
|
+
var _options$fee, _options$args, _options$timeoutInSec;
|
|
21563
|
+
var tx, contract, account;
|
|
21564
|
+
return assembled_transaction_regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
21565
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
21566
|
+
case 0:
|
|
21567
|
+
tx = new AssembledTransaction(options);
|
|
21568
|
+
contract = new lib.Contract(options.contractId);
|
|
21569
|
+
if (!options.publicKey) {
|
|
21570
|
+
_context6.next = 8;
|
|
21571
|
+
break;
|
|
21572
|
+
}
|
|
21573
|
+
_context6.next = 5;
|
|
21574
|
+
return tx.server.getAccount(options.publicKey);
|
|
21575
|
+
case 5:
|
|
21576
|
+
_context6.t0 = _context6.sent;
|
|
21577
|
+
_context6.next = 9;
|
|
21578
|
+
break;
|
|
21579
|
+
case 8:
|
|
21580
|
+
_context6.t0 = new lib.Account(NULL_ACCOUNT, "0");
|
|
21581
|
+
case 9:
|
|
21582
|
+
account = _context6.t0;
|
|
21583
|
+
tx.raw = new lib.TransactionBuilder(account, {
|
|
21584
|
+
fee: (_options$fee = options.fee) !== null && _options$fee !== void 0 ? _options$fee : lib.BASE_FEE,
|
|
21585
|
+
networkPassphrase: options.networkPassphrase
|
|
21586
|
+
}).addOperation(contract.call.apply(contract, [options.method].concat(_toConsumableArray((_options$args = options.args) !== null && _options$args !== void 0 ? _options$args : [])))).setTimeout((_options$timeoutInSec = options.timeoutInSeconds) !== null && _options$timeoutInSec !== void 0 ? _options$timeoutInSec : DEFAULT_TIMEOUT);
|
|
21587
|
+
if (!options.simulate) {
|
|
21588
|
+
_context6.next = 14;
|
|
21589
|
+
break;
|
|
21590
|
+
}
|
|
21591
|
+
_context6.next = 14;
|
|
21592
|
+
return tx.simulate();
|
|
21593
|
+
case 14:
|
|
21594
|
+
return _context6.abrupt("return", tx);
|
|
21595
|
+
case 15:
|
|
21596
|
+
case "end":
|
|
21597
|
+
return _context6.stop();
|
|
21598
|
+
}
|
|
21599
|
+
}, _callee6);
|
|
21600
|
+
}));
|
|
21601
|
+
function build(_x2) {
|
|
21602
|
+
return _build.apply(this, arguments);
|
|
21603
|
+
}
|
|
21604
|
+
return build;
|
|
21605
|
+
}())
|
|
21606
|
+
}]);
|
|
21607
|
+
}();
|
|
21608
|
+
assembled_transaction_defineProperty(AssembledTransaction, "Errors", {
|
|
21609
|
+
ExpiredState: function (_Error) {
|
|
21610
|
+
function ExpiredStateError() {
|
|
21611
|
+
assembled_transaction_classCallCheck(this, ExpiredStateError);
|
|
21612
|
+
return assembled_transaction_callSuper(this, ExpiredStateError, arguments);
|
|
21613
|
+
}
|
|
21614
|
+
assembled_transaction_inherits(ExpiredStateError, _Error);
|
|
21615
|
+
return assembled_transaction_createClass(ExpiredStateError);
|
|
21616
|
+
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
21617
|
+
NeedsMoreSignatures: function (_Error2) {
|
|
21618
|
+
function NeedsMoreSignaturesError() {
|
|
21619
|
+
assembled_transaction_classCallCheck(this, NeedsMoreSignaturesError);
|
|
21620
|
+
return assembled_transaction_callSuper(this, NeedsMoreSignaturesError, arguments);
|
|
21621
|
+
}
|
|
21622
|
+
assembled_transaction_inherits(NeedsMoreSignaturesError, _Error2);
|
|
21623
|
+
return assembled_transaction_createClass(NeedsMoreSignaturesError);
|
|
21624
|
+
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
21625
|
+
NoSignatureNeeded: function (_Error3) {
|
|
21626
|
+
function NoSignatureNeededError() {
|
|
21627
|
+
assembled_transaction_classCallCheck(this, NoSignatureNeededError);
|
|
21628
|
+
return assembled_transaction_callSuper(this, NoSignatureNeededError, arguments);
|
|
21629
|
+
}
|
|
21630
|
+
assembled_transaction_inherits(NoSignatureNeededError, _Error3);
|
|
21631
|
+
return assembled_transaction_createClass(NoSignatureNeededError);
|
|
21632
|
+
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
21633
|
+
NoUnsignedNonInvokerAuthEntries: function (_Error4) {
|
|
21634
|
+
function NoUnsignedNonInvokerAuthEntriesError() {
|
|
21635
|
+
assembled_transaction_classCallCheck(this, NoUnsignedNonInvokerAuthEntriesError);
|
|
21636
|
+
return assembled_transaction_callSuper(this, NoUnsignedNonInvokerAuthEntriesError, arguments);
|
|
21637
|
+
}
|
|
21638
|
+
assembled_transaction_inherits(NoUnsignedNonInvokerAuthEntriesError, _Error4);
|
|
21639
|
+
return assembled_transaction_createClass(NoUnsignedNonInvokerAuthEntriesError);
|
|
21640
|
+
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
21641
|
+
NoSigner: function (_Error5) {
|
|
21642
|
+
function NoSignerError() {
|
|
21643
|
+
assembled_transaction_classCallCheck(this, NoSignerError);
|
|
21644
|
+
return assembled_transaction_callSuper(this, NoSignerError, arguments);
|
|
21645
|
+
}
|
|
21646
|
+
assembled_transaction_inherits(NoSignerError, _Error5);
|
|
21647
|
+
return assembled_transaction_createClass(NoSignerError);
|
|
21648
|
+
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
21649
|
+
NotYetSimulated: function (_Error6) {
|
|
21650
|
+
function NotYetSimulatedError() {
|
|
21651
|
+
assembled_transaction_classCallCheck(this, NotYetSimulatedError);
|
|
21652
|
+
return assembled_transaction_callSuper(this, NotYetSimulatedError, arguments);
|
|
21653
|
+
}
|
|
21654
|
+
assembled_transaction_inherits(NotYetSimulatedError, _Error6);
|
|
21655
|
+
return assembled_transaction_createClass(NotYetSimulatedError);
|
|
21656
|
+
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
21657
|
+
FakeAccount: function (_Error7) {
|
|
21658
|
+
function FakeAccountError() {
|
|
21659
|
+
assembled_transaction_classCallCheck(this, FakeAccountError);
|
|
21660
|
+
return assembled_transaction_callSuper(this, FakeAccountError, arguments);
|
|
21661
|
+
}
|
|
21662
|
+
assembled_transaction_inherits(FakeAccountError, _Error7);
|
|
21663
|
+
return assembled_transaction_createClass(FakeAccountError);
|
|
21664
|
+
}(assembled_transaction_wrapNativeSuper(Error))
|
|
21665
|
+
});
|
|
21666
|
+
;// CONCATENATED MODULE: ./src/contract/basic_node_signer.ts
|
|
21667
|
+
/* provided dependency */ var basic_node_signer_Buffer = __webpack_require__(8287)["Buffer"];
|
|
21668
|
+
function basic_node_signer_typeof(o) { "@babel/helpers - typeof"; return basic_node_signer_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; }, basic_node_signer_typeof(o); }
|
|
21669
|
+
function basic_node_signer_regeneratorRuntime() { "use strict"; basic_node_signer_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" == basic_node_signer_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 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(basic_node_signer_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 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 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; }
|
|
21670
|
+
function basic_node_signer_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); } }
|
|
21671
|
+
function basic_node_signer_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { basic_node_signer_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { basic_node_signer_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
21672
|
+
|
|
21673
|
+
var basicNodeSigner = function basicNodeSigner(keypair, networkPassphrase) {
|
|
21674
|
+
return {
|
|
21675
|
+
signTransaction: function () {
|
|
21676
|
+
var _signTransaction = basic_node_signer_asyncToGenerator(basic_node_signer_regeneratorRuntime().mark(function _callee(tx) {
|
|
21677
|
+
var t;
|
|
21678
|
+
return basic_node_signer_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
21679
|
+
while (1) switch (_context.prev = _context.next) {
|
|
21680
|
+
case 0:
|
|
21681
|
+
t = lib.TransactionBuilder.fromXDR(tx, networkPassphrase);
|
|
21682
|
+
t.sign(keypair);
|
|
21683
|
+
return _context.abrupt("return", t.toXDR());
|
|
21684
|
+
case 3:
|
|
21685
|
+
case "end":
|
|
21686
|
+
return _context.stop();
|
|
21687
|
+
}
|
|
21688
|
+
}, _callee);
|
|
21689
|
+
}));
|
|
21690
|
+
function signTransaction(_x) {
|
|
21691
|
+
return _signTransaction.apply(this, arguments);
|
|
21692
|
+
}
|
|
21693
|
+
return signTransaction;
|
|
21694
|
+
}(),
|
|
21695
|
+
signAuthEntry: function () {
|
|
21696
|
+
var _signAuthEntry = basic_node_signer_asyncToGenerator(basic_node_signer_regeneratorRuntime().mark(function _callee2(entryXdr) {
|
|
21697
|
+
return basic_node_signer_regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
21698
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
21699
|
+
case 0:
|
|
21700
|
+
return _context2.abrupt("return", keypair.sign((0,lib.hash)(basic_node_signer_Buffer.from(entryXdr, "base64"))).toString("base64"));
|
|
21701
|
+
case 1:
|
|
21702
|
+
case "end":
|
|
21703
|
+
return _context2.stop();
|
|
21704
|
+
}
|
|
21705
|
+
}, _callee2);
|
|
21706
|
+
}));
|
|
21707
|
+
function signAuthEntry(_x2) {
|
|
21708
|
+
return _signAuthEntry.apply(this, arguments);
|
|
21709
|
+
}
|
|
21710
|
+
return signAuthEntry;
|
|
21711
|
+
}()
|
|
21712
|
+
};
|
|
21713
|
+
};
|
|
21714
|
+
;// CONCATENATED MODULE: ./src/contract/spec.ts
|
|
21715
|
+
/* provided dependency */ var spec_Buffer = __webpack_require__(8287)["Buffer"];
|
|
21716
|
+
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; }
|
|
21717
|
+
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) { spec_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; }
|
|
21718
|
+
function spec_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = spec_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
21719
|
+
function spec_typeof(o) { "@babel/helpers - typeof"; return spec_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; }, spec_typeof(o); }
|
|
21720
|
+
function spec_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21721
|
+
function spec_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, spec_toPropertyKey(descriptor.key), descriptor); } }
|
|
21722
|
+
function spec_createClass(Constructor, protoProps, staticProps) { if (protoProps) spec_defineProperties(Constructor.prototype, protoProps); if (staticProps) spec_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
21723
|
+
function spec_defineProperty(obj, key, value) { key = spec_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21724
|
+
function spec_toPropertyKey(t) { var i = spec_toPrimitive(t, "string"); return "symbol" == spec_typeof(i) ? i : i + ""; }
|
|
21725
|
+
function spec_toPrimitive(t, r) { if ("object" != spec_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != spec_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21726
|
+
function spec_slicedToArray(arr, i) { return spec_arrayWithHoles(arr) || spec_iterableToArrayLimit(arr, i) || spec_unsupportedIterableToArray(arr, i) || spec_nonIterableRest(); }
|
|
21727
|
+
function spec_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21728
|
+
function spec_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return spec_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return spec_arrayLikeToArray(o, minLen); }
|
|
21729
|
+
function spec_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
21730
|
+
function spec_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
21731
|
+
function spec_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20894
21732
|
|
|
20895
21733
|
|
|
20896
21734
|
function readObj(args, input) {
|
|
20897
21735
|
var inputName = input.name().toString();
|
|
20898
21736
|
var entry = Object.entries(args).find(function (_ref) {
|
|
20899
|
-
var _ref2 =
|
|
21737
|
+
var _ref2 = spec_slicedToArray(_ref, 2),
|
|
20900
21738
|
name = _ref2[0],
|
|
20901
21739
|
_ = _ref2[1];
|
|
20902
21740
|
return name === inputName;
|
|
@@ -20906,27 +21744,27 @@ function readObj(args, input) {
|
|
|
20906
21744
|
}
|
|
20907
21745
|
return entry[1];
|
|
20908
21746
|
}
|
|
20909
|
-
var
|
|
20910
|
-
function
|
|
20911
|
-
|
|
20912
|
-
|
|
21747
|
+
var Spec = function () {
|
|
21748
|
+
function Spec(entries) {
|
|
21749
|
+
spec_classCallCheck(this, Spec);
|
|
21750
|
+
spec_defineProperty(this, "entries", []);
|
|
20913
21751
|
if (entries.length == 0) {
|
|
20914
21752
|
throw new Error("Contract spec must have at least one entry");
|
|
20915
21753
|
}
|
|
20916
21754
|
var entry = entries[0];
|
|
20917
21755
|
if (typeof entry === "string") {
|
|
20918
21756
|
this.entries = entries.map(function (s) {
|
|
20919
|
-
return
|
|
21757
|
+
return lib.xdr.ScSpecEntry.fromXDR(s, "base64");
|
|
20920
21758
|
});
|
|
20921
21759
|
} else {
|
|
20922
21760
|
this.entries = entries;
|
|
20923
21761
|
}
|
|
20924
21762
|
}
|
|
20925
|
-
return
|
|
21763
|
+
return spec_createClass(Spec, [{
|
|
20926
21764
|
key: "funcs",
|
|
20927
21765
|
value: function funcs() {
|
|
20928
21766
|
return this.entries.filter(function (entry) {
|
|
20929
|
-
return entry.switch().value ===
|
|
21767
|
+
return entry.switch().value === lib.xdr.ScSpecEntryKind.scSpecEntryFunctionV0().value;
|
|
20930
21768
|
}).map(function (entry) {
|
|
20931
21769
|
return entry.functionV0();
|
|
20932
21770
|
});
|
|
@@ -20935,7 +21773,7 @@ var ContractSpec = function () {
|
|
|
20935
21773
|
key: "getFunc",
|
|
20936
21774
|
value: function getFunc(name) {
|
|
20937
21775
|
var entry = this.findEntry(name);
|
|
20938
|
-
if (entry.switch().value !==
|
|
21776
|
+
if (entry.switch().value !== lib.xdr.ScSpecEntryKind.scSpecEntryFunctionV0().value) {
|
|
20939
21777
|
throw new Error("".concat(name, " is not a function"));
|
|
20940
21778
|
}
|
|
20941
21779
|
return entry.functionV0();
|
|
@@ -20952,12 +21790,12 @@ var ContractSpec = function () {
|
|
|
20952
21790
|
}, {
|
|
20953
21791
|
key: "funcResToNative",
|
|
20954
21792
|
value: function funcResToNative(name, val_or_base64) {
|
|
20955
|
-
var val = typeof val_or_base64 === "string" ?
|
|
21793
|
+
var val = typeof val_or_base64 === "string" ? lib.xdr.ScVal.fromXDR(val_or_base64, "base64") : val_or_base64;
|
|
20956
21794
|
var func = this.getFunc(name);
|
|
20957
21795
|
var outputs = func.outputs();
|
|
20958
21796
|
if (outputs.length === 0) {
|
|
20959
21797
|
var type = val.switch();
|
|
20960
|
-
if (type.value !==
|
|
21798
|
+
if (type.value !== lib.xdr.ScValType.scvVoid().value) {
|
|
20961
21799
|
throw new Error("Expected void, got ".concat(type.name));
|
|
20962
21800
|
}
|
|
20963
21801
|
return null;
|
|
@@ -20966,7 +21804,7 @@ var ContractSpec = function () {
|
|
|
20966
21804
|
throw new Error("Multiple outputs not supported");
|
|
20967
21805
|
}
|
|
20968
21806
|
var output = outputs[0];
|
|
20969
|
-
if (output.switch().value ===
|
|
21807
|
+
if (output.switch().value === lib.xdr.ScSpecType.scSpecTypeResult().value) {
|
|
20970
21808
|
return new Ok(this.scValToNative(val, output.result().okType()));
|
|
20971
21809
|
}
|
|
20972
21810
|
return this.scValToNative(val, output);
|
|
@@ -20988,91 +21826,91 @@ var ContractSpec = function () {
|
|
|
20988
21826
|
var _this2 = this;
|
|
20989
21827
|
var t = ty.switch();
|
|
20990
21828
|
var value = t.value;
|
|
20991
|
-
if (t.value ===
|
|
21829
|
+
if (t.value === lib.xdr.ScSpecType.scSpecTypeUdt().value) {
|
|
20992
21830
|
var udt = ty.udt();
|
|
20993
21831
|
return this.nativeToUdt(val, udt.name().toString());
|
|
20994
21832
|
}
|
|
20995
|
-
if (value ===
|
|
21833
|
+
if (value === lib.xdr.ScSpecType.scSpecTypeOption().value) {
|
|
20996
21834
|
var opt = ty.option();
|
|
20997
21835
|
if (val === undefined) {
|
|
20998
|
-
return
|
|
21836
|
+
return lib.xdr.ScVal.scvVoid();
|
|
20999
21837
|
}
|
|
21000
21838
|
return this.nativeToScVal(val, opt.valueType());
|
|
21001
21839
|
}
|
|
21002
|
-
switch (
|
|
21840
|
+
switch (spec_typeof(val)) {
|
|
21003
21841
|
case "object":
|
|
21004
21842
|
{
|
|
21005
21843
|
var _val$constructor$name, _val$constructor;
|
|
21006
21844
|
if (val === null) {
|
|
21007
21845
|
switch (value) {
|
|
21008
|
-
case
|
|
21009
|
-
return
|
|
21846
|
+
case lib.xdr.ScSpecType.scSpecTypeVoid().value:
|
|
21847
|
+
return lib.xdr.ScVal.scvVoid();
|
|
21010
21848
|
default:
|
|
21011
21849
|
throw new TypeError("Type ".concat(ty, " was not void, but value was null"));
|
|
21012
21850
|
}
|
|
21013
21851
|
}
|
|
21014
|
-
if (val instanceof
|
|
21852
|
+
if (val instanceof lib.xdr.ScVal) {
|
|
21015
21853
|
return val;
|
|
21016
21854
|
}
|
|
21017
|
-
if (val instanceof
|
|
21018
|
-
if (ty.switch().value !==
|
|
21855
|
+
if (val instanceof lib.Address) {
|
|
21856
|
+
if (ty.switch().value !== lib.xdr.ScSpecType.scSpecTypeAddress().value) {
|
|
21019
21857
|
throw new TypeError("Type ".concat(ty, " was not address, but value was Address"));
|
|
21020
21858
|
}
|
|
21021
21859
|
return val.toScVal();
|
|
21022
21860
|
}
|
|
21023
|
-
if (val instanceof
|
|
21024
|
-
if (ty.switch().value !==
|
|
21861
|
+
if (val instanceof lib.Contract) {
|
|
21862
|
+
if (ty.switch().value !== lib.xdr.ScSpecType.scSpecTypeAddress().value) {
|
|
21025
21863
|
throw new TypeError("Type ".concat(ty, " was not address, but value was Address"));
|
|
21026
21864
|
}
|
|
21027
21865
|
return val.address().toScVal();
|
|
21028
21866
|
}
|
|
21029
|
-
if (val instanceof Uint8Array ||
|
|
21867
|
+
if (val instanceof Uint8Array || spec_Buffer.isBuffer(val)) {
|
|
21030
21868
|
var copy = Uint8Array.from(val);
|
|
21031
21869
|
switch (value) {
|
|
21032
|
-
case
|
|
21870
|
+
case lib.xdr.ScSpecType.scSpecTypeBytesN().value:
|
|
21033
21871
|
{
|
|
21034
21872
|
var bytes_n = ty.bytesN();
|
|
21035
21873
|
if (copy.length !== bytes_n.n()) {
|
|
21036
21874
|
throw new TypeError("expected ".concat(bytes_n.n(), " bytes, but got ").concat(copy.length));
|
|
21037
21875
|
}
|
|
21038
|
-
return
|
|
21876
|
+
return lib.xdr.ScVal.scvBytes(copy);
|
|
21039
21877
|
}
|
|
21040
|
-
case
|
|
21041
|
-
return
|
|
21878
|
+
case lib.xdr.ScSpecType.scSpecTypeBytes().value:
|
|
21879
|
+
return lib.xdr.ScVal.scvBytes(copy);
|
|
21042
21880
|
default:
|
|
21043
21881
|
throw new TypeError("invalid type (".concat(ty, ") specified for Bytes and BytesN"));
|
|
21044
21882
|
}
|
|
21045
21883
|
}
|
|
21046
21884
|
if (Array.isArray(val)) {
|
|
21047
21885
|
switch (value) {
|
|
21048
|
-
case
|
|
21886
|
+
case lib.xdr.ScSpecType.scSpecTypeVec().value:
|
|
21049
21887
|
{
|
|
21050
21888
|
var vec = ty.vec();
|
|
21051
21889
|
var elementType = vec.elementType();
|
|
21052
|
-
return
|
|
21890
|
+
return lib.xdr.ScVal.scvVec(val.map(function (v) {
|
|
21053
21891
|
return _this2.nativeToScVal(v, elementType);
|
|
21054
21892
|
}));
|
|
21055
21893
|
}
|
|
21056
|
-
case
|
|
21894
|
+
case lib.xdr.ScSpecType.scSpecTypeTuple().value:
|
|
21057
21895
|
{
|
|
21058
21896
|
var tup = ty.tuple();
|
|
21059
21897
|
var valTypes = tup.valueTypes();
|
|
21060
21898
|
if (val.length !== valTypes.length) {
|
|
21061
21899
|
throw new TypeError("Tuple expects ".concat(valTypes.length, " values, but ").concat(val.length, " were provided"));
|
|
21062
21900
|
}
|
|
21063
|
-
return
|
|
21901
|
+
return lib.xdr.ScVal.scvVec(val.map(function (v, i) {
|
|
21064
21902
|
return _this2.nativeToScVal(v, valTypes[i]);
|
|
21065
21903
|
}));
|
|
21066
21904
|
}
|
|
21067
|
-
case
|
|
21905
|
+
case lib.xdr.ScSpecType.scSpecTypeMap().value:
|
|
21068
21906
|
{
|
|
21069
21907
|
var map = ty.map();
|
|
21070
21908
|
var keyType = map.keyType();
|
|
21071
21909
|
var valueType = map.valueType();
|
|
21072
|
-
return
|
|
21910
|
+
return lib.xdr.ScVal.scvMap(val.map(function (entry) {
|
|
21073
21911
|
var key = _this2.nativeToScVal(entry[0], keyType);
|
|
21074
21912
|
var val = _this2.nativeToScVal(entry[1], valueType);
|
|
21075
|
-
return new
|
|
21913
|
+
return new lib.xdr.ScMapEntry({
|
|
21076
21914
|
key: key,
|
|
21077
21915
|
val: val
|
|
21078
21916
|
});
|
|
@@ -21083,7 +21921,7 @@ var ContractSpec = function () {
|
|
|
21083
21921
|
}
|
|
21084
21922
|
}
|
|
21085
21923
|
if (val.constructor === Map) {
|
|
21086
|
-
if (value !==
|
|
21924
|
+
if (value !== lib.xdr.ScSpecType.scSpecTypeMap().value) {
|
|
21087
21925
|
throw new TypeError("Type ".concat(ty, " was not map, but value was Map"));
|
|
21088
21926
|
}
|
|
21089
21927
|
var scMap = ty.map();
|
|
@@ -21092,18 +21930,18 @@ var ContractSpec = function () {
|
|
|
21092
21930
|
var values = _map.entries();
|
|
21093
21931
|
var res = values.next();
|
|
21094
21932
|
while (!res.done) {
|
|
21095
|
-
var _res$value =
|
|
21933
|
+
var _res$value = spec_slicedToArray(res.value, 2),
|
|
21096
21934
|
k = _res$value[0],
|
|
21097
21935
|
v = _res$value[1];
|
|
21098
21936
|
var key = this.nativeToScVal(k, scMap.keyType());
|
|
21099
21937
|
var _val = this.nativeToScVal(v, scMap.valueType());
|
|
21100
|
-
entries.push(new
|
|
21938
|
+
entries.push(new lib.xdr.ScMapEntry({
|
|
21101
21939
|
key: key,
|
|
21102
21940
|
val: _val
|
|
21103
21941
|
}));
|
|
21104
21942
|
res = values.next();
|
|
21105
21943
|
}
|
|
21106
|
-
return
|
|
21944
|
+
return lib.xdr.ScVal.scvMap(entries);
|
|
21107
21945
|
}
|
|
21108
21946
|
if (((_val$constructor$name = (_val$constructor = val.constructor) === null || _val$constructor === void 0 ? void 0 : _val$constructor.name) !== null && _val$constructor$name !== void 0 ? _val$constructor$name : "") !== "Object") {
|
|
21109
21947
|
var _val$constructor2;
|
|
@@ -21115,19 +21953,19 @@ var ContractSpec = function () {
|
|
|
21115
21953
|
case "bigint":
|
|
21116
21954
|
{
|
|
21117
21955
|
switch (value) {
|
|
21118
|
-
case
|
|
21119
|
-
return
|
|
21120
|
-
case
|
|
21121
|
-
return
|
|
21122
|
-
case
|
|
21123
|
-
case
|
|
21124
|
-
case
|
|
21125
|
-
case
|
|
21126
|
-
case
|
|
21127
|
-
case
|
|
21956
|
+
case lib.xdr.ScSpecType.scSpecTypeU32().value:
|
|
21957
|
+
return lib.xdr.ScVal.scvU32(val);
|
|
21958
|
+
case lib.xdr.ScSpecType.scSpecTypeI32().value:
|
|
21959
|
+
return lib.xdr.ScVal.scvI32(val);
|
|
21960
|
+
case lib.xdr.ScSpecType.scSpecTypeU64().value:
|
|
21961
|
+
case lib.xdr.ScSpecType.scSpecTypeI64().value:
|
|
21962
|
+
case lib.xdr.ScSpecType.scSpecTypeU128().value:
|
|
21963
|
+
case lib.xdr.ScSpecType.scSpecTypeI128().value:
|
|
21964
|
+
case lib.xdr.ScSpecType.scSpecTypeU256().value:
|
|
21965
|
+
case lib.xdr.ScSpecType.scSpecTypeI256().value:
|
|
21128
21966
|
{
|
|
21129
21967
|
var intType = t.name.substring(10).toLowerCase();
|
|
21130
|
-
return new
|
|
21968
|
+
return new lib.XdrLargeInt(intType, val).toScVal();
|
|
21131
21969
|
}
|
|
21132
21970
|
default:
|
|
21133
21971
|
throw new TypeError("invalid type (".concat(ty, ") specified for integer"));
|
|
@@ -21137,20 +21975,20 @@ var ContractSpec = function () {
|
|
|
21137
21975
|
return stringToScVal(val, t);
|
|
21138
21976
|
case "boolean":
|
|
21139
21977
|
{
|
|
21140
|
-
if (value !==
|
|
21978
|
+
if (value !== lib.xdr.ScSpecType.scSpecTypeBool().value) {
|
|
21141
21979
|
throw TypeError("Type ".concat(ty, " was not bool, but value was bool"));
|
|
21142
21980
|
}
|
|
21143
|
-
return
|
|
21981
|
+
return lib.xdr.ScVal.scvBool(val);
|
|
21144
21982
|
}
|
|
21145
21983
|
case "undefined":
|
|
21146
21984
|
{
|
|
21147
21985
|
if (!ty) {
|
|
21148
|
-
return
|
|
21986
|
+
return lib.xdr.ScVal.scvVoid();
|
|
21149
21987
|
}
|
|
21150
21988
|
switch (value) {
|
|
21151
|
-
case
|
|
21152
|
-
case
|
|
21153
|
-
return
|
|
21989
|
+
case lib.xdr.ScSpecType.scSpecTypeVoid().value:
|
|
21990
|
+
case lib.xdr.ScSpecType.scSpecTypeOption().value:
|
|
21991
|
+
return lib.xdr.ScVal.scvVoid();
|
|
21154
21992
|
default:
|
|
21155
21993
|
throw new TypeError("Type ".concat(ty, " was not void, but value was undefined"));
|
|
21156
21994
|
}
|
|
@@ -21158,7 +21996,7 @@ var ContractSpec = function () {
|
|
|
21158
21996
|
case "function":
|
|
21159
21997
|
return this.nativeToScVal(val(), ty);
|
|
21160
21998
|
default:
|
|
21161
|
-
throw new TypeError("failed to convert typeof ".concat(
|
|
21999
|
+
throw new TypeError("failed to convert typeof ".concat(spec_typeof(val), " (").concat(val, ")"));
|
|
21162
22000
|
}
|
|
21163
22001
|
}
|
|
21164
22002
|
}, {
|
|
@@ -21166,14 +22004,14 @@ var ContractSpec = function () {
|
|
|
21166
22004
|
value: function nativeToUdt(val, name) {
|
|
21167
22005
|
var entry = this.findEntry(name);
|
|
21168
22006
|
switch (entry.switch()) {
|
|
21169
|
-
case
|
|
22007
|
+
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtEnumV0():
|
|
21170
22008
|
if (typeof val !== "number") {
|
|
21171
|
-
throw new TypeError("expected number for enum ".concat(name, ", but got ").concat(
|
|
22009
|
+
throw new TypeError("expected number for enum ".concat(name, ", but got ").concat(spec_typeof(val)));
|
|
21172
22010
|
}
|
|
21173
22011
|
return this.nativeToEnum(val, entry.udtEnumV0());
|
|
21174
|
-
case
|
|
22012
|
+
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtStructV0():
|
|
21175
22013
|
return this.nativeToStruct(val, entry.udtStructV0());
|
|
21176
|
-
case
|
|
22014
|
+
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtUnionV0():
|
|
21177
22015
|
return this.nativeToUnion(val, entry.udtUnionV0());
|
|
21178
22016
|
default:
|
|
21179
22017
|
throw new Error("failed to parse udt ".concat(name));
|
|
@@ -21191,13 +22029,13 @@ var ContractSpec = function () {
|
|
|
21191
22029
|
if (!case_) {
|
|
21192
22030
|
throw new TypeError("no such enum entry: ".concat(entry_name, " in ").concat(union_));
|
|
21193
22031
|
}
|
|
21194
|
-
var key =
|
|
22032
|
+
var key = lib.xdr.ScVal.scvSymbol(entry_name);
|
|
21195
22033
|
switch (case_.switch()) {
|
|
21196
|
-
case
|
|
22034
|
+
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseVoidV0():
|
|
21197
22035
|
{
|
|
21198
|
-
return
|
|
22036
|
+
return lib.xdr.ScVal.scvVec([key]);
|
|
21199
22037
|
}
|
|
21200
|
-
case
|
|
22038
|
+
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0():
|
|
21201
22039
|
{
|
|
21202
22040
|
var types = case_.tupleCase().type();
|
|
21203
22041
|
if (Array.isArray(val.values)) {
|
|
@@ -21208,7 +22046,7 @@ var ContractSpec = function () {
|
|
|
21208
22046
|
return _this3.nativeToScVal(v, types[i]);
|
|
21209
22047
|
});
|
|
21210
22048
|
scvals.unshift(key);
|
|
21211
|
-
return
|
|
22049
|
+
return lib.xdr.ScVal.scvVec(scvals);
|
|
21212
22050
|
}
|
|
21213
22051
|
throw new Error("failed to parse union case ".concat(case_, " with ").concat(val));
|
|
21214
22052
|
}
|
|
@@ -21225,14 +22063,14 @@ var ContractSpec = function () {
|
|
|
21225
22063
|
if (!fields.every(isNumeric)) {
|
|
21226
22064
|
throw new Error("mixed numeric and non-numeric field names are not allowed");
|
|
21227
22065
|
}
|
|
21228
|
-
return
|
|
22066
|
+
return lib.xdr.ScVal.scvVec(fields.map(function (_, i) {
|
|
21229
22067
|
return _this4.nativeToScVal(val[i], fields[i].type());
|
|
21230
22068
|
}));
|
|
21231
22069
|
}
|
|
21232
|
-
return
|
|
22070
|
+
return lib.xdr.ScVal.scvMap(fields.map(function (field) {
|
|
21233
22071
|
var name = field.name().toString();
|
|
21234
|
-
return new
|
|
21235
|
-
key: _this4.nativeToScVal(name,
|
|
22072
|
+
return new lib.xdr.ScMapEntry({
|
|
22073
|
+
key: _this4.nativeToScVal(name, lib.xdr.ScSpecTypeDef.scSpecTypeSymbol()),
|
|
21236
22074
|
val: _this4.nativeToScVal(val[name], field.type())
|
|
21237
22075
|
});
|
|
21238
22076
|
}));
|
|
@@ -21243,14 +22081,14 @@ var ContractSpec = function () {
|
|
|
21243
22081
|
if (enum_.cases().some(function (entry) {
|
|
21244
22082
|
return entry.value() === val;
|
|
21245
22083
|
})) {
|
|
21246
|
-
return
|
|
22084
|
+
return lib.xdr.ScVal.scvU32(val);
|
|
21247
22085
|
}
|
|
21248
22086
|
throw new TypeError("no such enum entry: ".concat(val, " in ").concat(enum_));
|
|
21249
22087
|
}
|
|
21250
22088
|
}, {
|
|
21251
22089
|
key: "scValStrToNative",
|
|
21252
22090
|
value: function scValStrToNative(scv, typeDef) {
|
|
21253
|
-
return this.scValToNative(
|
|
22091
|
+
return this.scValToNative(lib.xdr.ScVal.fromXDR(scv, "base64"), typeDef);
|
|
21254
22092
|
}
|
|
21255
22093
|
}, {
|
|
21256
22094
|
key: "scValToNative",
|
|
@@ -21258,28 +22096,28 @@ var ContractSpec = function () {
|
|
|
21258
22096
|
var _this5 = this;
|
|
21259
22097
|
var t = typeDef.switch();
|
|
21260
22098
|
var value = t.value;
|
|
21261
|
-
if (value ===
|
|
22099
|
+
if (value === lib.xdr.ScSpecType.scSpecTypeUdt().value) {
|
|
21262
22100
|
return this.scValUdtToNative(scv, typeDef.udt());
|
|
21263
22101
|
}
|
|
21264
22102
|
switch (scv.switch().value) {
|
|
21265
|
-
case
|
|
22103
|
+
case lib.xdr.ScValType.scvVoid().value:
|
|
21266
22104
|
return void 0;
|
|
21267
|
-
case
|
|
21268
|
-
case
|
|
21269
|
-
case
|
|
21270
|
-
case
|
|
21271
|
-
case
|
|
21272
|
-
case
|
|
21273
|
-
return (0,
|
|
21274
|
-
case
|
|
22105
|
+
case lib.xdr.ScValType.scvU64().value:
|
|
22106
|
+
case lib.xdr.ScValType.scvI64().value:
|
|
22107
|
+
case lib.xdr.ScValType.scvU128().value:
|
|
22108
|
+
case lib.xdr.ScValType.scvI128().value:
|
|
22109
|
+
case lib.xdr.ScValType.scvU256().value:
|
|
22110
|
+
case lib.xdr.ScValType.scvI256().value:
|
|
22111
|
+
return (0,lib.scValToBigInt)(scv);
|
|
22112
|
+
case lib.xdr.ScValType.scvVec().value:
|
|
21275
22113
|
{
|
|
21276
|
-
if (value ==
|
|
22114
|
+
if (value == lib.xdr.ScSpecType.scSpecTypeVec().value) {
|
|
21277
22115
|
var _scv$vec;
|
|
21278
22116
|
var vec = typeDef.vec();
|
|
21279
22117
|
return ((_scv$vec = scv.vec()) !== null && _scv$vec !== void 0 ? _scv$vec : []).map(function (elm) {
|
|
21280
22118
|
return _this5.scValToNative(elm, vec.elementType());
|
|
21281
22119
|
});
|
|
21282
|
-
} else if (value ==
|
|
22120
|
+
} else if (value == lib.xdr.ScSpecType.scSpecTypeTuple().value) {
|
|
21283
22121
|
var _scv$vec2;
|
|
21284
22122
|
var tuple = typeDef.tuple();
|
|
21285
22123
|
var valTypes = tuple.valueTypes();
|
|
@@ -21289,13 +22127,13 @@ var ContractSpec = function () {
|
|
|
21289
22127
|
}
|
|
21290
22128
|
throw new TypeError("Type ".concat(typeDef, " was not vec, but ").concat(scv, " is"));
|
|
21291
22129
|
}
|
|
21292
|
-
case
|
|
21293
|
-
return
|
|
21294
|
-
case
|
|
22130
|
+
case lib.xdr.ScValType.scvAddress().value:
|
|
22131
|
+
return lib.Address.fromScVal(scv).toString();
|
|
22132
|
+
case lib.xdr.ScValType.scvMap().value:
|
|
21295
22133
|
{
|
|
21296
22134
|
var _scv$map;
|
|
21297
22135
|
var map = (_scv$map = scv.map()) !== null && _scv$map !== void 0 ? _scv$map : [];
|
|
21298
|
-
if (value ==
|
|
22136
|
+
if (value == lib.xdr.ScSpecType.scSpecTypeMap().value) {
|
|
21299
22137
|
var type_ = typeDef.map();
|
|
21300
22138
|
var keyType = type_.keyType();
|
|
21301
22139
|
var valueType = type_.valueType();
|
|
@@ -21306,23 +22144,23 @@ var ContractSpec = function () {
|
|
|
21306
22144
|
}
|
|
21307
22145
|
throw new TypeError("ScSpecType ".concat(t.name, " was not map, but ").concat(JSON.stringify(scv, null, 2), " is"));
|
|
21308
22146
|
}
|
|
21309
|
-
case
|
|
21310
|
-
case
|
|
21311
|
-
case
|
|
21312
|
-
case
|
|
22147
|
+
case lib.xdr.ScValType.scvBool().value:
|
|
22148
|
+
case lib.xdr.ScValType.scvU32().value:
|
|
22149
|
+
case lib.xdr.ScValType.scvI32().value:
|
|
22150
|
+
case lib.xdr.ScValType.scvBytes().value:
|
|
21313
22151
|
return scv.value();
|
|
21314
|
-
case
|
|
21315
|
-
case
|
|
22152
|
+
case lib.xdr.ScValType.scvString().value:
|
|
22153
|
+
case lib.xdr.ScValType.scvSymbol().value:
|
|
21316
22154
|
{
|
|
21317
22155
|
var _scv$value;
|
|
21318
|
-
if (value !==
|
|
22156
|
+
if (value !== lib.xdr.ScSpecType.scSpecTypeString().value && value !== lib.xdr.ScSpecType.scSpecTypeSymbol().value) {
|
|
21319
22157
|
throw new Error("ScSpecType ".concat(t.name, " was not string or symbol, but ").concat(JSON.stringify(scv, null, 2), " is"));
|
|
21320
22158
|
}
|
|
21321
22159
|
return (_scv$value = scv.value()) === null || _scv$value === void 0 ? void 0 : _scv$value.toString();
|
|
21322
22160
|
}
|
|
21323
|
-
case
|
|
21324
|
-
case
|
|
21325
|
-
return (0,
|
|
22161
|
+
case lib.xdr.ScValType.scvTimepoint().value:
|
|
22162
|
+
case lib.xdr.ScValType.scvDuration().value:
|
|
22163
|
+
return (0,lib.scValToBigInt)(lib.xdr.ScVal.scvU64(scv.u64()));
|
|
21326
22164
|
default:
|
|
21327
22165
|
throw new TypeError("failed to convert ".concat(JSON.stringify(scv, null, 2), " to native type from type ").concat(t.name));
|
|
21328
22166
|
}
|
|
@@ -21332,11 +22170,11 @@ var ContractSpec = function () {
|
|
|
21332
22170
|
value: function scValUdtToNative(scv, udt) {
|
|
21333
22171
|
var entry = this.findEntry(udt.name().toString());
|
|
21334
22172
|
switch (entry.switch()) {
|
|
21335
|
-
case
|
|
22173
|
+
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtEnumV0():
|
|
21336
22174
|
return this.enumToNative(scv);
|
|
21337
|
-
case
|
|
22175
|
+
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtStructV0():
|
|
21338
22176
|
return this.structToNative(scv, entry.udtStructV0());
|
|
21339
|
-
case
|
|
22177
|
+
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtUnionV0():
|
|
21340
22178
|
return this.unionToNative(scv, entry.udtUnionV0());
|
|
21341
22179
|
default:
|
|
21342
22180
|
throw new Error("failed to parse udt ".concat(udt.name().toString(), ": ").concat(entry));
|
|
@@ -21354,7 +22192,7 @@ var ContractSpec = function () {
|
|
|
21354
22192
|
throw new Error("".concat(val, " has length 0, but the there are at least one case in the union"));
|
|
21355
22193
|
}
|
|
21356
22194
|
var name = vec[0].sym().toString();
|
|
21357
|
-
if (vec[0].switch().value !=
|
|
22195
|
+
if (vec[0].switch().value != lib.xdr.ScValType.scvSymbol().value) {
|
|
21358
22196
|
throw new Error("{vec[0]} is not a symbol");
|
|
21359
22197
|
}
|
|
21360
22198
|
var entry = udt.cases().find(findCase(name));
|
|
@@ -21364,7 +22202,7 @@ var ContractSpec = function () {
|
|
|
21364
22202
|
var res = {
|
|
21365
22203
|
tag: name
|
|
21366
22204
|
};
|
|
21367
|
-
if (entry.switch().value ===
|
|
22205
|
+
if (entry.switch().value === lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0().value) {
|
|
21368
22206
|
var tuple = entry.tupleCase();
|
|
21369
22207
|
var ty = tuple.type();
|
|
21370
22208
|
var values = ty.map(function (entry, i) {
|
|
@@ -21397,7 +22235,7 @@ var ContractSpec = function () {
|
|
|
21397
22235
|
}, {
|
|
21398
22236
|
key: "enumToNative",
|
|
21399
22237
|
value: function enumToNative(scv) {
|
|
21400
|
-
if (scv.switch().value !==
|
|
22238
|
+
if (scv.switch().value !== lib.xdr.ScValType.scvU32().value) {
|
|
21401
22239
|
throw new Error("Enum must have a u32 value");
|
|
21402
22240
|
}
|
|
21403
22241
|
var num = scv.u32();
|
|
@@ -21407,7 +22245,7 @@ var ContractSpec = function () {
|
|
|
21407
22245
|
key: "errorCases",
|
|
21408
22246
|
value: function errorCases() {
|
|
21409
22247
|
return this.entries.filter(function (entry) {
|
|
21410
|
-
return entry.switch().value ===
|
|
22248
|
+
return entry.switch().value === lib.xdr.ScSpecEntryKind.scSpecEntryUdtErrorEnumV0().value;
|
|
21411
22249
|
}).flatMap(function (entry) {
|
|
21412
22250
|
return entry.value().cases();
|
|
21413
22251
|
});
|
|
@@ -21416,29 +22254,29 @@ var ContractSpec = function () {
|
|
|
21416
22254
|
key: "jsonSchema",
|
|
21417
22255
|
value: function jsonSchema(funcName) {
|
|
21418
22256
|
var definitions = {};
|
|
21419
|
-
var _iterator =
|
|
22257
|
+
var _iterator = spec_createForOfIteratorHelper(this.entries),
|
|
21420
22258
|
_step;
|
|
21421
22259
|
try {
|
|
21422
22260
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
21423
22261
|
var entry = _step.value;
|
|
21424
22262
|
switch (entry.switch().value) {
|
|
21425
|
-
case
|
|
22263
|
+
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtEnumV0().value:
|
|
21426
22264
|
{
|
|
21427
22265
|
var _udt = entry.udtEnumV0();
|
|
21428
22266
|
definitions[_udt.name().toString()] = enumToJsonSchema(_udt);
|
|
21429
22267
|
break;
|
|
21430
22268
|
}
|
|
21431
|
-
case
|
|
22269
|
+
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtStructV0().value:
|
|
21432
22270
|
{
|
|
21433
22271
|
var _udt2 = entry.udtStructV0();
|
|
21434
22272
|
definitions[_udt2.name().toString()] = structToJsonSchema(_udt2);
|
|
21435
22273
|
break;
|
|
21436
22274
|
}
|
|
21437
|
-
case
|
|
22275
|
+
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtUnionV0().value:
|
|
21438
22276
|
var udt = entry.udtUnionV0();
|
|
21439
22277
|
definitions[udt.name().toString()] = unionToJsonSchema(udt);
|
|
21440
22278
|
break;
|
|
21441
|
-
case
|
|
22279
|
+
case lib.xdr.ScSpecEntryKind.scSpecEntryFunctionV0().value:
|
|
21442
22280
|
{
|
|
21443
22281
|
var fn = entry.functionV0();
|
|
21444
22282
|
var fnName = fn.name().toString();
|
|
@@ -21447,7 +22285,7 @@ var ContractSpec = function () {
|
|
|
21447
22285
|
definitions[fnName] = input;
|
|
21448
22286
|
break;
|
|
21449
22287
|
}
|
|
21450
|
-
case
|
|
22288
|
+
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtErrorEnumV0().value:
|
|
21451
22289
|
{}
|
|
21452
22290
|
}
|
|
21453
22291
|
}
|
|
@@ -21469,30 +22307,30 @@ var ContractSpec = function () {
|
|
|
21469
22307
|
}();
|
|
21470
22308
|
function stringToScVal(str, ty) {
|
|
21471
22309
|
switch (ty.value) {
|
|
21472
|
-
case
|
|
21473
|
-
return
|
|
21474
|
-
case
|
|
21475
|
-
return
|
|
21476
|
-
case
|
|
22310
|
+
case lib.xdr.ScSpecType.scSpecTypeString().value:
|
|
22311
|
+
return lib.xdr.ScVal.scvString(str);
|
|
22312
|
+
case lib.xdr.ScSpecType.scSpecTypeSymbol().value:
|
|
22313
|
+
return lib.xdr.ScVal.scvSymbol(str);
|
|
22314
|
+
case lib.xdr.ScSpecType.scSpecTypeAddress().value:
|
|
21477
22315
|
{
|
|
21478
|
-
var addr =
|
|
21479
|
-
return
|
|
21480
|
-
}
|
|
21481
|
-
case
|
|
21482
|
-
return new
|
|
21483
|
-
case
|
|
21484
|
-
return new
|
|
21485
|
-
case
|
|
21486
|
-
return new
|
|
21487
|
-
case
|
|
21488
|
-
return new
|
|
21489
|
-
case
|
|
21490
|
-
return new
|
|
21491
|
-
case
|
|
21492
|
-
return new
|
|
21493
|
-
case
|
|
21494
|
-
case
|
|
21495
|
-
return
|
|
22316
|
+
var addr = lib.Address.fromString(str);
|
|
22317
|
+
return lib.xdr.ScVal.scvAddress(addr.toScAddress());
|
|
22318
|
+
}
|
|
22319
|
+
case lib.xdr.ScSpecType.scSpecTypeU64().value:
|
|
22320
|
+
return new lib.XdrLargeInt("u64", str).toScVal();
|
|
22321
|
+
case lib.xdr.ScSpecType.scSpecTypeI64().value:
|
|
22322
|
+
return new lib.XdrLargeInt("i64", str).toScVal();
|
|
22323
|
+
case lib.xdr.ScSpecType.scSpecTypeU128().value:
|
|
22324
|
+
return new lib.XdrLargeInt("u128", str).toScVal();
|
|
22325
|
+
case lib.xdr.ScSpecType.scSpecTypeI128().value:
|
|
22326
|
+
return new lib.XdrLargeInt("i128", str).toScVal();
|
|
22327
|
+
case lib.xdr.ScSpecType.scSpecTypeU256().value:
|
|
22328
|
+
return new lib.XdrLargeInt("u256", str).toScVal();
|
|
22329
|
+
case lib.xdr.ScSpecType.scSpecTypeI256().value:
|
|
22330
|
+
return new lib.XdrLargeInt("i256", str).toScVal();
|
|
22331
|
+
case lib.xdr.ScSpecType.scSpecTypeBytes().value:
|
|
22332
|
+
case lib.xdr.ScSpecType.scSpecTypeBytesN().value:
|
|
22333
|
+
return lib.xdr.ScVal.scvBytes(spec_Buffer.from(str, "base64"));
|
|
21496
22334
|
default:
|
|
21497
22335
|
throw new TypeError("invalid type ".concat(ty.name, " specified for string value"));
|
|
21498
22336
|
}
|
|
@@ -21503,12 +22341,12 @@ function isNumeric(field) {
|
|
|
21503
22341
|
function findCase(name) {
|
|
21504
22342
|
return function matches(entry) {
|
|
21505
22343
|
switch (entry.switch().value) {
|
|
21506
|
-
case
|
|
22344
|
+
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0().value:
|
|
21507
22345
|
{
|
|
21508
22346
|
var tuple = entry.tupleCase();
|
|
21509
22347
|
return tuple.name().toString() === name;
|
|
21510
22348
|
}
|
|
21511
|
-
case
|
|
22349
|
+
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseVoidV0().value:
|
|
21512
22350
|
{
|
|
21513
22351
|
var void_case = entry.voidCase();
|
|
21514
22352
|
return void_case.name().toString() === name;
|
|
@@ -21588,110 +22426,110 @@ function typeRef(typeDef) {
|
|
|
21588
22426
|
var value = t.value;
|
|
21589
22427
|
var ref;
|
|
21590
22428
|
switch (value) {
|
|
21591
|
-
case
|
|
22429
|
+
case lib.xdr.ScSpecType.scSpecTypeVal().value:
|
|
21592
22430
|
{
|
|
21593
22431
|
ref = "Val";
|
|
21594
22432
|
break;
|
|
21595
22433
|
}
|
|
21596
|
-
case
|
|
22434
|
+
case lib.xdr.ScSpecType.scSpecTypeBool().value:
|
|
21597
22435
|
{
|
|
21598
22436
|
return {
|
|
21599
22437
|
type: "boolean"
|
|
21600
22438
|
};
|
|
21601
22439
|
}
|
|
21602
|
-
case
|
|
22440
|
+
case lib.xdr.ScSpecType.scSpecTypeVoid().value:
|
|
21603
22441
|
{
|
|
21604
22442
|
return {
|
|
21605
22443
|
type: "null"
|
|
21606
22444
|
};
|
|
21607
22445
|
}
|
|
21608
|
-
case
|
|
22446
|
+
case lib.xdr.ScSpecType.scSpecTypeError().value:
|
|
21609
22447
|
{
|
|
21610
22448
|
ref = "Error";
|
|
21611
22449
|
break;
|
|
21612
22450
|
}
|
|
21613
|
-
case
|
|
22451
|
+
case lib.xdr.ScSpecType.scSpecTypeU32().value:
|
|
21614
22452
|
{
|
|
21615
22453
|
ref = "U32";
|
|
21616
22454
|
break;
|
|
21617
22455
|
}
|
|
21618
|
-
case
|
|
22456
|
+
case lib.xdr.ScSpecType.scSpecTypeI32().value:
|
|
21619
22457
|
{
|
|
21620
22458
|
ref = "I32";
|
|
21621
22459
|
break;
|
|
21622
22460
|
}
|
|
21623
|
-
case
|
|
22461
|
+
case lib.xdr.ScSpecType.scSpecTypeU64().value:
|
|
21624
22462
|
{
|
|
21625
22463
|
ref = "U64";
|
|
21626
22464
|
break;
|
|
21627
22465
|
}
|
|
21628
|
-
case
|
|
22466
|
+
case lib.xdr.ScSpecType.scSpecTypeI64().value:
|
|
21629
22467
|
{
|
|
21630
22468
|
ref = "I64";
|
|
21631
22469
|
break;
|
|
21632
22470
|
}
|
|
21633
|
-
case
|
|
22471
|
+
case lib.xdr.ScSpecType.scSpecTypeTimepoint().value:
|
|
21634
22472
|
{
|
|
21635
22473
|
throw new Error("Timepoint type not supported");
|
|
21636
22474
|
ref = "Timepoint";
|
|
21637
22475
|
break;
|
|
21638
22476
|
}
|
|
21639
|
-
case
|
|
22477
|
+
case lib.xdr.ScSpecType.scSpecTypeDuration().value:
|
|
21640
22478
|
{
|
|
21641
22479
|
throw new Error("Duration not supported");
|
|
21642
22480
|
ref = "Duration";
|
|
21643
22481
|
break;
|
|
21644
22482
|
}
|
|
21645
|
-
case
|
|
22483
|
+
case lib.xdr.ScSpecType.scSpecTypeU128().value:
|
|
21646
22484
|
{
|
|
21647
22485
|
ref = "U128";
|
|
21648
22486
|
break;
|
|
21649
22487
|
}
|
|
21650
|
-
case
|
|
22488
|
+
case lib.xdr.ScSpecType.scSpecTypeI128().value:
|
|
21651
22489
|
{
|
|
21652
22490
|
ref = "I128";
|
|
21653
22491
|
break;
|
|
21654
22492
|
}
|
|
21655
|
-
case
|
|
22493
|
+
case lib.xdr.ScSpecType.scSpecTypeU256().value:
|
|
21656
22494
|
{
|
|
21657
22495
|
ref = "U256";
|
|
21658
22496
|
break;
|
|
21659
22497
|
}
|
|
21660
|
-
case
|
|
22498
|
+
case lib.xdr.ScSpecType.scSpecTypeI256().value:
|
|
21661
22499
|
{
|
|
21662
22500
|
ref = "I256";
|
|
21663
22501
|
break;
|
|
21664
22502
|
}
|
|
21665
|
-
case
|
|
22503
|
+
case lib.xdr.ScSpecType.scSpecTypeBytes().value:
|
|
21666
22504
|
{
|
|
21667
22505
|
ref = "DataUrl";
|
|
21668
22506
|
break;
|
|
21669
22507
|
}
|
|
21670
|
-
case
|
|
22508
|
+
case lib.xdr.ScSpecType.scSpecTypeString().value:
|
|
21671
22509
|
{
|
|
21672
22510
|
ref = "ScString";
|
|
21673
22511
|
break;
|
|
21674
22512
|
}
|
|
21675
|
-
case
|
|
22513
|
+
case lib.xdr.ScSpecType.scSpecTypeSymbol().value:
|
|
21676
22514
|
{
|
|
21677
22515
|
ref = "ScSymbol";
|
|
21678
22516
|
break;
|
|
21679
22517
|
}
|
|
21680
|
-
case
|
|
22518
|
+
case lib.xdr.ScSpecType.scSpecTypeAddress().value:
|
|
21681
22519
|
{
|
|
21682
22520
|
ref = "Address";
|
|
21683
22521
|
break;
|
|
21684
22522
|
}
|
|
21685
|
-
case
|
|
22523
|
+
case lib.xdr.ScSpecType.scSpecTypeOption().value:
|
|
21686
22524
|
{
|
|
21687
22525
|
var opt = typeDef.option();
|
|
21688
22526
|
return typeRef(opt.valueType());
|
|
21689
22527
|
}
|
|
21690
|
-
case
|
|
22528
|
+
case lib.xdr.ScSpecType.scSpecTypeResult().value:
|
|
21691
22529
|
{
|
|
21692
22530
|
break;
|
|
21693
22531
|
}
|
|
21694
|
-
case
|
|
22532
|
+
case lib.xdr.ScSpecType.scSpecTypeVec().value:
|
|
21695
22533
|
{
|
|
21696
22534
|
var arr = typeDef.vec();
|
|
21697
22535
|
var _ref3 = typeRef(arr.elementType());
|
|
@@ -21700,7 +22538,7 @@ function typeRef(typeDef) {
|
|
|
21700
22538
|
items: _ref3
|
|
21701
22539
|
};
|
|
21702
22540
|
}
|
|
21703
|
-
case
|
|
22541
|
+
case lib.xdr.ScSpecType.scSpecTypeMap().value:
|
|
21704
22542
|
{
|
|
21705
22543
|
var map = typeDef.map();
|
|
21706
22544
|
var items = [typeRef(map.keyType()), typeRef(map.valueType())];
|
|
@@ -21714,7 +22552,7 @@ function typeRef(typeDef) {
|
|
|
21714
22552
|
}
|
|
21715
22553
|
};
|
|
21716
22554
|
}
|
|
21717
|
-
case
|
|
22555
|
+
case lib.xdr.ScSpecType.scSpecTypeTuple().value:
|
|
21718
22556
|
{
|
|
21719
22557
|
var tuple = typeDef.tuple();
|
|
21720
22558
|
var minItems = tuple.valueTypes().length;
|
|
@@ -21727,7 +22565,7 @@ function typeRef(typeDef) {
|
|
|
21727
22565
|
maxItems: maxItems
|
|
21728
22566
|
};
|
|
21729
22567
|
}
|
|
21730
|
-
case
|
|
22568
|
+
case lib.xdr.ScSpecType.scSpecTypeBytesN().value:
|
|
21731
22569
|
{
|
|
21732
22570
|
var _arr = typeDef.bytesN();
|
|
21733
22571
|
return {
|
|
@@ -21735,7 +22573,7 @@ function typeRef(typeDef) {
|
|
|
21735
22573
|
maxLength: _arr.n()
|
|
21736
22574
|
};
|
|
21737
22575
|
}
|
|
21738
|
-
case
|
|
22576
|
+
case lib.xdr.ScSpecType.scSpecTypeUdt().value:
|
|
21739
22577
|
{
|
|
21740
22578
|
var udt = typeDef.udt();
|
|
21741
22579
|
ref = udt.name().toString();
|
|
@@ -21747,7 +22585,7 @@ function typeRef(typeDef) {
|
|
|
21747
22585
|
};
|
|
21748
22586
|
}
|
|
21749
22587
|
function isRequired(typeDef) {
|
|
21750
|
-
return typeDef.switch().value !=
|
|
22588
|
+
return typeDef.switch().value != lib.xdr.ScSpecType.scSpecTypeOption().value;
|
|
21751
22589
|
}
|
|
21752
22590
|
function structToJsonSchema(udt) {
|
|
21753
22591
|
var fields = udt.fields();
|
|
@@ -21780,7 +22618,7 @@ function structToJsonSchema(udt) {
|
|
|
21780
22618
|
function args_and_required(input) {
|
|
21781
22619
|
var properties = {};
|
|
21782
22620
|
var required = [];
|
|
21783
|
-
var _iterator2 =
|
|
22621
|
+
var _iterator2 = spec_createForOfIteratorHelper(input),
|
|
21784
22622
|
_step2;
|
|
21785
22623
|
try {
|
|
21786
22624
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
@@ -21823,7 +22661,7 @@ function functionToJsonSchema(func) {
|
|
|
21823
22661
|
}
|
|
21824
22662
|
};
|
|
21825
22663
|
var outputs = func.outputs();
|
|
21826
|
-
var output = outputs.length > 0 ? typeRef(outputs[0]) : typeRef(
|
|
22664
|
+
var output = outputs.length > 0 ? typeRef(outputs[0]) : typeRef(lib.xdr.ScSpecTypeDef.scSpecTypeVoid());
|
|
21827
22665
|
var description = func.doc().toString();
|
|
21828
22666
|
if (description.length > 0) {
|
|
21829
22667
|
input.description = description;
|
|
@@ -21839,13 +22677,13 @@ function unionToJsonSchema(udt) {
|
|
|
21839
22677
|
var description = udt.doc().toString();
|
|
21840
22678
|
var cases = udt.cases();
|
|
21841
22679
|
var oneOf = [];
|
|
21842
|
-
var _iterator3 =
|
|
22680
|
+
var _iterator3 = spec_createForOfIteratorHelper(cases),
|
|
21843
22681
|
_step3;
|
|
21844
22682
|
try {
|
|
21845
22683
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
21846
22684
|
var case_ = _step3.value;
|
|
21847
22685
|
switch (case_.switch().value) {
|
|
21848
|
-
case
|
|
22686
|
+
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseVoidV0().value:
|
|
21849
22687
|
{
|
|
21850
22688
|
var c = case_.voidCase();
|
|
21851
22689
|
var title = c.name().toString();
|
|
@@ -21860,7 +22698,7 @@ function unionToJsonSchema(udt) {
|
|
|
21860
22698
|
});
|
|
21861
22699
|
break;
|
|
21862
22700
|
}
|
|
21863
|
-
case
|
|
22701
|
+
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0().value:
|
|
21864
22702
|
{
|
|
21865
22703
|
var _c = case_.tupleCase();
|
|
21866
22704
|
var _title = _c.name().toString();
|
|
@@ -21897,7 +22735,7 @@ function enumToJsonSchema(udt) {
|
|
|
21897
22735
|
var description = udt.doc().toString();
|
|
21898
22736
|
var cases = udt.cases();
|
|
21899
22737
|
var oneOf = [];
|
|
21900
|
-
var _iterator4 =
|
|
22738
|
+
var _iterator4 = spec_createForOfIteratorHelper(cases),
|
|
21901
22739
|
_step4;
|
|
21902
22740
|
try {
|
|
21903
22741
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
@@ -21924,6 +22762,189 @@ function enumToJsonSchema(udt) {
|
|
|
21924
22762
|
}
|
|
21925
22763
|
return res;
|
|
21926
22764
|
}
|
|
22765
|
+
// EXTERNAL MODULE: ./src/rpc/index.ts
|
|
22766
|
+
var rpc = __webpack_require__(1660);
|
|
22767
|
+
;// CONCATENATED MODULE: ./src/contract/client.ts
|
|
22768
|
+
/* provided dependency */ var client_Buffer = __webpack_require__(8287)["Buffer"];
|
|
22769
|
+
var _excluded = ["method"];
|
|
22770
|
+
function client_typeof(o) { "@babel/helpers - typeof"; return client_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; }, client_typeof(o); }
|
|
22771
|
+
function client_regeneratorRuntime() { "use strict"; client_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" == client_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 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(client_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 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 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; }
|
|
22772
|
+
function client_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); } }
|
|
22773
|
+
function client_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { client_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { client_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
22774
|
+
function client_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; }
|
|
22775
|
+
function client_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? client_ownKeys(Object(t), !0).forEach(function (r) { client_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : client_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22776
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
22777
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
22778
|
+
function client_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
22779
|
+
function client_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, client_toPropertyKey(descriptor.key), descriptor); } }
|
|
22780
|
+
function client_createClass(Constructor, protoProps, staticProps) { if (protoProps) client_defineProperties(Constructor.prototype, protoProps); if (staticProps) client_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
22781
|
+
function client_defineProperty(obj, key, value) { key = client_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
22782
|
+
function client_toPropertyKey(t) { var i = client_toPrimitive(t, "string"); return "symbol" == client_typeof(i) ? i : i + ""; }
|
|
22783
|
+
function client_toPrimitive(t, r) { if ("object" != client_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != client_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
22784
|
+
|
|
22785
|
+
|
|
22786
|
+
|
|
22787
|
+
|
|
22788
|
+
var Client = function () {
|
|
22789
|
+
function Client(spec, options) {
|
|
22790
|
+
var _this = this;
|
|
22791
|
+
client_classCallCheck(this, Client);
|
|
22792
|
+
client_defineProperty(this, "txFromJSON", function (json) {
|
|
22793
|
+
var _JSON$parse = JSON.parse(json),
|
|
22794
|
+
method = _JSON$parse.method,
|
|
22795
|
+
tx = _objectWithoutProperties(_JSON$parse, _excluded);
|
|
22796
|
+
return AssembledTransaction.fromJSON(client_objectSpread(client_objectSpread({}, _this.options), {}, {
|
|
22797
|
+
method: method,
|
|
22798
|
+
parseResultXdr: function parseResultXdr(result) {
|
|
22799
|
+
return _this.spec.funcResToNative(method, result);
|
|
22800
|
+
}
|
|
22801
|
+
}), tx);
|
|
22802
|
+
});
|
|
22803
|
+
this.spec = spec;
|
|
22804
|
+
this.options = options;
|
|
22805
|
+
this.spec.funcs().forEach(function (xdrFn) {
|
|
22806
|
+
var method = xdrFn.name().toString();
|
|
22807
|
+
var assembleTransaction = function assembleTransaction(args, methodOptions) {
|
|
22808
|
+
return AssembledTransaction.build(client_objectSpread(client_objectSpread(client_objectSpread({
|
|
22809
|
+
method: method,
|
|
22810
|
+
args: args && spec.funcArgsToScVals(method, args)
|
|
22811
|
+
}, options), methodOptions), {}, {
|
|
22812
|
+
errorTypes: spec.errorCases().reduce(function (acc, curr) {
|
|
22813
|
+
return client_objectSpread(client_objectSpread({}, acc), {}, client_defineProperty({}, curr.value(), {
|
|
22814
|
+
message: curr.doc().toString()
|
|
22815
|
+
}));
|
|
22816
|
+
}, {}),
|
|
22817
|
+
parseResultXdr: function parseResultXdr(result) {
|
|
22818
|
+
return spec.funcResToNative(method, result);
|
|
22819
|
+
}
|
|
22820
|
+
}));
|
|
22821
|
+
};
|
|
22822
|
+
_this[method] = spec.getFunc(method).inputs().length === 0 ? function (opts) {
|
|
22823
|
+
return assembleTransaction(undefined, opts);
|
|
22824
|
+
} : assembleTransaction;
|
|
22825
|
+
});
|
|
22826
|
+
}
|
|
22827
|
+
return client_createClass(Client, null, [{
|
|
22828
|
+
key: "fromWasmHash",
|
|
22829
|
+
value: (function () {
|
|
22830
|
+
var _fromWasmHash = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee(wasmHash, options) {
|
|
22831
|
+
var format,
|
|
22832
|
+
rpcUrl,
|
|
22833
|
+
allowHttp,
|
|
22834
|
+
serverOpts,
|
|
22835
|
+
server,
|
|
22836
|
+
wasm,
|
|
22837
|
+
_args = arguments;
|
|
22838
|
+
return client_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
22839
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22840
|
+
case 0:
|
|
22841
|
+
format = _args.length > 2 && _args[2] !== undefined ? _args[2] : "hex";
|
|
22842
|
+
if (!(!options || !options.rpcUrl)) {
|
|
22843
|
+
_context.next = 3;
|
|
22844
|
+
break;
|
|
22845
|
+
}
|
|
22846
|
+
throw new TypeError('options must contain rpcUrl');
|
|
22847
|
+
case 3:
|
|
22848
|
+
rpcUrl = options.rpcUrl, allowHttp = options.allowHttp;
|
|
22849
|
+
serverOpts = {
|
|
22850
|
+
allowHttp: allowHttp
|
|
22851
|
+
};
|
|
22852
|
+
server = new rpc.Server(rpcUrl, serverOpts);
|
|
22853
|
+
_context.next = 8;
|
|
22854
|
+
return server.getContractWasmByHash(wasmHash, format);
|
|
22855
|
+
case 8:
|
|
22856
|
+
wasm = _context.sent;
|
|
22857
|
+
return _context.abrupt("return", Client.fromWasm(wasm, options));
|
|
22858
|
+
case 10:
|
|
22859
|
+
case "end":
|
|
22860
|
+
return _context.stop();
|
|
22861
|
+
}
|
|
22862
|
+
}, _callee);
|
|
22863
|
+
}));
|
|
22864
|
+
function fromWasmHash(_x, _x2) {
|
|
22865
|
+
return _fromWasmHash.apply(this, arguments);
|
|
22866
|
+
}
|
|
22867
|
+
return fromWasmHash;
|
|
22868
|
+
}())
|
|
22869
|
+
}, {
|
|
22870
|
+
key: "fromWasm",
|
|
22871
|
+
value: (function () {
|
|
22872
|
+
var _fromWasm = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee2(wasm, options) {
|
|
22873
|
+
var wasmModule, xdrSections, bufferSection, specEntryArray, spec;
|
|
22874
|
+
return client_regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
22875
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
22876
|
+
case 0:
|
|
22877
|
+
_context2.next = 2;
|
|
22878
|
+
return WebAssembly.compile(wasm);
|
|
22879
|
+
case 2:
|
|
22880
|
+
wasmModule = _context2.sent;
|
|
22881
|
+
xdrSections = WebAssembly.Module.customSections(wasmModule, "contractspecv0");
|
|
22882
|
+
if (!(xdrSections.length === 0)) {
|
|
22883
|
+
_context2.next = 6;
|
|
22884
|
+
break;
|
|
22885
|
+
}
|
|
22886
|
+
throw new Error('Could not obtain contract spec from wasm');
|
|
22887
|
+
case 6:
|
|
22888
|
+
bufferSection = client_Buffer.from(xdrSections[0]);
|
|
22889
|
+
specEntryArray = processSpecEntryStream(bufferSection);
|
|
22890
|
+
spec = new Spec(specEntryArray);
|
|
22891
|
+
return _context2.abrupt("return", new Client(spec, options));
|
|
22892
|
+
case 10:
|
|
22893
|
+
case "end":
|
|
22894
|
+
return _context2.stop();
|
|
22895
|
+
}
|
|
22896
|
+
}, _callee2);
|
|
22897
|
+
}));
|
|
22898
|
+
function fromWasm(_x3, _x4) {
|
|
22899
|
+
return _fromWasm.apply(this, arguments);
|
|
22900
|
+
}
|
|
22901
|
+
return fromWasm;
|
|
22902
|
+
}())
|
|
22903
|
+
}, {
|
|
22904
|
+
key: "from",
|
|
22905
|
+
value: (function () {
|
|
22906
|
+
var _from = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee3(options) {
|
|
22907
|
+
var rpcUrl, contractId, allowHttp, serverOpts, server, wasm;
|
|
22908
|
+
return client_regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
22909
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
22910
|
+
case 0:
|
|
22911
|
+
if (!(!options || !options.rpcUrl || !options.contractId)) {
|
|
22912
|
+
_context3.next = 2;
|
|
22913
|
+
break;
|
|
22914
|
+
}
|
|
22915
|
+
throw new TypeError('options must contain rpcUrl and contractId');
|
|
22916
|
+
case 2:
|
|
22917
|
+
rpcUrl = options.rpcUrl, contractId = options.contractId, allowHttp = options.allowHttp;
|
|
22918
|
+
serverOpts = {
|
|
22919
|
+
allowHttp: allowHttp
|
|
22920
|
+
};
|
|
22921
|
+
server = new rpc.Server(rpcUrl, serverOpts);
|
|
22922
|
+
_context3.next = 7;
|
|
22923
|
+
return server.getContractWasmByContractId(contractId);
|
|
22924
|
+
case 7:
|
|
22925
|
+
wasm = _context3.sent;
|
|
22926
|
+
return _context3.abrupt("return", Client.fromWasm(wasm, options));
|
|
22927
|
+
case 9:
|
|
22928
|
+
case "end":
|
|
22929
|
+
return _context3.stop();
|
|
22930
|
+
}
|
|
22931
|
+
}, _callee3);
|
|
22932
|
+
}));
|
|
22933
|
+
function from(_x5) {
|
|
22934
|
+
return _from.apply(this, arguments);
|
|
22935
|
+
}
|
|
22936
|
+
return from;
|
|
22937
|
+
}())
|
|
22938
|
+
}]);
|
|
22939
|
+
}();
|
|
22940
|
+
;// CONCATENATED MODULE: ./src/contract/index.ts
|
|
22941
|
+
|
|
22942
|
+
|
|
22943
|
+
|
|
22944
|
+
|
|
22945
|
+
|
|
22946
|
+
|
|
22947
|
+
|
|
21927
22948
|
|
|
21928
22949
|
/***/ }),
|
|
21929
22950
|
|
|
@@ -27158,17 +28179,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
27158
28179
|
/* harmony export */ BadRequestError: () => (/* reexport safe */ _errors__WEBPACK_IMPORTED_MODULE_0__.v7),
|
|
27159
28180
|
/* harmony export */ BadResponseError: () => (/* reexport safe */ _errors__WEBPACK_IMPORTED_MODULE_0__.nS),
|
|
27160
28181
|
/* harmony export */ Config: () => (/* reexport safe */ _config__WEBPACK_IMPORTED_MODULE_1__.T),
|
|
27161
|
-
/* harmony export */ ContractSpec: () => (/* reexport safe */ _contract_spec__WEBPACK_IMPORTED_MODULE_9__.o),
|
|
27162
28182
|
/* harmony export */ Federation: () => (/* reexport module object */ _federation__WEBPACK_IMPORTED_MODULE_4__),
|
|
27163
28183
|
/* harmony export */ Friendbot: () => (/* reexport module object */ _friendbot__WEBPACK_IMPORTED_MODULE_6__),
|
|
27164
28184
|
/* harmony export */ Horizon: () => (/* reexport module object */ _horizon__WEBPACK_IMPORTED_MODULE_7__),
|
|
27165
28185
|
/* harmony export */ NetworkError: () => (/* reexport safe */ _errors__WEBPACK_IMPORTED_MODULE_0__.Dr),
|
|
27166
28186
|
/* harmony export */ NotFoundError: () => (/* reexport safe */ _errors__WEBPACK_IMPORTED_MODULE_0__.m_),
|
|
27167
|
-
/* harmony export */ SorobanRpc: () => (/* reexport module object */
|
|
28187
|
+
/* harmony export */ SorobanRpc: () => (/* reexport module object */ _rpc__WEBPACK_IMPORTED_MODULE_8__),
|
|
27168
28188
|
/* harmony export */ StellarToml: () => (/* reexport module object */ _stellartoml__WEBPACK_IMPORTED_MODULE_3__),
|
|
27169
28189
|
/* harmony export */ Utils: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_2__.A),
|
|
27170
28190
|
/* harmony export */ WebAuth: () => (/* reexport module object */ _webauth__WEBPACK_IMPORTED_MODULE_5__),
|
|
27171
|
-
/* harmony export */
|
|
28191
|
+
/* harmony export */ contract: () => (/* reexport module object */ _contract__WEBPACK_IMPORTED_MODULE_9__),
|
|
28192
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
28193
|
+
/* harmony export */ rpc: () => (/* reexport module object */ _rpc__WEBPACK_IMPORTED_MODULE_8__)
|
|
27172
28194
|
/* harmony export */ });
|
|
27173
28195
|
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5885);
|
|
27174
28196
|
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8732);
|
|
@@ -27178,12 +28200,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
27178
28200
|
/* harmony import */ var _webauth__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5479);
|
|
27179
28201
|
/* harmony import */ var _friendbot__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(8242);
|
|
27180
28202
|
/* harmony import */ var _horizon__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(2731);
|
|
27181
|
-
/* harmony import */ var
|
|
27182
|
-
/* harmony import */ var
|
|
28203
|
+
/* harmony import */ var _rpc__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(1660);
|
|
28204
|
+
/* harmony import */ var _contract__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(145);
|
|
27183
28205
|
/* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(356);
|
|
27184
28206
|
/* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10__);
|
|
27185
28207
|
/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
27186
|
-
/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10__) if(["default","Config","Utils","StellarToml","Federation","WebAuth","Friendbot","Horizon","SorobanRpc","AccountRequiresMemoError","BadRequestError","BadResponseError","NetworkError","NotFoundError"
|
|
28208
|
+
/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10__) if(["default","Config","Utils","StellarToml","Federation","WebAuth","Friendbot","Horizon","rpc","SorobanRpc","contract","AccountRequiresMemoError","BadRequestError","BadResponseError","NetworkError","NotFoundError"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10__[__WEBPACK_IMPORT_KEY__]
|
|
27187
28209
|
/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
27188
28210
|
/* module decorator */ module = __webpack_require__.hmd(module);
|
|
27189
28211
|
|
|
@@ -27203,30 +28225,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
27203
28225
|
|
|
27204
28226
|
|
|
27205
28227
|
|
|
28228
|
+
|
|
28229
|
+
|
|
28230
|
+
|
|
27206
28231
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (module.exports);
|
|
27207
28232
|
|
|
27208
28233
|
/***/ }),
|
|
27209
28234
|
|
|
27210
|
-
/***/
|
|
27211
|
-
/***/ ((
|
|
28235
|
+
/***/ 4076:
|
|
28236
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
27212
28237
|
|
|
27213
28238
|
"use strict";
|
|
27214
|
-
|
|
27215
|
-
|
|
27216
|
-
|
|
27217
|
-
// EXPORTS
|
|
27218
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27219
|
-
Api: () => (/* reexport */ Api),
|
|
27220
|
-
AxiosClient: () => (/* reexport */ soroban_axios),
|
|
27221
|
-
Durability: () => (/* reexport */ Durability),
|
|
27222
|
-
Server: () => (/* reexport */ Server),
|
|
27223
|
-
assembleTransaction: () => (/* reexport */ assembleTransaction),
|
|
27224
|
-
"default": () => (/* binding */ soroban),
|
|
27225
|
-
parseRawEvents: () => (/* reexport */ parseRawEvents),
|
|
27226
|
-
parseRawSimulation: () => (/* reexport */ parseRawSimulation)
|
|
27227
|
-
});
|
|
27228
|
-
|
|
27229
|
-
;// CONCATENATED MODULE: ./src/soroban/api.ts
|
|
28239
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
28240
|
+
/* harmony export */ j: () => (/* binding */ Api)
|
|
28241
|
+
/* harmony export */ });
|
|
27230
28242
|
var Api;
|
|
27231
28243
|
(function (_Api) {
|
|
27232
28244
|
var GetTransactionStatus = function (GetTransactionStatus) {
|
|
@@ -27253,76 +28265,79 @@ var Api;
|
|
|
27253
28265
|
}
|
|
27254
28266
|
_Api.isSimulationRaw = isSimulationRaw;
|
|
27255
28267
|
})(Api || (Api = {}));
|
|
27256
|
-
|
|
27257
|
-
|
|
27258
|
-
|
|
27259
|
-
|
|
27260
|
-
|
|
27261
|
-
|
|
27262
|
-
|
|
27263
|
-
|
|
28268
|
+
|
|
28269
|
+
/***/ }),
|
|
28270
|
+
|
|
28271
|
+
/***/ 4982:
|
|
28272
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
28273
|
+
|
|
28274
|
+
"use strict";
|
|
28275
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
28276
|
+
/* harmony export */ Ay: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
28277
|
+
/* harmony export */ });
|
|
28278
|
+
/* unused harmony exports version, AxiosClient */
|
|
28279
|
+
/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6266);
|
|
27264
28280
|
|
|
27265
28281
|
var version = (__webpack_require__(8330)/* .version */ .rE);
|
|
27266
|
-
var AxiosClient =
|
|
28282
|
+
var AxiosClient = axios__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A.create({
|
|
27267
28283
|
headers: {
|
|
27268
28284
|
'X-Client-Name': 'js-soroban-client',
|
|
27269
28285
|
'X-Client-Version': version
|
|
27270
28286
|
}
|
|
27271
28287
|
});
|
|
27272
|
-
/* harmony default export */ const
|
|
27273
|
-
;// CONCATENATED MODULE: ./src/soroban/jsonrpc.ts
|
|
27274
|
-
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); }
|
|
27275
|
-
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 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 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 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; }
|
|
27276
|
-
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); } }
|
|
27277
|
-
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); }); }; }
|
|
28288
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AxiosClient);
|
|
27278
28289
|
|
|
27279
|
-
|
|
27280
|
-
|
|
27281
|
-
|
|
27282
|
-
|
|
27283
|
-
|
|
27284
|
-
|
|
27285
|
-
|
|
27286
|
-
|
|
27287
|
-
|
|
27288
|
-
|
|
27289
|
-
|
|
27290
|
-
|
|
27291
|
-
|
|
27292
|
-
|
|
27293
|
-
|
|
27294
|
-
|
|
27295
|
-
|
|
27296
|
-
|
|
27297
|
-
|
|
27298
|
-
|
|
27299
|
-
|
|
27300
|
-
|
|
27301
|
-
|
|
27302
|
-
|
|
27303
|
-
|
|
27304
|
-
|
|
27305
|
-
|
|
27306
|
-
|
|
27307
|
-
|
|
27308
|
-
|
|
27309
|
-
|
|
27310
|
-
|
|
27311
|
-
|
|
27312
|
-
|
|
27313
|
-
|
|
27314
|
-
|
|
27315
|
-
|
|
27316
|
-
|
|
27317
|
-
|
|
27318
|
-
|
|
27319
|
-
|
|
27320
|
-
|
|
28290
|
+
/***/ }),
|
|
28291
|
+
|
|
28292
|
+
/***/ 1660:
|
|
28293
|
+
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
28294
|
+
|
|
28295
|
+
"use strict";
|
|
28296
|
+
__webpack_require__.r(__webpack_exports__);
|
|
28297
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
28298
|
+
/* harmony export */ Api: () => (/* reexport safe */ _api__WEBPACK_IMPORTED_MODULE_0__.j),
|
|
28299
|
+
/* harmony export */ AxiosClient: () => (/* reexport safe */ _axios__WEBPACK_IMPORTED_MODULE_2__.Ay),
|
|
28300
|
+
/* harmony export */ Durability: () => (/* reexport safe */ _server__WEBPACK_IMPORTED_MODULE_1__.ku),
|
|
28301
|
+
/* harmony export */ Server: () => (/* reexport safe */ _server__WEBPACK_IMPORTED_MODULE_1__.gq),
|
|
28302
|
+
/* harmony export */ assembleTransaction: () => (/* reexport safe */ _transaction__WEBPACK_IMPORTED_MODULE_4__.X),
|
|
28303
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
28304
|
+
/* harmony export */ parseRawEvents: () => (/* reexport safe */ _parsers__WEBPACK_IMPORTED_MODULE_3__.fG),
|
|
28305
|
+
/* harmony export */ parseRawSimulation: () => (/* reexport safe */ _parsers__WEBPACK_IMPORTED_MODULE_3__.jr)
|
|
28306
|
+
/* harmony export */ });
|
|
28307
|
+
/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4076);
|
|
28308
|
+
/* harmony import */ var _server__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1575);
|
|
28309
|
+
/* harmony import */ var _axios__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4982);
|
|
28310
|
+
/* harmony import */ var _parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(784);
|
|
28311
|
+
/* harmony import */ var _transaction__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8680);
|
|
28312
|
+
/* module decorator */ module = __webpack_require__.hmd(module);
|
|
28313
|
+
|
|
28314
|
+
|
|
28315
|
+
|
|
28316
|
+
|
|
28317
|
+
|
|
28318
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (module.exports);
|
|
28319
|
+
|
|
28320
|
+
/***/ }),
|
|
28321
|
+
|
|
28322
|
+
/***/ 784:
|
|
28323
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
28324
|
+
|
|
28325
|
+
"use strict";
|
|
28326
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
28327
|
+
/* harmony export */ $D: () => (/* binding */ parseRawLedgerEntries),
|
|
28328
|
+
/* harmony export */ Af: () => (/* binding */ parseRawSendTransaction),
|
|
28329
|
+
/* harmony export */ fG: () => (/* binding */ parseRawEvents),
|
|
28330
|
+
/* harmony export */ jr: () => (/* binding */ parseRawSimulation)
|
|
28331
|
+
/* harmony export */ });
|
|
28332
|
+
/* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(356);
|
|
28333
|
+
/* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__);
|
|
28334
|
+
/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4076);
|
|
28335
|
+
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); }
|
|
27321
28336
|
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; }
|
|
27322
28337
|
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; }
|
|
27323
28338
|
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; }
|
|
27324
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" ==
|
|
27325
|
-
function _toPrimitive(t, r) { if ("object" !=
|
|
28339
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
28340
|
+
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); }
|
|
27326
28341
|
|
|
27327
28342
|
|
|
27328
28343
|
function parseRawSendTransaction(r) {
|
|
@@ -27333,10 +28348,10 @@ function parseRawSendTransaction(r) {
|
|
|
27333
28348
|
if (!!errorResultXdr) {
|
|
27334
28349
|
return _objectSpread(_objectSpread(_objectSpread({}, r), diagnosticEventsXdr !== undefined && diagnosticEventsXdr.length > 0 && {
|
|
27335
28350
|
diagnosticEvents: diagnosticEventsXdr.map(function (evt) {
|
|
27336
|
-
return
|
|
28351
|
+
return _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
|
|
27337
28352
|
})
|
|
27338
28353
|
}), {}, {
|
|
27339
|
-
errorResult:
|
|
28354
|
+
errorResult: _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.TransactionResult.fromXDR(errorResultXdr, 'base64')
|
|
27340
28355
|
});
|
|
27341
28356
|
}
|
|
27342
28357
|
return _objectSpread({}, r);
|
|
@@ -27349,12 +28364,12 @@ function parseRawEvents(r) {
|
|
|
27349
28364
|
var clone = _objectSpread({}, evt);
|
|
27350
28365
|
delete clone.contractId;
|
|
27351
28366
|
return _objectSpread(_objectSpread(_objectSpread({}, clone), evt.contractId !== '' && {
|
|
27352
|
-
contractId: new
|
|
28367
|
+
contractId: new _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.Contract(evt.contractId)
|
|
27353
28368
|
}), {}, {
|
|
27354
28369
|
topic: evt.topic.map(function (topic) {
|
|
27355
|
-
return
|
|
28370
|
+
return _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.ScVal.fromXDR(topic, 'base64');
|
|
27356
28371
|
}),
|
|
27357
|
-
value:
|
|
28372
|
+
value: _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.ScVal.fromXDR(evt.value, 'base64')
|
|
27358
28373
|
});
|
|
27359
28374
|
})
|
|
27360
28375
|
};
|
|
@@ -27369,8 +28384,8 @@ function parseRawLedgerEntries(raw) {
|
|
|
27369
28384
|
}
|
|
27370
28385
|
return _objectSpread({
|
|
27371
28386
|
lastModifiedLedgerSeq: rawEntry.lastModifiedLedgerSeq,
|
|
27372
|
-
key:
|
|
27373
|
-
val:
|
|
28387
|
+
key: _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.LedgerKey.fromXDR(rawEntry.key, 'base64'),
|
|
28388
|
+
val: _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.LedgerEntryData.fromXDR(rawEntry.xdr, 'base64')
|
|
27374
28389
|
}, rawEntry.liveUntilLedgerSeq !== undefined && {
|
|
27375
28390
|
liveUntilLedgerSeq: rawEntry.liveUntilLedgerSeq
|
|
27376
28391
|
});
|
|
@@ -27379,7 +28394,7 @@ function parseRawLedgerEntries(raw) {
|
|
|
27379
28394
|
}
|
|
27380
28395
|
function parseRawSimulation(sim) {
|
|
27381
28396
|
var _sim$events$map, _sim$events;
|
|
27382
|
-
var looksRaw = Api.isSimulationRaw(sim);
|
|
28397
|
+
var looksRaw = _api__WEBPACK_IMPORTED_MODULE_1__/* .Api */ .j.isSimulationRaw(sim);
|
|
27383
28398
|
if (!looksRaw) {
|
|
27384
28399
|
return sim;
|
|
27385
28400
|
}
|
|
@@ -27388,7 +28403,7 @@ function parseRawSimulation(sim) {
|
|
|
27388
28403
|
id: sim.id,
|
|
27389
28404
|
latestLedger: sim.latestLedger,
|
|
27390
28405
|
events: (_sim$events$map = (_sim$events = sim.events) === null || _sim$events === void 0 ? void 0 : _sim$events.map(function (evt) {
|
|
27391
|
-
return
|
|
28406
|
+
return _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
|
|
27392
28407
|
})) !== null && _sim$events$map !== void 0 ? _sim$events$map : []
|
|
27393
28408
|
};
|
|
27394
28409
|
if (typeof sim.error === 'string') {
|
|
@@ -27401,7 +28416,7 @@ function parseRawSimulation(sim) {
|
|
|
27401
28416
|
function parseSuccessful(sim, partial) {
|
|
27402
28417
|
var _sim$results$length, _sim$results;
|
|
27403
28418
|
var success = _objectSpread(_objectSpread({}, partial), {}, {
|
|
27404
|
-
transactionData: new
|
|
28419
|
+
transactionData: new _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.SorobanDataBuilder(sim.transactionData),
|
|
27405
28420
|
minResourceFee: sim.minResourceFee,
|
|
27406
28421
|
cost: sim.cost
|
|
27407
28422
|
}, ((_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) && {
|
|
@@ -27409,9 +28424,9 @@ function parseSuccessful(sim, partial) {
|
|
|
27409
28424
|
var _row$auth;
|
|
27410
28425
|
return {
|
|
27411
28426
|
auth: ((_row$auth = row.auth) !== null && _row$auth !== void 0 ? _row$auth : []).map(function (entry) {
|
|
27412
|
-
return
|
|
28427
|
+
return _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.SorobanAuthorizationEntry.fromXDR(entry, 'base64');
|
|
27413
28428
|
}),
|
|
27414
|
-
retval: !!row.xdr ?
|
|
28429
|
+
retval: !!row.xdr ? _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.ScVal.fromXDR(row.xdr, 'base64') : _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.ScVal.scvVoid()
|
|
27415
28430
|
};
|
|
27416
28431
|
})[0]
|
|
27417
28432
|
});
|
|
@@ -27421,76 +28436,102 @@ function parseSuccessful(sim, partial) {
|
|
|
27421
28436
|
return _objectSpread(_objectSpread({}, success), {}, {
|
|
27422
28437
|
restorePreamble: {
|
|
27423
28438
|
minResourceFee: sim.restorePreamble.minResourceFee,
|
|
27424
|
-
transactionData: new
|
|
28439
|
+
transactionData: new _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.SorobanDataBuilder(sim.restorePreamble.transactionData)
|
|
27425
28440
|
}
|
|
27426
28441
|
});
|
|
27427
28442
|
}
|
|
27428
|
-
;// CONCATENATED MODULE: ./src/soroban/transaction.ts
|
|
27429
28443
|
|
|
28444
|
+
/***/ }),
|
|
27430
28445
|
|
|
28446
|
+
/***/ 1575:
|
|
28447
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
27431
28448
|
|
|
27432
|
-
|
|
27433
|
-
|
|
27434
|
-
|
|
27435
|
-
|
|
27436
|
-
|
|
27437
|
-
|
|
27438
|
-
|
|
27439
|
-
|
|
27440
|
-
|
|
27441
|
-
|
|
27442
|
-
|
|
27443
|
-
|
|
27444
|
-
|
|
27445
|
-
|
|
27446
|
-
|
|
27447
|
-
|
|
27448
|
-
|
|
27449
|
-
|
|
27450
|
-
|
|
27451
|
-
|
|
27452
|
-
|
|
27453
|
-
|
|
27454
|
-
|
|
27455
|
-
|
|
27456
|
-
|
|
27457
|
-
source: invokeOp.source,
|
|
27458
|
-
func: invokeOp.func,
|
|
27459
|
-
auth: existingAuth.length > 0 ? existingAuth : success.result.auth
|
|
27460
|
-
}));
|
|
27461
|
-
break;
|
|
27462
|
-
}
|
|
27463
|
-
return txnBuilder;
|
|
28449
|
+
"use strict";
|
|
28450
|
+
|
|
28451
|
+
// EXPORTS
|
|
28452
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
28453
|
+
ku: () => (/* binding */ Durability),
|
|
28454
|
+
gq: () => (/* binding */ Server)
|
|
28455
|
+
});
|
|
28456
|
+
|
|
28457
|
+
// UNUSED EXPORTS: SUBMIT_TRANSACTION_TIMEOUT
|
|
28458
|
+
|
|
28459
|
+
// EXTERNAL MODULE: ./node_modules/urijs/src/URI.js
|
|
28460
|
+
var URI = __webpack_require__(4193);
|
|
28461
|
+
var URI_default = /*#__PURE__*/__webpack_require__.n(URI);
|
|
28462
|
+
// EXTERNAL MODULE: ./node_modules/@stellar/stellar-base/lib/index.js
|
|
28463
|
+
var lib = __webpack_require__(356);
|
|
28464
|
+
// EXTERNAL MODULE: ./src/rpc/axios.ts
|
|
28465
|
+
var axios = __webpack_require__(4982);
|
|
28466
|
+
;// CONCATENATED MODULE: ./src/rpc/jsonrpc.ts
|
|
28467
|
+
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); }
|
|
28468
|
+
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 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 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 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; }
|
|
28469
|
+
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); } }
|
|
28470
|
+
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); }); }; }
|
|
28471
|
+
|
|
28472
|
+
function postObject(_x, _x2) {
|
|
28473
|
+
return _postObject.apply(this, arguments);
|
|
27464
28474
|
}
|
|
27465
|
-
function
|
|
27466
|
-
|
|
27467
|
-
|
|
27468
|
-
|
|
27469
|
-
|
|
27470
|
-
|
|
27471
|
-
|
|
27472
|
-
|
|
27473
|
-
|
|
27474
|
-
|
|
27475
|
-
|
|
27476
|
-
|
|
28475
|
+
function _postObject() {
|
|
28476
|
+
_postObject = _asyncToGenerator(_regeneratorRuntime().mark(function _callee(url, method) {
|
|
28477
|
+
var param,
|
|
28478
|
+
response,
|
|
28479
|
+
_response$data,
|
|
28480
|
+
_args = arguments;
|
|
28481
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
28482
|
+
while (1) switch (_context.prev = _context.next) {
|
|
28483
|
+
case 0:
|
|
28484
|
+
param = _args.length > 2 && _args[2] !== undefined ? _args[2] : null;
|
|
28485
|
+
_context.next = 3;
|
|
28486
|
+
return axios/* default */.Ay.post(url, {
|
|
28487
|
+
jsonrpc: "2.0",
|
|
28488
|
+
id: 1,
|
|
28489
|
+
method: method,
|
|
28490
|
+
params: param
|
|
28491
|
+
});
|
|
28492
|
+
case 3:
|
|
28493
|
+
response = _context.sent;
|
|
28494
|
+
if (!jsonrpc_hasOwnProperty(response.data, "error")) {
|
|
28495
|
+
_context.next = 8;
|
|
28496
|
+
break;
|
|
28497
|
+
}
|
|
28498
|
+
throw response.data.error;
|
|
28499
|
+
case 8:
|
|
28500
|
+
return _context.abrupt("return", (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.result);
|
|
28501
|
+
case 9:
|
|
28502
|
+
case "end":
|
|
28503
|
+
return _context.stop();
|
|
28504
|
+
}
|
|
28505
|
+
}, _callee);
|
|
28506
|
+
}));
|
|
28507
|
+
return _postObject.apply(this, arguments);
|
|
27477
28508
|
}
|
|
27478
|
-
|
|
28509
|
+
function jsonrpc_hasOwnProperty(obj, prop) {
|
|
28510
|
+
return obj.hasOwnProperty(prop);
|
|
28511
|
+
}
|
|
28512
|
+
// EXTERNAL MODULE: ./src/rpc/api.ts
|
|
28513
|
+
var api = __webpack_require__(4076);
|
|
28514
|
+
// EXTERNAL MODULE: ./src/rpc/transaction.ts
|
|
28515
|
+
var transaction = __webpack_require__(8680);
|
|
28516
|
+
// EXTERNAL MODULE: ./src/rpc/parsers.ts
|
|
28517
|
+
var parsers = __webpack_require__(784);
|
|
28518
|
+
;// CONCATENATED MODULE: ./src/rpc/server.ts
|
|
28519
|
+
/* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"];
|
|
27479
28520
|
function server_typeof(o) { "@babel/helpers - typeof"; return server_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; }, server_typeof(o); }
|
|
27480
28521
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
27481
28522
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
27482
28523
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
27483
|
-
function
|
|
27484
|
-
function
|
|
27485
|
-
function
|
|
28524
|
+
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; }
|
|
28525
|
+
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; }
|
|
28526
|
+
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; }
|
|
27486
28527
|
function server_regeneratorRuntime() { "use strict"; server_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" == server_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 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(server_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 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 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; }
|
|
27487
28528
|
function server_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); } }
|
|
27488
28529
|
function server_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { server_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { server_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
27489
28530
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
27490
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target,
|
|
28531
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
27491
28532
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
27492
|
-
function
|
|
27493
|
-
function
|
|
28533
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == server_typeof(i) ? i : i + ""; }
|
|
28534
|
+
function _toPrimitive(t, r) { if ("object" != server_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != server_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
27494
28535
|
|
|
27495
28536
|
|
|
27496
28537
|
|
|
@@ -27510,7 +28551,7 @@ var Server = function () {
|
|
|
27510
28551
|
_classCallCheck(this, Server);
|
|
27511
28552
|
this.serverURL = URI_default()(serverURL);
|
|
27512
28553
|
if (opts.headers && Object.keys(opts.headers).length === 0) {
|
|
27513
|
-
|
|
28554
|
+
axios/* default */.Ay.interceptors.request.use(function (config) {
|
|
27514
28555
|
config.headers = Object.assign(config.headers, opts.headers);
|
|
27515
28556
|
return config;
|
|
27516
28557
|
});
|
|
@@ -27652,20 +28693,101 @@ var Server = function () {
|
|
|
27652
28693
|
return getContractData;
|
|
27653
28694
|
}())
|
|
27654
28695
|
}, {
|
|
27655
|
-
key: "
|
|
28696
|
+
key: "getContractWasmByContractId",
|
|
27656
28697
|
value: (function () {
|
|
27657
|
-
var
|
|
27658
|
-
var
|
|
28698
|
+
var _getContractWasmByContractId = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee4(contractId) {
|
|
28699
|
+
var _response$entries$;
|
|
28700
|
+
var contractLedgerKey, response, wasmHash;
|
|
27659
28701
|
return server_regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
27660
28702
|
while (1) switch (_context4.prev = _context4.next) {
|
|
27661
28703
|
case 0:
|
|
27662
|
-
|
|
27663
|
-
|
|
28704
|
+
contractLedgerKey = new lib.Contract(contractId).getFootprint();
|
|
28705
|
+
_context4.next = 3;
|
|
28706
|
+
return this.getLedgerEntries(contractLedgerKey);
|
|
28707
|
+
case 3:
|
|
28708
|
+
response = _context4.sent;
|
|
28709
|
+
if (!(!response.entries.length || !((_response$entries$ = response.entries[0]) !== null && _response$entries$ !== void 0 && _response$entries$.val))) {
|
|
28710
|
+
_context4.next = 6;
|
|
28711
|
+
break;
|
|
28712
|
+
}
|
|
28713
|
+
return _context4.abrupt("return", Promise.reject({
|
|
28714
|
+
code: 404,
|
|
28715
|
+
message: "Could not obtain contract hash from server"
|
|
28716
|
+
}));
|
|
28717
|
+
case 6:
|
|
28718
|
+
wasmHash = response.entries[0].val.contractData().val().instance().executable().wasmHash();
|
|
28719
|
+
return _context4.abrupt("return", this.getContractWasmByHash(wasmHash));
|
|
28720
|
+
case 8:
|
|
27664
28721
|
case "end":
|
|
27665
28722
|
return _context4.stop();
|
|
27666
28723
|
}
|
|
27667
28724
|
}, _callee4, this);
|
|
27668
28725
|
}));
|
|
28726
|
+
function getContractWasmByContractId(_x4) {
|
|
28727
|
+
return _getContractWasmByContractId.apply(this, arguments);
|
|
28728
|
+
}
|
|
28729
|
+
return getContractWasmByContractId;
|
|
28730
|
+
}())
|
|
28731
|
+
}, {
|
|
28732
|
+
key: "getContractWasmByHash",
|
|
28733
|
+
value: (function () {
|
|
28734
|
+
var _getContractWasmByHash = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee5(wasmHash) {
|
|
28735
|
+
var _responseWasm$entries;
|
|
28736
|
+
var format,
|
|
28737
|
+
wasmHashBuffer,
|
|
28738
|
+
ledgerKeyWasmHash,
|
|
28739
|
+
responseWasm,
|
|
28740
|
+
wasmBuffer,
|
|
28741
|
+
_args5 = arguments;
|
|
28742
|
+
return server_regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
28743
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
28744
|
+
case 0:
|
|
28745
|
+
format = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : undefined;
|
|
28746
|
+
wasmHashBuffer = typeof wasmHash === "string" ? Buffer.from(wasmHash, format) : wasmHash;
|
|
28747
|
+
ledgerKeyWasmHash = lib.xdr.LedgerKey.contractCode(new lib.xdr.LedgerKeyContractCode({
|
|
28748
|
+
hash: wasmHashBuffer
|
|
28749
|
+
}));
|
|
28750
|
+
_context5.next = 5;
|
|
28751
|
+
return this.getLedgerEntries(ledgerKeyWasmHash);
|
|
28752
|
+
case 5:
|
|
28753
|
+
responseWasm = _context5.sent;
|
|
28754
|
+
if (!(!responseWasm.entries.length || !((_responseWasm$entries = responseWasm.entries[0]) !== null && _responseWasm$entries !== void 0 && _responseWasm$entries.val))) {
|
|
28755
|
+
_context5.next = 8;
|
|
28756
|
+
break;
|
|
28757
|
+
}
|
|
28758
|
+
return _context5.abrupt("return", Promise.reject({
|
|
28759
|
+
code: 404,
|
|
28760
|
+
message: "Could not obtain contract wasm from server"
|
|
28761
|
+
}));
|
|
28762
|
+
case 8:
|
|
28763
|
+
wasmBuffer = responseWasm.entries[0].val.contractCode().code();
|
|
28764
|
+
return _context5.abrupt("return", wasmBuffer);
|
|
28765
|
+
case 10:
|
|
28766
|
+
case "end":
|
|
28767
|
+
return _context5.stop();
|
|
28768
|
+
}
|
|
28769
|
+
}, _callee5, this);
|
|
28770
|
+
}));
|
|
28771
|
+
function getContractWasmByHash(_x5) {
|
|
28772
|
+
return _getContractWasmByHash.apply(this, arguments);
|
|
28773
|
+
}
|
|
28774
|
+
return getContractWasmByHash;
|
|
28775
|
+
}())
|
|
28776
|
+
}, {
|
|
28777
|
+
key: "getLedgerEntries",
|
|
28778
|
+
value: (function () {
|
|
28779
|
+
var _getLedgerEntries2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee6() {
|
|
28780
|
+
var _args6 = arguments;
|
|
28781
|
+
return server_regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
28782
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
28783
|
+
case 0:
|
|
28784
|
+
return _context6.abrupt("return", this._getLedgerEntries.apply(this, _args6).then(parsers/* parseRawLedgerEntries */.$D));
|
|
28785
|
+
case 1:
|
|
28786
|
+
case "end":
|
|
28787
|
+
return _context6.stop();
|
|
28788
|
+
}
|
|
28789
|
+
}, _callee6, this);
|
|
28790
|
+
}));
|
|
27669
28791
|
function getLedgerEntries() {
|
|
27670
28792
|
return _getLedgerEntries2.apply(this, arguments);
|
|
27671
28793
|
}
|
|
@@ -27674,27 +28796,27 @@ var Server = function () {
|
|
|
27674
28796
|
}, {
|
|
27675
28797
|
key: "_getLedgerEntries",
|
|
27676
28798
|
value: function () {
|
|
27677
|
-
var _getLedgerEntries3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
28799
|
+
var _getLedgerEntries3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee7() {
|
|
27678
28800
|
var _len,
|
|
27679
28801
|
keys,
|
|
27680
28802
|
_key,
|
|
27681
|
-
|
|
27682
|
-
return server_regeneratorRuntime().wrap(function
|
|
27683
|
-
while (1) switch (
|
|
28803
|
+
_args7 = arguments;
|
|
28804
|
+
return server_regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
28805
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
27684
28806
|
case 0:
|
|
27685
|
-
for (_len =
|
|
27686
|
-
keys[_key] =
|
|
28807
|
+
for (_len = _args7.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28808
|
+
keys[_key] = _args7[_key];
|
|
27687
28809
|
}
|
|
27688
|
-
return
|
|
28810
|
+
return _context7.abrupt("return", postObject(this.serverURL.toString(), 'getLedgerEntries', {
|
|
27689
28811
|
keys: keys.map(function (k) {
|
|
27690
28812
|
return k.toXDR('base64');
|
|
27691
28813
|
})
|
|
27692
28814
|
}));
|
|
27693
28815
|
case 2:
|
|
27694
28816
|
case "end":
|
|
27695
|
-
return
|
|
28817
|
+
return _context7.stop();
|
|
27696
28818
|
}
|
|
27697
|
-
},
|
|
28819
|
+
}, _callee7, this);
|
|
27698
28820
|
}));
|
|
27699
28821
|
function _getLedgerEntries() {
|
|
27700
28822
|
return _getLedgerEntries3.apply(this, arguments);
|
|
@@ -27704,16 +28826,16 @@ var Server = function () {
|
|
|
27704
28826
|
}, {
|
|
27705
28827
|
key: "getTransaction",
|
|
27706
28828
|
value: (function () {
|
|
27707
|
-
var _getTransaction2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
27708
|
-
return server_regeneratorRuntime().wrap(function
|
|
27709
|
-
while (1) switch (
|
|
28829
|
+
var _getTransaction2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee8(hash) {
|
|
28830
|
+
return server_regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
28831
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
27710
28832
|
case 0:
|
|
27711
|
-
return
|
|
28833
|
+
return _context8.abrupt("return", this._getTransaction(hash).then(function (raw) {
|
|
27712
28834
|
var foundInfo = {};
|
|
27713
|
-
if (raw.status !== Api.GetTransactionStatus.NOT_FOUND) {
|
|
28835
|
+
if (raw.status !== api/* Api */.j.GetTransactionStatus.NOT_FOUND) {
|
|
27714
28836
|
var _meta$v3$sorobanMeta;
|
|
27715
28837
|
var meta = lib.xdr.TransactionMeta.fromXDR(raw.resultMetaXdr, 'base64');
|
|
27716
|
-
foundInfo =
|
|
28838
|
+
foundInfo = _objectSpread({
|
|
27717
28839
|
ledger: raw.ledger,
|
|
27718
28840
|
createdAt: raw.createdAt,
|
|
27719
28841
|
applicationOrder: raw.applicationOrder,
|
|
@@ -27721,11 +28843,11 @@ var Server = function () {
|
|
|
27721
28843
|
envelopeXdr: lib.xdr.TransactionEnvelope.fromXDR(raw.envelopeXdr, 'base64'),
|
|
27722
28844
|
resultXdr: lib.xdr.TransactionResult.fromXDR(raw.resultXdr, 'base64'),
|
|
27723
28845
|
resultMetaXdr: meta
|
|
27724
|
-
}, meta.switch() === 3 && meta.v3().sorobanMeta() !== null && raw.status === Api.GetTransactionStatus.SUCCESS && {
|
|
28846
|
+
}, meta.switch() === 3 && meta.v3().sorobanMeta() !== null && raw.status === api/* Api */.j.GetTransactionStatus.SUCCESS && {
|
|
27725
28847
|
returnValue: (_meta$v3$sorobanMeta = meta.v3().sorobanMeta()) === null || _meta$v3$sorobanMeta === void 0 ? void 0 : _meta$v3$sorobanMeta.returnValue()
|
|
27726
28848
|
});
|
|
27727
28849
|
}
|
|
27728
|
-
var result =
|
|
28850
|
+
var result = _objectSpread({
|
|
27729
28851
|
status: raw.status,
|
|
27730
28852
|
latestLedger: raw.latestLedger,
|
|
27731
28853
|
latestLedgerCloseTime: raw.latestLedgerCloseTime,
|
|
@@ -27736,11 +28858,11 @@ var Server = function () {
|
|
|
27736
28858
|
}));
|
|
27737
28859
|
case 1:
|
|
27738
28860
|
case "end":
|
|
27739
|
-
return
|
|
28861
|
+
return _context8.stop();
|
|
27740
28862
|
}
|
|
27741
|
-
},
|
|
28863
|
+
}, _callee8, this);
|
|
27742
28864
|
}));
|
|
27743
|
-
function getTransaction(
|
|
28865
|
+
function getTransaction(_x6) {
|
|
27744
28866
|
return _getTransaction2.apply(this, arguments);
|
|
27745
28867
|
}
|
|
27746
28868
|
return getTransaction;
|
|
@@ -27748,20 +28870,20 @@ var Server = function () {
|
|
|
27748
28870
|
}, {
|
|
27749
28871
|
key: "_getTransaction",
|
|
27750
28872
|
value: function () {
|
|
27751
|
-
var _getTransaction3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
27752
|
-
return server_regeneratorRuntime().wrap(function
|
|
27753
|
-
while (1) switch (
|
|
28873
|
+
var _getTransaction3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee9(hash) {
|
|
28874
|
+
return server_regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
28875
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
27754
28876
|
case 0:
|
|
27755
|
-
return
|
|
28877
|
+
return _context9.abrupt("return", postObject(this.serverURL.toString(), 'getTransaction', {
|
|
27756
28878
|
hash: hash
|
|
27757
28879
|
}));
|
|
27758
28880
|
case 1:
|
|
27759
28881
|
case "end":
|
|
27760
|
-
return
|
|
28882
|
+
return _context9.stop();
|
|
27761
28883
|
}
|
|
27762
|
-
},
|
|
28884
|
+
}, _callee9, this);
|
|
27763
28885
|
}));
|
|
27764
|
-
function _getTransaction(
|
|
28886
|
+
function _getTransaction(_x7) {
|
|
27765
28887
|
return _getTransaction3.apply(this, arguments);
|
|
27766
28888
|
}
|
|
27767
28889
|
return _getTransaction;
|
|
@@ -27769,18 +28891,18 @@ var Server = function () {
|
|
|
27769
28891
|
}, {
|
|
27770
28892
|
key: "getEvents",
|
|
27771
28893
|
value: (function () {
|
|
27772
|
-
var _getEvents2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
27773
|
-
return server_regeneratorRuntime().wrap(function
|
|
27774
|
-
while (1) switch (
|
|
28894
|
+
var _getEvents2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee10(request) {
|
|
28895
|
+
return server_regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
28896
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
27775
28897
|
case 0:
|
|
27776
|
-
return
|
|
28898
|
+
return _context10.abrupt("return", this._getEvents(request).then(parsers/* parseRawEvents */.fG));
|
|
27777
28899
|
case 1:
|
|
27778
28900
|
case "end":
|
|
27779
|
-
return
|
|
28901
|
+
return _context10.stop();
|
|
27780
28902
|
}
|
|
27781
|
-
},
|
|
28903
|
+
}, _callee10, this);
|
|
27782
28904
|
}));
|
|
27783
|
-
function getEvents(
|
|
28905
|
+
function getEvents(_x8) {
|
|
27784
28906
|
return _getEvents2.apply(this, arguments);
|
|
27785
28907
|
}
|
|
27786
28908
|
return getEvents;
|
|
@@ -27788,14 +28910,14 @@ var Server = function () {
|
|
|
27788
28910
|
}, {
|
|
27789
28911
|
key: "_getEvents",
|
|
27790
28912
|
value: function () {
|
|
27791
|
-
var _getEvents3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
28913
|
+
var _getEvents3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee11(request) {
|
|
27792
28914
|
var _request$filters;
|
|
27793
|
-
return server_regeneratorRuntime().wrap(function
|
|
27794
|
-
while (1) switch (
|
|
28915
|
+
return server_regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
28916
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
27795
28917
|
case 0:
|
|
27796
|
-
return
|
|
28918
|
+
return _context11.abrupt("return", postObject(this.serverURL.toString(), 'getEvents', _objectSpread({
|
|
27797
28919
|
filters: (_request$filters = request.filters) !== null && _request$filters !== void 0 ? _request$filters : [],
|
|
27798
|
-
pagination:
|
|
28920
|
+
pagination: _objectSpread(_objectSpread({}, request.cursor && {
|
|
27799
28921
|
cursor: request.cursor
|
|
27800
28922
|
}), request.limit && {
|
|
27801
28923
|
limit: request.limit
|
|
@@ -27805,11 +28927,11 @@ var Server = function () {
|
|
|
27805
28927
|
})));
|
|
27806
28928
|
case 1:
|
|
27807
28929
|
case "end":
|
|
27808
|
-
return
|
|
28930
|
+
return _context11.stop();
|
|
27809
28931
|
}
|
|
27810
|
-
},
|
|
28932
|
+
}, _callee11, this);
|
|
27811
28933
|
}));
|
|
27812
|
-
function _getEvents(
|
|
28934
|
+
function _getEvents(_x9) {
|
|
27813
28935
|
return _getEvents3.apply(this, arguments);
|
|
27814
28936
|
}
|
|
27815
28937
|
return _getEvents;
|
|
@@ -27817,19 +28939,19 @@ var Server = function () {
|
|
|
27817
28939
|
}, {
|
|
27818
28940
|
key: "getNetwork",
|
|
27819
28941
|
value: (function () {
|
|
27820
|
-
var _getNetwork = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
27821
|
-
return server_regeneratorRuntime().wrap(function
|
|
27822
|
-
while (1) switch (
|
|
28942
|
+
var _getNetwork = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee12() {
|
|
28943
|
+
return server_regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
28944
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
27823
28945
|
case 0:
|
|
27824
|
-
|
|
28946
|
+
_context12.next = 2;
|
|
27825
28947
|
return postObject(this.serverURL.toString(), 'getNetwork');
|
|
27826
28948
|
case 2:
|
|
27827
|
-
return
|
|
28949
|
+
return _context12.abrupt("return", _context12.sent);
|
|
27828
28950
|
case 3:
|
|
27829
28951
|
case "end":
|
|
27830
|
-
return
|
|
28952
|
+
return _context12.stop();
|
|
27831
28953
|
}
|
|
27832
|
-
},
|
|
28954
|
+
}, _callee12, this);
|
|
27833
28955
|
}));
|
|
27834
28956
|
function getNetwork() {
|
|
27835
28957
|
return _getNetwork.apply(this, arguments);
|
|
@@ -27839,16 +28961,16 @@ var Server = function () {
|
|
|
27839
28961
|
}, {
|
|
27840
28962
|
key: "getLatestLedger",
|
|
27841
28963
|
value: (function () {
|
|
27842
|
-
var _getLatestLedger = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
27843
|
-
return server_regeneratorRuntime().wrap(function
|
|
27844
|
-
while (1) switch (
|
|
28964
|
+
var _getLatestLedger = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee13() {
|
|
28965
|
+
return server_regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
28966
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
27845
28967
|
case 0:
|
|
27846
|
-
return
|
|
28968
|
+
return _context13.abrupt("return", postObject(this.serverURL.toString(), 'getLatestLedger'));
|
|
27847
28969
|
case 1:
|
|
27848
28970
|
case "end":
|
|
27849
|
-
return
|
|
28971
|
+
return _context13.stop();
|
|
27850
28972
|
}
|
|
27851
|
-
},
|
|
28973
|
+
}, _callee13, this);
|
|
27852
28974
|
}));
|
|
27853
28975
|
function getLatestLedger() {
|
|
27854
28976
|
return _getLatestLedger.apply(this, arguments);
|
|
@@ -27858,18 +28980,18 @@ var Server = function () {
|
|
|
27858
28980
|
}, {
|
|
27859
28981
|
key: "simulateTransaction",
|
|
27860
28982
|
value: (function () {
|
|
27861
|
-
var _simulateTransaction2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
27862
|
-
return server_regeneratorRuntime().wrap(function
|
|
27863
|
-
while (1) switch (
|
|
28983
|
+
var _simulateTransaction2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee14(tx, addlResources) {
|
|
28984
|
+
return server_regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
28985
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
27864
28986
|
case 0:
|
|
27865
|
-
return
|
|
28987
|
+
return _context14.abrupt("return", this._simulateTransaction(tx, addlResources).then(parsers/* parseRawSimulation */.jr));
|
|
27866
28988
|
case 1:
|
|
27867
28989
|
case "end":
|
|
27868
|
-
return
|
|
28990
|
+
return _context14.stop();
|
|
27869
28991
|
}
|
|
27870
|
-
},
|
|
28992
|
+
}, _callee14, this);
|
|
27871
28993
|
}));
|
|
27872
|
-
function simulateTransaction(
|
|
28994
|
+
function simulateTransaction(_x10, _x11) {
|
|
27873
28995
|
return _simulateTransaction2.apply(this, arguments);
|
|
27874
28996
|
}
|
|
27875
28997
|
return simulateTransaction;
|
|
@@ -27877,11 +28999,11 @@ var Server = function () {
|
|
|
27877
28999
|
}, {
|
|
27878
29000
|
key: "_simulateTransaction",
|
|
27879
29001
|
value: function () {
|
|
27880
|
-
var _simulateTransaction3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
27881
|
-
return server_regeneratorRuntime().wrap(function
|
|
27882
|
-
while (1) switch (
|
|
29002
|
+
var _simulateTransaction3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee15(transaction, addlResources) {
|
|
29003
|
+
return server_regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
29004
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
27883
29005
|
case 0:
|
|
27884
|
-
return
|
|
29006
|
+
return _context15.abrupt("return", postObject(this.serverURL.toString(), 'simulateTransaction', _objectSpread({
|
|
27885
29007
|
transaction: transaction.toXDR()
|
|
27886
29008
|
}, addlResources !== undefined && {
|
|
27887
29009
|
resourceConfig: {
|
|
@@ -27890,11 +29012,11 @@ var Server = function () {
|
|
|
27890
29012
|
})));
|
|
27891
29013
|
case 1:
|
|
27892
29014
|
case "end":
|
|
27893
|
-
return
|
|
29015
|
+
return _context15.stop();
|
|
27894
29016
|
}
|
|
27895
|
-
},
|
|
29017
|
+
}, _callee15, this);
|
|
27896
29018
|
}));
|
|
27897
|
-
function _simulateTransaction(
|
|
29019
|
+
function _simulateTransaction(_x12, _x13) {
|
|
27898
29020
|
return _simulateTransaction3.apply(this, arguments);
|
|
27899
29021
|
}
|
|
27900
29022
|
return _simulateTransaction;
|
|
@@ -27902,29 +29024,29 @@ var Server = function () {
|
|
|
27902
29024
|
}, {
|
|
27903
29025
|
key: "prepareTransaction",
|
|
27904
29026
|
value: (function () {
|
|
27905
|
-
var _prepareTransaction = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
29027
|
+
var _prepareTransaction = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee16(tx) {
|
|
27906
29028
|
var simResponse;
|
|
27907
|
-
return server_regeneratorRuntime().wrap(function
|
|
27908
|
-
while (1) switch (
|
|
29029
|
+
return server_regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
29030
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
27909
29031
|
case 0:
|
|
27910
|
-
|
|
29032
|
+
_context16.next = 2;
|
|
27911
29033
|
return this.simulateTransaction(tx);
|
|
27912
29034
|
case 2:
|
|
27913
|
-
simResponse =
|
|
27914
|
-
if (!Api.isSimulationError(simResponse)) {
|
|
27915
|
-
|
|
29035
|
+
simResponse = _context16.sent;
|
|
29036
|
+
if (!api/* Api */.j.isSimulationError(simResponse)) {
|
|
29037
|
+
_context16.next = 5;
|
|
27916
29038
|
break;
|
|
27917
29039
|
}
|
|
27918
29040
|
throw simResponse.error;
|
|
27919
29041
|
case 5:
|
|
27920
|
-
return
|
|
29042
|
+
return _context16.abrupt("return", (0,transaction/* assembleTransaction */.X)(tx, simResponse).build());
|
|
27921
29043
|
case 6:
|
|
27922
29044
|
case "end":
|
|
27923
|
-
return
|
|
29045
|
+
return _context16.stop();
|
|
27924
29046
|
}
|
|
27925
|
-
},
|
|
29047
|
+
}, _callee16, this);
|
|
27926
29048
|
}));
|
|
27927
|
-
function prepareTransaction(
|
|
29049
|
+
function prepareTransaction(_x14) {
|
|
27928
29050
|
return _prepareTransaction.apply(this, arguments);
|
|
27929
29051
|
}
|
|
27930
29052
|
return prepareTransaction;
|
|
@@ -27932,18 +29054,18 @@ var Server = function () {
|
|
|
27932
29054
|
}, {
|
|
27933
29055
|
key: "sendTransaction",
|
|
27934
29056
|
value: (function () {
|
|
27935
|
-
var _sendTransaction2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
27936
|
-
return server_regeneratorRuntime().wrap(function
|
|
27937
|
-
while (1) switch (
|
|
29057
|
+
var _sendTransaction2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee17(transaction) {
|
|
29058
|
+
return server_regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
29059
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
27938
29060
|
case 0:
|
|
27939
|
-
return
|
|
29061
|
+
return _context17.abrupt("return", this._sendTransaction(transaction).then(parsers/* parseRawSendTransaction */.Af));
|
|
27940
29062
|
case 1:
|
|
27941
29063
|
case "end":
|
|
27942
|
-
return
|
|
29064
|
+
return _context17.stop();
|
|
27943
29065
|
}
|
|
27944
|
-
},
|
|
29066
|
+
}, _callee17, this);
|
|
27945
29067
|
}));
|
|
27946
|
-
function sendTransaction(
|
|
29068
|
+
function sendTransaction(_x15) {
|
|
27947
29069
|
return _sendTransaction2.apply(this, arguments);
|
|
27948
29070
|
}
|
|
27949
29071
|
return sendTransaction;
|
|
@@ -27951,20 +29073,20 @@ var Server = function () {
|
|
|
27951
29073
|
}, {
|
|
27952
29074
|
key: "_sendTransaction",
|
|
27953
29075
|
value: function () {
|
|
27954
|
-
var _sendTransaction3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
27955
|
-
return server_regeneratorRuntime().wrap(function
|
|
27956
|
-
while (1) switch (
|
|
29076
|
+
var _sendTransaction3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee18(transaction) {
|
|
29077
|
+
return server_regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
29078
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
27957
29079
|
case 0:
|
|
27958
|
-
return
|
|
29080
|
+
return _context18.abrupt("return", postObject(this.serverURL.toString(), 'sendTransaction', {
|
|
27959
29081
|
transaction: transaction.toXDR()
|
|
27960
29082
|
}));
|
|
27961
29083
|
case 1:
|
|
27962
29084
|
case "end":
|
|
27963
|
-
return
|
|
29085
|
+
return _context18.stop();
|
|
27964
29086
|
}
|
|
27965
|
-
},
|
|
29087
|
+
}, _callee18, this);
|
|
27966
29088
|
}));
|
|
27967
|
-
function _sendTransaction(
|
|
29089
|
+
function _sendTransaction(_x16) {
|
|
27968
29090
|
return _sendTransaction3.apply(this, arguments);
|
|
27969
29091
|
}
|
|
27970
29092
|
return _sendTransaction;
|
|
@@ -27972,58 +29094,58 @@ var Server = function () {
|
|
|
27972
29094
|
}, {
|
|
27973
29095
|
key: "requestAirdrop",
|
|
27974
29096
|
value: (function () {
|
|
27975
|
-
var _requestAirdrop = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
29097
|
+
var _requestAirdrop = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee19(address, friendbotUrl) {
|
|
27976
29098
|
var account, response, meta, sequence, _error$response, _error$response$detai;
|
|
27977
|
-
return server_regeneratorRuntime().wrap(function
|
|
27978
|
-
while (1) switch (
|
|
29099
|
+
return server_regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
29100
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
27979
29101
|
case 0:
|
|
27980
29102
|
account = typeof address === 'string' ? address : address.accountId();
|
|
27981
|
-
|
|
27982
|
-
if (
|
|
27983
|
-
|
|
29103
|
+
_context19.t0 = friendbotUrl;
|
|
29104
|
+
if (_context19.t0) {
|
|
29105
|
+
_context19.next = 6;
|
|
27984
29106
|
break;
|
|
27985
29107
|
}
|
|
27986
|
-
|
|
29108
|
+
_context19.next = 5;
|
|
27987
29109
|
return this.getNetwork();
|
|
27988
29110
|
case 5:
|
|
27989
|
-
|
|
29111
|
+
_context19.t0 = _context19.sent.friendbotUrl;
|
|
27990
29112
|
case 6:
|
|
27991
|
-
friendbotUrl =
|
|
29113
|
+
friendbotUrl = _context19.t0;
|
|
27992
29114
|
if (friendbotUrl) {
|
|
27993
|
-
|
|
29115
|
+
_context19.next = 9;
|
|
27994
29116
|
break;
|
|
27995
29117
|
}
|
|
27996
29118
|
throw new Error('No friendbot URL configured for current network');
|
|
27997
29119
|
case 9:
|
|
27998
|
-
|
|
27999
|
-
|
|
28000
|
-
return
|
|
29120
|
+
_context19.prev = 9;
|
|
29121
|
+
_context19.next = 12;
|
|
29122
|
+
return axios/* default */.Ay.post("".concat(friendbotUrl, "?addr=").concat(encodeURIComponent(account)));
|
|
28001
29123
|
case 12:
|
|
28002
|
-
response =
|
|
29124
|
+
response = _context19.sent;
|
|
28003
29125
|
meta = lib.xdr.TransactionMeta.fromXDR(response.data.result_meta_xdr, 'base64');
|
|
28004
29126
|
sequence = findCreatedAccountSequenceInTransactionMeta(meta);
|
|
28005
|
-
return
|
|
29127
|
+
return _context19.abrupt("return", new lib.Account(account, sequence));
|
|
28006
29128
|
case 18:
|
|
28007
|
-
|
|
28008
|
-
|
|
28009
|
-
if (!(((_error$response =
|
|
28010
|
-
|
|
29129
|
+
_context19.prev = 18;
|
|
29130
|
+
_context19.t1 = _context19["catch"](9);
|
|
29131
|
+
if (!(((_error$response = _context19.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 400)) {
|
|
29132
|
+
_context19.next = 23;
|
|
28011
29133
|
break;
|
|
28012
29134
|
}
|
|
28013
|
-
if (!((_error$response$detai =
|
|
28014
|
-
|
|
29135
|
+
if (!((_error$response$detai = _context19.t1.response.detail) !== null && _error$response$detai !== void 0 && _error$response$detai.includes('createAccountAlreadyExist'))) {
|
|
29136
|
+
_context19.next = 23;
|
|
28015
29137
|
break;
|
|
28016
29138
|
}
|
|
28017
|
-
return
|
|
29139
|
+
return _context19.abrupt("return", this.getAccount(account));
|
|
28018
29140
|
case 23:
|
|
28019
|
-
throw
|
|
29141
|
+
throw _context19.t1;
|
|
28020
29142
|
case 24:
|
|
28021
29143
|
case "end":
|
|
28022
|
-
return
|
|
29144
|
+
return _context19.stop();
|
|
28023
29145
|
}
|
|
28024
|
-
},
|
|
29146
|
+
}, _callee19, this, [[9, 18]]);
|
|
28025
29147
|
}));
|
|
28026
|
-
function requestAirdrop(
|
|
29148
|
+
function requestAirdrop(_x17, _x18) {
|
|
28027
29149
|
return _requestAirdrop.apply(this, arguments);
|
|
28028
29150
|
}
|
|
28029
29151
|
return requestAirdrop;
|
|
@@ -28076,14 +29198,69 @@ function findCreatedAccountSequenceInTransactionMeta(meta) {
|
|
|
28076
29198
|
}
|
|
28077
29199
|
throw new Error('No account created in transaction');
|
|
28078
29200
|
}
|
|
28079
|
-
;// CONCATENATED MODULE: ./src/soroban/index.ts
|
|
28080
|
-
/* module decorator */ module = __webpack_require__.hmd(module);
|
|
28081
29201
|
|
|
29202
|
+
/***/ }),
|
|
29203
|
+
|
|
29204
|
+
/***/ 8680:
|
|
29205
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
28082
29206
|
|
|
29207
|
+
"use strict";
|
|
29208
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
29209
|
+
/* harmony export */ X: () => (/* binding */ assembleTransaction)
|
|
29210
|
+
/* harmony export */ });
|
|
29211
|
+
/* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(356);
|
|
29212
|
+
/* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__);
|
|
29213
|
+
/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4076);
|
|
29214
|
+
/* harmony import */ var _parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(784);
|
|
28083
29215
|
|
|
28084
29216
|
|
|
28085
29217
|
|
|
28086
|
-
|
|
29218
|
+
function assembleTransaction(raw, simulation) {
|
|
29219
|
+
var _invokeOp$auth;
|
|
29220
|
+
if ('innerTransaction' in raw) {
|
|
29221
|
+
return assembleTransaction(raw.innerTransaction, simulation);
|
|
29222
|
+
}
|
|
29223
|
+
if (!isSorobanTransaction(raw)) {
|
|
29224
|
+
throw new TypeError('unsupported transaction: must contain exactly one ' + 'invokeHostFunction, extendFootprintTtl, or restoreFootprint ' + 'operation');
|
|
29225
|
+
}
|
|
29226
|
+
var success = (0,_parsers__WEBPACK_IMPORTED_MODULE_2__/* .parseRawSimulation */ .jr)(simulation);
|
|
29227
|
+
if (!_api__WEBPACK_IMPORTED_MODULE_1__/* .Api */ .j.isSimulationSuccess(success)) {
|
|
29228
|
+
throw new Error("simulation incorrect: ".concat(JSON.stringify(success)));
|
|
29229
|
+
}
|
|
29230
|
+
var classicFeeNum = parseInt(raw.fee) || 0;
|
|
29231
|
+
var minResourceFeeNum = parseInt(success.minResourceFee) || 0;
|
|
29232
|
+
var txnBuilder = _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.TransactionBuilder.cloneFrom(raw, {
|
|
29233
|
+
fee: (classicFeeNum + minResourceFeeNum).toString(),
|
|
29234
|
+
sorobanData: success.transactionData.build(),
|
|
29235
|
+
networkPassphrase: raw.networkPassphrase
|
|
29236
|
+
});
|
|
29237
|
+
switch (raw.operations[0].type) {
|
|
29238
|
+
case 'invokeHostFunction':
|
|
29239
|
+
txnBuilder.clearOperations();
|
|
29240
|
+
var invokeOp = raw.operations[0];
|
|
29241
|
+
var existingAuth = (_invokeOp$auth = invokeOp.auth) !== null && _invokeOp$auth !== void 0 ? _invokeOp$auth : [];
|
|
29242
|
+
txnBuilder.addOperation(_stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.Operation.invokeHostFunction({
|
|
29243
|
+
source: invokeOp.source,
|
|
29244
|
+
func: invokeOp.func,
|
|
29245
|
+
auth: existingAuth.length > 0 ? existingAuth : success.result.auth
|
|
29246
|
+
}));
|
|
29247
|
+
break;
|
|
29248
|
+
}
|
|
29249
|
+
return txnBuilder;
|
|
29250
|
+
}
|
|
29251
|
+
function isSorobanTransaction(tx) {
|
|
29252
|
+
if (tx.operations.length !== 1) {
|
|
29253
|
+
return false;
|
|
29254
|
+
}
|
|
29255
|
+
switch (tx.operations[0].type) {
|
|
29256
|
+
case 'invokeHostFunction':
|
|
29257
|
+
case 'extendFootprintTtl':
|
|
29258
|
+
case 'restoreFootprint':
|
|
29259
|
+
return true;
|
|
29260
|
+
default:
|
|
29261
|
+
return false;
|
|
29262
|
+
}
|
|
29263
|
+
}
|
|
28087
29264
|
|
|
28088
29265
|
/***/ }),
|
|
28089
29266
|
|
|
@@ -57304,7 +58481,7 @@ axios.default = axios;
|
|
|
57304
58481
|
/***/ ((module) => {
|
|
57305
58482
|
|
|
57306
58483
|
"use strict";
|
|
57307
|
-
module.exports = {"rE":"12.0.0-rc.
|
|
58484
|
+
module.exports = {"rE":"12.0.0-rc.3"};
|
|
57308
58485
|
|
|
57309
58486
|
/***/ })
|
|
57310
58487
|
|