Socket
Socket
Sign inDemoInstall

@toruslabs/solana-embed

Package Overview
Dependencies
135
Maintainers
4
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.0 to 0.3.1

dist/types/src/baseProvider.d.ts

528

dist/solanaEmbed.esm.js

@@ -12,2 +12,4 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';

var version = "0.3.1";
var messages = {

@@ -17,13 +19,13 @@ errors: {

permanentlyDisconnected: () => "Torus: Disconnected from iframe. Page reload required.",
unsupportedSync: method => "Torus: The Torus Ethereum provider does not support synchronous methods like ".concat(method, " without a callback parameter."),
unsupportedSync: method => `Torus: The Torus Ethereum provider does not support synchronous methods like ${method} without a callback parameter.`,
invalidDuplexStream: () => "Must provide a Node.js-style duplex stream.",
invalidOptions: maxEventListeners => "Invalid options. Received: { maxEventListeners: ".concat(maxEventListeners, "}"),
invalidRequestArgs: () => "Expected a single, non-array, object argument.",
invalidRequestMethod: () => "'args.method' must be a non-empty string.",
invalidRequestParams: () => "'args.params' must be an object or array if provided.",
invalidLoggerObject: () => "'args.logger' must be an object if provided.",
invalidLoggerMethod: method => "'args.logger' must include required method '".concat(method, "'.")
invalidOptions: maxEventListeners => `Invalid options. Received: { maxEventListeners: ${maxEventListeners}}`,
invalidRequestArgs: () => `Expected a single, non-array, object argument.`,
invalidRequestMethod: () => `'args.method' must be a non-empty string.`,
invalidRequestParams: () => `'args.params' must be an object or array if provided.`,
invalidLoggerObject: () => `'args.logger' must be an object if provided.`,
invalidLoggerMethod: method => `'args.logger' must include required method '${method}'.`
},
info: {
connected: chainId => "Torus: Connected to chain with ID \"".concat(chainId, "\".")
connected: chainId => `Torus: Connected to chain with ID "${chainId}".`
},

@@ -126,3 +128,3 @@ warnings: {}

prodTorusUrl: "",
localStorageKey: "torus-".concat(window.location.hostname)
localStorageKey: `torus-${window.location.hostname}`
};

@@ -132,2 +134,3 @@

