@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.
Files changed (50) hide show
  1. package/CHANGELOG.md +80 -1
  2. package/README.md +1 -1
  3. package/dist/stellar-sdk.js +1643 -466
  4. package/dist/stellar-sdk.min.js +1 -1
  5. package/lib/{contract_client → contract}/assembled_transaction.d.ts +59 -40
  6. package/lib/{contract_client → contract}/assembled_transaction.js +128 -146
  7. package/lib/{contract_client → contract}/basic_node_signer.d.ts +2 -2
  8. package/lib/{contract_client → contract}/basic_node_signer.js +3 -3
  9. package/lib/contract/client.d.ts +51 -0
  10. package/lib/contract/client.js +177 -0
  11. package/lib/contract/index.d.ts +7 -0
  12. package/lib/{contract_client → contract}/index.js +19 -8
  13. package/lib/{contract_client → contract}/sent_transaction.d.ts +21 -10
  14. package/lib/{contract_client → contract}/sent_transaction.js +38 -19
  15. package/lib/{contract_spec.d.ts → contract/spec.d.ts} +3 -3
  16. package/lib/{contract_spec.js → contract/spec.js} +160 -160
  17. package/lib/{contract_client → contract}/types.d.ts +10 -8
  18. package/lib/contract/utils.d.ts +40 -0
  19. package/lib/{contract_client → contract}/utils.js +13 -3
  20. package/lib/index.d.ts +26 -2
  21. package/lib/index.js +10 -16
  22. package/lib/rpc/index.d.ts +7 -0
  23. package/lib/{soroban → rpc}/server.d.ts +49 -0
  24. package/lib/{soroban → rpc}/server.js +199 -118
  25. package/package.json +20 -3
  26. package/lib/contract_client/client.d.ts +0 -17
  27. package/lib/contract_client/client.js +0 -57
  28. package/lib/contract_client/index.d.ts +0 -6
  29. package/lib/contract_client/utils.d.ts +0 -23
  30. package/lib/rust_types/index.d.ts +0 -1
  31. package/lib/rust_types/index.js +0 -16
  32. package/lib/soroban/index.d.ts +0 -7
  33. /package/lib/{rust_types/result.d.ts → contract/rust_result.d.ts} +0 -0
  34. /package/lib/{rust_types/result.js → contract/rust_result.js} +0 -0
  35. /package/lib/{contract_client → contract}/types.js +0 -0
  36. /package/lib/{soroban → rpc}/api.d.ts +0 -0
  37. /package/lib/{soroban → rpc}/api.js +0 -0
  38. /package/lib/{soroban → rpc}/axios.d.ts +0 -0
  39. /package/lib/{soroban → rpc}/axios.js +0 -0
  40. /package/lib/{soroban → rpc}/browser.d.ts +0 -0
  41. /package/lib/{soroban → rpc}/browser.js +0 -0
  42. /package/lib/{soroban → rpc}/index.js +0 -0
  43. /package/lib/{soroban → rpc}/jsonrpc.d.ts +0 -0
  44. /package/lib/{soroban → rpc}/jsonrpc.js +0 -0
  45. /package/lib/{soroban → rpc}/parsers.d.ts +0 -0
  46. /package/lib/{soroban → rpc}/parsers.js +0 -0
  47. /package/lib/{soroban → rpc}/transaction.d.ts +0 -0
  48. /package/lib/{soroban → rpc}/transaction.js +0 -0
  49. /package/lib/{soroban → rpc}/utils.d.ts +0 -0
  50. /package/lib/{soroban → rpc}/utils.js +0 -0
@@ -183,20 +183,101 @@ var Server = exports.Server = function () {
183
183
  return getContractData;
184
184
  }())
