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

splinterlands-web3-wallets

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

splinterlands-web3-wallets - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

dist/web3-wallets.browser.esm.js

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

import w from"web3";var d=(e,a,t)=>new Promise((r,i)=>{var h=s=>{try{n(t.next(s))}catch(l){i(l)}},u=s=>{try{n(t.throw(s))}catch(l){i(l)}},n=s=>s.done?r(s.value):Promise.resolve(s.value).then(h,u);n((t=t.apply(e,a)).next())});class f{constructor(a=!1,t=250){this.requestSignBuffer=({address:r,message:i,role:h,rpc:u,title:n})=>new Promise(s=>{this.call("requestSignBuffer",r,i,h,l=>this.handleCallback(s,l),u,n)}),this.requestBroadcast=({address:r,operations:i,role:h,rpc:u})=>new Promise(n=>{this.call("requestBroadcast",r,i,h,s=>this.handleCallback(n,s),u)}),this.requestCustomJson=({address:r,displayMessage:i,id:h,json:u,role:n,rpc:s})=>new Promise(l=>{this.call("requestCustomJson",r,h,n,u,i,o=>this.handleCallback(l,o),s)}),this.requestTransfer=({address:r,amount:i,asset:h,memo:u,to:n,enforce:s,rpc:l})=>new Promise(o=>{this.call("requestTransfer",r,n,i.toFixed(3),u,h,g=>this.handleCallback(o,g),s,l)}),this.requestSendToken=({address:r,amount:i,asset:h,memo:u,to:n,rpc:s})=>new Promise(l=>{this.call("requestSendToken",r,n,i.toFixed(3),u,h,o=>this.handleCallback(l,o),s)}),this.state="none",a&&setTimeout(()=>d(this,null,function*(){yield this.initialize()}),t)}get client(){return window.hive_keychain}initialize(){return d(this,null,function*(){return this.state!=="enabled"&&(this.state=yield this.getState()),this.state})}getState(){return d(this,null,function*(){const a=this.isKeychainInstalled();return this.client?(this.isKeychainInstalled()||localStorage.setItem("hasKeychain","true"),"enabled"):a?"installed":"none"})}isKeychainInstalled(){try{return Boolean(localStorage.getItem("hasKeychain"))}catch{return!1}}call(a,...t){return d(this,null,function*(){if(yield this.initialize(),this.state==="none")return{status:"error",state:this.state};try{return new Promise(r=>{this.client[a](...t,i=>this.handleCallback(r,i))})}catch(r){return{status:"error",message:r.message,state:this.state}}})}handleCallback(a,t){let r;return t.error==="user_cancel"&&(r={status:"cancel"}),t.success&&(r={status:"success",data:t}),r={status:"error",message:t.message,data:t,state:this.state},a(r)}}var c=(e,a,t)=>new Promise((r,i)=>{var h=s=>{try{n(t.next(s))}catch(l){i(l)}},u=s=>{try{n(t.throw(s))}catch(l){i(l)}},n=s=>s.done?r(s.value):Promise.resolve(s.value).then(h,u);n((t=t.apply(e,a)).next())});const m=class{constructor(e,a=!1,t=250){this.chain=e,this.requestSign=({address:r,message:i})=>this.call("eth_personalSign",[i,r]),this.state="none",a&&setTimeout(()=>c(this,null,function*(){yield this.initialize()}),t)}get ethereum(){return window.ethereum}initialize(){return c(this,null,function*(){return this.ethereum&&(this.web3=new w(this.ethereum),this.chain&&this.switchNetwork()),this.state!=="enabled"&&(this.state=yield this.getState()),this.state})}switchNetwork(){return c(this,null,function*(){const e=m.networks[this.chain];if(e&&parseInt(this.ethereum.networkVersion)!==e){const a=yield this.call("wallet_switchEthereumChain",[{chainId:`0x${e.toString(16)}`}]);a.status==="error"&&a.data.code===4902&&(yield this.call("wallet_addEthereumChain",[{chainId:`0x${e.toString(16)}`,rpcUrl:"https://bsc-dataseed.binance.org/"}]))}})}getState(){return c(this,null,function*(){const e=this.isEvmWalletInstalled();return this.ethereum?(this.isEvmWalletInstalled()||localStorage.setItem("hasEVM","true"),"enabled"):e?"installed":"none"})}isEvmWalletInstalled(){try{return Boolean(localStorage.getItem("hasEVM"))}catch{return!1}}requestAddress(){return c(this,null,function*(){let e=yield this.call("eth_accounts");if(e.status==="error"&&(e=yield this.call("eth_enable"),e.status==="error")||e.status==="cancel")return e;const a=e.data&&Array.isArray(e.data)?e.data[0]:null;return a?{status:"success",data:a}:{status:"error",message:"Address is empty",state:this.state}})}call(e,a){return c(this,null,function*(){if(yield this.initialize(),this.state==="none")return{status:"error",state:this.state};try{let t;return e==="eth_personalSign"?t=yield this.web3.eth.personal.sign(this.web3.utils.utf8ToHex(a[0]),a[1],""):e==="eth_enable"?t=yield this.ethereum.enable():t=yield this.ethereum.request({method:e,params:a}),{status:"success",data:t}}catch(t){return t.code===4001?{status:"cancel"}:{status:"error",message:t.message,state:this.state}}})}};let y=m;y.networks={ethereum:1,bsc:56};export{y as EVM,f as Keychain};
import y from"web3";var p=(r,e,t)=>new Promise((a,n)=>{var o=s=>{try{i(t.next(s))}catch(l){n(l)}},h=s=>{try{i(t.throw(s))}catch(l){n(l)}},i=s=>s.done?a(s.value):Promise.resolve(s.value).then(o,h);i((t=t.apply(r,e)).next())});class u{constructor(e,t={initialize:!1,timeout:250}){this.localStorageKey=e,this.options=t,this.state="none",this.options.initialize&&setTimeout(()=>p(this,null,function*(){yield this.getState()}),this.options.timeout)}isInstalled(){try{return Boolean(localStorage.getItem(this.localStorageKey))}catch{return!1}}}var d=(r,e,t)=>new Promise((a,n)=>{var o=s=>{try{i(t.next(s))}catch(l){n(l)}},h=s=>{try{i(t.throw(s))}catch(l){n(l)}},i=s=>s.done?a(s.value):Promise.resolve(s.value).then(o,h);i((t=t.apply(r,e)).next())});class f extends u{constructor(e={}){super("Keychain",e),this.requestSignBuffer=({address:t,message:a,role:n,rpc:o,title:h})=>new Promise(i=>{this.call("requestSignBuffer",t,a,n,s=>this.handleCallback(i,s),o,h)}),this.requestBroadcast=({address:t,operations:a,role:n,rpc:o})=>new Promise(h=>{this.call("requestBroadcast",t,a,n,i=>this.handleCallback(h,i),o)}),this.requestCustomJson=({address:t,displayMessage:a,id:n,json:o,role:h,rpc:i})=>new Promise(s=>{this.call("requestCustomJson",t,n,h,o,a,l=>this.handleCallback(s,l),i)}),this.requestTransfer=({address:t,amount:a,asset:n,memo:o,to:h,enforce:i,rpc:s})=>new Promise(l=>{this.call("requestTransfer",t,h,a.toFixed(3),o,n,g=>this.handleCallback(l,g),i,s)}),this.requestSendToken=({address:t,amount:a,asset:n,memo:o,to:h,rpc:i})=>new Promise(s=>{this.call("requestSendToken",t,h,a.toFixed(3),o,n,l=>this.handleCallback(s,l),i)})}get client(){return window.hive_keychain}getState(){return d(this,null,function*(){const e=this.isInstalled();if(this.state=e?"installed":"none",this.client){e||localStorage.setItem(this.localStorageKey,"true");try{this.state="enabled"}catch{}}return this.state})}call(e,...t){return d(this,null,function*(){try{return yield this.getState(),this.state==="none"?{status:"error",state:this.state}:new Promise(a=>{this.client[e](...t,n=>this.handleCallback(a,n))})}catch(a){return{status:"error",message:a.message,state:this.state}}})}handleCallback(e,t){let a;return t.error==="user_cancel"?a={status:"cancel"}:t.success?a={status:"success",data:t.result}:a={status:"error",message:t.message,data:t,state:this.state},e(a)}}var c=(r,e,t)=>new Promise((a,n)=>{var o=s=>{try{i(t.next(s))}catch(l){n(l)}},h=s=>{try{i(t.throw(s))}catch(l){n(l)}},i=s=>s.done?a(s.value):Promise.resolve(s.value).then(o,h);i((t=t.apply(r,e)).next())});const m=class extends u{constructor(r={chain:"ethereum"}){super("EVM",r),this.chain=r.chain}get client(){return window.ethereum}getState(){return c(this,null,function*(){const r=this.isInstalled();return this.state=r?"installed":"none",this.client&&(r||localStorage.setItem(this.localStorageKey,"true"),yield this.switchNetwork(),this.web3=new y(this.client),this.state="enabled"),this.state})}switchNetwork(){return c(this,null,function*(){var r;const e=m.networks[this.chain];if(e&&parseInt(this.client.networkVersion)!==e){const t=yield this.call("wallet_switchEthereumChain",[{chainId:`0x${e.toString(16)}`}]);if(t.status==="cancel")throw Error(`Please switch to the ${this.chain.toUpperCase()} network`);if(t.status==="error"&&((r=t.data)==null?void 0:r.code)===4902){if((yield this.call("wallet_addEthereumChain",[{chainId:`0x${e.toString(16)}`,rpcUrl:"https://bsc-dataseed.binance.org/"}])).status==="cancel")throw Error(`Please add the ${this.chain.toUpperCase()} network`);if(t.status==="error")throw Error(t.message)}else if(t.status==="error")throw Error(t.message)}})}requestSign(r){return c(this,arguments,function*({address:e,message:t}){return this.call("eth_personalSign",[t,e])})}requestAddress(){return c(this,null,function*(){const r=yield this.call("eth_requestAccounts");if(r.status!=="success")return r;const e=r.data&&Array.isArray(r.data)?r.data[0]:null;return e?{status:"success",data:e}:{status:"error",message:"Address is empty",state:this.state}})}call(r,e){return c(this,null,function*(){try{if(r!=="wallet_switchEthereumChain"&&r!=="wallet_addEthereumChain"&&(yield this.getState()),this.state==="none")return{status:"error",state:this.state};let t;return r==="eth_personalSign"?t=yield this.web3.eth.personal.sign(this.web3.utils.utf8ToHex(e[0]),e[1],""):t=yield this.client.request({method:r,params:e}),{status:"success",data:t}}catch(t){return t.code===4001?{status:"cancel"}:{status:"error",message:t.message,state:this.state}}})}};let w=m;w.networks={ethereum:1,bsc:56};export{w as EVM,f as Keychain};
//# sourceMappingURL=web3-wallets.browser.esm.js.map

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

