@solana/web3.js 2.0.0-experimental.ba21818 → 2.0.0-experimental.ba9b4c7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,62 +2,69 @@ this.globalThis = this.globalThis || {};
2
2
  this.globalThis.solanaWeb3 = (function (exports) {
3
3
  'use strict';
4
4
 
5
- var ir=Object.create;var ye=Object.defineProperty;var sr=Object.getOwnPropertyDescriptor;var ar=Object.getOwnPropertyNames;var cr=Object.getPrototypeOf,ur=Object.prototype.hasOwnProperty;var dr=(e,t,r)=>t in e?ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var lr=(e,t)=>()=>(e&&(t=e(e=0)),t);var fr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var pr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ar(t))!ur.call(e,o)&&o!==r&&ye(e,o,{get:()=>t[o],enumerable:!(n=sr(t,o))||n.enumerable});return e};var Ke=(e,t,r)=>(r=e!=null?ir(cr(e)):{},pr(t||!e||!e.__esModule?ye(r,"default",{value:e,enumerable:!0}):r,e));var A=(e,t,r)=>(dr(e,typeof t!="symbol"?t+"":t,r),r);var u=lr(()=>{});var Ue=fr((ia,Vt)=>{u();var Wn=Object.prototype.toString,Mn=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};function re(e,t){var r,n,o,i,s,a,c;if(e===!0)return "true";if(e===!1)return "false";switch(typeof e){case"object":if(e===null)return null;if(e.toJSON&&typeof e.toJSON=="function")return re(e.toJSON(),t);if(c=Wn.call(e),c==="[object Array]"){for(o="[",n=e.length-1,r=0;r<n;r++)o+=re(e[r],!0)+",";return n>-1&&(o+=re(e[r],!0)),o+"]"}else if(c==="[object Object]"){for(i=Mn(e).sort(),n=i.length,o="",r=0;r<n;)s=i[r],a=re(e[s],!1),a!==void 0&&(o&&(o+=","),o+=JSON.stringify(s)+":"+a),r++;return "{"+o+"}"}else return JSON.stringify(e);case"function":case"undefined":return t?null:void 0;case"string":return JSON.stringify(e);default:return isFinite(e)?e:null}}Vt.exports=function(e){var t=re(e,!1);if(t!==void 0)return ""+t};});u();u();u();function ne(e,t,r=0){if(t.length-r<=0)throw new Error(`Codec [${e}] cannot decode empty byte arrays.`)}function V(e,t,r,n=0){let o=r.length-n;if(o<t)throw new Error(`Codec [${e}] expected ${t} bytes, got ${o}.`)}var He=e=>{let t=e.filter(i=>i.length);if(t.length===0)return e.length?e[0]:new Uint8Array;if(t.length===1)return t[0];let r=t.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r),o=0;return t.forEach(i=>{n.set(i,o),o+=i.length;}),n},mr=(e,t)=>{if(e.length>=t)return e;let r=new Uint8Array(t).fill(0);return r.set(e),r},Ge=(e,t)=>mr(e.length<=t?e:e.slice(0,t),t);function F(e,t,r){if(e.fixedSize!==t.fixedSize)throw new Error(`Encoder and decoder must have the same fixed size, got [${e.fixedSize}] and [${t.fixedSize}].`);if(e.maxSize!==t.maxSize)throw new Error(`Encoder and decoder must have the same max size, got [${e.maxSize}] and [${t.maxSize}].`);if(r===void 0&&e.description!==t.description)throw new Error(`Encoder and decoder must have the same description, got [${e.description}] and [${t.description}]. Pass a custom description as a third argument if you want to override the description and bypass this error.`);return {decode:t.decode,description:r??e.description,encode:e.encode,fixedSize:e.fixedSize,maxSize:e.maxSize}}function je(e,t,r){return {description:r??`fixed(${t}, ${e.description})`,fixedSize:t,maxSize:t}}function Ve(e,t,r){return {...je(e,t,r),encode:n=>Ge(e.encode(n),t)}}function qe(e,t,r){return {...je(e,t,r),decode:(n,o=0)=>{V("fixCodec",t,n,o),(o>0||n.length>t)&&(n=n.slice(o,o+t)),e.fixedSize!==null&&(n=Ge(n,e.fixedSize));let[i]=e.decode(n,0);return [i,o+t]}}}function Ye(e,t){return {description:e.description,encode:r=>e.encode(t(r)),fixedSize:e.fixedSize,maxSize:e.maxSize}}u();u();function gr(e,t,r,n){if(n<t||n>r)throw new Error(`Codec [${e}] expected number to be in the range [${t}, ${r}], got ${n}.`)}function Je(e){let t,r=e.name;return e.size>1&&(t=!("endian"in e.options)||e.options.endian===0,r+=t?"(le)":"(be)"),{description:e.options.description??r,fixedSize:e.size,littleEndian:t,maxSize:e.size}}function br(e){let t=Je(e);return {description:t.description,encode(r){e.range&&gr(e.name,e.range[0],e.range[1],r);let n=new ArrayBuffer(e.size);return e.set(new DataView(n),r,t.littleEndian),new Uint8Array(n)},fixedSize:t.fixedSize,maxSize:t.maxSize}}function hr(e){let t=Je(e);return {decode(r,n=0){ne(t.description,r,n),V(t.description,e.size,r,n);let o=new DataView(yr(r,n,e.size));return [e.get(o,t.littleEndian),n+e.size]},description:t.description,fixedSize:t.fixedSize,maxSize:t.maxSize}}function yr(e,t,r){let n=e.byteOffset+(t??0),o=r??e.byteLength;return e.buffer.slice(n,n+o)}var Xe=(e={})=>br({name:"u32",options:e,range:[0,+"0xffffffff"],set:(t,r,n)=>t.setUint32(0,r,n),size:4}),Ze=(e={})=>hr({get:(t,r)=>t.getUint32(0,r),name:"u32",options:e,size:4});function Sr(e,t,r=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new Error(`Expected a string of base ${e.length}, got [${r}].`)}var wr=e=>{let t=e.length,r=BigInt(t);return {description:`base${t}`,encode(n){if(Sr(e,n),n==="")return new Uint8Array;let o=[...n],i=o.findIndex(p=>p!==e[0]);i=i===-1?o.length:i;let s=Array(i).fill(0);if(i===o.length)return Uint8Array.from(s);let a=o.slice(i),c=0n,l=1n;for(let p=a.length-1;p>=0;p-=1)c+=l*BigInt(e.indexOf(a[p])),l*=r;let f=[];for(;c>0n;)f.unshift(Number(c%256n)),c/=256n;return Uint8Array.from(s.concat(f))},fixedSize:null,maxSize:null}},xr=e=>{let t=e.length,r=BigInt(t);return {decode(n,o=0){let i=o===0?n:n.slice(o);if(i.length===0)return ["",0];let s=i.findIndex(f=>f!==0);s=s===-1?i.length:s;let a=e[0].repeat(s);if(s===i.length)return [a,n.length];let c=i.slice(s).reduce((f,p)=>f*256n+BigInt(p),0n),l=[];for(;c>0n;)l.unshift(e[Number(c%r)]),c/=r;return [a+l.join(""),n.length]},description:`base${t}`,fixedSize:null,maxSize:null}};var Qe="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",et=()=>wr(Qe),tt=()=>xr(Qe);var Er=e=>e.replace(/\u0000/g,"");var Ir=globalThis.TextDecoder,Ar=globalThis.TextEncoder,zr=()=>{let e;return {description:"utf8",encode:t=>new Uint8Array((e||(e=new Ar)).encode(t)),fixedSize:null,maxSize:null}},Tr=()=>{let e;return {decode(t,r=0){let n=(e||(e=new Ir)).decode(t.slice(r));return [Er(n),t.length]},description:"utf8",fixedSize:null,maxSize:null}};var rt=(e={})=>{let t=e.size??Xe(),r=e.encoding??zr(),n=e.description??`string(${r.description}; ${ot(t)})`;return t==="variable"?{...r,description:n}:typeof t=="number"?Ve(r,t,n):{description:n,encode:o=>{let i=r.encode(o),s=t.encode(i.length);return He([s,i])},fixedSize:null,maxSize:null}},nt=(e={})=>{let t=e.size??Ze(),r=e.encoding??Tr(),n=e.description??`string(${r.description}; ${ot(t)})`;return t==="variable"?{...r,description:n}:typeof t=="number"?qe(r,t,n):{decode:(o,i=0)=>{ne("string",o,i);let[s,a]=t.decode(o,i),c=Number(s);i=a;let l=o.slice(i,i+c);V("string",c,l);let[f,p]=r.decode(l);return i+=p,[f,i]},description:n,fixedSize:null,maxSize:null}};function ot(e){return typeof e=="object"?e.description:`${e}`}u();function q(){if(!globalThis.isSecureContext)throw new Error("Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts")}var L;async function vr(e){return L===void 0&&(L=new Promise(t=>{e.generateKey("Ed25519",!1,["sign","verify"]).catch(()=>{t(L=!1);}).then(()=>{t(L=!0);});})),typeof L=="boolean"?L:await L}async function it(){if(q(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.digest!="function")throw new Error("No digest implementation could be found")}async function st(){if(q(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.generateKey!="function")throw new Error("No key generation implementation could be found");if(!await vr(globalThis.crypto.subtle))throw new Error(`This runtime does not support the generation of Ed25519 key pairs.
5
+ var Vn=Object.create;var _e=Object.defineProperty;var qn=Object.getOwnPropertyDescriptor;var Yn=Object.getOwnPropertyNames;var Jn=Object.getPrototypeOf,Xn=Object.prototype.hasOwnProperty;var Zn=(e,t,n)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Qn=(e,t)=>()=>(e&&(t=e(e=0)),t);var er=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var tr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Yn(t))!Xn.call(e,o)&&o!==n&&_e(e,o,{get:()=>t[o],enumerable:!(r=qn(t,o))||r.enumerable});return e};var gt=(e,t,n)=>(n=e!=null?Vn(Jn(e)):{},tr(t||!e||!e.__esModule?_e(n,"default",{value:e,enumerable:!0}):n,e));var T=(e,t,n)=>(Zn(e,typeof t!="symbol"?t+"":t,n),n);var d=Qn(()=>{});var lt=er((Ac,kn)=>{d();var $o=Object.prototype.toString,Lo=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};function de(e,t){var n,r,o,i,a,s,c;if(e===!0)return "true";if(e===!1)return "false";switch(typeof e){case"object":if(e===null)return null;if(e.toJSON&&typeof e.toJSON=="function")return de(e.toJSON(),t);if(c=$o.call(e),c==="[object Array]"){for(o="[",r=e.length-1,n=0;n<r;n++)o+=de(e[n],!0)+",";return r>-1&&(o+=de(e[n],!0)),o+"]"}else if(c==="[object Object]"){for(i=Lo(e).sort(),r=i.length,o="",n=0;n<r;)a=i[n],s=de(e[a],!1),s!==void 0&&(o&&(o+=","),o+=JSON.stringify(a)+":"+s),n++;return "{"+o+"}"}else return JSON.stringify(e);case"function":case"undefined":return t?null:void 0;case"string":return JSON.stringify(e);default:return isFinite(e)?e:null}}kn.exports=function(e){var t=de(e,!1);if(t!==void 0)return ""+t};});d();d();d();function U(e,t,n=0){if(t.length-n<=0)throw new Error(`Codec [${e}] cannot decode empty byte arrays.`)}function P(e,t,n,r=0){let o=n.length-r;if(o<t)throw new Error(`Codec [${e}] expected ${t} bytes, got ${o}.`)}var F=e=>{let t=e.filter(i=>i.length);if(t.length===0)return e.length?e[0]:new Uint8Array;if(t.length===1)return t[0];let n=t.reduce((i,a)=>i+a.length,0),r=new Uint8Array(n),o=0;return t.forEach(i=>{r.set(i,o),o+=i.length;}),r},nr=(e,t)=>{if(e.length>=t)return e;let n=new Uint8Array(t).fill(0);return n.set(e),n},Oe=(e,t)=>nr(e.length<=t?e:e.slice(0,t),t);function I(e,t,n){if(e.fixedSize!==t.fixedSize)throw new Error(`Encoder and decoder must have the same fixed size, got [${e.fixedSize}] and [${t.fixedSize}].`);if(e.maxSize!==t.maxSize)throw new Error(`Encoder and decoder must have the same max size, got [${e.maxSize}] and [${t.maxSize}].`);if(n===void 0&&e.description!==t.description)throw new Error(`Encoder and decoder must have the same description, got [${e.description}] and [${t.description}]. Pass a custom description as a third argument if you want to override the description and bypass this error.`);return {decode:t.decode,description:n??e.description,encode:e.encode,fixedSize:e.fixedSize,maxSize:e.maxSize}}function bt(e,t,n){return {description:n??`fixed(${t}, ${e.description})`,fixedSize:t,maxSize:t}}function ue(e,t,n){return {...bt(e,t,n),encode:r=>Oe(e.encode(r),t)}}function le(e,t,n){return {...bt(e,t,n),decode:(r,o=0)=>{P("fixCodec",t,r,o),(o>0||r.length>t)&&(r=r.slice(o,o+t)),e.fixedSize!==null&&(r=Oe(r,e.fixedSize));let[i]=e.decode(r,0);return [i,o+t]}}}function fe(e,t){return {description:e.description,encode:n=>e.encode(t(n)),fixedSize:e.fixedSize,maxSize:e.maxSize}}function St(e,t){return {decode:(n,r=0)=>{let[o,i]=e.decode(n,r);return [t(o,n,r),i]},description:e.description,fixedSize:e.fixedSize,maxSize:e.maxSize}}d();d();function ht(e,t,n,r){if(r<t||r>n)throw new Error(`Codec [${e}] expected number to be in the range [${t}, ${n}], got ${r}.`)}function yt(e){let t,n=e.name;return e.size>1&&(t=!("endian"in e.options)||e.options.endian===0,n+=t?"(le)":"(be)"),{description:e.options.description??n,fixedSize:e.size,littleEndian:t,maxSize:e.size}}function xt(e){let t=yt(e);return {description:t.description,encode(n){e.range&&ht(e.name,e.range[0],e.range[1],n);let r=new ArrayBuffer(e.size);return e.set(new DataView(r),n,t.littleEndian),new Uint8Array(r)},fixedSize:t.fixedSize,maxSize:t.maxSize}}function wt(e){let t=yt(e);return {decode(n,r=0){U(t.description,n,r),P(t.description,e.size,n,r);let o=new DataView(rr(n,r,e.size));return [e.get(o,t.littleEndian),r+e.size]},description:t.description,fixedSize:t.fixedSize,maxSize:t.maxSize}}function rr(e,t,n){let r=e.byteOffset+(t??0),o=n??e.byteLength;return e.buffer.slice(r,r+o)}var Y=(e={})=>({description:e.description??"shortU16",encode:t=>{ht("shortU16",0,65535,t);let n=[0];for(let r=0;;r+=1){let o=t>>r*7;if(o===0)break;let i=127&o;n[r]=i,r>0&&(n[r-1]|=128);}return new Uint8Array(n)},fixedSize:null,maxSize:3}),J=(e={})=>({decode:(t,n=0)=>{let r=0,o=0;for(;++o;){let i=o-1,a=t[n+i],s=127&a;if(r|=s<<i*7,!(a&128))break}return [r,n+o]},description:e.description??"shortU16",fixedSize:null,maxSize:3});var me=(e={})=>xt({name:"u32",options:e,range:[0,+"0xffffffff"],set:(t,n,r)=>t.setUint32(0,n,r),size:4}),pe=(e={})=>wt({get:(t,n)=>t.getUint32(0,n),name:"u32",options:e,size:4});var _=(e={})=>xt({name:"u8",options:e,range:[0,+"0xff"],set:(t,n)=>t.setUint8(0,n),size:1}),O=(e={})=>wt({get:t=>t.getUint8(0),name:"u8",options:e,size:1}),Et=(e={})=>I(_(e),O(e));function or(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new Error(`Expected a string of base ${e.length}, got [${n}].`)}var ir=e=>{let t=e.length,n=BigInt(t);return {description:`base${t}`,encode(r){if(or(e,r),r==="")return new Uint8Array;let o=[...r],i=o.findIndex(m=>m!==e[0]);i=i===-1?o.length:i;let a=Array(i).fill(0);if(i===o.length)return Uint8Array.from(a);let s=o.slice(i),c=0n,l=1n;for(let m=s.length-1;m>=0;m-=1)c+=l*BigInt(e.indexOf(s[m])),l*=n;let f=[];for(;c>0n;)f.unshift(Number(c%256n)),c/=256n;return Uint8Array.from(a.concat(f))},fixedSize:null,maxSize:null}},ar=e=>{let t=e.length,n=BigInt(t);return {decode(r,o=0){let i=o===0?r:r.slice(o);if(i.length===0)return ["",0];let a=i.findIndex(f=>f!==0);a=a===-1?i.length:a;let s=e[0].repeat(a);if(a===i.length)return [s,r.length];let c=i.slice(a).reduce((f,m)=>f*256n+BigInt(m),0n),l=[];for(;c>0n;)l.unshift(e[Number(c%n)]),c/=n;return [s+l.join(""),r.length]},description:`base${t}`,fixedSize:null,maxSize:null}};var At="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Tt=()=>ir(At),zt=()=>ar(At);var sr=e=>e.replace(/\u0000/g,"");var cr=globalThis.TextDecoder,dr=globalThis.TextEncoder,ur=()=>{let e;return {description:"utf8",encode:t=>new Uint8Array((e||(e=new dr)).encode(t)),fixedSize:null,maxSize:null}},lr=()=>{let e;return {decode(t,n=0){let r=(e||(e=new cr)).decode(t.slice(n));return [sr(r),t.length]},description:"utf8",fixedSize:null,maxSize:null}};var It=(e={})=>{let t=e.size??me(),n=e.encoding??ur(),r=e.description??`string(${n.description}; ${Rt(t)})`;return t==="variable"?{...n,description:r}:typeof t=="number"?ue(n,t,r):{description:r,encode:o=>{let i=n.encode(o),a=t.encode(i.length);return F([a,i])},fixedSize:null,maxSize:null}},Ct=(e={})=>{let t=e.size??pe(),n=e.encoding??lr(),r=e.description??`string(${n.description}; ${Rt(t)})`;return t==="variable"?{...n,description:r}:typeof t=="number"?le(n,t,r):{decode:(o,i=0)=>{U("string",o,i);let[a,s]=t.decode(o,i),c=Number(a);i=s;let l=o.slice(i,i+c);P("string",c,l);let[f,m]=n.decode(l);return i+=m,[f,i]},description:r,fixedSize:null,maxSize:null}};function Rt(e){return typeof e=="object"?e.description:`${e}`}d();function X(){if(!globalThis.isSecureContext)throw new Error("Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts")}var $;async function fr(e){return $===void 0&&($=new Promise(t=>{e.generateKey("Ed25519",!1,["sign","verify"]).catch(()=>{t($=!1);}).then(()=>{t($=!0);});})),typeof $=="boolean"?$:await $}async function vt(){if(X(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.digest!="function")throw new Error("No digest implementation could be found")}async function Nt(){if(X(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.generateKey!="function")throw new Error("No key generation implementation could be found");if(!await fr(globalThis.crypto.subtle))throw new Error(`This runtime does not support the generation of Ed25519 key pairs.
6
6
 
7
7
  Install and import \`@solana/webcrypto-ed25519-polyfill\` before generating keys in environments that do not support Ed25519.
8
8
 
9
- For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20`)}async function at(){if(q(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!="function")throw new Error("No key export implementation could be found")}async function ct(){if(q(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!="function")throw new Error("No signing implementation could be found")}async function ut(){if(q(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.verify!="function")throw new Error("No signature verification implementation could be found")}var Se,we;function xe(){return Se||(Se=et()),Se}function Cr(){return we||(we=tt()),we}function Rr(e){return !(e.length<32||e.length>44||xe().encode(e).byteLength!==32)}function ft(e){try{if(e.length<32||e.length>44)throw new Error("Expected input string to decode to a byte array of length 32.");let n=xe().encode(e).byteLength;if(n!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${n}`)}catch(t){throw new Error(`\`${e}\` is not a base-58 encoded address`,{cause:t})}}function Nr(e){return ft(e),e}function Br(e){return Ye(rt({description:e?.description??"Base58EncodedAddress",encoding:xe(),size:32}),t=>Nr(t))}function pt(e){return nt({description:e?.description??"Base58EncodedAddress",encoding:Cr(),size:32})}function Y(e){return F(Br(e),pt(e))}function ie(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}var kr=37095705934669439343138083508754565189542113879843219016388785533085940283555n,I=57896044618658097711785492504343953926634992332820282019728792003956564819949n,dt=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function z(e){let t=e%I;return t>=0n?t:I+t}function C(e,t){let r=e;for(;t-- >0n;)r*=r,r%=I;return r}function _r(e){let r=e*e%I*e%I,n=C(r,2n)*r%I,o=C(n,1n)*e%I,i=C(o,5n)*o%I,s=C(i,10n)*i%I,a=C(s,20n)*s%I,c=C(a,40n)*a%I,l=C(c,80n)*c%I,f=C(l,80n)*c%I,p=C(f,10n)*i%I;return C(p,2n)*e%I}function Pr(e,t){let r=z(t*t*t),n=z(r*r*t),o=_r(e*n),i=z(e*r*o),s=z(t*i*i),a=i,c=z(i*dt),l=s===e,f=s===z(-e),p=s===z(-e*dt);return l&&(i=a),(f||p)&&(i=c),(z(i)&1n)===1n&&(i=z(-i)),!l&&!f?null:i}function Dr(e,t){let r=z(e*e),n=z(r-1n),o=z(kr*r+1n),i=Pr(n,o);if(i===null)return !1;let s=(t&128)!==0;return !(i===0n&&s)}function Or(e){let t=e.toString(16);return t.length===1?`0${t}`:t}function Lr(e){let r=`0x${e.reduce((n,o,i)=>`${Or(i===31?o&-129:o)}${n}`,"")}`;return BigInt(r)}async function Ur(e){if(e.byteLength!==32)return !1;let t=Lr(e);return Dr(t,e[31])}function mo(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&typeof e[1]=="number"&&e[1]>=0&&e[1]<=255&&Rr(e[0])}function go(e){if(!(Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&typeof e[1]=="number"))throw new Error("Expected given program derived address to have the following format: [Base58EncodedAddress, ProgramDerivedAddressBump].");if(e[1]<0||e[1]>255)throw new Error(`Expected program derived address bump to be in the range [0, 255], got: ${e[1]}.`);ft(e[0]);}var mt=32,lt=16,oe=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115],gt=class extends Error{};async function Fr({programAddress:e,seeds:t}){if(await it(),t.length>lt)throw new Error(`A maximum of ${lt} seeds may be supplied when creating an address`);let r,n=t.reduce((c,l,f)=>{let p=typeof l=="string"?(r||(r=new TextEncoder)).encode(l):l;if(p.byteLength>mt)throw new Error(`The seed at index ${f} exceeds the maximum length of 32 bytes`);return c.push(...p),c},[]),o=Y(),i=o.encode(e),s=await crypto.subtle.digest("SHA-256",new Uint8Array([...n,...i,...oe])),a=new Uint8Array(s);if(await Ur(a))throw new gt("Invalid seeds; point must fall off the Ed25519 curve");return o.decode(a)[0]}async function bo({programAddress:e,seeds:t}){let r=255;for(;r>0;)try{return [await Fr({programAddress:e,seeds:[...t,new Uint8Array([r])]}),r]}catch(n){if(n instanceof gt)r--;else throw n}throw new Error("Unable to find a viable program address bump seed")}async function ho({baseAddress:e,programAddress:t,seed:r}){let{encode:n,decode:o}=Y(),i=typeof r=="string"?new TextEncoder().encode(r):r;if(i.byteLength>mt)throw new Error("The seed exceeds the maximum length of 32 bytes");let s=n(t);if(s.length>=oe.length&&s.slice(-oe.length).every((l,f)=>l===oe[f]))throw new Error("programAddress cannot end with the PDA marker");let a=await crypto.subtle.digest("SHA-256",new Uint8Array([...n(e),...i,...s])),c=new Uint8Array(a);return o(c)[0]}async function bt(e){if(await at(),e.type!=="public"||e.algorithm.name!=="Ed25519")throw new Error("The `CryptoKey` must be an `Ed25519` public key");let t=await crypto.subtle.exportKey("raw",e),[r]=pt().decode(new Uint8Array(t));return r}u();var $r=(e=>(e[e.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",e[e.READONLY_SIGNER=2]="READONLY_SIGNER",e[e.WRITABLE=1]="WRITABLE",e[e.READONLY=0]="READONLY",e))($r||{}),ht=2,Ee=1;function xo(e){return e&~ht}function Eo(e){return e&~Ee}function Io(e){return e>=2}function Ao(e){return (e&Ee)!==0}function zo(e,t){return e|t}function To(e){return e|ht}function vo(e){return e|Ee}u();async function Bo(){return await st(),await crypto.subtle.generateKey("Ed25519",!1,["sign","verify"])}async function yt(e,t){await ct();let r=await crypto.subtle.sign("Ed25519",e,t);return new Uint8Array(r)}async function ko(e,t,r){return await ut(),await crypto.subtle.verify("Ed25519",e,t,r)}u();u();u();u();var N=e=>{let t=e.reduce((o,i)=>o+i.length,0),r=new Uint8Array(t),n=0;return e.forEach(o=>{r.set(o,n),n+=o.length;}),r},St=(e,t)=>{if(e.length>=t)return e;let r=new Uint8Array(t).fill(0);return r.set(e),r},se=(e,t)=>St(e.slice(0,t),t);u();var B=class extends Error{constructor(r){super(`Serializer [${r}] cannot deserialize empty buffers.`);A(this,"name","DeserializingEmptyBufferError");}},T=class extends Error{constructor(r,n,o){super(`Serializer [${r}] expected ${n} bytes, got ${o}.`);A(this,"name","NotEnoughBytesError");}},U=class extends Error{constructor(r){r??(r="Expected a fixed-size serializer, got a variable-size one.");super(r);A(this,"name","ExpectedFixedSizeSerializerError");}};u();function J(e,t,r){return {description:r??`fixed(${t}, ${e.description})`,fixedSize:t,maxSize:t,serialize:n=>se(e.serialize(n),t),deserialize:(n,o=0)=>{if(n=n.slice(o,o+t),n.length<t)throw new T("fixSerializer",t,n.length);e.fixedSize!==null&&(n=se(n,e.fixedSize));let[i]=e.deserialize(n,0);return [i,o+t]}}}u();function $(e,t,r){return {description:e.description,fixedSize:e.fixedSize,maxSize:e.maxSize,serialize:n=>e.serialize(t(n)),deserialize:(n,o=0)=>{let[i,s]=e.deserialize(n,o);return r?[r(i,n,o),s]:[i,s]}}}u();u();u();var W=class extends Error{constructor(r,n,o){let i=`Expected a string of base ${n}, got [${r}].`;super(i);A(this,"name","InvalidBaseStringError");this.cause=o;}};var wt=e=>{let t=e.length,r=BigInt(t);return {description:`base${t}`,fixedSize:null,maxSize:null,serialize(n){if(!n.match(new RegExp(`^[${e}]*$`)))throw new W(n,t);if(n==="")return new Uint8Array;let o=[...n],i=o.findIndex(p=>p!==e[0]);i=i===-1?o.length:i;let s=Array(i).fill(0);if(i===o.length)return Uint8Array.from(s);let a=o.slice(i),c=0n,l=1n;for(let p=a.length-1;p>=0;p-=1)c+=l*BigInt(e.indexOf(a[p])),l*=r;let f=[];for(;c>0n;)f.unshift(Number(c%256n)),c/=256n;return Uint8Array.from(s.concat(f))},deserialize(n,o=0){if(n.length===0)return ["",0];let i=n.slice(o),s=i.findIndex(f=>f!==0);s=s===-1?i.length:s;let a=e[0].repeat(s);if(s===i.length)return [a,n.length];let c=i.slice(s).reduce((f,p)=>f*256n+BigInt(p),0n),l=[];for(;c>0n;)l.unshift(e[Number(c%r)]),c/=r;return [a+l.join(""),n.length]}}};u();var D=wt("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");u();u();var xt=(e,t)=>{let r=e.length,n=(o,i,s,a)=>{let c=[],l=0,f=0,p=(1<<s)-1;for(let g of o)for(l=l<<i|g,f+=i;f>=s;)f-=s,c.push(l>>f&p);return a&&f>0&&c.push(l<<s-f&p),c};return {description:`base${r}`,fixedSize:null,maxSize:null,serialize(o){if(!o.match(new RegExp(`^[${e}]*$`)))throw new W(o,r);if(o==="")return new Uint8Array;let i=[...o].map(a=>e.indexOf(a)),s=n(i,t,8,!1);return Uint8Array.from(s)},deserialize(o,i=0){if(o.length===0)return ["",0];let s=[...o.slice(i)];return [n(s,8,t,!0).map(c=>e[c]).join(""),o.length]}}};var Ie=$(xt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",6),e=>e.replace(/=/g,""),e=>e.padEnd(Math.ceil(e.length/4)*4,"="));u();var Et=e=>e.replace(/\u0000/g,"");u();var Ae={description:"utf8",fixedSize:null,maxSize:null,serialize(e){return new TextEncoder().encode(e)},deserialize(e,t=0){let r=new TextDecoder().decode(e.slice(t));return [Et(r),e.length]}};u();u();var ae;(function(e){e.Little="le",e.Big="be";})(ae||(ae={}));u();var ce=class extends RangeError{constructor(r,n,o,i){super(`Serializer [${r}] expected number to be between ${n} and ${o}, got ${i}.`);A(this,"name","NumberOutOfRangeError");}};u();function ue(e){let t,r=e.name;return e.size>1&&(t=!("endian"in e.options)||e.options.endian===ae.Little,r+=t?"(le)":"(be)"),{description:e.options.description??r,fixedSize:e.size,maxSize:e.size,serialize(n){e.range&&ze(e.name,e.range[0],e.range[1],n);let o=new ArrayBuffer(e.size);return e.set(new DataView(o),n,t),new Uint8Array(o)},deserialize(n,o=0){let i=n.slice(o,o+e.size);Kr("i8",i,e.size);let s=Mr(i);return [e.get(s,t),o+e.size]}}}var Wr=e=>e.buffer.slice(e.byteOffset,e.byteLength+e.byteOffset),Mr=e=>new DataView(Wr(e)),ze=(e,t,r,n)=>{if(n<t||n>r)throw new ce(e,t,r,n)},Kr=(e,t,r)=>{if(t.length===0)throw new B(e);if(t.length<r)throw new T(e,r,t.length)};u();var k=(e={})=>ue({name:"u8",size:1,range:[0,+"0xff"],set:(t,r)=>t.setUint8(0,Number(r)),get:t=>t.getUint8(0),options:e});u();var X=(e={})=>ue({name:"u32",size:4,range:[0,+"0xffffffff"],set:(t,r,n)=>t.setUint32(0,Number(r),n),get:(t,r)=>t.getUint32(0,r),options:e});u();var R=(e={})=>({description:e.description??"shortU16",fixedSize:null,maxSize:3,serialize:t=>{ze("shortU16",0,65535,t);let r=[0];for(let n=0;;n+=1){let o=t>>n*7;if(o===0)break;let i=127&o;r[n]=i,n>0&&(r[n-1]|=128);}return new Uint8Array(r)},deserialize:(t,r=0)=>{let n=0,o=0;for(;++o;){let i=o-1,s=t[r+i],a=127&s;if(n|=a<<i*7,!(s&128))break}return [n,r+o]}});u();u();var de=class extends Error{constructor(r,n,o){super(`Expected [${r}] to have ${n} items, got ${o}.`);A(this,"name","InvalidNumberOfItemsError");}},le=class extends Error{constructor(r,n){super(`The remainder of the buffer (${r} bytes) cannot be split into chunks of ${n} bytes. Serializers of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${r} modulo ${n} should be equal to zero.`);A(this,"name","InvalidArrayLikeRemainderSizeError");}},fe=class extends Error{constructor(r){super(`Unrecognized array-like serializer size: ${JSON.stringify(r)}`);A(this,"name","UnrecognizedArrayLikeSerializerSizeError");}};u();u();function M(e){return e.reduce((t,r)=>t===null||r===null?null:t+r,0)}function It(e,t,r,n){if(typeof e=="number")return [e,n];if(typeof e=="object")return e.deserialize(r,n);if(e==="remainder"){let o=M(t);if(o===null)throw new U('Serializers of "remainder" size must have fixed-size items.');let i=r.slice(n).length;if(i%o!==0)throw new le(i,o);return [i/o,n]}throw new fe(e)}function K(e){return typeof e=="object"?e.description:`${e}`}function Te(e,t){if(typeof e!="number")return null;if(e===0)return 0;let r=M(t);return r===null?null:r*e}function At(e,t){return typeof e=="object"?e.serialize(t):new Uint8Array}function _(e,t={}){let r=t.size??X();if(r==="remainder"&&e.fixedSize===null)throw new U('Serializers of "remainder" size must have fixed-size items.');return {description:t.description??`array(${e.description}; ${K(r)})`,fixedSize:Te(r,[e.fixedSize]),maxSize:Te(r,[e.maxSize]),serialize:n=>{if(typeof r=="number"&&n.length!==r)throw new de("array",r,n.length);return N([At(r,n.length),...n.map(o=>e.serialize(o))])},deserialize:(n,o=0)=>{if(typeof r=="object"&&n.slice(o).length===0)return [[],o];let[i,s]=It(r,[e.fixedSize],n,o);o=s;let a=[];for(let c=0;c<i;c+=1){let[l,f]=e.deserialize(n,o);a.push(l),o=f;}return [a,o]}}}u();function pe(e={}){let t=e.size??"variable",r=e.description??`bytes(${K(t)})`,n={description:r,fixedSize:null,maxSize:null,serialize:o=>new Uint8Array(o),deserialize:(o,i=0)=>{let s=o.slice(i);return [s,i+s.length]}};return t==="variable"?n:typeof t=="number"?J(n,t,r):{description:r,fixedSize:null,maxSize:null,serialize:o=>{let i=n.serialize(o),s=t.serialize(i.length);return N([s,i])},deserialize:(o,i=0)=>{if(o.slice(i).length===0)throw new B("bytes");let[s,a]=t.deserialize(o,i),c=Number(s);i=a;let l=o.slice(i,i+c);if(l.length<c)throw new T("bytes",c,l.length);let[f,p]=n.deserialize(l);return i+=p,[f,i]}}}u();function ve(e={}){let t=e.size??X(),r=e.encoding??Ae,n=e.description??`string(${r.description}; ${K(t)})`;return t==="variable"?{...r,description:n}:typeof t=="number"?J(r,t,n):{description:n,fixedSize:null,maxSize:null,serialize:o=>{let i=r.serialize(o),s=t.serialize(i.length);return N([s,i])},deserialize:(o,i=0)=>{if(o.slice(i).length===0)throw new B("string");let[s,a]=t.deserialize(o,i),c=Number(s);i=a;let l=o.slice(i,i+c);if(l.length<c)throw new T("string",c,l.length);let[f,p]=r.deserialize(l);return i+=p,[f,i]}}}u();function O(e,t={}){let r=e.map(([n,o])=>`${String(n)}: ${o.description}`).join(", ");return {description:t.description??`struct(${r})`,fixedSize:M(e.map(([,n])=>n.fixedSize)),maxSize:M(e.map(([,n])=>n.maxSize)),serialize:n=>{let o=e.map(([i,s])=>s.serialize(n[i]));return N(o)},deserialize:(n,o=0)=>{let i={};return e.forEach(([s,a])=>{let[c,l]=a.deserialize(n,o);o=l,i[s]=c;}),[i,o]}}}function ee(e){if("signatures"in e){let{signatures:t,...r}=e;return r}else return e}function Ls(e){try{if(e.length<32||e.length>44)throw new Error("Expected input string to decode to a byte array of length 32.");let r=D.serialize(e).byteLength;if(r!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${r}`)}catch(t){throw new Error(`\`${e}\` is not a blockhash`,{cause:t})}}function Us(e,t){if("lifetimeConstraint"in t&&t.lifetimeConstraint.blockhash===e.blockhash&&t.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight)return t;let r={...ee(t),lifetimeConstraint:e};return Object.freeze(r),r}function Fs({version:e}){let t={instructions:[],version:e};return Object.freeze(t),t}var v=(e=>(e[e.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",e[e.READONLY_SIGNER=2]="READONLY_SIGNER",e[e.WRITABLE=1]="WRITABLE",e[e.READONLY=0]="READONLY",e))(v||{}),Hr=1;function Z(e){return e>=2}function Q(e){return (e&Hr)!==0}function zt(e,t){return e|t}var Ct="SysvarRecentB1ockHashes11111111111111111111",Rt="11111111111111111111111111111111";function $s(e){if(!Nt(e))throw new Error("Transaction is not a durable nonce transaction")}function Gr(e,t){return {accounts:[{address:e,role:v.WRITABLE},{address:Ct,role:v.READONLY},{address:t,role:v.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:Rt}}function jr(e){return e.programAddress===Rt&&e.data!=null&&Vr(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===v.WRITABLE&&e.accounts[1].address===Ct&&e.accounts[1].role===v.READONLY&&e.accounts[2].address!=null&&e.accounts[2].role===v.READONLY_SIGNER}function Vr(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function Nt(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&jr(e.instructions[0])}function Ws({nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:r},n){let o=Nt(n);if(o&&n.lifetimeConstraint.nonce===e&&n.instructions[0].accounts[0].address===t&&n.instructions[0].accounts[2].address===r)return n;let i={...ee(n),instructions:[Gr(t,r),...o?n.instructions.slice(1):n.instructions],lifetimeConstraint:{nonce:e}};return Object.freeze(i),i}function Ms(e,t){if("feePayer"in t&&e===t.feePayer)return t;let r={...ee(t),feePayer:e};return Object.freeze(r),r}function Ks(e,t){let r={...ee(t),instructions:[...t.instructions,e]};return Object.freeze(r),r}function Hs(e,t){let r={...ee(t),instructions:[e,...t.instructions]};return Object.freeze(r),r}function Tt(e,t,r){e[t]=r(e[t]??{role:v.READONLY});}var w=Symbol("AddressMapTypeProperty");function qr(e,t){let r={[e]:{[w]:0,role:v.WRITABLE_SIGNER}},n=new Set;for(let o of t){Tt(r,o.programAddress,s=>{if(n.add(o.programAddress),w in s){if(Q(s.role))switch(s[w]){case 0:throw new Error(`This transaction includes an address (\`${o.programAddress}\`) which is both invoked and set as the fee payer. Program addresses may not pay fees.`);default:throw new Error(`This transaction includes an address (\`${o.programAddress}\`) which is both invoked and marked writable. Program addresses may not be writable.`)}if(s[w]===2)return s}return {[w]:2,role:v.READONLY}});let i;if(o.accounts)for(let s of o.accounts)Tt(r,s.address,a=>{let{address:c,...l}=s;if(w in a)switch(a[w]){case 0:return a;case 1:{let f=zt(a.role,l.role);if("lookupTableAddress"in l){if(a.lookupTableAddress!==l.lookupTableAddress&&(i||(i=ie()))(l.lookupTableAddress,a.lookupTableAddress)<0)return {[w]:1,...l,role:f}}else if(Z(l.role))return {[w]:2,role:f};return a.role!==f?{...a,role:f}:a}case 2:{let f=zt(a.role,l.role);if(n.has(s.address)){if(Q(l.role))throw new Error(`This transaction includes an address (\`${s.address}\`) which is both invoked and marked writable. Program addresses may not be writable.`);return a.role!==f?{...a,role:f}:a}else return "lookupTableAddress"in l&&!Z(a.role)?{...l,[w]:1,role:f}:a.role!==f?{...a,role:f}:a}}return "lookupTableAddress"in l?{...l,[w]:1}:{...l,[w]:2}});}return r}function Yr(e){let t;return Object.entries(e).sort(([n,o],[i,s])=>{if(o[w]!==s[w]){if(o[w]===0)return -1;if(s[w]===0)return 1;if(o[w]===2)return -1;if(s[w]===2)return 1}let a=Z(o.role);if(a!==Z(s.role))return a?-1:1;let c=Q(o.role);return c!==Q(s.role)?c?-1:1:(t||(t=ie()),o[w]===1&&s[w]===1&&o.lookupTableAddress!==s.lookupTableAddress?t(o.lookupTableAddress,s.lookupTableAddress):t(n,i))}).map(([n,o])=>({address:n,...o}))}function Jr(e){var t;let r={};for(let n of e){if(!("lookupTableAddress"in n))continue;let o=r[t=n.lookupTableAddress]||(r[t]={readableIndices:[],writableIndices:[]});n.role===v.WRITABLE?o.writableIndices.push(n.addressIndex):o.readableIndices.push(n.addressIndex);}return Object.keys(r).sort(ie()).map(n=>({lookupTableAddress:n,...r[n]}))}function Xr(e){let t=0,r=0,n=0;for(let o of e){if("lookupTableAddress"in o)break;let i=Q(o.role);Z(o.role)?(n++,i||r++):i||t++;}return {numReadonlyNonSignerAccounts:t,numReadonlySignerAccounts:r,numSignerAccounts:n}}function Zr(e){let t={};for(let[r,n]of e.entries())t[n.address]=r;return t}function Qr(e,t){let r=Zr(t);return e.map(({accounts:n,data:o,programAddress:i})=>({programAddressIndex:r[i],...n?{accountIndices:n.map(({address:s})=>r[s])}:null,...o?{data:o}:null}))}function en(e){return "nonce"in e?e.nonce:e.blockhash}function tn(e){let t=e.findIndex(n=>"lookupTableAddress"in n);return (t===-1?e:e.slice(0,t)).map(({address:n})=>n)}function Bt(e){let t=qr(e.feePayer,e.instructions),r=Yr(t);return {...e.version!=="legacy"?{addressTableLookups:Jr(r)}:null,header:Xr(r),instructions:Qr(e.instructions,r),lifetimeToken:en(e.lifetimeConstraint),staticAccounts:tn(r),version:e.version}}function rn(e){let t=Bt(e),r;if("signatures"in e){r=[];for(let n=0;n<t.header.numSignerAccounts;n++)r[n]=e.signatures[t.staticAccounts[n]]??new Uint8Array(Array(64).fill(0));}else r=Array(t.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));return {compiledMessage:t,signatures:r}}function nn(e){let t=Y();return {description:e?.description??t.description,deserialize:t.decode,fixedSize:t.fixedSize,maxSize:t.maxSize,serialize:t.encode}}function on(){return O([["lookupTableAddress",nn(void 0)],["writableIndices",_(k(),{...null,size:R()})],["readableIndices",_(k(),{...void 0,size:R()})]],void 0)}function sn(){return O([["numSignerAccounts",k(void 0)],["numReadonlySignerAccounts",k(void 0)],["numReadonlyNonSignerAccounts",k(void 0)]],void 0)}function an(){return $(O([["programAddressIndex",k(void 0)],["accountIndices",_(k({description:""}),{description:"",size:R()})],["data",pe({description:"",size:R()})]]),e=>e.accountIndices!==void 0&&e.data!==void 0?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)},e=>{if(e.accountIndices.length&&e.data.byteLength)return e;let{accountIndices:t,data:r,...n}=e;return {...n,...t.length?{accountIndices:t}:null,...r.byteLength?{data:r}:null}})}var Ce=128,kt={description:"",fixedSize:null,maxSize:1};function cn(e,t=0){let r=e[t];return r&Ce?[r^Ce,t+1]:["legacy",t]}function un(e){if(e==="legacy")return new Uint8Array;if(e<0||e>127)throw new Error(`Transaction version must be in the range [0, 127]. \`${e}\` given.`);return new Uint8Array([e|Ce])}function dn(){return {...kt,decode:cn}}function ln(){return {...kt,encode:un}}function fn(){return F(ln(),dn())}function pn(e,t){let r=t+e[0].toUpperCase()+e.slice(1);return new Error(`No ${e} exists for ${t}. Use \`get${r}()\` if you need a ${e}, and \`get${t}Codec()\` if you need to both encode and decode ${t}`)}function _t(e){return ()=>{throw pn("decoder",e)}}var mn={description:"",fixedSize:null,maxSize:null};function gn(e){return e.version==="legacy"?O(vt()).serialize(e):$(O([...vt(),["addressTableLookups",yn()]]),t=>t.version==="legacy"?t:{...t,addressTableLookups:t.addressTableLookups??[]}).serialize(e)}function bn(){let e=Y();return {description:e.description,deserialize:e.decode,fixedSize:e.fixedSize,maxSize:e.maxSize,serialize:e.encode}}function hn(){let e=fn();return {description:e.description,deserialize:e.decode,fixedSize:e.fixedSize,maxSize:e.maxSize,serialize:e.encode}}function vt(){return [["version",hn()],["header",sn()],["staticAccounts",_(bn(),{description:"",size:R()})],["lifetimeToken",ve({description:"",encoding:D,size:32})],["instructions",_(an(),{description:"",size:R()})]]}function yn(){return _(on(),{...null,size:R()})}function Pt(){return {...mn,deserialize:_t("CompiledMessage"),serialize:gn}}var Sn={description:"",fixedSize:null,maxSize:null};function wn(e){let t=rn(e);return O([["signatures",_(pe({size:64}),{...null,size:R()})],["compiledMessage",Pt()]]).serialize(t)}function xn(){return {...Sn,deserialize:_t("CompiledMessage"),serialize:wn}}function En(e){try{if(e.length<64||e.length>88)throw new Error("Expected input string to decode to a byte array of length 64.");let r=D.serialize(e).byteLength;if(r!==64)throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${r}`)}catch(t){throw new Error(`\`${e}\` is not a transaction signature`,{cause:t})}}function Gs(e){return !(e.length<64||e.length>88||D.serialize(e).byteLength!==64)}async function In(e,t){let r=Pt().serialize(e);return await yt(t,r)}function Dt(e){let t=e.signatures[e.feePayer];if(!t)throw new Error("Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.");return t}async function js(e,t){let r=Bt(t),n="signatures"in t?{...t.signatures}:{},o=await Promise.all(e.map(s=>Promise.all([bt(s.publicKey),In(r,s.privateKey)])));for(let[s,a]of o)n[s]=a;let i={...t,signatures:n};return Object.freeze(i),i}function Vs(e){return En(e),e}function qs(e){let t=xn().serialize(e);return btoa(String.fromCharCode(...t))}u();u();function H(e,...t){return t.reduce((r,n)=>n(r),e)}u();function Ot(e){switch(e){case"finalized":return 2;case"confirmed":return 1;case"processed":return 0;default:return (t=>{throw new Error(`Unrecognized commitment \`${e}\`.`)})()}}function Ut(e,t){return e===t?0:Ot(e)<Ot(t)?-1:1}function Be(e,t,r){if(Array.isArray(e))return e.map((n,o)=>Be(n,[...t,o],r));if(typeof e=="object"&&e!==null){let n={};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=Be(e[o],[...t,o],r));return n}else return typeof e=="bigint"?(r&&(e>Number.MAX_SAFE_INTEGER||e<-Number.MAX_SAFE_INTEGER)&&r(t,e),Number(e)):e}function Ft(e,t){return Be(e,[],t)}var d={},ke=[["data","parsed","info","tokenAmount","decimals"],["data","parsed","info","tokenAmount","uiAmount"],["data","parsed","info","rentExemptReserve","decimals"],["data","parsed","info","rentExemptReserve","uiAmount"],["data","parsed","info","delegatedAmount","decimals"],["data","parsed","info","delegatedAmount","uiAmount"],["data","parsed","info","extensions",d,"state","olderTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",d,"state","newerTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",d,"state","preUpdateAverageRate"],["data","parsed","info","extensions",d,"state","currentRate"]],G=[...ke,["data","parsed","info","lastExtendedSlotStartIndex"],["data","parsed","info","slashPenalty"],["data","parsed","info","warmupCooldownRate"],["data","parsed","info","decimals"],["data","parsed","info","numRequiredSigners"],["data","parsed","info","numValidSigners"],["data","parsed","info","stake","delegation","warmupCooldownRate"],["data","parsed","info","exemptionThreshold"],["data","parsed","info","burnPercent"],["data","parsed","info","commission"],["data","parsed","info","votes",d,"confirmationCount"]],Re,Ne;function An(){return Re||(Re={accountNotifications:G.map(e=>["value",...e]),blockNotifications:[["value","block","blockTime"],["value","block","transactions",d,"meta","preTokenBalances",d,"accountIndex"],["value","block","transactions",d,"meta","preTokenBalances",d,"uiTokenAmount","decimals"],["value","block","transactions",d,"meta","postTokenBalances",d,"accountIndex"],["value","block","transactions",d,"meta","postTokenBalances",d,"uiTokenAmount","decimals"],["value","block","transactions",d,"meta","rewards",d,"commission"],["value","block","transactions",d,"meta","innerInstructions",d,"index"],["value","block","transactions",d,"meta","innerInstructions",d,"instructions",d,"programIdIndex"],["value","block","transactions",d,"meta","innerInstructions",d,"instructions",d,"accounts",d],["value","block","transactions",d,"transaction","message","addressTableLookups",d,"writableIndexes",d],["value","block","transactions",d,"transaction","message","addressTableLookups",d,"readonlyIndexes",d],["value","block","transactions",d,"transaction","message","instructions",d,"programIdIndex"],["value","block","transactions",d,"transaction","message","instructions",d,"accounts",d],["value","block","transactions",d,"transaction","message","header","numReadonlySignedAccounts"],["value","block","transactions",d,"transaction","message","header","numReadonlyUnsignedAccounts"],["value","block","transactions",d,"transaction","message","header","numRequiredSignatures"],["value","block","rewards",d,"commission"]],programNotifications:G.flatMap(e=>[["value",d,"account",...e],[d,"account",...e]])}),Re}function zn(){return Ne||(Ne={getAccountInfo:G.map(e=>["value",...e]),getBlock:[["blockTime"],["transactions",d,"meta","preTokenBalances",d,"accountIndex"],["transactions",d,"meta","preTokenBalances",d,"uiTokenAmount","decimals"],["transactions",d,"meta","postTokenBalances",d,"accountIndex"],["transactions",d,"meta","postTokenBalances",d,"uiTokenAmount","decimals"],["transactions",d,"meta","rewards",d,"commission"],["transactions",d,"meta","innerInstructions",d,"index"],["transactions",d,"meta","innerInstructions",d,"instructions",d,"programIdIndex"],["transactions",d,"meta","innerInstructions",d,"instructions",d,"accounts",d],["transactions",d,"transaction","message","addressTableLookups",d,"writableIndexes",d],["transactions",d,"transaction","message","addressTableLookups",d,"readonlyIndexes",d],["transactions",d,"transaction","message","instructions",d,"programIdIndex"],["transactions",d,"transaction","message","instructions",d,"accounts",d],["transactions",d,"transaction","message","header","numReadonlySignedAccounts"],["transactions",d,"transaction","message","header","numReadonlyUnsignedAccounts"],["transactions",d,"transaction","message","header","numRequiredSignatures"],["rewards",d,"commission"]],getBlockTime:[[]],getClusterNodes:[[d,"featureSet"],[d,"shredVersion"]],getInflationGovernor:[["initial"],["foundation"],["foundationTerm"],["taper"],["terminal"]],getInflationRate:[["foundation"],["total"],["validator"]],getInflationReward:[[d,"commission"]],getMultipleAccounts:G.map(e=>["value",d,...e]),getProgramAccounts:G.flatMap(e=>[["value",d,"account",...e],[d,"account",...e]]),getRecentPerformanceSamples:[[d,"samplePeriodSecs"]],getTokenAccountBalance:[["value","decimals"],["value","uiAmount"]],getTokenAccountsByDelegate:ke.map(e=>["value",d,"account",...e]),getTokenAccountsByOwner:ke.map(e=>["value",d,"account",...e]),getTokenLargestAccounts:[["value",d,"decimals"],["value",d,"uiAmount"]],getTokenSupply:[["value","decimals"],["value","uiAmount"]],getTransaction:[["meta","preTokenBalances",d,"accountIndex"],["meta","preTokenBalances",d,"uiTokenAmount","decimals"],["meta","postTokenBalances",d,"accountIndex"],["meta","postTokenBalances",d,"uiTokenAmount","decimals"],["meta","rewards",d,"commission"],["meta","innerInstructions",d,"index"],["meta","innerInstructions",d,"instructions",d,"programIdIndex"],["meta","innerInstructions",d,"instructions",d,"accounts",d],["transaction","message","addressTableLookups",d,"writableIndexes",d],["transaction","message","addressTableLookups",d,"readonlyIndexes",d],["transaction","message","instructions",d,"programIdIndex"],["transaction","message","instructions",d,"accounts",d],["transaction","message","header","numReadonlySignedAccounts"],["transaction","message","header","numReadonlyUnsignedAccounts"],["transaction","message","header","numRequiredSignatures"]],getVersion:[["feature-set"]],getVoteAccounts:[["current",d,"commission"],["delinquent",d,"commission"]],simulateTransaction:G.map(e=>["value","accounts",d,...e])}),Ne}function Lt(e,t){return e.filter(r=>r[0]===d&&typeof t=="number"||r[0]===t).map(r=>r.slice(1))}function me(e,t){if(Array.isArray(e))return e.map((r,n)=>{let o=Lt(t,n);return me(r,o)});if(typeof e=="object"&&e!==null){let r={};for(let[n,o]of Object.entries(e)){let i=Lt(t,n);r[n]=me(o,i);}return r}else return typeof e=="number"&&t.length===0&&Number.isInteger(e)?BigInt(e):e}function Tn(e,t){let r=t?zn()[t]:void 0;return me(e,r??[])}function vn(e,t){let r=t?An()[t]:void 0;return me(e,r??[])}function $t(e){return new Proxy({},{defineProperty(){return !1},deleteProperty(){return !1},get(...t){let[r,n]=t,o=n.toString();return function(...i){let s=e?.onIntegerOverflow,a=Ft(i,s?(c,l)=>s(o,c,l):void 0);return {methodName:o,params:a,responseProcessor:c=>Tn(c,o)}}}})}function _e(e){return new Proxy({},{defineProperty(){return !1},deleteProperty(){return !1},get(...t){let[r,n]=t,o=n.toString();return function(...i){let s=e?.onIntegerOverflow;return {params:Ft(i,s?(c,l)=>s(o,c,l):void 0),responseProcessor:c=>vn(c,o),subscribeMethodName:o.replace(/Notifications$/,"Subscribe"),unsubscribeMethodName:o.replace(/Notifications$/,"Unsubscribe")}}}})}function Wt(e){return _e(e)}u();var Kt=class extends Error{constructor(e){super(`JSON-RPC 2.0 error (${e.code}): ${e.message}`),Error.captureStackTrace(this,this.constructor),this.code=e.code,this.data=e.data;}get name(){return "SolanaJsonRpcError"}},Pe=0;function Cn(){let e=Pe;return Pe=(Pe+1)%Number.MAX_SAFE_INTEGER,e}function Oe(e,t){return {id:Cn(),jsonrpc:"2.0",method:e,params:t}}function Rn(e,t){return {async send(r){let{methodName:n,params:o,responseProcessor:i}=t,s=Oe(n,o),a=await e.transport({payload:s,signal:r?.abortSignal});if("error"in a)throw new Kt(a.error);return i?i(a.result):a.result}}}function Nn(e){return new Proxy(e.api,{defineProperty(){return !1},deleteProperty(){return !1},get(t,r,n){return function(...o){let i=r.toString(),s=Reflect.get(t,i,n),a=s?s(...o):{methodName:i,params:o};return Rn(e,a)}}})}function Ht(e){return Nn(e)}function Bn(e,t){(async()=>{try{for await(let r of e);}catch{}finally{t();}})();}function kn(e,{params:t,subscribeMethodName:r,unsubscribeMethodName:n,responseProcessor:o}){return {async subscribe({abortSignal:i}){i.throwIfAborted();let s;function a(){if(s!==void 0){let g=Oe(n,[s]);f.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(g).finally(()=>{c.abort();});}else c.abort();}i.addEventListener("abort",a);let c=new AbortController,l=Oe(r,t),f=await e.transport({payload:l,signal:c.signal});function p(){i.removeEventListener("abort",a);}Bn(f,p);for await(let g of f)if("id"in g&&g.id===l.id){if("error"in g)throw new Kt(g.error);s=g.result;break}if(s==null)throw new Error("Failed to obtain a subscription id from the server");return {async*[Symbol.asyncIterator](){for await(let g of f){if(!("params"in g)||g.params.subscription!==s)continue;let y=g.params.result;yield o?o(y):y;}}}}}}function _n(e){return new Proxy(e.api,{defineProperty(){return !1},deleteProperty(){return !1},get(t,r,n){return function(...o){let i=r.toString(),s=Reflect.get(t,i,n);if(r.toString().endsWith("Notifications")===!1&&!s)throw new Error("Either the notification name must end in 'Notifications' or the API must supply a subscription creator function to map between the notification name and the subscribe/unsubscribe method names.");let a=s?s(...o):{params:o,subscribeMethodName:i.replace(/Notifications$/,"Subscribe"),unsubscribeMethodName:i.replace(/Notifications$/,"Unsubscribe")};return kn(e,a)}}})}function Le(e){return _n(e)}var Pn=globalThis.fetch,Dn=class extends Error{constructor(e){super(`HTTP error (${e.statusCode}): ${e.message}`),Error.captureStackTrace(this,this.constructor),this.statusCode=e.statusCode;}get name(){return "SolanaHttpError"}};function Fn(e){let t={};for(let r in e)t[r.toLowerCase()]=e[r];return t}function Gt({httpAgentNodeOnly:e,headers:t,url:r}){let n=void 0;let o=t&&Fn(t);return async function({payload:s,signal:a}){let c=JSON.stringify(s),l={agent:n,body:c,headers:{...o,accept:"application/json","content-length":c.length.toString(),"content-type":"application/json; charset=utf-8"},method:"POST",signal:a},f=await Pn(r,l);if(!f.ok)throw new Dn({message:f.statusText,statusCode:f.status});return await f.json()}}var te=globalThis.WebSocket,Mt=Symbol(void 0);async function $n({sendBufferHighWatermark:e,signal:t,url:r}){return new Promise((n,o)=>{t.addEventListener("abort",a,{once:!0});let i=new Map;function s(h){let S=[...i.values()].filter(E=>E.__hasPolled).map(({onError:E})=>E);i.clear(),S.forEach(E=>{try{E(h);}catch{}});}function a(){s(Mt),b.readyState!==te.CLOSED&&b.readyState!==te.CLOSING&&b.close(1e3);}function c(h){p?.onCancel(),t.removeEventListener("abort",a),b.removeEventListener("close",c),b.removeEventListener("error",l),b.removeEventListener("open",g),b.removeEventListener("message",y),s(h);}function l(h){f||o(new Error("WebSocket failed to connect",{cause:h}));}let f=!1,p;function g(){f=!0,n({async send(h){let S=JSON.stringify(h);if(!p&&b.readyState===te.OPEN&&b.bufferedAmount>e){let E,P=new Promise((j,or)=>{let Me=setInterval(()=>{(b.readyState!==te.OPEN||!(b.bufferedAmount>e))&&(clearInterval(Me),p=void 0,j());},16);E=()=>{p=void 0,clearInterval(Me),or(new Error("WebSocket was closed before payload could be sent"));};});p={onCancel:E,promise:P};}p&&await p.promise,b.send(S);},async*[Symbol.asyncIterator](){let h=Symbol();i.set(h,{__hasPolled:!1,queuedMessages:[]});try{for(;;){let S=i.get(h);if(!S)throw new Error("Invariant: WebSocket message iterator is missing state storage");if(S.__hasPolled)throw new Error("Invariant: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise");let E=S.queuedMessages;if(E.length)S.queuedMessages=[],yield*E;else try{yield await new Promise((P,j)=>{i.set(h,{__hasPolled:!0,onError:j,onMessage:P});});}catch(P){if(P===Mt)return;throw new Error("WebSocket connection closed",{cause:P})}}}finally{i.delete(h);}}});}function y({data:h}){let S=JSON.parse(h);i.forEach((E,P)=>{if(E.__hasPolled){let{onMessage:j}=E;i.set(P,{__hasPolled:!1,queuedMessages:[]}),j(S);}else E.queuedMessages.push(S);});}let b=new te(r);b.addEventListener("close",c),b.addEventListener("error",l),b.addEventListener("open",g),b.addEventListener("message",y);})}function jt({sendBufferHighWatermark:e,url:t}){if(/^wss?:/i.test(t)===!1){let r=t.match(/^([^:]+):/);throw new DOMException(r?`Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. '${r[1]}:' is not allowed.`:`Failed to construct 'WebSocket': The URL '${t}' is invalid.`)}return async function({payload:n,signal:o}){o?.throwIfAborted();let i=await $n({sendBufferHighWatermark:e,signal:o,url:t});return o?.throwIfAborted(),await i.send(n),{[Symbol.asyncIterator]:i[Symbol.asyncIterator].bind(i),send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:i.send.bind(i)}}}var Yt=Ke(Ue(),1);u();u();var ge=class extends Error{constructor(r,n,o){let i=(typeof n[0]=="number"?n[0]:parseInt(n[0],10))+1,s="",a=i%10,c=i%100;a==1&&c!=11?s=i+"st":a==2&&c!=12?s=i+"nd":a==3&&c!=13?s=i+"rd":s=i+"th";let l=n.length>1?n.slice(1).map(f=>typeof f=="number"?`[${f}]`:f).join("."):null;super(`The ${s} argument to the \`${r}\` RPC method${l?` at path \`${l}\``:""} was \`${o}\`. This number is unsafe for use with the Solana JSON-RPC because it exceeds \`Number.MAX_SAFE_INTEGER\`.`);this.keyPath=n,this.methodName=r,this.value=o;}get name(){return "SolanaJsonRpcIntegerOverflowError"}};var be={onIntegerOverflow(e,t,r){throw new ge(e,t,r)}};u();u();function Kn(e,t){(async()=>{try{for await(let r of e);}catch{}finally{t();}})();}function he({getAbortSignalFromInputArgs:e,getCacheEntryMissingError:t,getCacheKeyFromInputArgs:r,onCacheHit:n,onCreateIterable:o}){let i=new Map;function s(a){let c=i.get(a);if(!c)throw t(a);return c}return async(...a)=>{let c=r(...a),l=e(...a);if(c===void 0)return await o(l,...a);let f=()=>{i.delete(c),l.removeEventListener("abort",p);},p=()=>{let g=s(c);g.purgeScheduled!==!0&&(g.purgeScheduled=!0,globalThis.queueMicrotask(()=>{g.purgeScheduled=!1,g.referenceCount===0&&(g.abortController.abort(),f());})),g.referenceCount--;};l.addEventListener("abort",p);try{let g=i.get(c);if(g){g.referenceCount++;let y=g.iterable,b="then"in y?await y:y;return await n(b,...a),b}else {let y=new AbortController,b=o(y.signal,...a),h={abortController:y,iterable:b,purgeScheduled:!1,referenceCount:1};i.set(c,h);let S=await b;return Kn(S,f),h.iterable=S,S}}catch(g){throw f(),g}}}var Fe=Symbol(void 0);function Hn(e,t){(async()=>{try{for await(let r of e);}catch{}finally{t();}})();}function qt({getDeduplicationKey:e,rpcSubscriptions:t}){let r=new Map;return new Proxy(t,{defineProperty(){return !1},deleteProperty(){return !1},get(n,o,i){let s=Reflect.get(n,o,i);return typeof s!="function"?s:function(...a){let c=e(o,a);if(c===void 0)return s(...a);if(r.has(c))return r.get(c);let l=he({getAbortSignalFromInputArgs:({abortSignal:p})=>p,getCacheEntryMissingError(p){return new Error(`Found no cache entry for subscription with deduplication key \`${p?.toString()}\``)},getCacheKeyFromInputArgs:()=>c,async onCacheHit(p,g){},async onCreateIterable(p,g){let b=await s(...a).subscribe({...g,abortSignal:p});return Hn(b,()=>{r.delete(c);}),b}}),f={async subscribe(...p){let g=await l(...p),{abortSignal:y}=p[0],b;return {...g,async*[Symbol.asyncIterator](){b||(b=y.aborted?Promise.reject(Fe):new Promise((h,S)=>{y.addEventListener("abort",()=>{S(Fe);});}));try{let h=g[Symbol.asyncIterator]();for(;;){let S=await Promise.race([h.next(),b]);if(S.done)return;yield S.value;}}catch(h){if(h===Fe)return;throw r.delete(c),h}}}}};return r.set(c,f),f}}})}function za(e){return Ht({...e,api:$t(be)})}function Ta(e){return H(Le({...e,api:_e(be)}),t=>qt({getDeduplicationKey:(...r)=>(0, Yt.default)(r),rpcSubscriptions:t}))}function va(e){return Le({...e,api:Wt(be)})}u();u();function Jt(e,t){let r;return async function(o){let{payload:i,signal:s}=o,a=t(i);if(a===void 0)return await e(o);if(r||(Promise.resolve().then(()=>{r=void 0;}),r={}),r[a]==null){let l=new AbortController;r[a]={abortController:l,numConsumers:0,responsePromise:e({...o,signal:l.signal})};}let c=r[a];if(c.numConsumers++,s){let l=c.responsePromise;return await new Promise((f,p)=>{let g=y=>{s.removeEventListener("abort",g),c.numConsumers-=1,c.numConsumers===0&&c.abortController.abort();let b=new DOMException(y.target.reason,"AbortError");p(b);};s.addEventListener("abort",g),l.then(f).finally(()=>{s.removeEventListener("abort",g);});})}else return await c.responsePromise}}u();var Xt=Ke(Ue(),1);function Gn(e){return e==null||typeof e!="object"||Array.isArray(e)?!1:"jsonrpc"in e&&e.jsonrpc==="2.0"&&"method"in e&&typeof e.method=="string"&&"params"in e}function Zt(e){return Gn(e)?(0, Xt.default)([e.method,e.params]):void 0}function jn(e){let t={};for(let r in e)t[r.toLowerCase()]=e[r];return t}function Ua(e){return H(Gt({...e,headers:{...e.headers?jn(e.headers):void 0,"solana-client":"js/2.0.0-development"}}),t=>Jt(t,Zt))}u();u();var Vn={jsonrpc:"2.0",method:"ping"};function Qt({intervalMs:e,transport:t}){let r=new Map;return async(...n)=>{let o=await t(...n),i;function s(){o.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(Vn);}function a(){clearInterval(i),i=setInterval(s,e);}if(r.has(o)===!1){r.set(o,{[Symbol.asyncIterator]:o[Symbol.asyncIterator].bind(o),send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:(...f)=>(a(),o.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(...f))}),(async()=>{try{for await(let f of o)a();}catch{}finally{r.delete(o),clearInterval(i),c&&globalThis.window.removeEventListener("offline",c),l&&globalThis.window.removeEventListener("online",l);}})(),globalThis.navigator.onLine&&a();let c,l;c=()=>{clearInterval(i);},l=()=>{s(),a();},globalThis.window.addEventListener("offline",c),globalThis.window.addEventListener("online",l);}return r.get(o)}}u();var qn=Symbol(void 0);function er({getShard:e,transport:t}){return he({getAbortSignalFromInputArgs:({signal:r})=>r,getCacheEntryMissingError(r){return new Error(`Found no cache entry for connection with shard key \`${r?.toString()}\``)},getCacheKeyFromInputArgs:({payload:r})=>e?e(r):qn,onCacheHit:(r,{payload:n})=>r.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(n),onCreateIterable:(r,n)=>t({...n,signal:r})})}function Ja(e){let{getShard:t,intervalMs:r,...n}=e;return H(jt({...n,sendBufferHighWatermark:e.sendBufferHighWatermark??131072}),o=>Qt({intervalMs:r??5e3,transport:o}),o=>er({getShard:t,transport:o}))}u();u();function tr(e){return async function({abortSignal:r,lastValidBlockHeight:n}){let o=new AbortController;function i(){o.abort();}r.addEventListener("abort",i,{signal:o.signal});let s=await e.slotNotifications().subscribe({abortSignal:o.signal});try{for await(let a of s)if(a.slot>n)throw new Error("The network has progressed past the last block for which this transaction could have committed.")}finally{o.abort();}}}u();var $e=4+4+32;function rr(e,t){return async function({abortSignal:n,commitment:o,currentNonceValue:i,nonceAccountAddress:s}){let a=new AbortController;function c(){a.abort();}n.addEventListener("abort",c,{signal:a.signal});let l=await t.accountNotifications(s,{commitment:o,encoding:"base64"}).subscribe({abortSignal:a.signal});function f([y]){let h=Ie.serialize(y).slice($e,$e+32);return D.deserialize(h)[0]}let p=(async()=>{for await(let y of l){let b=f(y.value.data);if(b!==i)throw new Error(`The nonce \`${i}\` is no longer valid. It has advanced to \`${b}\`.`)}})(),g=(async()=>{let{value:y}=await e.getAccountInfo(s,{commitment:o,dataSlice:{length:32,offset:$e},encoding:"base58"}).send({abortSignal:a.signal});if(!y)throw new Error(`No nonce account could be found at address \`${s}\`.`);let b=y.data[0];if(b!==i)throw new Error(`The nonce \`${i}\` is no longer valid. It has advanced to \`${b}\`.`);await new Promise(()=>{});})();try{return await Promise.race([p,g])}finally{a.abort();}}}u();function We(e,t){return async function({abortSignal:n,commitment:o,signature:i}){let s=new AbortController;function a(){s.abort();}n.addEventListener("abort",a,{signal:s.signal});let c=await t.signatureNotifications(i,{commitment:o}).subscribe({abortSignal:s.signal}),l=(async()=>{for await(let p of c){if(p.value.err)throw new Error(`The transaction with signature \`${i}\` failed.`,{cause:p.value.err});return}})(),f=(async()=>{let{value:p}=await e.getSignatureStatuses([i]).send({abortSignal:s.signal}),g=p[0];g&&g.confirmationStatus&&Ut(g.confirmationStatus,o)>=0||await new Promise(()=>{});})();try{return await Promise.race([l,f])}finally{s.abort();}}}async function nr(e,t){let{abortSignal:r,commitment:n,getSignatureConfirmationPromise:o,transaction:i}=e;r.throwIfAborted();let s=Dt(i),a=new AbortController;function c(){a.abort();}r.addEventListener("abort",c,{signal:a.signal});try{let l=t({...e,abortSignal:a.signal});return await Promise.race([o({abortSignal:a.signal,commitment:n,signature:s}),...l])}finally{a.abort();}}function bc({rpc:e,rpcSubscriptions:t}){let r=rr(e,t),n=We(e,t);return async function(i){await Yn({...i,getNonceInvalidationPromise:r,getSignatureConfirmationPromise:n});}}function hc({rpc:e,rpcSubscriptions:t}){let r=tr(t),n=We(e,t);return async function(i){await Jn({...i,getBlockHeightExceedencePromise:r,getSignatureConfirmationPromise:n});}}async function Yn(e){await nr(e,function({abortSignal:r,commitment:n,getNonceInvalidationPromise:o,transaction:i}){return [o({abortSignal:r,commitment:n,currentNonceValue:i.lifetimeConstraint.nonce,nonceAccountAddress:i.instructions[0].accounts[0].address})]});}async function Jn(e){await nr(e,function({abortSignal:r,getBlockHeightExceedencePromise:n,transaction:o}){return [n({abortSignal:r,lastValidBlockHeight:o.lifetimeConstraint.lastValidBlockHeight})]});}
9
+ For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20`)}async function Bt(){if(X(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!="function")throw new Error("No key export implementation could be found")}async function Dt(){if(X(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!="function")throw new Error("No signing implementation could be found")}async function kt(){if(X(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.verify!="function")throw new Error("No signature verification implementation could be found")}var $e,Le;function Ue(){return $e||($e=Tt()),$e}function mr(){return Le||(Le=zt()),Le}function pr(e){return !(e.length<32||e.length>44||Ue().encode(e).byteLength!==32)}function Ot(e){try{if(e.length<32||e.length>44)throw new Error("Expected input string to decode to a byte array of length 32.");let r=Ue().encode(e).byteLength;if(r!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${r}`)}catch(t){throw new Error(`\`${e}\` is not a base-58 encoded address`,{cause:t})}}function gr(e){return Ot(e),e}function Fe(e){return fe(It({description:e?.description??"Base58EncodedAddress",encoding:Ue(),size:32}),t=>gr(t))}function be(e){return Ct({description:e?.description??"Base58EncodedAddress",encoding:mr(),size:32})}function Se(e){return I(Fe(e),be(e))}function he(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}var br=37095705934669439343138083508754565189542113879843219016388785533085940283555n,A=57896044618658097711785492504343953926634992332820282019728792003956564819949n,Pt=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function z(e){let t=e%A;return t>=0n?t:A+t}function v(e,t){let n=e;for(;t-- >0n;)n*=n,n%=A;return n}function Sr(e){let n=e*e%A*e%A,r=v(n,2n)*n%A,o=v(r,1n)*e%A,i=v(o,5n)*o%A,a=v(i,10n)*i%A,s=v(a,20n)*a%A,c=v(s,40n)*s%A,l=v(c,80n)*c%A,f=v(l,80n)*c%A,m=v(f,10n)*i%A;return v(m,2n)*e%A}function hr(e,t){let n=z(t*t*t),r=z(n*n*t),o=Sr(e*r),i=z(e*n*o),a=z(t*i*i),s=i,c=z(i*Pt),l=a===e,f=a===z(-e),m=a===z(-e*Pt);return l&&(i=s),(f||m)&&(i=c),(z(i)&1n)===1n&&(i=z(-i)),!l&&!f?null:i}function yr(e,t){let n=z(e*e),r=z(n-1n),o=z(br*n+1n),i=hr(r,o);if(i===null)return !1;let a=(t&128)!==0;return !(i===0n&&a)}function xr(e){let t=e.toString(16);return t.length===1?`0${t}`:t}function wr(e){let n=`0x${e.reduce((r,o,i)=>`${xr(i===31?o&-129:o)}${r}`,"")}`;return BigInt(n)}async function Er(e){if(e.byteLength!==32)return !1;let t=wr(e);return yr(t,e[31])}function fi(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&typeof e[1]=="number"&&e[1]>=0&&e[1]<=255&&pr(e[0])}function mi(e){if(!(Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&typeof e[1]=="number"))throw new Error("Expected given program derived address to have the following format: [Base58EncodedAddress, ProgramDerivedAddressBump].");if(e[1]<0||e[1]>255)throw new Error(`Expected program derived address bump to be in the range [0, 255], got: ${e[1]}.`);Ot(e[0]);}var $t=32,_t=16,ge=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115],Lt=class extends Error{};async function Ar({programAddress:e,seeds:t}){if(await vt(),t.length>_t)throw new Error(`A maximum of ${_t} seeds may be supplied when creating an address`);let n,r=t.reduce((c,l,f)=>{let m=typeof l=="string"?(n||(n=new TextEncoder)).encode(l):l;if(m.byteLength>$t)throw new Error(`The seed at index ${f} exceeds the maximum length of 32 bytes`);return c.push(...m),c},[]),o=Se(),i=o.encode(e),a=await crypto.subtle.digest("SHA-256",new Uint8Array([...r,...i,...ge])),s=new Uint8Array(a);if(await Er(s))throw new Lt("Invalid seeds; point must fall off the Ed25519 curve");return o.decode(s)[0]}async function pi({programAddress:e,seeds:t}){let n=255;for(;n>0;)try{return [await Ar({programAddress:e,seeds:[...t,new Uint8Array([n])]}),n]}catch(r){if(r instanceof Lt)n--;else throw r}throw new Error("Unable to find a viable program address bump seed")}async function gi({baseAddress:e,programAddress:t,seed:n}){let{encode:r,decode:o}=Se(),i=typeof n=="string"?new TextEncoder().encode(n):n;if(i.byteLength>$t)throw new Error("The seed exceeds the maximum length of 32 bytes");let a=r(t);if(a.length>=ge.length&&a.slice(-ge.length).every((l,f)=>l===ge[f]))throw new Error("programAddress cannot end with the PDA marker");let s=await crypto.subtle.digest("SHA-256",new Uint8Array([...r(e),...i,...a])),c=new Uint8Array(s);return o(c)[0]}async function Ut(e){if(await Bt(),e.type!=="public"||e.algorithm.name!=="Ed25519")throw new Error("The `CryptoKey` must be an `Ed25519` public key");let t=await crypto.subtle.exportKey("raw",e),[n]=be().decode(new Uint8Array(t));return n}d();var Tr=(e=>(e[e.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",e[e.READONLY_SIGNER=2]="READONLY_SIGNER",e[e.WRITABLE=1]="WRITABLE",e[e.READONLY=0]="READONLY",e))(Tr||{}),Ft=2,We=1;function yi(e){return e&~Ft}function xi(e){return e&~We}function wi(e){return e>=2}function Ei(e){return (e&We)!==0}function Ai(e,t){return e|t}function Ti(e){return e|Ft}function zi(e){return e|We}d();async function vi(){return await Nt(),await crypto.subtle.generateKey("Ed25519",!1,["sign","verify"])}async function Wt(e,t){await Dt();let n=await crypto.subtle.sign("Ed25519",e,t);return new Uint8Array(n)}async function Ni(e,t,n){return await kt(),await crypto.subtle.verify("Ed25519",e,t,n)}d();d();d();d();var N=e=>{let t=e.reduce((o,i)=>o+i.length,0),n=new Uint8Array(t),r=0;return e.forEach(o=>{n.set(o,r),r+=o.length;}),n},Mt=(e,t)=>{if(e.length>=t)return e;let n=new Uint8Array(t).fill(0);return n.set(e),n},ye=(e,t)=>Mt(e.slice(0,t),t);d();var B=class extends Error{constructor(n){super(`Serializer [${n}] cannot deserialize empty buffers.`);T(this,"name","DeserializingEmptyBufferError");}},C=class extends Error{constructor(n,r,o){super(`Serializer [${n}] expected ${r} bytes, got ${o}.`);T(this,"name","NotEnoughBytesError");}},L=class extends Error{constructor(n){n??(n="Expected a fixed-size serializer, got a variable-size one.");super(n);T(this,"name","ExpectedFixedSizeSerializerError");}};d();function Z(e,t,n){return {description:n??`fixed(${t}, ${e.description})`,fixedSize:t,maxSize:t,serialize:r=>ye(e.serialize(r),t),deserialize:(r,o=0)=>{if(r=r.slice(o,o+t),r.length<t)throw new C("fixSerializer",t,r.length);e.fixedSize!==null&&(r=ye(r,e.fixedSize));let[i]=e.deserialize(r,0);return [i,o+t]}}}d();function Q(e,t,n){return {description:e.description,fixedSize:e.fixedSize,maxSize:e.maxSize,serialize:r=>e.serialize(t(r)),deserialize:(r,o=0)=>{let[i,a]=e.deserialize(r,o);return n?[n(i,r,o),a]:[i,a]}}}d();d();d();var W=class extends Error{constructor(n,r,o){let i=`Expected a string of base ${r}, got [${n}].`;super(i);T(this,"name","InvalidBaseStringError");this.cause=o;}};var Ht=e=>{let t=e.length,n=BigInt(t);return {description:`base${t}`,fixedSize:null,maxSize:null,serialize(r){if(!r.match(new RegExp(`^[${e}]*$`)))throw new W(r,t);if(r==="")return new Uint8Array;let o=[...r],i=o.findIndex(m=>m!==e[0]);i=i===-1?o.length:i;let a=Array(i).fill(0);if(i===o.length)return Uint8Array.from(a);let s=o.slice(i),c=0n,l=1n;for(let m=s.length-1;m>=0;m-=1)c+=l*BigInt(e.indexOf(s[m])),l*=n;let f=[];for(;c>0n;)f.unshift(Number(c%256n)),c/=256n;return Uint8Array.from(a.concat(f))},deserialize(r,o=0){if(r.length===0)return ["",0];let i=r.slice(o),a=i.findIndex(f=>f!==0);a=a===-1?i.length:a;let s=e[0].repeat(a);if(a===i.length)return [s,r.length];let c=i.slice(a).reduce((f,m)=>f*256n+BigInt(m),0n),l=[];for(;c>0n;)l.unshift(e[Number(c%n)]),c/=n;return [s+l.join(""),r.length]}}};d();var D=Ht("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");d();d();var Kt=(e,t)=>{let n=e.length,r=(o,i,a,s)=>{let c=[],l=0,f=0,m=(1<<a)-1;for(let g of o)for(l=l<<i|g,f+=i;f>=a;)f-=a,c.push(l>>f&m);return s&&f>0&&c.push(l<<a-f&m),c};return {description:`base${n}`,fixedSize:null,maxSize:null,serialize(o){if(!o.match(new RegExp(`^[${e}]*$`)))throw new W(o,n);if(o==="")return new Uint8Array;let i=[...o].map(s=>e.indexOf(s)),a=r(i,t,8,!1);return Uint8Array.from(a)},deserialize(o,i=0){if(o.length===0)return ["",0];let a=[...o.slice(i)];return [r(a,8,t,!0).map(c=>e[c]).join(""),o.length]}}};var Me=Q(Kt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",6),e=>e.replace(/=/g,""),e=>e.padEnd(Math.ceil(e.length/4)*4,"="));d();var jt=e=>e.replace(/\u0000/g,"");d();var He={description:"utf8",fixedSize:null,maxSize:null,serialize(e){return new TextEncoder().encode(e)},deserialize(e,t=0){let n=new TextDecoder().decode(e.slice(t));return [jt(n),e.length]}};d();d();var xe;(function(e){e.Little="le",e.Big="be";})(xe||(xe={}));d();var we=class extends RangeError{constructor(n,r,o,i){super(`Serializer [${n}] expected number to be between ${r} and ${o}, got ${i}.`);T(this,"name","NumberOutOfRangeError");}};d();function Gt(e){let t,n=e.name;return e.size>1&&(t=!("endian"in e.options)||e.options.endian===xe.Little,n+=t?"(le)":"(be)"),{description:e.options.description??n,fixedSize:e.size,maxSize:e.size,serialize(r){e.range&&Ke(e.name,e.range[0],e.range[1],r);let o=new ArrayBuffer(e.size);return e.set(new DataView(o),r,t),new Uint8Array(o)},deserialize(r,o=0){let i=r.slice(o,o+e.size);Cr("i8",i,e.size);let a=Ir(i);return [e.get(a,t),o+e.size]}}}var zr=e=>e.buffer.slice(e.byteOffset,e.byteLength+e.byteOffset),Ir=e=>new DataView(zr(e)),Ke=(e,t,n,r)=>{if(r<t||r>n)throw new we(e,t,n,r)},Cr=(e,t,n)=>{if(t.length===0)throw new B(e);if(t.length<n)throw new C(e,n,t.length)};d();var ee=(e={})=>Gt({name:"u32",size:4,range:[0,+"0xffffffff"],set:(t,n,r)=>t.setUint32(0,Number(n),r),get:(t,n)=>t.getUint32(0,n),options:e});d();var M=(e={})=>({description:e.description??"shortU16",fixedSize:null,maxSize:3,serialize:t=>{Ke("shortU16",0,65535,t);let n=[0];for(let r=0;;r+=1){let o=t>>r*7;if(o===0)break;let i=127&o;n[r]=i,r>0&&(n[r-1]|=128);}return new Uint8Array(n)},deserialize:(t,n=0)=>{let r=0,o=0;for(;++o;){let i=o-1,a=t[n+i],s=127&a;if(r|=s<<i*7,!(a&128))break}return [r,n+o]}});d();d();var Ee=class extends Error{constructor(n,r,o){super(`Expected [${n}] to have ${r} items, got ${o}.`);T(this,"name","InvalidNumberOfItemsError");}},Ae=class extends Error{constructor(n,r){super(`The remainder of the buffer (${n} bytes) cannot be split into chunks of ${r} bytes. Serializers of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${n} modulo ${r} should be equal to zero.`);T(this,"name","InvalidArrayLikeRemainderSizeError");}},Te=class extends Error{constructor(n){super(`Unrecognized array-like serializer size: ${JSON.stringify(n)}`);T(this,"name","UnrecognizedArrayLikeSerializerSizeError");}};d();d();function H(e){return e.reduce((t,n)=>t===null||n===null?null:t+n,0)}function Vt(e,t,n,r){if(typeof e=="number")return [e,r];if(typeof e=="object")return e.deserialize(n,r);if(e==="remainder"){let o=H(t);if(o===null)throw new L('Serializers of "remainder" size must have fixed-size items.');let i=n.slice(r).length;if(i%o!==0)throw new Ae(i,o);return [i/o,r]}throw new Te(e)}function K(e){return typeof e=="object"?e.description:`${e}`}function je(e,t){if(typeof e!="number")return null;if(e===0)return 0;let n=H(t);return n===null?null:n*e}function qt(e,t){return typeof e=="object"?e.serialize(t):new Uint8Array}function j(e,t={}){let n=t.size??ee();if(n==="remainder"&&e.fixedSize===null)throw new L('Serializers of "remainder" size must have fixed-size items.');return {description:t.description??`array(${e.description}; ${K(n)})`,fixedSize:je(n,[e.fixedSize]),maxSize:je(n,[e.maxSize]),serialize:r=>{if(typeof n=="number"&&r.length!==n)throw new Ee("array",n,r.length);return N([qt(n,r.length),...r.map(o=>e.serialize(o))])},deserialize:(r,o=0)=>{if(typeof n=="object"&&r.slice(o).length===0)return [[],o];let[i,a]=Vt(n,[e.fixedSize],r,o);o=a;let s=[];for(let c=0;c<i;c+=1){let[l,f]=e.deserialize(r,o);s.push(l),o=f;}return [s,o]}}}d();function Ge(e={}){let t=e.size??"variable",n=e.description??`bytes(${K(t)})`,r={description:n,fixedSize:null,maxSize:null,serialize:o=>new Uint8Array(o),deserialize:(o,i=0)=>{let a=o.slice(i);return [a,i+a.length]}};return t==="variable"?r:typeof t=="number"?Z(r,t,n):{description:n,fixedSize:null,maxSize:null,serialize:o=>{let i=r.serialize(o),a=t.serialize(i.length);return N([a,i])},deserialize:(o,i=0)=>{if(o.slice(i).length===0)throw new B("bytes");let[a,s]=t.deserialize(o,i),c=Number(a);i=s;let l=o.slice(i,i+c);if(l.length<c)throw new C("bytes",c,l.length);let[f,m]=r.deserialize(l);return i+=m,[f,i]}}}d();function Ve(e={}){let t=e.size??ee(),n=e.encoding??He,r=e.description??`string(${n.description}; ${K(t)})`;return t==="variable"?{...n,description:r}:typeof t=="number"?Z(n,t,r):{description:r,fixedSize:null,maxSize:null,serialize:o=>{let i=n.serialize(o),a=t.serialize(i.length);return N([a,i])},deserialize:(o,i=0)=>{if(o.slice(i).length===0)throw new B("string");let[a,s]=t.deserialize(o,i),c=Number(a);i=s;let l=o.slice(i,i+c);if(l.length<c)throw new C("string",c,l.length);let[f,m]=n.deserialize(l);return i+=m,[f,i]}}}d();function te(e,t={}){let n=e.map(([r,o])=>`${String(r)}: ${o.description}`).join(", ");return {description:t.description??`struct(${n})`,fixedSize:H(e.map(([,r])=>r.fixedSize)),maxSize:H(e.map(([,r])=>r.maxSize)),serialize:r=>{let o=e.map(([i,a])=>a.serialize(r[i]));return N(o)},deserialize:(r,o=0)=>{let i={};return e.forEach(([a,s])=>{let[c,l]=s.deserialize(r,o);o=l,i[a]=c;}),[i,o]}}}d();function ze(e){return e.reduce((t,n)=>t===null||n===null?null:t+n,0)}function Rr(e,t,n,r){if(typeof e=="number")return [e,r];if(typeof e=="object")return e.decode(n,r);if(e==="remainder"){let o=ze(t);if(o===null)throw new Error('Codecs of "remainder" size must have fixed-size items.');let i=n.slice(r).length;if(i%o!==0)throw new Error(`The remainder of the byte array (${i} bytes) cannot be split into chunks of ${o} bytes. Codecs of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${i} modulo ${o} should be equal to zero.`);return [i/o,r]}throw new Error(`Unrecognized array-like codec size: ${JSON.stringify(e)}`)}function vr(e){return typeof e=="object"?e.description:`${e}`}function Yt(e,t){if(typeof e!="number")return null;if(e===0)return 0;let n=ze(t);return n===null?null:n*e}function Nr(e,t){return typeof e=="object"?e.encode(t):new Uint8Array}function Br(e,t,n){if(t!==n)throw new Error(`Expected [${e}] to have ${t} items, got ${n}.`)}function Jt(e,t,n){if(t==="remainder"&&e.fixedSize===null)throw new Error('Codecs of "remainder" size must have fixed-size items.');return {description:n??`array(${e.description}; ${vr(t)})`,fixedSize:Yt(t,[e.fixedSize]),maxSize:Yt(t,[e.maxSize])}}function Ie(e,t={}){let n=t.size??me();return {...Jt(e,n,t.description),encode:r=>(typeof n=="number"&&Br("array",n,r.length),F([Nr(n,r.length),...r.map(o=>e.encode(o))]))}}function Ce(e,t={}){let n=t.size??pe();return {...Jt(e,n,t.description),decode:(r,o=0)=>{if(typeof n=="object"&&r.slice(o).length===0)return [[],o];let[i,a]=Rr(n,[e.fixedSize],r,o);o=a;let s=[];for(let c=0;c<i;c+=1){let[l,f]=e.decode(r,o);s.push(l),o=f;}return [s,o]}}}function Xt(e={}){let t=e.size??"variable",n=typeof t=="object"?t.description:`${t}`,r=e.description??`bytes(${n})`,o={description:r,encode:i=>i,fixedSize:null,maxSize:null};return t==="variable"?o:typeof t=="number"?ue(o,t,r):{...o,encode:i=>{let a=o.encode(i),s=t.encode(a.length);return F([s,a])}}}function Zt(e={}){let t=e.size??"variable",n=typeof t=="object"?t.description:`${t}`,r=e.description??`bytes(${n})`,o={decode:(i,a=0)=>{let s=i.slice(a);return [s,a+s.length]},description:r,fixedSize:null,maxSize:null};return t==="variable"?o:typeof t=="number"?le(o,t,r):{...o,decode:(i,a=0)=>{U("bytes",i,a);let[s,c]=t.decode(i,a),l=Number(s);a=c;let f=i.slice(a,a+l);P("bytes",l,f);let[m,g]=o.decode(f);return a+=g,[m,a]}}}function Qt(e,t){let n=e.map(([r,o])=>`${String(r)}: ${o.description}`).join(", ");return {description:t??`struct(${n})`,fixedSize:ze(e.map(([,r])=>r.fixedSize)),maxSize:ze(e.map(([,r])=>r.maxSize))}}function Re(e,t={}){return {...Qt(e,t.description),encode:n=>{let r=e.map(([o,i])=>i.encode(n[o]));return F(r)}}}function ve(e,t={}){return {...Qt(e,t.description),decode:(n,r=0)=>{let o={};return e.forEach(([i,a])=>{let[s,c]=a.decode(n,r);r=c,o[i]=s;}),[o,r]}}}function en(e,t={}){return I(Re(e,t),ve(e,t))}function ie(e){if("signatures"in e){let{signatures:t,...n}=e;return n}else return e}function Ls(e){try{if(e.length<32||e.length>44)throw new Error("Expected input string to decode to a byte array of length 32.");let n=D.serialize(e).byteLength;if(n!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${n}`)}catch(t){throw new Error(`\`${e}\` is not a blockhash`,{cause:t})}}function Us(e,t){if("lifetimeConstraint"in t&&t.lifetimeConstraint.blockhash===e.blockhash&&t.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight)return t;let n={...ie(t),lifetimeConstraint:e};return Object.freeze(n),n}function Fs({version:e}){let t={instructions:[],version:e};return Object.freeze(t),t}var R=(e=>(e[e.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",e[e.READONLY_SIGNER=2]="READONLY_SIGNER",e[e.WRITABLE=1]="WRITABLE",e[e.READONLY=0]="READONLY",e))(R||{}),Dr=1;function re(e){return e>=2}function oe(e){return (e&Dr)!==0}function tn(e,t){return e|t}var on="SysvarRecentB1ockHashes11111111111111111111",an="11111111111111111111111111111111";function Ws(e){if(!sn(e))throw new Error("Transaction is not a durable nonce transaction")}function kr(e,t){return {accounts:[{address:e,role:R.WRITABLE},{address:on,role:R.READONLY},{address:t,role:R.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:an}}function Pr(e){return e.programAddress===an&&e.data!=null&&_r(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===R.WRITABLE&&e.accounts[1].address===on&&e.accounts[1].role===R.READONLY&&e.accounts[2].address!=null&&e.accounts[2].role===R.READONLY_SIGNER}function _r(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function sn(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&Pr(e.instructions[0])}function Ms({nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:n},r){let o=sn(r);if(o&&r.lifetimeConstraint.nonce===e&&r.instructions[0].accounts[0].address===t&&r.instructions[0].accounts[2].address===n)return r;let i={...ie(r),instructions:[kr(t,n),...o?r.instructions.slice(1):r.instructions],lifetimeConstraint:{nonce:e}};return Object.freeze(i),i}function Hs(e,t){if("feePayer"in t&&e===t.feePayer)return t;let n={...ie(t),feePayer:e};return Object.freeze(n),n}function Ks(e,t){let n={...ie(t),instructions:[...t.instructions,e]};return Object.freeze(n),n}function js(e,t){let n={...ie(t),instructions:[e,...t.instructions]};return Object.freeze(n),n}function nn(e,t,n){e[t]=n(e[t]??{role:R.READONLY});}var x=Symbol("AddressMapTypeProperty");function Or(e,t){let n={[e]:{[x]:0,role:R.WRITABLE_SIGNER}},r=new Set;for(let o of t){nn(n,o.programAddress,a=>{if(r.add(o.programAddress),x in a){if(oe(a.role))switch(a[x]){case 0:throw new Error(`This transaction includes an address (\`${o.programAddress}\`) which is both invoked and set as the fee payer. Program addresses may not pay fees.`);default:throw new Error(`This transaction includes an address (\`${o.programAddress}\`) which is both invoked and marked writable. Program addresses may not be writable.`)}if(a[x]===2)return a}return {[x]:2,role:R.READONLY}});let i;if(o.accounts)for(let a of o.accounts)nn(n,a.address,s=>{let{address:c,...l}=a;if(x in s)switch(s[x]){case 0:return s;case 1:{let f=tn(s.role,l.role);if("lookupTableAddress"in l){if(s.lookupTableAddress!==l.lookupTableAddress&&(i||(i=he()))(l.lookupTableAddress,s.lookupTableAddress)<0)return {[x]:1,...l,role:f}}else if(re(l.role))return {[x]:2,role:f};return s.role!==f?{...s,role:f}:s}case 2:{let f=tn(s.role,l.role);if(r.has(a.address)){if(oe(l.role))throw new Error(`This transaction includes an address (\`${a.address}\`) which is both invoked and marked writable. Program addresses may not be writable.`);return s.role!==f?{...s,role:f}:s}else return "lookupTableAddress"in l&&!re(s.role)?{...l,[x]:1,role:f}:s.role!==f?{...s,role:f}:s}}return "lookupTableAddress"in l?{...l,[x]:1}:{...l,[x]:2}});}return n}function $r(e){let t;return Object.entries(e).sort(([r,o],[i,a])=>{if(o[x]!==a[x]){if(o[x]===0)return -1;if(a[x]===0)return 1;if(o[x]===2)return -1;if(a[x]===2)return 1}let s=re(o.role);if(s!==re(a.role))return s?-1:1;let c=oe(o.role);return c!==oe(a.role)?c?-1:1:(t||(t=he()),o[x]===1&&a[x]===1&&o.lookupTableAddress!==a.lookupTableAddress?t(o.lookupTableAddress,a.lookupTableAddress):t(r,i))}).map(([r,o])=>({address:r,...o}))}function Lr(e){var t;let n={};for(let r of e){if(!("lookupTableAddress"in r))continue;let o=n[t=r.lookupTableAddress]||(n[t]={readableIndices:[],writableIndices:[]});r.role===R.WRITABLE?o.writableIndices.push(r.addressIndex):o.readableIndices.push(r.addressIndex);}return Object.keys(n).sort(he()).map(r=>({lookupTableAddress:r,...n[r]}))}function Ur(e){let t=0,n=0,r=0;for(let o of e){if("lookupTableAddress"in o)break;let i=oe(o.role);re(o.role)?(r++,i||n++):i||t++;}return {numReadonlyNonSignerAccounts:t,numReadonlySignerAccounts:n,numSignerAccounts:r}}function Fr(e){let t={};for(let[n,r]of e.entries())t[r.address]=n;return t}function Wr(e,t){let n=Fr(t);return e.map(({accounts:r,data:o,programAddress:i})=>({programAddressIndex:n[i],...r?{accountIndices:r.map(({address:a})=>n[a])}:null,...o?{data:o}:null}))}function Mr(e){return "nonce"in e?e.nonce:e.blockhash}function Hr(e){let t=e.findIndex(r=>"lookupTableAddress"in r);return (t===-1?e:e.slice(0,t)).map(({address:r})=>r)}function cn(e){let t=Or(e.feePayer,e.instructions),n=$r(t);return {...e.version!=="legacy"?{addressTableLookups:Lr(n)}:null,header:Ur(n),instructions:Wr(e.instructions,n),lifetimeToken:Mr(e.lifetimeConstraint),staticAccounts:Hr(n),version:e.version}}function Kr(e){let t=cn(e),n;if("signatures"in e){n=[];for(let r=0;r<t.header.numSignerAccounts;r++)n[r]=e.signatures[t.staticAccounts[r]]??new Uint8Array(Array(64).fill(0));}else n=Array(t.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));return {compiledMessage:t,signatures:n}}var dn="lookupTableAddress",un="writableIndices",ln="readableIndices",fn="addressTableLookup",qe;function jr(){return qe||(qe=Re([["lookupTableAddress",Fe({description:dn})],["writableIndices",Ie(_(),{description:un,size:Y()})],["readableIndices",Ie(_(),{description:ln,size:Y()})]],{description:fn})),qe}var Ye;function Gr(){return Ye||(Ye=ve([["lookupTableAddress",be({description:dn})],["writableIndices",Ce(O(),{description:un,size:J()})],["readableIndices",Ce(O(),{description:ln,size:J()})]],{description:fn})),Ye}function Vr(){return I(jr(),Gr())}var Je;function qr(){return Je||(Je=Et()),Je}function Xe(e){let t=qr();return {...t,description:e??t.description}}var Yr=void 0,Jr=void 0,Xr=void 0,Zr=void 0;function Qr(){return en([["numSignerAccounts",Xe(Yr)],["numReadonlySignerAccounts",Xe(Jr)],["numReadonlyNonSignerAccounts",Xe(Xr)]],{description:Zr})}var mn="programAddressIndex",pn=void 0,gn="accountIndices",bn="data",Ze;function eo(){return Ze||(Ze=fe(Re([["programAddressIndex",_({description:mn})],["accountIndices",Ie(_({description:pn}),{description:gn,size:Y()})],["data",Xt({description:bn,size:Y()})]]),e=>e.accountIndices!==void 0&&e.data!==void 0?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)})),Ze}var Qe;function to(){return Qe||(Qe=St(ve([["programAddressIndex",O({description:mn})],["accountIndices",Ce(O({description:pn}),{description:gn,size:J()})],["data",Zt({description:bn,size:J()})]]),e=>{if(e.accountIndices.length&&e.data.byteLength)return e;let{accountIndices:t,data:n,...r}=e;return {...r,...t.length?{accountIndices:t}:null,...n.byteLength?{data:n}:null}})),Qe}function no(){return I(eo(),to())}var et=128,Sn={description:"",fixedSize:null,maxSize:1};function ro(e,t=0){let n=e[t];return n&et?[n^et,t+1]:["legacy",t]}function oo(e){if(e==="legacy")return new Uint8Array;if(e<0||e>127)throw new Error(`Transaction version must be in the range [0, 127]. \`${e}\` given.`);return new Uint8Array([e|et])}function io(){return {...Sn,decode:ro}}function ao(){return {...Sn,encode:oo}}function so(){return I(ao(),io())}function co(e,t){let n=t+e[0].toUpperCase()+e.slice(1);return new Error(`No ${e} exists for ${t}. Use \`get${n}()\` if you need a ${e}, and \`get${t}Codec()\` if you need to both encode and decode ${t}`)}function hn(e){return ()=>{throw co("decoder",e)}}var uo={description:"",fixedSize:null,maxSize:null};function lo(e){return e.version==="legacy"?te(rn()).serialize(e):Q(te([...rn(),["addressTableLookups",fo()]]),t=>t.version==="legacy"?t:{...t,addressTableLookups:t.addressTableLookups??[]}).serialize(e)}function ne(e){return {description:e.description,deserialize:e.decode,fixedSize:e.fixedSize,maxSize:e.maxSize,serialize:e.encode}}function rn(){return [["version",ne(so())],["header",ne(Qr())],["staticAccounts",j(ne(Se()),{description:"",size:M()})],["lifetimeToken",Ve({description:"",encoding:D,size:32})],["instructions",j(ne(no()),{description:"",size:M()})]]}function fo(){return j(ne(Vr()),{...null,size:M()})}function yn(){return {...uo,deserialize:hn("CompiledMessage"),serialize:lo}}var mo={description:"",fixedSize:null,maxSize:null};function po(e){let t=Kr(e);return te([["signatures",j(Ge({size:64}),{...null,size:M()})],["compiledMessage",yn()]]).serialize(t)}function go(){return {...mo,deserialize:hn("CompiledMessage"),serialize:po}}function bo(e){try{if(e.length<64||e.length>88)throw new Error("Expected input string to decode to a byte array of length 64.");let n=D.serialize(e).byteLength;if(n!==64)throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${n}`)}catch(t){throw new Error(`\`${e}\` is not a transaction signature`,{cause:t})}}function Gs(e){return !(e.length<64||e.length>88||D.serialize(e).byteLength!==64)}async function So(e,t){let n=yn().serialize(e);return await Wt(t,n)}function tt(e){let t=e.signatures[e.feePayer];if(!t)throw new Error("Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.");return D.deserialize(t)[0]}async function Vs(e,t){let n=cn(t),r="signatures"in t?{...t.signatures}:{},o=await Promise.all(e.map(a=>Promise.all([Ut(a.publicKey),So(n,a.privateKey)])));for(let[a,s]of o)r[a]=s;let i={...t,signatures:r};return Object.freeze(i),i}function qs(e){return bo(e),e}function xn(e){let t=go().serialize(e);return btoa(String.fromCharCode(...t))}d();d();d();async function ae(e,t,n){let{abortSignal:r,commitment:o,getRecentSignatureConfirmationPromise:i}=t;r.throwIfAborted();let a=new AbortController;function s(){a.abort();}r.addEventListener("abort",s,{signal:a.signal});try{let c=n({...t,abortSignal:a.signal});return await Promise.race([i({abortSignal:a.signal,commitment:o,signature:e}),...c])}finally{a.abort();}}d();d();function wn(e){switch(e){case"finalized":return 2;case"confirmed":return 1;case"processed":return 0;default:return (t=>{throw new Error(`Unrecognized commitment \`${e}\`.`)})()}}function Be(e,t){return e===t?0:wn(e)<wn(t)?-1:1}function ot(e,t,n){if(Array.isArray(e))return e.map((r,o)=>ot(r,[...t,o],n));if(typeof e=="object"&&e!==null){let r={};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=ot(e[o],[...t,o],n));return r}else return typeof e=="bigint"?(n&&(e>Number.MAX_SAFE_INTEGER||e<-Number.MAX_SAFE_INTEGER)&&n(t,e),Number(e)):e}function An(e,t){return ot(e,[],t)}var u={},it=[["data","parsed","info","tokenAmount","decimals"],["data","parsed","info","tokenAmount","uiAmount"],["data","parsed","info","rentExemptReserve","decimals"],["data","parsed","info","rentExemptReserve","uiAmount"],["data","parsed","info","delegatedAmount","decimals"],["data","parsed","info","delegatedAmount","uiAmount"],["data","parsed","info","extensions",u,"state","olderTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",u,"state","newerTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",u,"state","preUpdateAverageRate"],["data","parsed","info","extensions",u,"state","currentRate"]],G=[...it,["data","parsed","info","lastExtendedSlotStartIndex"],["data","parsed","info","slashPenalty"],["data","parsed","info","warmupCooldownRate"],["data","parsed","info","decimals"],["data","parsed","info","numRequiredSigners"],["data","parsed","info","numValidSigners"],["data","parsed","info","stake","delegation","warmupCooldownRate"],["data","parsed","info","exemptionThreshold"],["data","parsed","info","burnPercent"],["data","parsed","info","commission"],["data","parsed","info","votes",u,"confirmationCount"]],nt,rt;function ho(){return nt||(nt={accountNotifications:G.map(e=>["value",...e]),blockNotifications:[["value","block","blockTime"],["value","block","transactions",u,"meta","preTokenBalances",u,"accountIndex"],["value","block","transactions",u,"meta","preTokenBalances",u,"uiTokenAmount","decimals"],["value","block","transactions",u,"meta","postTokenBalances",u,"accountIndex"],["value","block","transactions",u,"meta","postTokenBalances",u,"uiTokenAmount","decimals"],["value","block","transactions",u,"meta","rewards",u,"commission"],["value","block","transactions",u,"meta","innerInstructions",u,"index"],["value","block","transactions",u,"meta","innerInstructions",u,"instructions",u,"programIdIndex"],["value","block","transactions",u,"meta","innerInstructions",u,"instructions",u,"accounts",u],["value","block","transactions",u,"transaction","message","addressTableLookups",u,"writableIndexes",u],["value","block","transactions",u,"transaction","message","addressTableLookups",u,"readonlyIndexes",u],["value","block","transactions",u,"transaction","message","instructions",u,"programIdIndex"],["value","block","transactions",u,"transaction","message","instructions",u,"accounts",u],["value","block","transactions",u,"transaction","message","header","numReadonlySignedAccounts"],["value","block","transactions",u,"transaction","message","header","numReadonlyUnsignedAccounts"],["value","block","transactions",u,"transaction","message","header","numRequiredSignatures"],["value","block","rewards",u,"commission"]],programNotifications:G.flatMap(e=>[["value",u,"account",...e],[u,"account",...e]])}),nt}function yo(){return rt||(rt={getAccountInfo:G.map(e=>["value",...e]),getBlock:[["blockTime"],["transactions",u,"meta","preTokenBalances",u,"accountIndex"],["transactions",u,"meta","preTokenBalances",u,"uiTokenAmount","decimals"],["transactions",u,"meta","postTokenBalances",u,"accountIndex"],["transactions",u,"meta","postTokenBalances",u,"uiTokenAmount","decimals"],["transactions",u,"meta","rewards",u,"commission"],["transactions",u,"meta","innerInstructions",u,"index"],["transactions",u,"meta","innerInstructions",u,"instructions",u,"programIdIndex"],["transactions",u,"meta","innerInstructions",u,"instructions",u,"accounts",u],["transactions",u,"transaction","message","addressTableLookups",u,"writableIndexes",u],["transactions",u,"transaction","message","addressTableLookups",u,"readonlyIndexes",u],["transactions",u,"transaction","message","instructions",u,"programIdIndex"],["transactions",u,"transaction","message","instructions",u,"accounts",u],["transactions",u,"transaction","message","header","numReadonlySignedAccounts"],["transactions",u,"transaction","message","header","numReadonlyUnsignedAccounts"],["transactions",u,"transaction","message","header","numRequiredSignatures"],["rewards",u,"commission"]],getBlockTime:[[]],getClusterNodes:[[u,"featureSet"],[u,"shredVersion"]],getInflationGovernor:[["initial"],["foundation"],["foundationTerm"],["taper"],["terminal"]],getInflationRate:[["foundation"],["total"],["validator"]],getInflationReward:[[u,"commission"]],getMultipleAccounts:G.map(e=>["value",u,...e]),getProgramAccounts:G.flatMap(e=>[["value",u,"account",...e],[u,"account",...e]]),getRecentPerformanceSamples:[[u,"samplePeriodSecs"]],getTokenAccountBalance:[["value","decimals"],["value","uiAmount"]],getTokenAccountsByDelegate:it.map(e=>["value",u,"account",...e]),getTokenAccountsByOwner:it.map(e=>["value",u,"account",...e]),getTokenLargestAccounts:[["value",u,"decimals"],["value",u,"uiAmount"]],getTokenSupply:[["value","decimals"],["value","uiAmount"]],getTransaction:[["meta","preTokenBalances",u,"accountIndex"],["meta","preTokenBalances",u,"uiTokenAmount","decimals"],["meta","postTokenBalances",u,"accountIndex"],["meta","postTokenBalances",u,"uiTokenAmount","decimals"],["meta","rewards",u,"commission"],["meta","innerInstructions",u,"index"],["meta","innerInstructions",u,"instructions",u,"programIdIndex"],["meta","innerInstructions",u,"instructions",u,"accounts",u],["transaction","message","addressTableLookups",u,"writableIndexes",u],["transaction","message","addressTableLookups",u,"readonlyIndexes",u],["transaction","message","instructions",u,"programIdIndex"],["transaction","message","instructions",u,"accounts",u],["transaction","message","header","numReadonlySignedAccounts"],["transaction","message","header","numReadonlyUnsignedAccounts"],["transaction","message","header","numRequiredSignatures"]],getVersion:[["feature-set"]],getVoteAccounts:[["current",u,"commission"],["delinquent",u,"commission"]],simulateTransaction:G.map(e=>["value","accounts",u,...e])}),rt}function En(e,t){return e.filter(n=>n[0]===u&&typeof t=="number"||n[0]===t).map(n=>n.slice(1))}function Ne(e,t){if(Array.isArray(e))return e.map((n,r)=>{let o=En(t,r);return Ne(n,o)});if(typeof e=="object"&&e!==null){let n={};for(let[r,o]of Object.entries(e)){let i=En(t,r);n[r]=Ne(o,i);}return n}else return typeof e=="number"&&t.length===0&&Number.isInteger(e)?BigInt(e):e}function xo(e,t){let n=t?yo()[t]:void 0;return Ne(e,n??[])}function wo(e,t){let n=t?ho()[t]:void 0;return Ne(e,n??[])}function Tn(e){return new Proxy({},{defineProperty(){return !1},deleteProperty(){return !1},get(...t){let[n,r]=t,o=r.toString();return function(...i){let a=e?.onIntegerOverflow,s=An(i,a?(c,l)=>a(o,c,l):void 0);return {methodName:o,params:s,responseProcessor:c=>xo(c,o)}}}})}function at(e){return new Proxy({},{defineProperty(){return !1},deleteProperty(){return !1},get(...t){let[n,r]=t,o=r.toString();return function(...i){let a=e?.onIntegerOverflow;return {params:An(i,a?(c,l)=>a(o,c,l):void 0),responseProcessor:c=>wo(c,o),subscribeMethodName:o.replace(/Notifications$/,"Subscribe"),unsubscribeMethodName:o.replace(/Notifications$/,"Unsubscribe")}}}})}function zn(e){return at(e)}function se(e,t){return async function({abortSignal:r,commitment:o,signature:i}){let a=new AbortController;function s(){a.abort();}r.addEventListener("abort",s,{signal:a.signal});let c=await t.signatureNotifications(i,{commitment:o}).subscribe({abortSignal:a.signal}),l=(async()=>{for await(let m of c){if(m.value.err)throw new Error(`The transaction with signature \`${i}\` failed.`,{cause:m.value.err});return}})(),f=(async()=>{let{value:m}=await e.getSignatureStatuses([i]).send({abortSignal:a.signal}),g=m[0];g&&g.confirmationStatus&&Be(g.confirmationStatus,o)>=0||await new Promise(()=>{});})();try{return await Promise.race([l,f])}finally{a.abort();}}}d();async function In({abortSignal:e,commitment:t}){return await new Promise((n,r)=>{let o=c=>{clearTimeout(s);let l=new DOMException(c.target.reason,"AbortError");r(l);};e.addEventListener("abort",o);let i=t==="processed"?3e4:6e4,a=performance.now(),s=setTimeout(()=>{let c=performance.now()-a;r(new DOMException(`Timeout elapsed after ${c} ms`,"TimeoutError"));},i);})}function Cn({rpc:e,rpcSubscriptions:t}){let n=se(e,t);return async function(o){await Eo({...o,getRecentSignatureConfirmationPromise:n,getTimeoutPromise:In});}}async function Eo(e){await ae(e.signature,e,function({abortSignal:n,commitment:r,getTimeoutPromise:o}){return [o({abortSignal:n,commitment:r})]});}function pc({rpc:e,rpcSubscriptions:t}){let n=Cn({rpc:e,rpcSubscriptions:t});return async function(o){return await Ao({...o,confirmSignatureOnlyTransaction:n,rpc:e})}}async function Ao({abortSignal:e,commitment:t,confirmSignatureOnlyTransaction:n,lamports:r,recipientAddress:o,rpc:i}){let a=await i.requestAirdrop(o,r,{commitment:t}).send({abortSignal:e});return await n({abortSignal:e,commitment:t,signature:a}),a}d();d();function V(e,...t){return t.reduce((n,r)=>r(n),e)}d();var vn=class extends Error{constructor(e){super(`JSON-RPC 2.0 error (${e.code}): ${e.message}`),Error.captureStackTrace(this,this.constructor),this.code=e.code,this.data=e.data;}get name(){return "SolanaJsonRpcError"}},st=0;function To(){let e=st;return st=(st+1)%Number.MAX_SAFE_INTEGER,e}function dt(e,t){return {id:To(),jsonrpc:"2.0",method:e,params:t}}function zo(e,t){return {async send(n){let{methodName:r,params:o,responseProcessor:i}=t,a=dt(r,o),s=await e.transport({payload:a,signal:n?.abortSignal});if("error"in s)throw new vn(s.error);return i?i(s.result):s.result}}}function Io(e){return new Proxy(e.api,{defineProperty(){return !1},deleteProperty(){return !1},get(t,n,r){return function(...o){let i=n.toString(),a=Reflect.get(t,i,r),s=a?a(...o):{methodName:i,params:o};return zo(e,s)}}})}function Nn(e){return Io(e)}function Co(e,t){(async()=>{try{for await(let n of e);}catch{}finally{t();}})();}function Ro(e,{params:t,subscribeMethodName:n,unsubscribeMethodName:r,responseProcessor:o}){return {async subscribe({abortSignal:i}){i.throwIfAborted();let a;function s(){if(a!==void 0){let g=dt(r,[a]);f.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(g).finally(()=>{c.abort();});}else c.abort();}i.addEventListener("abort",s);let c=new AbortController,l=dt(n,t),f=await e.transport({payload:l,signal:c.signal});function m(){i.removeEventListener("abort",s);}Co(f,m);for await(let g of f)if("id"in g&&g.id===l.id){if("error"in g)throw new vn(g.error);a=g.result;break}if(a==null)throw new Error("Failed to obtain a subscription id from the server");return {async*[Symbol.asyncIterator](){for await(let g of f){if(!("params"in g)||g.params.subscription!==a)continue;let h=g.params.result;yield o?o(h):h;}}}}}}function vo(e){return new Proxy(e.api,{defineProperty(){return !1},deleteProperty(){return !1},get(t,n,r){return function(...o){let i=n.toString(),a=Reflect.get(t,i,r);if(n.toString().endsWith("Notifications")===!1&&!a)throw new Error("Either the notification name must end in 'Notifications' or the API must supply a subscription creator function to map between the notification name and the subscribe/unsubscribe method names.");let s=a?a(...o):{params:o,subscribeMethodName:i.replace(/Notifications$/,"Subscribe"),unsubscribeMethodName:i.replace(/Notifications$/,"Unsubscribe")};return Ro(e,s)}}})}function ut(e){return vo(e)}var No=globalThis.fetch,Bo=class extends Error{constructor(e){super(`HTTP error (${e.statusCode}): ${e.message}`),Error.captureStackTrace(this,this.constructor),this.statusCode=e.statusCode;}get name(){return "SolanaHttpError"}};function _o(e){let t={};for(let n in e)t[n.toLowerCase()]=e[n];return t}function Bn({httpAgentNodeOnly:e,headers:t,url:n}){let r=void 0;let o=t&&_o(t);return async function({payload:a,signal:s}){let c=JSON.stringify(a),l={agent:r,body:c,headers:{...o,accept:"application/json","content-length":c.length.toString(),"content-type":"application/json; charset=utf-8"},method:"POST",signal:s},f=await No(n,l);if(!f.ok)throw new Bo({message:f.statusText,statusCode:f.status});return await f.json()}}var ce=globalThis.WebSocket,Rn=Symbol(void 0);async function Oo({sendBufferHighWatermark:e,signal:t,url:n}){return new Promise((r,o)=>{t.addEventListener("abort",s,{once:!0});let i=new Map;function a(S){let y=[...i.values()].filter(E=>E.__hasPolled).map(({onError:E})=>E);i.clear(),y.forEach(E=>{try{E(S);}catch{}});}function s(){a(Rn),b.readyState!==ce.CLOSED&&b.readyState!==ce.CLOSING&&b.close(1e3);}function c(S){m?.onCancel(),t.removeEventListener("abort",s),b.removeEventListener("close",c),b.removeEventListener("error",l),b.removeEventListener("open",g),b.removeEventListener("message",h),a(S);}function l(S){f||o(new Error("WebSocket failed to connect",{cause:S}));}let f=!1,m;function g(){f=!0,r({async send(S){let y=JSON.stringify(S);if(!m&&b.readyState===ce.OPEN&&b.bufferedAmount>e){let E,k=new Promise((q,Gn)=>{let pt=setInterval(()=>{(b.readyState!==ce.OPEN||!(b.bufferedAmount>e))&&(clearInterval(pt),m=void 0,q());},16);E=()=>{m=void 0,clearInterval(pt),Gn(new Error("WebSocket was closed before payload could be sent"));};});m={onCancel:E,promise:k};}m&&await m.promise,b.send(y);},async*[Symbol.asyncIterator](){let S=Symbol();i.set(S,{__hasPolled:!1,queuedMessages:[]});try{for(;;){let y=i.get(S);if(!y)throw new Error("Invariant: WebSocket message iterator is missing state storage");if(y.__hasPolled)throw new Error("Invariant: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise");let E=y.queuedMessages;if(E.length)y.queuedMessages=[],yield*E;else try{yield await new Promise((k,q)=>{i.set(S,{__hasPolled:!0,onError:q,onMessage:k});});}catch(k){if(k===Rn)return;throw new Error("WebSocket connection closed",{cause:k})}}}finally{i.delete(S);}}});}function h({data:S}){let y=JSON.parse(S);i.forEach((E,k)=>{if(E.__hasPolled){let{onMessage:q}=E;i.set(k,{__hasPolled:!1,queuedMessages:[]}),q(y);}else E.queuedMessages.push(y);});}let b=new ce(n);b.addEventListener("close",c),b.addEventListener("error",l),b.addEventListener("open",g),b.addEventListener("message",h);})}function Dn({sendBufferHighWatermark:e,url:t}){if(/^wss?:/i.test(t)===!1){let n=t.match(/^([^:]+):/);throw new DOMException(n?`Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. '${n[1]}:' is not allowed.`:`Failed to construct 'WebSocket': The URL '${t}' is invalid.`)}return async function({payload:r,signal:o}){o?.throwIfAborted();let i=await Oo({sendBufferHighWatermark:e,signal:o,url:t});return o?.throwIfAborted(),await i.send(r),{[Symbol.asyncIterator]:i[Symbol.asyncIterator].bind(i),send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:i.send.bind(i)}}}var _n=gt(lt(),1);d();d();var De=class extends Error{constructor(n,r,o){let i=(typeof r[0]=="number"?r[0]:parseInt(r[0],10))+1,a="",s=i%10,c=i%100;s==1&&c!=11?a=i+"st":s==2&&c!=12?a=i+"nd":s==3&&c!=13?a=i+"rd":a=i+"th";let l=r.length>1?r.slice(1).map(f=>typeof f=="number"?`[${f}]`:f).join("."):null;super(`The ${a} argument to the \`${n}\` RPC method${l?` at path \`${l}\``:""} was \`${o}\`. This number is unsafe for use with the Solana JSON-RPC because it exceeds \`Number.MAX_SAFE_INTEGER\`.`);this.keyPath=r,this.methodName=n,this.value=o;}get name(){return "SolanaJsonRpcIntegerOverflowError"}};var ke={onIntegerOverflow(e,t,n){throw new De(e,t,n)}};d();d();function Uo(e,t){(async()=>{try{for await(let n of e);}catch{}finally{t();}})();}function Pe({getAbortSignalFromInputArgs:e,getCacheEntryMissingError:t,getCacheKeyFromInputArgs:n,onCacheHit:r,onCreateIterable:o}){let i=new Map;function a(s){let c=i.get(s);if(!c)throw t(s);return c}return async(...s)=>{let c=n(...s),l=e(...s);if(c===void 0)return await o(l,...s);let f=()=>{i.delete(c),l.removeEventListener("abort",m);},m=()=>{let g=a(c);g.purgeScheduled!==!0&&(g.purgeScheduled=!0,globalThis.queueMicrotask(()=>{g.purgeScheduled=!1,g.referenceCount===0&&(g.abortController.abort(),f());})),g.referenceCount--;};l.addEventListener("abort",m);try{let g=i.get(c);if(g){g.referenceCount++;let h=g.iterable,b="then"in h?await h:h;return await r(b,...s),b}else {let h=new AbortController,b=o(h.signal,...s),S={abortController:h,iterable:b,purgeScheduled:!1,referenceCount:1};i.set(c,S);let y=await b;return Uo(y,f),S.iterable=y,y}}catch(g){throw f(),g}}}var ft=Symbol(void 0);function Fo(e,t){(async()=>{try{for await(let n of e);}catch{}finally{t();}})();}function Pn({getDeduplicationKey:e,rpcSubscriptions:t}){let n=new Map;return new Proxy(t,{defineProperty(){return !1},deleteProperty(){return !1},get(r,o,i){let a=Reflect.get(r,o,i);return typeof a!="function"?a:function(...s){let c=e(o,s);if(c===void 0)return a(...s);if(n.has(c))return n.get(c);let l=Pe({getAbortSignalFromInputArgs:({abortSignal:m})=>m,getCacheEntryMissingError(m){return new Error(`Found no cache entry for subscription with deduplication key \`${m?.toString()}\``)},getCacheKeyFromInputArgs:()=>c,async onCacheHit(m,g){},async onCreateIterable(m,g){let b=await a(...s).subscribe({...g,abortSignal:m});return Fo(b,()=>{n.delete(c);}),b}}),f={async subscribe(...m){let g=await l(...m),{abortSignal:h}=m[0],b;return {...g,async*[Symbol.asyncIterator](){b||(b=h.aborted?Promise.reject(ft):new Promise((S,y)=>{h.addEventListener("abort",()=>{y(ft);});}));try{let S=g[Symbol.asyncIterator]();for(;;){let y=await Promise.race([S.next(),b]);if(y.done)return;yield y.value;}}catch(S){if(S===ft)return;throw n.delete(c),S}}}}};return n.set(c,f),f}}})}function Hc(e){return Nn({...e,api:Tn(ke)})}function Kc(e){return V(ut({...e,api:at(ke)}),t=>Pn({getDeduplicationKey:(...n)=>(0, _n.default)(n),rpcSubscriptions:t}))}function jc(e){return ut({...e,api:zn(ke)})}d();d();function On(e,t){let n;return async function(o){let{payload:i,signal:a}=o,s=t(i);if(s===void 0)return await e(o);if(n||(Promise.resolve().then(()=>{n=void 0;}),n={}),n[s]==null){let l=new AbortController;n[s]={abortController:l,numConsumers:0,responsePromise:e({...o,signal:l.signal})};}let c=n[s];if(c.numConsumers++,a){let l=c.responsePromise;return await new Promise((f,m)=>{let g=h=>{a.removeEventListener("abort",g),c.numConsumers-=1,c.numConsumers===0&&c.abortController.abort();let b=new DOMException(h.target.reason,"AbortError");m(b);};a.addEventListener("abort",g),l.then(f).finally(()=>{a.removeEventListener("abort",g);});})}else return await c.responsePromise}}d();var $n=gt(lt(),1);function Wo(e){return e==null||typeof e!="object"||Array.isArray(e)?!1:"jsonrpc"in e&&e.jsonrpc==="2.0"&&"method"in e&&typeof e.method=="string"&&"params"in e}function Ln(e){return Wo(e)?(0, $n.default)([e.method,e.params]):void 0}function Mo(e){let t={};for(let n in e)t[n.toLowerCase()]=e[n];return t}function nd(e){return V(Bn({...e,headers:{...e.headers?Mo(e.headers):void 0,"solana-client":"js/2.0.0-development"}}),t=>On(t,Ln))}d();d();var Ho={jsonrpc:"2.0",method:"ping"};function Un({intervalMs:e,transport:t}){let n=new Map;return async(...r)=>{let o=await t(...r),i;function a(){o.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(Ho);}function s(){clearInterval(i),i=setInterval(a,e);}if(n.has(o)===!1){n.set(o,{[Symbol.asyncIterator]:o[Symbol.asyncIterator].bind(o),send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:(...f)=>(s(),o.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(...f))}),(async()=>{try{for await(let f of o)s();}catch{}finally{n.delete(o),clearInterval(i),c&&globalThis.window.removeEventListener("offline",c),l&&globalThis.window.removeEventListener("online",l);}})(),globalThis.navigator.onLine&&s();let c,l;c=()=>{clearInterval(i);},l=()=>{a(),s();},globalThis.window.addEventListener("offline",c),globalThis.window.addEventListener("online",l);}return n.get(o)}}d();var Ko=Symbol(void 0);function Fn({getShard:e,transport:t}){return Pe({getAbortSignalFromInputArgs:({signal:n})=>n,getCacheEntryMissingError(n){return new Error(`Found no cache entry for connection with shard key \`${n?.toString()}\``)},getCacheKeyFromInputArgs:({payload:n})=>e?e(n):Ko,onCacheHit:(n,{payload:r})=>n.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(r),onCreateIterable:(n,r)=>t({...r,signal:n})})}function pd(e){let{getShard:t,intervalMs:n,...r}=e;return V(Dn({...r,sendBufferHighWatermark:e.sendBufferHighWatermark??131072}),o=>Un({intervalMs:n??5e3,transport:o}),o=>Fn({getShard:t,transport:o}))}d();d();d();function Wn(e){return async function({abortSignal:n,lastValidBlockHeight:r}){let o=new AbortController;function i(){o.abort();}n.addEventListener("abort",i,{signal:o.signal});let a=await e.slotNotifications().subscribe({abortSignal:o.signal});try{for await(let s of a)if(s.slot>r)throw new Error("The network has progressed past the last block for which this transaction could have committed.")}finally{o.abort();}}}d();var mt=4+4+32;function Mn(e,t){return async function({abortSignal:r,commitment:o,currentNonceValue:i,nonceAccountAddress:a}){let s=new AbortController;function c(){s.abort();}r.addEventListener("abort",c,{signal:s.signal});let l=await t.accountNotifications(a,{commitment:o,encoding:"base64"}).subscribe({abortSignal:s.signal});function f([h]){let S=Me.serialize(h).slice(mt,mt+32);return D.deserialize(S)[0]}let m=(async()=>{for await(let h of l){let b=f(h.value.data);if(b!==i)throw new Error(`The nonce \`${i}\` is no longer valid. It has advanced to \`${b}\`.`)}})(),g=(async()=>{let{value:h}=await e.getAccountInfo(a,{commitment:o,dataSlice:{length:32,offset:mt},encoding:"base58"}).send({abortSignal:s.signal});if(!h)throw new Error(`No nonce account could be found at address \`${a}\`.`);let b=h.data[0];if(b!==i)throw new Error(`The nonce \`${i}\` is no longer valid. It has advanced to \`${b}\`.`);await new Promise(()=>{});})();try{return await Promise.race([m,g])}finally{s.abort();}}}function Hn({rpc:e,rpcSubscriptions:t}){let n=Mn(e,t),r=se(e,t);return async function(i){await jo({...i,getNonceInvalidationPromise:n,getRecentSignatureConfirmationPromise:r});}}function Kn({rpc:e,rpcSubscriptions:t}){let n=Wn(t),r=se(e,t);return async function(i){await Go({...i,getBlockHeightExceedencePromise:n,getRecentSignatureConfirmationPromise:r});}}async function jo(e){await ae(tt(e.transaction),e,function({abortSignal:n,commitment:r,getNonceInvalidationPromise:o,transaction:i}){return [o({abortSignal:n,commitment:r,currentNonceValue:i.lifetimeConstraint.nonce,nonceAccountAddress:i.instructions[0].accounts[0].address})]});}async function Go(e){await ae(tt(e.transaction),e,function({abortSignal:n,getBlockHeightExceedencePromise:r,transaction:o}){return [r({abortSignal:n,lastValidBlockHeight:o.lifetimeConstraint.lastValidBlockHeight})]});}function Vo(e,t){return !t?.preflightCommitment&&Be(e,"finalized")<0?{...t,preflightCommitment:e}:t}async function jn({abortSignal:e,commitment:t,rpc:n,transaction:r,sendTransactionConfig:o}){let i=xn(r);return await n.sendTransaction(i,{...Vo(t,o),encoding:"base64"}).send({abortSignal:e})}function Hd({rpc:e,rpcSubscriptions:t}){let n=Hn({rpc:e,rpcSubscriptions:t});return async function(o,i){await qo({...i,confirmDurableNonceTransaction:n,rpc:e,transaction:o});}}function Kd({rpc:e,rpcSubscriptions:t}){let n=Kn({rpc:e,rpcSubscriptions:t});return async function(o,i){await Yo({...i,confirmRecentTransaction:n,rpc:e,transaction:o});}}async function qo({abortSignal:e,commitment:t,confirmDurableNonceTransaction:n,rpc:r,transaction:o,...i}){let a=await jn({abortSignal:e,commitment:t,rpc:r,sendTransactionConfig:i,transaction:o});return await n({abortSignal:e,commitment:t,transaction:o}),a}async function Yo({abortSignal:e,commitment:t,confirmRecentTransaction:n,rpc:r,transaction:o,...i}){let a=await jn({abortSignal:e,commitment:t,rpc:r,sendTransactionConfig:i,transaction:o});return await n({abortSignal:e,commitment:t,transaction:o}),a}
10
10
 
11
- exports.AccountRole = $r;
12
- exports.address = Nr;
11
+ exports.AccountRole = Tr;
12
+ exports.address = gr;
13
13
  exports.appendTransactionInstruction = Ks;
14
- exports.assertIsAddress = ft;
14
+ exports.assertIsAddress = Ot;
15
15
  exports.assertIsBlockhash = Ls;
16
- exports.assertIsDurableNonceTransaction = $s;
17
- exports.assertIsProgramDerivedAddress = go;
18
- exports.assertIsTransactionSignature = En;
19
- exports.createAddressWithSeed = ho;
20
- exports.createBlockHeightExceedencePromiseFactory = tr;
21
- exports.createDefaultDurableNonceTransactionConfirmer = bc;
22
- exports.createDefaultRpcSubscriptionsTransport = Ja;
23
- exports.createDefaultRpcTransport = Ua;
24
- exports.createDefaultTransactionConfirmer = hc;
25
- exports.createNonceInvalidationPromiseFactory = rr;
26
- exports.createSignatureConfirmationPromiseFactory = We;
27
- exports.createSolanaRpc = za;
28
- exports.createSolanaRpcSubscriptions = Ta;
29
- exports.createSolanaRpcSubscriptions_UNSTABLE = va;
16
+ exports.assertIsDurableNonceTransaction = Ws;
17
+ exports.assertIsProgramDerivedAddress = mi;
18
+ exports.assertIsTransactionSignature = bo;
19
+ exports.createAddressWithSeed = gi;
20
+ exports.createBlockHeightExceedencePromiseFactory = Wn;
21
+ exports.createDefaultAirdropRequester = pc;
22
+ exports.createDefaultDurableNonceTransactionConfirmer = Hn;
23
+ exports.createDefaultDurableNonceTransactionSender = Hd;
24
+ exports.createDefaultRecentTransactionConfirmer = Kn;
25
+ exports.createDefaultRpcSubscriptionsTransport = pd;
26
+ exports.createDefaultRpcTransport = nd;
27
+ exports.createDefaultTransactionSender = Kd;
28
+ exports.createNonceInvalidationPromiseFactory = Mn;
29
+ exports.createRecentSignatureConfirmationPromiseFactory = se;
30
+ exports.createSolanaRpc = Hc;
31
+ exports.createSolanaRpcSubscriptions = Kc;
32
+ exports.createSolanaRpcSubscriptions_UNSTABLE = jc;
30
33
  exports.createTransaction = Fs;
31
- exports.downgradeRoleToNonSigner = xo;
32
- exports.downgradeRoleToReadonly = Eo;
33
- exports.generateKeyPair = Bo;
34
- exports.getAddressCodec = Y;
35
- exports.getAddressComparator = ie;
36
- exports.getAddressDecoder = pt;
37
- exports.getAddressEncoder = Br;
38
- exports.getAddressFromPublicKey = bt;
39
- exports.getBase64EncodedWireTransaction = qs;
40
- exports.getProgramDerivedAddress = bo;
41
- exports.getSignatureFromTransaction = Dt;
42
- exports.getTransactionEncoder = xn;
43
- exports.isAddress = Rr;
44
- exports.isProgramDerivedAddress = mo;
45
- exports.isSignerRole = Io;
34
+ exports.downgradeRoleToNonSigner = yi;
35
+ exports.downgradeRoleToReadonly = xi;
36
+ exports.generateKeyPair = vi;
37
+ exports.getAddressCodec = Se;
38
+ exports.getAddressComparator = he;
39
+ exports.getAddressDecoder = be;
40
+ exports.getAddressEncoder = Fe;
41
+ exports.getAddressFromPublicKey = Ut;
42
+ exports.getBase64EncodedWireTransaction = xn;
43
+ exports.getProgramDerivedAddress = pi;
44
+ exports.getSignatureFromTransaction = tt;
45
+ exports.getTransactionEncoder = go;
46
+ exports.isAddress = pr;
47
+ exports.isAdvanceNonceAccountInstruction = Pr;
48
+ exports.isProgramDerivedAddress = fi;
49
+ exports.isSignerRole = wi;
46
50
  exports.isTransactionSignature = Gs;
47
- exports.isWritableRole = Ao;
48
- exports.mergeRoles = zo;
49
- exports.prependTransactionInstruction = Hs;
50
- exports.setTransactionFeePayer = Ms;
51
+ exports.isWritableRole = Ei;
52
+ exports.mergeRoles = Ai;
53
+ exports.prependTransactionInstruction = js;
54
+ exports.requestAndConfirmAirdrop = Ao;
55
+ exports.sendAndConfirmDurableNonceTransaction = qo;
56
+ exports.sendAndConfirmTransaction = Yo;
57
+ exports.setTransactionFeePayer = Hs;
51
58
  exports.setTransactionLifetimeUsingBlockhash = Us;
52
- exports.setTransactionLifetimeUsingDurableNonce = Ws;
53
- exports.signBytes = yt;
54
- exports.signTransaction = js;
55
- exports.transactionSignature = Vs;
56
- exports.upgradeRoleToSigner = To;
57
- exports.upgradeRoleToWritable = vo;
58
- exports.verifySignature = ko;
59
- exports.waitForDurableNonceTransactionConfirmation = Yn;
60
- exports.waitForTransactionConfirmation = Jn;
59
+ exports.setTransactionLifetimeUsingDurableNonce = Ms;
60
+ exports.signBytes = Wt;
61
+ exports.signTransaction = Vs;
62
+ exports.transactionSignature = qs;
63
+ exports.upgradeRoleToSigner = Ti;
64
+ exports.upgradeRoleToWritable = zi;
65
+ exports.verifySignature = Ni;
66
+ exports.waitForDurableNonceTransactionConfirmation = jo;
67
+ exports.waitForRecentTransactionConfirmation = Go;
61
68
 
62
69
  return exports;
63
70
 
@@ -0,0 +1,20 @@
1
+ import { GetSignatureStatusesApi } from '@solana/rpc-core/dist/types/rpc-methods/getSignatureStatuses';
2
+ import { SignatureNotificationsApi } from '@solana/rpc-core/dist/types/rpc-subscriptions/signature-notifications';
3
+ import { Rpc, RpcSubscriptions } from '@solana/rpc-transport/dist/types/json-rpc-types';
4
+ import { TransactionSignature } from '@solana/transactions';
5
+ import { BaseTransactionConfirmationStrategyConfig } from './transaction-confirmation-strategy-racer';
6
+ import { getTimeoutPromise } from './transaction-confirmation-strategy-timeout';
7
+ interface DefaultSignatureOnlyRecentTransactionConfirmerConfig {
8
+ rpc: Rpc<GetSignatureStatusesApi>;
9
+ rpcSubscriptions: RpcSubscriptions<SignatureNotificationsApi>;
10
+ }
11
+ interface WaitForRecentTransactionWithTimeBasedLifetimeConfirmationConfig extends BaseTransactionConfirmationStrategyConfig {
12
+ getTimeoutPromise: typeof getTimeoutPromise;
13
+ signature: TransactionSignature;
14
+ }
15
+ /** @deprecated */
16
+ export declare function createDefaultSignatureOnlyRecentTransactionConfirmer({ rpc, rpcSubscriptions, }: DefaultSignatureOnlyRecentTransactionConfirmerConfig): (config: Omit<Parameters<typeof waitForRecentTransactionConfirmationUntilTimeout>[0], 'getRecentSignatureConfirmationPromise' | 'getTimeoutPromise'>) => Promise<void>;
17
+ /** @deprecated */
18
+ export declare function waitForRecentTransactionConfirmationUntilTimeout(config: WaitForRecentTransactionWithTimeBasedLifetimeConfirmationConfig): Promise<void>;
19
+ export {};
20
+ //# sourceMappingURL=airdrop-confirmer.d.ts.map
@@ -0,0 +1,23 @@
1
+ import { Base58EncodedAddress } from '@solana/addresses';
2
+ import { Commitment, LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-core';
3
+ import { GetSignatureStatusesApi } from '@solana/rpc-core/dist/types/rpc-methods/getSignatureStatuses';
4
+ import { RequestAirdropApi } from '@solana/rpc-core/dist/types/rpc-methods/requestAirdrop';
5
+ import { SignatureNotificationsApi } from '@solana/rpc-core/dist/types/rpc-subscriptions/signature-notifications';
6
+ import { Rpc, RpcSubscriptions } from '@solana/rpc-transport/dist/types/json-rpc-types';
7
+ import { TransactionSignature } from '@solana/transactions';
8
+ import { createDefaultSignatureOnlyRecentTransactionConfirmer } from './airdrop-confirmer';
9
+ type AirdropRequesterConfig = Readonly<{
10
+ rpc: Rpc<RequestAirdropApi & GetSignatureStatusesApi>;
11
+ rpcSubscriptions: RpcSubscriptions<SignatureNotificationsApi>;
12
+ }>;
13
+ export declare function createDefaultAirdropRequester({ rpc, rpcSubscriptions }: AirdropRequesterConfig): (config: Parameters<typeof requestAndConfirmAirdrop>[0]) => Promise<TransactionSignature>;
14
+ export declare function requestAndConfirmAirdrop({ abortSignal, commitment, confirmSignatureOnlyTransaction, lamports, recipientAddress, rpc, }: Readonly<{
15
+ abortSignal: AbortSignal;
16
+ commitment: Commitment;
17
+ confirmSignatureOnlyTransaction: ReturnType<typeof createDefaultSignatureOnlyRecentTransactionConfirmer>;
18
+ lamports: LamportsUnsafeBeyond2Pow53Minus1;
19
+ recipientAddress: Base58EncodedAddress;
20
+ rpc: Rpc<RequestAirdropApi>;
21
+ }>): Promise<TransactionSignature>;
22
+ export {};
23
+ //# sourceMappingURL=airdrop.d.ts.map
@@ -2,11 +2,13 @@ export * from '@solana/addresses';
2
2
  export * from '@solana/instructions';
3
3
  export * from '@solana/keys';
4
4
  export * from '@solana/transactions';
5
+ export * from './airdrop';
5
6
  export * from './rpc';
6
7
  export * from './rpc-transport';
7
8
  export * from './rpc-websocket-transport';
9
+ export * from './send-transaction';
8
10
  export * from './transaction-confirmation';
9
11
  export * from './transaction-confirmation-strategy-blockheight';
10
12
  export * from './transaction-confirmation-strategy-nonce';
11
- export * from './transaction-confirmation-strategy-signature';
13
+ export * from './transaction-confirmation-strategy-recent-signature';
12
14
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,44 @@
1
+ import { Commitment } from '@solana/rpc-core';
2
+ import { GetAccountInfoApi } from '@solana/rpc-core/dist/types/rpc-methods/getAccountInfo';
3
+ import { GetSignatureStatusesApi } from '@solana/rpc-core/dist/types/rpc-methods/getSignatureStatuses';
4
+ import { SendTransactionApi } from '@solana/rpc-core/dist/types/rpc-methods/sendTransaction';
5
+ import { AccountNotificationsApi } from '@solana/rpc-core/dist/types/rpc-subscriptions/account-notifications';
6
+ import { SignatureNotificationsApi } from '@solana/rpc-core/dist/types/rpc-subscriptions/signature-notifications';
7
+ import { SlotNotificationsApi } from '@solana/rpc-core/dist/types/rpc-subscriptions/slot-notifications';
8
+ import { Rpc, RpcSubscriptions } from '@solana/rpc-transport/dist/types/json-rpc-types';
9
+ import { BaseTransaction, IDurableNonceTransaction, IFullySignedTransaction, ITransactionWithBlockhashLifetime, ITransactionWithFeePayer, TransactionSignature } from '@solana/transactions';
10
+ import { createDefaultDurableNonceTransactionConfirmer, createDefaultRecentTransactionConfirmer } from './transaction-confirmation';
11
+ type DurableNonceTransactionSenderConfig = Readonly<{
12
+ rpc: Rpc<GetAccountInfoApi & GetSignatureStatusesApi & SendTransactionApi>;
13
+ rpcSubscriptions: RpcSubscriptions<SignatureNotificationsApi & AccountNotificationsApi>;
14
+ }>;
15
+ type RecentTransactionSenderConfig = Readonly<{
16
+ rpc: Rpc<GetSignatureStatusesApi & SendTransactionApi>;
17
+ rpcSubscriptions: RpcSubscriptions<SignatureNotificationsApi & SlotNotificationsApi>;
18
+ }>;
19
+ type SendableTransaction = BaseTransaction & ITransactionWithFeePayer & IFullySignedTransaction;
20
+ type SendTransactionConfig = Parameters<SendTransactionApi['sendTransaction']>[1];
21
+ export declare function createDefaultDurableNonceTransactionSender({ rpc, rpcSubscriptions, }: DurableNonceTransactionSenderConfig): (transaction: BaseTransaction & ITransactionWithFeePayer & IDurableNonceTransaction & IFullySignedTransaction, config: Omit<SendTransactionConfig & Readonly<{
22
+ abortSignal: AbortSignal;
23
+ commitment: Commitment;
24
+ }>, 'encoding'>) => Promise<void>;
25
+ export declare function createDefaultTransactionSender({ rpc, rpcSubscriptions }: RecentTransactionSenderConfig): (transaction: SendableTransaction & ITransactionWithBlockhashLifetime, config: Omit<SendTransactionConfig & Readonly<{
26
+ abortSignal: AbortSignal;
27
+ commitment: Commitment;
28
+ }>, 'encoding'>) => Promise<void>;
29
+ export declare function sendAndConfirmDurableNonceTransaction({ abortSignal, commitment, confirmDurableNonceTransaction, rpc, transaction, ...sendTransactionConfig }: Omit<SendTransactionConfig & Readonly<{
30
+ abortSignal: AbortSignal;
31
+ commitment: Commitment;
32
+ confirmDurableNonceTransaction: ReturnType<typeof createDefaultDurableNonceTransactionConfirmer>;
33
+ rpc: Rpc<SendTransactionApi>;
34
+ transaction: SendableTransaction & IDurableNonceTransaction;
35
+ }>, 'encoding'>): Promise<TransactionSignature>;
36
+ export declare function sendAndConfirmTransaction({ abortSignal, commitment, confirmRecentTransaction, rpc, transaction, ...sendTransactionConfig }: Omit<SendTransactionConfig & Readonly<{
37
+ abortSignal: AbortSignal;
38
+ commitment: Commitment;
39
+ confirmRecentTransaction: ReturnType<typeof createDefaultRecentTransactionConfirmer>;
40
+ rpc: Rpc<SendTransactionApi>;
41
+ transaction: SendableTransaction & ITransactionWithBlockhashLifetime;
42
+ }>, 'encoding'>): Promise<TransactionSignature>;
43
+ export {};
44
+ //# sourceMappingURL=send-transaction.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { Commitment } from '@solana/rpc-core';
2
+ import { TransactionSignature } from '@solana/transactions';
3
+ import { createRecentSignatureConfirmationPromiseFactory } from './transaction-confirmation-strategy-recent-signature';
4
+ export interface BaseTransactionConfirmationStrategyConfig {
5
+ abortSignal: AbortSignal;
6
+ commitment: Commitment;
7
+ getRecentSignatureConfirmationPromise: ReturnType<typeof createRecentSignatureConfirmationPromiseFactory>;
8
+ }
9
+ export declare function raceStrategies<TConfig extends BaseTransactionConfirmationStrategyConfig>(signature: TransactionSignature, config: TConfig, getSpecificStrategiesForRace: (config: TConfig) => readonly Promise<unknown>[]): Promise<unknown>;
10
+ //# sourceMappingURL=transaction-confirmation-strategy-racer.d.ts.map
@@ -3,11 +3,11 @@ import { GetSignatureStatusesApi } from '@solana/rpc-core/dist/types/rpc-methods
3
3
  import { SignatureNotificationsApi } from '@solana/rpc-core/dist/types/rpc-subscriptions/signature-notifications';
4
4
  import { Rpc, RpcSubscriptions } from '@solana/rpc-transport/dist/types/json-rpc-types';
5
5
  import { TransactionSignature } from '@solana/transactions';
6
- type GetSignatureConfirmationPromiseFn = (config: {
6
+ type GetRecentSignatureConfirmationPromiseFn = (config: {
7
7
  abortSignal: AbortSignal;
8
8
  commitment: Commitment;
9
9
  signature: TransactionSignature;
10
10
  }) => Promise<void>;
11
- export declare function createSignatureConfirmationPromiseFactory(rpc: Rpc<GetSignatureStatusesApi>, rpcSubscriptions: RpcSubscriptions<SignatureNotificationsApi>): GetSignatureConfirmationPromiseFn;
11
+ export declare function createRecentSignatureConfirmationPromiseFactory(rpc: Rpc<GetSignatureStatusesApi>, rpcSubscriptions: RpcSubscriptions<SignatureNotificationsApi>): GetRecentSignatureConfirmationPromiseFn;
12
12
  export {};
13
- //# sourceMappingURL=transaction-confirmation-strategy-signature.d.ts.map
13
+ //# sourceMappingURL=transaction-confirmation-strategy-recent-signature.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { Commitment } from '@solana/rpc-core';
2
+ type Config = Readonly<{
3
+ abortSignal: AbortSignal;
4
+ commitment: Commitment;
5
+ }>;
6
+ export declare function getTimeoutPromise({ abortSignal: callerAbortSignal, commitment }: Config): Promise<unknown>;
7
+ export {};
8
+ //# sourceMappingURL=transaction-confirmation-strategy-timeout.d.ts.map