New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@xdefi/bitcoin-provider

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xdefi/bitcoin-provider - npm Package Compare versions

Comparing version 0.0.14 to 0.1.0

30

dist/bundles/index.esm.js

@@ -32,5 +32,11 @@ import { EventEmitter } from 'events';

this.callBacksMap = callBacksMap;
this.chainId = 'mainnet';
this.network = 'mainnet';
this._chainId = 'mainnet';
this._network = 'mainnet';
}
get chainId() {
return this._chainId;
}
get network() {
return this._network;
}
// This will be called when accounts have changed and need to be re-pulled

@@ -41,14 +47,14 @@ // by the dApp

}
changeNetwork(chainId, network) {
if (chainId !== network) {
throw Error(`changeNetwork failed, incorrect chainId-network ${chainId} ${network}`);
changeNetwork(_chainId, _network) {
if (_chainId !== _network) {
throw Error(`changeNetwork failed, incorrect _chainId-_network ${_chainId} ${_network}`);
}
if (!['mainnet', 'testnet'].includes(chainId)) {
throw Error(`changeNetwork failed, incorrect chainId-network ${chainId} ${network}`);
if (!['mainnet', 'testnet'].includes(_chainId)) {
throw Error(`changeNetwork failed, incorrect _chainId-_network ${_chainId} ${_network}`);
}
this.chainId = chainId;
this.network = network;
this._chainId = _chainId;
this._network = _network;
this.emit('chainChanged', {
chainId,
network,
_chainId,
_network,
});

@@ -68,3 +74,3 @@ }

msg = {
name: 'provider',
name: 'xdefiprovider',
data: {

@@ -71,0 +77,0 @@ xdefiId: pId,

2

dist/bundles/index.esm.min.js

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

import{EventEmitter}from"events";const genPayloadId=()=>{return 1e3*(new Date).getTime()+Math.floor(1e3*Math.random())};var XDEFIBitcoinPayloadMethods,MessageNamespace;!function(e){e[e.REQUEST_ACCOUNTS=0]="REQUEST_ACCOUNTS",e[e.SIGN_TRANSACTION=1]="SIGN_TRANSACTION",e[e.GET_UNSPENT_UTXOS=2]="GET_UNSPENT_UTXOS",e[e.TRANSFER=3]="TRANSFER"}(XDEFIBitcoinPayloadMethods||(XDEFIBitcoinPayloadMethods={})),function(e){e[e.BINANCEDEX=0]="BINANCEDEX",e[e.BINANCESMARTCHAIN=1]="BINANCESMARTCHAIN",e[e.BITCOIN=2]="BITCOIN",e[e.ETHEREUM=3]="ETHEREUM"}(MessageNamespace||(MessageNamespace={}));class XDEFIBitcoinProvider extends EventEmitter{constructor(e,t){super(),this.msgStream=e,this.callBacksMap=t,this.chainId="mainnet",this.network="mainnet"}emitAccountsChanged(){this.emit("accountsChanged",{})}changeNetwork(e,t){if(e!==t)throw Error(`changeNetwork failed, incorrect chainId-network ${e} ${t}`);if(!["mainnet","testnet"].includes(e))throw Error(`changeNetwork failed, incorrect chainId-network ${e} ${t}`);this.chainId=e,this.network=t,this.emit("chainChanged",{chainId:e,network:t})}request(e,t){const i=genPayloadId();let a;switch(e.method){case XDEFIBitcoinPayloadMethods.REQUEST_ACCOUNTS:case XDEFIBitcoinPayloadMethods.SIGN_TRANSACTION:case XDEFIBitcoinPayloadMethods.GET_UNSPENT_UTXOS:case XDEFIBitcoinPayloadMethods.TRANSFER:a={name:"provider",data:{xdefiId:i,origin:null,namespace:MessageNamespace.BITCOIN,raw:{id:i,method:e.method,params:e.params},time:Date.now()}},t&&this.callBacksMap&&this.callBacksMap.set(a.data.raw.id,t),this.msgStream&&this.msgStream.write(a);break;default:throw Error(`XDEFI Bitcoin Provider: this method ${e.method} is not supported`)}}}const _initBitcoinProvider=(e,t)=>new XDEFIBitcoinProvider(e,t),initBitcoinProvider=_initBitcoinProvider;export{XDEFIBitcoinProvider,initBitcoinProvider,XDEFIBitcoinPayloadMethods,MessageNamespace};
import{EventEmitter}from"events";const genPayloadId=()=>{return 1e3*(new Date).getTime()+Math.floor(1e3*Math.random())};var XDEFIBitcoinPayloadMethods,MessageNamespace;!function(e){e[e.REQUEST_ACCOUNTS=0]="REQUEST_ACCOUNTS",e[e.SIGN_TRANSACTION=1]="SIGN_TRANSACTION",e[e.GET_UNSPENT_UTXOS=2]="GET_UNSPENT_UTXOS",e[e.TRANSFER=3]="TRANSFER"}(XDEFIBitcoinPayloadMethods||(XDEFIBitcoinPayloadMethods={})),function(e){e[e.BINANCEDEX=0]="BINANCEDEX",e[e.BINANCESMARTCHAIN=1]="BINANCESMARTCHAIN",e[e.BITCOIN=2]="BITCOIN",e[e.ETHEREUM=3]="ETHEREUM"}(MessageNamespace||(MessageNamespace={}));class XDEFIBitcoinProvider extends EventEmitter{constructor(e,t){super(),this.msgStream=e,this.callBacksMap=t,this._chainId="mainnet",this._network="mainnet"}get chainId(){return this._chainId}get network(){return this._network}emitAccountsChanged(){this.emit("accountsChanged",{})}changeNetwork(e,t){if(e!==t)throw Error(`changeNetwork failed, incorrect _chainId-_network ${e} ${t}`);if(!["mainnet","testnet"].includes(e))throw Error(`changeNetwork failed, incorrect _chainId-_network ${e} ${t}`);this._chainId=e,this._network=t,this.emit("chainChanged",{_chainId:e,_network:t})}request(e,t){const i=genPayloadId();let a;switch(e.method){case XDEFIBitcoinPayloadMethods.REQUEST_ACCOUNTS:case XDEFIBitcoinPayloadMethods.SIGN_TRANSACTION:case XDEFIBitcoinPayloadMethods.GET_UNSPENT_UTXOS:case XDEFIBitcoinPayloadMethods.TRANSFER:a={name:"xdefiprovider",data:{xdefiId:i,origin:null,namespace:MessageNamespace.BITCOIN,raw:{id:i,method:e.method,params:e.params},time:Date.now()}},t&&this.callBacksMap&&this.callBacksMap.set(a.data.raw.id,t),this.msgStream&&this.msgStream.write(a);break;default:throw Error(`XDEFI Bitcoin Provider: this method ${e.method} is not supported`)}}}const _initBitcoinProvider=(e,t)=>new XDEFIBitcoinProvider(e,t),initBitcoinProvider=_initBitcoinProvider;export{XDEFIBitcoinProvider,initBitcoinProvider,XDEFIBitcoinPayloadMethods,MessageNamespace};
//# sourceMappingURL=index.esm.min.js.map

@@ -35,6 +35,20 @@ (function (global, factory) {

_this.callBacksMap = callBacksMap;
_this.chainId = 'mainnet';
_this.network = 'mainnet';
_this._chainId = 'mainnet';
_this._network = 'mainnet';
return _this;
}
Object.defineProperty(XDEFIBitcoinProvider.prototype, "chainId", {
get: function () {
return this._chainId;
},
enumerable: true,
configurable: true
});
Object.defineProperty(XDEFIBitcoinProvider.prototype, "network", {
get: function () {
return this._network;
},
enumerable: true,
configurable: true
});
// This will be called when accounts have changed and need to be re-pulled

@@ -45,14 +59,14 @@ // by the dApp

};
XDEFIBitcoinProvider.prototype.changeNetwork = function (chainId, network) {
if (chainId !== network) {
throw Error("changeNetwork failed, incorrect chainId-network " + chainId + " " + network);
XDEFIBitcoinProvider.prototype.changeNetwork = function (_chainId, _network) {
if (_chainId !== _network) {
throw Error("changeNetwork failed, incorrect _chainId-_network " + _chainId + " " + _network);
}
if (!['mainnet', 'testnet'].includes(chainId)) {
throw Error("changeNetwork failed, incorrect chainId-network " + chainId + " " + network);
if (!['mainnet', 'testnet'].includes(_chainId)) {
throw Error("changeNetwork failed, incorrect _chainId-_network " + _chainId + " " + _network);
}
this.chainId = chainId;
this.network = network;
this._chainId = _chainId;
this._network = _network;
this.emit('chainChanged', {
chainId: chainId,
network: network,
_chainId: _chainId,
_network: _network,
});

@@ -72,3 +86,3 @@ };

msg = {
name: 'provider',
name: 'xdefiprovider',
data: {

@@ -75,0 +89,0 @@ xdefiId: pId,

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("tslib"),require("events")):"function"==typeof define&&define.amd?define(["exports","tslib","events"],t):t((e=e||self).BitcoinProvider={},e.tslib_1,e.events)}(this,function(o,t,e){"use strict";var i,a;(i=o.XDEFIBitcoinPayloadMethods||(o.XDEFIBitcoinPayloadMethods={}))[i.REQUEST_ACCOUNTS=0]="REQUEST_ACCOUNTS",i[i.SIGN_TRANSACTION=1]="SIGN_TRANSACTION",i[i.GET_UNSPENT_UTXOS=2]="GET_UNSPENT_UTXOS",i[i.TRANSFER=3]="TRANSFER",(a=o.MessageNamespace||(o.MessageNamespace={}))[a.BINANCEDEX=0]="BINANCEDEX",a[a.BINANCESMARTCHAIN=1]="BINANCESMARTCHAIN",a[a.BITCOIN=2]="BITCOIN",a[a.ETHEREUM=3]="ETHEREUM";var n=function(a){function e(e,t){var i=a.call(this)||this;return i.msgStream=e,i.callBacksMap=t,i.chainId="mainnet",i.network="mainnet",i}return t.__extends(e,a),e.prototype.emitAccountsChanged=function(){this.emit("accountsChanged",{})},e.prototype.changeNetwork=function(e,t){if(e!==t)throw Error("changeNetwork failed, incorrect chainId-network "+e+" "+t);if(!["mainnet","testnet"].includes(e))throw Error("changeNetwork failed, incorrect chainId-network "+e+" "+t);this.chainId=e,this.network=t,this.emit("chainChanged",{chainId:e,network:t})},e.prototype.request=function(e,t){var i,a=1e3*(new Date).getTime()+Math.floor(1e3*Math.random());switch(e.method){case o.XDEFIBitcoinPayloadMethods.REQUEST_ACCOUNTS:case o.XDEFIBitcoinPayloadMethods.SIGN_TRANSACTION:case o.XDEFIBitcoinPayloadMethods.GET_UNSPENT_UTXOS:case o.XDEFIBitcoinPayloadMethods.TRANSFER:i={name:"provider",data:{xdefiId:a,origin:null,namespace:o.MessageNamespace.BITCOIN,raw:{id:a,method:e.method,params:e.params},time:Date.now()}},t&&this.callBacksMap&&this.callBacksMap.set(i.data.raw.id,t),this.msgStream&&this.msgStream.write(i);break;default:throw Error("XDEFI Bitcoin Provider: this method "+e.method+" is not supported")}},e}(e.EventEmitter),r=function(e,t){return new n(e,t)};o.XDEFIBitcoinProvider=n,o.initBitcoinProvider=r,Object.defineProperty(o,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("tslib"),require("events")):"function"==typeof define&&define.amd?define(["exports","tslib","events"],t):t((e=e||self).BitcoinProvider={},e.tslib_1,e.events)}(this,function(o,t,e){"use strict";var i,n;(i=o.XDEFIBitcoinPayloadMethods||(o.XDEFIBitcoinPayloadMethods={}))[i.REQUEST_ACCOUNTS=0]="REQUEST_ACCOUNTS",i[i.SIGN_TRANSACTION=1]="SIGN_TRANSACTION",i[i.GET_UNSPENT_UTXOS=2]="GET_UNSPENT_UTXOS",i[i.TRANSFER=3]="TRANSFER",(n=o.MessageNamespace||(o.MessageNamespace={}))[n.BINANCEDEX=0]="BINANCEDEX",n[n.BINANCESMARTCHAIN=1]="BINANCESMARTCHAIN",n[n.BITCOIN=2]="BITCOIN",n[n.ETHEREUM=3]="ETHEREUM";var a=function(n){function e(e,t){var i=n.call(this)||this;return i.msgStream=e,i.callBacksMap=t,i._chainId="mainnet",i._network="mainnet",i}return t.__extends(e,n),Object.defineProperty(e.prototype,"chainId",{get:function(){return this._chainId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"network",{get:function(){return this._network},enumerable:!0,configurable:!0}),e.prototype.emitAccountsChanged=function(){this.emit("accountsChanged",{})},e.prototype.changeNetwork=function(e,t){if(e!==t)throw Error("changeNetwork failed, incorrect _chainId-_network "+e+" "+t);if(!["mainnet","testnet"].includes(e))throw Error("changeNetwork failed, incorrect _chainId-_network "+e+" "+t);this._chainId=e,this._network=t,this.emit("chainChanged",{_chainId:e,_network:t})},e.prototype.request=function(e,t){var i,n=1e3*(new Date).getTime()+Math.floor(1e3*Math.random());switch(e.method){case o.XDEFIBitcoinPayloadMethods.REQUEST_ACCOUNTS:case o.XDEFIBitcoinPayloadMethods.SIGN_TRANSACTION:case o.XDEFIBitcoinPayloadMethods.GET_UNSPENT_UTXOS:case o.XDEFIBitcoinPayloadMethods.TRANSFER:i={name:"xdefiprovider",data:{xdefiId:n,origin:null,namespace:o.MessageNamespace.BITCOIN,raw:{id:n,method:e.method,params:e.params},time:Date.now()}},t&&this.callBacksMap&&this.callBacksMap.set(i.data.raw.id,t),this.msgStream&&this.msgStream.write(i);break;default:throw Error("XDEFI Bitcoin Provider: this method "+e.method+" is not supported")}},e}(e.EventEmitter),r=function(e,t){return new a(e,t)};o.XDEFIBitcoinProvider=a,o.initBitcoinProvider=r,Object.defineProperty(o,"__esModule",{value:!0})});
//# sourceMappingURL=index.umd.min.js.map

@@ -10,5 +10,11 @@ import { EventEmitter } from 'events';

this.callBacksMap = callBacksMap;
this.chainId = 'mainnet';
this.network = 'mainnet';
this._chainId = 'mainnet';
this._network = 'mainnet';
}
get chainId() {
return this._chainId;
}
get network() {
return this._network;
}
// This will be called when accounts have changed and need to be re-pulled

@@ -19,14 +25,14 @@ // by the dApp

}
changeNetwork(chainId, network) {
if (chainId !== network) {
throw Error(`changeNetwork failed, incorrect chainId-network ${chainId} ${network}`);
changeNetwork(_chainId, _network) {
if (_chainId !== _network) {
throw Error(`changeNetwork failed, incorrect _chainId-_network ${_chainId} ${_network}`);
}
if (!['mainnet', 'testnet'].includes(chainId)) {
throw Error(`changeNetwork failed, incorrect chainId-network ${chainId} ${network}`);
if (!['mainnet', 'testnet'].includes(_chainId)) {
throw Error(`changeNetwork failed, incorrect _chainId-_network ${_chainId} ${_network}`);
}
this.chainId = chainId;
this.network = network;
this._chainId = _chainId;
this._network = _network;
this.emit('chainChanged', {
chainId,
network,
_chainId,
_network,
});

@@ -46,3 +52,3 @@ }

msg = {
name: 'provider',
name: 'xdefiprovider',
data: {

@@ -49,0 +55,0 @@ xdefiId: pId,

@@ -12,6 +12,20 @@ import * as tslib_1 from "tslib";

_this.callBacksMap = callBacksMap;
_this.chainId = 'mainnet';
_this.network = 'mainnet';
_this._chainId = 'mainnet';
_this._network = 'mainnet';
return _this;
}
Object.defineProperty(XDEFIBitcoinProvider.prototype, "chainId", {
get: function () {
return this._chainId;
},
enumerable: true,
configurable: true
});
Object.defineProperty(XDEFIBitcoinProvider.prototype, "network", {
get: function () {
return this._network;
},
enumerable: true,
configurable: true
});
// This will be called when accounts have changed and need to be re-pulled

@@ -22,14 +36,14 @@ // by the dApp

};
XDEFIBitcoinProvider.prototype.changeNetwork = function (chainId, network) {
if (chainId !== network) {
throw Error("changeNetwork failed, incorrect chainId-network " + chainId + " " + network);
XDEFIBitcoinProvider.prototype.changeNetwork = function (_chainId, _network) {
if (_chainId !== _network) {
throw Error("changeNetwork failed, incorrect _chainId-_network " + _chainId + " " + _network);
}
if (!['mainnet', 'testnet'].includes(chainId)) {
throw Error("changeNetwork failed, incorrect chainId-network " + chainId + " " + network);
if (!['mainnet', 'testnet'].includes(_chainId)) {
throw Error("changeNetwork failed, incorrect _chainId-_network " + _chainId + " " + _network);
}
this.chainId = chainId;
this.network = network;
this._chainId = _chainId;
this._network = _network;
this.emit('chainChanged', {
chainId: chainId,
network: network,
_chainId: _chainId,
_network: _network,
});

@@ -49,3 +63,3 @@ };

msg = {
name: 'provider',
name: 'xdefiprovider',
data: {

@@ -52,0 +66,0 @@ xdefiId: pId,

{
"name": "@xdefi/bitcoin-provider",
"version": "0.0.14",
"version": "0.1.0",
"description": "xdefi bitcoin provider",

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

@@ -5,9 +5,11 @@ /// <reference types="node" />

export declare class XDEFIBitcoinProvider extends EventEmitter {
msgStream: any | undefined;
callBacksMap: Map<number, any> | undefined;
chainId: string;
network: string;
private msgStream;
private callBacksMap;
private _chainId;
private _network;
constructor(msgStream?: any, callBacksMap?: Map<number, any>);
readonly chainId: string;
readonly network: string;
emitAccountsChanged(): void;
changeNetwork(chainId: string, network: string): void;
changeNetwork(_chainId: string, _network: string): void;
request(payload: XDEFIBitcoinPayload, callbackFunction: any): void;

@@ -14,0 +16,0 @@ }

{
"name": "@xdefi/bitcoin-provider",
"version": "0.0.14",
"version": "0.1.0",
"description": "xdefi bitcoin provider",

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

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

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