@stellar/typescript-wallet-sdk 1.1.0-alpha.0 → 1.1.0-alpha.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/lib/bundle.js CHANGED
@@ -50487,14 +50487,39 @@ var __importStar = (this && this.__importStar) || function (mod) {
50487
50487
  return result;
50488
50488
  };
50489
50489
  Object.defineProperty(exports, "__esModule", ({ value: true }));
50490
- exports.Keypair = exports.walletSdk = void 0;
50490
+ exports.Keypair = exports.walletSdk = exports.WatcherTypes = exports.Watcher = exports.parseToml = exports.InteractiveResponseType = exports.Interactive = exports.Exception = exports.AnchorTypes = exports.Anchor = void 0;
50491
50491
  var walletSdk = __importStar(__webpack_require__(/*! ./walletSdk */ "./src/walletSdk/index.ts"));
50492
50492
  exports.walletSdk = walletSdk;
50493
50493
  var stellar_sdk_1 = __webpack_require__(/*! stellar-sdk */ "./node_modules/stellar-sdk/lib/index.js");
50494
50494
  Object.defineProperty(exports, "Keypair", ({ enumerable: true, get: function () { return stellar_sdk_1.Keypair; } }));
50495
+ var Anchor_1 = __webpack_require__(/*! ./walletSdk/Anchor */ "./src/walletSdk/Anchor/index.ts");
50496
+ Object.defineProperty(exports, "Anchor", ({ enumerable: true, get: function () { return Anchor_1.Anchor; } }));
50497
+ exports.AnchorTypes = __importStar(__webpack_require__(/*! ./walletSdk/Anchor/Types */ "./src/walletSdk/Anchor/Types.ts"));
50498
+ exports.Exception = __importStar(__webpack_require__(/*! ./walletSdk/exception */ "./src/walletSdk/exception/index.ts"));
50499
+ var interactive_1 = __webpack_require__(/*! ./walletSdk/interactive */ "./src/walletSdk/interactive/index.ts");
50500
+ Object.defineProperty(exports, "Interactive", ({ enumerable: true, get: function () { return interactive_1.Interactive; } }));
50501
+ Object.defineProperty(exports, "InteractiveResponseType", ({ enumerable: true, get: function () { return interactive_1.InteractiveResponseType; } }));
50502
+ var toml_1 = __webpack_require__(/*! ./walletSdk/toml */ "./src/walletSdk/toml/index.ts");
50503
+ Object.defineProperty(exports, "parseToml", ({ enumerable: true, get: function () { return toml_1.parseToml; } }));
50504
+ var Watcher_1 = __webpack_require__(/*! ./walletSdk/Watcher */ "./src/walletSdk/Watcher/index.ts");
50505
+ Object.defineProperty(exports, "Watcher", ({ enumerable: true, get: function () { return Watcher_1.Watcher; } }));
50506
+ exports.WatcherTypes = __importStar(__webpack_require__(/*! ./walletSdk/Watcher/Types */ "./src/walletSdk/Watcher/Types.ts"));
50495
50507
  exports["default"] = { walletSdk: walletSdk };
50496
50508
 
50497
50509
 
50510
+ /***/ }),
50511
+
50512
+ /***/ "./src/walletSdk/Anchor/Types.ts":
50513
+ /*!***************************************!*\
50514
+ !*** ./src/walletSdk/Anchor/Types.ts ***!
50515
+ \***************************************/
50516
+ /***/ ((__unused_webpack_module, exports) => {
50517
+
50518
+ "use strict";
50519
+
50520
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
50521
+
50522
+
50498
50523
  /***/ }),
50499
50524
 
50500
50525
  /***/ "./src/walletSdk/Anchor/index.ts":
@@ -51419,23 +51444,135 @@ var InvalidTransactionsResponseError = /** @class */ (function (_super) {
51419
51444
  exports.InvalidTransactionsResponseError = InvalidTransactionsResponseError;
51420
51445
 
51421
51446
 
51447
+ /***/ }),
51448
+
51449
+ /***/ "./src/walletSdk/horizon/Account.ts":
51450
+ /*!******************************************!*\
51451
+ !*** ./src/walletSdk/horizon/Account.ts ***!
51452
+ \******************************************/
51453
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
51454
+
51455
+ "use strict";
51456
+
51457
+ var __extends = (this && this.__extends) || (function () {
51458
+ var extendStatics = function (d, b) {
51459
+ extendStatics = Object.setPrototypeOf ||
51460
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
51461
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
51462
+ return extendStatics(d, b);
51463
+ };
51464
+ return function (d, b) {
51465
+ if (typeof b !== "function" && b !== null)
51466
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
51467
+ extendStatics(d, b);
51468
+ function __() { this.constructor = d; }
51469
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
51470
+ };
51471
+ })();
51472
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
51473
+ exports.SigningKeypair = exports.PublicKeypair = void 0;
51474
+ var stellar_sdk_1 = __webpack_require__(/*! stellar-sdk */ "./node_modules/stellar-sdk/lib/index.js");
51475
+ var AccountKeypair = /** @class */ (function () {
51476
+ function AccountKeypair(keypair) {
51477
+ this.keypair = keypair;
51478
+ }
51479
+ Object.defineProperty(AccountKeypair.prototype, "publicKey", {
51480
+ get: function () {
51481
+ return this.keypair.publicKey();
51482
+ },
51483
+ enumerable: false,
51484
+ configurable: true
51485
+ });
51486
+ AccountKeypair.prototype.toString = function () {
51487
+ return "".concat(this.constructor.name, "(address=").concat(this.publicKey, ")");
51488
+ };
51489
+ return AccountKeypair;
51490
+ }());
51491
+ var PublicKeypair = exports.PublicKeypair = /** @class */ (function (_super) {
51492
+ __extends(PublicKeypair, _super);
51493
+ function PublicKeypair(keypair) {
51494
+ return _super.call(this, keypair) || this;
51495
+ }
51496
+ PublicKeypair.fromPublicKey = function (str) {
51497
+ return new PublicKeypair(stellar_sdk_1.Keypair.fromPublicKey(str));
51498
+ };
51499
+ return PublicKeypair;
51500
+ }(AccountKeypair));
51501
+ var SigningKeypair = exports.SigningKeypair = /** @class */ (function (_super) {
51502
+ __extends(SigningKeypair, _super);
51503
+ function SigningKeypair(keypair) {
51504
+ if (!keypair.canSign()) {
51505
+ throw new Error("This keypair doesn't have a private key and can't sign");
51506
+ }
51507
+ return _super.call(this, keypair) || this;
51508
+ }
51509
+ Object.defineProperty(SigningKeypair.prototype, "secretKey", {
51510
+ get: function () {
51511
+ return this.keypair.secret();
51512
+ },
51513
+ enumerable: false,
51514
+ configurable: true
51515
+ });
51516
+ SigningKeypair.prototype.sign = function (transaction) {
51517
+ transaction.sign(this.keypair);
51518
+ return transaction;
51519
+ };
51520
+ SigningKeypair.fromSecret = function (secret) {
51521
+ return new SigningKeypair(stellar_sdk_1.Keypair.fromSecret(secret));
51522
+ };
51523
+ return SigningKeypair;
51524
+ }(AccountKeypair));
51525
+
51526
+
51527
+ /***/ }),
51528
+
51529
+ /***/ "./src/walletSdk/horizon/AccountService.ts":
51530
+ /*!*************************************************!*\
51531
+ !*** ./src/walletSdk/horizon/AccountService.ts ***!
51532
+ \*************************************************/
51533
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
51534
+
51535
+ "use strict";
51536
+
51537
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
51538
+ exports.AccountService = void 0;
51539
+ var stellar_sdk_1 = __webpack_require__(/*! stellar-sdk */ "./node_modules/stellar-sdk/lib/index.js");
51540
+ var Account_1 = __webpack_require__(/*! ./Account */ "./src/walletSdk/horizon/Account.ts");
51541
+ // Do not create this object directly, use the Wallet class.
51542
+ var AccountService = /** @class */ (function () {
51543
+ function AccountService(cfg) {
51544
+ this.server = cfg.stellar.server;
51545
+ this.network = cfg.stellar.network;
51546
+ }
51547
+ AccountService.prototype.createKeypair = function () {
51548
+ return new Account_1.SigningKeypair(stellar_sdk_1.Keypair.random());
51549
+ };
51550
+ return AccountService;
51551
+ }());
51552
+ exports.AccountService = AccountService;
51553
+
51554
+
51422
51555
  /***/ }),
