@wormhole-foundation/wormhole-connect 0.3.12 → 0.3.13-beta.0-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 (111) hide show
  1. package/dist/assets/{ccip-CocV8yB9.js → ccip-OOFnKthE.js} +1 -1
  2. package/dist/assets/{evm-BCHTSsxK.js → evm-DItqF4y9.js} +4 -4
  3. package/dist/assets/{index-MLWSqkmC.js → index-DPMNShK9.js} +1 -1
  4. package/dist/assets/index-DhiBnkGj.js +2 -0
  5. package/dist/assets/{index.es-BiixD3RO.js → index.es-C_PUYdAu.js} +2 -2
  6. package/dist/main.js +4 -4
  7. package/dist/src/routes/ntt/chains/evm/nttManager.d.ts.map +1 -1
  8. package/dist/src/routes/ntt/chains/evm/wormholeTransceiver.d.ts.map +1 -1
  9. package/dist/src/routes/ntt/chains/solana/nttManager.d.ts.map +1 -1
  10. package/dist/src/routes/ntt/utils.d.ts +1 -0
  11. package/dist/src/routes/ntt/utils.d.ts.map +1 -1
  12. package/lib/{algorand-DsP9aKWl.mjs → algorand-Bg8JSyZc.mjs} +4 -4
  13. package/lib/{algorand-eXccnrCU.js → algorand-Bl2bjZ-6.js} +1 -1
  14. package/lib/{aptos-Bv3nDvax.mjs → aptos-C7Wu-1h4.mjs} +1 -1
  15. package/lib/{aptos-D8gbIchx.mjs → aptos-CMMGNgpi.mjs} +4 -4
  16. package/lib/{aptos-B2OLLOlg.js → aptos-CR2gkPFr.js} +1 -1
  17. package/lib/{aptos-3CZnOOfq.js → aptos-DJ84G9fi.js} +2 -2
  18. package/lib/{browser-Bn1qwjLm.js → browser-CkDunXxD.js} +1 -1
  19. package/lib/{browser-DlWxOLZX.mjs → browser-ZXnp4FKs.mjs} +2 -2
  20. package/lib/{ccip-CsyJv9a0.js → ccip-D-Pj74dK.js} +1 -1
  21. package/lib/{ccip-BZfUB9j4.mjs → ccip-DhCmkuPu.mjs} +1 -1
  22. package/lib/{chain-D5AOvPgB.js → chain-Bwy1h3yo.js} +1 -1
  23. package/lib/{chain-DKCnEQGr.mjs → chain-CVIItqOT.mjs} +1 -1
  24. package/lib/cosmos-6GOVGAZN.js +37 -0
  25. package/lib/{cosmos-DdMsP3Xb.mjs → cosmos-CmK1H6Y0.mjs} +6 -6
  26. package/lib/{cosmwasm-A-iur38A.js → cosmwasm-Con1USCX.js} +2 -2
  27. package/lib/{cosmwasm-CVl5FMK8.mjs → cosmwasm-MvfQhXNe.mjs} +6 -6
  28. package/lib/{create-C6FJqFGQ.mjs → create-BRdq6ZSm.mjs} +1 -1
  29. package/lib/{create-qTTAZEuM.js → create-CDRecM8t.js} +1 -1
  30. package/lib/{ens-validation.es6-DBtwapbx.js → ens-validation.es6-CPiX5dlm.js} +1 -1
  31. package/lib/{ens-validation.es6-Dzjz9A6H.mjs → ens-validation.es6-DApujkCb.mjs} +2 -2
  32. package/lib/{evm-DxS0QRu-.js → evm-BJ032m_M.js} +4 -4
  33. package/lib/{evm-La94iYcP.js → evm-Cc4KRKsc.js} +2 -2
  34. package/lib/{evm-ElW4TkgJ.mjs → evm-DS32wBN9.mjs} +6 -6
  35. package/lib/{evm--Jtx_TN_.mjs → evm-UD1FtfQa.mjs} +6 -6
  36. package/lib/{index-CzjS5BYI.mjs → index-1n9fqp9v.mjs} +72 -72
  37. package/lib/{index-CKwKd-BZ.mjs → index-7j3-yEnt.mjs} +1 -1
  38. package/lib/{index-ZwcNorsB.mjs → index-B-YY9GIv.mjs} +4 -4
  39. package/lib/{index-r3h1vFDJ.mjs → index-B24bqgIz.mjs} +4 -4
  40. package/lib/{index-DHti1Srl.mjs → index-BBqQFfdG.mjs} +6 -6
  41. package/lib/{index-e2BD9BAO.mjs → index-BCBG0qdU.mjs} +2 -2
  42. package/lib/{index-BJEw3qiN.mjs → index-BFG5RlAl.mjs} +5 -5
  43. package/lib/{index-hVAqPrRu.js → index-BFGs_cKt.js} +1 -1
  44. package/lib/{index-C3AalOOt.mjs → index-BJQon5qX.mjs} +4 -4
  45. package/lib/{index-CVW9fQKj.js → index-BuDqNPcO.js} +1 -1
  46. package/lib/{index-oXVQ9hP6.mjs → index-BwIRT-Wk.mjs} +4 -4
  47. package/lib/{index-BE635aC1.mjs → index-C8A6Lqgw.mjs} +3 -3
  48. package/lib/{index-D19hYI6q.mjs → index-CHQq3YQO.mjs} +2 -2
  49. package/lib/{index-D3AQ56s9.js → index-CJmh4QE2.js} +1 -1
  50. package/lib/{index-B8QmOEmB.mjs → index-COFhlc-l.mjs} +4 -4
  51. package/lib/{index-CnAVH7Pn.js → index-COvdHjEw.js} +1 -1
  52. package/lib/{index-DWNKf9h9.js → index-CQ1ulNVi.js} +1 -1
  53. package/lib/{index-BxnXFplu.js → index-CRYmVHnM.js} +1 -1
  54. package/lib/{index-CeFWxpd6.mjs → index-CqaNSRi8.mjs} +113 -109
  55. package/lib/{index-CabopkLM.mjs → index-CvqS6-7r.mjs} +2 -2
  56. package/lib/{index-BmWel1uO.js → index-CyiGY2nE.js} +1 -1
  57. package/lib/{index-9QuWXS0d.mjs → index-D1b3883O.mjs} +4 -4
  58. package/lib/{index-B-8eKuYx.mjs → index-D2sZc5xv.mjs} +3 -3
  59. package/lib/{index-6JK2KXZR.js → index-D4DDOeoI.js} +1 -1
  60. package/lib/{index-CcF8vTrz.js → index-D70PNWdi.js} +1 -1
  61. package/lib/{index-Cc1icmQX.mjs → index-DHJyF-pO.mjs} +5 -5
  62. package/lib/{index-DcMMztM9.js → index-DL8RgEWe.js} +1 -1
  63. package/lib/{index-Cy_JDgLX.mjs → index-DPR5REBL.mjs} +3 -3
  64. package/lib/index-DRq96-rz.js +1 -0
  65. package/lib/{index-B5UrJ3R0.js → index-DTS_3d8l.js} +1 -1
  66. package/lib/{index-C46QJUdT.mjs → index-DXyqUYq2.mjs} +4 -4
  67. package/lib/{index-BSZNhSAi.mjs → index-DZyYJrWL.mjs} +4 -4
  68. package/lib/{index-teJM2gf9.js → index-Di3sMEo7.js} +1 -1
  69. package/lib/{index-ScjSw6c9.js → index-DjCQ8uLP.js} +1 -1
  70. package/lib/index-DqQ___9y.js +3 -0
  71. package/lib/{index-Co6BPUyW.mjs → index-DtwoCm8e.mjs} +4 -4
  72. package/lib/{index-D8oMnzkE.js → index-IqeoAbGU.js} +1 -1
  73. package/lib/{index-BpeQ2zfk.mjs → index-Yv4XR6FC.mjs} +5 -5
  74. package/lib/{index-BzrMFsLZ.js → index-Z109VDLJ.js} +8 -8
  75. package/lib/{index-DV4C_0AO.js → index-eqTjyg7U.js} +1 -1
  76. package/lib/{index-3bbveAQd.js → index-hl4dntDw.js} +1 -1
  77. package/lib/{index-C5_IW6ZB.js → index-j4_UFrLd.js} +1 -1
  78. package/lib/{index-2luUak7r.js → index-lbAFXIJn.js} +1 -1
  79. package/lib/{index-CQ4sYLNm.js → index-mWfCnAaQ.js} +1 -1
  80. package/lib/{index-Bpk79NsA.js → index-mYo3ol_k.js} +1 -1
  81. package/lib/{index-G-UVRs5W.mjs → index-uGiYgmNv.mjs} +4 -4
  82. package/lib/{index.es-B_Sm9RUu.mjs → index.es-BjHm3oKE.mjs} +4 -4
  83. package/lib/{index.es-DoyD4mm0.js → index.es-CAK--miD.js} +2 -2
  84. package/lib/index.js +1 -1
  85. package/lib/index.mjs +1 -1
  86. package/lib/{libsodium-wrappers-tOa7WewD.mjs → libsodium-wrappers-BeOpJRQU.mjs} +1 -1
  87. package/lib/{libsodium-wrappers-DUeLf4UF.js → libsodium-wrappers-kbvVfw30.js} +1 -1
  88. package/lib/{sei-Dsh35qJH.js → sei-BW-0gNsO.js} +1 -1
  89. package/lib/{sei-B6kA_xto.mjs → sei-CAQxpS0Z.mjs} +2 -2
  90. package/lib/{solana-B0T5-GTG.mjs → solana-BAw4p_wG.mjs} +3 -3
  91. package/lib/{solana-BKu7ZEyd.mjs → solana-BmZEcITF.mjs} +6 -6
  92. package/lib/{solana-3l6_IpMo.js → solana-C6-Nhw0r.js} +1 -1
  93. package/lib/{solana-DxZRfZC7.js → solana-C935JrJy.js} +2 -2
  94. package/lib/{solanaEmbed.esm-BCUjAHAB.mjs → solanaEmbed.esm-ChgWwUf5.mjs} +2 -2
  95. package/lib/{solanaEmbed.esm-BfLMQHAY.js → solanaEmbed.esm-P8gWbyY6.js} +1 -1
  96. package/lib/src/routes/ntt/chains/evm/nttManager.d.ts.map +1 -1
  97. package/lib/src/routes/ntt/chains/evm/wormholeTransceiver.d.ts.map +1 -1
  98. package/lib/src/routes/ntt/chains/solana/nttManager.d.ts.map +1 -1
  99. package/lib/src/routes/ntt/utils.d.ts +1 -0
  100. package/lib/src/routes/ntt/utils.d.ts.map +1 -1
  101. package/lib/{sui-XxWiyiIK.mjs → sui-B6rErTwb.mjs} +1 -1
  102. package/lib/{sui-CQdykRga.js → sui-CaR22DH7.js} +1 -1
  103. package/lib/{sui-A03wTQ01.js → sui-LOtTZxFG.js} +2 -2
  104. package/lib/{sui-D5Lc_xEX.mjs → sui-MwjLxOll.mjs} +4 -4
  105. package/lib/{unsignedTransaction-B1m8rYzv.js → unsignedTransaction-B5T303Id.js} +1 -1
  106. package/lib/{unsignedTransaction-DUrFOHBP.mjs → unsignedTransaction-CybCHnDx.mjs} +2 -2
  107. package/package.json +1 -1
  108. package/dist/assets/index-CoIbnMKD.js +0 -2
  109. package/lib/cosmos-D60ErM9c.js +0 -37
  110. package/lib/index-CGMRtKmw.js +0 -1
  111. package/lib/index-XPYOjl5L.js +0 -3
