@wormhole-foundation/wormhole-connect 0.3.19-beta.1-development → 0.3.19-beta.3-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.
- package/dist/assets/{ccip-CC5KdnX-.js → ccip-B8sh0red.js} +1 -1
- package/dist/assets/cosmos-CZk6ggNU.js +37 -0
- package/dist/assets/{cosmwasm-D6dc3HhR.js → cosmwasm-BRgXJAEm.js} +3 -3
- package/dist/assets/{ens-validation.es6-JeiZhPFM.js → ens-validation.es6-CEldkK56.js} +1 -1
- package/dist/assets/{evm-scnxy1Tm.js → evm-B3YdeaCI.js} +4 -4
- package/dist/assets/{index-DcrZhJuV.js → index-1ZJmfQkw.js} +2 -2
- package/dist/assets/{index-CfFB0O_w.js → index-2haya2pd.js} +1 -1
- package/dist/assets/{index-DdlsdoUO.js → index-BSZP2fsz.js} +1 -1
- package/dist/assets/{index-CYsDCGyL.js → index-BUfxN-fw.js} +1 -1
- package/dist/assets/index-CoAwWRVw.js +3 -0
- package/dist/assets/{index-CZGBtcJ2.js → index-moDeJTxm.js} +1 -1
- package/dist/assets/{index.es-CkKy_bC0.js → index.es-CXmj0UJy.js} +2 -2
- package/dist/assets/{solana-DJERwdo1.js → solana-ClUmAbQX.js} +2 -2
- package/dist/assets/{solanaEmbed.esm-CYzxDEiX.js → solanaEmbed.esm-BpCHncZo.js} +1 -1
- package/dist/assets/{unsignedTransaction-Bbs3hbtB.js → unsignedTransaction-C5QlrOSq.js} +1 -1
- package/dist/main.js +10 -10
- package/dist/src/components/TokensModal.d.ts.map +1 -1
- package/dist/src/telemetry/types.d.ts +1 -0
- package/dist/src/telemetry/types.d.ts.map +1 -1
- package/dist/src/views/Bridge/Send.d.ts.map +1 -1
- package/lib/{algorand-BEj3eMlU.js → algorand-BDR3KPTJ.js} +1 -1
- package/lib/{algorand-Cn2ASQM8.mjs → algorand-CNPRWbNB.mjs} +4 -4
- package/lib/{aptos-B4K8HU4y.mjs → aptos-BPs26BCC.mjs} +1 -1
- package/lib/{aptos-C5usxwjg.js → aptos-Br9Q1n2N.js} +1 -1
- package/lib/{aptos-r2dqWkwd.mjs → aptos-t3uXFwih.mjs} +4 -4
- package/lib/{aptos-CgcrUUs6.js → aptos-tCZHrDAP.js} +2 -2
- package/lib/{browser-CqNEk73A.mjs → browser-33Nc32cs.mjs} +2 -2
- package/lib/{browser-9qSlzcs1.js → browser-Cz60hQ-L.js} +1 -1
- package/lib/{ccip-Cg8GiGjJ.mjs → ccip-CE49B2YD.mjs} +1 -1
- package/lib/{ccip-DiTkor0v.js → ccip-CtmuOQGX.js} +1 -1
- package/lib/{chain-BS9tnRQF.js → chain-BT07YJHt.js} +1 -1
- package/lib/{chain-CNimQoal.mjs → chain-CbwtJlkc.mjs} +1 -1
- package/lib/{cosmos-kdBLlX5J.mjs → cosmos-LlwNYP69.mjs} +6 -6
- package/lib/cosmos-t65H2NQC.js +37 -0
- package/lib/{cosmwasm-BdmGrQe2.mjs → cosmwasm-CbTKetWD.mjs} +6 -6
- package/lib/{cosmwasm-t4y0gzD9.js → cosmwasm-CiJ3I3AY.js} +2 -2
- package/lib/{create-BC4-6NQa.js → create-Chqnlpoq.js} +1 -1
- package/lib/{create-Bh45gqri.mjs → create-HNw0Emrd.mjs} +1 -1
- package/lib/{ens-validation.es6-B5lcZ1z0.js → ens-validation.es6-BaZUabxu.js} +1 -1
- package/lib/{ens-validation.es6-BBk1nSK3.mjs → ens-validation.es6-CyEOHc9J.mjs} +2 -2
- package/lib/{evm-ByfaloPB.js → evm-3AGyBI-h.js} +2 -2
- package/lib/{evm-Cplwt-Uu.js → evm-CNC7JHe1.js} +4 -4
- package/lib/{evm-CI9jvgpD.mjs → evm-CjvzIUCn.mjs} +6 -6
- package/lib/{evm-BdLUkbt8.mjs → evm-lHNM4jqm.mjs} +6 -6
- package/lib/{index-CitMOybO.js → index-0t31FGKV.js} +1 -1
- package/lib/{index-CeYAnGJU.js → index-35qsyZLz.js} +1 -1
- package/lib/{index-Bjg2w3Jp.mjs → index-B6m0ovID.mjs} +2 -2
- package/lib/{index-DuPl6mJy.mjs → index-B9L2kltl.mjs} +4 -4
- package/lib/{index-D3leTI6y.js → index-B9gw1I6s.js} +1 -1
- package/lib/{index-tFdU3m1V.js → index-BBtf8VGl.js} +1 -1
- package/lib/{index-LbkpxbxU.js → index-BCSt_UXY.js} +1 -1
- package/lib/{index-dgxqH4Al.mjs → index-BCnyHegg.mjs} +4 -4
- package/lib/{index-DHNJ7dTI.mjs → index-BH5gBrJu.mjs} +3 -3
- package/lib/{index-BTJEpkGu.mjs → index-BS1tjK_Z.mjs} +5 -5
- package/lib/{index-DKqdtMJw.mjs → index-BWsL77BI.mjs} +3 -3
- package/lib/{index-v5JYqN5T.js → index-Bfw-brA6.js} +1 -1
- package/lib/{index-JCeZURsa.mjs → index-Bk7wdRtH.mjs} +3 -3
- package/lib/index-Bp0NhDcb.js +3 -0
- package/lib/{index-D2283Eib.js → index-BpuXk_6h.js} +1 -1
- package/lib/{index-RHlQCTsY.js → index-BqGvvv6N.js} +1 -1
- package/lib/{index-_ey36AjY.mjs → index-C4kvGnSA.mjs} +2 -2
- package/lib/{index-Vqfiz4gq.js → index-CACyup9A.js} +1 -1
- package/lib/{index-DULgLsXD.mjs → index-CGLAoOXl.mjs} +4 -4
- package/lib/{index-DWqHObYQ.js → index-CO9tmWap.js} +1 -1
- package/lib/{index-DO9Aqf4O.js → index-CYap2RXm.js} +1 -1
- package/lib/{index-6SYLbVVC.mjs → index-CbCfazgA.mjs} +5 -5
- package/lib/{index-DjJSdBO_.mjs → index-CdSy2Lfd.mjs} +101 -91
- package/lib/{index-B11tXNbe.mjs → index-CjyrCdi_.mjs} +72 -72
- package/lib/{index-W5vGD3Jp.js → index-Cofatf_w.js} +1 -1
- package/lib/{index-D10P63La.mjs → index-CokIAiMa.mjs} +4 -4
- package/lib/{index-CLqwNevH.mjs → index-Cp5np38p.mjs} +1 -1
- package/lib/{index-BAfpfiMg.mjs → index-D1dHZqit.mjs} +4 -4
- package/lib/{index-CyoAaX76.js → index-DCPwTd_i.js} +1 -1
- package/lib/{index-Cms5l5e9.mjs → index-DGRaAUXo.mjs} +2 -2
- package/lib/{index-DonnLcua.mjs → index-DJzhcNDU.mjs} +6 -6
- package/lib/{index-BskUJ6-F.js → index-DPNt5r2L.js} +1 -1
- package/lib/{index-DVzNMQU2.mjs → index-DRTx-Ru8.mjs} +4 -4
- package/lib/{index-D4polzlG.mjs → index-DVH-ZIP6.mjs} +4 -4
- package/lib/{index-D05MUiKM.js → index-DVVJw5ml.js} +1 -1
- package/lib/{index-DC95G-Xg.js → index-Dbwiqljw.js} +1 -1
- package/lib/{index-DJoVr9ew.mjs → index-DfJLd65b.mjs} +4 -4
- package/lib/{index-DkHNYEwj.js → index-DrncQYMG.js} +1 -1
- package/lib/{index-ClpF6w41.mjs → index-DvUq-nIQ.mjs} +5 -5
- package/lib/{index-Cpfo_13K.js → index-Tl7zYqHL.js} +9 -9
- package/lib/{index-CZM1nqSC.js → index-UOSBfEgg.js} +1 -1
- package/lib/{index-CiNv_vqX.js → index-abvwfKBf.js} +1 -1
- package/lib/{index-Cc-SRhQH.mjs → index-dJMYtBle.mjs} +4 -4
- package/lib/{index--XOWHvs8.js → index-l_e-RUun.js} +1 -1
- package/lib/{index-L-oyxcKw.mjs → index-zKUpU-3R.mjs} +4 -4
- package/lib/{index-BdZfdhLf.js → index-ztQgUCWf.js} +1 -1
- package/lib/{index.es-D641bRIm.js → index.es-494n2GDU.js} +2 -2
- package/lib/{index.es-CE_sbvG3.mjs → index.es-DnXnnX-i.mjs} +4 -4
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{libsodium-wrappers-DLsfT6wH.mjs → libsodium-wrappers-9p7NdjLu.mjs} +1 -1
- package/lib/{libsodium-wrappers-Dv4avoYQ.js → libsodium-wrappers-Dechaffz.js} +1 -1
- package/lib/{sei-BgefK64I.js → sei-DORxBQd-.js} +1 -1
- package/lib/{sei-DSmG2Vzd.mjs → sei-SWKTnPTF.mjs} +2 -2
- package/lib/{solana-cDD0Ny2l.js → solana-Bd9eRY8E.js} +2 -2
- package/lib/{solana--NAZIp_H.mjs → solana-DvbMa7B_.mjs} +3 -3
- package/lib/{solana-D-xykBVb.js → solana-KhBV5LOd.js} +1 -1
- package/lib/{solana-DGHdzU4Y.mjs → solana-T2pgCVfU.mjs} +6 -6
- package/lib/{solanaEmbed.esm-CvJOxxKf.mjs → solanaEmbed.esm-8eZSo5K2.mjs} +2 -2
- package/lib/{solanaEmbed.esm-SQGeqX2v.js → solanaEmbed.esm-CnKFJhsj.js} +1 -1
- package/lib/src/components/TokensModal.d.ts.map +1 -1
- package/lib/src/telemetry/types.d.ts +1 -0
- package/lib/src/telemetry/types.d.ts.map +1 -1
- package/lib/src/views/Bridge/Send.d.ts.map +1 -1
- package/lib/{sui-CitobCk-.js → sui-B382sZz0.js} +1 -1
- package/lib/{sui-CabK_MAW.mjs → sui-CjRGl9Gg.mjs} +1 -1
- package/lib/{sui-CnL17qoE.mjs → sui-DDu4a1uc.mjs} +4 -4
- package/lib/{sui-Bn1nWU88.js → sui-DwH1wYGH.js} +2 -2
- package/lib/{unsignedTransaction-Bl6mVw94.mjs → unsignedTransaction-BbAfXtog.mjs} +2 -2
- package/lib/{unsignedTransaction-wkSutsdc.js → unsignedTransaction-mu6HJcHt.js} +1 -1
- package/package.json +1 -1
- package/dist/assets/cosmos-CKUC0334.js +0 -37
- package/dist/assets/index-DTubKMVE.js +0 -3
- package/lib/cosmos-DAYdruCU.js +0 -37
- package/lib/index-DTYdWw1E.js +0 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var yt=Object.defineProperty;var pt=(r,e,t)=>e in r?yt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var V=(r,e,t)=>(pt(r,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-Cpfo_13K.js"),ht=require("./chain-BS9tnRQF.js"),$=require("./solana-cDD0Ny2l.js"),Le=require("./index-DnneI5--.js");class bt extends TypeError{constructor(e,t){let s;const{message:i,...a}=e,{path:u}=e,m=u.length===0?i:"At path: "+u.join(".")+" -- "+i;super(m),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>{var l;return(l=s)!=null?l:s=[e,...t()]}}}function St(r){return q(r)&&typeof r[Symbol.iterator]=="function"}function q(r){return typeof r=="object"&&r!=null}function W(r){return typeof r=="string"?JSON.stringify(r):""+r}function kt(r){const{done:e,value:t}=r.next();return e?void 0:t}function Mt(r,e,t,s){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:i,branch:a}=e,{type:u}=t,{refinement:m,message:l="Expected a value of type `"+u+"`"+(m?" with refinement `"+m+"`":"")+", but received: `"+W(s)+"`"}=r;return{value:s,type:u,refinement:m,key:i[i.length-1],path:i,branch:a,...r,message:l}}function*Re(r,e,t,s){St(r)||(r=[r]);for(const i of r){const a=Mt(i,e,t,s);a&&(yield a)}}function*ke(r,e,t={}){const{path:s=[],branch:i=[r],coerce:a=!1,mask:u=!1}=t,m={path:s,branch:i};if(a&&(r=e.coercer(r,m),u&&e.type!=="type"&&q(e.schema)&&q(r)&&!Array.isArray(r)))for(const b in r)e.schema[b]===void 0&&delete r[b];let l=!0;for(const b of e.validator(r,m))l=!1,yield[b,void 0];for(let[b,k,M]of e.entries(r,m)){const I=ke(k,M,{path:b===void 0?s:[...s,b],branch:b===void 0?i:[...i,k],coerce:a,mask:u});for(const v of I)v[0]?(l=!1,yield[v[0],void 0]):a&&(k=v[1],b===void 0?r=k:r instanceof Map?r.set(b,k):r instanceof Set?r.add(k):q(r)&&(r[b]=k))}if(l)for(const b of e.refiner(r,m))l=!1,yield[b,void 0];l&&(yield[void 0,r])}let U=class{constructor(e){const{type:t,schema:s,validator:i,refiner:a,coercer:u=l=>l,entries:m=function*(){}}=e;this.type=t,this.schema=s,this.entries=m,this.coercer=u,i?this.validator=(l,b)=>{const k=i(l,b);return Re(k,b,this,l)}:this.validator=()=>[],a?this.refiner=(l,b)=>{const k=a(l,b);return Re(k,b,this,l)}:this.refiner=()=>[]}assert(e){return wt(e,this)}create(e){return re(e,this)}is(e){return Ue(e,this)}mask(e){return Pt(e,this)}validate(e,t={}){return oe(e,this,t)}};function wt(r,e){const t=oe(r,e);if(t[0])throw t[0]}function re(r,e){const t=oe(r,e,{coerce:!0});if(t[0])throw t[0];return t[1]}function Pt(r,e){const t=oe(r,e,{coerce:!0,mask:!0});if(t[0])throw t[0];return t[1]}function Ue(r,e){return!oe(r,e)[0]}function oe(r,e,t={}){const s=ke(r,e,t),i=kt(s);return i[0]?[new bt(i[0],function*(){for(const u of s)u[0]&&(yield u[0])}),void 0]:[void 0,i[1]]}function H(r,e){return new U({type:r,schema:null,validator:e})}function At(){return H("any",()=>!0)}function g(r){return new U({type:"array",schema:r,*entries(e){if(r&&Array.isArray(e))for(const[t,s]of e.entries())yield[t,s,r]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||"Expected an array value, but received: "+W(e)}})}function L(){return H("boolean",r=>typeof r=="boolean")}function Me(r){return H("instance",e=>e instanceof r||"Expected a `"+r.name+"` instance, but received: "+W(e))}function A(r){const e=W(r),t=typeof r;return new U({type:"literal",schema:t==="string"||t==="number"||t==="boolean"?r:null,validator(s){return s===r||"Expected the literal `"+e+"`, but received: "+W(s)}})}function It(){return H("never",()=>!1)}function f(r){return new U({...r,validator:(e,t)=>e===null||r.validator(e,t),refiner:(e,t)=>e===null||r.refiner(e,t)})}function o(){return H("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+W(r))}function p(r){return new U({...r,validator:(e,t)=>e===void 0||r.validator(e,t),refiner:(e,t)=>e===void 0||r.refiner(e,t)})}function qe(r,e){return new U({type:"record",schema:null,*entries(t){if(q(t))for(const s in t){const i=t[s];yield[s,s,r],yield[s,i,e]}},validator(t){return q(t)||"Expected an object, but received: "+W(t)}})}function d(){return H("string",r=>typeof r=="string"||"Expected a string, but received: "+W(r))}function we(r){const e=It();return new U({type:"tuple",schema:null,*entries(t){if(Array.isArray(t)){const s=Math.max(r.length,t.length);for(let i=0;i<s;i++)yield[i,t[i],r[i]||e]}},validator(t){return Array.isArray(t)||"Expected an array, but received: "+W(t)}})}function c(r){const e=Object.keys(r);return new U({type:"type",schema:r,*entries(t){if(q(t))for(const s of e)yield[s,t[s],r[s]]},validator(t){return q(t)||"Expected an object, but received: "+W(t)}})}function R(r){const e=r.map(t=>t.type).join(" | ");return new U({type:"union",schema:null,validator(t,s){const i=[];for(const a of r){const[...u]=ke(t,a,s),[m]=u;if(m[0])for(const[l]of u)l&&i.push(l);else return[]}return["Expected the value to satisfy a union of `"+e+"`, but received: "+W(t),...i]}})}function ue(){return H("unknown",()=>!0)}function ce(r,e,t){return new U({...r,coercer:(s,i)=>Ue(s,e)?r.coercer(t(s,i),i):r.coercer(s,i)})}const Ee=()=>{const r=n.ed25519.utils.randomPrivateKey(),e=he(r),t=new Uint8Array(64);return t.set(r),t.set(e,32),{publicKey:e,secretKey:t}},he=n.ed25519.getPublicKey;function Ce(r){try{return n.ed25519.ExtendedPoint.fromHex(r),!0}catch{return!1}}const vt=(r,e)=>n.ed25519.sign(r,e.slice(0,32)),Tt=n.ed25519.verify,K=r=>n.bufferPolyfill.Buffer.isBuffer(r)?r:r instanceof Uint8Array?n.bufferPolyfill.Buffer.from(r.buffer,r.byteOffset,r.byteLength):n.bufferPolyfill.Buffer.from(r);class xt{constructor(e){Object.assign(this,e)}encode(){return n.bufferPolyfill.Buffer.from(n.serialize_1(de,this))}static decode(e){return n.deserialize_1(de,this,e)}static decodeUnchecked(e){return n.deserializeUnchecked_1(de,this,e)}}const de=new Map;var Fe;let Ve;const Bt=32,ne=32;function Kt(r){return r._bn!==void 0}let Oe=1;Ve=Symbol.toStringTag;class y extends xt{constructor(e){if(super({}),this._bn=void 0,Kt(e))this._bn=e._bn;else{if(typeof e=="string"){const t=n.bs58.decode(e);if(t.length!=ne)throw new Error("Invalid public key input");this._bn=new n.BN(t)}else this._bn=new n.BN(e);if(this._bn.byteLength()>ne)throw new Error("Invalid public key input")}}static unique(){const e=new y(Oe);return Oe+=1,new y(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return n.bs58.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){const e=this._bn.toArrayLike(n.bufferPolyfill.Buffer);if(e.length===ne)return e;const t=n.bufferPolyfill.Buffer.alloc(32);return e.copy(t,32-e.length),t}get[Ve](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,t,s){const i=n.bufferPolyfill.Buffer.concat([e.toBuffer(),n.bufferPolyfill.Buffer.from(t),s.toBuffer()]),a=n.sha256(i);return new y(a)}static createProgramAddressSync(e,t){let s=n.bufferPolyfill.Buffer.alloc(0);e.forEach(function(a){if(a.length>Bt)throw new TypeError("Max seed length exceeded");s=n.bufferPolyfill.Buffer.concat([s,K(a)])}),s=n.bufferPolyfill.Buffer.concat([s,t.toBuffer(),n.bufferPolyfill.Buffer.from("ProgramDerivedAddress")]);const i=n.sha256(s);if(Ce(i))throw new Error("Invalid seeds, address must fall off the curve");return new y(i)}static async createProgramAddress(e,t){return this.createProgramAddressSync(e,t)}static findProgramAddressSync(e,t){let s=255,i;for(;s!=0;){try{const a=e.concat(n.bufferPolyfill.Buffer.from([s]));i=this.createProgramAddressSync(a,t)}catch(a){if(a instanceof TypeError)throw a;s--;continue}return[i,s]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,t){return this.findProgramAddressSync(e,t)}static isOnCurve(e){const t=new y(e);return Ce(t.toBytes())}}Fe=y;y.default=new Fe("11111111111111111111111111111111");de.set(y,{kind:"struct",fields:[["_bn","u256"]]});new y("BPFLoader1111111111111111111111111111111111");const be=1232,Rt=127,He=64;class Ne{constructor(e,t){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=t}keySegments(){const e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(const t of this.keySegments()){if(e<t.length)return t[e];e-=t.length}}get length(){return this.keySegments().flat().length}compileInstructions(e){if(this.length>256)throw new Error("Account index overflow encountered during compilation");const s=new Map;this.keySegments().flat().forEach((a,u)=>{s.set(a.toBase58(),u)});const i=a=>{const u=s.get(a.toBase58());if(u===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return u};return e.map(a=>({programIdIndex:i(a.programId),accountKeyIndexes:a.keys.map(u=>i(u.pubkey)),data:a.data}))}}const S=(r="publicKey")=>n.blob(32,r),J=(r="string")=>{const e=n.struct([n.u32("length"),n.u32("lengthPadding"),n.blob(n.offset(n.u32(),-8),"chars")],r),t=e.decode.bind(e),s=e.encode.bind(e),i=e;return i.decode=(a,u)=>t(a,u).chars.toString(),i.encode=(a,u,m)=>{const l={chars:n.bufferPolyfill.Buffer.from(a,"utf8")};return s(l,u,m)},i.alloc=a=>n.u32().span+n.u32().span+n.bufferPolyfill.Buffer.from(a,"utf8").length,i},Et=(r="authorized")=>n.struct([S("staker"),S("withdrawer")],r),Ct=(r="lockup")=>n.struct([n.ns64("unixTimestamp"),n.ns64("epoch"),S("custodian")],r),Ot=(r="voteInit")=>n.struct([S("nodePubkey"),S("authorizedVoter"),S("authorizedWithdrawer"),n.u8("commission")],r),Nt=(r="voteAuthorizeWithSeedArgs")=>n.struct([n.u32("voteAuthorizationType"),S("currentAuthorityDerivedKeyOwnerPubkey"),J("currentAuthorityDerivedKeySeed"),S("newAuthorized")],r);function je(r,e){const t=i=>{if(i.span>=0)return i.span;if(typeof i.alloc=="function")return i.alloc(e[i.property]);if("count"in i&&"elementLayout"in i){const a=e[i.property];if(Array.isArray(a))return a.length*t(i.elementLayout)}else if("fields"in i)return je({layout:i},e[i.property]);return 0};let s=0;return r.layout.fields.forEach(i=>{s+=t(i)}),s}function Q(r){let e=0,t=0;for(;;){let s=r.shift();if(e|=(s&127)<<t*7,t+=1,!(s&128))break}return e}function ee(r,e){let t=e;for(;;){let s=t&127;if(t>>=7,t==0){r.push(s);break}else s|=128,r.push(s)}}function C(r,e){if(!r)throw new Error(e||"Assertion failed")}class Pe{constructor(e,t){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=t}static compile(e,t){const s=new Map,i=u=>{const m=u.toBase58();let l=s.get(m);return l===void 0&&(l={isSigner:!1,isWritable:!1,isInvoked:!1},s.set(m,l)),l},a=i(t);a.isSigner=!0,a.isWritable=!0;for(const u of e){i(u.programId).isInvoked=!0;for(const m of u.keys){const l=i(m.pubkey);l.isSigner||(l.isSigner=m.isSigner),l.isWritable||(l.isWritable=m.isWritable)}}return new Pe(t,s)}getMessageComponents(){const e=[...this.keyMetaMap.entries()];C(e.length<=256,"Max static account keys length exceeded");const t=e.filter(([,l])=>l.isSigner&&l.isWritable),s=e.filter(([,l])=>l.isSigner&&!l.isWritable),i=e.filter(([,l])=>!l.isSigner&&l.isWritable),a=e.filter(([,l])=>!l.isSigner&&!l.isWritable),u={numRequiredSignatures:t.length+s.length,numReadonlySignedAccounts:s.length,numReadonlyUnsignedAccounts:a.length};{C(t.length>0,"Expected at least one writable signer key");const[l]=t[0];C(l===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const m=[...t.map(([l])=>new y(l)),...s.map(([l])=>new y(l)),...i.map(([l])=>new y(l)),...a.map(([l])=>new y(l))];return[u,m]}extractTableLookup(e){const[t,s]=this.drainKeysFoundInLookupTable(e.state.addresses,u=>!u.isSigner&&!u.isInvoked&&u.isWritable),[i,a]=this.drainKeysFoundInLookupTable(e.state.addresses,u=>!u.isSigner&&!u.isInvoked&&!u.isWritable);if(!(t.length===0&&i.length===0))return[{accountKey:e.key,writableIndexes:t,readonlyIndexes:i},{writable:s,readonly:a}]}drainKeysFoundInLookupTable(e,t){const s=new Array,i=new Array;for(const[a,u]of this.keyMetaMap.entries())if(t(u)){const m=new y(a),l=e.findIndex(b=>b.equals(m));l>=0&&(C(l<256,"Max lookup table index exceeded"),s.push(l),i.push(m),this.keyMetaMap.delete(a))}return[s,i]}}const Ge="Reached end of buffer unexpectedly";function le(r){if(r.length===0)throw new Error(Ge);return r.shift()}function te(r,...e){const[t]=e;if(e.length===2?t+(e[1]??0)>r.length:t>=r.length)throw new Error(Ge);return r.splice(...e)}class ie{constructor(e){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map(t=>new y(t)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:n.bs58.decode(e.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new Ne(this.staticAccountKeys)}static compile(e){const t=Pe.compile(e.instructions,e.payerKey),[s,i]=t.getMessageComponents(),u=new Ne(i).compileInstructions(e.instructions).map(m=>({programIdIndex:m.programIdIndex,accounts:m.accountKeyIndexes,data:n.bs58.encode(m.data)}));return new ie({header:s,accountKeys:i,recentBlockhash:e.recentBlockhash,instructions:u})}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){const t=this.header.numRequiredSignatures;if(e>=this.header.numRequiredSignatures){const s=e-t,a=this.accountKeys.length-t-this.header.numReadonlyUnsignedAccounts;return s<a}else{const s=t-this.header.numReadonlySignedAccounts;return e<s}}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((e,t)=>!this.isProgramId(t))}serialize(){const e=this.accountKeys.length;let t=[];ee(t,e);const s=this.instructions.map(M=>{const{accounts:I,programIdIndex:v}=M,E=Array.from(n.bs58.decode(M.data));let h=[];ee(h,I.length);let w=[];return ee(w,E.length),{programIdIndex:v,keyIndicesCount:n.bufferPolyfill.Buffer.from(h),keyIndices:I,dataLength:n.bufferPolyfill.Buffer.from(w),data:E}});let i=[];ee(i,s.length);let a=n.bufferPolyfill.Buffer.alloc(be);n.bufferPolyfill.Buffer.from(i).copy(a);let u=i.length;s.forEach(M=>{const v=n.struct([n.u8("programIdIndex"),n.blob(M.keyIndicesCount.length,"keyIndicesCount"),n.seq(n.u8("keyIndex"),M.keyIndices.length,"keyIndices"),n.blob(M.dataLength.length,"dataLength"),n.seq(n.u8("userdatum"),M.data.length,"data")]).encode(M,a,u);u+=v}),a=a.slice(0,u);const m=n.struct([n.blob(1,"numRequiredSignatures"),n.blob(1,"numReadonlySignedAccounts"),n.blob(1,"numReadonlyUnsignedAccounts"),n.blob(t.length,"keyCount"),n.seq(S("key"),e,"keys"),S("recentBlockhash")]),l={numRequiredSignatures:n.bufferPolyfill.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:n.bufferPolyfill.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:n.bufferPolyfill.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:n.bufferPolyfill.Buffer.from(t),keys:this.accountKeys.map(M=>K(M.toBytes())),recentBlockhash:n.bs58.decode(this.recentBlockhash)};let b=n.bufferPolyfill.Buffer.alloc(2048);const k=m.encode(l,b);return a.copy(b,k),b.slice(0,k+a.length)}static from(e){let t=[...e];const s=le(t);if(s!==(s&Rt))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const i=le(t),a=le(t),u=Q(t);let m=[];for(let I=0;I<u;I++){const v=te(t,0,ne);m.push(new y(n.bufferPolyfill.Buffer.from(v)))}const l=te(t,0,ne),b=Q(t);let k=[];for(let I=0;I<b;I++){const v=le(t),E=Q(t),h=te(t,0,E),w=Q(t),T=te(t,0,w),F=n.bs58.encode(n.bufferPolyfill.Buffer.from(T));k.push({programIdIndex:v,accounts:h,data:F})}const M={header:{numRequiredSignatures:s,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:a},recentBlockhash:n.bs58.encode(n.bufferPolyfill.Buffer.from(l)),accountKeys:m,instructions:k};return new ie(M)}}const _t=n.bufferPolyfill.Buffer.alloc(He).fill(0);class z{constructor(e){this.keys=void 0,this.programId=void 0,this.data=n.bufferPolyfill.Buffer.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}toJSON(){return{keys:this.keys.map(({pubkey:e,isSigner:t,isWritable:s})=>({pubkey:e.toJSON(),isSigner:t,isWritable:s})),programId:this.programId.toJSON(),data:[...this.data]}}}class X{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!e)if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){const{minContextSlot:t,nonceInfo:s}=e;this.minNonceContextSlot=t,this.nonceInfo=s}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){const{blockhash:t,lastValidBlockHeight:s}=e;this.recentBlockhash=t,this.lastValidBlockHeight=s}else{const{recentBlockhash:t,nonceInfo:s}=e;s&&(this.nonceInfo=s),this.recentBlockhash=t}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(e=>e.toJSON()),signers:this.signatures.map(({publicKey:e})=>e.toJSON())}}add(...e){if(e.length===0)throw new Error("No instructions");return e.forEach(t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new z(t))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let e,t;if(this.nonceInfo?(e=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?t=[this.nonceInfo.nonceInstruction,...this.instructions]:t=this.instructions):(e=this.recentBlockhash,t=this.instructions),!e)throw new Error("Transaction recentBlockhash required");t.length<1&&console.warn("No instructions provided");let s;if(this.feePayer)s=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)s=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let h=0;h<t.length;h++)if(t[h].programId===void 0)throw new Error(`Transaction instruction index ${h} has undefined program id`);const i=[],a=[];t.forEach(h=>{h.keys.forEach(T=>{a.push({...T})});const w=h.programId.toString();i.includes(w)||i.push(w)}),i.forEach(h=>{a.push({pubkey:new y(h),isSigner:!1,isWritable:!1})});const u=[];a.forEach(h=>{const w=h.pubkey.toString(),T=u.findIndex(F=>F.pubkey.toString()===w);T>-1?(u[T].isWritable=u[T].isWritable||h.isWritable,u[T].isSigner=u[T].isSigner||h.isSigner):u.push(h)}),u.sort(function(h,w){if(h.isSigner!==w.isSigner)return h.isSigner?-1:1;if(h.isWritable!==w.isWritable)return h.isWritable?-1:1;const T={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return h.pubkey.toBase58().localeCompare(w.pubkey.toBase58(),"en",T)});const m=u.findIndex(h=>h.pubkey.equals(s));if(m>-1){const[h]=u.splice(m,1);h.isSigner=!0,h.isWritable=!0,u.unshift(h)}else u.unshift({pubkey:s,isSigner:!0,isWritable:!0});for(const h of this.signatures){const w=u.findIndex(T=>T.pubkey.equals(h.publicKey));if(w>-1)u[w].isSigner||(u[w].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${h.publicKey.toString()}`)}let l=0,b=0,k=0;const M=[],I=[];u.forEach(({pubkey:h,isSigner:w,isWritable:T})=>{w?(M.push(h.toString()),l+=1,T||(b+=1)):(I.push(h.toString()),T||(k+=1))});const v=M.concat(I),E=t.map(h=>{const{data:w,programId:T}=h;return{programIdIndex:v.indexOf(T.toString()),accounts:h.keys.map(F=>v.indexOf(F.pubkey.toString())),data:n.bs58.encode(w)}});return E.forEach(h=>{C(h.programIdIndex>=0),h.accounts.forEach(w=>C(w>=0))}),new ie({header:{numRequiredSignatures:l,numReadonlySignedAccounts:b,numReadonlyUnsignedAccounts:k},accountKeys:v,recentBlockhash:e,instructions:E})}_compile(){const e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===t.length&&this.signatures.every((i,a)=>t[a].equals(i.publicKey))||(this.signatures=t.map(s=>({signature:null,publicKey:s}))),e}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(...e){if(e.length===0)throw new Error("No signers");const t=new Set;this.signatures=e.filter(s=>{const i=s.toString();return t.has(i)?!1:(t.add(i),!0)}).map(s=>({signature:null,publicKey:s}))}sign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,s=[];for(const a of e){const u=a.publicKey.toString();t.has(u)||(t.add(u),s.push(a))}this.signatures=s.map(a=>({signature:null,publicKey:a.publicKey}));const i=this._compile();this._partialSign(i,...s)}partialSign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,s=[];for(const a of e){const u=a.publicKey.toString();t.has(u)||(t.add(u),s.push(a))}const i=this._compile();this._partialSign(i,...s)}_partialSign(e,...t){const s=e.serialize();t.forEach(i=>{const a=vt(s,i.secretKey);this._addSignature(i.publicKey,K(a))})}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){C(t.length===64);const s=this.signatures.findIndex(i=>e.equals(i.publicKey));if(s<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[s].signature=n.bufferPolyfill.Buffer.from(t)}verifySignatures(e=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,t){const s={};for(const{signature:i,publicKey:a}of this.signatures)i===null?t&&(s.missing||(s.missing=[])).push(a):Tt(i,e,a.toBytes())||(s.invalid||(s.invalid=[])).push(a);return s.invalid||s.missing?s:void 0}serialize(e){const{requireAllSignatures:t,verifySignatures:s}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),i=this.serializeMessage();if(s){const a=this._getMessageSignednessErrors(i,t);if(a){let u="Signature verification failed.";throw a.invalid&&(u+=`
|
|
1
|
+
"use strict";var yt=Object.defineProperty;var pt=(r,e,t)=>e in r?yt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var V=(r,e,t)=>(pt(r,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-Tl7zYqHL.js"),ht=require("./chain-BT07YJHt.js"),$=require("./solana-Bd9eRY8E.js"),Le=require("./index-DnneI5--.js");class bt extends TypeError{constructor(e,t){let s;const{message:i,...a}=e,{path:u}=e,m=u.length===0?i:"At path: "+u.join(".")+" -- "+i;super(m),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>{var l;return(l=s)!=null?l:s=[e,...t()]}}}function St(r){return q(r)&&typeof r[Symbol.iterator]=="function"}function q(r){return typeof r=="object"&&r!=null}function W(r){return typeof r=="string"?JSON.stringify(r):""+r}function kt(r){const{done:e,value:t}=r.next();return e?void 0:t}function Mt(r,e,t,s){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:i,branch:a}=e,{type:u}=t,{refinement:m,message:l="Expected a value of type `"+u+"`"+(m?" with refinement `"+m+"`":"")+", but received: `"+W(s)+"`"}=r;return{value:s,type:u,refinement:m,key:i[i.length-1],path:i,branch:a,...r,message:l}}function*Re(r,e,t,s){St(r)||(r=[r]);for(const i of r){const a=Mt(i,e,t,s);a&&(yield a)}}function*ke(r,e,t={}){const{path:s=[],branch:i=[r],coerce:a=!1,mask:u=!1}=t,m={path:s,branch:i};if(a&&(r=e.coercer(r,m),u&&e.type!=="type"&&q(e.schema)&&q(r)&&!Array.isArray(r)))for(const b in r)e.schema[b]===void 0&&delete r[b];let l=!0;for(const b of e.validator(r,m))l=!1,yield[b,void 0];for(let[b,k,M]of e.entries(r,m)){const I=ke(k,M,{path:b===void 0?s:[...s,b],branch:b===void 0?i:[...i,k],coerce:a,mask:u});for(const v of I)v[0]?(l=!1,yield[v[0],void 0]):a&&(k=v[1],b===void 0?r=k:r instanceof Map?r.set(b,k):r instanceof Set?r.add(k):q(r)&&(r[b]=k))}if(l)for(const b of e.refiner(r,m))l=!1,yield[b,void 0];l&&(yield[void 0,r])}let U=class{constructor(e){const{type:t,schema:s,validator:i,refiner:a,coercer:u=l=>l,entries:m=function*(){}}=e;this.type=t,this.schema=s,this.entries=m,this.coercer=u,i?this.validator=(l,b)=>{const k=i(l,b);return Re(k,b,this,l)}:this.validator=()=>[],a?this.refiner=(l,b)=>{const k=a(l,b);return Re(k,b,this,l)}:this.refiner=()=>[]}assert(e){return wt(e,this)}create(e){return re(e,this)}is(e){return Ue(e,this)}mask(e){return Pt(e,this)}validate(e,t={}){return oe(e,this,t)}};function wt(r,e){const t=oe(r,e);if(t[0])throw t[0]}function re(r,e){const t=oe(r,e,{coerce:!0});if(t[0])throw t[0];return t[1]}function Pt(r,e){const t=oe(r,e,{coerce:!0,mask:!0});if(t[0])throw t[0];return t[1]}function Ue(r,e){return!oe(r,e)[0]}function oe(r,e,t={}){const s=ke(r,e,t),i=kt(s);return i[0]?[new bt(i[0],function*(){for(const u of s)u[0]&&(yield u[0])}),void 0]:[void 0,i[1]]}function H(r,e){return new U({type:r,schema:null,validator:e})}function At(){return H("any",()=>!0)}function g(r){return new U({type:"array",schema:r,*entries(e){if(r&&Array.isArray(e))for(const[t,s]of e.entries())yield[t,s,r]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||"Expected an array value, but received: "+W(e)}})}function L(){return H("boolean",r=>typeof r=="boolean")}function Me(r){return H("instance",e=>e instanceof r||"Expected a `"+r.name+"` instance, but received: "+W(e))}function A(r){const e=W(r),t=typeof r;return new U({type:"literal",schema:t==="string"||t==="number"||t==="boolean"?r:null,validator(s){return s===r||"Expected the literal `"+e+"`, but received: "+W(s)}})}function It(){return H("never",()=>!1)}function f(r){return new U({...r,validator:(e,t)=>e===null||r.validator(e,t),refiner:(e,t)=>e===null||r.refiner(e,t)})}function o(){return H("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+W(r))}function p(r){return new U({...r,validator:(e,t)=>e===void 0||r.validator(e,t),refiner:(e,t)=>e===void 0||r.refiner(e,t)})}function qe(r,e){return new U({type:"record",schema:null,*entries(t){if(q(t))for(const s in t){const i=t[s];yield[s,s,r],yield[s,i,e]}},validator(t){return q(t)||"Expected an object, but received: "+W(t)}})}function d(){return H("string",r=>typeof r=="string"||"Expected a string, but received: "+W(r))}function we(r){const e=It();return new U({type:"tuple",schema:null,*entries(t){if(Array.isArray(t)){const s=Math.max(r.length,t.length);for(let i=0;i<s;i++)yield[i,t[i],r[i]||e]}},validator(t){return Array.isArray(t)||"Expected an array, but received: "+W(t)}})}function c(r){const e=Object.keys(r);return new U({type:"type",schema:r,*entries(t){if(q(t))for(const s of e)yield[s,t[s],r[s]]},validator(t){return q(t)||"Expected an object, but received: "+W(t)}})}function R(r){const e=r.map(t=>t.type).join(" | ");return new U({type:"union",schema:null,validator(t,s){const i=[];for(const a of r){const[...u]=ke(t,a,s),[m]=u;if(m[0])for(const[l]of u)l&&i.push(l);else return[]}return["Expected the value to satisfy a union of `"+e+"`, but received: "+W(t),...i]}})}function ue(){return H("unknown",()=>!0)}function ce(r,e,t){return new U({...r,coercer:(s,i)=>Ue(s,e)?r.coercer(t(s,i),i):r.coercer(s,i)})}const Ee=()=>{const r=n.ed25519.utils.randomPrivateKey(),e=he(r),t=new Uint8Array(64);return t.set(r),t.set(e,32),{publicKey:e,secretKey:t}},he=n.ed25519.getPublicKey;function Ce(r){try{return n.ed25519.ExtendedPoint.fromHex(r),!0}catch{return!1}}const vt=(r,e)=>n.ed25519.sign(r,e.slice(0,32)),Tt=n.ed25519.verify,K=r=>n.bufferPolyfill.Buffer.isBuffer(r)?r:r instanceof Uint8Array?n.bufferPolyfill.Buffer.from(r.buffer,r.byteOffset,r.byteLength):n.bufferPolyfill.Buffer.from(r);class xt{constructor(e){Object.assign(this,e)}encode(){return n.bufferPolyfill.Buffer.from(n.serialize_1(de,this))}static decode(e){return n.deserialize_1(de,this,e)}static decodeUnchecked(e){return n.deserializeUnchecked_1(de,this,e)}}const de=new Map;var Fe;let Ve;const Bt=32,ne=32;function Kt(r){return r._bn!==void 0}let Oe=1;Ve=Symbol.toStringTag;class y extends xt{constructor(e){if(super({}),this._bn=void 0,Kt(e))this._bn=e._bn;else{if(typeof e=="string"){const t=n.bs58.decode(e);if(t.length!=ne)throw new Error("Invalid public key input");this._bn=new n.BN(t)}else this._bn=new n.BN(e);if(this._bn.byteLength()>ne)throw new Error("Invalid public key input")}}static unique(){const e=new y(Oe);return Oe+=1,new y(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return n.bs58.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){const e=this._bn.toArrayLike(n.bufferPolyfill.Buffer);if(e.length===ne)return e;const t=n.bufferPolyfill.Buffer.alloc(32);return e.copy(t,32-e.length),t}get[Ve](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,t,s){const i=n.bufferPolyfill.Buffer.concat([e.toBuffer(),n.bufferPolyfill.Buffer.from(t),s.toBuffer()]),a=n.sha256(i);return new y(a)}static createProgramAddressSync(e,t){let s=n.bufferPolyfill.Buffer.alloc(0);e.forEach(function(a){if(a.length>Bt)throw new TypeError("Max seed length exceeded");s=n.bufferPolyfill.Buffer.concat([s,K(a)])}),s=n.bufferPolyfill.Buffer.concat([s,t.toBuffer(),n.bufferPolyfill.Buffer.from("ProgramDerivedAddress")]);const i=n.sha256(s);if(Ce(i))throw new Error("Invalid seeds, address must fall off the curve");return new y(i)}static async createProgramAddress(e,t){return this.createProgramAddressSync(e,t)}static findProgramAddressSync(e,t){let s=255,i;for(;s!=0;){try{const a=e.concat(n.bufferPolyfill.Buffer.from([s]));i=this.createProgramAddressSync(a,t)}catch(a){if(a instanceof TypeError)throw a;s--;continue}return[i,s]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,t){return this.findProgramAddressSync(e,t)}static isOnCurve(e){const t=new y(e);return Ce(t.toBytes())}}Fe=y;y.default=new Fe("11111111111111111111111111111111");de.set(y,{kind:"struct",fields:[["_bn","u256"]]});new y("BPFLoader1111111111111111111111111111111111");const be=1232,Rt=127,He=64;class Ne{constructor(e,t){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=t}keySegments(){const e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(const t of this.keySegments()){if(e<t.length)return t[e];e-=t.length}}get length(){return this.keySegments().flat().length}compileInstructions(e){if(this.length>256)throw new Error("Account index overflow encountered during compilation");const s=new Map;this.keySegments().flat().forEach((a,u)=>{s.set(a.toBase58(),u)});const i=a=>{const u=s.get(a.toBase58());if(u===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return u};return e.map(a=>({programIdIndex:i(a.programId),accountKeyIndexes:a.keys.map(u=>i(u.pubkey)),data:a.data}))}}const S=(r="publicKey")=>n.blob(32,r),J=(r="string")=>{const e=n.struct([n.u32("length"),n.u32("lengthPadding"),n.blob(n.offset(n.u32(),-8),"chars")],r),t=e.decode.bind(e),s=e.encode.bind(e),i=e;return i.decode=(a,u)=>t(a,u).chars.toString(),i.encode=(a,u,m)=>{const l={chars:n.bufferPolyfill.Buffer.from(a,"utf8")};return s(l,u,m)},i.alloc=a=>n.u32().span+n.u32().span+n.bufferPolyfill.Buffer.from(a,"utf8").length,i},Et=(r="authorized")=>n.struct([S("staker"),S("withdrawer")],r),Ct=(r="lockup")=>n.struct([n.ns64("unixTimestamp"),n.ns64("epoch"),S("custodian")],r),Ot=(r="voteInit")=>n.struct([S("nodePubkey"),S("authorizedVoter"),S("authorizedWithdrawer"),n.u8("commission")],r),Nt=(r="voteAuthorizeWithSeedArgs")=>n.struct([n.u32("voteAuthorizationType"),S("currentAuthorityDerivedKeyOwnerPubkey"),J("currentAuthorityDerivedKeySeed"),S("newAuthorized")],r);function je(r,e){const t=i=>{if(i.span>=0)return i.span;if(typeof i.alloc=="function")return i.alloc(e[i.property]);if("count"in i&&"elementLayout"in i){const a=e[i.property];if(Array.isArray(a))return a.length*t(i.elementLayout)}else if("fields"in i)return je({layout:i},e[i.property]);return 0};let s=0;return r.layout.fields.forEach(i=>{s+=t(i)}),s}function Q(r){let e=0,t=0;for(;;){let s=r.shift();if(e|=(s&127)<<t*7,t+=1,!(s&128))break}return e}function ee(r,e){let t=e;for(;;){let s=t&127;if(t>>=7,t==0){r.push(s);break}else s|=128,r.push(s)}}function C(r,e){if(!r)throw new Error(e||"Assertion failed")}class Pe{constructor(e,t){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=t}static compile(e,t){const s=new Map,i=u=>{const m=u.toBase58();let l=s.get(m);return l===void 0&&(l={isSigner:!1,isWritable:!1,isInvoked:!1},s.set(m,l)),l},a=i(t);a.isSigner=!0,a.isWritable=!0;for(const u of e){i(u.programId).isInvoked=!0;for(const m of u.keys){const l=i(m.pubkey);l.isSigner||(l.isSigner=m.isSigner),l.isWritable||(l.isWritable=m.isWritable)}}return new Pe(t,s)}getMessageComponents(){const e=[...this.keyMetaMap.entries()];C(e.length<=256,"Max static account keys length exceeded");const t=e.filter(([,l])=>l.isSigner&&l.isWritable),s=e.filter(([,l])=>l.isSigner&&!l.isWritable),i=e.filter(([,l])=>!l.isSigner&&l.isWritable),a=e.filter(([,l])=>!l.isSigner&&!l.isWritable),u={numRequiredSignatures:t.length+s.length,numReadonlySignedAccounts:s.length,numReadonlyUnsignedAccounts:a.length};{C(t.length>0,"Expected at least one writable signer key");const[l]=t[0];C(l===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const m=[...t.map(([l])=>new y(l)),...s.map(([l])=>new y(l)),...i.map(([l])=>new y(l)),...a.map(([l])=>new y(l))];return[u,m]}extractTableLookup(e){const[t,s]=this.drainKeysFoundInLookupTable(e.state.addresses,u=>!u.isSigner&&!u.isInvoked&&u.isWritable),[i,a]=this.drainKeysFoundInLookupTable(e.state.addresses,u=>!u.isSigner&&!u.isInvoked&&!u.isWritable);if(!(t.length===0&&i.length===0))return[{accountKey:e.key,writableIndexes:t,readonlyIndexes:i},{writable:s,readonly:a}]}drainKeysFoundInLookupTable(e,t){const s=new Array,i=new Array;for(const[a,u]of this.keyMetaMap.entries())if(t(u)){const m=new y(a),l=e.findIndex(b=>b.equals(m));l>=0&&(C(l<256,"Max lookup table index exceeded"),s.push(l),i.push(m),this.keyMetaMap.delete(a))}return[s,i]}}const Ge="Reached end of buffer unexpectedly";function le(r){if(r.length===0)throw new Error(Ge);return r.shift()}function te(r,...e){const[t]=e;if(e.length===2?t+(e[1]??0)>r.length:t>=r.length)throw new Error(Ge);return r.splice(...e)}class ie{constructor(e){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map(t=>new y(t)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:n.bs58.decode(e.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new Ne(this.staticAccountKeys)}static compile(e){const t=Pe.compile(e.instructions,e.payerKey),[s,i]=t.getMessageComponents(),u=new Ne(i).compileInstructions(e.instructions).map(m=>({programIdIndex:m.programIdIndex,accounts:m.accountKeyIndexes,data:n.bs58.encode(m.data)}));return new ie({header:s,accountKeys:i,recentBlockhash:e.recentBlockhash,instructions:u})}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){const t=this.header.numRequiredSignatures;if(e>=this.header.numRequiredSignatures){const s=e-t,a=this.accountKeys.length-t-this.header.numReadonlyUnsignedAccounts;return s<a}else{const s=t-this.header.numReadonlySignedAccounts;return e<s}}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((e,t)=>!this.isProgramId(t))}serialize(){const e=this.accountKeys.length;let t=[];ee(t,e);const s=this.instructions.map(M=>{const{accounts:I,programIdIndex:v}=M,E=Array.from(n.bs58.decode(M.data));let h=[];ee(h,I.length);let w=[];return ee(w,E.length),{programIdIndex:v,keyIndicesCount:n.bufferPolyfill.Buffer.from(h),keyIndices:I,dataLength:n.bufferPolyfill.Buffer.from(w),data:E}});let i=[];ee(i,s.length);let a=n.bufferPolyfill.Buffer.alloc(be);n.bufferPolyfill.Buffer.from(i).copy(a);let u=i.length;s.forEach(M=>{const v=n.struct([n.u8("programIdIndex"),n.blob(M.keyIndicesCount.length,"keyIndicesCount"),n.seq(n.u8("keyIndex"),M.keyIndices.length,"keyIndices"),n.blob(M.dataLength.length,"dataLength"),n.seq(n.u8("userdatum"),M.data.length,"data")]).encode(M,a,u);u+=v}),a=a.slice(0,u);const m=n.struct([n.blob(1,"numRequiredSignatures"),n.blob(1,"numReadonlySignedAccounts"),n.blob(1,"numReadonlyUnsignedAccounts"),n.blob(t.length,"keyCount"),n.seq(S("key"),e,"keys"),S("recentBlockhash")]),l={numRequiredSignatures:n.bufferPolyfill.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:n.bufferPolyfill.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:n.bufferPolyfill.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:n.bufferPolyfill.Buffer.from(t),keys:this.accountKeys.map(M=>K(M.toBytes())),recentBlockhash:n.bs58.decode(this.recentBlockhash)};let b=n.bufferPolyfill.Buffer.alloc(2048);const k=m.encode(l,b);return a.copy(b,k),b.slice(0,k+a.length)}static from(e){let t=[...e];const s=le(t);if(s!==(s&Rt))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const i=le(t),a=le(t),u=Q(t);let m=[];for(let I=0;I<u;I++){const v=te(t,0,ne);m.push(new y(n.bufferPolyfill.Buffer.from(v)))}const l=te(t,0,ne),b=Q(t);let k=[];for(let I=0;I<b;I++){const v=le(t),E=Q(t),h=te(t,0,E),w=Q(t),T=te(t,0,w),F=n.bs58.encode(n.bufferPolyfill.Buffer.from(T));k.push({programIdIndex:v,accounts:h,data:F})}const M={header:{numRequiredSignatures:s,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:a},recentBlockhash:n.bs58.encode(n.bufferPolyfill.Buffer.from(l)),accountKeys:m,instructions:k};return new ie(M)}}const _t=n.bufferPolyfill.Buffer.alloc(He).fill(0);class z{constructor(e){this.keys=void 0,this.programId=void 0,this.data=n.bufferPolyfill.Buffer.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}toJSON(){return{keys:this.keys.map(({pubkey:e,isSigner:t,isWritable:s})=>({pubkey:e.toJSON(),isSigner:t,isWritable:s})),programId:this.programId.toJSON(),data:[...this.data]}}}class X{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!e)if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){const{minContextSlot:t,nonceInfo:s}=e;this.minNonceContextSlot=t,this.nonceInfo=s}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){const{blockhash:t,lastValidBlockHeight:s}=e;this.recentBlockhash=t,this.lastValidBlockHeight=s}else{const{recentBlockhash:t,nonceInfo:s}=e;s&&(this.nonceInfo=s),this.recentBlockhash=t}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(e=>e.toJSON()),signers:this.signatures.map(({publicKey:e})=>e.toJSON())}}add(...e){if(e.length===0)throw new Error("No instructions");return e.forEach(t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new z(t))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let e,t;if(this.nonceInfo?(e=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?t=[this.nonceInfo.nonceInstruction,...this.instructions]:t=this.instructions):(e=this.recentBlockhash,t=this.instructions),!e)throw new Error("Transaction recentBlockhash required");t.length<1&&console.warn("No instructions provided");let s;if(this.feePayer)s=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)s=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let h=0;h<t.length;h++)if(t[h].programId===void 0)throw new Error(`Transaction instruction index ${h} has undefined program id`);const i=[],a=[];t.forEach(h=>{h.keys.forEach(T=>{a.push({...T})});const w=h.programId.toString();i.includes(w)||i.push(w)}),i.forEach(h=>{a.push({pubkey:new y(h),isSigner:!1,isWritable:!1})});const u=[];a.forEach(h=>{const w=h.pubkey.toString(),T=u.findIndex(F=>F.pubkey.toString()===w);T>-1?(u[T].isWritable=u[T].isWritable||h.isWritable,u[T].isSigner=u[T].isSigner||h.isSigner):u.push(h)}),u.sort(function(h,w){if(h.isSigner!==w.isSigner)return h.isSigner?-1:1;if(h.isWritable!==w.isWritable)return h.isWritable?-1:1;const T={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return h.pubkey.toBase58().localeCompare(w.pubkey.toBase58(),"en",T)});const m=u.findIndex(h=>h.pubkey.equals(s));if(m>-1){const[h]=u.splice(m,1);h.isSigner=!0,h.isWritable=!0,u.unshift(h)}else u.unshift({pubkey:s,isSigner:!0,isWritable:!0});for(const h of this.signatures){const w=u.findIndex(T=>T.pubkey.equals(h.publicKey));if(w>-1)u[w].isSigner||(u[w].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${h.publicKey.toString()}`)}let l=0,b=0,k=0;const M=[],I=[];u.forEach(({pubkey:h,isSigner:w,isWritable:T})=>{w?(M.push(h.toString()),l+=1,T||(b+=1)):(I.push(h.toString()),T||(k+=1))});const v=M.concat(I),E=t.map(h=>{const{data:w,programId:T}=h;return{programIdIndex:v.indexOf(T.toString()),accounts:h.keys.map(F=>v.indexOf(F.pubkey.toString())),data:n.bs58.encode(w)}});return E.forEach(h=>{C(h.programIdIndex>=0),h.accounts.forEach(w=>C(w>=0))}),new ie({header:{numRequiredSignatures:l,numReadonlySignedAccounts:b,numReadonlyUnsignedAccounts:k},accountKeys:v,recentBlockhash:e,instructions:E})}_compile(){const e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===t.length&&this.signatures.every((i,a)=>t[a].equals(i.publicKey))||(this.signatures=t.map(s=>({signature:null,publicKey:s}))),e}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(...e){if(e.length===0)throw new Error("No signers");const t=new Set;this.signatures=e.filter(s=>{const i=s.toString();return t.has(i)?!1:(t.add(i),!0)}).map(s=>({signature:null,publicKey:s}))}sign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,s=[];for(const a of e){const u=a.publicKey.toString();t.has(u)||(t.add(u),s.push(a))}this.signatures=s.map(a=>({signature:null,publicKey:a.publicKey}));const i=this._compile();this._partialSign(i,...s)}partialSign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,s=[];for(const a of e){const u=a.publicKey.toString();t.has(u)||(t.add(u),s.push(a))}const i=this._compile();this._partialSign(i,...s)}_partialSign(e,...t){const s=e.serialize();t.forEach(i=>{const a=vt(s,i.secretKey);this._addSignature(i.publicKey,K(a))})}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){C(t.length===64);const s=this.signatures.findIndex(i=>e.equals(i.publicKey));if(s<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[s].signature=n.bufferPolyfill.Buffer.from(t)}verifySignatures(e=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,t){const s={};for(const{signature:i,publicKey:a}of this.signatures)i===null?t&&(s.missing||(s.missing=[])).push(a):Tt(i,e,a.toBytes())||(s.invalid||(s.invalid=[])).push(a);return s.invalid||s.missing?s:void 0}serialize(e){const{requireAllSignatures:t,verifySignatures:s}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),i=this.serializeMessage();if(s){const a=this._getMessageSignednessErrors(i,t);if(a){let u="Signature verification failed.";throw a.invalid&&(u+=`
|
|
2
2
|
Invalid signature for public key${a.invalid.length===1?"":"(s)"} [\`${a.invalid.map(m=>m.toBase58()).join("`, `")}\`].`),a.missing&&(u+=`
|
|
3
3
|
Missing signature for public key${a.missing.length===1?"":"(s)"} [\`${a.missing.map(m=>m.toBase58()).join("`, `")}\`].`),new Error(u)}}return this._serialize(i)}_serialize(e){const{signatures:t}=this,s=[];ee(s,t.length);const i=s.length+t.length*64+e.length,a=n.bufferPolyfill.Buffer.alloc(i);return C(t.length<256),n.bufferPolyfill.Buffer.from(s).copy(a,0),t.forEach(({signature:u},m)=>{u!==null&&(C(u.length===64,"signature has invalid length"),n.bufferPolyfill.Buffer.from(u).copy(a,s.length+m*64))}),e.copy(a,s.length+t.length*64),C(a.length<=be,`Transaction too large: ${a.length} > ${be}`),a}get keys(){return C(this.instructions.length===1),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return C(this.instructions.length===1),this.instructions[0].programId}get data(){return C(this.instructions.length===1),this.instructions[0].data}static from(e){let t=[...e];const s=Q(t);let i=[];for(let a=0;a<s;a++){const u=te(t,0,He);i.push(n.bs58.encode(n.bufferPolyfill.Buffer.from(u)))}return X.populate(ie.from(t),i)}static populate(e,t=[]){const s=new X;return s.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(s.feePayer=e.accountKeys[0]),t.forEach((i,a)=>{const u={signature:i==n.bs58.encode(_t)?null:n.bs58.decode(i),publicKey:e.accountKeys[a]};s.signatures.push(u)}),e.instructions.forEach(i=>{const a=i.accounts.map(u=>{const m=e.accountKeys[u];return{pubkey:m,isSigner:s.signatures.some(l=>l.publicKey.toString()===m.toString())||e.isAccountSigner(u),isWritable:e.isAccountWritable(u)}});s.instructions.push(new z({keys:a,programId:e.accountKeys[i.programIdIndex],data:n.bs58.decode(i.data)}))}),s._message=e,s._json=s.toJSON(),s}}new y("SysvarC1ock11111111111111111111111111111111");new y("SysvarEpochSchedu1e111111111111111111111111");new y("Sysvar1nstructions1111111111111111111111111");const pe=new y("SysvarRecentB1ockHashes11111111111111111111"),_e=new y("SysvarRent111111111111111111111111111111111");new y("SysvarRewards111111111111111111111111111111");new y("SysvarS1otHashes111111111111111111111111111");new y("SysvarS1otHistory11111111111111111111111111");new y("SysvarStakeHistory1111111111111111111111111");function O(r,e){const t=r.layout.span>=0?r.layout.span:je(r,e),s=n.bufferPolyfill.Buffer.alloc(t),i=Object.assign({instruction:r.index},e);return r.layout.encode(i,s),s}const Dt=n.nu64("lamportsPerSignature"),zt=n.struct([n.u32("version"),n.u32("state"),S("authorizedPubkey"),S("nonce"),n.struct([Dt],"feeCalculator")]),De=zt.span,Wt=r=>{const e=r.decode.bind(r),t=r.encode.bind(r);return{decode:e,encode:t}},Lt=r=>e=>{const t=n.blob(r,e),{encode:s,decode:i}=Wt(t),a=t;return a.decode=(u,m)=>{const l=i(u,m);return n.toBigIntLE_1(n.bufferPolyfill.Buffer.from(l))},a.encode=(u,m,l)=>{const b=n.toBufferLE_1(u,r);return s(b,m,l)},a},Y=Lt(8),N=Object.freeze({Create:{index:0,layout:n.struct([n.u32("instruction"),n.ns64("lamports"),n.ns64("space"),S("programId")])},Assign:{index:1,layout:n.struct([n.u32("instruction"),S("programId")])},Transfer:{index:2,layout:n.struct([n.u32("instruction"),Y("lamports")])},CreateWithSeed:{index:3,layout:n.struct([n.u32("instruction"),S("base"),J("seed"),n.ns64("lamports"),n.ns64("space"),S("programId")])},AdvanceNonceAccount:{index:4,layout:n.struct([n.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:n.struct([n.u32("instruction"),n.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:n.struct([n.u32("instruction"),S("authorized")])},AuthorizeNonceAccount:{index:7,layout:n.struct([n.u32("instruction"),S("authorized")])},Allocate:{index:8,layout:n.struct([n.u32("instruction"),n.ns64("space")])},AllocateWithSeed:{index:9,layout:n.struct([n.u32("instruction"),S("base"),J("seed"),n.ns64("space"),S("programId")])},AssignWithSeed:{index:10,layout:n.struct([n.u32("instruction"),S("base"),J("seed"),S("programId")])},TransferWithSeed:{index:11,layout:n.struct([n.u32("instruction"),Y("lamports"),J("seed"),S("programId")])},UpgradeNonceAccount:{index:12,layout:n.struct([n.u32("instruction")])}});class ae{constructor(){}static createAccount(e){const t=N.Create,s=O(t,{lamports:e.lamports,space:e.space,programId:K(e.programId.toBuffer())});return new z({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:s})}static transfer(e){let t,s;if("basePubkey"in e){const i=N.TransferWithSeed;t=O(i,{lamports:BigInt(e.lamports),seed:e.seed,programId:K(e.programId.toBuffer())}),s=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}else{const i=N.Transfer;t=O(i,{lamports:BigInt(e.lamports)}),s=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}return new z({keys:s,programId:this.programId,data:t})}static assign(e){let t,s;if("basePubkey"in e){const i=N.AssignWithSeed;t=O(i,{base:K(e.basePubkey.toBuffer()),seed:e.seed,programId:K(e.programId.toBuffer())}),s=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{const i=N.Assign;t=O(i,{programId:K(e.programId.toBuffer())}),s=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new z({keys:s,programId:this.programId,data:t})}static createAccountWithSeed(e){const t=N.CreateWithSeed,s=O(t,{base:K(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:K(e.programId.toBuffer())});let i=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey!=e.fromPubkey&&i.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new z({keys:i,programId:this.programId,data:s})}static createNonceAccount(e){const t=new X;"basePubkey"in e&&"seed"in e?t.add(ae.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:De,programId:this.programId})):t.add(ae.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:De,programId:this.programId}));const s={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return t.add(this.nonceInitialize(s)),t}static nonceInitialize(e){const t=N.InitializeNonceAccount,s=O(t,{authorized:K(e.authorizedPubkey.toBuffer())}),i={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:pe,isSigner:!1,isWritable:!1},{pubkey:_e,isSigner:!1,isWritable:!1}],programId:this.programId,data:s};return new z(i)}static nonceAdvance(e){const t=N.AdvanceNonceAccount,s=O(t),i={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:pe,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:s};return new z(i)}static nonceWithdraw(e){const t=N.WithdrawNonceAccount,s=O(t,{lamports:e.lamports});return new z({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:pe,isSigner:!1,isWritable:!1},{pubkey:_e,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static nonceAuthorize(e){const t=N.AuthorizeNonceAccount,s=O(t,{authorized:K(e.newAuthorizedPubkey.toBuffer())});return new z({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static allocate(e){let t,s;if("basePubkey"in e){const i=N.AllocateWithSeed;t=O(i,{base:K(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:K(e.programId.toBuffer())}),s=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{const i=N.Allocate;t=O(i,{space:e.space}),s=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new z({keys:s,programId:this.programId,data:t})}}ae.programId=new y("11111111111111111111111111111111");new y("BPFLoader2111111111111111111111111111111111");n.struct([n.u32("typeIndex"),Y("deactivationSlot"),n.nu64("lastExtendedSlot"),n.u8("lastExtendedStartIndex"),n.u8(),n.seq(S(),n.offset(n.u8(),-1),"authority")]);const x=ce(Me(y),d(),r=>new y(r)),$e=we([d(),A("base64")]),Ae=ce(Me(n.bufferPolyfill.Buffer),$e,r=>n.bufferPolyfill.Buffer.from(r[0],"base64"));function Je(r){return R([c({jsonrpc:A("2.0"),id:d(),result:r}),c({jsonrpc:A("2.0"),id:d(),error:c({code:ue(),message:d(),data:p(At())})})])}const Ut=Je(ue());function P(r){return ce(Je(r),Ut,e=>"error"in e?e:{...e,result:re(e.result,r)})}function _(r){return P(c({context:c({slot:o()}),value:r}))}function fe(r){return c({context:c({slot:o()}),value:r})}const qt=c({foundation:o(),foundationTerm:o(),initial:o(),taper:o(),terminal:o()});P(g(f(c({epoch:o(),effectiveSlot:o(),amount:o(),postBalance:o(),commission:p(f(o()))}))));const Ft=g(c({slot:o(),prioritizationFee:o()})),Vt=c({total:o(),validator:o(),foundation:o(),epoch:o()}),Ht=c({epoch:o(),slotIndex:o(),slotsInEpoch:o(),absoluteSlot:o(),blockHeight:p(o()),transactionCount:p(o())}),jt=c({slotsPerEpoch:o(),leaderScheduleSlotOffset:o(),warmup:L(),firstNormalEpoch:o(),firstNormalSlot:o()}),Gt=qe(d(),g(o())),j=f(R([c({}),d()])),$t=c({err:j}),Jt=A("receivedSignature");c({"solana-core":d(),"feature-set":p(o())});_(c({err:f(R([c({}),d()])),logs:f(g(d())),accounts:p(f(g(f(c({executable:L(),owner:d(),lamports:o(),data:g(d()),rentEpoch:p(o())}))))),unitsConsumed:p(o()),returnData:p(f(c({programId:d(),data:we([d(),A("base64")])})))}));_(c({byIdentity:qe(d(),g(o())),range:c({firstSlot:o(),lastSlot:o()})}));P(qt);P(Vt);P(Ft);P(Ht);P(jt);P(Gt);P(o());_(c({total:o(),circulating:o(),nonCirculating:o(),nonCirculatingAccounts:g(x)}));const Xt=c({amount:d(),uiAmount:f(o()),decimals:o(),uiAmountString:p(d())});_(g(c({address:x,amount:d(),uiAmount:f(o()),decimals:o(),uiAmountString:p(d())})));_(g(c({pubkey:x,account:c({executable:L(),owner:x,lamports:o(),data:Ae,rentEpoch:o()})})));const Se=c({program:d(),parsed:ue(),space:o()});_(g(c({pubkey:x,account:c({executable:L(),owner:x,lamports:o(),data:Se,rentEpoch:o()})})));_(g(c({lamports:o(),address:x})));const Ie=c({executable:L(),owner:x,lamports:o(),data:Ae,rentEpoch:o()});c({pubkey:x,account:Ie});const Yt=ce(R([Me(n.bufferPolyfill.Buffer),Se]),R([$e,Se]),r=>Array.isArray(r)?re(r,Ae):r),Zt=c({executable:L(),owner:x,lamports:o(),data:Yt,rentEpoch:o()});c({pubkey:x,account:Zt});c({state:R([A("active"),A("inactive"),A("activating"),A("deactivating")]),active:o(),inactive:o()});P(g(c({signature:d(),slot:o(),err:j,memo:f(d()),blockTime:p(f(o()))})));P(g(c({signature:d(),slot:o(),err:j,memo:f(d()),blockTime:p(f(o()))})));c({subscription:o(),result:fe(Ie)});const Qt=c({pubkey:x,account:Ie});c({subscription:o(),result:fe(Qt)});const en=c({parent:o(),slot:o(),root:o()});c({subscription:o(),result:en});const tn=R([c({type:R([A("firstShredReceived"),A("completed"),A("optimisticConfirmation"),A("root")]),slot:o(),timestamp:o()}),c({type:A("createdBank"),parent:o(),slot:o(),timestamp:o()}),c({type:A("frozen"),slot:o(),timestamp:o(),stats:c({numTransactionEntries:o(),numSuccessfulTransactions:o(),numFailedTransactions:o(),maxTransactionsPerEntry:o()})}),c({type:A("dead"),slot:o(),timestamp:o(),err:d()})]);c({subscription:o(),result:tn});c({subscription:o(),result:fe(R([$t,Jt]))});c({subscription:o(),result:o()});c({pubkey:d(),gossip:f(d()),tpu:f(d()),rpc:f(d()),version:f(d())});const ze=c({votePubkey:d(),nodePubkey:d(),activatedStake:o(),epochVoteAccount:L(),epochCredits:g(we([o(),o(),o()])),commission:o(),lastVote:o(),rootSlot:f(o())});P(c({current:g(ze),delinquent:g(ze)}));const nn=R([A("processed"),A("confirmed"),A("finalized")]),sn=c({slot:o(),confirmations:f(o()),err:j,confirmationStatus:p(nn)});_(g(f(sn)));P(o());const Xe=c({accountKey:x,writableIndexes:g(o()),readonlyIndexes:g(o())}),ve=c({signatures:g(d()),message:c({accountKeys:g(d()),header:c({numRequiredSignatures:o(),numReadonlySignedAccounts:o(),numReadonlyUnsignedAccounts:o()}),instructions:g(c({accounts:g(o()),data:d(),programIdIndex:o()})),recentBlockhash:d(),addressTableLookups:p(g(Xe))})}),Ye=c({pubkey:x,signer:L(),writable:L(),source:p(R([A("transaction"),A("lookupTable")]))}),Ze=c({accountKeys:g(Ye),signatures:g(d())}),Qe=c({parsed:ue(),program:d(),programId:x}),et=c({accounts:g(x),data:d(),programId:x}),rn=R([et,Qe]),an=R([c({parsed:ue(),program:d(),programId:d()}),c({accounts:g(d()),data:d(),programId:d()})]),tt=ce(rn,an,r=>"accounts"in r?re(r,et):re(r,Qe)),nt=c({signatures:g(d()),message:c({accountKeys:g(Ye),instructions:g(tt),recentBlockhash:d(),addressTableLookups:p(f(g(Xe)))})}),me=c({accountIndex:o(),mint:d(),owner:p(d()),uiTokenAmount:Xt}),st=c({writable:g(x),readonly:g(x)}),ge=c({err:j,fee:o(),innerInstructions:p(f(g(c({index:o(),instructions:g(c({accounts:g(o()),data:d(),programIdIndex:o()}))})))),preBalances:g(o()),postBalances:g(o()),logMessages:p(f(g(d()))),preTokenBalances:p(f(g(me))),postTokenBalances:p(f(g(me))),loadedAddresses:p(st),computeUnitsConsumed:p(o())}),Te=c({err:j,fee:o(),innerInstructions:p(f(g(c({index:o(),instructions:g(tt)})))),preBalances:g(o()),postBalances:g(o()),logMessages:p(f(g(d()))),preTokenBalances:p(f(g(me))),postTokenBalances:p(f(g(me))),loadedAddresses:p(st),computeUnitsConsumed:p(o())}),Z=R([A(0),A("legacy")]),G=c({pubkey:d(),lamports:o(),postBalance:f(o()),rewardType:f(d()),commission:p(f(o()))});P(f(c({blockhash:d(),previousBlockhash:d(),parentSlot:o(),transactions:g(c({transaction:ve,meta:f(ge),version:p(Z)})),rewards:p(g(G)),blockTime:f(o()),blockHeight:f(o())})));P(f(c({blockhash:d(),previousBlockhash:d(),parentSlot:o(),rewards:p(g(G)),blockTime:f(o()),blockHeight:f(o())})));P(f(c({blockhash:d(),previousBlockhash:d(),parentSlot:o(),transactions:g(c({transaction:Ze,meta:f(ge),version:p(Z)})),rewards:p(g(G)),blockTime:f(o()),blockHeight:f(o())})));P(f(c({blockhash:d(),previousBlockhash:d(),parentSlot:o(),transactions:g(c({transaction:nt,meta:f(Te),version:p(Z)})),rewards:p(g(G)),blockTime:f(o()),blockHeight:f(o())})));P(f(c({blockhash:d(),previousBlockhash:d(),parentSlot:o(),transactions:g(c({transaction:Ze,meta:f(Te),version:p(Z)})),rewards:p(g(G)),blockTime:f(o()),blockHeight:f(o())})));P(f(c({blockhash:d(),previousBlockhash:d(),parentSlot:o(),rewards:p(g(G)),blockTime:f(o()),blockHeight:f(o())})));P(f(c({blockhash:d(),previousBlockhash:d(),parentSlot:o(),transactions:g(c({transaction:ve,meta:f(ge)})),rewards:p(g(G)),blockTime:f(o())})));P(f(c({blockhash:d(),previousBlockhash:d(),parentSlot:o(),signatures:g(d()),blockTime:f(o())})));P(f(c({slot:o(),meta:f(ge),blockTime:p(f(o())),transaction:ve,version:p(Z)})));P(f(c({slot:o(),transaction:nt,meta:f(Te),blockTime:p(f(o())),version:p(Z)})));_(c({blockhash:d(),feeCalculator:c({lamportsPerSignature:o()})}));_(c({blockhash:d(),lastValidBlockHeight:o()}));_(L());const on=c({slot:o(),numTransactions:o(),numSlots:o(),samplePeriodSecs:o()});P(g(on));_(f(c({feeCalculator:c({lamportsPerSignature:o()})})));P(d());P(d());const un=c({err:j,logs:g(d()),signature:d()});c({result:fe(un),subscription:o()});class se{constructor(e){this._keypair=void 0,this._keypair=e??Ee()}static generate(){return new se(Ee())}static fromSecretKey(e,t){if(e.byteLength!==64)throw new Error("bad secret key size");const s=e.slice(32,64);if(!t||!t.skipValidation){const i=e.slice(0,32),a=he(i);for(let u=0;u<32;u++)if(s[u]!==a[u])throw new Error("provided secretKey is invalid")}return new se({publicKey:s,secretKey:e})}static fromSeed(e){const t=he(e),s=new Uint8Array(64);return s.set(e),s.set(t,32),new se({publicKey:t,secretKey:s})}get publicKey(){return new y(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}Object.freeze({CreateLookupTable:{index:0,layout:n.struct([n.u32("instruction"),Y("recentSlot"),n.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:n.struct([n.u32("instruction")])},ExtendLookupTable:{index:2,layout:n.struct([n.u32("instruction"),Y(),n.seq(S(),n.offset(n.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:n.struct([n.u32("instruction")])},CloseLookupTable:{index:4,layout:n.struct([n.u32("instruction")])}});new y("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:n.struct([n.u8("instruction"),n.u32("units"),n.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:n.struct([n.u8("instruction"),n.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:n.struct([n.u8("instruction"),n.u32("units")])},SetComputeUnitPrice:{index:3,layout:n.struct([n.u8("instruction"),Y("microLamports")])}});new y("ComputeBudget111111111111111111111111111111");n.struct([n.u8("numSignatures"),n.u8("padding"),n.u16("signatureOffset"),n.u16("signatureInstructionIndex"),n.u16("publicKeyOffset"),n.u16("publicKeyInstructionIndex"),n.u16("messageDataOffset"),n.u16("messageDataSize"),n.u16("messageInstructionIndex")]);new y("Ed25519SigVerify111111111111111111111111111");n.secp256k1.utils.isValidPrivateKey;n.secp256k1.getPublicKey;n.struct([n.u8("numSignatures"),n.u16("signatureOffset"),n.u8("signatureInstructionIndex"),n.u16("ethAddressOffset"),n.u8("ethAddressInstructionIndex"),n.u16("messageDataOffset"),n.u16("messageDataSize"),n.u8("messageInstructionIndex"),n.blob(20,"ethAddress"),n.blob(64,"signature"),n.u8("recoveryId")]);new y("KeccakSecp256k11111111111111111111111111111");var rt;new y("StakeConfig11111111111111111111111111111111");class it{constructor(e,t,s){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=t,this.custodian=s}}rt=it;it.default=new rt(0,0,y.default);Object.freeze({Initialize:{index:0,layout:n.struct([n.u32("instruction"),Et(),Ct()])},Authorize:{index:1,layout:n.struct([n.u32("instruction"),S("newAuthorized"),n.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:n.struct([n.u32("instruction")])},Split:{index:3,layout:n.struct([n.u32("instruction"),n.ns64("lamports")])},Withdraw:{index:4,layout:n.struct([n.u32("instruction"),n.ns64("lamports")])},Deactivate:{index:5,layout:n.struct([n.u32("instruction")])},Merge:{index:7,layout:n.struct([n.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:n.struct([n.u32("instruction"),S("newAuthorized"),n.u32("stakeAuthorizationType"),J("authoritySeed"),S("authorityOwner")])}});new y("Stake11111111111111111111111111111111111111");Object.freeze({InitializeAccount:{index:0,layout:n.struct([n.u32("instruction"),Ot()])},Authorize:{index:1,layout:n.struct([n.u32("instruction"),S("newAuthorized"),n.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:n.struct([n.u32("instruction"),n.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:n.struct([n.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:n.struct([n.u32("instruction"),Nt()])}});new y("Vote111111111111111111111111111111111111111");new y("Va1idator1nfo111111111111111111111111111111");c({name:d(),website:p(d()),details:p(d()),keybaseUsername:p(d())});new y("Vote111111111111111111111111111111111111111");n.struct([S("nodePubkey"),S("authorizedWithdrawer"),n.u8("commission"),n.nu64(),n.seq(n.struct([n.nu64("slot"),n.u32("confirmationCount")]),n.offset(n.u32(),-8),"votes"),n.u8("rootSlotValid"),n.nu64("rootSlot"),n.nu64(),n.seq(n.struct([n.nu64("epoch"),S("authorizedVoter")]),n.offset(n.u32(),-8),"authorizedVoters"),n.struct([n.seq(n.struct([S("authorizedPubkey"),n.nu64("epochOfLastAuthorizedSwitch"),n.nu64("targetEpoch")]),32,"buf"),n.nu64("idx"),n.u8("isEmpty")],"priorVoters"),n.nu64(),n.seq(n.struct([n.nu64("epoch"),n.nu64("credits"),n.nu64("prevCredits")]),n.offset(n.u32(),-8),"epochCredits"),n.struct([n.nu64("slot"),n.nu64("timestamp")],"lastTimestamp")]);const xe=new y("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new y("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const cn=new y("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new y("So11111111111111111111111111111111111111112");new y("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");class ln extends Error{constructor(e){super(e)}}class dn extends ln{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}const mn=n.struct([n.u32("mintAuthorityOption"),n.publicKey("mintAuthority"),n.u64("supply"),n.u8("decimals"),n.bool("isInitialized"),n.u32("freezeAuthorityOption"),n.publicKey("freezeAuthority")]);mn.span;function fn(r,e,t=!1,s=xe,i=cn){if(!t&&!y.isOnCurve(e.toBuffer()))throw new dn;const[a]=y.findProgramAddressSync([e.toBuffer(),s.toBuffer(),r.toBuffer()],i);return a}function at(r,e){return new n.Program(Be.TokenMessengerIdl,new y(r),e===void 0?{connection:null}:e)}function gn(r,e){return at(r,Le.createReadOnlyProvider(e))}function ot(r,e){return new n.Program(Be.MessageTransmitterIdl,new y(r),e===void 0?{connection:null}:e)}function yn(r,e){return ot(r,Le.createReadOnlyProvider(e))}const B=(r,e,t)=>{const s=[n.dist.Buffer.from(n.index.bytes.utf8.encode(r))];if(t)for(const a of t)typeof a=="string"?s.push(n.dist.Buffer.from(n.index.bytes.utf8.encode(a))):Array.isArray(a)?s.push(n.dist.Buffer.from(a)):n.dist.Buffer.isBuffer(a)?s.push(a):s.push(a.toBuffer());const i=y.findProgramAddressSync(s,e);return{publicKey:i[0],bump:i[1]}};function pn(r,e,t,s,i,a,u,m,l){const b=B("message_transmitter",r),k=B("token_messenger",e),M=B("token_minter",e),I=B("local_token",e,[t]),v=B("remote_token_messenger",e,[s.toString()]),E=B("sender_authority",e),h=at(e),w=B("__event_authority",e);return h.methods.depositForBurn({amount:new n.BN(m.toString()),destinationDomain:s,mintRecipient:new y(u.toUint8Array())}).accounts({owner:i,senderAuthorityPda:E.publicKey,burnTokenAccount:a,messageTransmitter:b.publicKey,tokenMessenger:k.publicKey,remoteTokenMessenger:v.publicKey,tokenMinter:M.publicKey,localToken:I.publicKey,burnTokenMint:t,messageTransmitterProgram:r,tokenMessengerMinterProgram:e,tokenProgram:xe,eventAuthority:w.publicKey,eventRentPayer:i,messageSentEventData:l}).instruction()}const We=6400n;function ut(r){return(r-BigInt(1))/We*We+BigInt(1)}function ct(r,e,t){const s=e.toString();return B("used_nonces",t,[s,ut(r).toString()]).publicKey}async function hn(r,e,t,s,i,a){const u=n.dist.Buffer.from(n.CircleBridge.serialize(s)),m=n.dist.Buffer.from(n.hex.decode(i)),l=new y(t),b=new y(s.payload.burnToken.toUint8Array()),k=new $.SolanaAddress(s.payload.mintRecipient).unwrap(),M=a?new y(a):k,I=s.sourceDomain.toString(),v=B("message_transmitter",r),E=B("token_messenger",e),h=B("token_minter",e),w=B("local_token",e,[l]),T=B("remote_token_messenger",e,[I]),F=B("token_pair",e,[I,b]),lt=B("custody",e,[l]),dt=B("message_transmitter_authority",r,[e]).publicKey,mt=ct(s.nonce,s.sourceDomain,r),ft=B("__event_authority",r),gt=B("__event_authority",e),D=[];D.push({isSigner:!1,isWritable:!1,pubkey:E.publicKey}),D.push({isSigner:!1,isWritable:!1,pubkey:T.publicKey}),D.push({isSigner:!1,isWritable:!0,pubkey:h.publicKey}),D.push({isSigner:!1,isWritable:!0,pubkey:w.publicKey}),D.push({isSigner:!1,isWritable:!1,pubkey:F.publicKey}),D.push({isSigner:!1,isWritable:!0,pubkey:k}),D.push({isSigner:!1,isWritable:!0,pubkey:lt.publicKey}),D.push({isSigner:!1,isWritable:!1,pubkey:xe}),D.push({isSigner:!1,isWritable:!1,pubkey:gt.publicKey}),D.push({isSigner:!1,isWritable:!1,pubkey:e});const Ke=ot(r);return Ke.methods.receiveMessage({message:u,attestation:m}).accounts({payer:M,caller:M,authorityPda:dt,messageTransmitter:v.publicKey,usedNonces:mt,receiver:e,systemProgram:ae.programId,eventAuthority:ft.publicKey,program:Ke.programId}).remainingAccounts(D).transaction()}class ye{constructor(e,t,s,i){V(this,"network");V(this,"chain");V(this,"connection");V(this,"contracts");V(this,"tokenMessenger");V(this,"messageTransmitter");var m,l;if(this.network=e,this.chain=t,this.connection=s,this.contracts=i,e==="Devnet")throw new Error("CircleBridge not supported on Devnet");const a=(m=i.cctp)==null?void 0:m.messageTransmitter;if(!a)throw new Error(`Circle Messenge Transmitter contract for domain ${t} not found`);this.messageTransmitter=yn(new y(a),this.connection);const u=(l=i.cctp)==null?void 0:l.tokenMessenger;if(!u)throw new Error(`Circle Token Messenger contract for domain ${t} not found`);this.tokenMessenger=gn(new y(u),this.connection)}static async fromRpc(e,t){const[s,i]=await $.SolanaPlatform.chainFromRpc(e),a=t[i];if(a.network!==s)throw new Error(`Network mismatch: ${a.network} != ${s}`);return new ye(s,i,e,a.contracts)}async*redeem(e,t,s){const i=new y(n.usdcContract.get(this.network,this.chain)),a=new $.SolanaAddress(e).unwrap(),u=await hn(this.messageTransmitter.programId,this.tokenMessenger.programId,i,t,s,a),m=new X;m.feePayer=a,m.add(u),yield this.createUnsignedTx({transaction:m},"CircleBridge.Redeem")}async*transfer(e,t,s){const i=new y(n.usdcContract.get(this.network,this.chain)),a=new $.SolanaAddress(e).unwrap(),u=fn(i,a),m=n.circleChainId.get(this.network,t.chain),l=t.address.toUniversalAddress(),b=se.generate(),k=await pn(this.messageTransmitter.programId,this.tokenMessenger.programId,i,m,a,u,l,s,b.publicKey),M=new X;M.feePayer=a,M.add(k),yield this.createUnsignedTx({transaction:M,signers:[b]},"CircleBridge.Transfer")}async isTransferCompleted(e){const t=ct(e.nonce,e.sourceDomain,this.messageTransmitter.programId),s=ut(e.nonce),{usedNonces:i}=await this.messageTransmitter.account.usedNonces.fetch(t),a=Number(e.nonce-s),u=i[Math.floor(a/64)];if(!u)throw new Error("Invalid nonce byte index");const m=a%64,l=new n.BN((BigInt(1)<<BigInt(m)).toString());return!u.and(l).isZero()}async parseTransactionDetails(e){const t=await this.connection.getTransaction(e);if(!t||!t.meta)throw new Error("Transaction not found");const s=t.transaction.message.getAccountKeys();if(s.length<2)throw new Error("No message account found");const i=s.get(1),a=await this.connection.getAccountInfo(i);if(!a)throw new Error("No account data found");const u=new Uint8Array(a.data).slice(44),[m,l]=n.CircleBridge.deserialize(u),{payload:b}=m,k=b.messageSender,M=b.mintRecipient,I=n.toCircleChain(this.network,m.sourceDomain),v=n.toCircleChain(this.network,m.destinationDomain),E={chain:I,address:b.burnToken};return{from:{chain:I,address:k},to:{chain:v,address:M},token:E,amount:b.amount,message:m,id:{hash:l}}}createUnsignedTx(e,t,s=!1){return new $.SolanaUnsignedTransaction(e,this.network,this.chain,t,s)}}const bn={version:"0.1.0",name:"token_messenger_minter",instructions:[{name:"initialize",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"upgradeAuthority",isMut:!1,isSigner:!0},{name:"authorityPda",isMut:!1,isSigner:!1},{name:"tokenMessenger",isMut:!0,isSigner:!1},{name:"tokenMinter",isMut:!0,isSigner:!1},{name:"tokenMessengerMinterProgramData",isMut:!1,isSigner:!1},{name:"tokenMessengerMinterProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"InitializeParams"}}]},{name:"transferOwnership",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"tokenMessenger",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"TransferOwnershipParams"}}]},{name:"acceptOwnership",accounts:[{name:"pendingOwner",isMut:!1,isSigner:!0},{name:"tokenMessenger",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"AcceptOwnershipParams"}}]},{name:"addRemoteTokenMessenger",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"owner",isMut:!1,isSigner:!0},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"remoteTokenMessenger",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"AddRemoteTokenMessengerParams"}}]},{name:"removeRemoteTokenMessenger",accounts:[{name:"payee",isMut:!0,isSigner:!0},{name:"owner",isMut:!1,isSigner:!0},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"remoteTokenMessenger",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"RemoveRemoteTokenMessengerParams"}}]},{name:"depositForBurn",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"eventRentPayer",isMut:!0,isSigner:!0},{name:"senderAuthorityPda",isMut:!1,isSigner:!1},{name:"burnTokenAccount",isMut:!0,isSigner:!1},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"remoteTokenMessenger",isMut:!1,isSigner:!1},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"localToken",isMut:!0,isSigner:!1},{name:"burnTokenMint",isMut:!0,isSigner:!1},{name:"messageSentEventData",isMut:!0,isSigner:!0},{name:"messageTransmitterProgram",isMut:!1,isSigner:!1},{name:"tokenMessengerMinterProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"DepositForBurnParams"}}],returns:"u64"},{name:"depositForBurnWithCaller",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"eventRentPayer",isMut:!0,isSigner:!0},{name:"senderAuthorityPda",isMut:!1,isSigner:!1},{name:"burnTokenAccount",isMut:!0,isSigner:!1},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"remoteTokenMessenger",isMut:!1,isSigner:!1},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"localToken",isMut:!0,isSigner:!1},{name:"burnTokenMint",isMut:!0,isSigner:!1},{name:"messageSentEventData",isMut:!0,isSigner:!0},{name:"messageTransmitterProgram",isMut:!1,isSigner:!1},{name:"tokenMessengerMinterProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"DepositForBurnWithCallerParams"}}],returns:"u64"},{name:"replaceDepositForBurn",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"eventRentPayer",isMut:!0,isSigner:!0},{name:"senderAuthorityPda",isMut:!1,isSigner:!1},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"messageSentEventData",isMut:!0,isSigner:!0},{name:"messageTransmitterProgram",isMut:!1,isSigner:!1},{name:"tokenMessengerMinterProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"ReplaceDepositForBurnParams"}}],returns:"u64"},{name:"handleReceiveMessage",accounts:[{name:"authorityPda",isMut:!1,isSigner:!0},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"remoteTokenMessenger",isMut:!1,isSigner:!1},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"localToken",isMut:!0,isSigner:!1},{name:"tokenPair",isMut:!1,isSigner:!1},{name:"recipientTokenAccount",isMut:!0,isSigner:!1},{name:"custodyTokenAccount",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"HandleReceiveMessageParams"}}]},{name:"setTokenController",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"tokenMinter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"SetTokenControllerParams"}}]},{name:"pause",accounts:[{name:"pauser",isMut:!1,isSigner:!0},{name:"tokenMinter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"PauseParams"}}]},{name:"unpause",accounts:[{name:"pauser",isMut:!1,isSigner:!0},{name:"tokenMinter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"UnpauseParams"}}]},{name:"updatePauser",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"tokenMessenger",isMut:!1,isSigner:!1},{name:"tokenMinter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"UpdatePauserParams"}}]},{name:"setMaxBurnAmountPerMessage",accounts:[{name:"tokenController",isMut:!1,isSigner:!0},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"localToken",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"SetMaxBurnAmountPerMessageParams"}}]},{name:"addLocalToken",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"tokenController",isMut:!1,isSigner:!0},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"localToken",isMut:!0,isSigner:!1},{name:"custodyTokenAccount",isMut:!0,isSigner:!1},{name:"localTokenMint",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"AddLocalTokenParams"}}]},{name:"removeLocalToken",accounts:[{name:"payee",isMut:!0,isSigner:!0},{name:"tokenController",isMut:!1,isSigner:!0},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"localToken",isMut:!0,isSigner:!1},{name:"custodyTokenAccount",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"RemoveLocalTokenParams"}}]},{name:"linkTokenPair",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"tokenController",isMut:!1,isSigner:!0},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"tokenPair",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"LinkTokenPairParams"}}]},{name:"unlinkTokenPair",accounts:[{name:"payee",isMut:!0,isSigner:!0},{name:"tokenController",isMut:!1,isSigner:!0},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"tokenPair",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"UninkTokenPairParams"}}]},{name:"burnTokenCustody",accounts:[{name:"payee",isMut:!0,isSigner:!0},{name:"tokenController",isMut:!1,isSigner:!0},{name:"tokenMinter",isMut:!1,isSigner:!1},{name:"localToken",isMut:!1,isSigner:!1},{name:"custodyTokenAccount",isMut:!0,isSigner:!1},{name:"custodyTokenMint",isMut:!0,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"BurnTokenCustodyParams"}}]}],accounts:[{name:"tokenMessenger",type:{kind:"struct",fields:[{name:"owner",type:"publicKey"},{name:"pendingOwner",type:"publicKey"},{name:"localMessageTransmitter",type:"publicKey"},{name:"messageBodyVersion",type:"u32"},{name:"authorityBump",type:"u8"}]}},{name:"remoteTokenMessenger",type:{kind:"struct",fields:[{name:"domain",type:"u32"},{name:"tokenMessenger",type:"publicKey"}]}},{name:"tokenMinter",type:{kind:"struct",fields:[{name:"tokenController",type:"publicKey"},{name:"pauser",type:"publicKey"},{name:"paused",type:"bool"},{name:"bump",type:"u8"}]}},{name:"tokenPair",type:{kind:"struct",fields:[{name:"remoteDomain",type:"u32"},{name:"remoteToken",type:"publicKey"},{name:"localToken",type:"publicKey"},{name:"bump",type:"u8"}]}},{name:"localToken",type:{kind:"struct",fields:[{name:"custody",type:"publicKey"},{name:"mint",type:"publicKey"},{name:"burnLimitPerMessage",type:"u64"},{name:"messagesSent",type:"u64"},{name:"messagesReceived",type:"u64"},{name:"amountSent",type:"u128"},{name:"amountReceived",type:"u128"},{name:"bump",type:"u8"},{name:"custodyBump",type:"u8"}]}}],types:[{name:"AcceptOwnershipParams",type:{kind:"struct",fields:[]}},{name:"AddRemoteTokenMessengerParams",type:{kind:"struct",fields:[{name:"domain",type:"u32"},{name:"tokenMessenger",type:"publicKey"}]}},{name:"DepositForBurnWithCallerParams",type:{kind:"struct",fields:[{name:"amount",type:"u64"},{name:"destinationDomain",type:"u32"},{name:"mintRecipient",type:"publicKey"},{name:"destinationCaller",type:"publicKey"}]}},{name:"DepositForBurnParams",type:{kind:"struct",fields:[{name:"amount",type:"u64"},{name:"destinationDomain",type:"u32"},{name:"mintRecipient",type:"publicKey"}]}},{name:"HandleReceiveMessageParams",type:{kind:"struct",fields:[{name:"remoteDomain",type:"u32"},{name:"sender",type:"publicKey"},{name:"messageBody",type:"bytes"},{name:"authorityBump",type:"u8"}]}},{name:"InitializeParams",type:{kind:"struct",fields:[{name:"tokenController",type:"publicKey"},{name:"localMessageTransmitter",type:"publicKey"},{name:"messageBodyVersion",type:"u32"}]}},{name:"RemoveRemoteTokenMessengerParams",type:{kind:"struct",fields:[]}},{name:"ReplaceDepositForBurnParams",type:{kind:"struct",fields:[{name:"originalMessage",type:"bytes"},{name:"originalAttestation",type:"bytes"},{name:"newDestinationCaller",type:"publicKey"},{name:"newMintRecipient",type:"publicKey"}]}},{name:"TransferOwnershipParams",type:{kind:"struct",fields:[{name:"newOwner",type:"publicKey"}]}},{name:"AddLocalTokenParams",type:{kind:"struct",fields:[]}},{name:"BurnTokenCustodyParams",type:{kind:"struct",fields:[{name:"amount",type:"u64"}]}},{name:"LinkTokenPairParams",type:{kind:"struct",fields:[{name:"localToken",type:"publicKey"},{name:"remoteDomain",type:"u32"},{name:"remoteToken",type:"publicKey"}]}},{name:"PauseParams",type:{kind:"struct",fields:[]}},{name:"RemoveLocalTokenParams",type:{kind:"struct",fields:[]}},{name:"SetMaxBurnAmountPerMessageParams",type:{kind:"struct",fields:[{name:"burnLimitPerMessage",type:"u64"}]}},{name:"SetTokenControllerParams",type:{kind:"struct",fields:[{name:"tokenController",type:"publicKey"}]}},{name:"UninkTokenPairParams",type:{kind:"struct",fields:[]}},{name:"UnpauseParams",type:{kind:"struct",fields:[]}},{name:"UpdatePauserParams",type:{kind:"struct",fields:[{name:"newPauser",type:"publicKey"}]}},{name:"TokenMinterError",type:{kind:"enum",variants:[{name:"InvalidAuthority"},{name:"InvalidTokenMinterState"},{name:"ProgramPaused"},{name:"InvalidTokenPairState"},{name:"InvalidLocalTokenState"},{name:"InvalidPauser"},{name:"InvalidTokenController"},{name:"BurnAmountExceeded"},{name:"InvalidAmount"}]}}],events:[{name:"OwnershipTransferStarted",fields:[{name:"previousOwner",type:"publicKey",index:!1},{name:"newOwner",type:"publicKey",index:!1}]},{name:"OwnershipTransferred",fields:[{name:"previousOwner",type:"publicKey",index:!1},{name:"newOwner",type:"publicKey",index:!1}]},{name:"DepositForBurn",fields:[{name:"nonce",type:"u64",index:!1},{name:"burnToken",type:"publicKey",index:!1},{name:"amount",type:"u64",index:!1},{name:"depositor",type:"publicKey",index:!1},{name:"mintRecipient",type:"publicKey",index:!1},{name:"destinationDomain",type:"u32",index:!1},{name:"destinationTokenMessenger",type:"publicKey",index:!1},{name:"destinationCaller",type:"publicKey",index:!1}]},{name:"MintAndWithdraw",fields:[{name:"mintRecipient",type:"publicKey",index:!1},{name:"amount",type:"u64",index:!1},{name:"mintToken",type:"publicKey",index:!1}]},{name:"RemoteTokenMessengerAdded",fields:[{name:"domain",type:"u32",index:!1},{name:"tokenMessenger",type:"publicKey",index:!1}]},{name:"RemoteTokenMessengerRemoved",fields:[{name:"domain",type:"u32",index:!1},{name:"tokenMessenger",type:"publicKey",index:!1}]},{name:"SetTokenController",fields:[{name:"tokenController",type:"publicKey",index:!1}]},{name:"PauserChanged",fields:[{name:"newAddress",type:"publicKey",index:!1}]},{name:"SetBurnLimitPerMessage",fields:[{name:"token",type:"publicKey",index:!1},{name:"burnLimitPerMessage",type:"u64",index:!1}]},{name:"LocalTokenAdded",fields:[{name:"custody",type:"publicKey",index:!1},{name:"mint",type:"publicKey",index:!1}]},{name:"LocalTokenRemoved",fields:[{name:"custody",type:"publicKey",index:!1},{name:"mint",type:"publicKey",index:!1}]},{name:"TokenPairLinked",fields:[{name:"localToken",type:"publicKey",index:!1},{name:"remoteDomain",type:"u32",index:!1},{name:"remoteToken",type:"publicKey",index:!1}]},{name:"TokenPairUnlinked",fields:[{name:"localToken",type:"publicKey",index:!1},{name:"remoteDomain",type:"u32",index:!1},{name:"remoteToken",type:"publicKey",index:!1}]},{name:"Pause",fields:[]},{name:"Unpause",fields:[]},{name:"TokenCustodyBurned",fields:[{name:"custodyTokenAccount",type:"publicKey",index:!1},{name:"amount",type:"u64",index:!1}]}],errors:[{code:6e3,name:"InvalidAuthority",msg:"Invalid authority"},{code:6001,name:"InvalidTokenMessengerState",msg:"Invalid token messenger state"},{code:6002,name:"InvalidTokenMessenger",msg:"Invalid token messenger"},{code:6003,name:"InvalidOwner",msg:"Invalid owner"},{code:6004,name:"MalformedMessage",msg:"Malformed message"},{code:6005,name:"InvalidMessageBodyVersion",msg:"Invalid message body version"},{code:6006,name:"InvalidAmount",msg:"Invalid amount"},{code:6007,name:"InvalidDestinationDomain",msg:"Invalid destination domain"},{code:6008,name:"InvalidDestinationCaller",msg:"Invalid destination caller"},{code:6009,name:"InvalidMintRecipient",msg:"Invalid mint recipient"},{code:6010,name:"InvalidSender",msg:"Invalid sender"},{code:6011,name:"InvalidTokenPair",msg:"Invalid token pair"},{code:6012,name:"InvalidTokenMint",msg:"Invalid token mint"}]},Sn={version:"0.1.0",name:"message_transmitter",instructions:[{name:"initialize",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"upgradeAuthority",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"messageTransmitterProgramData",isMut:!1,isSigner:!1},{name:"messageTransmitterProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"InitializeParams"}}]},{name:"transferOwnership",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"TransferOwnershipParams"}}]},{name:"acceptOwnership",accounts:[{name:"pendingOwner",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"AcceptOwnershipParams"}}]},{name:"updatePauser",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"UpdatePauserParams"}}]},{name:"updateAttesterManager",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"UpdateAttesterManagerParams"}}]},{name:"pause",accounts:[{name:"pauser",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"PauseParams"}}]},{name:"unpause",accounts:[{name:"pauser",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"UnpauseParams"}}]},{name:"setMaxMessageBodySize",accounts:[{name:"owner",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"SetMaxMessageBodySizeParams"}}]},{name:"enableAttester",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"attesterManager",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"EnableAttesterParams"}}]},{name:"disableAttester",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"attesterManager",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"DisableAttesterParams"}}]},{name:"setSignatureThreshold",accounts:[{name:"attesterManager",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"SetSignatureThresholdParams"}}]},{name:"sendMessage",accounts:[{name:"eventRentPayer",isMut:!0,isSigner:!0},{name:"senderAuthorityPda",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"messageSentEventData",isMut:!0,isSigner:!0},{name:"senderProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"SendMessageParams"}}],returns:"u64"},{name:"sendMessageWithCaller",accounts:[{name:"eventRentPayer",isMut:!0,isSigner:!0},{name:"senderAuthorityPda",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"messageSentEventData",isMut:!0,isSigner:!0},{name:"senderProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"SendMessageWithCallerParams"}}],returns:"u64"},{name:"replaceMessage",accounts:[{name:"eventRentPayer",isMut:!0,isSigner:!0},{name:"senderAuthorityPda",isMut:!1,isSigner:!0},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"messageSentEventData",isMut:!0,isSigner:!0},{name:"senderProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"ReplaceMessageParams"}}],returns:"u64"},{name:"receiveMessage",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"caller",isMut:!1,isSigner:!0},{name:"authorityPda",isMut:!1,isSigner:!1},{name:"messageTransmitter",isMut:!1,isSigner:!1},{name:"usedNonces",isMut:!0,isSigner:!1},{name:"receiver",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"eventAuthority",isMut:!1,isSigner:!1},{name:"program",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"ReceiveMessageParams"}}]},{name:"reclaimEventAccount",accounts:[{name:"payee",isMut:!0,isSigner:!0,docs:["rent SOL receiver, should match original rent payer"]},{name:"messageTransmitter",isMut:!0,isSigner:!1},{name:"messageSentEventData",isMut:!0,isSigner:!1}],args:[{name:"params",type:{defined:"ReclaimEventAccountParams"}}]},{name:"getNoncePda",accounts:[{name:"messageTransmitter",isMut:!1,isSigner:!1}],args:[{name:"params",type:{defined:"GetNoncePDAParams"}}],returns:"publicKey"},{name:"isNonceUsed",accounts:[{name:"usedNonces",isMut:!1,isSigner:!1,docs:["Account will be explicitly loaded to avoid error when it's not initialized"]}],args:[{name:"params",type:{defined:"IsNonceUsedParams"}}],returns:"bool"}],accounts:[{name:"messageSent",type:{kind:"struct",fields:[{name:"rentPayer",type:"publicKey"},{name:"message",type:"bytes"}]}},{name:"messageTransmitter",docs:["Main state of the MessageTransmitter program"],type:{kind:"struct",fields:[{name:"owner",type:"publicKey"},{name:"pendingOwner",type:"publicKey"},{name:"attesterManager",type:"publicKey"},{name:"pauser",type:"publicKey"},{name:"paused",type:"bool"},{name:"localDomain",type:"u32"},{name:"version",type:"u32"},{name:"signatureThreshold",type:"u32"},{name:"enabledAttesters",type:{vec:"publicKey"}},{name:"maxMessageBodySize",type:"u64"},{name:"nextAvailableNonce",type:"u64"}]}},{name:"usedNonces",docs:["UsedNonces account holds an array of bits that indicate which nonces were already used","so they can't be resused to receive new messages. Array starts with the first_nonce and","holds flags for UsedNonces::MAX_NONCES. Nonces are recorded separately for each remote_domain."],type:{kind:"struct",fields:[{name:"remoteDomain",type:"u32"},{name:"firstNonce",type:"u64"},{name:"usedNonces",type:{array:["u64",100]}}]}}],types:[{name:"AcceptOwnershipParams",type:{kind:"struct",fields:[]}},{name:"DisableAttesterParams",type:{kind:"struct",fields:[{name:"attester",type:"publicKey"}]}},{name:"EnableAttesterParams",type:{kind:"struct",fields:[{name:"newAttester",type:"publicKey"}]}},{name:"GetNoncePDAParams",type:{kind:"struct",fields:[{name:"nonce",type:"u64"},{name:"sourceDomain",type:"u32"}]}},{name:"InitializeParams",type:{kind:"struct",fields:[{name:"localDomain",type:"u32"},{name:"attester",type:"publicKey"},{name:"maxMessageBodySize",type:"u64"},{name:"version",type:"u32"}]}},{name:"IsNonceUsedParams",type:{kind:"struct",fields:[{name:"nonce",type:"u64"}]}},{name:"PauseParams",type:{kind:"struct",fields:[]}},{name:"ReceiveMessageParams",type:{kind:"struct",fields:[{name:"message",type:"bytes"},{name:"attestation",type:"bytes"}]}},{name:"HandleReceiveMessageParams",type:{kind:"struct",fields:[{name:"remoteDomain",type:"u32"},{name:"sender",type:"publicKey"},{name:"messageBody",type:"bytes"},{name:"authorityBump",type:"u8"}]}},{name:"ReclaimEventAccountParams",type:{kind:"struct",fields:[{name:"attestation",type:"bytes"}]}},{name:"ReplaceMessageParams",type:{kind:"struct",fields:[{name:"originalMessage",type:"bytes"},{name:"originalAttestation",type:"bytes"},{name:"newMessageBody",type:"bytes"},{name:"newDestinationCaller",type:"publicKey"}]}},{name:"SendMessageWithCallerParams",type:{kind:"struct",fields:[{name:"destinationDomain",type:"u32"},{name:"recipient",type:"publicKey"},{name:"messageBody",type:"bytes"},{name:"destinationCaller",type:"publicKey"}]}},{name:"SendMessageParams",type:{kind:"struct",fields:[{name:"destinationDomain",type:"u32"},{name:"recipient",type:"publicKey"},{name:"messageBody",type:"bytes"}]}},{name:"SetMaxMessageBodySizeParams",type:{kind:"struct",fields:[{name:"newMaxMessageBodySize",type:"u64"}]}},{name:"SetSignatureThresholdParams",type:{kind:"struct",fields:[{name:"newSignatureThreshold",type:"u32"}]}},{name:"TransferOwnershipParams",type:{kind:"struct",fields:[{name:"newOwner",type:"publicKey"}]}},{name:"UnpauseParams",type:{kind:"struct",fields:[]}},{name:"UpdateAttesterManagerParams",type:{kind:"struct",fields:[{name:"newAttesterManager",type:"publicKey"}]}},{name:"UpdatePauserParams",type:{kind:"struct",fields:[{name:"newPauser",type:"publicKey"}]}},{name:"MathError",type:{kind:"enum",variants:[{name:"MathOverflow"},{name:"MathUnderflow"},{name:"ErrorInDivision"}]}}],events:[{name:"OwnershipTransferStarted",fields:[{name:"previousOwner",type:"publicKey",index:!1},{name:"newOwner",type:"publicKey",index:!1}]},{name:"OwnershipTransferred",fields:[{name:"previousOwner",type:"publicKey",index:!1},{name:"newOwner",type:"publicKey",index:!1}]},{name:"PauserChanged",fields:[{name:"newAddress",type:"publicKey",index:!1}]},{name:"AttesterManagerUpdated",fields:[{name:"previousAttesterManager",type:"publicKey",index:!1},{name:"newAttesterManager",type:"publicKey",index:!1}]},{name:"MessageReceived",fields:[{name:"caller",type:"publicKey",index:!1},{name:"sourceDomain",type:"u32",index:!1},{name:"nonce",type:"u64",index:!1},{name:"sender",type:"publicKey",index:!1},{name:"messageBody",type:"bytes",index:!1}]},{name:"SignatureThresholdUpdated",fields:[{name:"oldSignatureThreshold",type:"u32",index:!1},{name:"newSignatureThreshold",type:"u32",index:!1}]},{name:"AttesterEnabled",fields:[{name:"attester",type:"publicKey",index:!1}]},{name:"AttesterDisabled",fields:[{name:"attester",type:"publicKey",index:!1}]},{name:"MaxMessageBodySizeUpdated",fields:[{name:"newMaxMessageBodySize",type:"u64",index:!1}]},{name:"Pause",fields:[]},{name:"Unpause",fields:[]}],errors:[{code:6e3,name:"InvalidAuthority",msg:"Invalid authority"},{code:6001,name:"ProgramPaused",msg:"Instruction is not allowed at this time"},{code:6002,name:"InvalidMessageTransmitterState",msg:"Invalid message transmitter state"},{code:6003,name:"InvalidSignatureThreshold",msg:"Invalid signature threshold"},{code:6004,name:"SignatureThresholdAlreadySet",msg:"Signature threshold already set"},{code:6005,name:"InvalidOwner",msg:"Invalid owner"},{code:6006,name:"InvalidPauser",msg:"Invalid pauser"},{code:6007,name:"InvalidAttesterManager",msg:"Invalid attester manager"},{code:6008,name:"InvalidAttester",msg:"Invalid attester"},{code:6009,name:"AttesterAlreadyEnabled",msg:"Attester already enabled"},{code:6010,name:"TooFewEnabledAttesters",msg:"Too few enabled attesters"},{code:6011,name:"SignatureThresholdTooLow",msg:"Signature threshold is too low"},{code:6012,name:"AttesterAlreadyDisabled",msg:"Attester already disabled"},{code:6013,name:"MessageBodyLimitExceeded",msg:"Message body exceeds max size"},{code:6014,name:"InvalidDestinationCaller",msg:"Invalid destination caller"},{code:6015,name:"InvalidRecipient",msg:"Invalid message recipient"},{code:6016,name:"SenderNotPermitted",msg:"Sender is not permitted"},{code:6017,name:"InvalidSourceDomain",msg:"Invalid source domain"},{code:6018,name:"InvalidDestinationDomain",msg:"Invalid destination domain"},{code:6019,name:"InvalidMessageVersion",msg:"Invalid message version"},{code:6020,name:"InvalidUsedNoncesAccount",msg:"Invalid used nonces account"},{code:6021,name:"InvalidRecipientProgram",msg:"Invalid recipient program"},{code:6022,name:"InvalidNonce",msg:"Invalid nonce"},{code:6023,name:"NonceAlreadyUsed",msg:"Nonce already used"},{code:6024,name:"MessageTooShort",msg:"Message is too short"},{code:6025,name:"MalformedMessage",msg:"Malformed message"},{code:6026,name:"InvalidSignatureOrderOrDupe",msg:"Invalid signature order or dupe"},{code:6027,name:"InvalidAttesterSignature",msg:"Invalid attester signature"},{code:6028,name:"InvalidAttestationLength",msg:"Invalid attestation length"},{code:6029,name:"InvalidSignatureRecoveryId",msg:"Invalid signature recovery ID"},{code:6030,name:"InvalidSignatureSValue",msg:"Invalid signature S value"},{code:6031,name:"InvalidMessageHash",msg:"Invalid message hash"}]};ht.registerProtocol($._platform,"CircleBridge",ye);const Be={TokenMessengerIdl:bn,MessageTransmitterIdl:Sn};exports.SolanaCircleBridge=ye;exports.idl=Be;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as _t, s as ce, T as N, o as ot, R as Uo, a as C, t as H, p as K, y as gt } from "./index-
|
|
1
|
+
import { n as _t, s as ce, T as N, o as ot, R as Uo, a as C, t as H, p as K, y as gt } from "./index-DGRaAUXo.mjs";
|
|
2
2
|
import { d as Wo } from "./dijkstra-BZM-8g-B.mjs";
|
|
3
|
-
import { d as Ho } from "./index-
|
|
3
|
+
import { d as Ho } from "./index-CdSy2Lfd.mjs";
|
|
4
4
|
var jo = function(t) {
|
|
5
5
|
for (var r = [], n = t.length, o = 0; o < n; o++) {
|
|
6
6
|
var i = t.charCodeAt(o);
|
|
@@ -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-
|
|
5
|
-
import { bp as g } from "./index-
|
|
6
|
-
import { c as l } from "./create-
|
|
7
|
-
import { r as u } from "./chain-
|
|
4
|
+
import { S as m, o as p, _ as w } from "./sui-DDu4a1uc.mjs";
|
|
5
|
+
import { bp as g } from "./index-CdSy2Lfd.mjs";
|
|
6
|
+
import { c as l } from "./create-HNw0Emrd.mjs";
|
|
7
|
+
import { r as u } from "./chain-CbwtJlkc.mjs";
|
|
8
8
|
class c {
|
|
9
9
|
constructor(e, r, t, o) {
|
|
10
10
|
n(this, "network");
|