@dodoex/wallet-web3 0.0.29-7 → 0.0.29-9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/__node-resolve_empty-791ff599.js +1 -0
  2. package/dist/__tslib-f57b178c.js +1 -0
  3. package/dist/_commonjs-dynamic-modules-7cfc9805.js +1 -0
  4. package/dist/blocto-afa3bd2f.js +7 -0
  5. package/dist/bn-0d54f183.js +1 -0
  6. package/dist/browser-ponyfill-2b89ba5a.js +1 -0
  7. package/dist/cjs/__node-resolve_empty-8d047230.cjs +1 -0
  8. package/dist/cjs/__tslib-ba3a83a3.cjs +1 -0
  9. package/dist/cjs/_commonjs-dynamic-modules-f09a98c7.cjs +1 -0
  10. package/dist/cjs/blocto-c82f60fd.cjs +7 -0
  11. package/dist/cjs/bn-7519dfb9.cjs +1 -0
  12. package/dist/cjs/browser-ponyfill-a2fe110e.cjs +1 -0
  13. package/dist/cjs/ethers-0cbd9a94.cjs +1 -0
  14. package/dist/cjs/hash-282034e6.cjs +1 -0
  15. package/dist/cjs/id-c1f8ef21.cjs +1 -0
  16. package/dist/cjs/index-1438cc4a.cjs +1 -0
  17. package/dist/cjs/index-390f74d4.cjs +1 -0
  18. package/dist/cjs/index-3da4db03.cjs +1 -0
  19. package/dist/cjs/index-41e51f13.cjs +72 -0
  20. package/dist/cjs/index-70269942.cjs +1 -0
  21. package/dist/cjs/index-7153e6ba.cjs +1 -0
  22. package/dist/cjs/index-851bfb86.cjs +1 -0
  23. package/dist/cjs/index-a7b876c9.cjs +1 -0
  24. package/dist/cjs/index-b6307a36.cjs +15 -0
  25. package/dist/cjs/index-bcd299f4.cjs +6 -0
  26. package/dist/cjs/index-bd265b4f.cjs +9 -0
  27. package/dist/cjs/index-cf3bf3b5.cjs +3 -0
  28. package/dist/cjs/index-d018e2ad.cjs +1 -0
  29. package/dist/cjs/index-df8e5839.cjs +1 -0
  30. package/dist/cjs/index-eb09e54d.cjs +60 -0
  31. package/dist/cjs/index.cjs +1 -1
  32. package/dist/cjs/index.es-40aefdd1.cjs +9 -0
  33. package/dist/cjs/inherits_browser-f88a000a.cjs +1 -0
  34. package/dist/cjs/interface-1b3e558c.cjs +1 -0
  35. package/dist/cjs/portis-413df2bf.cjs +24 -0
  36. package/dist/cjs/provider-db635447.cjs +1 -0
  37. package/dist/cjs/providers/wallets/standalone.d.ts +1 -0
  38. package/dist/cjs/providers/wallets/types.d.ts +2 -1
  39. package/dist/cjs/rainbow-bd266faf.cjs +1 -0
  40. package/dist/cjs/typed-data-7f7e9b45.cjs +1 -0
  41. package/dist/cjs/uAuth-a1275c54.cjs +1 -0
  42. package/dist/cjs/walletConnect-d9d188f0.cjs +1 -0
  43. package/dist/cjs/walletLink-27c00203.cjs +1 -0
  44. package/dist/ethers-74dad587.js +1 -0
  45. package/dist/hash-a9ebd52a.js +1 -0
  46. package/dist/id-d7d5f03e.js +1 -0
  47. package/dist/index-0ee5ef8d.js +60 -0
  48. package/dist/index-3e230de4.js +1 -0
  49. package/dist/index-493779ab.js +1 -0
  50. package/dist/index-4dce94d5.js +6 -0
  51. package/dist/index-5a901c0e.js +2 -0
  52. package/dist/index-6be6f872.js +1 -0
  53. package/dist/index-6ecf854b.js +15 -0
  54. package/dist/index-74bba30f.js +1 -0
  55. package/dist/index-85bfd871.js +1 -0
  56. package/dist/index-876d4980.js +1 -0
  57. package/dist/index-be6f7624.js +1 -0
  58. package/dist/index-cc5641ed.js +72 -0
  59. package/dist/index-d0eabf14.js +9 -0
  60. package/dist/index-d427f2bf.js +1 -0
  61. package/dist/index-e0d3617a.js +1 -0
  62. package/dist/index.es-b66a38fc.js +9 -0
  63. package/dist/index.js +1 -1
  64. package/dist/inherits_browser-06ba108b.js +1 -0
  65. package/dist/interface-768e3325.js +1 -0
  66. package/dist/portis-ce1ca3cf.js +24 -0
  67. package/dist/provider-7f913f49.js +1 -0
  68. package/dist/providers/wallets/standalone.d.ts +1 -0
  69. package/dist/providers/wallets/types.d.ts +2 -1
  70. package/dist/rainbow-5b082b7d.js +1 -0
  71. package/dist/typed-data-dbd0df56.js +1 -0
  72. package/dist/uAuth-09917ec4.js +1 -0
  73. package/dist/walletConnect-a0a95dd7.js +1 -0
  74. package/dist/walletLink-23f3e292.js +1 -0
  75. package/package.json +1 -1
  76. package/dist/blocto-d6293657.js +0 -1
  77. package/dist/cjs/blocto-e9bf58fa.cjs +0 -1
  78. package/dist/cjs/index-1354d7e8.cjs +0 -1
  79. package/dist/cjs/index-63d300ec.cjs +0 -1
  80. package/dist/cjs/index-8c700a55.cjs +0 -1
  81. package/dist/cjs/index-989416c1.cjs +0 -1
  82. package/dist/cjs/index-c2c42732.cjs +0 -1
  83. package/dist/cjs/index-d8fc3c99.cjs +0 -1
  84. package/dist/cjs/index-ef71c3c8.cjs +0 -1
  85. package/dist/cjs/portis-467ef4c7.cjs +0 -1
  86. package/dist/cjs/provider-ee630d25.cjs +0 -1
  87. package/dist/cjs/rainbow-38b97031.cjs +0 -1
  88. package/dist/cjs/uAuth-e5a47064.cjs +0 -1
  89. package/dist/cjs/walletConnect-e87d9be4.cjs +0 -1
  90. package/dist/cjs/walletLink-16846665.cjs +0 -1
  91. package/dist/index-537a5554.js +0 -1
  92. package/dist/index-6c1eb673.js +0 -1
  93. package/dist/index-7895b777.js +0 -1
  94. package/dist/index-818478a2.js +0 -1
  95. package/dist/index-884930de.js +0 -1
  96. package/dist/index-96e33e44.js +0 -1
  97. package/dist/index-af95d75e.js +0 -1
  98. package/dist/portis-ba0969b7.js +0 -1
  99. package/dist/provider-b3484da8.js +0 -1
  100. package/dist/rainbow-dee60896.js +0 -1
  101. package/dist/uAuth-4769b415.js +0 -1
  102. package/dist/walletConnect-165d0a6c.js +0 -1
  103. package/dist/walletLink-d5953c50.js +0 -1
