@solflare-wallet/metamask-sdk
Advanced tools
Comparing version 0.0.8 to 0.0.9
import { PublicKey, SendOptions } from '@solana/web3.js'; | ||
import { SolflareMetamaskConfig, TransactionOrVersionedTransaction } from './types'; | ||
import { SolflareMetaMaskConfig, TransactionOrVersionedTransaction } from './types'; | ||
import EventEmitter from 'eventemitter3'; | ||
export default class SolflareMetamask extends EventEmitter { | ||
export default class SolflareMetaMask extends EventEmitter { | ||
private _network; | ||
@@ -14,3 +14,3 @@ private _iframeParams; | ||
private static IFRAME_URL; | ||
constructor(config?: SolflareMetamaskConfig); | ||
constructor(config?: SolflareMetaMaskConfig); | ||
get publicKey(): PublicKey | null; | ||
@@ -17,0 +17,0 @@ get isConnected(): boolean; |
@@ -85,5 +85,5 @@ "use strict"; | ||
var detectProvider_1 = require("./detectProvider"); | ||
var SolflareMetamask = /** @class */ (function (_super) { | ||
__extends(SolflareMetamask, _super); | ||
function SolflareMetamask(config) { | ||
var SolflareMetaMask = /** @class */ (function (_super) { | ||
__extends(SolflareMetaMask, _super); | ||
function SolflareMetaMask(config) { | ||
var _this = _super.call(this) || this; | ||
@@ -212,7 +212,7 @@ _this._network = 'mainnet-beta'; | ||
_this._removeDanglingElements(); | ||
var params = __assign(__assign({}, _this._iframeParams), { cluster: _this._network || 'mainnet-beta', origin: window.location.origin || '', title: document.title || '' }); | ||
var params = __assign(__assign({}, _this._iframeParams), { mm: true, v: 1, 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); | ||
var iframeUrl = "".concat(SolflareMetaMask.IFRAME_URL, "?").concat(queryString); | ||
_this._element = document.createElement('div'); | ||
@@ -281,4 +281,4 @@ _this._element.className = 'solflare-metamask-wallet-adapter-iframe'; | ||
} | ||
if (window.SolflareMetamaskParams) { | ||
_this._iframeParams = __assign(__assign({}, _this._iframeParams), window.SolflareMetamaskParams); | ||
if (window.SolflareMetaMaskParams) { | ||
_this._iframeParams = __assign(__assign({}, _this._iframeParams), window.SolflareMetaMaskParams); | ||
} | ||
@@ -290,3 +290,3 @@ if (config === null || config === void 0 ? void 0 : config.params) { | ||
} | ||
Object.defineProperty(SolflareMetamask.prototype, "publicKey", { | ||
Object.defineProperty(SolflareMetaMask.prototype, "publicKey", { | ||
get: function () { | ||
@@ -298,3 +298,3 @@ return this._publicKey ? new web3_js_1.PublicKey(this._publicKey) : null; | ||
}); | ||
Object.defineProperty(SolflareMetamask.prototype, "isConnected", { | ||
Object.defineProperty(SolflareMetaMask.prototype, "isConnected", { | ||
get: function () { | ||
@@ -306,3 +306,3 @@ return this._isConnected; | ||
}); | ||
Object.defineProperty(SolflareMetamask.prototype, "connected", { | ||
Object.defineProperty(SolflareMetaMask.prototype, "connected", { | ||
get: function () { | ||
@@ -314,3 +314,3 @@ return this.isConnected; | ||
}); | ||
Object.defineProperty(SolflareMetamask.prototype, "autoApprove", { | ||
Object.defineProperty(SolflareMetaMask.prototype, "autoApprove", { | ||
get: function () { | ||
@@ -322,3 +322,3 @@ return false; | ||
}); | ||
SolflareMetamask.prototype.connect = function () { | ||
SolflareMetaMask.prototype.connect = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -343,3 +343,3 @@ var _this = this; | ||
}; | ||
SolflareMetamask.prototype.disconnect = function () { | ||
SolflareMetaMask.prototype.disconnect = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -360,3 +360,3 @@ return __generator(this, function (_a) { | ||
}; | ||
SolflareMetamask.prototype.signTransaction = function (transaction) { | ||
SolflareMetaMask.prototype.signTransaction = function (transaction) { | ||
var _a; | ||
@@ -393,3 +393,3 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
SolflareMetamask.prototype.signAllTransactions = function (transactions) { | ||
SolflareMetaMask.prototype.signAllTransactions = function (transactions) { | ||
var _a; | ||
@@ -430,3 +430,3 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
SolflareMetamask.prototype.signAndSendTransaction = function (transaction, options) { | ||
SolflareMetaMask.prototype.signAndSendTransaction = function (transaction, options) { | ||
var _a; | ||
@@ -463,3 +463,3 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
SolflareMetamask.prototype.signMessage = function (data, display) { | ||
SolflareMetaMask.prototype.signMessage = function (data, display) { | ||
var _a; | ||
@@ -496,3 +496,3 @@ if (display === void 0) { display = 'utf8'; } | ||
}; | ||
SolflareMetamask.prototype.sign = function (data, display) { | ||
SolflareMetaMask.prototype.sign = function (data, display) { | ||
if (display === void 0) { display = 'utf8'; } | ||
@@ -508,3 +508,3 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
SolflareMetamask.isSupported = function () { | ||
SolflareMetaMask.isSupported = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -522,5 +522,5 @@ var provider; | ||
}; | ||
SolflareMetamask.IFRAME_URL = 'https://comet-widget.solflare.com/'; | ||
return SolflareMetamask; | ||
SolflareMetaMask.IFRAME_URL = 'https://widget.solflare.com/'; | ||
return SolflareMetaMask; | ||
}(eventemitter3_1.default)); | ||
exports.default = SolflareMetamask; | ||
exports.default = SolflareMetaMask; |
import { Cluster, Transaction, VersionedTransaction } from '@solana/web3.js'; | ||
export type TransactionOrVersionedTransaction = Transaction | VersionedTransaction; | ||
export interface SolflareMetamaskConfig { | ||
export interface SolflareMetaMaskConfig { | ||
network?: Cluster; | ||
@@ -58,3 +58,3 @@ params?: Record<string, any>; | ||
export interface WindowWithParams extends Window { | ||
SolflareMetamaskParams?: Record<string, any>; | ||
SolflareMetaMaskParams?: Record<string, any>; | ||
} | ||
@@ -61,0 +61,0 @@ export interface EthereumProvider { |
import { PublicKey, SendOptions } from '@solana/web3.js'; | ||
import { SolflareMetamaskConfig, TransactionOrVersionedTransaction } from './types'; | ||
import { SolflareMetaMaskConfig, TransactionOrVersionedTransaction } from './types'; | ||
import EventEmitter from 'eventemitter3'; | ||
export default class SolflareMetamask extends EventEmitter { | ||
export default class SolflareMetaMask extends EventEmitter { | ||
private _network; | ||
@@ -14,3 +14,3 @@ private _iframeParams; | ||
private static IFRAME_URL; | ||
constructor(config?: SolflareMetamaskConfig); | ||
constructor(config?: SolflareMetaMaskConfig); | ||
get publicKey(): PublicKey | null; | ||
@@ -17,0 +17,0 @@ get isConnected(): boolean; |
@@ -80,5 +80,5 @@ var __extends = (this && this.__extends) || (function () { | ||
import { detectProvider } from './detectProvider'; | ||
var SolflareMetamask = /** @class */ (function (_super) { | ||
__extends(SolflareMetamask, _super); | ||
function SolflareMetamask(config) { | ||
var SolflareMetaMask = /** @class */ (function (_super) { | ||
__extends(SolflareMetaMask, _super); | ||
function SolflareMetaMask(config) { | ||
var _this = _super.call(this) || this; | ||
@@ -207,7 +207,7 @@ _this._network = 'mainnet-beta'; | ||
_this._removeDanglingElements(); | ||
var params = __assign(__assign({}, _this._iframeParams), { cluster: _this._network || 'mainnet-beta', origin: window.location.origin || '', title: document.title || '' }); | ||
var params = __assign(__assign({}, _this._iframeParams), { mm: true, v: 1, 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); | ||
var iframeUrl = "".concat(SolflareMetaMask.IFRAME_URL, "?").concat(queryString); | ||
_this._element = document.createElement('div'); | ||
@@ -276,4 +276,4 @@ _this._element.className = 'solflare-metamask-wallet-adapter-iframe'; | ||
} | ||
if (window.SolflareMetamaskParams) { | ||
_this._iframeParams = __assign(__assign({}, _this._iframeParams), window.SolflareMetamaskParams); | ||
if (window.SolflareMetaMaskParams) { | ||
_this._iframeParams = __assign(__assign({}, _this._iframeParams), window.SolflareMetaMaskParams); | ||
} | ||
@@ -285,3 +285,3 @@ if (config === null || config === void 0 ? void 0 : config.params) { | ||
} | ||
Object.defineProperty(SolflareMetamask.prototype, "publicKey", { | ||
Object.defineProperty(SolflareMetaMask.prototype, "publicKey", { | ||
get: function () { | ||
@@ -293,3 +293,3 @@ return this._publicKey ? new PublicKey(this._publicKey) : null; | ||
}); | ||
Object.defineProperty(SolflareMetamask.prototype, "isConnected", { | ||
Object.defineProperty(SolflareMetaMask.prototype, "isConnected", { | ||
get: function () { | ||
@@ -301,3 +301,3 @@ return this._isConnected; | ||
}); | ||
Object.defineProperty(SolflareMetamask.prototype, "connected", { | ||
Object.defineProperty(SolflareMetaMask.prototype, "connected", { | ||
get: function () { | ||
@@ -309,3 +309,3 @@ return this.isConnected; | ||
}); | ||
Object.defineProperty(SolflareMetamask.prototype, "autoApprove", { | ||
Object.defineProperty(SolflareMetaMask.prototype, "autoApprove", { | ||
get: function () { | ||
@@ -317,3 +317,3 @@ return false; | ||
}); | ||
SolflareMetamask.prototype.connect = function () { | ||
SolflareMetaMask.prototype.connect = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -338,3 +338,3 @@ var _this = this; | ||
}; | ||
SolflareMetamask.prototype.disconnect = function () { | ||
SolflareMetaMask.prototype.disconnect = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -355,3 +355,3 @@ return __generator(this, function (_a) { | ||
}; | ||
SolflareMetamask.prototype.signTransaction = function (transaction) { | ||
SolflareMetaMask.prototype.signTransaction = function (transaction) { | ||
var _a; | ||
@@ -388,3 +388,3 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
SolflareMetamask.prototype.signAllTransactions = function (transactions) { | ||
SolflareMetaMask.prototype.signAllTransactions = function (transactions) { | ||
var _a; | ||
@@ -425,3 +425,3 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
SolflareMetamask.prototype.signAndSendTransaction = function (transaction, options) { | ||
SolflareMetaMask.prototype.signAndSendTransaction = function (transaction, options) { | ||
var _a; | ||
@@ -458,3 +458,3 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
SolflareMetamask.prototype.signMessage = function (data, display) { | ||
SolflareMetaMask.prototype.signMessage = function (data, display) { | ||
var _a; | ||
@@ -491,3 +491,3 @@ if (display === void 0) { display = 'utf8'; } | ||
}; | ||
SolflareMetamask.prototype.sign = function (data, display) { | ||
SolflareMetaMask.prototype.sign = function (data, display) { | ||
if (display === void 0) { display = 'utf8'; } | ||
@@ -503,3 +503,3 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
SolflareMetamask.isSupported = function () { | ||
SolflareMetaMask.isSupported = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -517,5 +517,5 @@ var provider; | ||
}; | ||
SolflareMetamask.IFRAME_URL = 'https://comet-widget.solflare.com/'; | ||
return SolflareMetamask; | ||
SolflareMetaMask.IFRAME_URL = 'https://widget.solflare.com/'; | ||
return SolflareMetaMask; | ||
}(EventEmitter)); | ||
export default SolflareMetamask; | ||
export default SolflareMetaMask; |
import { Cluster, Transaction, VersionedTransaction } from '@solana/web3.js'; | ||
export type TransactionOrVersionedTransaction = Transaction | VersionedTransaction; | ||
export interface SolflareMetamaskConfig { | ||
export interface SolflareMetaMaskConfig { | ||
network?: Cluster; | ||
@@ -58,3 +58,3 @@ params?: Record<string, any>; | ||
export interface WindowWithParams extends Window { | ||
SolflareMetamaskParams?: Record<string, any>; | ||
SolflareMetaMaskParams?: Record<string, any>; | ||
} | ||
@@ -61,0 +61,0 @@ export interface EthereumProvider { |
{ | ||
"name": "@solflare-wallet/metamask-sdk", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"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, | ||
SolflareMetamaskConfig, | ||
SolflareMetaMaskConfig, | ||
SolflareIframeEvent, | ||
@@ -21,3 +21,3 @@ SolflareIframeMessage, | ||
export default class SolflareMetamask extends EventEmitter { | ||
export default class SolflareMetaMask extends EventEmitter { | ||
private _network: Cluster = 'mainnet-beta'; | ||
@@ -32,5 +32,5 @@ private _iframeParams: Record<string, any> = {}; | ||
private static IFRAME_URL = 'https://comet-widget.solflare.com/'; | ||
private static IFRAME_URL = 'https://widget.solflare.com/'; | ||
constructor(config?: SolflareMetamaskConfig) { | ||
constructor(config?: SolflareMetaMaskConfig) { | ||
super(); | ||
@@ -42,6 +42,6 @@ | ||
if ((window as WindowWithParams).SolflareMetamaskParams) { | ||
if ((window as WindowWithParams).SolflareMetaMaskParams) { | ||
this._iframeParams = { | ||
...this._iframeParams, | ||
...(window as WindowWithParams).SolflareMetamaskParams | ||
...(window as WindowWithParams).SolflareMetaMaskParams | ||
}; | ||
@@ -331,2 +331,4 @@ } | ||
...this._iframeParams, | ||
mm: true, | ||
v: 1, | ||
cluster: this._network || 'mainnet-beta', | ||
@@ -341,3 +343,3 @@ origin: window.location.origin || '', | ||
const iframeUrl = `${SolflareMetamask.IFRAME_URL}?${queryString}`; | ||
const iframeUrl = `${SolflareMetaMask.IFRAME_URL}?${queryString}`; | ||
@@ -344,0 +346,0 @@ this._element = document.createElement('div'); |
@@ -5,3 +5,3 @@ import { Cluster, Transaction, VersionedTransaction } from '@solana/web3.js'; | ||
export interface SolflareMetamaskConfig { | ||
export interface SolflareMetaMaskConfig { | ||
network?: Cluster; | ||
@@ -77,3 +77,3 @@ params?: Record<string, any>; | ||
export interface WindowWithParams extends Window { | ||
SolflareMetamaskParams?: Record<string, any>; | ||
SolflareMetaMaskParams?: Record<string, any>; | ||
} | ||
@@ -80,0 +80,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93583
2139