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

walletlink

Package Overview
Dependencies
Maintainers
3
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

walletlink - npm Package Compare versions

Comparing version 2.4.2 to 2.4.3

1

dist/components/Snackbar.d.ts

@@ -7,2 +7,3 @@ export interface SnackbarOptions {

menuItems?: SnackbarMenuItem[];
autoExpand?: boolean;
}

@@ -9,0 +10,0 @@ export interface SnackbarMenuItem {

4

dist/components/Snackbar.js

@@ -54,5 +54,5 @@ "use strict";

(0, preact_1.h)("div", { class: "-walletlink-snackbar" }, props.children)));
const SnackbarInstance = ({ message, menuItems }) => {
const SnackbarInstance = ({ autoExpand, message, menuItems }) => {
const [hidden, setHidden] = (0, hooks_1.useState)(true);
const [expanded, setExpanded] = (0, hooks_1.useState)(false);
const [expanded, setExpanded] = (0, hooks_1.useState)(autoExpand !== null && autoExpand !== void 0 ? autoExpand : false);
(0, hooks_1.useEffect)(() => {

@@ -59,0 +59,0 @@ const timers = [

@@ -15,2 +15,4 @@ export declare const EVENTS: {

GENERAL_ERROR: string;
WEB3_REQUEST: string;
WEB3_RESPONSE: string;
};

@@ -18,2 +18,4 @@ "use strict";

GENERAL_ERROR: "walletlink_sdk.general_error",
WEB3_REQUEST: "walletlink_sdk.web3.request",
WEB3_RESPONSE: "walletlink_sdk.web3.response"
};

@@ -54,2 +54,3 @@ import { EthereumAddressFromSignedMessageRequest, SignEthereumMessageRequest, SignEthereumTransactionRequest, SubmitEthereumTransactionRequest } from "../relay/Web3Request";

showConnecting(options: {
isUnlinkedErrorState?: boolean;
onCancel: () => void;

@@ -56,0 +57,0 @@ onResetConnection: () => void;

@@ -69,27 +69,48 @@ "use strict";

showConnecting(options) {
const snackbarProps = {
message: "Confirm on phone",
menuItems: [
{
isRed: true,
info: "Cancel transaction",
svgWidth: "11",
svgHeight: "11",
path: "M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",
defaultFillRule: "inherit",
defaultClipRule: "inherit",
onClick: options.onCancel
},
{
isRed: false,
info: "Reset connection",
svgWidth: "10",
svgHeight: "11",
path: "M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",
defaultFillRule: "evenodd",
defaultClipRule: "evenodd",
onClick: options.onResetConnection
}
]
};
let snackbarProps;
if (options.isUnlinkedErrorState) {
snackbarProps = {
autoExpand: true,
message: "Connection lost",
menuItems: [
{
isRed: false,
info: "Reset connection",
svgWidth: "10",
svgHeight: "11",
path: "M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",
defaultFillRule: "evenodd",
defaultClipRule: "evenodd",
onClick: options.onResetConnection
}
]
};
}
else {
snackbarProps = {
message: "Confirm on phone",
menuItems: [
{
isRed: true,
info: "Cancel transaction",
svgWidth: "11",
svgHeight: "11",
path: "M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",
defaultFillRule: "inherit",
defaultClipRule: "inherit",
onClick: options.onCancel
},
{
isRed: false,
info: "Reset connection",
svgWidth: "10",
svgHeight: "11",
path: "M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",
defaultFillRule: "evenodd",
defaultClipRule: "evenodd",
onClick: options.onResetConnection
}
]
};
}
return this.snackbar.presentItem(snackbarProps);

@@ -96,0 +117,0 @@ }

@@ -75,2 +75,3 @@ import { Observable } from "rxjs";

abstract showConnecting(options: {
isUnlinkedErrorState?: boolean;
onCancel: () => void;

@@ -77,0 +78,0 @@ onResetConnection: () => void;

@@ -38,2 +38,3 @@ /// <reference types="node" />

isLinked: boolean | undefined;
isUnlinkedErrorState: boolean | undefined;
constructor(options: Readonly<WalletLinkRelayOptions>);

@@ -74,3 +75,4 @@ attachUI(): void;

switchEthereumChain(chainId: string): CancelablePromise<SwitchEthereumChainResponse>;
private getSessionIdHash;
private sendRequestStandalone;
}

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

const bind_decorator_1 = __importDefault(require("bind-decorator"));
const eth_rpc_errors_1 = require("eth-rpc-errors");
const rxjs_1 = require("rxjs");

@@ -51,3 +52,2 @@ const operators_1 = require("rxjs/operators");

const Web3ResponseMessage_1 = require("./Web3ResponseMessage");
const eth_rpc_errors_1 = require("eth-rpc-errors");
class WalletLinkRelay extends WalletLinkRelayAbstract_1.WalletLinkRelayAbstract {

@@ -79,6 +79,8 @@ constructor(options) {

const cachedAddresses = this.storage.getItem(WalletLinkRelayAbstract_1.LOCAL_STORAGE_ADDRESSES_KEY);
this.isUnlinkedErrorState = false;
if (cachedAddresses) {
const addresses = cachedAddresses.split(" ");
if (addresses[0] !== "" && !linked) {
const sessionIdHash = Session_1.Session.hash(this._session.id);
this.isUnlinkedErrorState = true;
const sessionIdHash = this.getSessionIdHash();
(_a = this.walletLinkAnalytics) === null || _a === void 0 ? void 0 : _a.sendEvent(init_1.EVENTS.UNLINKED_ERROR_STATE, { sessionIdHash });

@@ -97,3 +99,3 @@ }

alreadyDestroyed,
sessionIdHash: Session_1.Session.hash(this._session.id)
sessionIdHash: this.getSessionIdHash()
});

@@ -213,3 +215,3 @@ return this.resetAndReload();

sessionMetadataChange: "__destroyed, 1",
sessionIdHash: Session_1.Session.hash(this._session.id)
sessionIdHash: this.getSessionIdHash()
});

@@ -223,4 +225,4 @@ this.connection.destroy();

method: "relay::resetAndReload",
message: `faled to reset and relod with ${err}`,
sessionIdHash: Session_1.Session.hash(this._session.id)
message: `failed to reset and reload with ${err}`,
sessionIdHash: this.getSessionIdHash()
});

@@ -352,2 +354,3 @@ });

hideSnackbarItem = this.ui.showConnecting({
isUnlinkedErrorState: this.isUnlinkedErrorState,
onCancel: cancel,

@@ -383,3 +386,9 @@ onResetConnection: this.resetAndReload // eslint-disable-line @typescript-eslint/unbound-method

publishWeb3RequestEvent(id, request) {
var _a;
const message = (0, Web3RequestMessage_1.Web3RequestMessage)({ id, request });
(_a = this.walletLinkAnalytics) === null || _a === void 0 ? void 0 : _a.sendEvent(init_1.EVENTS.WEB3_RESPONSE, {
eventId: message.id,
method: `relay::${message.request.method}`,
sessionIdHash: this.getSessionIdHash()
});
this.subscriptions.add(this.publishEvent("Web3Request", message, true).subscribe({

@@ -441,3 +450,9 @@ error: err => {

handleWeb3ResponseMessage(message) {
var _a;
const { response } = message;
(_a = this.walletLinkAnalytics) === null || _a === void 0 ? void 0 : _a.sendEvent(init_1.EVENTS.WEB3_RESPONSE, {
eventId: message.id,
method: `relay::${response.method}`,
sessionIdHash: this.getSessionIdHash()
});
if ((0, Web3Response_1.isRequestEthereumAccountsResponse)(response)) {

@@ -539,2 +554,3 @@ Array.from(WalletLinkRelay.accountRequestCallbackIds.values()).forEach(id => this.invokeCallback(Object.assign(Object.assign({}, message), { id })));

hideSnackbarItem = this.ui.showConnecting({
isUnlinkedErrorState: this.isUnlinkedErrorState,
onCancel: cancel,

@@ -555,3 +571,6 @@ onResetConnection: this.resetAndReload // eslint-disable-line @typescript-eslint/unbound-method

id,
response: (0, Web3Response_1.AddEthereumChainResponse)({ isApproved: false, rpcUrl: "" })
response: (0, Web3Response_1.AddEthereumChainResponse)({
isApproved: false,
rpcUrl: ""
})
}));

@@ -571,6 +590,8 @@ };

rpcUrls: request.params.rpcUrls,
blockExplorerUrls: request.params.blockExplorerUrls,
blockExplorerUrls: request.params
.blockExplorerUrls,
chainName: request.params.chainName,
iconUrls: request.params.iconUrls,
nativeCurrency: request.params.nativeCurrency,
nativeCurrency: request.params
.nativeCurrency
});

@@ -603,2 +624,3 @@ }

hideSnackbarItem = this.ui.showConnecting({
isUnlinkedErrorState: this.isUnlinkedErrorState,
onCancel: cancel,

@@ -614,3 +636,3 @@ onResetConnection: this.resetAndReload // eslint-disable-line @typescript-eslint/unbound-method

code: response.errorCode,
message: `Unrecognized chain ID. Try adding the chain using addEthereumChain first.`,
message: `Unrecognized chain ID. Try adding the chain using addEthereumChain first.`
}));

@@ -635,3 +657,3 @@ }

isApproved: false,
rpcUrl: "",
rpcUrl: ""
})

@@ -661,2 +683,5 @@ }));

}
getSessionIdHash() {
return Session_1.Session.hash(this._session.id);
}
sendRequestStandalone(id, request) {

@@ -663,0 +688,0 @@ const _cancel = () => {

{
"name": "walletlink",
"version": "2.4.2",
"version": "2.4.3",
"description": "WalletLink JavaScript SDK",

@@ -5,0 +5,0 @@ "keywords": [

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