@stellar/typescript-wallet-sdk 1.1.0-alpha.0 → 1.1.0-alpha.1
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 +135 -44
- package/lib/bundle.js.map +1 -1
- package/lib/walletSdk/anchor/Types.d.ts +76 -0
- package/lib/walletSdk/anchor/index.d.ts +6 -5
- package/lib/walletSdk/horizon/Account.d.ts +20 -0
- package/lib/walletSdk/horizon/AccountService.d.ts +8 -0
- package/lib/walletSdk/horizon/Stellar.d.ts +5 -1
- package/lib/walletSdk/util/sleep.d.ts +1 -0
- package/package.json +3 -2
- package/src/walletSdk/Anchor/Types.ts +79 -0
- package/src/walletSdk/Anchor/index.ts +17 -9
- package/src/walletSdk/horizon/Account.ts +52 -0
- package/src/walletSdk/horizon/AccountService.ts +19 -0
- package/src/walletSdk/horizon/Stellar.ts +10 -2
- package/test/account.test.ts +36 -0
- /package/test/{index.test.ts → wallet.test.ts} +0 -0
package/lib/bundle.js
CHANGED
|
@@ -51419,23 +51419,135 @@ var InvalidTransactionsResponseError = /** @class */ (function (_super) {
|
|
|
51419
51419
|
exports.InvalidTransactionsResponseError = InvalidTransactionsResponseError;
|
|
51420
51420
|
|
|
51421
51421
|
|
|
51422
|
+
/***/ }),
|
|
51423
|
+
|
|
51424
|
+
/***/ "./src/walletSdk/horizon/Account.ts":
|
|
51425
|
+
/*!******************************************!*\
|
|
51426
|
+
!*** ./src/walletSdk/horizon/Account.ts ***!
|
|
51427
|
+
\******************************************/
|
|
51428
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
51429
|
+
|
|
51430
|
+
"use strict";
|
|
51431
|
+
|
|
51432
|
+
var __extends = (this && this.__extends) || (function () {
|
|
51433
|
+
var extendStatics = function (d, b) {
|
|
51434
|
+
extendStatics = Object.setPrototypeOf ||
|
|
51435
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
51436
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
51437
|
+
return extendStatics(d, b);
|
|
51438
|
+
};
|
|
51439
|
+
return function (d, b) {
|
|
51440
|
+
if (typeof b !== "function" && b !== null)
|
|
51441
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
51442
|
+
extendStatics(d, b);
|
|
51443
|
+
function __() { this.constructor = d; }
|
|
51444
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
51445
|
+
};
|
|
51446
|
+
})();
|
|
51447
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
51448
|
+
exports.SigningKeypair = exports.PublicKeypair = void 0;
|
|
51449
|
+
var stellar_sdk_1 = __webpack_require__(/*! stellar-sdk */ "./node_modules/stellar-sdk/lib/index.js");
|
|
51450
|
+
var AccountKeypair = /** @class */ (function () {
|
|
51451
|
+
function AccountKeypair(keypair) {
|
|
51452
|
+
this.keypair = keypair;
|
|
51453
|
+
}
|
|
51454
|
+
Object.defineProperty(AccountKeypair.prototype, "publicKey", {
|
|
51455
|
+
get: function () {
|
|
51456
|
+
return this.keypair.publicKey();
|
|
51457
|
+
},
|
|
51458
|
+
enumerable: false,
|
|
51459
|
+
configurable: true
|
|
51460
|
+
});
|
|
51461
|
+
AccountKeypair.prototype.toString = function () {
|
|
51462
|
+
return "".concat(this.constructor.name, "(address=").concat(this.publicKey, ")");
|
|
51463
|
+
};
|
|
51464
|
+
return AccountKeypair;
|
|
51465
|
+
}());
|
|
51466
|
+
var PublicKeypair = exports.PublicKeypair = /** @class */ (function (_super) {
|
|
51467
|
+
__extends(PublicKeypair, _super);
|
|
51468
|
+
function PublicKeypair(keypair) {
|
|
51469
|
+
return _super.call(this, keypair) || this;
|
|
51470
|
+
}
|
|
51471
|
+
PublicKeypair.fromPublicKey = function (str) {
|
|
51472
|
+
return new PublicKeypair(stellar_sdk_1.Keypair.fromPublicKey(str));
|
|
51473
|
+
};
|
|
51474
|
+
return PublicKeypair;
|
|
51475
|
+
}(AccountKeypair));
|
|
51476
|
+
var SigningKeypair = exports.SigningKeypair = /** @class */ (function (_super) {
|
|
51477
|
+
__extends(SigningKeypair, _super);
|
|
51478
|
+
function SigningKeypair(keypair) {
|
|
51479
|
+
if (!keypair.canSign()) {
|
|
51480
|
+
throw new Error("This keypair doesn't have a private key and can't sign");
|
|
51481
|
+
}
|
|
51482
|
+
return _super.call(this, keypair) || this;
|
|
51483
|
+
}
|
|
51484
|
+
Object.defineProperty(SigningKeypair.prototype, "secretKey", {
|
|
51485
|
+
get: function () {
|
|
51486
|
+
return this.keypair.secret();
|
|
51487
|
+
},
|
|
51488
|
+
enumerable: false,
|
|
51489
|
+
configurable: true
|
|
51490
|
+
});
|
|
51491
|
+
SigningKeypair.prototype.sign = function (transaction) {
|
|
51492
|
+
transaction.sign(this.keypair);
|
|
51493
|
+
return transaction;
|
|
51494
|
+
};
|
|
51495
|
+
SigningKeypair.fromSecret = function (secret) {
|
|
51496
|
+
return new SigningKeypair(stellar_sdk_1.Keypair.fromSecret(secret));
|
|
51497
|
+
};
|
|
51498
|
+
return SigningKeypair;
|
|
51499
|
+
}(AccountKeypair));
|
|
51500
|
+
|
|
51501
|
+
|
|
51502
|
+
/***/ }),
|
|
51503
|
+
|
|
51504
|
+
/***/ "./src/walletSdk/horizon/AccountService.ts":
|
|
51505
|
+
/*!*************************************************!*\
|
|
51506
|
+
!*** ./src/walletSdk/horizon/AccountService.ts ***!
|
|
51507
|
+
\*************************************************/
|
|
51508
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
51509
|
+
|
|
51510
|
+
"use strict";
|
|
51511
|
+
|
|
51512
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
51513
|
+
exports.AccountService = void 0;
|
|
51514
|
+
var stellar_sdk_1 = __webpack_require__(/*! stellar-sdk */ "./node_modules/stellar-sdk/lib/index.js");
|
|
51515
|
+
var Account_1 = __webpack_require__(/*! ./Account */ "./src/walletSdk/horizon/Account.ts");
|
|
51516
|
+
// Do not create this object directly, use the Wallet class.
|
|
51517
|
+
var AccountService = /** @class */ (function () {
|
|
51518
|
+
function AccountService(cfg) {
|
|
51519
|
+
this.server = cfg.stellar.server;
|
|
51520
|
+
this.network = cfg.stellar.network;
|
|
51521
|
+
}
|
|
51522
|
+
AccountService.prototype.createKeypair = function () {
|
|
51523
|
+
return new Account_1.SigningKeypair(stellar_sdk_1.Keypair.random());
|
|
51524
|
+
};
|
|
51525
|
+
return AccountService;
|
|
51526
|
+
}());
|
|
51527
|
+
exports.AccountService = AccountService;
|
|
51528
|
+
|
|
51529
|
+
|
|
51422
51530
|
/***/ }),
|
|
51423
51531
|
|
|
51424
51532
|
/***/ "./src/walletSdk/horizon/Stellar.ts":
|
|
51425
51533
|
/*!******************************************!*\
|
|
51426
51534
|
!*** ./src/walletSdk/horizon/Stellar.ts ***!
|
|
51427
51535
|
\******************************************/
|
|
51428
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
51536
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
51429
51537
|
|
|
51430
51538
|
"use strict";
|
|
51431
51539
|
|
|
51432
|
-
// TODO - https://stellarorg.atlassian.net/browse/WAL-814?atlOrigin=eyJpIjoiMWY5MjBkZTE4MTg3NDA3N2E0MjYwMmQ2ZmRhOGFiODUiLCJwIjoiaiJ9
|
|
51433
51540
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
51434
51541
|
exports.Stellar = void 0;
|
|
51542
|
+
var AccountService_1 = __webpack_require__(/*! ./AccountService */ "./src/walletSdk/horizon/AccountService.ts");
|
|
51435
51543
|
// Do not create this object directly, use the Wallet class.
|
|
51436
51544
|
var Stellar = /** @class */ (function () {
|
|
51437
51545
|
function Stellar(cfg) {
|
|
51546
|
+
this.cfg = cfg;
|
|
51438
51547
|
}
|
|
51548
|
+
Stellar.prototype.account = function () {
|
|
51549
|
+
return new AccountService_1.AccountService(this.cfg);
|
|
51550
|
+
};
|
|
51439
51551
|
return Stellar;
|
|
51440
51552
|
}());
|
|
51441
51553
|
exports.Stellar = Stellar;
|
|
@@ -60298,7 +60410,7 @@ module.exports = function availableTypedArrays() {
|
|
|
60298
60410
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
60299
60411
|
|
|
60300
60412
|
"use strict";
|
|
60301
|
-
// Axios v1.
|
|
60413
|
+
// Axios v1.3.3 Copyright (c) 2023 Matt Zabriskie and contributors
|
|
60302
60414
|
|
|
60303
60415
|
|
|
60304
60416
|
function bind(fn, thisArg) {
|
|
@@ -60493,16 +60605,12 @@ const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
|
60493
60605
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
60494
60606
|
*/
|
|
60495
60607
|
const isFormData = (thing) => {
|
|
60496
|
-
|
|
60608
|
+
const pattern = '[object FormData]';
|
|
60497
60609
|
return thing && (
|
|
60498
|
-
(typeof FormData === 'function' && thing instanceof FormData) ||
|
|
60499
|
-
|
|
60500
|
-
|
|
60501
|
-
|
|
60502
|
-
(kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
|
|
60503
|
-
)
|
|
60504
|
-
)
|
|
60505
|
-
)
|
|
60610
|
+
(typeof FormData === 'function' && thing instanceof FormData) ||
|
|
60611
|
+
toString.call(thing) === pattern ||
|
|
60612
|
+
(isFunction(thing.toString) && thing.toString() === pattern)
|
|
60613
|
+
);
|
|
60506
60614
|
};
|
|
60507
60615
|
|
|
60508
60616
|
/**
|
|
@@ -60967,11 +61075,6 @@ const toJSONObject = (obj) => {
|
|
|
60967
61075
|
return visit(obj, 0);
|
|
60968
61076
|
};
|
|
60969
61077
|
|
|
60970
|
-
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
60971
|
-
|
|
60972
|
-
const isThenable = (thing) =>
|
|
60973
|
-
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
60974
|
-
|
|
60975
61078
|
var utils = {
|
|
60976
61079
|
isArray,
|
|
60977
61080
|
isArrayBuffer,
|
|
@@ -61021,9 +61124,7 @@ var utils = {
|
|
|
61021
61124
|
ALPHABET,
|
|
61022
61125
|
generateString,
|
|
61023
61126
|
isSpecCompliantForm,
|
|
61024
|
-
toJSONObject
|
|
61025
|
-
isAsyncFn,
|
|
61026
|
-
isThenable
|
|
61127
|
+
toJSONObject
|
|
61027
61128
|
};
|
|
61028
61129
|
|
|
61029
61130
|
/**
|
|
@@ -61525,8 +61626,6 @@ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams
|
|
|
61525
61626
|
|
|
61526
61627
|
var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
|
|
61527
61628
|
|
|
61528
|
-
var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
|
|
61529
|
-
|
|
61530
61629
|
/**
|
|
61531
61630
|
* Determine if we're running in a standard browser environment
|
|
61532
61631
|
*
|
|
@@ -61581,7 +61680,7 @@ var platform = {
|
|
|
61581
61680
|
classes: {
|
|
61582
61681
|
URLSearchParams: URLSearchParams$1,
|
|
61583
61682
|
FormData: FormData$1,
|
|
61584
|
-
Blob
|
|
61683
|
+
Blob
|
|
61585
61684
|
},
|
|
61586
61685
|
isStandardBrowserEnv,
|
|
61587
61686
|
isStandardBrowserWebWorkerEnv,
|
|
@@ -61923,7 +62022,9 @@ function parseTokens(str) {
|
|
|
61923
62022
|
return tokens;
|
|
61924
62023
|
}
|
|
61925
62024
|
|
|
61926
|
-
|
|
62025
|
+
function isValidHeaderName(str) {
|
|
62026
|
+
return /^[-_a-zA-Z]+$/.test(str.trim());
|
|
62027
|
+
}
|
|
61927
62028
|
|
|
61928
62029
|
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
61929
62030
|
if (utils.isFunction(filter)) {
|
|
@@ -62511,12 +62612,8 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
62511
62612
|
}
|
|
62512
62613
|
}
|
|
62513
62614
|
|
|
62514
|
-
if (utils.isFormData(requestData)) {
|
|
62515
|
-
|
|
62516
|
-
requestHeaders.setContentType(false); // Let the browser set it
|
|
62517
|
-
} else {
|
|
62518
|
-
requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
|
|
62519
|
-
}
|
|
62615
|
+
if (utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv)) {
|
|
62616
|
+
requestHeaders.setContentType(false); // Let the browser set it
|
|
62520
62617
|
}
|
|
62521
62618
|
|
|
62522
62619
|
let request = new XMLHttpRequest();
|
|
@@ -62922,7 +63019,7 @@ function mergeConfig(config1, config2) {
|
|
|
62922
63019
|
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
62923
63020
|
};
|
|
62924
63021
|
|
|
62925
|
-
utils.forEach(Object.keys(Object.
|
|
63022
|
+
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
|
62926
63023
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
62927
63024
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
62928
63025
|
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
@@ -62931,7 +63028,7 @@ function mergeConfig(config1, config2) {
|
|
|
62931
63028
|
return config;
|
|
62932
63029
|
}
|
|
62933
63030
|
|
|
62934
|
-
const VERSION = "1.
|
|
63031
|
+
const VERSION = "1.3.3";
|
|
62935
63032
|
|
|
62936
63033
|
const validators$1 = {};
|
|
62937
63034
|
|
|
@@ -63068,17 +63165,11 @@ class Axios {
|
|
|
63068
63165
|
}, false);
|
|
63069
63166
|
}
|
|
63070
63167
|
|
|
63071
|
-
if (paramsSerializer
|
|
63072
|
-
|
|
63073
|
-
|
|
63074
|
-
|
|
63075
|
-
|
|
63076
|
-
} else {
|
|
63077
|
-
validator.assertOptions(paramsSerializer, {
|
|
63078
|
-
encode: validators.function,
|
|
63079
|
-
serialize: validators.function
|
|
63080
|
-
}, true);
|
|
63081
|
-
}
|
|
63168
|
+
if (paramsSerializer !== undefined) {
|
|
63169
|
+
validator.assertOptions(paramsSerializer, {
|
|
63170
|
+
encode: validators.function,
|
|
63171
|
+
serialize: validators.function
|
|
63172
|
+
}, true);
|
|
63082
63173
|
}
|
|
63083
63174
|
|
|
63084
63175
|
// Set config.method
|
|
@@ -63530,7 +63621,7 @@ module.exports = JSON.parse('{"name":"stellar-sdk","version":"10.4.1","descripti
|
|
|
63530
63621
|
/***/ ((module) => {
|
|
63531
63622
|
|
|
63532
63623
|
"use strict";
|
|
63533
|
-
module.exports = JSON.parse('{"name":"@stellar/typescript-wallet-sdk","version":"1.1.0-alpha.
|
|
63624
|
+
module.exports = JSON.parse('{"name":"@stellar/typescript-wallet-sdk","version":"1.1.0-alpha.1","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
63625
|
|
|
63535
63626
|
/***/ })
|
|
63536
63627
|
|