@dodoex/wallet-web3 0.3.1 → 0.3.3

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 (69) hide show
  1. package/dist/{alchemy-provider-5870b6fa-01b7ba47.js → alchemy-provider-5870b6fa-6e276e1b.js} +1 -1
  2. package/dist/{alchemy-websocket-provider-213da986-c60d1dfa.js → alchemy-websocket-provider-213da986-bb6a57e6.js} +1 -1
  3. package/dist/{blocto-974aa061.js → blocto-d21cfb95.js} +1 -1
  4. package/dist/{ccip-a200a1fb.js → ccip-8431aba4.js} +1 -1
  5. package/dist/cjs/{alchemy-provider-5870b6fa-5d8beb75.cjs → alchemy-provider-5870b6fa-a4a9827b.cjs} +1 -1
  6. package/dist/cjs/{alchemy-websocket-provider-213da986-9374e5d6.cjs → alchemy-websocket-provider-213da986-de8016ab.cjs} +1 -1
  7. package/dist/cjs/{blocto-f026ba87.cjs → blocto-e7c05f55.cjs} +1 -1
  8. package/dist/cjs/{ccip-e1dddc6a.cjs → ccip-03b96ac0.cjs} +1 -1
  9. package/dist/cjs/core/index.d.ts +1 -1
  10. package/dist/cjs/{draggabilly-4aabe5f2.cjs → draggabilly-e6ba61be.cjs} +1 -1
  11. package/dist/cjs/id-977d274a.cjs +1 -0
  12. package/dist/cjs/{index-ca825060.cjs → index-147e455b.cjs} +1 -1
  13. package/dist/cjs/{index-39c74c76.cjs → index-17949bd2.cjs} +3 -3
  14. package/dist/cjs/{index-c55c197a.cjs → index-2b0f2dc3.cjs} +1 -1
  15. package/dist/cjs/{index-b34c47fa.cjs → index-46e66f67.cjs} +1 -1
  16. package/dist/cjs/{index-9c8d5559.cjs → index-690eebc7.cjs} +1 -1
  17. package/dist/cjs/{index-ee6766f4.cjs → index-7fa2d3b6.cjs} +1 -1
  18. package/dist/cjs/{index-cc41eb61.cjs → index-ac826265.cjs} +1 -1
  19. package/dist/cjs/{index-deacda68.cjs → index-acaec64d.cjs} +4 -4
  20. package/dist/cjs/{index-04367381.cjs → index-df573b7a.cjs} +1 -1
  21. package/dist/cjs/{index-94ef6acf.cjs → index-ff2bf30e.cjs} +1 -1
  22. package/dist/cjs/index.cjs +1 -1
  23. package/dist/cjs/{index.es-130f278b.cjs → index.es-df679ebf.cjs} +1 -1
  24. package/dist/cjs/{interface-1e467de9.cjs → interface-8cc0a528.cjs} +1 -1
  25. package/dist/cjs/lib-typedarrays-f16e2014.cjs +1 -0
  26. package/dist/cjs/{portis-621ac4db.cjs → portis-8128f750.cjs} +1 -1
  27. package/dist/cjs/{provider-cf054be5.cjs → provider-02ef17ce.cjs} +1 -1
  28. package/dist/cjs/{rainbow-2719e661.cjs → rainbow-d40d1a7f.cjs} +1 -1
  29. package/dist/cjs/sha224-25dc0525.cjs +1 -0
  30. package/dist/cjs/{sha256-f79d28af.cjs → sha256-b078a56f.cjs} +1 -1
  31. package/dist/cjs/{typed-data-7b51425e.cjs → typed-data-29e9ba41.cjs} +1 -1
  32. package/dist/cjs/uAuth-a3baeb1d.cjs +1 -0
  33. package/dist/cjs/{walletConnect-3597e222.cjs → walletConnect-19922064.cjs} +1 -1
  34. package/dist/cjs/{walletLink-7e596fd5.cjs → walletLink-65ca3891.cjs} +2 -2
  35. package/dist/core/index.d.ts +1 -1
  36. package/dist/{draggabilly-766a4455.js → draggabilly-13c91f3b.js} +1 -1
  37. package/dist/id-5204a899.js +1 -0
  38. package/dist/{index-a7364b6f.js → index-187032eb.js} +1 -1
  39. package/dist/{index-9a258d40.js → index-5866f671.js} +1 -1
  40. package/dist/{index-ddfee2fc.js → index-9607e7e6.js} +1 -1
  41. package/dist/{index-19c32690.js → index-983baf38.js} +4 -4
  42. package/dist/{index-5fddc184.js → index-b3c8d59e.js} +1 -1
  43. package/dist/{index-f994e683.js → index-bffd59f1.js} +1 -1
  44. package/dist/{index-3ce36b58.js → index-c8294cc6.js} +1 -1
  45. package/dist/{index-85dd2c8f.js → index-cf57880c.js} +3 -3
  46. package/dist/{index-891df3a4.js → index-d3046dad.js} +1 -1
  47. package/dist/{index-fe0a97a4.js → index-db13a7de.js} +1 -1
  48. package/dist/{index.es-6a198a68.js → index.es-0e287156.js} +1 -1
  49. package/dist/index.js +1 -1
  50. package/dist/{interface-ab9f0709.js → interface-adba737d.js} +1 -1
  51. package/dist/lib-typedarrays-78951703.js +1 -0
  52. package/dist/{portis-1dafd7e2.js → portis-aceac8e3.js} +1 -1
  53. package/dist/{provider-c03e393e.js → provider-0e2c1ad2.js} +1 -1
  54. package/dist/{rainbow-3ed61f48.js → rainbow-04918203.js} +1 -1
  55. package/dist/sha224-1a3c9027.js +1 -0
  56. package/dist/{sha256-dac8f0fb.js → sha256-53b92407.js} +1 -1
  57. package/dist/{typed-data-251d6ac6.js → typed-data-c4dc667a.js} +1 -1
  58. package/dist/uAuth-3e20de1b.js +1 -0
  59. package/dist/{walletConnect-100fdbbc.js → walletConnect-c6a32587.js} +1 -1
  60. package/dist/{walletLink-55c4685f.js → walletLink-30b4e762.js} +2 -2
  61. package/package.json +1 -1
  62. package/dist/cjs/id-428ecd58.cjs +0 -1
  63. package/dist/cjs/lib-typedarrays-97cd7d30.cjs +0 -1
  64. package/dist/cjs/sha224-f7cb1e2c.cjs +0 -1
  65. package/dist/cjs/uAuth-0356e32c.cjs +0 -1
  66. package/dist/id-15d1d8d2.js +0 -1
  67. package/dist/lib-typedarrays-f6713bff.js +0 -1
  68. package/dist/sha224-dc2d600e.js +0 -1
  69. package/dist/uAuth-66f4e9ca.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a1 as e,a2 as n,a3 as t,a4 as r,a5 as o,a6 as i,a7 as s,Q as a,a8 as c,a9 as l,aa as u,ab as d,ac as h,ad as f,ae as p,af as m,ag as w,ah as y,ai as g,aj as b,ak as v,al as k,am as E,an as C,ao as S,ap as O,aq as A,ar as x,as as R,at as I,au as _,av as N,aw as T,ax as M,ay as P,az as j,aA as B,aB as D,_ as W,A as L}from"./index-19c32690.js";export{ax as isInBinance}from"./index-19c32690.js";import*as F from"react";import z,{createContext as U,useState as H,useEffect as q,useCallback as V,useContext as Q}from"react";import J from"react-dom";import{I as G}from"./interface-ab9f0709.js";import"@ethersproject/address";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"@ethersproject/properties";import"@ethersproject/abstract-signer";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"events";import"@ethersproject/constants";import"@ethersproject/transactions";import"./id-15d1d8d2.js";function K(e,n,t,r,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void t(e)}a.done?n(c):Promise.resolve(c).then(r,o)}function Y(e){return function(){var n=this,t=arguments;return new Promise((function(r,o){var i=e.apply(n,t);function s(e){K(i,r,o,s,a,"next",e)}function a(e){K(i,r,o,s,a,"throw",e)}s(void 0)}))}}function Z(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function $(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function X(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){$(e,n,t[n])}))}return e}function ee(e,n){return n=null!=n?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):function(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})),e}function ne(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function te(e,n){var t,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(n){return c([e,n])}}function c(i){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=n.call(e,s)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}var re,oe=Object.defineProperty,ie=function(e,n,t){return function(e,n,t){n in e?oe(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t}(e,"symbol"!=(void 0===n?"undefined":ne(n))?n+"":n,t),t},se={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},ae=function(){function c(t){if(function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,c),this.url=t,ie(this,"events",new e),ie(this,"isAvailable",!1),ie(this,"registering",!1),!n(t))throw new Error("Provided URL is not compatible with HTTP connection: ".concat(t));this.url=t}return function(e,n,t){n&&Z(e.prototype,n),t&&Z(e,t)}(c,[{key:"connected",get:function(){return this.isAvailable}},{key:"connecting",get:function(){return this.registering}},{key:"open",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.url,n=this;return Y((function(){return te(this,(function(t){switch(t.label){case 0:return[4,n.register(e)];case 1:return t.sent(),[2]}}))}))()}},{key:"close",value:function(){var e=this;return Y((function(){return te(this,(function(n){if(!e.isAvailable)throw new Error("Connection already closed");return e.onClose(),[2]}))}))()}},{key:"request",value:function(e){var n=this;return Y((function(){var t,r,c,l;return te(this,(function(u){switch(u.label){case 0:return i.debug("HttpClient ~ request ~ payload:",e),n.isAvailable?[3,2]:[4,n.register()];case 1:u.sent(),u.label=2;case 2:u.label=3;case 3:return u.trys.push([3,6,,7]),t=s(e),[4,a(n.url,ee(X({},se),{body:t}))];case 4:return[4,u.sent().json()];case 5:return r=u.sent(),c="string"==typeof r?o(r):r,[2,(i.debug("HttpClient ~ request ~ result:",c),c)];case 6:return l=u.sent(),[2,n.formatError(e.id,l)];case 7:return[2]}}))}))()}},{key:"formatError",value:function(e,n){var r=this.parseError(n),o=r.message||r.toString();return t(e,o)}},{key:"register",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.url,t=this;return Y((function(){var r,o,i;return te(this,(function(c){switch(c.label){case 0:if(!n(e))throw new Error("Provided URL is not compatible with HTTP connection: ".concat(e));if(t.registering)return[2,new Promise((function(e,n){t.events.once("register_error",(function(e){n(e)})),t.events.once("open",(function(){if(ne(t.isAvailable)>"u")return n(new Error("HTTP connection is missing or invalid"));e()}))}))];t.url=e,t.registering=!0,c.label=1;case 1:return c.trys.push([1,3,,4]),r=s({id:1,jsonrpc:"2.0",method:"test",params:[]}),[4,a(e,ee(X({},se),{body:r}))];case 2:return c.sent(),t.onOpen(),[3,4];case 3:throw o=c.sent(),i=t.parseError(o),t.events.emit("register_error",i),t.onClose(),i;case 4:return[2]}}))}))()}},{key:"onOpen",value:function(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}},{key:"onClose",value:function(){this.isAvailable=!1,this.registering=!1,this.events.emit("open")}},{key:"parseError",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.url;return r(e,n,"HTTP")}}]),c}(),ce=J;if("production"===process.env.NODE_ENV)re=ce.createRoot,ce.hydrateRoot;else{var le=ce.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;re=function(e,n){le.usingClientEntryPoint=!0;try{return ce.createRoot(e,n)}finally{le.usingClientEntryPoint=!1}}}var ue,de,he=Object.defineProperty,fe=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable,we=(e,n,t)=>n in e?he(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,ye=(e,n)=>{for(var t in n||(n={}))pe.call(n,t)&&we(e,t,n[t]);if(fe)for(var t of fe(n))me.call(n,t)&&we(e,t,n[t]);return e},ge=(e,n)=>{var t={};for(var r in e)pe.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&fe)for(var r of fe(e))n.indexOf(r)<0&&me.call(e,r)&&(t[r]=e[r]);return t};(e=>{const n=class{constructor(e,t,r,o){if(this.version=e,this.errorCorrectionLevel=t,this.modules=[],this.isFunction=[],e<n.MIN_VERSION||e>n.MAX_VERSION)throw new RangeError("Version value out of range");if(o<-1||o>7)throw new RangeError("Mask value out of range");this.size=4*e+17;let s=[];for(let e=0;e<this.size;e++)s.push(!1);for(let e=0;e<this.size;e++)this.modules.push(s.slice()),this.isFunction.push(s.slice());this.drawFunctionPatterns();const a=this.addEccAndInterleave(r);if(this.drawCodewords(a),-1==o){let e=1e9;for(let n=0;n<8;n++){this.applyMask(n),this.drawFormatBits(n);const t=this.getPenaltyScore();t<e&&(o=n,e=t),this.applyMask(n)}}i(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[]}static encodeText(t,r){const o=e.QrSegment.makeSegments(t);return n.encodeSegments(o,r)}static encodeBinary(t,r){const o=e.QrSegment.makeBytes(t);return n.encodeSegments([o],r)}static encodeSegments(e,t,o=1,s=40,c=-1,l=!0){if(!(n.MIN_VERSION<=o&&o<=s&&s<=n.MAX_VERSION)||c<-1||c>7)throw new RangeError("Invalid value");let u,d;for(u=o;;u++){const r=8*n.getNumDataCodewords(u,t),o=a.getTotalBits(e,u);if(o<=r){d=o;break}if(u>=s)throw new RangeError("Data too long")}for(const e of[n.Ecc.MEDIUM,n.Ecc.QUARTILE,n.Ecc.HIGH])l&&d<=8*n.getNumDataCodewords(u,e)&&(t=e);let h=[];for(const n of e){r(n.mode.modeBits,4,h),r(n.numChars,n.mode.numCharCountBits(u),h);for(const e of n.getData())h.push(e)}i(h.length==d);const f=8*n.getNumDataCodewords(u,t);i(h.length<=f),r(0,Math.min(4,f-h.length),h),r(0,(8-h.length%8)%8,h),i(h.length%8==0);for(let e=236;h.length<f;e^=253)r(e,8,h);let p=[];for(;8*p.length<h.length;)p.push(0);return h.forEach(((e,n)=>p[n>>>3]|=e<<7-(7&n))),new n(u,t,p,c)}getModule(e,n){return 0<=e&&e<this.size&&0<=n&&n<this.size&&this.modules[n][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const e=this.getAlignmentPatternPositions(),n=e.length;for(let t=0;t<n;t++)for(let r=0;r<n;r++)0==t&&0==r||0==t&&r==n-1||t==n-1&&0==r||this.drawAlignmentPattern(e[t],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const n=this.errorCorrectionLevel.formatBits<<3|e;let t=n;for(let e=0;e<10;e++)t=t<<1^1335*(t>>>9);const r=21522^(n<<10|t);i(r>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,o(r,e));this.setFunctionModule(8,7,o(r,6)),this.setFunctionModule(8,8,o(r,7)),this.setFunctionModule(7,8,o(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,o(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,o(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,o(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let n=0;n<12;n++)e=e<<1^7973*(e>>>11);const n=this.version<<12|e;i(n>>>18==0);for(let e=0;e<18;e++){const t=o(n,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,t),this.setFunctionModule(i,r,t)}}drawFinderPattern(e,n){for(let t=-4;t<=4;t++)for(let r=-4;r<=4;r++){const o=Math.max(Math.abs(r),Math.abs(t)),i=e+r,s=n+t;0<=i&&i<this.size&&0<=s&&s<this.size&&this.setFunctionModule(i,s,2!=o&&4!=o)}}drawAlignmentPattern(e,n){for(let t=-2;t<=2;t++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,n+t,1!=Math.max(Math.abs(r),Math.abs(t)))}setFunctionModule(e,n,t){this.modules[n][e]=t,this.isFunction[n][e]=!0}addEccAndInterleave(e){const t=this.version,r=this.errorCorrectionLevel;if(e.length!=n.getNumDataCodewords(t,r))throw new RangeError("Invalid argument");const o=n.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][t],s=n.ECC_CODEWORDS_PER_BLOCK[r.ordinal][t],a=Math.floor(n.getNumRawDataModules(t)/8),c=o-a%o,l=Math.floor(a/o);let u=[];const d=n.reedSolomonComputeDivisor(s);for(let t=0,r=0;t<o;t++){let o=e.slice(r,r+l-s+(t<c?0:1));r+=o.length;const i=n.reedSolomonComputeRemainder(o,d);t<c&&o.push(0),u.push(o.concat(i))}let h=[];for(let e=0;e<u[0].length;e++)u.forEach(((n,t)=>{(e!=l-s||t>=c)&&h.push(n[e])}));return i(h.length==a),h}drawCodewords(e){if(e.length!=Math.floor(n.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let t=0;for(let n=this.size-1;n>=1;n-=2){6==n&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){const s=n-i,a=0==(n+1&2)?this.size-1-r:r;!this.isFunction[a][s]&&t<8*e.length&&(this.modules[a][s]=o(e[t>>>3],7-(7&t)),t++)}}i(t==8*e.length)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let n=0;n<this.size;n++)for(let t=0;t<this.size;t++){let r;switch(e){case 0:r=(t+n)%2==0;break;case 1:r=n%2==0;break;case 2:r=t%3==0;break;case 3:r=(t+n)%3==0;break;case 4:r=(Math.floor(t/3)+Math.floor(n/2))%2==0;break;case 5:r=t*n%2+t*n%3==0;break;case 6:r=(t*n%2+t*n%3)%2==0;break;case 7:r=((t+n)%2+t*n%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[n][t]&&r&&(this.modules[n][t]=!this.modules[n][t])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let r=!1,o=0,i=[0,0,0,0,0,0,0];for(let s=0;s<this.size;s++)this.modules[t][s]==r?(o++,5==o?e+=n.PENALTY_N1:o>5&&e++):(this.finderPenaltyAddHistory(o,i),r||(e+=this.finderPenaltyCountPatterns(i)*n.PENALTY_N3),r=this.modules[t][s],o=1);e+=this.finderPenaltyTerminateAndCount(r,o,i)*n.PENALTY_N3}for(let t=0;t<this.size;t++){let r=!1,o=0,i=[0,0,0,0,0,0,0];for(let s=0;s<this.size;s++)this.modules[s][t]==r?(o++,5==o?e+=n.PENALTY_N1:o>5&&e++):(this.finderPenaltyAddHistory(o,i),r||(e+=this.finderPenaltyCountPatterns(i)*n.PENALTY_N3),r=this.modules[s][t],o=1);e+=this.finderPenaltyTerminateAndCount(r,o,i)*n.PENALTY_N3}for(let t=0;t<this.size-1;t++)for(let r=0;r<this.size-1;r++){const o=this.modules[t][r];o==this.modules[t][r+1]&&o==this.modules[t+1][r]&&o==this.modules[t+1][r+1]&&(e+=n.PENALTY_N2)}let t=0;for(const e of this.modules)t=e.reduce(((e,n)=>e+(n?1:0)),t);const r=this.size*this.size,o=Math.ceil(Math.abs(20*t-10*r)/r)-1;return i(0<=o&&o<=9),e+=o*n.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(1==this.version)return[];{const e=Math.floor(this.version/7)+2,n=32==this.version?26:2*Math.ceil((4*this.version+4)/(2*e-2));let t=[6];for(let r=this.size-7;t.length<e;r-=n)t.splice(1,0,r);return t}}static getNumRawDataModules(e){if(e<n.MIN_VERSION||e>n.MAX_VERSION)throw new RangeError("Version number out of range");let t=(16*e+128)*e+64;if(e>=2){const n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return i(208<=t&&t<=29648),t}static getNumDataCodewords(e,t){return Math.floor(n.getNumRawDataModules(e)/8)-n.ECC_CODEWORDS_PER_BLOCK[t.ordinal][e]*n.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let r=1;for(let o=0;o<e;o++){for(let e=0;e<t.length;e++)t[e]=n.reedSolomonMultiply(t[e],r),e+1<t.length&&(t[e]^=t[e+1]);r=n.reedSolomonMultiply(r,2)}return t}static reedSolomonComputeRemainder(e,t){let r=t.map((e=>0));for(const o of e){const e=o^r.shift();r.push(0),t.forEach(((t,o)=>r[o]^=n.reedSolomonMultiply(t,e)))}return r}static reedSolomonMultiply(e,n){if(e>>>8!=0||n>>>8!=0)throw new RangeError("Byte out of range");let t=0;for(let r=7;r>=0;r--)t=t<<1^285*(t>>>7),t^=(n>>>r&1)*e;return i(t>>>8==0),t}finderPenaltyCountPatterns(e){const n=e[1];i(n<=3*this.size);const t=n>0&&e[2]==n&&e[3]==3*n&&e[4]==n&&e[5]==n;return(t&&e[0]>=4*n&&e[6]>=n?1:0)+(t&&e[6]>=4*n&&e[0]>=n?1:0)}finderPenaltyTerminateAndCount(e,n,t){return e&&(this.finderPenaltyAddHistory(n,t),n=0),n+=this.size,this.finderPenaltyAddHistory(n,t),this.finderPenaltyCountPatterns(t)}finderPenaltyAddHistory(e,n){0==n[0]&&(e+=this.size),n.pop(),n.unshift(e)}};let t=n;function r(e,n,t){if(n<0||n>31||e>>>n!=0)throw new RangeError("Value out of range");for(let r=n-1;r>=0;r--)t.push(e>>>r&1)}function o(e,n){return 0!=(e>>>n&1)}function i(e){if(!e)throw new Error("Assertion error")}t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;const s=class{constructor(e,n,t){if(this.mode=e,this.numChars=n,this.bitData=t,n<0)throw new RangeError("Invalid argument");this.bitData=t.slice()}static makeBytes(e){let n=[];for(const t of e)r(t,8,n);return new s(s.Mode.BYTE,e.length,n)}static makeNumeric(e){if(!s.isNumeric(e))throw new RangeError("String contains non-numeric characters");let n=[];for(let t=0;t<e.length;){const o=Math.min(e.length-t,3);r(parseInt(e.substr(t,o),10),3*o+1,n),t+=o}return new s(s.Mode.NUMERIC,e.length,n)}static makeAlphanumeric(e){if(!s.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");let n,t=[];for(n=0;n+2<=e.length;n+=2){let o=45*s.ALPHANUMERIC_CHARSET.indexOf(e.charAt(n));o+=s.ALPHANUMERIC_CHARSET.indexOf(e.charAt(n+1)),r(o,11,t)}return n<e.length&&r(s.ALPHANUMERIC_CHARSET.indexOf(e.charAt(n)),6,t),new s(s.Mode.ALPHANUMERIC,e.length,t)}static makeSegments(e){return""==e?[]:s.isNumeric(e)?[s.makeNumeric(e)]:s.isAlphanumeric(e)?[s.makeAlphanumeric(e)]:[s.makeBytes(s.toUtf8ByteArray(e))]}static makeEci(e){let n=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)r(e,8,n);else if(e<16384)r(2,2,n),r(e,14,n);else{if(!(e<1e6))throw new RangeError("ECI assignment value out of range");r(6,3,n),r(e,21,n)}return new s(s.Mode.ECI,0,n)}static isNumeric(e){return s.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return s.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,n){let t=0;for(const r of e){const e=r.mode.numCharCountBits(n);if(r.numChars>=1<<e)return 1/0;t+=4+e+r.bitData.length}return t}static toUtf8ByteArray(e){e=encodeURI(e);let n=[];for(let t=0;t<e.length;t++)"%"!=e.charAt(t)?n.push(e.charCodeAt(t)):(n.push(parseInt(e.substr(t+1,2),16)),t+=2);return n}};let a=s;a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",e.QrSegment=a})(ue||(ue={})),(e=>{const n=class{constructor(e,n){this.ordinal=e,this.formatBits=n}};let t=n;t.LOW=new n(0,1),t.MEDIUM=new n(1,0),t.QUARTILE=new n(2,3),t.HIGH=new n(3,2),e.Ecc=t})((de=ue||(ue={})).QrCode||(de.QrCode={})),(e=>{(e=>{const n=class{constructor(e,n){this.modeBits=e,this.numBitsCharCount=n}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};let t=n;t.NUMERIC=new n(1,[10,12,14]),t.ALPHANUMERIC=new n(2,[9,11,13]),t.BYTE=new n(4,[8,16,16]),t.KANJI=new n(8,[8,10,12]),t.ECI=new n(7,[0,0,0]),e.Mode=t})(e.QrSegment||(e.QrSegment={}))})(ue||(ue={}));var be=ue,ve={L:be.QrCode.Ecc.LOW,M:be.QrCode.Ecc.MEDIUM,Q:be.QrCode.Ecc.QUARTILE,H:be.QrCode.Ecc.HIGH},ke=128,Ee="L",Ce="#FFFFFF",Se="#000000",Oe=!1,Ae=4,xe=.1;
1
+ import{a1 as e,a2 as n,a3 as t,a4 as r,a5 as o,a6 as i,a7 as s,Q as a,a8 as c,a9 as l,aa as u,ab as d,ac as h,ad as f,ae as p,af as m,ag as w,ah as y,ai as g,aj as b,ak as v,al as k,am as E,an as C,ao as S,ap as O,aq as A,ar as x,as as R,at as I,au as _,av as N,aw as T,ax as M,ay as P,az as j,aA as B,aB as D,_ as W,A as L}from"./index-983baf38.js";export{ax as isInBinance}from"./index-983baf38.js";import*as F from"react";import z,{createContext as U,useState as H,useEffect as q,useCallback as V,useContext as Q}from"react";import J from"react-dom";import{I as G}from"./interface-adba737d.js";import"@ethersproject/address";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"@ethersproject/properties";import"@ethersproject/abstract-signer";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"events";import"@ethersproject/constants";import"@ethersproject/transactions";import"./id-5204a899.js";function K(e,n,t,r,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void t(e)}a.done?n(c):Promise.resolve(c).then(r,o)}function Y(e){return function(){var n=this,t=arguments;return new Promise((function(r,o){var i=e.apply(n,t);function s(e){K(i,r,o,s,a,"next",e)}function a(e){K(i,r,o,s,a,"throw",e)}s(void 0)}))}}function Z(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function $(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function X(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){$(e,n,t[n])}))}return e}function ee(e,n){return n=null!=n?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):function(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})),e}function ne(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function te(e,n){var t,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(n){return c([e,n])}}function c(i){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=n.call(e,s)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}var re,oe=Object.defineProperty,ie=function(e,n,t){return function(e,n,t){n in e?oe(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t}(e,"symbol"!=(void 0===n?"undefined":ne(n))?n+"":n,t),t},se={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},ae=function(){function c(t){if(function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,c),this.url=t,ie(this,"events",new e),ie(this,"isAvailable",!1),ie(this,"registering",!1),!n(t))throw new Error("Provided URL is not compatible with HTTP connection: ".concat(t));this.url=t}return function(e,n,t){n&&Z(e.prototype,n),t&&Z(e,t)}(c,[{key:"connected",get:function(){return this.isAvailable}},{key:"connecting",get:function(){return this.registering}},{key:"open",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.url,n=this;return Y((function(){return te(this,(function(t){switch(t.label){case 0:return[4,n.register(e)];case 1:return t.sent(),[2]}}))}))()}},{key:"close",value:function(){var e=this;return Y((function(){return te(this,(function(n){if(!e.isAvailable)throw new Error("Connection already closed");return e.onClose(),[2]}))}))()}},{key:"request",value:function(e){var n=this;return Y((function(){var t,r,c,l;return te(this,(function(u){switch(u.label){case 0:return i.debug("HttpClient ~ request ~ payload:",e),n.isAvailable?[3,2]:[4,n.register()];case 1:u.sent(),u.label=2;case 2:u.label=3;case 3:return u.trys.push([3,6,,7]),t=s(e),[4,a(n.url,ee(X({},se),{body:t}))];case 4:return[4,u.sent().json()];case 5:return r=u.sent(),c="string"==typeof r?o(r):r,[2,(i.debug("HttpClient ~ request ~ result:",c),c)];case 6:return l=u.sent(),[2,n.formatError(e.id,l)];case 7:return[2]}}))}))()}},{key:"formatError",value:function(e,n){var r=this.parseError(n),o=r.message||r.toString();return t(e,o)}},{key:"register",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.url,t=this;return Y((function(){var r,o,i;return te(this,(function(c){switch(c.label){case 0:if(!n(e))throw new Error("Provided URL is not compatible with HTTP connection: ".concat(e));if(t.registering)return[2,new Promise((function(e,n){t.events.once("register_error",(function(e){n(e)})),t.events.once("open",(function(){if(ne(t.isAvailable)>"u")return n(new Error("HTTP connection is missing or invalid"));e()}))}))];t.url=e,t.registering=!0,c.label=1;case 1:return c.trys.push([1,3,,4]),r=s({id:1,jsonrpc:"2.0",method:"test",params:[]}),[4,a(e,ee(X({},se),{body:r}))];case 2:return c.sent(),t.onOpen(),[3,4];case 3:throw o=c.sent(),i=t.parseError(o),t.events.emit("register_error",i),t.onClose(),i;case 4:return[2]}}))}))()}},{key:"onOpen",value:function(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}},{key:"onClose",value:function(){this.isAvailable=!1,this.registering=!1,this.events.emit("open")}},{key:"parseError",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.url;return r(e,n,"HTTP")}}]),c}(),ce=J;if("production"===process.env.NODE_ENV)re=ce.createRoot,ce.hydrateRoot;else{var le=ce.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;re=function(e,n){le.usingClientEntryPoint=!0;try{return ce.createRoot(e,n)}finally{le.usingClientEntryPoint=!1}}}var ue,de,he=Object.defineProperty,fe=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable,we=(e,n,t)=>n in e?he(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,ye=(e,n)=>{for(var t in n||(n={}))pe.call(n,t)&&we(e,t,n[t]);if(fe)for(var t of fe(n))me.call(n,t)&&we(e,t,n[t]);return e},ge=(e,n)=>{var t={};for(var r in e)pe.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&fe)for(var r of fe(e))n.indexOf(r)<0&&me.call(e,r)&&(t[r]=e[r]);return t};(e=>{const n=class{constructor(e,t,r,o){if(this.version=e,this.errorCorrectionLevel=t,this.modules=[],this.isFunction=[],e<n.MIN_VERSION||e>n.MAX_VERSION)throw new RangeError("Version value out of range");if(o<-1||o>7)throw new RangeError("Mask value out of range");this.size=4*e+17;let s=[];for(let e=0;e<this.size;e++)s.push(!1);for(let e=0;e<this.size;e++)this.modules.push(s.slice()),this.isFunction.push(s.slice());this.drawFunctionPatterns();const a=this.addEccAndInterleave(r);if(this.drawCodewords(a),-1==o){let e=1e9;for(let n=0;n<8;n++){this.applyMask(n),this.drawFormatBits(n);const t=this.getPenaltyScore();t<e&&(o=n,e=t),this.applyMask(n)}}i(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[]}static encodeText(t,r){const o=e.QrSegment.makeSegments(t);return n.encodeSegments(o,r)}static encodeBinary(t,r){const o=e.QrSegment.makeBytes(t);return n.encodeSegments([o],r)}static encodeSegments(e,t,o=1,s=40,c=-1,l=!0){if(!(n.MIN_VERSION<=o&&o<=s&&s<=n.MAX_VERSION)||c<-1||c>7)throw new RangeError("Invalid value");let u,d;for(u=o;;u++){const r=8*n.getNumDataCodewords(u,t),o=a.getTotalBits(e,u);if(o<=r){d=o;break}if(u>=s)throw new RangeError("Data too long")}for(const e of[n.Ecc.MEDIUM,n.Ecc.QUARTILE,n.Ecc.HIGH])l&&d<=8*n.getNumDataCodewords(u,e)&&(t=e);let h=[];for(const n of e){r(n.mode.modeBits,4,h),r(n.numChars,n.mode.numCharCountBits(u),h);for(const e of n.getData())h.push(e)}i(h.length==d);const f=8*n.getNumDataCodewords(u,t);i(h.length<=f),r(0,Math.min(4,f-h.length),h),r(0,(8-h.length%8)%8,h),i(h.length%8==0);for(let e=236;h.length<f;e^=253)r(e,8,h);let p=[];for(;8*p.length<h.length;)p.push(0);return h.forEach(((e,n)=>p[n>>>3]|=e<<7-(7&n))),new n(u,t,p,c)}getModule(e,n){return 0<=e&&e<this.size&&0<=n&&n<this.size&&this.modules[n][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const e=this.getAlignmentPatternPositions(),n=e.length;for(let t=0;t<n;t++)for(let r=0;r<n;r++)0==t&&0==r||0==t&&r==n-1||t==n-1&&0==r||this.drawAlignmentPattern(e[t],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const n=this.errorCorrectionLevel.formatBits<<3|e;let t=n;for(let e=0;e<10;e++)t=t<<1^1335*(t>>>9);const r=21522^(n<<10|t);i(r>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,o(r,e));this.setFunctionModule(8,7,o(r,6)),this.setFunctionModule(8,8,o(r,7)),this.setFunctionModule(7,8,o(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,o(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,o(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,o(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let n=0;n<12;n++)e=e<<1^7973*(e>>>11);const n=this.version<<12|e;i(n>>>18==0);for(let e=0;e<18;e++){const t=o(n,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,t),this.setFunctionModule(i,r,t)}}drawFinderPattern(e,n){for(let t=-4;t<=4;t++)for(let r=-4;r<=4;r++){const o=Math.max(Math.abs(r),Math.abs(t)),i=e+r,s=n+t;0<=i&&i<this.size&&0<=s&&s<this.size&&this.setFunctionModule(i,s,2!=o&&4!=o)}}drawAlignmentPattern(e,n){for(let t=-2;t<=2;t++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,n+t,1!=Math.max(Math.abs(r),Math.abs(t)))}setFunctionModule(e,n,t){this.modules[n][e]=t,this.isFunction[n][e]=!0}addEccAndInterleave(e){const t=this.version,r=this.errorCorrectionLevel;if(e.length!=n.getNumDataCodewords(t,r))throw new RangeError("Invalid argument");const o=n.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][t],s=n.ECC_CODEWORDS_PER_BLOCK[r.ordinal][t],a=Math.floor(n.getNumRawDataModules(t)/8),c=o-a%o,l=Math.floor(a/o);let u=[];const d=n.reedSolomonComputeDivisor(s);for(let t=0,r=0;t<o;t++){let o=e.slice(r,r+l-s+(t<c?0:1));r+=o.length;const i=n.reedSolomonComputeRemainder(o,d);t<c&&o.push(0),u.push(o.concat(i))}let h=[];for(let e=0;e<u[0].length;e++)u.forEach(((n,t)=>{(e!=l-s||t>=c)&&h.push(n[e])}));return i(h.length==a),h}drawCodewords(e){if(e.length!=Math.floor(n.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let t=0;for(let n=this.size-1;n>=1;n-=2){6==n&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){const s=n-i,a=0==(n+1&2)?this.size-1-r:r;!this.isFunction[a][s]&&t<8*e.length&&(this.modules[a][s]=o(e[t>>>3],7-(7&t)),t++)}}i(t==8*e.length)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let n=0;n<this.size;n++)for(let t=0;t<this.size;t++){let r;switch(e){case 0:r=(t+n)%2==0;break;case 1:r=n%2==0;break;case 2:r=t%3==0;break;case 3:r=(t+n)%3==0;break;case 4:r=(Math.floor(t/3)+Math.floor(n/2))%2==0;break;case 5:r=t*n%2+t*n%3==0;break;case 6:r=(t*n%2+t*n%3)%2==0;break;case 7:r=((t+n)%2+t*n%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[n][t]&&r&&(this.modules[n][t]=!this.modules[n][t])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let r=!1,o=0,i=[0,0,0,0,0,0,0];for(let s=0;s<this.size;s++)this.modules[t][s]==r?(o++,5==o?e+=n.PENALTY_N1:o>5&&e++):(this.finderPenaltyAddHistory(o,i),r||(e+=this.finderPenaltyCountPatterns(i)*n.PENALTY_N3),r=this.modules[t][s],o=1);e+=this.finderPenaltyTerminateAndCount(r,o,i)*n.PENALTY_N3}for(let t=0;t<this.size;t++){let r=!1,o=0,i=[0,0,0,0,0,0,0];for(let s=0;s<this.size;s++)this.modules[s][t]==r?(o++,5==o?e+=n.PENALTY_N1:o>5&&e++):(this.finderPenaltyAddHistory(o,i),r||(e+=this.finderPenaltyCountPatterns(i)*n.PENALTY_N3),r=this.modules[s][t],o=1);e+=this.finderPenaltyTerminateAndCount(r,o,i)*n.PENALTY_N3}for(let t=0;t<this.size-1;t++)for(let r=0;r<this.size-1;r++){const o=this.modules[t][r];o==this.modules[t][r+1]&&o==this.modules[t+1][r]&&o==this.modules[t+1][r+1]&&(e+=n.PENALTY_N2)}let t=0;for(const e of this.modules)t=e.reduce(((e,n)=>e+(n?1:0)),t);const r=this.size*this.size,o=Math.ceil(Math.abs(20*t-10*r)/r)-1;return i(0<=o&&o<=9),e+=o*n.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(1==this.version)return[];{const e=Math.floor(this.version/7)+2,n=32==this.version?26:2*Math.ceil((4*this.version+4)/(2*e-2));let t=[6];for(let r=this.size-7;t.length<e;r-=n)t.splice(1,0,r);return t}}static getNumRawDataModules(e){if(e<n.MIN_VERSION||e>n.MAX_VERSION)throw new RangeError("Version number out of range");let t=(16*e+128)*e+64;if(e>=2){const n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return i(208<=t&&t<=29648),t}static getNumDataCodewords(e,t){return Math.floor(n.getNumRawDataModules(e)/8)-n.ECC_CODEWORDS_PER_BLOCK[t.ordinal][e]*n.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let r=1;for(let o=0;o<e;o++){for(let e=0;e<t.length;e++)t[e]=n.reedSolomonMultiply(t[e],r),e+1<t.length&&(t[e]^=t[e+1]);r=n.reedSolomonMultiply(r,2)}return t}static reedSolomonComputeRemainder(e,t){let r=t.map((e=>0));for(const o of e){const e=o^r.shift();r.push(0),t.forEach(((t,o)=>r[o]^=n.reedSolomonMultiply(t,e)))}return r}static reedSolomonMultiply(e,n){if(e>>>8!=0||n>>>8!=0)throw new RangeError("Byte out of range");let t=0;for(let r=7;r>=0;r--)t=t<<1^285*(t>>>7),t^=(n>>>r&1)*e;return i(t>>>8==0),t}finderPenaltyCountPatterns(e){const n=e[1];i(n<=3*this.size);const t=n>0&&e[2]==n&&e[3]==3*n&&e[4]==n&&e[5]==n;return(t&&e[0]>=4*n&&e[6]>=n?1:0)+(t&&e[6]>=4*n&&e[0]>=n?1:0)}finderPenaltyTerminateAndCount(e,n,t){return e&&(this.finderPenaltyAddHistory(n,t),n=0),n+=this.size,this.finderPenaltyAddHistory(n,t),this.finderPenaltyCountPatterns(t)}finderPenaltyAddHistory(e,n){0==n[0]&&(e+=this.size),n.pop(),n.unshift(e)}};let t=n;function r(e,n,t){if(n<0||n>31||e>>>n!=0)throw new RangeError("Value out of range");for(let r=n-1;r>=0;r--)t.push(e>>>r&1)}function o(e,n){return 0!=(e>>>n&1)}function i(e){if(!e)throw new Error("Assertion error")}t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;const s=class{constructor(e,n,t){if(this.mode=e,this.numChars=n,this.bitData=t,n<0)throw new RangeError("Invalid argument");this.bitData=t.slice()}static makeBytes(e){let n=[];for(const t of e)r(t,8,n);return new s(s.Mode.BYTE,e.length,n)}static makeNumeric(e){if(!s.isNumeric(e))throw new RangeError("String contains non-numeric characters");let n=[];for(let t=0;t<e.length;){const o=Math.min(e.length-t,3);r(parseInt(e.substr(t,o),10),3*o+1,n),t+=o}return new s(s.Mode.NUMERIC,e.length,n)}static makeAlphanumeric(e){if(!s.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");let n,t=[];for(n=0;n+2<=e.length;n+=2){let o=45*s.ALPHANUMERIC_CHARSET.indexOf(e.charAt(n));o+=s.ALPHANUMERIC_CHARSET.indexOf(e.charAt(n+1)),r(o,11,t)}return n<e.length&&r(s.ALPHANUMERIC_CHARSET.indexOf(e.charAt(n)),6,t),new s(s.Mode.ALPHANUMERIC,e.length,t)}static makeSegments(e){return""==e?[]:s.isNumeric(e)?[s.makeNumeric(e)]:s.isAlphanumeric(e)?[s.makeAlphanumeric(e)]:[s.makeBytes(s.toUtf8ByteArray(e))]}static makeEci(e){let n=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)r(e,8,n);else if(e<16384)r(2,2,n),r(e,14,n);else{if(!(e<1e6))throw new RangeError("ECI assignment value out of range");r(6,3,n),r(e,21,n)}return new s(s.Mode.ECI,0,n)}static isNumeric(e){return s.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return s.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,n){let t=0;for(const r of e){const e=r.mode.numCharCountBits(n);if(r.numChars>=1<<e)return 1/0;t+=4+e+r.bitData.length}return t}static toUtf8ByteArray(e){e=encodeURI(e);let n=[];for(let t=0;t<e.length;t++)"%"!=e.charAt(t)?n.push(e.charCodeAt(t)):(n.push(parseInt(e.substr(t+1,2),16)),t+=2);return n}};let a=s;a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",e.QrSegment=a})(ue||(ue={})),(e=>{const n=class{constructor(e,n){this.ordinal=e,this.formatBits=n}};let t=n;t.LOW=new n(0,1),t.MEDIUM=new n(1,0),t.QUARTILE=new n(2,3),t.HIGH=new n(3,2),e.Ecc=t})((de=ue||(ue={})).QrCode||(de.QrCode={})),(e=>{(e=>{const n=class{constructor(e,n){this.modeBits=e,this.numBitsCharCount=n}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};let t=n;t.NUMERIC=new n(1,[10,12,14]),t.ALPHANUMERIC=new n(2,[9,11,13]),t.BYTE=new n(4,[8,16,16]),t.KANJI=new n(8,[8,10,12]),t.ECI=new n(7,[0,0,0]),e.Mode=t})(e.QrSegment||(e.QrSegment={}))})(ue||(ue={}));var be=ue,ve={L:be.QrCode.Ecc.LOW,M:be.QrCode.Ecc.MEDIUM,Q:be.QrCode.Ecc.QUARTILE,H:be.QrCode.Ecc.HIGH},ke=128,Ee="L",Ce="#FFFFFF",Se="#000000",Oe=!1,Ae=4,xe=.1;
2
2
  /**
3
3
  * @license qrcode.react
4
4
  * Copyright (c) Paul O'Shannessy
@@ -1 +1 @@
1
- import{_ as t,D as e,Z as n,$ as r,a0 as o,C as i}from"./index-19c32690.js";import{getAddress as s}from"@ethersproject/address";import{Signer as a}from"@ethersproject/abstract-signer";import{UniPassPopupSDK as d}from"@unipasswallet/popup-sdk";import{defineReadOnly as c}from"@ethersproject/properties";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"events";import"@ethersproject/constants";import"@ethersproject/transactions";class l extends a{constructor(t,e,n,r){super(),this._address=n,this._index=null!=r?r:0,this.provider=t,this.upWallet=e}_legacySignMessage(t){throw new Error("Method not implemented.")}sendUncheckedTransaction(t){throw new Error("Method not implemented.")}unlock(t){throw new Error("Method not implemented.")}getAddress(){return t(this,void 0,void 0,(function*(){return Promise.resolve(s(this._address))}))}signMessage(e){return t(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${e}'`);return yield this.upWallet.signMessage(e,{isEIP191Prefix:!0,onAuthChain:!0})}))}_signTypedData(e,n,r){return t(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}signTransaction(e){return t(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${e.from}'`);return this.upWallet.sendTransaction({from:e.from,to:e.to,value:e.value,data:e.data})}))}sendTransaction(e){return t(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${e.from}'`);return{hash:yield this.upWallet.sendTransaction({from:e.from,to:e.to,value:e.value,data:e.data}),from:e.from}}))}connect(t){return new l(null!=t?t:this.provider,this.upWallet,this._address,this._index)}connectUnchecked(){return new l(this.provider,this.upWallet,this._address,this._index)}}function u(i){var a,u,p;return t(this,void 0,void 0,(function*(){const h=i.JsonRpcProvider||e,v=null!==(a=i.chainId)&&void 0!==a?a:1;let m=null!==(u=i.rpcUrl)&&void 0!==u?u:null===(p=i.rpc)||void 0===p?void 0:p[v];const f=new class extends h{constructor(t,e){super(t,e),this.updateUpWalletConfig=t=>{var e;const o=null===(e=i.rpc)||void 0===e?void 0:e[t];if(!n.includes(t))throw new Error(`chainId ${t} not supported`);if(this.upWallet.updateConfig({chainType:r(t),nodeRPC:o,appSettings:{chain:r(t)}}),"object"==typeof this.network)this.network.chainId=t;else{const e={chainId:t,name:"unknown"};c(this,"_network",e),this.emit("network",e,null)}return this.rpcUrl=o,this.emit("chainChanged",`0x${t.toString(16)}`),{result:!0}},this.rpcUrl=t,this.upWallet=new d({env:o(v),chainType:r(v),appSettings:{appIcon:i.appLogoUrl,appName:i.appName,chain:r(v)},rpcUrl:m,storageType:"sessionStorage"})}getSigner(){var t;const e=this.upWallet.getAccount();return new l(f,this.upWallet,null!==(t=null==e?void 0:e.address)&&void 0!==t?t:"",0)}connect(){return t(this,void 0,void 0,(function*(){const t=this.upWallet.getAccount();return t||(yield this.upWallet.login({email:false}))}))}disconnect(){return t(this,void 0,void 0,(function*(){yield this.upWallet.logout()}))}listAccounts(){return t(this,void 0,void 0,(function*(){const t=this.upWallet.getAccount();return(null==t?void 0:t.address)?[null==t?void 0:t.address]:[]}))}getAddress(){const t=this.upWallet.getAccount();return Promise.resolve((null==t?void 0:t.address)?s(null==t?void 0:t.address):null)}}(m,v);return f}))}function p(e,n){return t(this,void 0,void 0,(function*(){const t=yield u(e);return t.on("connect",n.connect),t.on("disconnect",(t=>{n.disconnect(t),n.accountsChanged([])})),t.on("accountsChanged",n.accountsChanged),t.on("chainChanged",n.chainChanged),t.on("message",(({type:t,data:e})=>n.message(t,e))),yield t.connect(),t}))}function h(){var t;null===(t=i.getState().provider)||void 0===t||t.disconnect()}function v(t){var e,n;return null===(n=null===(e=i.getState().provider)||void 0===e?void 0:e.upWallet)||void 0===n?void 0:n.signTypedData(t)}function m(t){var e;const r=t.addChainParameters.chainId,o="string"==typeof r&&(null==r?void 0:r.startsWith("0x"))?parseInt(r,16):Number(r);if(!n.includes(o))throw new Error(`chainId ${o} not supported`);return null===(e=i.getState().provider)||void 0===e?void 0:e.updateUpWalletConfig(o)}export{u as createProvider,p as default,h as disconnectWallet,v as signTypedData,m as switchChain};
1
+ import{_ as t,D as e,Z as n,$ as r,a0 as o,C as i}from"./index-983baf38.js";import{getAddress as s}from"@ethersproject/address";import{Signer as a}from"@ethersproject/abstract-signer";import{UniPassPopupSDK as d}from"@unipasswallet/popup-sdk";import{defineReadOnly as l}from"@ethersproject/properties";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"events";import"@ethersproject/constants";import"@ethersproject/transactions";class c extends a{constructor(t,e,n,r){super(),this._address=n,this._index=null!=r?r:0,this.provider=t,this.upWallet=e}_legacySignMessage(t){throw new Error("Method not implemented.")}sendUncheckedTransaction(t){throw new Error("Method not implemented.")}unlock(t){throw new Error("Method not implemented.")}getAddress(){return t(this,void 0,void 0,(function*(){return Promise.resolve(s(this._address))}))}signMessage(e){return t(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${e}'`);return yield this.upWallet.signMessage(e,{isEIP191Prefix:!0,onAuthChain:!0})}))}_signTypedData(e,n,r){return t(this,void 0,void 0,(function*(){throw new Error("Method not implemented.")}))}signTransaction(e){return t(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${e.from}'`);return this.upWallet.sendTransaction({from:e.from,to:e.to,value:e.value,data:e.data})}))}sendTransaction(e){return t(this,void 0,void 0,(function*(){if(!this.upWallet)throw new Error(`address unknown '${e.from}'`);return{hash:yield this.upWallet.sendTransaction({from:e.from,to:e.to,value:e.value,data:e.data}),from:e.from}}))}connect(t){return new c(null!=t?t:this.provider,this.upWallet,this._address,this._index)}connectUnchecked(){return new c(this.provider,this.upWallet,this._address,this._index)}}function u(i){var a,u,p;return t(this,void 0,void 0,(function*(){const h=i.JsonRpcProvider||e,v=null!==(a=i.chainId)&&void 0!==a?a:1;let m=null!==(u=i.rpcUrl)&&void 0!==u?u:null===(p=i.rpc)||void 0===p?void 0:p[v];const f=new class extends h{constructor(t,e){super(t,e),this.updateUpWalletConfig=t=>{var e;const o=null===(e=i.rpc)||void 0===e?void 0:e[t];if(!n.includes(t))throw new Error(`chainId ${t} not supported`);if(this.upWallet.updateConfig({chainType:r(t),nodeRPC:o,appSettings:{chain:r(t)}}),"object"==typeof this.network)this.network.chainId=t;else{const e={chainId:t,name:"unknown"};l(this,"_network",e),this.emit("network",e,null)}return this.rpcUrl=o,this.emit("chainChanged",`0x${t.toString(16)}`),{result:!0}},this.rpcUrl=t,this.upWallet=new d({env:o(v),chainType:r(v),appSettings:{appIcon:i.appLogoUrl,appName:i.appName,chain:r(v)},rpcUrl:m,storageType:"sessionStorage"})}getSigner(){var t;const e=this.upWallet.getAccount();return new c(f,this.upWallet,null!==(t=null==e?void 0:e.address)&&void 0!==t?t:"",0)}connect(){return t(this,void 0,void 0,(function*(){const t=this.upWallet.getAccount();return t||(yield this.upWallet.login({email:false}))}))}disconnect(){return t(this,void 0,void 0,(function*(){yield this.upWallet.logout()}))}listAccounts(){return t(this,void 0,void 0,(function*(){const t=this.upWallet.getAccount();return(null==t?void 0:t.address)?[null==t?void 0:t.address]:[]}))}getAddress(){const t=this.upWallet.getAccount();return Promise.resolve((null==t?void 0:t.address)?s(null==t?void 0:t.address):null)}}(m,v);return f}))}function p(e,n){return t(this,void 0,void 0,(function*(){const t=yield u(e);return t.on("connect",n.connect),t.on("disconnect",(t=>{n.disconnect(t),n.accountsChanged([])})),t.on("accountsChanged",n.accountsChanged),t.on("chainChanged",n.chainChanged),t.on("message",(({type:t,data:e})=>n.message(t,e))),yield t.connect(),t}))}function h(){var t;null===(t=i.getState().provider)||void 0===t||t.disconnect()}function v(t){var e,n;return null===(n=null===(e=i.getState().provider)||void 0===e?void 0:e.upWallet)||void 0===n?void 0:n.signTypedData(t)}function m(t){var e;const r=t.addChainParameters.chainId,o="string"==typeof r&&(null==r?void 0:r.startsWith("0x"))?parseInt(r,16):Number(r);if(!n.includes(o))throw new Error(`chainId ${o} not supported`);return null===(e=i.getState().provider)||void 0===e?void 0:e.updateUpWalletConfig(o)}export{u as createProvider,p as default,h as disconnectWallet,v as signTypedData,m as switchChain};