@human.tech/waap-sdk 2.4.0 → 2.4.2-staging-416db8

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 (83) hide show
  1. package/.agent/SKILL.md +28 -13
  2. package/CHANGELOG.md +84 -0
  3. package/README.md +16 -2
  4. package/dist/SolanaProvider-BKWKXTWh.mjs +1 -0
  5. package/dist/SolanaProvider-Uv3q1b0H.js +1 -0
  6. package/dist/UIMessageManager-4xqSTTBS.d.mts +11 -0
  7. package/dist/UIMessageManager-4xqSTTBS.d.ts +11 -0
  8. package/dist/UIMessageManager-CPw6PggC.js +1 -0
  9. package/dist/UIMessageManager-D3VN9vM8.mjs +1 -0
  10. package/dist/{WaaPError-BuwfZjBk.d.mts → WaaPError-C2TOEGPx.d.mts} +1 -1
  11. package/dist/{WaaPError-BuwfZjBk.d.ts → WaaPError-C2TOEGPx.d.ts} +1 -1
  12. package/dist/{WalletConnect-Dn40Omgo.js → WalletConnect-B21f4Vvh.js} +1 -1
  13. package/dist/{WalletConnect-UfxGn2M_.mjs → WalletConnect-DXiTxC-F.mjs} +1 -1
  14. package/dist/{WalletModalController-Qh9LNwW5.d.ts → WalletModalController-16mHsFv2.d.ts} +1 -1
  15. package/dist/{WalletModalController-wIHBGOVd.d.mts → WalletModalController-DxiBiqDf.d.mts} +1 -1
  16. package/dist/bridge.d.mts +3 -3
  17. package/dist/bridge.d.ts +3 -3
  18. package/dist/bridge.js +1 -1
  19. package/dist/bridge.mjs +1 -1
  20. package/dist/evm-BbSgL_Hv.mjs +2 -0
  21. package/dist/evm-_ReyhrCP.js +2 -0
  22. package/dist/evm.d.mts +3 -3
  23. package/dist/evm.d.ts +3 -3
  24. package/dist/evm.js +1 -1
  25. package/dist/evm.mjs +1 -1
  26. package/dist/{index-XdQjHMzI.d.mts → index-BOExImk3.d.mts} +29 -11
  27. package/dist/{index-DNyKwJcJ.d.ts → index-BkKBZpqc.d.ts} +29 -11
  28. package/dist/index.d.mts +12 -10
  29. package/dist/index.d.ts +12 -10
  30. package/dist/index.js +3 -3
  31. package/dist/index.mjs +3 -3
  32. package/dist/init-BljRyI7Q.mjs +1 -0
  33. package/dist/init-C-52fEJS.d.ts +84 -0
  34. package/dist/init-C3zCj5Lc.d.mts +84 -0
  35. package/dist/init-IB0dPXBp.js +1 -0
  36. package/dist/react.d.mts +1 -1
  37. package/dist/react.d.ts +1 -1
  38. package/dist/{register-CMv6n7ak.d.ts → register-BKCJXsHB.d.mts} +9 -6
  39. package/dist/{register-DfUAOQke.d.mts → register-C1hFwh4A.d.ts} +4 -3
  40. package/dist/register-CLsRV5W0.mjs +1 -0
  41. package/dist/register-CpvrhMCx.js +1 -0
  42. package/dist/register-DN1lfMSy.mjs +1 -0
  43. package/dist/register-DpEJlZIw.js +1 -0
  44. package/dist/{register-BhybMFR2.d.mts → register-GiWQpcBY.d.ts} +9 -6
  45. package/dist/{register-MK9ivXiJ.d.ts → register-mq9fTaSt.d.mts} +4 -3
  46. package/dist/solana.d.mts +6 -6
  47. package/dist/solana.d.ts +6 -6
  48. package/dist/solana.js +1 -1
  49. package/dist/solana.mjs +1 -1
  50. package/dist/stellar.d.mts +6 -0
  51. package/dist/stellar.d.ts +6 -0
  52. package/dist/stellar.js +1 -0
  53. package/dist/stellar.mjs +1 -0
  54. package/dist/sui.d.mts +5 -5
  55. package/dist/sui.d.ts +5 -5
  56. package/dist/sui.js +1 -1
  57. package/dist/sui.mjs +1 -1
  58. package/dist/types-Bai14yLc.d.mts +95 -0
  59. package/dist/{types-8CCmbLuY.d.ts → types-Bj5dDE-C.d.ts} +10 -3
  60. package/dist/{types-Bfz205sD.d.mts → types-C7JDjWnt.d.mts} +10 -3
  61. package/dist/{types-x7TOncUp.d.mts → types-Cc6tc4ut.d.mts} +5 -0
  62. package/dist/{types-x7TOncUp.d.ts → types-Cc6tc4ut.d.ts} +5 -0
  63. package/dist/types-DqdVfkaW.d.ts +95 -0
  64. package/dist/ui-D4wp1W_E.js +1 -0
  65. package/dist/ui-DSsOjby7.mjs +1 -0
  66. package/dist/{useWaapAuth-CMhYoBKA.d.mts → useWaapAuth-Be1YJk-7.d.mts} +2 -2
  67. package/dist/{useWaapAuth-CeJuu2wk.d.ts → useWaapAuth-DSFDwJtt.d.ts} +2 -2
  68. package/dist/walletconnect.js +1 -1
  69. package/dist/walletconnect.mjs +1 -1
  70. package/docs/solana-wallet-adapter.md +157 -0
  71. package/package.json +9 -2
  72. package/dist/SolanaProvider-CxJX9Dzo.js +0 -1
  73. package/dist/SolanaProvider-CygEwKg1.mjs +0 -1
  74. package/dist/evm-64xq-c4L.js +0 -2
  75. package/dist/evm-ChOfSh-X.mjs +0 -2
  76. package/dist/initializerContext-DB5E2A6s.d.mts +0 -20
  77. package/dist/initializerContext-Z7JeZRsm.d.ts +0 -20
  78. package/dist/register-BAygaKgr.mjs +0 -1
  79. package/dist/register-CdSpQr2m.js +0 -1
  80. package/dist/register-CoFt8w20.mjs +0 -1
  81. package/dist/register-DEFLr1aE.js +0 -1
  82. package/dist/ui-Bd49qoIs.js +0 -1
  83. package/dist/ui-CI7vln8d.mjs +0 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./evm-64xq-c4L.js"),t=require("./asyncSigning-B0KrmKk7.js"),n=require("./ui-Bd49qoIs.js"),r=require("./SolanaProvider-CxJX9Dzo.js"),i=require("./WalletConnect-Dn40Omgo.js"),a=require("./register-DEFLr1aE.js"),o=require("./register-CdSpQr2m.js"),s=require("./useWaapAuth-C9Cwu4XG.js");let c=require("events");var l=class extends c.EventEmitter{constructor(t){super(),this.isSilk=!0,this.connected=!1,this.config={...e.i,...t||{}}}sendToExtension(e){return new Promise((t,n)=>{window.postMessage({type:`FROM_PAGE`,request:e},`*`),window.addEventListener(`message`,e=>{e.data.type===`FROM_EXTENSION`&&(e.data.error?n(e.data.error):t(e.data.result))})})}async request(t){if(!Object.keys(e.D).includes(t.method))return Promise.reject({error:`Not implemented (${t.method})`});let n=await this.sendToExtension(t);return(t.method===e.D.wallet_switchEthereumChain||t.method===e.D.wallet_addEthereumChain)&&n===null&&this.emit(`chainChanged`,t.params?.[0]?.chainId),n}async enable(){return this.request({method:`eth_requestAccounts`})}isConnected(){return this.connected}async login(){return this.sendToExtension({method:e.O.login})}async requestSBT(t){return this.sendToExtension({method:e.O.silk_requestSbt,params:[t]})}async toggleDarkMode(){this.config.styles.darkMode=!this.config.styles.darkMode,await this.sendToExtension({method:e.O.set_custom_config,params:[this.config]})}async safe(){return this.sendToExtension({method:e.O.safe})}};
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./UIMessageManager-CPw6PggC.js"),t=require("./asyncSigning-B0KrmKk7.js"),n=require("./ui-D4wp1W_E.js"),r=require("./SolanaProvider-Uv3q1b0H.js"),i=require("./init-IB0dPXBp.js"),a=require("./evm-_ReyhrCP.js"),o=require("./WalletConnect-B21f4Vvh.js"),s=require("./register-CpvrhMCx.js"),c=require("./register-DpEJlZIw.js"),l=require("./useWaapAuth-C9Cwu4XG.js");let u=require("events");var d=class extends u.EventEmitter{constructor(e){super(),this.isSilk=!0,this.connected=!1,this.config={...a.i,...e||{}}}sendToExtension(e){return new Promise((t,n)=>{window.postMessage({type:`FROM_PAGE`,request:e},`*`),window.addEventListener(`message`,e=>{e.data.type===`FROM_EXTENSION`&&(e.data.error?n(e.data.error):t(e.data.result))})})}async request(t){if(!Object.keys(e.C).includes(t.method))return Promise.reject({error:`Not implemented (${t.method})`});let n=await this.sendToExtension(t);return(t.method===e.C.wallet_switchEthereumChain||t.method===e.C.wallet_addEthereumChain)&&n===null&&this.emit(`chainChanged`,t.params?.[0]?.chainId),n}async enable(){return this.request({method:`eth_requestAccounts`})}isConnected(){return this.connected}async login(){return this.sendToExtension({method:e.w.login})}async requestSBT(t){return this.sendToExtension({method:e.w.silk_requestSbt,params:[t]})}async toggleDarkMode(){this.config.styles.darkMode=!this.config.styles.darkMode,await this.sendToExtension({method:e.w.set_custom_config,params:[this.config]})}async safe(){return this.sendToExtension({method:e.w.safe})}};
2
2
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3
- function u(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function d(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function f(e,...t){if(!u(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function p(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function m(e,t){f(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function ee(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function h(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function g(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function _(e,t){return e<<32-t|e>>>t}const te=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function ne(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function re(e){for(let t=0;t<e.length;t++)e[t]=ne(e[t]);return e}const v=te?e=>e:re,ie=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,ae=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function oe(e){if(f(e),ie)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=ae[e[n]];return t}function y(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function b(e){return typeof e==`string`&&(e=y(e)),f(e),e}var x=class{};function S(e){let t=t=>e().update(b(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function se(e){if(e.length>=255)throw TypeError(`Alphabet too long`);let t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let n=0;n<e.length;n++){let r=e.charAt(n),i=r.charCodeAt(0);if(t[i]!==255)throw TypeError(r+` is ambiguous`);t[i]=n}let n=e.length,r=e.charAt(0),i=Math.log(n)/Math.log(256),a=Math.log(256)/Math.log(n);function o(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError(`Expected Uint8Array`);if(t.length===0)return``;let i=0,o=0,s=0,c=t.length;for(;s!==c&&t[s]===0;)s++,i++;let l=(c-s)*a+1>>>0,u=new Uint8Array(l);for(;s!==c;){let e=t[s],r=0;for(let t=l-1;(e!==0||r<o)&&t!==-1;t--,r++)e+=256*u[t]>>>0,u[t]=e%n>>>0,e=e/n>>>0;if(e!==0)throw Error(`Non-zero carry`);o=r,s++}let d=l-o;for(;d!==l&&u[d]===0;)d++;let f=r.repeat(i);for(;d<l;++d)f+=e.charAt(u[d]);return f}function s(e){if(typeof e!=`string`)throw TypeError(`Expected String`);if(e.length===0)return new Uint8Array;let a=0,o=0,s=0;for(;e[a]===r;)o++,a++;let c=(e.length-a)*i+1>>>0,l=new Uint8Array(c);for(;a<e.length;){let r=e.charCodeAt(a);if(r>255)return;let i=t[r];if(i===255)return;let o=0;for(let e=c-1;(i!==0||o<s)&&e!==-1;e--,o++)i+=n*l[e]>>>0,l[e]=i%256>>>0,i=i/256>>>0;if(i!==0)throw Error(`Non-zero carry`);s=o,a++}let u=c-s;for(;u!==c&&l[u]===0;)u++;let d=new Uint8Array(o+(c-u)),f=o;for(;u!==c;)d[f++]=l[u++];return d}function c(e){let t=s(e);if(t)return t;throw Error(`Non-base`+n+` character`)}return{encode:o,decodeUnsafe:s,decode:c}}var C=se(`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`);function ce(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function le(e,t,n){return e&t^~e&n}function ue(e,t,n){return e&t^e&n^t&n}var de=class extends x{constructor(e,t,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=g(this.buffer)}update(e){p(this),e=b(e),f(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=g(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){p(this),m(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,h(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;ce(n,r-8,BigInt(this.length*8),i),this.process(n,0);let o=g(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen should be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=r,e.pos=o,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}};const w=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),T=BigInt(2**32-1),E=BigInt(32);function fe(e,t=!1){return t?{h:Number(e&T),l:Number(e>>E&T)}:{h:Number(e>>E&T)|0,l:Number(e&T)|0}}function pe(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=fe(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}const me=(e,t,n)=>e<<n|t>>>32-n,he=(e,t,n)=>t<<n|e>>>32-n,ge=(e,t,n)=>t<<n-32|e>>>64-n,_e=(e,t,n)=>e<<n-32|t>>>64-n,ve=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),D=new Uint32Array(64);var ye=class extends de{constructor(e=32){super(64,e,8,!1),this.A=w[0]|0,this.B=w[1]|0,this.C=w[2]|0,this.D=w[3]|0,this.E=w[4]|0,this.F=w[5]|0,this.G=w[6]|0,this.H=w[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)D[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=D[e-15],n=D[e-2],r=_(t,7)^_(t,18)^t>>>3,i=_(n,17)^_(n,19)^n>>>10;D[e]=i+D[e-7]+r+D[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=_(o,6)^_(o,11)^_(o,25),u=l+t+le(o,s,c)+ve[e]+D[e]|0,d=(_(n,2)^_(n,13)^_(n,22))+ue(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){h(D)}destroy(){this.set(0,0,0,0,0,0,0,0),h(this.buffer)}};const O=S(()=>new ye);function be(e,t){return e.exec(t)?.groups}const k=/^tuple(?<array>(\[(\d*)\])*)$/;function A(e){let t=e.type;if(k.test(e.type)&&`components`in e){t=`(`;let n=e.components.length;for(let r=0;r<n;r++){let i=e.components[r];t+=A(i),r<n-1&&(t+=`, `)}let r=be(k,e.type);return t+=`)${r?.array||``}`,A({...e,type:t})}return`indexed`in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function j(e){let t=``,n=e.length;for(let r=0;r<n;r++){let i=e[r];t+=A(i),r!==n-1&&(t+=`, `)}return t}function xe(e){return e.type===`function`?`function ${e.name}(${j(e.inputs)})${e.stateMutability&&e.stateMutability!==`nonpayable`?` ${e.stateMutability}`:``}${e.outputs?.length?` returns (${j(e.outputs)})`:``}`:e.type===`event`?`event ${e.name}(${j(e.inputs)})`:e.type===`error`?`error ${e.name}(${j(e.inputs)})`:e.type===`constructor`?`constructor(${j(e.inputs)})${e.stateMutability===`payable`?` payable`:``}`:e.type===`fallback`?`fallback() external${e.stateMutability===`payable`?` payable`:``}`:`receive() external payable`}function M(e,{strict:t=!0}={}){return!e||typeof e!=`string`?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith(`0x`)}function N(e){return M(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const P=`2.55.2`;let F={getDocsUrl:({docsBaseUrl:e,docsPath:t=``,docsSlug:n})=>t?`${e??`https://viem.sh`}${t}${n?`#${n}`:``}`:void 0,version:`viem@${P}`};var I=class e extends Error{constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof e&&n.cause.docsPath||n.docsPath,a=F.getDocsUrl?.({...n,docsPath:i}),o=[t||`An error occurred.`,``,...n.metaMessages?[...n.metaMessages,``]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...F.version?[`Version: ${F.version}`]:[]].join(`
4
- `);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`BaseError`}),this.details=r,this.docsPath=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=P}walk(e){return L(this,e)}};function L(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?L(e.cause,t):t?null:e}var R=class extends I{constructor({offset:e,position:t,size:n}){super(`Slice ${t===`start`?`starting`:`ending`} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:`SliceOffsetOutOfBoundsError`})}},z=class extends I{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:`SizeExceedsPaddingSizeError`})}};function B(e,{dir:t,size:n=32}={}){return typeof e==`string`?Se(e,{dir:t,size:n}):Ce(e,{dir:t,size:n})}function Se(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace(`0x`,``);if(r.length>n*2)throw new z({size:Math.ceil(r.length/2),targetSize:n,type:`hex`});return`0x${r[t===`right`?`padEnd`:`padStart`](n*2,`0`)}`}function Ce(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new z({size:e.length,targetSize:n,type:`bytes`});let r=new Uint8Array(n);for(let i=0;i<n;i++){let a=t===`right`;r[a?i:n-i-1]=e[a?i:e.length-i-1]}return r}var we=class extends I{constructor({max:e,min:t,signed:n,size:r,value:i}){super(`Number "${i}" is not in safe ${r?`${r*8}-bit ${n?`signed`:`unsigned`} `:``}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:`IntegerOutOfRangeError`})}},Te=class extends I{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:`SizeOverflowError`})}};function V(e,{size:t}){if(N(e)>t)throw new Te({givenSize:N(e),maxSize:t})}const Ee=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function De(e,t={}){return typeof e==`number`||typeof e==`bigint`?U(e,t):typeof e==`string`?Ae(e,t):typeof e==`boolean`?Oe(e,t):H(e,t)}function Oe(e,t={}){let n=`0x${Number(e)}`;return typeof t.size==`number`?(V(n,{size:t.size}),B(n,{size:t.size})):n}function H(e,t={}){let n=``;for(let t=0;t<e.length;t++)n+=Ee[e[t]];let r=`0x${n}`;return typeof t.size==`number`?(V(r,{size:t.size}),B(r,{dir:`right`,size:t.size})):r}function U(e,t={}){let{signed:n,size:r}=t,i=BigInt(e),a;r?a=n?(1n<<BigInt(r)*8n-1n)-1n:2n**(BigInt(r)*8n)-1n:typeof e==`number`&&(a=BigInt(2**53-1));let o=typeof a==`bigint`&&n?-a-1n:0;if(a&&i>a||i<o){let t=typeof e==`bigint`?`n`:``;throw new we({max:a?`${a}${t}`:void 0,min:`${o}${t}`,signed:n,size:r,value:`${e}${t}`})}let s=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?B(s,{size:r}):s}const ke=new TextEncoder;function Ae(e,t={}){return H(ke.encode(e),t)}const je=new TextEncoder;function W(e,t={}){return typeof e==`number`||typeof e==`bigint`?Ne(e,t):typeof e==`boolean`?Me(e,t):M(e)?q(e,t):J(e,t)}function Me(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size==`number`?(V(n,{size:t.size}),B(n,{size:t.size})):n}const G={zero:48,nine:57,A:65,F:70,a:97,f:102};function K(e){if(e>=G.zero&&e<=G.nine)return e-G.zero;if(e>=G.A&&e<=G.F)return e-(G.A-10);if(e>=G.a&&e<=G.f)return e-(G.a-10)}function q(e,t={}){let n=e;t.size&&(V(n,{size:t.size}),n=B(n,{dir:`right`,size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);let i=r.length/2,a=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let n=K(r.charCodeAt(t++)),i=K(r.charCodeAt(t++));if(n===void 0||i===void 0)throw new I(`Invalid byte sequence ("${r[t-2]}${r[t-1]}" in "${r}").`);a[e]=n*16+i}return a}function Ne(e,t){return q(U(e,t))}function J(e,t={}){let n=je.encode(e);return typeof t.size==`number`?(V(n,{size:t.size}),B(n,{dir:`right`,size:t.size})):n}const Pe=BigInt(0),Y=BigInt(1),Fe=BigInt(2),Ie=BigInt(7),Le=BigInt(256),Re=BigInt(113),X=[],ze=[],Be=[];for(let e=0,t=Y,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],X.push(2*(5*r+n)),ze.push((e+1)*(e+2)/2%64);let i=Pe;for(let e=0;e<7;e++)t=(t<<Y^(t>>Ie)*Re)%Le,t&Fe&&(i^=Y<<(Y<<BigInt(e))-Y);Be.push(i)}const Ve=pe(Be,!0),He=Ve[0],Ue=Ve[1],We=(e,t,n)=>n>32?ge(e,t,n):me(e,t,n),Ge=(e,t,n)=>n>32?_e(e,t,n):he(e,t,n);function Ke(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let r=(t+8)%10,i=(t+2)%10,a=n[i],o=n[i+1],s=We(a,o,1)^n[r],c=Ge(a,o,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=ze[n],a=We(t,i,r),o=Ge(t,i,r),s=X[n];t=e[s],i=e[s+1],e[s]=a,e[s+1]=o}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=He[r],e[1]^=Ue[r]}h(n)}var qe=class e extends x{constructor(e,t,n,r=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,d(n),!(0<e&&e<200))throw Error(`only keccak-f1600 function is supported`);this.state=new Uint8Array(200),this.state32=ee(this.state)}clone(){return this._cloneInto()}keccak(){v(this.state32),Ke(this.state32,this.rounds),v(this.state32),this.posOut=0,this.pos=0}update(e){p(this),e=b(e),f(e);let{blockLen:t,state:n}=this,r=e.length;for(let i=0;i<r;){let a=Math.min(t-this.pos,r-i);for(let t=0;t<a;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,t&128&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){p(this,!1),f(e),this.finish();let t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw Error(`XOF is not possible for this instance`);return this.writeInto(e)}xof(e){return d(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(m(e,this),this.finished)throw Error(`digest() was already called`);return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,h(this.state)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:i,rounds:a,enableXOF:o}=this;return t||=new e(n,r,i,o,a),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const Je=((e,t,n)=>S(()=>new qe(t,e,n)))(1,136,256/8);function Ye(e,t){let n=t||`hex`,r=Je(M(e,{strict:!1})?W(e):e);return n===`bytes`?r:De(r)}const Xe=e=>Ye(W(e));function Ze(e){return Xe(e)}function Qe(e){let t=!0,n=``,r=0,i=``,a=!1;for(let o=0;o<e.length;o++){let s=e[o];if([`(`,`)`,`,`].includes(s)&&(t=!0),s===`(`&&r++,s===`)`&&r--,t){if(r===0){if(s===` `&&[`event`,`function`,``].includes(i))i=``;else if(i+=s,s===`)`){a=!0;break}continue}if(s===` `){e[o-1]!==`,`&&n!==`,`&&n!==`,(`&&(n=``,t=!1);continue}i+=s,n+=s}}if(!a)throw new I(`Unable to normalize signature.`);return i}const $e=e=>Qe(typeof e==`string`?e:xe(e));function et(e){return Ze($e(e))}var tt=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;e!==void 0&&super.delete(e)}return this}};const Z=new tt(8192);function nt(e,t){if(Z.has(`${e}.${t}`))return Z.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=Ye(J(n),`bytes`),i=(t?n.substring(`${t}0x`.length):n).split(``);for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(r[e>>1]&15)>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let a=`0x${i.join(``)}`;return Z.set(`${e}.${t}`,a),a}const rt=/^0x[a-fA-F0-9]{40}$/,Q=new tt(8192);function it(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(Q.has(r))return Q.get(r);let i=rt.test(e)?e.toLowerCase()===e||!n||nt(e)===e:!1;return Q.set(r,i),i}function at(e,t,n,{strict:r}={}){return M(e,{strict:!1})?lt(e,t,n,{strict:r}):ct(e,t,n,{strict:r})}function ot(e,t){if(typeof t==`number`&&t>0&&t>N(e)-1)throw new R({offset:t,position:`start`,size:N(e)})}function st(e,t,n){if(typeof t==`number`&&typeof n==`number`&&N(e)!==n-t)throw new R({offset:n,position:`end`,size:N(e)})}function ct(e,t,n,{strict:r}={}){ot(e,t);let i=e.slice(t,n);return r&&st(i,t,n),i}function lt(e,t,n,{strict:r}={}){ot(e,t);let i=`0x${e.replace(`0x`,``).slice((t??0)*2,(n??e.length)*2)}`;return r&&st(i,t,n),i}const ut=e=>at(et(e),0,4),dt=/^0x[0-9a-fA-F]{1,64}$/,ft=/^[A-Za-z_][A-Za-z0-9_]*$/;function pt(e){return`0x${e.slice(2).toLowerCase().padStart(64,`0`)}`}function mt(e){return e.indexOf(`:`)}function ht(e){try{let t=C.decode(e);return t.length===32?C.encode(t):null}catch{return null}}function gt(e,t){if(t.length===0||new TextEncoder().encode(t).length>512||t.trim()!==t)return null;let n=mt(t),r=n===-1?t:t.slice(0,n),i=n===-1?null:t.slice(n+1);if(i===``)return null;if(e.startsWith(`evm:`)){if(!it(r))return null;let e=r.toLowerCase();if(i===null)return{kind:`recipient`,address:e,canonical:e};if(i===`*`)return{kind:`application`,target:e,action:{kind:`all`},canonical:`${e}:*`};if(!/^0x[0-9a-fA-F]{8}$/.test(i))return null;let t=i.toLowerCase();return{kind:`application`,target:e,action:{kind:`evm-selector`,selector:t},canonical:`${e}:${t}`}}if(e.startsWith(`sui:`)){if(!dt.test(r))return null;let e=pt(r);if(i===null)return{kind:`recipient`,address:e,canonical:e};if(i===`*`)return{kind:`application`,target:e,action:{kind:`all`},canonical:`${e}:*`};let t=i.split(`::`);return t.length!==2||!ft.test(t[0])||t[1]!==`*`&&!ft.test(t[1])?null:{kind:`application`,target:e,action:{kind:`sui-function`,module:t[0],function:t[1]},canonical:`${e}:${t[0]}::${t[1]}`}}let a=ht(r);if(!a)return null;if(i===null)return{kind:`recipient`,address:a,canonical:a};if(i===`*`)return{kind:`application`,target:a,action:{kind:`all`},canonical:`${a}:*`};let o=i.match(/^disc:(0x[0-9a-fA-F]{2,64})$/)?.[1];if(o&&o.length%2==0){let e=o.toLowerCase();return{kind:`application`,target:a,action:{kind:`solana-discriminator`,discriminator:e},canonical:`${a}:disc:${e}`}}let s=i.match(/^data-sha256:(0x[0-9a-fA-F]{64})$/)?.[1];if(s){let e=s.toLowerCase();return{kind:`application`,target:a,action:{kind:`solana-data-hash`,hash:e},canonical:`${a}:data-sha256:${e}`}}return null}function $(e,t){let n=gt(e,t);if(!n)throw Error(`Invalid permission-token scope: ${t}`);return n.canonical}function _t(e){return`0x${oe(e)}`}function vt(e,t){let n=gt(e,t);if(!n||n.kind!==`recipient`)throw Error(`Invalid ${e} permission-token recipient: ${t}`);return n.canonical}function yt(e){return $(`evm:1`,`${e}:*`)}function bt(e,t){return $(`evm:1`,`${e}:${/^0x[0-9a-fA-F]{8}$/.test(t)?t:ut(t)}`)}function xt(e){return $(`sui:mainnet`,`${e}:*`)}function St(e,t,n=`*`){return $(`sui:mainnet`,`${e}:${t}::${n}`)}function Ct(e){return $(`solana:mainnet`,`${e}:*`)}function wt(e,t){return $(`solana:mainnet`,`${e}:disc:${typeof t==`string`?t:_t(t)}`)}function Tt(e,t){return $(`solana:mainnet`,`${e}:data-sha256:${_t(O(t))}`)}function Et(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).replace(/[-\s]+/g,`_`).toLowerCase()}function Dt(e,t){return wt(e,t.discriminator?Uint8Array.from(t.discriminator):O(y(`global:${Et(t.name)}`)).slice(0,8))}exports.EthereumProvider=e.r,exports.EthereumProviderExtension=l,Object.defineProperty(exports,"SILK_METHOD",{enumerable:!0,get:function(){return e.O}}),Object.defineProperty(exports,"WAAP_METHOD",{enumerable:!0,get:function(){return e.O}}),exports.SilkWalletConnect=i.t,exports.WaaPWalletConnect=i.t,exports.UIMessageManager=e.a,exports.UI_EVENT_NAMES=e.o,exports.WAAP_EVENTS=t.t,Object.defineProperty(exports,"WaaP",{enumerable:!0,get:function(){return e.w}}),exports.WaaPError=e.T,exports.WaaPSolanaProvider=r.t,exports.WaaPSuiWallet=n.s,exports.WalletMessageManager=e.h,exports.getWaaPIframeDiagnostics=e.d,exports.handleWalletRequestAndResponse=e.c,exports.initWaaP=n.t,exports.initWaaPMulti=n.n,exports.initWaaPSolana=n.r,exports.initWaaPSquid=n.i,exports.initWaaPSui=n.a,exports.initWaaPTap=n.o,exports.normalizeWaaPError=e.E,exports.permissionTokenEvmContract=yt,exports.permissionTokenEvmFunction=bt,exports.permissionTokenRecipient=vt,exports.permissionTokenSolanaAnchorInstruction=Dt,exports.permissionTokenSolanaDiscriminator=wt,exports.permissionTokenSolanaInstruction=Tt,exports.permissionTokenSolanaProgram=Ct,exports.permissionTokenSuiFunction=St,exports.permissionTokenSuiPackage=xt,exports.preloadWaaPOnIdle=e.s,exports.registerWaaPSolanaWallet=o.t,exports.registerWaaPSuiWallet=a.t,exports.resolveWalletOrigin=e.S,exports.rpcMethodRequiresUI=e.l,exports.subscribeWaaPIframeLifecycle=e.m,exports.useWaapAuth=s.t,exports.useWaapTransaction=s.n,exports.validateWalletOrigin=e.C;
3
+ function f(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function p(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function m(e,...t){if(!f(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function h(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function ee(e,t){m(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function te(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function g(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function _(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function v(e,t){return e<<32-t|e>>>t}const ne=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function re(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function ie(e){for(let t=0;t<e.length;t++)e[t]=re(e[t]);return e}const ae=ne?e=>e:ie,oe=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,se=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function ce(e){if(m(e),oe)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=se[e[n]];return t}function y(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function b(e){return typeof e==`string`&&(e=y(e)),m(e),e}var x=class{};function S(e){let t=t=>e().update(b(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function le(e){if(e.length>=255)throw TypeError(`Alphabet too long`);let t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let n=0;n<e.length;n++){let r=e.charAt(n),i=r.charCodeAt(0);if(t[i]!==255)throw TypeError(r+` is ambiguous`);t[i]=n}let n=e.length,r=e.charAt(0),i=Math.log(n)/Math.log(256),a=Math.log(256)/Math.log(n);function o(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError(`Expected Uint8Array`);if(t.length===0)return``;let i=0,o=0,s=0,c=t.length;for(;s!==c&&t[s]===0;)s++,i++;let l=(c-s)*a+1>>>0,u=new Uint8Array(l);for(;s!==c;){let e=t[s],r=0;for(let t=l-1;(e!==0||r<o)&&t!==-1;t--,r++)e+=256*u[t]>>>0,u[t]=e%n>>>0,e=e/n>>>0;if(e!==0)throw Error(`Non-zero carry`);o=r,s++}let d=l-o;for(;d!==l&&u[d]===0;)d++;let f=r.repeat(i);for(;d<l;++d)f+=e.charAt(u[d]);return f}function s(e){if(typeof e!=`string`)throw TypeError(`Expected String`);if(e.length===0)return new Uint8Array;let a=0,o=0,s=0;for(;e[a]===r;)o++,a++;let c=(e.length-a)*i+1>>>0,l=new Uint8Array(c);for(;a<e.length;){let r=e.charCodeAt(a);if(r>255)return;let i=t[r];if(i===255)return;let o=0;for(let e=c-1;(i!==0||o<s)&&e!==-1;e--,o++)i+=n*l[e]>>>0,l[e]=i%256>>>0,i=i/256>>>0;if(i!==0)throw Error(`Non-zero carry`);s=o,a++}let u=c-s;for(;u!==c&&l[u]===0;)u++;let d=new Uint8Array(o+(c-u)),f=o;for(;u!==c;)d[f++]=l[u++];return d}function c(e){let t=s(e);if(t)return t;throw Error(`Non-base`+n+` character`)}return{encode:o,decodeUnsafe:s,decode:c}}var C=le(`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`);function ue(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function de(e,t,n){return e&t^~e&n}function fe(e,t,n){return e&t^e&n^t&n}var pe=class extends x{constructor(e,t,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=_(this.buffer)}update(e){h(this),e=b(e),m(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=_(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){h(this),ee(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,g(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;ue(n,r-8,BigInt(this.length*8),i),this.process(n,0);let o=_(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen should be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=r,e.pos=o,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}};const w=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),T=BigInt(2**32-1),E=BigInt(32);function me(e,t=!1){return t?{h:Number(e&T),l:Number(e>>E&T)}:{h:Number(e>>E&T)|0,l:Number(e&T)|0}}function he(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=me(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}const ge=(e,t,n)=>e<<n|t>>>32-n,_e=(e,t,n)=>t<<n|e>>>32-n,ve=(e,t,n)=>t<<n-32|e>>>64-n,ye=(e,t,n)=>e<<n-32|t>>>64-n,be=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),D=new Uint32Array(64);var xe=class extends pe{constructor(e=32){super(64,e,8,!1),this.A=w[0]|0,this.B=w[1]|0,this.C=w[2]|0,this.D=w[3]|0,this.E=w[4]|0,this.F=w[5]|0,this.G=w[6]|0,this.H=w[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)D[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=D[e-15],n=D[e-2],r=v(t,7)^v(t,18)^t>>>3,i=v(n,17)^v(n,19)^n>>>10;D[e]=i+D[e-7]+r+D[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=v(o,6)^v(o,11)^v(o,25),u=l+t+de(o,s,c)+be[e]+D[e]|0,d=(v(n,2)^v(n,13)^v(n,22))+fe(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){g(D)}destroy(){this.set(0,0,0,0,0,0,0,0),g(this.buffer)}};const Se=S(()=>new xe);function Ce(e,t){return e.exec(t)?.groups}const we=/^tuple(?<array>(\[(\d*)\])*)$/;function O(e){let t=e.type;if(we.test(e.type)&&`components`in e){t=`(`;let n=e.components.length;for(let r=0;r<n;r++){let i=e.components[r];t+=O(i),r<n-1&&(t+=`, `)}let r=Ce(we,e.type);return t+=`)${r?.array||``}`,O({...e,type:t})}return`indexed`in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function k(e){let t=``,n=e.length;for(let r=0;r<n;r++){let i=e[r];t+=O(i),r!==n-1&&(t+=`, `)}return t}function Te(e){return e.type===`function`?`function ${e.name}(${k(e.inputs)})${e.stateMutability&&e.stateMutability!==`nonpayable`?` ${e.stateMutability}`:``}${e.outputs?.length?` returns (${k(e.outputs)})`:``}`:e.type===`event`?`event ${e.name}(${k(e.inputs)})`:e.type===`error`?`error ${e.name}(${k(e.inputs)})`:e.type===`constructor`?`constructor(${k(e.inputs)})${e.stateMutability===`payable`?` payable`:``}`:e.type===`fallback`?`fallback() external${e.stateMutability===`payable`?` payable`:``}`:`receive() external payable`}function A(e,{strict:t=!0}={}){return!e||typeof e!=`string`?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith(`0x`)}function j(e){return A(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Ee=`2.55.2`;let M={getDocsUrl:({docsBaseUrl:e,docsPath:t=``,docsSlug:n})=>t?`${e??`https://viem.sh`}${t}${n?`#${n}`:``}`:void 0,version:`viem@${Ee}`};var N=class e extends Error{constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof e&&n.cause.docsPath||n.docsPath,a=M.getDocsUrl?.({...n,docsPath:i}),o=[t||`An error occurred.`,``,...n.metaMessages?[...n.metaMessages,``]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...M.version?[`Version: ${M.version}`]:[]].join(`
4
+ `);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`BaseError`}),this.details=r,this.docsPath=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=Ee}walk(e){return P(this,e)}};function P(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?P(e.cause,t):t?null:e}var F=class extends N{constructor({offset:e,position:t,size:n}){super(`Slice ${t===`start`?`starting`:`ending`} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:`SliceOffsetOutOfBoundsError`})}},I=class extends N{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:`SizeExceedsPaddingSizeError`})}};function L(e,{dir:t,size:n=32}={}){return typeof e==`string`?De(e,{dir:t,size:n}):Oe(e,{dir:t,size:n})}function De(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace(`0x`,``);if(r.length>n*2)throw new I({size:Math.ceil(r.length/2),targetSize:n,type:`hex`});return`0x${r[t===`right`?`padEnd`:`padStart`](n*2,`0`)}`}function Oe(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new I({size:e.length,targetSize:n,type:`bytes`});let r=new Uint8Array(n);for(let i=0;i<n;i++){let a=t===`right`;r[a?i:n-i-1]=e[a?i:e.length-i-1]}return r}var ke=class extends N{constructor({max:e,min:t,signed:n,size:r,value:i}){super(`Number "${i}" is not in safe ${r?`${r*8}-bit ${n?`signed`:`unsigned`} `:``}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:`IntegerOutOfRangeError`})}},Ae=class extends N{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:`SizeOverflowError`})}};function R(e,{size:t}){if(j(e)>t)throw new Ae({givenSize:j(e),maxSize:t})}const je=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Me(e,t={}){return typeof e==`number`||typeof e==`bigint`?B(e,t):typeof e==`string`?Fe(e,t):typeof e==`boolean`?Ne(e,t):z(e,t)}function Ne(e,t={}){let n=`0x${Number(e)}`;return typeof t.size==`number`?(R(n,{size:t.size}),L(n,{size:t.size})):n}function z(e,t={}){let n=``;for(let t=0;t<e.length;t++)n+=je[e[t]];let r=`0x${n}`;return typeof t.size==`number`?(R(r,{size:t.size}),L(r,{dir:`right`,size:t.size})):r}function B(e,t={}){let{signed:n,size:r}=t,i=BigInt(e),a;r?a=n?(1n<<BigInt(r)*8n-1n)-1n:2n**(BigInt(r)*8n)-1n:typeof e==`number`&&(a=BigInt(2**53-1));let o=typeof a==`bigint`&&n?-a-1n:0;if(a&&i>a||i<o){let t=typeof e==`bigint`?`n`:``;throw new ke({max:a?`${a}${t}`:void 0,min:`${o}${t}`,signed:n,size:r,value:`${e}${t}`})}let s=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?L(s,{size:r}):s}const Pe=new TextEncoder;function Fe(e,t={}){return z(Pe.encode(e),t)}const Ie=new TextEncoder;function V(e,t={}){return typeof e==`number`||typeof e==`bigint`?Re(e,t):typeof e==`boolean`?Le(e,t):A(e)?W(e,t):G(e,t)}function Le(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size==`number`?(R(n,{size:t.size}),L(n,{size:t.size})):n}const H={zero:48,nine:57,A:65,F:70,a:97,f:102};function U(e){if(e>=H.zero&&e<=H.nine)return e-H.zero;if(e>=H.A&&e<=H.F)return e-(H.A-10);if(e>=H.a&&e<=H.f)return e-(H.a-10)}function W(e,t={}){let n=e;t.size&&(R(n,{size:t.size}),n=L(n,{dir:`right`,size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);let i=r.length/2,a=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let n=U(r.charCodeAt(t++)),i=U(r.charCodeAt(t++));if(n===void 0||i===void 0)throw new N(`Invalid byte sequence ("${r[t-2]}${r[t-1]}" in "${r}").`);a[e]=n*16+i}return a}function Re(e,t){return W(B(e,t))}function G(e,t={}){let n=Ie.encode(e);return typeof t.size==`number`?(R(n,{size:t.size}),L(n,{dir:`right`,size:t.size})):n}const ze=BigInt(0),K=BigInt(1),Be=BigInt(2),Ve=BigInt(7),He=BigInt(256),Ue=BigInt(113),q=[],We=[],J=[];for(let e=0,t=K,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],q.push(2*(5*r+n)),We.push((e+1)*(e+2)/2%64);let i=ze;for(let e=0;e<7;e++)t=(t<<K^(t>>Ve)*Ue)%He,t&Be&&(i^=K<<(K<<BigInt(e))-K);J.push(i)}const Y=he(J,!0),Ge=Y[0],Ke=Y[1],qe=(e,t,n)=>n>32?ve(e,t,n):ge(e,t,n),Je=(e,t,n)=>n>32?ye(e,t,n):_e(e,t,n);function Ye(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let r=(t+8)%10,i=(t+2)%10,a=n[i],o=n[i+1],s=qe(a,o,1)^n[r],c=Je(a,o,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=We[n],a=qe(t,i,r),o=Je(t,i,r),s=q[n];t=e[s],i=e[s+1],e[s]=a,e[s+1]=o}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=Ge[r],e[1]^=Ke[r]}g(n)}var Xe=class e extends x{constructor(e,t,n,r=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,p(n),!(0<e&&e<200))throw Error(`only keccak-f1600 function is supported`);this.state=new Uint8Array(200),this.state32=te(this.state)}clone(){return this._cloneInto()}keccak(){ae(this.state32),Ye(this.state32,this.rounds),ae(this.state32),this.posOut=0,this.pos=0}update(e){h(this),e=b(e),m(e);let{blockLen:t,state:n}=this,r=e.length;for(let i=0;i<r;){let a=Math.min(t-this.pos,r-i);for(let t=0;t<a;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,t&128&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){h(this,!1),m(e),this.finish();let t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw Error(`XOF is not possible for this instance`);return this.writeInto(e)}xof(e){return p(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(ee(e,this),this.finished)throw Error(`digest() was already called`);return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,g(this.state)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:i,rounds:a,enableXOF:o}=this;return t||=new e(n,r,i,o,a),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const Ze=((e,t,n)=>S(()=>new Xe(t,e,n)))(1,136,256/8);function Qe(e,t){let n=t||`hex`,r=Ze(A(e,{strict:!1})?V(e):e);return n===`bytes`?r:Me(r)}const $e=e=>Qe(V(e));function et(e){return $e(e)}function tt(e){let t=!0,n=``,r=0,i=``,a=!1;for(let o=0;o<e.length;o++){let s=e[o];if([`(`,`)`,`,`].includes(s)&&(t=!0),s===`(`&&r++,s===`)`&&r--,t){if(r===0){if(s===` `&&[`event`,`function`,``].includes(i))i=``;else if(i+=s,s===`)`){a=!0;break}continue}if(s===` `){e[o-1]!==`,`&&n!==`,`&&n!==`,(`&&(n=``,t=!1);continue}i+=s,n+=s}}if(!a)throw new N(`Unable to normalize signature.`);return i}const nt=e=>tt(typeof e==`string`?e:Te(e));function rt(e){return et(nt(e))}var X=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;e!==void 0&&super.delete(e)}return this}};const Z=new X(8192);function it(e,t){if(Z.has(`${e}.${t}`))return Z.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=Qe(G(n),`bytes`),i=(t?n.substring(`${t}0x`.length):n).split(``);for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(r[e>>1]&15)>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let a=`0x${i.join(``)}`;return Z.set(`${e}.${t}`,a),a}const at=/^0x[a-fA-F0-9]{40}$/,Q=new X(8192);function ot(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(Q.has(r))return Q.get(r);let i=at.test(e)?e.toLowerCase()===e||!n||it(e)===e:!1;return Q.set(r,i),i}function st(e,t,n,{strict:r}={}){return A(e,{strict:!1})?dt(e,t,n,{strict:r}):ut(e,t,n,{strict:r})}function ct(e,t){if(typeof t==`number`&&t>0&&t>j(e)-1)throw new F({offset:t,position:`start`,size:j(e)})}function lt(e,t,n){if(typeof t==`number`&&typeof n==`number`&&j(e)!==n-t)throw new F({offset:n,position:`end`,size:j(e)})}function ut(e,t,n,{strict:r}={}){ct(e,t);let i=e.slice(t,n);return r&&lt(i,t,n),i}function dt(e,t,n,{strict:r}={}){ct(e,t);let i=`0x${e.replace(`0x`,``).slice((t??0)*2,(n??e.length)*2)}`;return r&&lt(i,t,n),i}const ft=e=>st(rt(e),0,4),pt=/^0x[0-9a-fA-F]{1,64}$/,mt=/^[A-Za-z_][A-Za-z0-9_]*$/;function ht(e){return`0x${e.slice(2).toLowerCase().padStart(64,`0`)}`}function gt(e){return e.indexOf(`:`)}function _t(e){try{let t=C.decode(e);return t.length===32?C.encode(t):null}catch{return null}}function vt(e,t){if(t.length===0||new TextEncoder().encode(t).length>512||t.trim()!==t)return null;let n=gt(t),r=n===-1?t:t.slice(0,n),i=n===-1?null:t.slice(n+1);if(i===``)return null;if(e.startsWith(`evm:`)){if(!ot(r))return null;let e=r.toLowerCase();if(i===null)return{kind:`recipient`,address:e,canonical:e};if(i===`*`)return{kind:`application`,target:e,action:{kind:`all`},canonical:`${e}:*`};if(!/^0x[0-9a-fA-F]{8}$/.test(i))return null;let t=i.toLowerCase();return{kind:`application`,target:e,action:{kind:`evm-selector`,selector:t},canonical:`${e}:${t}`}}if(e.startsWith(`sui:`)){if(!pt.test(r))return null;let e=ht(r);if(i===null)return{kind:`recipient`,address:e,canonical:e};if(i===`*`)return{kind:`application`,target:e,action:{kind:`all`},canonical:`${e}:*`};let t=i.split(`::`);return t.length!==2||!mt.test(t[0])||t[1]!==`*`&&!mt.test(t[1])?null:{kind:`application`,target:e,action:{kind:`sui-function`,module:t[0],function:t[1]},canonical:`${e}:${t[0]}::${t[1]}`}}let a=_t(r);if(!a)return null;if(i===null)return{kind:`recipient`,address:a,canonical:a};if(i===`*`)return{kind:`application`,target:a,action:{kind:`all`},canonical:`${a}:*`};let o=i.match(/^disc:(0x[0-9a-fA-F]{2,64})$/)?.[1];if(o&&o.length%2==0){let e=o.toLowerCase();return{kind:`application`,target:a,action:{kind:`solana-discriminator`,discriminator:e},canonical:`${a}:disc:${e}`}}let s=i.match(/^data-sha256:(0x[0-9a-fA-F]{64})$/)?.[1];if(s){let e=s.toLowerCase();return{kind:`application`,target:a,action:{kind:`solana-data-hash`,hash:e},canonical:`${a}:data-sha256:${e}`}}return null}function $(e,t){let n=vt(e,t);if(!n)throw Error(`Invalid permission-token scope: ${t}`);return n.canonical}function yt(e){return`0x${ce(e)}`}function bt(e,t){let n=vt(e,t);if(!n||n.kind!==`recipient`)throw Error(`Invalid ${e} permission-token recipient: ${t}`);return n.canonical}function xt(e){return $(`evm:1`,`${e}:*`)}function St(e,t){return $(`evm:1`,`${e}:${/^0x[0-9a-fA-F]{8}$/.test(t)?t:ft(t)}`)}function Ct(e){return $(`sui:mainnet`,`${e}:*`)}function wt(e,t,n=`*`){return $(`sui:mainnet`,`${e}:${t}::${n}`)}function Tt(e){return $(`solana:mainnet`,`${e}:*`)}function Et(e,t){return $(`solana:mainnet`,`${e}:disc:${typeof t==`string`?t:yt(t)}`)}function Dt(e,t){return $(`solana:mainnet`,`${e}:data-sha256:${yt(Se(t))}`)}function Ot(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).replace(/[-\s]+/g,`_`).toLowerCase()}function kt(e,t){return Et(e,t.discriminator?Uint8Array.from(t.discriminator):Se(y(`global:${Ot(t.name)}`)).slice(0,8))}exports.EthereumProvider=a.r,exports.EthereumProviderExtension=d,Object.defineProperty(exports,"SILK_METHOD",{enumerable:!0,get:function(){return e.w}}),Object.defineProperty(exports,"WAAP_METHOD",{enumerable:!0,get:function(){return e.w}}),exports.SilkWalletConnect=o.t,exports.WaaPWalletConnect=o.t,exports.UIMessageManager=e.t,exports.UI_EVENT_NAMES=e.n,exports.WAAP_EVENTS=t.t,Object.defineProperty(exports,"WaaP",{enumerable:!0,get:function(){return e.b}}),exports.WaaPError=e.x,exports.WaaPSolanaProvider=r.t,exports.WaaPStellarProvider=i.n,exports.WaaPSuiWallet=n.c,exports.WalletMessageManager=e.d,exports.getWaaPIframeDiagnostics=e.s,exports.handleWalletRequestAndResponse=e.i,exports.initWaaP=n.t,exports.initWaaPMulti=n.n,exports.initWaaPSolana=n.r,exports.initWaaPSquid=n.i,exports.initWaaPStellar=i.t,exports.initWaaPSui=n.a,exports.initWaaPTap=n.o,exports.normalizeWaaPError=e.S,exports.permissionTokenEvmContract=xt,exports.permissionTokenEvmFunction=St,exports.permissionTokenRecipient=bt,exports.permissionTokenSolanaAnchorInstruction=kt,exports.permissionTokenSolanaDiscriminator=Et,exports.permissionTokenSolanaInstruction=Dt,exports.permissionTokenSolanaProgram=Tt,exports.permissionTokenSuiFunction=wt,exports.permissionTokenSuiPackage=Ct,exports.preloadWaaPOnIdle=e.r,exports.registerWaaPSolanaWallet=c.t,exports.registerWaaPSuiWallet=s.t,exports.resolveWalletOrigin=e.v,exports.rpcMethodRequiresUI=e.a,exports.subscribeWaaPIframeLifecycle=e.u,exports.useWaapAuth=l.t,exports.useWaapTransaction=l.n,exports.validateWalletOrigin=e.y;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{C as e,D as t,E as n,O as r,S as i,T as a,a as o,c as s,d as c,h as l,i as u,l as d,m as f,o as ee,r as te,s as ne,w as re}from"./evm-ChOfSh-X.mjs";import{t as ie}from"./asyncSigning-CzqBbYDP.mjs";import{a as ae,i as oe,n as se,o as ce,r as le,s as ue,t as de}from"./ui-CI7vln8d.mjs";import{t as fe}from"./SolanaProvider-CygEwKg1.mjs";import{t as pe}from"./WalletConnect-UfxGn2M_.mjs";import{t as me}from"./register-CoFt8w20.mjs";import{t as he}from"./register-BAygaKgr.mjs";import{n as ge,t as _e}from"./useWaapAuth-Vh8gUs6Y.mjs";import{EventEmitter as ve}from"events";var ye=class extends ve{constructor(e){super(),this.isSilk=!0,this.connected=!1,this.config={...u,...e||{}}}sendToExtension(e){return new Promise((t,n)=>{window.postMessage({type:`FROM_PAGE`,request:e},`*`),window.addEventListener(`message`,e=>{e.data.type===`FROM_EXTENSION`&&(e.data.error?n(e.data.error):t(e.data.result))})})}async request(e){if(!Object.keys(t).includes(e.method))return Promise.reject({error:`Not implemented (${e.method})`});let n=await this.sendToExtension(e);return(e.method===t.wallet_switchEthereumChain||e.method===t.wallet_addEthereumChain)&&n===null&&this.emit(`chainChanged`,e.params?.[0]?.chainId),n}async enable(){return this.request({method:`eth_requestAccounts`})}isConnected(){return this.connected}async login(){return this.sendToExtension({method:r.login})}async requestSBT(e){return this.sendToExtension({method:r.silk_requestSbt,params:[e]})}async toggleDarkMode(){this.config.styles.darkMode=!this.config.styles.darkMode,await this.sendToExtension({method:r.set_custom_config,params:[this.config]})}async safe(){return this.sendToExtension({method:r.safe})}};
1
+ import{C as e,S as t,a as n,b as r,d as i,i as a,n as o,r as s,s as c,t as l,u,v as d,w as f,x as ee,y as te}from"./UIMessageManager-D3VN9vM8.mjs";import{t as ne}from"./asyncSigning-CzqBbYDP.mjs";import{a as re,c as ie,i as ae,n as oe,o as se,r as ce,t as le}from"./ui-DSsOjby7.mjs";import{t as ue}from"./SolanaProvider-BKWKXTWh.mjs";import{n as de,t as fe}from"./init-BljRyI7Q.mjs";import{i as pe,r as me}from"./evm-BbSgL_Hv.mjs";import{t as he}from"./WalletConnect-DXiTxC-F.mjs";import{t as ge}from"./register-DN1lfMSy.mjs";import{t as _e}from"./register-CLsRV5W0.mjs";import{n as ve,t as ye}from"./useWaapAuth-Vh8gUs6Y.mjs";import{EventEmitter as be}from"events";var xe=class extends be{constructor(e){super(),this.isSilk=!0,this.connected=!1,this.config={...pe,...e||{}}}sendToExtension(e){return new Promise((t,n)=>{window.postMessage({type:`FROM_PAGE`,request:e},`*`),window.addEventListener(`message`,e=>{e.data.type===`FROM_EXTENSION`&&(e.data.error?n(e.data.error):t(e.data.result))})})}async request(t){if(!Object.keys(e).includes(t.method))return Promise.reject({error:`Not implemented (${t.method})`});let n=await this.sendToExtension(t);return(t.method===e.wallet_switchEthereumChain||t.method===e.wallet_addEthereumChain)&&n===null&&this.emit(`chainChanged`,t.params?.[0]?.chainId),n}async enable(){return this.request({method:`eth_requestAccounts`})}isConnected(){return this.connected}async login(){return this.sendToExtension({method:f.login})}async requestSBT(e){return this.sendToExtension({method:f.silk_requestSbt,params:[e]})}async toggleDarkMode(){this.config.styles.darkMode=!this.config.styles.darkMode,await this.sendToExtension({method:f.set_custom_config,params:[this.config]})}async safe(){return this.sendToExtension({method:f.safe})}};
2
2
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3
- function be(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function p(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function m(e,...t){if(!be(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function h(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function xe(e,t){m(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function Se(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function g(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function _(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function v(e,t){return e<<32-t|e>>>t}const Ce=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function we(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Te(e){for(let t=0;t<e.length;t++)e[t]=we(e[t]);return e}const y=Ce?e=>e:Te,Ee=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,De=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Oe(e){if(m(e),Ee)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=De[e[n]];return t}function b(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function x(e){return typeof e==`string`&&(e=b(e)),m(e),e}var S=class{};function C(e){let t=t=>e().update(x(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function ke(e){if(e.length>=255)throw TypeError(`Alphabet too long`);let t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let n=0;n<e.length;n++){let r=e.charAt(n),i=r.charCodeAt(0);if(t[i]!==255)throw TypeError(r+` is ambiguous`);t[i]=n}let n=e.length,r=e.charAt(0),i=Math.log(n)/Math.log(256),a=Math.log(256)/Math.log(n);function o(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError(`Expected Uint8Array`);if(t.length===0)return``;let i=0,o=0,s=0,c=t.length;for(;s!==c&&t[s]===0;)s++,i++;let l=(c-s)*a+1>>>0,u=new Uint8Array(l);for(;s!==c;){let e=t[s],r=0;for(let t=l-1;(e!==0||r<o)&&t!==-1;t--,r++)e+=256*u[t]>>>0,u[t]=e%n>>>0,e=e/n>>>0;if(e!==0)throw Error(`Non-zero carry`);o=r,s++}let d=l-o;for(;d!==l&&u[d]===0;)d++;let f=r.repeat(i);for(;d<l;++d)f+=e.charAt(u[d]);return f}function s(e){if(typeof e!=`string`)throw TypeError(`Expected String`);if(e.length===0)return new Uint8Array;let a=0,o=0,s=0;for(;e[a]===r;)o++,a++;let c=(e.length-a)*i+1>>>0,l=new Uint8Array(c);for(;a<e.length;){let r=e.charCodeAt(a);if(r>255)return;let i=t[r];if(i===255)return;let o=0;for(let e=c-1;(i!==0||o<s)&&e!==-1;e--,o++)i+=n*l[e]>>>0,l[e]=i%256>>>0,i=i/256>>>0;if(i!==0)throw Error(`Non-zero carry`);s=o,a++}let u=c-s;for(;u!==c&&l[u]===0;)u++;let d=new Uint8Array(o+(c-u)),f=o;for(;u!==c;)d[f++]=l[u++];return d}function c(e){let t=s(e);if(t)return t;throw Error(`Non-base`+n+` character`)}return{encode:o,decodeUnsafe:s,decode:c}}var w=ke(`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`);function Ae(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function je(e,t,n){return e&t^~e&n}function Me(e,t,n){return e&t^e&n^t&n}var Ne=class extends S{constructor(e,t,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=_(this.buffer)}update(e){h(this),e=x(e),m(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=_(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){h(this),xe(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,g(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;Ae(n,r-8,BigInt(this.length*8),i),this.process(n,0);let o=_(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen should be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=r,e.pos=o,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}};const T=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),E=BigInt(2**32-1),D=BigInt(32);function Pe(e,t=!1){return t?{h:Number(e&E),l:Number(e>>D&E)}:{h:Number(e>>D&E)|0,l:Number(e&E)|0}}function Fe(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=Pe(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}const Ie=(e,t,n)=>e<<n|t>>>32-n,Le=(e,t,n)=>t<<n|e>>>32-n,Re=(e,t,n)=>t<<n-32|e>>>64-n,ze=(e,t,n)=>e<<n-32|t>>>64-n,Be=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),O=new Uint32Array(64);var Ve=class extends Ne{constructor(e=32){super(64,e,8,!1),this.A=T[0]|0,this.B=T[1]|0,this.C=T[2]|0,this.D=T[3]|0,this.E=T[4]|0,this.F=T[5]|0,this.G=T[6]|0,this.H=T[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)O[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=O[e-15],n=O[e-2],r=v(t,7)^v(t,18)^t>>>3,i=v(n,17)^v(n,19)^n>>>10;O[e]=i+O[e-7]+r+O[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=v(o,6)^v(o,11)^v(o,25),u=l+t+je(o,s,c)+Be[e]+O[e]|0,d=(v(n,2)^v(n,13)^v(n,22))+Me(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){g(O)}destroy(){this.set(0,0,0,0,0,0,0,0),g(this.buffer)}};const k=C(()=>new Ve);function He(e,t){return e.exec(t)?.groups}const A=/^tuple(?<array>(\[(\d*)\])*)$/;function j(e){let t=e.type;if(A.test(e.type)&&`components`in e){t=`(`;let n=e.components.length;for(let r=0;r<n;r++){let i=e.components[r];t+=j(i),r<n-1&&(t+=`, `)}let r=He(A,e.type);return t+=`)${r?.array||``}`,j({...e,type:t})}return`indexed`in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function M(e){let t=``,n=e.length;for(let r=0;r<n;r++){let i=e[r];t+=j(i),r!==n-1&&(t+=`, `)}return t}function Ue(e){return e.type===`function`?`function ${e.name}(${M(e.inputs)})${e.stateMutability&&e.stateMutability!==`nonpayable`?` ${e.stateMutability}`:``}${e.outputs?.length?` returns (${M(e.outputs)})`:``}`:e.type===`event`?`event ${e.name}(${M(e.inputs)})`:e.type===`error`?`error ${e.name}(${M(e.inputs)})`:e.type===`constructor`?`constructor(${M(e.inputs)})${e.stateMutability===`payable`?` payable`:``}`:e.type===`fallback`?`fallback() external${e.stateMutability===`payable`?` payable`:``}`:`receive() external payable`}function N(e,{strict:t=!0}={}){return!e||typeof e!=`string`?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith(`0x`)}function P(e){return N(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const F=`2.55.2`;let I={getDocsUrl:({docsBaseUrl:e,docsPath:t=``,docsSlug:n})=>t?`${e??`https://viem.sh`}${t}${n?`#${n}`:``}`:void 0,version:`viem@${F}`};var L=class e extends Error{constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof e&&n.cause.docsPath||n.docsPath,a=I.getDocsUrl?.({...n,docsPath:i}),o=[t||`An error occurred.`,``,...n.metaMessages?[...n.metaMessages,``]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...I.version?[`Version: ${I.version}`]:[]].join(`
4
- `);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`BaseError`}),this.details=r,this.docsPath=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=F}walk(e){return R(this,e)}};function R(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?R(e.cause,t):t?null:e}var z=class extends L{constructor({offset:e,position:t,size:n}){super(`Slice ${t===`start`?`starting`:`ending`} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:`SliceOffsetOutOfBoundsError`})}},B=class extends L{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:`SizeExceedsPaddingSizeError`})}};function V(e,{dir:t,size:n=32}={}){return typeof e==`string`?We(e,{dir:t,size:n}):Ge(e,{dir:t,size:n})}function We(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace(`0x`,``);if(r.length>n*2)throw new B({size:Math.ceil(r.length/2),targetSize:n,type:`hex`});return`0x${r[t===`right`?`padEnd`:`padStart`](n*2,`0`)}`}function Ge(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new B({size:e.length,targetSize:n,type:`bytes`});let r=new Uint8Array(n);for(let i=0;i<n;i++){let a=t===`right`;r[a?i:n-i-1]=e[a?i:e.length-i-1]}return r}var Ke=class extends L{constructor({max:e,min:t,signed:n,size:r,value:i}){super(`Number "${i}" is not in safe ${r?`${r*8}-bit ${n?`signed`:`unsigned`} `:``}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:`IntegerOutOfRangeError`})}},qe=class extends L{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:`SizeOverflowError`})}};function H(e,{size:t}){if(P(e)>t)throw new qe({givenSize:P(e),maxSize:t})}const Je=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Ye(e,t={}){return typeof e==`number`||typeof e==`bigint`?W(e,t):typeof e==`string`?Qe(e,t):typeof e==`boolean`?Xe(e,t):U(e,t)}function Xe(e,t={}){let n=`0x${Number(e)}`;return typeof t.size==`number`?(H(n,{size:t.size}),V(n,{size:t.size})):n}function U(e,t={}){let n=``;for(let t=0;t<e.length;t++)n+=Je[e[t]];let r=`0x${n}`;return typeof t.size==`number`?(H(r,{size:t.size}),V(r,{dir:`right`,size:t.size})):r}function W(e,t={}){let{signed:n,size:r}=t,i=BigInt(e),a;r?a=n?(1n<<BigInt(r)*8n-1n)-1n:2n**(BigInt(r)*8n)-1n:typeof e==`number`&&(a=BigInt(2**53-1));let o=typeof a==`bigint`&&n?-a-1n:0;if(a&&i>a||i<o){let t=typeof e==`bigint`?`n`:``;throw new Ke({max:a?`${a}${t}`:void 0,min:`${o}${t}`,signed:n,size:r,value:`${e}${t}`})}let s=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?V(s,{size:r}):s}const Ze=new TextEncoder;function Qe(e,t={}){return U(Ze.encode(e),t)}const $e=new TextEncoder;function G(e,t={}){return typeof e==`number`||typeof e==`bigint`?tt(e,t):typeof e==`boolean`?et(e,t):N(e)?J(e,t):nt(e,t)}function et(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size==`number`?(H(n,{size:t.size}),V(n,{size:t.size})):n}const K={zero:48,nine:57,A:65,F:70,a:97,f:102};function q(e){if(e>=K.zero&&e<=K.nine)return e-K.zero;if(e>=K.A&&e<=K.F)return e-(K.A-10);if(e>=K.a&&e<=K.f)return e-(K.a-10)}function J(e,t={}){let n=e;t.size&&(H(n,{size:t.size}),n=V(n,{dir:`right`,size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);let i=r.length/2,a=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let n=q(r.charCodeAt(t++)),i=q(r.charCodeAt(t++));if(n===void 0||i===void 0)throw new L(`Invalid byte sequence ("${r[t-2]}${r[t-1]}" in "${r}").`);a[e]=n*16+i}return a}function tt(e,t){return J(W(e,t))}function nt(e,t={}){let n=$e.encode(e);return typeof t.size==`number`?(H(n,{size:t.size}),V(n,{dir:`right`,size:t.size})):n}const rt=BigInt(0),Y=BigInt(1),it=BigInt(2),at=BigInt(7),ot=BigInt(256),st=BigInt(113),ct=[],lt=[],ut=[];for(let e=0,t=Y,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],ct.push(2*(5*r+n)),lt.push((e+1)*(e+2)/2%64);let i=rt;for(let e=0;e<7;e++)t=(t<<Y^(t>>at)*st)%ot,t&it&&(i^=Y<<(Y<<BigInt(e))-Y);ut.push(i)}const dt=Fe(ut,!0),ft=dt[0],pt=dt[1],mt=(e,t,n)=>n>32?Re(e,t,n):Ie(e,t,n),ht=(e,t,n)=>n>32?ze(e,t,n):Le(e,t,n);function gt(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let r=(t+8)%10,i=(t+2)%10,a=n[i],o=n[i+1],s=mt(a,o,1)^n[r],c=ht(a,o,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=lt[n],a=mt(t,i,r),o=ht(t,i,r),s=ct[n];t=e[s],i=e[s+1],e[s]=a,e[s+1]=o}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=ft[r],e[1]^=pt[r]}g(n)}var _t=class e extends S{constructor(e,t,n,r=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,p(n),!(0<e&&e<200))throw Error(`only keccak-f1600 function is supported`);this.state=new Uint8Array(200),this.state32=Se(this.state)}clone(){return this._cloneInto()}keccak(){y(this.state32),gt(this.state32,this.rounds),y(this.state32),this.posOut=0,this.pos=0}update(e){h(this),e=x(e),m(e);let{blockLen:t,state:n}=this,r=e.length;for(let i=0;i<r;){let a=Math.min(t-this.pos,r-i);for(let t=0;t<a;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,t&128&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){h(this,!1),m(e),this.finish();let t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw Error(`XOF is not possible for this instance`);return this.writeInto(e)}xof(e){return p(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(xe(e,this),this.finished)throw Error(`digest() was already called`);return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,g(this.state)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:i,rounds:a,enableXOF:o}=this;return t||=new e(n,r,i,o,a),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const vt=((e,t,n)=>C(()=>new _t(t,e,n)))(1,136,256/8);function yt(e,t){let n=t||`hex`,r=vt(N(e,{strict:!1})?G(e):e);return n===`bytes`?r:Ye(r)}const bt=e=>yt(G(e));function xt(e){return bt(e)}function St(e){let t=!0,n=``,r=0,i=``,a=!1;for(let o=0;o<e.length;o++){let s=e[o];if([`(`,`)`,`,`].includes(s)&&(t=!0),s===`(`&&r++,s===`)`&&r--,t){if(r===0){if(s===` `&&[`event`,`function`,``].includes(i))i=``;else if(i+=s,s===`)`){a=!0;break}continue}if(s===` `){e[o-1]!==`,`&&n!==`,`&&n!==`,(`&&(n=``,t=!1);continue}i+=s,n+=s}}if(!a)throw new L(`Unable to normalize signature.`);return i}const Ct=e=>St(typeof e==`string`?e:Ue(e));function wt(e){return xt(Ct(e))}var Tt=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;e!==void 0&&super.delete(e)}return this}};const X=new Tt(8192);function Et(e,t){if(X.has(`${e}.${t}`))return X.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=yt(nt(n),`bytes`),i=(t?n.substring(`${t}0x`.length):n).split(``);for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(r[e>>1]&15)>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let a=`0x${i.join(``)}`;return X.set(`${e}.${t}`,a),a}const Dt=/^0x[a-fA-F0-9]{40}$/,Z=new Tt(8192);function Ot(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(Z.has(r))return Z.get(r);let i=Dt.test(e)?e.toLowerCase()===e||!n||Et(e)===e:!1;return Z.set(r,i),i}function kt(e,t,n,{strict:r}={}){return N(e,{strict:!1})?Nt(e,t,n,{strict:r}):Mt(e,t,n,{strict:r})}function At(e,t){if(typeof t==`number`&&t>0&&t>P(e)-1)throw new z({offset:t,position:`start`,size:P(e)})}function jt(e,t,n){if(typeof t==`number`&&typeof n==`number`&&P(e)!==n-t)throw new z({offset:n,position:`end`,size:P(e)})}function Mt(e,t,n,{strict:r}={}){At(e,t);let i=e.slice(t,n);return r&&jt(i,t,n),i}function Nt(e,t,n,{strict:r}={}){At(e,t);let i=`0x${e.replace(`0x`,``).slice((t??0)*2,(n??e.length)*2)}`;return r&&jt(i,t,n),i}const Pt=e=>kt(wt(e),0,4),Ft=/^0x[0-9a-fA-F]{1,64}$/,It=/^[A-Za-z_][A-Za-z0-9_]*$/;function Lt(e){return`0x${e.slice(2).toLowerCase().padStart(64,`0`)}`}function Rt(e){return e.indexOf(`:`)}function zt(e){try{let t=w.decode(e);return t.length===32?w.encode(t):null}catch{return null}}function Bt(e,t){if(t.length===0||new TextEncoder().encode(t).length>512||t.trim()!==t)return null;let n=Rt(t),r=n===-1?t:t.slice(0,n),i=n===-1?null:t.slice(n+1);if(i===``)return null;if(e.startsWith(`evm:`)){if(!Ot(r))return null;let e=r.toLowerCase();if(i===null)return{kind:`recipient`,address:e,canonical:e};if(i===`*`)return{kind:`application`,target:e,action:{kind:`all`},canonical:`${e}:*`};if(!/^0x[0-9a-fA-F]{8}$/.test(i))return null;let t=i.toLowerCase();return{kind:`application`,target:e,action:{kind:`evm-selector`,selector:t},canonical:`${e}:${t}`}}if(e.startsWith(`sui:`)){if(!Ft.test(r))return null;let e=Lt(r);if(i===null)return{kind:`recipient`,address:e,canonical:e};if(i===`*`)return{kind:`application`,target:e,action:{kind:`all`},canonical:`${e}:*`};let t=i.split(`::`);return t.length!==2||!It.test(t[0])||t[1]!==`*`&&!It.test(t[1])?null:{kind:`application`,target:e,action:{kind:`sui-function`,module:t[0],function:t[1]},canonical:`${e}:${t[0]}::${t[1]}`}}let a=zt(r);if(!a)return null;if(i===null)return{kind:`recipient`,address:a,canonical:a};if(i===`*`)return{kind:`application`,target:a,action:{kind:`all`},canonical:`${a}:*`};let o=i.match(/^disc:(0x[0-9a-fA-F]{2,64})$/)?.[1];if(o&&o.length%2==0){let e=o.toLowerCase();return{kind:`application`,target:a,action:{kind:`solana-discriminator`,discriminator:e},canonical:`${a}:disc:${e}`}}let s=i.match(/^data-sha256:(0x[0-9a-fA-F]{64})$/)?.[1];if(s){let e=s.toLowerCase();return{kind:`application`,target:a,action:{kind:`solana-data-hash`,hash:e},canonical:`${a}:data-sha256:${e}`}}return null}function Q(e,t){let n=Bt(e,t);if(!n)throw Error(`Invalid permission-token scope: ${t}`);return n.canonical}function Vt(e){return`0x${Oe(e)}`}function Ht(e,t){let n=Bt(e,t);if(!n||n.kind!==`recipient`)throw Error(`Invalid ${e} permission-token recipient: ${t}`);return n.canonical}function Ut(e){return Q(`evm:1`,`${e}:*`)}function Wt(e,t){return Q(`evm:1`,`${e}:${/^0x[0-9a-fA-F]{8}$/.test(t)?t:Pt(t)}`)}function Gt(e){return Q(`sui:mainnet`,`${e}:*`)}function Kt(e,t,n=`*`){return Q(`sui:mainnet`,`${e}:${t}::${n}`)}function qt(e){return Q(`solana:mainnet`,`${e}:*`)}function $(e,t){return Q(`solana:mainnet`,`${e}:disc:${typeof t==`string`?t:Vt(t)}`)}function Jt(e,t){return Q(`solana:mainnet`,`${e}:data-sha256:${Vt(k(t))}`)}function Yt(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).replace(/[-\s]+/g,`_`).toLowerCase()}function Xt(e,t){return $(e,t.discriminator?Uint8Array.from(t.discriminator):k(b(`global:${Yt(t.name)}`)).slice(0,8))}export{te as EthereumProvider,ye as EthereumProviderExtension,r as SILK_METHOD,r as WAAP_METHOD,pe as SilkWalletConnect,pe as WaaPWalletConnect,o as UIMessageManager,ee as UI_EVENT_NAMES,ie as WAAP_EVENTS,re as WaaP,a as WaaPError,fe as WaaPSolanaProvider,ue as WaaPSuiWallet,l as WalletMessageManager,c as getWaaPIframeDiagnostics,s as handleWalletRequestAndResponse,de as initWaaP,se as initWaaPMulti,le as initWaaPSolana,oe as initWaaPSquid,ae as initWaaPSui,ce as initWaaPTap,n as normalizeWaaPError,Ut as permissionTokenEvmContract,Wt as permissionTokenEvmFunction,Ht as permissionTokenRecipient,Xt as permissionTokenSolanaAnchorInstruction,$ as permissionTokenSolanaDiscriminator,Jt as permissionTokenSolanaInstruction,qt as permissionTokenSolanaProgram,Kt as permissionTokenSuiFunction,Gt as permissionTokenSuiPackage,ne as preloadWaaPOnIdle,he as registerWaaPSolanaWallet,me as registerWaaPSuiWallet,i as resolveWalletOrigin,d as rpcMethodRequiresUI,f as subscribeWaaPIframeLifecycle,_e as useWaapAuth,ge as useWaapTransaction,e as validateWalletOrigin};
3
+ function Se(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function p(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function m(e,...t){if(!Se(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function h(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function g(e,t){m(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function Ce(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function _(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function v(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function y(e,t){return e<<32-t|e>>>t}const we=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Te(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Ee(e){for(let t=0;t<e.length;t++)e[t]=Te(e[t]);return e}const b=we?e=>e:Ee,De=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,Oe=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function ke(e){if(m(e),De)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=Oe[e[n]];return t}function Ae(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function x(e){return typeof e==`string`&&(e=Ae(e)),m(e),e}var je=class{};function Me(e){let t=t=>e().update(x(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Ne(e){if(e.length>=255)throw TypeError(`Alphabet too long`);let t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let n=0;n<e.length;n++){let r=e.charAt(n),i=r.charCodeAt(0);if(t[i]!==255)throw TypeError(r+` is ambiguous`);t[i]=n}let n=e.length,r=e.charAt(0),i=Math.log(n)/Math.log(256),a=Math.log(256)/Math.log(n);function o(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError(`Expected Uint8Array`);if(t.length===0)return``;let i=0,o=0,s=0,c=t.length;for(;s!==c&&t[s]===0;)s++,i++;let l=(c-s)*a+1>>>0,u=new Uint8Array(l);for(;s!==c;){let e=t[s],r=0;for(let t=l-1;(e!==0||r<o)&&t!==-1;t--,r++)e+=256*u[t]>>>0,u[t]=e%n>>>0,e=e/n>>>0;if(e!==0)throw Error(`Non-zero carry`);o=r,s++}let d=l-o;for(;d!==l&&u[d]===0;)d++;let f=r.repeat(i);for(;d<l;++d)f+=e.charAt(u[d]);return f}function s(e){if(typeof e!=`string`)throw TypeError(`Expected String`);if(e.length===0)return new Uint8Array;let a=0,o=0,s=0;for(;e[a]===r;)o++,a++;let c=(e.length-a)*i+1>>>0,l=new Uint8Array(c);for(;a<e.length;){let r=e.charCodeAt(a);if(r>255)return;let i=t[r];if(i===255)return;let o=0;for(let e=c-1;(i!==0||o<s)&&e!==-1;e--,o++)i+=n*l[e]>>>0,l[e]=i%256>>>0,i=i/256>>>0;if(i!==0)throw Error(`Non-zero carry`);s=o,a++}let u=c-s;for(;u!==c&&l[u]===0;)u++;let d=new Uint8Array(o+(c-u)),f=o;for(;u!==c;)d[f++]=l[u++];return d}function c(e){let t=s(e);if(t)return t;throw Error(`Non-base`+n+` character`)}return{encode:o,decodeUnsafe:s,decode:c}}var S=Ne(`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`);function Pe(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function Fe(e,t,n){return e&t^~e&n}function Ie(e,t,n){return e&t^e&n^t&n}var Le=class extends je{constructor(e,t,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=v(this.buffer)}update(e){h(this),e=x(e),m(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=v(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){h(this),g(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,_(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;Pe(n,r-8,BigInt(this.length*8),i),this.process(n,0);let o=v(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen should be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=r,e.pos=o,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}};const C=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),w=BigInt(2**32-1),T=BigInt(32);function Re(e,t=!1){return t?{h:Number(e&w),l:Number(e>>T&w)}:{h:Number(e>>T&w)|0,l:Number(e&w)|0}}function ze(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=Re(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}const Be=(e,t,n)=>e<<n|t>>>32-n,Ve=(e,t,n)=>t<<n|e>>>32-n,He=(e,t,n)=>t<<n-32|e>>>64-n,Ue=(e,t,n)=>e<<n-32|t>>>64-n,We=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),E=new Uint32Array(64);var Ge=class extends Le{constructor(e=32){super(64,e,8,!1),this.A=C[0]|0,this.B=C[1]|0,this.C=C[2]|0,this.D=C[3]|0,this.E=C[4]|0,this.F=C[5]|0,this.G=C[6]|0,this.H=C[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)E[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=E[e-15],n=E[e-2],r=y(t,7)^y(t,18)^t>>>3,i=y(n,17)^y(n,19)^n>>>10;E[e]=i+E[e-7]+r+E[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=y(o,6)^y(o,11)^y(o,25),u=l+t+Fe(o,s,c)+We[e]+E[e]|0,d=(y(n,2)^y(n,13)^y(n,22))+Ie(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){_(E)}destroy(){this.set(0,0,0,0,0,0,0,0),_(this.buffer)}};const D=Me(()=>new Ge);function Ke(e,t){return e.exec(t)?.groups}const qe=/^tuple(?<array>(\[(\d*)\])*)$/;function O(e){let t=e.type;if(qe.test(e.type)&&`components`in e){t=`(`;let n=e.components.length;for(let r=0;r<n;r++){let i=e.components[r];t+=O(i),r<n-1&&(t+=`, `)}let r=Ke(qe,e.type);return t+=`)${r?.array||``}`,O({...e,type:t})}return`indexed`in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function k(e){let t=``,n=e.length;for(let r=0;r<n;r++){let i=e[r];t+=O(i),r!==n-1&&(t+=`, `)}return t}function Je(e){return e.type===`function`?`function ${e.name}(${k(e.inputs)})${e.stateMutability&&e.stateMutability!==`nonpayable`?` ${e.stateMutability}`:``}${e.outputs?.length?` returns (${k(e.outputs)})`:``}`:e.type===`event`?`event ${e.name}(${k(e.inputs)})`:e.type===`error`?`error ${e.name}(${k(e.inputs)})`:e.type===`constructor`?`constructor(${k(e.inputs)})${e.stateMutability===`payable`?` payable`:``}`:e.type===`fallback`?`fallback() external${e.stateMutability===`payable`?` payable`:``}`:`receive() external payable`}function A(e,{strict:t=!0}={}){return!e||typeof e!=`string`?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith(`0x`)}function j(e){return A(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const M=`2.55.2`;let N={getDocsUrl:({docsBaseUrl:e,docsPath:t=``,docsSlug:n})=>t?`${e??`https://viem.sh`}${t}${n?`#${n}`:``}`:void 0,version:`viem@${M}`};var P=class e extends Error{constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof e&&n.cause.docsPath||n.docsPath,a=N.getDocsUrl?.({...n,docsPath:i}),o=[t||`An error occurred.`,``,...n.metaMessages?[...n.metaMessages,``]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...N.version?[`Version: ${N.version}`]:[]].join(`
4
+ `);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`BaseError`}),this.details=r,this.docsPath=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=M}walk(e){return F(this,e)}};function F(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?F(e.cause,t):t?null:e}var I=class extends P{constructor({offset:e,position:t,size:n}){super(`Slice ${t===`start`?`starting`:`ending`} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:`SliceOffsetOutOfBoundsError`})}},L=class extends P{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:`SizeExceedsPaddingSizeError`})}};function R(e,{dir:t,size:n=32}={}){return typeof e==`string`?Ye(e,{dir:t,size:n}):Xe(e,{dir:t,size:n})}function Ye(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace(`0x`,``);if(r.length>n*2)throw new L({size:Math.ceil(r.length/2),targetSize:n,type:`hex`});return`0x${r[t===`right`?`padEnd`:`padStart`](n*2,`0`)}`}function Xe(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new L({size:e.length,targetSize:n,type:`bytes`});let r=new Uint8Array(n);for(let i=0;i<n;i++){let a=t===`right`;r[a?i:n-i-1]=e[a?i:e.length-i-1]}return r}var Ze=class extends P{constructor({max:e,min:t,signed:n,size:r,value:i}){super(`Number "${i}" is not in safe ${r?`${r*8}-bit ${n?`signed`:`unsigned`} `:``}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:`IntegerOutOfRangeError`})}},Qe=class extends P{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:`SizeOverflowError`})}};function z(e,{size:t}){if(j(e)>t)throw new Qe({givenSize:j(e),maxSize:t})}const $e=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function et(e,t={}){return typeof e==`number`||typeof e==`bigint`?V(e,t):typeof e==`string`?rt(e,t):typeof e==`boolean`?tt(e,t):B(e,t)}function tt(e,t={}){let n=`0x${Number(e)}`;return typeof t.size==`number`?(z(n,{size:t.size}),R(n,{size:t.size})):n}function B(e,t={}){let n=``;for(let t=0;t<e.length;t++)n+=$e[e[t]];let r=`0x${n}`;return typeof t.size==`number`?(z(r,{size:t.size}),R(r,{dir:`right`,size:t.size})):r}function V(e,t={}){let{signed:n,size:r}=t,i=BigInt(e),a;r?a=n?(1n<<BigInt(r)*8n-1n)-1n:2n**(BigInt(r)*8n)-1n:typeof e==`number`&&(a=BigInt(2**53-1));let o=typeof a==`bigint`&&n?-a-1n:0;if(a&&i>a||i<o){let t=typeof e==`bigint`?`n`:``;throw new Ze({max:a?`${a}${t}`:void 0,min:`${o}${t}`,signed:n,size:r,value:`${e}${t}`})}let s=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?R(s,{size:r}):s}const nt=new TextEncoder;function rt(e,t={}){return B(nt.encode(e),t)}const it=new TextEncoder;function H(e,t={}){return typeof e==`number`||typeof e==`bigint`?ot(e,t):typeof e==`boolean`?at(e,t):A(e)?G(e,t):K(e,t)}function at(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size==`number`?(z(n,{size:t.size}),R(n,{size:t.size})):n}const U={zero:48,nine:57,A:65,F:70,a:97,f:102};function W(e){if(e>=U.zero&&e<=U.nine)return e-U.zero;if(e>=U.A&&e<=U.F)return e-(U.A-10);if(e>=U.a&&e<=U.f)return e-(U.a-10)}function G(e,t={}){let n=e;t.size&&(z(n,{size:t.size}),n=R(n,{dir:`right`,size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);let i=r.length/2,a=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let n=W(r.charCodeAt(t++)),i=W(r.charCodeAt(t++));if(n===void 0||i===void 0)throw new P(`Invalid byte sequence ("${r[t-2]}${r[t-1]}" in "${r}").`);a[e]=n*16+i}return a}function ot(e,t){return G(V(e,t))}function K(e,t={}){let n=it.encode(e);return typeof t.size==`number`?(z(n,{size:t.size}),R(n,{dir:`right`,size:t.size})):n}const st=BigInt(0),q=BigInt(1),ct=BigInt(2),lt=BigInt(7),ut=BigInt(256),dt=BigInt(113),ft=[],J=[],Y=[];for(let e=0,t=q,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],ft.push(2*(5*r+n)),J.push((e+1)*(e+2)/2%64);let i=st;for(let e=0;e<7;e++)t=(t<<q^(t>>lt)*dt)%ut,t&ct&&(i^=q<<(q<<BigInt(e))-q);Y.push(i)}const pt=ze(Y,!0),mt=pt[0],ht=pt[1],gt=(e,t,n)=>n>32?He(e,t,n):Be(e,t,n),_t=(e,t,n)=>n>32?Ue(e,t,n):Ve(e,t,n);function vt(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let r=(t+8)%10,i=(t+2)%10,a=n[i],o=n[i+1],s=gt(a,o,1)^n[r],c=_t(a,o,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=J[n],a=gt(t,i,r),o=_t(t,i,r),s=ft[n];t=e[s],i=e[s+1],e[s]=a,e[s+1]=o}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=mt[r],e[1]^=ht[r]}_(n)}var yt=class e extends je{constructor(e,t,n,r=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,p(n),!(0<e&&e<200))throw Error(`only keccak-f1600 function is supported`);this.state=new Uint8Array(200),this.state32=Ce(this.state)}clone(){return this._cloneInto()}keccak(){b(this.state32),vt(this.state32,this.rounds),b(this.state32),this.posOut=0,this.pos=0}update(e){h(this),e=x(e),m(e);let{blockLen:t,state:n}=this,r=e.length;for(let i=0;i<r;){let a=Math.min(t-this.pos,r-i);for(let t=0;t<a;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,t&128&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){h(this,!1),m(e),this.finish();let t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw Error(`XOF is not possible for this instance`);return this.writeInto(e)}xof(e){return p(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(g(e,this),this.finished)throw Error(`digest() was already called`);return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,_(this.state)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:i,rounds:a,enableXOF:o}=this;return t||=new e(n,r,i,o,a),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const bt=((e,t,n)=>Me(()=>new yt(t,e,n)))(1,136,256/8);function xt(e,t){let n=t||`hex`,r=bt(A(e,{strict:!1})?H(e):e);return n===`bytes`?r:et(r)}const St=e=>xt(H(e));function Ct(e){return St(e)}function wt(e){let t=!0,n=``,r=0,i=``,a=!1;for(let o=0;o<e.length;o++){let s=e[o];if([`(`,`)`,`,`].includes(s)&&(t=!0),s===`(`&&r++,s===`)`&&r--,t){if(r===0){if(s===` `&&[`event`,`function`,``].includes(i))i=``;else if(i+=s,s===`)`){a=!0;break}continue}if(s===` `){e[o-1]!==`,`&&n!==`,`&&n!==`,(`&&(n=``,t=!1);continue}i+=s,n+=s}}if(!a)throw new P(`Unable to normalize signature.`);return i}const Tt=e=>wt(typeof e==`string`?e:Je(e));function Et(e){return Ct(Tt(e))}var Dt=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;e!==void 0&&super.delete(e)}return this}};const X=new Dt(8192);function Ot(e,t){if(X.has(`${e}.${t}`))return X.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=xt(K(n),`bytes`),i=(t?n.substring(`${t}0x`.length):n).split(``);for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(r[e>>1]&15)>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let a=`0x${i.join(``)}`;return X.set(`${e}.${t}`,a),a}const kt=/^0x[a-fA-F0-9]{40}$/,Z=new Dt(8192);function At(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(Z.has(r))return Z.get(r);let i=kt.test(e)?e.toLowerCase()===e||!n||Ot(e)===e:!1;return Z.set(r,i),i}function jt(e,t,n,{strict:r}={}){return A(e,{strict:!1})?Pt(e,t,n,{strict:r}):Nt(e,t,n,{strict:r})}function Mt(e,t){if(typeof t==`number`&&t>0&&t>j(e)-1)throw new I({offset:t,position:`start`,size:j(e)})}function Q(e,t,n){if(typeof t==`number`&&typeof n==`number`&&j(e)!==n-t)throw new I({offset:n,position:`end`,size:j(e)})}function Nt(e,t,n,{strict:r}={}){Mt(e,t);let i=e.slice(t,n);return r&&Q(i,t,n),i}function Pt(e,t,n,{strict:r}={}){Mt(e,t);let i=`0x${e.replace(`0x`,``).slice((t??0)*2,(n??e.length)*2)}`;return r&&Q(i,t,n),i}const Ft=e=>jt(Et(e),0,4),It=/^0x[0-9a-fA-F]{1,64}$/,Lt=/^[A-Za-z_][A-Za-z0-9_]*$/;function Rt(e){return`0x${e.slice(2).toLowerCase().padStart(64,`0`)}`}function zt(e){return e.indexOf(`:`)}function Bt(e){try{let t=S.decode(e);return t.length===32?S.encode(t):null}catch{return null}}function Vt(e,t){if(t.length===0||new TextEncoder().encode(t).length>512||t.trim()!==t)return null;let n=zt(t),r=n===-1?t:t.slice(0,n),i=n===-1?null:t.slice(n+1);if(i===``)return null;if(e.startsWith(`evm:`)){if(!At(r))return null;let e=r.toLowerCase();if(i===null)return{kind:`recipient`,address:e,canonical:e};if(i===`*`)return{kind:`application`,target:e,action:{kind:`all`},canonical:`${e}:*`};if(!/^0x[0-9a-fA-F]{8}$/.test(i))return null;let t=i.toLowerCase();return{kind:`application`,target:e,action:{kind:`evm-selector`,selector:t},canonical:`${e}:${t}`}}if(e.startsWith(`sui:`)){if(!It.test(r))return null;let e=Rt(r);if(i===null)return{kind:`recipient`,address:e,canonical:e};if(i===`*`)return{kind:`application`,target:e,action:{kind:`all`},canonical:`${e}:*`};let t=i.split(`::`);return t.length!==2||!Lt.test(t[0])||t[1]!==`*`&&!Lt.test(t[1])?null:{kind:`application`,target:e,action:{kind:`sui-function`,module:t[0],function:t[1]},canonical:`${e}:${t[0]}::${t[1]}`}}let a=Bt(r);if(!a)return null;if(i===null)return{kind:`recipient`,address:a,canonical:a};if(i===`*`)return{kind:`application`,target:a,action:{kind:`all`},canonical:`${a}:*`};let o=i.match(/^disc:(0x[0-9a-fA-F]{2,64})$/)?.[1];if(o&&o.length%2==0){let e=o.toLowerCase();return{kind:`application`,target:a,action:{kind:`solana-discriminator`,discriminator:e},canonical:`${a}:disc:${e}`}}let s=i.match(/^data-sha256:(0x[0-9a-fA-F]{64})$/)?.[1];if(s){let e=s.toLowerCase();return{kind:`application`,target:a,action:{kind:`solana-data-hash`,hash:e},canonical:`${a}:data-sha256:${e}`}}return null}function $(e,t){let n=Vt(e,t);if(!n)throw Error(`Invalid permission-token scope: ${t}`);return n.canonical}function Ht(e){return`0x${ke(e)}`}function Ut(e,t){let n=Vt(e,t);if(!n||n.kind!==`recipient`)throw Error(`Invalid ${e} permission-token recipient: ${t}`);return n.canonical}function Wt(e){return $(`evm:1`,`${e}:*`)}function Gt(e,t){return $(`evm:1`,`${e}:${/^0x[0-9a-fA-F]{8}$/.test(t)?t:Ft(t)}`)}function Kt(e){return $(`sui:mainnet`,`${e}:*`)}function qt(e,t,n=`*`){return $(`sui:mainnet`,`${e}:${t}::${n}`)}function Jt(e){return $(`solana:mainnet`,`${e}:*`)}function Yt(e,t){return $(`solana:mainnet`,`${e}:disc:${typeof t==`string`?t:Ht(t)}`)}function Xt(e,t){return $(`solana:mainnet`,`${e}:data-sha256:${Ht(D(t))}`)}function Zt(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).replace(/[-\s]+/g,`_`).toLowerCase()}function Qt(e,t){return Yt(e,t.discriminator?Uint8Array.from(t.discriminator):D(Ae(`global:${Zt(t.name)}`)).slice(0,8))}export{me as EthereumProvider,xe as EthereumProviderExtension,f as SILK_METHOD,f as WAAP_METHOD,he as SilkWalletConnect,he as WaaPWalletConnect,l as UIMessageManager,o as UI_EVENT_NAMES,ne as WAAP_EVENTS,r as WaaP,ee as WaaPError,ue as WaaPSolanaProvider,de as WaaPStellarProvider,ie as WaaPSuiWallet,i as WalletMessageManager,c as getWaaPIframeDiagnostics,a as handleWalletRequestAndResponse,le as initWaaP,oe as initWaaPMulti,ce as initWaaPSolana,ae as initWaaPSquid,fe as initWaaPStellar,re as initWaaPSui,se as initWaaPTap,t as normalizeWaaPError,Wt as permissionTokenEvmContract,Gt as permissionTokenEvmFunction,Ut as permissionTokenRecipient,Qt as permissionTokenSolanaAnchorInstruction,Yt as permissionTokenSolanaDiscriminator,Xt as permissionTokenSolanaInstruction,Jt as permissionTokenSolanaProgram,qt as permissionTokenSuiFunction,Kt as permissionTokenSuiPackage,s as preloadWaaPOnIdle,_e as registerWaaPSolanaWallet,ge as registerWaaPSuiWallet,d as resolveWalletOrigin,n as rpcMethodRequiresUI,u as subscribeWaaPIframeLifecycle,ye as useWaapAuth,ve as useWaapTransaction,te as validateWalletOrigin};
@@ -0,0 +1 @@
1
+ import{S as e,_ as t,c as n,d as r,f as i,g as a,h as o,l as s,m as c,o as l,r as u,t as d,v as f,w as p}from"./UIMessageManager-D3VN9vM8.mjs";import{EventEmitter as m}from"events";const h={PUBLIC:`Public Global Stellar Network ; September 2015`,TESTNET:`Test SDF Network ; September 2015`},g=(e,t,n)=>({error:{code:e,message:t,...n?{ext:n}:{}}});function _(e){let t=e instanceof Error?e.message:String(e),n=t.toLowerCase();return n.includes(`reject`)||n.includes(`cancel`)||n.includes(`denied`)||n.includes(`closed`)?g(-4,`The user rejected this request.`,[t]):n.includes(`horizon`)||n.includes(`network`)?g(-2,`An error occurred with the Stellar network. Please try again.`,[t]):g(-1,`The wallet encountered an internal error. Please try again or contact support if the problem persists.`,[t])}var v=class{constructor(e,t={},n,i=t){this.name=`WaaP`,this.version=`1.0.0`,this.address=null,this.accountMode=`tap`,this.loginMethod=null,this.internalEventEmitter=new m,this.initializerPromise=null,this.initializedIframeWindow=null,this.network=t.network??`PUBLIC`,this.walletMessageManager=new r(e,f(t)),this.ensureIframe=n,this.iframeMounted=!n,this.initializerOptions=i,this.uiMessageManager=new d,this.walletMessageManager.addListener({handleResponse:e=>{this.internalEventEmitter.emit(e.id,e)},handleRequest:e=>{e.method===p.show_modal?this.uiMessageManager.emit(`show_modal`):e.method===p.hide_modal&&this.uiMessageManager.emit(`hide_modal`)},onAccountChanged:async()=>{this.address=null}})}destroy(){this.walletMessageManager.dispose(),this.internalEventEmitter.removeAllListeners(),this.uiMessageManager.removeAllListeners(),this.address=null}get ui(){return this.uiMessageManager}ensureIframeMounted(){if(this.iframeMounted||!this.ensureIframe)return;let e=this.ensureIframe();if(!e)throw Error(`Failed to create WaaP iframe`);this.iframeMounted=!0,this.walletMessageManager.setIframeWindow(e)}async preload(){if(!this.ensureIframe)return;this.ensureIframeMounted();let e=this.walletMessageManager.getIframeWindow();if(!e)throw Error(`WaaP iframe is not mounted`);if(this.initializedIframeWindow===e&&this.initializerPromise)return this.initializerPromise;this.initializedIframeWindow=e,this.initializerPromise=c(e,()=>this.selectAccountMode(this.accountMode,this.initializerOptions));try{await this.initializerPromise}catch(e){throw this.initializerPromise=null,this.initializedIframeWindow=null,e}}async ensureInitialized(){await this.preload()}setAccountMode(e){this.accountMode=e,this.initializerPromise=null,this.initializedIframeWindow=null}async selectAccountMode(e,t={}){await this.walletMessageManager.pingIframe(),await this.postRequestAndWait({method:p.set_signing_mode,params:[i(e,t)],interactionRequired:!1})}setLoginMethod(e){this.loginMethod=e,e===null&&(this.address=null)}getLoginMethod(){return this.loginMethod}async login(){await this.ensureInitialized();let e=(await this.postRequestAndWait({method:p.login,params:[],interactionRequired:!0})).data;return e!==`waap`&&e!==`human`&&e!==`injected`&&e!==`walletconnect`?(this.loginMethod=null,null):(this.loginMethod=e,e)}async logout(){await this.ensureInitialized(),await this.postRequestAndWait({method:p.logout,params:[],interactionRequired:!1}),this.loginMethod=null,this.address=null}async disconnect(){await this.ensureInitialized(),await this.postRequestAndWait({method:p.stellar_disconnect,params:[],interactionRequired:!1}),this.address=null}async getAccountStatus(){await this.ensureInitialized();let e=await this.postRequestAndWait({method:p.waap_getAccountStatus,params:[],interactionRequired:!1});if(e.error)throw Error(e.error.message||`Failed to read WaaP status`);return e.data}async getNetwork(){return{network:this.network,networkPassphrase:h[this.network]}}async getAddress(){try{if(this.address)return{address:this.address};await this.ensureInitialized();let e=(await this.postRequestAndWait({method:p.stellar_connect,params:[{}],interactionRequired:!this.loginMethod})).data?.address;return e?(this.address=e,{address:e}):g(-1,`The wallet has no Stellar address for this account.`)}catch(e){return _(e)}}async signTransaction(e,t){try{if(typeof e!=`string`||e.length===0)return g(-3,`Request is invalid. Please check the details.`,[`Missing transaction XDR`]);let n=this.networkMismatch(t?.networkPassphrase);if(n)return n;if(t?.submitUrl)return g(-3,`This wallet submits through its own Stellar network connection and cannot submit to a supplied URL.`,[`submitUrl is not supported`]);let r=await this.requireAddress(t?.address);if(`error`in r)return r;let i=(await this.postRequestAndWait({method:t?.submit?p.stellar_signAndSendTransaction:p.stellar_signTransaction,params:[{xdr:e,account:r.address,network:this.network}],interactionRequired:!0})).data;return i?.signedTxXdr?{signedTxXdr:i.signedTxXdr,signerAddress:r.address}:g(-1,`The wallet did not return a signed transaction.`)}catch(e){return _(e)}}async signMessage(e,t){try{if(typeof e!=`string`||e.length===0)return g(-3,`Request is invalid. Please check the details.`,[`Missing message`]);let n=this.networkMismatch(t?.networkPassphrase);if(n)return n;let r=await this.requireAddress(t?.address);if(`error`in r)return r;let i=(await this.postRequestAndWait({method:p.stellar_signMessage,params:[{message:e,account:r.address,network:this.network}],interactionRequired:!0})).data;return i?.signedMessage?{signedMessage:i.signedMessage,signerAddress:r.address}:g(-1,`The wallet did not return a signature.`)}catch(e){return _(e)}}async signAuthEntry(){return g(-1,`This wallet does not support Soroban authorization entries yet.`)}networkMismatch(e){if(!(!e||e===h[this.network]))return g(-3,`This wallet is connected to Stellar ${this.network}. Reconnect it to the network this transaction was built for.`,[`expected ${h[this.network]}`])}async requireAddress(e){let t=await this.getAddress();if(t.error)return{error:t.error};let n=t.address;return e&&e!==n?g(-3,`This wallet is not signing for the requested address.`,[`requested ${e}`]):{address:n}}async postRequestAndWait(t){let r;try{t.interactionRequired&&s({layout:t.method===p.login?`auth`:`signing`}),r=await this.walletMessageManager.postSilkRequest({method:t.method,params:t.params,interactionRequired:t.interactionRequired});let e=await l({eventEmitter:this.internalEventEmitter,id:r,method:t.method,interactionRequired:t.interactionRequired,signal:t.signal,timeoutMs:t.timeoutMs,onCancel:()=>{this.walletMessageManager.cancelSilkRequest(r,t.method),t.interactionRequired&&n()}});if(e.error)throw Error(e.error.message);return e}catch(i){throw t.interactionRequired&&r===void 0&&n(),e(i,{chain:`stellar`,method:String(t.method),requestId:r})}}};function y(e={}){let r=()=>(a(e),o(`tap`).contentWindow),i=e.deferIframe===!1,c=e.deferIframe===void 0,l=i?r():null;if(i&&!l)throw Error(`Failed to create WaaP iframe`);let d=new v(l,e,r,{...e,chains:[`stellar`]});i&&d.preload().catch(()=>void 0);let f=d.destroy.bind(d);if(d.destroy=()=>{f(),t()},c){let e=u(d),t=d.destroy.bind(d);d.destroy=()=>{e(),t()}}return d.ui.on(`show_modal`,()=>{s()}),d.ui.on(`hide_modal`,()=>{n()}),d}export{v as n,y as t};
@@ -0,0 +1,84 @@
1
+ import { d as WaaPAccountMode, f as WaaPAccountStatus, r as LoginResponse } from "./types-Cc6tc4ut.js";
2
+ import { a as StellarSignBlobOptions, c as WaaPInitializerOptions, i as StellarNetwork, o as StellarSignTransactionOptions, r as Sep43Result, s as WaaPStellarProviderInterface, t as InitWaaPStellarOptions } from "./types-DqdVfkaW.js";
3
+ import { t as UIMessageManager } from "./UIMessageManager-4xqSTTBS.js";
4
+ //#region src/lib/stellar/StellarProvider.d.ts
5
+ declare class WaaPStellarProvider implements WaaPStellarProviderInterface {
6
+ readonly name = "WaaP";
7
+ readonly version = "1.0.0";
8
+ private readonly network;
9
+ private address;
10
+ private accountMode;
11
+ private loginMethod;
12
+ private walletMessageManager;
13
+ private uiMessageManager;
14
+ private internalEventEmitter;
15
+ private ensureIframe?;
16
+ private iframeMounted;
17
+ private initializerOptions;
18
+ private initializerPromise;
19
+ private initializedIframeWindow;
20
+ constructor(iframeWindow: Window | null, options?: InitWaaPStellarOptions, ensureIframe?: () => Window | null, initializerOptions?: WaaPInitializerOptions);
21
+ destroy(): void;
22
+ get ui(): UIMessageManager;
23
+ private ensureIframeMounted;
24
+ preload(): Promise<void>;
25
+ private ensureInitialized;
26
+ setAccountMode(mode: WaaPAccountMode): void;
27
+ selectAccountMode(mode: WaaPAccountMode, options?: WaaPInitializerOptions): Promise<void>;
28
+ setLoginMethod(loginMethod: LoginResponse): void;
29
+ getLoginMethod(): LoginResponse;
30
+ login(): Promise<LoginResponse>;
31
+ logout(): Promise<void>;
32
+ disconnect(): Promise<void>;
33
+ getAccountStatus(): Promise<WaaPAccountStatus>;
34
+ /**
35
+ * `getNetwork` is answered locally.
36
+ *
37
+ * The facade is initialized for one network and signs for that one; a round
38
+ * trip could only ever disagree with it, and a dapp that believed the round
39
+ * trip would build a transaction the wallet then refuses.
40
+ */
41
+ getNetwork(): Promise<Sep43Result<{
42
+ network: StellarNetwork;
43
+ networkPassphrase: string;
44
+ }>>;
45
+ getAddress(): Promise<Sep43Result<{
46
+ address: string;
47
+ }>>;
48
+ signTransaction(xdr: string, opts?: StellarSignTransactionOptions): Promise<Sep43Result<{
49
+ signedTxXdr: string;
50
+ signerAddress: string;
51
+ }>>;
52
+ signMessage(message: string, opts?: StellarSignBlobOptions): Promise<Sep43Result<{
53
+ signedMessage: string;
54
+ signerAddress: string;
55
+ }>>;
56
+ /**
57
+ * Not supported, and refused rather than approximated.
58
+ *
59
+ * A Soroban authorization entry is a different preimage with different
60
+ * consequences, and the wallet has nothing that can decode or display one.
61
+ * Signing a blob it cannot show the user is exactly the blind signing the
62
+ * rest of this integration is built to avoid. SEP-43 defines no
63
+ * "unsupported" code, so this is -1 with a message that says why.
64
+ */
65
+ signAuthEntry(): Promise<Sep43Result<{
66
+ signedAuthEntry: string;
67
+ signerAddress: string;
68
+ }>>;
69
+ /** A dapp may assert which network it built for; it may never select one. */
70
+ private networkMismatch;
71
+ private requireAddress;
72
+ private postRequestAndWait;
73
+ }
74
+ //#endregion
75
+ //#region src/lib/stellar/init.d.ts
76
+ /**
77
+ * Initialize a standalone SEP-43 Stellar wallet.
78
+ *
79
+ * Always TAP: Stellar signs with the `t2` ed25519 key, and Squid's shared
80
+ * dWallet has no funded Stellar account to send from.
81
+ */
82
+ declare function initWaaPStellar(options?: InitWaaPStellarOptions): WaaPStellarProviderInterface;
83
+ //#endregion
84
+ export { WaaPStellarProvider as n, initWaaPStellar as t };
@@ -0,0 +1,84 @@
1
+ import { d as WaaPAccountMode, f as WaaPAccountStatus, r as LoginResponse } from "./types-Cc6tc4ut.mjs";
2
+ import { a as StellarSignBlobOptions, c as WaaPInitializerOptions, i as StellarNetwork, o as StellarSignTransactionOptions, r as Sep43Result, s as WaaPStellarProviderInterface, t as InitWaaPStellarOptions } from "./types-Bai14yLc.mjs";
3
+ import { t as UIMessageManager } from "./UIMessageManager-4xqSTTBS.mjs";
4
+ //#region src/lib/stellar/StellarProvider.d.ts
5
+ declare class WaaPStellarProvider implements WaaPStellarProviderInterface {
6
+ readonly name = "WaaP";
7
+ readonly version = "1.0.0";
8
+ private readonly network;
9
+ private address;
10
+ private accountMode;
11
+ private loginMethod;
12
+ private walletMessageManager;
13
+ private uiMessageManager;
14
+ private internalEventEmitter;
15
+ private ensureIframe?;
16
+ private iframeMounted;
17
+ private initializerOptions;
18
+ private initializerPromise;
19
+ private initializedIframeWindow;
20
+ constructor(iframeWindow: Window | null, options?: InitWaaPStellarOptions, ensureIframe?: () => Window | null, initializerOptions?: WaaPInitializerOptions);
21
+ destroy(): void;
22
+ get ui(): UIMessageManager;
23
+ private ensureIframeMounted;
24
+ preload(): Promise<void>;
25
+ private ensureInitialized;
26
+ setAccountMode(mode: WaaPAccountMode): void;
27
+ selectAccountMode(mode: WaaPAccountMode, options?: WaaPInitializerOptions): Promise<void>;
28
+ setLoginMethod(loginMethod: LoginResponse): void;
29
+ getLoginMethod(): LoginResponse;
30
+ login(): Promise<LoginResponse>;
31
+ logout(): Promise<void>;
32
+ disconnect(): Promise<void>;
33
+ getAccountStatus(): Promise<WaaPAccountStatus>;
34
+ /**
35
+ * `getNetwork` is answered locally.
36
+ *
37
+ * The facade is initialized for one network and signs for that one; a round
38
+ * trip could only ever disagree with it, and a dapp that believed the round
39
+ * trip would build a transaction the wallet then refuses.
40
+ */
41
+ getNetwork(): Promise<Sep43Result<{
42
+ network: StellarNetwork;
43
+ networkPassphrase: string;
44
+ }>>;
45
+ getAddress(): Promise<Sep43Result<{
46
+ address: string;
47
+ }>>;
48
+ signTransaction(xdr: string, opts?: StellarSignTransactionOptions): Promise<Sep43Result<{
49
+ signedTxXdr: string;
50
+ signerAddress: string;
51
+ }>>;
52
+ signMessage(message: string, opts?: StellarSignBlobOptions): Promise<Sep43Result<{
53
+ signedMessage: string;
54
+ signerAddress: string;
55
+ }>>;
56
+ /**
57
+ * Not supported, and refused rather than approximated.
58
+ *
59
+ * A Soroban authorization entry is a different preimage with different
60
+ * consequences, and the wallet has nothing that can decode or display one.
61
+ * Signing a blob it cannot show the user is exactly the blind signing the
62
+ * rest of this integration is built to avoid. SEP-43 defines no
63
+ * "unsupported" code, so this is -1 with a message that says why.
64
+ */
65
+ signAuthEntry(): Promise<Sep43Result<{
66
+ signedAuthEntry: string;
67
+ signerAddress: string;
68
+ }>>;
69
+ /** A dapp may assert which network it built for; it may never select one. */
70
+ private networkMismatch;
71
+ private requireAddress;
72
+ private postRequestAndWait;
73
+ }
74
+ //#endregion
75
+ //#region src/lib/stellar/init.d.ts
76
+ /**
77
+ * Initialize a standalone SEP-43 Stellar wallet.
78
+ *
79
+ * Always TAP: Stellar signs with the `t2` ed25519 key, and Squid's shared
80
+ * dWallet has no funded Stellar account to send from.
81
+ */
82
+ declare function initWaaPStellar(options?: InitWaaPStellarOptions): WaaPStellarProviderInterface;
83
+ //#endregion
84
+ export { WaaPStellarProvider as n, initWaaPStellar as t };
@@ -0,0 +1 @@
1
+ const e=require("./UIMessageManager-CPw6PggC.js");let t=require("events");const n={PUBLIC:`Public Global Stellar Network ; September 2015`,TESTNET:`Test SDF Network ; September 2015`},r=(e,t,n)=>({error:{code:e,message:t,...n?{ext:n}:{}}});function i(e){let t=e instanceof Error?e.message:String(e),n=t.toLowerCase();return n.includes(`reject`)||n.includes(`cancel`)||n.includes(`denied`)||n.includes(`closed`)?r(-4,`The user rejected this request.`,[t]):n.includes(`horizon`)||n.includes(`network`)?r(-2,`An error occurred with the Stellar network. Please try again.`,[t]):r(-1,`The wallet encountered an internal error. Please try again or contact support if the problem persists.`,[t])}var a=class{constructor(n,r={},i,a=r){this.name=`WaaP`,this.version=`1.0.0`,this.address=null,this.accountMode=`tap`,this.loginMethod=null,this.internalEventEmitter=new t.EventEmitter,this.initializerPromise=null,this.initializedIframeWindow=null,this.network=r.network??`PUBLIC`,this.walletMessageManager=new e.d(n,e.v(r)),this.ensureIframe=i,this.iframeMounted=!i,this.initializerOptions=a,this.uiMessageManager=new e.t,this.walletMessageManager.addListener({handleResponse:e=>{this.internalEventEmitter.emit(e.id,e)},handleRequest:t=>{t.method===e.w.show_modal?this.uiMessageManager.emit(`show_modal`):t.method===e.w.hide_modal&&this.uiMessageManager.emit(`hide_modal`)},onAccountChanged:async()=>{this.address=null}})}destroy(){this.walletMessageManager.dispose(),this.internalEventEmitter.removeAllListeners(),this.uiMessageManager.removeAllListeners(),this.address=null}get ui(){return this.uiMessageManager}ensureIframeMounted(){if(this.iframeMounted||!this.ensureIframe)return;let e=this.ensureIframe();if(!e)throw Error(`Failed to create WaaP iframe`);this.iframeMounted=!0,this.walletMessageManager.setIframeWindow(e)}async preload(){if(!this.ensureIframe)return;this.ensureIframeMounted();let t=this.walletMessageManager.getIframeWindow();if(!t)throw Error(`WaaP iframe is not mounted`);if(this.initializedIframeWindow===t&&this.initializerPromise)return this.initializerPromise;this.initializedIframeWindow=t,this.initializerPromise=e.m(t,()=>this.selectAccountMode(this.accountMode,this.initializerOptions));try{await this.initializerPromise}catch(e){throw this.initializerPromise=null,this.initializedIframeWindow=null,e}}async ensureInitialized(){await this.preload()}setAccountMode(e){this.accountMode=e,this.initializerPromise=null,this.initializedIframeWindow=null}async selectAccountMode(t,n={}){await this.walletMessageManager.pingIframe(),await this.postRequestAndWait({method:e.w.set_signing_mode,params:[e.f(t,n)],interactionRequired:!1})}setLoginMethod(e){this.loginMethod=e,e===null&&(this.address=null)}getLoginMethod(){return this.loginMethod}async login(){await this.ensureInitialized();let t=(await this.postRequestAndWait({method:e.w.login,params:[],interactionRequired:!0})).data;return t!==`waap`&&t!==`human`&&t!==`injected`&&t!==`walletconnect`?(this.loginMethod=null,null):(this.loginMethod=t,t)}async logout(){await this.ensureInitialized(),await this.postRequestAndWait({method:e.w.logout,params:[],interactionRequired:!1}),this.loginMethod=null,this.address=null}async disconnect(){await this.ensureInitialized(),await this.postRequestAndWait({method:e.w.stellar_disconnect,params:[],interactionRequired:!1}),this.address=null}async getAccountStatus(){await this.ensureInitialized();let t=await this.postRequestAndWait({method:e.w.waap_getAccountStatus,params:[],interactionRequired:!1});if(t.error)throw Error(t.error.message||`Failed to read WaaP status`);return t.data}async getNetwork(){return{network:this.network,networkPassphrase:n[this.network]}}async getAddress(){try{if(this.address)return{address:this.address};await this.ensureInitialized();let t=(await this.postRequestAndWait({method:e.w.stellar_connect,params:[{}],interactionRequired:!this.loginMethod})).data?.address;return t?(this.address=t,{address:t}):r(-1,`The wallet has no Stellar address for this account.`)}catch(e){return i(e)}}async signTransaction(t,n){try{if(typeof t!=`string`||t.length===0)return r(-3,`Request is invalid. Please check the details.`,[`Missing transaction XDR`]);let i=this.networkMismatch(n?.networkPassphrase);if(i)return i;if(n?.submitUrl)return r(-3,`This wallet submits through its own Stellar network connection and cannot submit to a supplied URL.`,[`submitUrl is not supported`]);let a=await this.requireAddress(n?.address);if(`error`in a)return a;let o=(await this.postRequestAndWait({method:n?.submit?e.w.stellar_signAndSendTransaction:e.w.stellar_signTransaction,params:[{xdr:t,account:a.address,network:this.network}],interactionRequired:!0})).data;return o?.signedTxXdr?{signedTxXdr:o.signedTxXdr,signerAddress:a.address}:r(-1,`The wallet did not return a signed transaction.`)}catch(e){return i(e)}}async signMessage(t,n){try{if(typeof t!=`string`||t.length===0)return r(-3,`Request is invalid. Please check the details.`,[`Missing message`]);let i=this.networkMismatch(n?.networkPassphrase);if(i)return i;let a=await this.requireAddress(n?.address);if(`error`in a)return a;let o=(await this.postRequestAndWait({method:e.w.stellar_signMessage,params:[{message:t,account:a.address,network:this.network}],interactionRequired:!0})).data;return o?.signedMessage?{signedMessage:o.signedMessage,signerAddress:a.address}:r(-1,`The wallet did not return a signature.`)}catch(e){return i(e)}}async signAuthEntry(){return r(-1,`This wallet does not support Soroban authorization entries yet.`)}networkMismatch(e){if(!(!e||e===n[this.network]))return r(-3,`This wallet is connected to Stellar ${this.network}. Reconnect it to the network this transaction was built for.`,[`expected ${n[this.network]}`])}async requireAddress(e){let t=await this.getAddress();if(t.error)return{error:t.error};let n=t.address;return e&&e!==n?r(-3,`This wallet is not signing for the requested address.`,[`requested ${e}`]):{address:n}}async postRequestAndWait(t){let n;try{t.interactionRequired&&e.l({layout:t.method===e.w.login?`auth`:`signing`}),n=await this.walletMessageManager.postSilkRequest({method:t.method,params:t.params,interactionRequired:t.interactionRequired});let r=await e.o({eventEmitter:this.internalEventEmitter,id:n,method:t.method,interactionRequired:t.interactionRequired,signal:t.signal,timeoutMs:t.timeoutMs,onCancel:()=>{this.walletMessageManager.cancelSilkRequest(n,t.method),t.interactionRequired&&e.c()}});if(r.error)throw Error(r.error.message);return r}catch(r){throw t.interactionRequired&&n===void 0&&e.c(),e.S(r,{chain:`stellar`,method:String(t.method),requestId:n})}}};function o(t={}){let n=()=>(e.g(t),e.h(`tap`).contentWindow),r=t.deferIframe===!1,i=t.deferIframe===void 0,o=r?n():null;if(r&&!o)throw Error(`Failed to create WaaP iframe`);let s=new a(o,t,n,{...t,chains:[`stellar`]});r&&s.preload().catch(()=>void 0);let c=s.destroy.bind(s);if(s.destroy=()=>{c(),e._()},i){let t=e.r(s),n=s.destroy.bind(s);s.destroy=()=>{t(),n()}}return s.ui.on(`show_modal`,()=>{e.l()}),s.ui.on(`hide_modal`,()=>{e.c()}),s}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
package/dist/react.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as useWaapTransaction, i as UseWaapTransactionReturn, n as TxState, r as UseWaapTransactionOptions, t as useWaapAuth } from "./useWaapAuth-CMhYoBKA.mjs";
1
+ import { a as useWaapTransaction, i as UseWaapTransactionReturn, n as TxState, r as UseWaapTransactionOptions, t as useWaapAuth } from "./useWaapAuth-Be1YJk-7.mjs";
2
2
  export { type TxState, type UseWaapTransactionOptions, type UseWaapTransactionReturn, useWaapAuth, useWaapTransaction };
package/dist/react.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as useWaapTransaction, i as UseWaapTransactionReturn, n as TxState, r as UseWaapTransactionOptions, t as useWaapAuth } from "./useWaapAuth-CeJuu2wk.js";
1
+ import { a as useWaapTransaction, i as UseWaapTransactionReturn, n as TxState, r as UseWaapTransactionOptions, t as useWaapAuth } from "./useWaapAuth-DSFDwJtt.js";
2
2
  export { type TxState, type UseWaapTransactionOptions, type UseWaapTransactionReturn, useWaapAuth, useWaapTransaction };
@@ -1,8 +1,10 @@
1
- import { E as RequestPermissionTokenResult, T as RequestPermissionTokenParams, a as PermissionTokenClearResult, d as WaaPAccountMode, f as WaaPAccountStatus, m as WaaPSessionExtension, o as PermissionTokenQuery, r as LoginResponse, s as PermissionTokenStatus } from "./types-x7TOncUp.js";
2
- import { a as SolanaConnectOutput, b as WaaPSolanaWalletFeatures, c as SolanaSignMessageInput, d as SolanaSignTransactionOutput, i as SolanaConnectInput, l as SolanaSignMessageOutput, n as SolanaAccount, o as SolanaSignAndSendTransactionInput, r as SolanaChain, s as SolanaSignAndSendTransactionOutput, t as InitWaaPSolanaOptions, u as SolanaSignTransactionInput, v as SolanaWalletEventListener, y as WaaPSolanaProviderInterface } from "./types-8CCmbLuY.js";
3
- import { n as UIMessageManager, t as WaaPInitializerOptions } from "./initializerContext-Z7JeZRsm.js";
1
+ import { E as RequestPermissionTokenResult, T as RequestPermissionTokenParams, a as PermissionTokenClearResult, d as WaaPAccountMode, f as WaaPAccountStatus, m as WaaPSessionExtension, o as PermissionTokenQuery, r as LoginResponse, s as PermissionTokenStatus } from "./types-Cc6tc4ut.mjs";
2
+ import { a as SolanaConnectOutput, b as WaaPSolanaWalletFeatures, c as SolanaSignMessageInput, d as SolanaSignTransactionOutput, i as SolanaConnectInput, l as SolanaSignMessageOutput, n as SolanaAccount, o as SolanaSignAndSendTransactionInput, r as SolanaChain, s as SolanaSignAndSendTransactionOutput, t as InitWaaPSolanaOptions, u as SolanaSignTransactionInput, v as SolanaWalletEventListener, y as WaaPSolanaProviderInterface } from "./types-C7JDjWnt.mjs";
3
+ import { c as WaaPInitializerOptions } from "./types-Bai14yLc.mjs";
4
+ import { t as UIMessageManager } from "./UIMessageManager-4xqSTTBS.mjs";
4
5
  //#region src/lib/solana/SolanaProvider.d.ts
5
6
  declare class WaaPSolanaProvider implements WaaPSolanaProviderInterface {
7
+ private readonly ownsSession;
6
8
  /**
7
9
  * Last conversion state the wallet actually reported. The synchronous status
8
10
  * accessor cannot await the iframe, and previously answered `complete` for any
@@ -18,6 +20,7 @@ declare class WaaPSolanaProvider implements WaaPSolanaProviderInterface {
18
20
  private accountMode;
19
21
  private loginMethod;
20
22
  private _chains;
23
+ private readonly defaultChain;
21
24
  private walletMessageManager;
22
25
  private uiMessageManager;
23
26
  private internalEventEmitter;
@@ -27,7 +30,7 @@ declare class WaaPSolanaProvider implements WaaPSolanaProviderInterface {
27
30
  private initializerOptions;
28
31
  private initializerPromise;
29
32
  private initializedIframeWindow;
30
- constructor(iframeWindow: Window | null, options?: InitWaaPSolanaOptions, ensureIframe?: () => Window | null, initializerOptions?: WaaPInitializerOptions);
33
+ constructor(iframeWindow: Window | null, options?: InitWaaPSolanaOptions, ensureIframe?: () => Window | null, initializerOptions?: WaaPInitializerOptions, ownsSession?: boolean);
31
34
  /** Release listeners owned by this Solana facade. */
32
35
  destroy(): void;
33
36
  private ensureIframeMounted;
@@ -45,7 +48,7 @@ declare class WaaPSolanaProvider implements WaaPSolanaProviderInterface {
45
48
  get ui(): UIMessageManager;
46
49
  getAccountStatus(): WaaPAccountStatus;
47
50
  get session(): WaaPSessionExtension;
48
- getCanonicalAccountStatus(): Promise<WaaPAccountStatus>;
51
+ getCanonicalAccountStatus(input?: Pick<SolanaConnectInput, 'signal' | 'timeoutMs'>): Promise<WaaPAccountStatus>;
49
52
  /** @internal Initializers set this once; applications select a mode by initializer. */
50
53
  setAccountMode(mode: WaaPAccountMode): void;
51
54
  /** @internal Tell the iframe which initializer family owns this facade. */
@@ -53,7 +56,7 @@ declare class WaaPSolanaProvider implements WaaPSolanaProviderInterface {
53
56
  /** @internal Shared multichain initializers propagate their EVM login here. */
54
57
  setLoginMethod(loginMethod: LoginResponse): void;
55
58
  getLoginMethod(): LoginResponse;
56
- login(): Promise<LoginResponse>;
59
+ login(input?: SolanaConnectInput): Promise<LoginResponse>;
57
60
  logout(): Promise<void>;
58
61
  private refreshAccounts;
59
62
  /**
@@ -1,6 +1,7 @@
1
- import { E as RequestPermissionTokenResult, T as RequestPermissionTokenParams, a as PermissionTokenClearResult, d as WaaPAccountMode, f as WaaPAccountStatus, m as WaaPSessionExtension, o as PermissionTokenQuery, r as LoginResponse, s as PermissionTokenStatus } from "./types-x7TOncUp.mjs";
2
- import { A as SuiSignPersonalMessageOutput, C as SuiConnectInput, D as SuiSignAndExecuteTransactionInput, E as SuiSignAndExecuteTransactionBlockOutput, I as SuiWalletEventListener, M as SuiSignTransactionBlockOutput, N as SuiSignTransactionInput, O as SuiSignAndExecuteTransactionOutput, R as WaaPSuiWalletInterface, S as SuiChain, T as SuiSignAndExecuteTransactionBlockInput, b as InitWaaPSuiOptions, j as SuiSignTransactionBlockInput, k as SuiSignPersonalMessageInput, w as SuiConnectOutput, x as SuiAccount, z as WalletIcon } from "./index-XdQjHMzI.mjs";
3
- import { n as UIMessageManager, t as WaaPInitializerOptions } from "./initializerContext-DB5E2A6s.mjs";
1
+ import { E as RequestPermissionTokenResult, T as RequestPermissionTokenParams, a as PermissionTokenClearResult, d as WaaPAccountMode, f as WaaPAccountStatus, m as WaaPSessionExtension, o as PermissionTokenQuery, r as LoginResponse, s as PermissionTokenStatus } from "./types-Cc6tc4ut.js";
2
+ import { A as SuiSignPersonalMessageInput, B as WalletIcon, C as SuiChain, D as SuiSignAndExecuteTransactionBlockOutput, E as SuiSignAndExecuteTransactionBlockInput, L as SuiWalletEventListener, M as SuiSignTransactionBlockInput, N as SuiSignTransactionBlockOutput, O as SuiSignAndExecuteTransactionInput, P as SuiSignTransactionInput, S as SuiAccount, T as SuiConnectOutput, j as SuiSignPersonalMessageOutput, k as SuiSignAndExecuteTransactionOutput, w as SuiConnectInput, x as InitWaaPSuiOptions, z as WaaPSuiWalletInterface } from "./index-BkKBZpqc.js";
3
+ import { c as WaaPInitializerOptions } from "./types-DqdVfkaW.js";
4
+ import { t as UIMessageManager } from "./UIMessageManager-4xqSTTBS.js";
4
5
  //#region src/lib/sui/SuiWallet.d.ts
5
6
  /**
6
7
  * WaaP Sui Wallet implementation.
@@ -0,0 +1 @@
1
+ import{s as e}from"./ui-DSsOjby7.mjs";import{t}from"./SolanaProvider-BKWKXTWh.mjs";function n(n,r={}){let i=new t(n,r);return i.setAccountMode(`tap`),i.selectAccountMode(`tap`).catch(()=>void 0),e(i),i}export{n as t};
@@ -0,0 +1 @@
1
+ const e=require("./ui-D4wp1W_E.js");let t=require("@mysten/wallet-standard");function n(n,r={}){let i=new e.c(n,r);return(0,t.registerWallet)(i),i}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
@@ -0,0 +1 @@
1
+ import{c as e}from"./ui-DSsOjby7.mjs";import{registerWallet as t}from"@mysten/wallet-standard";function n(n,r={}){let i=new e(n,r);return t(i),i}export{n as t};
@@ -0,0 +1 @@
1
+ const e=require("./ui-D4wp1W_E.js"),t=require("./SolanaProvider-Uv3q1b0H.js");function n(n,r={}){let i=new t.t(n,r);return i.setAccountMode(`tap`),i.selectAccountMode(`tap`).catch(()=>void 0),e.s(i),i}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
@@ -1,8 +1,10 @@
1
- import { E as RequestPermissionTokenResult, T as RequestPermissionTokenParams, a as PermissionTokenClearResult, d as WaaPAccountMode, f as WaaPAccountStatus, m as WaaPSessionExtension, o as PermissionTokenQuery, r as LoginResponse, s as PermissionTokenStatus } from "./types-x7TOncUp.mjs";
2
- import { a as SolanaConnectOutput, b as WaaPSolanaWalletFeatures, c as SolanaSignMessageInput, d as SolanaSignTransactionOutput, i as SolanaConnectInput, l as SolanaSignMessageOutput, n as SolanaAccount, o as SolanaSignAndSendTransactionInput, r as SolanaChain, s as SolanaSignAndSendTransactionOutput, t as InitWaaPSolanaOptions, u as SolanaSignTransactionInput, v as SolanaWalletEventListener, y as WaaPSolanaProviderInterface } from "./types-Bfz205sD.mjs";
3
- import { n as UIMessageManager, t as WaaPInitializerOptions } from "./initializerContext-DB5E2A6s.mjs";
1
+ import { E as RequestPermissionTokenResult, T as RequestPermissionTokenParams, a as PermissionTokenClearResult, d as WaaPAccountMode, f as WaaPAccountStatus, m as WaaPSessionExtension, o as PermissionTokenQuery, r as LoginResponse, s as PermissionTokenStatus } from "./types-Cc6tc4ut.js";
2
+ import { a as SolanaConnectOutput, b as WaaPSolanaWalletFeatures, c as SolanaSignMessageInput, d as SolanaSignTransactionOutput, i as SolanaConnectInput, l as SolanaSignMessageOutput, n as SolanaAccount, o as SolanaSignAndSendTransactionInput, r as SolanaChain, s as SolanaSignAndSendTransactionOutput, t as InitWaaPSolanaOptions, u as SolanaSignTransactionInput, v as SolanaWalletEventListener, y as WaaPSolanaProviderInterface } from "./types-Bj5dDE-C.js";
3
+ import { c as WaaPInitializerOptions } from "./types-DqdVfkaW.js";
4
+ import { t as UIMessageManager } from "./UIMessageManager-4xqSTTBS.js";
4
5
  //#region src/lib/solana/SolanaProvider.d.ts
5
6
  declare class WaaPSolanaProvider implements WaaPSolanaProviderInterface {
7
+ private readonly ownsSession;
6
8
  /**
7
9
  * Last conversion state the wallet actually reported. The synchronous status
8
10
  * accessor cannot await the iframe, and previously answered `complete` for any
@@ -18,6 +20,7 @@ declare class WaaPSolanaProvider implements WaaPSolanaProviderInterface {
18
20
  private accountMode;
19
21
  private loginMethod;
20
22
  private _chains;
23
+ private readonly defaultChain;
21
24
  private walletMessageManager;
22
25
  private uiMessageManager;
23
26
  private internalEventEmitter;
@@ -27,7 +30,7 @@ declare class WaaPSolanaProvider implements WaaPSolanaProviderInterface {
27
30
  private initializerOptions;
28
31
  private initializerPromise;
29
32
  private initializedIframeWindow;
30
- constructor(iframeWindow: Window | null, options?: InitWaaPSolanaOptions, ensureIframe?: () => Window | null, initializerOptions?: WaaPInitializerOptions);
33
+ constructor(iframeWindow: Window | null, options?: InitWaaPSolanaOptions, ensureIframe?: () => Window | null, initializerOptions?: WaaPInitializerOptions, ownsSession?: boolean);
31
34
  /** Release listeners owned by this Solana facade. */
32
35
  destroy(): void;
33
36
  private ensureIframeMounted;
@@ -45,7 +48,7 @@ declare class WaaPSolanaProvider implements WaaPSolanaProviderInterface {
45
48
  get ui(): UIMessageManager;
46
49
  getAccountStatus(): WaaPAccountStatus;
47
50
  get session(): WaaPSessionExtension;
48
- getCanonicalAccountStatus(): Promise<WaaPAccountStatus>;
51
+ getCanonicalAccountStatus(input?: Pick<SolanaConnectInput, 'signal' | 'timeoutMs'>): Promise<WaaPAccountStatus>;
49
52
  /** @internal Initializers set this once; applications select a mode by initializer. */
50
53
  setAccountMode(mode: WaaPAccountMode): void;
51
54
  /** @internal Tell the iframe which initializer family owns this facade. */
@@ -53,7 +56,7 @@ declare class WaaPSolanaProvider implements WaaPSolanaProviderInterface {
53
56
  /** @internal Shared multichain initializers propagate their EVM login here. */
54
57
  setLoginMethod(loginMethod: LoginResponse): void;
55
58
  getLoginMethod(): LoginResponse;
56
- login(): Promise<LoginResponse>;
59
+ login(input?: SolanaConnectInput): Promise<LoginResponse>;
57
60
  logout(): Promise<void>;
58
61
  private refreshAccounts;
59
62
  /**