@@ -1,4 +1,4 @@
1
- "use strict";var Ir=Object.defineProperty;var xr=(e,t,r)=>t in e?Ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var V=(e,t,r)=>(xr(e,typeof t!="symbol"?t+"":t,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("./index-BzrMFsLZ.js"),S=require("./sui-A03wTQ01.js");require("./index-CVW9fQKj.js");const Ar=require("./chain-D5AOvPgB.js");class _r{constructor(t,r,n,i,s=!1){V(this,"transaction");V(this,"network");V(this,"chain");V(this,"description");V(this,"parallelizable");this.transaction=t,this.network=r,this.chain=n,this.description=i,this.parallelizable=s}}class Cr extends TypeError{constructor(t,r){let n;const{message:i,explanation:s,...o}=t,{path:a}=t,c=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??c),s!=null&&(this.cause=c),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}}function Br(e){return K(e)&&typeof e[Symbol.iterator]=="function"}function K(e){return typeof e=="object"&&e!=null}function J(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function $r(e){const{done:t,value:r}=e.next();return t?void 0:r}function Ur(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:s}=t,{type:o}=r,{refinement:a,message:c=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${J(n)}\``}=e;return{value:n,type:o,refinement:a,key:i[i.length-1],path:i,branch:s,...e,message:c}}function*Vt(e,t,r,n){Br(e)||(e=[e]);for(const i of e){const s=Ur(i,t,r,n);s&&(yield s)}}function*ut(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:o=!1}=r,a={path:n,branch:i};if(s&&(e=t.coercer(e,a),o&&t.type!=="type"&&K(t.schema)&&K(e)&&!Array.isArray(e)))for(const d in e)t.schema[d]===void 0&&delete e[d];let c="valid";for(const d of t.validator(e,a))d.explanation=r.message,c="not_valid",yield[d,void 0];for(let[d,l,g]of t.entries(e,a)){const m=ut(l,g,{path:d===void 0?n:[...n,d],branch:d===void 0?i:[...i,l],coerce:s,mask:o,message:r.message});for(const y of m)y[0]?(c=y[0].refinement!=null?"not_refined":"not_valid",yield[y[0],void 0]):s&&(l=y[1],d===void 0?e=l:e instanceof Map?e.set(d,l):e instanceof Set?e.add(l):K(e)&&(l!==void 0||d in e)&&(e[d]=l))}if(c!=="not_valid")for(const d of t.refiner(e,a))d.explanation=r.message,c="not_refined",yield[d,void 0];c==="valid"&&(yield[void 0,e])}class te{constructor(t){const{type:r,schema:n,validator:i,refiner:s,coercer:o=c=>c,entries:a=function*(){}}=t;this.type=r,this.schema=n,this.entries=a,this.coercer=o,i?this.validator=(c,d)=>{const l=i(c,d);return Vt(l,d,this,c)}:this.validator=()=>[],s?this.refiner=(c,d)=>{const l=s(c,d);return Vt(l,d,this,c)}:this.refiner=()=>[]}assert(t,r){return tt(t,this,r)}create(t,r){return Kt(t,this,r)}is(t){return L(t,this)}mask(t,r){return Jt(t,this,r)}validate(t,r={}){return Ie(t,this,r)}}function tt(e,t,r){const n=Ie(e,t,{message:r});if(n[0])throw n[0]}function Kt(e,t,r){const n=Ie(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Jt(e,t,r){const n=Ie(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function L(e,t){return!Ie(e,t)[0]}function Ie(e,t,r={}){const n=ut(e,t,r),i=$r(n);return i[0]?[new Cr(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function je(...e){const t=e[0].type==="type",r=e.map(i=>i.schema),n=Object.assign({},...r);return t?Rr(n):p(n)}function W(e,t){return new te({type:e,schema:null,validator:t})}function rt(){return W("any",()=>!0)}function E(e){return new te({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: ${J(t)}`}})}function Mr(){return W("bigint",e=>typeof e=="bigint")}function z(){return W("boolean",e=>typeof e=="boolean")}function ee(){return W("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${J(e)}`)}function v(e){const t=J(e),r=typeof e;return new te({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${J(n)}`}})}function qt(){return W("never",()=>!1)}function $(e){return new te({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function le(){return W("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${J(e)}`)}function p(e){const t=e?Object.keys(e):[],r=qt();return new te({type:"object",schema:e||null,*entries(n){if(e&&K(n)){const i=new Set(Object.keys(n));for(const s of t)i.delete(s),yield[s,n[s],e[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return K(n)||`Expected an object, but received: ${J(n)}`},coercer(n){return K(n)?{...n}:n}})}function T(e){return new te({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function Q(e,t){return new te({type:"record",schema:null,*entries(r){if(K(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`}})}function h(){return W("string",e=>typeof e=="string"||`Expected a string, but received: ${J(e)}`)}function Ht(e){const t=qt();return new te({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],e[i]||t]}},validator(r){return Array.isArray(r)||`Expected an array, but received: ${J(r)}`}})}function Rr(e){const t=Object.keys(e);return new te({type:"type",schema:e,*entries(r){if(K(r))for(const n of t)yield[n,r[n],e[n]]},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`},coercer(r){return K(r)?{...r}:r}})}function U(e){const t=e.map(r=>r.type).join(" | ");return new te({type:"union",schema:null,coercer(r){for(const n of e){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of e){const[...o]=ut(r,s,n),[a]=o;if(a[0])for(const[c]of o)c&&i.push(c);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${J(r)}`,...i]}})}function Xt(){return W("unknown",()=>!0)}const dt=U([p({AddressOwner:h()}),p({ObjectOwner:h()}),p({Shared:p({initial_shared_version:$(h())})}),v("Immutable")]);W("SuiJsonValue",()=>!0);const Pr=U([p({u32:h()}),p({u64:h()}),p({f64:h()})]);p({attributes:Q(h(),$(Pr)),featureFlags:Q(h(),z()),maxSupportedProtocolVersion:h(),minSupportedProtocolVersion:h(),protocolVersion:h()});U([h(),v("package")]);const oe=p({digest:h(),objectId:h(),version:U([le(),h(),Mr()])});p({owner:dt,reference:oe});p({objectId:h(),sequenceNumber:h()});p({payment:E(oe),owner:h(),price:h(),budget:h()});const Nr=je(oe,p({type:h(),owner:dt,previousTransaction:h()})),Dr=Q(h(),rt()),zr=Q(h(),Xt()),Vr=p({type:h(),fields:Dr,hasPublicTransfer:z()}),Fr=p({disassembled:zr}),Gr=U([je(Vr,p({dataType:v("moveObject")})),je(Fr,p({dataType:v("package")}))]),Lr=p({type:h(),hasPublicTransfer:z(),version:h(),bcsBytes:h()}),Wr=p({id:h(),moduleMap:Q(h(),h())}),Kr=U([je(Lr,p({dataType:v("moveObject")})),je(Wr,p({dataType:v("package")}))]);BigInt(1e9);const Zt=p({code:h(),error:T(h()),object_id:T(h()),parent_object_id:T(h()),version:T(h()),digest:T(h())}),Jr=p({data:$(T(Q(h(),h()))),error:$(T(Zt))}),qr=U([Jr,T(Q(h(),h()))]),Yt=p({objectId:h(),version:h(),digest:h(),type:$(T(h())),content:$(T(Gr)),bcs:$(T(Kr)),owner:$(T(dt)),previousTransaction:$(T(h())),storageRebate:$(T(h())),display:$(T(qr))});p({showType:$(T(z())),showContent:$(T(z())),showBcs:$(T(z())),showOwner:$(T(z())),showPreviousTransaction:$(T(z())),showStorageRebate:$(T(z())),showDisplay:$(T(z()))});U([v("Exists"),v("notExists"),v("Deleted")]);E(Nr);const Hr=p({data:$(T(Yt)),error:$(T(Zt))});function Xr(e){return e.data}function Zr(e){if(e.error&&"object_id"in e.error&&"version"in e.error&&"digest"in e.error){const t=e.error;return{objectId:t.object_id,version:t.version,digest:t.digest}}}function Ft(e){if("reference"in e)return e.reference;const t=Xr(e);return t?{objectId:t.objectId,version:t.version,digest:t.digest}:Zr(e)}p({objectId:h(),atCheckpoint:T(le())});p({data:E(Hr),nextCursor:T($(h())),hasNextPage:z()});U([p({details:Yt,status:v("VersionFound")}),p({details:h(),status:v("ObjectNotExists")}),p({details:oe,status:v("ObjectDeleted")}),p({details:Ht([h(),le()]),status:v("VersionNotFound")}),p({details:p({asked_version:le(),latest_version:le(),object_id:h()}),status:v("VersionTooHigh")})]);const Yr=U([h(),p({Object:h()})]);E(Yr);const Qr=p({address:h(),name:h()}),en=U([v("Private"),v("Public"),v("Friend")]),lt=p({abilities:E(h())}),tn=p({constraints:lt,isPhantom:z()}),rn=p({TypeParameter:le()}),qe=Ht([p({module:h(),package:h(),function:h()}),h()]);p({rank3Days:E(qe),rank7Days:E(qe),rank30Days:E(qe)});function Qt(e){if(!e)return!1;if(typeof e=="string"||L(e,rn)||er(e))return!0;if(typeof e!="object")return!1;const t=e;return!!(L(t.Reference,pe)||L(t.MutableReference,pe)||L(t.Vector,pe))}const pe=W("SuiMoveNormalizedType",Qt);function er(e){if(!e||typeof e!="object")return!1;const t=e;if(!t.Struct||typeof t.Struct!="object")return!1;const r=t.Struct;return!(typeof r.address!="string"||typeof r.module!="string"||typeof r.name!="string"||!Array.isArray(r.typeArguments)||!r.typeArguments.every(n=>Qt(n)))}W("SuiMoveNormalizedStructType",er);const nn=p({visibility:en,isEntry:z(),typeParameters:E(lt),parameters:E(pe),return:E(pe)}),sn=p({name:h(),type:pe}),an=p({abilities:lt,typeParameters:E(tn),fields:E(sn)}),on=p({fileFormatVersion:le(),address:h(),name:h(),friends:E(Qr),structs:Q(h(),an),exposedFunctions:Q(h(),nn)});Q(h(),on);function nt(e){return typeof e=="object"&&"MutableReference"in e?e.MutableReference:void 0}function tr(e){return typeof e=="object"&&"Reference"in e?e.Reference:void 0}function ft(e){if(typeof e=="object"&&"Struct"in e)return e;const t=tr(e),r=nt(e);if(typeof t=="object"&&"Struct"in t)return t;if(typeof r=="object"&&"Struct"in r)return r}function cn(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),s=i.charCodeAt(0);if(t[s]!==255)throw new TypeError(i+" is ambiguous");t[s]=n}var o=e.length,a=e.charAt(0),c=Math.log(o)/Math.log(256),d=Math.log(256)/Math.log(o);function l(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var w=0,b=0,f=0,x=y.length;f!==x&&y[f]===0;)f++,w++;for(var C=(x-f)*d+1>>>0,P=new Uint8Array(C);f!==x;){for(var A=y[f],k=0,N=C-1;(A!==0||k<b)&&N!==-1;N--,k++)A+=256*P[N]>>>0,P[N]=A%o>>>0,A=A/o>>>0;if(A!==0)throw new Error("Non-zero carry");b=k,f++}for(var q=C-b;q!==C&&P[q]===0;)q++;for(var he=a.repeat(w);q<C;++q)he+=e.charAt(P[q]);return he}function g(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;for(var w=0,b=0,f=0;y[w]===a;)b++,w++;for(var x=(y.length-w)*c+1>>>0,C=new Uint8Array(x);y[w];){var P=t[y.charCodeAt(w)];if(P===255)return;for(var A=0,k=x-1;(P!==0||A<f)&&k!==-1;k--,A++)P+=o*C[k]>>>0,C[k]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");f=A,w++}for(var N=x-f;N!==x&&C[N]===0;)N++;for(var q=new Uint8Array(b+(x-N)),he=b;N!==x;)q[he++]=C[N++];return q}function m(y){var w=g(y);if(w)return w;throw new Error("Non-base"+o+" character")}return{encode:l,decodeUnsafe:g,decode:m}}var un=cn;const dn=un,ln="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var fn=dn(ln);const rr=B.getDefaultExportFromCjs(fn),xe=e=>rr.encode(e),ht=e=>rr.decode(e);function ce(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const He=8192;function Ae(e){if(e.length<He)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=He){const n=e.slice(r,r+He);t+=String.fromCharCode(...n)}return btoa(t)}function Ke(e){var i;const t=e.startsWith("0x")?e.slice(2):e,n=((i=(t.length%2===0?t:`0${t}}`).match(/.{2}/g))==null?void 0:i.map(s=>parseInt(s,16)))??[];return Uint8Array.from(n)}function _e(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}function gt(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 hn(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}}class nr{constructor(t){this.bytePosition=0,this.dataView=new DataView(t.buffer)}shift(t){return this.bytePosition+=t,this}read8(){let t=this.dataView.getUint8(this.bytePosition);return this.shift(1),t}read16(){let t=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),t}read32(){let t=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),t}read64(){let t=this.read32(),n=this.read32().toString(16)+t.toString(16).padStart(8,"0");return BigInt("0x"+n).toString(10)}read128(){let t=BigInt(this.read64()),n=BigInt(this.read64()).toString(16)+t.toString(16).padStart(16,"0");return BigInt("0x"+n).toString(10)}read256(){let t=BigInt(this.read128()),n=BigInt(this.read128()).toString(16)+t.toString(16).padStart(32,"0");return BigInt("0x"+n).toString(10)}readBytes(t){let r=this.bytePosition+this.dataView.byteOffset,n=new Uint8Array(this.dataView.buffer,r,t);return this.shift(t),n}readULEB(){let t=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,t),{value:n,length:i}=hn(r);return this.shift(i),n}readVec(t){let r=this.readULEB(),n=[];for(let i=0;i<r;i++)n.push(t(this,i,r));return n}}function gn(e,t){switch(t){case"base58":return xe(e);case"base64":return Ae(e);case"hex":return _e(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function pn(e,t){switch(t){case"base58":return ht(e);case"base64":return ce(e);case"hex":return Ke(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function ir(e,t=["<",">"]){const[r,n]=t,i=[];let s="",o=0;for(let a=0;a<e.length;a++){const c=e[a];if(c===r&&o++,c===n&&o--,o===0&&c===","){i.push(s.trim()),s="";continue}s+=c}return i.push(s.trim()),i}class sr{constructor({size:t=1024,maxSize:r,allocateSize:n=1024}={}){this.bytePosition=0,this.size=t,this.maxSize=r||t,this.allocateSize=n,this.dataView=new DataView(new ArrayBuffer(t))}ensureSizeOrGrow(t){const r=this.bytePosition+t;if(r>this.size){const n=Math.min(this.maxSize,this.size+this.allocateSize);if(r>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: ${r}`);this.size=n;const i=new ArrayBuffer(this.size);new Uint8Array(i).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(i)}}shift(t){return this.bytePosition+=t,this}write8(t){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(t)),this.shift(1)}write16(t){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(t),!0),this.shift(2)}write32(t){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(t),!0),this.shift(4)}write64(t){return Xe(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return Xe(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return Xe(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return gt(t).forEach(r=>this.write8(r)),this}writeVec(t,r){return this.writeULEB(t.length),Array.from(t).forEach((n,i)=>r(this,n,i,t.length)),this}*[Symbol.iterator](){for(let t=0;t<this.bytePosition;t++)yield this.dataView.getUint8(t);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(t){return gn(this.toBytes(),t)}}function Xe(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 ar=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},X=(e,t,r)=>(ar(e,t,"read from private field"),r?r.call(e):t.get(e)),ze=(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)},Ve=(e,t,r,n)=>(ar(e,t,"write to private field"),t.set(e,r),r),ge,be,Me,ae;const or=class{constructor(e){ze(this,ge,void 0),ze(this,be,void 0),this.name=e.name,this.read=e.read,this.serializedSize=e.serializedSize??(()=>null),Ve(this,ge,e.write),Ve(this,be,e.serialize??((t,r)=>{const n=new sr({size:this.serializedSize(t)??void 0,...r});return X(this,ge).call(this,t,n),n.toBytes()})),this.validate=e.validate??(()=>{})}write(e,t){this.validate(e),X(this,ge).call(this,e,t)}serialize(e,t){return this.validate(e),new yn(this,X(this,be).call(this,e,t))}parse(e){const t=new nr(e);return this.read(t)}transform({name:e,input:t,output:r}){return new or({name:e??this.name,read:n=>r(this.read(n)),write:(n,i)=>X(this,ge).call(this,t(n),i),serializedSize:n=>this.serializedSize(t(n)),serialize:(n,i)=>X(this,be).call(this,t(n),i),validate:n=>this.validate(t(n))})}};let Z=or;ge=new WeakMap;be=new WeakMap;const cr=Symbol.for("@mysten/serialized-bcs");function pt(e){return!!e&&typeof e=="object"&&e[cr]===!0}class yn{constructor(t,r){ze(this,Me,void 0),ze(this,ae,void 0),Ve(this,Me,t),Ve(this,ae,r)}get[cr](){return!0}toBytes(){return X(this,ae)}toHex(){return _e(X(this,ae))}toBase64(){return Ae(X(this,ae))}toBase58(){return xe(X(this,ae))}parse(){return X(this,Me).parse(X(this,ae))}}Me=new WeakMap;ae=new WeakMap;function Fe({size:e,...t}){return new Z({...t,serializedSize:()=>e})}function Ze({readMethod:e,writeMethod:t,...r}){return Fe({...r,read:n=>n[e](),write:(n,i)=>i[t](n),validate:n=>{var i;if(n<0||n>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${n}. Expected value in range 0-${r.maxValue}`);(i=r.validate)==null||i.call(r,n)}})}function Ye({readMethod:e,writeMethod:t,...r}){return Fe({...r,read:n=>n[e](),write:(n,i)=>i[t](BigInt(n)),validate:n=>{var s;const i=BigInt(n);if(i<0||i>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${i}. Expected value in range 0-${r.maxValue}`);(s=r.validate)==null||s.call(r,i)}})}function mn({serialize:e,...t}){const r=new Z({...t,serialize:e,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function wn({toBytes:e,fromBytes:t,...r}){return new Z({...r,read:n=>{const i=n.readULEB(),s=n.readBytes(i);return t(s)},write:(n,i)=>{const s=e(n);i.writeULEB(s.length);for(let o=0;o<s.length;o++)i.write8(s[o])},serialize:n=>{const i=e(n),s=gt(i.length),o=new Uint8Array(s.length+i.length);return o.set(s,0),o.set(i,s.length),o},validate:n=>{var i;if(typeof n!="string")throw new TypeError(`Invalid ${r.name} value: ${n}. Expected string`);(i=r.validate)==null||i.call(r,n)}})}function bn(e){let t=null;function r(){return t||(t=e()),t}return new Z({name:"lazy",read:n=>r().read(n),serializedSize:n=>r().serializedSize(n),write:(n,i)=>r().write(n,i),serialize:(n,i)=>r().serialize(n,i).toBytes()})}const u={u8(e){return Ze({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return Ze({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return Ze({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return Ye({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return Ye({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return Ye({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e})},bool(e){return Fe({name:"bool",size:1,read:t=>t.read8()===1,write:(t,r)=>r.write8(t?1:0),...e,validate:t=>{var r;if((r=e==null?void 0:e.validate)==null||r.call(e,t),typeof t!="boolean")throw new TypeError(`Expected boolean, found ${typeof t}`)}})},uleb128(e){return mn({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(gt(t)),...e})},bytes(e,t){return Fe({name:`bytes[${e}]`,size:e,read:r=>r.readBytes(e),write:(r,n)=>{for(let i=0;i<e;i++)n.write8(r[i]??0)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e)throw new TypeError(`Expected array of length ${e}, found ${r.length}`)}})},string(e){return wn({name:"string",toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e})},fixedArray(e,t,r){return new Z({name:`${t.name}[${e}]`,read:n=>{const i=new Array(e);for(let s=0;s<e;s++)i[s]=t.read(n);return i},write:(n,i)=>{for(const s of n)t.write(s,i)},...r,validate:n=>{var i;if((i=r==null?void 0:r.validate)==null||i.call(r,n),!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==e)throw new TypeError(`Expected array of length ${e}, found ${n.length}`)}})},option(e){return u.enum(`Option<${e.name}>`,{None:null,Some:e}).transform({input:t=>t==null?{None:!0}:{Some:t},output:t=>"Some"in t?t.Some:null})},vector(e,t){return new Z({name:`vector<${e.name}>`,read:r=>{const n=r.readULEB(),i=new Array(n);for(let s=0;s<n;s++)i[s]=e.read(r);return i},write:(r,n)=>{n.writeULEB(r.length);for(const i of r)e.write(i,n)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`)}})},tuple(e,t){return new Z({name:`(${e.map(r=>r.name).join(", ")})`,serializedSize:r=>{let n=0;for(let i=0;i<e.length;i++){const s=e[i].serializedSize(r[i]);if(s==null)return null;n+=s}return n},read:r=>{const n=[];for(const i of e)n.push(i.read(r));return n},write:(r,n)=>{for(let i=0;i<e.length;i++)e[i].write(r[i],n)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!Array.isArray(r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e.length)throw new TypeError(`Expected array of length ${e.length}, found ${r.length}`)}})},struct(e,t,r){const n=Object.entries(t);return new Z({name:e,serializedSize:i=>{let s=0;for(const[o,a]of n){const c=a.serializedSize(i[o]);if(c==null)return null;s+=c}return s},read:i=>{const s={};for(const[o,a]of n)s[o]=a.read(i);return s},write:(i,s)=>{for(const[o,a]of n)a.write(i[o],s)},...r,validate:i=>{var s;if((s=r==null?void 0:r.validate)==null||s.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`)}})},enum(e,t,r){const n=Object.entries(t);return new Z({name:e,read:i=>{const s=i.readULEB(),[o,a]=n[s];return{[o]:(a==null?void 0:a.read(i))??!0}},write:(i,s)=>{const[o,a]=Object.entries(i)[0];for(let c=0;c<n.length;c++){const[d,l]=n[c];if(d===o){s.writeULEB(c),l==null||l.write(a,s);return}}},...r,validate:i=>{var a;if((a=r==null?void 0:r.validate)==null||a.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`);const s=Object.keys(i);if(s.length!==1)throw new TypeError(`Expected object with one key, found ${s.length}`);const[o]=s;if(!Object.hasOwn(t,o))throw new TypeError(`Invalid enum variant ${o}`)}})},map(e,t){return u.vector(u.tuple([e,t])).transform({name:`Map<${e.name}, ${t.name}>`,input:r=>[...r.entries()],output:r=>{const n=new Map;for(const[i,s]of r)n.set(i,s);return n}})},generic(e,t){return(...r)=>t(...r).transform({name:`${t.name}<${r.map(n=>n.name).join(", ")}>`,input:n=>n,output:n=>n})},lazy(e){return bn(e)}},Sn=32,Se=class{constructor(e){if(this.types=new Map,this.counter=0,e instanceof Se){this.schema=e.schema,this.types=new Map(e.types);return}if(this.schema=e,this.registerAddressType(Se.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&&Tn(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 Se(this).registerStructType(n,e).ser(n,t,r)}throw new Error(`Incorrect type passed into the '.ser()' function.
1
+ "use strict";var Ir=Object.defineProperty;var xr=(e,t,r)=>t in e?Ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var V=(e,t,r)=>(xr(e,typeof t!="symbol"?t+"":t,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("./index-Z109VDLJ.js"),S=require("./sui-LOtTZxFG.js");require("./index-BuDqNPcO.js");const Ar=require("./chain-Bwy1h3yo.js");class _r{constructor(t,r,n,i,s=!1){V(this,"transaction");V(this,"network");V(this,"chain");V(this,"description");V(this,"parallelizable");this.transaction=t,this.network=r,this.chain=n,this.description=i,this.parallelizable=s}}class Cr extends TypeError{constructor(t,r){let n;const{message:i,explanation:s,...o}=t,{path:a}=t,c=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??c),s!=null&&(this.cause=c),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}}function Br(e){return K(e)&&typeof e[Symbol.iterator]=="function"}function K(e){return typeof e=="object"&&e!=null}function J(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function $r(e){const{done:t,value:r}=e.next();return t?void 0:r}function Ur(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:s}=t,{type:o}=r,{refinement:a,message:c=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${J(n)}\``}=e;return{value:n,type:o,refinement:a,key:i[i.length-1],path:i,branch:s,...e,message:c}}function*Vt(e,t,r,n){Br(e)||(e=[e]);for(const i of e){const s=Ur(i,t,r,n);s&&(yield s)}}function*ut(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:o=!1}=r,a={path:n,branch:i};if(s&&(e=t.coercer(e,a),o&&t.type!=="type"&&K(t.schema)&&K(e)&&!Array.isArray(e)))for(const d in e)t.schema[d]===void 0&&delete e[d];let c="valid";for(const d of t.validator(e,a))d.explanation=r.message,c="not_valid",yield[d,void 0];for(let[d,l,g]of t.entries(e,a)){const m=ut(l,g,{path:d===void 0?n:[...n,d],branch:d===void 0?i:[...i,l],coerce:s,mask:o,message:r.message});for(const y of m)y[0]?(c=y[0].refinement!=null?"not_refined":"not_valid",yield[y[0],void 0]):s&&(l=y[1],d===void 0?e=l:e instanceof Map?e.set(d,l):e instanceof Set?e.add(l):K(e)&&(l!==void 0||d in e)&&(e[d]=l))}if(c!=="not_valid")for(const d of t.refiner(e,a))d.explanation=r.message,c="not_refined",yield[d,void 0];c==="valid"&&(yield[void 0,e])}class te{constructor(t){const{type:r,schema:n,validator:i,refiner:s,coercer:o=c=>c,entries:a=function*(){}}=t;this.type=r,this.schema=n,this.entries=a,this.coercer=o,i?this.validator=(c,d)=>{const l=i(c,d);return Vt(l,d,this,c)}:this.validator=()=>[],s?this.refiner=(c,d)=>{const l=s(c,d);return Vt(l,d,this,c)}:this.refiner=()=>[]}assert(t,r){return tt(t,this,r)}create(t,r){return Kt(t,this,r)}is(t){return L(t,this)}mask(t,r){return Jt(t,this,r)}validate(t,r={}){return Ie(t,this,r)}}function tt(e,t,r){const n=Ie(e,t,{message:r});if(n[0])throw n[0]}function Kt(e,t,r){const n=Ie(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Jt(e,t,r){const n=Ie(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function L(e,t){return!Ie(e,t)[0]}function Ie(e,t,r={}){const n=ut(e,t,r),i=$r(n);return i[0]?[new Cr(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function je(...e){const t=e[0].type==="type",r=e.map(i=>i.schema),n=Object.assign({},...r);return t?Rr(n):p(n)}function W(e,t){return new te({type:e,schema:null,validator:t})}function rt(){return W("any",()=>!0)}function E(e){return new te({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: ${J(t)}`}})}function Mr(){return W("bigint",e=>typeof e=="bigint")}function z(){return W("boolean",e=>typeof e=="boolean")}function ee(){return W("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${J(e)}`)}function v(e){const t=J(e),r=typeof e;return new te({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${J(n)}`}})}function qt(){return W("never",()=>!1)}function $(e){return new te({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function le(){return W("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${J(e)}`)}function p(e){const t=e?Object.keys(e):[],r=qt();return new te({type:"object",schema:e||null,*entries(n){if(e&&K(n)){const i=new Set(Object.keys(n));for(const s of t)i.delete(s),yield[s,n[s],e[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return K(n)||`Expected an object, but received: ${J(n)}`},coercer(n){return K(n)?{...n}:n}})}function T(e){return new te({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function Q(e,t){return new te({type:"record",schema:null,*entries(r){if(K(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`}})}function h(){return W("string",e=>typeof e=="string"||`Expected a string, but received: ${J(e)}`)}function Ht(e){const t=qt();return new te({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],e[i]||t]}},validator(r){return Array.isArray(r)||`Expected an array, but received: ${J(r)}`}})}function Rr(e){const t=Object.keys(e);return new te({type:"type",schema:e,*entries(r){if(K(r))for(const n of t)yield[n,r[n],e[n]]},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`},coercer(r){return K(r)?{...r}:r}})}function U(e){const t=e.map(r=>r.type).join(" | ");return new te({type:"union",schema:null,coercer(r){for(const n of e){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of e){const[...o]=ut(r,s,n),[a]=o;if(a[0])for(const[c]of o)c&&i.push(c);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${J(r)}`,...i]}})}function Xt(){return W("unknown",()=>!0)}const dt=U([p({AddressOwner:h()}),p({ObjectOwner:h()}),p({Shared:p({initial_shared_version:$(h())})}),v("Immutable")]);W("SuiJsonValue",()=>!0);const Pr=U([p({u32:h()}),p({u64:h()}),p({f64:h()})]);p({attributes:Q(h(),$(Pr)),featureFlags:Q(h(),z()),maxSupportedProtocolVersion:h(),minSupportedProtocolVersion:h(),protocolVersion:h()});U([h(),v("package")]);const oe=p({digest:h(),objectId:h(),version:U([le(),h(),Mr()])});p({owner:dt,reference:oe});p({objectId:h(),sequenceNumber:h()});p({payment:E(oe),owner:h(),price:h(),budget:h()});const Nr=je(oe,p({type:h(),owner:dt,previousTransaction:h()})),Dr=Q(h(),rt()),zr=Q(h(),Xt()),Vr=p({type:h(),fields:Dr,hasPublicTransfer:z()}),Fr=p({disassembled:zr}),Gr=U([je(Vr,p({dataType:v("moveObject")})),je(Fr,p({dataType:v("package")}))]),Lr=p({type:h(),hasPublicTransfer:z(),version:h(),bcsBytes:h()}),Wr=p({id:h(),moduleMap:Q(h(),h())}),Kr=U([je(Lr,p({dataType:v("moveObject")})),je(Wr,p({dataType:v("package")}))]);BigInt(1e9);const Zt=p({code:h(),error:T(h()),object_id:T(h()),parent_object_id:T(h()),version:T(h()),digest:T(h())}),Jr=p({data:$(T(Q(h(),h()))),error:$(T(Zt))}),qr=U([Jr,T(Q(h(),h()))]),Yt=p({objectId:h(),version:h(),digest:h(),type:$(T(h())),content:$(T(Gr)),bcs:$(T(Kr)),owner:$(T(dt)),previousTransaction:$(T(h())),storageRebate:$(T(h())),display:$(T(qr))});p({showType:$(T(z())),showContent:$(T(z())),showBcs:$(T(z())),showOwner:$(T(z())),showPreviousTransaction:$(T(z())),showStorageRebate:$(T(z())),showDisplay:$(T(z()))});U([v("Exists"),v("notExists"),v("Deleted")]);E(Nr);const Hr=p({data:$(T(Yt)),error:$(T(Zt))});function Xr(e){return e.data}function Zr(e){if(e.error&&"object_id"in e.error&&"version"in e.error&&"digest"in e.error){const t=e.error;return{objectId:t.object_id,version:t.version,digest:t.digest}}}function Ft(e){if("reference"in e)return e.reference;const t=Xr(e);return t?{objectId:t.objectId,version:t.version,digest:t.digest}:Zr(e)}p({objectId:h(),atCheckpoint:T(le())});p({data:E(Hr),nextCursor:T($(h())),hasNextPage:z()});U([p({details:Yt,status:v("VersionFound")}),p({details:h(),status:v("ObjectNotExists")}),p({details:oe,status:v("ObjectDeleted")}),p({details:Ht([h(),le()]),status:v("VersionNotFound")}),p({details:p({asked_version:le(),latest_version:le(),object_id:h()}),status:v("VersionTooHigh")})]);const Yr=U([h(),p({Object:h()})]);E(Yr);const Qr=p({address:h(),name:h()}),en=U([v("Private"),v("Public"),v("Friend")]),lt=p({abilities:E(h())}),tn=p({constraints:lt,isPhantom:z()}),rn=p({TypeParameter:le()}),qe=Ht([p({module:h(),package:h(),function:h()}),h()]);p({rank3Days:E(qe),rank7Days:E(qe),rank30Days:E(qe)});function Qt(e){if(!e)return!1;if(typeof e=="string"||L(e,rn)||er(e))return!0;if(typeof e!="object")return!1;const t=e;return!!(L(t.Reference,pe)||L(t.MutableReference,pe)||L(t.Vector,pe))}const pe=W("SuiMoveNormalizedType",Qt);function er(e){if(!e||typeof e!="object")return!1;const t=e;if(!t.Struct||typeof t.Struct!="object")return!1;const r=t.Struct;return!(typeof r.address!="string"||typeof r.module!="string"||typeof r.name!="string"||!Array.isArray(r.typeArguments)||!r.typeArguments.every(n=>Qt(n)))}W("SuiMoveNormalizedStructType",er);const nn=p({visibility:en,isEntry:z(),typeParameters:E(lt),parameters:E(pe),return:E(pe)}),sn=p({name:h(),type:pe}),an=p({abilities:lt,typeParameters:E(tn),fields:E(sn)}),on=p({fileFormatVersion:le(),address:h(),name:h(),friends:E(Qr),structs:Q(h(),an),exposedFunctions:Q(h(),nn)});Q(h(),on);function nt(e){return typeof e=="object"&&"MutableReference"in e?e.MutableReference:void 0}function tr(e){return typeof e=="object"&&"Reference"in e?e.Reference:void 0}function ft(e){if(typeof e=="object"&&"Struct"in e)return e;const t=tr(e),r=nt(e);if(typeof t=="object"&&"Struct"in t)return t;if(typeof r=="object"&&"Struct"in r)return r}function cn(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),s=i.charCodeAt(0);if(t[s]!==255)throw new TypeError(i+" is ambiguous");t[s]=n}var o=e.length,a=e.charAt(0),c=Math.log(o)/Math.log(256),d=Math.log(256)/Math.log(o);function l(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var w=0,b=0,f=0,x=y.length;f!==x&&y[f]===0;)f++,w++;for(var C=(x-f)*d+1>>>0,P=new Uint8Array(C);f!==x;){for(var A=y[f],k=0,N=C-1;(A!==0||k<b)&&N!==-1;N--,k++)A+=256*P[N]>>>0,P[N]=A%o>>>0,A=A/o>>>0;if(A!==0)throw new Error("Non-zero carry");b=k,f++}for(var q=C-b;q!==C&&P[q]===0;)q++;for(var he=a.repeat(w);q<C;++q)he+=e.charAt(P[q]);return he}function g(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;for(var w=0,b=0,f=0;y[w]===a;)b++,w++;for(var x=(y.length-w)*c+1>>>0,C=new Uint8Array(x);y[w];){var P=t[y.charCodeAt(w)];if(P===255)return;for(var A=0,k=x-1;(P!==0||A<f)&&k!==-1;k--,A++)P+=o*C[k]>>>0,C[k]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");f=A,w++}for(var N=x-f;N!==x&&C[N]===0;)N++;for(var q=new Uint8Array(b+(x-N)),he=b;N!==x;)q[he++]=C[N++];return q}function m(y){var w=g(y);if(w)return w;throw new Error("Non-base"+o+" character")}return{encode:l,decodeUnsafe:g,decode:m}}var un=cn;const dn=un,ln="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var fn=dn(ln);const rr=B.getDefaultExportFromCjs(fn),xe=e=>rr.encode(e),ht=e=>rr.decode(e);function ce(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const He=8192;function Ae(e){if(e.length<He)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=He){const n=e.slice(r,r+He);t+=String.fromCharCode(...n)}return btoa(t)}function Ke(e){var i;const t=e.startsWith("0x")?e.slice(2):e,n=((i=(t.length%2===0?t:`0${t}}`).match(/.{2}/g))==null?void 0:i.map(s=>parseInt(s,16)))??[];return Uint8Array.from(n)}function _e(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}function gt(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 hn(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}}class nr{constructor(t){this.bytePosition=0,this.dataView=new DataView(t.buffer)}shift(t){return this.bytePosition+=t,this}read8(){let t=this.dataView.getUint8(this.bytePosition);return this.shift(1),t}read16(){let t=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),t}read32(){let t=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),t}read64(){let t=this.read32(),n=this.read32().toString(16)+t.toString(16).padStart(8,"0");return BigInt("0x"+n).toString(10)}read128(){let t=BigInt(this.read64()),n=BigInt(this.read64()).toString(16)+t.toString(16).padStart(16,"0");return BigInt("0x"+n).toString(10)}read256(){let t=BigInt(this.read128()),n=BigInt(this.read128()).toString(16)+t.toString(16).padStart(32,"0");return BigInt("0x"+n).toString(10)}readBytes(t){let r=this.bytePosition+this.dataView.byteOffset,n=new Uint8Array(this.dataView.buffer,r,t);return this.shift(t),n}readULEB(){let t=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,t),{value:n,length:i}=hn(r);return this.shift(i),n}readVec(t){let r=this.readULEB(),n=[];for(let i=0;i<r;i++)n.push(t(this,i,r));return n}}function gn(e,t){switch(t){case"base58":return xe(e);case"base64":return Ae(e);case"hex":return _e(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function pn(e,t){switch(t){case"base58":return ht(e);case"base64":return ce(e);case"hex":return Ke(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function ir(e,t=["<",">"]){const[r,n]=t,i=[];let s="",o=0;for(let a=0;a<e.length;a++){const c=e[a];if(c===r&&o++,c===n&&o--,o===0&&c===","){i.push(s.trim()),s="";continue}s+=c}return i.push(s.trim()),i}class sr{constructor({size:t=1024,maxSize:r,allocateSize:n=1024}={}){this.bytePosition=0,this.size=t,this.maxSize=r||t,this.allocateSize=n,this.dataView=new DataView(new ArrayBuffer(t))}ensureSizeOrGrow(t){const r=this.bytePosition+t;if(r>this.size){const n=Math.min(this.maxSize,this.size+this.allocateSize);if(r>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: ${r}`);this.size=n;const i=new ArrayBuffer(this.size);new Uint8Array(i).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(i)}}shift(t){return this.bytePosition+=t,this}write8(t){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(t)),this.shift(1)}write16(t){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(t),!0),this.shift(2)}write32(t){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(t),!0),this.shift(4)}write64(t){return Xe(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return Xe(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return Xe(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return gt(t).forEach(r=>this.write8(r)),this}writeVec(t,r){return this.writeULEB(t.length),Array.from(t).forEach((n,i)=>r(this,n,i,t.length)),this}*[Symbol.iterator](){for(let t=0;t<this.bytePosition;t++)yield this.dataView.getUint8(t);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(t){return gn(this.toBytes(),t)}}function Xe(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 ar=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},X=(e,t,r)=>(ar(e,t,"read from private field"),r?r.call(e):t.get(e)),ze=(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)},Ve=(e,t,r,n)=>(ar(e,t,"write to private field"),t.set(e,r),r),ge,be,Me,ae;const or=class{constructor(e){ze(this,ge,void 0),ze(this,be,void 0),this.name=e.name,this.read=e.read,this.serializedSize=e.serializedSize??(()=>null),Ve(this,ge,e.write),Ve(this,be,e.serialize??((t,r)=>{const n=new sr({size:this.serializedSize(t)??void 0,...r});return X(this,ge).call(this,t,n),n.toBytes()})),this.validate=e.validate??(()=>{})}write(e,t){this.validate(e),X(this,ge).call(this,e,t)}serialize(e,t){return this.validate(e),new yn(this,X(this,be).call(this,e,t))}parse(e){const t=new nr(e);return this.read(t)}transform({name:e,input:t,output:r}){return new or({name:e??this.name,read:n=>r(this.read(n)),write:(n,i)=>X(this,ge).call(this,t(n),i),serializedSize:n=>this.serializedSize(t(n)),serialize:(n,i)=>X(this,be).call(this,t(n),i),validate:n=>this.validate(t(n))})}};let Z=or;ge=new WeakMap;be=new WeakMap;const cr=Symbol.for("@mysten/serialized-bcs");function pt(e){return!!e&&typeof e=="object"&&e[cr]===!0}class yn{constructor(t,r){ze(this,Me,void 0),ze(this,ae,void 0),Ve(this,Me,t),Ve(this,ae,r)}get[cr](){return!0}toBytes(){return X(this,ae)}toHex(){return _e(X(this,ae))}toBase64(){return Ae(X(this,ae))}toBase58(){return xe(X(this,ae))}parse(){return X(this,Me).parse(X(this,ae))}}Me=new WeakMap;ae=new WeakMap;function Fe({size:e,...t}){return new Z({...t,serializedSize:()=>e})}function Ze({readMethod:e,writeMethod:t,...r}){return Fe({...r,read:n=>n[e](),write:(n,i)=>i[t](n),validate:n=>{var i;if(n<0||n>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${n}. Expected value in range 0-${r.maxValue}`);(i=r.validate)==null||i.call(r,n)}})}function Ye({readMethod:e,writeMethod:t,...r}){return Fe({...r,read:n=>n[e](),write:(n,i)=>i[t](BigInt(n)),validate:n=>{var s;const i=BigInt(n);if(i<0||i>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${i}. Expected value in range 0-${r.maxValue}`);(s=r.validate)==null||s.call(r,i)}})}function mn({serialize:e,...t}){const r=new Z({...t,serialize:e,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function wn({toBytes:e,fromBytes:t,...r}){return new Z({...r,read:n=>{const i=n.readULEB(),s=n.readBytes(i);return t(s)},write:(n,i)=>{const s=e(n);i.writeULEB(s.length);for(let o=0;o<s.length;o++)i.write8(s[o])},serialize:n=>{const i=e(n),s=gt(i.length),o=new Uint8Array(s.length+i.length);return o.set(s,0),o.set(i,s.length),o},validate:n=>{var i;if(typeof n!="string")throw new TypeError(`Invalid ${r.name} value: ${n}. Expected string`);(i=r.validate)==null||i.call(r,n)}})}function bn(e){let t=null;function r(){return t||(t=e()),t}return new Z({name:"lazy",read:n=>r().read(n),serializedSize:n=>r().serializedSize(n),write:(n,i)=>r().write(n,i),serialize:(n,i)=>r().serialize(n,i).toBytes()})}const u={u8(e){return Ze({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return Ze({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return Ze({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return Ye({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return Ye({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return Ye({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e})},bool(e){return Fe({name:"bool",size:1,read:t=>t.read8()===1,write:(t,r)=>r.write8(t?1:0),...e,validate:t=>{var r;if((r=e==null?void 0:e.validate)==null||r.call(e,t),typeof t!="boolean")throw new TypeError(`Expected boolean, found ${typeof t}`)}})},uleb128(e){return mn({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(gt(t)),...e})},bytes(e,t){return Fe({name:`bytes[${e}]`,size:e,read:r=>r.readBytes(e),write:(r,n)=>{for(let i=0;i<e;i++)n.write8(r[i]??0)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e)throw new TypeError(`Expected array of length ${e}, found ${r.length}`)}})},string(e){return wn({name:"string",toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e})},fixedArray(e,t,r){return new Z({name:`${t.name}[${e}]`,read:n=>{const i=new Array(e);for(let s=0;s<e;s++)i[s]=t.read(n);return i},write:(n,i)=>{for(const s of n)t.write(s,i)},...r,validate:n=>{var i;if((i=r==null?void 0:r.validate)==null||i.call(r,n),!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==e)throw new TypeError(`Expected array of length ${e}, found ${n.length}`)}})},option(e){return u.enum(`Option<${e.name}>`,{None:null,Some:e}).transform({input:t=>t==null?{None:!0}:{Some:t},output:t=>"Some"in t?t.Some:null})},vector(e,t){return new Z({name:`vector<${e.name}>`,read:r=>{const n=r.readULEB(),i=new Array(n);for(let s=0;s<n;s++)i[s]=e.read(r);return i},write:(r,n)=>{n.writeULEB(r.length);for(const i of r)e.write(i,n)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`)}})},tuple(e,t){return new Z({name:`(${e.map(r=>r.name).join(", ")})`,serializedSize:r=>{let n=0;for(let i=0;i<e.length;i++){const s=e[i].serializedSize(r[i]);if(s==null)return null;n+=s}return n},read:r=>{const n=[];for(const i of e)n.push(i.read(r));return n},write:(r,n)=>{for(let i=0;i<e.length;i++)e[i].write(r[i],n)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!Array.isArray(r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e.length)throw new TypeError(`Expected array of length ${e.length}, found ${r.length}`)}})},struct(e,t,r){const n=Object.entries(t);return new Z({name:e,serializedSize:i=>{let s=0;for(const[o,a]of n){const c=a.serializedSize(i[o]);if(c==null)return null;s+=c}return s},read:i=>{const s={};for(const[o,a]of n)s[o]=a.read(i);return s},write:(i,s)=>{for(const[o,a]of n)a.write(i[o],s)},...r,validate:i=>{var s;if((s=r==null?void 0:r.validate)==null||s.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`)}})},enum(e,t,r){const n=Object.entries(t);return new Z({name:e,read:i=>{const s=i.readULEB(),[o,a]=n[s];return{[o]:(a==null?void 0:a.read(i))??!0}},write:(i,s)=>{const[o,a]=Object.entries(i)[0];for(let c=0;c<n.length;c++){const[d,l]=n[c];if(d===o){s.writeULEB(c),l==null||l.write(a,s);return}}},...r,validate:i=>{var a;if((a=r==null?void 0:r.validate)==null||a.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`);const s=Object.keys(i);if(s.length!==1)throw new TypeError(`Expected object with one key, found ${s.length}`);const[o]=s;if(!Object.hasOwn(t,o))throw new TypeError(`Invalid enum variant ${o}`)}})},map(e,t){return u.vector(u.tuple([e,t])).transform({name:`Map<${e.name}, ${t.name}>`,input:r=>[...r.entries()],output:r=>{const n=new Map;for(const[i,s]of r)n.set(i,s);return n}})},generic(e,t){return(...r)=>t(...r).transform({name:`${t.name}<${r.map(n=>n.name).join(", ")}>`,input:n=>n,output:n=>n})},lazy(e){return bn(e)}},Sn=32,Se=class{constructor(e){if(this.types=new Map,this.counter=0,e instanceof Se){this.schema=e.schema,this.types=new Map(e.types);return}if(this.schema=e,this.registerAddressType(Se.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&&Tn(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 Se(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=pn(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 Se(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:s}=this.parseTypeName(e);return this.types.set(i,{encode(o,a,c,d){const l=s.reduce((g,m,y)=>Object.assign(g,{[m]:d[y]}),{});return this._encodeRaw.call(o,new sr(c),a,d,l)},decode(o,a,c){const d=s.reduce((l,g,m)=>Object.assign(l,{[g]:c[m]}),{});return this._decodeRaw.call(o,new nr(a),c,d)},_encodeRaw(o,a,c,d){if(n(a))return t.call(this,o,a,c,d);throw new Error(`Validation failed for type ${i}, data: ${a}`)},_decodeRaw(o,a,c){return r.call(this,o,a,c)}}),this}registerBcsType(e,t){return this.registerType(e,(r,n,i)=>{const s=i.map(o=>new Z({name:String(o),write:(a,c)=>{const{name:d,params:l}=this.parseTypeName(o),g=this.getTypeInterface(d),m=l.reduce((y,w,b)=>Object.assign(y,{[w]:i[b]}),{});return g._encodeRaw.call(this,c,a,l,m)},read:()=>{throw new Error("Not implemented")}}));return t(...s).write(n,r),r},(r,n)=>{const i=n.map(s=>new Z({name:String(s),write:(o,a)=>{throw new Error("Not implemented")},read:o=>{const{name:a,params:c}=this.parseTypeName(s),d=this.getTypeInterface(a),l=c.reduce((g,m,y)=>Object.assign(g,{[m]:n[y]}),{});return d._decodeRaw.call(this,o,c,l)}}));return t(...i).read(r)}),this}registerAddressType(e,t,r="hex"){switch(r){case"base64":return this.registerType(e,function(i,s){return ce(s).reduce((o,a)=>o.write8(a),i)},function(i){return Ae(i.readBytes(t))});case"hex":return this.registerType(e,function(i,s){return Ke(s).reduce((o,a)=>o.write8(a),i)},function(i){return _e(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,s,o,a){return i.writeVec(s,(c,d)=>{let l=o[0];if(!l)throw new Error(`Incorrect number of type parameters passed a to vector '${e}'`);let{name:g,params:m}=this.parseTypeName(l);if(this.hasType(g))return this.getTypeInterface(g)._encodeRaw.call(this,c,d,m,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:y,params:w}=this.parseTypeName(a[g]);return this.getTypeInterface(y)._encodeRaw.call(this,c,d,w,a)})},function(i,s,o){return i.readVec(a=>{let c=s[0];if(!c)throw new Error(`Incorrect number of type parameters passed to a vector '${e}'`);let{name:d,params:l}=this.parseTypeName(c);if(this.hasType(d))return this.getTypeInterface(d)._decodeRaw.call(this,a,l,o);if(!(d in o))throw new Error(`Unable to find a matching type definition for ${d} in vector; make sure you passed a generic`);let{name:g,params:m}=this.parseTypeName(o[d]);return this.getTypeInterface(g)._decodeRaw.call(this,a,m,o)})})}registerStructType(e,t){for(let o in t){let a=this.tempKey(),c=t[o];!Array.isArray(c)&&typeof c!="string"&&(t[o]=a,this.registerStructType(a,c))}let r=Object.freeze(t),n=Object.keys(r),{name:i,params:s}=this.parseTypeName(e);return this.registerType(e,function(a,c,d,l){if(!c||c.constructor!==Object)throw new Error(`Expected ${i} to be an Object, got: ${c}`);if(d.length!==s.length)throw new Error(`Incorrect number of generic parameters passed; expected: ${s.length}, got: ${d.length}`);for(let g of n){if(!(g in c))throw new Error(`Struct ${i} requires field ${g}:${r[g]}`);const{name:m,params:y}=this.parseTypeName(r[g]);if(!s.includes(m))this.getTypeInterface(m)._encodeRaw.call(this,a,c[g],y,l);else{const w=s.indexOf(m);let{name:b,params:f}=this.parseTypeName(d[w]);if(this.hasType(b)){this.getTypeInterface(b)._encodeRaw.call(this,a,c[g],f,l);continue}if(!(b in l))throw new Error(`Unable to find a matching type definition for ${b} in ${i}; make sure you passed a generic`);let{name:x,params:C}=this.parseTypeName(l[b]);this.getTypeInterface(x)._encodeRaw.call(this,a,c[g],C,l)}}return a},function(a,c,d){if(c.length!==s.length)throw new Error(`Incorrect number of generic parameters passed; expected: ${s.length}, got: ${c.length}`);let l={};for(let g of n){const{name:m,params:y}=this.parseTypeName(r[g]);if(!s.includes(m))l[g]=this.getTypeInterface(m)._decodeRaw.call(this,a,y,d);else{const w=s.indexOf(m);let{name:b,params:f}=this.parseTypeName(c[w]);if(this.hasType(b)){l[g]=this.getTypeInterface(b)._decodeRaw.call(this,a,f,d);continue}if(!(b in d))throw new Error(`Unable to find a matching type definition for ${b} in ${i}; make sure you passed a generic`);let{name:x,params:C}=this.parseTypeName(d[b]);l[g]=this.getTypeInterface(x)._decodeRaw.call(this,a,C,d)}}return l})}registerEnumType(e,t){for(let o in t){let a=this.tempKey(),c=t[o];c!==null&&!Array.isArray(c)&&typeof c!="string"&&(t[o]=a,this.registerStructType(a,c))}let r=Object.freeze(t),n=Object.keys(r),{name:i,params:s}=this.parseTypeName(e);return this.registerType(e,function(a,c,d,l){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(" | ")}".
@@ -1,9 +1,9 @@
1
1
  var Nt = Object.defineProperty;
2
2
  var Dt = (s, e, t) => e in s ? Nt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
3
  var Z = (s, e, t) => (Dt(s, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { n as b, aH as C, aI as p, aJ as y, aK as U, aL as T, aM as X, aN as ae, aO as H, aP as st, aQ as j, a2 as W, aF as Ae, aG as qe, aR as he, aS as Wt, aT as zt, aU as Lt, aV as Ut, aW as Ft, cb as Ve, c9 as qt, ca as Vt, ce as rt, d as se, cj as He, c1 as at, at as Ht, c2 as je, c0 as jt, c3 as Ge } from "./index-CeFWxpd6.mjs";
5
- import { r as Gt } from "./chain-DKCnEQGr.mjs";
6
- import { a as xe, S as $t, b as Jt, _ as Xt } from "./solana-BKu7ZEyd.mjs";
4
+ import { n as b, aH as C, aI as p, aJ as y, aK as U, aL as T, aM as X, aN as ae, aO as H, aP as st, aQ as j, a2 as W, aF as Ae, aG as qe, aR as he, aS as Wt, aT as zt, aU as Lt, aV as Ut, aW as Ft, cb as Ve, c9 as qt, ca as Vt, ce as rt, d as se, cj as He, c1 as at, at as Ht, c2 as je, c0 as jt, c3 as Ge } from "./index-CqaNSRi8.mjs";
5
+ import { r as Gt } from "./chain-CVIItqOT.mjs";
6
+ import { a as xe, S as $t, b as Jt, _ as Xt } from "./solana-BmZEcITF.mjs";
7
7
  import { c as it } from "./index-DpFNxVts.mjs";
8
8
  class Yt extends TypeError {
9
9
  constructor(e, t) {
@@ -0,0 +1 @@
1
+ "use strict";const me=Symbol(),se=Object.getPrototypeOf,G=new WeakMap,he=e=>e&&(G.has(e)?G.get(e):se(e)===Object.prototype||se(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,ne=(e,t=!0)=>{G.set(e,t)};var H={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1,REACT_APP_CONNECT_VERSION:"0.3.13-beta.0-development"};const F=e=>typeof e=="object"&&e!==null,A=new WeakMap,x=new WeakSet,be=(e=Object.is,t=(n,g)=>new Proxy(n,g),s=n=>F(n)&&!x.has(n)&&(Array.isArray(n)||!(Symbol.iterator in n))&&!(n instanceof WeakMap)&&!(n instanceof WeakSet)&&!(n instanceof Error)&&!(n instanceof Number)&&!(n instanceof Date)&&!(n instanceof String)&&!(n instanceof RegExp)&&!(n instanceof ArrayBuffer),r=n=>{switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:throw n}},l=new WeakMap,c=(n,g,I=r)=>{const v=l.get(n);if((v==null?void 0:v[0])===g)return v[1];const w=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n));return ne(w,!0),l.set(n,[g,w]),Reflect.ownKeys(n).forEach(k=>{if(Object.getOwnPropertyDescriptor(w,k))return;const L=Reflect.get(n,k),M={value:L,enumerable:!0,configurable:!0};if(x.has(L))ne(L,!1);else if(L instanceof Promise)delete M.value,M.get=()=>I(L);else if(A.has(L)){const[b,q]=A.get(L);M.value=c(b,q(),I)}Object.defineProperty(w,k,M)}),Object.preventExtensions(w)},m=new WeakMap,f=[1,1],W=n=>{if(!F(n))throw new Error("object required");const g=m.get(n);if(g)return g;let I=f[0];const v=new Set,w=(a,i=++f[0])=>{I!==i&&(I=i,v.forEach(o=>o(a,i)))};let k=f[1];const L=(a=++f[1])=>(k!==a&&!v.size&&(k=a,b.forEach(([i])=>{const o=i[1](a);o>I&&(I=o)})),I),M=a=>(i,o)=>{const h=[...i];h[1]=[a,...h[1]],w(h,o)},b=new Map,q=(a,i)=>{if((H?"production":void 0)!=="production"&&b.has(a))throw new Error("prop listener already exists");if(v.size){const o=i[3](M(a));b.set(a,[i,o])}else b.set(a,[i])},te=a=>{var i;const o=b.get(a);o&&(b.delete(a),(i=o[1])==null||i.call(o))},pe=a=>(v.add(a),v.size===1&&b.forEach(([o,h],N)=>{if((H?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const R=o[3](M(N));b.set(N,[o,R])}),()=>{v.delete(a),v.size===0&&b.forEach(([o,h],N)=>{h&&(h(),b.set(N,[o]))})}),J=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),$=t(J,{deleteProperty(a,i){const o=Reflect.get(a,i);te(i);const h=Reflect.deleteProperty(a,i);return h&&w(["delete",[i],o]),h},set(a,i,o,h){const N=Reflect.has(a,i),R=Reflect.get(a,i,h);if(N&&(e(R,o)||m.has(o)&&e(R,m.get(o))))return!0;te(i),F(o)&&(o=ge(o)||o);let V=o;if(o instanceof Promise)o.then(C=>{o.status="fulfilled",o.value=C,w(["resolve",[i],C])}).catch(C=>{o.status="rejected",o.reason=C,w(["reject",[i],C])});else{!A.has(o)&&s(o)&&(V=W(o));const C=!x.has(V)&&A.get(V);C&&q(i,C)}return Reflect.set(a,i,V,h),w(["set",[i],o,R]),!0}});m.set(n,$);const fe=[J,L,c,pe];return A.set($,fe),Reflect.ownKeys(n).forEach(a=>{const i=Object.getOwnPropertyDescriptor(n,a);"value"in i&&($[a]=n[a],delete i.value,delete i.writable),Object.defineProperty(J,a,i)}),$})=>[W,A,x,e,t,s,r,l,c,m,f],[ye]=be();function j(e={}){return ye(e)}function D(e,t,s){const r=A.get(e);(H?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let l;const c=[],m=r[3];let f=!1;const n=m(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,n()}}function ve(e,t){const s=A.get(e);(H?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[r,l,c]=s;return c(r,l(),t)}const d=j({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),ee={state:d,subscribe(e){return D(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},u={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return u.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return u.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(u.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!u.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(u.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(u.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(u.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(u.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=ee.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=j({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),ue={state:p,subscribe(e){return D(p.events,()=>e(ve(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},O=j({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),y={state:O,subscribe(e){return D(O,()=>e(O))},setChains(e){O.chains=e},setWalletConnectUri(e){O.walletConnectUri=e},setIsCustomDesktop(e){O.isCustomDesktop=e},setIsCustomMobile(e){O.isCustomMobile=e},setIsDataLoaded(e){O.isDataLoaded=e},setIsUiLoaded(e){O.isUiLoaded=e},setIsAuth(e){O.isAuth=e}},B=j({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),P={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;ue.initialize(),y.setChains(e.chains),y.setIsAuth(!!e.enableAuthMode),y.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),y.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),u.setModalVersionInStorage(),Object.assign(B,e)}};var Ie=Object.defineProperty,oe=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Le=(e,t)=>{for(var s in t||(t={}))Oe.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Ee.call(t,s)&&re(e,s,t[s]);return e};const Q="https://explorer-api.walletconnect.com",X="wcm",Y="js-2.6.2";async function K(e,t){const s=Le({sdkType:X,sdkVersion:Y},t),r=new URL(e,Q);return r.searchParams.append("projectId",P.state.projectId),Object.entries(s).forEach(([l,c])=>{c&&r.searchParams.append(l,String(c))}),(await fetch(r)).json()}const U={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${Q}/w3m/v1/getWalletImage/${e}?projectId=${P.state.projectId}&sdkType=${X}&sdkVersion=${Y}`},getAssetImageUrl(e){return`${Q}/w3m/v1/getAssetImage/${e}?projectId=${P.state.projectId}&sdkType=${X}&sdkVersion=${Y}`}};var We=Object.defineProperty,ie=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,ae=(e,t,s)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&ae(e,s,t[s]);if(ie)for(var s of ie(t))Ae.call(t,s)&&ae(e,s,t[s]);return e};const le=u.isMobile(),E=j({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Me={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=P.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(u.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await U.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const f=e.indexOf(c.id),W=e.indexOf(m.id);return f-W}),E.recomendedWallets=l}else{const{chains:s,isAuth:r}=y.state,l=s==null?void 0:s.join(","),c=u.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:u.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=le?await U.getMobileListings(m):await U.getDesktopListings(m);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=je({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=P.state,{recomendedWallets:l}=E;if(r==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):u.isArray(s)&&(t.excludedIds=s.join(",")),u.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),y.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:f,total:W}=le?await U.getMobileListings(t):await U.getDesktopListings(t),n=Object.values(f),g=m?"search":"wallets";return E[g]={listings:[...E[g].listings,...n],total:W,page:c??1},{listings:n,total:W}},getWalletImageUrl(e){return U.getWalletImageUrl(e)},getAssetImageUrl(e){return U.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},_=j({open:!1}),z={state:_,subscribe(e){return D(_,()=>e(_))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=y.state;if(u.removeWalletConnectDeepLink(),y.setWalletConnectUri(e==null?void 0:e.uri),y.setChains(e==null?void 0:e.chains),ee.reset("ConnectWallet"),s&&r)_.open=!0,t();else{const l=setInterval(()=>{const c=y.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),_.open=!0,t())},200)}})},close(){_.open=!1}};var Ue=Object.defineProperty,ce=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,de=(e,t,s)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,De=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&de(e,s,t[s]);if(ce)for(var s of ce(t))Pe.call(t,s)&&de(e,s,t[s]);return e};function ke(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const T=j({themeMode:ke()?"dark":"light"}),Z={state:T,subscribe(e){return D(T,()=>e(T))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(T.themeMode=t),s&&(T.themeVariables=De({},s))}},S=j({open:!1,message:"",variant:"success"}),Ne={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class _e{constructor(t){this.openModal=z.open,this.closeModal=z.close,this.subscribeModal=z.subscribe,this.setTheme=Z.setThemeConfig,Z.setThemeConfig(t),P.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(()=>require("./index-j4_UFrLd.js"));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),y.setIsUiLoaded(!0)}}}const Re=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:_e},Symbol.toStringTag,{value:"Module"}));exports.R=ue;exports.T=ee;exports.a=u;exports.index=Re;exports.ne=Z;exports.oe=Ne;exports.p=y;exports.se=z;exports.te=Me;exports.y=P;
@@ -1 +1 @@
1
- "use strict";var U=Object.defineProperty;var R=(T,n,e)=>n in T?U(T,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):T[n]=e;var A=(T,n,e)=>(R(T,typeof n!="symbol"?n+"":n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-BxnXFplu.js"),t=require("./index-BzrMFsLZ.js"),c=require("./algorand-eXccnrCU.js"),q=require("./chain-D5AOvPgB.js"),W=t.ABIMethod.fromSignature("portal_transfer(byte[])byte[]"),g=class g{constructor(n,e,r,s){A(this,"network");A(this,"chain");A(this,"connection");A(this,"contracts");A(this,"chainId");A(this,"coreBridge");A(this,"coreAppId");A(this,"coreAppAddress");A(this,"tokenBridgeAppId");A(this,"tokenBridgeAddress");if(this.network=n,this.chain=e,this.connection=r,this.contracts=s,this.chainId=t.toChainId(e),!s.coreBridge)throw new Error(`Core contract address for chain ${e} not found`);const i=BigInt(s.coreBridge);if(this.coreAppId=i,this.coreAppAddress=t.getApplicationAddress(i),this.coreBridge=new p.AlgorandWormholeCore(n,e,r,s),!s.tokenBridge)throw new Error(`TokenBridge contract address for chain ${e} not found`);const a=BigInt(s.tokenBridge);this.tokenBridgeAppId=a,this.tokenBridgeAddress=t.getApplicationAddress(a)}static async fromRpc(n,e){const[r,s]=await c.AlgorandPlatform.chainFromRpc(n),i=e[s];if(i.network!==r)throw new Error(`Network mismatch: ${i.network} != ${r}`);return new g(r,s,n,i.contracts)}async isWrappedAsset(n){const e=new c.AlgorandAddress(n).toInt();if(e===0)return!1;const r=await this.connection.getAssetByID(e).do(),i=t.Asset.from_obj_for_encoding(r).params.creator,a=await this.connection.accountInformation(i).exclude("all").do(),o=t.Account.from_obj_for_encoding(a);return(o==null?void 0:o.authAddr)===this.tokenBridgeAddress}async getOriginalAsset(n){const e=new c.AlgorandAddress(n).toInt(),r=await this.connection.getAssetByID(e).do(),s=t.Asset.from_obj_for_encoding(r),i=await p.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,s.params.creator);if(i.length<94)throw new Error("Invalid local state data");const a=i.slice(92,94),o=t.toChain(t.bignum.decode(a)),l=new t.UniversalAddress(i.slice(60,92));return{chain:o,address:l}}async getWrappedAsset(n){const e=p.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,n),r=await p.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,e.address());if(r.length<8)throw new Error("Invalid wrapped asset data");return t.toNative(this.chain,t.bignum.decode(r.slice(0,8)).toString())}async hasWrappedAsset(n){try{return await this.getWrappedAsset(n),!0}catch{}return!1}async getWrappedNative(){return t.toNative(this.chain,"0")}async isTransferCompleted(n){const e=p.StorageLogicSig.forMessageId(this.tokenBridgeAppId,{sequence:n.sequence,chain:n.emitterChain,emitter:n.emitterAddress});try{return await p.StorageLogicSig.checkBitsSet(this.connection,this.tokenBridgeAppId,e.address(),n.sequence)}catch{}return!1}async*createAttestation(n,e){if(!e)throw new Error("Payer required to create attestation");const r=new c.AlgorandAddress(e).toString(),s=new c.AlgorandAddress(n).toInt(),i=[],a=await this.connection.getTransactionParams().do(),o=p.StorageLogicSig.forEmitter(this.coreAppId,new c.AlgorandAddress(this.tokenBridgeAddress).toUint8Array()),{accounts:[l],txs:x}=await p.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.coreAppId,o,a);i.push(...x);let f="",d;if(s!==0){const I=await this.connection.getAssetByID(s).do(),S=t.Asset.from_obj_for_encoding(I),C=await this.connection.accountInformation(S.params.creator).do();if(d=t.Account.from_obj_for_encoding(C),d.authAddr===this.tokenBridgeAddress.toString())throw new Error("Cannot re-attest wormhole assets")}const w=p.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(s)),k=await p.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.tokenBridgeAppId,w);f=k.accounts[0],i.push(...k.txs);const u=t.makeApplicationCallTxnFromObject({from:r,appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:t.OnApplicationComplete.NoOpOC,appArgs:[g.noop],suggestedParams:a});i.push({tx:u});const m=await this.coreBridge.getMessageFee();if(m>BigInt(0)){const I=t.makePaymentTxnWithSuggestedParamsFromObject({from:r,suggestedParams:a,to:this.tokenBridgeAddress,amount:m});i.push({tx:I})}let b=[l,f,this.coreAppAddress];d&&b.push(d.address);let h=t.makeApplicationCallTxnFromObject({appArgs:[g.attestToken,t.bignum.toBytes(s,8)],accounts:b,appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),foreignApps:[c.safeBigIntToNumber(this.coreAppId)],foreignAssets:[s],from:r,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:a});m>BigInt(0)?h.fee*=3:h.fee*=2,i.push({tx:h});for(const I of i)yield this.createUnsignedTx(I,"TokenBridge.createAttestation",!0)}async*submitAttestation(n,e,r){if(!e)throw new Error("Sender required to submit attestation");r||(r=await this.connection.getTransactionParams().do());const s=e.toString(),a=p.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,n.payload.token).address(),o=[],l=[],x=await p.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,a);x.length>8&&l.push(new c.AlgorandAddress(x.slice(0,8)).toInt()),o.push({tx:t.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:a,amount:1e5,suggestedParams:r})});let f=new Uint8Array(1);f[0]=1,o.push({tx:t.makeApplicationCallTxnFromObject({appArgs:[g.noop,f],appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:r})}),f=new Uint8Array(1),f[0]=2,o.push({tx:t.makeApplicationCallTxnFromObject({appArgs:[g.noop,f],appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:r})}),o.push({tx:t.makeApplicationCallTxnFromObject({accounts:[],appArgs:[g.receiveAttest,t.serialize(n)],appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:l,from:s,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:r})}),o[o.length-1].tx.fee=o[o.length-1].tx.fee*2;for(const d of o)yield this.createUnsignedTx(d,"TokenBridge.submitAttestation",!0)}async*transfer(n,e,r,s,i){const a=n.toString(),o=t.isNative(r)?0:new c.AlgorandAddress(r).toInt(),l=s,x=t.toChainId(e.chain),f=e.address.toUniversalAddress().toUint8Array(),d=await this.connection.getTransactionParams().do(),w=BigInt(0),k=p.StorageLogicSig.fromData({appId:this.coreAppId,appAddress:t.decodeAddress(this.coreAppAddress).publicKey,idx:BigInt(0),address:t.decodeAddress(this.tokenBridgeAddress).publicKey}),u=[],{accounts:[m],txs:b}=await p.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.coreAppId,k,d);u.push(...b);let h="",I,S=!1;if(o!==0){const B=await this.connection.getAssetByID(o).do();h=t.Asset.from_obj_for_encoding(B).params.creator;const O=await this.connection.accountInformation(h).do();I=t.Account.from_obj_for_encoding(O),S=I.authAddr===this.tokenBridgeAddress.toString()}const C=await this.coreBridge.getMessageFee();if(C>0&&u.push({tx:t.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:this.tokenBridgeAddress,amount:C,suggestedParams:d})}),!S){const B=p.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(o)),{accounts:[y],txs:O}=await p.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.tokenBridgeAppId,B,d);h=y,O.push(...O)}if(o!==0&&!await g.isOptedInToAsset(this.connection,h,o)){const B=t.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:h,amount:1e5,suggestedParams:d});let y=t.makeApplicationCallTxnFromObject({from:a,appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:t.OnApplicationComplete.NoOpOC,appArgs:[g.optIn,t.bigIntToBytes(o,8)],foreignAssets:[o],accounts:[h],suggestedParams:d});y.fee*=2,u.unshift({tx:B},{tx:y})}const P=t.makeApplicationCallTxnFromObject({from:a,appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:t.OnApplicationComplete.NoOpOC,appArgs:[g.noop],suggestedParams:d});u.push({tx:P});let j=[];if(o===0){const B=t.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:h,amount:l,suggestedParams:d});u.push({tx:B}),j=[m,h,h]}else{const B=t.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:h,amount:l,assetIndex:o,suggestedParams:d});u.push({tx:B}),j=I!=null&&I.address?[m,h,I.address]:[m,h]}const F=[g.sendTransfer,t.bignum.toBytes(o,8),t.bignum.toBytes(l,8),f,t.bignum.toBytes(x,8),t.bignum.toBytes(w,8)];i&&F.push(i);const L=t.makeApplicationCallTxnFromObject({from:a,appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:t.OnApplicationComplete.NoOpOC,appArgs:F,foreignApps:[c.safeBigIntToNumber(this.coreAppId)],foreignAssets:[o],accounts:j,suggestedParams:d});L.fee*=2,u.push({tx:L});for(const B of u)yield this.createUnsignedTx(B,"TokenBridge.transfer",!0)}async*redeem(n,e,r=!0,s){s||(s=await this.connection.getTransactionParams().do());const i=new c.AlgorandAddress(n).toString(),{accounts:a,txs:o}=await p.AlgorandWormholeCore.submitVAAHeader(this.connection,this.coreAppId,this.tokenBridgeAppId,e,i);let l,x="",f=[],d=0;if(e.payload.token.chain!==this.chain){l=p.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,e.payload.token),x=l.address();const m=await p.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,x);d=new c.AlgorandAddress(m.slice(0,8)).toInt()}else{const m=new c.AlgorandAddress(e.payload.token.address).toBigInt();l=p.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,m),x=l.address(),d=c.safeBigIntToNumber(m)}a.push(x);let w=0,k="";if(e.payloadName==="TransferWithPayload"?(w=new c.AlgorandAddress(e.payload.to.address).toInt(),k=t.getApplicationAddress(w)):k=new c.AlgorandAddress(e.payload.to.address.toUint8Array()).toString(),a.push(k),d!==0&&(f.push(d),!await g.isOptedInToAsset(this.connection,k,d))){if(i!=k)throw new Error("Cannot ASA optin for somebody else (asset "+d.toString()+")");o.unshift({tx:t.makeAssetTransferTxnWithSuggestedParamsFromObject({amount:0,assetIndex:d,from:i,suggestedParams:s,to:i})})}const u={accounts:a,appArgs:[g.completeTransfer,t.serialize(e)],appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:f,from:i,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:s};o.push({tx:t.makeApplicationCallTxnFromObject(u)}),o[o.length-1].tx.fee=o[o.length-1].tx.fee*(e.payloadName==="Transfer"&&e.payload.fee!==void 0&&e.payload.fee===0n?2:3),e.payloadName==="TransferWithPayload"&&(o[o.length-1].tx.appForeignApps=[w],o.push({tx:t.makeApplicationCallTxnFromObject({appArgs:[W.getSelector(),W.args[0].type.encode(t.serialize(e))],appIndex:w,foreignAssets:f,from:i,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:s})}));for(const m of o)yield this.createUnsignedTx(m,"TokenBridge.redeem",!0)}static async isOptedInToAsset(n,e,r){var s;try{const i=await n.accountAssetInformation(e,r).do();return(((s=t.AccountAssetResponse.from_obj_for_encoding(i).assetHolding)==null?void 0:s.amount)??0)>0}catch{}return!1}createUnsignedTx(n,e,r=!0){return new p.AlgorandUnsignedTransaction(n,this.network,this.chain,e,r)}};A(g,"sendTransfer",t.bytes.encode("sendTransfer")),A(g,"attestToken",t.bytes.encode("attestToken")),A(g,"noop",t.bytes.encode("nop")),A(g,"optIn",t.bytes.encode("optin")),A(g,"completeTransfer",t.bytes.encode("completeTransfer")),A(g,"receiveAttest",t.bytes.encode("receiveAttest"));let N=g;q.registerProtocol(c._platform,"TokenBridge",N);exports.AlgorandTokenBridge=N;exports.TransferMethodSelector=W;
1
+ "use strict";var U=Object.defineProperty;var R=(T,n,e)=>n in T?U(T,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):T[n]=e;var A=(T,n,e)=>(R(T,typeof n!="symbol"?n+"":n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-CRYmVHnM.js"),t=require("./index-Z109VDLJ.js"),c=require("./algorand-Bl2bjZ-6.js"),q=require("./chain-Bwy1h3yo.js"),W=t.ABIMethod.fromSignature("portal_transfer(byte[])byte[]"),g=class g{constructor(n,e,r,s){A(this,"network");A(this,"chain");A(this,"connection");A(this,"contracts");A(this,"chainId");A(this,"coreBridge");A(this,"coreAppId");A(this,"coreAppAddress");A(this,"tokenBridgeAppId");A(this,"tokenBridgeAddress");if(this.network=n,this.chain=e,this.connection=r,this.contracts=s,this.chainId=t.toChainId(e),!s.coreBridge)throw new Error(`Core contract address for chain ${e} not found`);const i=BigInt(s.coreBridge);if(this.coreAppId=i,this.coreAppAddress=t.getApplicationAddress(i),this.coreBridge=new p.AlgorandWormholeCore(n,e,r,s),!s.tokenBridge)throw new Error(`TokenBridge contract address for chain ${e} not found`);const a=BigInt(s.tokenBridge);this.tokenBridgeAppId=a,this.tokenBridgeAddress=t.getApplicationAddress(a)}static async fromRpc(n,e){const[r,s]=await c.AlgorandPlatform.chainFromRpc(n),i=e[s];if(i.network!==r)throw new Error(`Network mismatch: ${i.network} != ${r}`);return new g(r,s,n,i.contracts)}async isWrappedAsset(n){const e=new c.AlgorandAddress(n).toInt();if(e===0)return!1;const r=await this.connection.getAssetByID(e).do(),i=t.Asset.from_obj_for_encoding(r).params.creator,a=await this.connection.accountInformation(i).exclude("all").do(),o=t.Account.from_obj_for_encoding(a);return(o==null?void 0:o.authAddr)===this.tokenBridgeAddress}async getOriginalAsset(n){const e=new c.AlgorandAddress(n).toInt(),r=await this.connection.getAssetByID(e).do(),s=t.Asset.from_obj_for_encoding(r),i=await p.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,s.params.creator);if(i.length<94)throw new Error("Invalid local state data");const a=i.slice(92,94),o=t.toChain(t.bignum.decode(a)),l=new t.UniversalAddress(i.slice(60,92));return{chain:o,address:l}}async getWrappedAsset(n){const e=p.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,n),r=await p.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,e.address());if(r.length<8)throw new Error("Invalid wrapped asset data");return t.toNative(this.chain,t.bignum.decode(r.slice(0,8)).toString())}async hasWrappedAsset(n){try{return await this.getWrappedAsset(n),!0}catch{}return!1}async getWrappedNative(){return t.toNative(this.chain,"0")}async isTransferCompleted(n){const e=p.StorageLogicSig.forMessageId(this.tokenBridgeAppId,{sequence:n.sequence,chain:n.emitterChain,emitter:n.emitterAddress});try{return await p.StorageLogicSig.checkBitsSet(this.connection,this.tokenBridgeAppId,e.address(),n.sequence)}catch{}return!1}async*createAttestation(n,e){if(!e)throw new Error("Payer required to create attestation");const r=new c.AlgorandAddress(e).toString(),s=new c.AlgorandAddress(n).toInt(),i=[],a=await this.connection.getTransactionParams().do(),o=p.StorageLogicSig.forEmitter(this.coreAppId,new c.AlgorandAddress(this.tokenBridgeAddress).toUint8Array()),{accounts:[l],txs:x}=await p.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.coreAppId,o,a);i.push(...x);let f="",d;if(s!==0){const I=await this.connection.getAssetByID(s).do(),S=t.Asset.from_obj_for_encoding(I),C=await this.connection.accountInformation(S.params.creator).do();if(d=t.Account.from_obj_for_encoding(C),d.authAddr===this.tokenBridgeAddress.toString())throw new Error("Cannot re-attest wormhole assets")}const w=p.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(s)),k=await p.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.tokenBridgeAppId,w);f=k.accounts[0],i.push(...k.txs);const u=t.makeApplicationCallTxnFromObject({from:r,appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:t.OnApplicationComplete.NoOpOC,appArgs:[g.noop],suggestedParams:a});i.push({tx:u});const m=await this.coreBridge.getMessageFee();if(m>BigInt(0)){const I=t.makePaymentTxnWithSuggestedParamsFromObject({from:r,suggestedParams:a,to:this.tokenBridgeAddress,amount:m});i.push({tx:I})}let b=[l,f,this.coreAppAddress];d&&b.push(d.address);let h=t.makeApplicationCallTxnFromObject({appArgs:[g.attestToken,t.bignum.toBytes(s,8)],accounts:b,appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),foreignApps:[c.safeBigIntToNumber(this.coreAppId)],foreignAssets:[s],from:r,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:a});m>BigInt(0)?h.fee*=3:h.fee*=2,i.push({tx:h});for(const I of i)yield this.createUnsignedTx(I,"TokenBridge.createAttestation",!0)}async*submitAttestation(n,e,r){if(!e)throw new Error("Sender required to submit attestation");r||(r=await this.connection.getTransactionParams().do());const s=e.toString(),a=p.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,n.payload.token).address(),o=[],l=[],x=await p.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,a);x.length>8&&l.push(new c.AlgorandAddress(x.slice(0,8)).toInt()),o.push({tx:t.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:a,amount:1e5,suggestedParams:r})});let f=new Uint8Array(1);f[0]=1,o.push({tx:t.makeApplicationCallTxnFromObject({appArgs:[g.noop,f],appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:r})}),f=new Uint8Array(1),f[0]=2,o.push({tx:t.makeApplicationCallTxnFromObject({appArgs:[g.noop,f],appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:r})}),o.push({tx:t.makeApplicationCallTxnFromObject({accounts:[],appArgs:[g.receiveAttest,t.serialize(n)],appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:l,from:s,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:r})}),o[o.length-1].tx.fee=o[o.length-1].tx.fee*2;for(const d of o)yield this.createUnsignedTx(d,"TokenBridge.submitAttestation",!0)}async*transfer(n,e,r,s,i){const a=n.toString(),o=t.isNative(r)?0:new c.AlgorandAddress(r).toInt(),l=s,x=t.toChainId(e.chain),f=e.address.toUniversalAddress().toUint8Array(),d=await this.connection.getTransactionParams().do(),w=BigInt(0),k=p.StorageLogicSig.fromData({appId:this.coreAppId,appAddress:t.decodeAddress(this.coreAppAddress).publicKey,idx:BigInt(0),address:t.decodeAddress(this.tokenBridgeAddress).publicKey}),u=[],{accounts:[m],txs:b}=await p.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.coreAppId,k,d);u.push(...b);let h="",I,S=!1;if(o!==0){const B=await this.connection.getAssetByID(o).do();h=t.Asset.from_obj_for_encoding(B).params.creator;const O=await this.connection.accountInformation(h).do();I=t.Account.from_obj_for_encoding(O),S=I.authAddr===this.tokenBridgeAddress.toString()}const C=await this.coreBridge.getMessageFee();if(C>0&&u.push({tx:t.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:this.tokenBridgeAddress,amount:C,suggestedParams:d})}),!S){const B=p.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(o)),{accounts:[y],txs:O}=await p.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.tokenBridgeAppId,B,d);h=y,O.push(...O)}if(o!==0&&!await g.isOptedInToAsset(this.connection,h,o)){const B=t.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:h,amount:1e5,suggestedParams:d});let y=t.makeApplicationCallTxnFromObject({from:a,appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:t.OnApplicationComplete.NoOpOC,appArgs:[g.optIn,t.bigIntToBytes(o,8)],foreignAssets:[o],accounts:[h],suggestedParams:d});y.fee*=2,u.unshift({tx:B},{tx:y})}const P=t.makeApplicationCallTxnFromObject({from:a,appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:t.OnApplicationComplete.NoOpOC,appArgs:[g.noop],suggestedParams:d});u.push({tx:P});let j=[];if(o===0){const B=t.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:h,amount:l,suggestedParams:d});u.push({tx:B}),j=[m,h,h]}else{const B=t.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:h,amount:l,assetIndex:o,suggestedParams:d});u.push({tx:B}),j=I!=null&&I.address?[m,h,I.address]:[m,h]}const F=[g.sendTransfer,t.bignum.toBytes(o,8),t.bignum.toBytes(l,8),f,t.bignum.toBytes(x,8),t.bignum.toBytes(w,8)];i&&F.push(i);const L=t.makeApplicationCallTxnFromObject({from:a,appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:t.OnApplicationComplete.NoOpOC,appArgs:F,foreignApps:[c.safeBigIntToNumber(this.coreAppId)],foreignAssets:[o],accounts:j,suggestedParams:d});L.fee*=2,u.push({tx:L});for(const B of u)yield this.createUnsignedTx(B,"TokenBridge.transfer",!0)}async*redeem(n,e,r=!0,s){s||(s=await this.connection.getTransactionParams().do());const i=new c.AlgorandAddress(n).toString(),{accounts:a,txs:o}=await p.AlgorandWormholeCore.submitVAAHeader(this.connection,this.coreAppId,this.tokenBridgeAppId,e,i);let l,x="",f=[],d=0;if(e.payload.token.chain!==this.chain){l=p.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,e.payload.token),x=l.address();const m=await p.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,x);d=new c.AlgorandAddress(m.slice(0,8)).toInt()}else{const m=new c.AlgorandAddress(e.payload.token.address).toBigInt();l=p.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,m),x=l.address(),d=c.safeBigIntToNumber(m)}a.push(x);let w=0,k="";if(e.payloadName==="TransferWithPayload"?(w=new c.AlgorandAddress(e.payload.to.address).toInt(),k=t.getApplicationAddress(w)):k=new c.AlgorandAddress(e.payload.to.address.toUint8Array()).toString(),a.push(k),d!==0&&(f.push(d),!await g.isOptedInToAsset(this.connection,k,d))){if(i!=k)throw new Error("Cannot ASA optin for somebody else (asset "+d.toString()+")");o.unshift({tx:t.makeAssetTransferTxnWithSuggestedParamsFromObject({amount:0,assetIndex:d,from:i,suggestedParams:s,to:i})})}const u={accounts:a,appArgs:[g.completeTransfer,t.serialize(e)],appIndex:c.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:f,from:i,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:s};o.push({tx:t.makeApplicationCallTxnFromObject(u)}),o[o.length-1].tx.fee=o[o.length-1].tx.fee*(e.payloadName==="Transfer"&&e.payload.fee!==void 0&&e.payload.fee===0n?2:3),e.payloadName==="TransferWithPayload"&&(o[o.length-1].tx.appForeignApps=[w],o.push({tx:t.makeApplicationCallTxnFromObject({appArgs:[W.getSelector(),W.args[0].type.encode(t.serialize(e))],appIndex:w,foreignAssets:f,from:i,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:s})}));for(const m of o)yield this.createUnsignedTx(m,"TokenBridge.redeem",!0)}static async isOptedInToAsset(n,e,r){var s;try{const i=await n.accountAssetInformation(e,r).do();return(((s=t.AccountAssetResponse.from_obj_for_encoding(i).assetHolding)==null?void 0:s.amount)??0)>0}catch{}return!1}createUnsignedTx(n,e,r=!0){return new p.AlgorandUnsignedTransaction(n,this.network,this.chain,e,r)}};A(g,"sendTransfer",t.bytes.encode("sendTransfer")),A(g,"attestToken",t.bytes.encode("attestToken")),A(g,"noop",t.bytes.encode("nop")),A(g,"optIn",t.bytes.encode("optin")),A(g,"completeTransfer",t.bytes.encode("completeTransfer")),A(g,"receiveAttest",t.bytes.encode("receiveAttest"));let N=g;q.registerProtocol(c._platform,"TokenBridge",N);exports.AlgorandTokenBridge=N;exports.TransferMethodSelector=W;
@@ -1,10 +1,10 @@
1
1
  var d = Object.defineProperty;
2
2
  var h = (i, e, r) => e in i ? d(i, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[e] = r;
3
3
  var n = (i, e, r) => (h(i, typeof e != "symbol" ? e + "" : e, r), r);
4
- import { S as m, o as p, _ as w } from "./sui-D5Lc_xEX.mjs";
5
- import { bp as g } from "./index-CeFWxpd6.mjs";
6
- import { c as l } from "./create-C6FJqFGQ.mjs";
7
- import { r as u } from "./chain-DKCnEQGr.mjs";
4
+ import { S as m, o as p, _ as w } from "./sui-MwjLxOll.mjs";
5
+ import { bp as g } from "./index-CqaNSRi8.mjs";
6
+ import { c as l } from "./create-BRdq6ZSm.mjs";
7
+ import { r as u } from "./chain-CVIItqOT.mjs";
8
8
  class c {
9
9
  constructor(e, r, t, o) {
10
10
  n(this, "network");
@@ -17,10 +17,10 @@ var f1 = (a, e, t, n) => ({
17
17
  return u(a, e, n);
18
18
  }
19
19
  }), N = (a, e, t) => (F6(a, e, "access private method"), t);
20
- import { a as D1 } from "./index-B8QmOEmB.mjs";
21
- import { by as V1, c5 as b1, bp as Z0, c6 as Fe, au as Le, az as E6, c7 as $e, b_ as m6, bO as W1 } from "./index-CeFWxpd6.mjs";
22
- import { E as L0, d as De, a as Q, u as c1, e as c6, b as s0, c as H1, _ as G1 } from "./evm--Jtx_TN_.mjs";
23
- import { r as z1 } from "./chain-DKCnEQGr.mjs";
20
+ import { a as D1 } from "./index-COFhlc-l.mjs";
21
+ import { by as V1, c5 as b1, bp as Z0, c6 as Fe, au as Le, az as E6, c7 as $e, b_ as m6, bO as W1 } from "./index-CqaNSRi8.mjs";
22
+ import { E as L0, d as De, a as Q, u as c1, e as c6, b as s0, c as H1, _ as G1 } from "./evm-UD1FtfQa.mjs";
23
+ import { r as z1 } from "./chain-CVIItqOT.mjs";
24
24
  class Z6 {
25
25
  constructor(e, t, n, r) {
26
26
  o(this, "network");
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./solana-DxZRfZC7.js"),e=require("./index-BzrMFsLZ.js");class s extends Error{constructor(t){super(t)}}class n extends s{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}const u=e.struct([e.u32("mintAuthorityOption"),e.publicKey("mintAuthority"),e.u64("supply"),e.u8("decimals"),e.bool("isInitialized"),e.u32("freezeAuthorityOption"),e.publicKey("freezeAuthority")]);u.span;async function f(o,t,i=!1,O=r.TOKEN_PROGRAM_ID,c=r.ASSOCIATED_TOKEN_PROGRAM_ID){if(!i&&!r.PublicKey.isOnCurve(t.toBuffer()))throw new n;const[a]=await r.PublicKey.findProgramAddress([t.toBuffer(),O.toBuffer(),o.toBuffer()],c);return a}exports.ASSOCIATED_TOKEN_PROGRAM_ID=r.ASSOCIATED_TOKEN_PROGRAM_ID;exports.TOKEN_PROGRAM_ID=r.TOKEN_PROGRAM_ID;exports.MintLayout=u;exports.TokenError=s;exports.TokenOwnerOffCurveError=n;exports.getAssociatedTokenAddress=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./solana-C935JrJy.js"),e=require("./index-Z109VDLJ.js");class s extends Error{constructor(t){super(t)}}class n extends s{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}const u=e.struct([e.u32("mintAuthorityOption"),e.publicKey("mintAuthority"),e.u64("supply"),e.u8("decimals"),e.bool("isInitialized"),e.u32("freezeAuthorityOption"),e.publicKey("freezeAuthority")]);u.span;async function f(o,t,i=!1,O=r.TOKEN_PROGRAM_ID,c=r.ASSOCIATED_TOKEN_PROGRAM_ID){if(!i&&!r.PublicKey.isOnCurve(t.toBuffer()))throw new n;const[a]=await r.PublicKey.findProgramAddress([t.toBuffer(),O.toBuffer(),o.toBuffer()],c);return a}exports.ASSOCIATED_TOKEN_PROGRAM_ID=r.ASSOCIATED_TOKEN_PROGRAM_ID;exports.TOKEN_PROGRAM_ID=r.TOKEN_PROGRAM_ID;exports.MintLayout=u;exports.TokenError=s;exports.TokenOwnerOffCurveError=n;exports.getAssociatedTokenAddress=f;