wax-wallet-manager
Advanced tools
Comparing version 1.1.4 to 1.1.5
@@ -1,1 +0,1 @@ | ||
export declare function swapAccounts(account: any, wallet: string, remove?: boolean): void; | ||
export declare function swapAccounts(user: any, remove?: boolean): void; |
@@ -5,4 +5,4 @@ "use strict"; | ||
var storage_1 = require("./storage"); | ||
function swapAccounts(account, wallet, remove) { | ||
var _user = formatAccount(account, wallet); | ||
function swapAccounts(user, remove) { | ||
var _user = formatAccount(user); | ||
var allusers = getUsersList().filter(function (find) { | ||
@@ -24,8 +24,8 @@ return "".concat(find.accountName, "-").concat(find.requestPermission) !== "".concat(_user.accountName, "-").concat(_user.requestPermission); | ||
} | ||
function formatAccount(account, walletName) { | ||
function formatAccount(user) { | ||
return { | ||
accountName: account.accountName, | ||
requestPermission: account.requestPermission, | ||
walletName: walletName, | ||
accountName: user.accountName, | ||
requestPermission: user.requestPermission, | ||
walletName: user.walletName, | ||
}; | ||
} |
@@ -16,3 +16,3 @@ import { Wallet } from './Wallet'; | ||
getAvailableWallets(): Wallet[]; | ||
setUsers(user: any, wallet: string, remove?: boolean): void; | ||
setUsers(user: any, remove?: boolean): void; | ||
setViewonly(accountName: string): { | ||
@@ -19,0 +19,0 @@ accountName: string; |
@@ -78,14 +78,12 @@ "use strict"; | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
wallet = this.getAvailableWallets().filter(function (v) { | ||
return v.walletName() === walletName; | ||
})[0]; | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, wallet.login()]; | ||
case 2: return [2 /*return*/, _a.sent()]; | ||
case 3: | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
case 2: | ||
e_1 = _a.sent(); | ||
throw new WalletError_1.WalletError(e_1.message, WalletError_1.WalletErrorType.Login, e_1, walletName); | ||
case 4: return [2 /*return*/]; | ||
case 3: return [2 /*return*/]; | ||
} | ||
@@ -104,4 +102,4 @@ }); | ||
}; | ||
WalletManager.prototype.setUsers = function (user, wallet, remove) { | ||
(0, UsersManager_1.swapAccounts)(user, wallet, remove); | ||
WalletManager.prototype.setUsers = function (user, remove) { | ||
(0, UsersManager_1.swapAccounts)(user, remove); | ||
this.setAccounts(); | ||
@@ -115,3 +113,3 @@ }; | ||
}; | ||
(0, UsersManager_1.swapAccounts)(user, 'viewonly'); | ||
(0, UsersManager_1.swapAccounts)(user); | ||
return user; | ||
@@ -118,0 +116,0 @@ }; |
@@ -12,2 +12,3 @@ import { Account } from '../../Account'; | ||
signerRequest?: any; | ||
walletName: string; | ||
private signatureProvider; | ||
@@ -14,0 +15,0 @@ private chainId; |
@@ -74,2 +74,3 @@ "use strict"; | ||
var _this = _super.call(this) || this; | ||
_this.walletName = 'anchor'; | ||
_this.accountName = ''; | ||
@@ -76,0 +77,0 @@ _this.requestPermission = ''; |
@@ -57,3 +57,2 @@ "use strict"; | ||
var WalletError_1 = require("../../WalletError"); | ||
var UsersManager_1 = require("../../UsersManager"); | ||
var WaxUser_1 = require("./WaxUser"); | ||
@@ -137,3 +136,2 @@ var WaxError_1 = require("./WaxError"); | ||
this.users = [new WaxUser_1.WaxUser(this.chain, this.session.userAccount, this.session.pubKeys, this.wax)]; | ||
(0, UsersManager_1.swapAccounts)(this.users[0], this.walletName()); | ||
return [2 /*return*/, this.users]; | ||
@@ -179,2 +177,6 @@ case 4: | ||
}); | ||
this.session = JSON.parse(localStorage.getItem('ual-wax:autologin') || ''); | ||
if (this.session) { | ||
this.users = [new WaxUser_1.WaxUser(this.chain, this.session.userAccount, this.session.pubKeys, this.wax)]; | ||
} | ||
}; | ||
@@ -181,0 +183,0 @@ Wax.prototype.getEndpoint = function () { |
@@ -8,2 +8,3 @@ import { Account } from '../../Account'; | ||
readonly requestPermission: string; | ||
readonly walletName: string; | ||
private readonly pubKeys; | ||
@@ -10,0 +11,0 @@ private readonly wax; |
@@ -62,2 +62,3 @@ "use strict"; | ||
var _this = _super.call(this) || this; | ||
_this.walletName = 'wax'; | ||
_this.accountName = userAccount; | ||
@@ -64,0 +65,0 @@ _this.pubKeys = pubKeys; |
{ | ||
"name": "wax-wallet-manager", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Manage multiple Wax Blockchain account login sessions across WCW and supported wallets.", | ||
@@ -20,3 +20,3 @@ "main": "lib/index.js", | ||
"postversion": "git push && git push --tags", | ||
"publish": "npm publish --access=public" | ||
"publishnow": "npm publish --access=public" | ||
}, | ||
@@ -23,0 +23,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61630
1340