@stellar/typescript-wallet-sdk 1.1.1 → 1.1.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/README.md +32 -18
- package/lib/bundle.js +10 -56
- package/lib/bundle.js.map +1 -1
- package/lib/bundle_browser.js +10 -56
- package/lib/bundle_browser.js.map +1 -1
- package/package.json +1 -1
- package/src/walletSdk/Watcher/index.ts +9 -8
- package/test/wallet.test.ts +131 -16
package/README.md
CHANGED
|
@@ -1,30 +1,44 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Stellar Typescript Wallet SDK [](https://badge.fury.io/js/@stellar%2Ftypescript-wallet-sdk)
|
|
2
2
|
|
|
3
|
-
Typescript Wallet SDK to build Stellar
|
|
3
|
+
Typescript Wallet SDK is a library that allows developers to build wallet applications on the Stellar network faster. It
|
|
4
|
+
utilizes [Javascript Stellar SDK](https://github.com/stellar/js-stellar-sdk) to communicate with a Stellar Horizon server.
|
|
5
|
+
It offers wide range of functionality to simplify integration with the Stellar network, and connect to the anchors easily, utilizing
|
|
6
|
+
various Stellar protocols (SEPs)
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
## Dependency
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
The library is available via npm.
|
|
11
|
+
To import `typescript-wallet-sdk` library you need to add it as a dependency to your code:
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
// build wallet sdk
|
|
11
|
-
cd typescript-wallet-sdk
|
|
12
|
-
yarn
|
|
13
|
-
yarn run build
|
|
13
|
+
yarn:
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
```shell
|
|
16
|
+
yarn add @stellar/typescript-wallet-sdk
|
|
17
|
+
```
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
cd my-wallet
|
|
20
|
-
npm link @stellar/typescript-wallet-sdk
|
|
19
|
+
npm:
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
```shell
|
|
22
|
+
npm install @stellar/typescript-wallet-sdk
|
|
24
23
|
```
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
## Introduction
|
|
27
26
|
|
|
27
|
+
Here's a small example creating main wallet class with default configuration connected to testnet network:
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
let wallet = walletSdk.Wallet.TestNet();
|
|
28
31
|
```
|
|
29
|
-
|
|
32
|
+
|
|
33
|
+
It should later be re-used across the code, as it has access to various useful children classes. For example, you can
|
|
34
|
+
authenticate with the `testanchor` as simple as:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
const authKey = SigningKeypair.fromSecret("my secret key");
|
|
38
|
+
const anchor = wallet.anchor({ homeDomain: "testanchor.stellar.org" });
|
|
39
|
+
const sep10 = await anchor.sep10();
|
|
40
|
+
|
|
41
|
+
const authToken = await sep10.authenticate({accountKp: authKey});
|
|
30
42
|
```
|
|
43
|
+
|
|
44
|
+
Read [full wallet guide](https://developers.stellar.org/docs/category/build-a-wallet) for more info
|
package/lib/bundle.js
CHANGED
|
@@ -18918,51 +18918,6 @@ function isEmpty(value) {
|
|
|
18918
18918
|
module.exports = isEmpty;
|
|
18919
18919
|
|
|
18920
18920
|
|
|
18921
|
-
/***/ }),
|
|
18922
|
-
|
|
18923
|
-
/***/ "./node_modules/lodash/isEqual.js":
|
|
18924
|
-
/*!****************************************!*\
|
|
18925
|
-
!*** ./node_modules/lodash/isEqual.js ***!
|
|
18926
|
-
\****************************************/
|
|
18927
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
18928
|
-
|
|
18929
|
-
var baseIsEqual = __webpack_require__(/*! ./_baseIsEqual */ "./node_modules/lodash/_baseIsEqual.js");
|
|
18930
|
-
|
|
18931
|
-
/**
|
|
18932
|
-
* Performs a deep comparison between two values to determine if they are
|
|
18933
|
-
* equivalent.
|
|
18934
|
-
*
|
|
18935
|
-
* **Note:** This method supports comparing arrays, array buffers, booleans,
|
|
18936
|
-
* date objects, error objects, maps, numbers, `Object` objects, regexes,
|
|
18937
|
-
* sets, strings, symbols, and typed arrays. `Object` objects are compared
|
|
18938
|
-
* by their own, not inherited, enumerable properties. Functions and DOM
|
|
18939
|
-
* nodes are compared by strict equality, i.e. `===`.
|
|
18940
|
-
*
|
|
18941
|
-
* @static
|
|
18942
|
-
* @memberOf _
|
|
18943
|
-
* @since 0.1.0
|
|
18944
|
-
* @category Lang
|
|
18945
|
-
* @param {*} value The value to compare.
|
|
18946
|
-
* @param {*} other The other value to compare.
|
|
18947
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
18948
|
-
* @example
|
|
18949
|
-
*
|
|
18950
|
-
* var object = { 'a': 1 };
|
|
18951
|
-
* var other = { 'a': 1 };
|
|
18952
|
-
*
|
|
18953
|
-
* _.isEqual(object, other);
|
|
18954
|
-
* // => true
|
|
18955
|
-
*
|
|
18956
|
-
* object === other;
|
|
18957
|
-
* // => false
|
|
18958
|
-
*/
|
|
18959
|
-
function isEqual(value, other) {
|
|
18960
|
-
return baseIsEqual(value, other);
|
|
18961
|
-
}
|
|
18962
|
-
|
|
18963
|
-
module.exports = isEqual;
|
|
18964
|
-
|
|
18965
|
-
|
|
18966
18921
|
/***/ }),
|
|
18967
18922
|
|
|
18968
18923
|
/***/ "./node_modules/lodash/isFinite.js":
|
|
@@ -49115,12 +49070,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
49115
49070
|
};
|
|
49116
49071
|
return __assign.apply(this, arguments);
|
|
49117
49072
|
};
|
|
49118
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
49119
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49120
|
-
};
|
|
49121
49073
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
49122
49074
|
exports.Watcher = void 0;
|
|
49123
|
-
var isEqual_1 = __importDefault(__webpack_require__(/*! lodash/isEqual */ "./node_modules/lodash/isEqual.js"));
|
|
49124
49075
|
var Types_1 = __webpack_require__(/*! ../Types */ "./src/walletSdk/Types/index.ts");
|
|
49125
49076
|
// Do not create this object directly, use the Anchor class.
|
|
49126
49077
|
var Watcher = /** @class */ (function () {
|
|
@@ -49209,9 +49160,9 @@ var Watcher = /** @class */ (function () {
|
|
|
49209
49160
|
}
|
|
49210
49161
|
return isInProgress;
|
|
49211
49162
|
}
|
|
49212
|
-
// if we've had the transaction before, only report updates
|
|
49163
|
+
// if we've had the transaction before, only report updates if status changed
|
|
49213
49164
|
if (registeredTransaction) {
|
|
49214
|
-
return
|
|
49165
|
+
return registeredTransaction.status !== transaction.status;
|
|
49215
49166
|
}
|
|
49216
49167
|
// if it's NOT a registered transaction, and it's not the first
|
|
49217
49168
|
// roll, maybe it's a new transaction that achieved a final
|
|
@@ -49323,10 +49274,11 @@ var Watcher = /** @class */ (function () {
|
|
|
49323
49274
|
return;
|
|
49324
49275
|
}
|
|
49325
49276
|
var registeredTransaction = _this._transactionsRegistry[assetCode][transaction.id];
|
|
49326
|
-
// if we've had the transaction before, only report if there is a change
|
|
49277
|
+
// if we've had the transaction before, only report if there is a status change
|
|
49278
|
+
var isChanged = true;
|
|
49327
49279
|
if (registeredTransaction &&
|
|
49328
|
-
|
|
49329
|
-
|
|
49280
|
+
registeredTransaction.status === transaction.status) {
|
|
49281
|
+
isChanged = false;
|
|
49330
49282
|
}
|
|
49331
49283
|
_this._transactionsRegistry[assetCode][transaction.id] = transaction;
|
|
49332
49284
|
if (transaction.status.indexOf("pending") === 0 ||
|
|
@@ -49337,7 +49289,9 @@ var Watcher = /** @class */ (function () {
|
|
|
49337
49289
|
_this._oneTransactionWatcher[assetCode][id] = setTimeout(function () {
|
|
49338
49290
|
_this.watchOneTransaction(__assign(__assign({}, allParams), { isRetry: true }));
|
|
49339
49291
|
}, timeout);
|
|
49340
|
-
|
|
49292
|
+
if (isChanged) {
|
|
49293
|
+
onMessage(transaction);
|
|
49294
|
+
}
|
|
49341
49295
|
}
|
|
49342
49296
|
else if ([
|
|
49343
49297
|
Types_1.TransactionStatus.completed,
|
|
@@ -60223,7 +60177,7 @@ module.exports = JSON.parse('{"name":"stellar-sdk","version":"10.4.1","descripti
|
|
|
60223
60177
|
/***/ ((module) => {
|
|
60224
60178
|
|
|
60225
60179
|
"use strict";
|
|
60226
|
-
module.exports = JSON.parse('{"name":"@stellar/typescript-wallet-sdk","version":"1.1.
|
|
60180
|
+
module.exports = JSON.parse('{"name":"@stellar/typescript-wallet-sdk","version":"1.1.2","engines":{"node":">=18"},"browser":"./lib/bundle_browser.js","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","crypto-browserify":"^3.12.0","eslint":"^8.33.0","husky":"^8.0.0","jest":"^29.4.1","npm-run-all":"^4.1.5","prettier":"^2.0.5","pretty-quick":"^2.0.1","sinon":"^15.1.0","stream-browserify":"^3.0.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","jws":"^4.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:web":"webpack --config webpack.config.js","build:node":"webpack --env NODE=true --config webpack.config.js","build":"run-p build:web build:node"}}');
|
|
60227
60181
|
|
|
60228
60182
|
/***/ })
|
|
60229
60183
|
|