@stellar/stellar-sdk 13.0.0-rc.2 → 13.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +112 -7
- package/README.md +1 -1
- package/dist/stellar-sdk-minimal.js +448 -77
- package/dist/stellar-sdk-minimal.min.js +1 -1
- package/dist/stellar-sdk-no-axios.js +1044 -234
- package/dist/stellar-sdk-no-axios.min.js +1 -1
- package/dist/stellar-sdk-no-eventsource.js +171 -148
- package/dist/stellar-sdk-no-eventsource.min.js +1 -1
- package/dist/stellar-sdk.js +767 -305
- package/dist/stellar-sdk.min.js +1 -1
- package/lib/friendbot/index.d.ts +1 -0
- package/lib/horizon/call_builder.d.ts +1 -1
- package/lib/horizon/horizon_api.d.ts +13 -0
- package/lib/horizon/horizon_axios_client.js +1 -1
- package/lib/horizon/server.d.ts +5 -0
- package/lib/horizon/server.js +80 -59
- package/lib/minimal/friendbot/index.d.ts +1 -0
- package/lib/minimal/horizon/call_builder.d.ts +1 -1
- package/lib/minimal/horizon/horizon_api.d.ts +13 -0
- package/lib/minimal/horizon/horizon_axios_client.js +1 -1
- package/lib/minimal/horizon/server.d.ts +5 -0
- package/lib/minimal/horizon/server.js +80 -59
- package/lib/minimal/rpc/api.d.ts +2 -1
- package/lib/minimal/rpc/axios.js +1 -1
- package/lib/minimal/rpc/parsers.js +1 -0
- package/lib/minimal/rpc/server.js +27 -8
- package/lib/no-axios/friendbot/index.d.ts +1 -0
- package/lib/no-axios/horizon/call_builder.d.ts +1 -1
- package/lib/no-axios/horizon/horizon_api.d.ts +13 -0
- package/lib/no-axios/horizon/horizon_axios_client.js +1 -1
- package/lib/no-axios/horizon/server.d.ts +5 -0
- package/lib/no-axios/horizon/server.js +80 -59
- package/lib/no-axios/rpc/api.d.ts +2 -1
- package/lib/no-axios/rpc/axios.js +1 -1
- package/lib/no-axios/rpc/parsers.js +1 -0
- package/lib/no-axios/rpc/server.js +27 -8
- package/lib/no-eventsource/friendbot/index.d.ts +1 -0
- package/lib/no-eventsource/horizon/call_builder.d.ts +1 -1
- package/lib/no-eventsource/horizon/horizon_api.d.ts +13 -0
- package/lib/no-eventsource/horizon/horizon_axios_client.js +1 -1
- package/lib/no-eventsource/horizon/server.d.ts +5 -0
- package/lib/no-eventsource/horizon/server.js +80 -59
- package/lib/no-eventsource/rpc/api.d.ts +2 -1
- package/lib/no-eventsource/rpc/axios.js +1 -1
- package/lib/no-eventsource/rpc/parsers.js +1 -0
- package/lib/no-eventsource/rpc/server.js +27 -8
- package/lib/rpc/api.d.ts +2 -1
- package/lib/rpc/axios.js +1 -1
- package/lib/rpc/parsers.js +1 -0
- package/lib/rpc/server.js +27 -8
- package/package.json +11 -11
|
@@ -170,28 +170,49 @@ var HorizonServer = exports.HorizonServer = function () {
|
|
|
170
170
|
}
|
|
171
171
|
return feeStats;
|
|
172
172
|
}())
|
|
173
|
+
}, {
|
|
174
|
+
key: "root",
|
|
175
|
+
value: (function () {
|
|
176
|
+
var _root = _asyncToGenerator(_regeneratorRuntime().mark(function _callee4() {
|
|
177
|
+
var cb;
|
|
178
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
179
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
180
|
+
case 0:
|
|
181
|
+
cb = new _call_builder.CallBuilder((0, _urijs.default)(this.serverURL));
|
|
182
|
+
return _context4.abrupt("return", cb.call());
|
|
183
|
+
case 2:
|
|
184
|
+
case "end":
|
|
185
|
+
return _context4.stop();
|
|
186
|
+
}
|
|
187
|
+
}, _callee4, this);
|
|
188
|
+
}));
|
|
189
|
+
function root() {
|
|
190
|
+
return _root.apply(this, arguments);
|
|
191
|
+
}
|
|
192
|
+
return root;
|
|
193
|
+
}())
|
|
173
194
|
}, {
|
|
174
195
|
key: "submitTransaction",
|
|
175
196
|
value: (function () {
|
|
176
|
-
var _submitTransaction = _asyncToGenerator(_regeneratorRuntime().mark(function
|
|
197
|
+
var _submitTransaction = _asyncToGenerator(_regeneratorRuntime().mark(function _callee5(transaction) {
|
|
177
198
|
var opts,
|
|
178
199
|
tx,
|
|
179
|
-
|
|
180
|
-
return _regeneratorRuntime().wrap(function
|
|
181
|
-
while (1) switch (
|
|
200
|
+
_args5 = arguments;
|
|
201
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
202
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
182
203
|
case 0:
|
|
183
|
-
opts =
|
|
204
|
+
opts = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {
|
|
184
205
|
skipMemoRequiredCheck: false
|
|
185
206
|
};
|
|
186
207
|
if (opts.skipMemoRequiredCheck) {
|
|
187
|
-
|
|
208
|
+
_context5.next = 4;
|
|
188
209
|
break;
|
|
189
210
|
}
|
|
190
|
-
|
|
211
|
+
_context5.next = 4;
|
|
191
212
|
return this.checkMemoRequired(transaction);
|
|
192
213
|
case 4:
|
|
193
214
|
tx = encodeURIComponent(transaction.toEnvelope().toXDR().toString("base64"));
|
|
194
|
-
return
|
|
215
|
+
return _context5.abrupt("return", _horizon_axios_client.default.post((0, _urijs.default)(this.serverURL).segment("transactions").toString(), "tx=".concat(tx), {
|
|
195
216
|
timeout: SUBMIT_TRANSACTION_TIMEOUT
|
|
196
217
|
}).then(function (response) {
|
|
197
218
|
if (!response.data.result_xdr) {
|
|
@@ -302,9 +323,9 @@ var HorizonServer = exports.HorizonServer = function () {
|
|
|
302
323
|
}));
|
|
303
324
|
case 6:
|
|
304
325
|
case "end":
|
|
305
|
-
return
|
|
326
|
+
return _context5.stop();
|
|
306
327
|
}
|
|
307
|
-
},
|
|
328
|
+
}, _callee5, this);
|
|
308
329
|
}));
|
|
309
330
|
function submitTransaction(_x2) {
|
|
310
331
|
return _submitTransaction.apply(this, arguments);
|
|
@@ -314,25 +335,25 @@ var HorizonServer = exports.HorizonServer = function () {
|
|
|
314
335
|
}, {
|
|
315
336
|
key: "submitAsyncTransaction",
|
|
316
337
|
value: (function () {
|
|
317
|
-
var _submitAsyncTransaction = _asyncToGenerator(_regeneratorRuntime().mark(function
|
|
338
|
+
var _submitAsyncTransaction = _asyncToGenerator(_regeneratorRuntime().mark(function _callee6(transaction) {
|
|
318
339
|
var opts,
|
|
319
340
|
tx,
|
|
320
|
-
|
|
321
|
-
return _regeneratorRuntime().wrap(function
|
|
322
|
-
while (1) switch (
|
|
341
|
+
_args6 = arguments;
|
|
342
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
343
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
323
344
|
case 0:
|
|
324
|
-
opts =
|
|
345
|
+
opts = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {
|
|
325
346
|
skipMemoRequiredCheck: false
|
|
326
347
|
};
|
|
327
348
|
if (opts.skipMemoRequiredCheck) {
|
|
328
|
-
|
|
349
|
+
_context6.next = 4;
|
|
329
350
|
break;
|
|
330
351
|
}
|
|
331
|
-
|
|
352
|
+
_context6.next = 4;
|
|
332
353
|
return this.checkMemoRequired(transaction);
|
|
333
354
|
case 4:
|
|
334
355
|
tx = encodeURIComponent(transaction.toEnvelope().toXDR().toString("base64"));
|
|
335
|
-
return
|
|
356
|
+
return _context6.abrupt("return", _horizon_axios_client.default.post((0, _urijs.default)(this.serverURL).segment("transactions_async").toString(), "tx=".concat(tx)).then(function (response) {
|
|
336
357
|
return response.data;
|
|
337
358
|
}).catch(function (response) {
|
|
338
359
|
if (response instanceof Error) {
|
|
@@ -342,9 +363,9 @@ var HorizonServer = exports.HorizonServer = function () {
|
|
|
342
363
|
}));
|
|
343
364
|
case 6:
|
|
344
365
|
case "end":
|
|
345
|
-
return
|
|
366
|
+
return _context6.stop();
|
|
346
367
|
}
|
|
347
|
-
},
|
|
368
|
+
}, _callee6, this);
|
|
348
369
|
}));
|
|
349
370
|
function submitAsyncTransaction(_x3) {
|
|
350
371
|
return _submitAsyncTransaction.apply(this, arguments);
|
|
@@ -429,21 +450,21 @@ var HorizonServer = exports.HorizonServer = function () {
|
|
|
429
450
|
}, {
|
|
430
451
|
key: "loadAccount",
|
|
431
452
|
value: (function () {
|
|
432
|
-
var _loadAccount = _asyncToGenerator(_regeneratorRuntime().mark(function
|
|
453
|
+
var _loadAccount = _asyncToGenerator(_regeneratorRuntime().mark(function _callee7(accountId) {
|
|
433
454
|
var res;
|
|
434
|
-
return _regeneratorRuntime().wrap(function
|
|
435
|
-
while (1) switch (
|
|
455
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
456
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
436
457
|
case 0:
|
|
437
|
-
|
|
458
|
+
_context7.next = 2;
|
|
438
459
|
return this.accounts().accountId(accountId).call();
|
|
439
460
|
case 2:
|
|
440
|
-
res =
|
|
441
|
-
return
|
|
461
|
+
res = _context7.sent;
|
|
462
|
+
return _context7.abrupt("return", new _account_response.AccountResponse(res));
|
|
442
463
|
case 4:
|
|
443
464
|
case "end":
|
|
444
|
-
return
|
|
465
|
+
return _context7.stop();
|
|
445
466
|
}
|
|
446
|
-
},
|
|
467
|
+
}, _callee7, this);
|
|
447
468
|
}));
|
|
448
469
|
function loadAccount(_x4) {
|
|
449
470
|
return _loadAccount.apply(this, arguments);
|
|
@@ -458,88 +479,88 @@ var HorizonServer = exports.HorizonServer = function () {
|
|
|
458
479
|
}, {
|
|
459
480
|
key: "checkMemoRequired",
|
|
460
481
|
value: (function () {
|
|
461
|
-
var _checkMemoRequired = _asyncToGenerator(_regeneratorRuntime().mark(function
|
|
482
|
+
var _checkMemoRequired = _asyncToGenerator(_regeneratorRuntime().mark(function _callee8(transaction) {
|
|
462
483
|
var destinations, i, operation, destination, account;
|
|
463
|
-
return _regeneratorRuntime().wrap(function
|
|
464
|
-
while (1) switch (
|
|
484
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
485
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
465
486
|
case 0:
|
|
466
487
|
if (transaction instanceof _stellarBase.FeeBumpTransaction) {
|
|
467
488
|
transaction = transaction.innerTransaction;
|
|
468
489
|
}
|
|
469
490
|
if (!(transaction.memo.type !== "none")) {
|
|
470
|
-
|
|
491
|
+
_context8.next = 3;
|
|
471
492
|
break;
|
|
472
493
|
}
|
|
473
|
-
return
|
|
494
|
+
return _context8.abrupt("return");
|
|
474
495
|
case 3:
|
|
475
496
|
destinations = new Set();
|
|
476
497
|
i = 0;
|
|
477
498
|
case 5:
|
|
478
499
|
if (!(i < transaction.operations.length)) {
|
|
479
|
-
|
|
500
|
+
_context8.next = 36;
|
|
480
501
|
break;
|
|
481
502
|
}
|
|
482
503
|
operation = transaction.operations[i];
|
|
483
|
-
|
|
484
|
-
|
|
504
|
+
_context8.t0 = operation.type;
|
|
505
|
+
_context8.next = _context8.t0 === "payment" ? 10 : _context8.t0 === "pathPaymentStrictReceive" ? 10 : _context8.t0 === "pathPaymentStrictSend" ? 10 : _context8.t0 === "accountMerge" ? 10 : 11;
|
|
485
506
|
break;
|
|
486
507
|
case 10:
|
|
487
|
-
return
|
|
508
|
+
return _context8.abrupt("break", 12);
|
|
488
509
|
case 11:
|
|
489
|
-
return
|
|
510
|
+
return _context8.abrupt("continue", 33);
|
|
490
511
|
case 12:
|
|
491
512
|
destination = operation.destination;
|
|
492
513
|
if (!destinations.has(destination)) {
|
|
493
|
-
|
|
514
|
+
_context8.next = 15;
|
|
494
515
|
break;
|
|
495
516
|
}
|
|
496
|
-
return
|
|
517
|
+
return _context8.abrupt("continue", 33);
|
|
497
518
|
case 15:
|
|
498
519
|
destinations.add(destination);
|
|
499
520
|
if (!destination.startsWith("M")) {
|
|
500
|
-
|
|
521
|
+
_context8.next = 18;
|
|
501
522
|
break;
|
|
502
523
|
}
|
|
503
|
-
return
|
|
524
|
+
return _context8.abrupt("continue", 33);
|
|
504
525
|
case 18:
|
|
505
|
-
|
|
506
|
-
|
|
526
|
+
_context8.prev = 18;
|
|
527
|
+
_context8.next = 21;
|
|
507
528
|
return this.loadAccount(destination);
|
|
508
529
|
case 21:
|
|
509
|
-
account =
|
|
530
|
+
account = _context8.sent;
|
|
510
531
|
if (!(account.data_attr["config.memo_required"] === ACCOUNT_REQUIRES_MEMO)) {
|
|
511
|
-
|
|
532
|
+
_context8.next = 24;
|
|
512
533
|
break;
|
|
513
534
|
}
|
|
514
535
|
throw new _errors.AccountRequiresMemoError("account requires memo", destination, i);
|
|
515
536
|
case 24:
|
|
516
|
-
|
|
537
|
+
_context8.next = 33;
|
|
517
538
|
break;
|
|
518
539
|
case 26:
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
if (!(
|
|
522
|
-
|
|
540
|
+
_context8.prev = 26;
|
|
541
|
+
_context8.t1 = _context8["catch"](18);
|
|
542
|
+
if (!(_context8.t1 instanceof _errors.AccountRequiresMemoError)) {
|
|
543
|
+
_context8.next = 30;
|
|
523
544
|
break;
|
|
524
545
|
}
|
|
525
|
-
throw
|
|
546
|
+
throw _context8.t1;
|
|
526
547
|
case 30:
|
|
527
|
-
if (
|
|
528
|
-
|
|
548
|
+
if (_context8.t1 instanceof _errors.NotFoundError) {
|
|
549
|
+
_context8.next = 32;
|
|
529
550
|
break;
|
|
530
551
|
}
|
|
531
|
-
throw
|
|
552
|
+
throw _context8.t1;
|
|
532
553
|
case 32:
|
|
533
|
-
return
|
|
554
|
+
return _context8.abrupt("continue", 33);
|
|
534
555
|
case 33:
|
|
535
556
|
i += 1;
|
|
536
|
-
|
|
557
|
+
_context8.next = 5;
|
|
537
558
|
break;
|
|
538
559
|
case 36:
|
|
539
560
|
case "end":
|
|
540
|
-
return
|
|
561
|
+
return _context8.stop();
|
|
541
562
|
}
|
|
542
|
-
},
|
|
563
|
+
}, _callee8, this, [[18, 26]]);
|
|
543
564
|
}));
|
|
544
565
|
function checkMemoRequired(_x5) {
|
|
545
566
|
return _checkMemoRequired.apply(this, arguments);
|
|
@@ -155,6 +155,7 @@ export declare namespace Api {
|
|
|
155
155
|
export interface GetEventsResponse {
|
|
156
156
|
latestLedger: number;
|
|
157
157
|
events: EventResponse[];
|
|
158
|
+
cursor: string;
|
|
158
159
|
}
|
|
159
160
|
export interface EventResponse extends BaseEventResponse {
|
|
160
161
|
contractId?: Contract;
|
|
@@ -164,13 +165,13 @@ export declare namespace Api {
|
|
|
164
165
|
export interface RawGetEventsResponse {
|
|
165
166
|
latestLedger: number;
|
|
166
167
|
events: RawEventResponse[];
|
|
168
|
+
cursor: string;
|
|
167
169
|
}
|
|
168
170
|
interface BaseEventResponse {
|
|
169
171
|
id: string;
|
|
170
172
|
type: EventType;
|
|
171
173
|
ledger: number;
|
|
172
174
|
ledgerClosedAt: string;
|
|
173
|
-
cursor: string;
|
|
174
175
|
pagingToken: string;
|
|
175
176
|
inSuccessfulContractCall: boolean;
|
|
176
177
|
txHash: string;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.default = exports.AxiosClient = void 0;
|
|
7
7
|
var _httpClient = require("../http-client");
|
|
8
|
-
var version = exports.version = "13.
|
|
8
|
+
var version = exports.version = "13.1.0";
|
|
9
9
|
var AxiosClient = exports.AxiosClient = (0, _httpClient.create)({
|
|
10
10
|
headers: {
|
|
11
11
|
'X-Client-Name': 'js-soroban-client',
|
|
@@ -65,6 +65,7 @@ function parseRawEvents(raw) {
|
|
|
65
65
|
var _raw$events;
|
|
66
66
|
return {
|
|
67
67
|
latestLedger: raw.latestLedger,
|
|
68
|
+
cursor: raw.cursor,
|
|
68
69
|
events: ((_raw$events = raw.events) !== null && _raw$events !== void 0 ? _raw$events : []).map(function (evt) {
|
|
69
70
|
var clone = _objectSpread({}, evt);
|
|
70
71
|
delete clone.contractId;
|
|
@@ -696,7 +696,7 @@ var RpcServer = exports.RpcServer = function () {
|
|
|
696
696
|
key: "requestAirdrop",
|
|
697
697
|
value: (function () {
|
|
698
698
|
var _requestAirdrop = _asyncToGenerator(_regeneratorRuntime().mark(function _callee22(address, friendbotUrl) {
|
|
699
|
-
var account, response, meta, sequence, _error$response, _error$response$detai;
|
|
699
|
+
var account, response, meta, txMeta, sequence, _error$response, _error$response$detai;
|
|
700
700
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
701
701
|
while (1) switch (_context22.prev = _context22.next) {
|
|
702
702
|
case 0:
|
|
@@ -723,28 +723,47 @@ var RpcServer = exports.RpcServer = function () {
|
|
|
723
723
|
return _axios.default.post("".concat(friendbotUrl, "?addr=").concat(encodeURIComponent(account)));
|
|
724
724
|
case 12:
|
|
725
725
|
response = _context22.sent;
|
|
726
|
+
if (response.data.result_meta_xdr) {
|
|
727
|
+
_context22.next = 22;
|
|
728
|
+
break;
|
|
729
|
+
}
|
|
730
|
+
_context22.next = 16;
|
|
731
|
+
return this.getTransaction(response.data.hash);
|
|
732
|
+
case 16:
|
|
733
|
+
txMeta = _context22.sent;
|
|
734
|
+
if (!(txMeta.status !== _api.Api.GetTransactionStatus.SUCCESS)) {
|
|
735
|
+
_context22.next = 19;
|
|
736
|
+
break;
|
|
737
|
+
}
|
|
738
|
+
throw new Error("Funding account ".concat(address, " failed"));
|
|
739
|
+
case 19:
|
|
740
|
+
meta = txMeta.resultMetaXdr;
|
|
741
|
+
_context22.next = 23;
|
|
742
|
+
break;
|
|
743
|
+
case 22:
|
|
726
744
|
meta = _stellarBase.xdr.TransactionMeta.fromXDR(response.data.result_meta_xdr, 'base64');
|
|
745
|
+
case 23:
|
|
727
746
|
sequence = findCreatedAccountSequenceInTransactionMeta(meta);
|
|
728
747
|
return _context22.abrupt("return", new _stellarBase.Account(account, sequence));
|
|
729
|
-
case
|
|
730
|
-
_context22.prev =
|
|
748
|
+
case 27:
|
|
749
|
+
_context22.prev = 27;
|
|
731
750
|
_context22.t1 = _context22["catch"](9);
|
|
732
751
|
if (!(((_error$response = _context22.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 400)) {
|
|
733
|
-
_context22.next =
|
|
752
|
+
_context22.next = 32;
|
|
734
753
|
break;
|
|
735
754
|
}
|
|
736
755
|
if (!((_error$response$detai = _context22.t1.response.detail) !== null && _error$response$detai !== void 0 && _error$response$detai.includes('createAccountAlreadyExist'))) {
|
|
737
|
-
_context22.next =
|
|
756
|
+
_context22.next = 32;
|
|
738
757
|
break;
|
|
739
758
|
}
|
|
740
759
|
return _context22.abrupt("return", this.getAccount(account));
|
|
741
|
-
case
|
|
760
|
+
case 32:
|
|
742
761
|
throw _context22.t1;
|
|
743
|
-
case
|
|
762
|
+
case 33:
|
|
744
763
|
case "end":
|
|
745
764
|
return _context22.stop();
|
|
746
765
|
}
|
|
747
|
-
}, _callee22, this, [[9,
|
|
766
|
+
}, _callee22, this, [[9, 27]]);
|
|
748
767
|
}));
|
|
749
768
|
function requestAirdrop(_x21, _x22) {
|
|
750
769
|
return _requestAirdrop.apply(this, arguments);
|
package/lib/rpc/api.d.ts
CHANGED
|
@@ -155,6 +155,7 @@ export declare namespace Api {
|
|
|
155
155
|
export interface GetEventsResponse {
|
|
156
156
|
latestLedger: number;
|
|
157
157
|
events: EventResponse[];
|
|
158
|
+
cursor: string;
|
|
158
159
|
}
|
|
159
160
|
export interface EventResponse extends BaseEventResponse {
|
|
160
161
|
contractId?: Contract;
|
|
@@ -164,13 +165,13 @@ export declare namespace Api {
|
|
|
164
165
|
export interface RawGetEventsResponse {
|
|
165
166
|
latestLedger: number;
|
|
166
167
|
events: RawEventResponse[];
|
|
168
|
+
cursor: string;
|
|
167
169
|
}
|
|
168
170
|
interface BaseEventResponse {
|
|
169
171
|
id: string;
|
|
170
172
|
type: EventType;
|
|
171
173
|
ledger: number;
|
|
172
174
|
ledgerClosedAt: string;
|
|
173
|
-
cursor: string;
|
|
174
175
|
pagingToken: string;
|
|
175
176
|
inSuccessfulContractCall: boolean;
|
|
176
177
|
txHash: string;
|
package/lib/rpc/axios.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.default = exports.AxiosClient = void 0;
|
|
7
7
|
var _httpClient = require("../http-client");
|
|
8
|
-
var version = exports.version = "13.
|
|
8
|
+
var version = exports.version = "13.1.0";
|
|
9
9
|
var AxiosClient = exports.AxiosClient = (0, _httpClient.create)({
|
|
10
10
|
headers: {
|
|
11
11
|
'X-Client-Name': 'js-soroban-client',
|
package/lib/rpc/parsers.js
CHANGED
|
@@ -65,6 +65,7 @@ function parseRawEvents(raw) {
|
|
|
65
65
|
var _raw$events;
|
|
66
66
|
return {
|
|
67
67
|
latestLedger: raw.latestLedger,
|
|
68
|
+
cursor: raw.cursor,
|
|
68
69
|
events: ((_raw$events = raw.events) !== null && _raw$events !== void 0 ? _raw$events : []).map(function (evt) {
|
|
69
70
|
var clone = _objectSpread({}, evt);
|
|
70
71
|
delete clone.contractId;
|
package/lib/rpc/server.js
CHANGED
|
@@ -696,7 +696,7 @@ var RpcServer = exports.RpcServer = function () {
|
|
|
696
696
|
key: "requestAirdrop",
|
|
697
697
|
value: (function () {
|
|
698
698
|
var _requestAirdrop = _asyncToGenerator(_regeneratorRuntime().mark(function _callee22(address, friendbotUrl) {
|
|
699
|
-
var account, response, meta, sequence, _error$response, _error$response$detai;
|
|
699
|
+
var account, response, meta, txMeta, sequence, _error$response, _error$response$detai;
|
|
700
700
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
701
701
|
while (1) switch (_context22.prev = _context22.next) {
|
|
702
702
|
case 0:
|
|
@@ -723,28 +723,47 @@ var RpcServer = exports.RpcServer = function () {
|
|
|
723
723
|
return _axios.default.post("".concat(friendbotUrl, "?addr=").concat(encodeURIComponent(account)));
|
|
724
724
|
case 12:
|
|
725
725
|
response = _context22.sent;
|
|
726
|
+
if (response.data.result_meta_xdr) {
|
|
727
|
+
_context22.next = 22;
|
|
728
|
+
break;
|
|
729
|
+
}
|
|
730
|
+
_context22.next = 16;
|
|
731
|
+
return this.getTransaction(response.data.hash);
|
|
732
|
+
case 16:
|
|
733
|
+
txMeta = _context22.sent;
|
|
734
|
+
if (!(txMeta.status !== _api.Api.GetTransactionStatus.SUCCESS)) {
|
|
735
|
+
_context22.next = 19;
|
|
736
|
+
break;
|
|
737
|
+
}
|
|
738
|
+
throw new Error("Funding account ".concat(address, " failed"));
|
|
739
|
+
case 19:
|
|
740
|
+
meta = txMeta.resultMetaXdr;
|
|
741
|
+
_context22.next = 23;
|
|
742
|
+
break;
|
|
743
|
+
case 22:
|
|
726
744
|
meta = _stellarBase.xdr.TransactionMeta.fromXDR(response.data.result_meta_xdr, 'base64');
|
|
745
|
+
case 23:
|
|
727
746
|
sequence = findCreatedAccountSequenceInTransactionMeta(meta);
|
|
728
747
|
return _context22.abrupt("return", new _stellarBase.Account(account, sequence));
|
|
729
|
-
case
|
|
730
|
-
_context22.prev =
|
|
748
|
+
case 27:
|
|
749
|
+
_context22.prev = 27;
|
|
731
750
|
_context22.t1 = _context22["catch"](9);
|
|
732
751
|
if (!(((_error$response = _context22.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 400)) {
|
|
733
|
-
_context22.next =
|
|
752
|
+
_context22.next = 32;
|
|
734
753
|
break;
|
|
735
754
|
}
|
|
736
755
|
if (!((_error$response$detai = _context22.t1.response.detail) !== null && _error$response$detai !== void 0 && _error$response$detai.includes('createAccountAlreadyExist'))) {
|
|
737
|
-
_context22.next =
|
|
756
|
+
_context22.next = 32;
|
|
738
757
|
break;
|
|
739
758
|
}
|
|
740
759
|
return _context22.abrupt("return", this.getAccount(account));
|
|
741
|
-
case
|
|
760
|
+
case 32:
|
|
742
761
|
throw _context22.t1;
|
|
743
|
-
case
|
|
762
|
+
case 33:
|
|
744
763
|
case "end":
|
|
745
764
|
return _context22.stop();
|
|
746
765
|
}
|
|
747
|
-
}, _callee22, this, [[9,
|
|
766
|
+
}, _callee22, this, [[9, 27]]);
|
|
748
767
|
}));
|
|
749
768
|
function requestAirdrop(_x21, _x22) {
|
|
750
769
|
return _requestAirdrop.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stellar/stellar-sdk",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.1.0",
|
|
4
4
|
"description": "A library for working with the Stellar network, including communication with the Horizon and Soroban RPC servers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"stellar"
|
|
@@ -142,13 +142,13 @@
|
|
|
142
142
|
]
|
|
143
143
|
},
|
|
144
144
|
"devDependencies": {
|
|
145
|
-
"@babel/cli": "^7.
|
|
145
|
+
"@babel/cli": "^7.26.4",
|
|
146
146
|
"@babel/core": "^7.26.0",
|
|
147
147
|
"@babel/eslint-plugin": "^7.25.9",
|
|
148
148
|
"@babel/preset-env": "^7.26.0",
|
|
149
149
|
"@babel/preset-typescript": "^7.26.0",
|
|
150
150
|
"@babel/register": "^7.25.9",
|
|
151
|
-
"@definitelytyped/dtslint": "^0.2.
|
|
151
|
+
"@definitelytyped/dtslint": "^0.2.28",
|
|
152
152
|
"@istanbuljs/nyc-config-babel": "3.0.0",
|
|
153
153
|
"@stellar/tsconfig": "^1.0.2",
|
|
154
154
|
"@types/chai": "^4.3.19",
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
"chai-as-promised": "^7.1.1",
|
|
173
173
|
"chai-http": "^4.3.0",
|
|
174
174
|
"cross-env": "^7.0.3",
|
|
175
|
-
"dotenv": "^16.4.
|
|
175
|
+
"dotenv": "^16.4.7",
|
|
176
176
|
"eslint": "^8.57.0",
|
|
177
177
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
178
178
|
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
@@ -195,29 +195,29 @@
|
|
|
195
195
|
"karma-mocha": "^2.0.0",
|
|
196
196
|
"karma-sinon-chai": "^2.0.2",
|
|
197
197
|
"karma-webpack": "^5.0.1",
|
|
198
|
-
"lint-staged": "^15.2.
|
|
198
|
+
"lint-staged": "^15.2.11",
|
|
199
199
|
"lodash": "^4.17.21",
|
|
200
200
|
"mocha": "^10.8.2",
|
|
201
201
|
"node-polyfill-webpack-plugin": "^3.0.0",
|
|
202
202
|
"null-loader": "^4.0.1",
|
|
203
203
|
"nyc": "^17.0.0",
|
|
204
|
-
"prettier": "^3.
|
|
204
|
+
"prettier": "^3.4.2",
|
|
205
205
|
"randombytes": "^2.1.0",
|
|
206
206
|
"sinon": "^17.0.1",
|
|
207
207
|
"sinon-chai": "^3.7.0",
|
|
208
208
|
"taffydb": "^2.7.3",
|
|
209
|
-
"terser-webpack-plugin": "^5.3.
|
|
209
|
+
"terser-webpack-plugin": "^5.3.11",
|
|
210
210
|
"ts-node": "^10.9.2",
|
|
211
211
|
"typescript": "^5.6.3",
|
|
212
|
-
"webpack": "^5.
|
|
212
|
+
"webpack": "^5.97.1",
|
|
213
213
|
"webpack-cli": "^5.0.1"
|
|
214
214
|
},
|
|
215
215
|
"dependencies": {
|
|
216
|
-
"@stellar/stellar-base": "^13.0.
|
|
217
|
-
"axios": "^1.7.
|
|
216
|
+
"@stellar/stellar-base": "^13.0.1",
|
|
217
|
+
"axios": "^1.7.9",
|
|
218
218
|
"bignumber.js": "^9.1.2",
|
|
219
219
|
"eventsource": "^2.0.2",
|
|
220
|
-
"feaxios": "^0.0.
|
|
220
|
+
"feaxios": "^0.0.23",
|
|
221
221
|
"randombytes": "^2.1.0",
|
|
222
222
|
"toml": "^3.0.0",
|
|
223
223
|
"urijs": "^1.19.1"
|