@secux/utility
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isSupportedCoin=exports.supported_coin=exports.BigIntToBuffer=exports.ow_checkBufferLength=exports.ow_accountPath=exports.ow_strictPath=exports.ow_numberString=exports.ow_hashString=exports.ow_prefixedhexString=exports.ow_hexString=exports.ow_bip32String=exports.toExtenededPublicKey=exports.splitPath=exports.buildPathBuffer=void 0;const e=require("bignumber.js"),t=require("ow"),r=require("./BIP32Path");var o=require("./BIP32Path");Object.defineProperty(exports,"buildPathBuffer",{enumerable:!0,get:function(){return o.buildPathBuffer}}),Object.defineProperty(exports,"splitPath",{enumerable:!0,get:function(){return o.splitPath}});var n=require("./xpub");function p(e){let t="";return e.map((e=>t+=`${e.toString()}|`)),t=`(${t.substr(0,t.length-1)})`,t}Object.defineProperty(exports,"toExtenededPublicKey",{enumerable:!0,get:function(){return n.toExtenededPublicKey}}),exports.ow_bip32String=t.default.string.matches(/^m(\/\d+'){3}(\/\d+){2}$/),exports.ow_hexString=t.default.string.matches(/^[0-9A-F-a-f]+$/),exports.ow_prefixedhexString=t.default.string.matches(/^0x[0-9A-F-a-f]+$/),exports.ow_hashString=t.default.string.matches(/^[0-9A-Z-a-z]+$/),exports.ow_numberString=t.default.string.matches(/^[0-9]+$/),exports.ow_strictPath=function(e,r){const o=p("number"==typeof e?[e]:e);if(r){const e=p("number"==typeof r?[r]:r);return t.default.string.matches(new RegExp(`^m/${e}'/${o}'/[0-9]+'/[0-9]+/[0-9]+$`))}return t.default.string.matches(new RegExp(`^m/(44|49|84)'/${o}'/[0-9]+'/[0-9]+/[0-9]+$`))},exports.ow_accountPath=function(e,r){const o=p("number"==typeof e?[e]:e);if(r){const e=p("number"==typeof r?[r]:r);return t.default.string.matches(new RegExp(`^m/${e}'/${o}'/[0-9]+'/[0-9]+/[0-9]+$`))}return t.default.string.matches(new RegExp(`^m/(44|49|84)'/${o}'/[0-9]+'$`))},exports.ow_checkBufferLength=function(e){return t.default.buffer.validate((t=>({validator:t.length===e,message:r=>`ArgumentError: Expected length of ${r} is ${e}, got ${t.length}`})))},exports.BigIntToBuffer=function(t,r,o=!0){let n="";"number"==typeof t?n=t.toString(16):"string"==typeof t&&(n=new e.BigNumber(t).toString(16)),n.length%2!=0&&(n="0"+n);const p=Buffer.from(n,"hex");if(p.length>r)throw Error("value is too large");const i=Buffer.concat([Buffer.alloc(r-p.length),p]);return o?i.reverse():i},exports.supported_coin=Object.freeze([{purpose:[44,49,84],cointype:0,name:"bitcoin mainnet"},{purpose:[44,49],cointype:1,name:"bitcoin testnet"},{purpose:[44,49],cointype:2,name:"litecoin"},{purpose:[44],cointype:3,name:"dogecoin"},{purpose:[44],cointype:5,name:"dash"},{purpose:[44,49],cointype:17,name:"groestl"},{purpose:[44,49],cointype:20,name:"digibyte"},{purpose:[44],cointype:60,name:"ethereum"},{purpose:[44],cointype:144,name:"ripple"},{purpose:[44],cointype:145,name:"bitcoincash"},{purpose:[44],cointype:148,name:"stellar"},{purpose:[44],cointype:358,name:"tron"},{purpose:[44],cointype:714,name:"binance"},{purpose:[1852],cointype:1815,name:"cardano"}]),exports.isSupportedCoin=function(e){const t=(0,r.splitPath)(e);for(const e of exports.supported_coin)if(e.purpose.includes(t.purpose.value)&&e.cointype===t.coinType.value)return!0;return!1}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isSupportedCoin=exports.supported_coin=exports.BigIntToBuffer=exports.ow_checkBufferLength=exports.ow_accountPath=exports.ow_strictPath=exports.ow_numberString=exports.ow_hashString=exports.ow_prefixedhexString=exports.ow_hexString=exports.ow_bip32String=exports.toExtenededPublicKey=exports.splitPath=exports.buildPathBuffer=void 0;const e=require("bignumber.js"),t=require("ow"),r=require("./BIP32Path");var o=require("./BIP32Path");Object.defineProperty(exports,"buildPathBuffer",{enumerable:!0,get:function(){return o.buildPathBuffer}}),Object.defineProperty(exports,"splitPath",{enumerable:!0,get:function(){return o.splitPath}});var n=require("./xpub");function p(e){let t="";return e.map((e=>t+=`${e.toString()}|`)),t=`(${t.substr(0,t.length-1)})`,t}Object.defineProperty(exports,"toExtenededPublicKey",{enumerable:!0,get:function(){return n.toExtenededPublicKey}}),exports.ow_bip32String=t.default.string.matches(/^m(\/\d+'){3}(\/\d+){2}$/),exports.ow_hexString=t.default.string.matches(/^[0-9A-F-a-f]+$/),exports.ow_prefixedhexString=t.default.string.matches(/^0x[0-9A-F-a-f]+$/),exports.ow_hashString=t.default.string.matches(/^[0-9A-Z-a-z]+$/),exports.ow_numberString=t.default.string.matches(/^[0-9]+$/),exports.ow_strictPath=function(e,r){const o=p("number"==typeof e?[e]:e);if(r){const e=p("number"==typeof r?[r]:r);return t.default.string.matches(new RegExp(`^m/${e}'/${o}'/[0-9]+'/[0-9]+/[0-9]+$`))}return t.default.string.matches(new RegExp(`^m/(44|49|84)'/${o}'/[0-9]+'/[0-9]+/[0-9]+$`))},exports.ow_accountPath=function(e,r){const o=p("number"==typeof e?[e]:e);if(r){const e=p("number"==typeof r?[r]:r);return t.default.string.matches(new RegExp(`^m/${e}'/${o}'/[0-9]+'/[0-9]+/[0-9]+$`))}return t.default.string.matches(new RegExp(`^m/(44|49|84)'/${o}'/[0-9]+'$`))},exports.ow_checkBufferLength=function(e){return t.default.buffer.validate((t=>({validator:t.length===e,message:r=>`ArgumentError: Expected length of ${r} is ${e}, got ${t.length}`})))},exports.BigIntToBuffer=function(t,r,o=!0){let n="";"number"==typeof t?n=t.toString(16):"string"==typeof t&&(n=new e.BigNumber(t).toString(16)),n.length%2!=0&&(n="0"+n);const p=Buffer.from(n,"hex");if(p.length>r)throw Error("value is too large");const i=Buffer.concat([Buffer.alloc(r-p.length),p]);return o?i.reverse():i},exports.supported_coin=Object.freeze([{purpose:[44,49,84],cointype:0,name:"bitcoin mainnet"},{purpose:[44,49],cointype:1,name:"bitcoin testnet"},{purpose:[44,49],cointype:2,name:"litecoin"},{purpose:[44],cointype:3,name:"dogecoin"},{purpose:[44],cointype:5,name:"dash"},{purpose:[44,49],cointype:17,name:"groestl"},{purpose:[44,49],cointype:20,name:"digibyte"},{purpose:[44],cointype:60,name:"ethereum"},{purpose:[44],cointype:144,name:"ripple"},{purpose:[44],cointype:145,name:"bitcoincash"},{purpose:[44],cointype:148,name:"stellar"},{purpose:[44],cointype:195,name:"tron"},{purpose:[44],cointype:714,name:"binance"},{purpose:[1852],cointype:1815,name:"cardano"}]),exports.isSupportedCoin=function(e){const t=(0,r.splitPath)(e);for(const e of exports.supported_coin)if(e.purpose.includes(t.purpose.value)&&e.cointype===t.coinType.value)return!0;return!1}; |
{ | ||
"name": "@secux/utility", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "SecuX Hardware Wallet internal tools for SDK", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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