51423
51556
 
51424
51557
  /***/ "./src/walletSdk/horizon/Stellar.ts":
51425
51558
  /*!******************************************!*\
51426
51559
  !*** ./src/walletSdk/horizon/Stellar.ts ***!
51427
51560
  \******************************************/
51428
- /***/ ((__unused_webpack_module, exports) => {
51561
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
51429
51562
 
51430
51563
  "use strict";
51431
51564
 
51432
- // TODO - https://stellarorg.atlassian.net/browse/WAL-814?atlOrigin=eyJpIjoiMWY5MjBkZTE4MTg3NDA3N2E0MjYwMmQ2ZmRhOGFiODUiLCJwIjoiaiJ9
51433
51565
  Object.defineProperty(exports, "__esModule", ({ value: true }));
51434
51566
  exports.Stellar = void 0;
51567
+ var AccountService_1 = __webpack_require__(/*! ./AccountService */ "./src/walletSdk/horizon/AccountService.ts");
51435
51568
  // Do not create this object directly, use the Wallet class.
51436
51569
  var Stellar = /** @class */ (function () {
51437
51570
  function Stellar(cfg) {
51571
+ this.cfg = cfg;
51438
51572
  }
51573
+ Stellar.prototype.account = function () {
51574
+ return new AccountService_1.AccountService(this.cfg);
51575
+ };
51439
51576
  return Stellar;
51440
51577
  }());
51441
51578
  exports.Stellar = Stellar;
@@ -51634,8 +51771,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
51634
51771
  }
51635
51772
  };
51636
51773
  Object.defineProperty(exports, "__esModule", ({ value: true }));
51637
- exports.Interactive = exports.FLOW_TYPE = void 0;
51774
+ exports.Interactive = exports.FLOW_TYPE = exports.InteractiveResponseType = void 0;
51638
51775
  var exception_1 = __webpack_require__(/*! ../exception */ "./src/walletSdk/exception/index.ts");
51776
+ var InteractiveResponseType;
51777
+ (function (InteractiveResponseType) {
51778
+ InteractiveResponseType["authentication_required"] = "authentication_required";
51779
+ InteractiveResponseType["interactive_customer_info_needed"] = "interactive_customer_info_needed";
51780
+ InteractiveResponseType["error"] = "error";
51781
+ })(InteractiveResponseType = exports.InteractiveResponseType || (exports.InteractiveResponseType = {}));
51639
51782
  var FLOW_TYPE;
