@wormhole-foundation/wormhole-connect 2.5.0-beta.0-development → 2.5.0-beta.2-development

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 (133) hide show
  1. package/dist/assets/{aptos-t5JANz4b.js → aptos-BGyyK8mz.js} +3 -3
  2. package/dist/assets/{aptos-DvAOSqnD.js → aptos-Cepohe0c.js} +1 -1
  3. package/dist/assets/{blake2b-CzqSqyTv.js → blake2b-BwI-z5NJ.js} +1 -1
  4. package/dist/assets/{ccip-4EBcfi6P.js → ccip-BpjdU5zN.js} +1 -1
  5. package/dist/assets/{chunk-IMTC3J2M-Cms0K4gx.js → chunk-IMTC3J2M-CWE1FuDc.js} +1 -1
  6. package/dist/assets/events-6PekJgMN.js +1 -0
  7. package/dist/assets/{evm-8e-eySdo.js → evm-DS7RCBlt.js} +2 -2
  8. package/dist/assets/{evm-CYjbe4kH.js → evm-DvDOQf0K.js} +4 -4
  9. package/dist/assets/{index-M2j4uONF.js → index-5kmPKAJ_.js} +1 -1
  10. package/dist/assets/{index-DALVDBZq.js → index-BP8gdgNH.js} +1 -1
  11. package/dist/assets/{index-BgVVAYar.js → index-BXRb91Mn.js} +1 -1
  12. package/dist/assets/{index-SO_H3W5I.js → index-Bbr14gKC.js} +1 -1
  13. package/dist/assets/index-BjVbgKwL.js +1 -0
  14. package/dist/assets/{index-JtvUouOr.js → index-BwPu1wGj.js} +1 -1
  15. package/dist/assets/{index-CwGBYrGm.js → index-BxXKtU8j.js} +1 -1
  16. package/dist/assets/{index-BKj7Inys.js → index-BzNSt2uL.js} +1 -1
  17. package/dist/assets/{index-CSHmWPOV.js → index-C1f05Vbe.js} +1 -1
  18. package/dist/assets/{index-BcX-2q-J.js → index-C74fy0qh.js} +1 -1
  19. package/dist/assets/{index-Dl17aI3S.js → index-CCOom38X.js} +1 -1
  20. package/dist/assets/{index-C0rvraea.js → index-CHnF49kB.js} +1 -1
  21. package/dist/assets/{index-DmaqQuhH.js → index-CyxmcHOs.js} +1 -1
  22. package/dist/assets/{index-Chd_bwGM.js → index-D1MoRUWm.js} +1 -1
  23. package/dist/assets/{index-CqA1lXp5.js → index-D54DXHBu.js} +1 -1
  24. package/dist/assets/index-D8nnAO88.js +1 -0
  25. package/dist/assets/index-DpMc0uqY.js +1 -0
  26. package/dist/assets/{index-Ced_GF9G.js → index-FNyibGfB.js} +2 -2
  27. package/dist/assets/{index-D9U4BOHM.js → index-X7Qc-hll.js} +1 -1
  28. package/dist/assets/{index-CcMXeWAX.js → index-YqzS8F8M.js} +2 -2
  29. package/dist/assets/{index.es-Bzsluoyw.js → index.es-B2WvD5Rz.js} +6 -6
  30. package/dist/assets/{solana-BHeUantu.js → solana-Dj3oh4lV.js} +2 -2
  31. package/dist/assets/solana-DseaNtL0.js +2 -0
  32. package/dist/assets/solanaEmbed.esm-xl7iC7nm.js +37 -0
  33. package/dist/assets/sui-BdOrw1dc.js +2 -0
  34. package/dist/assets/{sui-CLrvrAHM.js → sui-Ck-FZzH_.js} +1 -1
  35. package/dist/assets/unsignedTransaction-arVvzoJx.js +1 -0
  36. package/dist/main.js +102 -102
  37. package/dist/src/AppRouter.d.ts.map +1 -1
  38. package/dist/src/utils/coingecko.d.ts.map +1 -1
  39. package/lib/{aptos-By3qLiAP.js → aptos-BHFBFxf9.js} +1 -1
  40. package/lib/{aptos-C3Ph4uY9.mjs → aptos-BusONhYq.mjs} +5 -5
  41. package/lib/{aptos-Cs46Nns5.mjs → aptos-DS0eK_De.mjs} +2 -2
  42. package/lib/{aptos-D7X5GMcO.js → aptos-Dqp93_ct.js} +2 -2
  43. package/lib/{base64-B-n8C-1n.js → base64-Cjk6rii_.js} +1 -1
  44. package/lib/{base64-DxqKuhqD.mjs → base64-Vgzj53Io.mjs} +1 -1
  45. package/lib/{ccip-BoG9ZHRV.js → ccip-BLUli_Dz.js} +1 -1
  46. package/lib/{ccip-DgwbitdX.mjs → ccip-FbY2UZlg.mjs} +1 -1
  47. package/lib/{chunk-IMTC3J2M-DfLEkM5Z.js → chunk-IMTC3J2M-6yduhw0s.js} +1 -1
  48. package/lib/{chunk-IMTC3J2M-w136PyXJ.mjs → chunk-IMTC3J2M-AkEA0_z6.mjs} +3 -3
  49. package/lib/{evm-Bta1KBsb.js → evm-BB0d_Gf4.js} +2 -2
  50. package/lib/{evm--NPB9x1d.mjs → evm-DAHEa0cY.mjs} +5 -5
  51. package/lib/{evm-BwXOj4Er.js → evm-DZww7tTt.js} +3 -3
  52. package/lib/{evm-OXQXmbRf.mjs → evm-gEzFFEsO.mjs} +6 -6
  53. package/lib/{index-C2jvFfvC.js → index-6m6Q8Vsa.js} +1 -1
  54. package/lib/{index-0m16n7L7.js → index-8STuBnQE.js} +1 -1
  55. package/lib/{index-hFtbBndd.js → index-B5i1j7Dy.js} +1 -1
  56. package/lib/{index-CoEGiDGu.js → index-BZh72NtL.js} +1 -1
  57. package/lib/{index-C86P0A0Y.mjs → index-BaMrMiTv.mjs} +1 -1
  58. package/lib/{index-BEHglvs0.js → index-BbxXJYWg.js} +1 -1
  59. package/lib/{index-ByicGRKs.mjs → index-Bcl7n3KD.mjs} +2 -2
  60. package/lib/{index-Bi6PAFR8.mjs → index-BeYO1LV3.mjs} +2 -2
  61. package/lib/{index-wsfzS6PN.js → index-Bhgci81L.js} +120 -120
  62. package/lib/{index-CWffCIQl.js → index-BuPKwE_4.js} +1 -1
  63. package/lib/{index-C5tynAhb.mjs → index-C27ZY3oS.mjs} +1 -1
  64. package/lib/{index-bDliG7yg.mjs → index-C6YOw6gB.mjs} +4 -4
  65. package/lib/{index-1WX3nZoM.mjs → index-CA09NOzo.mjs} +3 -3
  66. package/lib/index-CHaex8L3.mjs +75 -0
  67. package/lib/{index-B5z5oFY1.js → index-CSK3DRpf.js} +1 -1
  68. package/lib/{index-Cslbrg97.js → index-CT45reKG.js} +1 -1
  69. package/lib/{index-PnMJX4OC.mjs → index-CkXJo6xD.mjs} +1 -1
  70. package/lib/{index-FGc8swXY.mjs → index-Cs1dlfzD.mjs} +1 -1
  71. package/lib/{index-CKtZvS3X.mjs → index-CxTd6N-A.mjs} +2 -2
  72. package/lib/{index-CGbtcED2.mjs → index-D9hjnIst.mjs} +2 -2
  73. package/lib/{index-CksJcNrV.mjs → index-DDZaEBsC.mjs} +3 -3
  74. package/lib/{index-CDwpyfnd.mjs → index-DR-fv3uE.mjs} +2 -2
  75. package/lib/{index-BGqNMVpQ.js → index-DUC1gOTG.js} +1 -1
  76. package/lib/{index-Bpx_Rf1J.js → index-DUZnVNwZ.js} +1 -1
  77. package/lib/{index-DLiQpgMj.js → index-DXzXHly-.js} +1 -1
  78. package/lib/{index-MytorfyK.mjs → index-D_PIxJ0d.mjs} +2 -2
  79. package/lib/index-D_XBMeuk.js +1 -0
  80. package/lib/{index-DSejRtdA.js → index-DcYZkDfF.js} +1 -1
  81. package/lib/{index-cyTUScMF.js → index-DhR1_nfh.js} +1 -1
  82. package/lib/index-DhowVYVk.mjs +191 -0
  83. package/lib/{index-BLxoZ8qT.js → index-DlNp9VMO.js} +1 -1
  84. package/lib/{index-zMaT9P4V.mjs → index-DpeIjsSi.mjs} +1 -1
  85. package/lib/{index-B3smMSuW.js → index-Ds5QMWJr.js} +1 -1
  86. package/lib/{index-BXc3l4Br.mjs → index-Ds6Q5qfX.mjs} +2 -2
  87. package/lib/{index-DlW1-aGm.js → index-DtjJKYjA.js} +1 -1
  88. package/lib/{index-ILKgpNXM.js → index-FoZ3qnSm.js} +1 -1
  89. package/lib/{index-CoX_24Ky.mjs → index-GSQqQOXb.mjs} +1 -1
  90. package/lib/{index-m0543tB2.mjs → index-LdDD7AAy.mjs} +20959 -32801
  91. package/lib/index-OqOcvaDE.mjs +654 -0
  92. package/lib/{index-50mhIuON.mjs → index-QCqnETT_.mjs} +2 -2
  93. package/lib/index-j8CdhHvQ.js +1 -0
  94. package/lib/{index-Dt0J9sau.js → index-pWRTEePn.js} +1 -1
  95. package/lib/{index-DPM7TGSv.mjs → index-pg4EQbm-.mjs} +11 -2
  96. package/lib/index-s9pQs8eO.js +1 -0
  97. package/lib/{index-CANn2DFq.mjs → index-tI4rmxN8.mjs} +1 -1
  98. package/lib/{index-NTAse-vE.js → index-u05I0QmU.js} +1 -1
  99. package/lib/{index.es-DIL345_I.js → index.es-BeAVotPr.js} +2 -2
  100. package/lib/{index.es-Bh1QXm67.mjs → index.es-Z5ZsZIyC.mjs} +5 -5
  101. package/lib/index.js +1 -1
  102. package/lib/index.mjs +19 -19
  103. package/lib/{signer-CeNONJjb.mjs → signer-B0f07_6U.mjs} +1 -1
  104. package/lib/{signer-Br2-fgMa.js → signer-yr6Zpc2i.js} +1 -1
  105. package/lib/{solana-C5lAA_Eh.mjs → solana-C-LeRjT-.mjs} +4 -4
  106. package/lib/solana-Ci7N1M7R.js +1 -0
  107. package/lib/solana-DCefclYK.mjs +17 -0
  108. package/lib/{solana-Bwwk-8HE.js → solana-DWYDxAWP.js} +1 -1
  109. package/lib/{solanaEmbed.esm-_NPc8tZC.mjs → solanaEmbed.esm-CEtmCHNm.mjs} +1 -1
  110. package/lib/{solanaEmbed.esm-BMTrlSVI.js → solanaEmbed.esm-D5pFIuXZ.js} +1 -1
  111. package/lib/src/AppRouter.d.ts.map +1 -1
  112. package/lib/src/utils/coingecko.d.ts.map +1 -1
  113. package/lib/sui-756LVCZm.js +1 -0
  114. package/lib/{sui-zLYQBpSC.js → sui-BIUo4whG.js} +1 -1
  115. package/lib/sui-BuI3_sI0.mjs +585 -0
  116. package/lib/{sui-X62i5q3_.mjs → sui-naAV3r83.mjs} +1 -1
  117. package/package.json +17 -17
  118. package/dist/assets/index-BRtMY3at.js +0 -1
  119. package/dist/assets/index-BUlVFUMr.js +0 -1
  120. package/dist/assets/index-RBS_ALc7.js +0 -1
  121. package/dist/assets/solana-BEFCVrXa.js +0 -2
  122. package/dist/assets/solanaEmbed.esm-B7A7qKmk.js +0 -37
  123. package/dist/assets/sui-C1wbtvIC.js +0 -2
  124. package/lib/index-CNkTJOH_.js +0 -1
  125. package/lib/index-DN6dWOSB.js +0 -1
  126. package/lib/index-DUOnxuE_.mjs +0 -252
  127. package/lib/index-DqFY4i5u.js +0 -1
  128. package/lib/index-Eomc9IwB.mjs +0 -936
  129. package/lib/index-fkzogQYE.mjs +0 -376
  130. package/lib/solana-4Qcfxe9o.js +0 -1
  131. package/lib/solana-DM9nG3cQ.mjs +0 -17
  132. package/lib/sui-BvJu9wTN.mjs +0 -701
  133. package/lib/sui-pGBefbTJ.js +0 -1
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D8nnAO88.js","main.js","main.css","assets/blake2b-BwI-z5NJ.js","assets/index-CyxmcHOs.js","assets/index-BjVbgKwL.js","assets/unsignedTransaction-arVvzoJx.js","assets/index-DpMc0uqY.js"])))=>i.map(i=>d[i]);
2
+ var wn=Object.defineProperty;var vn=(r,e,t)=>e in r?wn(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var le=(r,e,t)=>vn(r,typeof e!="symbol"?e+"":e,t);import{be as Sn,bf as At,bg as nt,bh as z,bi as ze,bj as A,bk as Pt,bl as Z,bm as k,bn as kn,bo as gr,bp as se,bq as Ze,br as Xt,aN as En,bs as Qt,bt as On,bu as In,aO as Tn,aQ as jn,aR as Cn,bv as _n,aT as Mn,aU as ft,aV as xn,bw as Xe,aX as An,aY as Pn,a_ as mr,a$ as yr,bb as te,_ as pt,aA as Un}from"../main.js";import{b as st}from"./blake2b-BwI-z5NJ.js";import{m as $n}from"./index-CyxmcHOs.js";function it(r){let e=[],t=0;if(r===0)return[0];for(;r>0;)e[t]=r&127,(r>>=7)&&(e[t]|=128),t+=1;return e}function Bn(r){let e=0,t=0,n=0;for(;;){let s=r[n];if(n+=1,e|=(s&127)<<t,!(s&128))break;t+=7}return{value:e,length:n}}class Rn{constructor(e){this.bytePosition=0,this.dataView=new DataView(e.buffer)}shift(e){return this.bytePosition+=e,this}read8(){let e=this.dataView.getUint8(this.bytePosition);return this.shift(1),e}read16(){let e=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),e}read32(){let e=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),e}read64(){let e=this.read32(),n=this.read32().toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+n).toString(10)}read128(){let e=BigInt(this.read64()),n=BigInt(this.read64()).toString(16)+e.toString(16).padStart(16,"0");return BigInt("0x"+n).toString(10)}read256(){let e=BigInt(this.read128()),n=BigInt(this.read128()).toString(16)+e.toString(16).padStart(32,"0");return BigInt("0x"+n).toString(10)}readBytes(e){let t=this.bytePosition+this.dataView.byteOffset,n=new Uint8Array(this.dataView.buffer,t,e);return this.shift(e),n}readULEB(){let e=this.bytePosition+this.dataView.byteOffset,t=new Uint8Array(this.dataView.buffer,e),{value:n,length:s}=Bn(t);return this.shift(s),n}readVec(e){let t=this.readULEB(),n=[];for(let s=0;s<t;s++)n.push(e(this,s,t));return n}}class Nn{constructor({initialSize:e=1024,maxSize:t=1/0,allocateSize:n=1024}={}){this.bytePosition=0,this.size=e,this.maxSize=t,this.allocateSize=n,this.dataView=new DataView(new ArrayBuffer(e))}ensureSizeOrGrow(e){const t=this.bytePosition+e;if(t>this.size){const n=Math.min(this.maxSize,this.size+this.allocateSize);if(t>n)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${t}`);this.size=n;const s=new ArrayBuffer(this.size);new Uint8Array(s).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(s)}}shift(e){return this.bytePosition+=e,this}write8(e){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(e)),this.shift(1)}write16(e){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(e),!0),this.shift(2)}write32(e){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(e),!0),this.shift(4)}write64(e){return gt(BigInt(e),8).forEach(t=>this.write8(t)),this}write128(e){return gt(BigInt(e),16).forEach(t=>this.write8(t)),this}write256(e){return gt(BigInt(e),32).forEach(t=>this.write8(t)),this}writeULEB(e){return it(e).forEach(t=>this.write8(t)),this}writeVec(e,t){return this.writeULEB(e.length),Array.from(e).forEach((n,s)=>t(this,n,s,e.length)),this}*[Symbol.iterator](){for(let e=0;e<this.bytePosition;e++)yield this.dataView.getUint8(e);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(e){return Sn(this.toBytes(),e)}}function gt(r,e){let t=new Uint8Array(e),n=0;for(;r>0;)t[n]=Number(r%BigInt(256)),r=r/BigInt(256),n+=1;return t}var br=r=>{throw TypeError(r)},wr=(r,e,t)=>e.has(r)||br("Cannot "+t),F=(r,e,t)=>(wr(r,e,"read from private field"),t?t.call(r):e.get(r)),at=(r,e,t)=>e.has(r)?br("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),ot=(r,e,t,n)=>(wr(r,e,"write to private field"),e.set(r,t),t),ve,Ae,Qe,ce;const Dn=class vr{constructor(e){at(this,ve),at(this,Ae),this.name=e.name,this.read=e.read,this.serializedSize=e.serializedSize??(()=>null),ot(this,ve,e.write),ot(this,Ae,e.serialize??((t,n)=>{const s=new Nn({initialSize:this.serializedSize(t)??void 0,...n});return F(this,ve).call(this,t,s),s.toBytes()})),this.validate=e.validate??(()=>{})}write(e,t){this.validate(e),F(this,ve).call(this,e,t)}serialize(e,t){return this.validate(e),new zn(this,F(this,Ae).call(this,e,t))}parse(e){const t=new Rn(e);return this.read(t)}fromHex(e){return this.parse(At(e))}fromBase58(e){return this.parse(nt(e))}fromBase64(e){return this.parse(z(e))}transform({name:e,input:t,output:n,validate:s}){return new vr({name:e??this.name,read:i=>n?n(this.read(i)):this.read(i),write:(i,o)=>F(this,ve).call(this,t?t(i):i,o),serializedSize:i=>this.serializedSize(t?t(i):i),serialize:(i,o)=>F(this,Ae).call(this,t?t(i):i,o),validate:i=>{s==null||s(i),this.validate(t?t(i):i)}})}};ve=new WeakMap;Ae=new WeakMap;let H=Dn;const Sr=Symbol.for("@mysten/serialized-bcs");function Ut(r){return!!r&&typeof r=="object"&&r[Sr]===!0}class zn{constructor(e,t){at(this,Qe),at(this,ce),ot(this,Qe,e),ot(this,ce,t)}get[Sr](){return!0}toBytes(){return F(this,ce)}toHex(){return ze(F(this,ce))}toBase64(){return A(F(this,ce))}toBase58(){return Pt(F(this,ce))}parse(){return F(this,Qe).parse(F(this,ce))}}Qe=new WeakMap;ce=new WeakMap;function ct({size:r,...e}){return new H({...e,serializedSize:()=>r})}function mt({readMethod:r,writeMethod:e,...t}){return ct({...t,read:n=>n[r](),write:(n,s)=>s[e](n),validate:n=>{var s;if(n<0||n>t.maxValue)throw new TypeError(`Invalid ${t.name} value: ${n}. Expected value in range 0-${t.maxValue}`);(s=t.validate)==null||s.call(t,n)}})}function yt({readMethod:r,writeMethod:e,...t}){return ct({...t,read:n=>n[r](),write:(n,s)=>s[e](BigInt(n)),validate:n=>{var i;const s=BigInt(n);if(s<0||s>t.maxValue)throw new TypeError(`Invalid ${t.name} value: ${s}. Expected value in range 0-${t.maxValue}`);(i=t.validate)==null||i.call(t,s)}})}function Vn({serialize:r,...e}){const t=new H({...e,serialize:r,write:(n,s)=>{for(const i of t.serialize(n).toBytes())s.write8(i)}});return t}function qn({toBytes:r,fromBytes:e,...t}){return new H({...t,read:n=>{const s=n.readULEB(),i=n.readBytes(s);return e(i)},write:(n,s)=>{const i=r(n);s.writeULEB(i.length);for(let o=0;o<i.length;o++)s.write8(i[o])},serialize:n=>{const s=r(n),i=it(s.length),o=new Uint8Array(i.length+s.length);return o.set(i,0),o.set(s,i.length),o},validate:n=>{var s;if(typeof n!="string")throw new TypeError(`Invalid ${t.name} value: ${n}. Expected string`);(s=t.validate)==null||s.call(t,n)}})}function Fn(r){let e=null;function t(){return e||(e=r()),e}return new H({name:"lazy",read:n=>t().read(n),serializedSize:n=>t().serializedSize(n),write:(n,s)=>t().write(n,s),serialize:(n,s)=>t().serialize(n,s).toBytes()})}const a={u8(r){return mt({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...r})},u16(r){return mt({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...r})},u32(r){return mt({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...r})},u64(r){return yt({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...r})},u128(r){return yt({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...r})},u256(r){return yt({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...r})},bool(r){return ct({name:"bool",size:1,read:e=>e.read8()===1,write:(e,t)=>t.write8(e?1:0),...r,validate:e=>{var t;if((t=r==null?void 0:r.validate)==null||t.call(r,e),typeof e!="boolean")throw new TypeError(`Expected boolean, found ${typeof e}`)}})},uleb128(r){return Vn({name:"uleb128",read:e=>e.readULEB(),serialize:e=>Uint8Array.from(it(e)),...r})},bytes(r,e){return ct({name:`bytes[${r}]`,size:r,read:t=>t.readBytes(r),write:(t,n)=>{const s=new Uint8Array(t);for(let i=0;i<r;i++)n.write8(s[i]??0)},...e,validate:t=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,t),!t||typeof t!="object"||!("length"in t))throw new TypeError(`Expected array, found ${typeof t}`);if(t.length!==r)throw new TypeError(`Expected array of length ${r}, found ${t.length}`)}})},byteVector(r){return new H({name:"bytesVector",read:e=>{const t=e.readULEB();return e.readBytes(t)},write:(e,t)=>{const n=new Uint8Array(e);t.writeULEB(n.length);for(let s=0;s<n.length;s++)t.write8(n[s]??0)},...r,serializedSize:e=>{const t="length"in e?e.length:null;return t==null?null:it(t).length+t},validate:e=>{var t;if((t=r==null?void 0:r.validate)==null||t.call(r,e),!e||typeof e!="object"||!("length"in e))throw new TypeError(`Expected array, found ${typeof e}`)}})},string(r){return qn({name:"string",toBytes:e=>new TextEncoder().encode(e),fromBytes:e=>new TextDecoder().decode(e),...r})},fixedArray(r,e,t){return new H({name:`${e.name}[${r}]`,read:n=>{const s=new Array(r);for(let i=0;i<r;i++)s[i]=e.read(n);return s},write:(n,s)=>{for(const i of n)e.write(i,s)},...t,validate:n=>{var s;if((s=t==null?void 0:t.validate)==null||s.call(t,n),!n||typeof n!="object"||!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==r)throw new TypeError(`Expected array of length ${r}, found ${n.length}`)}})},option(r){return a.enum(`Option<${r.name}>`,{None:null,Some:r}).transform({input:e=>e==null?{None:!0}:{Some:e},output:e=>e.$kind==="Some"?e.Some:null})},vector(r,e){return new H({name:`vector<${r.name}>`,read:t=>{const n=t.readULEB(),s=new Array(n);for(let i=0;i<n;i++)s[i]=r.read(t);return s},write:(t,n)=>{n.writeULEB(t.length);for(const s of t)r.write(s,n)},...e,validate:t=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,t),!t||typeof t!="object"||!("length"in t))throw new TypeError(`Expected array, found ${typeof t}`)}})},tuple(r,e){return new H({name:`(${r.map(t=>t.name).join(", ")})`,serializedSize:t=>{let n=0;for(let s=0;s<r.length;s++){const i=r[s].serializedSize(t[s]);if(i==null)return null;n+=i}return n},read:t=>{const n=[];for(const s of r)n.push(s.read(t));return n},write:(t,n)=>{for(let s=0;s<r.length;s++)r[s].write(t[s],n)},...e,validate:t=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,t),!Array.isArray(t))throw new TypeError(`Expected array, found ${typeof t}`);if(t.length!==r.length)throw new TypeError(`Expected array of length ${r.length}, found ${t.length}`)}})},struct(r,e,t){const n=Object.entries(e);return new H({name:r,serializedSize:s=>{let i=0;for(const[o,u]of n){const c=u.serializedSize(s[o]);if(c==null)return null;i+=c}return i},read:s=>{const i={};for(const[o,u]of n)i[o]=u.read(s);return i},write:(s,i)=>{for(const[o,u]of n)u.write(s[o],i)},...t,validate:s=>{var i;if((i=t==null?void 0:t.validate)==null||i.call(t,s),typeof s!="object"||s==null)throw new TypeError(`Expected object, found ${typeof s}`)}})},enum(r,e,t){const n=Object.entries(e);return new H({name:r,read:s=>{const i=s.readULEB(),o=n[i];if(!o)throw new TypeError(`Unknown value ${i} for enum ${r}`);const[u,c]=o;return{[u]:(c==null?void 0:c.read(s))??!0,$kind:u}},write:(s,i)=>{const[o,u]=Object.entries(s).filter(([c])=>Object.hasOwn(e,c))[0];for(let c=0;c<n.length;c++){const[p,l]=n[c];if(p===o){i.writeULEB(c),l==null||l.write(u,i);return}}},...t,validate:s=>{var u;if((u=t==null?void 0:t.validate)==null||u.call(t,s),typeof s!="object"||s==null)throw new TypeError(`Expected object, found ${typeof s}`);const i=Object.keys(s).filter(c=>s[c]!==void 0&&Object.hasOwn(e,c));if(i.length!==1)throw new TypeError(`Expected object with one key, but found ${i.length} for type ${r}}`);const[o]=i;if(!Object.hasOwn(e,o))throw new TypeError(`Invalid enum variant ${o}`)}})},map(r,e){return a.vector(a.tuple([r,e])).transform({name:`Map<${r.name}, ${e.name}>`,input:t=>[...t.entries()],output:t=>{const n=new Map;for(const[s,i]of t)n.set(s,i);return n}})},lazy(r){return Fn(r)}},Gn=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,Kn=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i;function Wn(r,e="at"){const t=r.toLowerCase();let n;if(t.includes("@")){if(!Gn.test(t))throw new Error(`Invalid SuiNS name ${r}`);const[s,i]=t.split("@");n=[...s?s.split("."):[],i]}else{if(!Kn.test(t))throw new Error(`Invalid SuiNS name ${r}`);n=t.split(".").slice(0,-1)}return e==="dot"?`${n.join(".")}.sui`:`${n.slice(0,-1).join(".")}@${n[n.length-1]}`}BigInt(1e9);const Ln="0x1",kr="0x2",ga=Z("0x6"),Hn=`${kr}::sui::SUI`;Z("0x5");const Jn=/^vector<(.+)>$/,Zn=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;class J{static parseFromStr(e,t=!1){if(e==="address")return{address:null};if(e==="bool")return{bool:null};if(e==="u8")return{u8:null};if(e==="u16")return{u16:null};if(e==="u32")return{u32:null};if(e==="u64")return{u64:null};if(e==="u128")return{u128:null};if(e==="u256")return{u256:null};if(e==="signer")return{signer:null};const n=e.match(Jn);if(n)return{vector:J.parseFromStr(n[1],t)};const s=e.match(Zn);if(s)return{struct:{address:t?k(s[1]):s[1],module:s[2],name:s[3],typeParams:s[5]===void 0?[]:J.parseStructTypeArgs(s[5],t)}};throw new Error(`Encountered unexpected token when parsing type args for ${e}`)}static parseStructTypeArgs(e,t=!1){return kn(e).map(n=>J.parseFromStr(n,t))}static tagToString(e){if("bool"in e)return"bool";if("u8"in e)return"u8";if("u16"in e)return"u16";if("u32"in e)return"u32";if("u64"in e)return"u64";if("u128"in e)return"u128";if("u256"in e)return"u256";if("address"in e)return"address";if("signer"in e)return"signer";if("vector"in e)return`vector<${J.tagToString(e.vector)}>`;if("struct"in e){const t=e.struct,n=t.typeParams.map(J.tagToString).join(", ");return`${t.address}::${t.module}::${t.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}}function Yn(r){return a.u64({name:"unsafe_u64",...r}).transform({input:e=>e,output:e=>Number(e)})}function Xn(r){return a.enum("Option",{None:null,Some:r})}const j=a.bytes(gr).transform({validate:r=>{const e=typeof r=="string"?r:ze(r);if(!e||!se(k(e)))throw new Error(`Invalid Sui address ${e}`)},input:r=>typeof r=="string"?At(k(r)):r,output:r=>k(ze(r))}),W=a.vector(a.u8()).transform({name:"ObjectDigest",input:r=>nt(r),output:r=>Pt(new Uint8Array(r)),validate:r=>{if(nt(r).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),N=a.struct("SuiObjectRef",{objectId:j,version:a.u64(),digest:W}),Er=a.struct("SharedObjectRef",{objectId:j,initialSharedVersion:a.u64(),mutable:a.bool()}),Or=a.enum("ObjectArg",{ImmOrOwnedObject:N,SharedObject:Er,Receiving:N}),Ir=a.enum("CallArg",{Pure:a.struct("Pure",{bytes:a.vector(a.u8()).transform({input:r=>typeof r=="string"?z(r):r,output:r=>A(new Uint8Array(r))})}),Object:Or}),$t=a.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:a.lazy(()=>$t),struct:a.lazy(()=>xr),u16:null,u32:null,u256:null}),Bt=$t.transform({input:r=>typeof r=="string"?J.parseFromStr(r,!0):r,output:r=>J.tagToString(r)}),L=a.enum("Argument",{GasCoin:null,Input:a.u16(),Result:a.u16(),NestedResult:a.tuple([a.u16(),a.u16()])}),Tr=a.struct("ProgrammableMoveCall",{package:j,module:a.string(),function:a.string(),typeArguments:a.vector(Bt),arguments:a.vector(L)}),jr=a.enum("Command",{MoveCall:Tr,TransferObjects:a.struct("TransferObjects",{objects:a.vector(L),address:L}),SplitCoins:a.struct("SplitCoins",{coin:L,amounts:a.vector(L)}),MergeCoins:a.struct("MergeCoins",{destination:L,sources:a.vector(L)}),Publish:a.struct("Publish",{modules:a.vector(a.vector(a.u8()).transform({input:r=>typeof r=="string"?z(r):r,output:r=>A(new Uint8Array(r))})),dependencies:a.vector(j)}),MakeMoveVec:a.struct("MakeMoveVec",{type:Xn(Bt).transform({input:r=>r===null?{None:!0}:{Some:r},output:r=>r.Some??null}),elements:a.vector(L)}),Upgrade:a.struct("Upgrade",{modules:a.vector(a.vector(a.u8()).transform({input:r=>typeof r=="string"?z(r):r,output:r=>A(new Uint8Array(r))})),dependencies:a.vector(j),package:j,ticket:L})}),Cr=a.struct("ProgrammableTransaction",{inputs:a.vector(Ir),commands:a.vector(jr)}),_r=a.enum("TransactionKind",{ProgrammableTransaction:Cr,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),Mr=a.enum("TransactionExpiration",{None:null,Epoch:Yn()}),xr=a.struct("StructTag",{address:j,module:a.string(),name:a.string(),typeParams:a.vector($t)}),Ar=a.struct("GasData",{payment:a.vector(N),owner:j,price:a.u64(),budget:a.u64()}),Pr=a.struct("TransactionDataV1",{kind:_r,sender:j,gasData:Ar,expiration:Mr}),Ur=a.enum("TransactionData",{V1:Pr}),$r=a.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),Br=a.enum("IntentVersion",{V0:null}),Rr=a.enum("AppId",{Sui:null}),Nr=a.struct("Intent",{scope:$r,version:Br,appId:Rr});function Dr(r){return a.struct(`IntentMessage<${r.name}>`,{intent:Nr,value:r})}const zr=a.enum("CompressedSignature",{ED25519:a.fixedArray(64,a.u8()),Secp256k1:a.fixedArray(64,a.u8()),Secp256r1:a.fixedArray(64,a.u8()),ZkLogin:a.vector(a.u8())}),Vr=a.enum("PublicKey",{ED25519:a.fixedArray(32,a.u8()),Secp256k1:a.fixedArray(33,a.u8()),Secp256r1:a.fixedArray(33,a.u8()),ZkLogin:a.vector(a.u8())}),qr=a.struct("MultiSigPkMap",{pubKey:Vr,weight:a.u8()}),Fr=a.struct("MultiSigPublicKey",{pk_map:a.vector(qr),threshold:a.u16()}),Qn=a.struct("MultiSig",{sigs:a.vector(zr),bitmap:a.u16(),multisig_pk:Fr}),es=a.vector(a.u8()).transform({input:r=>typeof r=="string"?z(r):r,output:r=>A(new Uint8Array(r))}),Gr=a.struct("SenderSignedTransaction",{intentMessage:Dr(Ur),txSignatures:a.vector(es)}),ts=a.vector(Gr,{name:"SenderSignedData"}),rs=a.struct("PasskeyAuthenticator",{authenticatorData:a.vector(a.u8()),clientDataJson:a.string(),userSignature:a.vector(a.u8())}),ns=a.enum("PackageUpgradeError",{UnableToFetchPackage:a.struct("UnableToFetchPackage",{packageId:j}),NotAPackage:a.struct("NotAPackage",{objectId:j}),IncompatibleUpgrade:null,DigestDoesNotMatch:a.struct("DigestDoesNotMatch",{digest:a.vector(a.u8())}),UnknownUpgradePolicy:a.struct("UnknownUpgradePolicy",{policy:a.u8()}),PackageIDDoesNotMatch:a.struct("PackageIDDoesNotMatch",{packageId:j,ticketId:j})}),ss=a.struct("ModuleId",{address:j,name:a.string()}),er=a.struct("MoveLocation",{module:ss,function:a.u16(),instruction:a.u16(),functionName:a.option(a.string())}),is=a.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:a.struct("IndexOutOfBounds",{idx:a.u16()}),SecondaryIndexOutOfBounds:a.struct("SecondaryIndexOutOfBounds",{resultIdx:a.u16(),secondaryIdx:a.u16()}),InvalidResultArity:a.struct("InvalidResultArity",{resultIdx:a.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),as=a.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),os=a.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:a.struct("MoveObjectTooBig",{objectSize:a.u64(),maxObjectSize:a.u64()}),MovePackageTooBig:a.struct("MovePackageTooBig",{objectSize:a.u64(),maxObjectSize:a.u64()}),CircularObjectOwnership:a.struct("CircularObjectOwnership",{object:j}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:a.option(er),MoveAbort:a.tuple([er,a.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:a.struct("CommandArgumentError",{argIdx:a.u16(),kind:is}),TypeArgumentError:a.struct("TypeArgumentError",{argumentIdx:a.u16(),kind:as}),UnusedValueWithoutDrop:a.struct("UnusedValueWithoutDrop",{resultIdx:a.u16(),secondaryIdx:a.u16()}),InvalidPublicFunctionReturnType:a.struct("InvalidPublicFunctionReturnType",{idx:a.u16()}),InvalidTransferObject:null,EffectsTooLarge:a.struct("EffectsTooLarge",{currentSize:a.u64(),maxSize:a.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:a.struct("PackageUpgradeError",{upgradeError:ns}),WrittenObjectsTooLarge:a.struct("WrittenObjectsTooLarge",{currentSize:a.u64(),maxSize:a.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:a.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:a.vector(j)}),AddressDeniedForCoin:a.struct("AddressDeniedForCoin",{address:j,coinType:a.string()}),CoinTypeGlobalPause:a.struct("CoinTypeGlobalPause",{coinType:a.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),Kr=a.enum("ExecutionStatus",{Success:null,Failed:a.struct("ExecutionFailed",{error:os,command:a.option(a.u64())})}),Wr=a.struct("GasCostSummary",{computationCost:a.u64(),storageCost:a.u64(),storageRebate:a.u64(),nonRefundableStorageFee:a.u64()}),Se=a.enum("Owner",{AddressOwner:j,ObjectOwner:j,Shared:a.struct("Shared",{initialSharedVersion:a.u64()}),Immutable:null}),cs=a.struct("TransactionEffectsV1",{status:Kr,executedEpoch:a.u64(),gasUsed:Wr,modifiedAtVersions:a.vector(a.tuple([j,a.u64()])),sharedObjects:a.vector(N),transactionDigest:W,created:a.vector(a.tuple([N,Se])),mutated:a.vector(a.tuple([N,Se])),unwrapped:a.vector(a.tuple([N,Se])),deleted:a.vector(N),unwrappedThenDeleted:a.vector(N),wrapped:a.vector(N),gasObject:a.tuple([N,Se]),eventsDigest:a.option(W),dependencies:a.vector(W)}),Rt=a.tuple([a.u64(),W]),us=a.enum("ObjectIn",{NotExist:null,Exist:a.tuple([Rt,Se])}),ls=a.enum("ObjectOut",{NotExist:null,ObjectWrite:a.tuple([W,Se]),PackageWrite:Rt}),ds=a.enum("IDOperation",{None:null,Created:null,Deleted:null}),hs=a.struct("EffectsObjectChange",{inputState:us,outputState:ls,idOperation:ds}),fs=a.enum("UnchangedSharedKind",{ReadOnlyRoot:Rt,MutateDeleted:a.u64(),ReadDeleted:a.u64(),Cancelled:a.u64(),PerEpochConfig:null}),ps=a.struct("TransactionEffectsV2",{status:Kr,executedEpoch:a.u64(),gasUsed:Wr,transactionDigest:W,gasObjectIndex:a.option(a.u32()),eventsDigest:a.option(W),dependencies:a.vector(W),lamportVersion:a.u64(),changedObjects:a.vector(a.tuple([j,hs])),unchangedSharedObjects:a.vector(a.tuple([j,fs])),auxDataDigest:a.option(W)}),gs=a.enum("TransactionEffects",{V1:cs,V2:ps});function $e(r){switch(r){case"u8":return a.u8();case"u16":return a.u16();case"u32":return a.u32();case"u64":return a.u64();case"u128":return a.u128();case"u256":return a.u256();case"bool":return a.bool();case"string":return a.string();case"id":case"address":return j}const e=r.match(/^(vector|option)<(.+)>$/);if(e){const[t,n]=e.slice(1);return t==="vector"?a.vector($e(n)):a.option($e(n))}throw new Error(`Invalid Pure type name: ${r}`)}const y={...a,U8:a.u8(),U16:a.u16(),U32:a.u32(),U64:a.u64(),U128:a.u128(),U256:a.u256(),ULEB128:a.uleb128(),Bool:a.bool(),String:a.string(),Address:j,AppId:Rr,Argument:L,CallArg:Ir,CompressedSignature:zr,GasData:Ar,Intent:Nr,IntentMessage:Dr,IntentScope:$r,IntentVersion:Br,MultiSig:Qn,MultiSigPkMap:qr,MultiSigPublicKey:Fr,ObjectArg:Or,ObjectDigest:W,ProgrammableMoveCall:Tr,ProgrammableTransaction:Cr,PublicKey:Vr,SenderSignedData:ts,SenderSignedTransaction:Gr,SharedObjectRef:Er,StructTag:xr,SuiObjectRef:N,Command:jr,TransactionData:Ur,TransactionDataV1:Pr,TransactionExpiration:Mr,TransactionKind:_r,TypeTag:Bt,TransactionEffects:gs,PasskeyAuthenticator:rs},ms="1.21.2",ys="1.43.0",bs={"-32700":"ParseError","-32701":"OversizedRequest","-32702":"OversizedResponse","-32600":"InvalidRequest","-32601":"MethodNotFound","-32602":"InvalidParams","-32603":"InternalError","-32604":"ServerBusy","-32000":"CallExecutionFailed","-32001":"UnknownError","-32003":"SubscriptionClosed","-32004":"SubscriptionClosedWithError","-32005":"BatchesNotSupported","-32006":"TooManySubscriptions","-32050":"TransientError","-32002":"TransactionExecutionClientError"};class Lr extends Error{}class Hr extends Lr{constructor(e,t){super(e),this.code=t,this.type=bs[t]??"ServerError"}}class ws extends Lr{constructor(e,t,n){super(e),this.status=t,this.statusText=n}}var Jr=r=>{throw TypeError(r)},Nt=(r,e,t)=>e.has(r)||Jr("Cannot "+t),_=(r,e,t)=>(Nt(r,e,"read from private field"),t?t.call(r):e.get(r)),de=(r,e,t)=>e.has(r)?Jr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Ee=(r,e,t,n)=>(Nt(r,e,"write to private field"),e.set(r,t),t),Zr=(r,e,t)=>(Nt(r,e,"access private method"),t),vs=(r,e,t,n)=>({set _(s){Ee(r,e,s)},get _(){return _(r,e,n)}}),pe,Be,ie,me,Ve,Oe,ut,Yr,Xr;function Ss(r){const e=new URL(r);return e.protocol=e.protocol.replace("http","ws"),e.toString()}const ks={WebSocketConstructor:typeof WebSocket<"u"?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5};class Es{constructor(e,t={}){if(de(this,ut),de(this,pe,0),de(this,Be,0),de(this,ie,null),de(this,me,null),de(this,Ve,new Set),de(this,Oe,new Map),this.endpoint=e,this.options={...ks,...t},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=Ss(this.endpoint))}async makeRequest(e,t){const n=await Zr(this,ut,Yr).call(this);return new Promise((s,i)=>{Ee(this,pe,_(this,pe)+1),_(this,Oe).set(_(this,pe),{resolve:s,reject:i,timeout:setTimeout(()=>{_(this,Oe).delete(_(this,pe)),i(new Error(`Request timeout: ${e}`))},this.options.callTimeout)}),n.send(JSON.stringify({jsonrpc:"2.0",id:_(this,pe),method:e,params:t}))}).then(({error:s,result:i})=>{if(s)throw new Hr(s.message,s.code);return i})}async subscribe(e){const t=new Os(e);return _(this,Ve).add(t),await t.subscribe(this),()=>t.unsubscribe(this)}}pe=new WeakMap;Be=new WeakMap;ie=new WeakMap;me=new WeakMap;Ve=new WeakMap;Oe=new WeakMap;ut=new WeakSet;Yr=function(){return _(this,me)?_(this,me):(Ee(this,me,new Promise(r=>{var e;(e=_(this,ie))==null||e.close(),Ee(this,ie,new this.options.WebSocketConstructor(this.endpoint)),_(this,ie).addEventListener("open",()=>{Ee(this,Be,0),r(_(this,ie))}),_(this,ie).addEventListener("close",()=>{vs(this,Be)._++,_(this,Be)<=this.options.maxReconnects&&setTimeout(()=>{Zr(this,ut,Xr).call(this)},this.options.reconnectTimeout)}),_(this,ie).addEventListener("message",({data:t})=>{let n;try{n=JSON.parse(t)}catch(s){console.error(new Error(`Failed to parse RPC message: ${t}`,{cause:s}));return}if("id"in n&&n.id!=null&&_(this,Oe).has(n.id)){const{resolve:s,timeout:i}=_(this,Oe).get(n.id);clearTimeout(i),s(n)}else if("params"in n){const{params:s}=n;_(this,Ve).forEach(i=>{i.subscriptionId===s.subscription&&s.subscription===i.subscriptionId&&i.onMessage(s.result)})}})})),_(this,me))};Xr=async function(){var r;return(r=_(this,ie))==null||r.close(),Ee(this,me,null),Promise.allSettled([..._(this,Ve)].map(e=>e.subscribe(this)))};class Os{constructor(e){this.subscriptionId=null,this.subscribed=!1,this.input=e}onMessage(e){this.subscribed&&this.input.onMessage(e)}async unsubscribe(e){const{subscriptionId:t}=this;return this.subscribed=!1,t==null?!1:(this.subscriptionId=null,e.makeRequest(this.input.unsubscribe,[t]))}async subscribe(e){this.subscriptionId=null,this.subscribed=!0;const t=await e.makeRequest(this.input.method,this.input.params);this.subscribed&&(this.subscriptionId=t)}}var Qr=r=>{throw TypeError(r)},Dt=(r,e,t)=>e.has(r)||Qr("Cannot "+t),D=(r,e,t)=>(Dt(r,e,"read from private field"),t?t.call(r):e.get(r)),Ye=(r,e,t)=>e.has(r)?Qr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),kt=(r,e,t,n)=>(Dt(r,e,"write to private field"),e.set(r,t),t),Is=(r,e,t)=>(Dt(r,e,"access private method"),t),Pe,G,Re,Et,en;class Ts{constructor(e){Ye(this,Et),Ye(this,Pe,0),Ye(this,G),Ye(this,Re),kt(this,G,e)}fetch(e,t){const n=D(this,G).fetch??fetch;if(!n)throw new Error("The current environment does not support fetch, you can provide a fetch implementation in the options for SuiHTTPTransport.");return n(e,t)}async request(e){var s,i;kt(this,Pe,D(this,Pe)+1);const t=await this.fetch(((s=D(this,G).rpc)==null?void 0:s.url)??D(this,G).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":ms,"Client-Target-Api-Version":ys,"Client-Request-Method":e.method,...(i=D(this,G).rpc)==null?void 0:i.headers},body:JSON.stringify({jsonrpc:"2.0",id:D(this,Pe),method:e.method,params:e.params})});if(!t.ok)throw new ws(`Unexpected status code: ${t.status}`,t.status,t.statusText);const n=await t.json();if("error"in n&&n.error!=null)throw new Hr(n.error.message,n.error.code);return n.result}async subscribe(e){const t=await Is(this,Et,en).call(this).subscribe(e);return async()=>!!await t()}}Pe=new WeakMap;G=new WeakMap;Re=new WeakMap;Et=new WeakSet;en=function(){var r;if(!D(this,Re)){const e=D(this,G).WebSocketConstructor??WebSocket;if(!e)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");kt(this,Re,new Es(((r=D(this,G).websocket)==null?void 0:r.url)??D(this,G).url,{WebSocketConstructor:e,...D(this,G).websocket}))}return D(this,Re)};const js="object",Cs="ID",_s="ascii",Ms="String",xs="string",As="String",Ps="option",Us="Option";function $s(r){const e=typeof r.body=="object"&&"datatype"in r.body?r.body.datatype:null;return!!e&&k(e.package)===k("0x2")&&e.module==="tx_context"&&e.type==="TxContext"}function Ot(r){if(typeof r=="string")switch(r){case"address":return y.Address;case"bool":return y.Bool;case"u8":return y.U8;case"u16":return y.U16;case"u32":return y.U32;case"u64":return y.U64;case"u128":return y.U128;case"u256":return y.U256;default:throw new Error(`Unknown type signature ${r}`)}if("vector"in r){if(r.vector==="u8")return y.vector(y.U8).transform({input:t=>typeof t=="string"?new TextEncoder().encode(t):t,output:t=>t});const e=Ot(r.vector);return e?y.vector(e):null}if("datatype"in r){const e=k(r.datatype.package);if(e===k(Ln)){if(r.datatype.module===_s&&r.datatype.type===Ms||r.datatype.module===xs&&r.datatype.type===As)return y.String;if(r.datatype.module===Ps&&r.datatype.type===Us){const t=Ot(r.datatype.typeParameters[0]);return t?y.vector(t):null}}if(e===k(kr)&&r.datatype.module===js&&r.datatype.type===Cs)return y.Address}return null}function Bs(r){return typeof r=="object"&&"Reference"in r?{ref:"&",body:Ne(r.Reference)}:typeof r=="object"&&"MutableReference"in r?{ref:"&mut",body:Ne(r.MutableReference)}:{ref:null,body:Ne(r)}}function Ne(r){if(typeof r=="string")switch(r){case"Address":return"address";case"Bool":return"bool";case"U8":return"u8";case"U16":return"u16";case"U32":return"u32";case"U64":return"u64";case"U128":return"u128";case"U256":return"u256";default:throw new Error(`Unexpected type ${r}`)}if("Vector"in r)return{vector:Ne(r.Vector)};if("Struct"in r)return{datatype:{package:r.Struct.address,module:r.Struct.module,type:r.Struct.name,typeParameters:r.Struct.typeArguments.map(Ne)}};if("TypeParameter"in r)return{typeParameter:r.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(r)}`)}function Rs(r){return{$kind:"Pure",Pure:{bytes:r instanceof Uint8Array?A(r):r.toBase64()}}}const ae={Pure:Rs,ObjectRef({objectId:r,digest:e,version:t}){return{$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:e,version:t,objectId:k(r)}}}},SharedObjectRef({objectId:r,mutable:e,initialSharedVersion:t}){return{$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:e,initialSharedVersion:t,objectId:k(r)}}}},ReceivingRef({objectId:r,digest:e,version:t}){return{$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:e,version:t,objectId:k(r)}}}}};var X;function Ns(r){return{lang:(r==null?void 0:r.lang)??(X==null?void 0:X.lang),message:r==null?void 0:r.message,abortEarly:(r==null?void 0:r.abortEarly)??(X==null?void 0:X.abortEarly),abortPipeEarly:(r==null?void 0:r.abortPipeEarly)??(X==null?void 0:X.abortPipeEarly)}}var bt;function Ds(r){return bt==null?void 0:bt.get(r)}var wt;function zs(r){return wt==null?void 0:wt.get(r)}var vt;function Vs(r,e){var t;return(t=vt==null?void 0:vt.get(r))==null?void 0:t.get(e)}function tn(r){var t,n;const e=typeof r;return e==="string"?`"${r}"`:e==="number"||e==="bigint"||e==="boolean"?`${r}`:e==="object"||e==="function"?(r&&((n=(t=Object.getPrototypeOf(r))==null?void 0:t.constructor)==null?void 0:n.name))??"null":e}function R(r,e,t,n,s){const i=s&&"input"in s?s.input:t.value,o=(s==null?void 0:s.expected)??r.expects??null,u=(s==null?void 0:s.received)??tn(i),c={kind:r.kind,type:r.type,input:i,expected:o,received:u,message:`Invalid ${e}: ${o?`Expected ${o} but r`:"R"}eceived ${u}`,requirement:r.requirement,path:s==null?void 0:s.path,issues:s==null?void 0:s.issues,lang:n.lang,abortEarly:n.abortEarly,abortPipeEarly:n.abortPipeEarly},p=r.kind==="schema",l=(s==null?void 0:s.message)??r.message??Vs(r.reference,c.lang)??(p?zs(c.lang):null)??n.message??Ds(c.lang);l&&(c.message=typeof l=="function"?l(c):l),p&&(t.typed=!1),t.issues?t.issues.push(c):t.issues=[c]}function qs(r,e){return Object.hasOwn(r,e)&&e!=="__proto__"&&e!=="prototype"&&e!=="constructor"}var Fs=class extends Error{constructor(e){super(e[0].message);le(this,"issues");this.name="ValiError",this.issues=e}};function Le(r,e){return{kind:"validation",type:"check",reference:Le,async:!1,expects:null,requirement:r,message:e,_run(t,n){return t.typed&&!this.requirement(t.value)&&R(this,"input",t,n),t}}}function x(r){return{kind:"validation",type:"integer",reference:x,async:!1,expects:null,requirement:Number.isInteger,message:r,_run(e,t){return e.typed&&!this.requirement(e.value)&&R(this,"integer",e,t),e}}}function dt(r){return{kind:"transformation",type:"transform",reference:dt,async:!1,operation:r,_run(e){return e.value=this.operation(e.value),e}}}function zt(r,e,t){return typeof r.default=="function"?r.default(e,t):r.default}function It(r,e){return!r._run({typed:!1,value:e},{abortEarly:!0}).issues}function f(r,e){return{kind:"schema",type:"array",reference:f,expects:"Array",async:!1,item:r,message:e,_run(t,n){var i;const s=t.value;if(Array.isArray(s)){t.typed=!0,t.value=[];for(let o=0;o<s.length;o++){const u=s[o],c=this.item._run({typed:!1,value:u},n);if(c.issues){const p={type:"array",origin:"value",input:s,key:o,value:u};for(const l of c.issues)l.path?l.path.unshift(p):l.path=[p],(i=t.issues)==null||i.push(l);if(t.issues||(t.issues=c.issues),n.abortEarly){t.typed=!1;break}}c.typed||(t.typed=!1),t.value.push(c.value)}}else R(this,"type",t,n);return t}}}function Vt(r){return{kind:"schema",type:"bigint",reference:Vt,expects:"bigint",async:!1,message:r,_run(e,t){return typeof e.value=="bigint"?e.typed=!0:R(this,"type",e,t),e}}}function ht(r){return{kind:"schema",type:"boolean",reference:ht,expects:"boolean",async:!1,message:r,_run(e,t){return typeof e.value=="boolean"?e.typed=!0:R(this,"type",e,t),e}}}function qe(r){return{kind:"schema",type:"lazy",reference:qe,expects:"unknown",async:!1,getter:r,_run(e,t){return this.getter(e.value)._run(e,t)}}}function g(r,e){return{kind:"schema",type:"literal",reference:g,expects:tn(r),async:!1,literal:r,message:e,_run(t,n){return t.value===this.literal?t.typed=!0:R(this,"type",t,n),t}}}function v(r,...e){const t={kind:"schema",type:"nullable",reference:v,expects:`${r.expects} | null`,async:!1,wrapped:r,_run(n,s){return n.value===null&&("default"in this&&(n.value=zt(this,n,s)),n.value===null)?(n.typed=!0,n):this.wrapped._run(n,s)}};return 0 in e&&(t.default=e[0]),t}function Te(r,...e){const t={kind:"schema",type:"nullish",reference:Te,expects:`${r.expects} | null | undefined`,async:!1,wrapped:r,_run(n,s){return(n.value===null||n.value===void 0)&&("default"in this&&(n.value=zt(this,n,s)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped._run(n,s)}};return 0 in e&&(t.default=e[0]),t}function C(r){return{kind:"schema",type:"number",reference:C,expects:"number",async:!1,message:r,_run(e,t){return typeof e.value=="number"&&!isNaN(e.value)?e.typed=!0:R(this,"type",e,t),e}}}function d(r,e){return{kind:"schema",type:"object",reference:d,expects:"Object",async:!1,entries:r,message:e,_run(t,n){var i;const s=t.value;if(s&&typeof s=="object"){t.typed=!0,t.value={};for(const o in this.entries){const u=s[o],c=this.entries[o]._run({typed:!1,value:u},n);if(c.issues){const p={type:"object",origin:"value",input:s,key:o,value:u};for(const l of c.issues)l.path?l.path.unshift(p):l.path=[p],(i=t.issues)==null||i.push(l);if(t.issues||(t.issues=c.issues),n.abortEarly){t.typed=!1;break}}c.typed||(t.typed=!1),(c.value!==void 0||o in s)&&(t.value[o]=c.value)}}else R(this,"type",t,n);return t}}}function U(r,...e){const t={kind:"schema",type:"optional",reference:U,expects:`${r.expects} | undefined`,async:!1,wrapped:r,_run(n,s){return n.value===void 0&&("default"in this&&(n.value=zt(this,n,s)),n.value===void 0)?(n.typed=!0,n):this.wrapped._run(n,s)}};return 0 in e&&(t.default=e[0]),t}function Fe(r,e,t){return{kind:"schema",type:"record",reference:Fe,expects:"Object",async:!1,key:r,value:e,message:t,_run(n,s){var o,u;const i=n.value;if(i&&typeof i=="object"){n.typed=!0,n.value={};for(const c in i)if(qs(i,c)){const p=i[c],l=this.key._run({typed:!1,value:c},s);if(l.issues){const I={type:"object",origin:"key",input:i,key:c,value:p};for(const O of l.issues)O.path=[I],(o=n.issues)==null||o.push(O);if(n.issues||(n.issues=l.issues),s.abortEarly){n.typed=!1;break}}const h=this.value._run({typed:!1,value:p},s);if(h.issues){const I={type:"object",origin:"value",input:i,key:c,value:p};for(const O of h.issues)O.path?O.path.unshift(I):O.path=[I],(u=n.issues)==null||u.push(O);if(n.issues||(n.issues=h.issues),s.abortEarly){n.typed=!1;break}}(!l.typed||!h.typed)&&(n.typed=!1),l.typed&&(n.value[l.value]=h.value)}}else R(this,"type",n,s);return n}}}function m(r){return{kind:"schema",type:"string",reference:m,expects:"string",async:!1,message:r,_run(e,t){return typeof e.value=="string"?e.typed=!0:R(this,"type",e,t),e}}}function qt(r,e){return{kind:"schema",type:"tuple",reference:qt,expects:"Array",async:!1,items:r,message:e,_run(t,n){var i;const s=t.value;if(Array.isArray(s)){t.typed=!0,t.value=[];for(let o=0;o<this.items.length;o++){const u=s[o],c=this.items[o]._run({typed:!1,value:u},n);if(c.issues){const p={type:"array",origin:"value",input:s,key:o,value:u};for(const l of c.issues)l.path?l.path.unshift(p):l.path=[p],(i=t.issues)==null||i.push(l);if(t.issues||(t.issues=c.issues),n.abortEarly){t.typed=!1;break}}c.typed||(t.typed=!1),t.value.push(c.value)}}else R(this,"type",t,n);return t}}}function tr(r){let e;if(r)for(const t of r)e?e.push(...t.issues):e=t.issues;return e}function P(r,e){return{kind:"schema",type:"union",reference:P,expects:[...new Set(r.map(t=>t.expects))].join(" | ")||"never",async:!1,options:r,message:e,_run(t,n){let s,i,o;for(const u of this.options){const c=u._run({typed:!1,value:t.value},n);if(c.typed)if(c.issues)i?i.push(c):i=[c];else{s=c;break}else o?o.push(c):o=[c]}if(s)return s;if(i){if(i.length===1)return i[0];R(this,"type",t,n,{issues:tr(i)}),t.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];R(this,"type",t,n,{issues:tr(o)})}return t}}}function ye(){return{kind:"schema",type:"unknown",reference:ye,expects:"unknown",async:!1,_run(r){return r.typed=!0,r}}}function M(r,e,t){const n=r._run({typed:!1,value:e},Ns(t));if(n.issues)throw new Fs(n.issues);return n.value}function E(...r){return{...r[0],pipe:r,_run(e,t){for(let n=0;n<r.length;n++){if(e.issues&&(r[n].kind==="schema"||r[n].kind==="transformation")){e.typed=!1;break}(!e.issues||!t.abortEarly&&!t.abortPipeEarly)&&(e=r[n]._run(e,t))}return e}}}function we(r){const e=Object.entries(r).map(([t,n])=>d({[t]:n}));return E(P(e),dt(t=>({...t,$kind:Object.keys(t)[0]})))}const je=E(m(),dt(r=>k(r)),Le(se)),B=je,be=m(),$=E(P([m(),E(C(),x())]),Le(r=>{try{return BigInt(r),BigInt(r)>=0&&BigInt(r)<=18446744073709551615n}catch{return!1}},"Invalid u64")),ue=d({objectId:je,version:$,digest:m()}),T=E(P([d({GasCoin:g(!0)}),d({Input:E(C(),x()),type:U(g("pure"))}),d({Input:E(C(),x()),type:U(g("object"))}),d({Result:E(C(),x())}),d({NestedResult:qt([E(C(),x()),E(C(),x())])})]),dt(r=>({...r,$kind:Object.keys(r)[0]}))),Gs=d({budget:v($),price:v($),owner:v(je),payment:v(f(ue))}),Tt=P([g("address"),g("bool"),g("u8"),g("u16"),g("u32"),g("u64"),g("u128"),g("u256"),d({vector:qe(()=>Tt)}),d({datatype:d({package:m(),module:m(),type:m(),typeParameters:f(qe(()=>Tt))})}),d({typeParameter:E(C(),x())})]),Ks=d({ref:v(P([g("&"),g("&mut")])),body:Tt}),Ws=d({package:B,module:m(),function:m(),typeArguments:f(m()),arguments:f(T),_argumentTypes:U(v(f(Ks)))}),Ls=d({name:m(),inputs:Fe(m(),P([T,f(T)])),data:Fe(m(),ye())}),Hs=we({MoveCall:Ws,TransferObjects:d({objects:f(T),address:T}),SplitCoins:d({coin:T,amounts:f(T)}),MergeCoins:d({destination:T,sources:f(T)}),Publish:d({modules:f(be),dependencies:f(B)}),MakeMoveVec:d({type:v(m()),elements:f(T)}),Upgrade:d({modules:f(be),dependencies:f(B),package:B,ticket:T}),$Intent:Ls}),rn=we({ImmOrOwnedObject:ue,SharedObject:d({objectId:B,initialSharedVersion:$,mutable:ht()}),Receiving:ue}),Js=we({Object:rn,Pure:d({bytes:be}),UnresolvedPure:d({value:ye()}),UnresolvedObject:d({objectId:B,version:U(v($)),digest:U(v(m())),initialSharedVersion:U(v($))})}),rr=we({Object:rn,Pure:d({bytes:be})}),nn=we({None:g(!0),Epoch:$}),et=d({version:g(2),sender:Te(je),expiration:Te(nn),gasData:Gs,inputs:f(Js),commands:f(Hs)}),he={MoveCall(r){const[e,t="",n=""]="target"in r?r.target.split("::"):[r.package,r.module,r.function];return{$kind:"MoveCall",MoveCall:{package:e,module:t,function:n,typeArguments:r.typeArguments??[],arguments:r.arguments??[]}}},TransferObjects(r,e){return{$kind:"TransferObjects",TransferObjects:{objects:r.map(t=>M(T,t)),address:M(T,e)}}},SplitCoins(r,e){return{$kind:"SplitCoins",SplitCoins:{coin:M(T,r),amounts:e.map(t=>M(T,t))}}},MergeCoins(r,e){return{$kind:"MergeCoins",MergeCoins:{destination:M(T,r),sources:e.map(t=>M(T,t))}}},Publish({modules:r,dependencies:e}){return{$kind:"Publish",Publish:{modules:r.map(t=>typeof t=="string"?t:A(new Uint8Array(t))),dependencies:e.map(t=>Z(t))}}},Upgrade({modules:r,dependencies:e,package:t,ticket:n}){return{$kind:"Upgrade",Upgrade:{modules:r.map(s=>typeof s=="string"?s:A(new Uint8Array(s))),dependencies:e.map(s=>Z(s)),package:t,ticket:M(T,n)}}},MakeMoveVec({type:r,elements:e}){return{$kind:"MakeMoveVec",MakeMoveVec:{type:r??null,elements:e.map(t=>M(T,t))}}},Intent({name:r,inputs:e={},data:t={}}){return{$kind:"$Intent",$Intent:{name:r,inputs:Object.fromEntries(Object.entries(e).map(([n,s])=>[n,Array.isArray(s)?s.map(i=>M(T,i)):M(T,s)])),data:t}}}},jt=d({digest:m(),objectId:m(),version:P([E(C(),x()),m(),Vt()])}),Zs=we({ImmOrOwned:jt,Shared:d({objectId:B,initialSharedVersion:$,mutable:ht()}),Receiving:jt}),nr=we({Object:Zs,Pure:f(E(C(),x()))}),sn=P([d({kind:g("Input"),index:E(C(),x()),value:ye(),type:U(g("object"))}),d({kind:g("Input"),index:E(C(),x()),value:ye(),type:g("pure")})]),Ys=P([d({Epoch:E(C(),x())}),d({None:v(g(!0))})]),sr=E(P([C(),m(),Vt()]),Le(r=>{if(!["string","number","bigint"].includes(typeof r))return!1;try{return BigInt(r),!0}catch{return!1}})),Ft=P([d({bool:v(g(!0))}),d({u8:v(g(!0))}),d({u64:v(g(!0))}),d({u128:v(g(!0))}),d({address:v(g(!0))}),d({signer:v(g(!0))}),d({vector:qe(()=>Ft)}),d({struct:qe(()=>Xs)}),d({u16:v(g(!0))}),d({u32:v(g(!0))}),d({u256:v(g(!0))})]),Xs=d({address:m(),module:m(),name:m(),typeParams:f(Ft)}),Qs=d({budget:U(sr),price:U(sr),payment:U(f(jt)),owner:U(m())}),ei=[sn,d({kind:g("GasCoin")}),d({kind:g("Result"),index:E(C(),x())}),d({kind:g("NestedResult"),index:E(C(),x()),resultIndex:E(C(),x())})],oe=P([...ei]),ti=d({kind:g("MoveCall"),target:E(m(),Le(r=>r.split("::").length===3)),typeArguments:f(m()),arguments:f(oe)}),ri=d({kind:g("TransferObjects"),objects:f(oe),address:oe}),ni=d({kind:g("SplitCoins"),coin:oe,amounts:f(oe)}),si=d({kind:g("MergeCoins"),destination:oe,sources:f(oe)}),ii=d({kind:g("MakeMoveVec"),type:P([d({Some:Ft}),d({None:v(g(!0))})]),objects:f(oe)}),ai=d({kind:g("Publish"),modules:f(f(E(C(),x()))),dependencies:f(m())}),oi=d({kind:g("Upgrade"),modules:f(f(E(C(),x()))),dependencies:f(m()),packageId:m(),ticket:oe}),ci=[ti,ri,ni,si,ai,oi,ii],ui=P([...ci]);d({version:g(1),sender:U(m()),expiration:Te(Ys),gasConfig:Qs,inputs:f(sn),transactions:f(ui)});function ir(r){var t;const e=r.inputs.map((n,s)=>{if(n.Object)return{kind:"Input",index:s,value:{Object:n.Object.ImmOrOwnedObject?{ImmOrOwned:n.Object.ImmOrOwnedObject}:n.Object.Receiving?{Receiving:{digest:n.Object.Receiving.digest,version:n.Object.Receiving.version,objectId:n.Object.Receiving.objectId}}:{Shared:{mutable:n.Object.SharedObject.mutable,initialSharedVersion:n.Object.SharedObject.initialSharedVersion,objectId:n.Object.SharedObject.objectId}}},type:"object"};if(n.Pure)return{kind:"Input",index:s,value:{Pure:Array.from(z(n.Pure.bytes))},type:"pure"};if(n.UnresolvedPure)return{kind:"Input",type:"pure",index:s,value:n.UnresolvedPure.value};if(n.UnresolvedObject)return{kind:"Input",type:"object",index:s,value:n.UnresolvedObject.objectId};throw new Error("Invalid input")});return{version:1,sender:r.sender??void 0,expiration:((t=r.expiration)==null?void 0:t.$kind)==="Epoch"?{Epoch:Number(r.expiration.Epoch)}:r.expiration?{None:!0}:null,gasConfig:{owner:r.gasData.owner??void 0,budget:r.gasData.budget??void 0,price:r.gasData.price??void 0,payment:r.gasData.payment??void 0},inputs:e,transactions:r.commands.map(n=>{if(n.MakeMoveVec)return{kind:"MakeMoveVec",type:n.MakeMoveVec.type===null?{None:!0}:{Some:J.parseFromStr(n.MakeMoveVec.type)},objects:n.MakeMoveVec.elements.map(s=>Q(s,e))};if(n.MergeCoins)return{kind:"MergeCoins",destination:Q(n.MergeCoins.destination,e),sources:n.MergeCoins.sources.map(s=>Q(s,e))};if(n.MoveCall)return{kind:"MoveCall",target:`${n.MoveCall.package}::${n.MoveCall.module}::${n.MoveCall.function}`,typeArguments:n.MoveCall.typeArguments,arguments:n.MoveCall.arguments.map(s=>Q(s,e))};if(n.Publish)return{kind:"Publish",modules:n.Publish.modules.map(s=>Array.from(z(s))),dependencies:n.Publish.dependencies};if(n.SplitCoins)return{kind:"SplitCoins",coin:Q(n.SplitCoins.coin,e),amounts:n.SplitCoins.amounts.map(s=>Q(s,e))};if(n.TransferObjects)return{kind:"TransferObjects",objects:n.TransferObjects.objects.map(s=>Q(s,e)),address:Q(n.TransferObjects.address,e)};if(n.Upgrade)return{kind:"Upgrade",modules:n.Upgrade.modules.map(s=>Array.from(z(s))),dependencies:n.Upgrade.dependencies,packageId:n.Upgrade.package,ticket:Q(n.Upgrade.ticket,e)};throw new Error(`Unknown transaction ${Object.keys(n)}`)})}}function Q(r,e){if(r.$kind==="GasCoin")return{kind:"GasCoin"};if(r.$kind==="Result")return{kind:"Result",index:r.Result};if(r.$kind==="NestedResult")return{kind:"NestedResult",index:r.NestedResult[0],resultIndex:r.NestedResult[1]};if(r.$kind==="Input")return e[r.Input];throw new Error(`Invalid argument ${Object.keys(r)}`)}function li(r){var e,t,n;return M(et,{version:2,sender:r.sender??null,expiration:r.expiration?"Epoch"in r.expiration?{Epoch:r.expiration.Epoch}:{None:!0}:null,gasData:{owner:r.gasConfig.owner??null,budget:((e=r.gasConfig.budget)==null?void 0:e.toString())??null,price:((t=r.gasConfig.price)==null?void 0:t.toString())??null,payment:((n=r.gasConfig.payment)==null?void 0:n.map(s=>({digest:s.digest,objectId:s.objectId,version:s.version.toString()})))??null},inputs:r.inputs.map(s=>{if(s.kind==="Input"){if(It(nr,s.value)){const i=M(nr,s.value);if(i.Object){if(i.Object.ImmOrOwned)return{Object:{ImmOrOwnedObject:{objectId:i.Object.ImmOrOwned.objectId,version:String(i.Object.ImmOrOwned.version),digest:i.Object.ImmOrOwned.digest}}};if(i.Object.Shared)return{Object:{SharedObject:{mutable:i.Object.Shared.mutable??null,initialSharedVersion:i.Object.Shared.initialSharedVersion,objectId:i.Object.Shared.objectId}}};if(i.Object.Receiving)return{Object:{Receiving:{digest:i.Object.Receiving.digest,version:String(i.Object.Receiving.version),objectId:i.Object.Receiving.objectId}}};throw new Error("Invalid object input")}return{Pure:{bytes:A(new Uint8Array(i.Pure))}}}return s.type==="object"?{UnresolvedObject:{objectId:s.value}}:{UnresolvedPure:{value:s.value}}}throw new Error("Invalid input")}),commands:r.transactions.map(s=>{switch(s.kind){case"MakeMoveVec":return{MakeMoveVec:{type:"Some"in s.type?J.tagToString(s.type.Some):null,elements:s.objects.map(i=>ee(i))}};case"MergeCoins":return{MergeCoins:{destination:ee(s.destination),sources:s.sources.map(i=>ee(i))}};case"MoveCall":{const[i,o,u]=s.target.split("::");return{MoveCall:{package:i,module:o,function:u,typeArguments:s.typeArguments,arguments:s.arguments.map(c=>ee(c))}}}case"Publish":return{Publish:{modules:s.modules.map(i=>A(Uint8Array.from(i))),dependencies:s.dependencies}};case"SplitCoins":return{SplitCoins:{coin:ee(s.coin),amounts:s.amounts.map(i=>ee(i))}};case"TransferObjects":return{TransferObjects:{objects:s.objects.map(i=>ee(i)),address:ee(s.address)}};case"Upgrade":return{Upgrade:{modules:s.modules.map(i=>A(Uint8Array.from(i))),dependencies:s.dependencies,package:s.packageId,ticket:ee(s.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(s)}`)})})}function ee(r){switch(r.kind){case"GasCoin":return{GasCoin:!0};case"Result":return{Result:r.index};case"NestedResult":return{NestedResult:[r.index,r.resultIndex]};case"Input":return{Input:r.index}}}function He(r){return P(Object.entries(r).map(([e,t])=>d({[e]:t})))}const V=He({GasCoin:g(!0),Input:E(C(),x()),Result:E(C(),x()),NestedResult:qt([E(C(),x()),E(C(),x())])}),di=d({budget:v($),price:v($),owner:v(je),payment:v(f(ue))}),hi=d({package:B,module:m(),function:m(),typeArguments:f(m()),arguments:f(V)}),fi=d({name:m(),inputs:Fe(m(),P([V,f(V)])),data:Fe(m(),ye())}),pi=He({MoveCall:hi,TransferObjects:d({objects:f(V),address:V}),SplitCoins:d({coin:V,amounts:f(V)}),MergeCoins:d({destination:V,sources:f(V)}),Publish:d({modules:f(be),dependencies:f(B)}),MakeMoveVec:d({type:v(m()),elements:f(V)}),Upgrade:d({modules:f(be),dependencies:f(B),package:B,ticket:V}),$Intent:fi}),gi=He({ImmOrOwnedObject:ue,SharedObject:d({objectId:B,initialSharedVersion:$,mutable:ht()}),Receiving:ue}),mi=He({Object:gi,Pure:d({bytes:be}),UnresolvedPure:d({value:ye()}),UnresolvedObject:d({objectId:B,version:U(v($)),digest:U(v(m())),initialSharedVersion:U(v($))})}),yi=He({None:g(!0),Epoch:$}),bi=d({version:g(2),sender:Te(je),expiration:Te(yi),gasData:di,inputs:f(mi),commands:f(pi)}),wi=50,vi=1000n,Si=5e10;async function ki(r,e,t){return await ji(r,e),await Ti(r,e),e.onlyTransactionKind||(await Ei(r,e),await Oi(r,e),await Ii(r,e)),await Ci(r),await t()}async function Ei(r,e){r.gasConfig.price||(r.gasConfig.price=String(await Je(e).getReferenceGasPrice()))}async function Oi(r,e){if(r.gasConfig.budget)return;const t=await Je(e).dryRunTransactionBlock({transactionBlock:r.build({overrides:{gasData:{budget:String(Si),payment:[]}}})});if(t.effects.status.status!=="success")throw new Error(`Dry run failed, could not automatically determine a budget: ${t.effects.status.error}`,{cause:t});const n=vi*BigInt(r.gasConfig.price||1n),s=BigInt(t.effects.gasUsed.computationCost)+n,i=s+BigInt(t.effects.gasUsed.storageCost)-BigInt(t.effects.gasUsed.storageRebate);r.gasConfig.budget=String(i>s?i:s)}async function Ii(r,e){if(!r.gasConfig.payment){const n=(await Je(e).getCoins({owner:r.gasConfig.owner||r.sender,coinType:Hn})).data.filter(s=>!r.inputs.find(o=>{var u;return(u=o.Object)!=null&&u.ImmOrOwnedObject?s.coinObjectId===o.Object.ImmOrOwnedObject.objectId:!1})).map(s=>({objectId:s.coinObjectId,digest:s.digest,version:s.version}));if(!n.length)throw new Error("No valid gas coins found for the transaction.");r.gasConfig.payment=n.map(s=>M(ue,s))}}async function Ti(r,e){const t=r.inputs.filter(l=>{var h;return l.UnresolvedObject&&!(l.UnresolvedObject.version||(h=l.UnresolvedObject)!=null&&h.initialSharedVersion)}),n=[...new Set(t.map(l=>Z(l.UnresolvedObject.objectId)))],s=n.length?Ai(n,wi):[],i=(await Promise.all(s.map(l=>Je(e).multiGetObjects({ids:l,options:{showOwner:!0}})))).flat(),o=new Map(n.map((l,h)=>[l,i[h]])),u=Array.from(o).filter(([l,h])=>h.error).map(([l,h])=>JSON.stringify(h.error));if(u.length)throw new Error(`The following input objects are invalid: ${u.join(", ")}`);const c=i.map(l=>{if(l.error||!l.data)throw new Error(`Failed to fetch object: ${l.error}`);const h=l.data.owner,I=h&&typeof h=="object"&&"Shared"in h?h.Shared.initial_shared_version:null;return{objectId:l.data.objectId,digest:l.data.digest,version:l.data.version,initialSharedVersion:I}}),p=new Map(n.map((l,h)=>[l,c[h]]));for(const[l,h]of r.inputs.entries()){if(!h.UnresolvedObject)continue;let I;const O=k(h.UnresolvedObject.objectId),S=p.get(O);h.UnresolvedObject.initialSharedVersion??(S==null?void 0:S.initialSharedVersion)?I=ae.SharedObjectRef({objectId:O,initialSharedVersion:h.UnresolvedObject.initialSharedVersion||(S==null?void 0:S.initialSharedVersion),mutable:_i(r,l)}):Mi(r,l)&&(I=ae.ReceivingRef({objectId:O,digest:h.UnresolvedObject.digest??(S==null?void 0:S.digest),version:h.UnresolvedObject.version??(S==null?void 0:S.version)})),r.inputs[r.inputs.indexOf(h)]=I??ae.ObjectRef({objectId:O,digest:h.UnresolvedObject.digest??(S==null?void 0:S.digest),version:h.UnresolvedObject.version??(S==null?void 0:S.version)})}}async function ji(r,e){const{inputs:t,commands:n}=r,s=[],i=new Set;n.forEach(u=>{if(u.MoveCall){if(u.MoveCall._argumentTypes)return;if(u.MoveCall.arguments.map(l=>l.$kind==="Input"?r.inputs[l.Input]:null).some(l=>(l==null?void 0:l.UnresolvedPure)||(l==null?void 0:l.UnresolvedObject))){const l=`${u.MoveCall.package}::${u.MoveCall.module}::${u.MoveCall.function}`;i.add(l),s.push(u.MoveCall)}}switch(u.$kind){case"SplitCoins":u.SplitCoins.amounts.forEach(c=>{ar(c,y.U64,r)});break;case"TransferObjects":ar(u.TransferObjects.address,y.Address,r);break}});const o=new Map;if(i.size>0){const u=Je(e);await Promise.all([...i].map(async c=>{const[p,l,h]=c.split("::"),I=await u.getNormalizedMoveFunction({package:p,module:l,function:h});o.set(c,I.parameters.map(O=>Bs(O)))}))}s.length&&await Promise.all(s.map(async u=>{const c=o.get(`${u.package}::${u.module}::${u.function}`);if(!c)return;const l=c.length>0&&$s(c.at(-1))?c.slice(0,c.length-1):c;u._argumentTypes=l})),n.forEach(u=>{if(!u.MoveCall)return;const c=u.MoveCall,p=`${c.package}::${c.module}::${c.function}`,l=c._argumentTypes;if(l){if(l.length!==u.MoveCall.arguments.length)throw new Error(`Incorrect number of arguments for ${p}`);l.forEach((h,I)=>{var Zt,Yt;const O=c.arguments[I];if(O.$kind!=="Input")return;const S=t[O.Input];if(!S.UnresolvedPure&&!S.UnresolvedObject)return;const Y=((Zt=S.UnresolvedPure)==null?void 0:Zt.value)??((Yt=S.UnresolvedObject)==null?void 0:Yt.objectId),Ce=Ot(h.body);if(Ce){O.type="pure",t[t.indexOf(S)]=ae.Pure(Ce.serialize(Y));return}if(typeof Y!="string")throw new Error(`Expect the argument to be an object id string, got ${JSON.stringify(Y,null,2)}`);O.type="object";const _e=S.UnresolvedPure?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:Y}}:S;t[O.Input]=_e})}})}function Ci(r){r.inputs.forEach((e,t)=>{if(e.$kind!=="Object"&&e.$kind!=="Pure")throw new Error(`Input at index ${t} has not been resolved. Expected a Pure or Object input, but found ${JSON.stringify(e)}`)})}function ar(r,e,t){if(r.$kind!=="Input")return;const n=t.inputs[r.Input];n.$kind==="UnresolvedPure"&&(t.inputs[r.Input]=ae.Pure(e.serialize(n.UnresolvedPure.value)))}function _i(r,e){let t=!1;return r.getInputUses(e,(n,s)=>{if(s.MoveCall&&s.MoveCall._argumentTypes){const i=s.MoveCall.arguments.indexOf(n);t=s.MoveCall._argumentTypes[i].ref!=="&"||t}(s.$kind==="MakeMoveVec"||s.$kind==="MergeCoins"||s.$kind==="SplitCoins")&&(t=!0)}),t}function Mi(r,e){let t=!1;return r.getInputUses(e,(n,s)=>{if(s.MoveCall&&s.MoveCall._argumentTypes){const i=s.MoveCall.arguments.indexOf(n);t=xi(s.MoveCall._argumentTypes[i])||t}}),t}function xi(r){return typeof r.body!="object"||!("datatype"in r.body)?!1:r.body.datatype.package==="0x2"&&r.body.datatype.module==="transfer"&&r.body.datatype.type==="Receiving"}function Je(r){if(!r.client)throw new Error("No sui client passed to Transaction#build, but transaction data was not sufficient to build offline.");return r.client}function Ai(r,e){return Array.from({length:Math.ceil(r.length/e)},(t,n)=>r.slice(n*e,n*e+e))}function Pi(r){function e(t){return r(t)}return e.system=()=>e("0x5"),e.clock=()=>e("0x6"),e.random=()=>e("0x8"),e.denyList=()=>e("0x403"),e.option=({type:t,value:n})=>s=>s.moveCall({typeArguments:[t],target:`0x1::option::${n===null?"none":"some"}`,arguments:n===null?[]:[s.object(n)]}),e}function Ui(r){function e(t,n){if(typeof t=="string")return r($e(t).serialize(n));if(t instanceof Uint8Array||Ut(t))return r(t);throw new Error("tx.pure must be called either a bcs type name, or a serialized bcs value")}return e.u8=t=>r(y.U8.serialize(t)),e.u16=t=>r(y.U16.serialize(t)),e.u32=t=>r(y.U32.serialize(t)),e.u64=t=>r(y.U64.serialize(t)),e.u128=t=>r(y.U128.serialize(t)),e.u256=t=>r(y.U256.serialize(t)),e.bool=t=>r(y.Bool.serialize(t)),e.string=t=>r(y.String.serialize(t)),e.address=t=>r(y.Address.serialize(t)),e.id=e.address,e.vector=(t,n)=>r(y.vector($e(t)).serialize(n)),e.option=(t,n)=>r(y.option($e(t)).serialize(n)),e}function $i(r,e){const t=Array.from(`${r}::`).map(s=>s.charCodeAt(0)),n=new Uint8Array(t.length+e.length);return n.set(t),n.set(e,t.length),st(n,{dkLen:32})}function or(r){return k(r).replace("0x","")}class K{constructor(e){this.version=2,this.sender=(e==null?void 0:e.sender)??null,this.expiration=(e==null?void 0:e.expiration)??null,this.inputs=(e==null?void 0:e.inputs)??[],this.commands=(e==null?void 0:e.commands)??[],this.gasData=(e==null?void 0:e.gasData)??{budget:null,price:null,owner:null,payment:null}}static fromKindBytes(e){const n=y.TransactionKind.parse(e).ProgrammableTransaction;if(!n)throw new Error("Unable to deserialize from bytes.");return K.restore({version:2,sender:null,expiration:null,gasData:{budget:null,owner:null,payment:null,price:null},inputs:n.inputs,commands:n.commands})}static fromBytes(e){const t=y.TransactionData.parse(e),n=t==null?void 0:t.V1,s=n.kind.ProgrammableTransaction;if(!n||!s)throw new Error("Unable to deserialize from bytes.");return K.restore({version:2,sender:n.sender,expiration:n.expiration,gasData:n.gasData,inputs:s.inputs,commands:s.commands})}static restore(e){return e.version===2?new K(M(et,e)):new K(M(et,li(e)))}static getDigestFromBytes(e){const t=$i("TransactionData",e);return Pt(t)}get gasConfig(){return this.gasData}set gasConfig(e){this.gasData=e}build({maxSizeBytes:e=1/0,overrides:t,onlyTransactionKind:n}={}){const s=this.inputs,i=this.commands,o={ProgrammableTransaction:{inputs:s,commands:i}};if(n)return y.TransactionKind.serialize(o,{maxSize:e}).toBytes();const u=(t==null?void 0:t.expiration)??this.expiration,c=(t==null?void 0:t.sender)??this.sender,p={...this.gasData,...t==null?void 0:t.gasConfig,...t==null?void 0:t.gasData};if(!c)throw new Error("Missing transaction sender");if(!p.budget)throw new Error("Missing gas budget");if(!p.payment)throw new Error("Missing gas payment");if(!p.price)throw new Error("Missing gas price");const l={sender:or(c),expiration:u||{None:!0},gasData:{payment:p.payment,owner:or(this.gasData.owner??c),price:BigInt(p.price),budget:BigInt(p.budget)},kind:{ProgrammableTransaction:{inputs:s,commands:i}}};return y.TransactionData.serialize({V1:l},{maxSize:e}).toBytes()}addInput(e,t){const n=this.inputs.length;return this.inputs.push(t),{Input:n,type:e,$kind:"Input"}}getInputUses(e,t){this.mapArguments((n,s)=>(n.$kind==="Input"&&n.Input===e&&t(n,s),n))}mapArguments(e){for(const t of this.commands)switch(t.$kind){case"MoveCall":t.MoveCall.arguments=t.MoveCall.arguments.map(s=>e(s,t));break;case"TransferObjects":t.TransferObjects.objects=t.TransferObjects.objects.map(s=>e(s,t)),t.TransferObjects.address=e(t.TransferObjects.address,t);break;case"SplitCoins":t.SplitCoins.coin=e(t.SplitCoins.coin,t),t.SplitCoins.amounts=t.SplitCoins.amounts.map(s=>e(s,t));break;case"MergeCoins":t.MergeCoins.destination=e(t.MergeCoins.destination,t),t.MergeCoins.sources=t.MergeCoins.sources.map(s=>e(s,t));break;case"MakeMoveVec":t.MakeMoveVec.elements=t.MakeMoveVec.elements.map(s=>e(s,t));break;case"Upgrade":t.Upgrade.ticket=e(t.Upgrade.ticket,t);break;case"$Intent":const n=t.$Intent.inputs;t.$Intent.inputs={};for(const[s,i]of Object.entries(n))t.$Intent.inputs[s]=Array.isArray(i)?i.map(o=>e(o,t)):e(i,t);break;case"Publish":break;default:throw new Error(`Unexpected transaction kind: ${t.$kind}`)}}replaceCommand(e,t){if(!Array.isArray(t)){this.commands[e]=t;return}const n=t.length-1;this.commands.splice(e,1,...t),n!==0&&this.mapArguments(s=>{switch(s.$kind){case"Result":s.Result>e&&(s.Result+=n);break;case"NestedResult":s.NestedResult[0]>e&&(s.NestedResult[0]+=n);break}return s})}getDigest(){const e=this.build({onlyTransactionKind:!1});return K.getDigestFromBytes(e)}snapshot(){return M(et,this)}}function cr(r){if(typeof r=="string")return k(r);if(r.Object)return r.Object.ImmOrOwnedObject?k(r.Object.ImmOrOwnedObject.objectId):r.Object.Receiving?k(r.Object.Receiving.objectId):k(r.Object.SharedObject.objectId);if(r.UnresolvedObject)return k(r.UnresolvedObject.objectId)}var an=r=>{throw TypeError(r)},Gt=(r,e,t)=>e.has(r)||an("Cannot "+t),b=(r,e,t)=>(Gt(r,e,"read from private field"),t?t.call(r):e.get(r)),Me=(r,e,t)=>e.has(r)?an("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),fe=(r,e,t,n)=>(Gt(r,e,"write to private field"),e.set(r,t),t),re=(r,e,t)=>(Gt(r,e,"access private method"),t),Ue,De,ge,w,q,tt,Kt,Ct,Wt;function ur(r,e=1/0){const t={$kind:"Result",Result:r},n=[],s=i=>n[i]??(n[i]={$kind:"NestedResult",NestedResult:[r,i]});return new Proxy(t,{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(i,o){if(o in i)return Reflect.get(i,o);if(o===Symbol.iterator)return function*(){let c=0;for(;c<e;)yield s(c),c++};if(typeof o=="symbol")return;const u=parseInt(o,10);if(!(Number.isNaN(u)||u<0))return s(u)}})}const on=Symbol.for("@mysten/transaction");function cn(r){return!!r&&typeof r=="object"&&r[on]===!0}const lr={buildPlugins:new Map,serializationPlugins:new Map},St=Symbol.for("@mysten/transaction/registry");function xe(){try{const r=globalThis;return r[St]||(r[St]=lr),r[St]}catch{return lr}}const Bi=class _t{constructor(){Me(this,q),Me(this,Ue),Me(this,De),Me(this,ge,new Map),Me(this,w),this.object=Pi(t=>{var i,o;if(typeof t=="function")return this.object(t(this));if(typeof t=="object"&&It(T,t))return t;const n=cr(t),s=b(this,w).inputs.find(u=>n===cr(u));return(i=s==null?void 0:s.Object)!=null&&i.SharedObject&&typeof t=="object"&&((o=t.Object)!=null&&o.SharedObject)&&(s.Object.SharedObject.mutable=s.Object.SharedObject.mutable||t.Object.SharedObject.mutable),s?{$kind:"Input",Input:b(this,w).inputs.indexOf(s),type:"object"}:b(this,w).addInput("object",typeof t=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:k(t)}}:t)});const e=xe();fe(this,w,new K),fe(this,De,[...e.buildPlugins.values()]),fe(this,Ue,[...e.serializationPlugins.values()])}static fromKind(e){const t=new _t;return fe(t,w,K.fromKindBytes(typeof e=="string"?z(e):e)),t}static from(e){const t=new _t;return cn(e)?fe(t,w,new K(e.getData())):typeof e!="string"||!e.startsWith("{")?fe(t,w,K.fromBytes(typeof e=="string"?z(e):e)):fe(t,w,K.restore(JSON.parse(e))),t}static registerGlobalSerializationPlugin(e,t){xe().serializationPlugins.set(e,t??e)}static unregisterGlobalSerializationPlugin(e){xe().serializationPlugins.delete(e)}static registerGlobalBuildPlugin(e,t){xe().buildPlugins.set(e,t??e)}static unregisterGlobalBuildPlugin(e){xe().buildPlugins.delete(e)}addSerializationPlugin(e){b(this,Ue).push(e)}addBuildPlugin(e){b(this,De).push(e)}addIntentResolver(e,t){if(b(this,ge).has(e)&&b(this,ge).get(e)!==t)throw new Error(`Intent resolver for ${e} already exists`);b(this,ge).set(e,t)}setSender(e){b(this,w).sender=e}setSenderIfNotSet(e){b(this,w).sender||(b(this,w).sender=e)}setExpiration(e){b(this,w).expiration=e?M(nn,e):null}setGasPrice(e){b(this,w).gasConfig.price=String(e)}setGasBudget(e){b(this,w).gasConfig.budget=String(e)}setGasBudgetIfNotSet(e){b(this,w).gasData.budget==null&&(b(this,w).gasConfig.budget=String(e))}setGasOwner(e){b(this,w).gasConfig.owner=e}setGasPayment(e){b(this,w).gasConfig.payment=e.map(t=>M(ue,t))}get blockData(){return ir(b(this,w).snapshot())}getData(){return b(this,w).snapshot()}get[on](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:Ui(e=>Ut(e)?b(this,w).addInput("pure",{$kind:"Pure",Pure:{bytes:e.toBase64()}}):b(this,w).addInput("pure",It(rr,e)?M(rr,e):e instanceof Uint8Array?ae.Pure(e):{$kind:"UnresolvedPure",UnresolvedPure:{value:e}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...e){return this.object(ae.ObjectRef(...e))}receivingRef(...e){return this.object(ae.ReceivingRef(...e))}sharedObjectRef(...e){return this.object(ae.SharedObjectRef(...e))}add(e){if(typeof e=="function")return e(this);const t=b(this,w).commands.push(e);return ur(t-1)}splitCoins(e,t){const n=he.SplitCoins(typeof e=="string"?this.object(e):re(this,q,Kt).call(this,e),t.map(i=>typeof i=="number"||typeof i=="bigint"||typeof i=="string"?this.pure.u64(i):re(this,q,tt).call(this,i))),s=b(this,w).commands.push(n);return ur(s-1,t.length)}mergeCoins(e,t){return this.add(he.MergeCoins(this.object(e),t.map(n=>this.object(n))))}publish({modules:e,dependencies:t}){return this.add(he.Publish({modules:e,dependencies:t}))}upgrade({modules:e,dependencies:t,package:n,ticket:s}){return this.add(he.Upgrade({modules:e,dependencies:t,package:n,ticket:this.object(s)}))}moveCall({arguments:e,...t}){return this.add(he.MoveCall({...t,arguments:e==null?void 0:e.map(n=>re(this,q,tt).call(this,n))}))}transferObjects(e,t){return this.add(he.TransferObjects(e.map(n=>this.object(n)),typeof t=="string"?this.pure.address(t):re(this,q,tt).call(this,t)))}makeMoveVec({type:e,elements:t}){return this.add(he.MakeMoveVec({type:e,elements:t.map(n=>this.object(n))}))}serialize(){return JSON.stringify(ir(b(this,w).snapshot()))}async toJSON(e={}){return await this.prepareForSerialization(e),JSON.stringify(M(bi,b(this,w).snapshot()),(t,n)=>typeof n=="bigint"?n.toString():n,2)}async sign(e){const{signer:t,...n}=e,s=await this.build(n);return t.signTransaction(s)}async build(e={}){return await this.prepareForSerialization(e),await re(this,q,Ct).call(this,e),b(this,w).build({onlyTransactionKind:e.onlyTransactionKind})}async getDigest(e={}){return await re(this,q,Ct).call(this,e),b(this,w).getDigest()}async prepareForSerialization(e){var s;const t=new Set;for(const i of b(this,w).commands)i.$Intent&&t.add(i.$Intent.name);const n=[...b(this,Ue)];for(const i of t)if(!((s=e.supportedIntents)!=null&&s.includes(i))){if(!b(this,ge).has(i))throw new Error(`Missing intent resolver for ${i}`);n.push(b(this,ge).get(i))}await re(this,q,Wt).call(this,n,e)}};Ue=new WeakMap;De=new WeakMap;ge=new WeakMap;w=new WeakMap;q=new WeakSet;tt=function(r){return Ut(r)?this.pure(r):re(this,q,Kt).call(this,r)};Kt=function(r){return typeof r=="function"?M(T,r(this)):M(T,r)};Ct=async function(r){if(!r.onlyTransactionKind&&!b(this,w).sender)throw new Error("Missing transaction sender");await re(this,q,Wt).call(this,[...b(this,De),ki],r)};Wt=async function(r,e){const t=n=>{if(n>=r.length)return()=>{};const s=r[n];return async()=>{const i=t(n+1);let o=!1,u=!1;if(await s(b(this,w),e,async()=>{if(o)throw new Error(`next() was call multiple times in TransactionPlugin ${n}`);o=!0,await i(),u=!0}),!o)throw new Error(`next() was not called in TransactionPlugin ${n}`);if(!u)throw new Error(`next() was not awaited in TransactionPlugin ${n}`)}};await t(0)()};let Ri=Bi;const Ni=Symbol.for("@mysten/SuiClient");class Di{get[Ni](){return!0}constructor(e){this.transport=e.transport??new Ts({url:e.url})}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(e){if(!e.owner||!se(k(e.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getCoins",params:[e.owner,e.coinType,e.cursor,e.limit]})}async getAllCoins(e){if(!e.owner||!se(k(e.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getAllCoins",params:[e.owner,e.cursor,e.limit]})}async getBalance(e){if(!e.owner||!se(k(e.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getBalance",params:[e.owner,e.coinType]})}async getAllBalances(e){if(!e.owner||!se(k(e.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getAllBalances",params:[e.owner]})}async getCoinMetadata(e){return await this.transport.request({method:"suix_getCoinMetadata",params:[e.coinType]})}async getTotalSupply(e){return await this.transport.request({method:"suix_getTotalSupply",params:[e.coinType]})}async call(e,t){return await this.transport.request({method:e,params:t})}async getMoveFunctionArgTypes(e){return await this.transport.request({method:"sui_getMoveFunctionArgTypes",params:[e.package,e.module,e.function]})}async getNormalizedMoveModulesByPackage(e){return await this.transport.request({method:"sui_getNormalizedMoveModulesByPackage",params:[e.package]})}async getNormalizedMoveModule(e){return await this.transport.request({method:"sui_getNormalizedMoveModule",params:[e.package,e.module]})}async getNormalizedMoveFunction(e){return await this.transport.request({method:"sui_getNormalizedMoveFunction",params:[e.package,e.module,e.function]})}async getNormalizedMoveStruct(e){return await this.transport.request({method:"sui_getNormalizedMoveStruct",params:[e.package,e.module,e.struct]})}async getOwnedObjects(e){if(!e.owner||!se(k(e.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getOwnedObjects",params:[e.owner,{filter:e.filter,options:e.options},e.cursor,e.limit]})}async getObject(e){if(!e.id||!Ze(Z(e.id)))throw new Error("Invalid Sui Object id");return await this.transport.request({method:"sui_getObject",params:[e.id,e.options]})}async tryGetPastObject(e){return await this.transport.request({method:"sui_tryGetPastObject",params:[e.id,e.version,e.options]})}async multiGetObjects(e){if(e.ids.forEach(n=>{if(!n||!Ze(Z(n)))throw new Error(`Invalid Sui Object id ${n}`)}),e.ids.length!==new Set(e.ids).size)throw new Error(`Duplicate object ids in batch call ${e.ids}`);return await this.transport.request({method:"sui_multiGetObjects",params:[e.ids,e.options]})}async queryTransactionBlocks(e){return await this.transport.request({method:"suix_queryTransactionBlocks",params:[{filter:e.filter,options:e.options},e.cursor,e.limit,(e.order||"descending")==="descending"]})}async getTransactionBlock(e){if(!Xt(e.digest))throw new Error("Invalid Transaction digest");return await this.transport.request({method:"sui_getTransactionBlock",params:[e.digest,e.options]})}async multiGetTransactionBlocks(e){if(e.digests.forEach(n=>{if(!Xt(n))throw new Error(`Invalid Transaction digest ${n}`)}),e.digests.length!==new Set(e.digests).size)throw new Error(`Duplicate digests in batch call ${e.digests}`);return await this.transport.request({method:"sui_multiGetTransactionBlocks",params:[e.digests,e.options]})}async executeTransactionBlock({transactionBlock:e,signature:t,options:n,requestType:s}){const i=await this.transport.request({method:"sui_executeTransactionBlock",params:[typeof e=="string"?e:A(e),Array.isArray(t)?t:[t],n]});if(s==="WaitForLocalExecution")try{await this.waitForTransaction({digest:i.digest})}catch{}return i}async signAndExecuteTransaction({transaction:e,signer:t,...n}){let s;e instanceof Uint8Array?s=e:(e.setSenderIfNotSet(t.toSuiAddress()),s=await e.build({client:this}));const{signature:i,bytes:o}=await t.signTransaction(s);return this.executeTransactionBlock({transactionBlock:o,signature:i,...n})}async getTotalTransactionBlocks(){const e=await this.transport.request({method:"sui_getTotalTransactionBlocks",params:[]});return BigInt(e)}async getReferenceGasPrice(){const e=await this.transport.request({method:"suix_getReferenceGasPrice",params:[]});return BigInt(e)}async getStakes(e){if(!e.owner||!se(k(e.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getStakes",params:[e.owner]})}async getStakesByIds(e){return e.stakedSuiIds.forEach(t=>{if(!t||!Ze(Z(t)))throw new Error(`Invalid Sui Stake id ${t}`)}),await this.transport.request({method:"suix_getStakesByIds",params:[e.stakedSuiIds]})}async getLatestSuiSystemState(){return await this.transport.request({method:"suix_getLatestSuiSystemState",params:[]})}async queryEvents(e){return await this.transport.request({method:"suix_queryEvents",params:[e.query,e.cursor,e.limit,(e.order||"descending")==="descending"]})}async subscribeEvent(e){return this.transport.subscribe({method:"suix_subscribeEvent",unsubscribe:"suix_unsubscribeEvent",params:[e.filter],onMessage:e.onMessage})}async subscribeTransaction(e){return this.transport.subscribe({method:"suix_subscribeTransaction",unsubscribe:"suix_unsubscribeTransaction",params:[e.filter],onMessage:e.onMessage})}async devInspectTransactionBlock(e){var n;let t;if(cn(e.transactionBlock))e.transactionBlock.setSenderIfNotSet(e.sender),t=A(await e.transactionBlock.build({client:this,onlyTransactionKind:!0}));else if(typeof e.transactionBlock=="string")t=e.transactionBlock;else if(e.transactionBlock instanceof Uint8Array)t=A(e.transactionBlock);else throw new Error("Unknown transaction block format.");return await this.transport.request({method:"sui_devInspectTransactionBlock",params:[e.sender,t,(n=e.gasPrice)==null?void 0:n.toString(),e.epoch]})}async dryRunTransactionBlock(e){return await this.transport.request({method:"sui_dryRunTransactionBlock",params:[typeof e.transactionBlock=="string"?e.transactionBlock:A(e.transactionBlock)]})}async getDynamicFields(e){if(!e.parentId||!Ze(Z(e.parentId)))throw new Error("Invalid Sui Object id");return await this.transport.request({method:"suix_getDynamicFields",params:[e.parentId,e.cursor,e.limit]})}async getDynamicFieldObject(e){return await this.transport.request({method:"suix_getDynamicFieldObject",params:[e.parentId,e.name]})}async getLatestCheckpointSequenceNumber(){const e=await this.transport.request({method:"sui_getLatestCheckpointSequenceNumber",params:[]});return String(e)}async getCheckpoint(e){return await this.transport.request({method:"sui_getCheckpoint",params:[e.id]})}async getCheckpoints(e){return await this.transport.request({method:"sui_getCheckpoints",params:[e.cursor,e==null?void 0:e.limit,e.descendingOrder]})}async getCommitteeInfo(e){return await this.transport.request({method:"suix_getCommitteeInfo",params:[e==null?void 0:e.epoch]})}async getNetworkMetrics(){return await this.transport.request({method:"suix_getNetworkMetrics",params:[]})}async getAddressMetrics(){return await this.transport.request({method:"suix_getLatestAddressMetrics",params:[]})}async getEpochMetrics(e){return await this.transport.request({method:"suix_getEpochMetrics",params:[e==null?void 0:e.cursor,e==null?void 0:e.limit,e==null?void 0:e.descendingOrder]})}async getAllEpochAddressMetrics(e){return await this.transport.request({method:"suix_getAllEpochAddressMetrics",params:[e==null?void 0:e.descendingOrder]})}async getEpochs(e){return await this.transport.request({method:"suix_getEpochs",params:[e==null?void 0:e.cursor,e==null?void 0:e.limit,e==null?void 0:e.descendingOrder]})}async getMoveCallMetrics(){return await this.transport.request({method:"suix_getMoveCallMetrics",params:[]})}async getCurrentEpoch(){return await this.transport.request({method:"suix_getCurrentEpoch",params:[]})}async getValidatorsApy(){return await this.transport.request({method:"suix_getValidatorsApy",params:[]})}async getChainIdentifier(){const e=await this.getCheckpoint({id:"0"}),t=nt(e.digest);return ze(t.slice(0,4))}async resolveNameServiceAddress(e){return await this.transport.request({method:"suix_resolveNameServiceAddress",params:[e.name]})}async resolveNameServiceNames({format:e="dot",...t}){const{nextCursor:n,hasNextPage:s,data:i}=await this.transport.request({method:"suix_resolveNameServiceNames",params:[t.address,t.cursor,t.limit]});return{hasNextPage:s,nextCursor:n,data:i.map(o=>Wn(o,e))}}async getProtocolConfig(e){return await this.transport.request({method:"sui_getProtocolConfig",params:[e==null?void 0:e.version]})}async waitForTransaction({signal:e,timeout:t=60*1e3,pollInterval:n=2*1e3,...s}){const i=AbortSignal.timeout(t),o=new Promise((u,c)=>{i.addEventListener("abort",()=>c(i.reason))});for(o.catch(()=>{});!i.aborted;){e==null||e.throwIfAborted();try{return await this.getTransactionBlock(s)}catch{await Promise.race([new Promise(c=>setTimeout(c,n)),o])}}throw i.throwIfAborted(),new Error("Unexpected error while waiting for transaction block.")}}class un extends En{}const Mt="Sui",ln=r=>{var t;const e=(t=r.data)==null?void 0:t.content;return e&&e.dataType==="moveObject"?e.fields:null},ma=(r,e)=>{try{return Qt(r)===Qt(e)}catch{return!1}},ya=r=>(r==null?void 0:r.type)==="created",ba=r=>(r==null?void 0:r.type)==="published";function zi(r){return Array.isArray(r)}function Lt(r){return!Array.isArray(r)&&typeof r=="object"&&"fields"in r&&"type"in r}function Vi(r){return typeof r=="object"&&!zi(r)&&!Lt(r)}function wa(r){return typeof r=="object"&&"id"in r}const va=async(r,e)=>{const{data:t,error:n}=await r.getObject({id:e,options:{showContent:!0}});if(n)throw new Error("Error getting object: "+n);if(!t||!Lt(t.content))throw new Error(`Cannot get oject for state id ${e}: `+t);return In(t.content.type)},qi=async(r,e)=>{if(!se(e))throw new Error(`Invalid object ID: ${e}`);const t=await r.getObject({id:e,options:{showContent:!0}});return ln(t)},Sa=async(r,e)=>{let t,n;do{const o=await r.getDynamicFields({parentId:e,cursor:n});t=o.data.find(u=>u.name.type.endsWith("CurrentPackage")),n=o.hasNextPage?o.nextCursor:null}while(n&&!t);if(!t)throw new Error("CurrentPackage not found");const s=await r.getObject({id:t.objectId,options:{showContent:!0}}),i=ln(s);if(!i||!Vi(i))throw new Error("Unable to get fields from object response");if(!("value"in i)||!Lt(i.value))throw new Error("Unable to get package id");return i.value.fields.package},ka=async(r,e,t)=>{let n=null,s=null,i=null,o;do{if(i=await r.getOwnedObjects({owner:t,filter:{StructType:`${e}::emitter::EmitterCap`},options:{showContent:!0},cursor:o}),!i||!i.data)throw Error("Failed to get owned objects");for(const u of i.data){if(!u.data)continue;const{version:c,objectId:p}=u.data;(n===null||c<n)&&(n=c,s=p)}o=i.hasNextPage?i.nextCursor:void 0}while(o);return s},Ea=async(r,e)=>{const t=new Ri,[n]=t.publish({modules:r.modules.map(s=>Array.from(On.decode(s))),dependencies:r.dependencies.map(s=>Z(s))});return t.transferObjects([n],t.pure.address(e)),t},ne=class ne extends Tn{constructor(e,t){super(e,t??jn(e,ne._platform))}getRpc(e){if(e in this.config)return new Di({url:this.config[e].rpc});throw new Error("No configuration available for chain: "+e)}getChain(e){if(e in this.config)return new un(e,this);throw new Error("No configuration available for chain: "+e)}static nativeTokenId(e,t){if(!ne.isSupportedChain(t))throw new Error(`invalid chain for ${Mt}: ${t}`);return Cn.tokenId(t,_n)}static isNativeTokenId(e,t,n){return!ne.isSupportedChain(t)||n.chain!==t?!1:this.nativeTokenId(e,t)===n}static isSupportedChain(e){return Mn(e)===ne._platform}static async getDecimals(e,t,n){if(ft(n))return xn(ne._platform);const s=new Xe(n);try{const o=await qi(t,s.toString());if(o&&"decimals"in o)return o.decimals}catch{}const i=await t.getCoinMetadata({coinType:s.toString()});if(i===null)throw new Error(`Can't fetch decimals for token ${s.toString()}`);return i.decimals}static async getCoins(e,t,n){let s=[],i=null;const o=new Xe(t).toString();do{const u=await e.getCoins({owner:o,coinType:n,cursor:i});s=[...s,...u.data],i=u.hasNextPage?u.nextCursor:null}while(i);return s}static async getBalance(e,t,n,s){if(ft(s)){const{totalBalance:o}=await t.getBalance({owner:n});return BigInt(o)}const{totalBalance:i}=await t.getBalance({owner:n,coinType:s.toString()});return BigInt(i)}static async getBalances(e,t,n,s){return(await Promise.all(s.map(async o=>{const u=await this.getBalance(e,t,n,o);return{[ft(o)?"native":new Xe(o).toString()]:u}}))).reduce((o,u)=>Object.assign(o,u),{})}static async sendWait(e,t,n){const s=[];for(const i of n){const o=await t.executeTransactionBlock(i);await t.waitForTransaction({digest:o.digest}),s.push(o.digest)}return s}static async getLatestBlock(e){return Number(await e.getLatestCheckpointSequenceNumber())}static async getLatestFinalizedBlock(e){return this.getLatestBlock(e)}static chainFromChainId(e){const t=An(ne._platform,e);if(t===void 0)throw new Error(`Unknown native chain id ${e}`);const[n,s]=t;return[n,s]}static async chainFromRpc(e){const t=await e.call("sui_getChainIdentifier",[]);return this.chainFromChainId(t)}};le(ne,"_platform",Mt);let Ge=ne;var Ke={};Object.defineProperty(Ke,"__esModule",{value:!0});Ke.bech32m=We=Ke.bech32=void 0;const lt="qpzry9x8gf2tvdw0s3jn54khce6mua7l",dn={};for(let r=0;r<lt.length;r++){const e=lt.charAt(r);dn[e]=r}function Ie(r){const e=r>>25;return(r&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function dr(r){let e=1;for(let t=0;t<r.length;++t){const n=r.charCodeAt(t);if(n<33||n>126)return"Invalid prefix ("+r+")";e=Ie(e)^n>>5}e=Ie(e);for(let t=0;t<r.length;++t){const n=r.charCodeAt(t);e=Ie(e)^n&31}return e}function Ht(r,e,t,n){let s=0,i=0;const o=(1<<t)-1,u=[];for(let c=0;c<r.length;++c)for(s=s<<e|r[c],i+=e;i>=t;)i-=t,u.push(s>>i&o);if(n)i>0&&u.push(s<<t-i&o);else{if(i>=e)return"Excess padding";if(s<<t-i&o)return"Non-zero padding"}return u}function Fi(r){return Ht(r,8,5,!0)}function Gi(r){const e=Ht(r,5,8,!1);if(Array.isArray(e))return e}function Ki(r){const e=Ht(r,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}function hn(r){let e;r==="bech32"?e=1:e=734539939;function t(o,u,c){if(c=c||90,o.length+7+u.length>c)throw new TypeError("Exceeds length limit");o=o.toLowerCase();let p=dr(o);if(typeof p=="string")throw new Error(p);let l=o+"1";for(let h=0;h<u.length;++h){const I=u[h];if(I>>5)throw new Error("Non 5-bit word");p=Ie(p)^I,l+=lt.charAt(I)}for(let h=0;h<6;++h)p=Ie(p);p^=e;for(let h=0;h<6;++h){const I=p>>(5-h)*5&31;l+=lt.charAt(I)}return l}function n(o,u){if(u=u||90,o.length<8)return o+" too short";if(o.length>u)return"Exceeds length limit";const c=o.toLowerCase(),p=o.toUpperCase();if(o!==c&&o!==p)return"Mixed-case string "+o;o=c;const l=o.lastIndexOf("1");if(l===-1)return"No separator character for "+o;if(l===0)return"Missing prefix for "+o;const h=o.slice(0,l),I=o.slice(l+1);if(I.length<6)return"Data too short";let O=dr(h);if(typeof O=="string")return O;const S=[];for(let Y=0;Y<I.length;++Y){const Ce=I.charAt(Y),_e=dn[Ce];if(_e===void 0)return"Unknown character "+Ce;O=Ie(O)^_e,!(Y+6>=I.length)&&S.push(_e)}return O!==e?"Invalid checksum for "+o:{prefix:h,words:S}}function s(o,u){const c=n(o,u);if(typeof c=="object")return c}function i(o,u){const c=n(o,u);if(typeof c=="object")return c;throw new Error(c)}return{decodeUnsafe:s,decode:i,encode:t,toWords:Fi,fromWordsUnsafe:Gi,fromWords:Ki}}var We=Ke.bech32=hn("bech32");Ke.bech32m=hn("bech32m");function fn(r,e){return y.IntentMessage(y.fixedArray(e.length,y.u8())).serialize({intent:{scope:{[r]:!0},version:{V0:!0},appId:{Sui:!0}},value:e}).toBytes()}const Jt={ED25519:0,Secp256k1:1,Secp256r1:2,MultiSig:3,ZkLogin:5,Passkey:6},Wi={ED25519:32,Secp256k1:33,Secp256r1:33},pn={0:"ED25519",1:"Secp256k1",2:"Secp256r1",3:"MultiSig",5:"ZkLogin",6:"Passkey"};function gn(r,e){if(r===e)return!0;if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}class Li{equals(e){return gn(this.toRawBytes(),e.toRawBytes())}toBase64(){return A(this.toRawBytes())}toString(){throw new Error("`toString` is not implemented on public keys. Use `toBase64()` or `toRawBytes()` instead.")}toSuiPublicKey(){const e=this.toSuiBytes();return A(e)}verifyWithIntent(e,t,n){const s=fn(n,e),i=st(s,{dkLen:32});return this.verify(i,t)}verifyPersonalMessage(e,t){return this.verifyWithIntent(y.vector(y.u8()).serialize(e).toBytes(),t,"PersonalMessage")}verifyTransaction(e,t){return this.verifyWithIntent(e,t,"TransactionData")}verifyAddress(e){return this.toSuiAddress()===e}toSuiBytes(){const e=this.toRawBytes(),t=new Uint8Array(e.length+1);return t.set([this.flag()]),t.set(e,1),t}toSuiAddress(){return k(Pn(st(this.toSuiBytes(),{dkLen:32})).slice(0,gr*2))}}function Hi(r){const e=z(r),t=pn[e[0]];switch(t){case"ED25519":case"Secp256k1":case"Secp256r1":const n=Wi[t],s=e.slice(1,e.length-n),i=e.slice(1+s.length);return{serializedSignature:r,signatureScheme:t,signature:s,publicKey:i,bytes:e};default:throw new Error("Unsupported signature scheme")}}function Ji({signature:r,signatureScheme:e,publicKey:t}){if(!t)throw new Error("`publicKey` is required");const n=t.toRawBytes(),s=new Uint8Array(1+r.length+n.length);return s.set([Jt[e]]),s.set(r,1),s.set(n,1+r.length),A(s)}const rt=32,mn="suiprivkey";class Zi{async signWithIntent(e,t){const n=fn(t,e),s=st(n,{dkLen:32});return{signature:Ji({signature:await this.sign(s),signatureScheme:this.getKeyScheme(),publicKey:this.getPublicKey()}),bytes:A(e)}}async signTransaction(e){return this.signWithIntent(e,"TransactionData")}async signPersonalMessage(e){const{signature:t}=await this.signWithIntent(a.vector(a.u8()).serialize(e).toBytes(),"PersonalMessage");return{bytes:A(e),signature:t}}toSuiAddress(){return this.getPublicKey().toSuiAddress()}}class Yi extends Zi{}function Xi(r){const{prefix:e,words:t}=We.decode(r);if(e!==mn)throw new Error("invalid private key prefix");const n=new Uint8Array(We.fromWords(t)),s=n.slice(1);return{schema:pn[n[0]],secretKey:s}}function Qi(r,e){if(r.length!==rt)throw new Error("Invalid bytes length");const t=Jt[e],n=new Uint8Array(r.length+1);return n.set([t]),n.set(r,1),We.encode(mn,We.toWords(n))}function hr(r){return!!new RegExp("^m\\/44'\\/784'\\/[0-9]+'\\/[0-9]+'\\/[0-9]+'+$").test(r)}function ea(r){return $n(r,"")}function ta(r){return ze(ea(r))}const ra="ed25519 seed",na=2147483648,sa=new RegExp("^m(\\/[0-9]+')+$"),yn=r=>r.replace("'",""),ia=r=>{const t=mr.create(yr,ra).update(At(r)).digest(),n=t.slice(0,32),s=t.slice(32);return{key:n,chainCode:s}},aa=({key:r,chainCode:e},t)=>{const n=new ArrayBuffer(4);new DataView(n).setUint32(0,t);const i=new Uint8Array(1+r.length+n.byteLength);i.set(new Uint8Array(1).fill(0)),i.set(r,1),i.set(new Uint8Array(n,0,n.byteLength),r.length+1);const o=mr.create(yr,e).update(i).digest(),u=o.slice(0,32),c=o.slice(32);return{key:u,chainCode:c}},oa=r=>sa.test(r)?!r.split("/").slice(1).map(yn).some(isNaN):!1,fr=(r,e,t=na)=>{if(!oa(r))throw new Error("Invalid derivation path");const{key:n,chainCode:s}=ia(e);return r.split("/").slice(1).map(yn).map(o=>parseInt(o,10)).reduce((o,u)=>aa(o,u+t),{key:n,chainCode:s})},xt=32;class bn extends Li{constructor(e){if(super(),typeof e=="string"?this.data=z(e):e instanceof Uint8Array?this.data=e:this.data=Uint8Array.from(e),this.data.length!==xt)throw new Error(`Invalid public key input. Expected ${xt} bytes, got ${this.data.length}`)}equals(e){return super.equals(e)}toRawBytes(){return this.data}flag(){return Jt.ED25519}async verify(e,t){let n;if(typeof t=="string"){const s=Hi(t);if(s.signatureScheme!=="ED25519")throw new Error("Invalid signature scheme");if(!gn(this.toRawBytes(),s.publicKey))throw new Error("Signature does not match public key");n=s.signature}else n=t;return te.verify(n,e,this.toRawBytes())}}bn.SIZE=xt;const pr="m/44'/784'/0'/0'/0'";class ke extends Yi{constructor(e){if(super(),e)this.keypair={publicKey:e.publicKey,secretKey:e.secretKey.slice(0,32)};else{const t=te.utils.randomPrivateKey();this.keypair={publicKey:te.getPublicKey(t),secretKey:t}}}getKeyScheme(){return"ED25519"}static generate(){const e=te.utils.randomPrivateKey();return new ke({publicKey:te.getPublicKey(e),secretKey:e})}static fromSecretKey(e,t){if(typeof e=="string"){const i=Xi(e);if(i.schema!=="ED25519")throw new Error(`Expected a ED25519 keypair, got ${i.schema}`);return this.fromSecretKey(i.secretKey,t)}const n=e.length;if(n!==rt)throw new Error(`Wrong secretKey size. Expected ${rt} bytes, got ${n}.`);const s={publicKey:te.getPublicKey(e),secretKey:e};if(!t||!t.skipValidation){const o=new TextEncoder().encode("sui validation"),u=te.sign(o,e);if(!te.verify(u,o,s.publicKey))throw new Error("provided secretKey is invalid")}return new ke(s)}getPublicKey(){return new bn(this.keypair.publicKey)}getSecretKey(){return Qi(this.keypair.secretKey.slice(0,rt),this.getKeyScheme())}async sign(e){return te.sign(e,this.keypair.secretKey)}static deriveKeypair(e,t){if(t==null&&(t=pr),!hr(t))throw new Error("Invalid derivation path");const{key:n}=fr(t,ta(e));return ke.fromSecretKey(n)}static deriveKeypairFromSeed(e,t){if(t==null&&(t=pr),!hr(t))throw new Error("Invalid derivation path");const{key:n}=fr(t,e);return ke.fromSecretKey(n)}}async function ca(r,e){const[,t]=await Ge.chainFromRpc(r);return new ua(t,r,ke.deriveKeypair(e,"m/44'/784'/0'/0'/0'"))}class ua{constructor(e,t,n,s){le(this,"_chain");le(this,"_client");le(this,"_signer");le(this,"_debug");this._chain=e,this._client=t,this._signer=n,this._debug=s}chain(){return this._chain}address(){return this._signer.toSuiAddress()}async signAndSend(e){const t=[];for(const n of e){const{description:s,transaction:i}=n;this._debug&&console.log(`Signing ${s} for ${this.address()}`);try{const o=await this._client.signAndExecuteTransaction({transaction:i,signer:this._signer});t.push(o.digest)}catch(o){throw o}}return t}}const la={Address:Xe,Platform:Ge,getSigner:ca,protocols:{WormholeCore:()=>pt(()=>import("./index-D8nnAO88.js"),__vite__mapDeps([0,1,2,3,4])),TokenBridge:()=>pt(()=>import("./index-BjVbgKwL.js"),__vite__mapDeps([5,1,2,0,3,4,6])),CircleBridge:()=>pt(()=>import("./index-DpMc0uqY.js"),__vite__mapDeps([7,1,2,6,3,4]))},getChain:(r,e,t)=>new un(e,new Ge(r,Un(r,Mt,{[e]:t})))},Oa=Object.freeze(Object.defineProperty({__proto__:null,default:la},Symbol.toStringTag,{value:"Module"}));export{Ge as S,Ri as T,ln as a,Lt as b,ga as c,ba as d,ya as e,Hn as f,qi as g,ma as h,Vi as i,ka as j,Sa as k,va as l,wa as m,Ea as p,Oa as s};
@@ -1,4 +1,4 @@
1
- var zn=Object.defineProperty;var On=(e,t,r)=>t in e?zn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var k=(e,t,r)=>On(e,typeof t!="symbol"?t+"":t,r);import{g as br}from"./wallets-B2cUxj0w.js";import{R as Bn}from"./util-C_16CLeU.js";import{j as Pn,i as Rn,H as tr,R as Un,W as Gn,l as rr,I as nr,N as Qn,B as _e}from"../main.js";import{b as Yn}from"./blake2b-CzqSqyTv.js";function Wn(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const dt=8192;function Lr(e){if(e.length<dt)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=dt){const n=e.slice(r,r+dt);t+=String.fromCharCode(...n)}return btoa(t)}const Zn=32;function Vn(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Zn*2,"0")}`}function Cr(e,t=!1){return Vn(e,t)}BigInt(1e9);Cr("0x6");Cr("0x5");let Fn=class extends TypeError{constructor(t,r){let n;const{message:i,explanation:o,...a}=t,{path:l}=t,c=l.length===0?i:`At path: ${l.join(".")} -- ${i}`;super(o??c),o!=null&&(this.cause=c),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}};function Jn(e){return Ee(e)&&typeof e[Symbol.iterator]=="function"}function Ee(e){return typeof e=="object"&&e!=null}function be(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function Hn(e){const{done:t,value:r}=e.next();return t?void 0:r}function Xn(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:o}=t,{type:a}=r,{refinement:l,message:c=`Expected a value of type \`${a}\`${l?` with refinement \`${l}\``:""}, but received: \`${be(n)}\``}=e;return{value:n,type:a,refinement:l,key:i[i.length-1],path:i,branch:o,...e,message:c}}function*ir(e,t,r,n){Jn(e)||(e=[e]);for(const i of e){const o=Xn(i,t,r,n);o&&(yield o)}}function*xt(e,t,r={}){const{path:n=[],branch:i=[e],coerce:o=!1,mask:a=!1}=r,l={path:n,branch:i};if(o&&(e=t.coercer(e,l),a&&t.type!=="type"&&Ee(t.schema)&&Ee(e)&&!Array.isArray(e)))for(const g in e)t.schema[g]===void 0&&delete e[g];let c="valid";for(const g of t.validator(e,l))g.explanation=r.message,c="not_valid",yield[g,void 0];for(let[g,d,A]of t.entries(e,l)){const j=xt(d,A,{path:g===void 0?n:[...n,g],branch:g===void 0?i:[...i,d],coerce:o,mask:a,message:r.message});for(const h of j)h[0]?(c=h[0].refinement!=null?"not_refined":"not_valid",yield[h[0],void 0]):o&&(d=h[1],g===void 0?e=d:e instanceof Map?e.set(g,d):e instanceof Set?e.add(d):Ee(e)&&(d!==void 0||g in e)&&(e[g]=d))}if(c!=="not_valid")for(const g of t.refiner(e,l))g.explanation=r.message,c="not_refined",yield[g,void 0];c==="valid"&&(yield[void 0,e])}let Re=class{constructor(t){const{type:r,schema:n,validator:i,refiner:o,coercer:a=c=>c,entries:l=function*(){}}=t;this.type=r,this.schema=n,this.entries=l,this.coercer=a,i?this.validator=(c,g)=>{const d=i(c,g);return ir(d,g,this,c)}:this.validator=()=>[],o?this.refiner=(c,g)=>{const d=o(c,g);return ir(d,g,this,c)}:this.refiner=()=>[]}assert(t,r){return qn(t,this,r)}create(t,r){return Kn(t,this,r)}is(t){return $n(t,this)}mask(t,r){return _n(t,this,r)}validate(t,r={}){return Xe(t,this,r)}};function qn(e,t,r){const n=Xe(e,t,{message:r});if(n[0])throw n[0]}function Kn(e,t,r){const n=Xe(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function _n(e,t,r){const n=Xe(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function $n(e,t){return!Xe(e,t)[0]}function Xe(e,t,r={}){const n=xt(e,t,r),i=Hn(n);return i[0]?[new Fn(i[0],function*(){for(const a of n)a[0]&&(yield a[0])}),void 0]:[void 0,i[1]]}function kt(e,t){return new Re({type:e,schema:null,validator:t})}function sr(e){return new Re({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${be(t)}`}})}function ke(){return kt("boolean",e=>typeof e=="boolean")}function $e(e){const t=be(e),r=typeof e;return new Re({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${be(n)}`}})}function ei(){return kt("never",()=>!1)}function Ue(e){const t=e?Object.keys(e):[],r=ei();return new Re({type:"object",schema:e||null,*entries(n){if(e&&Ee(n)){const i=new Set(Object.keys(n));for(const o of t)i.delete(o),yield[o,n[o],e[o]];for(const o of i)yield[o,n[o],r]}},validator(n){return Ee(n)||`Expected an object, but received: ${be(n)}`},coercer(n){return Ee(n)?{...n}:n}})}function re(e){return new Re({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function Y(){return kt("string",e=>typeof e=="string"||`Expected a string, but received: ${be(e)}`)}function ti(e){const t=e.map(r=>r.type).join(" | ");return new Re({type:"union",schema:null,coercer(r){for(const n of e){const[i,o]=n.validate(r,{coerce:!0});if(!i)return o}return r},validator(r,n){const i=[];for(const o of e){const[...a]=xt(r,o,n),[l]=a;if(l[0])for(const[c]of a)c&&i.push(c);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${be(r)}`,...i]}})}var ri=Object.defineProperty,ni=(e,t,r)=>t in e?ri(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_=(e,t,r)=>(ni(e,typeof t!="symbol"?t+"":t,r),r),vr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},q=(e,t,r)=>(vr(e,t,"read from private field"),r?r.call(e):t.get(e)),oe=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},F=(e,t,r,n)=>(vr(e,t,"write to private field"),t.set(e,r),r),zt=Ue({address:Y(),publicKey:Y(),chains:sr(Y()),features:sr(Y()),label:re(Y()),icon:re(Y())});function Ot(e){return{address:e.address,publicKey:Lr(e.publicKey),features:[...e.features],chains:[...e.chains],label:e.label,icon:e.icon}}function ii(e){return{address:e.address,publicKey:Wn(e.publicKey),chains:e.chains.map(t=>t),features:e.features.map(t=>t),label:e.label,icon:e.icon}}Ue({message:Y(),account:zt});function si(e){return{message:Lr(e.message),account:Ot(e.account)}}Ue({transactionBlock:Y(),account:zt,chain:Y()});function oi(e){return{transactionBlock:e.transactionBlock.serialize(),account:Ot(e.account),chain:e.chain}}var ai=Ue({showBalanceChanges:re(ke()),showEffects:re(ke()),showEvents:re(ke()),showInput:re(ke()),showObjectChanges:re(ke()),showRawInput:re(ke())});Ue({transactionBlock:Y(),account:zt,chain:Y(),requestType:re(Y()),options:re(ai)});function ci(e){return{transactionBlock:e.transactionBlock.serialize(),account:Ot(e.account),chain:e.chain,requestType:e.requestType,options:e.options}}Ue({network:ti([$e("mainnet"),$e("testnet"),$e("devnet"),$e("localnet")]),url:Y()});const ui="sui:devnet",li="sui:testnet",gi="sui:localnet",di="sui:mainnet",Mi=[ui,li,gi,di];var Ai="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIGlkPSJMYXllcl8xIiB4PSIwIiB5PSIwIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAzMTguNiAzMTguNiI+CiAgPHN0eWxlPgogICAgLnN0MSwuc3Q2e2ZpbGw6I2U0NzYxYjtzdHJva2U6I2U0NzYxYjtzdHJva2UtbGluZWNhcDpyb3VuZDtzdHJva2UtbGluZWpvaW46cm91bmR9LnN0NntmaWxsOiNmNjg1MWI7c3Ryb2tlOiNmNjg1MWJ9CiAgPC9zdHlsZT4KICA8cGF0aCBmaWxsPSIjZTI3NjFiIiBzdHJva2U9IiNlMjc2MWIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0ibTI3NC4xIDM1LjUtOTkuNSA3My45TDE5MyA2NS44eiIvPgogIDxwYXRoIGQ9Im00NC40IDM1LjUgOTguNyA3NC42LTE3LjUtNDQuM3ptMTkzLjkgMTcxLjMtMjYuNSA0MC42IDU2LjcgMTUuNiAxNi4zLTU1LjN6bS0yMDQuNC45TDUwLjEgMjYzbDU2LjctMTUuNi0yNi41LTQwLjZ6IiBjbGFzcz0ic3QxIi8+CiAgPHBhdGggZD0ibTEwMy42IDEzOC4yLTE1LjggMjMuOSA1Ni4zIDIuNS0yLTYwLjV6bTExMS4zIDAtMzktMzQuOC0xLjMgNjEuMiA1Ni4yLTIuNXpNMTA2LjggMjQ3LjRsMzMuOC0xNi41LTI5LjItMjIuOHptNzEuMS0xNi41IDMzLjkgMTYuNS00LjctMzkuM3oiIGNsYXNzPSJzdDEiLz4KICA8cGF0aCBmaWxsPSIjZDdjMWIzIiBzdHJva2U9IiNkN2MxYjMiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0ibTIxMS44IDI0Ny40LTMzLjktMTYuNSAyLjcgMjIuMS0uMyA5LjN6bS0xMDUgMCAzMS41IDE0LjktLjItOS4zIDIuNS0yMi4xeiIvPgogIDxwYXRoIGZpbGw9IiMyMzM0NDciIHN0cm9rZT0iIzIzMzQ0NyIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBkPSJtMTM4LjggMTkzLjUtMjguMi04LjMgMTkuOS05LjF6bTQwLjkgMCA4LjMtMTcuNCAyMCA5LjF6Ii8+CiAgPHBhdGggZmlsbD0iI2NkNjExNiIgc3Ryb2tlPSIjY2Q2MTE2IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGQ9Im0xMDYuOCAyNDcuNCA0LjgtNDAuNi0zMS4zLjl6TTIwNyAyMDYuOGw0LjggNDAuNiAyNi41LTM5Ljd6bTIzLjgtNDQuNy01Ni4yIDIuNSA1LjIgMjguOSA4LjMtMTcuNCAyMCA5LjF6bS0xMjAuMiAyMy4xIDIwLTkuMSA4LjIgMTcuNCA1LjMtMjguOS01Ni4zLTIuNXoiLz4KICA8cGF0aCBmaWxsPSIjZTQ3NTFmIiBzdHJva2U9IiNlNDc1MWYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0ibTg3LjggMTYyLjEgMjMuNiA0Ni0uOC0yMi45em0xMjAuMyAyMy4xLTEgMjIuOSAyMy43LTQ2em0tNjQtMjAuNi01LjMgMjguOSA2LjYgMzQuMSAxLjUtNDQuOXptMzAuNSAwLTIuNyAxOCAxLjIgNDUgNi43LTM0LjF6Ii8+CiAgPHBhdGggZD0ibTE3OS44IDE5My41LTYuNyAzNC4xIDQuOCAzLjMgMjkuMi0yMi44IDEtMjIuOXptLTY5LjItOC4zLjggMjIuOSAyOS4yIDIyLjggNC44LTMuMy02LjYtMzQuMXoiIGNsYXNzPSJzdDYiLz4KICA8cGF0aCBmaWxsPSIjYzBhZDllIiBzdHJva2U9IiNjMGFkOWUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0ibTE4MC4zIDI2Mi4zLjMtOS4zLTIuNS0yLjJoLTM3LjdsLTIuMyAyLjIuMiA5LjMtMzEuNS0xNC45IDExIDkgMjIuMyAxNS41aDM4LjNsMjIuNC0xNS41IDExLTl6Ii8+CiAgPHBhdGggZmlsbD0iIzE2MTYxNiIgc3Ryb2tlPSIjMTYxNjE2IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGQ9Im0xNzcuOSAyMzAuOS00LjgtMy4zaC0yNy43bC00LjggMy4zLTIuNSAyMi4xIDIuMy0yLjJoMzcuN2wyLjUgMi4yeiIvPgogIDxwYXRoIGZpbGw9IiM3NjNkMTYiIHN0cm9rZT0iIzc2M2QxNiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBkPSJtMjc4LjMgMTE0LjIgOC41LTQwLjgtMTIuNy0zNy45LTk2LjIgNzEuNCAzNyAzMS4zIDUyLjMgMTUuMyAxMS42LTEzLjUtNS0zLjYgOC03LjMtNi4yLTQuOCA4LTYuMXpNMzEuOCA3My40bDguNSA0MC44LTUuNCA0IDggNi4xLTYuMSA0LjggOCA3LjMtNSAzLjYgMTEuNSAxMy41IDUyLjMtMTUuMyAzNy0zMS4zLTk2LjItNzEuNHoiLz4KICA8cGF0aCBkPSJtMjY3LjIgMTUzLjUtNTIuMy0xNS4zIDE1LjkgMjMuOS0yMy43IDQ2IDMxLjItLjRoNDYuNXptLTE2My42LTE1LjMtNTIuMyAxNS4zLTE3LjQgNTQuMmg0Ni40bDMxLjEuNC0yMy42LTQ2em03MSAyNi40IDMuMy01Ny43IDE1LjItNDEuMWgtNjcuNWwxNSA0MS4xIDMuNSA1Ny43IDEuMiAxOC4yLjEgNDQuOGgyNy43bC4yLTQ0Ljh6IiBjbGFzcz0ic3Q2Ii8+Cjwvc3ZnPg==",xr=class Ne extends Error{constructor(t){super(`${Ne.type}: ${t}}`),_(this,"type",Ne.type)}static asSimpleError(t){return new Error(`${Ne.type}: ${t}`)}static isSimpleErrorMessage(t){return t.startsWith(Ne.type+": ")}static fromSimpleErrorMessage(t){return new Ne(t.slice(Ne.type.length+2))}};_(xr,"type","INVALID_REQUEST_PARAMS");var or=xr,kr=class Qe extends Error{constructor(){super(Qe.type),_(this,"type",Qe.type)}static asSimpleError(){return new Error(Qe.type)}static isSimpleErrorMessage(t){return t===Qe.type}};_(kr,"type","USER_REJECTION");var ht=kr,zr=class Te extends Error{constructor(t){super(`${Te.type}: ${t}`),_(this,"type",Te.type)}static asSimpleError(t){return new Error(`${Te.type}: ${t}`)}static isSimpleErrorMessage(t){return t.startsWith(Te.type+": ")}static fromSimpleErrorMessage(t){return new Te(t.slice(Te.type.length+2))}};_(zr,"type","INVALID_REQUEST_METHOD");var ar=zr,Or=class me extends Error{constructor(t){let r=me.type;t&&(r+=": "+t),super(r),_(this,"type",me.type)}static asSimpleError(t){let r=me.type;return t&&(r+=": "+t),new Error(r)}static isSimpleErrorMessage(t){return t.startsWith(me.type)}static fromSimpleErrorMessage(t){return new me(t.slice(me.type.length+2))}};_(Or,"type","DRY_RUN_FAILED");var cr=Or,Br=class st extends Error{constructor(){super(st.type),_(this,"type",ht.type)}static asSimpleError(){return new Error(st.type)}static isSimpleErrorMessage(t){return t===st.type}};_(Br,"type","NON_ADMIN_ORIGIN");var ur=Br;function hi(e){return typeof e=="object"&&e!==null&&"message"in e}function Bt(e){return hi(e)?or.isSimpleErrorMessage(e.message)?or.fromSimpleErrorMessage(e.message):ht.isSimpleErrorMessage(e.message)?new ht:ar.isSimpleErrorMessage(e.message)?ar.fromSimpleErrorMessage(e.message):cr.isSimpleErrorMessage(e.message)?cr.fromSimpleErrorMessage(e.message):ur.isSimpleErrorMessage(e.message)?new ur:e:e}var qe="npm:@kunalabs-io/sui-metamask-snap",Ii="^1.0.0";function fi(){const e=br();for(const r of e.get())if(r.name===lr.NAME)return console.warn("SuiSnapWallet already registered"),r;const t=new lr;return e.register(t),t}async function yi(e){return(await e.request({method:"wallet_invokeSnap",params:{snapId:qe,request:{method:"getAccounts"}}})).map(r=>new Bn(ii(r)))}async function Pr(e,t){const r=si(t);try{return await e.request({method:"wallet_invokeSnap",params:{snapId:qe,request:{method:"signPersonalMessage",params:JSON.parse(JSON.stringify(r))}}})}catch(n){throw Bt(n)}}async function pi(e,t){const r=await Pr(e,t);return{messageBytes:r.bytes,signature:r.signature}}async function ji(e,t){const r=oi(t);try{return await e.request({method:"wallet_invokeSnap",params:{snapId:qe,request:{method:"signTransactionBlock",params:JSON.parse(JSON.stringify(r))}}})}catch(n){throw Bt(n)}}async function Ni(e,t){const r=ci(t);try{return await e.request({method:"wallet_invokeSnap",params:{snapId:qe,request:{method:"signAndExecuteTransactionBlock",params:JSON.parse(JSON.stringify(r))}}})}catch(n){throw Bt(n)}}async function Ti(){const e=window.ethereum;if(!e)return{available:!1,supportsSnaps:!1,suiSnapInstalled:!1};if(!e.isMetaMask)return{available:!1,suiSnapInstalled:!1,supportsSnaps:!1};try{const t=await e.request({method:"web3_clientVersion"}),r=await e.request({method:"wallet_getSnaps"}),n=!!r&&"npm:@kunalabs-io/sui-metamask-snap"in r;return{available:!0,version:t,supportsSnaps:!0,suiSnapInstalled:n}}catch(t){return console.warn(t),{available:!0,supportsSnaps:!1,suiSnapInstalled:!1}}}var ce,Ie,Oe,It,ft,yt,pt,jt,Nt,Rr=class Ur{constructor(){oe(this,ce,void 0),oe(this,Ie,void 0),oe(this,Oe,null),oe(this,It,async()=>{if(q(this,ce))throw new Error("Already connecting");F(this,ce,!0),F(this,Ie,!1);try{const t=window.ethereum;if(!(await Ti()).available)throw new Error("MetaMask not detected!");return await t.request({method:"wallet_requestSnaps",params:{[qe]:{version:Ii}}}),F(this,Oe,await yi(t)),F(this,ce,!1),F(this,Ie,!0),{accounts:this.accounts}}catch(t){throw F(this,ce,!1),F(this,Ie,!1),t}}),oe(this,ft,async()=>{F(this,ce,!1),F(this,Ie,!1),F(this,Oe,null)}),oe(this,yt,async t=>Pr(window.ethereum,t)),oe(this,pt,async t=>pi(window.ethereum,t)),oe(this,jt,async t=>ji(window.ethereum,t)),oe(this,Nt,async t=>Ni(window.ethereum,t)),F(this,ce,!1),F(this,Ie,!1)}get version(){return"1.0.0"}get name(){return Ur.NAME}get icon(){return Ai}get chains(){return Mi}get connecting(){return q(this,ce)}get accounts(){return q(this,Ie)&&q(this,Oe)?q(this,Oe):[]}get features(){return{"standard:connect":{version:"1.0.0",connect:q(this,It)},"standard:disconnect":{version:"1.0.0",disconnect:q(this,ft)},"sui:signPersonalMessage":{version:"1.0.0",signPersonalMessage:q(this,yt)},"sui:signMessage":{version:"1.0.0",signMessage:q(this,pt)},"sui:signTransactionBlock":{version:"1.0.0",signTransactionBlock:q(this,jt)},"sui:signAndExecuteTransactionBlock":{version:"1.0.0",signAndExecuteTransactionBlock:q(this,Nt)},"standard:events":{version:"1.0.0",on:()=>()=>{}}}}};ce=new WeakMap;Ie=new WeakMap;Oe=new WeakMap;It=new WeakMap;ft=new WeakMap;yt=new WeakMap;pt=new WeakMap;jt=new WeakMap;Nt=new WeakMap;_(Rr,"NAME","Sui MetaMask Snap");var lr=Rr;function mi(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var i=e.charAt(n),o=i.charCodeAt(0);if(t[o]!==255)throw new TypeError(i+" is ambiguous");t[o]=n}var a=e.length,l=e.charAt(0),c=Math.log(a)/Math.log(256),g=Math.log(256)/Math.log(a);function d(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var y=0,T=0,f=0,S=h.length;f!==S&&h[f]===0;)f++,y++;for(var C=(S-f)*g+1>>>0,w=new Uint8Array(C);f!==S;){for(var V=h[f],P=0,X=C-1;(V!==0||P<T)&&X!==-1;X--,P++)V+=256*w[X]>>>0,w[X]=V%a>>>0,V=V/a>>>0;if(V!==0)throw new Error("Non-zero carry");T=P,f++}for(var se=C-T;se!==C&&w[se]===0;)se++;for(var Ke=l.repeat(y);se<C;++se)Ke+=e.charAt(w[se]);return Ke}function A(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;for(var y=0,T=0,f=0;h[y]===l;)T++,y++;for(var S=(h.length-y)*c+1>>>0,C=new Uint8Array(S);h[y];){var w=t[h.charCodeAt(y)];if(w===255)return;for(var V=0,P=S-1;(w!==0||V<f)&&P!==-1;P--,V++)w+=a*C[P]>>>0,C[P]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");f=V,y++}for(var X=S-f;X!==S&&C[X]===0;)X++;for(var se=new Uint8Array(T+(S-X)),Ke=T;X!==S;)se[Ke++]=C[X++];return se}function j(h){var y=A(h);if(y)return y;throw new Error("Non-base"+a+" character")}return{encode:d,decodeUnsafe:A,decode:j}}var wi=mi;const Si=wi,Di="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var Ei=Si(Di);const Gr=Pn(Ei);function bi(e){return e>64&&e<91?e-65:e>96&&e<123?e-71:e>47&&e<58?e+4:e===43?62:e===47?63:0}function Le(e,t){for(var r=e.replace(/[^A-Za-z0-9+/]/g,""),n=r.length,i=n*3+1>>2,o=new Uint8Array(i),a,l,c=0,g=0,d=0;d<n;d++)if(l=d&3,c|=bi(r.charCodeAt(d))<<6*(3-l),l===3||n-d===1){for(a=0;a<3&&g<i;a++,g++)o[g]=c>>>(16>>>a&24)&255;c=0}return o}function et(e){return e<26?e+65:e<52?e+71:e<62?e-4:e===62?43:e===63?47:65}function De(e){for(var t=2,r="",n=e.length,i=0,o=0;o<n;o++)t=o%3,o>0&&o*4/3%76===0&&(r+=""),i|=e[o]<<(16>>>t&24),(t===2||e.length-o===1)&&(r+=String.fromCodePoint(et(i>>>18&63),et(i>>>12&63),et(i>>>6&63),et(i&63)),i=0);return r.slice(0,r.length-2+t)+(t===2?"":t===1?"=":"==")}function Pt(e){let t=e.replace("0x","").match(/.{1,2}/g).map(r=>parseInt(r,16));if(t===null)throw new Error(`Unable to parse HEX: ${e}`);return Uint8Array.from(t)}function Rt(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}var Li=32;function Mt(e,t){let r=new Uint8Array(t),n=0;for(;e>0;)r[n]=Number(e%BigInt(256)),e=e/BigInt(256),n+=1;return r}var Ut=e=>Gr.encode(e),Gt=e=>Gr.decode(e),Ci=class{constructor(e){this.bytePosition=0,this.dataView=new DataView(e.buffer)}shift(e){return this.bytePosition+=e,this}read8(){let e=this.dataView.getUint8(this.bytePosition);return this.shift(1),e}read16(){let e=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),e}read32(){let e=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),e}read64(){let e=this.read32(),r=this.read32().toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+r).toString(10)}read128(){let e=BigInt(this.read64()),r=BigInt(this.read64()).toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+r).toString(10)}read256(){let e=BigInt(this.read128()),r=BigInt(this.read128()).toString(16)+e.toString(16).padStart(16,"0");return BigInt("0x"+r).toString(10)}readBytes(e){let t=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,t,e);return this.shift(e),r}readULEB(){let e=this.bytePosition+this.dataView.byteOffset,t=new Uint8Array(this.dataView.buffer,e),{value:r,length:n}=ki(t);return this.shift(n),r}readVec(e){let t=this.readULEB(),r=[];for(let n=0;n<t;n++)r.push(e(this,n,t));return r}},vi=class{constructor({size:e=1024,maxSize:t,allocateSize:r=1024}={}){this.bytePosition=0,this.size=e,this.maxSize=t||e,this.allocateSize=r,this.dataView=new DataView(new ArrayBuffer(e))}ensureSizeOrGrow(e){const t=this.bytePosition+e;if(t>this.size){const r=Math.min(this.maxSize,this.size+this.allocateSize);if(t>r)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${t}`);this.size=r;const n=new ArrayBuffer(this.size);new Uint8Array(n).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(n)}}shift(e){return this.bytePosition+=e,this}write8(e){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(e)),this.shift(1)}write16(e){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(e),!0),this.shift(2)}write32(e){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(e),!0),this.shift(4)}write64(e){return Mt(BigInt(e),8).forEach(t=>this.write8(t)),this}write128(e){return Mt(BigInt(e),16).forEach(t=>this.write8(t)),this}write256(e){return Mt(BigInt(e),32).forEach(t=>this.write8(t)),this}writeULEB(e){return xi(e).forEach(t=>this.write8(t)),this}writeVec(e,t){return this.writeULEB(e.length),Array.from(e).forEach((r,n)=>t(this,r,n,e.length)),this}*[Symbol.iterator](){for(let e=0;e<this.bytePosition;e++)yield this.dataView.getUint8(e);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(e){return zi(this.toBytes(),e)}};function xi(e){let t=[],r=0;if(e===0)return[0];for(;e>0;)t[r]=e&127,(e>>=7)&&(t[r]|=128),r+=1;return t}function ki(e){let t=0,r=0,n=0;for(;;){let i=e[n];if(n+=1,t|=(i&127)<<r,!(i&128))break;r+=7}return{value:t,length:n}}var Ye=class{constructor(e){if(this.types=new Map,this.counter=0,e instanceof Ye){this.schema=e.schema,this.types=new Map(e.types);return}if(this.schema=e,this.registerAddressType(Ye.ADDRESS,e.addressLength,e.addressEncoding),this.registerVectorType(e.vectorType),e.types&&e.types.structs)for(let t of Object.keys(e.types.structs))this.registerStructType(t,e.types.structs[t]);if(e.types&&e.types.enums)for(let t of Object.keys(e.types.enums))this.registerEnumType(t,e.types.enums[t]);if(e.types&&e.types.aliases)for(let t of Object.keys(e.types.aliases))this.registerAlias(t,e.types.aliases[t]);e.withPrimitives!==!1&&Bi(this)}tempKey(){return`bcs-struct-${++this.counter}`}ser(e,t,r){if(typeof e=="string"||Array.isArray(e)){const{name:n,params:i}=this.parseTypeName(e);return this.getTypeInterface(n).encode(this,t,r,i)}if(typeof e=="object"){const n=this.tempKey();return new Ye(this).registerStructType(n,e).ser(n,t,r)}throw new Error(`Incorrect type passed into the '.ser()' function.
1
+ var zn=Object.defineProperty;var On=(e,t,r)=>t in e?zn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var k=(e,t,r)=>On(e,typeof t!="symbol"?t+"":t,r);import{g as br}from"./wallets-B2cUxj0w.js";import{R as Bn}from"./util-C_16CLeU.js";import{j as Pn,i as Rn,H as tr,R as Un,W as Gn,l as rr,I as nr,N as Qn,B as _e}from"../main.js";import{b as Yn}from"./blake2b-BwI-z5NJ.js";function Wn(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const dt=8192;function Lr(e){if(e.length<dt)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=dt){const n=e.slice(r,r+dt);t+=String.fromCharCode(...n)}return btoa(t)}const Zn=32;function Vn(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Zn*2,"0")}`}function Cr(e,t=!1){return Vn(e,t)}BigInt(1e9);Cr("0x6");Cr("0x5");let Fn=class extends TypeError{constructor(t,r){let n;const{message:i,explanation:o,...a}=t,{path:l}=t,c=l.length===0?i:`At path: ${l.join(".")} -- ${i}`;super(o??c),o!=null&&(this.cause=c),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}};function Jn(e){return Ee(e)&&typeof e[Symbol.iterator]=="function"}function Ee(e){return typeof e=="object"&&e!=null}function be(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function Hn(e){const{done:t,value:r}=e.next();return t?void 0:r}function Xn(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:o}=t,{type:a}=r,{refinement:l,message:c=`Expected a value of type \`${a}\`${l?` with refinement \`${l}\``:""}, but received: \`${be(n)}\``}=e;return{value:n,type:a,refinement:l,key:i[i.length-1],path:i,branch:o,...e,message:c}}function*ir(e,t,r,n){Jn(e)||(e=[e]);for(const i of e){const o=Xn(i,t,r,n);o&&(yield o)}}function*xt(e,t,r={}){const{path:n=[],branch:i=[e],coerce:o=!1,mask:a=!1}=r,l={path:n,branch:i};if(o&&(e=t.coercer(e,l),a&&t.type!=="type"&&Ee(t.schema)&&Ee(e)&&!Array.isArray(e)))for(const g in e)t.schema[g]===void 0&&delete e[g];let c="valid";for(const g of t.validator(e,l))g.explanation=r.message,c="not_valid",yield[g,void 0];for(let[g,d,A]of t.entries(e,l)){const j=xt(d,A,{path:g===void 0?n:[...n,g],branch:g===void 0?i:[...i,d],coerce:o,mask:a,message:r.message});for(const h of j)h[0]?(c=h[0].refinement!=null?"not_refined":"not_valid",yield[h[0],void 0]):o&&(d=h[1],g===void 0?e=d:e instanceof Map?e.set(g,d):e instanceof Set?e.add(d):Ee(e)&&(d!==void 0||g in e)&&(e[g]=d))}if(c!=="not_valid")for(const g of t.refiner(e,l))g.explanation=r.message,c="not_refined",yield[g,void 0];c==="valid"&&(yield[void 0,e])}let Re=class{constructor(t){const{type:r,schema:n,validator:i,refiner:o,coercer:a=c=>c,entries:l=function*(){}}=t;this.type=r,this.schema=n,this.entries=l,this.coercer=a,i?this.validator=(c,g)=>{const d=i(c,g);return ir(d,g,this,c)}:this.validator=()=>[],o?this.refiner=(c,g)=>{const d=o(c,g);return ir(d,g,this,c)}:this.refiner=()=>[]}assert(t,r){return qn(t,this,r)}create(t,r){return Kn(t,this,r)}is(t){return $n(t,this)}mask(t,r){return _n(t,this,r)}validate(t,r={}){return Xe(t,this,r)}};function qn(e,t,r){const n=Xe(e,t,{message:r});if(n[0])throw n[0]}function Kn(e,t,r){const n=Xe(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function _n(e,t,r){const n=Xe(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function $n(e,t){return!Xe(e,t)[0]}function Xe(e,t,r={}){const n=xt(e,t,r),i=Hn(n);return i[0]?[new Fn(i[0],function*(){for(const a of n)a[0]&&(yield a[0])}),void 0]:[void 0,i[1]]}function kt(e,t){return new Re({type:e,schema:null,validator:t})}function sr(e){return new Re({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${be(t)}`}})}function ke(){return kt("boolean",e=>typeof e=="boolean")}function $e(e){const t=be(e),r=typeof e;return new Re({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${be(n)}`}})}function ei(){return kt("never",()=>!1)}function Ue(e){const t=e?Object.keys(e):[],r=ei();return new Re({type:"object",schema:e||null,*entries(n){if(e&&Ee(n)){const i=new Set(Object.keys(n));for(const o of t)i.delete(o),yield[o,n[o],e[o]];for(const o of i)yield[o,n[o],r]}},validator(n){return Ee(n)||`Expected an object, but received: ${be(n)}`},coercer(n){return Ee(n)?{...n}:n}})}function re(e){return new Re({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function Y(){return kt("string",e=>typeof e=="string"||`Expected a string, but received: ${be(e)}`)}function ti(e){const t=e.map(r=>r.type).join(" | ");return new Re({type:"union",schema:null,coercer(r){for(const n of e){const[i,o]=n.validate(r,{coerce:!0});if(!i)return o}return r},validator(r,n){const i=[];for(const o of e){const[...a]=xt(r,o,n),[l]=a;if(l[0])for(const[c]of a)c&&i.push(c);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${be(r)}`,...i]}})}var ri=Object.defineProperty,ni=(e,t,r)=>t in e?ri(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_=(e,t,r)=>(ni(e,typeof t!="symbol"?t+"":t,r),r),vr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},q=(e,t,r)=>(vr(e,t,"read from private field"),r?r.call(e):t.get(e)),oe=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},F=(e,t,r,n)=>(vr(e,t,"write to private field"),t.set(e,r),r),zt=Ue({address:Y(),publicKey:Y(),chains:sr(Y()),features:sr(Y()),label:re(Y()),icon:re(Y())});function Ot(e){return{address:e.address,publicKey:Lr(e.publicKey),features:[...e.features],chains:[...e.chains],label:e.label,icon:e.icon}}function ii(e){return{address:e.address,publicKey:Wn(e.publicKey),chains:e.chains.map(t=>t),features:e.features.map(t=>t),label:e.label,icon:e.icon}}Ue({message:Y(),account:zt});function si(e){return{message:Lr(e.message),account:Ot(e.account)}}Ue({transactionBlock:Y(),account:zt,chain:Y()});function oi(e){return{transactionBlock:e.transactionBlock.serialize(),account:Ot(e.account),chain:e.chain}}var ai=Ue({showBalanceChanges:re(ke()),showEffects:re(ke()),showEvents:re(ke()),showInput:re(ke()),showObjectChanges:re(ke()),showRawInput:re(ke())});Ue({transactionBlock:Y(),account:zt,chain:Y(),requestType:re(Y()),options:re(ai)});function ci(e){return{transactionBlock:e.transactionBlock.serialize(),account:Ot(e.account),chain:e.chain,requestType:e.requestType,options:e.options}}Ue({network:ti([$e("mainnet"),$e("testnet"),$e("devnet"),$e("localnet")]),url:Y()});const ui="sui:devnet",li="sui:testnet",gi="sui:localnet",di="sui:mainnet",Mi=[ui,li,gi,di];var Ai="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIGlkPSJMYXllcl8xIiB4PSIwIiB5PSIwIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAzMTguNiAzMTguNiI+CiAgPHN0eWxlPgogICAgLnN0MSwuc3Q2e2ZpbGw6I2U0NzYxYjtzdHJva2U6I2U0NzYxYjtzdHJva2UtbGluZWNhcDpyb3VuZDtzdHJva2UtbGluZWpvaW46cm91bmR9LnN0NntmaWxsOiNmNjg1MWI7c3Ryb2tlOiNmNjg1MWJ9CiAgPC9zdHlsZT4KICA8cGF0aCBmaWxsPSIjZTI3NjFiIiBzdHJva2U9IiNlMjc2MWIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0ibTI3NC4xIDM1LjUtOTkuNSA3My45TDE5MyA2NS44eiIvPgogIDxwYXRoIGQ9Im00NC40IDM1LjUgOTguNyA3NC42LTE3LjUtNDQuM3ptMTkzLjkgMTcxLjMtMjYuNSA0MC42IDU2LjcgMTUuNiAxNi4zLTU1LjN6bS0yMDQuNC45TDUwLjEgMjYzbDU2LjctMTUuNi0yNi41LTQwLjZ6IiBjbGFzcz0ic3QxIi8+CiAgPHBhdGggZD0ibTEwMy42IDEzOC4yLTE1LjggMjMuOSA1Ni4zIDIuNS0yLTYwLjV6bTExMS4zIDAtMzktMzQuOC0xLjMgNjEuMiA1Ni4yLTIuNXpNMTA2LjggMjQ3LjRsMzMuOC0xNi41LTI5LjItMjIuOHptNzEuMS0xNi41IDMzLjkgMTYuNS00LjctMzkuM3oiIGNsYXNzPSJzdDEiLz4KICA8cGF0aCBmaWxsPSIjZDdjMWIzIiBzdHJva2U9IiNkN2MxYjMiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0ibTIxMS44IDI0Ny40LTMzLjktMTYuNSAyLjcgMjIuMS0uMyA5LjN6bS0xMDUgMCAzMS41IDE0LjktLjItOS4zIDIuNS0yMi4xeiIvPgogIDxwYXRoIGZpbGw9IiMyMzM0NDciIHN0cm9rZT0iIzIzMzQ0NyIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBkPSJtMTM4LjggMTkzLjUtMjguMi04LjMgMTkuOS05LjF6bTQwLjkgMCA4LjMtMTcuNCAyMCA5LjF6Ii8+CiAgPHBhdGggZmlsbD0iI2NkNjExNiIgc3Ryb2tlPSIjY2Q2MTE2IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGQ9Im0xMDYuOCAyNDcuNCA0LjgtNDAuNi0zMS4zLjl6TTIwNyAyMDYuOGw0LjggNDAuNiAyNi41LTM5Ljd6bTIzLjgtNDQuNy01Ni4yIDIuNSA1LjIgMjguOSA4LjMtMTcuNCAyMCA5LjF6bS0xMjAuMiAyMy4xIDIwLTkuMSA4LjIgMTcuNCA1LjMtMjguOS01Ni4zLTIuNXoiLz4KICA8cGF0aCBmaWxsPSIjZTQ3NTFmIiBzdHJva2U9IiNlNDc1MWYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0ibTg3LjggMTYyLjEgMjMuNiA0Ni0uOC0yMi45em0xMjAuMyAyMy4xLTEgMjIuOSAyMy43LTQ2em0tNjQtMjAuNi01LjMgMjguOSA2LjYgMzQuMSAxLjUtNDQuOXptMzAuNSAwLTIuNyAxOCAxLjIgNDUgNi43LTM0LjF6Ii8+CiAgPHBhdGggZD0ibTE3OS44IDE5My41LTYuNyAzNC4xIDQuOCAzLjMgMjkuMi0yMi44IDEtMjIuOXptLTY5LjItOC4zLjggMjIuOSAyOS4yIDIyLjggNC44LTMuMy02LjYtMzQuMXoiIGNsYXNzPSJzdDYiLz4KICA8cGF0aCBmaWxsPSIjYzBhZDllIiBzdHJva2U9IiNjMGFkOWUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0ibTE4MC4zIDI2Mi4zLjMtOS4zLTIuNS0yLjJoLTM3LjdsLTIuMyAyLjIuMiA5LjMtMzEuNS0xNC45IDExIDkgMjIuMyAxNS41aDM4LjNsMjIuNC0xNS41IDExLTl6Ii8+CiAgPHBhdGggZmlsbD0iIzE2MTYxNiIgc3Ryb2tlPSIjMTYxNjE2IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGQ9Im0xNzcuOSAyMzAuOS00LjgtMy4zaC0yNy43bC00LjggMy4zLTIuNSAyMi4xIDIuMy0yLjJoMzcuN2wyLjUgMi4yeiIvPgogIDxwYXRoIGZpbGw9IiM3NjNkMTYiIHN0cm9rZT0iIzc2M2QxNiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBkPSJtMjc4LjMgMTE0LjIgOC41LTQwLjgtMTIuNy0zNy45LTk2LjIgNzEuNCAzNyAzMS4zIDUyLjMgMTUuMyAxMS42LTEzLjUtNS0zLjYgOC03LjMtNi4yLTQuOCA4LTYuMXpNMzEuOCA3My40bDguNSA0MC44LTUuNCA0IDggNi4xLTYuMSA0LjggOCA3LjMtNSAzLjYgMTEuNSAxMy41IDUyLjMtMTUuMyAzNy0zMS4zLTk2LjItNzEuNHoiLz4KICA8cGF0aCBkPSJtMjY3LjIgMTUzLjUtNTIuMy0xNS4zIDE1LjkgMjMuOS0yMy43IDQ2IDMxLjItLjRoNDYuNXptLTE2My42LTE1LjMtNTIuMyAxNS4zLTE3LjQgNTQuMmg0Ni40bDMxLjEuNC0yMy42LTQ2em03MSAyNi40IDMuMy01Ny43IDE1LjItNDEuMWgtNjcuNWwxNSA0MS4xIDMuNSA1Ny43IDEuMiAxOC4yLjEgNDQuOGgyNy43bC4yLTQ0Ljh6IiBjbGFzcz0ic3Q2Ii8+Cjwvc3ZnPg==",xr=class Ne extends Error{constructor(t){super(`${Ne.type}: ${t}}`),_(this,"type",Ne.type)}static asSimpleError(t){return new Error(`${Ne.type}: ${t}`)}static isSimpleErrorMessage(t){return t.startsWith(Ne.type+": ")}static fromSimpleErrorMessage(t){return new Ne(t.slice(Ne.type.length+2))}};_(xr,"type","INVALID_REQUEST_PARAMS");var or=xr,kr=class Qe extends Error{constructor(){super(Qe.type),_(this,"type",Qe.type)}static asSimpleError(){return new Error(Qe.type)}static isSimpleErrorMessage(t){return t===Qe.type}};_(kr,"type","USER_REJECTION");var ht=kr,zr=class Te extends Error{constructor(t){super(`${Te.type}: ${t}`),_(this,"type",Te.type)}static asSimpleError(t){return new Error(`${Te.type}: ${t}`)}static isSimpleErrorMessage(t){return t.startsWith(Te.type+": ")}static fromSimpleErrorMessage(t){return new Te(t.slice(Te.type.length+2))}};_(zr,"type","INVALID_REQUEST_METHOD");var ar=zr,Or=class me extends Error{constructor(t){let r=me.type;t&&(r+=": "+t),super(r),_(this,"type",me.type)}static asSimpleError(t){let r=me.type;return t&&(r+=": "+t),new Error(r)}static isSimpleErrorMessage(t){return t.startsWith(me.type)}static fromSimpleErrorMessage(t){return new me(t.slice(me.type.length+2))}};_(Or,"type","DRY_RUN_FAILED");var cr=Or,Br=class st extends Error{constructor(){super(st.type),_(this,"type",ht.type)}static asSimpleError(){return new Error(st.type)}static isSimpleErrorMessage(t){return t===st.type}};_(Br,"type","NON_ADMIN_ORIGIN");var ur=Br;function hi(e){return typeof e=="object"&&e!==null&&"message"in e}function Bt(e){return hi(e)?or.isSimpleErrorMessage(e.message)?or.fromSimpleErrorMessage(e.message):ht.isSimpleErrorMessage(e.message)?new ht:ar.isSimpleErrorMessage(e.message)?ar.fromSimpleErrorMessage(e.message):cr.isSimpleErrorMessage(e.message)?cr.fromSimpleErrorMessage(e.message):ur.isSimpleErrorMessage(e.message)?new ur:e:e}var qe="npm:@kunalabs-io/sui-metamask-snap",Ii="^1.0.0";function fi(){const e=br();for(const r of e.get())if(r.name===lr.NAME)return console.warn("SuiSnapWallet already registered"),r;const t=new lr;return e.register(t),t}async function yi(e){return(await e.request({method:"wallet_invokeSnap",params:{snapId:qe,request:{method:"getAccounts"}}})).map(r=>new Bn(ii(r)))}async function Pr(e,t){const r=si(t);try{return await e.request({method:"wallet_invokeSnap",params:{snapId:qe,request:{method:"signPersonalMessage",params:JSON.parse(JSON.stringify(r))}}})}catch(n){throw Bt(n)}}async function pi(e,t){const r=await Pr(e,t);return{messageBytes:r.bytes,signature:r.signature}}async function ji(e,t){const r=oi(t);try{return await e.request({method:"wallet_invokeSnap",params:{snapId:qe,request:{method:"signTransactionBlock",params:JSON.parse(JSON.stringify(r))}}})}catch(n){throw Bt(n)}}async function Ni(e,t){const r=ci(t);try{return await e.request({method:"wallet_invokeSnap",params:{snapId:qe,request:{method:"signAndExecuteTransactionBlock",params:JSON.parse(JSON.stringify(r))}}})}catch(n){throw Bt(n)}}async function Ti(){const e=window.ethereum;if(!e)return{available:!1,supportsSnaps:!1,suiSnapInstalled:!1};if(!e.isMetaMask)return{available:!1,suiSnapInstalled:!1,supportsSnaps:!1};try{const t=await e.request({method:"web3_clientVersion"}),r=await e.request({method:"wallet_getSnaps"}),n=!!r&&"npm:@kunalabs-io/sui-metamask-snap"in r;return{available:!0,version:t,supportsSnaps:!0,suiSnapInstalled:n}}catch(t){return console.warn(t),{available:!0,supportsSnaps:!1,suiSnapInstalled:!1}}}var ce,Ie,Oe,It,ft,yt,pt,jt,Nt,Rr=class Ur{constructor(){oe(this,ce,void 0),oe(this,Ie,void 0),oe(this,Oe,null),oe(this,It,async()=>{if(q(this,ce))throw new Error("Already connecting");F(this,ce,!0),F(this,Ie,!1);try{const t=window.ethereum;if(!(await Ti()).available)throw new Error("MetaMask not detected!");return await t.request({method:"wallet_requestSnaps",params:{[qe]:{version:Ii}}}),F(this,Oe,await yi(t)),F(this,ce,!1),F(this,Ie,!0),{accounts:this.accounts}}catch(t){throw F(this,ce,!1),F(this,Ie,!1),t}}),oe(this,ft,async()=>{F(this,ce,!1),F(this,Ie,!1),F(this,Oe,null)}),oe(this,yt,async t=>Pr(window.ethereum,t)),oe(this,pt,async t=>pi(window.ethereum,t)),oe(this,jt,async t=>ji(window.ethereum,t)),oe(this,Nt,async t=>Ni(window.ethereum,t)),F(this,ce,!1),F(this,Ie,!1)}get version(){return"1.0.0"}get name(){return Ur.NAME}get icon(){return Ai}get chains(){return Mi}get connecting(){return q(this,ce)}get accounts(){return q(this,Ie)&&q(this,Oe)?q(this,Oe):[]}get features(){return{"standard:connect":{version:"1.0.0",connect:q(this,It)},"standard:disconnect":{version:"1.0.0",disconnect:q(this,ft)},"sui:signPersonalMessage":{version:"1.0.0",signPersonalMessage:q(this,yt)},"sui:signMessage":{version:"1.0.0",signMessage:q(this,pt)},"sui:signTransactionBlock":{version:"1.0.0",signTransactionBlock:q(this,jt)},"sui:signAndExecuteTransactionBlock":{version:"1.0.0",signAndExecuteTransactionBlock:q(this,Nt)},"standard:events":{version:"1.0.0",on:()=>()=>{}}}}};ce=new WeakMap;Ie=new WeakMap;Oe=new WeakMap;It=new WeakMap;ft=new WeakMap;yt=new WeakMap;pt=new WeakMap;jt=new WeakMap;Nt=new WeakMap;_(Rr,"NAME","Sui MetaMask Snap");var lr=Rr;function mi(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var i=e.charAt(n),o=i.charCodeAt(0);if(t[o]!==255)throw new TypeError(i+" is ambiguous");t[o]=n}var a=e.length,l=e.charAt(0),c=Math.log(a)/Math.log(256),g=Math.log(256)/Math.log(a);function d(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var y=0,T=0,f=0,S=h.length;f!==S&&h[f]===0;)f++,y++;for(var C=(S-f)*g+1>>>0,w=new Uint8Array(C);f!==S;){for(var V=h[f],P=0,X=C-1;(V!==0||P<T)&&X!==-1;X--,P++)V+=256*w[X]>>>0,w[X]=V%a>>>0,V=V/a>>>0;if(V!==0)throw new Error("Non-zero carry");T=P,f++}for(var se=C-T;se!==C&&w[se]===0;)se++;for(var Ke=l.repeat(y);se<C;++se)Ke+=e.charAt(w[se]);return Ke}function A(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;for(var y=0,T=0,f=0;h[y]===l;)T++,y++;for(var S=(h.length-y)*c+1>>>0,C=new Uint8Array(S);h[y];){var w=t[h.charCodeAt(y)];if(w===255)return;for(var V=0,P=S-1;(w!==0||V<f)&&P!==-1;P--,V++)w+=a*C[P]>>>0,C[P]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");f=V,y++}for(var X=S-f;X!==S&&C[X]===0;)X++;for(var se=new Uint8Array(T+(S-X)),Ke=T;X!==S;)se[Ke++]=C[X++];return se}function j(h){var y=A(h);if(y)return y;throw new Error("Non-base"+a+" character")}return{encode:d,decodeUnsafe:A,decode:j}}var wi=mi;const Si=wi,Di="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var Ei=Si(Di);const Gr=Pn(Ei);function bi(e){return e>64&&e<91?e-65:e>96&&e<123?e-71:e>47&&e<58?e+4:e===43?62:e===47?63:0}function Le(e,t){for(var r=e.replace(/[^A-Za-z0-9+/]/g,""),n=r.length,i=n*3+1>>2,o=new Uint8Array(i),a,l,c=0,g=0,d=0;d<n;d++)if(l=d&3,c|=bi(r.charCodeAt(d))<<6*(3-l),l===3||n-d===1){for(a=0;a<3&&g<i;a++,g++)o[g]=c>>>(16>>>a&24)&255;c=0}return o}function et(e){return e<26?e+65:e<52?e+71:e<62?e-4:e===62?43:e===63?47:65}function De(e){for(var t=2,r="",n=e.length,i=0,o=0;o<n;o++)t=o%3,o>0&&o*4/3%76===0&&(r+=""),i|=e[o]<<(16>>>t&24),(t===2||e.length-o===1)&&(r+=String.fromCodePoint(et(i>>>18&63),et(i>>>12&63),et(i>>>6&63),et(i&63)),i=0);return r.slice(0,r.length-2+t)+(t===2?"":t===1?"=":"==")}function Pt(e){let t=e.replace("0x","").match(/.{1,2}/g).map(r=>parseInt(r,16));if(t===null)throw new Error(`Unable to parse HEX: ${e}`);return Uint8Array.from(t)}function Rt(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}var Li=32;function Mt(e,t){let r=new Uint8Array(t),n=0;for(;e>0;)r[n]=Number(e%BigInt(256)),e=e/BigInt(256),n+=1;return r}var Ut=e=>Gr.encode(e),Gt=e=>Gr.decode(e),Ci=class{constructor(e){this.bytePosition=0,this.dataView=new DataView(e.buffer)}shift(e){return this.bytePosition+=e,this}read8(){let e=this.dataView.getUint8(this.bytePosition);return this.shift(1),e}read16(){let e=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),e}read32(){let e=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),e}read64(){let e=this.read32(),r=this.read32().toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+r).toString(10)}read128(){let e=BigInt(this.read64()),r=BigInt(this.read64()).toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+r).toString(10)}read256(){let e=BigInt(this.read128()),r=BigInt(this.read128()).toString(16)+e.toString(16).padStart(16,"0");return BigInt("0x"+r).toString(10)}readBytes(e){let t=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,t,e);return this.shift(e),r}readULEB(){let e=this.bytePosition+this.dataView.byteOffset,t=new Uint8Array(this.dataView.buffer,e),{value:r,length:n}=ki(t);return this.shift(n),r}readVec(e){let t=this.readULEB(),r=[];for(let n=0;n<t;n++)r.push(e(this,n,t));return r}},vi=class{constructor({size:e=1024,maxSize:t,allocateSize:r=1024}={}){this.bytePosition=0,this.size=e,this.maxSize=t||e,this.allocateSize=r,this.dataView=new DataView(new ArrayBuffer(e))}ensureSizeOrGrow(e){const t=this.bytePosition+e;if(t>this.size){const r=Math.min(this.maxSize,this.size+this.allocateSize);if(t>r)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${t}`);this.size=r;const n=new ArrayBuffer(this.size);new Uint8Array(n).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(n)}}shift(e){return this.bytePosition+=e,this}write8(e){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(e)),this.shift(1)}write16(e){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(e),!0),this.shift(2)}write32(e){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(e),!0),this.shift(4)}write64(e){return Mt(BigInt(e),8).forEach(t=>this.write8(t)),this}write128(e){return Mt(BigInt(e),16).forEach(t=>this.write8(t)),this}write256(e){return Mt(BigInt(e),32).forEach(t=>this.write8(t)),this}writeULEB(e){return xi(e).forEach(t=>this.write8(t)),this}writeVec(e,t){return this.writeULEB(e.length),Array.from(e).forEach((r,n)=>t(this,r,n,e.length)),this}*[Symbol.iterator](){for(let e=0;e<this.bytePosition;e++)yield this.dataView.getUint8(e);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(e){return zi(this.toBytes(),e)}};function xi(e){let t=[],r=0;if(e===0)return[0];for(;e>0;)t[r]=e&127,(e>>=7)&&(t[r]|=128),r+=1;return t}function ki(e){let t=0,r=0,n=0;for(;;){let i=e[n];if(n+=1,t|=(i&127)<<r,!(i&128))break;r+=7}return{value:t,length:n}}var Ye=class{constructor(e){if(this.types=new Map,this.counter=0,e instanceof Ye){this.schema=e.schema,this.types=new Map(e.types);return}if(this.schema=e,this.registerAddressType(Ye.ADDRESS,e.addressLength,e.addressEncoding),this.registerVectorType(e.vectorType),e.types&&e.types.structs)for(let t of Object.keys(e.types.structs))this.registerStructType(t,e.types.structs[t]);if(e.types&&e.types.enums)for(let t of Object.keys(e.types.enums))this.registerEnumType(t,e.types.enums[t]);if(e.types&&e.types.aliases)for(let t of Object.keys(e.types.aliases))this.registerAlias(t,e.types.aliases[t]);e.withPrimitives!==!1&&Bi(this)}tempKey(){return`bcs-struct-${++this.counter}`}ser(e,t,r){if(typeof e=="string"||Array.isArray(e)){const{name:n,params:i}=this.parseTypeName(e);return this.getTypeInterface(n).encode(this,t,r,i)}if(typeof e=="object"){const n=this.tempKey();return new Ye(this).registerStructType(n,e).ser(n,t,r)}throw new Error(`Incorrect type passed into the '.ser()' function.
2
2
  ${JSON.stringify(e)}`)}de(e,t,r){if(typeof t=="string")if(r)t=Oi(t,r);else throw new Error("To pass a string to `bcs.de`, specify encoding");if(typeof e=="string"||Array.isArray(e)){const{name:n,params:i}=this.parseTypeName(e);return this.getTypeInterface(n).decode(this,t,i)}if(typeof e=="object"){const n=new Ye(this),i=this.tempKey();return n.registerStructType(i,e).de(i,t,r)}throw new Error(`Incorrect type passed into the '.de()' function.
3
3
  ${JSON.stringify(e)}`)}hasType(e){return this.types.has(e)}registerAlias(e,t){return this.types.set(e,t),this}registerType(e,t,r,n=()=>!0){const{name:i,params:o}=this.parseTypeName(e);return this.types.set(i,{encode(a,l,c,g){const d=o.reduce((A,j,h)=>Object.assign(A,{[j]:g[h]}),{});return this._encodeRaw.call(a,new vi(c),l,g,d)},decode(a,l,c){const g=o.reduce((d,A,j)=>Object.assign(d,{[A]:c[j]}),{});return this._decodeRaw.call(a,new Ci(l),c,g)},_encodeRaw(a,l,c,g){if(n(l))return t.call(this,a,l,c,g);throw new Error(`Validation failed for type ${i}, data: ${l}`)},_decodeRaw(a,l,c){return r.call(this,a,l,c)}}),this}registerAddressType(e,t,r="hex"){switch(r){case"base64":return this.registerType(e,function(i,o){return Le(o).reduce((a,l)=>a.write8(l),i)},function(i){return De(i.readBytes(t))});case"hex":return this.registerType(e,function(i,o){return Pt(o).reduce((a,l)=>a.write8(l),i)},function(i){return Rt(i.readBytes(t))});default:throw new Error("Unsupported encoding! Use either hex or base64")}}registerVectorType(e){let{name:t,params:r}=this.parseTypeName(e);if(r.length>1)throw new Error("Vector can have only one type parameter; got "+t);return this.registerType(e,function(i,o,a,l){return i.writeVec(o,(c,g)=>{let d=a[0];if(!d)throw new Error(`Incorrect number of type parameters passed a to vector '${e}'`);let{name:A,params:j}=this.parseTypeName(d);if(this.hasType(A))return this.getTypeInterface(A)._encodeRaw.call(this,c,g,j,l);if(!(A in l))throw new Error(`Unable to find a matching type definition for ${A} in vector; make sure you passed a generic`);let{name:h,params:y}=this.parseTypeName(l[A]);return this.getTypeInterface(h)._encodeRaw.call(this,c,g,y,l)})},function(i,o,a){return i.readVec(l=>{let c=o[0];if(!c)throw new Error(`Incorrect number of type parameters passed to a vector '${e}'`);let{name:g,params:d}=this.parseTypeName(c);if(this.hasType(g))return this.getTypeInterface(g)._decodeRaw.call(this,l,d,a);if(!(g in a))throw new Error(`Unable to find a matching type definition for ${g} in vector; make sure you passed a generic`);let{name:A,params:j}=this.parseTypeName(a[g]);this.getTypeInterface(A)._decodeRaw.call(this,l,j,a)})})}registerStructType(e,t){for(let a in t){let l=this.tempKey(),c=t[a];!Array.isArray(c)&&typeof c!="string"&&(t[a]=l,this.registerStructType(l,c))}let r=Object.freeze(t),n=Object.keys(r),{name:i,params:o}=this.parseTypeName(e);return this.registerType(e,function(l,c,g,d){if(!c||c.constructor!==Object)throw new Error(`Expected ${i} to be an Object, got: ${c}`);if(g.length!==o.length)throw new Error(`Incorrect number of generic parameters passed; expected: ${o.length}, got: ${g.length}`);for(let A of n){if(!(A in c))throw new Error(`Struct ${i} requires field ${A}:${r[A]}`);const{name:j,params:h}=this.parseTypeName(r[A]);if(!o.includes(j))this.getTypeInterface(j)._encodeRaw.call(this,l,c[A],h,d);else{const y=o.indexOf(j);let{name:T,params:f}=this.parseTypeName(g[y]);if(this.hasType(T)){this.getTypeInterface(T)._encodeRaw.call(this,l,c[A],f,d);continue}if(!(T in d))throw new Error(`Unable to find a matching type definition for ${T} in ${i}; make sure you passed a generic`);let{name:S,params:C}=this.parseTypeName(d[T]);this.getTypeInterface(S)._encodeRaw.call(this,l,c[A],C,d)}}return l},function(l,c,g){if(c.length!==o.length)throw new Error(`Incorrect number of generic parameters passed; expected: ${o.length}, got: ${c.length}`);let d={};for(let A of n){const{name:j,params:h}=this.parseTypeName(r[A]);if(!o.includes(j))d[A]=this.getTypeInterface(j)._decodeRaw.call(this,l,h,g);else{const y=o.indexOf(j);let{name:T,params:f}=this.parseTypeName(c[y]);if(this.hasType(T)){d[A]=this.getTypeInterface(T)._decodeRaw.call(this,l,f,g);continue}if(!(T in g))throw new Error(`Unable to find a matching type definition for ${T} in ${i}; make sure you passed a generic`);let{name:S,params:C}=this.parseTypeName(g[T]);d[A]=this.getTypeInterface(S)._decodeRaw.call(this,l,C,g)}}return d})}registerEnumType(e,t){for(let a in t){let l=this.tempKey(),c=t[a];c!==null&&!Array.isArray(c)&&typeof c!="string"&&(t[a]=l,this.registerStructType(l,c))}let r=Object.freeze(t),n=Object.keys(r),{name:i,params:o}=this.parseTypeName(e);return this.registerType(e,function(l,c,g,d){if(!c)throw new Error(`Unable to write enum "${i}", missing data.
4
4
  Received: "${c}"`);if(typeof c!="object")throw new Error(`Incorrect data passed into enum "${i}", expected object with properties: "${n.join(" | ")}".
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var l=(a,i,t)=>i in a?c(a,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[i]=t;var s=(a,i,t)=>l(a,typeof i!="symbol"?i+"":i,t);class h{constructor(i,t,n,r,e=!1){s(this,"transaction");s(this,"network");s(this,"chain");s(this,"description");s(this,"parallelizable");this.transaction=i,this.network=t,this.chain=n,this.description=r,this.parallelizable=e}}export{h as S};