1"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[1270],{80199(e,t,n){n.d(t,{Ng:()=>Qn,Sr:()=>yr,J3:()=>se,ZX:()=>xe,B2:()=>Ae,Kt:()=>Pe,Kw:()=>br});var r=n(80045),i=n(89379),s=n(20746),o=n(18462),a=n(83825),c=n.n(a),u=n(27586),l=n.n(u),d=n(64845),h=n(95896),g=n(57292),m=n(64467);const p=["cause"];var f=8078e3,b=8078001,y=8078004,w=8078005,k=8078006,S=8078011;function v(e){if(Array.isArray(e)){return"%5B"+e.map(v).join("%2C%20")+"%5D"}return"bigint"===typeof e?"".concat(e,"n"):encodeURIComponent(String(null!=e&&null===Object.getPrototypeOf(e)?(0,i.A)({},e):e))}function I(e){let[t,n]=e;return"".concat(t,"=").concat(v(n))}function A(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};{let n="Solana error #".concat(e,"; Decode this error by running `npx @solana/errors decode -- ").concat(e);return Object.keys(t).length&&(n+=" '".concat(function(e){const t=Object.entries(e).map(I).join("&");return btoa(t)}(t),"'")),"".concat(n,"`")}}var _=class extends Error{constructor(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let s,o,[a,c]=t;if(c){const{cause:e}=c,t=(0,r.A)(c,p);e&&(o={cause:e}),Object.keys(t).length>0&&(s=t)}super(A(a,s),o),(0,m.A)(this,"cause",this.cause),(0,m.A)(this,"context",void 0),this.context=(0,i.A)({__code:a},s),this.name="SolanaError"}};function B(e,t){return"fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function W(e){return Object.freeze((0,i.A)((0,i.A)({},e),{},{encode:t=>{const n=new Uint8Array(B(t,e));return e.write(t,n,0),n}}))}function x(e){return Object.freeze((0,i.A)((0,i.A)({},e),{},{decode:function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.read(t,n)[0]}}))}function P(e){return"fixedSize"in e&&"number"===typeof e.fixedSize}function E(e,t){if(P(e)!==P(t))throw new _(y);if(P(e)&&P(t)&&e.fixedSize!==t.fixedSize)throw new _(w,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!P(e)&&!P(t)&&e.maxSize!==t.maxSize)throw new _(k,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return(0,i.A)((0,i.A)((0,i.A)({},t),e),{},{decode:t.decode,encode:e.encode,read:t.read,write:e.write})}function N(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const i=n.length-r;if(i<t)throw new _(b,{bytesLength:i,codecDescription:e,expected:t})}function C(e,t,n,r){if(r<t||r>n)throw new _(S,{codecDescription:e,max:n,min:t,value:r})}function T(e){return 1!==(null===e||void 0===e?void 0:e.endian)}function O(e){return W({fixedSize:e.size,write(t,n,r){e.range&&C(e.name,e.range[0],e.range[1],t);const i=new ArrayBuffer(e.size);return e.set(new DataView(i),t,T(e.config)),n.set(new Uint8Array(i),r),r+e.size}})}function z(e){return x({fixedSize:e.size,read(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(t.length-n<=0)throw new _(f,{codecDescription:e})}(e.name,t,n),N(e.name,e.size,t,n);const r=new DataView(function(e,t,n){const r=e.byteOffset+(null!==t&&void 0!==t?t:0),i=null!==n&&void 0!==n?n:e.byteLength;return e.buffer.slice(r,r+i)}(t,n,e.size));return[e.get(r,T(e.config)),n+e.size]}})}var K=function(){return O({config:arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,t,n)=>e.setBigUint64(0,BigInt(t),n),size:8})},L=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return E(K(e),function(){return z({config:arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},get:(e,t)=>e.getBigUint64(0,t),name:"u64",size:8})}(e))},q=n(90543),R=n(18881),Y=n.n(R),j=n(93259),D=n(50877),H=n(84624);const M=["commitment"],U=["encoding"],F=["commitment"],V=["commitment"],J=(o.ev.utils.randomPrivateKey,()=>{const e=o.ev.utils.randomPrivateKey(),t=G(e),n=new Uint8Array(64);return n.set(e),n.set(t,32),{publicKey:t,secretKey:n}}),G=o.ev.getPublicKey;function X(e){try{return o.ev.ExtendedPoint.fromHex(e),!0}catch(t){return!1}}const Z=(e,t)=>o.ev.sign(e,t.slice(0,32)),Q=o.ev.verify,$=e=>s.Buffer.isBuffer(e)?e:e instanceof Uint8Array?s.Buffer.from(e.buffer,e.byteOffset,e.byteLength):s.Buffer.from(e);class ee{constructor(e){Object.assign(this,e)}encode(){return s.Buffer.from((0,h.serialize)(te,this))}static decode(e){return(0,h.deserialize)(te,this,e)}
1static decodeUnchecked(e){return(0,h.deserializeUnchecked)(te,this,e)}}const te=new Map;var ne;const re=32;let ie=1;class se extends ee{constructor(e){if(super({}),this._bn=void 0,function(e){return void 0!==e._bn}(e))this._bn=e._bn;else{if("string"===typeof e){const t=l().decode(e);if(t.length!=re)throw new Error("Invalid public key input");this._bn=new(c())(t)}else this._bn=new(c())(e);if(this._bn.byteLength()>re)throw new Error("Invalid public key input")}}static unique(){const e=new se(ie);return ie+=1,new se(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return l().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(s.Buffer);if(e.length===re)return e;const t=s.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,n){const r=s.Buffer.concat([e.toBuffer(),s.Buffer.from(t),n.toBuffer()]),i=(0,d.sc)(r);return new se(i)}static createProgramAddressSync(e,t){let n=s.Buffer.alloc(0);e.forEach(function(e){if(e.length>32)throw new TypeError("Max seed length exceeded");n=s.Buffer.concat([n,$(e)])}),n=s.Buffer.concat([n,t.toBuffer(),s.Buffer.from("ProgramDerivedAddress")]);const r=(0,d.sc)(n);if(X(r))throw new Error("Invalid seeds, address must fall off the curve");return new se(r)}static async createProgramAddress(e,t){return this.createProgramAddressSync(e,t)}static findProgramAddressSync(e,t){let n,r=255;for(;0!=r;){try{const i=e.concat(s.Buffer.from([r]));n=this.createProgramAddressSync(i,t)}catch(i){if(i instanceof TypeError)throw i;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,t){return this.findProgramAddressSync(e,t)}static isOnCurve(e){return X(new se(e).toBytes())}}ne=se,se.default=new ne("11111111111111111111111111111111"),te.set(se,{kind:"struct",fields:[["_bn","u256"]]});new se("BPFLoader1111111111111111111111111111111111");const oe=1232;class ae extends Error{constructor(e){super("Signature ".concat(e," has expired: block height exceeded.")),this.signature=void 0,this.signature=e}}Object.defineProperty(ae.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class ce 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(ce.prototype,"name",{value:"TransactionExpiredTimeoutError"});class ue 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(ue.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class le{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 t=new Map;this.keySegments().flat().forEach((e,n)=>{t.set(e.toBase58(),n)});const n=e=>{const n=t.get(e.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return e.map(e=>({programIdIndex:n(e.programId),accountKeyIndexes:e.keys.map(e=>n(e.pubkey)),data:e.data}))}}const de=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"publicKey";return g.av(32,e)},he=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature";return g.av(64,e)},ge=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"string";const t=g.w3([g.DH("length"),g.DH("lengthPadding"),g.av(g.cY(g.DH(),-8),"chars")],e),n=t.decode.bind(t),r=t.encode.bind(t),i=t;return i.decode=(e,t)=>n(e,t).chars.toString(),i.encode=(e,t,n)=>{const i={chars:s.Buffer.from(e,"utf8")};return r(i,t,n)},i.alloc=e=>g.DH().span+g.DH().span+s.Buffer.from(e,"utf8").length,i};function me(e,t){const n=e=>{if(e.span>=0)return e.span;if("function"===typeof e.alloc)return e.alloc(t[e.property]);if("count"in e&&"elementLayout"in e){const r=t[e.property];if(Array.isArray(r))return r.length*n(e.elementLayout)}else if("fields"in e)return me({layout:e},t[e.property]);return 0};let r=0;
1return e.layout.fields.forEach(e=>{r+=n(e)}),r}function pe(e){let t=0,n=0;for(;;){let r=e.shift();if(t|=(127&r)<<7*n,n+=1,0===(128&r))break}return t}function fe(e,t){let n=t;for(;;){let t=127&n;if(n>>=7,0==n){e.push(t);break}t|=128,e.push(t)}}function be(e,t){if(!e)throw new Error(t||"Assertion failed")}class ye{constructor(e,t){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=t}static compile(e,t){const n=new Map,r=e=>{const t=e.toBase58();let r=n.get(t);return void 0===r&&(r={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(t,r)),r},i=r(t);i.isSigner=!0,i.isWritable=!0;for(const s of e){r(s.programId).isInvoked=!0;for(const e of s.keys){const t=r(e.pubkey);t.isSigner||(t.isSigner=e.isSigner),t.isWritable||(t.isWritable=e.isWritable)}}return new ye(t,n)}getMessageComponents(){const e=[...this.keyMetaMap.entries()];be(e.length<=256,"Max static account keys length exceeded");const t=e.filter(e=>{let[,t]=e;return t.isSigner&&t.isWritable}),n=e.filter(e=>{let[,t]=e;return t.isSigner&&!t.isWritable}),r=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+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};{be(t.length>0,"Expected at least one writable signer key");const[e]=t[0];be(e===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[s,[...t.map(e=>{let[t]=e;return new se(t)}),...n.map(e=>{let[t]=e;return new se(t)}),...r.map(e=>{let[t]=e;return new se(t)}),...i.map(e=>{let[t]=e;return new se(t)})]]}extractTableLookup(e){const[t,n]=this.drainKeysFoundInLookupTable(e.state.addresses,e=>!e.isSigner&&!e.isInvoked&&e.isWritable),[r,i]=this.drainKeysFoundInLookupTable(e.state.addresses,e=>!e.isSigner&&!e.isInvoked&&!e.isWritable);if(0!==t.length||0!==r.length)return[{accountKey:e.key,writableIndexes:t,readonlyIndexes:r},{writable:n,readonly:i}]}drainKeysFoundInLookupTable(e,t){const n=new Array,r=new Array;for(const[i,s]of this.keyMetaMap.entries())if(t(s)){const t=new se(i),s=e.findIndex(e=>e.equals(t));s>=0&&(be(s<256,"Max lookup table index exceeded"),n.push(s),r.push(t),this.keyMetaMap.delete(i))}return[n,r]}}const we="Reached end of buffer unexpectedly";function ke(e){if(0===e.length)throw new Error(we);return e.shift()}function Se(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];const[s]=r;if(2===r.length?s+(null!==(t=r[1])&&void 0!==t?t:0)>e.length:s>=e.length)throw new Error(we);return e.splice(...r)}class ve{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(e=>new se(e)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:l().decode(e.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new le(this.staticAccountKeys)}static compile(e){const t=ye.compile(e.instructions,e.payerKey),[n,r]=t.getMessageComponents(),i=new le(r).compileInstructions(e.instructions).map(e=>({programIdIndex:e.programIdIndex,accounts:e.accountKeyIndexes,data:l().encode(e.data)}));return new ve({header:n,accountKeys:r,recentBlockhash:e.recentBlockhash,instructions:i})}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){const t=this.header.numRequiredSignatures;if(e>=this.header.numRequiredSignatures){return e-t<this.accountKeys.length-t-this.header.numReadonlyUnsignedAccounts}return e<t-this.header.numReadonlySignedAccounts}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=[];fe(t,e);const n=this.instructions.map(e=>{const{accounts:t,programIdIndex:n}=e,r=Array.from(l().decode(e.data));let i=[];fe(i,t.length);let o=[];return fe(o,r.length),{programIdIndex:n,keyIndicesCount:s.Buffer.from(i),keyIndices:t,dataLength:s.Buffer.from(o),data:r}});let r=[];
1fe(r,n.length);let i=s.Buffer.alloc(oe);s.Buffer.from(r).copy(i);let o=r.length;n.forEach(e=>{const t=g.w3([g.u8("programIdIndex"),g.av(e.keyIndicesCount.length,"keyIndicesCount"),g.O6(g.u8("keyIndex"),e.keyIndices.length,"keyIndices"),g.av(e.dataLength.length,"dataLength"),g.O6(g.u8("userdatum"),e.data.length,"data")]).encode(e,i,o);o+=t}),i=i.slice(0,o);const a=g.w3([g.av(1,"numRequiredSignatures"),g.av(1,"numReadonlySignedAccounts"),g.av(1,"numReadonlyUnsignedAccounts"),g.av(t.length,"keyCount"),g.O6(de("key"),e,"keys"),de("recentBlockhash")]),c={numRequiredSignatures:s.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:s.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:s.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:s.Buffer.from(t),keys:this.accountKeys.map(e=>$(e.toBytes())),recentBlockhash:l().decode(this.recentBlockhash)};let u=s.Buffer.alloc(2048);const d=a.encode(c,u);return i.copy(u,d),u.slice(0,d+i.length)}static from(e){let t=[...e];const n=ke(t);if(n!==(127&n))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const r=ke(t),i=ke(t),o=pe(t);let a=[];for(let l=0;l<o;l++){const e=Se(t,0,re);a.push(new se(s.Buffer.from(e)))}const c=Se(t,0,re),u=pe(t);let d=[];for(let g=0;g<u;g++){const e=ke(t),n=Se(t,0,pe(t)),r=Se(t,0,pe(t)),i=l().encode(s.Buffer.from(r));d.push({programIdIndex:e,accounts:n,data:i})}const h={header:{numRequiredSignatures:n,numReadonlySignedAccounts:r,numReadonlyUnsignedAccounts:i},recentBlockhash:l().encode(s.Buffer.from(c)),accountKeys:a,instructions:d};return new ve(h)}}class Ie{constructor(e){this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=e.header,this.staticAccountKeys=e.staticAccountKeys,this.recentBlockhash=e.recentBlockhash,this.compiledInstructions=e.compiledInstructions,this.addressTableLookups=e.addressTableLookups}get version(){return 0}get numAccountKeysFromLookups(){let e=0;for(const 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 new 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 new Error("Failed to get account keys because address table lookups were not resolved");return new le(this.staticAccountKeys,t)}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){const t=this.header.numRequiredSignatures,n=this.staticAccountKeys.length;if(e>=n){return e-n<this.addressTableLookups.reduce((e,t)=>e+t.writableIndexes.length,0)}if(e>=this.header.numRequiredSignatures){return e-t<n-t-this.header.numReadonlyUnsignedAccounts}return e<t-this.header.numReadonlySignedAccounts}resolveAddressTableLookups(e){const t={writable:[],readonly:[]};for(const n of this.addressTableLookups){const r=e.find(e=>e.key.equals(n.accountKey));if(!r)throw new Error("Failed to find address lookup table account for table key ".concat(n.accountKey.toBase58()));for(const e of n.writableIndexes){if(!(e<r.state.addresses.length))throw new Error("Failed to find address for index ".concat(e," in address lookup table ").concat(n.accountKey.toBase58()));t.writable.push(r.state.addresses[e])}for(const e of n.readonlyIndexes){if(!(e<r.state.addresses.length))throw new Error("Failed to find address for index ".concat(e," in address lookup table ").concat(n.accountKey.toBase58()));t.readonly.push(r.state.addresses[e])}}return t}static compile(e){const t=ye.compile(e.instructions,e.payerKey),n=new Array,r={writable:new Array,readonly:new Array},i=e.addressLookupTableAccounts||[];for(const c of i){const e=t.extractTableLookup(c);if(void 0!==e){const[t,{writable:i,readonly:s}]=e;n.push(t),r.writable.push(...i),r.readonly.push(...s)}}
1const[s,o]=t.getMessageComponents(),a=new le(o,r).compileInstructions(e.instructions);return new Ie({header:s,staticAccountKeys:o,recentBlockhash:e.recentBlockhash,compiledInstructions:a,addressTableLookups:n})}serialize(){const e=Array();fe(e,this.staticAccountKeys.length);const t=this.serializeInstructions(),n=Array();fe(n,this.compiledInstructions.length);const r=this.serializeAddressTableLookups(),i=Array();fe(i,this.addressTableLookups.length);const s=g.w3([g.u8("prefix"),g.w3([g.u8("numRequiredSignatures"),g.u8("numReadonlySignedAccounts"),g.u8("numReadonlyUnsignedAccounts")],"header"),g.av(e.length,"staticAccountKeysLength"),g.O6(de(),this.staticAccountKeys.length,"staticAccountKeys"),de("recentBlockhash"),g.av(n.length,"instructionsLength"),g.av(t.length,"serializedInstructions"),g.av(i.length,"addressTableLookupsLength"),g.av(r.length,"serializedAddressTableLookups")]),o=new Uint8Array(oe),a=s.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(e),staticAccountKeys:this.staticAccountKeys.map(e=>e.toBytes()),recentBlockhash:l().decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:t,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},o);return o.slice(0,a)}serializeInstructions(){let e=0;const t=new Uint8Array(oe);for(const n of this.compiledInstructions){const r=Array();fe(r,n.accountKeyIndexes.length);const i=Array();fe(i,n.data.length);e+=g.w3([g.u8("programIdIndex"),g.av(r.length,"encodedAccountKeyIndexesLength"),g.O6(g.u8(),n.accountKeyIndexes.length,"accountKeyIndexes"),g.av(i.length,"encodedDataLength"),g.av(n.data.length,"data")]).encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(r),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:n.data},t,e)}return t.slice(0,e)}serializeAddressTableLookups(){let e=0;const t=new Uint8Array(oe);for(const n of this.addressTableLookups){const r=Array();fe(r,n.writableIndexes.length);const i=Array();fe(i,n.readonlyIndexes.length);e+=g.w3([de("accountKey"),g.av(r.length,"encodedWritableIndexesLength"),g.O6(g.u8(),n.writableIndexes.length,"writableIndexes"),g.av(i.length,"encodedReadonlyIndexesLength"),g.O6(g.u8(),n.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(r),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:n.readonlyIndexes},t,e)}return t.slice(0,e)}static deserialize(e){let t=[...e];const n=ke(t),r=127&n;be(n!==r,"Expected versioned message but received legacy message");be(0===r,"Expected versioned message with version 0 but found version ".concat(r));const i={numRequiredSignatures:ke(t),numReadonlySignedAccounts:ke(t),numReadonlyUnsignedAccounts:ke(t)},s=[],o=pe(t);for(let l=0;l<o;l++)s.push(new se(Se(t,0,re)));const a=l().encode(Se(t,0,re)),c=pe(t),u=[];for(let l=0;l<c;l++){const e=ke(t),n=Se(t,0,pe(t)),r=pe(t),i=new Uint8Array(Se(t,0,r));u.push({programIdIndex:e,accountKeyIndexes:n,data:i})}const d=pe(t),h=[];for(let l=0;l<d;l++){const e=new se(Se(t,0,re)),n=Se(t,0,pe(t)),r=Se(t,0,pe(t));h.push({accountKey:e,writableIndexes:n,readonlyIndexes:r})}return new Ie({header:i,staticAccountKeys:s,recentBlockhash:a,compiledInstructions:u,addressTableLookups:h})}}const Ae={deserializeMessageVersion(e){const t=e[0],n=127&t;return n===t?"legacy":n},deserialize:e=>{const t=Ae.deserializeMessageVersion(e);if("legacy"===t)return ve.from(e);if(0===t)return Ie.deserialize(e);throw new Error("Transaction message version ".concat(t," deserialization is not supported"))}};let _e=function(e){return e[e.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",e[e.PROCESSED=1]="PROCESSED",e[e.TIMED_OUT=2]="TIMED_OUT",e[e.NONCE_INVALID=3]="NONCE_INVALID",e}({});const Be=s.Buffer.alloc(64).fill(0);class We{constructor(e){this.keys=void 0,this.programId=void 0,this.data=s.Buffer.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}toJSON(){return{keys:this.keys.map(e=>{let{pubkey:t,isSigner:n,isWritable:r}=e;return{pubkey:t.toJSON(),isSigner:n,isWritable:r}}),programId:this.programId.toJSON(),data:[...this.data]}}}class xe{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:n}=e;this.minNonceContextSlot=t,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){const{blockhash:t,lastValidBlockHeight:n}=e;this.recentBlockhash=t,this.lastValidBlockHeight=n}else{const{recentBlockhash:t,nonceInfo:n}=e;n&&(this.nonceInfo=n),this.recentBlockhash=t}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstru
1ction: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=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No instructions");return t.forEach(e=>{"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 We(e))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let e,t,n;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 new Error("Transaction recentBlockhash required");if(t.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let i=0;i<t.length;i++)if(void 0===t[i].programId)throw new Error("Transaction instruction index ".concat(i," has undefined program id"));const r=[],s=[];t.forEach(e=>{e.keys.forEach(e=>{s.push((0,i.A)({},e))});const t=e.programId.toString();r.includes(t)||r.push(t)}),r.forEach(e=>{s.push({pubkey:new se(e),isSigner:!1,isWritable:!1})});const o=[];s.forEach(e=>{const t=e.pubkey.toString(),n=o.findIndex(e=>e.pubkey.toString()===t);n>-1?(o[n].isWritable=o[n].isWritable||e.isWritable,o[n].isSigner=o[n].isSigner||e.isSigner):o.push(e)}),o.sort(function(e,t){if(e.isSigner!==t.isSigner)return e.isSigner?-1:1;if(e.isWritable!==t.isWritable)return e.isWritable?-1:1;return e.pubkey.toBase58().localeCompare(t.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})});const a=o.findIndex(e=>e.pubkey.equals(n));if(a>-1){const[e]=o.splice(a,1);e.isSigner=!0,e.isWritable=!0,o.unshift(e)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const i of this.signatures){const e=o.findIndex(e=>e.pubkey.equals(i.publicKey));if(!(e>-1))throw new Error("unknown signer: ".concat(i.publicKey.toString()));o[e].isSigner||(o[e].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."))}let c=0,u=0,d=0;const h=[],g=[];o.forEach(e=>{let{pubkey:t,isSigner:n,isWritable:r}=e;n?(h.push(t.toString()),c+=1,r||(u+=1)):(g.push(t.toString()),r||(d+=1))});const m=h.concat(g),p=t.map(e=>{const{data:t,programId:n}=e;return{programIdIndex:m.indexOf(n.toString()),accounts:e.keys.map(e=>m.indexOf(e.pubkey.toString())),data:l().encode(t)}});return p.forEach(e=>{be(e.programIdIndex>=0),e.accounts.forEach(e=>be(e>=0))}),new ve({header:{numRequiredSignatures:c,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:d},accountKeys:m,recentBlockhash:e,instructions:p})}_compile(){const e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);if(this.signatures.length===t.length){if(this.signatures.every((e,n)=>t[n].equals(e.publicKey)))return e}return 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=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");const r=new Set;this.signatures=t.filter(e=>{const t=e.toString();return!r.has(t)&&(r.add(t),!0)}).map(e=>({signature:null,publicKey:e}))}sign(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");const r=new Set,i=[];for(const o of t){const e=o.publicKey.toString();r.has(e)||(r.add(e),i.push(o))}this.signatures=i.map(e=>({signature:null,publicKey:e.publicKey}));const s=this._compile();this._partialSign(s,...i)}partialSign(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");const r=new Set,i=[];for(const o of t){const e=o.publicKey.toString();r.has(e)||(r.add(e),i.push(o))}const s=this._compile();this._partialSign(s,...i)}_partialSign(e){const t=e.serialize();for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];
1r.forEach(e=>{const n=Z(t,e.secretKey);this._addSignature(e.publicKey,$(n))})}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){be(64===t.length);const n=this.signatures.findIndex(t=>e.equals(t.publicKey));if(n<0)throw new Error("unknown signer: ".concat(e.toString()));this.signatures[n].signature=s.Buffer.from(t)}verifySignatures(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,t){const n={};for(const{signature:r,publicKey:i}of this.signatures)null===r?t&&(n.missing||(n.missing=[])).push(i):Q(r,e,i.toBytes())||(n.invalid||(n.invalid=[])).push(i);return n.invalid||n.missing?n:void 0}serialize(e){const{requireAllSignatures:t,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),r=this.serializeMessage();if(n){const e=this._getMessageSignednessErrors(r,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("`, `"),"`].")),new Error(t)}}return this._serialize(r)}_serialize(e){const{signatures:t}=this,n=[];fe(n,t.length);const r=n.length+64*t.length+e.length,i=s.Buffer.alloc(r);return be(t.length<256),s.Buffer.from(n).copy(i,0),t.forEach((e,t)=>{let{signature:r}=e;null!==r&&(be(64===r.length,"signature has invalid length"),s.Buffer.from(r).copy(i,n.length+64*t))}),e.copy(i,n.length+64*t.length),be(i.length<=oe,"Transaction too large: ".concat(i.length," > ").concat(oe)),i}get keys(){return be(1===this.instructions.length),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return be(1===this.instructions.length),this.instructions[0].programId}get data(){return be(1===this.instructions.length),this.instructions[0].data}static from(e){let t=[...e];const n=pe(t);let r=[];for(let i=0;i<n;i++){const e=Se(t,0,64);r.push(l().encode(s.Buffer.from(e)))}return xe.populate(ve.from(t),r)}static populate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=new xe;return n.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(n.feePayer=e.accountKeys[0]),t.forEach((t,r)=>{const i={signature:t==l().encode(Be)?null:l().decode(t),publicKey:e.accountKeys[r]};n.signatures.push(i)}),e.instructions.forEach(t=>{const r=t.accounts.map(t=>{const r=e.accountKeys[t];return{pubkey:r,isSigner:n.signatures.some(e=>e.publicKey.toString()===r.toString())||e.isAccountSigner(t),isWritable:e.isAccountWritable(t)}});n.instructions.push(new We({keys:r,programId:e.accountKeys[t.programIdIndex],data:l().decode(t.data)}))}),n._message=e,n._json=n.toJSON(),n}}class Pe{get version(){return this.message.version}constructor(e,t){if(this.signatures=void 0,this.message=void 0,void 0!==t)be(t.length===e.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=t;else{const t=[];for(let n=0;n<e.header.numRequiredSignatures;n++)t.push(new Uint8Array(64));this.signatures=t}this.message=e}serialize(){const e=this.message.serialize(),t=Array();fe(t,this.signatures.length);const n=g.w3([g.av(t.length,"encodedSignaturesLength"),g.O6(he(),this.signatures.length,"signatures"),g.av(e.length,"serializedMessage")]),r=new Uint8Array(2048),i=n.encode({encodedSignaturesLength:new Uint8Array(t),signatures:this.signatures,serializedMessage:e},r);return r.slice(0,i)}static deserialize(e){let t=[...e];const n=[],r=pe(t);for(let s=0;s<r;s++)n.push(new Uint8Array(Se(t,0,64)));const i=Ae.deserialize(new Uint8Array(t));return new Pe(i,n)}sign(e){const t=this.message.serialize(),n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures);for(const r of e){const e=n.findIndex(e=>e.equals(r.publicKey));be(e>=0,"Cannot sign with non signer key ".concat(r.publicKey.toBase58())),this.signatures[e]=Z(t,r.secretKey)}}addSignature(e,t){be(64===t.byteLength,"Signature must be 64 bytes long");const n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(t=>t.equals(e));be(n>=0,"Can not add signature; `".concat(e.toBase58(),"` is not required to sign this transaction")),this.signatures[n]=t}}const Ee=new se("SysvarC1ock11111111111111111111111111111111"),Ne=(new se("SysvarEpochSchedu1e111111111111111111111111"),new se("Sysvar1nstructions1111111111111111111111111"),new se("SysvarRecentB1ockHashes11111111111111111111")),Ce=new se("SysvarRent111111111111111111111111111111111"),Te=(new se("SysvarRewards111111111111111111111111111111"),new se("SysvarS1otHashes111111111111111111111111111"),new se("SysvarS1otHistory11111111111111111111111111"),new se("SysvarStakeHistory1111111111111111111111111"));
1class Oe extends Error{constructor(e){let{action:t,signature:n,transactionMessage:r,logs:i}=e;const s=i?"Logs: \n".concat(JSON.stringify(i.slice(-10),null,2),". "):"",o="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";let a;switch(t){case"send":a="Transaction ".concat(n," resulted in an error. \n")+"".concat(r,". ")+s+o;break;case"simulate":a="Simulation failed. \nMessage: ".concat(r,". \n")+s+o;break;default:a="Unknown action '".concat(t,"'")}super(a),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=n,this.transactionMessage=r,this.transactionLogs=i||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){const e=this.transactionLogs;if(null==e||"object"!==typeof e||!("then"in e))return e}async getLogs(e){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise((t,n)=>{e.getTransaction(this.signature).then(e=>{if(e&&e.meta&&e.meta.logMessages){const n=e.meta.logMessages;this.transactionLogs=n,t(n)}else n(new Error("Log messages not found"))}).catch(n)})),await this.transactionLogs}}class ze extends Error{constructor(e,t){let{code:n,message:r,data:i}=e;super(null!=t?"".concat(t,": ").concat(r):r),this.code=void 0,this.data=void 0,this.code=n,this.data=i,this.name="SolanaJSONRPCError"}}async function Ke(e,t,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},s=await e.sendTransaction(t,n,i);let o;if(null!=t.recentBlockhash&&null!=t.lastValidBlockHeight)o=(await e.confirmTransaction({abortSignal:null===r||void 0===r?void 0:r.abortSignal,signature:s,blockhash:t.recentBlockhash,lastValidBlockHeight:t.lastValidBlockHeight},r&&r.commitment)).value;else if(null!=t.minNonceContextSlot&&null!=t.nonceInfo){const{nonceInstruction:n}=t.nonceInfo,i=n.keys[0].pubkey;o=(await e.confirmTransaction({abortSignal:null===r||void 0===r?void 0:r.abortSignal,minContextSlot:t.minNonceContextSlot,nonceAccountPubkey:i,nonceValue:t.nonceInfo.nonce,signature:s},r&&r.commitment)).value}else null!=(null===r||void 0===r?void 0:r.abortSignal)&&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."),o=(await e.confirmTransaction(s,r&&r.commitment)).value;if(o.err){if(null!=s)throw new Oe({action:"send",signature:s,transactionMessage:"Status: (".concat(JSON.stringify(o),")")});throw new Error("Transaction ".concat(s," failed (").concat(JSON.stringify(o),")"))}return s}function Le(e){return new Promise(t=>setTimeout(t,e))}function qe(e,t){const n=e.layout.span>=0?e.layout.span:me(e,t),r=s.Buffer.alloc(n),i=Object.assign({instruction:e.index},t);return e.layout.encode(i,r),r}const Re=g.I0("lamportsPerSignature"),Ye=g.w3([g.DH("version"),g.DH("state"),de("authorizedPubkey"),de("nonce"),g.w3([Re],"feeCalculator")]),je=Ye.span;class De{constructor(e){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}static fromAccountData(e){const t=Ye.decode($(e),0);return new De({authorizedPubkey:new se(t.authorizedPubkey),nonce:new se(t.nonce).toString(),feeCalculator:t.feeCalculator})}}function He(e){const t=(0,g.av)(8,e),n=t.decode.bind(t),r=t.encode.bind(t),i=t,s=L();return i.decode=(e,t)=>{const r=n(e,t);return s.decode(r)},i.encode=(e,t,n)=>{const i=s.encode(e);return r(i,t,n)},i}const Me=Object.freeze({Create:{index:0,layout:g.w3([g.DH("instruction"),g.Wg("lamports"),g.Wg("space"),de("programId")])},Assign:{index:1,layout:g.w3([g.DH("instruction"),de("programId")])},Transfer:{index:2,layout:g.w3([g.DH("instruction"),He("lamports")])},CreateWithSeed:{index:3,layout:g.w3([g.DH("instruction"),de("base"),ge("seed"),g.Wg("lamports"),g.Wg("space"),de("programId")])},AdvanceNonceAccount:{index:4,layout:g.w3([g.DH("instruction")])},WithdrawNonceAccount:{index:5,layout:g.w3([g.DH("instruction"),g.Wg("lamports")])},InitializeNonceAccount:{index:6,layout:g.w3([g.DH("instruction"),de("authorized")])},AuthorizeNonceAccount:{index:7,layout:g.w3([g.DH("instruction"),de("authorized")])},Allocate:{index:8,layout:g.w3([g.DH("instruction"),g.Wg("space")])},AllocateWithSeed:{index:9,layout:g.w3([g.DH("instruction"),de("base"),ge("seed"),g.Wg("space"),de("programId")])},AssignWithSeed:{index:10,layout:g.w3([g.DH("instruction"),de("base"),ge("seed"),de("programId")])},TransferWithSeed:{index:11,layout:g.w3([g.DH("instruction"),He("lamports"),ge("seed"),de("programId")])},UpgradeNonceAccount:{index:12,layout:g.w3([g.DH("instruction")])}});
1class Ue{constructor(){}static createAccount(e){const t=qe(Me.Create,{lamports:e.lamports,space:e.space,programId:$(e.programId.toBuffer())});return new We({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,n;if("basePubkey"in e){t=qe(Me.TransferWithSeed,{lamports:BigInt(e.lamports),seed:e.seed,programId:$(e.programId.toBuffer())}),n=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}else{t=qe(Me.Transfer,{lamports:BigInt(e.lamports)}),n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}return new We({keys:n,programId:this.programId,data:t})}static assign(e){let t,n;if("basePubkey"in e){t=qe(Me.AssignWithSeed,{base:$(e.basePubkey.toBuffer()),seed:e.seed,programId:$(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{t=qe(Me.Assign,{programId:$(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new We({keys:n,programId:this.programId,data:t})}static createAccountWithSeed(e){const t=qe(Me.CreateWithSeed,{base:$(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:$(e.programId.toBuffer())});let n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey.equals(e.fromPubkey)||n.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new We({keys:n,programId:this.programId,data:t})}static createNonceAccount(e){const t=new xe;"basePubkey"in e&&"seed"in e?t.add(Ue.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:je,programId:this.programId})):t.add(Ue.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:je,programId:this.programId}));const n={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return t.add(this.nonceInitialize(n)),t}static nonceInitialize(e){const t=qe(Me.InitializeNonceAccount,{authorized:$(e.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Ne,isSigner:!1,isWritable:!1},{pubkey:Ce,isSigner:!1,isWritable:!1}],programId:this.programId,data:t};return new We(n)}static nonceAdvance(e){const t=qe(Me.AdvanceNonceAccount),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Ne,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t};return new We(n)}static nonceWithdraw(e){const t=qe(Me.WithdrawNonceAccount,{lamports:e.lamports});return new We({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:Ne,isSigner:!1,isWritable:!1},{pubkey:Ce,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static nonceAuthorize(e){const t=qe(Me.AuthorizeNonceAccount,{authorized:$(e.newAuthorizedPubkey.toBuffer())});return new We({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,n;if("basePubkey"in e){t=qe(Me.AllocateWithSeed,{base:$(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:$(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{t=qe(Me.Allocate,{space:e.space}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new We({keys:n,programId:this.programId,data:t})}}Ue.programId=new se("11111111111111111111111111111111");class Fe{constructor(){}static getMinNumSignatures(e){return 2*(Math.ceil(e/Fe.chunkSize)+1+1)}static async load(e,t,n,r,i){{const s=await e.getMinimumBalanceForRentExemption(i.length),o=await e.getAccountInfo(n.publicKey,"confirmed");let a=null;if(null!==o){if(o.executable)return console.error("Program load failed, account is already executable"),!1;o.data.length!==i.length&&(a=a||new xe,a.add(Ue.allocate({accountPubkey:n.publicKey,space:i.length}))),o.owner.equals(r)||(a=a||new xe,a.add(Ue.assign({accountPubkey:n.publicKey,programId:r}))),o.lamports<s&&(a=a||new xe,a.add(Ue.transfer({fromPubkey:t.publicKey,toPubkey:n.publicKey,lamports:s-o.lamports})))}else a=(new xe).add(Ue.createAccount({fromPubkey:t.publicKey,newAccountPubkey:n.publicKey,lamports:s>0?s:1,space:i.length,programId:r}));null!==a&&await Ke(e,a,[t,n],{commitment:"confirmed"})}const o=g.w3([g.DH("instruction"),g.DH("offset"),g.DH("bytesLength"),g.DH("bytesLengthPadding"),g.O6(g.u8("byte"),g.cY(g.DH(),-8),"bytes")]),a=Fe.chunkSize;let c=0,u=i,l=[];for(;u.length>0;){const i=u.slice(0,a),d=s.Buffer.alloc(a+16);o.encode({instruction:0,offset:c,bytes:i,bytesLength:0,bytesLengthPadding:0},d);const h=(new xe).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:d});if(l.push(Ke(e,h,[t,n],{commitment:"confirmed"})),e._rpcEndpoint.includes("solana.com")){const e=4;await Le(1e3/e)}c+=a,u=u.slice(a)}await Promise.all(l);{const i=g.w3([g.DH("instruction")]),o=s.Buffer.alloc(i.span);i.encode({instruction:1},o);const a=(new xe).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:Ce,isSigner:!1,isWritable:!1}],programId:r,data:o}),c="processed",u=await e.sendTransaction(a,[t,n],{preflightCommitment:c}),{context:l,value:h}=await e.confirmTransaction({signature:u,lastValidBlockHeight:a.lastV
1alidBlockHeight,blockhash:a.recentBlockhash},c);if(h.err)throw new Error("Transaction ".concat(u," failed (").concat(JSON.stringify(h),")"));for(;;){try{if(await e.getSlot({commitment:c})>l.slot)break}catch(d){}await new Promise(e=>setTimeout(e,Math.round(200)))}}return!0}}Fe.chunkSize=932;new se("BPFLoader2111111111111111111111111111111111");function Ve(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Je,Ge;function Xe(){if(Ge)return Je;Ge=1;var e=Object.prototype.toString,t=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};function n(r,i){var s,o,a,c,u,l,d;if(!0===r)return"true";if(!1===r)return"false";switch(typeof r){case"object":if(null===r)return null;if(r.toJSON&&"function"===typeof r.toJSON)return n(r.toJSON(),i);if("[object Array]"===(d=e.call(r))){for(a="[",o=r.length-1,s=0;s<o;s++)a+=n(r[s],!0)+",";return o>-1&&(a+=n(r[s],!0)),a+"]"}if("[object Object]"===d){for(o=(c=t(r).sort()).length,a="",s=0;s<o;)void 0!==(l=n(r[u=c[s]],!1))&&(a&&(a+=","),a+=JSON.stringify(u)+":"+l),s++;return"{"+a+"}"}return JSON.stringify(r);case"function":case"undefined":return i?null:void 0;case"string":return JSON.stringify(r);default:return isFinite(r)?r:null}}return Je=function(e){var t=n(e,!1);if(void 0!==t)return""+t}}var Ze=Ve(Xe());function Qe(e){let t=0;for(;e>1;)e/=2,t++;return t}class $e{constructor(e,t,n,r,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=e,this.leaderScheduleSlotOffset=t,this.warmup=n,this.firstNormalEpoch=r,this.firstNormalSlot=i}getEpoch(e){return this.getEpochAndSlotIndex(e)[0]}getEpochAndSlotIndex(e){if(e<this.firstNormalSlot){const n=Qe(0===(t=e+32+1)?1:(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,1+(t|=t>>32)))-Qe(32)-1;return[n,e-(this.getSlotsInEpoch(n)-32)]}{const t=e-this.firstNormalSlot,n=Math.floor(t/this.slotsPerEpoch);return[this.firstNormalEpoch+n,t%this.slotsPerEpoch]}var t}getFirstSlotInEpoch(e){return e<=this.firstNormalEpoch?32*(Math.pow(2,e)-1):(e-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(e){return this.getFirstSlotInEpoch(e)+this.getSlotsInEpoch(e)-1}getSlotsInEpoch(e){return e<this.firstNormalEpoch?Math.pow(2,e+Qe(32)):this.slotsPerEpoch}}var et=globalThis.fetch;class tt extends j.vE{constructor(e,t,n){super(e=>{const n=(0,j.kb)(e,(0,i.A)({autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3},t));return this.underlyingSocket="socket"in n?n.socket:n,n},e,t,n),this.underlyingSocket=void 0}call(){var e;const t=null===(e=this.underlyingSocket)||void 0===e?void 0:e.readyState;return 1===t?super.call(...arguments):Promise.reject(new Error("Tried to call a JSON-RPC method `"+(arguments.length<=0?void 0:arguments[0])+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+t+")"))}notify(){var e;const t=null===(e=this.underlyingSocket)||void 0===e?void 0:e.readyState;return 1===t?super.notify(...arguments):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+(arguments.length<=0?void 0:arguments[0])+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+t+")"))}}class nt{constructor(e){this.key=void 0,this.state=void 0,this.key=e.key,this.state=e.state}isActive(){const e=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===e}static deserialize(e){const t=function(e,t){let n;try{n=e.layout.decode(t)}catch(r){throw new Error("invalid instruction; "+r)}if(n.typeIndex!==e.index)throw new Error("invalid account data; account type mismatch ".concat(n.typeIndex," != ").concat(e.index));return n}(rt,e),n=e.length-56;be(n>=0,"lookup table is invalid"),be(n%32===0,"lookup table is invalid");const r=n/32,{addresses:i}=g.w3([g.O6(de(),r,"addresses")]).decode(e.slice(56));return{deactivationSlot:t.deactivationSlot,lastExtendedSlot:t.lastExtendedSlot,lastExtendedSlotStartIndex:t.lastExtendedStartIndex,authority:0!==t.authority.length?new se(t.authority[0]):void 0,addresses:i.map(e=>new se(e))}}}const rt={index:1,layout:g.w3([g.DH("typeIndex"),He("deactivationSlot"),g.I0("lastExtendedSlot"),g.u8("lastExtendedStartIndex"),g.u8(),g.O6(de(),g.cY(g.u8(),-1),"authority")])},it=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;const st=(0,q.au)((0,q.KJ)(se),(0,q.Yj)(),e=>new se(e)),ot=(0,q.PV)([(0,q.Yj)(),(0,q.eu)("base64")]),at=(0,q.au)((0,q.KJ)(s.Buffer),ot,e=>s.Buffer.from(e[0],"base64"));function ct(e){let t,n;if("string"===typeof e)t=e;else if(e){const{commitment:i}=e;t=i,n=(0,r.A)(e,M)}return{commitment:t,config:n}}function ut(e){return e.map(e=>{var t;return"memcmp"in e?(0,i.A)((0,i.A)({},e),{},{memcmp:(0,i.A)((0,i.A)({},e.memcmp),{},{encoding:null!==(t=e.memcmp.encoding)&&void 0!==t?t:"base58"})}):e})}function lt(e){return(0,q.KC)([(0,q.NW)({jsonrpc:(0,q.eu)("2.0"),id:(0,q.Yj)(),result:e}),(0,q.NW)({jsonrpc:(0,q.eu)("2.0"),id:(0,q.Yj)(),error:(0,q.NW)({code:(0,q.L5)(),message:(0,q.Yj)(),data:(0,q.lq)((0,q.bz)())})})])}const dt=lt((0,q.L5)());function ht(e){return(0,q.au)(lt(e),dt,t=>"error"in t?t:(0,i.A)((0,i.A)({},t),{},{result:(0,q.vt)(t.result,e)}))}function gt(e){return ht((0,q.NW)({context:(0,q.NW)({slot:(0,q.ai)()}),value:e}))}function mt(e){return(0,q.NW)({context:(0,q.NW)({slot:(0,q.ai)()}),value:e})}function pt(e,t){return 0===e?new Ie({header:t.header,staticAccountKeys:t.accountKeys.map(e=>new se(e)),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:l().decode(e.data)})),addressTableLookups:t.addressTableLookups}):new ve(t)}const ft=(0,q.NW)({foundation:(0,q.ai)(),foundationTerm:(0,q.ai)(),initial:(0,q.ai)(),taper:(0,q.ai)(),terminal:(0,q.ai)()}),bt=ht((0,q.YO)((0,q.me)((0,q.NW)({epoch:(0,q.ai)(),effectiveSlot:(0,q.ai)(),amount:(0,q.ai)(),postBalance:(0,q.ai)(),commission:(0,q.lq)((0,q.me)((0,q.ai)()))})))),yt=(0,q.YO)((0,q.NW)({slot:(0,q.ai)(),prioritizationFee:(0,q.ai)()})),wt=(0,q.NW)({total:(0,q.ai)(),validator:(0,q.ai)(),foundation:(0,q.ai)(),epoch:(0,q.ai)()}),kt=(0,q.NW)({epoch:(0,q.ai)(),slotIndex:(0,q.ai)(),slotsInEpoch:(0,q.ai)(),absoluteSlot:(0,q.ai)(),blockHeight:(0,q.lq)((0,q.ai)()),transactionCount:(0,q.lq)((0,q.ai)())}),St=(0,q.NW)({slotsPerEpoch:(0,q.ai)(),leaderScheduleSlotOffset:(0,q.ai)(),warmup:(0,q.zM)(),firstNormalEpoch:(0,q.ai)(),firstNormalSlot:(0,q.ai)()}),vt=(0,q.g1)((0,q.Yj)(),(0,q.YO)((0,q.ai)())),It=(0,q.me)((0,q.KC)([(0,q.NW)({}),(0,q.Yj)()])),At=(0,q.NW)({err:It}),_t=(0,q.eu)("receivedSignature"),Bt=(0,q.NW)({"solana-core":(0,q.Yj)(),"feature-set":(0,q.lq)((0,q.ai)())}
1),Wt=(0,q.NW)({program:(0,q.Yj)(),programId:st,parsed:(0,q.L5)()}),xt=(0,q.NW)({programId:st,accounts:(0,q.YO)(st),data:(0,q.Yj)()}),Pt=gt((0,q.NW)({err:(0,q.me)((0,q.KC)([(0,q.NW)({}),(0,q.Yj)()])),logs:(0,q.me)((0,q.YO)((0,q.Yj)())),accounts:(0,q.lq)((0,q.me)((0,q.YO)((0,q.me)((0,q.NW)({executable:(0,q.zM)(),owner:(0,q.Yj)(),lamports:(0,q.ai)(),data:(0,q.YO)((0,q.Yj)()),rentEpoch:(0,q.lq)((0,q.ai)())}))))),unitsConsumed:(0,q.lq)((0,q.ai)()),returnData:(0,q.lq)((0,q.me)((0,q.NW)({programId:(0,q.Yj)(),data:(0,q.PV)([(0,q.Yj)(),(0,q.eu)("base64")])}))),innerInstructions:(0,q.lq)((0,q.me)((0,q.YO)((0,q.NW)({index:(0,q.ai)(),instructions:(0,q.YO)((0,q.KC)([Wt,xt]))}))))})),Et=gt((0,q.NW)({byIdentity:(0,q.g1)((0,q.Yj)(),(0,q.YO)((0,q.ai)())),range:(0,q.NW)({firstSlot:(0,q.ai)(),lastSlot:(0,q.ai)()})}));const Nt=ht(ft),Ct=ht(wt),Tt=ht(yt),Ot=ht(kt),zt=ht(St),Kt=ht(vt),Lt=ht((0,q.ai)()),qt=gt((0,q.NW)({total:(0,q.ai)(),circulating:(0,q.ai)(),nonCirculating:(0,q.ai)(),nonCirculatingAccounts:(0,q.YO)(st)})),Rt=(0,q.NW)({amount:(0,q.Yj)(),uiAmount:(0,q.me)((0,q.ai)()),decimals:(0,q.ai)(),uiAmountString:(0,q.lq)((0,q.Yj)())}),Yt=gt((0,q.YO)((0,q.NW)({address:st,amount:(0,q.Yj)(),uiAmount:(0,q.me)((0,q.ai)()),decimals:(0,q.ai)(),uiAmountString:(0,q.lq)((0,q.Yj)())}))),jt=gt((0,q.YO)((0,q.NW)({pubkey:st,account:(0,q.NW)({executable:(0,q.zM)(),owner:st,lamports:(0,q.ai)(),data:at,rentEpoch:(0,q.ai)()})}))),Dt=(0,q.NW)({program:(0,q.Yj)(),parsed:(0,q.L5)(),space:(0,q.ai)()}),Ht=gt((0,q.YO)((0,q.NW)({pubkey:st,account:(0,q.NW)({executable:(0,q.zM)(),owner:st,lamports:(0,q.ai)(),data:Dt,rentEpoch:(0,q.ai)()})}))),Mt=gt((0,q.YO)((0,q.NW)({lamports:(0,q.ai)(),address:st}))),Ut=(0,q.NW)({executable:(0,q.zM)(),owner:st,lamports:(0,q.ai)(),data:at,rentEpoch:(0,q.ai)()}),Ft=(0,q.NW)({pubkey:st,account:Ut}),Vt=(0,q.au)((0,q.KC)([(0,q.KJ)(s.Buffer),Dt]),(0,q.KC)([ot,Dt]),e=>Array.isArray(e)?(0,q.vt)(e,at):e),Jt=(0,q.NW)({executable:(0,q.zM)(),owner:st,lamports:(0,q.ai)(),data:Vt,rentEpoch:(0,q.ai)()}),Gt=(0,q.NW)({pubkey:st,account:Jt}),Xt=(0,q.NW)({state:(0,q.KC)([(0,q.eu)("active"),(0,q.eu)("inactive"),(0,q.eu)("activating"),(0,q.eu)("deactivating")]),active:(0,q.ai)(),inactive:(0,q.ai)()}),Zt=ht((0,q.YO)((0,q.NW)({signature:(0,q.Yj)(),slot:(0,q.ai)(),err:It,memo:(0,q.me)((0,q.Yj)()),blockTime:(0,q.lq)((0,q.me)((0,q.ai)()))}))),Qt=ht((0,q.YO)((0,q.NW)({signature:(0,q.Yj)(),slot:(0,q.ai)(),err:It,memo:(0,q.me)((0,q.Yj)()),blockTime:(0,q.lq)((0,q.me)((0,q.ai)()))}))),$t=(0,q.NW)({subscription:(0,q.ai)(),result:mt(Ut)}),en=(0,q.NW)({pubkey:st,account:Ut}),tn=(0,q.NW)({subscription:(0,q.ai)(),result:mt(en)}),nn=(0,q.NW)({parent:(0,q.ai)(),slot:(0,q.ai)(),root:(0,q.ai)()}),rn=(0,q.NW)({subscription:(0,q.ai)(),result:nn}),sn=(0,q.KC)([(0,q.NW)({type:(0,q.KC)([(0,q.eu)("firstShredReceived"),(0,q.eu)("completed"),(0,q.eu)("optimisticConfirmation"),(0,q.eu)("root")]),slot:(0,q.ai)(),timestamp:(0,q.ai)()}),(0,q.NW)({type:(0,q.eu)("createdBank"),parent:(0,q.ai)(),slot:(0,q.ai)(),timestamp:(0,q.ai)()}),(0,q.NW)({type:(0,q.eu)("frozen"),slot:(0,q.ai)(),timestamp:(0,q.ai)(),stats:(0,q.NW)({numTransactionEntries:(0,q.ai)(),numSuccessfulTransactions:(0,q.ai)(),numFailedTransactions:(0,q.ai)(),maxTransactionsPerEntry:(0,q.ai)()})}),(0,q.NW)({type:(0,q.eu)("dead"),slot:(0,q.ai)(),timestamp:(0,q.ai)(),err:(0,q.Yj)()})]),on=(0,q.NW)({subscription:(0,q.ai)(),result:sn}),an=(0,q.NW)({subscription:(0,q.ai)(),result:mt((0,q.KC)([At,_t]))}),cn=(0,q.NW)({subscription:(0,q.ai)(),result:(0,q.ai)()}),un=(0,q.NW)({pubkey:(0,q.Yj)(),gossip:(0,q.me)((0,q.Yj)()),tpu:(0,q.me)((0,q.Yj)()),rpc:(0,q.me)((0,q.Yj)()),version:(0,q.me)((0,q.Yj)())}),ln=(0,q.NW)({votePubkey:(0,q.Yj)(),nodePubkey:(0,q.Yj)(),activatedStake:(0,q.ai)(),epochVoteAccount:(0,q.zM)(),epochCredits:(0,q.YO)((0,q.PV)([(0,q.ai)(),(0,q.ai)(),(0,q.ai)()])),commission:(0,q.ai)(),lastVote:(0,q.ai)(),rootSlot:(0,q.me)((0,q.ai)())}),dn=ht((0,q.NW)({current:(0,q.YO)(ln),delinquent:(0,q.YO)(ln)})),hn=(0,q.KC)([(0,q.eu)("processed"),(0,q.eu)("confirmed"),(0,q.eu)("finalized")]),gn=(0,q.NW)({slot:(0,q.ai)(),confirmations:(0,q.me)((0,q.ai)()),err:It,confirmationStatus:(0,q.lq)(hn)}),mn=gt((0,q.YO)((0,q.me)(gn))),pn=ht((0,q.ai)()),fn=(0,q.NW)({accountKey:st,writableIndexes:(0,q.YO)((0,q.ai)()),readonlyIndexes:(0,q.YO)((0,q.ai)())}),bn=(0,q.NW)({signatures:(0,q.YO)((0,q.Yj)()),message:(0,q.NW)({accountKeys:(0,q.YO)((0,q.Yj)()),header:(0,q.NW)({numRequiredSignatures:(0,q.ai)(),numReadonlySignedAccounts:(0,q.ai)(),numReadonlyUnsignedAccounts:(0,q.ai)()}),instructions:(0,q.YO)((0,q.NW)({accounts:(0,q.YO)((0,q.ai)()),data:(0,q.Yj)(),programIdIndex:(0,q.ai)()})),recentBlockhash:(0,q.Yj)(),addressTableLookups:(0,q.lq)((0,q.YO)(fn))})}),yn=(0,q.NW)({pubkey:st,signer:(0,q.zM)(),writable:(0,q.zM)(),source:(0,q.lq)((0,q.KC)([(0,q.eu)("transaction"),(0,q.eu)("lookupTable")]))}),wn=(0,q.NW)({accountKeys:(0,q.YO)(yn),signatures:(0,q.YO)((0,q.Yj)())}
1),kn=(0,q.NW)({parsed:(0,q.L5)(),program:(0,q.Yj)(),programId:st}),Sn=(0,q.NW)({accounts:(0,q.YO)(st),data:(0,q.Yj)(),programId:st}),vn=(0,q.KC)([Sn,kn]),In=(0,q.KC)([(0,q.NW)({parsed:(0,q.L5)(),program:(0,q.Yj)(),programId:(0,q.Yj)()}),(0,q.NW)({accounts:(0,q.YO)((0,q.Yj)()),data:(0,q.Yj)(),programId:(0,q.Yj)()})]),An=(0,q.au)(vn,In,e=>"accounts"in e?(0,q.vt)(e,Sn):(0,q.vt)(e,kn)),_n=(0,q.NW)({signatures:(0,q.YO)((0,q.Yj)()),message:(0,q.NW)({accountKeys:(0,q.YO)(yn),instructions:(0,q.YO)(An),recentBlockhash:(0,q.Yj)(),addressTableLookups:(0,q.lq)((0,q.me)((0,q.YO)(fn)))})}),Bn=(0,q.NW)({accountIndex:(0,q.ai)(),mint:(0,q.Yj)(),owner:(0,q.lq)((0,q.Yj)()),programId:(0,q.lq)((0,q.Yj)()),uiTokenAmount:Rt}),Wn=(0,q.NW)({writable:(0,q.YO)(st),readonly:(0,q.YO)(st)}),xn=(0,q.NW)({err:It,fee:(0,q.ai)(),innerInstructions:(0,q.lq)((0,q.me)((0,q.YO)((0,q.NW)({index:(0,q.ai)(),instructions:(0,q.YO)((0,q.NW)({accounts:(0,q.YO)((0,q.ai)()),data:(0,q.Yj)(),programIdIndex:(0,q.ai)()}))})))),preBalances:(0,q.YO)((0,q.ai)()),postBalances:(0,q.YO)((0,q.ai)()),logMessages:(0,q.lq)((0,q.me)((0,q.YO)((0,q.Yj)()))),preTokenBalances:(0,q.lq)((0,q.me)((0,q.YO)(Bn))),postTokenBalances:(0,q.lq)((0,q.me)((0,q.YO)(Bn))),loadedAddresses:(0,q.lq)(Wn),computeUnitsConsumed:(0,q.lq)((0,q.ai)()),costUnits:(0,q.lq)((0,q.ai)())}),Pn=(0,q.NW)({err:It,fee:(0,q.ai)(),innerInstructions:(0,q.lq)((0,q.me)((0,q.YO)((0,q.NW)({index:(0,q.ai)(),instructions:(0,q.YO)(An)})))),preBalances:(0,q.YO)((0,q.ai)()),postBalances:(0,q.YO)((0,q.ai)()),logMessages:(0,q.lq)((0,q.me)((0,q.YO)((0,q.Yj)()))),preTokenBalances:(0,q.lq)((0,q.me)((0,q.YO)(Bn))),postTokenBalances:(0,q.lq)((0,q.me)((0,q.YO)(Bn))),loadedAddresses:(0,q.lq)(Wn),computeUnitsConsumed:(0,q.lq)((0,q.ai)()),costUnits:(0,q.lq)((0,q.ai)())}),En=(0,q.KC)([(0,q.eu)(0),(0,q.eu)("legacy")]),Nn=(0,q.NW)({pubkey:(0,q.Yj)(),lamports:(0,q.ai)(),postBalance:(0,q.me)((0,q.ai)()),rewardType:(0,q.me)((0,q.Yj)()),commission:(0,q.lq)((0,q.me)((0,q.ai)()))}),Cn=ht((0,q.me)((0,q.NW)({blockhash:(0,q.Yj)(),previousBlockhash:(0,q.Yj)(),parentSlot:(0,q.ai)(),transactions:(0,q.YO)((0,q.NW)({transaction:bn,meta:(0,q.me)(xn),version:(0,q.lq)(En)})),rewards:(0,q.lq)((0,q.YO)(Nn)),blockTime:(0,q.me)((0,q.ai)()),blockHeight:(0,q.me)((0,q.ai)())}))),Tn=ht((0,q.me)((0,q.NW)({blockhash:(0,q.Yj)(),previousBlockhash:(0,q.Yj)(),parentSlot:(0,q.ai)(),rewards:(0,q.lq)((0,q.YO)(Nn)),blockTime:(0,q.me)((0,q.ai)()),blockHeight:(0,q.me)((0,q.ai)())}))),On=ht((0,q.me)((0,q.NW)({blockhash:(0,q.Yj)(),previousBlockhash:(0,q.Yj)(),parentSlot:(0,q.ai)(),transactions:(0,q.YO)((0,q.NW)({transaction:wn,meta:(0,q.me)(xn),version:(0,q.lq)(En)})),rewards:(0,q.lq)((0,q.YO)(Nn)),blockTime:(0,q.me)((0,q.ai)()),blockHeight:(0,q.me)((0,q.ai)())}))),zn=ht((0,q.me)((0,q.NW)({blockhash:(0,q.Yj)(),previousBlockhash:(0,q.Yj)(),parentSlot:(0,q.ai)(),transactions:(0,q.YO)((0,q.NW)({transaction:_n,meta:(0,q.me)(Pn),version:(0,q.lq)(En)})),rewards:(0,q.lq)((0,q.YO)(Nn)),blockTime:(0,q.me)((0,q.ai)()),blockHeight:(0,q.me)((0,q.ai)())}))),Kn=ht((0,q.me)((0,q.NW)({blockhash:(0,q.Yj)(),previousBlockhash:(0,q.Yj)(),parentSlot:(0,q.ai)(),transactions:(0,q.YO)((0,q.NW)({transaction:wn,meta:(0,q.me)(Pn),version:(0,q.lq)(En)})),rewards:(0,q.lq)((0,q.YO)(Nn)),blockTime:(0,q.me)((0,q.ai)()),blockHeight:(0,q.me)((0,q.ai)())}))),Ln=ht((0,q.me)((0,q.NW)({blockhash:(0,q.Yj)(),previousBlockhash:(0,q.Yj)(),parentSlot:(0,q.ai)(),rewards:(0,q.lq)((0,q.YO)(Nn)),blockTime:(0,q.me)((0,q.ai)()),blockHeight:(0,q.me)((0,q.ai)())}))),qn=ht((0,q.me)((0,q.NW)({blockhash:(0,q.Yj)(),previousBlockhash:(0,q.Yj)(),parentSlot:(0,q.ai)(),transactions:(0,q.YO)((0,q.NW)({transaction:bn,meta:(0,q.me)(xn)})),rewards:(0,q.lq)((0,q.YO)(Nn)),blockTime:(0,q.me)((0,q.ai)())}))),Rn=ht((0,q.me)((0,q.NW)({blockhash:(0,q.Yj)(),previousBlockhash:(0,q.Yj)(),parentSlot:(0,q.ai)(),signatures:(0,q.YO)((0,q.Yj)()),blockTime:(0,q.me)((0,q.ai)())}))),Yn=ht((0,q.me)((0,q.NW)({slot:(0,q.ai)(),meta:(0,q.me)(xn),blockTime:(0,q.lq)((0,q.me)((0,q.ai)())),transaction:bn,version:(0,q.lq)(En)}))),jn=ht((0,q.me)((0,q.NW)({slot:(0,q.ai)(),transaction:_n,meta:(0,q.me)(Pn),blockTime:(0,q.lq)((0,q.me)((0,q.ai)())),version:(0,q.lq)(En)}
1))),Dn=gt((0,q.NW)({blockhash:(0,q.Yj)(),lastValidBlockHeight:(0,q.ai)()})),Hn=gt((0,q.zM)()),Mn=(0,q.NW)({slot:(0,q.ai)(),numTransactions:(0,q.ai)(),numSlots:(0,q.ai)(),samplePeriodSecs:(0,q.ai)()}),Un=ht((0,q.YO)(Mn)),Fn=gt((0,q.me)((0,q.NW)({feeCalculator:(0,q.NW)({lamportsPerSignature:(0,q.ai)()})}))),Vn=ht((0,q.Yj)()),Jn=ht((0,q.Yj)()),Gn=(0,q.NW)({err:It,logs:(0,q.YO)((0,q.Yj)()),signature:(0,q.Yj)()}),Xn=(0,q.NW)({result:mt(Gn),subscription:(0,q.ai)()}),Zn={"solana-client":"js/".concat("1.0.0-maintenance")};class Qn{constructor(e,t){let n,r,i,s,o,a;var c;this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const e={};return async t=>{var n;const{commitment:r,config:i}=ct(t),s=this._buildArgs([],r,void 0,i),o=Ze(s);return e[o]=null!==(n=e[o])&&void 0!==n?n:(async()=>{try{const e=await this._rpcRequest("getBlockHeight",s),t=(0,q.vt)(e,ht((0,q.ai)()));if("error"in t)throw new ze(t.error,"failed to get block height information");return t.result}finally{delete e[o]}})(),await e[o]}})(),t&&"string"===typeof t?this._commitment=t:t&&(this._commitment=t.commitment,this._confirmTransactionInitialTimeout=t.confirmTransactionInitialTimeout,n=t.wsEndpoint,r=t.httpHeaders,i=t.fetch,s=t.fetchMiddleware,o=t.disableRetryOnRateLimit,a=t.httpAgent),this._rpcEndpoint=function(e){if(!1===/^https?:/.test(e))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return e}(e),this._rpcWsEndpoint=n||function(e){const t=e.match(it);if(null==t)throw TypeError("Failed to validate endpoint URL `".concat(e,"`"));const[n,r,i,s]=t,o=e.startsWith("https:")?"wss:":"ws:",a=null==i?null:parseInt(i.slice(1),10),c=null==a?"":":".concat(a+1);return"".concat(o,"//").concat(r).concat(c).concat(s)}(e),this._rpcClient=function(e,t,n,r,i,s){const o=n||et;let a;return null!=s&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),r&&(a=async(e,t)=>{const n=await new Promise((n,i)=>{try{r(e,t,(e,t)=>n([e,t]))}catch(s){i(s)}});return await o(...n)}),new(Y())(async(n,r)=>{const s={method:"POST",body:n,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},t||{},Zn)};try{let t,n=5,c=500;for(;t=a?await a(e,s):await o(e,s),429===t.status&&!0!==i&&(n-=1,0!==n);)console.error("Server responded with ".concat(t.status," ").concat(t.statusText,". Retrying after ").concat(c,"ms delay...")),await Le(c),c*=2;const u=await t.text();t.ok?r(null,u):r(new Error("".concat(t.status," ").concat(t.statusText,": ").concat(u)))}catch(c){c instanceof Error&&r(c)}},{})}(e,r,i,s,o,a),this._rpcRequest=(c=this._rpcClient,(e,t)=>new Promise((n,r)=>{c.request(e,t,(e,t)=>{e?r(e):n(t)})})),this._rpcBatchRequest=function(e){return t=>new Promise((n,r)=>{0===t.length&&n([]);const i=t.map(t=>e.request(t.methodName,t.args));e.request(i,(e,t)=>{e?r(e):n(t)})})}(this._rpcClient),this._rpcWebSocket=new tt(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(e,t){const{commitment:n,config:r}=ct(t),i=this._buildArgs([e.toBase58()],n,void 0,r),s=await this._rpcRequest("getBalance",i),o=(0,q.vt)(s,gt((0,q.ai)()));if("error"in o)throw new ze(o.error,"failed to get balance for ".concat(e.toBase58()
1));return o.result}async getBalance(e,t){return await this.getBalanceAndContext(e,t).then(e=>e.value).catch(t=>{throw new Error("failed to get balance of account "+e.toBase58()+": "+t)})}async getBlockTime(e){const t=await this._rpcRequest("getBlockTime",[e]),n=(0,q.vt)(t,ht((0,q.me)((0,q.ai)())));if("error"in n)throw new ze(n.error,"failed to get block time for slot ".concat(e));return n.result}async getMinimumLedgerSlot(){const e=await this._rpcRequest("minimumLedgerSlot",[]),t=(0,q.vt)(e,ht((0,q.ai)()));if("error"in t)throw new ze(t.error,"failed to get minimum ledger slot");return t.result}async getFirstAvailableBlock(){const e=await this._rpcRequest("getFirstAvailableBlock",[]),t=(0,q.vt)(e,Lt);if("error"in t)throw new ze(t.error,"failed to get first available block");return t.result}async getSupply(e){let t={};t="string"===typeof e?{commitment:e}:e?(0,i.A)((0,i.A)({},e),{},{commitment:e&&e.commitment||this.commitment}):{commitment:this.commitment};const n=await this._rpcRequest("getSupply",[t]),r=(0,q.vt)(n,qt);if("error"in r)throw new ze(r.error,"failed to get supply");return r.result}async getTokenSupply(e,t){const n=this._buildArgs([e.toBase58()],t),r=await this._rpcRequest("getTokenSupply",n),i=(0,q.vt)(r,gt(Rt));if("error"in i)throw new ze(i.error,"failed to get token supply");return i.result}async getTokenAccountBalance(e,t){const n=this._buildArgs([e.toBase58()],t),r=await this._rpcRequest("getTokenAccountBalance",n),i=(0,q.vt)(r,gt(Rt));if("error"in i)throw new ze(i.error,"failed to get token account balance");return i.result}async getTokenAccountsByOwner(e,t,n){const{commitment:r,config:i}=ct(n);let s=[e.toBase58()];"mint"in t?s.push({mint:t.mint.toBase58()}):s.push({programId:t.programId.toBase58()});const o=this._buildArgs(s,r,"base64",i),a=await this._rpcRequest("getTokenAccountsByOwner",o),c=(0,q.vt)(a,jt);if("error"in c)throw new ze(c.error,"failed to get token accounts owned by account ".concat(e.toBase58()));return c.result}async getParsedTokenAccountsByOwner(e,t,n){let r=[e.toBase58()];"mint"in t?r.push({mint:t.mint.toBase58()}):r.push({programId:t.programId.toBase58()});const i=this._buildArgs(r,n,"jsonParsed"),s=await this._rpcRequest("getTokenAccountsByOwner",i),o=(0,q.vt)(s,Ht);if("error"in o)throw new ze(o.error,"failed to get token accounts owned by account ".concat(e.toBase58()));return o.result}async getLargestAccounts(e){const t=(0,i.A)((0,i.A)({},e),{},{commitment:e&&e.commitment||this.commitment}),n=t.filter||t.commitment?[t]:[],r=await this._rpcRequest("getLargestAccounts",n),s=(0,q.vt)(r,Mt);if("error"in s)throw new ze(s.error,"failed to get largest accounts");return s.result}async getTokenLargestAccounts(e,t){const n=this._buildArgs([e.toBase58()],t),r=await this._rpcRequest("getTokenLargestAccounts",n),i=(0,q.vt)(r,Yt);if("error"in i)throw new ze(i.error,"failed to get token largest accounts");return i.result}async getAccountInfoAndContext(e,t){const{commitment:n,config:r}=ct(t),i=this._buildArgs([e.toBase58()],n,"base64",r),s=await this._rpcRequest("getAccountInfo",i),o=(0,q.vt)(s,gt((0,q.me)(Ut)));if("error"in o)throw new ze(o.error,"failed to get info about account ".concat(e.toBase58()));return o.result}async getParsedAccountInfo(e,t){const{commitment:n,config:r}=ct(t),i=this._buildArgs([e.toBase58()],n,"jsonParsed",r),s=await this._rpcRequest("getAccountInfo",i),o=(0,q.vt)(s,gt((0,q.me)(Jt)));if("error"in o)throw new ze(o.error,"failed to get info about account ".concat(e.toBase58()));return o.result}async getAccountInfo(e,t){try{return(await this.getAccountInfoAndContext(e,t)).value}catch(n){throw new Error("failed to get info about account "+e.toBase58()+": "+n)}}async getMultipleParsedAccounts(e,t){const{commitment:n,config:r}=ct(t),i=e.map(e=>e.toBase58()),s=this._buildArgs([i],n,"jsonParsed",r),o=await this._rpcRequest("getMultipleAccounts",s),a=(0,q.vt)(o,gt((0,q.YO)((0,q.me)(Jt))));if("error"in a)throw new ze(a.error,"failed to get info for accounts ".concat(i));return a.result}async getMultipleAccountsInfoAndContext(e,t){const{commitment:n,config:r}=ct(t),i=e.map(e=>
1e.toBase58()),s=this._buildArgs([i],n,"base64",r),o=await this._rpcRequest("getMultipleAccounts",s),a=(0,q.vt)(o,gt((0,q.YO)((0,q.me)(Ut))));if("error"in a)throw new ze(a.error,"failed to get info for accounts ".concat(i));return a.result}async getMultipleAccountsInfo(e,t){return(await this.getMultipleAccountsInfoAndContext(e,t)).value}async getStakeActivation(e,t,n){const{commitment:r,config:s}=ct(t),o=this._buildArgs([e.toBase58()],r,void 0,(0,i.A)((0,i.A)({},s),{},{epoch:null!=n?n:null===s||void 0===s?void 0:s.epoch})),a=await this._rpcRequest("getStakeActivation",o),c=(0,q.vt)(a,ht(Xt));if("error"in c)throw new ze(c.error,"failed to get Stake Activation ".concat(e.toBase58()));return c.result}async getProgramAccounts(e,t){const{commitment:n,config:s}=ct(t),o=s||{},{encoding:a}=o,c=(0,r.A)(o,U),u=this._buildArgs([e.toBase58()],n,a||"base64",(0,i.A)((0,i.A)({},c),c.filters?{filters:ut(c.filters)}:null)),l=await this._rpcRequest("getProgramAccounts",u),d=(0,q.YO)(Ft),h=!0===c.withContext?(0,q.vt)(l,gt(d)):(0,q.vt)(l,ht(d));if("error"in h)throw new ze(h.error,"failed to get accounts owned by program ".concat(e.toBase58()));return h.result}async getParsedProgramAccounts(e,t){const{commitment:n,config:r}=ct(t),i=this._buildArgs([e.toBase58()],n,"jsonParsed",r),s=await this._rpcRequest("getProgramAccounts",i),o=(0,q.vt)(s,ht((0,q.YO)(Gt)));if("error"in o)throw new ze(o.error,"failed to get accounts owned by program ".concat(e.toBase58()));return o.result}async confirmTransaction(e,t){let n,r;if("string"==typeof e)n=e;else{var i;const t=e;if(null!==(i=t.abortSignal)&&void 0!==i&&i.aborted)return Promise.reject(t.abortSignal.reason);n=t.signature}try{r=l().decode(n)}catch(s){throw new Error("signature must be base58 encoded: "+n)}return be(64===r.length,"signature has invalid length"),"string"===typeof e?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:t||this.commitment,signature:n}):"lastValidBlockHeight"in e?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t||this.commitment,strategy:e}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:t||this.commitment,strategy:e})}getCancellationPromise(e){return new Promise((t,n)=>{null!=e&&(e.aborted?n(e.reason):e.addEventListener("abort",()=>{n(e.reason)}))})}getTransactionConfirmationPromise(e){let t,n,{commitment:r,signature:i}=e,s=!1;return{abortConfirmation:()=>{n&&(n(),n=void 0),null!=t&&(this.removeSignatureListener(t),t=void 0)},confirmationPromise:new Promise((e,o)=>{try{t=this.onSignature(i,(n,r)=>{t=void 0;const i={context:r,value:n};e({__type:_e.PROCESSED,response:i})},r);const a=new Promise(e=>{null==t?e():n=this._onSubscriptionStateChange(t,t=>{"subscribed"===t&&e()})});(async()=>{if(await a,s)return;
1const t=await this.getSignatureStatus(i);if(s)return;if(null==t)return;const{context:n,value:c}=t;if(null!=c)if(null!==c&&void 0!==c&&c.err)o(c.err);else{switch(r){case"confirmed":case"single":case"singleGossip":if("processed"===c.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===c.confirmationStatus||"confirmed"===c.confirmationStatus)return}s=!0,e({__type:_e.PROCESSED,response:{context:n,value:c}})}})()}catch(a){o(a)}})}}async confirmTransactionUsingBlockHeightExceedanceStrategy(e){let{commitment:t,strategy:{abortSignal:n,lastValidBlockHeight:r,signature:i}}=e,s=!1;const o=new Promise(e=>{const n=async()=>{try{return await this.getBlockHeight(t)}catch(e){return-1}};(async()=>{let t=await n();if(!s){for(;t<=r;){if(await Le(1e3),s)return;if(t=await n(),s)return}e({__type:_e.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:a,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:t,signature:i}),u=this.getCancellationPromise(n);let l;try{const e=await Promise.race([u,c,o]);if(e.__type!==_e.PROCESSED)throw new ae(i);l=e.response}finally{s=!0,a()}return l}async confirmTransactionUsingDurableNonceStrategy(e){let{commitment:t,strategy:{abortSignal:n,minContextSlot:r,nonceAccountPubkey:i,nonceValue:s,signature:o}}=e,a=!1;const c=new Promise(e=>{let n=s,o=null;const c=async()=>{try{const{context:e,value:n}=await this.getNonceAndContext(i,{commitment:t,minContextSlot:r});return o=e.slot,null===n||void 0===n?void 0:n.nonce}catch(e){return n}};(async()=>{if(n=await c(),!a)for(;;){if(s!==n)return void e({__type:_e.NONCE_INVALID,slotInWhichNonceDidAdvance:o});if(await Le(2e3),a)return;if(n=await c(),a)return}})()}),{abortConfirmation:u,confirmationPromise:l}=this.getTransactionConfirmationPromise({commitment:t,signature:o}),d=this.getCancellationPromise(n);let h;try{const e=await Promise.race([d,l,c]);if(e.__type===_e.PROCESSED)h=e.response;else{var g;let n;for(;;){var m;
1const t=await this.getSignatureStatus(o);if(null==t)break;if(!(t.context.slot<(null!==(m=e.slotInWhichNonceDidAdvance)&&void 0!==m?m:r))){n=t;break}await Le(400)}if(null===(g=n)||void 0===g||!g.value)throw new ue(o);{const e=t||"finalized",{confirmationStatus:r}=n.value;switch(e){case"processed":case"recent":if("processed"!==r&&"confirmed"!==r&&"finalized"!==r)throw new ue(o);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==r&&"finalized"!==r)throw new ue(o);break;case"finalized":case"max":case"root":if("finalized"!==r)throw new ue(o)}h={context:n.context,value:{err:n.value.err}}}}}finally{a=!0,u()}return h}async confirmTransactionUsingLegacyTimeoutStrategy(e){let t,{commitment:n,signature:r}=e;const i=new Promise(e=>{let r=this._confirmTransactionInitialTimeout||6e4;switch(n){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":r=this._confirmTransactionInitialTimeout||3e4}t=setTimeout(()=>e({__type:_e.TIMED_OUT,timeoutMs:r}),r)}),{abortConfirmation:s,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:n,signature:r});let a;try{const e=await Promise.race([o,i]);if(e.__type!==_e.PROCESSED)throw new ce(r,e.timeoutMs/1e3);a=e.response}finally{clearTimeout(t),s()}return a}async getClusterNodes(){const e=await this._rpcRequest("getClusterNodes",[]),t=(0,q.vt)(e,ht((0,q.YO)(un)));if("error"in t)throw new ze(t.error,"failed to get cluster nodes");return t.result}async getVoteAccounts(e){const t=this._buildArgs([],e),n=await this._rpcRequest("getVoteAccounts",t),r=(0,q.vt)(n,dn);if("error"in r)throw new ze(r.error,"failed to get vote accounts");return r.result}async getSlot(e){const{commitment:t,config:n}=ct(e),r=this._buildArgs([],t,void 0,n),i=await this._rpcRequest("getSlot",r),s=(0,q.vt)(i,ht((0,q.ai)()));if("error"in s)throw new ze(s.error,"failed to get slot");return s.result}async getSlotLeader(e){const{commitment:t,config:n}=ct(e),r=this._buildArgs([],t,void 0,n),i=await this._rpcRequest("getSlotLeader",r),s=(0,q.vt)(i,ht((0,q.Yj)()));if("error"in s)throw new ze(s.error,"failed to get slot leader");return s.result}async getSlotLeaders(e,t){const n=[e,t],r=await this._rpcRequest("getSlotLeaders",n),i=(0,q.vt)(r,ht((0,q.YO)(st)));if("error"in i)throw new ze(i.error,"failed to get slot leaders");return i.result}async getSignatureStatus(e,t){const{context:n,value:r}
1=await this.getSignatureStatuses([e],t);be(1===r.length);return{context:n,value:r[0]}}async getSignatureStatuses(e,t){const n=[e];t&&n.push(t);const r=await this._rpcRequest("getSignatureStatuses",n),i=(0,q.vt)(r,mn);if("error"in i)throw new ze(i.error,"failed to get signature status");return i.result}async getTransactionCount(e){const{commitment:t,config:n}=ct(e),r=this._buildArgs([],t,void 0,n),i=await this._rpcRequest("getTransactionCount",r),s=(0,q.vt)(i,ht((0,q.ai)()));if("error"in s)throw new ze(s.error,"failed to get transaction count");return s.result}async getTotalSupply(e){return(await this.getSupply({commitment:e,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(e){const t=this._buildArgs([],e),n=await this._rpcRequest("getInflationGovernor",t),r=(0,q.vt)(n,Nt);if("error"in r)throw new ze(r.error,"failed to get inflation");return r.result}async getInflationReward(e,t,n){const{commitment:r,config:s}=ct(n),o=this._buildArgs([e.map(e=>e.toBase58())],r,void 0,(0,i.A)((0,i.A)({},s),{},{epoch:null!=t?t:null===s||void 0===s?void 0:s.epoch})),a=await this._rpcRequest("getInflationReward",o),c=(0,q.vt)(a,bt);if("error"in c)throw new ze(c.error,"failed to get inflation reward");return c.result}async getInflationRate(){const e=await this._rpcRequest("getInflationRate",[]),t=(0,q.vt)(e,Ct);if("error"in t)throw new ze(t.error,"failed to get inflation rate");return t.result}async getEpochInfo(e){const{commitment:t,config:n}=ct(e),r=this._buildArgs([],t,void 0,n),i=await this._rpcRequest("getEpochInfo",r),s=(0,q.vt)(i,Ot);if("error"in s)throw new ze(s.error,"failed to get epoch info");return s.result}async getEpochSchedule(){const e=await this._rpcRequest("getEpochSchedule",[]),t=(0,q.vt)(e,zt);if("error"in t)throw new ze(t.error,"failed to get epoch schedule");const n=t.result;return new $e(n.slotsPerEpoch,n.leaderScheduleSlotOffset,n.warmup,n.firstNormalEpoch,n.firstNormalSlot)}async getLeaderSchedule(){const e=await this._rpcRequest("getLeaderSchedule",[]),t=(0,q.vt)(e,Kt);if("error"in t)throw new ze(t.error,"failed to get leader schedule");return t.result}async getMinimumBalanceForRentExemption(e,t){const n=this._buildArgs([e],t),r=await this._rpcRequest("getMinimumBalanceForRentExemption",n),i=(0,q.vt)(r,pn);return"error"in i?(console.warn("Unable to fetch minimum balance for rent exemption"),0):i.result}async getRecentBlockhashAndContext(e){const{context:t,value:{blockhash:n}}=await this.getLatestBlockhashAndContext(e);return{context:t,value:{blockhash:n,feeCalculator:{get lamportsPerSignature(){throw new Error("The capability to fetch `lamportsPerSignature` using the `getRecentBlockhash` API is no longer offered by the network. Use the `getFeeForMessage` API to obtain the fee for a given message.")},toJSON:()=>({})}}}}async getRecentPerformanceSamples(e){const t=await this._rpcRequest("getRecentPerformanceSamples",e?[e]:[]),n=(0,q.vt)(t,Un);if("error"in n)throw new ze(n.error,"failed to get recent performance samples");return n.result}async getFeeCalculatorForBlockhash(e,t){const n=this._buildArgs([e],t),r=await this._rpcRequest("getFeeCalculatorForBlockhash",n),i=(0,q.vt)(r,Fn);if("error"in i)throw new ze(i.error,"failed to get fee calculator");const{context:s,value:o}=i.result;return{context:s,value:null!==o?o.feeCalculator:null}}async getFeeForMessage(e,t){const n=$(e.serialize()).toString("base64"),r=this._buildArgs([n],t),i=await this._rpcRequest("getFeeForMessage",r),s=(0,q.vt)(i,gt((0,q.me)((0,q.ai)())));if("error"in s)throw new ze(s.error,"failed to get fee for message");if(null===s.result)throw new Error("invalid blockhash");return s.result}async getRecentPrioritizationFees(e){var t;const n=null===e||void 0===e||null===(t=e.lockedWritableAccounts)||void 0===t?void 0:t.map(e=>e.toBase58()),r=null!==n&&void 0!==n&&n.length?[n]:[],i=await this._rpcRequest("getRecentPrioritizationFees",r),s=(0,q.vt)(i,Tt);if("error"in s)throw new ze(s.error,"failed to get recent prioritization fees");return s.result}async getRecentBlockhash(e){try{return(await this.getRecentBlockhashAndContext(e)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(e){try{return(await this.getLatestBlockhashAndContext(e)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(e){const{commitment:t,config:n}=ct(e),r=this._buildArgs([],t,void 0,n),i=await this._rpcRequest("getLatestBlockhash",r),s=(0,q.vt)(i,Dn);if("error"in s)throw new ze(s.error,"failed to get latest blockhash");return s.result}async isBlockhashValid(e,t){const{commitment:n,config:r}=ct(t),i=this._buildArgs([e],n,void 0,r),s=await this._rpcRequest("isBlockhashValid",i),o=(0,q.vt)(s,Hn);if("error"in o)throw new ze(o.error,"failed to determine if the blockhash `"+e+"`is valid");return o.result}async getVersion(){const e=await this._rpcRequest("getVersion",[]),t=(0,q.vt)(e,ht(Bt));if("error"in t)throw new ze(t.error,"failed to get version");return t.result}async getGenesisHash(){const e=await this._rpcRequest("getGenesisHash",[]),t=(0,q.vt)(e,ht((0,q.Yj)()));if("error"in t)throw new ze(t.error,"failed to get genesis hash");return t.result}async getBlock(e,t){const{commitment:n,config:r}=ct(t),s=this._buildArgsAtLeastConfirmed([e],n,void 0,r),o=await this._rpcRequest("getBlock",s);
1try{switch(null===r||void 0===r?void 0:r.transactionDetails){case"accounts":{const e=(0,q.vt)(o,On);if("error"in e)throw e.error;return e.result}case"none":{const e=(0,q.vt)(o,Tn);if("error"in e)throw e.error;return e.result}default:{const e=(0,q.vt)(o,Cn);if("error"in e)throw e.error;const{result:t}=e;return t?(0,i.A)((0,i.A)({},t),{},{transactions:t.transactions.map(e=>{let{transaction:t,meta:n,version:r}=e;return{meta:n,transaction:(0,i.A)((0,i.A)({},t),{},{message:pt(r,t.message)}),version:r}})}):null}}}catch(a){throw new ze(a,"failed to get confirmed block")}}async getParsedBlock(e,t){const{commitment:n,config:r}=ct(t),i=this._buildArgsAtLeastConfirmed([e],n,"jsonParsed",r),s=await this._rpcRequest("getBlock",i);try{switch(null===r||void 0===r?void 0:r.transactionDetails){case"accounts":{const e=(0,q.vt)(s,Kn);if("error"in e)throw e.error;return e.result}case"none":{const e=(0,q.vt)(s,Ln);if("error"in e)throw e.error;return e.result}default:{const e=(0,q.vt)(s,zn);if("error"in e)throw e.error;return e.result}}}catch(o){throw new ze(o,"failed to get block")}}async getBlockProduction(e){let t,n;if("string"===typeof e)n=e;else if(e){const{commitment:i}=e;n=i,t=(0,r.A)(e,F)}const i=this._buildArgs([],n,"base64",t),s=await this._rpcRequest("getBlockProduction",i),o=(0,q.vt)(s,Et);if("error"in o)throw new ze(o.error,"failed to get block production information");return o.result}async getTransaction(e,t){const{commitment:n,config:r}=ct(t),s=this._buildArgsAtLeastConfirmed([e],n,void 0,r),o=await this._rpcRequest("getTransaction",s),a=(0,q.vt)(o,Yn);if("error"in a)throw new ze(a.error,"failed to get transaction");const c=a.result;return c?(0,i.A)((0,i.A)({},c),{},{transaction:(0,i.A)((0,i.A)({},c.transaction),{},{message:pt(c.version,c.transaction.message)})}):c}async getParsedTransaction(e,t){const{commitment:n,config:r}=ct(t),i=this._buildArgsAtLeastConfirmed([e],n,"jsonParsed",r),s=await this._rpcRequest("getTransaction",i),o=(0,q.vt)(s,jn);if("error"in o)throw new ze(o.error,"failed to get transaction");return o.result}async getParsedTransactions(e,t){const{commitment:n,config:r}=ct(t),i=e.map(e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],n,"jsonParsed",r)}));return(await this._rpcBatchRequest(i)).map(e=>{const t=(0,q.vt)(e,jn);if("error"in t)throw new ze(t.error,"failed to get transactions");return t.result})}async getTransactions(e,t){const{commitment:n,config:r}=ct(t),s=e.map(e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],n,void 0,r)}));return(await this._rpcBatchRequest(s)).map(e=>{const t=(0,q.vt)(e,Yn);if("error"in t)throw new ze(t.error,"failed to get transactions");const n=t.result;return n?(0,i.A)((0,i.A)({},n),{},{transaction:(0,i.A)((0,i.A)({},n.transaction),{},{message:pt(n.version,n.transaction.message)})}):n})}async getConfirmedBlock(e,t){const n=this._buildArgsAtLeastConfirmed([e],t),r=await this._rpcRequest("getBlock",n),s=(0,q.vt)(r,qn);if("error"in s)throw new ze(s.error,"failed to get confirmed block");const o=s.result;if(!o)throw new Error("Confirmed block "+e+" not found");const a=(0,i.A)((0,i.A)({},o),{},{transactions:o.transactions.map(e=>{let{transaction:t,meta:n}=e;const r=new ve(t.message);return{meta:n,transaction:(0,i.A)((0,i.A)({},t),{},{message:r})}})});return(0,i.A)((0,i.A)({},a),{},{transactions:a.transactions.map(e=>{let{transaction:t,meta:n}=e;return{meta:n,transaction:xe.populate(t.message,t.signatures)}})})}async getBlocks(e,t,n){const r=this._buildArgsAtLeastConfirmed(void 0!==t?[e,t]:[e],n),i=await this._rpcRequest("getBlocks",r),s=(0,q.vt)(i,ht((0,q.YO)((0,q.ai)())));if("error"in s)throw new ze(s.error,"failed to get blocks");return s.result}async getBlockSignatures(e,t){const n=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),r=await this._rpcRequest("getBlock",n),i=(0,q.vt)(r,Rn);if("error"in i)throw new ze(i.error,"failed to get block");const s=i.result;if(!s)throw new Error("Block "+e+" not found");return s}async getConfirmedBlockSignatures(e,t){const n=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetail
1s:"signatures",rewards:!1}),r=await this._rpcRequest("getBlock",n),i=(0,q.vt)(r,Rn);if("error"in i)throw new ze(i.error,"failed to get confirmed block");const s=i.result;if(!s)throw new Error("Confirmed block "+e+" not found");return s}async getConfirmedTransaction(e,t){const n=this._buildArgsAtLeastConfirmed([e],t),r=await this._rpcRequest("getTransaction",n),s=(0,q.vt)(r,Yn);if("error"in s)throw new ze(s.error,"failed to get transaction");const o=s.result;if(!o)return o;const a=new ve(o.transaction.message),c=o.transaction.signatures;return(0,i.A)((0,i.A)({},o),{},{transaction:xe.populate(a,c)})}async getParsedConfirmedTransaction(e,t){const n=this._buildArgsAtLeastConfirmed([e],t,"jsonParsed"),r=await this._rpcRequest("getTransaction",n),i=(0,q.vt)(r,jn);if("error"in i)throw new ze(i.error,"failed to get confirmed transaction");return i.result}async getParsedConfirmedTransactions(e,t){const n=e.map(e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],t,"jsonParsed")}));return(await this._rpcBatchRequest(n)).map(e=>{const t=(0,q.vt)(e,jn);if("error"in t)throw new ze(t.error,"failed to get confirmed transactions");return t.result})}async getConfirmedSignaturesForAddress(e,t,n){let r={},i=await this.getFirstAvailableBlock();for(;!("until"in r)&&!(--t<=0||t<i);)try{const e=await this.getConfirmedBlockSignatures(t,"finalized");e.signatures.length>0&&(r.until=e.signatures[e.signatures.length-1].toString())}catch(o){if(o instanceof Error&&o.message.includes("skipped"))continue;throw o}
1let s=await this.getSlot("finalized");for(;!("before"in r)&&!(++n>s);)try{const e=await this.getConfirmedBlockSignatures(n);e.signatures.length>0&&(r.before=e.signatures[e.signatures.length-1].toString())}catch(o){if(o instanceof Error&&o.message.includes("skipped"))continue;throw o}return(await this.getConfirmedSignaturesForAddress2(e,r)).map(e=>e.signature)}async getConfirmedSignaturesForAddress2(e,t,n){const r=this._buildArgsAtLeastConfirmed([e.toBase58()],n,void 0,t),i=await this._rpcRequest("getConfirmedSignaturesForAddress2",r),s=(0,q.vt)(i,Zt);if("error"in s)throw new ze(s.error,"failed to get confirmed signatures for address");return s.result}async getSignaturesForAddress(e,t,n){const r=this._buildArgsAtLeastConfirmed([e.toBase58()],n,void 0,t),i=await this._rpcRequest("getSignaturesForAddress",r),s=(0,q.vt)(i,Qt);if("error"in s)throw new ze(s.error,"failed to get signatures for address");return s.result}async getAddressLookupTable(e,t){const{context:n,value:r}=await this.getAccountInfoAndContext(e,t);let i=null;return null!==r&&(i=new nt({key:e,state:nt.deserialize(r.data)})),{context:n,value:i}}async getNonceAndContext(e,t){const{context:n,value:r}=await this.getAccountInfoAndContext(e,t);let i=null;return null!==r&&(i=De.fromAccountData(r.data)),{context:n,value:i}}async getNonce(e,t){return await this.getNonceAndContext(e,t).then(e=>e.value).catch(t=>{throw new Error("failed to get nonce for account "+e.toBase58()+": "+t)})}async requestAirdrop(e,t){const n=await this._rpcRequest("requestAirdrop",[e.toBase58(),t]),r=(0,q.vt)(n,Vn);if("error"in r)throw new ze(r.error,"airdrop to ".concat(e.toBase58()," failed"));return r.result}async _blockhashWithExpiryBlockHeight(e){if(!e){for(;this._pollingBlockhash;)await Le(100);const e=Date.now()-this._blockhashInfo.lastFetch>=3e4;if(null!==this._blockhashInfo.latestBlockhash&&!e)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const e=Date.now(),t=this._blockhashInfo.latestBlockhash,n=t?t.blockhash:null;for(let r=0;r<50;r++){const e=await this.getLatestBlockhash("finalized");if(n!==e.blockhash)return this._blockhashInfo={latestBlockhash:e,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},e;await Le(200)}throw new Error("Unable to obtain a new blockhash after ".concat(Date.now()-e,"ms"))}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(e){const{commitment:t,config:n}=ct(e),r=this._buildArgs([],t,"base64",n),i=await this._rpcRequest("getStakeMinimumDelegation",r),s=(0,q.vt)(i,gt((0,q.ai)()));if("error"in s)throw new ze(s.error,"failed to get stake minimum delegation");return s.result}async simulateTransaction(e,t,n){if("message"in e){const r=e.serialize(),i=s.Buffer.from(r).toString("base64");if(Array.isArray(t)||void 0!==n)throw new Error("Invalid arguments");const o=t||{};o.encoding="base64","commitment"in o||(o.commitment=this.commitment),t&&"object"===typeof t&&"innerInstructions"in t&&(o.innerInstructions=t.innerInstructions);const a=[i,o],c=await this._rpcRequest("simulateTransaction",a),u=(0,q.vt)(c,Pt);if("error"in u)throw new Error("failed to simulate transaction: "+u.error.message);return u.result}let r;if(e instanceof xe){let t=e;r=new xe,r.feePayer=t.feePayer,r.instructions=e.instructions,r.nonceInfo=t.nonceInfo,r.signatures=t.signatures}else r=xe.populate(e),r._message=r._json=void 0;if(void 0!==t&&!Array.isArray(t))throw new Error("Invalid arguments");const i=t;if(r.nonceInfo&&i)r.sign(...i);else{let e=this._disableBlockhashCaching;for(;;){const t=await this._blockhashWithExpiryBlockHeight(e);if(r.lastValidBlockHeight=t.lastValidBlockHeight,r.recentBlockhash=t.blockhash,!i)break;if(r.sign(...i),!r.signature)throw new Error("!signature");const n=r.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(n)&&!this._blockhashInfo.transactionSignatures.includes(n)){this._blockhashInfo.simulatedSignatures.push(n);break}e=!0}}const o=r._compile(),a=o.serialize(),c=r._serialize(a).toString("base64"),u={encoding:"base64",commitment:this.commitment};if(n){const e=(Array.isArray(n)?n:o.nonProgramIds()).map(e=>
1e.toBase58());u.accounts={encoding:"base64",addresses:e}}i&&(u.sigVerify=!0),t&&"object"===typeof t&&"innerInstructions"in t&&(u.innerInstructions=t.innerInstructions);const l=[c,u],d=await this._rpcRequest("simulateTransaction",l),h=(0,q.vt)(d,Pt);if("error"in h){let e;if("data"in h.error&&(e=h.error.data.logs,e&&Array.isArray(e))){const t="\n ",n=t+e.join(t);console.error(h.error.message,n)}throw new Oe({action:"simulate",signature:"",transactionMessage:h.error.message,logs:e})}return h.result}async sendTransaction(e,t,n){if("version"in e){if(t&&Array.isArray(t))throw new Error("Invalid arguments");const n=e.serialize();return await this.sendRawTransaction(n,t)}if(void 0===t||!Array.isArray(t))throw new Error("Invalid arguments");const r=t;if(e.nonceInfo)e.sign(...r);else{let t=this._disableBlockhashCaching;for(;;){const n=await this._blockhashWithExpiryBlockHeight(t);if(e.lastValidBlockHeight=n.lastValidBlockHeight,e.recentBlockhash=n.blockhash,e.sign(...r),!e.signature)throw new Error("!signature");const i=e.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.transactionSignatures.push(i);break}t=!0}}const i=e.serialize();return await this.sendRawTransaction(i,n)}async sendRawTransaction(e,t){const n=$(e).toString("base64");return await this.sendEncodedTransaction(n,t)}async sendEncodedTransaction(e,t){const n={encoding:"base64"},r=t&&t.skipPreflight,i=!0===r?"processed":t&&t.preflightCommitment||this.commitment;t&&null!=t.maxRetries&&(n.maxRetries=t.maxRetries),t&&null!=t.minContextSlot&&(n.minContextSlot=t.minContextSlot),r&&(n.skipPreflight=r),i&&(n.preflightCommitment=i);const s=[e,n],o=await this._rpcRequest("sendTransaction",s),a=(0,q.vt)(o,Jn);if("error"in a){let e;throw"data"in a.error&&(e=a.error.data.logs),new Oe({action:r?"send":"simulate",signature:"",transactionMessage:a.error.message,logs:e})}return a.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch(e){}})()},5e3),this._updateSubscriptions()}_wsOnError(e){this._rpcWebSocketConnected=!1,console.error("ws error:",e.message)}_wsOnClose(e){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==e?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(e=>{let[t,n]=e;this._setSubscription(t,(0,i.A)((0,i.A)({},n),{},{state:"pending"}))})):this._updateSubscriptions()}_setSubscription(e,t){var n;const r=null===(n=this._subscriptionsByHash[e])||void 0===n?void 0:n.state;if(this._subscriptionsByHash[e]=t,r!==t.state){const n=this._subscriptionStateChangeCallbacksByHash[e];n&&n.forEach(e=>{try{e(t.state)}catch(n){}})}}_onSubscriptionStateChange(e,t){var n;const r=this._subscriptionHashByClientSubscriptionId[e];if(null==r)return()=>{};const i=(n=this._subscriptionStateChangeCallbacksByHash)[r]||(n[r]=new Set);return i.add(t),()=>{i.delete(t),0===i.size&&delete this._subscriptionStateChangeCallbacksByHash[r]}}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(e){e instanceof Error&&console.log("Error when closing socket connection: ".concat(e.message))}},500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const e=this._rpcWebSocketGeneration,t=()=>e===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async e=>{const n=this._subscriptionsByHash[e];
1if(void 0!==n)switch(n.state){case"pending":case"unsubscribed":if(0===n.callbacks.size)return delete this._subscriptionsByHash[e],"unsubscribed"===n.state&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:r,method:s}=n;try{this._setSubscription(e,(0,i.A)((0,i.A)({},n),{},{state:"subscribing"}));const t=await this._rpcWebSocket.call(s,r);this._setSubscription(e,(0,i.A)((0,i.A)({},n),{},{serverSubscriptionId:t,state:"subscribed"})),this._subscriptionCallbacksByServerSubscriptionId[t]=n.callbacks,await this._updateSubscriptions()}catch(o){if(console.error("Received ".concat(o instanceof Error?"":"JSON-RPC ","error calling `").concat(s,"`"),{args:r,error:o}),!t())return;this._setSubscription(e,(0,i.A)((0,i.A)({},n),{},{state:"pending"})),await this._updateSubscriptions()}})();break;case"subscribed":0===n.callbacks.size&&await(async()=>{const{serverSubscriptionId:r,unsubscribeMethod:s}=n;if(this._subscriptionsAutoDisposedByRpc.has(r))this._subscriptionsAutoDisposedByRpc.delete(r);else{this._setSubscription(e,(0,i.A)((0,i.A)({},n),{},{state:"unsubscribing"})),this._setSubscription(e,(0,i.A)((0,i.A)({},n),{},{state:"unsubscribing"}));try{await this._rpcWebSocket.call(s,[r])}catch(o){if(o instanceof Error&&console.error("".concat(s," error:"),o.message),!t())return;return this._setSubscription(e,(0,i.A)((0,i.A)({},n),{},{state:"subscribed"})),void await this._updateSubscriptions()}}this._setSubscription(e,(0,i.A)((0,i.A)({},n),{},{state:"unsubscribed"})),await this._updateSubscriptions()})()}}))}_handleServerNotification(e,t){const n=this._subscriptionCallbacksByServerSubscriptionId[e];void 0!==n&&n.forEach(e=>{try{e(...t)}catch(n){console.error(n)}})}_wsOnAccountNotification(e){const{result:t,subscription:n}=(0,q.vt)(e,$t);this._handleServerNotification(n,[t.value,t.context])}_makeSubscription(e,t){const n=this._nextClientSubscriptionId++,r=Ze([e.method,t]),s=this._subscriptionsByHash[r];return void 0===s?this._subscriptionsByHash[r]=(0,i.A)((0,i.A)({},e),{},{args:t,callbacks:new Set([e.callback]),state:"pending"}):s.callbacks.add(e.callback),this._subscriptionHashByClientSubscriptionId[n]=r,this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n],delete this._subscriptionHashByClientSubscriptionId[n];const t=this._subscriptionsByHash[r];be(void 0!==t,"Could not find a `Subscription` when tearing down client subscription #".concat(n)),t.callbacks.delete(e.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(e,t,n){const{commitment:r,config:i}=ct(n),s=this._buildArgs([e.toBase58()],r||this._commitment||"finalized","base64",i);return this._makeSubscription({callback:t,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},s)}async removeAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"account change")}_wsOnProgramAccountNotification(e){const{result:t,subscription:n}=(0,q.vt)(e,tn);this._handleServerNotification(n,[{accountId:t.value.pubkey,accountInfo:t.value.account},t.context])}onProgramAccountChange(e,t,n,r){const{commitment:i,config:s}=ct(n),o=this._buildArgs([e.toBase58()],i||this._commitment||"finalized","base64",s||(r?{filters:ut(r)}:void 0));return this._makeSubscription({callback:t,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},o)}async removeProgramAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"program account change")}onLogs(e,t,n){const r=this._buildArgs(["object"===typeof e?{mentions:[e.toString()]}:e],n||this._commitment||"finalized");return this._makeSubscription({callback:t,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}async removeOnLogsListener(e){await this._unsubscribeClientSubscription(e,"logs")}_wsOnLogsNotification(e){const{result:t,subscription:n}=(0,q.vt)(e,Xn);this._handleServerNotification(n,[t.value,t.context])}_wsOnSlotNotification(e){const{result:t,subscription:n}=(0,q.vt)(e,rn);this._handleServerNotification(n,[t])}onSlotChange(e){return this._makeSubscription({callback:e,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(e){await this._unsubscribeClientSubscription(e,"slot change")}_wsOnSlotUpdatesNotification(e){const{result:t,subscription:n}=(0,q.vt)(e,on);this._handleServerNotification(n,[t])}onSlotUpdate(e){return this._makeSubscription({callback:e,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(e){await this._unsubscribeClientSubscription(e,"slot update")}async _unsubscribeClientSubscription(e,t){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[e];n?await n():console.warn("Ignored unsubscribe request because an active subscription with id "+"`".concat(e,"` for '").concat(t,"' events ")+"could not be found.")}_buildArgs(e,t,n,r){const i=t||this._commitment;if(i||n||r){let t={};n&&(t.encoding=n),i&&(t.commitment=i),r&&(t=Object.assign(t,r)),e.push(t)}return e}_buildArgsAtLeastConfirmed(e,t,n,r){const i=t||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(e,t,n,r)}_wsOnSignatureNotification(e){const{result:t,subscription:n}=(0,q.vt)(e,an);"receivedSignature"!==t.value&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,"receivedSignature"===t.value?[{type:"received"},t.context]:[{type:"status",result:t.value},t.context])}onSignature(e,t,n){const r=this._buildArgs([e],n||this._commitment||"finalized"),i=this._makeSubscription({callback:(e,n)=>{if("status"===e.type){t(e.result,n);try{this.removeSignatureListener(i)}catch(r){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},r);return i}onSignatureWithOptions(e,t,n){const s=(0,i.A)((0,i.A)({},n),{},{commitment:n&&n.commitment||this._commitment||"finalized"}),{commitment:o}=s,a=(0,r.A)(s,V),c=this._buildArgs([e],o,void 0,a),u=this._makeSubscription({callback:(e,n)=>{t(e,n);try{this.removeSignatureListener(u)}catch(r){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},c);return u}async removeSignatureListener(e){await this._unsubscribeClientSubscription(e,"signature result")}_wsOnRootNotification(e){const{result:t,subscription:n}=(0,q.vt)(e,cn);this._handleServerNotification(n,[t])}onRootChange(e){return this._makeSubscription({callback:e,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(e){await this._unsubscribeClientSubscription(e,"root change")}}class $n{constructor(e){this._keypair=void 0,this._keypair=null!==e&&void 0!==e?e:J()}static generate(){return new $n(J())}static fromSecretKey(e,t){if(64!==e.byteLength)throw new Error("bad secret key size");const n=e.slice(32,64);if(!t||!t.skipValidation){const t=e.slice(0,32),r=G(t);for(let e=0;e<32;e++)if(n[e]!==r[e])throw new Error("provided secretKey is invali
1d")}return new $n({publicKey:n,secretKey:e})}static fromSeed(e){const t=G(e),n=new Uint8Array(64);return n.set(e),n.set(t,32),new $n({publicKey:t,secretKey:n})}get publicKey(){return new se(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const er=Object.freeze({CreateLookupTable:{index:0,layout:g.w3([g.DH("instruction"),He("recentSlot"),g.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:g.w3([g.DH("instruction")])},ExtendLookupTable:{index:2,layout:g.w3([g.DH("instruction"),He(),g.O6(de(),g.cY(g.DH(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:g.w3([g.DH("instruction")])},CloseLookupTable:{index:4,layout:g.w3([g.DH("instruction")])}});class tr{constructor(){}static createLookupTable(e){const[t,n]=se.findProgramAddressSync([e.authority.toBuffer(),K().encode(e.recentSlot)],this.programId),r=qe(er.CreateLookupTable,{recentSlot:BigInt(e.recentSlot),bumpSeed:n}),i=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:Ue.programId,isSigner:!1,isWritable:!1}];return[new We({programId:this.programId,keys:i,data:r}),t]}static freezeLookupTable(e){const t=qe(er.FreezeLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new We({programId:this.programId,keys:n,data:t})}static extendLookupTable(e){const t=qe(er.ExtendLookupTable,{addresses:e.addresses.map(e=>e.toBytes())}),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return e.payer&&n.push({pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:Ue.programId,isSigner:!1,isWritable:!1}),new We({programId:this.programId,keys:n,data:t})}static deactivateLookupTable(e){const t=qe(er.DeactivateLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new We({programId:this.programId,keys:n,data:t})}static closeLookupTable(e){const t=qe(er.CloseLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.recipient,isSigner:!1,isWritable:!0}];return new We({programId:this.programId,keys:n,data:t})}}tr.programId=new se("AddressLookupTab1e1111111111111111111111111");const nr=Object.freeze({RequestUnits:{index:0,layout:g.w3([g.u8("instruction"),g.DH("units"),g.DH("additionalFee")])},RequestHeapFrame:{index:1,layout:g.w3([g.u8("instruction"),g.DH("bytes")])},SetComputeUnitLimit:{index:2,layout:g.w3([g.u8("instruction"),g.DH("units")])},SetComputeUnitPrice:{index:3,layout:g.w3([g.u8("instruction"),He("microLamports")])}});class rr{constructor(){}static requestUnits(e){const t=qe(nr.RequestUnits,e);return new We({keys:[],programId:this.programId,data:t})}static requestHeapFrame(e){const t=qe(nr.RequestHeapFrame,e);return new We({keys:[],programId:this.programId,data:t})}static setComputeUnitLimit(e){const t=qe(nr.SetComputeUnitLimit,e);return new We({keys:[],programId:this.programId,data:t})}static setComputeUnitPrice(e){const t=qe(nr.SetComputeUnitPrice,{microLamports:BigInt(e.microLamports)});return new We({keys:[],programId:this.programId,data:t})}}rr.programId=new se("ComputeBudget111111111111111111111111111111");const ir=g.w3([g.u8("numSignatures"),g.u8("padding"),g.NX("signatureOffset"),g.NX("signatureInstructionIndex"),g.NX("publicKeyOffset"),g.NX("publicKeyInstructionIndex"),g.NX("messageDataOffset"),g.NX("messageDataSize"),g.NX("messageInstructionIndex")]);class sr{constructor(){}static createInstructionWithPublicKey(e){const{publicKey:t,message:n,signature:r,instructionIndex:i}=e;be(32===t.length,"Public Key must be ".concat(32," bytes but received ").concat(t.length," bytes")),be(64===r.length,"Signature must be ".concat(64," bytes but received ").concat(r.length," bytes"));const o=ir.span,a=o+t.length,c=a+r.length,u=s.Buffer.alloc(c+n.length),l=null==i?65535:i;return ir.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:l,publicKeyOffset:o,publicKeyInstructionIndex:l,messageDataOffset:c,messageDataSize:n.length,messageInstructionIndex:l},u),u.fill(t,o),u.fill(r,a),u.fill(n,c),new We({keys:[],programId:sr.programId,data:u})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:n,instructionIndex:r}=e;be(64===t.length,"Private key must be ".concat(64," bytes but received ").concat(t.length," bytes"));try{const e=$n.fromSecretKey(t),i=e.publicKey.toBytes(),s=Z(n,e.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:s,instructionIndex:r})}catch(i){throw new Error("Error creating instruction; ".concat(i))}}}sr.programId=new se("Ed25519SigVerify111111111111111111111111111");H.bI.utils.isValidPrivateKey;const or=H.bI.getPublicKey,ar=g.w3([g.u8("numSignatures"),g.NX("signatureOffset"),g.u8("signatureInstructionIndex"),g.NX("ethAddressOffset"),g.u8("ethAddressInstructionIndex"),g.NX("messageDataOffset"),g.NX("messageDataSize"),g.u8("messageInstructionIndex"),g.av(20,"ethAddress"),g.av(64,"signature"),g.u8("recoveryId")]);class cr{constructor(){}static publicKeyToEthAddress(e){be(64===e.length,"Public key must be ".concat(64," bytes but received ").concat(e.length," bytes"));try{return s.Buffer.from((0,D.lY)($(e))).slice(-20)}catch(t){throw new Error("Error constructing Ethereum address: ".concat(t))}}static createInstructionWithPublicKey(e){const{publicKey:t,message:n,signature:r,recoveryId:i,instructionIndex:s}=e;return cr.createInstructionWithEthAddress({ethAddress:cr.publicKeyToEthAddress(t),message:n,signature:r,recoveryId:i,instructionIndex:s})}static createInstructionWithEthAddress(e){const{ethAddress:t,message:n,signature:r,recoveryId:i,instructionIndex:o=0}=e;let a;a="string"===typeof t?t.startsWith("0x")?s.Buffer.from(t.substr(2),"hex"):s.Buffer.from(t,"hex"):t,be(2
10===a.length,"Address must be ".concat(20," bytes but received ").concat(a.length," bytes"));const c=12+a.length,u=c+r.length+1,l=s.Buffer.alloc(ar.span+n.length);return ar.encode({numSignatures:1,signatureOffset:c,signatureInstructionIndex:o,ethAddressOffset:12,ethAddressInstructionIndex:o,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:o,signature:$(r),ethAddress:$(a),recoveryId:i},l),l.fill($(n),ar.span),new We({keys:[],programId:cr.programId,data:l})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:n,instructionIndex:r}=e;be(32===t.length,"Private key must be ".concat(32," bytes but received ").concat(t.length," bytes"));try{const e=$(t),i=or(e,!1).slice(1),o=s.Buffer.from((0,D.lY)($(n))),[a,c]=((e,t)=>{const n=H.bI.sign(e,t);return[n.toCompactRawBytes(),n.recovery]})(o,e);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:a,recoveryId:c,instructionIndex:r})}catch(i){throw new Error("Error creating instruction; ".concat(i))}}}var ur;cr.programId=new se("KeccakSecp256k11111111111111111111111111111");const lr=new se("StakeConfig11111111111111111111111111111111");class dr{constructor(e,t,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=t,this.custodian=n}}ur=dr,dr.default=new ur(0,0,se.default);const hr=Object.freeze({Initialize:{index:0,layout:g.w3([g.DH("instruction"),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"authorized";return g.w3([de("staker"),de("withdrawer")],e)}(),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lockup";return g.w3([g.Wg("unixTimestamp"),g.Wg("epoch"),de("custodian")],e)}()])},Authorize:{index:1,layout:g.w3([g.DH("instruction"),de("newAuthorized"),g.DH("stakeAuthorizationType")])},Delegate:{index:2,layout:g.w3([g.DH("instruction")])},Split:{index:3,layout:g.w3([g.DH("instruction"),g.Wg("lamports")])},Withdraw:{index:4,layout:g.w3([g.DH("instruction"),g.Wg("lamports")])},Deactivate:{index:5,layout:g.w3([g.DH("instruction")])},Merge:{index:7,layout:g.w3([g.DH("instruction")])},AuthorizeWithSeed:{index:8,layout:g.w3([g.DH("instruction"),de("newAuthorized"),g.DH("stakeAuthorizationType"),ge("authoritySeed"),de("authorityOwner")])}});Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class gr{constructor(){}static initialize(e){const{stakePubkey:t,authorized:n,lockup:r}=e,i=r||dr.default,s=qe(hr.Initialize,{authorized:{staker:$(n.staker.toBuffer()),withdrawer:$(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:$(i.custodian.toBuffer())}}),o={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Ce,isSigner:!1,isWritable:!1}],programId:this.programId,data:s};return new We(o)}static createAccountWithSeed(e){const t=new xe;t.add(Ue.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=e;return t.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(e){const t=new xe;t.add(Ue.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=e;return t.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(e){const{stakePubkey:t,authorizedPubkey:n,votePubkey:r}=e,i=qe(hr.Delegate);return(new xe).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:Ee,isSigner:!1,isWritable:!1},{pubkey:Te,isSigner:!1,isWritable:!1},{pubkey:lr,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(e){const{stakePubkey:t,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:s}=e,o=qe(hr.Authorize,{newAuthorized:$(r.toBuffer()),stakeAuthorizationType:i.index}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Ee,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return s&&a.push({pubkey:s,isSigner:!0,isWritable:!1}),(new xe).add({keys:a,programId:this.programId,data:o})}static authorizeWithSeed(e){const{stakePubkey:t,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:s,stakeAuthorizationType:o,custodianPubkey:a}=e,c=qe(hr.AuthorizeWithSeed,{newAuthorized:$(s.toBuffer()),stakeAuthorizationType:o.index,authoritySeed:r,authorityOwner:$(i.toBuffer())}),u=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:Ee,isSigner:!1,isWritable:!1}];return a&&u.push({pubkey:a,isSigner:!0,isWritable:!1}),(new xe).add({keys:u,programId:this.programId,data:c})}static splitInstruction(e){const{stakePubkey:t,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=e,s=qe(hr.Split,{lamports:i});return new We({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static split(e,t){const n=new xe;return n.add(Ue.createAccount({fromPubkey:e.authorizedPubkey,newAccountPubkey:e.splitStakePubkey,lamports:t,space
1:this.space,programId:this.programId})),n.add(this.splitInstruction(e))}static splitWithSeed(e,t){const{stakePubkey:n,authorizedPubkey:r,splitStakePubkey:i,basePubkey:s,seed:o,lamports:a}=e,c=new xe;return c.add(Ue.allocate({accountPubkey:i,basePubkey:s,seed:o,space:this.space,programId:this.programId})),t&&t>0&&c.add(Ue.transfer({fromPubkey:e.authorizedPubkey,toPubkey:i,lamports:t})),c.add(this.splitInstruction({stakePubkey:n,authorizedPubkey:r,splitStakePubkey:i,lamports:a}))}static merge(e){const{stakePubkey:t,sourceStakePubKey:n,authorizedPubkey:r}=e,i=qe(hr.Merge);return(new xe).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:Ee,isSigner:!1,isWritable:!1},{pubkey:Te,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(e){const{stakePubkey:t,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:s}=e,o=qe(hr.Withdraw,{lamports:i}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:Ee,isSigner:!1,isWritable:!1},{pubkey:Te,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return s&&a.push({pubkey:s,isSigner:!0,isWritable:!1}),(new xe).add({keys:a,programId:this.programId,data:o})}static deactivate(e){const{stakePubkey:t,authorizedPubkey:n}=e,r=qe(hr.Deactivate);return(new xe).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Ee,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}gr.programId=new se("Stake11111111111111111111111111111111111111"),gr.space=200;const mr=Object.freeze({InitializeAccount:{index:0,layout:g.w3([g.DH("instruction"),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteInit";return g.w3([de("nodePubkey"),de("authorizedVoter"),de("authorizedWithdrawer"),g.u8("commission")],e)}()])},Authorize:{index:1,layout:g.w3([g.DH("instruction"),de("newAuthorized"),g.DH("voteAuthorizationType")])},Withdraw:{index:3,layout:g.w3([g.DH("instruction"),g.Wg("lamports")])},UpdateValidatorIdentity:{index:4,layout:g.w3([g.DH("instruction")])},AuthorizeWithSeed:{index:10,layout:g.w3([g.DH("instruction"),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteAuthorizeWithSeedArgs";return g.w3([g.DH("voteAuthorizationType"),de("currentAuthorityDerivedKeyOwnerPubkey"),ge("currentAuthorityDerivedKeySeed"),de("newAuthorized")],e)}()])}});Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class pr{constructor(){}static initializeAccount(e){const{votePubkey:t,nodePubkey:n,voteInit:r}=e,i=qe(mr.InitializeAccount,{voteInit:{nodePubkey:$(r.nodePubkey.toBuffer()),authorizedVoter:$(r.authorizedVoter.toBuffer()),authorizedWithdrawer:$(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),s={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Ce,isSigner:!1,isWritable:!1},{pubkey:Ee,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new We(s)}static createAccount(e){const t=new xe;return t.add(Ue.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){const{votePubkey:t,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=e,s=qe(mr.Authorize,{newAuthorized:$(r.toBuffer()),voteAuthorizationType:i.index}),o=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Ee,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new xe).add({keys:o,programId:this.programId,data:s})}static authorizeWithSeed(e){const{currentAuthorityDerivedKeyBasePubkey:t,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:i,voteAuthorizationType:s,votePubkey:o}=e,a=qe(mr.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:$(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:$(i.toBuffer()),voteAuthorizationType:s.index}}),c=[{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:Ee,isSigner:!1,isWritable:!1},{pubkey:t,isSigner:!0,isWritable:!1}];return(new xe).add({keys:c,programId:this.programId,data:a})}static withdraw(e){const{votePubkey:t,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=e,s=qe(mr.Withdraw,{lamports:r}),o=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new xe).add({keys:o,programId:this.programId,data:s})}static safeWithdraw(e,t,n){if(e.lamports>t-n)throw new Error("Withdraw will leave vote account with insufficient funds.");return pr.withdraw(e)}static updateValidatorIdentity(e){const{votePubkey:t,authorizedWithdrawerPubkey:n,nodePubkey:r}=e,i=qe(mr.UpdateValidatorIdentity),s=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new xe).add({keys:s,programId:this.programId,data:i})}}pr.programId=new se("Vote111111111111111111111111111111111111111"),pr.space=3762;new se("Va1idator1nfo111111111111111111111111111111"),(0,q.NW)({name:(0,q.Yj)(),website:(0,q.lq)((0,q.Yj)()),details:(0,q.lq)((0,q.Yj)()),iconUrl:(0,q.lq)((0,q.Yj)()),keybaseUsername:(0,q.lq)((0,q.Yj)())});new se("Vote111111111111111111111111111111111111111"),g.w3([de("nodePubkey"),de("authorizedWithdrawer"),g.u8("commission"),g.I0(),g.O6(g.w3([g.I0("slot"),g.DH("confirmationCount")]),g.cY(g.DH(),-8),"votes"),g.u8("rootSlotValid"),g.I0("rootSlot"),g.I0(),g.O6(g.w3([g.I0("epoch"),de("authorizedVoter")]),g.cY(g.DH(),-8),"authorizedVoters"),g.w3([g.O6(g.w3([de("authorizedPubkey"),g.I0("epochOfLastAuthorizedSwitch"),g.I0("targetEpoch")]),32,"buf"),g.I0("idx"),g.u8("isEmpty")],"priorVoters"),g.I0(),g.O6(g.w3([g.I0("epoch"),g.I0("credits"),g.I0("prevCredits")]),g.cY(g.DH(),-8),"epochCredits"),g.w3([g.I0("slot"),g.I0("timestamp")],"lastTimestamp")]);const fr={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function br(e,t){const n=!1===t?"http":"https";if(!e)return fr[n].devnet;const r=fr[n][e];if(!r)throw new Error("Unknown ".concat(n," cluster: ").concat(e));return r}const yr=1e9}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.