Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solana/wallet-adapter-torus

Package Overview
Dependencies
Maintainers
10
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/wallet-adapter-torus - npm Package Compare versions

Comparing version 0.6.0 to 0.6.1

61

lib/adapter.js

@@ -0,1 +1,21 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -10,10 +30,12 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
import { BaseSignerWalletAdapter, WalletConnectionError, WalletDisconnectionError, WalletError, WalletKeypairError, WalletNotConnectedError, WalletSignTransactionError, WalletWindowBlockedError, WalletWindowClosedError, } from '@solana/wallet-adapter-base';
import { Keypair } from '@solana/web3.js';
import OpenLogin, { OPENLOGIN_NETWORK } from '@toruslabs/openlogin';
import { getED25519Key } from '@toruslabs/openlogin-ed25519';
export class TorusWalletAdapter extends BaseSignerWalletAdapter {
Object.defineProperty(exports, "__esModule", { value: true });
exports.TorusWalletAdapter = void 0;
const wallet_adapter_base_1 = require("@solana/wallet-adapter-base");
const web3_js_1 = require("@solana/web3.js");
const openlogin_1 = __importStar(require("@toruslabs/openlogin"));
const openlogin_ed25519_1 = require("@toruslabs/openlogin-ed25519");
class TorusWalletAdapter extends wallet_adapter_base_1.BaseSignerWalletAdapter {
constructor(config) {
super();
this._options = Object.assign({ uxMode: 'popup', network: OPENLOGIN_NETWORK.MAINNET }, config.options);
this._options = Object.assign({ uxMode: 'popup', network: openlogin_1.OPENLOGIN_NETWORK.MAINNET }, config.options);
this._connecting = false;

@@ -28,3 +50,3 @@ this._openLogin = null;

get ready() {
return true;
return typeof window !== 'undefined';
}

@@ -49,3 +71,3 @@ get connecting() {

try {
openLogin = new OpenLogin(this._options);
openLogin = new openlogin_1.default(this._options);
yield openLogin.init();

@@ -60,6 +82,6 @@ privateKey = openLogin.privKey;

case 'user closed popup':
reason = new WalletWindowClosedError(reason.message, reason);
reason = new wallet_adapter_base_1.WalletWindowClosedError(reason.message, reason);
break;
case 'unable to open window':
reason = new WalletWindowBlockedError(reason.message, reason);
reason = new wallet_adapter_base_1.WalletWindowBlockedError(reason.message, reason);
break;

@@ -81,12 +103,10 @@ }

catch (error) {
if (error instanceof WalletError)
throw error;
throw new WalletConnectionError(error === null || error === void 0 ? void 0 : error.message, error);
throw new wallet_adapter_base_1.WalletConnectionError(error === null || error === void 0 ? void 0 : error.message, error);
}
let keypair;
try {
keypair = Keypair.fromSecretKey(getED25519Key(privateKey).sk);
keypair = web3_js_1.Keypair.fromSecretKey((0, openlogin_ed25519_1.getED25519Key)(privateKey).sk);
}
catch (error) {
throw new WalletKeypairError(error === null || error === void 0 ? void 0 : error.message, error);
throw new wallet_adapter_base_1.WalletKeypairError(error === null || error === void 0 ? void 0 : error.message, error);
}

@@ -117,3 +137,3 @@ this._openLogin = openLogin;

catch (error) {
this.emit('error', new WalletDisconnectionError(error.message, error));
this.emit('error', new wallet_adapter_base_1.WalletDisconnectionError(error === null || error === void 0 ? void 0 : error.message, error));
}

@@ -129,3 +149,3 @@ this.emit('disconnect');

if (!keypair)
throw new WalletNotConnectedError();
throw new wallet_adapter_base_1.WalletNotConnectedError();
try {

@@ -135,3 +155,3 @@ transaction.partialSign(keypair);

catch (error) {
throw new WalletSignTransactionError(error === null || error === void 0 ? void 0 : error.message, error);
throw new wallet_adapter_base_1.WalletSignTransactionError(error === null || error === void 0 ? void 0 : error.message, error);
}

@@ -151,3 +171,3 @@ return transaction;

if (!keypair)
throw new WalletNotConnectedError();
throw new wallet_adapter_base_1.WalletNotConnectedError();
try {

@@ -159,3 +179,3 @@ for (const transaction of transactions) {

catch (error) {
throw new WalletSignTransactionError(error === null || error === void 0 ? void 0 : error.message, error);
throw new wallet_adapter_base_1.WalletSignTransactionError(error === null || error === void 0 ? void 0 : error.message, error);
}

@@ -171,2 +191,3 @@ return transactions;

}
exports.TorusWalletAdapter = TorusWalletAdapter;
//# sourceMappingURL=adapter.js.map

@@ -1,2 +0,14 @@

export * from './adapter';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./adapter"), exports);
//# sourceMappingURL=index.js.map
{
"name": "@solana/wallet-adapter-torus",
"version": "0.6.0",
"version": "0.6.1",
"author": "Solana Maintainers <maintainers@solana.foundation>",

@@ -22,3 +22,3 @@ "repository": "https://github.com/solana-labs/wallet-adapter",

"peerDependencies": {
"@solana/wallet-adapter-base": "^0.5.0",
"@solana/wallet-adapter-base": "^0.5.1",
"@solana/web3.js": "^1.20.0"

@@ -32,6 +32,6 @@ },

"devDependencies": {
"@solana/wallet-adapter-base": "^0.5.0",
"@solana/wallet-adapter-base": "^0.5.1",
"@solana/web3.js": "^1.20.0"
},
"gitHead": "76ff330eaf74b916f448eb8870302ae127a94b3d"
"gitHead": "4e46f44d180bda0f9ca4d20e48f62759a9af4c2c"
}

@@ -5,3 +5,2 @@ import {

WalletDisconnectionError,
WalletError,
WalletKeypairError,

@@ -40,3 +39,3 @@ WalletNotConnectedError,

get ready(): boolean {
return true;
return typeof window !== 'undefined';
}

@@ -97,4 +96,3 @@

}
} catch (error) {
if (error instanceof WalletError) throw error;
} catch (error: any) {
throw new WalletConnectionError(error?.message, error);

@@ -106,3 +104,3 @@ }

keypair = Keypair.fromSecretKey(getED25519Key(privateKey).sk);
} catch (error) {
} catch (error: any) {
throw new WalletKeypairError(error?.message, error);

@@ -115,3 +113,3 @@ }

this.emit('connect');
} catch (error) {
} catch (error: any) {
this.emit('error', error);

@@ -133,4 +131,4 @@ throw error;

await openLogin._cleanup();
} catch (error) {
this.emit('error', new WalletDisconnectionError(error.message, error));
} catch (error: any) {
this.emit('error', new WalletDisconnectionError(error?.message, error));
}

@@ -149,3 +147,3 @@

transaction.partialSign(keypair);
} catch (error) {
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);

@@ -155,3 +153,3 @@ }

return transaction;
} catch (error) {
} catch (error: any) {
this.emit('error', error);

@@ -171,3 +169,3 @@ throw error;

}
} catch (error) {
} catch (error: any) {
throw new WalletSignTransactionError(error?.message, error);

@@ -177,3 +175,3 @@ }

return transactions;
} catch (error) {
} catch (error: any) {
this.emit('error', error);

@@ -180,0 +178,0 @@ throw error;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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