185
185
  }, {
186
- key: "getLedgerEntries",
186
+ key: "getContractWasmByContractId",
187
187
  value: (function () {
188
- var _getLedgerEntries2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee4() {
189
- var _args4 = arguments;
188
+ var _getContractWasmByContractId = _asyncToGenerator(_regeneratorRuntime().mark(function _callee4(contractId) {
189
+ var _response$entries$;
190
+ var contractLedgerKey, response, wasmHash;
190
191
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
191
192
  while (1) switch (_context4.prev = _context4.next) {
192
193
  case 0:
193
- return _context4.abrupt("return", this._getLedgerEntries.apply(this, _args4).then(_parsers.parseRawLedgerEntries));
194
- case 1:
194
+ contractLedgerKey = new _stellarBase.Contract(contractId).getFootprint();
195
+ _context4.next = 3;
196
+ return this.getLedgerEntries(contractLedgerKey);
197
+ case 3:
198
+ response = _context4.sent;
199
+ if (!(!response.entries.length || !((_response$entries$ = response.entries[0]) !== null && _response$entries$ !== void 0 && _response$entries$.val))) {
200
+ _context4.next = 6;
201
+ break;
202
+ }
203
+ return _context4.abrupt("return", Promise.reject({
204
+ code: 404,
205
+ message: "Could not obtain contract hash from server"
206
+ }));
207
+ case 6:
208
+ wasmHash = response.entries[0].val.contractData().val().instance().executable().wasmHash();
209
+ return _context4.abrupt("return", this.getContractWasmByHash(wasmHash));
210
+ case 8:
195
211
  case "end":
196
212
  return _context4.stop();
197
213
  }
198
214
  }, _callee4, this);
199
215
  }));
216
+ function getContractWasmByContractId(_x4) {
217
+ return _getContractWasmByContractId.apply(this, arguments);
218
+ }
219
+ return getContractWasmByContractId;
220
+ }())
221
+ }, {
222
+ key: "getContractWasmByHash",
223
+ value: (function () {
224
+ var _getContractWasmByHash = _asyncToGenerator(_regeneratorRuntime().mark(function _callee5(wasmHash) {
225
+ var _responseWasm$entries;
226
+ var format,
227
+ wasmHashBuffer,
228
+ ledgerKeyWasmHash,
229
+ responseWasm,
230
+ wasmBuffer,
231
+ _args5 = arguments;
232
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
233
+ while (1) switch (_context5.prev = _context5.next) {
234
+ case 0:
235
+ format = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : undefined;
236
+ wasmHashBuffer = typeof wasmHash === "string" ? Buffer.from(wasmHash, format) : wasmHash;
237
+ ledgerKeyWasmHash = _stellarBase.xdr.LedgerKey.contractCode(new _stellarBase.xdr.LedgerKeyContractCode({
238
+ hash: wasmHashBuffer
239
+ }));
240
+ _context5.next = 5;
241
+ return this.getLedgerEntries(ledgerKeyWasmHash);
242
+ case 5:
243
+ responseWasm = _context5.sent;
244
+ if (!(!responseWasm.entries.length || !((_responseWasm$entries = responseWasm.entries[0]) !== null && _responseWasm$entries !== void 0 && _responseWasm$entries.val))) {
245
+ _context5.next = 8;
246
+ break;
247
+ }
248
+ return _context5.abrupt("return", Promise.reject({
249
+ code: 404,
250
+ message: "Could not obtain contract wasm from server"
251
+ }));
252
+ case 8:
253
+ wasmBuffer = responseWasm.entries[0].val.contractCode().code();
254
+ return _context5.abrupt("return", wasmBuffer);
255
+ case 10:
256
+ case "end":
257
+ return _context5.stop();
258
+ }
259
+ }, _callee5, this);
260
+ }));
261
+ function getContractWasmByHash(_x5) {
262
+ return _getContractWasmByHash.apply(this, arguments);
263
+ }
264
+ return getContractWasmByHash;
265
+ }())
266
+ }, {
267
+ key: "getLedgerEntries",
268
+ value: (function () {
269
+ var _getLedgerEntries2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee6() {
270
+ var _args6 = arguments;
271
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
272
+ while (1) switch (_context6.prev = _context6.next) {
273
+ case 0:
274
+ return _context6.abrupt("return", this._getLedgerEntries.apply(this, _args6).then(_parsers.parseRawLedgerEntries));
275
+ case 1:
276
+ case "end":
277
+ return _context6.stop();
278
+ }
279
+ }, _callee6, this);
280
+ }));
200
281
  function getLedgerEntries() {
201
282
  return _getLedgerEntries2.apply(this, arguments);
202
283
  }
