New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

wax-wallet-manager

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wax-wallet-manager - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

2

lib/interfaces.d.ts

@@ -43,5 +43,5 @@ export interface Chain {

export interface StoredAccount {
account_name: string;
accountName: string;
requestPermission: string;
walletName: string;
}

@@ -8,3 +8,3 @@ "use strict";

var allusers = getUsersList().filter(function (find) {
return "".concat(find.account_name, "-").concat(find.requestPermission) !== "".concat(_user.account_name, "-").concat(_user.requestPermission);
return "".concat(find.accountName, "-").concat(find.requestPermission) !== "".concat(_user.accountName, "-").concat(_user.requestPermission);
});

@@ -24,8 +24,8 @@ if (!remove) {

}
function formatAccount(account, wallet) {
function formatAccount(account, walletName) {
return {
account_name: account.accountName ? account.accountName : account.account_name,
accountName: account.accountName,
requestPermission: account.requestPermission,
walletName: wallet
walletName: walletName,
};
}
import { Wallet } from './Wallet';
import { StoredAccount } from "./interfaces";
import { StoredAccount } from './interfaces';
export declare class WalletManager {

@@ -13,7 +13,8 @@ wallets: Wallet[];

set accounts(value: StoredAccount[]);
login(walletName: string): Promise<import("./Account").Account[]>;
setAccounts(): void;
getAvailableWallets(): Wallet[];
setUsers(user: any, wallet: string, remove?: boolean): void;
setViewonly(account: string): {
account_name: string;
setViewonly(accountName: string): {
accountName: string;
requestPermission: string;

@@ -20,0 +21,0 @@ walletName: string;

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -6,2 +42,3 @@ exports.WalletManager = void 0;

var storage_1 = require("./storage");
var WalletError_1 = require("./WalletError");
var WalletManager = /** @class */ (function () {

@@ -17,3 +54,3 @@ function WalletManager(wallets, callback) {

* We use shouldRender to detect wallet/browser compatibility and only init the wallets that shouldRender
*/
*/
WalletManager.prototype.init = function () {

@@ -37,2 +74,24 @@ var wallets = this.getAvailableWallets();

});
WalletManager.prototype.login = function (walletName) {
return __awaiter(this, void 0, void 0, function () {
var wallet, e_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
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:
e_1 = _a.sent();
throw new WalletError_1.WalletError(e_1.message, WalletError_1.WalletErrorType.Login, e_1, walletName);
case 4: return [2 /*return*/];
}
});
});
};
WalletManager.prototype.setAccounts = function () {

@@ -51,9 +110,9 @@ var stored = localStorage.getItem(storage_1.ACCOUNTS_KEY) || null;

};
WalletManager.prototype.setViewonly = function (account) {
WalletManager.prototype.setViewonly = function (accountName) {
var user = {
account_name: account,
requestPermission: "view only",
walletName: "viewonly"
accountName: accountName,
requestPermission: 'view only',
walletName: 'viewonly',
};
(0, UsersManager_1.swapAccounts)(user, "viewonly");
(0, UsersManager_1.swapAccounts)(user, 'viewonly');
return user;

@@ -60,0 +119,0 @@ };

@@ -60,3 +60,2 @@ "use strict";

var WalletError_1 = require("../../WalletError");
var UsersManager_1 = require("../../UsersManager");
var AnchorUser_1 = require("./AnchorUser");

@@ -78,3 +77,3 @@ var AnchorError_1 = require("./AnchorError");

chainId: '1064487b3cd1a897ce03ae5b6a865651747e2e152090f99c1d19d44e01aea5a4',
rpcEndpoints: rpcEndpoints
rpcEndpoints: rpcEndpoints,
};

@@ -172,3 +171,3 @@ // Establish initial values

case 0:
_a.trys.push([0, 4, , 5]);
_a.trys.push([0, 3, , 4]);
if (!(this.users.length === 0)) return [3 /*break*/, 2];

@@ -179,13 +178,10 @@ return [4 /*yield*/, this.link.login(this.appName)];

this.users = [new AnchorUser_1.AnchorUser(this.rpc, this.client, identity)];
return [3 /*break*/, 3];
case 2:
(0, UsersManager_1.swapAccounts)(this.users[0], this.walletName());
return [2 /*return*/, this.users];
case 3: return [3 /*break*/, 5];
case 4:
_a.label = 2;
case 2: return [3 /*break*/, 4];
case 3:
e_1 = _a.sent();
throw new AnchorError_1.AnchorError(e_1.message, WalletError_1.WalletErrorType.Login, e_1);
case 5:
(0, UsersManager_1.swapAccounts)(this.users[0], this.walletName());
return [2 /*return*/, this.users];
case 4:
// swapAccounts(this.users[0], this.walletName());
return [2 /*return*/, this.users];
}

@@ -192,0 +188,0 @@ });

@@ -67,3 +67,3 @@ "use strict";

chainId: '1064487b3cd1a897ce03ae5b6a865651747e2e152090f99c1d19d44e01aea5a4',
rpcEndpoints: []
rpcEndpoints: [],
};

@@ -136,5 +136,3 @@ _this.users = [];

}
this.users = [
new WaxUser_1.WaxUser(this.chain, this.session.userAccount, this.session.pubKeys, this.wax)
];
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());

@@ -165,3 +163,3 @@ return [2 /*return*/, this.users];

pubKeys: pubKeys || this.wax.pubKeys,
expire: Date.now() + (this.shouldInvalidateAfter() * 1000)
expire: Date.now() + this.shouldInvalidateAfter() * 1000,
};

@@ -180,3 +178,3 @@ if (!login.userAccount || !login.pubKeys) {

waxSigningURL: this.waxSigningURL,
waxAutoSigningURL: this.waxAutoSigningURL
waxAutoSigningURL: this.waxAutoSigningURL,
});

@@ -183,0 +181,0 @@ };

@@ -23,3 +23,3 @@ "use strict";

function WaxError(message, type, cause) {
return _super.call(this, message, type, cause, "Wax") || this;
return _super.call(this, message, type, cause, 'Wax') || this;
}

@@ -26,0 +26,0 @@ return WaxError;

import { Account } from '../../Account';
import { Chain } from '../../interfaces';
import { SignTransactionResponse } from '../../interfaces';
import { WaxJS } from "@waxio/waxjs/dist";
import { WaxJS } from '@waxio/waxjs/dist';
export declare class WaxUser extends Account {

@@ -6,0 +6,0 @@ readonly accountName: string;

{
"name": "wax-wallet-manager",
"version": "1.1.3",
"version": "1.1.4",
"description": "Manage multiple Wax Blockchain account login sessions across WCW and supported wallets.",

@@ -19,3 +19,4 @@ "main": "lib/index.js",

"version": "npm run format && git add -A src",
"postversion": "git push && git push --tags"
"postversion": "git push && git push --tags",
"publish": "npm publish --access=public"
},

@@ -22,0 +23,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc