"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[814],{5265:function(e,t,r){r.d(t,{GS:function(){return N},YW:function(){return U}});var n=r(3663),i=r(8237),s=r(4108),a=r.n(s),o=r(8430),u=r.n(o),c=r(3940),l=r(4072),d=r(2109),h=r(9401),g=r(1544);r(4967),r(9787);var p=r(9400),y=r(8923);i.UN.utils.randomPrivateKey;let b=()=>{let e=i.UN.utils.randomPrivateKey(),t=m(e),r=new Uint8Array(64);return r.set(e),r.set(t,32),{publicKey:t,secretKey:r}},m=i.UN.getPublicKey;function f(e){try{return i.UN.ExtendedPoint.fromHex(e),!0}catch(e){return!1}}let k=(e,t)=>i.UN.sign(e,t.slice(0,32)),I=i.UN.verify,x=e=>n.Buffer.isBuffer(e)?e:e instanceof Uint8Array?n.Buffer.from(e.buffer,e.byteOffset,e.byteLength):n.Buffer.from(e);class S{encode(){return n.Buffer.from((0,l.qC)(w,this))}static decode(e){return(0,l.vB)(w,this,e)}static decodeUnchecked(e){return(0,l.XG)(w,this,e)}constructor(e){Object.assign(this,e)}}let w=new Map,A=1;class v extends S{static unique(){let e=new v(A);return A+=1,new v(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return u().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){let e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){let e=this._bn.toArrayLike(n.Buffer);if(32===e.length)return e;let t=n.Buffer.alloc(32);return e.copy(t,32-e.length),t}get[Symbol.toStringTag](){return"PublicKey(".concat(this.toString(),")")}toString(){return this.toBase58()}static async createWithSeed(e,t,r){let i=n.Buffer.concat([e.toBuffer(),n.Buffer.from(t),r.toBuffer()]);return new v((0,c.JQ)(i))}static createProgramAddressSync(e,t){let r=n.Buffer.alloc(0);e.forEach(function(e){if(e.length>32)throw TypeError("Max seed length exceeded");r=n.Buffer.concat([r,x(e)])}),r=n.Buffer.concat([r,t.toBuffer(),n.Buffer.from("ProgramDerivedAddress")]);let i=(0,c.JQ)(r);if(f(i))throw Error("Invalid seeds, address must fall off the curve");return new v(i)}static async createProgramAddress(e,t){return this.createProgramAddressSync(e,t)}static findProgramAddressSync(e,t){let r,i=255;for(;0!=i;){try{let s=e.concat(n.Buffer.from([i]));r=this.createProgramAddressSync(s,t)}catch(e){if(e instanceof TypeError)throw e;i--;continue}return[r,i]}throw Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,t){return this.findProgramAddressSync(e,t)}static isOnCurve(e){return f(new v(e).toBytes())}constructor(e){if(super({}),this._bn=void 0,void 0!==e._bn)this._bn=e._bn;else{if("string"==typeof e){let t=u().decode(e);if(32!=t.length)throw Error("Invalid public key input");this._bn=new(a())(t)}else this._bn=new(a())(e);if(this._bn.byteLength()>32)throw Error("Invalid public key input")}}}v.default=new v("11111111111111111111111111111111"),w.set(v,{kind:"struct",fields:[["_bn","u256"]]}),new v("BPFLoader1111111111111111111111111111111111");class _ extends Error{constructor(e){super("Signature ".concat(e," has expired: block height exceeded.")),this.signature=void 0,this.signature=e}}Object.defineProperty(_.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class R extends Error{constructor(e,t){super("Transaction was not confirmed in ".concat(t.toFixed(2)," seconds. It is ")+"unknown if it succeeded or failed. Check signature "+"".concat(e," using the Solana Explorer or CLI tools.")),this.signature=void 0,this.signature=e}}Object.defineProperty(R.prototype,"name",{value:"TransactionExpiredTimeoutError"});class B extends Error{constructor(e){super("Signature ".concat(e," has expired: the nonce is no longer valid.")),this.signature=void 0,this.signature=e}}Object.defineProperty(B.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class W{keySegments(){let e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(let t of this.keySegments()){if(e256)throw Error("Account index overflow encountered during compilation");let t=new Map;this.keySegments().flat().forEach((e,r)=>{t.set(e.toBase58(),r)});let r=e=>{let r=t.get(e.toBase58());if(void 0===r)throw Error("Encountered an unknown instruction account key during compilation");return r};return e.map(e=>({programIdIndex:r(e.programId),accountKeyIndexes:e.keys.map(e=>r(e.pubkey)),data:e.data}))}constructor(e,t){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=t}}let P=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"publicKey";return d.Ik(32,e)},K=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature";return d.Ik(64,e)},T=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"string",t=d.n_([d.Jq("length"),d.Jq("lengthPadding"),d.Ik(d.cv(d.Jq(),-8),"chars")],e),r=t.decode.bind(t),i=t.encode.bind(t);return t.decode=(e,t)=>r(e,t).chars.toString(),t.encode=(e,t,r)=>i({chars:n.Buffer.from(e,"utf8")},t,r),t.alloc=e=>d.Jq().span+d.Jq().span+n.Buffer.from(e,"utf8").length,t};function z(e){let t=0,r=0;for(;;){let n=e.shift();if(t|=(127&n)<<7*r,r+=1,(128&n)==0)break}return t}function E(e,t){let r=t;for(;;){let t=127&r;if(0==(r>>=7)){e.push(t);break}t|=128,e.push(t)}}function L(e,t){if(!e)throw Error(t||"Assertion failed")}class q{static compile(e,t){let r=new Map,n=e=>{let t=e.toBase58(),n=r.get(t);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(t,n)),n},i=n(t);for(let t of(i.isSigner=!0,i.isWritable=!0,e))for(let e of(n(t.programId).isInvoked=!0,t.keys)){let t=n(e.pubkey);t.isSigner||(t.isSigner=e.isSigner),t.isWritable||(t.isWritable=e.isWritable)}return new q(t,r)}getMessageComponents(){let e=[...this.keyMetaMap.entries()];L(e.length<=256,"Max static account keys length exceeded");let t=e.filter(e=>{let[,t]=e;return t.isSigner&&t.isWritable}),r=e.filter(e=>{let[,t]=e;return t.isSigner&&!t.isWritable}),n=e.filter(e=>{let[,t]=e;return!t.isSigner&&t.isWritable}),i=e.filter(e=>{let[,t]=e;return!t.isSigner&&!t.isWritable}),s={numRequiredSignatures:t.length+r.length,numReadonlySignedAccounts:r.length,numReadonlyUnsignedAccounts:i.length};{L(t.length>0,"Expected at least one writable signer key");let[e]=t[0];L(e===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[s,[...t.map(e=>{let[t]=e;return new v(t)}),...r.map(e=>{let[t]=e;return new v(t)}),...n.map(e=>{let[t]=e;return new v(t)}),...i.map(e=>{let[t]=e;return new v(t)})]]}extractTableLookup(e){let[t,r]=this.drainKeysFoundInLookupTable(e.state.addresses,e=>!e.isSigner&&!e.isInvoked&&e.isWritable),[n,i]=this.drainKeysFoundInLookupTable(e.state.addresses,e=>!e.isSigner&&!e.isInvoked&&!e.isWritable);if(0!==t.length||0!==n.length)return[{accountKey:e.key,writableIndexes:t,readonlyIndexes:n},{writable:r,readonly:i}]}drainKeysFoundInLookupTable(e,t){let r=[],n=[];for(let[i,s]of this.keyMetaMap.entries())if(t(s)){let t=new v(i),s=e.findIndex(e=>e.equals(t));s>=0&&(L(s<256,"Max lookup table index exceeded"),r.push(s),n.push(t),this.keyMetaMap.delete(i))}return[r,n]}constructor(e,t){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=t}}let G="Reached end of buffer unexpectedly";function Z(e){if(0===e.length)throw Error(G);return e.shift()}function O(e){for(var t,r=arguments.length,n=Array(r>1?r-1:0),i=1;ie.length:s>=e.length)throw Error(G);return e.splice(...n)}class j{get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:u().decode(e.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new W(this.staticAccountKeys)}static compile(e){let[t,r]=q.compile(e.instructions,e.payerKey).getMessageComponents(),n=new W(r).compileInstructions(e.instructions).map(e=>({programIdIndex:e.programIdIndex,accounts:e.accountKeyIndexes,data:u().encode(e.data)}));return new j({header:t,accountKeys:r,recentBlockhash:e.recentBlockhash,instructions:n})}isAccountSigner(e){return e=this.header.numRequiredSignatures))return e!this.isProgramId(t))}serialize(){let e=this.accountKeys.length,t=[];E(t,e);let r=this.instructions.map(e=>{let{accounts:t,programIdIndex:r}=e,i=Array.from(u().decode(e.data)),s=[];E(s,t.length);let a=[];return E(a,i.length),{programIdIndex:r,keyIndicesCount:n.Buffer.from(s),keyIndices:t,dataLength:n.Buffer.from(a),data:i}}),i=[];E(i,r.length);let s=n.Buffer.alloc(1232);n.Buffer.from(i).copy(s);let a=i.length;r.forEach(e=>{let t=d.n_([d.u8("programIdIndex"),d.Ik(e.keyIndicesCount.length,"keyIndicesCount"),d.A9(d.u8("keyIndex"),e.keyIndices.length,"keyIndices"),d.Ik(e.dataLength.length,"dataLength"),d.A9(d.u8("userdatum"),e.data.length,"data")]).encode(e,s,a);a+=t}),s=s.slice(0,a);let o=d.n_([d.Ik(1,"numRequiredSignatures"),d.Ik(1,"numReadonlySignedAccounts"),d.Ik(1,"numReadonlyUnsignedAccounts"),d.Ik(t.length,"keyCount"),d.A9(P("key"),e,"keys"),P("recentBlockhash")]),c={numRequiredSignatures:n.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:n.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:n.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:n.Buffer.from(t),keys:this.accountKeys.map(e=>x(e.toBytes())),recentBlockhash:u().decode(this.recentBlockhash)},l=n.Buffer.alloc(2048),h=o.encode(c,l);return s.copy(l,h),l.slice(0,h+s.length)}static from(e){let t=[...e],r=Z(t);if(r!==(127&r))throw Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let i=Z(t),s=Z(t),a=z(t),o=[];for(let e=0;enew v(e)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex]))}}class J{get version(){return 0}get numAccountKeysFromLookups(){let e=0;for(let t of this.addressTableLookups)e+=t.readonlyIndexes.length+t.writableIndexes.length;return e}getAccountKeys(e){let t;if(e&&"accountKeysFromLookups"in e&&e.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=e.accountKeysFromLookups.writable.length+e.accountKeysFromLookups.readonly.length)throw Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");t=e.accountKeysFromLookups}else if(e&&"addressLookupTableAccounts"in e&&e.addressLookupTableAccounts)t=this.resolveAddressTableLookups(e.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw Error("Failed to get account keys because address table lookups were not resolved");return new W(this.staticAccountKeys,t)}isAccountSigner(e){return e=r)return e-re+t.writableIndexes.length,0);if(!(e>=this.header.numRequiredSignatures))return ee.key.equals(r.accountKey));if(!n)throw Error("Failed to find address lookup table account for table key ".concat(r.accountKey.toBase58()));for(let e of r.writableIndexes)if(ee.toBytes()),recentBlockhash:u().decode(this.recentBlockhash),instructionsLength:new Uint8Array(r),serializedInstructions:t,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:n},a);return a.slice(0,o)}serializeInstructions(){let e=0,t=new Uint8Array(1232);for(let r of this.compiledInstructions){let n=[];E(n,r.accountKeyIndexes.length);let i=[];E(i,r.data.length);let s=d.n_([d.u8("programIdIndex"),d.Ik(n.length,"encodedAccountKeyIndexesLength"),d.A9(d.u8(),r.accountKeyIndexes.length,"accountKeyIndexes"),d.Ik(i.length,"encodedDataLength"),d.Ik(r.data.length,"data")]);e+=s.encode({programIdIndex:r.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(n),accountKeyIndexes:r.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:r.data},t,e)}return t.slice(0,e)}serializeAddressTableLookups(){let e=0,t=new Uint8Array(1232);for(let r of this.addressTableLookups){let n=[];E(n,r.writableIndexes.length);let i=[];E(i,r.readonlyIndexes.length);let s=d.n_([P("accountKey"),d.Ik(n.length,"encodedWritableIndexesLength"),d.A9(d.u8(),r.writableIndexes.length,"writableIndexes"),d.Ik(i.length,"encodedReadonlyIndexesLength"),d.A9(d.u8(),r.readonlyIndexes.length,"readonlyIndexes")]);e+=s.encode({accountKey:r.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(n),writableIndexes:r.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:r.readonlyIndexes},t,e)}return t.slice(0,e)}static deserialize(e){let t=[...e],r=Z(t),n=127&r;L(r!==n,"Expected versioned message but received legacy message"),L(0===n,"Expected versioned message with version 0 but found version ".concat(n));let i={numRequiredSignatures:Z(t),numReadonlySignedAccounts:Z(t),numReadonlyUnsignedAccounts:Z(t)},s=[],a=z(t);for(let e=0;e{let t=X.deserializeMessageVersion(e);if("legacy"===t)return j.from(e);if(0===t)return J.deserialize(e);throw Error("Transaction message version ".concat(t," deserialization is not supported"))}},M=n.Buffer.alloc(64).fill(0);class C{toJSON(){return{keys:this.keys.map(e=>{let{pubkey:t,isSigner:r,isWritable:n}=e;return{pubkey:t.toJSON(),isSigner:r,isWritable:n}}),programId:this.programId.toJSON(),data:[...this.data]}}constructor(e){this.keys=void 0,this.programId=void 0,this.data=n.Buffer.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}}class U{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}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(e=>{let{publicKey:t}=e;return t.toJSON()})}}add(){for(var e=arguments.length,t=Array(e),r=0;r{"instructions"in e?this.instructions=this.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?this.instructions.push(e):this.instructions.push(new C(e))}),this}compileMessage(){let e,t,r;if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;if(this.nonceInfo?(e=this.nonceInfo.nonce,t=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(e=this.recentBlockhash,t=this.instructions),!e)throw Error("Transaction recentBlockhash required");if(t.length<1&&console.warn("No instructions provided"),this.feePayer)r=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)r=this.signatures[0].publicKey;else throw Error("Transaction fee payer required");for(let e=0;e{e.keys.forEach(e=>{i.push({...e})});let t=e.programId.toString();n.includes(t)||n.push(t)}),n.forEach(e=>{i.push({pubkey:new v(e),isSigner:!1,isWritable:!1})});let s=[];i.forEach(e=>{let t=e.pubkey.toString(),r=s.findIndex(e=>e.pubkey.toString()===t);r>-1?(s[r].isWritable=s[r].isWritable||e.isWritable,s[r].isSigner=s[r].isSigner||e.isSigner):s.push(e)}),s.sort(function(e,t){return e.isSigner!==t.isSigner?e.isSigner?-1:1:e.isWritable!==t.isWritable?e.isWritable?-1:1:e.pubkey.toBase58().localeCompare(t.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})});let a=s.findIndex(e=>e.pubkey.equals(r));if(a>-1){let[e]=s.splice(a,1);e.isSigner=!0,e.isWritable=!0,s.unshift(e)}else s.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(let e of this.signatures){let t=s.findIndex(t=>t.pubkey.equals(e.publicKey));if(t>-1)s[t].isSigner||(s[t].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 Error("unknown signer: ".concat(e.publicKey.toString()))}let o=0,c=0,l=0,d=[],h=[];s.forEach(e=>{let{pubkey:t,isSigner:r,isWritable:n}=e;r?(d.push(t.toString()),o+=1,n||(c+=1)):(h.push(t.toString()),n||(l+=1))});let g=d.concat(h),p=t.map(e=>{let{data:t,programId:r}=e;return{programIdIndex:g.indexOf(r.toString()),accounts:e.keys.map(e=>g.indexOf(e.pubkey.toString())),data:u().encode(t)}});return p.forEach(e=>{L(e.programIdIndex>=0),e.accounts.forEach(e=>L(e>=0))}),new j({header:{numRequiredSignatures:o,numReadonlySignedAccounts:c,numReadonlyUnsignedAccounts:l},accountKeys:g,recentBlockhash:e,instructions:p})}_compile(){let e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===t.length&&this.signatures.every((e,r)=>t[r].equals(e.publicKey))||(this.signatures=t.map(e=>({signature:null,publicKey:e}))),e}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(){for(var e=arguments.length,t=Array(e),r=0;r{let t=e.toString();return!n.has(t)&&(n.add(t),!0)}).map(e=>({signature:null,publicKey:e}))}sign(){for(var e=arguments.length,t=Array(e),r=0;r({signature:null,publicKey:e.publicKey}));let s=this._compile();this._partialSign(s,...i)}partialSign(){for(var e=arguments.length,t=Array(e),r=0;r1?t-1:0),n=1;n{let t=k(i,e.secretKey);this._addSignature(e.publicKey,x(t))})}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){L(64===t.length);let r=this.signatures.findIndex(t=>e.equals(t.publicKey));if(r<0)throw Error("unknown signer: ".concat(e.toString()));this.signatures[r].signature=n.Buffer.from(t)}verifySignatures(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,t){let r={};for(let{signature:n,publicKey:i}of this.signatures)null===n?t&&(r.missing||(r.missing=[])).push(i):I(n,e,i.toBytes())||(r.invalid||(r.invalid=[])).push(i);return r.invalid||r.missing?r:void 0}serialize(e){let{requireAllSignatures:t,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),n=this.serializeMessage();if(r){let e=this._getMessageSignednessErrors(n,t);if(e){let t="Signature verification failed.";throw e.invalid&&(t+="\nInvalid signature for public key".concat(1===e.invalid.length?"":"(s)"," [`").concat(e.invalid.map(e=>e.toBase58()).join("`, `"),"`].")),e.missing&&(t+="\nMissing signature for public key".concat(1===e.missing.length?"":"(s)"," [`").concat(e.missing.map(e=>e.toBase58()).join("`, `"),"`].")),Error(t)}}return this._serialize(n)}_serialize(e){let{signatures:t}=this,r=[];E(r,t.length);let i=r.length+64*t.length+e.length,s=n.Buffer.alloc(i);return L(t.length<256),n.Buffer.from(r).copy(s,0),t.forEach((e,t)=>{let{signature:i}=e;null!==i&&(L(64===i.length,"signature has invalid length"),n.Buffer.from(i).copy(s,r.length+64*t))}),e.copy(s,r.length+64*t.length),L(s.length<=1232,"Transaction too large: ".concat(s.length," > ").concat(1232)),s}get keys(){return L(1===this.instructions.length),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return L(1===this.instructions.length),this.instructions[0].programId}get data(){return L(1===this.instructions.length),this.instructions[0].data}static from(e){let t=[...e],r=z(t),i=[];for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:[],r=new U;return r.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(r.feePayer=e.accountKeys[0]),t.forEach((t,n)=>{let i={signature:t==u().encode(M)?null:u().decode(t),publicKey:e.accountKeys[n]};r.signatures.push(i)}),e.instructions.forEach(t=>{let n=t.accounts.map(t=>{let n=e.accountKeys[t];return{pubkey:n,isSigner:r.signatures.some(e=>e.publicKey.toString()===n.toString())||e.isAccountSigner(t),isWritable:e.isAccountWritable(t)}});r.instructions.push(new C({keys:n,programId:e.accountKeys[t.programIdIndex],data:u().decode(t.data)}))}),r._message=e,r._json=r.toJSON(),r}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)return;if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){let{minContextSlot:t,nonceInfo:r}=e;this.minNonceContextSlot=t,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){let{blockhash:t,lastValidBlockHeight:r}=e;this.recentBlockhash=t,this.lastValidBlockHeight=r}else{let{recentBlockhash:t,nonceInfo:r}=e;r&&(this.nonceInfo=r),this.recentBlockhash=t}}}class N{get version(){return this.message.version}serialize(){let e=this.message.serialize(),t=[];E(t,this.signatures.length);let r=d.n_([d.Ik(t.length,"encodedSignaturesLength"),d.A9(K(),this.signatures.length,"signatures"),d.Ik(e.length,"serializedMessage")]),n=new Uint8Array(2048),i=r.encode({encodedSignaturesLength:new Uint8Array(t),signatures:this.signatures,serializedMessage:e},n);return n.slice(0,i)}static deserialize(e){let t=[...e],r=[],n=z(t);for(let e=0;ee.equals(n.publicKey));L(e>=0,"Cannot sign with non signer key ".concat(n.publicKey.toBase58())),this.signatures[e]=k(t,n.secretKey)}}addSignature(e,t){L(64===t.byteLength,"Signature must be 64 bytes long");let r=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(t=>t.equals(e));L(r>=0,"Can not add signature; `".concat(e.toBase58(),"` is not required to sign this transaction")),this.signatures[r]=t}constructor(e,t){if(this.signatures=void 0,this.message=void 0,void 0!==t)L(t.length===e.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=t;else{let t=[];for(let r=0;r{e.getTransaction(this.signature).then(e=>{if(e&&e.meta&&e.meta.logMessages){let r=e.meta.logMessages;this.transactionLogs=r,t(r)}else r(Error("Log messages not found"))}).catch(r)})),await this.transactionLogs}constructor({action:e,signature:t,transactionMessage:r,logs:n}){let i;let s=n?"Logs: \n".concat(JSON.stringify(n.slice(-10),null,2),". "):"",a="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";switch(e){case"send":i="Transaction ".concat(t," resulted in an error. \n")+"".concat(r,". ")+s+a;break;case"simulate":i="Simulation failed. \nMessage: ".concat(r,". \n")+s+a;break;default:i="Unknown action '".concat(e,"'")}super(i),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=t,this.transactionMessage=r,this.transactionLogs=n||void 0}}async function Y(e,t,r,n){let i;let s=n&&{skipPreflight:n.skipPreflight,preflightCommitment:n.preflightCommitment||n.commitment,maxRetries:n.maxRetries,minContextSlot:n.minContextSlot},a=await e.sendTransaction(t,r,s);if(null!=t.recentBlockhash&&null!=t.lastValidBlockHeight)i=(await e.confirmTransaction({abortSignal:null==n?void 0:n.abortSignal,signature:a,blockhash:t.recentBlockhash,lastValidBlockHeight:t.lastValidBlockHeight},n&&n.commitment)).value;else if(null!=t.minNonceContextSlot&&null!=t.nonceInfo){let{nonceInstruction:r}=t.nonceInfo,s=r.keys[0].pubkey;i=(await e.confirmTransaction({abortSignal:null==n?void 0:n.abortSignal,minContextSlot:t.minNonceContextSlot,nonceAccountPubkey:s,nonceValue:t.nonceInfo.nonce,signature:a},n&&n.commitment)).value}else(null==n?void 0:n.abortSignal)!=null&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),i=(await e.confirmTransaction(a,n&&n.commitment)).value;if(i.err){if(null!=a)throw new Q({action:"send",signature:a,transactionMessage:"Status: (".concat(JSON.stringify(i),")")});throw Error("Transaction ".concat(a," failed (").concat(JSON.stringify(i),")"))}return a}function $(e,t){let r=e.layout.span>=0?e.layout.span:function e(t,r){let n=t=>{if(t.span>=0)return t.span;if("function"==typeof t.alloc)return t.alloc(r[t.property]);if("count"in t&&"elementLayout"in t){let e=r[t.property];if(Array.isArray(e))return e.length*n(t.elementLayout)}else if("fields"in t)return e({layout:t},r[t.property]);return 0},i=0;return t.layout.fields.forEach(e=>{i+=n(e)}),i}(e,t),i=n.Buffer.alloc(r),s=Object.assign({instruction:e.index},t);return e.layout.encode(s,i),i}let ee=d._O("lamportsPerSignature"),et=d.n_([d.Jq("version"),d.Jq("state"),P("authorizedPubkey"),P("nonce"),d.n_([ee],"feeCalculator")]).span;function er(e){let t=(0,d.Ik)(8,e),r=t.decode.bind(t),n=t.encode.bind(t),i=(0,h.GH)();return t.decode=(e,t)=>{let n=r(e,t);return i.decode(n)},t.encode=(e,t,r)=>n(i.encode(e),t,r),t}let en=Object.freeze({Create:{index:0,layout:d.n_([d.Jq("instruction"),d.gM("lamports"),d.gM("space"),P("programId")])},Assign:{index:1,layout:d.n_([d.Jq("instruction"),P("programId")])},Transfer:{index:2,layout:d.n_([d.Jq("instruction"),er("lamports")])},CreateWithSeed:{index:3,layout:d.n_([d.Jq("instruction"),P("base"),T("seed"),d.gM("lamports"),d.gM("space"),P("programId")])},AdvanceNonceAccount:{index:4,layout:d.n_([d.Jq("instruction")])},WithdrawNonceAccount:{index:5,layout:d.n_([d.Jq("instruction"),d.gM("lamports")])},InitializeNonceAccount:{index:6,layout:d.n_([d.Jq("instruction"),P("authorized")])},AuthorizeNonceAccount:{index:7,layout:d.n_([d.Jq("instruction"),P("authorized")])},Allocate:{index:8,layout:d.n_([d.Jq("instruction"),d.gM("space")])},AllocateWithSeed:{index:9,layout:d.n_([d.Jq("instruction"),P("base"),T("seed"),d.gM("space"),P("programId")])},AssignWithSeed:{index:10,layout:d.n_([d.Jq("instruction"),P("base"),T("seed"),P("programId")])},TransferWithSeed:{index:11,layout:d.n_([d.Jq("instruction"),er("lamports"),T("seed"),P("programId")])},UpgradeNonceAccount:{index:12,layout:d.n_([d.Jq("instruction")])}});class ei{static createAccount(e){let t=$(en.Create,{lamports:e.lamports,space:e.space,programId:x(e.programId.toBuffer())});return new C({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:t})}static transfer(e){let t,r;return"basePubkey"in e?(t=$(en.TransferWithSeed,{lamports:BigInt(e.lamports),seed:e.seed,programId:x(e.programId.toBuffer())}),r=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]):(t=$(en.Transfer,{lamports:BigInt(e.lamports)}),r=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]),new C({keys:r,programId:this.programId,data:t})}static assign(e){let t,r;return"basePubkey"in e?(t=$(en.AssignWithSeed,{base:x(e.basePubkey.toBuffer()),seed:e.seed,programId:x(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=$(en.Assign,{programId:x(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]),new C({keys:r,programId:this.programId,data:t})}static createAccountWithSeed(e){let t=$(en.CreateWithSeed,{base:x(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:x(e.programId.toBuffer())}),r=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey.equals(e.fromPubkey)||r.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new C({keys:r,programId:this.programId,data:t})}static createNonceAccount(e){let t=new U;"basePubkey"in e&&"seed"in e?t.add(ei.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:et,programId:this.programId})):t.add(ei.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:et,programId:this.programId}));let r={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return t.add(this.nonceInitialize(r)),t}static nonceInitialize(e){let t=$(en.InitializeNonceAccount,{authorized:x(e.authorizedPubkey.toBuffer())});return new C({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:V,isSigner:!1,isWritable:!1},{pubkey:H,isSigner:!1,isWritable:!1}],programId:this.programId,data:t})}static nonceAdvance(e){let t=$(en.AdvanceNonceAccount);return new C({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:V,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static nonceWithdraw(e){let t=$(en.WithdrawNonceAccount,{lamports:e.lamports});return new C({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:V,isSigner:!1,isWritable:!1},{pubkey:H,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static nonceAuthorize(e){let t=$(en.AuthorizeNonceAccount,{authorized:x(e.newAuthorizedPubkey.toBuffer())});return new C({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static allocate(e){let t,r;return"basePubkey"in e?(t=$(en.AllocateWithSeed,{base:x(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:x(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=$(en.Allocate,{space:e.space}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]),new C({keys:r,programId:this.programId,data:t})}constructor(){}}ei.programId=new v("11111111111111111111111111111111");class es{static getMinNumSignatures(e){return 2*(Math.ceil(e/es.chunkSize)+1+1)}static async load(e,t,r,i,s){{let n=await e.getMinimumBalanceForRentExemption(s.length),a=await e.getAccountInfo(r.publicKey,"confirmed"),o=null;if(null!==a){if(a.executable)return console.error("Program load failed, account is already executable"),!1;a.data.length!==s.length&&(o=o||new U).add(ei.allocate({accountPubkey:r.publicKey,space:s.length})),a.owner.equals(i)||(o=o||new U).add(ei.assign({accountPubkey:r.publicKey,programId:i})),a.lamports0?n:1,space:s.length,programId:i}));null!==o&&await Y(e,o,[t,r],{commitment:"confirmed"})}let a=d.n_([d.Jq("instruction"),d.Jq("offset"),d.Jq("bytesLength"),d.Jq("bytesLengthPadding"),d.A9(d.u8("byte"),d.cv(d.Jq(),-8),"bytes")]),o=es.chunkSize,u=0,c=s,l=[];for(;c.length>0;){let s=c.slice(0,o),d=n.Buffer.alloc(o+16);a.encode({instruction:0,offset:u,bytes:s,bytesLength:0,bytesLengthPadding:0},d);let h=new U().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0}],programId:i,data:d});l.push(Y(e,h,[t,r],{commitment:"confirmed"})),e._rpcEndpoint.includes("solana.com")&&await new Promise(e=>setTimeout(e,250)),u+=o,c=c.slice(o)}await Promise.all(l);{let s=d.n_([d.Jq("instruction")]),a=n.Buffer.alloc(s.span);s.encode({instruction:1},a);let o=new U().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0},{pubkey:H,isSigner:!1,isWritable:!1}],programId:i,data:a}),u="processed",c=await e.sendTransaction(o,[t,r],{preflightCommitment:u}),{context:l,value:h}=await e.confirmTransaction({signature:c,lastValidBlockHeight:o.lastValidBlockHeight,blockhash:o.recentBlockhash},u);if(h.err)throw Error("Transaction ".concat(c," failed (").concat(JSON.stringify(h),")"));for(;;){try{if(await e.getSlot({commitment:u})>l.slot)break}catch(e){}await new Promise(e=>setTimeout(e,Math.round(200)))}}return!0}constructor(){}}es.chunkSize=932,new v("BPFLoader2111111111111111111111111111111111"),d.n_([d.Jq("typeIndex"),er("deactivationSlot"),d._O("lastExtendedSlot"),d.u8("lastExtendedStartIndex"),d.u8(),d.A9(P(),d.cv(d.u8(),-1),"authority")]);let ea=(0,g.oQ)((0,g.eE)(v),(0,g.Z_)(),e=>new v(e)),eo=(0,g.bc)([(0,g.Z_)(),(0,g.i0)("base64")]),eu=(0,g.oQ)((0,g.eE)(n.Buffer),eo,e=>n.Buffer.from(e[0],"base64"));function ec(e){return(0,g.G0)([(0,g.dt)({jsonrpc:(0,g.i0)("2.0"),id:(0,g.Z_)(),result:e}),(0,g.dt)({jsonrpc:(0,g.i0)("2.0"),id:(0,g.Z_)(),error:(0,g.dt)({code:(0,g._4)(),message:(0,g.Z_)(),data:(0,g.jt)((0,g.Yj)())})})])}let el=ec((0,g._4)());function ed(e){return(0,g.oQ)(ec(e),el,t=>"error"in t?t:{...t,result:(0,g.Ue)(t.result,e)})}function eh(e){return ed((0,g.dt)({context:(0,g.dt)({slot:(0,g.Rx)()}),value:e}))}function eg(e){return(0,g.dt)({context:(0,g.dt)({slot:(0,g.Rx)()}),value:e})}let ep=(0,g.dt)({foundation:(0,g.Rx)(),foundationTerm:(0,g.Rx)(),initial:(0,g.Rx)(),taper:(0,g.Rx)(),terminal:(0,g.Rx)()});ed((0,g.IX)((0,g.AG)((0,g.dt)({epoch:(0,g.Rx)(),effectiveSlot:(0,g.Rx)(),amount:(0,g.Rx)(),postBalance:(0,g.Rx)(),commission:(0,g.jt)((0,g.AG)((0,g.Rx)()))}))));let ey=(0,g.IX)((0,g.dt)({slot:(0,g.Rx)(),prioritizationFee:(0,g.Rx)()})),eb=(0,g.dt)({total:(0,g.Rx)(),validator:(0,g.Rx)(),foundation:(0,g.Rx)(),epoch:(0,g.Rx)()}),em=(0,g.dt)({epoch:(0,g.Rx)(),slotIndex:(0,g.Rx)(),slotsInEpoch:(0,g.Rx)(),absoluteSlot:(0,g.Rx)(),blockHeight:(0,g.jt)((0,g.Rx)()),transactionCount:(0,g.jt)((0,g.Rx)())}),ef=(0,g.dt)({slotsPerEpoch:(0,g.Rx)(),leaderScheduleSlotOffset:(0,g.Rx)(),warmup:(0,g.O7)(),firstNormalEpoch:(0,g.Rx)(),firstNormalSlot:(0,g.Rx)()}),ek=(0,g.IM)((0,g.Z_)(),(0,g.IX)((0,g.Rx)())),eI=(0,g.AG)((0,g.G0)([(0,g.dt)({}),(0,g.Z_)()])),ex=(0,g.dt)({err:eI}),eS=(0,g.i0)("receivedSignature");(0,g.dt)({"solana-core":(0,g.Z_)(),"feature-set":(0,g.jt)((0,g.Rx)())});let ew=(0,g.dt)({program:(0,g.Z_)(),programId:ea,parsed:(0,g._4)()}),eA=(0,g.dt)({programId:ea,accounts:(0,g.IX)(ea),data:(0,g.Z_)()});eh((0,g.dt)({err:(0,g.AG)((0,g.G0)([(0,g.dt)({}),(0,g.Z_)()])),logs:(0,g.AG)((0,g.IX)((0,g.Z_)())),accounts:(0,g.jt)((0,g.AG)((0,g.IX)((0,g.AG)((0,g.dt)({executable:(0,g.O7)(),owner:(0,g.Z_)(),lamports:(0,g.Rx)(),data:(0,g.IX)((0,g.Z_)()),rentEpoch:(0,g.jt)((0,g.Rx)())}))))),unitsConsumed:(0,g.jt)((0,g.Rx)()),returnData:(0,g.jt)((0,g.AG)((0,g.dt)({programId:(0,g.Z_)(),data:(0,g.bc)([(0,g.Z_)(),(0,g.i0)("base64")])}))),innerInstructions:(0,g.jt)((0,g.AG)((0,g.IX)((0,g.dt)({index:(0,g.Rx)(),instructions:(0,g.IX)((0,g.G0)([ew,eA]))}))))})),eh((0,g.dt)({byIdentity:(0,g.IM)((0,g.Z_)(),(0,g.IX)((0,g.Rx)())),range:(0,g.dt)({firstSlot:(0,g.Rx)(),lastSlot:(0,g.Rx)()})})),ed(ep),ed(eb),ed(ey),ed(em),ed(ef),ed(ek),ed((0,g.Rx)()),eh((0,g.dt)({total:(0,g.Rx)(),circulating:(0,g.Rx)(),nonCirculating:(0,g.Rx)(),nonCirculatingAccounts:(0,g.IX)(ea)}));let ev=(0,g.dt)({amount:(0,g.Z_)(),uiAmount:(0,g.AG)((0,g.Rx)()),decimals:(0,g.Rx)(),uiAmountString:(0,g.jt)((0,g.Z_)())});eh((0,g.IX)((0,g.dt)({address:ea,amount:(0,g.Z_)(),uiAmount:(0,g.AG)((0,g.Rx)()),decimals:(0,g.Rx)(),uiAmountString:(0,g.jt)((0,g.Z_)())}))),eh((0,g.IX)((0,g.dt)({pubkey:ea,account:(0,g.dt)({executable:(0,g.O7)(),owner:ea,lamports:(0,g.Rx)(),data:eu,rentEpoch:(0,g.Rx)()})})));let e_=(0,g.dt)({program:(0,g.Z_)(),parsed:(0,g._4)(),space:(0,g.Rx)()});eh((0,g.IX)((0,g.dt)({pubkey:ea,account:(0,g.dt)({executable:(0,g.O7)(),owner:ea,lamports:(0,g.Rx)(),data:e_,rentEpoch:(0,g.Rx)()})}))),eh((0,g.IX)((0,g.dt)({lamports:(0,g.Rx)(),address:ea})));let eR=(0,g.dt)({executable:(0,g.O7)(),owner:ea,lamports:(0,g.Rx)(),data:eu,rentEpoch:(0,g.Rx)()});(0,g.dt)({pubkey:ea,account:eR});let eB=(0,g.oQ)((0,g.G0)([(0,g.eE)(n.Buffer),e_]),(0,g.G0)([eo,e_]),e=>Array.isArray(e)?(0,g.Ue)(e,eu):e),eW=(0,g.dt)({executable:(0,g.O7)(),owner:ea,lamports:(0,g.Rx)(),data:eB,rentEpoch:(0,g.Rx)()});(0,g.dt)({pubkey:ea,account:eW}),(0,g.dt)({state:(0,g.G0)([(0,g.i0)("active"),(0,g.i0)("inactive"),(0,g.i0)("activating"),(0,g.i0)("deactivating")]),active:(0,g.Rx)(),inactive:(0,g.Rx)()}),ed((0,g.IX)((0,g.dt)({signature:(0,g.Z_)(),slot:(0,g.Rx)(),err:eI,memo:(0,g.AG)((0,g.Z_)()),blockTime:(0,g.jt)((0,g.AG)((0,g.Rx)()))}))),ed((0,g.IX)((0,g.dt)({signature:(0,g.Z_)(),slot:(0,g.Rx)(),err:eI,memo:(0,g.AG)((0,g.Z_)()),blockTime:(0,g.jt)((0,g.AG)((0,g.Rx)()))}))),(0,g.dt)({subscription:(0,g.Rx)(),result:eg(eR)});let eP=(0,g.dt)({pubkey:ea,account:eR});(0,g.dt)({subscription:(0,g.Rx)(),result:eg(eP)});let eK=(0,g.dt)({parent:(0,g.Rx)(),slot:(0,g.Rx)(),root:(0,g.Rx)()});(0,g.dt)({subscription:(0,g.Rx)(),result:eK});let eT=(0,g.G0)([(0,g.dt)({type:(0,g.G0)([(0,g.i0)("firstShredReceived"),(0,g.i0)("completed"),(0,g.i0)("optimisticConfirmation"),(0,g.i0)("root")]),slot:(0,g.Rx)(),timestamp:(0,g.Rx)()}),(0,g.dt)({type:(0,g.i0)("createdBank"),parent:(0,g.Rx)(),slot:(0,g.Rx)(),timestamp:(0,g.Rx)()}),(0,g.dt)({type:(0,g.i0)("frozen"),slot:(0,g.Rx)(),timestamp:(0,g.Rx)(),stats:(0,g.dt)({numTransactionEntries:(0,g.Rx)(),numSuccessfulTransactions:(0,g.Rx)(),numFailedTransactions:(0,g.Rx)(),maxTransactionsPerEntry:(0,g.Rx)()})}),(0,g.dt)({type:(0,g.i0)("dead"),slot:(0,g.Rx)(),timestamp:(0,g.Rx)(),err:(0,g.Z_)()})]);(0,g.dt)({subscription:(0,g.Rx)(),result:eT}),(0,g.dt)({subscription:(0,g.Rx)(),result:eg((0,g.G0)([ex,eS]))}),(0,g.dt)({subscription:(0,g.Rx)(),result:(0,g.Rx)()}),(0,g.dt)({pubkey:(0,g.Z_)(),gossip:(0,g.AG)((0,g.Z_)()),tpu:(0,g.AG)((0,g.Z_)()),rpc:(0,g.AG)((0,g.Z_)()),version:(0,g.AG)((0,g.Z_)())});let ez=(0,g.dt)({votePubkey:(0,g.Z_)(),nodePubkey:(0,g.Z_)(),activatedStake:(0,g.Rx)(),epochVoteAccount:(0,g.O7)(),epochCredits:(0,g.IX)((0,g.bc)([(0,g.Rx)(),(0,g.Rx)(),(0,g.Rx)()])),commission:(0,g.Rx)(),lastVote:(0,g.Rx)(),rootSlot:(0,g.AG)((0,g.Rx)())});ed((0,g.dt)({current:(0,g.IX)(ez),delinquent:(0,g.IX)(ez)}));let eE=(0,g.G0)([(0,g.i0)("processed"),(0,g.i0)("confirmed"),(0,g.i0)("finalized")]),eL=(0,g.dt)({slot:(0,g.Rx)(),confirmations:(0,g.AG)((0,g.Rx)()),err:eI,confirmationStatus:(0,g.jt)(eE)});eh((0,g.IX)((0,g.AG)(eL))),ed((0,g.Rx)());let eq=(0,g.dt)({accountKey:ea,writableIndexes:(0,g.IX)((0,g.Rx)()),readonlyIndexes:(0,g.IX)((0,g.Rx)())}),eG=(0,g.dt)({signatures:(0,g.IX)((0,g.Z_)()),message:(0,g.dt)({accountKeys:(0,g.IX)((0,g.Z_)()),header:(0,g.dt)({numRequiredSignatures:(0,g.Rx)(),numReadonlySignedAccounts:(0,g.Rx)(),numReadonlyUnsignedAccounts:(0,g.Rx)()}),instructions:(0,g.IX)((0,g.dt)({accounts:(0,g.IX)((0,g.Rx)()),data:(0,g.Z_)(),programIdIndex:(0,g.Rx)()})),recentBlockhash:(0,g.Z_)(),addressTableLookups:(0,g.jt)((0,g.IX)(eq))})}),eZ=(0,g.dt)({pubkey:ea,signer:(0,g.O7)(),writable:(0,g.O7)(),source:(0,g.jt)((0,g.G0)([(0,g.i0)("transaction"),(0,g.i0)("lookupTable")]))}),eO=(0,g.dt)({accountKeys:(0,g.IX)(eZ),signatures:(0,g.IX)((0,g.Z_)())}),ej=(0,g.dt)({parsed:(0,g._4)(),program:(0,g.Z_)(),programId:ea}),eJ=(0,g.dt)({accounts:(0,g.IX)(ea),data:(0,g.Z_)(),programId:ea}),eX=(0,g.G0)([eJ,ej]),eM=(0,g.G0)([(0,g.dt)({parsed:(0,g._4)(),program:(0,g.Z_)(),programId:(0,g.Z_)()}),(0,g.dt)({accounts:(0,g.IX)((0,g.Z_)()),data:(0,g.Z_)(),programId:(0,g.Z_)()})]),eC=(0,g.oQ)(eX,eM,e=>"accounts"in e?(0,g.Ue)(e,eJ):(0,g.Ue)(e,ej)),eU=(0,g.dt)({signatures:(0,g.IX)((0,g.Z_)()),message:(0,g.dt)({accountKeys:(0,g.IX)(eZ),instructions:(0,g.IX)(eC),recentBlockhash:(0,g.Z_)(),addressTableLookups:(0,g.jt)((0,g.AG)((0,g.IX)(eq)))})}),eN=(0,g.dt)({accountIndex:(0,g.Rx)(),mint:(0,g.Z_)(),owner:(0,g.jt)((0,g.Z_)()),programId:(0,g.jt)((0,g.Z_)()),uiTokenAmount:ev}),eF=(0,g.dt)({writable:(0,g.IX)(ea),readonly:(0,g.IX)(ea)}),eV=(0,g.dt)({err:eI,fee:(0,g.Rx)(),innerInstructions:(0,g.jt)((0,g.AG)((0,g.IX)((0,g.dt)({index:(0,g.Rx)(),instructions:(0,g.IX)((0,g.dt)({accounts:(0,g.IX)((0,g.Rx)()),data:(0,g.Z_)(),programIdIndex:(0,g.Rx)()}))})))),preBalances:(0,g.IX)((0,g.Rx)()),postBalances:(0,g.IX)((0,g.Rx)()),logMessages:(0,g.jt)((0,g.AG)((0,g.IX)((0,g.Z_)()))),preTokenBalances:(0,g.jt)((0,g.AG)((0,g.IX)(eN))),postTokenBalances:(0,g.jt)((0,g.AG)((0,g.IX)(eN))),loadedAddresses:(0,g.jt)(eF),computeUnitsConsumed:(0,g.jt)((0,g.Rx)())}),eH=(0,g.dt)({err:eI,fee:(0,g.Rx)(),innerInstructions:(0,g.jt)((0,g.AG)((0,g.IX)((0,g.dt)({index:(0,g.Rx)(),instructions:(0,g.IX)(eC)})))),preBalances:(0,g.IX)((0,g.Rx)()),postBalances:(0,g.IX)((0,g.Rx)()),logMessages:(0,g.jt)((0,g.AG)((0,g.IX)((0,g.Z_)()))),preTokenBalances:(0,g.jt)((0,g.AG)((0,g.IX)(eN))),postTokenBalances:(0,g.jt)((0,g.AG)((0,g.IX)(eN))),loadedAddresses:(0,g.jt)(eF),computeUnitsConsumed:(0,g.jt)((0,g.Rx)())}),eD=(0,g.G0)([(0,g.i0)(0),(0,g.i0)("legacy")]),eQ=(0,g.dt)({pubkey:(0,g.Z_)(),lamports:(0,g.Rx)(),postBalance:(0,g.AG)((0,g.Rx)()),rewardType:(0,g.AG)((0,g.Z_)()),commission:(0,g.jt)((0,g.AG)((0,g.Rx)()))});ed((0,g.AG)((0,g.dt)({blockhash:(0,g.Z_)(),previousBlockhash:(0,g.Z_)(),parentSlot:(0,g.Rx)(),transactions:(0,g.IX)((0,g.dt)({transaction:eG,meta:(0,g.AG)(eV),version:(0,g.jt)(eD)})),rewards:(0,g.jt)((0,g.IX)(eQ)),blockTime:(0,g.AG)((0,g.Rx)()),blockHeight:(0,g.AG)((0,g.Rx)())}))),ed((0,g.AG)((0,g.dt)({blockhash:(0,g.Z_)(),previousBlockhash:(0,g.Z_)(),parentSlot:(0,g.Rx)(),rewards:(0,g.jt)((0,g.IX)(eQ)),blockTime:(0,g.AG)((0,g.Rx)()),blockHeight:(0,g.AG)((0,g.Rx)())}))),ed((0,g.AG)((0,g.dt)({blockhash:(0,g.Z_)(),previousBlockhash:(0,g.Z_)(),parentSlot:(0,g.Rx)(),transactions:(0,g.IX)((0,g.dt)({transaction:eO,meta:(0,g.AG)(eV),version:(0,g.jt)(eD)})),rewards:(0,g.jt)((0,g.IX)(eQ)),blockTime:(0,g.AG)((0,g.Rx)()),blockHeight:(0,g.AG)((0,g.Rx)())}))),ed((0,g.AG)((0,g.dt)({blockhash:(0,g.Z_)(),previousBlockhash:(0,g.Z_)(),parentSlot:(0,g.Rx)(),transactions:(0,g.IX)((0,g.dt)({transaction:eU,meta:(0,g.AG)(eH),version:(0,g.jt)(eD)})),rewards:(0,g.jt)((0,g.IX)(eQ)),blockTime:(0,g.AG)((0,g.Rx)()),blockHeight:(0,g.AG)((0,g.Rx)())}))),ed((0,g.AG)((0,g.dt)({blockhash:(0,g.Z_)(),previousBlockhash:(0,g.Z_)(),parentSlot:(0,g.Rx)(),transactions:(0,g.IX)((0,g.dt)({transaction:eO,meta:(0,g.AG)(eH),version:(0,g.jt)(eD)})),rewards:(0,g.jt)((0,g.IX)(eQ)),blockTime:(0,g.AG)((0,g.Rx)()),blockHeight:(0,g.AG)((0,g.Rx)())}))),ed((0,g.AG)((0,g.dt)({blockhash:(0,g.Z_)(),previousBlockhash:(0,g.Z_)(),parentSlot:(0,g.Rx)(),rewards:(0,g.jt)((0,g.IX)(eQ)),blockTime:(0,g.AG)((0,g.Rx)()),blockHeight:(0,g.AG)((0,g.Rx)())}))),ed((0,g.AG)((0,g.dt)({blockhash:(0,g.Z_)(),previousBlockhash:(0,g.Z_)(),parentSlot:(0,g.Rx)(),transactions:(0,g.IX)((0,g.dt)({transaction:eG,meta:(0,g.AG)(eV)})),rewards:(0,g.jt)((0,g.IX)(eQ)),blockTime:(0,g.AG)((0,g.Rx)())}))),ed((0,g.AG)((0,g.dt)({blockhash:(0,g.Z_)(),previousBlockhash:(0,g.Z_)(),parentSlot:(0,g.Rx)(),signatures:(0,g.IX)((0,g.Z_)()),blockTime:(0,g.AG)((0,g.Rx)())}))),ed((0,g.AG)((0,g.dt)({slot:(0,g.Rx)(),meta:(0,g.AG)(eV),blockTime:(0,g.jt)((0,g.AG)((0,g.Rx)())),transaction:eG,version:(0,g.jt)(eD)}))),ed((0,g.AG)((0,g.dt)({slot:(0,g.Rx)(),transaction:eU,meta:(0,g.AG)(eH),blockTime:(0,g.jt)((0,g.AG)((0,g.Rx)())),version:(0,g.jt)(eD)}))),eh((0,g.dt)({blockhash:(0,g.Z_)(),lastValidBlockHeight:(0,g.Rx)()})),eh((0,g.O7)());let eY=(0,g.dt)({slot:(0,g.Rx)(),numTransactions:(0,g.Rx)(),numSlots:(0,g.Rx)(),samplePeriodSecs:(0,g.Rx)()});ed((0,g.IX)(eY)),eh((0,g.AG)((0,g.dt)({feeCalculator:(0,g.dt)({lamportsPerSignature:(0,g.Rx)()})}))),ed((0,g.Z_)()),ed((0,g.Z_)());let e$=(0,g.dt)({err:eI,logs:(0,g.IX)((0,g.Z_)()),signature:(0,g.Z_)()});(0,g.dt)({result:eg(e$),subscription:(0,g.Rx)()});class e0{static generate(){return new e0(b())}static fromSecretKey(e,t){if(64!==e.byteLength)throw Error("bad secret key size");let r=e.slice(32,64);if(!t||!t.skipValidation){let t=m(e.slice(0,32));for(let e=0;e<32;e++)if(r[e]!==t[e])throw Error("provided secretKey is invalid")}return new e0({publicKey:r,secretKey:e})}static fromSeed(e){let t=m(e),r=new Uint8Array(64);return r.set(e),r.set(t,32),new e0({publicKey:t,secretKey:r})}get publicKey(){return new v(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}constructor(e){this._keypair=void 0,this._keypair=null!=e?e:b()}}let e1=Object.freeze({CreateLookupTable:{index:0,layout:d.n_([d.Jq("instruction"),er("recentSlot"),d.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:d.n_([d.Jq("instruction")])},ExtendLookupTable:{index:2,layout:d.n_([d.Jq("instruction"),er(),d.A9(P(),d.cv(d.Jq(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:d.n_([d.Jq("instruction")])},CloseLookupTable:{index:4,layout:d.n_([d.Jq("instruction")])}});class e8{static createLookupTable(e){let[t,r]=v.findProgramAddressSync([e.authority.toBuffer(),(0,h.bP)().encode(e.recentSlot)],this.programId),n=$(e1.CreateLookupTable,{recentSlot:BigInt(e.recentSlot),bumpSeed:r}),i=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:ei.programId,isSigner:!1,isWritable:!1}];return[new C({programId:this.programId,keys:i,data:n}),t]}static freezeLookupTable(e){let t=$(e1.FreezeLookupTable),r=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new C({programId:this.programId,keys:r,data:t})}static extendLookupTable(e){let t=$(e1.ExtendLookupTable,{addresses:e.addresses.map(e=>e.toBytes())}),r=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return e.payer&&r.push({pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:ei.programId,isSigner:!1,isWritable:!1}),new C({programId:this.programId,keys:r,data:t})}static deactivateLookupTable(e){let t=$(e1.DeactivateLookupTable),r=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new C({programId:this.programId,keys:r,data:t})}static closeLookupTable(e){let t=$(e1.CloseLookupTable),r=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.recipient,isSigner:!1,isWritable:!0}];return new C({programId:this.programId,keys:r,data:t})}constructor(){}}e8.programId=new v("AddressLookupTab1e1111111111111111111111111");let e2=Object.freeze({RequestUnits:{index:0,layout:d.n_([d.u8("instruction"),d.Jq("units"),d.Jq("additionalFee")])},RequestHeapFrame:{index:1,layout:d.n_([d.u8("instruction"),d.Jq("bytes")])},SetComputeUnitLimit:{index:2,layout:d.n_([d.u8("instruction"),d.Jq("units")])},SetComputeUnitPrice:{index:3,layout:d.n_([d.u8("instruction"),er("microLamports")])}});class e4{static requestUnits(e){let t=$(e2.RequestUnits,e);return new C({keys:[],programId:this.programId,data:t})}static requestHeapFrame(e){let t=$(e2.RequestHeapFrame,e);return new C({keys:[],programId:this.programId,data:t})}static setComputeUnitLimit(e){let t=$(e2.SetComputeUnitLimit,e);return new C({keys:[],programId:this.programId,data:t})}static setComputeUnitPrice(e){let t=$(e2.SetComputeUnitPrice,{microLamports:BigInt(e.microLamports)});return new C({keys:[],programId:this.programId,data:t})}constructor(){}}e4.programId=new v("ComputeBudget111111111111111111111111111111");let e3=d.n_([d.u8("numSignatures"),d.u8("padding"),d.KB("signatureOffset"),d.KB("signatureInstructionIndex"),d.KB("publicKeyOffset"),d.KB("publicKeyInstructionIndex"),d.KB("messageDataOffset"),d.KB("messageDataSize"),d.KB("messageInstructionIndex")]);class e6{static createInstructionWithPublicKey(e){let{publicKey:t,message:r,signature:i,instructionIndex:s}=e;L(32===t.length,"Public Key must be ".concat(32," bytes but received ").concat(t.length," bytes")),L(64===i.length,"Signature must be ".concat(64," bytes but received ").concat(i.length," bytes"));let a=e3.span,o=a+t.length,u=o+i.length,c=n.Buffer.alloc(u+r.length),l=null==s?65535:s;return e3.encode({numSignatures:1,padding:0,signatureOffset:o,signatureInstructionIndex:l,publicKeyOffset:a,publicKeyInstructionIndex:l,messageDataOffset:u,messageDataSize:r.length,messageInstructionIndex:l},c),c.fill(t,a),c.fill(i,o),c.fill(r,u),new C({keys:[],programId:e6.programId,data:c})}static createInstructionWithPrivateKey(e){let{privateKey:t,message:r,instructionIndex:n}=e;L(64===t.length,"Private key must be ".concat(64," bytes but received ").concat(t.length," bytes"));try{let e=e0.fromSecretKey(t),i=e.publicKey.toBytes(),s=k(r,e.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:r,signature:s,instructionIndex:n})}catch(e){throw Error("Error creating instruction; ".concat(e))}}constructor(){}}e6.programId=new v("Ed25519SigVerify111111111111111111111111111");let e5=(e,t)=>{let r=y.kA.sign(e,t);return[r.toCompactRawBytes(),r.recovery]};y.kA.utils.isValidPrivateKey;let e7=y.kA.getPublicKey,e9=d.n_([d.u8("numSignatures"),d.KB("signatureOffset"),d.u8("signatureInstructionIndex"),d.KB("ethAddressOffset"),d.u8("ethAddressInstructionIndex"),d.KB("messageDataOffset"),d.KB("messageDataSize"),d.u8("messageInstructionIndex"),d.Ik(20,"ethAddress"),d.Ik(64,"signature"),d.u8("recoveryId")]);class te{static publicKeyToEthAddress(e){L(64===e.length,"Public key must be ".concat(64," bytes but received ").concat(e.length," bytes"));try{return n.Buffer.from((0,p.fr)(x(e))).slice(-20)}catch(e){throw Error("Error constructing Ethereum address: ".concat(e))}}static createInstructionWithPublicKey(e){let{publicKey:t,message:r,signature:n,recoveryId:i,instructionIndex:s}=e;return te.createInstructionWithEthAddress({ethAddress:te.publicKeyToEthAddress(t),message:r,signature:n,recoveryId:i,instructionIndex:s})}static createInstructionWithEthAddress(e){let t;let{ethAddress:r,message:i,signature:s,recoveryId:a,instructionIndex:o=0}=e;L(20===(t="string"==typeof r?r.startsWith("0x")?n.Buffer.from(r.substr(2),"hex"):n.Buffer.from(r,"hex"):r).length,"Address must be ".concat(20," bytes but received ").concat(t.length," bytes"));let u=12+t.length,c=u+s.length+1,l=n.Buffer.alloc(e9.span+i.length);return e9.encode({numSignatures:1,signatureOffset:u,signatureInstructionIndex:o,ethAddressOffset:12,ethAddressInstructionIndex:o,messageDataOffset:c,messageDataSize:i.length,messageInstructionIndex:o,signature:x(s),ethAddress:x(t),recoveryId:a},l),l.fill(x(i),e9.span),new C({keys:[],programId:te.programId,data:l})}static createInstructionWithPrivateKey(e){let{privateKey:t,message:r,instructionIndex:i}=e;L(32===t.length,"Private key must be ".concat(32," bytes but received ").concat(t.length," bytes"));try{let e=x(t),s=e7(e,!1).slice(1),a=n.Buffer.from((0,p.fr)(x(r))),[o,u]=e5(a,e);return this.createInstructionWithPublicKey({publicKey:s,message:r,signature:o,recoveryId:u,instructionIndex:i})}catch(e){throw Error("Error creating instruction; ".concat(e))}}constructor(){}}te.programId=new v("KeccakSecp256k11111111111111111111111111111");let tt=new v("StakeConfig11111111111111111111111111111111");class tr{constructor(e,t,r){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=t,this.custodian=r}}tr.default=new tr(0,0,v.default);let tn=Object.freeze({Initialize:{index:0,layout:d.n_([d.Jq("instruction"),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"authorized";return d.n_([P("staker"),P("withdrawer")],e)}(),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lockup";return d.n_([d.gM("unixTimestamp"),d.gM("epoch"),P("custodian")],e)}()])},Authorize:{index:1,layout:d.n_([d.Jq("instruction"),P("newAuthorized"),d.Jq("stakeAuthorizationType")])},Delegate:{index:2,layout:d.n_([d.Jq("instruction")])},Split:{index:3,layout:d.n_([d.Jq("instruction"),d.gM("lamports")])},Withdraw:{index:4,layout:d.n_([d.Jq("instruction"),d.gM("lamports")])},Deactivate:{index:5,layout:d.n_([d.Jq("instruction")])},Merge:{index:7,layout:d.n_([d.Jq("instruction")])},AuthorizeWithSeed:{index:8,layout:d.n_([d.Jq("instruction"),P("newAuthorized"),d.Jq("stakeAuthorizationType"),T("authoritySeed"),P("authorityOwner")])}});Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class ti{static initialize(e){let{stakePubkey:t,authorized:r,lockup:n}=e,i=n||tr.default,s=$(tn.Initialize,{authorized:{staker:x(r.staker.toBuffer()),withdrawer:x(r.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:x(i.custodian.toBuffer())}});return new C({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:H,isSigner:!1,isWritable:!1}],programId:this.programId,data:s})}static createAccountWithSeed(e){let t=new U;t.add(ei.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));let{stakePubkey:r,authorized:n,lockup:i}=e;return t.add(this.initialize({stakePubkey:r,authorized:n,lockup:i}))}static createAccount(e){let t=new U;t.add(ei.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));let{stakePubkey:r,authorized:n,lockup:i}=e;return t.add(this.initialize({stakePubkey:r,authorized:n,lockup:i}))}static delegate(e){let{stakePubkey:t,authorizedPubkey:r,votePubkey:n}=e,i=$(tn.Delegate);return new U().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:F,isSigner:!1,isWritable:!1},{pubkey:D,isSigner:!1,isWritable:!1},{pubkey:tt,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(e){let{stakePubkey:t,authorizedPubkey:r,newAuthorizedPubkey:n,stakeAuthorizationType:i,custodianPubkey:s}=e,a=$(tn.Authorize,{newAuthorized:x(n.toBuffer()),stakeAuthorizationType:i.index}),o=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:F,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}];return s&&o.push({pubkey:s,isSigner:!0,isWritable:!1}),new U().add({keys:o,programId:this.programId,data:a})}static authorizeWithSeed(e){let{stakePubkey:t,authorityBase:r,authoritySeed:n,authorityOwner:i,newAuthorizedPubkey:s,stakeAuthorizationType:a,custodianPubkey:o}=e,u=$(tn.AuthorizeWithSeed,{newAuthorized:x(s.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:n,authorityOwner:x(i.toBuffer())}),c=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:F,isSigner:!1,isWritable:!1}];return o&&c.push({pubkey:o,isSigner:!0,isWritable:!1}),new U().add({keys:c,programId:this.programId,data:u})}static splitInstruction(e){let{stakePubkey:t,authorizedPubkey:r,splitStakePubkey:n,lamports:i}=e,s=$(tn.Split,{lamports:i});return new C({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static split(e,t){let r=new U;return r.add(ei.createAccount({fromPubkey:e.authorizedPubkey,newAccountPubkey:e.splitStakePubkey,lamports:t,space:this.space,programId:this.programId})),r.add(this.splitInstruction(e))}static splitWithSeed(e,t){let{stakePubkey:r,authorizedPubkey:n,splitStakePubkey:i,basePubkey:s,seed:a,lamports:o}=e,u=new U;return u.add(ei.allocate({accountPubkey:i,basePubkey:s,seed:a,space:this.space,programId:this.programId})),t&&t>0&&u.add(ei.transfer({fromPubkey:e.authorizedPubkey,toPubkey:i,lamports:t})),u.add(this.splitInstruction({stakePubkey:r,authorizedPubkey:n,splitStakePubkey:i,lamports:o}))}static merge(e){let{stakePubkey:t,sourceStakePubKey:r,authorizedPubkey:n}=e,i=$(tn.Merge);return new U().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:F,isSigner:!1,isWritable:!1},{pubkey:D,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(e){let{stakePubkey:t,authorizedPubkey:r,toPubkey:n,lamports:i,custodianPubkey:s}=e,a=$(tn.Withdraw,{lamports:i}),o=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:F,isSigner:!1,isWritable:!1},{pubkey:D,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return s&&o.push({pubkey:s,isSigner:!0,isWritable:!1}),new U().add({keys:o,programId:this.programId,data:a})}static deactivate(e){let{stakePubkey:t,authorizedPubkey:r}=e,n=$(tn.Deactivate);return new U().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:F,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}constructor(){}}ti.programId=new v("Stake11111111111111111111111111111111111111"),ti.space=200;let ts=Object.freeze({InitializeAccount:{index:0,layout:d.n_([d.Jq("instruction"),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteInit";return d.n_([P("nodePubkey"),P("authorizedVoter"),P("authorizedWithdrawer"),d.u8("commission")],e)}()])},Authorize:{index:1,layout:d.n_([d.Jq("instruction"),P("newAuthorized"),d.Jq("voteAuthorizationType")])},Withdraw:{index:3,layout:d.n_([d.Jq("instruction"),d.gM("lamports")])},UpdateValidatorIdentity:{index:4,layout:d.n_([d.Jq("instruction")])},AuthorizeWithSeed:{index:10,layout:d.n_([d.Jq("instruction"),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteAuthorizeWithSeedArgs";return d.n_([d.Jq("voteAuthorizationType"),P("currentAuthorityDerivedKeyOwnerPubkey"),T("currentAuthorityDerivedKeySeed"),P("newAuthorized")],e)}()])}});Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class ta{static initializeAccount(e){let{votePubkey:t,nodePubkey:r,voteInit:n}=e,i=$(ts.InitializeAccount,{voteInit:{nodePubkey:x(n.nodePubkey.toBuffer()),authorizedVoter:x(n.authorizedVoter.toBuffer()),authorizedWithdrawer:x(n.authorizedWithdrawer.toBuffer()),commission:n.commission}});return new C({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:H,isSigner:!1,isWritable:!1},{pubkey:F,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static createAccount(e){let t=new U;return t.add(ei.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.votePubkey,lamports:e.lamports,space:this.space,programId:this.programId})),t.add(this.initializeAccount({votePubkey:e.votePubkey,nodePubkey:e.voteInit.nodePubkey,voteInit:e.voteInit}))}static authorize(e){let{votePubkey:t,authorizedPubkey:r,newAuthorizedPubkey:n,voteAuthorizationType:i}=e,s=$(ts.Authorize,{newAuthorized:x(n.toBuffer()),voteAuthorizationType:i.index});return new U().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:F,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static authorizeWithSeed(e){let{currentAuthorityDerivedKeyBasePubkey:t,currentAuthorityDerivedKeyOwnerPubkey:r,currentAuthorityDerivedKeySeed:n,newAuthorizedPubkey:i,voteAuthorizationType:s,votePubkey:a}=e,o=$(ts.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:x(r.toBuffer()),currentAuthorityDerivedKeySeed:n,newAuthorized:x(i.toBuffer()),voteAuthorizationType:s.index}});return new U().add({keys:[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:F,isSigner:!1,isWritable:!1},{pubkey:t,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static withdraw(e){let{votePubkey:t,authorizedWithdrawerPubkey:r,lamports:n,toPubkey:i}=e,s=$(ts.Withdraw,{lamports:n});return new U().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static safeWithdraw(e,t,r){if(e.lamports>t-r)throw Error("Withdraw will leave vote account with insufficient funds.");return ta.withdraw(e)}static updateValidatorIdentity(e){let{votePubkey:t,authorizedWithdrawerPubkey:r,nodePubkey:n}=e,i=$(ts.UpdateValidatorIdentity);return new U().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}constructor(){}}ta.programId=new v("Vote111111111111111111111111111111111111111"),ta.space=3762,new v("Va1idator1nfo111111111111111111111111111111"),(0,g.dt)({name:(0,g.Z_)(),website:(0,g.jt)((0,g.Z_)()),details:(0,g.jt)((0,g.Z_)()),iconUrl:(0,g.jt)((0,g.Z_)()),keybaseUsername:(0,g.jt)((0,g.Z_)())}),new v("Vote111111111111111111111111111111111111111"),d.n_([P("nodePubkey"),P("authorizedWithdrawer"),d.u8("commission"),d._O(),d.A9(d.n_([d._O("slot"),d.Jq("confirmationCount")]),d.cv(d.Jq(),-8),"votes"),d.u8("rootSlotValid"),d._O("rootSlot"),d._O(),d.A9(d.n_([d._O("epoch"),P("authorizedVoter")]),d.cv(d.Jq(),-8),"authorizedVoters"),d.n_([d.A9(d.n_([P("authorizedPubkey"),d._O("epochOfLastAuthorizedSwitch"),d._O("targetEpoch")]),32,"buf"),d._O("idx"),d.u8("isEmpty")],"priorVoters"),d._O(),d.A9(d.n_([d._O("epoch"),d._O("credits"),d._O("prevCredits")]),d.cv(d.Jq(),-8),"epochCredits"),d.n_([d._O("slot"),d._O("timestamp")],"lastTimestamp")])}}]);