Socket
Socket
Sign inDemoInstall

@walletconnect/utils

Package Overview
Dependencies
Maintainers
1
Versions
646
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@walletconnect/utils - npm Package Compare versions

Comparing version 1.0.0-beta.15 to 1.0.0-beta.16

2

lib/index.js

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

!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("WalletConnectUtils",[],r):"object"==typeof exports?exports.WalletConnectUtils=r():t.WalletConnectUtils=r()}(this,function(){return function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=1)}([function(t,r){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,r,e){"use strict";(function(t){Object.defineProperty(r,"__esModule",{value:!0});var n=e(6),o=n.__importDefault(e(7)),i=e(8);function u(t){return t.toString("hex")}function f(r){return new t(r,"hex")}function a(t){for(var r=new Uint8Array(t),e=[],n=0;n<r.length;){var o=r[n];o<128?(e.push(String.fromCharCode(o)),n++):o>191&&o<224?(e.push(String.fromCharCode((31&o)<<6|63&r[n+1])),n+=2):(e.push(String.fromCharCode((15&o)<<12|(63&r[n+1])<<6|63&r[n+2])),n+=3)}return e.join("")}function s(t){var r=[],e=0;for(t=encodeURI(t);e<t.length;){var n=t.charCodeAt(e++);37===n?(r.push(parseInt(t.substr(e,2),16)),e+=2):r.push(n)}return new Uint8Array(r).buffer}function c(t){for(var r=new Uint8Array(t),e=[],n=0;n<r.length;n++){var o=r[n];e.push("0123456789abcdef"[(240&o)>>4]+"0123456789abcdef"[15&o])}return e.join("")}function h(t){for(var r=[],e=0;e<t.length;e+=2)r.push(parseInt(t.substr(e,2),16));return new Uint8Array(r).buffer}function l(t){return c(s(t))}function p(t){return t?"0x"+i.keccak_256(t):""}function d(t){return""===(t="0x"===t.substring(0,2)?t.substring(2):t)?"":"0x"+(t=t.length%2!=0?"0"+t:t)}r.convertArrayBufferToBuffer=function(t){return f(c(t))},r.convertBufferToArrayBuffer=function(t){return h(u(t))},r.convertUtf8ToBuffer=function(r){return new t(r,"utf8")},r.convertBufferToUtf8=function(t){return t.toString("utf8")},r.convertBufferToHex=u,r.convertHexToBuffer=f,r.concatBuffers=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return f(t.map(function(t){return u(t)}).join(""))},r.concatArrayBuffers=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return h(t.map(function(t){return c(t)}).join(""))},r.convertArrayBufferToUtf8=a,r.convertUtf8ToArrayBuffer=s,r.convertArrayBufferToHex=c,r.convertHexToArrayBuffer=h,r.convertUtf8ToHex=l,r.convertHexToUtf8=function(t){return a(h(t))},r.payloadId=function(){return(new Date).getTime()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))},r.uuid=function(){return function(t,r){for(r=t="";t++<36;r+=51*t&52?(15^t?8^Math.random()*(20^t?16:4):4).toString(16):"-");return r}()},r.isHexStrict=function(t){return("string"==typeof t||o.default(t))&&/^(-)?0x[0-9a-f]*$/i.test(t)},r.keccak256=p,r.toChecksumAddress=function(t){if(void 0===t)return"";for(var r=p(t=t.toLowerCase().replace("0x","")).replace("0x",""),e="0x",n=0;n<t.length;n++)parseInt(r[n],16)>7?e+=t[n].toUpperCase():e+=t[n];return e},r.isValidAddress=function(t){return!!t&&("0x"===t.toLowerCase().substring(0,2)&&(!!/^(0x)?[0-9a-f]{40}$/i.test(t)&&(!(!/^(0x)?[0-9a-f]{40}$/.test(t)&&!/^(0x)?[0-9A-F]{40}$/.test(t))||t===r.toChecksumAddress(t))))},r.getMeta=function(){if("undefined"==typeof window||"undefined"==typeof document||void 0===window.location)return null;function t(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var e=document.getElementsByTagName("meta"),n=function(r){var n=e[r],o=["itemprop","property","name"].map(function(t){return n.getAttribute(t)}).filter(function(r){r&&t.includes(r)});if(o.length&&o){var i=n.getAttribute("content");if(i)return{value:i}}},o=0;o<e.length;o++){var i=n(o);if("object"==typeof i)return i.value}return""}var r=function(){var r=t("name","og:site_name","og:title","twitter:title");return r||(r=document.title),r}();return{description:t("description","og:description","twitter:description","keywords"),url:window.location.origin,icons:function(){for(var t=document.getElementsByTagName("link"),r=[],e=0;e<t.length;e++){var n=t[e],o=n.getAttribute("rel");if(o&&o.toLowerCase().indexOf("icon")>-1){var i=n.getAttribute("href");if(i)if(-1===i.toLowerCase().indexOf("https:")&&-1===i.toLowerCase().indexOf("http:")&&0!==i.indexOf("//")){var u=window.location.protocol+"//"+window.location.host;if(0===i.indexOf("/"))u+=i;else{var f=window.location.pathname.split("/");f.pop(),u+=f.join("/")+"/"+i}r.push(u)}else if(0===i.indexOf("//")){var a=window.location.protocol+i;r.push(a)}else r.push(i)}}return r}(),name:r}},r.parseWalletConnectUri=function(t){var r=t.indexOf(":"),e=-1!==t.indexOf("?")?t.indexOf("?"):void 0,o=t.substring(0,r),i=function(t){var r=t.split("@");return{handshakeTopic:r[0],version:parseInt(r[1],10)}}(t.substring(r+1,e)),u=function(t){for(var r={},e=("?"===t[0]?t.substr(1):t).split("&"),n=0;n<e.length;n++){var o=e[n].match(/\w+(?==)/i)||[],i=e[n].match(/=.+/i)||[];o[0]&&(r[decodeURIComponent(o[0])]=decodeURIComponent(i[0].substr(1)))}return{key:r.key||"",bridge:r.bridge||""}}(void 0!==e?t.substr(e):"");return n.__assign({protocol:o},i,u)},r.sanitizeHex=d,r.removeHexPrefix=function(t){return t.toLowerCase().replace("0x","")},r.promisify=function(t,r){var e=this;return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.__awaiter(e,void 0,void 0,function(){return n.__generator(this,function(e){return[2,new Promise(function(e,i){t.apply(r,n.__spread(o,[function(t,r){null==t&&i(t),e(r)}]))})]})})}},r.parseTransactionData=function(t){if(void 0===t.from||!r.isValidAddress(t.from))throw new Error("Transaction object must include a valid 'from' value.");function e(t){return r.isHexStrict(t)?t:l(t)}var n={from:d(t.from),to:void 0===t.to?"":d(t.to),gasPrice:void 0===t.gasPrice?"":e(""+t.gasPrice),gasLimit:void 0===t.gasLimit?void 0===t.gas?"":e(""+t.gas):e(""+t.gasLimit),value:void 0===t.value?"":e(""+t.value),nonce:void 0===t.nonce?"":e(""+t.nonce)},o=["gasPrice","gas","value","nonce"];return Object.keys(n).forEach(function(t){!n[t].trim().length&&o.includes(t)&&delete n[t]}),n},r.formatRpcError=function(t){var r=t.message||"Failed or Rejected Request",e=-32e3;if(t&&!t.code)switch(r){case"Parse error":e=-32700;break;case"Invalid request":e=-32600;break;case"Method not found":e=-32601;break;case"Invalid params":e=-32602;break;case"Internal error":e=-32603;break;default:e=-32e3}return{code:e,message:r}}}).call(this,e(2).Buffer)},function(t,r,e){"use strict";(function(t){
!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("WalletConnectUtils",[],r):"object"==typeof exports?exports.WalletConnectUtils=r():t.WalletConnectUtils=r()}(this,function(){return function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=1)}([function(t,r){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,r,e){"use strict";(function(t){Object.defineProperty(r,"__esModule",{value:!0});var n=e(6),o=n.__importDefault(e(7)),i=e(8);function u(t){return t.toString("hex")}function f(r){return new t(r,"hex")}function a(t){for(var r=new Uint8Array(t),e=[],n=0;n<r.length;){var o=r[n];o<128?(e.push(String.fromCharCode(o)),n++):o>191&&o<224?(e.push(String.fromCharCode((31&o)<<6|63&r[n+1])),n+=2):(e.push(String.fromCharCode((15&o)<<12|(63&r[n+1])<<6|63&r[n+2])),n+=3)}return e.join("")}function s(t){var r=[],e=0;for(t=encodeURI(t);e<t.length;){var n=t.charCodeAt(e++);37===n?(r.push(parseInt(t.substr(e,2),16)),e+=2):r.push(n)}return new Uint8Array(r).buffer}function c(t){for(var r=new Uint8Array(t),e=[],n=0;n<r.length;n++){var o=r[n];e.push("0123456789abcdef"[(240&o)>>4]+"0123456789abcdef"[15&o])}return e.join("")}function h(t){for(var r=[],e=0;e<t.length;e+=2)r.push(parseInt(t.substr(e,2),16));return new Uint8Array(r).buffer}function l(t){return c(s(t))}function p(t){return t?"0x"+i.keccak_256(t):""}function d(t){return""===(t="0x"===t.substring(0,2)?t.substring(2):t)?"":"0x"+(t=t.length%2!=0?"0"+t:t)}r.convertArrayBufferToBuffer=function(t){return f(c(t))},r.convertBufferToArrayBuffer=function(t){return h(u(t))},r.convertUtf8ToBuffer=function(r){return new t(r,"utf8")},r.convertBufferToUtf8=function(t){return t.toString("utf8")},r.convertBufferToHex=u,r.convertHexToBuffer=f,r.concatBuffers=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return f(t.map(function(t){return u(t)}).join(""))},r.concatArrayBuffers=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return h(t.map(function(t){return c(t)}).join(""))},r.convertArrayBufferToUtf8=a,r.convertUtf8ToArrayBuffer=s,r.convertArrayBufferToHex=c,r.convertHexToArrayBuffer=h,r.convertUtf8ToHex=l,r.convertHexToUtf8=function(t){return a(h(t))},r.payloadId=function(){return(new Date).getTime()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))},r.uuid=function(){return function(t,r){for(r=t="";t++<36;r+=51*t&52?(15^t?8^Math.random()*(20^t?16:4):4).toString(16):"-");return r}()},r.isHexStrict=function(t){return("string"==typeof t||o.default(t))&&/^(-)?0x[0-9a-f]*$/i.test(t)},r.keccak256=p,r.toChecksumAddress=function(t){if(void 0===t)return"";for(var r=p(t=t.toLowerCase().replace("0x","")).replace("0x",""),e="0x",n=0;n<t.length;n++)parseInt(r[n],16)>7?e+=t[n].toUpperCase():e+=t[n];return e},r.isValidAddress=function(t){return!!t&&("0x"===t.toLowerCase().substring(0,2)&&(!!/^(0x)?[0-9a-f]{40}$/i.test(t)&&(!(!/^(0x)?[0-9a-f]{40}$/.test(t)&&!/^(0x)?[0-9A-F]{40}$/.test(t))||t===r.toChecksumAddress(t))))},r.getMeta=function(){if("undefined"==typeof window||"undefined"==typeof document||void 0===window.location)return null;function t(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var e=document.getElementsByTagName("meta"),n=function(r){var n=e[r],o=["itemprop","property","name"].map(function(t){return n.getAttribute(t)}).filter(function(r){r&&t.includes(r)});if(o.length&&o){var i=n.getAttribute("content");if(i)return{value:i}}},o=0;o<e.length;o++){var i=n(o);if("object"==typeof i)return i.value}return""}var r=function(){var r=t("name","og:site_name","og:title","twitter:title");return r||(r=document.title),r}();return{description:t("description","og:description","twitter:description","keywords"),url:window.location.origin,icons:function(){for(var t=document.getElementsByTagName("link"),r=[],e=0;e<t.length;e++){var n=t[e],o=n.getAttribute("rel");if(o&&o.toLowerCase().indexOf("icon")>-1){var i=n.getAttribute("href");if(i)if(-1===i.toLowerCase().indexOf("https:")&&-1===i.toLowerCase().indexOf("http:")&&0!==i.indexOf("//")){var u=window.location.protocol+"//"+window.location.host;if(0===i.indexOf("/"))u+=i;else{var f=window.location.pathname.split("/");f.pop(),u+=f.join("/")+"/"+i}r.push(u)}else if(0===i.indexOf("//")){var a=window.location.protocol+i;r.push(a)}else r.push(i)}}return r}(),name:r}},r.parseWalletConnectUri=function(t){var r=t.indexOf(":"),e=-1!==t.indexOf("?")?t.indexOf("?"):void 0,o=t.substring(0,r),i=function(t){var r=t.split("@");return{handshakeTopic:r[0],version:parseInt(r[1],10)}}(t.substring(r+1,e)),u=function(t){for(var r={},e=("?"===t[0]?t.substr(1):t).split("&"),n=0;n<e.length;n++){var o=e[n].match(/\w+(?==)/i)||[],i=e[n].match(/=.+/i)||[];o[0]&&(r[decodeURIComponent(o[0])]=decodeURIComponent(i[0].substr(1)))}return{key:r.key||"",bridge:r.bridge||""}}(void 0!==e?t.substr(e):"");return n.__assign({protocol:o},i,u)},r.sanitizeHex=d,r.removeHexPrefix=function(t){return t.toLowerCase().replace("0x","")},r.promisify=function(t,r){var e=this;return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.__awaiter(e,void 0,void 0,function(){return n.__generator(this,function(e){return[2,new Promise(function(e,i){t.apply(r,n.__spread(o,[function(t,r){null==t&&i(t),e(r)}]))})]})})}},r.parseTransactionData=function(t){if(void 0===t.from||!r.isValidAddress(t.from))throw new Error("Transaction object must include a valid 'from' value.");function e(t){return r.isHexStrict(t)?t:l(t)}var n={from:d(t.from),to:void 0===t.to?"":d(t.to),gasPrice:void 0===t.gasPrice?"":e(""+t.gasPrice),gasLimit:void 0===t.gasLimit?void 0===t.gas?"":e(""+t.gas):e(""+t.gasLimit),value:void 0===t.value?"":e(""+t.value),nonce:void 0===t.nonce?"":e(""+t.nonce),data:void 0===t.data?"":e(""+t.data)},o=["gasPrice","gasLimit","value","nonce"];return Object.keys(n).forEach(function(t){!n[t].trim().length&&o.includes(t)&&delete n[t]}),n},r.formatRpcError=function(t){var r=t.message||"Failed or Rejected Request",e=-32e3;if(t&&!t.code)switch(r){case"Parse error":e=-32700;break;case"Invalid request":e=-32600;break;case"Method not found":e=-32601;break;case"Invalid params":e=-32602;break;case"Internal error":e=-32603;break;default:e=-32e3}return{code:e,message:r}}}).call(this,e(2).Buffer)},function(t,r,e){"use strict";(function(t){
/*!

@@ -3,0 +3,0 @@ * The buffer module from node.js, for the browser.

{
"name": "@walletconnect/utils",
"version": "1.0.0-beta.15",
"version": "1.0.0-beta.16",
"description": "Utility Library for WalletConnect",

@@ -58,3 +58,3 @@ "scripts": {

"dependencies": {
"@walletconnect/types": "^1.0.0-beta.15",
"@walletconnect/types": "^1.0.0-beta.16",
"js-sha3": "^0.8.0",

@@ -61,0 +61,0 @@ "lodash.isnumber": "^3.0.3"

@@ -480,6 +480,8 @@ import isNumber from 'lodash.isnumber'

? ''
: parseHexValues(`${txData.nonce}`)
: parseHexValues(`${txData.nonce}`),
data:
typeof txData.data === 'undefined' ? '' : parseHexValues(`${txData.data}`)
}
const prunable = ['gasPrice', 'gas', 'value', 'nonce']
const prunable = ['gasPrice', 'gasLimit', 'value', 'nonce']
Object.keys(txDataRPC).forEach((key: string) => {

@@ -486,0 +488,0 @@ if (!txDataRPC[key].trim().length && prunable.includes(key)) {

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