@@ -205,27 +286,27 @@ var Server = exports.Server = function () {
205
286
  }, {
206
287
  key: "_getLedgerEntries",
207
288
  value: function () {
208
- var _getLedgerEntries3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee5() {
289
+ var _getLedgerEntries3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee7() {
209
290
  var _len,
210
291
  keys,
211
292
  _key,
212
- _args5 = arguments;
213
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
214
- while (1) switch (_context5.prev = _context5.next) {
293
+ _args7 = arguments;
294
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
295
+ while (1) switch (_context7.prev = _context7.next) {
215
296
  case 0:
216
- for (_len = _args5.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
217
- keys[_key] = _args5[_key];
297
+ for (_len = _args7.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
298
+ keys[_key] = _args7[_key];
218
299
  }
219
- return _context5.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getLedgerEntries', {
300
+ return _context7.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getLedgerEntries', {
220
301
  keys: keys.map(function (k) {
221
302
  return k.toXDR('base64');
222
303
  })
223
304
  }));
224
305
  case 2:
225
306
  case "end":
226
- return _context5.stop();
307
+ return _context7.stop();
227
308
  }
228
- }, _callee5, this);
309
+ }, _callee7, this);
229
310
  }));
230
311
  function _getLedgerEntries() {
231
312
  return _getLedgerEntries3.apply(this, arguments);
@@ -235,11 +316,11 @@ var Server = exports.Server = function () {
235
316
  }, {
236
317
  key: "getTransaction",
237
318
  value: (function () {
238
- var _getTransaction2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee6(hash) {
239
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
240
- while (1) switch (_context6.prev = _context6.next) {
319
+ var _getTransaction2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee8(hash) {
320
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
321
+ while (1) switch (_context8.prev = _context8.next) {
241
322
  case 0:
242
- return _context6.abrupt("return", this._getTransaction(hash).then(function (raw) {
323
+ return _context8.abrupt("return", this._getTransaction(hash).then(function (raw) {
243
324
  var foundInfo = {};
244
325
  if (raw.status !== _api.Api.GetTransactionStatus.NOT_FOUND) {
245
326
  var _meta$v3$sorobanMeta;
@@ -267,11 +348,11 @@ var Server = exports.Server = function () {
267
348
  }));
268
349
  case 1:
269
350
  case "end":
270
- return _context6.stop();
351
+ return _context8.stop();
271
352
  }
272
- }, _callee6, this);
353
+ }, _callee8, this);
273
354
  }));
274
- function getTransaction(_x4) {
355
+ function getTransaction(_x6) {
275
356
  return _getTransaction2.apply(this, arguments);
276
357
  }
277
358
  return getTransaction;
@@ -279,20 +360,20 @@ var Server = exports.Server = function () {
279
360
  }, {
280
361
  key: "_getTransaction",
281
362
  value: function () {
282
- var _getTransaction3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee7(hash) {
283
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
284
- while (1) switch (_context7.prev = _context7.next) {
363
+ var _getTransaction3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee9(hash) {
364
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
365
+ while (1) switch (_context9.prev = _context9.next) {
285
366
  case 0:
286
- return _context7.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getTransaction', {
367
+ return _context9.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getTransaction', {
287
368
  hash: hash
288
369
  }));
289
370
  case 1:
290
371
  case "end":
291
- return _context7.stop();
372
+ return _context9.stop();
292
373
  }
293
- }, _callee7, this);
374
+ }, _callee9, this);
294
375
  }));
295
- function _getTransaction(_x5) {
376
+ function _getTransaction(_x7) {
296
377
  return _getTransaction3.apply(this, arguments);
297
378
  }
298
379
  return _getTransaction;
@@ -300,18 +381,18 @@ var Server = exports.Server = function () {
300
381
  }, {
301
382
  key: "getEvents",
302
383
  value: (function () {
303
- var _getEvents2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee8(request) {
304
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
305
- while (1) switch (_context8.prev = _context8.next) {
384
+ var _getEvents2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee10(request) {
385
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
386
+ while (1) switch (_context10.prev = _context10.next) {
306
387
  case 0:
307
- return _context8.abrupt("return", this._getEvents(request).then(_parsers.parseRawEvents));
388
+ return _context10.abrupt("return", this._getEvents(request).then(_parsers.parseRawEvents));
308
389
  case 1:
309
390
  case "end":
310
- return _context8.stop();
391
+ return _context10.stop();
311
392
  }
312
- }, _callee8, this);
393
+ }, _callee10, this);
313
394
  }));
314
- function getEvents(_x6) {
395
+ function getEvents(_x8) {
315
396
  return _getEvents2.apply(this, arguments);
316
397
  }
317
398
  return getEvents;
@@ -319,12 +400,12 @@ var Server = exports.Server = function () {
319
400
  }, {
320
401
  key: "_getEvents",
321
402
  value: function () {
322
- var _getEvents3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee9(request) {
403
+ var _getEvents3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee11(request) {
323
404
  var _request$filters;
324
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
325
- while (1) switch (_context9.prev = _context9.next) {
405
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
406
+ while (1) switch (_context11.prev = _context11.next) {
326
407
  case 0:
327
- return _context9.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getEvents', _objectSpread({
408
+ return _context11.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getEvents', _objectSpread({
328
409
  filters: (_request$filters = request.filters) !== null && _request$filters !== void 0 ? _request$filters : [],
329
410
  pagination: _objectSpread(_objectSpread({}, request.cursor && {
330
411
  cursor: request.cursor
@@ -336,11 +417,11 @@ var Server = exports.Server = function () {
336
417
  })));
337
418
  case 1:
338
419
  case "end":
339
- return _context9.stop();
420
+ return _context11.stop();
340
421
  }
341
- }, _callee9, this);
422
+ }, _callee11, this);
342
423
  }));
343
- function _getEvents(_x7) {
424
+ function _getEvents(_x9) {
344
425
  return _getEvents3.apply(this, arguments);
345
426
  }
346
427
  return _getEvents;
@@ -348,19 +429,19 @@ var Server = exports.Server = function () {
348
429
  }, {
349
430
  key: "getNetwork",
350
431
  value: (function () {
351
- var _getNetwork = _asyncToGenerator(_regeneratorRuntime().mark(function _callee10() {
352
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
353
- while (1) switch (_context10.prev = _context10.next) {
432
+ var _getNetwork = _asyncToGenerator(_regeneratorRuntime().mark(function _callee12() {
433
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
434
+ while (1) switch (_context12.prev = _context12.next) {
354
435
  case 0:
355
- _context10.next = 2;
436
+ _context12.next = 2;
356
437
  return jsonrpc.postObject(this.serverURL.toString(), 'getNetwork');
357
438
  case 2:
358
- return _context10.abrupt("return", _context10.sent);
439
+ return _context12.abrupt("return", _context12.sent);
359
440
  case 3:
360
441
  case "end":
361
- return _context10.stop();
442
+ return _context12.stop();
362
443
  }
363
- }, _callee10, this);
444
+ }, _callee12, this);
364
445
  }));
365
446
  function getNetwork() {
366
447
  return _getNetwork.apply(this, arguments);
@@ -370,16 +451,16 @@ var Server = exports.Server = function () {
370
451
  }, {
371
452
  key: "getLatestLedger",
372
453
  value: (function () {
373
- var _getLatestLedger = _asyncToGenerator(_regeneratorRuntime().mark(function _callee11() {
374
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
375
- while (1) switch (_context11.prev = _context11.next) {
454
+ var _getLatestLedger = _asyncToGenerator(_regeneratorRuntime().mark(function _callee13() {
455
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
456
+ while (1) switch (_context13.prev = _context13.next) {
376
457
  case 0:
377
- return _context11.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getLatestLedger'));
458
+ return _context13.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'getLatestLedger'));
378
459
  case 1:
379
460
  case "end":
380
- return _context11.stop();
461
+ return _context13.stop();
381
462
  }
382
- }, _callee11, this);
463
+ }, _callee13, this);
383
464
  }));
384
465
  function getLatestLedger() {
385
466
  return _getLatestLedger.apply(this, arguments);
@@ -389,18 +470,18 @@ var Server = exports.Server = function () {
389
470
  }, {
390
471
  key: "simulateTransaction",
391
472
  value: (function () {
392
- var _simulateTransaction2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee12(tx, addlResources) {
393
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
394
- while (1) switch (_context12.prev = _context12.next) {
473
+ var _simulateTransaction2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee14(tx, addlResources) {
474
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
475
+ while (1) switch (_context14.prev = _context14.next) {
395
476
  case 0:
396
- return _context12.abrupt("return", this._simulateTransaction(tx, addlResources).then(_parsers.parseRawSimulation));
477
+ return _context14.abrupt("return", this._simulateTransaction(tx, addlResources).then(_parsers.parseRawSimulation));
397
478
  case 1:
398
479
  case "end":
399
- return _context12.stop();
480
+ return _context14.stop();
400
481
  }
401
- }, _callee12, this);
482
+ }, _callee14, this);
402
483
  }));
403
- function simulateTransaction(_x8, _x9) {
484
+ function simulateTransaction(_x10, _x11) {
404
485
  return _simulateTransaction2.apply(this, arguments);
405
486
  }
406
487
  return simulateTransaction;
@@ -408,11 +489,11 @@ var Server = exports.Server = function () {
408
489
  }, {
409
490
  key: "_simulateTransaction",
410
491
  value: function () {
411
- var _simulateTransaction3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee13(transaction, addlResources) {
412
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
413
- while (1) switch (_context13.prev = _context13.next) {
492
+ var _simulateTransaction3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee15(transaction, addlResources) {
493
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
494
+ while (1) switch (_context15.prev = _context15.next) {
414
495
  case 0:
415
- return _context13.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'simulateTransaction', _objectSpread({
496
+ return _context15.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'simulateTransaction', _objectSpread({
416
497
  transaction: transaction.toXDR()
417
498
  }, addlResources !== undefined && {
418
499
  resourceConfig: {
@@ -421,11 +502,11 @@ var Server = exports.Server = function () {
421
502
  })));
422
503
  case 1:
423
504
  case "end":
424
- return _context13.stop();
505
+ return _context15.stop();
425
506
  }
426
- }, _callee13, this);
507
+ }, _callee15, this);
427
508
  }));
428
- function _simulateTransaction(_x10, _x11) {
509
+ function _simulateTransaction(_x12, _x13) {
429
510
  return _simulateTransaction3.apply(this, arguments);
430
511
  }
431
512
  return _simulateTransaction;
@@ -433,29 +514,29 @@ var Server = exports.Server = function () {
433
514
  }, {
434
515
  key: "prepareTransaction",
435
516
  value: (function () {
436
- var _prepareTransaction = _asyncToGenerator(_regeneratorRuntime().mark(function _callee14(tx) {
517
+ var _prepareTransaction = _asyncToGenerator(_regeneratorRuntime().mark(function _callee16(tx) {
437
518
  var simResponse;
438
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
439
- while (1) switch (_context14.prev = _context14.next) {
519
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
520
+ while (1) switch (_context16.prev = _context16.next) {
440
521
  case 0:
441
- _context14.next = 2;
522
+ _context16.next = 2;
442
523
  return this.simulateTransaction(tx);
443
524
  case 2:
444
- simResponse = _context14.sent;
525
+ simResponse = _context16.sent;
445
526
  if (!_api.Api.isSimulationError(simResponse)) {
446
- _context14.next = 5;
527
+ _context16.next = 5;
447
528
  break;
448
529
  }
449
530
  throw simResponse.error;
450
531
  case 5:
451
- return _context14.abrupt("return", (0, _transaction.assembleTransaction)(tx, simResponse).build());
532
+ return _context16.abrupt("return", (0, _transaction.assembleTransaction)(tx, simResponse).build());
452
533
  case 6:
453
534
  case "end":
454
- return _context14.stop();
535
+ return _context16.stop();
455
536
  }
456
- }, _callee14, this);
537
+ }, _callee16, this);
457
538
  }));
458
- function prepareTransaction(_x12) {
539
+ function prepareTransaction(_x14) {
459
540
  return _prepareTransaction.apply(this, arguments);
460
541
  }
461
542
  return prepareTransaction;
@@ -463,18 +544,18 @@ var Server = exports.Server = function () {
463
544
  }, {
464
545
  key: "sendTransaction",
465
546
  value: (function () {
466
- var _sendTransaction2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee15(transaction) {
467
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
468
- while (1) switch (_context15.prev = _context15.next) {
547
+ var _sendTransaction2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee17(transaction) {
548
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
549
+ while (1) switch (_context17.prev = _context17.next) {
469
550
  case 0:
470
- return _context15.abrupt("return", this._sendTransaction(transaction).then(_parsers.parseRawSendTransaction));
551
+ return _context17.abrupt("return", this._sendTransaction(transaction).then(_parsers.parseRawSendTransaction));
471
552
  case 1:
472
553
  case "end":
473
- return _context15.stop();
554
+ return _context17.stop();
474
555
  }
475
- }, _callee15, this);
556
+ }, _callee17, this);
476
557
  }));
477
- function sendTransaction(_x13) {
558
+ function sendTransaction(_x15) {
478
559
  return _sendTransaction2.apply(this, arguments);
479
560
  }
480
561
  return sendTransaction;
@@ -482,20 +563,20 @@ var Server = exports.Server = function () {
482
563
  }, {
483
564
  key: "_sendTransaction",
484
565
  value: function () {
485
- var _sendTransaction3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee16(transaction) {
486
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
487
- while (1) switch (_context16.prev = _context16.next) {
566
+ var _sendTransaction3 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee18(transaction) {
567
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
568
+ while (1) switch (_context18.prev = _context18.next) {
488
569
  case 0:
489
- return _context16.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'sendTransaction', {
570
+ return _context18.abrupt("return", jsonrpc.postObject(this.serverURL.toString(), 'sendTransaction', {
490
571
  transaction: transaction.toXDR()
491
572
  }));
492
573
  case 1:
493
574
  case "end":
494
- return _context16.stop();
575
+ return _context18.stop();
495
576
  }
496
- }, _callee16, this);
577
+ }, _callee18, this);
497
578
  }));
498
- function _sendTransaction(_x14) {
579
+ function _sendTransaction(_x16) {
499
580
  return _sendTransaction3.apply(this, arguments);
500
581
  }
501
582
  return _sendTransaction;
@@ -503,58 +584,58 @@ var Server = exports.Server = function () {
503
584
  }, {
504
585
  key: "requestAirdrop",
505
586
  value: (function () {
506
- var _requestAirdrop = _asyncToGenerator(_regeneratorRuntime().mark(function _callee17(address, friendbotUrl) {
587
+ var _requestAirdrop = _asyncToGenerator(_regeneratorRuntime().mark(function _callee19(address, friendbotUrl) {
507
588
  var account, response, meta, sequence, _error$response, _error$response$detai;
508
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
509
- while (1) switch (_context17.prev = _context17.next) {
589
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
590
+ while (1) switch (_context19.prev = _context19.next) {
510
591
  case 0:
511
592
  account = typeof address === 'string' ? address : address.accountId();
512
- _context17.t0 = friendbotUrl;
513
- if (_context17.t0) {
514
- _context17.next = 6;
593
+ _context19.t0 = friendbotUrl;
594
+ if (_context19.t0) {
595
+ _context19.next = 6;
515
596
  break;
516
597
  }
517
- _context17.next = 5;
598
+ _context19.next = 5;
518
599
  return this.getNetwork();
519
600
  case 5:
520
- _context17.t0 = _context17.sent.friendbotUrl;
601
+ _context19.t0 = _context19.sent.friendbotUrl;
521
602
  case 6:
522
- friendbotUrl = _context17.t0;
603
+ friendbotUrl = _context19.t0;
523
604
  if (friendbotUrl) {
524
- _context17.next = 9;
605
+ _context19.next = 9;
525
606
  break;
526
607
  }
527
608
  throw new Error('No friendbot URL configured for current network');
528
609
  case 9:
529
- _context17.prev = 9;
530
- _context17.next = 12;
610
+ _context19.prev = 9;
611
+ _context19.next = 12;
531
612
  return _axios.default.post("".concat(friendbotUrl, "?addr=").concat(encodeURIComponent(account)));
532
613
  case 12:
533
- response = _context17.sent;
614
+ response = _context19.sent;
534
615
  meta = _stellarBase.xdr.TransactionMeta.fromXDR(response.data.result_meta_xdr, 'base64');
535
616
  sequence = findCreatedAccountSequenceInTransactionMeta(meta);
536
- return _context17.abrupt("return", new _stellarBase.Account(account, sequence));
617
+ return _context19.abrupt("return", new _stellarBase.Account(account, sequence));
537
618
  case 18:
538
- _context17.prev = 18;
539
- _context17.t1 = _context17["catch"](9);
540
- if (!(((_error$response = _context17.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 400)) {
541
- _context17.next = 23;
619
+ _context19.prev = 18;
620
+ _context19.t1 = _context19["catch"](9);
621
+ if (!(((_error$response = _context19.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 400)) {
622
+ _context19.next = 23;
542
623
  break;
543
624
  }
544
- if (!((_error$response$detai = _context17.t1.response.detail) !== null && _error$response$detai !== void 0 && _error$response$detai.includes('createAccountAlreadyExist'))) {
545
- _context17.next = 23;
625
+ if (!((_error$response$detai = _context19.t1.response.detail) !== null && _error$response$detai !== void 0 && _error$response$detai.includes('createAccountAlreadyExist'))) {
626
+ _context19.next = 23;
546
627
  break;
547
628
  }
548
- return _context17.abrupt("return", this.getAccount(account));
629
+ return _context19.abrupt("return", this.getAccount(account));
549
630
  case 23:
550
- throw _context17.t1;
631
+ throw _context19.t1;
551
632
  case 24:
552
633
  case "end":
553
- return _context17.stop();
634
+ return _context19.stop();
554
635
  }
555
- }, _callee17, this, [[9, 18]]);
636
+ }, _callee19, this, [[9, 18]]);
556
637
  }));
557
- function requestAirdrop(_x15, _x16) {
638
+ function requestAirdrop(_x17, _x18) {
558
639
  return _requestAirdrop.apply(this, arguments);
559
640
  }
560
641
  return requestAirdrop;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar/stellar-sdk",
3
- "version": "12.0.0-rc.1",
3
+ "version": "12.0.0-rc.3",
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"
@@ -23,6 +23,21 @@
23
23
  "/lib",
24
24
  "/dist"
25
25
  ],
26
+ "exports": {
27
+ ".": {
28
+ "browser": "./dist/stellar-sdk.min.js",
29
+ "types": "./lib/index.d.ts",
30
+ "default": "./lib/index.js"
31
+ },
32
+ "./contract": {
33
+ "types": "./lib/contract/index.d.ts",
34
+ "default": "./lib/contract/index.js"
35
+ },
36
+ "./rpc": {
37
+ "types": "./lib/rpc/index.d.ts",
38
+ "default": "./lib/rpc/index.js"
39
+ }
40
+ },
26
41
  "scripts": {
27
42
  "build": "cross-env NODE_ENV=development yarn _build",
28
43
  "build:prod": "cross-env NODE_ENV=production yarn _build",
@@ -39,7 +54,7 @@
39
54
  "test:integration": "yarn _nyc mocha --recursive 'test/integration/**/*.js'",
40
55
  "test:browser": "karma start config/karma.conf.js",
41
56
  "fmt": "yarn eslint -c .eslintrc.js src/ --fix && yarn _prettier",
42
- "preversion": "yarn clean && yarn fmt && yarn build:prod && yarn test",
57
+ "preversion": "yarn clean && yarn _prettier && yarn build:prod && yarn test",
43
58
  "prepare": "yarn build:prod",
44
59
  "_build": "yarn build:node && yarn build:test && yarn build:browser",
45
60
  "_babel": "babel --extensions '.ts' --out-dir lib/ src/",
@@ -109,8 +124,10 @@
109
124
  "dotenv": "^16.4.5",
110
125
  "eslint": "^8.57.0",
111
126
  "eslint-config-airbnb-base": "^15.0.0",
127
+ "eslint-config-airbnb-typescript": "^18.0.0",
112
128
  "eslint-config-prettier": "^9.0.0",
113
129
  "eslint-plugin-import": "^2.29.1",
130
+ "eslint-plugin-jsdoc": "^48.2.4",
114
131
  "eslint-plugin-node": "^11.1.0",
115
132
  "eslint-plugin-prefer-import": "^0.0.1",
116
133
  "eslint-plugin-prettier": "^5.1.2",
@@ -145,7 +162,7 @@
145
162
  "webpack-cli": "^5.0.1"
146
163
  },
147
164
  "dependencies": {
148
- "@stellar/stellar-base": "^11.0.1",
165
+ "@stellar/stellar-base": "^12.0.0-rc.1",
149
166
  "axios": "^1.6.8",
150
167
  "bignumber.js": "^9.1.2",
151
168
  "eventsource": "^2.0.2",
@@ -1,17 +0,0 @@
1
- import { ContractSpec } from "..";
2
- import { AssembledTransaction } from "./assembled_transaction";
3
- import type { ContractClientOptions } from "./types";
4
- export declare class ContractClient {
5
- readonly spec: ContractSpec;
6
- readonly options: ContractClientOptions;
7
- /**
8
- * Generate a class from the contract spec that where each contract method
9
- * gets included with an identical name.
10
- *
11
- * Each method returns an {@link AssembledTransaction} that can be used to
12
- * modify, simulate, decode results, and possibly sign, & submit the
13
- * transaction.
14
- */
15
- constructor(spec: ContractSpec, options: ContractClientOptions);
16
- txFromJSON: <T>(json: string) => AssembledTransaction<T>;
17
- }