// utility functions
/**

@@ -139,3 +142,2 @@ * json-rpc-engine middleware that logs RPC errors and and validates req.method.

*/
function createErrorMiddleware() {

@@ -146,7 +148,6 @@ return (req, res, next) => {

res.error = ethErrors.rpc.invalidRequest({
message: "The request 'method' must be a non-empty string.",
message: `The request 'method' must be a non-empty string.`,
data: req
});
}
next(done => {

@@ -156,8 +157,6 @@ const {

} = res;
if (!error) {
return done();
}
log.error("Torus - RPC Error: ".concat(error.message), error);
log.error(`Torus - RPC Error: ${error.message}`, error);
return done();

@@ -176,12 +175,8 @@ });

*/
function logStreamDisconnectWarning(remoteLabel, error, emitter) {
let warningMsg = "Torus: Lost connection to \"".concat(remoteLabel, "\".");
let warningMsg = `Torus: Lost connection to "${remoteLabel}".`;
if (error !== null && error !== void 0 && error.stack) {
warningMsg += "\n".concat(error.stack);
warningMsg += `\n${error.stack}`;
}
log.warn(warningMsg);
if (emitter && emitter.listenerCount("error") > 0) {

@@ -194,5 +189,5 @@ emitter.emit("error", warningMsg);

let torusUrl;
let logLevel; // const versionUsed = version;
let logLevel;
// const versionUsed = version;
// log.info("solana embed version used: ", versionUsed);
switch (buildEnv) {

@@ -203,3 +198,2 @@ case "testing":

break;
case "development":

@@ -209,9 +203,7 @@ torusUrl = "http://localhost:8080";

break;
default:
torusUrl = "https://solana.tor.us";
torusUrl = `https://solana.tor.us`;
logLevel = "error";
break;
}
return {

@@ -246,3 +238,2 @@ torusUrl,

let storage;
try {

@@ -255,8 +246,13 @@ storage = window[type];

} catch (e) {
return e && ( // everything except Firefox
e.code === 22 || // Firefox
e.code === 1014 || // test name field too, because code might not be present
return e && (
// everything except Firefox
e.name === "QuotaExceededError" || // Firefox
e.name === "NS_ERROR_DOM_QUOTA_REACHED") && // acknowledge QuotaExceededError only if there's something already stored
e.code === 22 ||
// Firefox
e.code === 1014 ||
// test name field too, because code might not be present
// everything except Firefox
e.name === "QuotaExceededError" ||
// Firefox
e.name === "NS_ERROR_DOM_QUOTA_REACHED") &&
// acknowledge QuotaExceededError only if there's something already stored
storage && storage.length !== 0;

@@ -268,3 +264,2 @@ }

*/
function getPopupFeatures(_ref) {

@@ -281,6 +276,5 @@ let {

const systemZoom = 1; // No reliable estimate
const left = Math.abs((width - w) / 2 / systemZoom + dualScreenLeft);
const top = Math.abs((height - h) / 2 / systemZoom + dualScreenTop);
const features = "titlebar=0,toolbar=0,status=0,location=0,menubar=0,height=".concat(h / systemZoom, ",width=").concat(w / systemZoom, ",top=").concat(top, ",left=").concat(left);
const features = `titlebar=0,toolbar=0,status=0,location=0,menubar=0,height=${h / systemZoom},width=${w / systemZoom},top=${top},left=${left}`;
return features;

@@ -293,2 +287,3 @@ }

*/
constructor(connectionStream, _ref) {

@@ -300,15 +295,9 @@ let {

super();
_defineProperty(this, "isTorus", void 0);
_defineProperty(this, "_rpcEngine", void 0);
_defineProperty(this, "jsonRpcConnectionEvents", void 0);
_defineProperty(this, "_state", void 0);
if (!duplex(connectionStream)) {
throw new Error(messages.errors.invalidDuplexStream());
}
this.isTorus = true;

@@ -322,14 +311,14 @@ this.setMaxListeners(maxEventListeners);

this.request = this.request.bind(this);
this.sendAsync = this.sendAsync.bind(this); // this.enable = this.enable.bind(this);
this.sendAsync = this.sendAsync.bind(this);
// this.enable = this.enable.bind(this);
// setup connectionStream multiplexing
const mux = new ObjectMultiplex();
pump(connectionStream, mux, connectionStream, this._handleStreamDisconnect.bind(this, "Torus")); // ignore phishing warning message (handled elsewhere)
mux.ignoreStream("phishing"); // setup own event listeners
pump(connectionStream, mux, connectionStream, this._handleStreamDisconnect.bind(this, "Torus"));
// ignore phishing warning message (handled elsewhere)
mux.ignoreStream("phishing");
// setup own event listeners
// connect to async provider
const jsonRpcConnection = createStreamMiddleware();
pump(jsonRpcConnection.stream, mux.createStream(jsonRpcStreamName), jsonRpcConnection.stream, this._handleStreamDisconnect.bind(this, "Torus RpcProvider")); // handle RPC requests via dapp-side rpc engine
pump(jsonRpcConnection.stream, mux.createStream(jsonRpcStreamName), jsonRpcConnection.stream, this._handleStreamDisconnect.bind(this, "Torus RpcProvider"));
// handle RPC requests via dapp-side rpc engine
const rpcEngine = new JRPCEngine();

@@ -349,4 +338,2 @@ rpcEngine.push(createIdRemapMiddleware());

*/
async request(args) {

@@ -359,3 +346,2 @@ if (!args || typeof args !== "object" || Array.isArray(args)) {

}
const {

@@ -365,3 +351,2 @@ method,

} = args;
if (typeof method !== "string" || method.length === 0) {

@@ -373,3 +358,2 @@ throw ethErrors.rpc.invalidRequest({

}
if (params !== undefined && !Array.isArray(params) && (typeof params !== "object" || params === null)) {

@@ -381,3 +365,2 @@ throw ethErrors.rpc.invalidRequest({

}
return new Promise((resolve, reject) => {

@@ -393,4 +376,2 @@ this._rpcRequest({

*/
send(payload, callback) {

@@ -402,4 +383,2 @@ this._rpcRequest(payload, callback);

*/
sendAsync(payload) {

@@ -415,10 +394,6 @@ return new Promise((resolve, reject) => {

*/
_handleStreamDisconnect(streamName, error) {
logStreamDisconnectWarning(streamName, error, this);
this._handleDisconnect(false, error ? error.message : undefined);
}
}

@@ -430,3 +405,2 @@

}
const handlerWrapper = () => {

@@ -436,3 +410,2 @@ handler(...handlerArgs);

};
handle.addEventListener(eventName, handlerWrapper);

@@ -452,3 +425,2 @@ };

const trimmedHtml = html.trim(); // Never return a text node of whitespace as the result
template.innerHTML = trimmedHtml;

@@ -466,15 +438,8 @@ return template.content.firstChild;

super();
_defineProperty(this, "url", void 0);
_defineProperty(this, "target", void 0);
_defineProperty(this, "features", void 0);
_defineProperty(this, "window", void 0);
_defineProperty(this, "windowTimer", void 0);
_defineProperty(this, "iClosedWindow", void 0);
this.url = url;

@@ -486,6 +451,4 @@ this.target = target || "_blank";

this.iClosedWindow = false;
this._setupTimer();
}
_setupTimer() {

@@ -495,18 +458,13 @@ this.windowTimer = Number(setInterval(() => {

clearInterval(this.windowTimer);
if (!this.iClosedWindow) {
this.emit("close");
}
this.iClosedWindow = false;
this.window = undefined;
}
if (this.window === undefined) clearInterval(this.windowTimer);
}, 500));
}
open() {
var _this$window;
this.window = window.open(this.url.href, this.target, this.features);

@@ -516,3 +474,2 @@ if ((_this$window = this.window) !== null && _this$window !== void 0 && _this$window.focus) this.window.focus();

}
close() {

@@ -522,3 +479,2 @@ this.iClosedWindow = true;

}
redirect(locationReplaceOnRedirect) {

@@ -531,9 +487,6 @@ if (locationReplaceOnRedirect) {

}
}
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
class TorusCommunicationProvider extends BaseProvider {

@@ -548,20 +501,13 @@ constructor(connectionStream, _ref) {

jsonRpcStreamName
}); // private state
});
// private state
_defineProperty(this, "embedTranslations", void 0);
_defineProperty(this, "torusUrl", void 0);
_defineProperty(this, "dappStorageKey", void 0);
_defineProperty(this, "windowRefs", void 0);
_defineProperty(this, "tryWindowHandle", void 0);
_defineProperty(this, "torusAlertContainer", void 0);
_defineProperty(this, "torusIframe", void 0);
this._state = _objectSpread$2({}, TorusCommunicationProvider._defaultState); // public state
this._state = _objectSpread$2({}, TorusCommunicationProvider._defaultState);
// public state
this.torusUrl = "";

@@ -571,9 +517,8 @@ this.dappStorageKey = "";

this.embedTranslations = languageTranslations.embed;
this.windowRefs = {}; // setup own event listeners
this.windowRefs = {};
// setup own event listeners
// EIP-1193 connect
this.on("connect", () => {
this._state.isConnected = true;
});
const notificationHandler = payload => {

@@ -584,3 +529,2 @@ const {

} = payload;
if (method === COMMUNICATION_NOTIFICATIONS.IFRAME_STATUS) {

@@ -591,3 +535,2 @@ const {

} = params;
this._displayIframe({

@@ -602,3 +545,2 @@ isFull: isFullScreen,

} = params;
this._createPopupBlockAlert(windowId, url);

@@ -616,14 +558,10 @@ } else if (method === COMMUNICATION_NOTIFICATIONS.CLOSE_WINDOW) {

this._state.currentLoginProvider = null;
this._displayIframe();
}
};
this.jsonRpcConnectionEvents.on("notification", notificationHandler);
}
get isLoggedIn() {
return this._state.isLoggedIn;
}
get isIFrameFullScreen() {

@@ -635,8 +573,5 @@ return this._state.isIFrameFullScreen;

*/
isConnected() {
return this._state.isConnected;
}
async _initializeState(params) {

@@ -664,4 +599,4 @@ try {

params: []
}); // indicate that we've connected, for EIP-1193 compliance
});
// indicate that we've connected, for EIP-1193 compliance
this._handleConnect(currentLoginProvider, isLoggedIn);

@@ -676,3 +611,2 @@ } catch (error) {

}
_handleWindow(windowId) {

@@ -684,9 +618,7 @@ let {

} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
const finalUrl = new URL(url || "".concat(this.torusUrl, "/redirect?windowId=").concat(windowId));
const finalUrl = new URL(url || `${this.torusUrl}/redirect?windowId=${windowId}`);
if (this.dappStorageKey) {
// If multiple instances, it returns the first one
if (finalUrl.hash) finalUrl.hash += "&dappStorageKey=".concat(this.dappStorageKey);else finalUrl.hash = "#dappStorageKey=".concat(this.dappStorageKey);
if (finalUrl.hash) finalUrl.hash += `&dappStorageKey=${this.dappStorageKey}`;else finalUrl.hash = `#dappStorageKey=${this.dappStorageKey}`;
}
const handledWindow = new PopupHandler({

@@ -698,12 +630,9 @@ url: finalUrl,

handledWindow.open();
if (!handledWindow.window) {
this._createPopupBlockAlert(windowId, finalUrl.href);
return;
} // Add to collection only if window is opened
this.windowRefs[windowId] = handledWindow; // We tell the iframe that the window has been successfully opened
}
// Add to collection only if window is opened
this.windowRefs[windowId] = handledWindow;
// We tell the iframe that the window has been successfully opened
this.request({

@@ -726,3 +655,2 @@ method: COMMUNICATION_JRPC_METHODS.OPENED_WINDOW,

}
_displayIframe() {

@@ -733,4 +661,4 @@ let {

} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
const style = {}; // set phase
const style = {};
// set phase
if (!isFull) {

@@ -740,3 +668,2 @@ style.display = this._state.torusWidgetVisibility ? "block" : "none";

style.width = "70px";
switch (this._state.buttonPosition) {

@@ -749,3 +676,2 @@ case BUTTON_POSITION.TOP_LEFT:

break;
case BUTTON_POSITION.TOP_RIGHT:

@@ -757,3 +683,2 @@ style.top = "0px";

break;
case BUTTON_POSITION.BOTTOM_RIGHT:

@@ -765,3 +690,2 @@ style.bottom = "0px";

break;
case BUTTON_POSITION.BOTTOM_LEFT:

@@ -784,3 +708,2 @@ default:

}
Object.assign(this.torusIframe.style, style);

@@ -796,12 +719,8 @@ this._state.isIFrameFullScreen = isFull;

}
hideTorusButton() {
this._state.torusWidgetVisibility = false;
this._displayIframe();
}
showTorusButton() {
this._state.torusWidgetVisibility = true;
this._displayIframe();

@@ -813,8 +732,5 @@ }

*/
_rpcRequest(payload, callback) {
const cb = callback;
const _payload = payload;
if (!Array.isArray(_payload)) {

@@ -825,3 +741,2 @@ if (!_payload.jsonrpc) {

}
this.tryWindowHandle(_payload, cb);

@@ -836,4 +751,2 @@ }

*/
_handleConnect(currentLoginProvider, isLoggedIn) {

@@ -860,4 +773,2 @@ if (!this._state.isConnected) {

*/
_handleDisconnect(isRecoverable, errorMessage) {

@@ -867,9 +778,10 @@ if (this._state.isConnected || !this._state.isPermanentlyDisconnected && !isRecoverable) {

let error;
if (isRecoverable) {
error = new EthereumRpcError(1013, // Try again later
error = new EthereumRpcError(1013,
// Try again later
errorMessage || messages.errors.disconnected());
log.debug(error);
} else {
error = new EthereumRpcError(1011, // Internal error
error = new EthereumRpcError(1011,
// Internal error
errorMessage || messages.errors.permanentlyDisconnected());

@@ -883,8 +795,6 @@ log.error(error);

}
this.emit("disconnect", error);
}
} // Called if the iframe wants to close the window cause it is done processing the request
}
// Called if the iframe wants to close the window cause it is done processing the request
_handleCloseWindow(params) {

@@ -894,3 +804,2 @@ const {

} = params;
if (this.windowRefs[windowId]) {

@@ -901,11 +810,9 @@ this.windowRefs[windowId].close();

}
async _createPopupBlockAlert(windowId, url) {
const logoUrl = this.getLogoUrl();
const torusAlert = htmlToElement('<div id="torusAlert" class="torus-alert--v2">' + "<div id=\"torusAlert__logo\"><img src=\"".concat(logoUrl, "\" /></div>") + "<div>" + "<h1 id=\"torusAlert__title\">".concat(this.embedTranslations.actionRequired, "</h1>") + "<p id=\"torusAlert__desc\">".concat(this.embedTranslations.pendingAction, "</p>") + "</div>" + "</div>");
const successAlert = htmlToElement("<div><a id=\"torusAlert__btn\">".concat(this.embedTranslations.continue, "</a></div>"));
const torusAlert = htmlToElement('<div id="torusAlert" class="torus-alert--v2">' + `<div id="torusAlert__logo"><img src="${logoUrl}" /></div>` + "<div>" + `<h1 id="torusAlert__title">${this.embedTranslations.actionRequired}</h1>` + `<p id="torusAlert__desc">${this.embedTranslations.pendingAction}</p>` + "</div>" + "</div>");
const successAlert = htmlToElement(`<div><a id="torusAlert__btn">${this.embedTranslations.continue}</a></div>`);
const btnContainer = htmlToElement('<div id="torusAlert__btn-container"></div>');
btnContainer.appendChild(successAlert);
torusAlert.appendChild(btnContainer);
const bindOnLoad = () => {

@@ -918,3 +825,2 @@ successAlert.addEventListener("click", () => {

});
torusAlert.remove();

@@ -924,7 +830,5 @@ if (this.torusAlertContainer.children.length === 0) this.torusAlertContainer.style.display = "none";

};
const attachOnLoad = () => {
this.torusAlertContainer.appendChild(torusAlert);
};
await documentReady();

@@ -935,10 +839,7 @@ attachOnLoad();

}
getLogoUrl() {
const logoUrl = "".concat(this.torusUrl, "/images/torus_icon-blue.svg");
const logoUrl = `${this.torusUrl}/images/torus_icon-blue.svg`;
return logoUrl;
}
}
_defineProperty(TorusCommunicationProvider, "_defaultState", {

@@ -957,5 +858,3 @@ buttonPosition: "bottom-left",

function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
class TorusInPageProvider extends BaseProvider {

@@ -972,2 +871,3 @@ /**

*/
constructor(connectionStream, _ref) {

@@ -981,12 +881,9 @@ let {

jsonRpcStreamName
}); // private state
});
// private state
_defineProperty(this, "chainId", void 0);
_defineProperty(this, "selectedAddress", void 0);
_defineProperty(this, "tryWindowHandle", void 0);
this._state = _objectSpread$1({}, TorusInPageProvider._defaultState); // public state
this._state = _objectSpread$1({}, TorusInPageProvider._defaultState);
// public state
this.selectedAddress = null;

@@ -996,9 +893,8 @@ this.chainId = null;

this._handleChainChanged = this._handleChainChanged.bind(this);
this._handleUnlockStateChanged = this._handleUnlockStateChanged.bind(this); // setup own event listeners
this._handleUnlockStateChanged = this._handleUnlockStateChanged.bind(this);
// setup own event listeners
// EIP-1193 connect
this.on("connect", () => {
this._state.isConnected = true;
});
const jsonRpcNotificationHandler = payload => {

@@ -1009,3 +905,2 @@ const {

} = payload;
if (method === PROVIDER_NOTIFICATIONS.ACCOUNTS_CHANGED) {

@@ -1018,5 +913,4 @@ this._handleAccountsChanged(params);

}
}; // json rpc notification listener
};
// json rpc notification listener
this.jsonRpcConnectionEvents.on("notification", jsonRpcNotificationHandler);

@@ -1027,9 +921,7 @@ }

*/
isConnected() {
return this._state.isConnected;
} // Private Methods
}
// Private Methods
//= ===================
/**

@@ -1040,4 +932,2 @@ * Constructor helper.

*/
async _initializeState() {

@@ -1052,12 +942,10 @@ try {

params: []
}); // indicate that we've connected, for EIP-1193 compliance
});
// indicate that we've connected, for EIP-1193 compliance
this.emit("connect", {
chainId
});
this._handleChainChanged({
chainId
});
this._handleUnlockStateChanged({

@@ -1067,3 +955,2 @@ accounts,

});
this._handleAccountsChanged(accounts);

@@ -1082,4 +969,2 @@ } catch (error) {

*/
_rpcRequest(payload, callback) {

@@ -1089,3 +974,2 @@ let isInternal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

const _payload = payload;
if (!Array.isArray(_payload)) {

@@ -1095,3 +979,2 @@ if (!_payload.jsonrpc) {

}
if (_payload.method === "solana_accounts" || _payload.method === "solana_requestAccounts") {

@@ -1101,3 +984,2 @@ // handle accounts changing

this._handleAccountsChanged(res.result || [], _payload.method === "solana_accounts", isInternal);
callback(err, res);

@@ -1107,7 +989,5 @@ };

this._rpcEngine.handle(payload, cb);
return;
}
}
this.tryWindowHandle(_payload, cb);

@@ -1122,4 +1002,2 @@ }

*/
_handleConnect(chainId) {

@@ -1145,4 +1023,2 @@ if (!this._state.isConnected) {

*/
_handleDisconnect(isRecoverable, errorMessage) {

@@ -1152,9 +1028,10 @@ if (this._state.isConnected || !this._state.isPermanentlyDisconnected && !isRecoverable) {

let error;
if (isRecoverable) {
error = new EthereumRpcError(1013, // Try again later
error = new EthereumRpcError(1013,
// Try again later
errorMessage || messages.errors.disconnected());
log.debug(error);
} else {
error = new EthereumRpcError(1011, // Internal error
error = new EthereumRpcError(1011,
// Internal error
errorMessage || messages.errors.permanentlyDisconnected());

@@ -1168,3 +1045,2 @@ log.error(error);

}
this.emit("disconnect", error);

@@ -1176,4 +1052,2 @@ }

*/
_handleAccountsChanged(accounts) {

@@ -1184,3 +1058,2 @@ let isEthAccounts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

let finalAccounts = accounts;
if (!Array.isArray(finalAccounts)) {

@@ -1190,3 +1063,2 @@ log.error("Torus: Received non-array accounts parameter. Please report this bug.", finalAccounts);

}
for (const account of accounts) {

@@ -1198,5 +1070,4 @@ if (typeof account !== "string") {

}
} // emit accountsChanged if anything about the accounts array has changed
}
// emit accountsChanged if anything about the accounts array has changed
if (!dequal(this._state.accounts, finalAccounts)) {

@@ -1208,8 +1079,6 @@ // we should always have the correct accounts even before solana_accounts

}
this._state.accounts = finalAccounts;
this.emit("accountsChanged", finalAccounts);
} // handle selectedAddress
}
// handle selectedAddress
if (this.selectedAddress !== finalAccounts[0]) {

@@ -1228,4 +1097,2 @@ this.selectedAddress = finalAccounts[0] || null;

*/
_handleChainChanged() {

@@ -1235,3 +1102,2 @@ let {

} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if (!chainId) {

@@ -1243,3 +1109,2 @@ log.error("Torus: Received invalid network parameters. Please report this bug.", {

}
if (chainId === "loading") {

@@ -1249,6 +1114,4 @@ this._handleDisconnect(true);

this._handleConnect(chainId);
if (chainId !== this.chainId) {
this.chainId = chainId;
if (this._state.initialized) {

@@ -1270,4 +1133,2 @@ this.emit("chainChanged", this.chainId);

*/
_handleUnlockStateChanged() {

@@ -1278,3 +1139,2 @@ let {

} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if (typeof isUnlocked !== "boolean") {

@@ -1286,12 +1146,8 @@ log.error("Torus: Received invalid isUnlocked parameter. Please report this bug.", {

}
if (isUnlocked !== this._state.isUnlocked) {
this._state.isUnlocked = isUnlocked;
this._handleAccountsChanged(accounts || []);
}
}
}
_defineProperty(TorusInPageProvider, "_defaultState", {

@@ -1313,7 +1169,4 @@ accounts: null,

const img = document.createElement("img");
img.onload = () => resolve(true);
img.onerror = () => resolve(false);
img.src = url;

@@ -1328,4 +1181,2 @@ } catch (e) {

*/
const getSiteName = window => {

@@ -1336,17 +1187,12 @@ const {

const siteName = document.querySelector('head > meta[property="og:site_name"]');
if (siteName) {
return siteName.content;
}
const metaTitle = document.querySelector('head > meta[name="title"]');
if (metaTitle) {
return metaTitle.content;
}
if (document.title && document.title.length > 0) {
return document.title;
}
return window.location.hostname;

@@ -1357,4 +1203,2 @@ };

*/
async function getSiteIcon(window) {

@@ -1364,17 +1208,13 @@ try {

document
} = window; // Use the site's favicon if it exists
} = window;
// Use the site's favicon if it exists
let icon = document.querySelector('head > link[rel="shortcut icon"]');
if (icon && (await imgExists(icon.href))) {
return icon.href;
} // Search through available icons in no particular order
}
// Search through available icons in no particular order
icon = Array.from(document.querySelectorAll('head > link[rel="icon"]')).find(_icon => Boolean(_icon.href));
if (icon && (await imgExists(icon.href))) {
return icon.href;
}
return "";

@@ -1389,4 +1229,2 @@ } catch (error) {

*/
const getSiteMetadata = async () => ({

@@ -1398,13 +1236,7 @@ name: getSiteName(window),

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
const {
version
} = require("../package.json");
const PROVIDER_UNSAFE_METHODS = ["send_transaction", "sign_transaction", "sign_all_transactions", "sign_message", "connect"];
const COMMUNICATION_UNSAFE_METHODS = [COMMUNICATION_JRPC_METHODS.SET_PROVIDER];
const isLocalStorageAvailable = storageAvailable("localStorage"); // preload for iframe doesn't work https://bugs.chromium.org/p/chromium/issues/detail?id=593267
const isLocalStorageAvailable = storageAvailable("localStorage");
// preload for iframe doesn't work https://bugs.chromium.org/p/chromium/issues/detail?id=593267
(async function preLoadIframe() {

@@ -1417,7 +1249,6 @@ try {

} = await getTorusUrl("production");
torusIframeHtml.href = "".concat(torusUrl, "/frame");
torusIframeHtml.href = `${torusUrl}/frame`;
torusIframeHtml.crossOrigin = "anonymous";
torusIframeHtml.type = "text/html";
torusIframeHtml.rel = "prefetch";
if (torusIframeHtml.relList && torusIframeHtml.relList.supports) {

@@ -1432,3 +1263,2 @@ if (torusIframeHtml.relList.supports("prefetch")) {

})();
class Torus {

@@ -1439,32 +1269,17 @@ constructor() {

} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_defineProperty(this, "isInitialized", void 0);
_defineProperty(this, "torusAlert", void 0);
_defineProperty(this, "modalZIndex", void 0);
_defineProperty(this, "alertZIndex", void 0);
_defineProperty(this, "requestedLoginProvider", void 0);
_defineProperty(this, "provider", void 0);
_defineProperty(this, "communicationProvider", void 0);
_defineProperty(this, "dappStorageKey", void 0);
_defineProperty(this, "isTopupHidden", false);
_defineProperty(this, "torusAlertContainer", void 0);
_defineProperty(this, "torusUrl", void 0);
_defineProperty(this, "torusIframe", void 0);
_defineProperty(this, "styleLink", void 0);
this.torusUrl = "";
this.isInitialized = false; // init done
this.requestedLoginProvider = null;

@@ -1475,3 +1290,2 @@ this.modalZIndex = modalZIndex;

}
get isLoggedIn() {

@@ -1481,3 +1295,2 @@ if (!this.communicationProvider) return false;

}
async init() {

@@ -1503,3 +1316,3 @@ let {

log.info(torusUrl, "url loaded");
log.info("Solana Embed Version :".concat(version));
log.info(`Solana Embed Version :${version}`);
this.torusUrl = torusUrl;

@@ -1514,8 +1327,13 @@ log.setDefaultLevel(logLevel);

hashParams.append("origin", window.location.origin);
torusIframeUrl.hash = hashParams.toString(); // Iframe code
this.torusIframe = htmlToElement("<iframe\n id=\"torusIframe\"\n class=\"torusIframe\"\n src=\"".concat(torusIframeUrl.href, "\"\n style=\"display: none; position: fixed; top: 0; right: 0; width: 100%;\n height: 100%; border: none; border-radius: 0; z-index: ").concat(this.modalZIndex.toString(), "\"\n ></iframe>"));
this.torusAlertContainer = htmlToElement("<div id=\"torusAlertContainer\" style=\"display:none; z-index: ".concat(this.alertZIndex.toString(), "\"></div>"));
this.styleLink = htmlToElement("<link href=\"".concat(torusUrl, "/css/widget.css\" rel=\"stylesheet\" type=\"text/css\">"));
torusIframeUrl.hash = hashParams.toString();
// Iframe code
this.torusIframe = htmlToElement(`<iframe
id="torusIframe"
class="torusIframe"
src="${torusIframeUrl.href}"
style="display: none; position: fixed; top: 0; right: 0; width: 100%;
height: 100%; border: none; border-radius: 0; z-index: ${this.modalZIndex.toString()}"
></iframe>`);
this.torusAlertContainer = htmlToElement(`<div id="torusAlertContainer" style="display:none; z-index: ${this.alertZIndex.toString()}"></div>`);
this.styleLink = htmlToElement(`<link href="${torusUrl}/css/widget.css" rel="stylesheet" type="text/css">`);
const handleSetup = async () => {

@@ -1528,4 +1346,4 @@ return new Promise((resolve, reject) => {

this.torusIframe.addEventListener("load", async () => {
const dappMetadata = await getSiteMetadata(); // send init params here
const dappMetadata = await getSiteMetadata();
// send init params here
this.torusIframe.contentWindow.postMessage({

@@ -1553,14 +1371,10 @@ buttonPosition,

};
await documentReady();
await handleSetup();
}
async login() {
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if (!this.isInitialized) throw new Error("Call init() first");
try {
this.requestedLoginProvider = params.loginProvider || null;
if (!this.requestedLoginProvider) {

@@ -1570,5 +1384,4 @@ this.communicationProvider._displayIframe({

});
} // If user is already logged in, we assume they have given access to the website
}
// If user is already logged in, we assume they have given access to the website
const res = await new Promise((resolve, reject) => {

@@ -1581,8 +1394,6 @@ // We use this method because we want to update inPage provider state with account info

});
if (Array.isArray(res) && res.length > 0) {
return res;
} // This would never happen, but just in case
}
// This would never happen, but just in case
throw new Error("Login failed");

@@ -1596,3 +1407,2 @@ } catch (error) {

}
async loginWithPrivateKey(loginParams) {

@@ -1615,3 +1425,2 @@ if (!this.isInitialized) throw new Error("Call init() first");

}
async logout() {

@@ -1625,3 +1434,2 @@ if (!this.communicationProvider.isLoggedIn) throw new Error("Not logged in");

}
async cleanUp() {

@@ -1631,6 +1439,4 @@ if (this.communicationProvider.isLoggedIn) {

}
this.clearInit();
}
clearInit() {

@@ -1640,3 +1446,2 @@ function isElement(element) {

}
if (isElement(this.styleLink) && window.document.body.contains(this.styleLink)) {

@@ -1646,3 +1451,2 @@ this.styleLink.remove();

}
if (isElement(this.torusIframe) && window.document.body.contains(this.torusIframe)) {

@@ -1652,3 +1456,2 @@ this.torusIframe.remove();

}
if (isElement(this.torusAlertContainer) && window.document.body.contains(this.torusAlertContainer)) {

@@ -1659,14 +1462,10 @@ this.torusAlert = undefined;

}
this.isInitialized = false;
}
hideTorusButton() {
this.communicationProvider.hideTorusButton();
}
showTorusButton() {
this.communicationProvider.showTorusButton();
}
async setProvider(params) {

@@ -1678,3 +1477,2 @@ await this.communicationProvider.request({

}
async showWallet(path) {

@@ -1686,5 +1484,5 @@ let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

});
const finalPath = path ? "/".concat(path) : "";
const finalUrl = new URL("".concat(this.torusUrl, "/wallet").concat(finalPath)); // Using URL constructor to prevent js injection and allow parameter validation.!
const finalPath = path ? `/${path}` : "";
const finalUrl = new URL(`${this.torusUrl}/wallet${finalPath}`);
// Using URL constructor to prevent js injection and allow parameter validation.!
finalUrl.searchParams.append("instanceId", instanceId);

@@ -1694,8 +1492,6 @@ Object.keys(params).forEach(x => {

});
if (this.dappStorageKey) {
finalUrl.hash = "#dappStorageKey=".concat(this.dappStorageKey);
} // No need to track this window state. Hence, no _handleWindow call.
finalUrl.hash = `#dappStorageKey=${this.dappStorageKey}`;
}
// No need to track this window state. Hence, no _handleWindow call.
const walletWindow = new PopupHandler({

@@ -1707,3 +1503,2 @@ url: finalUrl,

}
async getUserInfo() {

@@ -1716,9 +1511,6 @@ const userInfoResponse = await this.communicationProvider.request({

}
async initiateTopup(provider, params) {
if (!this.isInitialized) throw new Error("Torus is not initialized");
const windowId = getWindowId();
this.communicationProvider._handleWindow(windowId);
const topupResponse = await this.communicationProvider.request({

@@ -1733,5 +1525,4 @@ method: COMMUNICATION_JRPC_METHODS.TOPUP,

return topupResponse;
} // Solana specific API
}
// Solana specific API
async getAccounts() {

@@ -1744,3 +1535,2 @@ const response = await this.provider.request({

}
async sendTransaction(transaction) {

@@ -1756,5 +1546,4 @@ const response = await this.provider.request({

return response;
} // support sendOptions
}
// support sendOptions
async signAndSendTransaction(transaction, options) {

@@ -1774,3 +1563,2 @@ const response = await this.provider.request({

}
async signTransaction(transaction) {

@@ -1783,4 +1571,4 @@ const response = await this.provider.request({

}
}); // reconstruct signature pair
});
// reconstruct signature pair
const parsed = JSON.parse(response);

@@ -1794,3 +1582,2 @@ const signature = {

}
async signAllTransactions(transactions) {

@@ -1806,4 +1593,4 @@ const encodedMessage = transactions.map(tx => {

}
}); // reconstruct signature pairs
});
// reconstruct signature pairs
const signatures = responses.map(item => {

@@ -1822,3 +1609,2 @@ const parsed = JSON.parse(item);

}
async signMessage(data) {

@@ -1833,3 +1619,2 @@ const response = await this.provider.request({

}
async getGaslessPublicKey() {

@@ -1841,3 +1626,4 @@ const response = await this.provider.request({

return response;
} // async connect(): Promise<boolean> {
}
// async connect(): Promise<boolean> {
// const response = (await this.provider.request({

@@ -1849,11 +1635,8 @@ // method: "connect",

// }
handleDappStorageKey(useLocalStorage) {
let dappStorageKey = "";
if (isLocalStorageAvailable && useLocalStorage) {
const storedKey = window.localStorage.getItem(configuration.localStorageKey);
if (storedKey) dappStorageKey = storedKey;else {
const generatedKey = "torus-app-".concat(getWindowId());
const generatedKey = `torus-app-${getWindowId()}`;
window.localStorage.setItem(configuration.localStorageKey, generatedKey);

@@ -1863,10 +1646,8 @@ dappStorageKey = generatedKey;

}
this.dappStorageKey = dappStorageKey;
return dappStorageKey;
}
async _setupWeb3(providerParams) {
log.info("setupWeb3 running"); // setup background connection
log.info("setupWeb3 running");
// setup background connection
const providerStream = new BasePostMessageStream({

@@ -1876,4 +1657,4 @@ name: "embed_torus",

targetWindow: this.torusIframe.contentWindow
}); // We create another LocalMessageDuplexStream for communication between dapp <> iframe
});
// We create another LocalMessageDuplexStream for communication between dapp <> iframe
const communicationStream = new BasePostMessageStream({

@@ -1883,52 +1664,39 @@ name: "embed_communication",

targetWindow: this.torusIframe.contentWindow
}); // compose the inPage provider
});
// compose the inPage provider
const inPageProvider = new TorusInPageProvider(providerStream, {});
const communicationProvider = new TorusCommunicationProvider(communicationStream, {});
inPageProvider.tryWindowHandle = (payload, cb) => {
const _payload = payload;
if (!Array.isArray(_payload) && PROVIDER_UNSAFE_METHODS.includes(_payload.method)) {
if (!this.communicationProvider.isLoggedIn) throw new Error("User Not Logged In");
const windowId = getWindowId();
communicationProvider._handleWindow(windowId, {
target: "_blank",
features: getPopupFeatures(FEATURES_CONFIRM_WINDOW)
}); // for inPageProvider methods sending windowId in request instead of params
});
// for inPageProvider methods sending windowId in request instead of params
// as params might be positional.
_payload.windowId = windowId;
}
inPageProvider._rpcEngine.handle(_payload, cb);
};
communicationProvider.tryWindowHandle = (payload, cb) => {
const _payload = payload;
if (!Array.isArray(_payload) && COMMUNICATION_UNSAFE_METHODS.includes(_payload.method)) {
const windowId = getWindowId();
communicationProvider._handleWindow(windowId, {
target: "_blank",
features: getPopupFeatures(FEATURES_PROVIDER_CHANGE_WINDOW) // todo: are these features generic for all
}); // for communication methods sending window id in jrpc req params
});
// for communication methods sending window id in jrpc req params
_payload.params.windowId = windowId;
}
communicationProvider._rpcEngine.handle(_payload, cb);
}; // detect solana_requestAccounts and pipe to enable for now
};
// detect solana_requestAccounts and pipe to enable for now
const detectAccountRequestPrototypeModifier = m => {
const originalMethod = inPageProvider[m]; // eslint-disable-next-line @typescript-eslint/no-this-alias
const originalMethod = inPageProvider[m];
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;
inPageProvider[m] = function providerFunc(request, cb) {

@@ -1939,3 +1707,2 @@ const {

} = request;
if (method === "solana_requestAccounts") {

@@ -1947,12 +1714,12 @@ if (!cb) return self.login({

loginProvider: params[0]
}) // eslint-disable-next-line promise/no-callback-in-promise
.then(res => cb(null, res)) // eslint-disable-next-line promise/no-callback-in-promise
})
// eslint-disable-next-line promise/no-callback-in-promise
.then(res => cb(null, res))
// eslint-disable-next-line promise/no-callback-in-promise
.catch(err => cb(err));
}
return originalMethod.apply(this, [request, cb]);
};
}; // Detects call to solana_requestAccounts in request & sendAsync and passes to login
};
// Detects call to solana_requestAccounts in request & sendAsync and passes to login
detectAccountRequestPrototypeModifier("request");

@@ -1980,3 +1747,2 @@ detectAccountRequestPrototypeModifier("sendAsync");

}
}

@@ -1983,0 +1749,0 @@

@@ -17,13 +17,8 @@ /*!

/*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
/**
* [js-sha3]{@link https://github.com/emn178/js-sha3}
*
* @version 0.8.0
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2015-2018
* @license MIT
*/
{
"name": "@toruslabs/solana-embed",
"version": "0.3.0",
"version": "0.3.1",
"description": "Embed script for solana blockchain",

@@ -9,3 +9,3 @@ "main": "dist/solanaEmbed.cjs.js",

"jsdelivr": "dist/solanaEmbed.umd.min.js",
"types": "dist/types/index.d.ts",
"types": "dist/types/src/index.d.ts",
"files": [

@@ -17,3 +17,3 @@ "dist",

"start": "torus-scripts start",
"build": "torus-scripts build",
"build": "rimraf dist/ && torus-scripts build",
"build:test": "cross-env NODE_ENV=testing torus-scripts build",

@@ -31,5 +31,5 @@ "release": "torus-scripts release",

"@solana/web3.js": "^1.36.0",
"@toruslabs/base-controllers": "^2.2.3",
"@toruslabs/http-helpers": "^3.0.0",
"@toruslabs/openlogin-jrpc": "^2.0.0",
"@toruslabs/base-controllers": "^2.2.6",
"@toruslabs/http-helpers": "^3.2.0",
"@toruslabs/openlogin-jrpc": "^2.6.0",
"eth-rpc-errors": "^4.0.3",

@@ -46,9 +46,10 @@ "fast-deep-equal": "^3.1.3",

"devDependencies": {
"@babel/register": "^7.17.7",
"@babel/runtime": "^7.18.9",
"@babel/register": "^7.18.9",
"@babel/runtime": "^7.20.1",
"@commitlint/cli": "^16.2.4",
"@commitlint/config-conventional": "^16.2.4",
"@commitlint/is-ignored": "^16.2.4",
"@toruslabs/eslint-config-typescript": "^1.0.6",
"@toruslabs/torus-scripts": "^1.0.9",
"@rollup/plugin-json": "^5.0.1",
"@toruslabs/eslint-config-typescript": "^1.1.3",
"@toruslabs/torus-scripts": "^1.2.4",
"@types/bs58": "^4.0.1",

@@ -58,22 +59,22 @@ "@types/node": "^17.0.45",

"@types/pump": "^1.1.1",
"@types/readable-stream": "^2.3.14",
"@typescript-eslint/eslint-plugin": "^5.25.0",
"@typescript-eslint/parser": "^5.25.0",
"@types/readable-stream": "^2.3.15",
"@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0",
"cross-env": "^7.0.3",
"eslint": "^8.15.0",
"eslint": "^8.27.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-mocha": "^10.0.5",
"eslint-plugin-n": "^15.2.4",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint-plugin-tsdoc": "^0.2.16",
"eslint-plugin-mocha": "^10.1.0",
"eslint-plugin-n": "^15.5.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-simple-import-sort": "^8.0.0",
"eslint-plugin-tsdoc": "^0.2.17",
"husky": "^8.0.1",
"lint-staged": "^12.4.3",
"mocha": "^10.0.0",
"prettier": "^2.6.2",
"puppeteer": "^14.1.2",
"lint-staged": "^13.0.3",
"mocha": "^10.1.0",
"prettier": "^2.7.1",
"puppeteer": "^19.2.2",
"rimraf": "^3.0.2",
"ts-node": "^10.7.0",
"typescript": "^4.6.4"
"ts-node": "^10.9.1",
"typescript": "^4.8.4"
},

@@ -80,0 +81,0 @@ "mocha": {

@@ -1,6 +0,62 @@

# Torus Embed — New Frictionless login for Dapps
# Solana Embed (by Web3Auth)
[![npm version](https://badge.fury.io/js/%40toruslabs%2Fsolana-embed.svg)](https://badge.fury.io/js/%40toruslabs%2Fsolana-embed)
![npm](https://img.shields.io/npm/dw/@toruslabs/solana-embed)
[![minzip](https://img.shields.io/bundlephobia/minzip/@toruslabs/solana-embed?label=%22%22)](https://bundlephobia.com/result?p=@toruslabs/solana-embed)
> [Web3Auth](https://web3auth.io) is where passwordless auth meets non-custodial key infrastructure for Web3 apps and wallets. By aggregating OAuth (Google, Twitter, Discord) logins, different wallets and innovative Multi Party Computation (MPC) - Web3Auth provides a seamless login experience to every user on your application.
## 📖 Documentation
Checkout the official [Torus Documentation for Solana Embed](https://docs.tor.us/solana-wallet/api-reference/installation) to get started.
## 🔗 Installation
```shell
npm install --save @toruslabs/solana-embed
```
## ⚡ Quick Start
### Get your Client ID from Web3Auth Dashboard
Hop on to the [Web3Auth Dashboard](https://dashboard.web3auth.io/) and create a new Torus Wallet project. Use the Client ID of the project to start your integration.
![Web3Auth Dashboard - Torus Wallets](https://user-images.githubusercontent.com/6962565/187207779-9420f4ad-17e8-43fa-b578-0bc64f50e4d3.png)
## Initialize & Login
```ts
import Torus from "@toruslabs/solana-embed";
const torus = new Torus();
await torus.init({
buttonPosition: "top-left", // default: bottom-left
buildEnv: "production", // default: production
enableLogging: true, // default: false
showTorusButton: false, // default: true
whitelabel: {
theme: { isDark: true, colors: { torusBrand1: "#00a8ff" } },
logoDark: "https://web3auth.io/images/w3a-L-Favicon-1.svg",
logoLight: "https://web3auth.io/images/w3a-D-Favicon-1.svg",
topupHide: true,
},
});
await torus.login();
```
## 🩹 Examples
Checkout the examples `Solana Embed` in our [example directory.](https://github.com/torusresearch/solana-embed/tree/main/examples/vue-app)
## 🌐 Demo
Checkout the [Web3Auth Demo](https://demo-solana.tor.us/) to see how `Solana Embed` can be used in your application.
## 💬 Troubleshooting and Discussions
- Have a look at our [GitHub Discussions](https://github.com/Web3Auth/Web3Auth/discussions?discussions_q=sort%3Atop) to see if anyone has any questions or issues you might be having.
- Checkout our [Troubleshooting Documentation Page](https://web3auth.io/docs/troubleshooting) to know the common issues and solutions
- Join our [Discord](https://discord.gg/web3auth) to join our community and get private integration support or help with your integration.
## Introduction

@@ -12,4 +68,2 @@

Please refer to docs for API Reference available [here](https://docs.tor.us/wallet/api-reference/installation) or [change log](https://docs.tor.us/torus-wallet/changelog).
## Features

@@ -19,4 +73,2 @@

Please refer to docs for API Reference available [here](https://docs.tor.us/wallet/api-reference/installation) or [change log](https://docs.tor.us/torus-wallet/changelog).
## Installation

@@ -93,3 +145,3 @@

- This package requires a peer dependency of `@babel/runtime`
- Node 10+
- Node 14+

@@ -96,0 +148,0 @@ ## License

@@ -6,2 +6,3 @@ import { PublicKey, SendOptions, SignaturePubkeyPair, Transaction } from "@solana/web3.js";

import { version } from "../package.json";
import TorusCommunicationProvider from "./communicationProvider";

@@ -37,4 +38,2 @@ import configuration from "./config";

} from "./utils";
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { version } = require("../package.json");
const PROVIDER_UNSAFE_METHODS = ["send_transaction", "sign_transaction", "sign_all_transactions", "sign_message", "connect"];

@@ -41,0 +40,0 @@ const COMMUNICATION_UNSAFE_METHODS = [COMMUNICATION_JRPC_METHODS.SET_PROVIDER];

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc