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

@solflare-wallet/metamask-sdk

Package Overview
Dependencies
Maintainers
7
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solflare-wallet/metamask-sdk - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

5

lib/cjs/index.d.ts
import { PublicKey, SendOptions } from '@solana/web3.js';
import { SolflareConfig, TransactionOrVersionedTransaction } from './types';
import { SolflareMetamaskConfig, TransactionOrVersionedTransaction } from './types';
import EventEmitter from 'eventemitter3';
export default class SolflareMetamask extends EventEmitter {
private _network;
private _iframeParams;
private _element;

@@ -13,3 +14,3 @@ private _iframe;

private static IFRAME_URL;
constructor(config?: SolflareConfig);
constructor(config?: SolflareMetamaskConfig);
get publicKey(): PublicKey | null;

@@ -16,0 +17,0 @@ get isConnected(): boolean;

16

lib/cjs/index.js

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

_this._network = 'mainnet-beta';
_this._iframeParams = {};
_this._element = null;

@@ -210,6 +211,7 @@ _this._iframe = null;

_this._removeDanglingElements();
var network = encodeURIComponent(_this._network);
var origin = encodeURIComponent(window.location.origin);
var title = encodeURIComponent(document.title);
var iframeUrl = "".concat(SolflareMetamask.IFRAME_URL, "?cluster=").concat(network, "&origin=").concat(origin, "&title=").concat(title);
var params = __assign(__assign({}, _this._iframeParams), { cluster: _this._network || 'mainnet-beta', origin: window.location.origin || '', title: document.title || '' });
var queryString = Object.keys(params)
.map(function (key) { return "".concat(key, "=").concat(encodeURIComponent(params[key])); })
.join('&');
var iframeUrl = "".concat(SolflareMetamask.IFRAME_URL, "?").concat(queryString);
_this._element = document.createElement('div');

@@ -278,2 +280,8 @@ _this._element.className = 'solflare-metamask-wallet-adapter-iframe';

}
if (window.SolflareMetamaskParams) {
_this._iframeParams = __assign(__assign({}, _this._iframeParams), window.SolflareMetamaskParams);
}
if (config === null || config === void 0 ? void 0 : config.params) {
_this._iframeParams = __assign(__assign({}, _this._iframeParams), config === null || config === void 0 ? void 0 : config.params);
}
return _this;

@@ -280,0 +288,0 @@ }

