@dodoex/wallet-web3 0.3.4 → 0.4.1-rise

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 (91) hide show
  1. package/dist/{alchemy-provider-5870b6fa-d73f10c3.js → alchemy-provider-5870b6fa-14ec4a67.js} +1 -1
  2. package/dist/{alchemy-websocket-provider-213da986-5548964b.js → alchemy-websocket-provider-213da986-248efea7.js} +1 -1
  3. package/dist/{blocto-087ab98b.js → blocto-f754a82a.js} +1 -1
  4. package/dist/{ccip-b0d2cb9b.js → ccip-97718869.js} +1 -1
  5. package/dist/ccip-e1bced07.js +1 -0
  6. package/dist/cjs/{alchemy-provider-5870b6fa-13c38c30.cjs → alchemy-provider-5870b6fa-116ab07a.cjs} +1 -1
  7. package/dist/cjs/{alchemy-websocket-provider-213da986-9c2a561f.cjs → alchemy-websocket-provider-213da986-87ccad9d.cjs} +1 -1
  8. package/dist/cjs/{blocto-59170006.cjs → blocto-95507d3f.cjs} +1 -1
  9. package/dist/cjs/{ccip-f9b919b2.cjs → ccip-51bad854.cjs} +1 -1
  10. package/dist/cjs/ccip-b38d78bc.cjs +1 -0
  11. package/dist/cjs/{draggabilly-b2bd6560.cjs → draggabilly-e359aaca.cjs} +1 -1
  12. package/dist/cjs/id-2a5c5ef2.cjs +1 -0
  13. package/dist/cjs/{index-8f9c08b7.cjs → index-10a24541.cjs} +1 -1
  14. package/dist/cjs/{index-6cb01ff5.cjs → index-39f61aea.cjs} +1 -1
  15. package/dist/cjs/index-5f0913a9.cjs +2 -0
  16. package/dist/cjs/{index-4088da7a.cjs → index-643e5119.cjs} +1 -1
  17. package/dist/cjs/{index-909ed09f.cjs → index-69bd892e.cjs} +1 -1
  18. package/dist/cjs/{index-c8776c7e.cjs → index-7af70508.cjs} +3 -3
  19. package/dist/cjs/{index-e3a09800.cjs → index-96e65b8a.cjs} +1 -1
  20. package/dist/cjs/{index-7e2b99b8.cjs → index-9ccb1170.cjs} +1 -1
  21. package/dist/cjs/index-bb10a98a.cjs +6 -0
  22. package/dist/cjs/{index-a9e41217.cjs → index-f544eb4c.cjs} +1 -1
  23. package/dist/cjs/index-fadaf8b8.cjs +28 -0
  24. package/dist/cjs/index.cjs +1 -1
  25. package/dist/cjs/{index.es-5658402e.cjs → index.es-f545ef05.cjs} +1 -1
  26. package/dist/cjs/{interface-f8513d40.cjs → interface-8a637174.cjs} +1 -1
  27. package/dist/cjs/lib-typedarrays-cad6d780.cjs +1 -0
  28. package/dist/cjs/{portis-f1e438bd.cjs → portis-6bb18e8c.cjs} +1 -1
  29. package/dist/cjs/{provider-1469a098.cjs → provider-ef4d48ff.cjs} +1 -1
  30. package/dist/cjs/providers/connector/alchemy/index.d.ts +12 -8
  31. package/dist/cjs/providers/connector/index.d.ts +3 -907
  32. package/dist/cjs/providers/connector/rise/index.d.ts +3 -0
  33. package/dist/cjs/providers/connector/rise/provider.d.ts +2 -0
  34. package/dist/cjs/providers/wallets/index.d.ts +4 -0
  35. package/dist/cjs/providers/wallets/standalone.d.ts +1 -0
  36. package/dist/cjs/providers/wallets/types.d.ts +1 -0
  37. package/dist/cjs/{rainbow-3dc6f968.cjs → rainbow-23f226c3.cjs} +1 -1
  38. package/dist/cjs/secp256k1-12b6c26a.cjs +2 -0
  39. package/dist/cjs/sha224-80c902fd.cjs +1 -0
  40. package/dist/cjs/{sha256-981f903c.cjs → sha256-5fef9f66.cjs} +1 -1
  41. package/dist/cjs/{typed-data-d4238233.cjs → typed-data-6fcfdd47.cjs} +1 -1
  42. package/dist/cjs/uAuth-2e9ca189.cjs +1 -0
  43. package/dist/cjs/{walletConnect-e69e2a9a.cjs → walletConnect-a924de37.cjs} +1 -1
  44. package/dist/cjs/{walletLink-0560c895.cjs → walletLink-61f852a1.cjs} +1 -1
  45. package/dist/{draggabilly-4433218d.js → draggabilly-3125c6e9.js} +1 -1
  46. package/dist/id-cdf2dadd.js +1 -0
  47. package/dist/{index-fe2d0915.js → index-388a0406.js} +1 -1
  48. package/dist/{index-43cf1b4a.js → index-3f3b3b93.js} +1 -1
  49. package/dist/index-435c5426.js +2 -0
  50. package/dist/index-4f2cd06b.js +6 -0
  51. package/dist/index-9534d8ad.js +28 -0
  52. package/dist/{index-a02313f2.js → index-bbbb136d.js} +1 -1
  53. package/dist/{index-e8d823f4.js → index-be44c6cf.js} +1 -1
  54. package/dist/{index-8d7041e4.js → index-ce22e241.js} +3 -3
  55. package/dist/{index-08b24f87.js → index-dca9f9d5.js} +1 -1
  56. package/dist/{index-98e3a5b7.js → index-ecc4ef84.js} +1 -1
  57. package/dist/{index-e23ece16.js → index-f9b4c373.js} +1 -1
  58. package/dist/{index.es-0097b19b.js → index.es-54e0c8fc.js} +1 -1
  59. package/dist/index.js +1 -1
  60. package/dist/{interface-6ba1137a.js → interface-a828a662.js} +1 -1
  61. package/dist/lib-typedarrays-87be4777.js +1 -0
  62. package/dist/{portis-37b07247.js → portis-2c5bf8b6.js} +1 -1
  63. package/dist/{provider-db4424b4.js → provider-68c12b1a.js} +1 -1
  64. package/dist/providers/connector/alchemy/index.d.ts +12 -8
  65. package/dist/providers/connector/index.d.ts +3 -907
  66. package/dist/providers/connector/rise/index.d.ts +3 -0
  67. package/dist/providers/connector/rise/provider.d.ts +2 -0
  68. package/dist/providers/wallets/index.d.ts +4 -0
  69. package/dist/providers/wallets/standalone.d.ts +1 -0
  70. package/dist/providers/wallets/types.d.ts +1 -0
  71. package/dist/{rainbow-367d8171.js → rainbow-049a1739.js} +1 -1
  72. package/dist/secp256k1-981bc92b.js +2 -0
  73. package/dist/sha224-5fac1d2c.js +1 -0
  74. package/dist/{sha256-d65763b0.js → sha256-5efde761.js} +1 -1
  75. package/dist/{typed-data-a771d851.js → typed-data-fd8be8f8.js} +1 -1
  76. package/dist/uAuth-d6acd696.js +1 -0
  77. package/dist/{walletConnect-c14d2cb7.js → walletConnect-bad92dcf.js} +1 -1
  78. package/dist/{walletLink-062c2a28.js → walletLink-b85ce653.js} +1 -1
  79. package/package.json +5 -4
  80. package/dist/cjs/id-6aec2278.cjs +0 -1
  81. package/dist/cjs/index-5fba0284.cjs +0 -28
  82. package/dist/cjs/index-afede0c1.cjs +0 -6
  83. package/dist/cjs/lib-typedarrays-0c53ed3f.cjs +0 -1
  84. package/dist/cjs/sha224-a96222a0.cjs +0 -1
  85. package/dist/cjs/uAuth-89a23338.cjs +0 -1
  86. package/dist/id-b18759a6.js +0 -1
  87. package/dist/index-4ce5e1ef.js +0 -6
  88. package/dist/index-8d387984.js +0 -28
  89. package/dist/lib-typedarrays-72196011.js +0 -1
  90. package/dist/sha224-4183d3c7.js +0 -1
  91. package/dist/uAuth-2c8aeeba.js +0 -1
@@ -0,0 +1,3 @@
1
+ import { ConnectEvents } from '../../wallets/types';
2
+ import { ConnectorParams } from '../types';
3
+ export default function connector(params: ConnectorParams, events: ConnectEvents): Promise<import("@ethersproject/providers").JsonRpcProvider>;
@@ -0,0 +1,2 @@
1
+ import { ConnectorParams } from '../types';
2
+ export declare function createProvider(params: ConnectorParams): Promise<any>;
@@ -35,6 +35,10 @@ export declare const allWalletObject: {
35
35
  SocialLogin: Wallet;
36
36
  Alchemy: Wallet;
37
37
  Bybit: Wallet;
38
+ Zerion: Wallet;
39
+ Holdstation: Wallet;
40
+ SafePal: Wallet;
41
+ Rise: Wallet;
38
42
  MetamaskWallet: Wallet;
39
43
  };
40
44
  export declare const standaloneList: Wallet[];
@@ -33,3 +33,4 @@ export declare const Bybit: Wallet;
33
33
  export declare const Zerion: Wallet;
34
34
  export declare const Holdstation: Wallet;
35
35
  export declare const SafePal: Wallet;
36
+ export declare const Rise: Wallet;
@@ -65,6 +65,7 @@ export declare enum WalletType {
65
65
  Zerion = "custom-zerion",
66
66
  Holdstation = "custom-holdstation",
67
67
  SafePal = "custom-safe-pal",
68
+ Rise = "custom-rise",
68
69
  EIP6963Prefix = "custom-eip-6963-"
69
70
  }
70
71
  export type ConnectEvents = {
@@ -1 +1 @@
1
- import{_ as e,N as o,O as t,A as r}from"./index-8d387984.js";import{EthereumProvider as n}from"./index.es-0097b19b.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"./_commonjs-dynamic-modules-7cfc9805.js";function i({chainId:i,rpcUrl:c,rpc:s,walletConnectParams:a,darkMode:d},p){return e(this,void 0,void 0,(function*(){let l,m,h="wss://relay.walletconnect.com",u=!0;a&&(h=a.bridge||h,u=void 0!==a.qrcode?a.qrcode:u,a.infuraId,m=a.qrModalOptions||void 0),s?l=s:i&&c&&(l={[i]:c});const j=o(),b=yield n.init({projectId:null==a?void 0:a.projectId,chains:i?[i]:[],showQrModal:!j,rpcMap:l,qrModalOptions:Object.assign({themeMode:d?"dark":"light"},m)});return b.on("display_uri",(e=>{(null==m?void 0:m.openCallback)&&m.openCallback(e)})),b.on("connect",p.connect),b.on("disconnect",(e=>{p.disconnect(e),p.accountsChanged([])})),b.on("accountsChanged",p.accountsChanged),b.on("chainChanged",p.chainChanged),b.on("message",(({type:e,data:o})=>p.message(e,o))),new Promise((o=>e(this,void 0,void 0,(function*(){j?(b.once("display_uri",(e=>{let n=e;t()&&(n=`rainbow://wc?uri=${encodeURIComponent(e)}&connector=rainbowkit`),window.location.href=n,o(r(b))})),b.enable()):(yield b.enable(),o(r(b)))}))))}))}export{i as default};
1
+ import{_ as e,N as o,O as t,A as r}from"./index-9534d8ad.js";import{EthereumProvider as n}from"./index.es-54e0c8fc.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"./_commonjs-dynamic-modules-7cfc9805.js";function i({chainId:i,rpcUrl:c,rpc:s,walletConnectParams:a,darkMode:d},p){return e(this,void 0,void 0,(function*(){let l,m,h="wss://relay.walletconnect.com",u=!0;a&&(h=a.bridge||h,u=void 0!==a.qrcode?a.qrcode:u,a.infuraId,m=a.qrModalOptions||void 0),s?l=s:i&&c&&(l={[i]:c});const j=o(),b=yield n.init({projectId:null==a?void 0:a.projectId,chains:i?[i]:[],showQrModal:!j,rpcMap:l,qrModalOptions:Object.assign({themeMode:d?"dark":"light"},m)});return b.on("display_uri",(e=>{(null==m?void 0:m.openCallback)&&m.openCallback(e)})),b.on("connect",p.connect),b.on("disconnect",(e=>{p.disconnect(e),p.accountsChanged([])})),b.on("accountsChanged",p.accountsChanged),b.on("chainChanged",p.chainChanged),b.on("message",(({type:e,data:o})=>p.message(e,o))),new Promise((o=>e(this,void 0,void 0,(function*(){j?(b.once("display_uri",(e=>{let n=e;t()&&(n=`rainbow://wc?uri=${encodeURIComponent(e)}&connector=rainbowkit`),window.location.href=n,o(r(b))})),b.enable()):(yield b.enable(),o(r(b)))}))))}))}export{i as default};
@@ -0,0 +1,2 @@
1
+ import{aT as t,aU as e,aV as r,aW as n,aX as o,aY as i,aZ as s,a_ as a,a$ as f,b0 as c}from"./index-9534d8ad.js";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"@ethersproject/properties";import"@ethersproject/address";import"@ethersproject/abstract-signer";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"events";import"@ethersproject/constants";import"@ethersproject/transactions";class u extends t{constructor(t,o){super(),this.finished=!1,this.destroyed=!1,e(t);const i=r(o);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,a=new Uint8Array(s);a.set(i.length>s?t.create().update(i).digest():i);for(let t=0;t<a.length;t++)a[t]^=54;this.iHash.update(a),this.oHash=t.create();for(let t=0;t<a.length;t++)a[t]^=106;this.oHash.update(a),n(a)}update(t){return o(this),this.iHash.update(t),this}digestInto(t){o(this),i(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:n,destroyed:o,blockLen:i,outputLen:s}=this;return t.finished=n,t.destroyed=o,t.blockLen=i,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const d=(t,e,r)=>new u(t,e).update(r).digest();d.create=(t,e)=>new u(t,e)
2
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */;const l=BigInt(0),h=BigInt(1);function w(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}function p(t){if(!w(t))throw new Error("Uint8Array expected")}function g(t,e){if("boolean"!=typeof e)throw new Error(t+" boolean expected, got "+e)}function m(t){const e=t.toString(16);return 1&e.length?"0"+e:e}function y(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return""===t?l:BigInt("0x"+t)}const b="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,E=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function v(t){if(p(t),b)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=E[t[r]];return e}const x={_0:48,_9:57,A:65,F:70,a:97,f:102};function B(t){return t>=x._0&&t<=x._9?t-x._0:t>=x.A&&t<=x.F?t-(x.A-10):t>=x.a&&t<=x.f?t-(x.a-10):void 0}function S(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);if(b)return Uint8Array.fromHex(t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let e=0,o=0;e<r;e++,o+=2){const r=B(t.charCodeAt(o)),i=B(t.charCodeAt(o+1));if(void 0===r||void 0===i){const e=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+o)}n[e]=16*r+i}return n}function A(t){return y(v(t))}function O(t){return p(t),y(v(Uint8Array.from(t).reverse()))}function I(t,e){return S(t.toString(16).padStart(2*e,"0"))}function R(t,e){return I(t,e).reverse()}function q(t,e,r){let n;if("string"==typeof e)try{n=S(e)}catch(e){throw new Error(t+" must be hex string or Uint8Array, cause: "+e)}else{if(!w(e))throw new Error(t+" must be hex string or Uint8Array");n=Uint8Array.from(e)}const o=n.length;if("number"==typeof r&&o!==r)throw new Error(t+" of length "+r+" expected, got "+o);return n}function N(...t){let e=0;for(let r=0;r<t.length;r++){const n=t[r];p(n),e+=n.length}const r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const o=t[e];r.set(o,n),n+=o.length}return r}function T(t){if("string"!=typeof t)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(t))}const H=t=>"bigint"==typeof t&&l<=t;function P(t,e,r){return H(t)&&H(e)&&H(r)&&e<=t&&t<r}function U(t,e,r,n){if(!P(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}const Z=t=>(h<<BigInt(t))-h,k=t=>new Uint8Array(t),C=t=>Uint8Array.from(t);const L={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||w(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function z(t,e,r={}){const n=(e,r,n)=>{const o=L[r];if("function"!=typeof o)throw new Error("invalid validator function");const i=t[e];if(!(n&&void 0===i||o(i,t)))throw new Error("param "+String(e)+" is invalid. Expected "+r+", got "+i)};for(const[t,r]of Object.entries(e))n(t,r,!1);for(const[t,e]of Object.entries(r))n(t,e,!0);return t}function F(t){const e=new WeakMap;return(r,...n)=>{const o=e.get(r);if(void 0!==o)return o;const i=t(r,...n);return e.set(r,i),i}}const _=BigInt(0),D=BigInt(1),V=BigInt(2),j=BigInt(3),K=BigInt(4),Y=BigInt(5),M=BigInt(8);function W(t,e){const r=t%e;return r>=_?r:e+r}function G(t,e,r){let n=t;for(;e-- >_;)n*=n,n%=r;return n}function X(t,e){if(t===_)throw new Error("invert: expected non-zero number");if(e<=_)throw new Error("invert: expected positive modulus, got "+e);let r=W(t,e),n=e,o=_,i=D;for(;r!==_;){const t=n%r,e=o-i*(n/r);n=r,r=t,o=i,i=e}if(n!==D)throw new Error("invert: does not exist");return W(o,e)}function $(t,e){const r=(t.ORDER+D)/K,n=t.pow(e,r);if(!t.eql(t.sqr(n),e))throw new Error("Cannot find square root");return n}function J(t,e){const r=(t.ORDER-Y)/M,n=t.mul(e,V),o=t.pow(n,r),i=t.mul(e,o),s=t.mul(t.mul(i,V),o),a=t.mul(i,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),e))throw new Error("Cannot find square root");return a}function Q(t){return t%K===j?$:t%M===Y?J:function(t){if(t<BigInt(3))throw new Error("sqrt is not defined for small field");let e=t-D,r=0;for(;e%V===_;)e/=V,r++;let n=V;const o=it(t);for(;1===nt(o,n);)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===r)return $;let i=o.pow(n,e);const s=(e+D)/V;return function(t,n){if(t.is0(n))return n;if(1!==nt(t,n))throw new Error("Cannot find square root");let o=r,a=t.mul(t.ONE,i),f=t.pow(n,e),c=t.pow(n,s);for(;!t.eql(f,t.ONE);){if(t.is0(f))return t.ZERO;let e=1,r=t.sqr(f);for(;!t.eql(r,t.ONE);)if(e++,r=t.sqr(r),e===o)throw new Error("Cannot find square root");const n=D<<BigInt(o-e-1),i=t.pow(a,n);o=e,a=t.sqr(i),f=t.mul(f,a),c=t.mul(c,i)}return c}}(t)}const tt=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function et(t){return z(t,tt.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"}))}function rt(t,e,r=!1){const n=new Array(e.length).fill(r?t.ZERO:void 0),o=e.reduce(((e,r,o)=>t.is0(r)?e:(n[o]=e,t.mul(e,r))),t.ONE),i=t.inv(o);return e.reduceRight(((e,r,o)=>t.is0(r)?e:(n[o]=t.mul(e,n[o]),t.mul(e,r))),i),n}function nt(t,e){const r=(t.ORDER-D)/V,n=t.pow(e,r),o=t.eql(n,t.ONE),i=t.eql(n,t.ZERO),s=t.eql(n,t.neg(t.ONE));if(!o&&!i&&!s)throw new Error("invalid Legendre symbol result");return o?1:i?0:-1}function ot(t,e){void 0!==e&&s(e);const r=void 0!==e?e:t.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function it(t,e,r=!1,n={}){if(t<=_)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:o,nByteLength:i}=ot(t,e);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let s;const a=Object.freeze({ORDER:t,isLE:r,BITS:o,BYTES:i,MASK:Z(o),ZERO:_,ONE:D,create:e=>W(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("invalid field element: expected bigint, got "+typeof e);return _<=e&&e<t},is0:t=>t===_,isOdd:t=>(t&D)===D,neg:e=>W(-e,t),eql:(t,e)=>t===e,sqr:e=>W(e*e,t),add:(e,r)=>W(e+r,t),sub:(e,r)=>W(e-r,t),mul:(e,r)=>W(e*r,t),pow:(t,e)=>function(t,e,r){if(r<_)throw new Error("invalid exponent, negatives unsupported");if(r===_)return t.ONE;if(r===D)return e;let n=t.ONE,o=e;for(;r>_;)r&D&&(n=t.mul(n,o)),o=t.sqr(o),r>>=D;return n}(a,t,e),div:(e,r)=>W(e*X(r,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>X(e,t),sqrt:n.sqrt||(e=>(s||(s=Q(t)),s(a,e))),toBytes:t=>r?R(t,i):I(t,i),fromBytes:t=>{if(t.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);return r?O(t):A(t)},invertBatch:t=>rt(a,t),cmov:(t,e,r)=>r?e:t});return Object.freeze(a)}function st(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function at(t){const e=st(t);return e+Math.ceil(e/2)}const ft=BigInt(0),ct=BigInt(1);function ut(t,e){const r=e.negate();return t?r:e}function dt(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function lt(t,e){dt(t,e);const r=2**t;return{windows:Math.ceil(e/t)+1,windowSize:2**(t-1),mask:Z(t),maxNumber:r,shiftBy:BigInt(t)}}function ht(t,e,r){const{windowSize:n,mask:o,maxNumber:i,shiftBy:s}=r;let a=Number(t&o),f=t>>s;a>n&&(a-=i,f+=ct);const c=e*n;return{nextN:f,offset:c+Math.abs(a)-1,isZero:0===a,isNeg:a<0,isNegF:e%2!=0,offsetF:c}}const wt=new WeakMap,pt=new WeakMap;function gt(t){return pt.get(t)||1}function mt(t,e,r,n){!function(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach(((t,r)=>{if(!(t instanceof e))throw new Error("invalid point at index "+r)}))}(r,t),function(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach(((t,r)=>{if(!e.isValid(t))throw new Error("invalid scalar at index "+r)}))}(n,e);const o=r.length,i=n.length;if(o!==i)throw new Error("arrays of points and scalars must have equal length");const s=t.ZERO,a=function(t){let e;for(e=0;t>l;t>>=h,e+=1);return e}(BigInt(o));let f=1;a>12?f=a-3:a>4?f=a-2:a>0&&(f=2);const c=Z(f),u=new Array(Number(c)+1).fill(s);let d=s;for(let t=Math.floor((e.BITS-1)/f)*f;t>=0;t-=f){u.fill(s);for(let e=0;e<i;e++){const o=n[e],i=Number(o>>BigInt(t)&c);u[i]=u[i].add(r[e])}let e=s;for(let t=u.length-1,r=s;t>0;t--)r=r.add(u[t]),e=e.add(r);if(d=d.add(e),0!==t)for(let t=0;t<f;t++)d=d.double()}return d}function yt(t){return et(t.Fp),z(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...ot(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}function bt(t){void 0!==t.lowS&&g("lowS",t.lowS),void 0!==t.prehash&&g("prehash",t.prehash)}class Et extends Error{constructor(t=""){super(t)}}const vt={Err:Et,_tlv:{encode:(t,e)=>{const{Err:r}=vt;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(1&e.length)throw new r("tlv.encode: unpadded data");const n=e.length/2,o=m(n);if(o.length/2&128)throw new r("tlv.encode: long form length too big");const i=n>127?m(o.length/2|128):"";return m(t)+i+o+e},decode(t,e){const{Err:r}=vt;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const o=e[n++];let i=0;if(!!(128&o)){const t=127&o;if(!t)throw new r("tlv.decode(long): indefinite length not supported");if(t>4)throw new r("tlv.decode(long): byte length is too big");const s=e.subarray(n,n+t);if(s.length!==t)throw new r("tlv.decode: length bytes not complete");if(0===s[0])throw new r("tlv.decode(long): zero leftmost byte");for(const t of s)i=i<<8|t;if(n+=t,i<128)throw new r("tlv.decode(long): not minimal encoding")}else i=o;const s=e.subarray(n,n+i);if(s.length!==i)throw new r("tlv.decode: wrong value length");return{v:s,l:e.subarray(n+i)}}},_int:{encode(t){const{Err:e}=vt;if(t<Bt)throw new e("integer: negative integers are not allowed");let r=m(t);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new e("unexpected DER parsing assertion: unpadded hex");return r},decode(t){const{Err:e}=vt;if(128&t[0])throw new e("invalid signature integer: negative");if(0===t[0]&&!(128&t[1]))throw new e("invalid signature integer: unnecessary leading zero");return A(t)}},toSig(t){const{Err:e,_int:r,_tlv:n}=vt,o=q("signature",t),{v:i,l:s}=n.decode(48,o);if(s.length)throw new e("invalid signature: left bytes after parsing");const{v:a,l:f}=n.decode(2,i),{v:c,l:u}=n.decode(2,f);if(u.length)throw new e("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(c)}},hexFromSig(t){const{_tlv:e,_int:r}=vt,n=e.encode(2,r.encode(t.r))+e.encode(2,r.encode(t.s));return e.encode(48,n)}};function xt(t,e){return v(I(t,e))}const Bt=BigInt(0),St=BigInt(1),At=BigInt(2),Ot=BigInt(3),It=BigInt(4);function Rt(t){const e=function(t){const e=yt(t);z(e,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:r,Fp:n,a:o}=e;if(r){if(!n.eql(o,n.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...e})}(t),{Fp:r}=e,n=it(e.n,e.nBitLength),o=e.toBytes||((t,e,n)=>{const o=e.toAffine();return N(Uint8Array.from([4]),r.toBytes(o.x),r.toBytes(o.y))}),i=e.fromBytes||(t=>{const e=t.subarray(1);return{x:r.fromBytes(e.subarray(0,r.BYTES)),y:r.fromBytes(e.subarray(r.BYTES,2*r.BYTES))}});function s(t){const{a:n,b:o}=e,i=r.sqr(t),s=r.mul(i,t);return r.add(r.add(s,r.mul(t,n)),o)}function a(t,e){const n=r.sqr(e),o=s(t);return r.eql(n,o)}if(!a(e.Gx,e.Gy))throw new Error("bad curve params: generator point");const f=r.mul(r.pow(e.a,Ot),It),c=r.mul(r.sqr(e.b),BigInt(27));if(r.is0(r.add(f,c)))throw new Error("bad curve params: a or b");function u(t){const{allowedPrivateKeyLengths:r,nByteLength:n,wrapPrivateKey:o,n:i}=e;if(r&&"bigint"!=typeof t){if(w(t)&&(t=v(t)),"string"!=typeof t||!r.includes(t.length))throw new Error("invalid private key");t=t.padStart(2*n,"0")}let s;try{s="bigint"==typeof t?t:A(q("private key",t,n))}catch(e){throw new Error("invalid private key, expected hex or "+n+" bytes, got "+typeof t)}return o&&(s=W(s,i)),U("private key",s,St,i),s}function d(t){if(!(t instanceof p))throw new Error("ProjectivePoint expected")}const l=F(((t,e)=>{const{px:n,py:o,pz:i}=t;if(r.eql(i,r.ONE))return{x:n,y:o};const s=t.is0();null==e&&(e=s?r.ONE:r.inv(i));const a=r.mul(n,e),f=r.mul(o,e),c=r.mul(i,e);if(s)return{x:r.ZERO,y:r.ZERO};if(!r.eql(c,r.ONE))throw new Error("invZ was invalid");return{x:a,y:f}})),h=F((t=>{if(t.is0()){if(e.allowInfinityPoint&&!r.is0(t.py))return;throw new Error("bad point: ZERO")}const{x:n,y:o}=t.toAffine();if(!r.isValid(n)||!r.isValid(o))throw new Error("bad point: x or y not FE");if(!a(n,o))throw new Error("bad point: equation left != right");if(!t.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0}));class p{constructor(t,e,n){if(null==t||!r.isValid(t))throw new Error("x required");if(null==e||!r.isValid(e)||r.is0(e))throw new Error("y required");if(null==n||!r.isValid(n))throw new Error("z required");this.px=t,this.py=e,this.pz=n,Object.freeze(this)}static fromAffine(t){const{x:e,y:n}=t||{};if(!t||!r.isValid(e)||!r.isValid(n))throw new Error("invalid affine point");if(t instanceof p)throw new Error("projective point not allowed");const o=t=>r.eql(t,r.ZERO);return o(e)&&o(n)?p.ZERO:new p(e,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=rt(r,t.map((t=>t.pz)));return t.map(((t,r)=>t.toAffine(e[r]))).map(p.fromAffine)}static fromHex(t){const e=p.fromAffine(i(q("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return p.BASE.multiply(u(t))}static msm(t,e){return mt(p,n,t,e)}_setWindowSize(t){b.setWindowSize(this,t)}assertValidity(){h(this)}hasEvenY(){const{y:t}=this.toAffine();if(r.isOdd)return!r.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){d(t);const{px:e,py:n,pz:o}=this,{px:i,py:s,pz:a}=t,f=r.eql(r.mul(e,a),r.mul(i,o)),c=r.eql(r.mul(n,a),r.mul(s,o));return f&&c}negate(){return new p(this.px,r.neg(this.py),this.pz)}double(){const{a:t,b:n}=e,o=r.mul(n,Ot),{px:i,py:s,pz:a}=this;let f=r.ZERO,c=r.ZERO,u=r.ZERO,d=r.mul(i,i),l=r.mul(s,s),h=r.mul(a,a),w=r.mul(i,s);return w=r.add(w,w),u=r.mul(i,a),u=r.add(u,u),f=r.mul(t,u),c=r.mul(o,h),c=r.add(f,c),f=r.sub(l,c),c=r.add(l,c),c=r.mul(f,c),f=r.mul(w,f),u=r.mul(o,u),h=r.mul(t,h),w=r.sub(d,h),w=r.mul(t,w),w=r.add(w,u),u=r.add(d,d),d=r.add(u,d),d=r.add(d,h),d=r.mul(d,w),c=r.add(c,d),h=r.mul(s,a),h=r.add(h,h),d=r.mul(h,w),f=r.sub(f,d),u=r.mul(h,l),u=r.add(u,u),u=r.add(u,u),new p(f,c,u)}add(t){d(t);const{px:n,py:o,pz:i}=this,{px:s,py:a,pz:f}=t;let c=r.ZERO,u=r.ZERO,l=r.ZERO;const h=e.a,w=r.mul(e.b,Ot);let g=r.mul(n,s),m=r.mul(o,a),y=r.mul(i,f),b=r.add(n,o),E=r.add(s,a);b=r.mul(b,E),E=r.add(g,m),b=r.sub(b,E),E=r.add(n,i);let v=r.add(s,f);return E=r.mul(E,v),v=r.add(g,y),E=r.sub(E,v),v=r.add(o,i),c=r.add(a,f),v=r.mul(v,c),c=r.add(m,y),v=r.sub(v,c),l=r.mul(h,E),c=r.mul(w,y),l=r.add(c,l),c=r.sub(m,l),l=r.add(m,l),u=r.mul(c,l),m=r.add(g,g),m=r.add(m,g),y=r.mul(h,y),E=r.mul(w,E),m=r.add(m,y),y=r.sub(g,y),y=r.mul(h,y),E=r.add(E,y),g=r.mul(m,E),u=r.add(u,g),g=r.mul(v,E),c=r.mul(b,c),c=r.sub(c,g),g=r.mul(b,m),l=r.mul(v,l),l=r.add(l,g),new p(c,u,l)}subtract(t){return this.add(t.negate())}is0(){return this.equals(p.ZERO)}wNAF(t){return b.wNAFCached(this,t,p.normalizeZ)}multiplyUnsafe(t){const{endo:n,n:o}=e;U("scalar",t,Bt,o);const i=p.ZERO;if(t===Bt)return i;if(this.is0()||t===St)return this;if(!n||b.hasPrecomputes(this))return b.wNAFCachedUnsafe(this,t,p.normalizeZ);let{k1neg:s,k1:a,k2neg:f,k2:c}=n.splitScalar(t),u=i,d=i,l=this;for(;a>Bt||c>Bt;)a&St&&(u=u.add(l)),c&St&&(d=d.add(l)),l=l.double(),a>>=St,c>>=St;return s&&(u=u.negate()),f&&(d=d.negate()),d=new p(r.mul(d.px,n.beta),d.py,d.pz),u.add(d)}multiply(t){const{endo:n,n:o}=e;let i,s;if(U("scalar",t,St,o),n){const{k1neg:e,k1:o,k2neg:a,k2:f}=n.splitScalar(t);let{p:c,f:u}=this.wNAF(o),{p:d,f:l}=this.wNAF(f);c=b.constTimeNegate(e,c),d=b.constTimeNegate(a,d),d=new p(r.mul(d.px,n.beta),d.py,d.pz),i=c.add(d),s=u.add(l)}else{const{p:e,f:r}=this.wNAF(t);i=e,s=r}return p.normalizeZ([i,s])[0]}multiplyAndAddUnsafe(t,e,r){const n=p.BASE,o=(t,e)=>e!==Bt&&e!==St&&t.equals(n)?t.multiply(e):t.multiplyUnsafe(e),i=o(this,e).add(o(t,r));return i.is0()?void 0:i}toAffine(t){return l(this,t)}isTorsionFree(){const{h:t,isTorsionFree:r}=e;if(t===St)return!0;if(r)return r(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:r}=e;return t===St?this:r?r(p,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return g("isCompressed",t),this.assertValidity(),o(p,this,t)}toHex(t=!0){return g("isCompressed",t),v(this.toRawBytes(t))}}p.BASE=new p(e.Gx,e.Gy,r.ONE),p.ZERO=new p(r.ZERO,r.ONE,r.ZERO);const{endo:m,nBitLength:y}=e,b=(E=p,x=m?Math.ceil(y/2):y,{constTimeNegate:ut,hasPrecomputes:t=>1!==gt(t),unsafeLadder(t,e,r=E.ZERO){let n=t;for(;e>ft;)e&ct&&(r=r.add(n)),n=n.double(),e>>=ct;return r},precomputeWindow(t,e){const{windows:r,windowSize:n}=lt(e,x),o=[];let i=t,s=i;for(let t=0;t<r;t++){s=i,o.push(s);for(let t=1;t<n;t++)s=s.add(i),o.push(s);i=s.double()}return o},wNAF(t,e,r){let n=E.ZERO,o=E.BASE;const i=lt(t,x);for(let t=0;t<i.windows;t++){const{nextN:s,offset:a,isZero:f,isNeg:c,isNegF:u,offsetF:d}=ht(r,t,i);r=s,f?o=o.add(ut(u,e[d])):n=n.add(ut(c,e[a]))}return{p:n,f:o}},wNAFUnsafe(t,e,r,n=E.ZERO){const o=lt(t,x);for(let t=0;t<o.windows&&r!==ft;t++){const{nextN:i,offset:s,isZero:a,isNeg:f}=ht(r,t,o);if(r=i,!a){const t=e[s];n=n.add(f?t.negate():t)}}return n},getPrecomputes(t,e,r){let n=wt.get(e);return n||(n=this.precomputeWindow(e,t),1!==t&&wt.set(e,r(n))),n},wNAFCached(t,e,r){const n=gt(t);return this.wNAF(n,this.getPrecomputes(n,t,r),e)},wNAFCachedUnsafe(t,e,r,n){const o=gt(t);return 1===o?this.unsafeLadder(t,e,n):this.wNAFUnsafe(o,this.getPrecomputes(o,t,r),e,n)},setWindowSize(t,e){dt(e,x),pt.set(t,e),wt.delete(t)}});var E,x;return{CURVE:e,ProjectivePoint:p,normPrivateKeyToScalar:u,weierstrassEquation:s,isWithinCurveOrder:function(t){return P(t,St,e.n)}}}function qt(t){const e=function(t){const e=yt(t);return z(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:r,n:n,nByteLength:o,nBitLength:i}=e,s=r.BYTES+1,a=2*r.BYTES+1;function f(t){return W(t,n)}function c(t){return X(t,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:d,weierstrassEquation:l,isWithinCurveOrder:h}=Rt({...e,toBytes(t,e,n){const o=e.toAffine(),i=r.toBytes(o.x),s=N;return g("isCompressed",n),n?s(Uint8Array.from([e.hasEvenY()?2:3]),i):s(Uint8Array.from([4]),i,r.toBytes(o.y))},fromBytes(t){const e=t.length,n=t[0],o=t.subarray(1);if(e!==s||2!==n&&3!==n){if(e===a&&4===n){return{x:r.fromBytes(o.subarray(0,r.BYTES)),y:r.fromBytes(o.subarray(r.BYTES,2*r.BYTES))}}throw new Error("invalid Point, expected length of "+s+", or uncompressed "+a+", got "+e)}{const t=A(o);if(!P(t,St,r.ORDER))throw new Error("Point is not on curve");const e=l(t);let i;try{i=r.sqrt(e)}catch(t){const e=t instanceof Error?": "+t.message:"";throw new Error("Point is not on curve"+e)}return 1==(1&n)!==((i&St)===St)&&(i=r.neg(i)),{x:t,y:i}}}});function p(t){return t>n>>St}const m=(t,e,r)=>A(t.slice(e,r));class y{constructor(t,e,r){U("r",t,St,n),U("s",e,St,n),this.r=t,this.s=e,null!=r&&(this.recovery=r),Object.freeze(this)}static fromCompact(t){const e=o;return t=q("compactSignature",t,2*e),new y(m(t,0,e),m(t,e,2*e))}static fromDER(t){const{r:e,s:r}=vt.toSig(q("DER",t));return new y(e,r)}assertValidity(){}addRecoveryBit(t){return new y(this.r,this.s,t)}recoverPublicKey(t){const{r:n,s:o,recovery:i}=this,s=x(q("msgHash",t));if(null==i||![0,1,2,3].includes(i))throw new Error("recovery id invalid");const a=2===i||3===i?n+e.n:n;if(a>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const d=0==(1&i)?"02":"03",l=u.fromHex(d+xt(a,r.BYTES)),h=c(a),w=f(-s*h),p=f(o*h),g=u.BASE.multiplyAndAddUnsafe(l,w,p);if(!g)throw new Error("point at infinify");return g.assertValidity(),g}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,f(-this.s),this.recovery):this}toDERRawBytes(){return S(this.toDERHex())}toDERHex(){return vt.hexFromSig(this)}toCompactRawBytes(){return S(this.toCompactHex())}toCompactHex(){const t=o;return xt(this.r,t)+xt(this.s,t)}}const b={isValidPrivateKey(t){try{return d(t),!0}catch(t){return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const t=at(e.n);return function(t,e,r=!1){const n=t.length,o=st(e),i=at(e);if(n<16||n<i||n>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+n);const s=W(r?O(t):A(t),e-D)+D;return r?R(s,o):I(s,o)}(e.randomBytes(t),e.n)},precompute:(t=8,e=u.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function E(t){if("bigint"==typeof t)return!1;if(t instanceof u)return!0;const n=q("key",t).length,i=r.BYTES,s=i+1,a=2*i+1;return e.allowedPrivateKeyLengths||o===s?void 0:n===s||n===a}const v=e.bits2int||function(t){if(t.length>8192)throw new Error("input is too large");const e=A(t),r=8*t.length-i;return r>0?e>>BigInt(r):e},x=e.bits2int_modN||function(t){return f(v(t))},B=Z(i);function T(t){return U("num < 2^"+i,t,Bt,B),I(t,o)}function H(t,n,o=L){if(["recovered","canonical"].some((t=>t in o)))throw new Error("sign() legacy options not supported");const{hash:i,randomBytes:s}=e;let{lowS:a,prehash:l,extraEntropy:w}=o;null==a&&(a=!0),t=q("msgHash",t),bt(o),l&&(t=q("prehashed msgHash",i(t)));const g=x(t),m=d(n),b=[T(m),T(g)];if(null!=w&&!1!==w){const t=!0===w?s(r.BYTES):w;b.push(q("extraEntropy",t))}const E=N(...b),B=g;return{seed:E,k2sig:function(t){const e=v(t);if(!h(e))return;const r=c(e),n=u.BASE.multiply(e).toAffine(),o=f(n.x);if(o===Bt)return;const i=f(r*f(B+o*m));if(i===Bt)return;let s=(n.x===o?0:2)|Number(n.y&St),d=i;return a&&p(i)&&(d=function(t){return p(t)?f(-t):t}(i),s^=1),new y(o,d,s)}}}const L={lowS:e.lowS,prehash:!1},F={lowS:e.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return u.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,r=!0){if(!0===E(t))throw new Error("first arg must be private key");if(!1===E(e))throw new Error("second arg must be public key");return u.fromHex(e).multiply(d(t)).toRawBytes(r)},sign:function(t,r,n=L){const{seed:o,k2sig:i}=H(t,r,n),s=e;return function(t,e,r){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=k(t),o=k(t),i=0;const s=()=>{n.fill(1),o.fill(0),i=0},a=(...t)=>r(o,n,...t),f=(t=k(0))=>{o=a(C([0]),t),n=a(),0!==t.length&&(o=a(C([1]),t),n=a())},c=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const r=[];for(;t<e;){n=a();const e=n.slice();r.push(e),t+=n.length}return N(...r)};return(t,e)=>{let r;for(s(),f(t);!(r=e(c()));)f();return s(),r}}(s.hash.outputLen,s.nByteLength,s.hmac)(o,i)},verify:function(t,r,n,o=F){const i=t;r=q("msgHash",r),n=q("publicKey",n);const{lowS:s,prehash:a,format:d}=o;if(bt(o),"strict"in o)throw new Error("options.strict was renamed to lowS");if(void 0!==d&&"compact"!==d&&"der"!==d)throw new Error("format must be compact or der");const l="string"==typeof i||w(i),h=!l&&!d&&"object"==typeof i&&null!==i&&"bigint"==typeof i.r&&"bigint"==typeof i.s;if(!l&&!h)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let p,g;try{if(h&&(p=new y(i.r,i.s)),l){try{"compact"!==d&&(p=y.fromDER(i))}catch(t){if(!(t instanceof vt.Err))throw t}p||"der"===d||(p=y.fromCompact(i))}g=u.fromHex(n)}catch(t){return!1}if(!p)return!1;if(s&&p.hasHighS())return!1;a&&(r=e.hash(r));const{r:m,s:b}=p,E=x(r),v=c(b),B=f(E*v),S=f(m*v),A=u.BASE.multiplyAndAddUnsafe(g,B,S)?.toAffine();return!!A&&f(A.x)===m},ProjectivePoint:u,Signature:y,utils:b}}function Nt(t,e){if(et(t),!t.isValid(e.A)||!t.isValid(e.B)||!t.isValid(e.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const r=function(t,e){const r=t.ORDER;let n=Bt;for(let t=r-St;t%At===Bt;t/=At)n+=St;const o=n,i=At<<o-St-St,s=i*At,a=(r-St)/s,f=(a-St)/At,c=s-St,u=i,d=t.pow(e,a),l=t.pow(e,(a+St)/At);let h=(e,r)=>{let n=d,i=t.pow(r,c),s=t.sqr(i);s=t.mul(s,r);let a=t.mul(e,s);a=t.pow(a,f),a=t.mul(a,i),i=t.mul(a,r),s=t.mul(a,e);let h=t.mul(s,i);a=t.pow(h,u);let w=t.eql(a,t.ONE);i=t.mul(s,l),a=t.mul(h,n),s=t.cmov(i,s,w),h=t.cmov(a,h,w);for(let e=o;e>St;e--){let r=e-At;r=At<<r-St;let o=t.pow(h,r);const a=t.eql(o,t.ONE);i=t.mul(s,n),n=t.mul(n,n),o=t.mul(h,n),s=t.cmov(i,s,a),h=t.cmov(o,h,a)}return{isValid:w,value:s}};if(t.ORDER%It===Ot){const r=(t.ORDER-Ot)/It,n=t.sqrt(t.neg(e));h=(e,o)=>{let i=t.sqr(o);const s=t.mul(e,o);i=t.mul(i,s);let a=t.pow(i,r);a=t.mul(a,s);const f=t.mul(a,n),c=t.mul(t.sqr(a),o),u=t.eql(c,e);return{isValid:u,value:t.cmov(f,a,u)}}}return h}(t,e.Z);if(!t.isOdd)throw new Error("Fp.isOdd is not implemented!");return n=>{let o,i,s,a,f,c,u,d;o=t.sqr(n),o=t.mul(o,e.Z),i=t.sqr(o),i=t.add(i,o),s=t.add(i,t.ONE),s=t.mul(s,e.B),a=t.cmov(e.Z,t.neg(i),!t.eql(i,t.ZERO)),a=t.mul(a,e.A),i=t.sqr(s),c=t.sqr(a),f=t.mul(c,e.A),i=t.add(i,f),i=t.mul(i,s),c=t.mul(c,a),f=t.mul(c,e.B),i=t.add(i,f),u=t.mul(o,s);const{isValid:l,value:h}=r(i,c);d=t.mul(o,n),d=t.mul(d,h),u=t.cmov(u,s,l),d=t.cmov(d,h,l);const w=t.isOdd(n)===t.isOdd(d);d=t.cmov(t.neg(d),d,w);const p=rt(t,[a],!0)[0];return u=t.mul(u,p),{x:u,y:d}}}function Tt(t){return{hash:t,hmac:(e,...r)=>d(t,e,a(...r)),randomBytes:f}}const Ht=A;function Pt(t,e){if(Zt(t),Zt(e),t<0||t>=1<<8*e)throw new Error("invalid I2OSP input: "+t);const r=Array.from({length:e}).fill(0);for(let n=e-1;n>=0;n--)r[n]=255&t,t>>>=8;return new Uint8Array(r)}function Ut(t,e){const r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t[n]^e[n];return r}function Zt(t){if(!Number.isSafeInteger(t))throw new Error("number expected")}function kt(t,e,r){z(r,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:n,k:o,m:i,hash:s,expand:a,DST:f}=r;p(t),Zt(e);const c="string"==typeof f?T(f):f,u=n.toString(2).length,d=Math.ceil((u+o)/8),l=e*i*d;let h;if("xmd"===a)h=function(t,e,r,n){p(t),p(e),Zt(r),e.length>255&&(e=n(N(T("H2C-OVERSIZE-DST-"),e)));const{outputLen:o,blockLen:i}=n,s=Math.ceil(r/o);if(r>65535||s>255)throw new Error("expand_message_xmd: invalid lenInBytes");const a=N(e,Pt(e.length,1)),f=Pt(0,i),c=Pt(r,2),u=new Array(s),d=n(N(f,t,c,Pt(0,1),a));u[0]=n(N(d,Pt(1,1),a));for(let t=1;t<=s;t++){const e=[Ut(d,u[t-1]),Pt(t+1,1),a];u[t]=n(N(...e))}return N(...u).slice(0,r)}(t,c,l,s);else if("xof"===a)h=function(t,e,r,n,o){if(p(t),p(e),Zt(r),e.length>255){const t=Math.ceil(2*n/8);e=o.create({dkLen:t}).update(T("H2C-OVERSIZE-DST-")).update(e).digest()}if(r>65535||e.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return o.create({dkLen:r}).update(t).update(Pt(r,2)).update(e).update(Pt(e.length,1)).digest()}(t,c,l,o,s);else{if("_internal_pass"!==a)throw new Error('expand must be "xmd" or "xof"');h=t}const w=new Array(e);for(let t=0;t<e;t++){const e=new Array(i);for(let r=0;r<i;r++){const o=d*(r+t*i),s=h.subarray(o,o+d);e[r]=W(Ht(s),n)}w[t]=e}return w}const Ct=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Lt=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),zt=BigInt(0),Ft=BigInt(1),_t=BigInt(2),Dt=(t,e)=>(t+e/_t)/e;function Vt(t){const e=Ct,r=BigInt(3),n=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),a=BigInt(44),f=BigInt(88),c=t*t*t%e,u=c*c*t%e,d=G(u,r,e)*u%e,l=G(d,r,e)*u%e,h=G(l,_t,e)*c%e,w=G(h,o,e)*h%e,p=G(w,i,e)*w%e,g=G(p,a,e)*p%e,m=G(g,f,e)*g%e,y=G(m,a,e)*p%e,b=G(y,r,e)*u%e,E=G(b,s,e)*w%e,v=G(E,n,e)*c%e,x=G(v,_t,e);if(!jt.eql(jt.sqr(x),t))throw new Error("Cannot find square root");return x}const jt=it(Ct,void 0,void 0,{sqrt:Vt}),Kt=function(t,e){const r=e=>qt({...t,...Tt(e)});return{...r(e),create:r}}({a:zt,b:BigInt(7),Fp:jt,n:Lt,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Lt,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Ft*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,s=BigInt("0x100000000000000000000000000000000"),a=Dt(i*t,e),f=Dt(-n*t,e);let c=W(t-a*r-f*o,e),u=W(-a*n-f*i,e);const d=c>s,l=u>s;if(d&&(c=e-c),l&&(u=e-u),c>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:d,k1:c,k2neg:l,k2:u}}}},c),Yt={};function Mt(t,...e){let r=Yt[t];if(void 0===r){const e=c(Uint8Array.from(t,(t=>t.charCodeAt(0))));r=N(e,e),Yt[t]=r}return c(N(r,...e))}const Wt=t=>t.toRawBytes(!0).slice(1),Gt=t=>I(t,32),Xt=t=>W(t,Ct),$t=t=>W(t,Lt),Jt=(()=>Kt.ProjectivePoint)(),Qt=(t,e,r)=>Jt.BASE.multiplyAndAddUnsafe(t,e,r);function te(t){let e=Kt.utils.normPrivateKeyToScalar(t),r=Jt.fromPrivateKey(e);return{scalar:r.hasEvenY()?e:$t(-e),bytes:Wt(r)}}function ee(t){U("x",t,Ft,Ct);const e=Xt(t*t);let r=Vt(Xt(e*t+BigInt(7)));r%_t!==zt&&(r=Xt(-r));const n=new Jt(t,r,Ft);return n.assertValidity(),n}const re=A;function ne(...t){return $t(re(Mt("BIP0340/challenge",...t)))}function oe(t){return te(t).bytes}function ie(t,e,r=f(32)){const n=q("message",t),{bytes:o,scalar:i}=te(e),s=q("auxRand",r,32),a=Gt(i^re(Mt("BIP0340/aux",s))),c=Mt("BIP0340/nonce",a,o,n),u=$t(re(c));if(u===zt)throw new Error("sign failed: k is zero");const{bytes:d,scalar:l}=te(u),h=ne(d,o,n),w=new Uint8Array(64);if(w.set(d,0),w.set(Gt($t(l+h*i)),32),!se(w,n,o))throw new Error("sign: Invalid signature produced");return w}function se(t,e,r){const n=q("signature",t,64),o=q("message",e),i=q("publicKey",r,32);try{const t=ee(re(i)),e=re(n.subarray(0,32));if(!P(e,Ft,Ct))return!1;const r=re(n.subarray(32,64));if(!P(r,Ft,Lt))return!1;const s=ne(Gt(e),Wt(t),o),a=Qt(t,r,$t(-s));return!(!a||!a.hasEvenY()||a.toAffine().x!==e)}catch(t){return!1}}const ae=(()=>({getPublicKey:oe,sign:ie,verify:se,utils:{randomPrivateKey:Kt.utils.randomPrivateKey,lift_x:ee,pointToBytes:Wt,numberToBytesBE:I,bytesToNumberBE:A,taggedHash:Mt,mod:W}}))(),fe=(()=>function(t,e){const r=e.map((t=>Array.from(t).reverse()));return(e,n)=>{const[o,i,s,a]=r.map((r=>r.reduce(((r,n)=>t.add(t.mul(r,e),n))))),[f,c]=rt(t,[i,a],!0);return e=t.mul(o,f),n=t.mul(n,t.mul(s,c)),{x:e,y:n}}}(jt,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map((t=>t.map((t=>BigInt(t)))))))(),ce=(()=>Nt(jt,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:jt.create(BigInt("-11"))}))(),ue=(()=>function(t,e,r){if("function"!=typeof e)throw new Error("mapToCurve() must be defined");function n(r){return t.fromAffine(e(r))}function o(e){const r=e.clearCofactor();return r.equals(t.ZERO)?t.ZERO:(r.assertValidity(),r)}return{defaults:r,hashToCurve(t,e){const i=kt(t,2,{...r,DST:r.DST,...e}),s=n(i[0]),a=n(i[1]);return o(s.add(a))},encodeToCurve:(t,e)=>o(n(kt(t,1,{...r,DST:r.encodeDST,...e})[0])),mapToCurve(t){if(!Array.isArray(t))throw new Error("expected array of bigints");for(const e of t)if("bigint"!=typeof e)throw new Error("expected array of bigints");return o(n(t))}}}(Kt.ProjectivePoint,(t=>{const{x:e,y:r}=ce(jt.create(t[0]));return fe(e,r)}),{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:jt.ORDER,m:1,k:128,expand:"xmd",hash:c}))(),de=(()=>ue.hashToCurve)(),le=(()=>ue.encodeToCurve)();export{le as encodeToCurve,de as hashToCurve,ae as schnorr,Kt as secp256k1,ue as secp256k1_hasher};
@@ -0,0 +1 @@
1
+ import{c as e}from"./index-9534d8ad.js";import{r,a}from"./sha256-5efde761.js";var t,i={exports:{}};function o(){return t?i.exports:(t=1,i.exports=(d=r(),a(),o=(e=d).lib.WordArray,s=e.algo,n=s.SHA256,c=s.SHA224=n.extend({_doReset:function(){this._hash=new o.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=4,e}}),e.SHA224=n._createHelper(c),e.HmacSHA224=n._createHmacHelper(c),d.SHA224));var e,o,s,n,c,d}export{o as r};
@@ -1 +1 @@
1
- import{c as t,r as n}from"./index-8d387984.js";import{c as r}from"./_commonjs-dynamic-modules-7cfc9805.js";var e,i={exports:{}};function o(){return e||(e=1,i.exports=(o=o||function(e,i){var o;if("undefined"!=typeof window&&window.crypto&&(o=window.crypto),"undefined"!=typeof self&&self.crypto&&(o=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(o=globalThis.crypto),!o&&"undefined"!=typeof window&&window.msCrypto&&(o=window.msCrypto),!o&&void 0!==t&&t.crypto&&(o=t.crypto),!o&&"function"==typeof r)try{o=n}catch(t){}var s=function(){if(o){if("function"==typeof o.getRandomValues)try{return o.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof o.randomBytes)try{return o.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function t(){}return function(n){var r;return t.prototype=n,r=new t,t.prototype=null,r}}(),c={},f=c.lib={},u=f.Base={extend:function(t){var n=a(this);return t&&n.mixIn(t),n.hasOwnProperty("init")&&this.init!==n.init||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var n in t)t.hasOwnProperty(n)&&(this[n]=t[n]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},h=f.WordArray=u.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=i?n:4*t.length},toString:function(t){return(t||d).stringify(this)},concat:function(t){var n=this.words,r=t.words,e=this.sigBytes,i=t.sigBytes;if(this.clamp(),e%4)for(var o=0;o<i;o++){var s=r[o>>>2]>>>24-o%4*8&255;n[e+o>>>2]|=s<<24-(e+o)%4*8}else for(var a=0;a<i;a+=4)n[e+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var t=u.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var n=[],r=0;r<t;r+=4)n.push(s());return new h.init(n,t)}}),p=c.enc={},d=p.Hex={stringify:function(t){for(var n=t.words,r=t.sigBytes,e=[],i=0;i<r;i++){var o=n[i>>>2]>>>24-i%4*8&255;e.push((o>>>4).toString(16)),e.push((15&o).toString(16))}return e.join("")},parse:function(t){for(var n=t.length,r=[],e=0;e<n;e+=2)r[e>>>3]|=parseInt(t.substr(e,2),16)<<24-e%8*4;return new h.init(r,n/2)}},l=p.Latin1={stringify:function(t){for(var n=t.words,r=t.sigBytes,e=[],i=0;i<r;i++){var o=n[i>>>2]>>>24-i%4*8&255;e.push(String.fromCharCode(o))}return e.join("")},parse:function(t){for(var n=t.length,r=[],e=0;e<n;e++)r[e>>>2]|=(255&t.charCodeAt(e))<<24-e%4*8;return new h.init(r,n)}},y=p.Utf8={stringify:function(t){try{return decodeURIComponent(escape(l.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return l.parse(unescape(encodeURIComponent(t)))}},g=f.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new h.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=y.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var n,r=this._data,i=r.words,o=r.sigBytes,s=this.blockSize,a=o/(4*s),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,f=e.min(4*c,o);if(c){for(var u=0;u<c;u+=s)this._doProcessBlock(i,u);n=i.splice(0,c),r.sigBytes-=f}return new h.init(n,f)},clone:function(){var t=u.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});f.Hasher=g.extend({cfg:u.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){g.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(n,r){return new t.init(r).finalize(n)}},_createHmacHelper:function(t){return function(n,r){return new w.HMAC.init(t,r).finalize(n)}}});var w=c.algo={};return c}(Math),o)),i.exports;var o}var s,a={exports:{}};a.exports=(s=o(),function(t){var n=s,r=n.lib,e=r.WordArray,i=r.Hasher,o=n.algo,a=[],c=[];!function(){function n(n){for(var r=t.sqrt(n),e=2;e<=r;e++)if(!(n%e))return!1;return!0}function r(t){return 4294967296*(t-(0|t))|0}for(var e=2,i=0;i<64;)n(e)&&(i<8&&(a[i]=r(t.pow(e,.5))),c[i]=r(t.pow(e,1/3)),i++),e++}();var f=[],u=o.SHA256=i.extend({_doReset:function(){this._hash=new e.init(a.slice(0))},_doProcessBlock:function(t,n){for(var r=this._hash.words,e=r[0],i=r[1],o=r[2],s=r[3],a=r[4],u=r[5],h=r[6],p=r[7],d=0;d<64;d++){if(d<16)f[d]=0|t[n+d];else{var l=f[d-15],y=(l<<25|l>>>7)^(l<<14|l>>>18)^l>>>3,g=f[d-2],w=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;f[d]=y+f[d-7]+w+f[d-16]}var v=e&i^e&o^i&o,m=(e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22),_=p+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&u^~a&h)+c[d]+f[d];p=h,h=u,u=a,a=s+_|0,s=o,o=i,i=e,e=_+(m+v)|0}r[0]=r[0]+e|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+u|0,r[6]=r[6]+h|0,r[7]=r[7]+p|0},_doFinalize:function(){var n=this._data,r=n.words,e=8*this._nDataBytes,i=8*n.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(e/4294967296),r[15+(i+64>>>9<<4)]=e,n.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});n.SHA256=i._createHelper(u),n.HmacSHA256=i._createHmacHelper(u)}(Math),s.SHA256);export{o as r,a as s};
1
+ import{c as t,r as n}from"./index-9534d8ad.js";import{c as r}from"./_commonjs-dynamic-modules-7cfc9805.js";var e,i={exports:{}};function o(){return e||(e=1,i.exports=(o=o||function(e,i){var o;if("undefined"!=typeof window&&window.crypto&&(o=window.crypto),"undefined"!=typeof self&&self.crypto&&(o=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(o=globalThis.crypto),!o&&"undefined"!=typeof window&&window.msCrypto&&(o=window.msCrypto),!o&&void 0!==t&&t.crypto&&(o=t.crypto),!o&&"function"==typeof r)try{o=n}catch(t){}var s=function(){if(o){if("function"==typeof o.getRandomValues)try{return o.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof o.randomBytes)try{return o.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function t(){}return function(n){var r;return t.prototype=n,r=new t,t.prototype=null,r}}(),c={},f=c.lib={},u=f.Base={extend:function(t){var n=a(this);return t&&n.mixIn(t),n.hasOwnProperty("init")&&this.init!==n.init||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var n in t)t.hasOwnProperty(n)&&(this[n]=t[n]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},h=f.WordArray=u.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=i?n:4*t.length},toString:function(t){return(t||d).stringify(this)},concat:function(t){var n=this.words,r=t.words,e=this.sigBytes,i=t.sigBytes;if(this.clamp(),e%4)for(var o=0;o<i;o++){var s=r[o>>>2]>>>24-o%4*8&255;n[e+o>>>2]|=s<<24-(e+o)%4*8}else for(var a=0;a<i;a+=4)n[e+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var t=u.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var n=[],r=0;r<t;r+=4)n.push(s());return new h.init(n,t)}}),p=c.enc={},d=p.Hex={stringify:function(t){for(var n=t.words,r=t.sigBytes,e=[],i=0;i<r;i++){var o=n[i>>>2]>>>24-i%4*8&255;e.push((o>>>4).toString(16)),e.push((15&o).toString(16))}return e.join("")},parse:function(t){for(var n=t.length,r=[],e=0;e<n;e+=2)r[e>>>3]|=parseInt(t.substr(e,2),16)<<24-e%8*4;return new h.init(r,n/2)}},l=p.Latin1={stringify:function(t){for(var n=t.words,r=t.sigBytes,e=[],i=0;i<r;i++){var o=n[i>>>2]>>>24-i%4*8&255;e.push(String.fromCharCode(o))}return e.join("")},parse:function(t){for(var n=t.length,r=[],e=0;e<n;e++)r[e>>>2]|=(255&t.charCodeAt(e))<<24-e%4*8;return new h.init(r,n)}},y=p.Utf8={stringify:function(t){try{return decodeURIComponent(escape(l.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return l.parse(unescape(encodeURIComponent(t)))}},g=f.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new h.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=y.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var n,r=this._data,i=r.words,o=r.sigBytes,s=this.blockSize,a=o/(4*s),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,f=e.min(4*c,o);if(c){for(var u=0;u<c;u+=s)this._doProcessBlock(i,u);n=i.splice(0,c),r.sigBytes-=f}return new h.init(n,f)},clone:function(){var t=u.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});f.Hasher=g.extend({cfg:u.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){g.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(n,r){return new t.init(r).finalize(n)}},_createHmacHelper:function(t){return function(n,r){return new w.HMAC.init(t,r).finalize(n)}}});var w=c.algo={};return c}(Math),o)),i.exports;var o}var s,a={exports:{}};function c(){return s?a.exports:(s=1,a.exports=(t=o(),function(n){var r=t,e=r.lib,i=e.WordArray,o=e.Hasher,s=r.algo,a=[],c=[];!function(){function t(t){for(var r=n.sqrt(t),e=2;e<=r;e++)if(!(t%e))return!1;return!0}function r(t){return 4294967296*(t-(0|t))|0}for(var e=2,i=0;i<64;)t(e)&&(i<8&&(a[i]=r(n.pow(e,.5))),c[i]=r(n.pow(e,1/3)),i++),e++}();var f=[],u=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(t,n){for(var r=this._hash.words,e=r[0],i=r[1],o=r[2],s=r[3],a=r[4],u=r[5],h=r[6],p=r[7],d=0;d<64;d++){if(d<16)f[d]=0|t[n+d];else{var l=f[d-15],y=(l<<25|l>>>7)^(l<<14|l>>>18)^l>>>3,g=f[d-2],w=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;f[d]=y+f[d-7]+w+f[d-16]}var v=e&i^e&o^i&o,m=(e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22),_=p+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&u^~a&h)+c[d]+f[d];p=h,h=u,u=a,a=s+_|0,s=o,o=i,i=e,e=_+(m+v)|0}r[0]=r[0]+e|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+u|0,r[6]=r[6]+h|0,r[7]=r[7]+p|0},_doFinalize:function(){var t=this._data,r=t.words,e=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=n.floor(e/4294967296),r[15+(i+64>>>9<<4)]=e,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});r.SHA256=o._createHelper(u),r.HmacSHA256=o._createHmacHelper(u)}(Math),t.SHA256));var t}export{c as a,o as r};
@@ -1 +1 @@
1
- import{getAddress as t}from"@ethersproject/address";import{hexZeroPad as r,hexConcat as n,isHexString as e,hexlify as o,arrayify as i}from"@ethersproject/bytes";import{L as s,B as a,k as c}from"./index-8d387984.js";import{defineReadOnly as f,deepCopy as u,shallowCopy as h}from"@ethersproject/properties";import{i as m}from"./id-b18759a6.js";const y="hash/5.7.0";var p=function(t,r,n,e){return new(n||(n=Promise))((function(o,i){function s(t){try{c(e.next(t))}catch(t){i(t)}}function a(t){try{c(e.throw(t))}catch(t){i(t)}}function c(t){var r;t.done?o(t.value):(r=t.value,r instanceof n?r:new n((function(t){t(r)}))).then(s,a)}c((e=e.apply(t,r||[])).next())}))};const d=new s(y),g=new Uint8Array(32);g.fill(0);const l=a.from(-1),v=a.from(0),w=a.from(1),E=a.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const A=r(w.toHexString(),32),b=r(v.toHexString(),32),$={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},x=["name","version","chainId","verifyingContract","salt"];function S(t){return function(r){return"string"!=typeof r&&d.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,r),r}}const C={name:S("name"),version:S("version"),chainId:function(t){try{return a.from(t).toString()}catch(t){}return d.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(r){try{return t(r).toLowerCase()}catch(t){}return d.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",r)},salt:function(t){try{const r=i(t);if(32!==r.length)throw new Error("bad length");return o(r)}catch(t){}return d.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function O(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const n=""===t[1],o=parseInt(t[2]||"256");(o%8!=0||o>256||t[2]&&t[2]!==String(o))&&d.throwArgumentError("invalid numeric width","type",e);const i=E.mask(n?o-1:o),s=n?i.add(w).mul(l):v;return function(t){const n=a.from(t);return(n.lt(s)||n.gt(i))&&d.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),r(n.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&d.throwArgumentError("invalid bytes width","type",e),function(t){return i(t).length!==r&&d.throwArgumentError(`invalid length for ${e}`,"value",t),function(t){const r=i(t),e=r.length%32;return e?n([r,g.slice(e)]):o(r)}(t)}}}switch(e){case"address":return function(n){return r(t(n),32)};case"bool":return function(t){return t?A:b};case"bytes":return function(t){return c(t)};case"string":return function(t){return m(t)}}return null}function I(t,r){return`${t}(${r.map((({name:t,type:r})=>r+" "+t)).join(",")})`}class _{constructor(t){f(this,"types",Object.freeze(u(t))),f(this,"_encoderCache",{}),f(this,"_types",{});const r={},n={},e={};Object.keys(t).forEach((t=>{r[t]={},n[t]=[],e[t]={}}));for(const e in t){const o={};t[e].forEach((i=>{o[i.name]&&d.throwArgumentError(`duplicate variable name ${JSON.stringify(i.name)} in ${JSON.stringify(e)}`,"types",t),o[i.name]=!0;const s=i.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===e&&d.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);O(s)||(n[s]||d.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),n[s].push(e),r[e][s]=!0)}))}const o=Object.keys(n).filter((t=>0===n[t].length));0===o.length?d.throwArgumentError("missing primary type","types",t):o.length>1&&d.throwArgumentError(`ambiguous primary types or unused types: ${o.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),f(this,"primaryType",o[0]),function o(i,s){s[i]&&d.throwArgumentError(`circular type reference to ${JSON.stringify(i)}`,"types",t),s[i]=!0,Object.keys(r[i]).forEach((t=>{n[t]&&(o(t,s),Object.keys(s).forEach((r=>{e[r][t]=!0})))})),delete s[i]}(this.primaryType,{});for(const r in e){const n=Object.keys(e[r]);n.sort(),this._types[r]=I(r,t[r])+n.map((r=>I(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=O(t);if(r)return r}const r=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const t=r[1],e=this.getEncoder(t),o=parseInt(r[3]);return r=>{o>=0&&r.length!==o&&d.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r);let i=r.map(e);return this._types[t]&&(i=i.map(c)),c(n(i))}}const e=this.types[t];if(e){const r=m(this._types[t]);return t=>{const o=e.map((({name:r,type:n})=>{const e=this.getEncoder(n)(t[r]);return this._types[n]?c(e):e}));return o.unshift(r),n(o)}}return d.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const r=this._types[t];return r||d.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),r}encodeData(t,r){return this.getEncoder(t)(r)}hashStruct(t,r){return c(this.encodeData(t,r))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,r,n){if(O(t))return n(t,r);const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],o=parseInt(e[3]);return o>=0&&r.length!==o&&d.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map((r=>this._visit(t,r,n)))}const o=this.types[t];return o?o.reduce(((t,{name:e,type:o})=>(t[e]=this._visit(o,r[e],n),t)),{}):d.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,r){return this._visit(this.primaryType,t,r)}static from(t){return new _(t)}static getPrimaryType(t){return _.from(t).primaryType}static hashStruct(t,r,n){return _.from(r).hashStruct(t,n)}static hashDomain(t){const r=[];for(const n in t){const e=$[n];e||d.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",t),r.push({name:n,type:e})}return r.sort(((t,r)=>x.indexOf(t.name)-x.indexOf(r.name))),_.hashStruct("EIP712Domain",{EIP712Domain:r},t)}static encode(t,r,e){return n(["0x1901",_.hashDomain(t),_.from(r).hash(e)])}static hash(t,r,n){return c(_.encode(t,r,n))}static resolveNames(t,r,n,o){return p(this,void 0,void 0,(function*(){t=h(t);const i={};t.verifyingContract&&!e(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const s=_.from(r);s.visit(n,((t,r)=>("address"!==t||e(r,20)||(i[r]="0x"),r)));for(const t in i)i[t]=yield o(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),n=s.visit(n,((t,r)=>"address"===t&&i[r]?i[r]:r)),{domain:t,value:n}}))}static getPayload(t,r,n){_.hashDomain(t);const e={},s=[];x.forEach((r=>{const n=t[r];null!=n&&(e[r]=C[r](n),s.push({name:r,type:$[r]}))}));const c=_.from(r),f=h(r);return f.EIP712Domain?d.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):f.EIP712Domain=s,c.encode(n),{types:f,domain:e,primaryType:c.primaryType,message:c.visit(n,((t,r)=>{if(t.match(/^bytes(\d*)/))return o(i(r));if(t.match(/^u?int/))return a.from(r).toString();switch(t){case"address":return r.toLowerCase();case"bool":return!!r;case"string":return"string"!=typeof r&&d.throwArgumentError("invalid string","value",r),r}return d.throwArgumentError("unsupported type","type",t)}))}}}export{_ as T,y as v};
1
+ import{getAddress as t}from"@ethersproject/address";import{hexZeroPad as r,hexConcat as n,isHexString as e,hexlify as o,arrayify as i}from"@ethersproject/bytes";import{L as s,B as a,k as c}from"./index-9534d8ad.js";import{defineReadOnly as f,deepCopy as u,shallowCopy as h}from"@ethersproject/properties";import{i as m}from"./id-cdf2dadd.js";const y="hash/5.7.0";var p=function(t,r,n,e){return new(n||(n=Promise))((function(o,i){function s(t){try{c(e.next(t))}catch(t){i(t)}}function a(t){try{c(e.throw(t))}catch(t){i(t)}}function c(t){var r;t.done?o(t.value):(r=t.value,r instanceof n?r:new n((function(t){t(r)}))).then(s,a)}c((e=e.apply(t,r||[])).next())}))};const d=new s(y),g=new Uint8Array(32);g.fill(0);const l=a.from(-1),v=a.from(0),w=a.from(1),E=a.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const A=r(w.toHexString(),32),$=r(v.toHexString(),32),b={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},x=["name","version","chainId","verifyingContract","salt"];function S(t){return function(r){return"string"!=typeof r&&d.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,r),r}}const C={name:S("name"),version:S("version"),chainId:function(t){try{return a.from(t).toString()}catch(t){}return d.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(r){try{return t(r).toLowerCase()}catch(t){}return d.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",r)},salt:function(t){try{const r=i(t);if(32!==r.length)throw new Error("bad length");return o(r)}catch(t){}return d.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function O(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const n=""===t[1],o=parseInt(t[2]||"256");(o%8!=0||o>256||t[2]&&t[2]!==String(o))&&d.throwArgumentError("invalid numeric width","type",e);const i=E.mask(n?o-1:o),s=n?i.add(w).mul(l):v;return function(t){const n=a.from(t);return(n.lt(s)||n.gt(i))&&d.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),r(n.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&d.throwArgumentError("invalid bytes width","type",e),function(t){return i(t).length!==r&&d.throwArgumentError(`invalid length for ${e}`,"value",t),function(t){const r=i(t),e=r.length%32;return e?n([r,g.slice(e)]):o(r)}(t)}}}switch(e){case"address":return function(n){return r(t(n),32)};case"bool":return function(t){return t?A:$};case"bytes":return function(t){return c(t)};case"string":return function(t){return m(t)}}return null}function I(t,r){return`${t}(${r.map((({name:t,type:r})=>r+" "+t)).join(",")})`}class _{constructor(t){f(this,"types",Object.freeze(u(t))),f(this,"_encoderCache",{}),f(this,"_types",{});const r={},n={},e={};Object.keys(t).forEach((t=>{r[t]={},n[t]=[],e[t]={}}));for(const e in t){const o={};t[e].forEach((i=>{o[i.name]&&d.throwArgumentError(`duplicate variable name ${JSON.stringify(i.name)} in ${JSON.stringify(e)}`,"types",t),o[i.name]=!0;const s=i.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===e&&d.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);O(s)||(n[s]||d.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),n[s].push(e),r[e][s]=!0)}))}const o=Object.keys(n).filter((t=>0===n[t].length));0===o.length?d.throwArgumentError("missing primary type","types",t):o.length>1&&d.throwArgumentError(`ambiguous primary types or unused types: ${o.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),f(this,"primaryType",o[0]),function o(i,s){s[i]&&d.throwArgumentError(`circular type reference to ${JSON.stringify(i)}`,"types",t),s[i]=!0,Object.keys(r[i]).forEach((t=>{n[t]&&(o(t,s),Object.keys(s).forEach((r=>{e[r][t]=!0})))})),delete s[i]}(this.primaryType,{});for(const r in e){const n=Object.keys(e[r]);n.sort(),this._types[r]=I(r,t[r])+n.map((r=>I(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=O(t);if(r)return r}const r=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const t=r[1],e=this.getEncoder(t),o=parseInt(r[3]);return r=>{o>=0&&r.length!==o&&d.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r);let i=r.map(e);return this._types[t]&&(i=i.map(c)),c(n(i))}}const e=this.types[t];if(e){const r=m(this._types[t]);return t=>{const o=e.map((({name:r,type:n})=>{const e=this.getEncoder(n)(t[r]);return this._types[n]?c(e):e}));return o.unshift(r),n(o)}}return d.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const r=this._types[t];return r||d.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),r}encodeData(t,r){return this.getEncoder(t)(r)}hashStruct(t,r){return c(this.encodeData(t,r))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,r,n){if(O(t))return n(t,r);const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],o=parseInt(e[3]);return o>=0&&r.length!==o&&d.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map((r=>this._visit(t,r,n)))}const o=this.types[t];return o?o.reduce(((t,{name:e,type:o})=>(t[e]=this._visit(o,r[e],n),t)),{}):d.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,r){return this._visit(this.primaryType,t,r)}static from(t){return new _(t)}static getPrimaryType(t){return _.from(t).primaryType}static hashStruct(t,r,n){return _.from(r).hashStruct(t,n)}static hashDomain(t){const r=[];for(const n in t){const e=b[n];e||d.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",t),r.push({name:n,type:e})}return r.sort(((t,r)=>x.indexOf(t.name)-x.indexOf(r.name))),_.hashStruct("EIP712Domain",{EIP712Domain:r},t)}static encode(t,r,e){return n(["0x1901",_.hashDomain(t),_.from(r).hash(e)])}static hash(t,r,n){return c(_.encode(t,r,n))}static resolveNames(t,r,n,o){return p(this,void 0,void 0,(function*(){t=h(t);const i={};t.verifyingContract&&!e(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const s=_.from(r);s.visit(n,((t,r)=>("address"!==t||e(r,20)||(i[r]="0x"),r)));for(const t in i)i[t]=yield o(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),n=s.visit(n,((t,r)=>"address"===t&&i[r]?i[r]:r)),{domain:t,value:n}}))}static getPayload(t,r,n){_.hashDomain(t);const e={},s=[];x.forEach((r=>{const n=t[r];null!=n&&(e[r]=C[r](n),s.push({name:r,type:b[r]}))}));const c=_.from(r),f=h(r);return f.EIP712Domain?d.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):f.EIP712Domain=s,c.encode(n),{types:f,domain:e,primaryType:c.primaryType,message:c.visit(n,((t,r)=>{if(t.match(/^bytes(\d*)/))return o(i(r));if(t.match(/^u?int/))return a.from(r).toString();switch(t){case"address":return r.toLowerCase();case"bool":return!!r;case"string":return"string"!=typeof r&&d.throwArgumentError("invalid string","value",r),r}return d.throwArgumentError("unsupported type","type",t)}))}}}export{_ as T,y as v};