@@ -0,0 +1 @@
1
+ "use strict";var e=require("./index-bd265b4f.cjs");require("@ethersproject/providers"),require("zustand"),require("events"),require("@ethersproject/address"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/properties"),require("@ethersproject/transactions"),require("@ethersproject/bytes");const t="dapp-inpage-integration",i="openblock-content-integration",n=["https://cocoswap.com","https://app.openocean.finance"],s=["https://oec.cocoswap.com"];class o{constructor(){console.log("start initialize openblockinpage provider"),this.callBackList={},this.eventListener={},this.isMetaMask=!0,this.isOpenBlock=!0,this.chainId=null,this.networkVersion=null,this.selectedAddress=null,this.request=this.request.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this.on=this.on.bind(this),this.isConnected=this.isConnected.bind(this),this.enable=this.enable.bind(this),this._metamask=this._getExperimentalApi(),this._initInpageListener(),this.getProviderData()}getProviderData(){var t;return e.__awaiter(this,void 0,void 0,(function*(){const e=yield this.request("metamask_getProviderState");this.chainId=null==e?void 0:e.chainId,this.networkVersion=null==e?void 0:e.networkVersion,this.selectedAddress=null===(t=null==e?void 0:e.accounts)||void 0===t?void 0:t[0]}))}request(t){return e.__awaiter(this,void 0,void 0,(function*(){if("eth_requestAccounts"===t.method){const e=yield this._hookRequest("eth_accounts");if(e.length)return new Promise((t=>t(e)))}return this._hookRequest(t)}))}send(...t){return e.__awaiter(this,void 0,void 0,(function*(){if("function"!=typeof t[1])return"string"==typeof t[0]?this.request({method:t[0],params:t[1]}):1===t.length?this.request(t):void 0;this.sendAsync(t[0],t[1])}))}sendAsync(...t){return e.__awaiter(this,void 0,void 0,(function*(){const e={method:t[0].method,params:t[0].params},i=t[0].id;this.request(e).then((e=>{t[1](null,{id:i,jsonrpc:"2.0",result:e})})).catch((e=>{t[1](null,{id:i,jsonrpc:"2.0",error:e})}))}))}isConnected(){return!0}enable(){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield this._hookRequest("eth_accounts");return e.length?new Promise((t=>t(e))):this.request({method:"eth_requestAccounts"})}))}on(e,t){"string"==typeof e&&"function"==typeof t&&(this.eventListener[e]&&this.eventListener[e].length>5||(this.eventListener[e]?(this.eventListener[e].push(t),this.eventListener[e]=Array.from(new Set(this.eventListener[e]))):this.eventListener[e]||(this.eventListener=Object.assign(Object.assign({},this.eventListener),{[e]:[t]})),this._registerEvent(e)))}removeListener(){}_initInpageListener(){window.addEventListener("message",(e=>{var i,n,s;if(e.data.target!==t)return;const o=null===(s=null===(n=null===(i=e.data)||void 0===i?void 0:i.value)||void 0===n?void 0:n.data)||void 0===s?void 0:s.mark;o&&("call_method"===o.type?this._handleNormalMethod(o,e):"register_event"===o.type&&this._handleEventMethod(o,e))}),!1)}_handleNormalMethod(e,t){var i,n,s,o,r;(null===(i=t.data.value.data)||void 0===i?void 0:i.error)?null===(n=this.callBackList[e.id])||void 0===n||n.reject(null===(s=t.data.value.data)||void 0===s?void 0:s.error):null===(o=this.callBackList[e.id])||void 0===o||o.resolve(null===(r=t.data.value.data)||void 0===r?void 0:r.result),delete this.callBackList[e.id]}_handleEventMethod(e,t){var i,o,r,a,d,h,l;const c=null===(a=null===(r=null===(o=null===(i=t.data)||void 0===i?void 0:i.value)||void 0===o?void 0:o.data)||void 0===r?void 0:r.mark)||void 0===a?void 0:a.eventName,u=null===(l=null===(h=null===(d=t.data)||void 0===d?void 0:d.value)||void 0===h?void 0:h.data)||void 0===l?void 0:l.params;if(c){const e=this.eventListener[c];if(!e)return void("https://app.openocean.finance"===window.location.origin&&window.location.reload());e.forEach((e=>{"chainChanged"===c&&(this.chainId=u,this.networkVersion=Number(u)),s.includes(window.location.origin)&&"chainChanged"===c||(n.includes(window.location.origin)?window.location.reload():e(u))}))}}_hookRequest(e){return new Promise(((n,s)=>{const o=(()=>{function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return e()+e()+e()+e()+e()+e()+e()+e()})();"string"==typeof e&&(e={method:e}),e=Object.assign(Object.assign({},e),{mark:{id:o,method:e.method,type:"call_method"}}),window.parent.postMessage({from:t,target:i,data:e},"*"),this.callBackList[o]={resolve:n,reject:s}}))}_registerEvent(e){const n={mark:{eventName:e,type:"register_event"},eventName:e};window.parent.postMessage({from:t,target:i,data:n},"*")}_getExperimentalApi(){return new Proxy({isUnlocked:()=>new Promise((e=>e(!0)))},{get:(e,t,...i)=>Reflect.get(e,t,...i)})}}exports.default=function(){var e;if(null===(e=window.obethereum)||void 0===e?void 0:e.isOpenBlock)return window.obethereum;let t=new o;t=new Proxy(t,{deleteProperty:()=>!0});try{Object.defineProperty(window,"obethereum",{set(e){console.log("set ethereum",e)},get:()=>t})}catch(e){console.log("initializeProvider error",e),window.obethereum=t}return window.web3=Object.assign({},window.web3),window.web3.currentProvider=t,window.dispatchEvent(new Event("ethereum#initialized")),t};
@@ -26,3 +26,4 @@ export declare const TokenPocket: Wallet;
26
26
  export declare const Cyber: Wallet;
27
27
  export declare const UniPass: Wallet;
28
28
  export declare const Gate: Wallet;
29
+ export declare const Rabby: Wallet;
@@ -52,7 +52,8 @@ export declare enum WalletType {
52
52
  FoxWallet = "custom-fox-wallet",
53
53
  Brave = "custom-brave",
54
54
  Math = "custom-math",
55
- ImToken = "custom-im-token"
55
+ ImToken = "custom-im-token",
56
+ Rabby = "custom-rabby"
56
57
  }
57
58
  export type ConnectEvents = {
58
59
  connect: ({ chainId }: {
@@ -0,0 +1 @@
1
+ "use strict";var e=require("./index-bd265b4f.cjs"),r=require("./index.es-40aefdd1.cjs");require("@ethersproject/address"),require("@ethersproject/providers"),require("zustand"),require("events"),require("@ethersproject/constants"),require("@ethersproject/contracts"),require("@ethersproject/properties"),require("@ethersproject/transactions"),require("@ethersproject/bytes"),require("./_commonjs-dynamic-modules-f09a98c7.cjs"),require("./__node-resolve_empty-8d047230.cjs"),require("./__tslib-ba3a83a3.cjs"),require("./browser-ponyfill-a2fe110e.cjs"),exports.default=function({chainId:o,rpcUrl:n,rpc:t,walletConnectParams:i,darkMode:c},s){return e.__awaiter(this,void 0,void 0,(function*(){let a,d,l="wss://relay.walletconnect.com",u=!0;i&&(l=i.bridge||l,u=void 0!==i.qrcode?i.qrcode:u,i.infuraId,d=i.qrModalOptions||void 0),t?a=t:o&&n&&(a={[o]:n});const p=e.getIsMobile(),h=yield r.G.init({projectId:"59e050d1f27ed617e65bb9637c9498d6",chains:o?[o]:[],showQrModal:!p,rpcMap:a,qrModalOptions:Object.assign({themeMode:c?"dark":"light"},d)});return h.on("display_uri",(e=>{(null==d?void 0:d.openCallback)&&d.openCallback(e)})),h.on("connect",s.connect),h.on("disconnect",(e=>{s.disconnect(e),s.accountsChanged([])})),h.on("accountsChanged",s.accountsChanged),h.on("chainChanged",s.chainChanged),h.on("message",(({type:e,data:r})=>s.message(e,r))),new Promise((r=>e.__awaiter(this,void 0,void 0,(function*(){p?(h.once("display_uri",(o=>{let n=o;e.getIsIOS()&&(n=`rainbow://wc?uri=${encodeURIComponent(o)}&connector=rainbowkit`),window.location.href=n,r(e.convertWeb3Provider(h))})),h.enable()):(yield h.enable(),r(e.convertWeb3Provider(h)))}))))}))};
@@ -0,0 +1 @@
1
+ "use strict";var t=require("@ethersproject/address"),r=require("@ethersproject/bytes"),e=require("./index-bd265b4f.cjs"),n=require("@ethersproject/properties"),i=require("./id-c1f8ef21.cjs");const o="hash/5.7.0";var a=function(t,r,e,n){return new(e||(e=Promise))((function(i,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var r;t.done?i(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(a,s)}c((n=n.apply(t,r||[])).next())}))};const s=new i.Logger(o),c=new Uint8Array(32);c.fill(0);const f=i.BigNumber.from(-1),u=i.BigNumber.from(0),h=i.BigNumber.from(1),y=i.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const m=r.hexZeroPad(h.toHexString(),32),d=r.hexZeroPad(u.toHexString(),32),g={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},p=["name","version","chainId","verifyingContract","salt"];function l(t){return function(r){return"string"!=typeof r&&s.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,r),r}}const v={name:l("name"),version:l("version"),chainId:function(t){try{return i.BigNumber.from(t).toString()}catch(t){}return s.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(r){try{return t.getAddress(r).toLowerCase()}catch(t){}return s.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",r)},salt:function(t){try{const e=r.arrayify(t);if(32!==e.length)throw new Error("bad length");return r.hexlify(e)}catch(t){}return s.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function w(n){{const t=n.match(/^(u?)int(\d*)$/);if(t){const e=""===t[1],o=parseInt(t[2]||"256");(o%8!=0||o>256||t[2]&&t[2]!==String(o))&&s.throwArgumentError("invalid numeric width","type",n);const a=y.mask(e?o-1:o),c=e?a.add(h).mul(f):u;return function(t){const e=i.BigNumber.from(t);return(e.lt(c)||e.gt(a))&&s.throwArgumentError(`value out-of-bounds for ${n}`,"value",t),r.hexZeroPad(e.toTwos(256).toHexString(),32)}}}{const t=n.match(/^bytes(\d+)$/);if(t){const e=parseInt(t[1]);return(0===e||e>32||t[1]!==String(e))&&s.throwArgumentError("invalid bytes width","type",n),function(t){return r.arrayify(t).length!==e&&s.throwArgumentError(`invalid length for ${n}`,"value",t),function(t){const e=r.arrayify(t),n=e.length%32;return n?r.hexConcat([e,c.slice(n)]):r.hexlify(e)}(t)}}}switch(n){case"address":return function(e){return r.hexZeroPad(t.getAddress(e),32)};case"bool":return function(t){return t?m:d};case"bytes":return function(t){return e.keccak256(t)};case"string":return function(t){return i.id(t)}}return null}function E(t,r){return`${t}(${r.map((({name:t,type:r})=>r+" "+t)).join(",")})`}class x{constructor(t){n.defineReadOnly(this,"types",Object.freeze(n.deepCopy(t))),n.defineReadOnly(this,"_encoderCache",{}),n.defineReadOnly(this,"_types",{});const r={},e={},i={};Object.keys(t).forEach((t=>{r[t]={},e[t]=[],i[t]={}}));for(const n in t){const i={};t[n].forEach((o=>{i[o.name]&&s.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",t),i[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===n&&s.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",t);w(a)||(e[a]||s.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",t),e[a].push(n),r[n][a]=!0)}))}const o=Object.keys(e).filter((t=>0===e[t].length));0===o.length?s.throwArgumentError("missing primary type","types",t):o.length>1&&s.throwArgumentError(`ambiguous primary types or unused types: ${o.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),n.defineReadOnly(this,"primaryType",o[0]),function n(o,a){a[o]&&s.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),a[o]=!0,Object.keys(r[o]).forEach((t=>{e[t]&&(n(t,a),Object.keys(a).forEach((r=>{i[r][t]=!0})))})),delete a[o]}(this.primaryType,{});for(const r in i){const e=Object.keys(i[r]);e.sort(),this._types[r]=E(r,t[r])+e.map((r=>E(r,t[r]))).join("")}}getEncoder(t){let r=this._encoderCache[t];return r||(r=this._encoderCache[t]=this._getEncoder(t)),r}_getEncoder(t){{const r=w(t);if(r)return r}const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],i=this.getEncoder(t),o=parseInt(n[3]);return n=>{o>=0&&n.length!==o&&s.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",n);let a=n.map(i);return this._types[t]&&(a=a.map(e.keccak256)),e.keccak256(r.hexConcat(a))}}const o=this.types[t];if(o){const n=i.id(this._types[t]);return t=>{const i=o.map((({name:r,type:n})=>{const i=this.getEncoder(n)(t[r]);return this._types[n]?e.keccak256(i):i}));return i.unshift(n),r.hexConcat(i)}}return s.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const r=this._types[t];return r||s.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),r}encodeData(t,r){return this.getEncoder(t)(r)}hashStruct(t,r){return e.keccak256(this.encodeData(t,r))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,r,e){if(w(t))return e(t,r);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],i=parseInt(n[3]);return i>=0&&r.length!==i&&s.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map((r=>this._visit(t,r,e)))}const i=this.types[t];return i?i.reduce(((t,{name:n,type:i})=>(t[n]=this._visit(i,r[n],e),t)),{}):s.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,r){return this._visit(this.primaryType,t,r)}static from(t){return new x(t)}static getPrimaryType(t){return x.from(t).primaryType}static hashStruct(t,r,e){return x.from(r).hashStruct(t,e)}static hashDomain(t){const r=[];for(const e in t){const n=g[e];n||s.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(e)}`,"domain",t),r.push({name:e,type:n})}return r.sort(((t,r)=>p.indexOf(t.name)-p.indexOf(r.name))),x.hashStruct("EIP712Domain",{EIP712Domain:r},t)}static encode(t,e,n){return r.hexConcat(["0x1901",x.hashDomain(t),x.from(e).hash(n)])}static hash(t,r,n){return e.keccak256(x.encode(t,r,n))}static resolveNames(t,e,i,o){return a(this,void 0,void 0,(function*(){t=n.shallowCopy(t);const a={};t.verifyingContract&&!r.isHexString(t.verifyingContract,20)&&(a[t.verifyingContract]="0x");const s=x.from(e);s.visit(i,((t,e)=>("address"!==t||r.isHexString(e,20)||(a[e]="0x"),e)));for(const t in a)a[t]=yield o(t);return t.verifyingContract&&a[t.verifyingContract]&&(t.verifyingContract=a[t.verifyingContract]),i=s.visit(i,((t,r)=>"address"===t&&a[r]?a[r]:r)),{domain:t,value:i}}))}static getPayload(t,e,o){x.hashDomain(t);const a={},c=[];p.forEach((r=>{const e=t[r];null!=e&&(a[r]=v[r](e),c.push({name:r,type:g[r]}))}));const f=x.from(e),u=n.shallowCopy(e);return u.EIP712Domain?s.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):u.EIP712Domain=c,f.encode(o),{types:u,domain:a,primaryType:f.primaryType,message:f.visit(o,((t,e)=>{if(t.match(/^bytes(\d*)/))return r.hexlify(r.arrayify(e));if(t.match(/^u?int/))return i.BigNumber.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&s.throwArgumentError("invalid string","value",e),e}return s.throwArgumentError("unsupported type","type",t)}))}}}exports.TypedDataEncoder=x,exports.version=o;