import { Cluster, Transaction, VersionedTransaction } from '@solana/web3.js';
export type TransactionOrVersionedTransaction = Transaction | VersionedTransaction;
export interface SolflareConfig {
export interface SolflareMetamaskConfig {
network?: Cluster;
params?: Record<string, any>;
}

@@ -56,1 +57,4 @@ export interface SolflareIframeEvent {

};
export interface WindowWithParams extends Window {
SolflareMetamaskParams?: Record<string, any>;
}
import { PublicKey, SendOptions } from '@solana/web3.js';
import { SolflareConfig, TransactionOrVersionedTransaction } from './types';
import { SolflareMetamaskConfig, TransactionOrVersionedTransaction } from './types';
import EventEmitter from 'eventemitter3';
export default class SolflareMetamask extends EventEmitter {
private _network;
private _iframeParams;
private _element;

@@ -13,3 +14,3 @@ private _iframe;

private static IFRAME_URL;
constructor(config?: SolflareConfig);
constructor(config?: SolflareMetamaskConfig);
get publicKey(): PublicKey | null;

@@ -16,0 +17,0 @@ get isConnected(): boolean;

@@ -84,2 +84,3 @@ var __extends = (this && this.__extends) || (function () {

_this._network = 'mainnet-beta';
_this._iframeParams = {};
_this._element = null;

@@ -205,6 +206,7 @@ _this._iframe = null;

_this._removeDanglingElements();
var network = encodeURIComponent(_this._network);
var origin = encodeURIComponent(window.location.origin);
var title = encodeURIComponent(document.title);
var iframeUrl = "".concat(SolflareMetamask.IFRAME_URL, "?cluster=").concat(network, "&origin=").concat(origin, "&title=").concat(title);
var params = __assign(__assign({}, _this._iframeParams), { cluster: _this._network || 'mainnet-beta', origin: window.location.origin || '', title: document.title || '' });
var queryString = Object.keys(params)
.map(function (key) { return "".concat(key, "=").concat(encodeURIComponent(params[key])); })
.join('&');
var iframeUrl = "".concat(SolflareMetamask.IFRAME_URL, "?").concat(queryString);
_this._element = document.createElement('div');

@@ -273,2 +275,8 @@ _this._element.className = 'solflare-metamask-wallet-adapter-iframe';

}
if (window.SolflareMetamaskParams) {
_this._iframeParams = __assign(__assign({}, _this._iframeParams), window.SolflareMetamaskParams);
}
if (config === null || config === void 0 ? void 0 : config.params) {
_this._iframeParams = __assign(__assign({}, _this._iframeParams), config === null || config === void 0 ? void 0 : config.params);
}
return _this;

@@ -275,0 +283,0 @@ }

import { Cluster, Transaction, VersionedTransaction } from '@solana/web3.js';
export type TransactionOrVersionedTransaction = Transaction | VersionedTransaction;
export interface SolflareConfig {
export interface SolflareMetamaskConfig {
network?: Cluster;
params?: Record<string, any>;
}

@@ -56,1 +57,4 @@ export interface SolflareIframeEvent {

};
export interface WindowWithParams extends Window {
SolflareMetamaskParams?: Record<string, any>;
}
{
"name": "@solflare-wallet/metamask-sdk",
"version": "0.0.3",
"version": "0.0.4",
"description": "",

@@ -5,0 +5,0 @@ "repository": "https://github.com/solflare-wallet/solflare-metamask-sdk",

@@ -5,3 +5,3 @@ import { Cluster, PublicKey, SendOptions } from '@solana/web3.js';

PromiseCallback,
SolflareConfig,
SolflareMetamaskConfig,
SolflareIframeEvent,

@@ -12,3 +12,4 @@ SolflareIframeMessage,

SolflareIframeResizeMessage,
TransactionOrVersionedTransaction
TransactionOrVersionedTransaction,
WindowWithParams
} from './types';

@@ -22,2 +23,3 @@ import EventEmitter from 'eventemitter3';

private _network: Cluster = 'mainnet-beta';
private _iframeParams: Record<string, any> = {};
private _element: HTMLElement | null = null;

@@ -32,3 +34,3 @@ private _iframe: HTMLIFrameElement | null = null;

constructor(config?: SolflareConfig) {
constructor(config?: SolflareMetamaskConfig) {
super();

@@ -39,2 +41,16 @@

}
if ((window as WindowWithParams).SolflareMetamaskParams) {
this._iframeParams = {
...this._iframeParams,
...(window as WindowWithParams).SolflareMetamaskParams
};
}
if (config?.params) {
this._iframeParams = {
...this._iframeParams,
...config?.params
};
}
}

@@ -298,8 +314,15 @@

const network = encodeURIComponent(this._network);
const origin = encodeURIComponent(window.location.origin);
const title = encodeURIComponent(document.title);
const params = {
...this._iframeParams,
cluster: this._network || 'mainnet-beta',
origin: window.location.origin || '',
title: document.title || ''
};
const iframeUrl = `${SolflareMetamask.IFRAME_URL}?cluster=${network}&origin=${origin}&title=${title}`;
const queryString = Object.keys(params)
.map((key) => `${key}=${encodeURIComponent(params[key])}`)
.join('&');
const iframeUrl = `${SolflareMetamask.IFRAME_URL}?${queryString}`;
this._element = document.createElement('div');

@@ -306,0 +329,0 @@ this._element.className = 'solflare-metamask-wallet-adapter-iframe';

@@ -5,4 +5,5 @@ import { Cluster, Transaction, VersionedTransaction } from '@solana/web3.js';

export interface SolflareConfig {
export interface SolflareMetamaskConfig {
network?: Cluster;
params?: Record<string, any>;
}

@@ -74,1 +75,5 @@

};
export interface WindowWithParams extends Window {
SolflareMetamaskParams?: Record<string, any>;
}
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