51640
51783
  (function (FLOW_TYPE) {
51641
51784
  FLOW_TYPE["DEPOSIT"] = "deposit";
@@ -60298,7 +60441,7 @@ module.exports = function availableTypedArrays() {
60298
60441
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
60299
60442
 
60300
60443
  "use strict";
60301
- // Axios v1.4.0 Copyright (c) 2023 Matt Zabriskie and contributors
60444
+ // Axios v1.3.3 Copyright (c) 2023 Matt Zabriskie and contributors
60302
60445
 
60303
60446
 
60304
60447
  function bind(fn, thisArg) {
@@ -60493,16 +60636,12 @@ const isStream = (val) => isObject(val) && isFunction(val.pipe);
60493
60636
  * @returns {boolean} True if value is an FormData, otherwise false
60494
60637
  */
60495
60638
  const isFormData = (thing) => {
60496
- let kind;
60639
+ const pattern = '[object FormData]';
60497
60640
  return thing && (
60498
- (typeof FormData === 'function' && thing instanceof FormData) || (
60499
- isFunction(thing.append) && (
60500
- (kind = kindOf(thing)) === 'formdata' ||
60501
- // detect form-data instance
60502
- (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
60503
- )
60504
- )
60505
- )
60641
+ (typeof FormData === 'function' && thing instanceof FormData) ||
60642
+ toString.call(thing) === pattern ||
60643
+ (isFunction(thing.toString) && thing.toString() === pattern)
60644
+ );
60506
60645
  };
60507
60646
 
60508
60647
  /**
@@ -60967,11 +61106,6 @@ const toJSONObject = (obj) => {
60967
61106
  return visit(obj, 0);
60968
61107
  };
60969
61108
 
60970
- const isAsyncFn = kindOfTest('AsyncFunction');
60971
-
60972
- const isThenable = (thing) =>
60973
- thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
60974
-
60975
61109
  var utils = {
60976
61110
  isArray,
60977
61111
  isArrayBuffer,
@@ -61021,9 +61155,7 @@ var utils = {
61021
61155
  ALPHABET,
61022
61156
  generateString,
61023
61157
  isSpecCompliantForm,
61024
- toJSONObject,
61025
- isAsyncFn,
61026
- isThenable
61158
+ toJSONObject
61027
61159
  };
61028
61160
 
61029
61161
  /**
@@ -61525,8 +61657,6 @@ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams
61525
61657
 
61526
61658
  var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
61527
61659
 
61528
- var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
61529
-
61530
61660
  /**
61531
61661
  * Determine if we're running in a standard browser environment
61532
61662
  *
@@ -61581,7 +61711,7 @@ var platform = {
61581
61711
  classes: {
61582
61712
  URLSearchParams: URLSearchParams$1,
61583
61713
  FormData: FormData$1,
61584
- Blob: Blob$1
61714
+ Blob
61585
61715
  },
61586
61716
  isStandardBrowserEnv,
61587
61717
  isStandardBrowserWebWorkerEnv,
@@ -61923,7 +62053,9 @@ function parseTokens(str) {
61923
62053
  return tokens;
61924
62054
  }
61925
62055
 
61926
- const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
62056
+ function isValidHeaderName(str) {
62057
+ return /^[-_a-zA-Z]+$/.test(str.trim());
62058
+ }
61927
62059
 
61928
62060
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
61929
62061
  if (utils.isFunction(filter)) {
@@ -62511,12 +62643,8 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
62511
62643
  }
62512
62644
  }
62513
62645
 
62514
- if (utils.isFormData(requestData)) {
62515
- if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
62516
- requestHeaders.setContentType(false); // Let the browser set it
62517
- } else {
62518
- requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
62519
- }
62646
+ if (utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv)) {
62647
+ requestHeaders.setContentType(false); // Let the browser set it
62520
62648
  }
62521
62649
 
62522
62650
  let request = new XMLHttpRequest();
@@ -62922,7 +63050,7 @@ function mergeConfig(config1, config2) {
62922
63050
  headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
62923
63051
  };
62924
63052
 
62925
- utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
63053
+ utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
62926
63054
  const merge = mergeMap[prop] || mergeDeepProperties;
62927
63055
  const configValue = merge(config1[prop], config2[prop], prop);
62928
63056
  (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
@@ -62931,7 +63059,7 @@ function mergeConfig(config1, config2) {
62931
63059
  return config;
62932
63060
  }
62933
63061
 
62934
- const VERSION = "1.4.0";
63062
+ const VERSION = "1.3.3";
62935
63063
 
62936
63064
  const validators$1 = {};
62937
63065
 
@@ -63068,17 +63196,11 @@ class Axios {
63068
63196
  }, false);
63069
63197
  }
63070
63198
 
63071
- if (paramsSerializer != null) {
63072
- if (utils.isFunction(paramsSerializer)) {
63073
- config.paramsSerializer = {
63074
- serialize: paramsSerializer
63075
- };
63076
- } else {
63077
- validator.assertOptions(paramsSerializer, {
63078
- encode: validators.function,
63079
- serialize: validators.function
63080
- }, true);
63081
- }
63199
+ if (paramsSerializer !== undefined) {
63200
+ validator.assertOptions(paramsSerializer, {
63201
+ encode: validators.function,
63202
+ serialize: validators.function
63203
+ }, true);
63082
63204
  }
63083
63205
 
63084
63206
  // Set config.method
@@ -63530,7 +63652,7 @@ module.exports = JSON.parse('{"name":"stellar-sdk","version":"10.4.1","descripti
63530
63652
  /***/ ((module) => {
63531
63653
 
63532
63654
  "use strict";
63533
- module.exports = JSON.parse('{"name":"@stellar/typescript-wallet-sdk","version":"1.1.0-alpha.0","engines":{"node":">=18"},"main":"./lib/bundle.js","types":"./lib/index.d.ts","license":"Apache-2.0","private":false,"devDependencies":{"@babel/preset-env":"^7.20.2","@stellar/eslint-config":"^2.1.2","@stellar/prettier-config":"^1.0.1","@stellar/tsconfig":"^1.0.2","@types/jest":"^29.4.0","@types/lodash":"^4.14.194","@types/sinon":"^10.0.15","babel-jest":"^29.4.1","eslint":"^8.33.0","jest":"^29.4.1","sinon":"^15.1.0","ts-jest":"^29.0.5","ts-loader":"^9.4.2","tslib":"^2.5.0","typescript":"^5.0.4","webpack":"^5.83.1","webpack-cli":"^5.1.1"},"dependencies":{"axios":"^1.4.0","https-browserify":"^1.0.0","lodash":"^4.17.21","query-string":"^7.1.3","stellar-sdk":"^10.4.1","stream-http":"^3.2.0","url":"^0.11.0","util":"^0.12.5"},"scripts":{"prepare":"yarn build","test":"jest --watchAll","build":"webpack --config webpack.config.js"}}');
63655
+ module.exports = JSON.parse('{"name":"@stellar/typescript-wallet-sdk","version":"1.1.0-alpha.2","engines":{"node":">=18"},"main":"./lib/bundle.js","types":"./lib/index.d.ts","license":"Apache-2.0","private":false,"devDependencies":{"@babel/preset-env":"^7.20.2","@stellar/eslint-config":"^2.1.2","@stellar/prettier-config":"^1.0.1","@stellar/tsconfig":"^1.0.2","@types/jest":"^29.4.0","@types/lodash":"^4.14.194","@types/sinon":"^10.0.15","babel-jest":"^29.4.1","eslint":"^8.33.0","jest":"^29.4.1","sinon":"^15.1.0","ts-jest":"^29.0.5","ts-loader":"^9.4.2","tslib":"^2.5.0","typescript":"^5.0.4","webpack":"^5.83.1","webpack-cli":"^5.1.1"},"dependencies":{"axios":"^1.4.0","https-browserify":"^1.0.0","lodash":"^4.17.21","query-string":"^7.1.3","stellar-sdk":"^10.4.1","stream-http":"^3.2.0","url":"^0.11.0","util":"^0.12.5","utility-types":"^3.10.0"},"scripts":{"prepare":"yarn build","test":"jest --watchAll","build":"webpack --config webpack.config.js"}}');
63534
63656
 
63535
63657
  /***/ })
63536
63658