wallaby-cash 1.7.1 → 1.7.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.
- package/dist/index.cjs.js +17 -34
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +17 -34
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +17 -34
- 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 +17 -18
- package/dist/types/wallet.d.ts +5 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -4922,7 +4922,6 @@ var StorageService = /** @class */ (function () {
|
|
|
4922
4922
|
return StorageService;
|
|
4923
4923
|
}());
|
|
4924
4924
|
|
|
4925
|
-
/* eslint-disable no-prototype-builtins */
|
|
4926
4925
|
/**
|
|
4927
4926
|
* Converts an object to query parameters string.
|
|
4928
4927
|
*
|
|
@@ -4931,11 +4930,11 @@ var StorageService = /** @class */ (function () {
|
|
|
4931
4930
|
*/
|
|
4932
4931
|
function objectToQueryParams(obj) {
|
|
4933
4932
|
var params = new URLSearchParams();
|
|
4934
|
-
|
|
4935
|
-
if (obj
|
|
4933
|
+
Object.keys(obj).forEach(function (key) {
|
|
4934
|
+
if (obj[key] !== null && obj[key] !== undefined && obj[key] !== '') {
|
|
4936
4935
|
params.append(key, obj[key]);
|
|
4937
4936
|
}
|
|
4938
|
-
}
|
|
4937
|
+
});
|
|
4939
4938
|
return params.toString();
|
|
4940
4939
|
}
|
|
4941
4940
|
|
|
@@ -5189,12 +5188,6 @@ var WalletRoutes = {
|
|
|
5189
5188
|
method: exports.RequestMethod.Post,
|
|
5190
5189
|
requiresAccessToken: false,
|
|
5191
5190
|
},
|
|
5192
|
-
// TODO Move this to transactions module
|
|
5193
|
-
estimateFee: {
|
|
5194
|
-
fullPath: '/transactions/estimate-fee',
|
|
5195
|
-
method: exports.RequestMethod.Get,
|
|
5196
|
-
requiresAccessToken: true,
|
|
5197
|
-
},
|
|
5198
5191
|
getWalletAssets: {
|
|
5199
5192
|
fullPath: function (_a) {
|
|
5200
5193
|
var walletId = _a.walletId;
|
|
@@ -5469,16 +5462,16 @@ var Auth = /** @class */ (function (_super) {
|
|
|
5469
5462
|
*/
|
|
5470
5463
|
Auth.prototype.signIn = function (_a) {
|
|
5471
5464
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
5472
|
-
var signatureMessage, message, signature, clientAuthPubKey, response, accessToken, user,
|
|
5465
|
+
var signatureMessage, message, signature, clientAuthPubKey, decryptedClientAuthPrivKey, response, accessToken, user, error_3;
|
|
5473
5466
|
var password = _b.password;
|
|
5474
5467
|
return __generator(this, function (_c) {
|
|
5475
5468
|
switch (_c.label) {
|
|
5476
5469
|
case 0:
|
|
5477
|
-
_c.trys.push([0,
|
|
5470
|
+
_c.trys.push([0, 3, , 4]);
|
|
5478
5471
|
return [4 /*yield*/, this.signatureMessage({ password: password })];
|
|
5479
5472
|
case 1:
|
|
5480
5473
|
signatureMessage = _c.sent();
|
|
5481
|
-
message = signatureMessage.message, signature = signatureMessage.signature, clientAuthPubKey = signatureMessage.clientAuthPubKey;
|
|
5474
|
+
message = signatureMessage.message, signature = signatureMessage.signature, clientAuthPubKey = signatureMessage.clientAuthPubKey, decryptedClientAuthPrivKey = signatureMessage.decryptedClientAuthPrivKey;
|
|
5482
5475
|
return [4 /*yield*/, this.request(AuthRoutes.signIn, {
|
|
5483
5476
|
method: AuthRoutes.signUp.method,
|
|
5484
5477
|
payload: { clientAuthPubKey: clientAuthPubKey, signature: signature, message: message },
|
|
@@ -5489,22 +5482,15 @@ var Auth = /** @class */ (function (_super) {
|
|
|
5489
5482
|
throw new Error(response.error);
|
|
5490
5483
|
}
|
|
5491
5484
|
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
|
-
}
|
|
5485
|
+
this.storageService.setWallabyAuthPubKey(user.wallabyAuthPubKey);
|
|
5486
|
+
this.storageService.setEncryptedPrivateKey(decryptedClientAuthPrivKey, password);
|
|
5501
5487
|
this.storageService.setAccessToken(accessToken);
|
|
5502
5488
|
return [2 /*return*/, response];
|
|
5503
|
-
case
|
|
5489
|
+
case 3:
|
|
5504
5490
|
error_3 = _c.sent();
|
|
5505
5491
|
logger('SDK::Auth::signIn::error', error_3);
|
|
5506
5492
|
return [2 /*return*/, Promise.reject(error_3)];
|
|
5507
|
-
case
|
|
5493
|
+
case 4: return [2 /*return*/];
|
|
5508
5494
|
}
|
|
5509
5495
|
});
|
|
5510
5496
|
});
|
|
@@ -6162,8 +6148,8 @@ var Wallet = /** @class */ (function (_super) {
|
|
|
6162
6148
|
return [4 /*yield*/, this.initRecoveryFlow({ clientAuthPubKey: publicKey })];
|
|
6163
6149
|
case 1:
|
|
6164
6150
|
initRecovery = _d.sent();
|
|
6165
|
-
if (!initRecovery
|
|
6166
|
-
throw new Error(
|
|
6151
|
+
if (!initRecovery) {
|
|
6152
|
+
throw new Error('Wallet could not be recovered');
|
|
6167
6153
|
}
|
|
6168
6154
|
signatureMessage = initRecovery.signatureMessage, wallabyAuthPubKey = initRecovery.wallabyAuthPubKey;
|
|
6169
6155
|
hashedMessage = ethCryptoJs.keccak256(signatureMessage);
|
|
@@ -6410,8 +6396,8 @@ var Wallet = /** @class */ (function (_super) {
|
|
|
6410
6396
|
})];
|
|
6411
6397
|
case 1:
|
|
6412
6398
|
initRecovery = _c.sent();
|
|
6413
|
-
if (!initRecovery
|
|
6414
|
-
throw new Error(
|
|
6399
|
+
if (!initRecovery) {
|
|
6400
|
+
throw new Error('Wallet recovery could not be initiated');
|
|
6415
6401
|
}
|
|
6416
6402
|
return [2 /*return*/, { signatureMessage: initRecovery.signatureMessage, wallabyAuthPubKey: initRecovery.wallabyAuthPubKey }];
|
|
6417
6403
|
case 2:
|
|
@@ -7047,10 +7033,7 @@ var TransactionsRoutes = {
|
|
|
7047
7033
|
requiresAccessToken: true,
|
|
7048
7034
|
},
|
|
7049
7035
|
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
|
-
},
|
|
7036
|
+
fullPath: '/transactions/estimate-fee',
|
|
7054
7037
|
method: exports.RequestMethod.Get,
|
|
7055
7038
|
requiresAccessToken: true,
|
|
7056
7039
|
},
|
|
@@ -7097,8 +7080,8 @@ var Transactions = /** @class */ (function (_super) {
|
|
|
7097
7080
|
_c.trys.push([0, 2, , 3]);
|
|
7098
7081
|
return [4 /*yield*/, this.request(TransactionsRoutes.estimateFee, {
|
|
7099
7082
|
method: TransactionsRoutes.estimateFee.method,
|
|
7100
|
-
|
|
7101
|
-
|
|
7083
|
+
queryParams: {
|
|
7084
|
+
chainName: blockchain,
|
|
7102
7085
|
originAddress: originAddress,
|
|
7103
7086
|
recipientAddress: recipientAddress,
|
|
7104
7087
|
amount: amount,
|