wallaby-cash 1.7.1 → 1.7.4
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/dist/index.cjs.js +18 -37
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +18 -37
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +18 -37
- package/dist/index.js.map +1 -1
- package/dist/lib/wallet/index.d.ts +4 -1
- package/dist/routes/transactions.d.ts +2 -11
- package/dist/routes/wallet.d.ts +0 -5
- package/dist/tests/helpers.spec.d.ts +1 -0
- package/dist/types/common.d.ts +18 -18
- package/dist/types/wallet.d.ts +5 -0
- package/package.json +8 -19
package/dist/index.cjs.js
CHANGED
|
@@ -4479,7 +4479,7 @@ var _a;
|
|
|
4479
4479
|
* The default environment will be set to NODE_ENV if environment is not set in config.
|
|
4480
4480
|
* For production builds, it is recommended to set NODE_ENV to 'production'.
|
|
4481
4481
|
*/
|
|
4482
|
-
var defaultEnvironment = (_a = browser$1$1.env.NODE_ENV) !== null && _a !== void 0 ? _a : '
|
|
4482
|
+
var defaultEnvironment = (_a = browser$1$1.env.NODE_ENV) !== null && _a !== void 0 ? _a : 'production';
|
|
4483
4483
|
/**
|
|
4484
4484
|
* The default network is set to 'testnet' for protection during development.
|
|
4485
4485
|
* Please pass the network value in the WallabyConfigOptions object to override it for production-mainnet.
|
|
@@ -4806,8 +4806,6 @@ var StorageService = /** @class */ (function () {
|
|
|
4806
4806
|
switch (_a.label) {
|
|
4807
4807
|
case 0:
|
|
4808
4808
|
_a.trys.push([0, 2, , 3]);
|
|
4809
|
-
console.log('setAccessTokenKey and payload', "".concat(this.environment, "-access-token-").concat(this.userId, ": ").concat(accessToken));
|
|
4810
|
-
console.log('localStorage type', { type: typeof this.deviceStorage, storage: this.deviceStorage });
|
|
4811
4809
|
return [4 /*yield*/, this.setItem("".concat(this.environment, "-access-token-").concat(this.userId), accessToken)];
|
|
4812
4810
|
case 1:
|
|
4813
4811
|
_a.sent();
|
|
@@ -4922,7 +4920,6 @@ var StorageService = /** @class */ (function () {
|
|
|
4922
4920
|
return StorageService;
|
|
4923
4921
|
}());
|
|
4924
4922
|
|
|
4925
|
-
/* eslint-disable no-prototype-builtins */
|
|
4926
4923
|
/**
|
|
4927
4924
|
* Converts an object to query parameters string.
|
|
4928
4925
|
*
|
|
@@ -4931,11 +4928,11 @@ var StorageService = /** @class */ (function () {
|
|
|
4931
4928
|
*/
|
|
4932
4929
|
function objectToQueryParams(obj) {
|
|
4933
4930
|
var params = new URLSearchParams();
|
|
4934
|
-
|
|
4935
|
-
if (obj
|
|
4931
|
+
Object.keys(obj).forEach(function (key) {
|
|
4932
|
+
if (obj[key] !== null && obj[key] !== undefined && obj[key] !== '') {
|
|
4936
4933
|
params.append(key, obj[key]);
|
|
4937
4934
|
}
|
|
4938
|
-
}
|
|
4935
|
+
});
|
|
4939
4936
|
return params.toString();
|
|
4940
4937
|
}
|
|
4941
4938
|
|
|
@@ -5189,12 +5186,6 @@ var WalletRoutes = {
|
|
|
5189
5186
|
method: exports.RequestMethod.Post,
|
|
5190
5187
|
requiresAccessToken: false,
|
|
5191
5188
|
},
|
|
5192
|
-
// TODO Move this to transactions module
|
|
5193
|
-
estimateFee: {
|
|
5194
|
-
fullPath: '/transactions/estimate-fee',
|
|
5195
|
-
method: exports.RequestMethod.Get,
|
|
5196
|
-
requiresAccessToken: true,
|
|
5197
|
-
},
|
|
5198
5189
|
getWalletAssets: {
|
|
5199
5190
|
fullPath: function (_a) {
|
|
5200
5191
|
var walletId = _a.walletId;
|
|
@@ -5469,16 +5460,16 @@ var Auth = /** @class */ (function (_super) {
|
|
|
5469
5460
|
*/
|
|
5470
5461
|
Auth.prototype.signIn = function (_a) {
|
|
5471
5462
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
5472
|
-
var signatureMessage, message, signature, clientAuthPubKey, response, accessToken, user,
|
|
5463
|
+
var signatureMessage, message, signature, clientAuthPubKey, decryptedClientAuthPrivKey, response, accessToken, user, error_3;
|
|
5473
5464
|
var password = _b.password;
|
|
5474
5465
|
return __generator(this, function (_c) {
|
|
5475
5466
|
switch (_c.label) {
|
|
5476
5467
|
case 0:
|
|
5477
|
-
_c.trys.push([0,
|
|
5468
|
+
_c.trys.push([0, 3, , 4]);
|
|
5478
5469
|
return [4 /*yield*/, this.signatureMessage({ password: password })];
|
|
5479
5470
|
case 1:
|
|
5480
5471
|
signatureMessage = _c.sent();
|
|
5481
|
-
message = signatureMessage.message, signature = signatureMessage.signature, clientAuthPubKey = signatureMessage.clientAuthPubKey;
|
|
5472
|
+
message = signatureMessage.message, signature = signatureMessage.signature, clientAuthPubKey = signatureMessage.clientAuthPubKey, decryptedClientAuthPrivKey = signatureMessage.decryptedClientAuthPrivKey;
|
|
5482
5473
|
return [4 /*yield*/, this.request(AuthRoutes.signIn, {
|
|
5483
5474
|
method: AuthRoutes.signUp.method,
|
|
5484
5475
|
payload: { clientAuthPubKey: clientAuthPubKey, signature: signature, message: message },
|
|
@@ -5489,22 +5480,15 @@ var Auth = /** @class */ (function (_super) {
|
|
|
5489
5480
|
throw new Error(response.error);
|
|
5490
5481
|
}
|
|
5491
5482
|
accessToken = response.accessToken, user = response.user;
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
wallabyAuthPubKey = _c.sent();
|
|
5495
|
-
if (wallabyAuthPubKey !== user.wallabyAuthPubKey) {
|
|
5496
|
-
throw new Error('Wallaby Auth Public Key does not match the one stored in local storage');
|
|
5497
|
-
}
|
|
5498
|
-
if (!wallabyAuthPubKey) {
|
|
5499
|
-
this.storageService.setWallabyAuthPubKey(user.wallabyAuthPubKey);
|
|
5500
|
-
}
|
|
5483
|
+
this.storageService.setWallabyAuthPubKey(user.wallabyAuthPubKey);
|
|
5484
|
+
this.storageService.setEncryptedPrivateKey(decryptedClientAuthPrivKey, password);
|
|
5501
5485
|
this.storageService.setAccessToken(accessToken);
|
|
5502
5486
|
return [2 /*return*/, response];
|
|
5503
|
-
case
|
|
5487
|
+
case 3:
|
|
5504
5488
|
error_3 = _c.sent();
|
|
5505
5489
|
logger('SDK::Auth::signIn::error', error_3);
|
|
5506
5490
|
return [2 /*return*/, Promise.reject(error_3)];
|
|
5507
|
-
case
|
|
5491
|
+
case 4: return [2 /*return*/];
|
|
5508
5492
|
}
|
|
5509
5493
|
});
|
|
5510
5494
|
});
|
|
@@ -6162,8 +6146,8 @@ var Wallet = /** @class */ (function (_super) {
|
|
|
6162
6146
|
return [4 /*yield*/, this.initRecoveryFlow({ clientAuthPubKey: publicKey })];
|
|
6163
6147
|
case 1:
|
|
6164
6148
|
initRecovery = _d.sent();
|
|
6165
|
-
if (!initRecovery
|
|
6166
|
-
throw new Error(
|
|
6149
|
+
if (!initRecovery) {
|
|
6150
|
+
throw new Error('Wallet could not be recovered');
|
|
6167
6151
|
}
|
|
6168
6152
|
signatureMessage = initRecovery.signatureMessage, wallabyAuthPubKey = initRecovery.wallabyAuthPubKey;
|
|
6169
6153
|
hashedMessage = ethCryptoJs.keccak256(signatureMessage);
|
|
@@ -6410,8 +6394,8 @@ var Wallet = /** @class */ (function (_super) {
|
|
|
6410
6394
|
})];
|
|
6411
6395
|
case 1:
|
|
6412
6396
|
initRecovery = _c.sent();
|
|
6413
|
-
if (!initRecovery
|
|
6414
|
-
throw new Error(
|
|
6397
|
+
if (!initRecovery) {
|
|
6398
|
+
throw new Error('Wallet recovery could not be initiated');
|
|
6415
6399
|
}
|
|
6416
6400
|
return [2 /*return*/, { signatureMessage: initRecovery.signatureMessage, wallabyAuthPubKey: initRecovery.wallabyAuthPubKey }];
|
|
6417
6401
|
case 2:
|
|
@@ -7047,10 +7031,7 @@ var TransactionsRoutes = {
|
|
|
7047
7031
|
requiresAccessToken: true,
|
|
7048
7032
|
},
|
|
7049
7033
|
estimateFee: {
|
|
7050
|
-
fullPath:
|
|
7051
|
-
var assetSymbol = _a.assetSymbol, originAddress = _a.originAddress, recipientAddress = _a.recipientAddress, amount = _a.amount, transactionType = _a.transactionType, tokenType = _a.tokenType, tokenStandard = _a.tokenStandard, blockchain = _a.blockchain;
|
|
7052
|
-
return "/transactions/estimate-fee?assetSymbol=".concat(assetSymbol, "&originAddress=").concat(originAddress, "&recipientAddress=").concat(recipientAddress, "&chainName=").concat(blockchain, "&amount=").concat(amount, "&transactionType=").concat(transactionType).concat(tokenStandard ? "&tokenStandard=".concat(tokenStandard) : tokenType ? "&tokenType=".concat(tokenType) : null).trim();
|
|
7053
|
-
},
|
|
7034
|
+
fullPath: '/transactions/estimate-fee',
|
|
7054
7035
|
method: exports.RequestMethod.Get,
|
|
7055
7036
|
requiresAccessToken: true,
|
|
7056
7037
|
},
|
|
@@ -7097,8 +7078,8 @@ var Transactions = /** @class */ (function (_super) {
|
|
|
7097
7078
|
_c.trys.push([0, 2, , 3]);
|
|
7098
7079
|
return [4 /*yield*/, this.request(TransactionsRoutes.estimateFee, {
|
|
7099
7080
|
method: TransactionsRoutes.estimateFee.method,
|
|
7100
|
-
|
|
7101
|
-
|
|
7081
|
+
queryParams: {
|
|
7082
|
+
chainName: blockchain,
|
|
7102
7083
|
originAddress: originAddress,
|
|
7103
7084
|
recipientAddress: recipientAddress,
|
|
7104
7085
|
amount: amount,
|