wax-wallet-manager
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,2 +0,4 @@ | ||
export * from './WalletManager'; | ||
export * from './wallets/anchor/Anchor'; | ||
export { WalletManager } from './WalletManager'; | ||
export { Anchor } from './wallets/anchor/Anchor'; | ||
export { Wax } from './wallets/wax-cloud/WAX'; | ||
export * from './storage'; |
@@ -17,3 +17,9 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./WalletManager"), exports); | ||
__exportStar(require("./wallets/anchor/Anchor"), exports); | ||
exports.Wax = exports.Anchor = exports.WalletManager = void 0; | ||
var WalletManager_1 = require("./WalletManager"); | ||
Object.defineProperty(exports, "WalletManager", { enumerable: true, get: function () { return WalletManager_1.WalletManager; } }); | ||
var Anchor_1 = require("./wallets/anchor/Anchor"); | ||
Object.defineProperty(exports, "Anchor", { enumerable: true, get: function () { return Anchor_1.Anchor; } }); | ||
var WAX_1 = require("./wallets/wax-cloud/WAX"); | ||
Object.defineProperty(exports, "Wax", { enumerable: true, get: function () { return WAX_1.Wax; } }); | ||
__exportStar(require("./storage"), exports); |
@@ -42,1 +42,6 @@ export interface Chain { | ||
} | ||
export interface StoredAccount { | ||
accountName: string; | ||
requestPermission: string; | ||
walletName: string; | ||
} |
import { Wallet } from './Wallet'; | ||
import { StoredAccount } from "./interfaces"; | ||
export declare class WalletManager { | ||
wallets: Wallet[]; | ||
constructor(wallets: Wallet[]); | ||
getWallets(): { | ||
wallets: Wallet[]; | ||
}; | ||
private callback?; | ||
private _accounts; | ||
constructor(wallets: Wallet[], callback?: { | ||
accounts?: (() => void) | undefined; | ||
} | undefined); | ||
init(): void; | ||
get accounts(): StoredAccount[]; | ||
set accounts(value: StoredAccount[]); | ||
setAccounts(): void; | ||
getAvailableWallets(): Wallet[]; | ||
setUsers(user: any, wallet: string): void; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WalletManager = void 0; | ||
var UsersManager_1 = require("./UsersManager"); | ||
var storage_1 = require("./storage"); | ||
var WalletManager = /** @class */ (function () { | ||
function WalletManager(wallets) { | ||
function WalletManager(wallets, callback) { | ||
this.wallets = wallets; | ||
this.callback = callback; | ||
this._accounts = []; | ||
this.init(); | ||
} | ||
WalletManager.prototype.getWallets = function () { | ||
var wallets = this.wallets.filter(function (wallet) { | ||
/* | ||
* Multiple wallets may be added but some may not be valid with all browsers | ||
* We use shouldRender to detect wallet/browser compatibility and only init the wallets that shouldRender | ||
*/ | ||
WalletManager.prototype.init = function () { | ||
this.setAccounts(); | ||
var wallets = this.getAvailableWallets(); | ||
wallets.forEach(function (wallet) { return wallet.init(); }); | ||
}; | ||
Object.defineProperty(WalletManager.prototype, "accounts", { | ||
get: function () { | ||
return this._accounts; | ||
}, | ||
set: function (value) { | ||
if (!value.length) { | ||
return; | ||
} | ||
this._accounts = value; | ||
if (this.callback && this.callback.accounts) { | ||
this.callback.accounts(); | ||
} | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
WalletManager.prototype.setAccounts = function () { | ||
var stored = localStorage.getItem(storage_1.ACCOUNTS_KEY) || null; | ||
this.accounts = stored ? JSON.parse(stored) : []; | ||
}; | ||
WalletManager.prototype.getAvailableWallets = function () { | ||
return this.wallets.filter(function (wallet) { | ||
return wallet.shouldRender(); | ||
}); | ||
wallets.forEach(function (wallet) { return wallet.init(); }); | ||
return { | ||
wallets: wallets, | ||
}; | ||
}; | ||
WalletManager.prototype.setUsers = function (user, wallet) { | ||
(0, UsersManager_1.swapUsers)(user, wallet); | ||
this.setAccounts(); | ||
}; | ||
return WalletManager; | ||
}()); | ||
exports.WalletManager = WalletManager; |
@@ -60,2 +60,3 @@ "use strict"; | ||
var WalletError_1 = require("../../WalletError"); | ||
var UsersManager_1 = require("../../UsersManager"); | ||
var AnchorUser_1 = require("./AnchorUser"); | ||
@@ -181,3 +182,5 @@ var AnchorError_1 = require("./AnchorError"); | ||
throw new AnchorError_1.AnchorError(e_1.message, WalletError_1.WalletErrorType.Login, e_1); | ||
case 4: return [2 /*return*/, this.users]; | ||
case 4: | ||
(0, UsersManager_1.swapUsers)(this.users[0], this.walletName()); | ||
return [2 /*return*/, this.users]; | ||
} | ||
@@ -184,0 +187,0 @@ }); |
{ | ||
"name": "wax-wallet-manager", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Manage multiple Wax Blockchain account login sessions across WCW and supported wallets.", | ||
@@ -41,8 +41,4 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@greymass/eosio": "^0.6.4", | ||
"@types/bn.js": "^5.1.1", | ||
"@types/jest": "^29.0.1", | ||
"anchor-link": "^3.5.1", | ||
"anchor-link-browser-transport": "^3.5.1", | ||
"eosjs": "^22.1.0", | ||
"jest": "^29.0.3", | ||
@@ -54,3 +50,10 @@ "prettier": "^2.7.1", | ||
"typescript": "^4.8.3" | ||
}, | ||
"dependencies": { | ||
"@greymass/eosio": "^0.6.4", | ||
"@waxio/waxjs": "^1.1.0", | ||
"anchor-link": "^3.5.1", | ||
"anchor-link-browser-transport": "^3.5.1", | ||
"eosjs": "^22.1.0" | ||
} | ||
} |
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
57549
8
30
1266
5
+ Added@greymass/eosio@^0.6.4
+ Added@waxio/waxjs@^1.1.0
+ Addedanchor-link@^3.5.1
+ Addedeosjs@^22.1.0
+ Added@greymass/eosio@0.6.11(transitive)
+ Added@greymass/miniaes@1.0.0(transitive)
+ Added@types/strip-bom@3.0.0(transitive)
+ Added@types/strip-json-comments@0.0.30(transitive)
+ Added@waxio/waxjs@1.7.1(transitive)
+ Added@wharfkit/antelope@1.0.13(transitive)
+ Added@wharfkit/signing-request@3.2.0(transitive)
+ Addedanchor-link@3.6.0(transitive)
+ Addedanchor-link-browser-transport@3.6.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedanymatch@3.1.3(transitive)
+ Addedarg@4.1.3(transitive)
+ Addedasync@3.2.6(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbinary-extensions@2.3.0(transitive)
+ Addedbn.js@4.12.15.2.0(transitive)
+ Addedbrace-expansion@1.1.112.0.1(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedbrorand@1.1.0(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedchokidar@3.6.0(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedcommander@7.2.0(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedcreate-require@1.1.1(transitive)
+ Addeddiff@4.0.2(transitive)
+ Addeddynamic-dedupe@0.3.0(transitive)
+ Addedejs@3.1.10(transitive)
+ Addedelliptic@6.5.46.6.1(transitive)
+ Addedeosjs@22.1.0(transitive)
+ Addedfetch-ponyfill@7.1.0(transitive)
+ Addedfilelist@1.0.4(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedfind-package@1.0.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedfsevents@2.3.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedgenversion@3.2.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedhash.js@1.1.7(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhmac-drbg@1.0.1(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-binary-path@2.1.0(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedisomorphic-ws@4.0.1(transitive)
+ Addedjake@10.9.2(transitive)
+ Addedmake-error@1.3.6(transitive)
+ Addedminimalistic-assert@1.0.1(transitive)
+ Addedminimalistic-crypto-utils@1.0.1(transitive)
+ Addedminimatch@3.1.25.1.6(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@1.0.4(transitive)
+ Addednode-fetch@2.6.13(transitive)
+ Addednormalize-path@3.0.0(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpako@2.0.32.1.0(transitive)
+ Addedparents@1.0.1(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-platform@0.11.15(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedreaddirp@3.6.0(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedsource-map-support@0.5.21(transitive)
+ Addedstrip-bom@3.0.0(transitive)
+ Addedstrip-json-comments@2.0.1(transitive)
+ Addedsupports-color@7.2.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedto-regex-range@5.0.1(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedtree-kill@1.2.2(transitive)
+ Addedts-node@9.1.1(transitive)
+ Addedts-node-dev@1.1.8(transitive)
+ Addedtsconfig@7.0.0(transitive)
+ Addedtslib@2.8.1(transitive)
+ Addedtypescript@5.6.3(transitive)
+ Addeduuid@8.3.2(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedws@8.18.0(transitive)
+ Addedxtend@4.0.2(transitive)
+ Addedyn@3.1.1(transitive)