@stellar/stellar-sdk 13.0.0-rc.1 → 13.0.0-rc.2
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 +31 -1
- package/dist/stellar-sdk-minimal.js +363 -93
- package/dist/stellar-sdk-minimal.min.js +1 -1
- package/dist/stellar-sdk-no-axios.js +380 -96
- package/dist/stellar-sdk-no-axios.min.js +1 -1
- package/dist/stellar-sdk-no-eventsource.js +363 -93
- package/dist/stellar-sdk-no-eventsource.min.js +1 -1
- package/dist/stellar-sdk.js +380 -96
- package/dist/stellar-sdk.min.js +1 -1
- package/lib/contract/assembled_transaction.d.ts +75 -3
- package/lib/contract/assembled_transaction.js +123 -34
- package/lib/contract/basic_node_signer.d.ts +3 -2
- package/lib/contract/basic_node_signer.js +16 -8
- package/lib/contract/client.d.ts +13 -1
- package/lib/contract/client.js +159 -48
- package/lib/contract/types.d.ts +72 -8
- package/lib/contract/types.js +1 -0
- package/lib/horizon/call_builder.d.ts +1 -1
- package/lib/horizon/horizon_axios_client.js +1 -1
- package/lib/horizon/server_api.d.ts +1 -0
- package/lib/horizon/server_api.js +5 -0
- package/lib/horizon/types/effects.d.ts +51 -51
- package/lib/horizon/types/trade.d.ts +3 -2
- package/lib/http-client/types.d.ts +1 -0
- package/lib/minimal/contract/assembled_transaction.d.ts +75 -3
- package/lib/minimal/contract/assembled_transaction.js +123 -34
- package/lib/minimal/contract/basic_node_signer.d.ts +3 -2
- package/lib/minimal/contract/basic_node_signer.js +16 -8
- package/lib/minimal/contract/client.d.ts +13 -1
- package/lib/minimal/contract/client.js +159 -48
- package/lib/minimal/contract/types.d.ts +72 -8
- package/lib/minimal/contract/types.js +1 -0
- package/lib/minimal/horizon/call_builder.d.ts +1 -1
- package/lib/minimal/horizon/horizon_axios_client.js +1 -1
- package/lib/minimal/horizon/server_api.d.ts +1 -0
- package/lib/minimal/horizon/server_api.js +5 -0
- package/lib/minimal/horizon/types/effects.d.ts +51 -51
- package/lib/minimal/horizon/types/trade.d.ts +3 -2
- package/lib/minimal/http-client/types.d.ts +1 -0
- package/lib/minimal/rpc/axios.js +1 -1
- package/lib/minimal/stellartoml/index.d.ts +1 -0
- package/lib/minimal/stellartoml/index.js +2 -0
- package/lib/no-axios/contract/assembled_transaction.d.ts +75 -3
- package/lib/no-axios/contract/assembled_transaction.js +123 -34
- package/lib/no-axios/contract/basic_node_signer.d.ts +3 -2
- package/lib/no-axios/contract/basic_node_signer.js +16 -8
- package/lib/no-axios/contract/client.d.ts +13 -1
- package/lib/no-axios/contract/client.js +159 -48
- package/lib/no-axios/contract/types.d.ts +72 -8
- package/lib/no-axios/contract/types.js +1 -0
- package/lib/no-axios/horizon/call_builder.d.ts +1 -1
- package/lib/no-axios/horizon/horizon_axios_client.js +1 -1
- package/lib/no-axios/horizon/server_api.d.ts +1 -0
- package/lib/no-axios/horizon/server_api.js +5 -0
- package/lib/no-axios/horizon/types/effects.d.ts +51 -51
- package/lib/no-axios/horizon/types/trade.d.ts +3 -2
- package/lib/no-axios/http-client/types.d.ts +1 -0
- package/lib/no-axios/rpc/axios.js +1 -1
- package/lib/no-axios/stellartoml/index.d.ts +1 -0
- package/lib/no-axios/stellartoml/index.js +2 -0
- package/lib/no-eventsource/contract/assembled_transaction.d.ts +75 -3
- package/lib/no-eventsource/contract/assembled_transaction.js +123 -34
- package/lib/no-eventsource/contract/basic_node_signer.d.ts +3 -2
- package/lib/no-eventsource/contract/basic_node_signer.js +16 -8
- package/lib/no-eventsource/contract/client.d.ts +13 -1
- package/lib/no-eventsource/contract/client.js +159 -48
- package/lib/no-eventsource/contract/types.d.ts +72 -8
- package/lib/no-eventsource/contract/types.js +1 -0
- package/lib/no-eventsource/horizon/call_builder.d.ts +1 -1
- package/lib/no-eventsource/horizon/horizon_axios_client.js +1 -1
- package/lib/no-eventsource/horizon/server_api.d.ts +1 -0
- package/lib/no-eventsource/horizon/server_api.js +5 -0
- package/lib/no-eventsource/horizon/types/effects.d.ts +51 -51
- package/lib/no-eventsource/horizon/types/trade.d.ts +3 -2
- package/lib/no-eventsource/http-client/types.d.ts +1 -0
- package/lib/no-eventsource/rpc/axios.js +1 -1
- package/lib/no-eventsource/stellartoml/index.d.ts +1 -0
- package/lib/no-eventsource/stellartoml/index.js +2 -0
- package/lib/rpc/axios.js +1 -1
- package/lib/stellartoml/index.d.ts +1 -0
- package/lib/stellartoml/index.js +2 -0
- package/package.json +1 -1
package/dist/stellar-sdk.js
CHANGED
|
@@ -21620,6 +21620,7 @@ var Err = function () {
|
|
|
21620
21620
|
}]);
|
|
21621
21621
|
}();
|
|
21622
21622
|
;// ./src/contract/types.ts
|
|
21623
|
+
|
|
21623
21624
|
var DEFAULT_TIMEOUT = 5 * 60;
|
|
21624
21625
|
var NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
|
|
21625
21626
|
;// ./src/contract/utils.ts
|
|
@@ -22012,7 +22013,10 @@ var AssembledTransaction = function () {
|
|
|
22012
22013
|
signTransaction,
|
|
22013
22014
|
sigsNeeded,
|
|
22014
22015
|
timeoutInSeconds,
|
|
22016
|
+
signOpts,
|
|
22017
|
+
_yield$signTransactio,
|
|
22015
22018
|
signature,
|
|
22019
|
+
error,
|
|
22016
22020
|
_args2 = arguments;
|
|
22017
22021
|
return assembled_transaction_regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
22018
22022
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -22051,14 +22055,21 @@ var AssembledTransaction = function () {
|
|
|
22051
22055
|
timebounds: undefined,
|
|
22052
22056
|
sorobanData: _this.simulationData.transactionData
|
|
22053
22057
|
}).setTimeout(timeoutInSeconds).build();
|
|
22054
|
-
|
|
22055
|
-
return signTransaction(_this.built.toXDR(), {
|
|
22058
|
+
signOpts = {
|
|
22056
22059
|
networkPassphrase: _this.options.networkPassphrase
|
|
22057
|
-
}
|
|
22058
|
-
|
|
22059
|
-
|
|
22060
|
+
};
|
|
22061
|
+
if (_this.options.address) signOpts.address = _this.options.address;
|
|
22062
|
+
if (_this.options.submit !== undefined) signOpts.submit = _this.options.submit;
|
|
22063
|
+
if (_this.options.submitUrl) signOpts.submitUrl = _this.options.submitUrl;
|
|
22064
|
+
_context2.next = 18;
|
|
22065
|
+
return signTransaction(_this.built.toXDR(), signOpts);
|
|
22066
|
+
case 18:
|
|
22067
|
+
_yield$signTransactio = _context2.sent;
|
|
22068
|
+
signature = _yield$signTransactio.signedTxXdr;
|
|
22069
|
+
error = _yield$signTransactio.error;
|
|
22070
|
+
_this.handleWalletError(error);
|
|
22060
22071
|
_this.signed = lib.TransactionBuilder.fromXDR(signature, _this.options.networkPassphrase);
|
|
22061
|
-
case
|
|
22072
|
+
case 23:
|
|
22062
22073
|
case "end":
|
|
22063
22074
|
return _context2.stop();
|
|
22064
22075
|
}
|
|
@@ -22070,27 +22081,37 @@ var AssembledTransaction = function () {
|
|
|
22070
22081
|
force,
|
|
22071
22082
|
_ref6$signTransaction,
|
|
22072
22083
|
signTransaction,
|
|
22084
|
+
originalSubmit,
|
|
22073
22085
|
_args3 = arguments;
|
|
22074
22086
|
return assembled_transaction_regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
22075
22087
|
while (1) switch (_context3.prev = _context3.next) {
|
|
22076
22088
|
case 0:
|
|
22077
22089
|
_ref6 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, _ref6$force = _ref6.force, force = _ref6$force === void 0 ? false : _ref6$force, _ref6$signTransaction = _ref6.signTransaction, signTransaction = _ref6$signTransaction === void 0 ? _this.options.signTransaction : _ref6$signTransaction;
|
|
22078
22090
|
if (_this.signed) {
|
|
22079
|
-
_context3.next =
|
|
22091
|
+
_context3.next = 10;
|
|
22080
22092
|
break;
|
|
22081
22093
|
}
|
|
22082
|
-
|
|
22094
|
+
originalSubmit = _this.options.submit;
|
|
22095
|
+
if (_this.options.submit) {
|
|
22096
|
+
_this.options.submit = false;
|
|
22097
|
+
}
|
|
22098
|
+
_context3.prev = 4;
|
|
22099
|
+
_context3.next = 7;
|
|
22083
22100
|
return _this.sign({
|
|
22084
22101
|
force: force,
|
|
22085
22102
|
signTransaction: signTransaction
|
|
22086
22103
|
});
|
|
22087
|
-
case
|
|
22104
|
+
case 7:
|
|
22105
|
+
_context3.prev = 7;
|
|
22106
|
+
_this.options.submit = originalSubmit;
|
|
22107
|
+
return _context3.finish(7);
|
|
22108
|
+
case 10:
|
|
22088
22109
|
return _context3.abrupt("return", _this.send());
|
|
22089
|
-
case
|
|
22110
|
+
case 11:
|
|
22090
22111
|
case "end":
|
|
22091
22112
|
return _context3.stop();
|
|
22092
22113
|
}
|
|
22093
|
-
}, _callee3);
|
|
22114
|
+
}, _callee3, null, [[4,, 7, 10]]);
|
|
22094
22115
|
})));
|
|
22095
22116
|
assembled_transaction_defineProperty(this, "needsNonInvokerSigningBy", function () {
|
|
22096
22117
|
var _rawInvokeHostFunctio;
|
|
@@ -22205,18 +22226,21 @@ var AssembledTransaction = function () {
|
|
|
22205
22226
|
_context6.t1 = entry;
|
|
22206
22227
|
_context6.t2 = function () {
|
|
22207
22228
|
var _ref11 = assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee5(preimage) {
|
|
22229
|
+
var _yield$sign, signedAuthEntry, error;
|
|
22208
22230
|
return assembled_transaction_regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
22209
22231
|
while (1) switch (_context5.prev = _context5.next) {
|
|
22210
22232
|
case 0:
|
|
22211
|
-
_context5.
|
|
22212
|
-
_context5.next = 3;
|
|
22233
|
+
_context5.next = 2;
|
|
22213
22234
|
return sign(preimage.toXDR("base64"), {
|
|
22214
|
-
|
|
22235
|
+
address: address
|
|
22215
22236
|
});
|
|
22216
|
-
case
|
|
22217
|
-
|
|
22218
|
-
|
|
22219
|
-
|
|
22237
|
+
case 2:
|
|
22238
|
+
_yield$sign = _context5.sent;
|
|
22239
|
+
signedAuthEntry = _yield$sign.signedAuthEntry;
|
|
22240
|
+
error = _yield$sign.error;
|
|
22241
|
+
_this.handleWalletError(error);
|
|
22242
|
+
return _context5.abrupt("return", Buffer.from(signedAuthEntry, "base64"));
|
|
22243
|
+
case 7:
|
|
22220
22244
|
case "end":
|
|
22221
22245
|
return _context5.stop();
|
|
22222
22246
|
}
|
|
@@ -22304,6 +22328,26 @@ var AssembledTransaction = function () {
|
|
|
22304
22328
|
if (!this.built) throw new Error("Transaction has not yet been simulated; " + "call `AssembledTransaction.simulate` first.");
|
|
22305
22329
|
return (_this$built2 = this.built) === null || _this$built2 === void 0 ? void 0 : _this$built2.toEnvelope().toXDR('base64');
|
|
22306
22330
|
}
|
|
22331
|
+
}, {
|
|
22332
|
+
key: "handleWalletError",
|
|
22333
|
+
value: function handleWalletError(error) {
|
|
22334
|
+
if (!error) return;
|
|
22335
|
+
var message = error.message,
|
|
22336
|
+
code = error.code;
|
|
22337
|
+
var fullMessage = "".concat(message).concat(error.ext ? " (".concat(error.ext.join(', '), ")") : '');
|
|
22338
|
+
switch (code) {
|
|
22339
|
+
case -1:
|
|
22340
|
+
throw new AssembledTransaction.Errors.InternalWalletError(fullMessage);
|
|
22341
|
+
case -2:
|
|
22342
|
+
throw new AssembledTransaction.Errors.ExternalServiceError(fullMessage);
|
|
22343
|
+
case -3:
|
|
22344
|
+
throw new AssembledTransaction.Errors.InvalidClientRequest(fullMessage);
|
|
22345
|
+
case -4:
|
|
22346
|
+
throw new AssembledTransaction.Errors.UserRejected(fullMessage);
|
|
22347
|
+
default:
|
|
22348
|
+
throw new Error("Unhandled error: ".concat(fullMessage));
|
|
22349
|
+
}
|
|
22350
|
+
}
|
|
22307
22351
|
}, {
|
|
22308
22352
|
key: "simulationData",
|
|
22309
22353
|
get: function get() {
|
|
@@ -22319,7 +22363,7 @@ var AssembledTransaction = function () {
|
|
|
22319
22363
|
throw new AssembledTransaction.Errors.NotYetSimulated("Transaction has not yet been simulated");
|
|
22320
22364
|
}
|
|
22321
22365
|
if (api/* Api */.j.isSimulationError(simulation)) {
|
|
22322
|
-
throw new
|
|
22366
|
+
throw new AssembledTransaction.Errors.SimulationFailed("Transaction simulation failed: \"".concat(simulation.error, "\""));
|
|
22323
22367
|
}
|
|
22324
22368
|
if (api/* Api */.j.isSimulationRestore(simulation)) {
|
|
22325
22369
|
throw new AssembledTransaction.Errors.ExpiredState("You need to restore some contract state before you can invoke this method.\n" + 'You can set `restore` to true in the method options in order to ' + 'automatically restore the contract state when needed.');
|
|
@@ -22495,41 +22539,47 @@ var AssembledTransaction = function () {
|
|
|
22495
22539
|
}
|
|
22496
22540
|
}, {
|
|
22497
22541
|
key: "build",
|
|
22542
|
+
value: function build(options) {
|
|
22543
|
+
var _options$args;
|
|
22544
|
+
var contract = new lib.Contract(options.contractId);
|
|
22545
|
+
return AssembledTransaction.buildWithOp(contract.call.apply(contract, [options.method].concat(_toConsumableArray((_options$args = options.args) !== null && _options$args !== void 0 ? _options$args : []))), options);
|
|
22546
|
+
}
|
|
22547
|
+
}, {
|
|
22548
|
+
key: "buildWithOp",
|
|
22498
22549
|
value: (function () {
|
|
22499
|
-
var
|
|
22500
|
-
var _options$fee, _options$
|
|
22501
|
-
var tx,
|
|
22550
|
+
var _buildWithOp = assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee9(operation, options) {
|
|
22551
|
+
var _options$fee, _options$timeoutInSec;
|
|
22552
|
+
var tx, account;
|
|
22502
22553
|
return assembled_transaction_regeneratorRuntime().wrap(function _callee9$(_context10) {
|
|
22503
22554
|
while (1) switch (_context10.prev = _context10.next) {
|
|
22504
22555
|
case 0:
|
|
22505
22556
|
tx = new AssembledTransaction(options);
|
|
22506
|
-
|
|
22507
|
-
_context10.next = 4;
|
|
22557
|
+
_context10.next = 3;
|
|
22508
22558
|
return getAccount(options, tx.server);
|
|
22509
|
-
case
|
|
22559
|
+
case 3:
|
|
22510
22560
|
account = _context10.sent;
|
|
22511
22561
|
tx.raw = new lib.TransactionBuilder(account, {
|
|
22512
22562
|
fee: (_options$fee = options.fee) !== null && _options$fee !== void 0 ? _options$fee : lib.BASE_FEE,
|
|
22513
22563
|
networkPassphrase: options.networkPassphrase
|
|
22514
|
-
}).
|
|
22564
|
+
}).setTimeout((_options$timeoutInSec = options.timeoutInSeconds) !== null && _options$timeoutInSec !== void 0 ? _options$timeoutInSec : DEFAULT_TIMEOUT).addOperation(operation);
|
|
22515
22565
|
if (!options.simulate) {
|
|
22516
|
-
_context10.next =
|
|
22566
|
+
_context10.next = 8;
|
|
22517
22567
|
break;
|
|
22518
22568
|
}
|
|
22519
|
-
_context10.next =
|
|
22569
|
+
_context10.next = 8;
|
|
22520
22570
|
return tx.simulate();
|
|
22521
|
-
case
|
|
22571
|
+
case 8:
|
|
22522
22572
|
return _context10.abrupt("return", tx);
|
|
22523
|
-
case
|
|
22573
|
+
case 9:
|
|
22524
22574
|
case "end":
|
|
22525
22575
|
return _context10.stop();
|
|
22526
22576
|
}
|
|
22527
22577
|
}, _callee9);
|
|
22528
22578
|
}));
|
|
22529
|
-
function
|
|
22530
|
-
return
|
|
22579
|
+
function buildWithOp(_x4, _x5) {
|
|
22580
|
+
return _buildWithOp.apply(this, arguments);
|
|
22531
22581
|
}
|
|
22532
|
-
return
|
|
22582
|
+
return buildWithOp;
|
|
22533
22583
|
}())
|
|
22534
22584
|
}, {
|
|
22535
22585
|
key: "buildFootprintRestoreTransaction",
|
|
@@ -22557,7 +22607,7 @@ var AssembledTransaction = function () {
|
|
|
22557
22607
|
}
|
|
22558
22608
|
}, _callee10);
|
|
22559
22609
|
}));
|
|
22560
|
-
function buildFootprintRestoreTransaction(
|
|
22610
|
+
function buildFootprintRestoreTransaction(_x6, _x7, _x8, _x9) {
|
|
22561
22611
|
return _buildFootprintRestoreTransaction.apply(this, arguments);
|
|
22562
22612
|
}
|
|
22563
22613
|
return buildFootprintRestoreTransaction;
|
|
@@ -22628,6 +22678,46 @@ assembled_transaction_defineProperty(AssembledTransaction, "Errors", {
|
|
|
22628
22678
|
}
|
|
22629
22679
|
assembled_transaction_inherits(FakeAccountError, _Error8);
|
|
22630
22680
|
return assembled_transaction_createClass(FakeAccountError);
|
|
22681
|
+
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
22682
|
+
SimulationFailed: function (_Error9) {
|
|
22683
|
+
function SimulationFailedError() {
|
|
22684
|
+
assembled_transaction_classCallCheck(this, SimulationFailedError);
|
|
22685
|
+
return assembled_transaction_callSuper(this, SimulationFailedError, arguments);
|
|
22686
|
+
}
|
|
22687
|
+
assembled_transaction_inherits(SimulationFailedError, _Error9);
|
|
22688
|
+
return assembled_transaction_createClass(SimulationFailedError);
|
|
22689
|
+
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
22690
|
+
InternalWalletError: function (_Error10) {
|
|
22691
|
+
function InternalWalletError() {
|
|
22692
|
+
assembled_transaction_classCallCheck(this, InternalWalletError);
|
|
22693
|
+
return assembled_transaction_callSuper(this, InternalWalletError, arguments);
|
|
22694
|
+
}
|
|
22695
|
+
assembled_transaction_inherits(InternalWalletError, _Error10);
|
|
22696
|
+
return assembled_transaction_createClass(InternalWalletError);
|
|
22697
|
+
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
22698
|
+
ExternalServiceError: function (_Error11) {
|
|
22699
|
+
function ExternalServiceError() {
|
|
22700
|
+
assembled_transaction_classCallCheck(this, ExternalServiceError);
|
|
22701
|
+
return assembled_transaction_callSuper(this, ExternalServiceError, arguments);
|
|
22702
|
+
}
|
|
22703
|
+
assembled_transaction_inherits(ExternalServiceError, _Error11);
|
|
22704
|
+
return assembled_transaction_createClass(ExternalServiceError);
|
|
22705
|
+
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
22706
|
+
InvalidClientRequest: function (_Error12) {
|
|
22707
|
+
function InvalidClientRequestError() {
|
|
22708
|
+
assembled_transaction_classCallCheck(this, InvalidClientRequestError);
|
|
22709
|
+
return assembled_transaction_callSuper(this, InvalidClientRequestError, arguments);
|
|
22710
|
+
}
|
|
22711
|
+
assembled_transaction_inherits(InvalidClientRequestError, _Error12);
|
|
22712
|
+
return assembled_transaction_createClass(InvalidClientRequestError);
|
|
22713
|
+
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
22714
|
+
UserRejected: function (_Error13) {
|
|
22715
|
+
function UserRejectedError() {
|
|
22716
|
+
assembled_transaction_classCallCheck(this, UserRejectedError);
|
|
22717
|
+
return assembled_transaction_callSuper(this, UserRejectedError, arguments);
|
|
22718
|
+
}
|
|
22719
|
+
assembled_transaction_inherits(UserRejectedError, _Error13);
|
|
22720
|
+
return assembled_transaction_createClass(UserRejectedError);
|
|
22631
22721
|
}(assembled_transaction_wrapNativeSuper(Error))
|
|
22632
22722
|
});
|
|
22633
22723
|
;// ./src/contract/basic_node_signer.ts
|
|
@@ -22640,38 +22730,46 @@ function basic_node_signer_asyncToGenerator(n) { return function () { var t = th
|
|
|
22640
22730
|
var basicNodeSigner = function basicNodeSigner(keypair, networkPassphrase) {
|
|
22641
22731
|
return {
|
|
22642
22732
|
signTransaction: function () {
|
|
22643
|
-
var _signTransaction = basic_node_signer_asyncToGenerator(basic_node_signer_regeneratorRuntime().mark(function _callee(
|
|
22733
|
+
var _signTransaction = basic_node_signer_asyncToGenerator(basic_node_signer_regeneratorRuntime().mark(function _callee(xdr, opts) {
|
|
22644
22734
|
var t;
|
|
22645
22735
|
return basic_node_signer_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
22646
22736
|
while (1) switch (_context.prev = _context.next) {
|
|
22647
22737
|
case 0:
|
|
22648
|
-
t = lib.TransactionBuilder.fromXDR(
|
|
22738
|
+
t = lib.TransactionBuilder.fromXDR(xdr, (opts === null || opts === void 0 ? void 0 : opts.networkPassphrase) || networkPassphrase);
|
|
22649
22739
|
t.sign(keypair);
|
|
22650
|
-
return _context.abrupt("return",
|
|
22740
|
+
return _context.abrupt("return", {
|
|
22741
|
+
signedTxXdr: t.toXDR(),
|
|
22742
|
+
signerAddress: keypair.publicKey()
|
|
22743
|
+
});
|
|
22651
22744
|
case 3:
|
|
22652
22745
|
case "end":
|
|
22653
22746
|
return _context.stop();
|
|
22654
22747
|
}
|
|
22655
22748
|
}, _callee);
|
|
22656
22749
|
}));
|
|
22657
|
-
function signTransaction(_x) {
|
|
22750
|
+
function signTransaction(_x, _x2) {
|
|
22658
22751
|
return _signTransaction.apply(this, arguments);
|
|
22659
22752
|
}
|
|
22660
22753
|
return signTransaction;
|
|
22661
22754
|
}(),
|
|
22662
22755
|
signAuthEntry: function () {
|
|
22663
|
-
var _signAuthEntry = basic_node_signer_asyncToGenerator(basic_node_signer_regeneratorRuntime().mark(function _callee2(
|
|
22756
|
+
var _signAuthEntry = basic_node_signer_asyncToGenerator(basic_node_signer_regeneratorRuntime().mark(function _callee2(authEntry) {
|
|
22757
|
+
var signedAuthEntry;
|
|
22664
22758
|
return basic_node_signer_regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
22665
22759
|
while (1) switch (_context2.prev = _context2.next) {
|
|
22666
22760
|
case 0:
|
|
22667
|
-
|
|
22668
|
-
|
|
22761
|
+
signedAuthEntry = keypair.sign((0,lib.hash)(basic_node_signer_Buffer.from(authEntry, "base64"))).toString("base64");
|
|
22762
|
+
return _context2.abrupt("return", {
|
|
22763
|
+
signedAuthEntry: signedAuthEntry,
|
|
22764
|
+
signerAddress: keypair.publicKey()
|
|
22765
|
+
});
|
|
22766
|
+
case 2:
|
|
22669
22767
|
case "end":
|
|
22670
22768
|
return _context2.stop();
|
|
22671
22769
|
}
|
|
22672
22770
|
}, _callee2);
|
|
22673
22771
|
}));
|
|
22674
|
-
function signAuthEntry(
|
|
22772
|
+
function signAuthEntry(_x3) {
|
|
22675
22773
|
return _signAuthEntry.apply(this, arguments);
|
|
22676
22774
|
}
|
|
22677
22775
|
return signAuthEntry;
|
|
@@ -23696,11 +23794,10 @@ var Spec = function () {
|
|
|
23696
23794
|
}();
|
|
23697
23795
|
;// ./src/contract/client.ts
|
|
23698
23796
|
/* provided dependency */ var client_Buffer = __webpack_require__(8287)["Buffer"];
|
|
23699
|
-
var _excluded = ["method"];
|
|
23700
23797
|
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); }
|
|
23798
|
+
var _excluded = ["method"],
|
|
23799
|
+
_excluded2 = ["wasmHash", "salt", "format", "fee", "timeoutInSeconds", "simulate"];
|
|
23701
23800
|
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; }
|
|
23702
|
-
function client_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
23703
|
-
function client_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { client_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { client_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
23704
23801
|
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; }
|
|
23705
23802
|
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; }
|
|
23706
23803
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
@@ -23711,10 +23808,86 @@ function client_createClass(e, r, t) { return r && client_defineProperties(e.pro
|
|
|
23711
23808
|
function client_defineProperty(e, r, t) { return (r = client_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
23712
23809
|
function client_toPropertyKey(t) { var i = client_toPrimitive(t, "string"); return "symbol" == client_typeof(i) ? i : i + ""; }
|
|
23713
23810
|
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); }
|
|
23811
|
+
function client_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
23812
|
+
function client_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { client_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { client_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
23714
23813
|
|
|
23715
23814
|
|
|
23716
23815
|
|
|
23717
23816
|
|
|
23817
|
+
|
|
23818
|
+
var CONSTRUCTOR_FUNC = "__constructor";
|
|
23819
|
+
function specFromWasm(_x) {
|
|
23820
|
+
return _specFromWasm.apply(this, arguments);
|
|
23821
|
+
}
|
|
23822
|
+
function _specFromWasm() {
|
|
23823
|
+
_specFromWasm = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee5(wasm) {
|
|
23824
|
+
var wasmModule, xdrSections, bufferSection, specEntryArray, spec;
|
|
23825
|
+
return client_regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
23826
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
23827
|
+
case 0:
|
|
23828
|
+
_context5.next = 2;
|
|
23829
|
+
return WebAssembly.compile(wasm);
|
|
23830
|
+
case 2:
|
|
23831
|
+
wasmModule = _context5.sent;
|
|
23832
|
+
xdrSections = WebAssembly.Module.customSections(wasmModule, "contractspecv0");
|
|
23833
|
+
if (!(xdrSections.length === 0)) {
|
|
23834
|
+
_context5.next = 6;
|
|
23835
|
+
break;
|
|
23836
|
+
}
|
|
23837
|
+
throw new Error("Could not obtain contract spec from wasm");
|
|
23838
|
+
case 6:
|
|
23839
|
+
bufferSection = client_Buffer.from(xdrSections[0]);
|
|
23840
|
+
specEntryArray = processSpecEntryStream(bufferSection);
|
|
23841
|
+
spec = new Spec(specEntryArray);
|
|
23842
|
+
return _context5.abrupt("return", spec);
|
|
23843
|
+
case 10:
|
|
23844
|
+
case "end":
|
|
23845
|
+
return _context5.stop();
|
|
23846
|
+
}
|
|
23847
|
+
}, _callee5);
|
|
23848
|
+
}));
|
|
23849
|
+
return _specFromWasm.apply(this, arguments);
|
|
23850
|
+
}
|
|
23851
|
+
function specFromWasmHash(_x2, _x3) {
|
|
23852
|
+
return _specFromWasmHash.apply(this, arguments);
|
|
23853
|
+
}
|
|
23854
|
+
function _specFromWasmHash() {
|
|
23855
|
+
_specFromWasmHash = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee6(wasmHash, options) {
|
|
23856
|
+
var format,
|
|
23857
|
+
rpcUrl,
|
|
23858
|
+
allowHttp,
|
|
23859
|
+
serverOpts,
|
|
23860
|
+
server,
|
|
23861
|
+
wasm,
|
|
23862
|
+
_args6 = arguments;
|
|
23863
|
+
return client_regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
23864
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
23865
|
+
case 0:
|
|
23866
|
+
format = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : "hex";
|
|
23867
|
+
if (!(!options || !options.rpcUrl)) {
|
|
23868
|
+
_context6.next = 3;
|
|
23869
|
+
break;
|
|
23870
|
+
}
|
|
23871
|
+
throw new TypeError("options must contain rpcUrl");
|
|
23872
|
+
case 3:
|
|
23873
|
+
rpcUrl = options.rpcUrl, allowHttp = options.allowHttp;
|
|
23874
|
+
serverOpts = {
|
|
23875
|
+
allowHttp: allowHttp
|
|
23876
|
+
};
|
|
23877
|
+
server = new rpc.Server(rpcUrl, serverOpts);
|
|
23878
|
+
_context6.next = 8;
|
|
23879
|
+
return server.getContractWasmByHash(wasmHash, format);
|
|
23880
|
+
case 8:
|
|
23881
|
+
wasm = _context6.sent;
|
|
23882
|
+
return _context6.abrupt("return", specFromWasm(wasm));
|
|
23883
|
+
case 10:
|
|
23884
|
+
case "end":
|
|
23885
|
+
return _context6.stop();
|
|
23886
|
+
}
|
|
23887
|
+
}, _callee6);
|
|
23888
|
+
}));
|
|
23889
|
+
return _specFromWasmHash.apply(this, arguments);
|
|
23890
|
+
}
|
|
23718
23891
|
var Client = function () {
|
|
23719
23892
|
function Client(spec, options) {
|
|
23720
23893
|
var _this = this;
|
|
@@ -23737,6 +23910,9 @@ var Client = function () {
|
|
|
23737
23910
|
this.options = options;
|
|
23738
23911
|
this.spec.funcs().forEach(function (xdrFn) {
|
|
23739
23912
|
var method = xdrFn.name().toString();
|
|
23913
|
+
if (method === CONSTRUCTOR_FUNC) {
|
|
23914
|
+
return;
|
|
23915
|
+
}
|
|
23740
23916
|
var assembleTransaction = function assembleTransaction(args, methodOptions) {
|
|
23741
23917
|
return AssembledTransaction.build(client_objectSpread(client_objectSpread(client_objectSpread({
|
|
23742
23918
|
method: method,
|
|
@@ -23758,22 +23934,65 @@ var Client = function () {
|
|
|
23758
23934
|
});
|
|
23759
23935
|
}
|
|
23760
23936
|
return client_createClass(Client, null, [{
|
|
23937
|
+
key: "deploy",
|
|
23938
|
+
value: function () {
|
|
23939
|
+
var _deploy = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee(args, options) {
|
|
23940
|
+
var wasmHash, salt, format, fee, timeoutInSeconds, simulate, clientOptions, spec, operation;
|
|
23941
|
+
return client_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
23942
|
+
while (1) switch (_context.prev = _context.next) {
|
|
23943
|
+
case 0:
|
|
23944
|
+
wasmHash = options.wasmHash, salt = options.salt, format = options.format, fee = options.fee, timeoutInSeconds = options.timeoutInSeconds, simulate = options.simulate, clientOptions = _objectWithoutProperties(options, _excluded2);
|
|
23945
|
+
_context.next = 3;
|
|
23946
|
+
return specFromWasmHash(wasmHash, clientOptions, format);
|
|
23947
|
+
case 3:
|
|
23948
|
+
spec = _context.sent;
|
|
23949
|
+
operation = lib.Operation.createCustomContract({
|
|
23950
|
+
address: new lib.Address(options.publicKey),
|
|
23951
|
+
wasmHash: typeof wasmHash === "string" ? client_Buffer.from(wasmHash, format !== null && format !== void 0 ? format : "hex") : wasmHash,
|
|
23952
|
+
salt: salt,
|
|
23953
|
+
constructorArgs: args ? spec.funcArgsToScVals(CONSTRUCTOR_FUNC, args) : []
|
|
23954
|
+
});
|
|
23955
|
+
return _context.abrupt("return", AssembledTransaction.buildWithOp(operation, client_objectSpread(client_objectSpread({
|
|
23956
|
+
fee: fee,
|
|
23957
|
+
timeoutInSeconds: timeoutInSeconds,
|
|
23958
|
+
simulate: simulate
|
|
23959
|
+
}, clientOptions), {}, {
|
|
23960
|
+
contractId: "ignored",
|
|
23961
|
+
method: CONSTRUCTOR_FUNC,
|
|
23962
|
+
parseResultXdr: function parseResultXdr(result) {
|
|
23963
|
+
return new Client(spec, client_objectSpread(client_objectSpread({}, clientOptions), {}, {
|
|
23964
|
+
contractId: lib.Address.fromScVal(result).toString()
|
|
23965
|
+
}));
|
|
23966
|
+
}
|
|
23967
|
+
})));
|
|
23968
|
+
case 6:
|
|
23969
|
+
case "end":
|
|
23970
|
+
return _context.stop();
|
|
23971
|
+
}
|
|
23972
|
+
}, _callee);
|
|
23973
|
+
}));
|
|
23974
|
+
function deploy(_x4, _x5) {
|
|
23975
|
+
return _deploy.apply(this, arguments);
|
|
23976
|
+
}
|
|
23977
|
+
return deploy;
|
|
23978
|
+
}()
|
|
23979
|
+
}, {
|
|
23761
23980
|
key: "fromWasmHash",
|
|
23762
23981
|
value: (function () {
|
|
23763
|
-
var _fromWasmHash = client_asyncToGenerator(client_regeneratorRuntime().mark(function
|
|
23982
|
+
var _fromWasmHash = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee2(wasmHash, options) {
|
|
23764
23983
|
var format,
|
|
23765
23984
|
rpcUrl,
|
|
23766
23985
|
allowHttp,
|
|
23767
23986
|
serverOpts,
|
|
23768
23987
|
server,
|
|
23769
23988
|
wasm,
|
|
23770
|
-
|
|
23771
|
-
return client_regeneratorRuntime().wrap(function
|
|
23772
|
-
while (1) switch (
|
|
23989
|
+
_args2 = arguments;
|
|
23990
|
+
return client_regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
23991
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
23773
23992
|
case 0:
|
|
23774
|
-
format =
|
|
23993
|
+
format = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : "hex";
|
|
23775
23994
|
if (!(!options || !options.rpcUrl)) {
|
|
23776
|
-
|
|
23995
|
+
_context2.next = 3;
|
|
23777
23996
|
break;
|
|
23778
23997
|
}
|
|
23779
23998
|
throw new TypeError('options must contain rpcUrl');
|
|
@@ -23783,18 +24002,18 @@ var Client = function () {
|
|
|
23783
24002
|
allowHttp: allowHttp
|
|
23784
24003
|
};
|
|
23785
24004
|
server = new rpc.Server(rpcUrl, serverOpts);
|
|
23786
|
-
|
|
24005
|
+
_context2.next = 8;
|
|
23787
24006
|
return server.getContractWasmByHash(wasmHash, format);
|
|
23788
24007
|
case 8:
|
|
23789
|
-
wasm =
|
|
23790
|
-
return
|
|
24008
|
+
wasm = _context2.sent;
|
|
24009
|
+
return _context2.abrupt("return", Client.fromWasm(wasm, options));
|
|
23791
24010
|
case 10:
|
|
23792
24011
|
case "end":
|
|
23793
|
-
return
|
|
24012
|
+
return _context2.stop();
|
|
23794
24013
|
}
|
|
23795
|
-
},
|
|
24014
|
+
}, _callee2);
|
|
23796
24015
|
}));
|
|
23797
|
-
function fromWasmHash(
|
|
24016
|
+
function fromWasmHash(_x6, _x7) {
|
|
23798
24017
|
return _fromWasmHash.apply(this, arguments);
|
|
23799
24018
|
}
|
|
23800
24019
|
return fromWasmHash;
|
|
@@ -23802,33 +24021,23 @@ var Client = function () {
|
|
|
23802
24021
|
}, {
|
|
23803
24022
|
key: "fromWasm",
|
|
23804
24023
|
value: (function () {
|
|
23805
|
-
var _fromWasm = client_asyncToGenerator(client_regeneratorRuntime().mark(function
|
|
23806
|
-
var
|
|
23807
|
-
return client_regeneratorRuntime().wrap(function
|
|
23808
|
-
while (1) switch (
|
|
24024
|
+
var _fromWasm = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee3(wasm, options) {
|
|
24025
|
+
var spec;
|
|
24026
|
+
return client_regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
24027
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
23809
24028
|
case 0:
|
|
23810
|
-
|
|
23811
|
-
return
|
|
24029
|
+
_context3.next = 2;
|
|
24030
|
+
return specFromWasm(wasm);
|
|
23812
24031
|
case 2:
|
|
23813
|
-
|
|
23814
|
-
|
|
23815
|
-
|
|
23816
|
-
_context2.next = 6;
|
|
23817
|
-
break;
|
|
23818
|
-
}
|
|
23819
|
-
throw new Error('Could not obtain contract spec from wasm');
|
|
23820
|
-
case 6:
|
|
23821
|
-
bufferSection = client_Buffer.from(xdrSections[0]);
|
|
23822
|
-
specEntryArray = processSpecEntryStream(bufferSection);
|
|
23823
|
-
spec = new Spec(specEntryArray);
|
|
23824
|
-
return _context2.abrupt("return", new Client(spec, options));
|
|
23825
|
-
case 10:
|
|
24032
|
+
spec = _context3.sent;
|
|
24033
|
+
return _context3.abrupt("return", new Client(spec, options));
|
|
24034
|
+
case 4:
|
|
23826
24035
|
case "end":
|
|
23827
|
-
return
|
|
24036
|
+
return _context3.stop();
|
|
23828
24037
|
}
|
|
23829
|
-
},
|
|
24038
|
+
}, _callee3);
|
|
23830
24039
|
}));
|
|
23831
|
-
function fromWasm(
|
|
24040
|
+
function fromWasm(_x8, _x9) {
|
|
23832
24041
|
return _fromWasm.apply(this, arguments);
|
|
23833
24042
|
}
|
|
23834
24043
|
return fromWasm;
|
|
@@ -23836,13 +24045,13 @@ var Client = function () {
|
|
|
23836
24045
|
}, {
|
|
23837
24046
|
key: "from",
|
|
23838
24047
|
value: (function () {
|
|
23839
|
-
var _from = client_asyncToGenerator(client_regeneratorRuntime().mark(function
|
|
24048
|
+
var _from = client_asyncToGenerator(client_regeneratorRuntime().mark(function _callee4(options) {
|
|
23840
24049
|
var rpcUrl, contractId, allowHttp, serverOpts, server, wasm;
|
|
23841
|
-
return client_regeneratorRuntime().wrap(function
|
|
23842
|
-
while (1) switch (
|
|
24050
|
+
return client_regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
24051
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
23843
24052
|
case 0:
|
|
23844
24053
|
if (!(!options || !options.rpcUrl || !options.contractId)) {
|
|
23845
|
-
|
|
24054
|
+
_context4.next = 2;
|
|
23846
24055
|
break;
|
|
23847
24056
|
}
|
|
23848
24057
|
throw new TypeError('options must contain rpcUrl and contractId');
|
|
@@ -23852,18 +24061,18 @@ var Client = function () {
|
|
|
23852
24061
|
allowHttp: allowHttp
|
|
23853
24062
|
};
|
|
23854
24063
|
server = new rpc.Server(rpcUrl, serverOpts);
|
|
23855
|
-
|
|
24064
|
+
_context4.next = 7;
|
|
23856
24065
|
return server.getContractWasmByContractId(contractId);
|
|
23857
24066
|
case 7:
|
|
23858
|
-
wasm =
|
|
23859
|
-
return
|
|
24067
|
+
wasm = _context4.sent;
|
|
24068
|
+
return _context4.abrupt("return", Client.fromWasm(wasm, options));
|
|
23860
24069
|
case 9:
|
|
23861
24070
|
case "end":
|
|
23862
|
-
return
|
|
24071
|
+
return _context4.stop();
|
|
23863
24072
|
}
|
|
23864
|
-
},
|
|
24073
|
+
}, _callee4);
|
|
23865
24074
|
}));
|
|
23866
|
-
function from(
|
|
24075
|
+
function from(_x10) {
|
|
23867
24076
|
return _from.apply(this, arguments);
|
|
23868
24077
|
}
|
|
23869
24078
|
return from;
|
|
@@ -24353,7 +24562,7 @@ var Api;
|
|
|
24353
24562
|
|
|
24354
24563
|
/***/ }),
|
|
24355
24564
|
|
|
24356
|
-
/***/
|
|
24565
|
+
/***/ 8733:
|
|
24357
24566
|
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
24358
24567
|
|
|
24359
24568
|
"use strict";
|
|
@@ -24463,10 +24672,69 @@ var HorizonApi;
|
|
|
24463
24672
|
}({});
|
|
24464
24673
|
_HorizonApi.TransactionFailedResultCodes = TransactionFailedResultCodes;
|
|
24465
24674
|
})(HorizonApi || (HorizonApi = {}));
|
|
24675
|
+
;// ./src/horizon/types/effects.ts
|
|
24676
|
+
var effects_EffectType = function (EffectType) {
|
|
24677
|
+
EffectType[EffectType["account_created"] = 0] = "account_created";
|
|
24678
|
+
EffectType[EffectType["account_removed"] = 1] = "account_removed";
|
|
24679
|
+
EffectType[EffectType["account_credited"] = 2] = "account_credited";
|
|
24680
|
+
EffectType[EffectType["account_debited"] = 3] = "account_debited";
|
|
24681
|
+
EffectType[EffectType["account_thresholds_updated"] = 4] = "account_thresholds_updated";
|
|
24682
|
+
EffectType[EffectType["account_home_domain_updated"] = 5] = "account_home_domain_updated";
|
|
24683
|
+
EffectType[EffectType["account_flags_updated"] = 6] = "account_flags_updated";
|
|
24684
|
+
EffectType[EffectType["account_inflation_destination_updated"] = 7] = "account_inflation_destination_updated";
|
|
24685
|
+
EffectType[EffectType["signer_created"] = 10] = "signer_created";
|
|
24686
|
+
EffectType[EffectType["signer_removed"] = 11] = "signer_removed";
|
|
24687
|
+
EffectType[EffectType["signer_updated"] = 12] = "signer_updated";
|
|
24688
|
+
EffectType[EffectType["trustline_created"] = 20] = "trustline_created";
|
|
24689
|
+
EffectType[EffectType["trustline_removed"] = 21] = "trustline_removed";
|
|
24690
|
+
EffectType[EffectType["trustline_updated"] = 22] = "trustline_updated";
|
|
24691
|
+
EffectType[EffectType["trustline_authorized"] = 23] = "trustline_authorized";
|
|
24692
|
+
EffectType[EffectType["trustline_deauthorized"] = 24] = "trustline_deauthorized";
|
|
24693
|
+
EffectType[EffectType["trustline_authorized_to_maintain_liabilities"] = 25] = "trustline_authorized_to_maintain_liabilities";
|
|
24694
|
+
EffectType[EffectType["trustline_flags_updated"] = 26] = "trustline_flags_updated";
|
|
24695
|
+
EffectType[EffectType["offer_created"] = 30] = "offer_created";
|
|
24696
|
+
EffectType[EffectType["offer_removed"] = 31] = "offer_removed";
|
|
24697
|
+
EffectType[EffectType["offer_updated"] = 32] = "offer_updated";
|
|
24698
|
+
EffectType[EffectType["trade"] = 33] = "trade";
|
|
24699
|
+
EffectType[EffectType["data_created"] = 40] = "data_created";
|
|
24700
|
+
EffectType[EffectType["data_removed"] = 41] = "data_removed";
|
|
24701
|
+
EffectType[EffectType["data_updated"] = 42] = "data_updated";
|
|
24702
|
+
EffectType[EffectType["sequence_bumped"] = 43] = "sequence_bumped";
|
|
24703
|
+
EffectType[EffectType["claimable_balance_created"] = 50] = "claimable_balance_created";
|
|
24704
|
+
EffectType[EffectType["claimable_balance_claimant_created"] = 51] = "claimable_balance_claimant_created";
|
|
24705
|
+
EffectType[EffectType["claimable_balance_claimed"] = 52] = "claimable_balance_claimed";
|
|
24706
|
+
EffectType[EffectType["account_sponsorship_created"] = 60] = "account_sponsorship_created";
|
|
24707
|
+
EffectType[EffectType["account_sponsorship_updated"] = 61] = "account_sponsorship_updated";
|
|
24708
|
+
EffectType[EffectType["account_sponsorship_removed"] = 62] = "account_sponsorship_removed";
|
|
24709
|
+
EffectType[EffectType["trustline_sponsorship_created"] = 63] = "trustline_sponsorship_created";
|
|
24710
|
+
EffectType[EffectType["trustline_sponsorship_updated"] = 64] = "trustline_sponsorship_updated";
|
|
24711
|
+
EffectType[EffectType["trustline_sponsorship_removed"] = 65] = "trustline_sponsorship_removed";
|
|
24712
|
+
EffectType[EffectType["data_sponsorship_created"] = 66] = "data_sponsorship_created";
|
|
24713
|
+
EffectType[EffectType["data_sponsorship_updated"] = 67] = "data_sponsorship_updated";
|
|
24714
|
+
EffectType[EffectType["data_sponsorship_removed"] = 68] = "data_sponsorship_removed";
|
|
24715
|
+
EffectType[EffectType["claimable_balance_sponsorship_created"] = 69] = "claimable_balance_sponsorship_created";
|
|
24716
|
+
EffectType[EffectType["claimable_balance_sponsorship_updated"] = 70] = "claimable_balance_sponsorship_updated";
|
|
24717
|
+
EffectType[EffectType["claimable_balance_sponsorship_removed"] = 71] = "claimable_balance_sponsorship_removed";
|
|
24718
|
+
EffectType[EffectType["signer_sponsorship_created"] = 72] = "signer_sponsorship_created";
|
|
24719
|
+
EffectType[EffectType["signer_sponsorship_updated"] = 73] = "signer_sponsorship_updated";
|
|
24720
|
+
EffectType[EffectType["signer_sponsorship_removed"] = 74] = "signer_sponsorship_removed";
|
|
24721
|
+
EffectType[EffectType["claimable_balance_clawed_back"] = 80] = "claimable_balance_clawed_back";
|
|
24722
|
+
EffectType[EffectType["liquidity_pool_deposited"] = 90] = "liquidity_pool_deposited";
|
|
24723
|
+
EffectType[EffectType["liquidity_pool_withdrew"] = 91] = "liquidity_pool_withdrew";
|
|
24724
|
+
EffectType[EffectType["liquidity_pool_trade"] = 92] = "liquidity_pool_trade";
|
|
24725
|
+
EffectType[EffectType["liquidity_pool_created"] = 93] = "liquidity_pool_created";
|
|
24726
|
+
EffectType[EffectType["liquidity_pool_removed"] = 94] = "liquidity_pool_removed";
|
|
24727
|
+
EffectType[EffectType["liquidity_pool_revoked"] = 95] = "liquidity_pool_revoked";
|
|
24728
|
+
EffectType[EffectType["contract_credited"] = 96] = "contract_credited";
|
|
24729
|
+
EffectType[EffectType["contract_debited"] = 97] = "contract_debited";
|
|
24730
|
+
return EffectType;
|
|
24731
|
+
}({});
|
|
24466
24732
|
;// ./src/horizon/server_api.ts
|
|
24467
24733
|
|
|
24734
|
+
|
|
24468
24735
|
var ServerApi;
|
|
24469
24736
|
(function (_ServerApi) {
|
|
24737
|
+
var EffectType = _ServerApi.EffectType = effects_EffectType;
|
|
24470
24738
|
var TradeType = function (TradeType) {
|
|
24471
24739
|
TradeType["all"] = "all";
|
|
24472
24740
|
TradeType["liquidityPools"] = "liquidity_pool";
|
|
@@ -27446,7 +27714,7 @@ var http_client = __webpack_require__(9983);
|
|
|
27446
27714
|
function horizon_axios_client_typeof(o) { "@babel/helpers - typeof"; return horizon_axios_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; }, horizon_axios_client_typeof(o); }
|
|
27447
27715
|
|
|
27448
27716
|
|
|
27449
|
-
var version = "13.0.0-rc.
|
|
27717
|
+
var version = "13.0.0-rc.2";
|
|
27450
27718
|
var SERVER_TIME_MAP = {};
|
|
27451
27719
|
var AxiosClient = (0,http_client/* create */.vt)({
|
|
27452
27720
|
headers: {
|
|
@@ -33365,7 +33633,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
33365
33633
|
/* harmony import */ var _federation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7600);
|
|
33366
33634
|
/* harmony import */ var _webauth__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5479);
|
|
33367
33635
|
/* harmony import */ var _friendbot__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(8242);
|
|
33368
|
-
/* harmony import */ var _horizon__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(
|
|
33636
|
+
/* harmony import */ var _horizon__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(8733);
|
|
33369
33637
|
/* harmony import */ var _rpc__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(3496);
|
|
33370
33638
|
/* harmony import */ var _contract__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(6299);
|
|
33371
33639
|
/* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(356);
|
|
@@ -33470,7 +33738,7 @@ var lib = __webpack_require__(356);
|
|
|
33470
33738
|
var http_client = __webpack_require__(9983);
|
|
33471
33739
|
;// ./src/rpc/axios.ts
|
|
33472
33740
|
|
|
33473
|
-
var version = "13.0.0-rc.
|
|
33741
|
+
var version = "13.0.0-rc.2";
|
|
33474
33742
|
var AxiosClient = (0,http_client/* create */.vt)({
|
|
33475
33743
|
headers: {
|
|
33476
33744
|
'X-Client-Name': 'js-soroban-client',
|
|
@@ -34670,6 +34938,7 @@ var Resolver = function () {
|
|
|
34670
34938
|
key: "resolve",
|
|
34671
34939
|
value: (function () {
|
|
34672
34940
|
var _resolve = _asyncToGenerator(_regeneratorRuntime().mark(function _callee(domain) {
|
|
34941
|
+
var _opts$allowedRedirect;
|
|
34673
34942
|
var opts,
|
|
34674
34943
|
allowHttp,
|
|
34675
34944
|
timeout,
|
|
@@ -34683,6 +34952,7 @@ var Resolver = function () {
|
|
|
34683
34952
|
timeout = typeof opts.timeout === "undefined" ? _config__WEBPACK_IMPORTED_MODULE_2__/* .Config */ .T.getTimeout() : opts.timeout;
|
|
34684
34953
|
protocol = allowHttp ? "http" : "https";
|
|
34685
34954
|
return _context.abrupt("return", _http_client__WEBPACK_IMPORTED_MODULE_1__/* .httpClient */ .ok.get("".concat(protocol, "://").concat(domain, "/.well-known/stellar.toml"), {
|
|
34955
|
+
maxRedirects: (_opts$allowedRedirect = opts.allowedRedirects) !== null && _opts$allowedRedirect !== void 0 ? _opts$allowedRedirect : 0,
|
|
34686
34956
|
maxContentLength: STELLAR_TOML_MAX_SIZE,
|
|
34687
34957
|
cancelToken: timeout ? new CancelToken(function (cancel) {
|
|
34688
34958
|
return setTimeout(function () {
|
|
@@ -43148,10 +43418,21 @@ var utilInspect = __webpack_require__(2634);
|
|
|
43148
43418
|
var inspectCustom = utilInspect.custom;
|
|
43149
43419
|
var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
|
|
43150
43420
|
|
|
43421
|
+
var quotes = {
|
|
43422
|
+
__proto__: null,
|
|
43423
|
+
'double': '"',
|
|
43424
|
+
single: "'"
|
|
43425
|
+
};
|
|
43426
|
+
var quoteREs = {
|
|
43427
|
+
__proto__: null,
|
|
43428
|
+
'double': /(["\\])/g,
|
|
43429
|
+
single: /(['\\])/g
|
|
43430
|
+
};
|
|
43431
|
+
|
|
43151
43432
|
module.exports = function inspect_(obj, options, depth, seen) {
|
|
43152
43433
|
var opts = options || {};
|
|
43153
43434
|
|
|
43154
|
-
if (has(opts, 'quoteStyle') && (
|
|
43435
|
+
if (has(opts, 'quoteStyle') && !has(quotes, opts.quoteStyle)) {
|
|
43155
43436
|
throw new TypeError('option "quoteStyle" must be "single" or "double"');
|
|
43156
43437
|
}
|
|
43157
43438
|
if (
|
|
@@ -43346,7 +43627,8 @@ module.exports = function inspect_(obj, options, depth, seen) {
|
|
|
43346
43627
|
};
|
|
43347
43628
|
|
|
43348
43629
|
function wrapQuotes(s, defaultStyle, opts) {
|
|
43349
|
-
var
|
|
43630
|
+
var style = opts.quoteStyle || defaultStyle;
|
|
43631
|
+
var quoteChar = quotes[style];
|
|
43350
43632
|
return quoteChar + s + quoteChar;
|
|
43351
43633
|
}
|
|
43352
43634
|
|
|
@@ -43504,8 +43786,10 @@ function inspectString(str, opts) {
|
|
|
43504
43786
|
var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
|
|
43505
43787
|
return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
|
|
43506
43788
|
}
|
|
43789
|
+
var quoteRE = quoteREs[opts.quoteStyle || 'single'];
|
|
43790
|
+
quoteRE.lastIndex = 0;
|
|
43507
43791
|
// eslint-disable-next-line no-control-regex
|
|
43508
|
-
var s = $replace.call($replace.call(str,
|
|
43792
|
+
var s = $replace.call($replace.call(str, quoteRE, '\\$1'), /[\x00-\x1f]/g, lowbyte);
|
|
43509
43793
|
return wrapQuotes(s, 'single', opts);
|
|
43510
43794
|
}
|
|
43511
43795
|
|