(function(o,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("web3")):typeof define=="function"&&define.amd?define(["exports","web3"],d):(o=typeof globalThis<"u"?globalThis:o||self,d(o.web3Wallets={},o.web3))})(this,function(o,d){"use strict";function g(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var p=g(d),f=(t,a,e)=>new Promise((i,r)=>{var h=s=>{try{n(e.next(s))}catch(l){r(l)}},u=s=>{try{n(e.throw(s))}catch(l){r(l)}},n=s=>s.done?i(s.value):Promise.resolve(s.value).then(h,u);n((e=e.apply(t,a)).next())});class b{constructor(a=!1,e=250){this.requestSignBuffer=({address:i,message:r,role:h,rpc:u,title:n})=>new Promise(s=>{this.call("requestSignBuffer",i,r,h,l=>this.handleCallback(s,l),u,n)}),this.requestBroadcast=({address:i,operations:r,role:h,rpc:u})=>new Promise(n=>{this.call("requestBroadcast",i,r,h,s=>this.handleCallback(n,s),u)}),this.requestCustomJson=({address:i,displayMessage:r,id:h,json:u,role:n,rpc:s})=>new Promise(l=>{this.call("requestCustomJson",i,h,n,u,r,m=>this.handleCallback(l,m),s)}),this.requestTransfer=({address:i,amount:r,asset:h,memo:u,to:n,enforce:s,rpc:l})=>new Promise(m=>{this.call("requestTransfer",i,n,r.toFixed(3),u,h,S=>this.handleCallback(m,S),s,l)}),this.requestSendToken=({address:i,amount:r,asset:h,memo:u,to:n,rpc:s})=>new Promise(l=>{this.call("requestSendToken",i,n,r.toFixed(3),u,h,m=>this.handleCallback(l,m),s)}),this.state="none",a&&setTimeout(()=>f(this,null,function*(){yield this.initialize()}),e)}get client(){return window.hive_keychain}initialize(){return f(this,null,function*(){return this.state!=="enabled"&&(this.state=yield this.getState()),this.state})}getState(){return f(this,null,function*(){const a=this.isKeychainInstalled();return this.client?(this.isKeychainInstalled()||localStorage.setItem("hasKeychain","true"),"enabled"):a?"installed":"none"})}isKeychainInstalled(){try{return Boolean(localStorage.getItem("hasKeychain"))}catch{return!1}}call(a,...e){return f(this,null,function*(){if(yield this.initialize(),this.state==="none")return{status:"error",state:this.state};try{return new Promise(i=>{this.client[a](...e,r=>this.handleCallback(i,r))})}catch(i){return{status:"error",message:i.message,state:this.state}}})}handleCallback(a,e){let i;return e.error==="user_cancel"&&(i={status:"cancel"}),e.success&&(i={status:"success",data:e}),i={status:"error",message:e.message,data:e,state:this.state},a(i)}}var c=(t,a,e)=>new Promise((i,r)=>{var h=s=>{try{n(e.next(s))}catch(l){r(l)}},u=s=>{try{n(e.throw(s))}catch(l){r(l)}},n=s=>s.done?i(s.value):Promise.resolve(s.value).then(h,u);n((e=e.apply(t,a)).next())});const y=class{constructor(t,a=!1,e=250){this.chain=t,this.requestSign=({address:i,message:r})=>this.call("eth_personalSign",[r,i]),this.state="none",a&&setTimeout(()=>c(this,null,function*(){yield this.initialize()}),e)}get ethereum(){return window.ethereum}initialize(){return c(this,null,function*(){return this.ethereum&&(this.web3=new p.default(this.ethereum),this.chain&&this.switchNetwork()),this.state!=="enabled"&&(this.state=yield this.getState()),this.state})}switchNetwork(){return c(this,null,function*(){const t=y.networks[this.chain];if(t&&parseInt(this.ethereum.networkVersion)!==t){const a=yield this.call("wallet_switchEthereumChain",[{chainId:`0x${t.toString(16)}`}]);a.status==="error"&&a.data.code===4902&&(yield this.call("wallet_addEthereumChain",[{chainId:`0x${t.toString(16)}`,rpcUrl:"https://bsc-dataseed.binance.org/"}]))}})}getState(){return c(this,null,function*(){const t=this.isEvmWalletInstalled();return this.ethereum?(this.isEvmWalletInstalled()||localStorage.setItem("hasEVM","true"),"enabled"):t?"installed":"none"})}isEvmWalletInstalled(){try{return Boolean(localStorage.getItem("hasEVM"))}catch{return!1}}requestAddress(){return c(this,null,function*(){let t=yield this.call("eth_accounts");if(t.status==="error"&&(t=yield this.call("eth_enable"),t.status==="error")||t.status==="cancel")return t;const a=t.data&&Array.isArray(t.data)?t.data[0]:null;return a?{status:"success",data:a}:{status:"error",message:"Address is empty",state:this.state}})}call(t,a){return c(this,null,function*(){if(yield this.initialize(),this.state==="none")return{status:"error",state:this.state};try{let e;return t==="eth_personalSign"?e=yield this.web3.eth.personal.sign(this.web3.utils.utf8ToHex(a[0]),a[1],""):t==="eth_enable"?e=yield this.ethereum.enable():e=yield this.ethereum.request({method:t,params:a}),{status:"success",data:e}}catch(e){return e.code===4001?{status:"cancel"}:{status:"error",message:e.message,state:this.state}}})}};let w=y;w.networks={ethereum:1,bsc:56},o.EVM=w,o.Keychain=b,Object.defineProperty(o,"__esModule",{value:!0})});
(function(h,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("web3")):typeof define=="function"&&define.amd?define(["exports","web3"],u):(h=typeof globalThis<"u"?globalThis:h||self,u(h.web3Wallets={},h.web3))})(this,function(h,u){"use strict";function p(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var g=p(u),b=(e,s,t)=>new Promise((a,i)=>{var o=r=>{try{n(t.next(r))}catch(l){i(l)}},c=r=>{try{n(t.throw(r))}catch(l){i(l)}},n=r=>r.done?a(r.value):Promise.resolve(r.value).then(o,c);n((t=t.apply(e,s)).next())});class m{constructor(s,t={initialize:!1,timeout:250}){this.localStorageKey=s,this.options=t,this.state="none",this.options.initialize&&setTimeout(()=>b(this,null,function*(){yield this.getState()}),this.options.timeout)}isInstalled(){try{return Boolean(localStorage.getItem(this.localStorageKey))}catch{return!1}}}var f=(e,s,t)=>new Promise((a,i)=>{var o=r=>{try{n(t.next(r))}catch(l){i(l)}},c=r=>{try{n(t.throw(r))}catch(l){i(l)}},n=r=>r.done?a(r.value):Promise.resolve(r.value).then(o,c);n((t=t.apply(e,s)).next())});class S extends m{constructor(s={}){super("Keychain",s),this.requestSignBuffer=({address:t,message:a,role:i,rpc:o,title:c})=>new Promise(n=>{this.call("requestSignBuffer",t,a,i,r=>this.handleCallback(n,r),o,c)}),this.requestBroadcast=({address:t,operations:a,role:i,rpc:o})=>new Promise(c=>{this.call("requestBroadcast",t,a,i,n=>this.handleCallback(c,n),o)}),this.requestCustomJson=({address:t,displayMessage:a,id:i,json:o,role:c,rpc:n})=>new Promise(r=>{this.call("requestCustomJson",t,i,c,o,a,l=>this.handleCallback(r,l),n)}),this.requestTransfer=({address:t,amount:a,asset:i,memo:o,to:c,enforce:n,rpc:r})=>new Promise(l=>{this.call("requestTransfer",t,c,a.toFixed(3),o,i,v=>this.handleCallback(l,v),n,r)}),this.requestSendToken=({address:t,amount:a,asset:i,memo:o,to:c,rpc:n})=>new Promise(r=>{this.call("requestSendToken",t,c,a.toFixed(3),o,i,l=>this.handleCallback(r,l),n)})}get client(){return window.hive_keychain}getState(){return f(this,null,function*(){const s=this.isInstalled();if(this.state=s?"installed":"none",this.client){s||localStorage.setItem(this.localStorageKey,"true");try{this.state="enabled"}catch{}}return this.state})}call(s,...t){return f(this,null,function*(){try{return yield this.getState(),this.state==="none"?{status:"error",state:this.state}:new Promise(a=>{this.client[s](...t,i=>this.handleCallback(a,i))})}catch(a){return{status:"error",message:a.message,state:this.state}}})}handleCallback(s,t){let a;return t.error==="user_cancel"?a={status:"cancel"}:t.success?a={status:"success",data:t.result}:a={status:"error",message:t.message,data:t,state:this.state},s(a)}}var d=(e,s,t)=>new Promise((a,i)=>{var o=r=>{try{n(t.next(r))}catch(l){i(l)}},c=r=>{try{n(t.throw(r))}catch(l){i(l)}},n=r=>r.done?a(r.value):Promise.resolve(r.value).then(o,c);n((t=t.apply(e,s)).next())});const w=class extends m{constructor(e={chain:"ethereum"}){super("EVM",e),this.chain=e.chain}get client(){return window.ethereum}getState(){return d(this,null,function*(){const e=this.isInstalled();return this.state=e?"installed":"none",this.client&&(e||localStorage.setItem(this.localStorageKey,"true"),yield this.switchNetwork(),this.web3=new g.default(this.client),this.state="enabled"),this.state})}switchNetwork(){return d(this,null,function*(){var e;const s=w.networks[this.chain];if(s&&parseInt(this.client.networkVersion)!==s){const t=yield this.call("wallet_switchEthereumChain",[{chainId:`0x${s.toString(16)}`}]);if(t.status==="cancel")throw Error(`Please switch to the ${this.chain.toUpperCase()} network`);if(t.status==="error"&&((e=t.data)==null?void 0:e.code)===4902){if((yield this.call("wallet_addEthereumChain",[{chainId:`0x${s.toString(16)}`,rpcUrl:"https://bsc-dataseed.binance.org/"}])).status==="cancel")throw Error(`Please add the ${this.chain.toUpperCase()} network`);if(t.status==="error")throw Error(t.message)}else if(t.status==="error")throw Error(t.message)}})}requestSign(e){return d(this,arguments,function*({address:s,message:t}){return this.call("eth_personalSign",[t,s])})}requestAddress(){return d(this,null,function*(){const e=yield this.call("eth_requestAccounts");if(e.status!=="success")return e;const s=e.data&&Array.isArray(e.data)?e.data[0]:null;return s?{status:"success",data:s}:{status:"error",message:"Address is empty",state:this.state}})}call(e,s){return d(this,null,function*(){try{if(e!=="wallet_switchEthereumChain"&&e!=="wallet_addEthereumChain"&&(yield this.getState()),this.state==="none")return{status:"error",state:this.state};let t;return e==="eth_personalSign"?t=yield this.web3.eth.personal.sign(this.web3.utils.utf8ToHex(s[0]),s[1],""):t=yield this.client.request({method:e,params:s}),{status:"success",data:t}}catch(t){return t.code===4001?{status:"cancel"}:{status:"error",message:t.message,state:this.state}}})}};let y=w;y.networks={ethereum:1,bsc:56},h.EVM=y,h.Keychain=S,Object.defineProperty(h,"__esModule",{value:!0})});
//# sourceMappingURL=web3-wallets.browser.js.map

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

import Web3 from 'web3';
import Web3Package from 'web3';

@@ -6,2 +6,3 @@ declare type Web3WalletState = 'enabled' | 'installed' | 'none';

declare type Web3WalletResultWithoutCancel<T = any> = Web3WalletSuccess<T> | Web3WalletError;
declare type Web3WalletStatus = 'success' | 'error' | 'cancel';
interface Web3WalletSuccess<T = any> {

@@ -147,22 +148,7 @@ status: 'success';

declare class Keychain {
state: Web3WalletState;
constructor(initialize?: boolean, timeout?: number);
get client(): any;
initialize(): Promise<Web3WalletState>;
private getState;
private isKeychainInstalled;
/**
* Signs message with {role}-key and returns signature
*/
requestSignBuffer: ({ address, message, role, rpc, title, }: KeychainFunctionRequestSignBuffer[1]) => Promise<Web3WalletResult<string>>;
requestBroadcast: ({ address, operations, role, rpc, }: KeychainFunctionRequestBroadcast[1]) => Promise<Web3WalletResult>;
requestCustomJson: ({ address, displayMessage, id, json, role, rpc, }: KeychainFunctionRequestCustomJson[1]) => Promise<Web3WalletResult>;
requestTransfer: ({ address, amount, asset, memo, to, enforce, rpc, }: KeychainFunctionRequestTransfer[1]) => Promise<Web3WalletResult>;
requestSendToken: ({ address, amount, asset, memo, to, rpc, }: KeychainFunctionRequestSendToken[1]) => Promise<Web3WalletResult>;
call<T = any>(fn: KeychainFunctionName, ...args: any): Promise<Web3WalletResult<T>>;
private handleCallback;
declare type EvmChain = 'ethereum' | 'bsc';
interface EvmParameters extends Web3ClientParameters {
chain?: EvmChain;
}
declare type EVMFunctionName = 'wallet_switchEthereumChain' | 'wallet_addEthereumChain' | 'eth_accounts' | 'eth_personalSign' | 'eth_enable';
declare type EVMFunctionName = 'wallet_switchEthereumChain' | 'wallet_addEthereumChain' | 'eth_accounts' | 'eth_personalSign' | 'eth_requestAccounts';
interface EVMFunction {

@@ -182,20 +168,53 @@ 0: EVMFunctionName;

declare class EVM {
private readonly chain?;
static networks: {
ethereum: number;
bsc: number;
};
web3: Web3;
interface Web3ClientOptions {
initialize: boolean;
timeout: number;
}
declare type Web3ClientParameters = Partial<Web3ClientOptions>;
declare abstract class Web3Client {
protected localStorageKey: string;
state: Web3WalletState;
constructor(chain?: 'ethereum' | 'bsc', initialize?: boolean, timeout?: number);
get ethereum(): any;
initialize(): Promise<Web3WalletState>;
private options;
constructor(localStorageKey: string, parameters?: Web3ClientParameters);
abstract client: any;
/**
* Checks if specific key is found within localStorage which indicates wallet is installed
*/
protected isInstalled(): boolean;
/**
* Checks state of wallet - whether it's 'enabled', 'installed' or 'none'
* @returns boolean (can also be checked via .state)
*/
abstract getState(): Promise<Web3WalletState>;
abstract call<T = any>(functionName: KeychainFunctionName | EVMFunctionName, ...args: any): Promise<Web3WalletResult<T>>;
}
declare class Keychain extends Web3Client {
constructor(parameters?: Web3ClientParameters);
get client(): any;
getState(): Promise<Web3WalletState>;
/**
* Signs message with {role}-key and returns signature
*/
requestSignBuffer: ({ address, message, role, rpc, title }: KeychainFunctionRequestSignBuffer[1]) => Promise<Web3WalletResult<string>>;
requestBroadcast: ({ address, operations, role, rpc }: KeychainFunctionRequestBroadcast[1]) => Promise<Web3WalletResult>;
requestCustomJson: ({ address, displayMessage, id, json, role, rpc }: KeychainFunctionRequestCustomJson[1]) => Promise<Web3WalletResult>;
requestTransfer: ({ address, amount, asset, memo, to, enforce, rpc }: KeychainFunctionRequestTransfer[1]) => Promise<Web3WalletResult>;
requestSendToken: ({ address, amount, asset, memo, to, rpc }: KeychainFunctionRequestSendToken[1]) => Promise<Web3WalletResult>;
call<T = any>(functionName: KeychainFunctionName, ...args: any): Promise<Web3WalletResult<T>>;
private handleCallback;
}
declare class EVM extends Web3Client {
private static networks;
private chain;
web3: Web3Package;
constructor(parameters?: EvmParameters);
get client(): any;
getState(): Promise<Web3WalletState>;
private switchNetwork;
private getState;
private isEvmWalletInstalled;
/**
* Signs signature with web3 active wallet
*/
requestSign: ({ address, message, }: EVMFunctionRequestSign[1]) => Promise<Web3WalletResult<string>>;
requestSign({ address, message }: EVMFunctionRequestSign[1]): Promise<Web3WalletResult<string>>;
/**

@@ -208,2 +227,2 @@ * Returns address of web3 active wallet

export { EVM, EVMFunction, EVMFunctionName, EVMFunctionRequestSign, Keychain, KeychainFunction, KeychainFunctionName, KeychainFunctionRequestAddAccount, KeychainFunctionRequestAddAccountAuthority, KeychainFunctionRequestBroadcast, KeychainFunctionRequestCustomJson, KeychainFunctionRequestEncodeMessage, KeychainFunctionRequestHandshake, KeychainFunctionRequestRemoveAccountAuthority, KeychainFunctionRequestSendToken, KeychainFunctionRequestSignBuffer, KeychainFunctionRequestSignTx, KeychainFunctionRequestTransfer, KeychainFunctionRequestVerifyKey, KeychainRole, Web3WalletCancel, Web3WalletError, Web3WalletResult, Web3WalletResultWithoutCancel, Web3WalletState, Web3WalletSuccess };
export { EVM, EVMFunction, EVMFunctionName, EVMFunctionRequestSign, EvmChain, EvmParameters, Keychain, KeychainFunction, KeychainFunctionName, KeychainFunctionRequestAddAccount, KeychainFunctionRequestAddAccountAuthority, KeychainFunctionRequestBroadcast, KeychainFunctionRequestCustomJson, KeychainFunctionRequestEncodeMessage, KeychainFunctionRequestHandshake, KeychainFunctionRequestRemoveAccountAuthority, KeychainFunctionRequestSendToken, KeychainFunctionRequestSignBuffer, KeychainFunctionRequestSignTx, KeychainFunctionRequestTransfer, KeychainFunctionRequestVerifyKey, KeychainRole, Web3WalletCancel, Web3WalletError, Web3WalletResult, Web3WalletResultWithoutCancel, Web3WalletState, Web3WalletStatus, Web3WalletSuccess };

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

import w from"web3";var d=(e,a,t)=>new Promise((r,i)=>{var h=s=>{try{n(t.next(s))}catch(l){i(l)}},u=s=>{try{n(t.throw(s))}catch(l){i(l)}},n=s=>s.done?r(s.value):Promise.resolve(s.value).then(h,u);n((t=t.apply(e,a)).next())});class f{constructor(a=!1,t=250){this.requestSignBuffer=({address:r,message:i,role:h,rpc:u,title:n})=>new Promise(s=>{this.call("requestSignBuffer",r,i,h,l=>this.handleCallback(s,l),u,n)}),this.requestBroadcast=({address:r,operations:i,role:h,rpc:u})=>new Promise(n=>{this.call("requestBroadcast",r,i,h,s=>this.handleCallback(n,s),u)}),this.requestCustomJson=({address:r,displayMessage:i,id:h,json:u,role:n,rpc:s})=>new Promise(l=>{this.call("requestCustomJson",r,h,n,u,i,o=>this.handleCallback(l,o),s)}),this.requestTransfer=({address:r,amount:i,asset:h,memo:u,to:n,enforce:s,rpc:l})=>new Promise(o=>{this.call("requestTransfer",r,n,i.toFixed(3),u,h,g=>this.handleCallback(o,g),s,l)}),this.requestSendToken=({address:r,amount:i,asset:h,memo:u,to:n,rpc:s})=>new Promise(l=>{this.call("requestSendToken",r,n,i.toFixed(3),u,h,o=>this.handleCallback(l,o),s)}),this.state="none",a&&setTimeout(()=>d(this,null,function*(){yield this.initialize()}),t)}get client(){return window.hive_keychain}initialize(){return d(this,null,function*(){return this.state!=="enabled"&&(this.state=yield this.getState()),this.state})}getState(){return d(this,null,function*(){const a=this.isKeychainInstalled();return this.client?(this.isKeychainInstalled()||localStorage.setItem("hasKeychain","true"),"enabled"):a?"installed":"none"})}isKeychainInstalled(){try{return Boolean(localStorage.getItem("hasKeychain"))}catch{return!1}}call(a,...t){return d(this,null,function*(){if(yield this.initialize(),this.state==="none")return{status:"error",state:this.state};try{return new Promise(r=>{this.client[a](...t,i=>this.handleCallback(r,i))})}catch(r){return{status:"error",message:r.message,state:this.state}}})}handleCallback(a,t){let r;return t.error==="user_cancel"&&(r={status:"cancel"}),t.success&&(r={status:"success",data:t}),r={status:"error",message:t.message,data:t,state:this.state},a(r)}}var c=(e,a,t)=>new Promise((r,i)=>{var h=s=>{try{n(t.next(s))}catch(l){i(l)}},u=s=>{try{n(t.throw(s))}catch(l){i(l)}},n=s=>s.done?r(s.value):Promise.resolve(s.value).then(h,u);n((t=t.apply(e,a)).next())});const m=class{constructor(e,a=!1,t=250){this.chain=e,this.requestSign=({address:r,message:i})=>this.call("eth_personalSign",[i,r]),this.state="none",a&&setTimeout(()=>c(this,null,function*(){yield this.initialize()}),t)}get ethereum(){return window.ethereum}initialize(){return c(this,null,function*(){return this.ethereum&&(this.web3=new w(this.ethereum),this.chain&&this.switchNetwork()),this.state!=="enabled"&&(this.state=yield this.getState()),this.state})}switchNetwork(){return c(this,null,function*(){const e=m.networks[this.chain];if(e&&parseInt(this.ethereum.networkVersion)!==e){const a=yield this.call("wallet_switchEthereumChain",[{chainId:`0x${e.toString(16)}`}]);a.status==="error"&&a.data.code===4902&&(yield this.call("wallet_addEthereumChain",[{chainId:`0x${e.toString(16)}`,rpcUrl:"https://bsc-dataseed.binance.org/"}]))}})}getState(){return c(this,null,function*(){const e=this.isEvmWalletInstalled();return this.ethereum?(this.isEvmWalletInstalled()||localStorage.setItem("hasEVM","true"),"enabled"):e?"installed":"none"})}isEvmWalletInstalled(){try{return Boolean(localStorage.getItem("hasEVM"))}catch{return!1}}requestAddress(){return c(this,null,function*(){let e=yield this.call("eth_accounts");if(e.status==="error"&&(e=yield this.call("eth_enable"),e.status==="error")||e.status==="cancel")return e;const a=e.data&&Array.isArray(e.data)?e.data[0]:null;return a?{status:"success",data:a}:{status:"error",message:"Address is empty",state:this.state}})}call(e,a){return c(this,null,function*(){if(yield this.initialize(),this.state==="none")return{status:"error",state:this.state};try{let t;return e==="eth_personalSign"?t=yield this.web3.eth.personal.sign(this.web3.utils.utf8ToHex(a[0]),a[1],""):e==="eth_enable"?t=yield this.ethereum.enable():t=yield this.ethereum.request({method:e,params:a}),{status:"success",data:t}}catch(t){return t.code===4001?{status:"cancel"}:{status:"error",message:t.message,state:this.state}}})}};let y=m;y.networks={ethereum:1,bsc:56};export{y as EVM,f as Keychain};
import y from"web3";var p=(r,e,t)=>new Promise((a,n)=>{var o=s=>{try{i(t.next(s))}catch(l){n(l)}},h=s=>{try{i(t.throw(s))}catch(l){n(l)}},i=s=>s.done?a(s.value):Promise.resolve(s.value).then(o,h);i((t=t.apply(r,e)).next())});class u{constructor(e,t={initialize:!1,timeout:250}){this.localStorageKey=e,this.options=t,this.state="none",this.options.initialize&&setTimeout(()=>p(this,null,function*(){yield this.getState()}),this.options.timeout)}isInstalled(){try{return Boolean(localStorage.getItem(this.localStorageKey))}catch{return!1}}}var d=(r,e,t)=>new Promise((a,n)=>{var o=s=>{try{i(t.next(s))}catch(l){n(l)}},h=s=>{try{i(t.throw(s))}catch(l){n(l)}},i=s=>s.done?a(s.value):Promise.resolve(s.value).then(o,h);i((t=t.apply(r,e)).next())});class f extends u{constructor(e={}){super("Keychain",e),this.requestSignBuffer=({address:t,message:a,role:n,rpc:o,title:h})=>new Promise(i=>{this.call("requestSignBuffer",t,a,n,s=>this.handleCallback(i,s),o,h)}),this.requestBroadcast=({address:t,operations:a,role:n,rpc:o})=>new Promise(h=>{this.call("requestBroadcast",t,a,n,i=>this.handleCallback(h,i),o)}),this.requestCustomJson=({address:t,displayMessage:a,id:n,json:o,role:h,rpc:i})=>new Promise(s=>{this.call("requestCustomJson",t,n,h,o,a,l=>this.handleCallback(s,l),i)}),this.requestTransfer=({address:t,amount:a,asset:n,memo:o,to:h,enforce:i,rpc:s})=>new Promise(l=>{this.call("requestTransfer",t,h,a.toFixed(3),o,n,g=>this.handleCallback(l,g),i,s)}),this.requestSendToken=({address:t,amount:a,asset:n,memo:o,to:h,rpc:i})=>new Promise(s=>{this.call("requestSendToken",t,h,a.toFixed(3),o,n,l=>this.handleCallback(s,l),i)})}get client(){return window.hive_keychain}getState(){return d(this,null,function*(){const e=this.isInstalled();if(this.state=e?"installed":"none",this.client){e||localStorage.setItem(this.localStorageKey,"true");try{this.state="enabled"}catch{}}return this.state})}call(e,...t){return d(this,null,function*(){try{return yield this.getState(),this.state==="none"?{status:"error",state:this.state}:new Promise(a=>{this.client[e](...t,n=>this.handleCallback(a,n))})}catch(a){return{status:"error",message:a.message,state:this.state}}})}handleCallback(e,t){let a;return t.error==="user_cancel"?a={status:"cancel"}:t.success?a={status:"success",data:t.result}:a={status:"error",message:t.message,data:t,state:this.state},e(a)}}var c=(r,e,t)=>new Promise((a,n)=>{var o=s=>{try{i(t.next(s))}catch(l){n(l)}},h=s=>{try{i(t.throw(s))}catch(l){n(l)}},i=s=>s.done?a(s.value):Promise.resolve(s.value).then(o,h);i((t=t.apply(r,e)).next())});const m=class extends u{constructor(r={chain:"ethereum"}){super("EVM",r),this.chain=r.chain}get client(){return window.ethereum}getState(){return c(this,null,function*(){const r=this.isInstalled();return this.state=r?"installed":"none",this.client&&(r||localStorage.setItem(this.localStorageKey,"true"),yield this.switchNetwork(),this.web3=new y(this.client),this.state="enabled"),this.state})}switchNetwork(){return c(this,null,function*(){var r;const e=m.networks[this.chain];if(e&&parseInt(this.client.networkVersion)!==e){const t=yield this.call("wallet_switchEthereumChain",[{chainId:`0x${e.toString(16)}`}]);if(t.status==="cancel")throw Error(`Please switch to the ${this.chain.toUpperCase()} network`);if(t.status==="error"&&((r=t.data)==null?void 0:r.code)===4902){if((yield this.call("wallet_addEthereumChain",[{chainId:`0x${e.toString(16)}`,rpcUrl:"https://bsc-dataseed.binance.org/"}])).status==="cancel")throw Error(`Please add the ${this.chain.toUpperCase()} network`);if(t.status==="error")throw Error(t.message)}else if(t.status==="error")throw Error(t.message)}})}requestSign(r){return c(this,arguments,function*({address:e,message:t}){return this.call("eth_personalSign",[t,e])})}requestAddress(){return c(this,null,function*(){const r=yield this.call("eth_requestAccounts");if(r.status!=="success")return r;const e=r.data&&Array.isArray(r.data)?r.data[0]:null;return e?{status:"success",data:e}:{status:"error",message:"Address is empty",state:this.state}})}call(r,e){return c(this,null,function*(){try{if(r!=="wallet_switchEthereumChain"&&r!=="wallet_addEthereumChain"&&(yield this.getState()),this.state==="none")return{status:"error",state:this.state};let t;return r==="eth_personalSign"?t=yield this.web3.eth.personal.sign(this.web3.utils.utf8ToHex(e[0]),e[1],""):t=yield this.client.request({method:r,params:e}),{status:"success",data:t}}catch(t){return t.code===4001?{status:"cancel"}:{status:"error",message:t.message,state:this.state}}})}};let w=m;w.networks={ethereum:1,bsc:56};export{w as EVM,f as Keychain};
//# sourceMappingURL=web3-wallets.esm.js.map

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var f=require("web3");function w(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var b=w(f),d=(t,a,e)=>new Promise((r,i)=>{var h=s=>{try{n(e.next(s))}catch(l){i(l)}},u=s=>{try{n(e.throw(s))}catch(l){i(l)}},n=s=>s.done?r(s.value):Promise.resolve(s.value).then(h,u);n((e=e.apply(t,a)).next())});class p{constructor(a=!1,e=250){this.requestSignBuffer=({address:r,message:i,role:h,rpc:u,title:n})=>new Promise(s=>{this.call("requestSignBuffer",r,i,h,l=>this.handleCallback(s,l),u,n)}),this.requestBroadcast=({address:r,operations:i,role:h,rpc:u})=>new Promise(n=>{this.call("requestBroadcast",r,i,h,s=>this.handleCallback(n,s),u)}),this.requestCustomJson=({address:r,displayMessage:i,id:h,json:u,role:n,rpc:s})=>new Promise(l=>{this.call("requestCustomJson",r,h,n,u,i,o=>this.handleCallback(l,o),s)}),this.requestTransfer=({address:r,amount:i,asset:h,memo:u,to:n,enforce:s,rpc:l})=>new Promise(o=>{this.call("requestTransfer",r,n,i.toFixed(3),u,h,g=>this.handleCallback(o,g),s,l)}),this.requestSendToken=({address:r,amount:i,asset:h,memo:u,to:n,rpc:s})=>new Promise(l=>{this.call("requestSendToken",r,n,i.toFixed(3),u,h,o=>this.handleCallback(l,o),s)}),this.state="none",a&&setTimeout(()=>d(this,null,function*(){yield this.initialize()}),e)}get client(){return window.hive_keychain}initialize(){return d(this,null,function*(){return this.state!=="enabled"&&(this.state=yield this.getState()),this.state})}getState(){return d(this,null,function*(){const a=this.isKeychainInstalled();return this.client?(this.isKeychainInstalled()||localStorage.setItem("hasKeychain","true"),"enabled"):a?"installed":"none"})}isKeychainInstalled(){try{return Boolean(localStorage.getItem("hasKeychain"))}catch{return!1}}call(a,...e){return d(this,null,function*(){if(yield this.initialize(),this.state==="none")return{status:"error",state:this.state};try{return new Promise(r=>{this.client[a](...e,i=>this.handleCallback(r,i))})}catch(r){return{status:"error",message:r.message,state:this.state}}})}handleCallback(a,e){let r;return e.error==="user_cancel"&&(r={status:"cancel"}),e.success&&(r={status:"success",data:e}),r={status:"error",message:e.message,data:e,state:this.state},a(r)}}var c=(t,a,e)=>new Promise((r,i)=>{var h=s=>{try{n(e.next(s))}catch(l){i(l)}},u=s=>{try{n(e.throw(s))}catch(l){i(l)}},n=s=>s.done?r(s.value):Promise.resolve(s.value).then(h,u);n((e=e.apply(t,a)).next())});const m=class{constructor(t,a=!1,e=250){this.chain=t,this.requestSign=({address:r,message:i})=>this.call("eth_personalSign",[i,r]),this.state="none",a&&setTimeout(()=>c(this,null,function*(){yield this.initialize()}),e)}get ethereum(){return window.ethereum}initialize(){return c(this,null,function*(){return this.ethereum&&(this.web3=new b.default(this.ethereum),this.chain&&this.switchNetwork()),this.state!=="enabled"&&(this.state=yield this.getState()),this.state})}switchNetwork(){return c(this,null,function*(){const t=m.networks[this.chain];if(t&&parseInt(this.ethereum.networkVersion)!==t){const a=yield this.call("wallet_switchEthereumChain",[{chainId:`0x${t.toString(16)}`}]);a.status==="error"&&a.data.code===4902&&(yield this.call("wallet_addEthereumChain",[{chainId:`0x${t.toString(16)}`,rpcUrl:"https://bsc-dataseed.binance.org/"}]))}})}getState(){return c(this,null,function*(){const t=this.isEvmWalletInstalled();return this.ethereum?(this.isEvmWalletInstalled()||localStorage.setItem("hasEVM","true"),"enabled"):t?"installed":"none"})}isEvmWalletInstalled(){try{return Boolean(localStorage.getItem("hasEVM"))}catch{return!1}}requestAddress(){return c(this,null,function*(){let t=yield this.call("eth_accounts");if(t.status==="error"&&(t=yield this.call("eth_enable"),t.status==="error")||t.status==="cancel")return t;const a=t.data&&Array.isArray(t.data)?t.data[0]:null;return a?{status:"success",data:a}:{status:"error",message:"Address is empty",state:this.state}})}call(t,a){return c(this,null,function*(){if(yield this.initialize(),this.state==="none")return{status:"error",state:this.state};try{let e;return t==="eth_personalSign"?e=yield this.web3.eth.personal.sign(this.web3.utils.utf8ToHex(a[0]),a[1],""):t==="eth_enable"?e=yield this.ethereum.enable():e=yield this.ethereum.request({method:t,params:a}),{status:"success",data:e}}catch(e){return e.code===4001?{status:"cancel"}:{status:"error",message:e.message,state:this.state}}})}};let y=m;y.networks={ethereum:1,bsc:56},exports.EVM=y,exports.Keychain=p;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var y=require("web3");function f(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var p=f(y),v=(e,s,t)=>new Promise((a,n)=>{var o=r=>{try{i(t.next(r))}catch(l){n(l)}},c=r=>{try{i(t.throw(r))}catch(l){n(l)}},i=r=>r.done?a(r.value):Promise.resolve(r.value).then(o,c);i((t=t.apply(e,s)).next())});class u{constructor(s,t={initialize:!1,timeout:250}){this.localStorageKey=s,this.options=t,this.state="none",this.options.initialize&&setTimeout(()=>v(this,null,function*(){yield this.getState()}),this.options.timeout)}isInstalled(){try{return Boolean(localStorage.getItem(this.localStorageKey))}catch{return!1}}}var d=(e,s,t)=>new Promise((a,n)=>{var o=r=>{try{i(t.next(r))}catch(l){n(l)}},c=r=>{try{i(t.throw(r))}catch(l){n(l)}},i=r=>r.done?a(r.value):Promise.resolve(r.value).then(o,c);i((t=t.apply(e,s)).next())});class S extends u{constructor(s={}){super("Keychain",s),this.requestSignBuffer=({address:t,message:a,role:n,rpc:o,title:c})=>new Promise(i=>{this.call("requestSignBuffer",t,a,n,r=>this.handleCallback(i,r),o,c)}),this.requestBroadcast=({address:t,operations:a,role:n,rpc:o})=>new Promise(c=>{this.call("requestBroadcast",t,a,n,i=>this.handleCallback(c,i),o)}),this.requestCustomJson=({address:t,displayMessage:a,id:n,json:o,role:c,rpc:i})=>new Promise(r=>{this.call("requestCustomJson",t,n,c,o,a,l=>this.handleCallback(r,l),i)}),this.requestTransfer=({address:t,amount:a,asset:n,memo:o,to:c,enforce:i,rpc:r})=>new Promise(l=>{this.call("requestTransfer",t,c,a.toFixed(3),o,n,g=>this.handleCallback(l,g),i,r)}),this.requestSendToken=({address:t,amount:a,asset:n,memo:o,to:c,rpc:i})=>new Promise(r=>{this.call("requestSendToken",t,c,a.toFixed(3),o,n,l=>this.handleCallback(r,l),i)})}get client(){return window.hive_keychain}getState(){return d(this,null,function*(){const s=this.isInstalled();if(this.state=s?"installed":"none",this.client){s||localStorage.setItem(this.localStorageKey,"true");try{this.state="enabled"}catch{}}return this.state})}call(s,...t){return d(this,null,function*(){try{return yield this.getState(),this.state==="none"?{status:"error",state:this.state}:new Promise(a=>{this.client[s](...t,n=>this.handleCallback(a,n))})}catch(a){return{status:"error",message:a.message,state:this.state}}})}handleCallback(s,t){let a;return t.error==="user_cancel"?a={status:"cancel"}:t.success?a={status:"success",data:t.result}:a={status:"error",message:t.message,data:t,state:this.state},s(a)}}var h=(e,s,t)=>new Promise((a,n)=>{var o=r=>{try{i(t.next(r))}catch(l){n(l)}},c=r=>{try{i(t.throw(r))}catch(l){n(l)}},i=r=>r.done?a(r.value):Promise.resolve(r.value).then(o,c);i((t=t.apply(e,s)).next())});const m=class extends u{constructor(e={chain:"ethereum"}){super("EVM",e),this.chain=e.chain}get client(){return window.ethereum}getState(){return h(this,null,function*(){const e=this.isInstalled();return this.state=e?"installed":"none",this.client&&(e||localStorage.setItem(this.localStorageKey,"true"),yield this.switchNetwork(),this.web3=new p.default(this.client),this.state="enabled"),this.state})}switchNetwork(){return h(this,null,function*(){var e;const s=m.networks[this.chain];if(s&&parseInt(this.client.networkVersion)!==s){const t=yield this.call("wallet_switchEthereumChain",[{chainId:`0x${s.toString(16)}`}]);if(t.status==="cancel")throw Error(`Please switch to the ${this.chain.toUpperCase()} network`);if(t.status==="error"&&((e=t.data)==null?void 0:e.code)===4902){if((yield this.call("wallet_addEthereumChain",[{chainId:`0x${s.toString(16)}`,rpcUrl:"https://bsc-dataseed.binance.org/"}])).status==="cancel")throw Error(`Please add the ${this.chain.toUpperCase()} network`);if(t.status==="error")throw Error(t.message)}else if(t.status==="error")throw Error(t.message)}})}requestSign(e){return h(this,arguments,function*({address:s,message:t}){return this.call("eth_personalSign",[t,s])})}requestAddress(){return h(this,null,function*(){const e=yield this.call("eth_requestAccounts");if(e.status!=="success")return e;const s=e.data&&Array.isArray(e.data)?e.data[0]:null;return s?{status:"success",data:s}:{status:"error",message:"Address is empty",state:this.state}})}call(e,s){return h(this,null,function*(){try{if(e!=="wallet_switchEthereumChain"&&e!=="wallet_addEthereumChain"&&(yield this.getState()),this.state==="none")return{status:"error",state:this.state};let t;return e==="eth_personalSign"?t=yield this.web3.eth.personal.sign(this.web3.utils.utf8ToHex(s[0]),s[1],""):t=yield this.client.request({method:e,params:s}),{status:"success",data:t}}catch(t){return t.code===4001?{status:"cancel"}:{status:"error",message:t.message,state:this.state}}})}};let w=m;w.networks={ethereum:1,bsc:56},exports.EVM=w,exports.Keychain=S;
//# sourceMappingURL=web3-wallets.js.map
{
"name": "splinterlands-web3-wallets",
"version": "1.0.1",
"description": "Small library to use Hive Keychain with Typescript",
"main": "dist/web3-wallets.js",
"module": "dist/web3-wallets.esm.js",
"typings": "dist/web3-wallets.d.ts",
"browser": {
"./dist/web3-wallets.js": "./dist/web3-wallets.browser.js",
"./dist/web3-wallets.esm.js": "./dist/web3-wallets.browser.esm.js"
},
"files": [
"dist"
],
"repository": {
"type": "git",
"url": "https://github.com/steem-monsters/web3-wallets.git"
},
"scripts": {
"lint": "eslint --ext .ts,.js,.vue . --ignore-path .gitignore .",
"prepublishOnly": "npm run lint && npm run build",
"build": "npm run build:clear && rollup -c",
"build:watch": "tsc -w",
"build:clear": "rimraf dist && rimraf tsconfig.tsbuildinfo"
},
"author": "reichert-splinterlands",
"license": "MIT",
"keywords": [
"blockchain",
"wallet"
],
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.30.4",
"@typescript-eslint/parser": "^5.30.4",
"eslint": "^8.19.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.7.1",
"rollup-plugin-dts": "^4.2.2",
"rollup-plugin-esbuild": "^4.9.1",
"ts-node": "^10.8.2",
"ts-node-dev": "^2.0.0",
"typescript": "^4.7.4"
},
"dependencies": {
"web3": "^1.7.4"
}
"name": "splinterlands-web3-wallets",
"version": "1.0.2",
"description": "Small library to use Hive Keychain with Typescript",
"main": "dist/web3-wallets.js",
"module": "dist/web3-wallets.esm.js",
"typings": "dist/web3-wallets.d.ts",
"browser": {
"./dist/web3-wallets.js": "./dist/web3-wallets.browser.js",
"./dist/web3-wallets.esm.js": "./dist/web3-wallets.browser.esm.js"
},
"files": [
"dist"
],
"repository": {
"type": "git",
"url": "https://github.com/steem-monsters/web3-wallets.git"
},
"scripts": {
"lint": "eslint --ext .ts,.js,.vue . --ignore-path .gitignore .",
"prepublishOnly": "npm run lint && npm run build",
"build": "npm run build:clear && rollup -c",
"build:watch": "tsc -w",
"build:clear": "rimraf dist && rimraf tsconfig.tsbuildinfo"
},
"author": "reichert-splinterlands",
"license": "MIT",
"keywords": [
"blockchain",
"wallet"
],
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.30.4",
"@typescript-eslint/parser": "^5.30.4",
"eslint": "^8.19.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
"prettier": "^2.7.1",
"rollup": "^2.75.7",
"rollup-plugin-dts": "^4.2.2",
"rollup-plugin-esbuild": "^4.9.1",
"ts-node": "^10.8.2",
"ts-node-dev": "^2.0.0",
"typescript": "^4.7.4"
},
"dependencies": {
"web3": "^1.7.4"
}
}

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 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