@solana/web3.js 2.0.0-experimental.ba46ce1 → 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.
- package/LICENSE +1 -1
- package/README.md +4 -4
- package/dist/index.browser.cjs +436 -1
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +424 -2
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +2214 -819
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +424 -2
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +436 -1
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +424 -2
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +59 -35
- package/dist/types/airdrop-confirmer.d.ts +20 -0
- package/dist/types/airdrop.d.ts +23 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/rpc.d.ts +2 -1
- package/dist/types/send-transaction.d.ts +44 -0
- package/dist/types/transaction-confirmation-strategy-blockheight.d.ts +10 -0
- package/dist/types/transaction-confirmation-strategy-nonce.d.ts +15 -0
- package/dist/types/transaction-confirmation-strategy-racer.d.ts +10 -0
- package/dist/types/transaction-confirmation-strategy-recent-signature.d.ts +13 -0
- package/dist/types/transaction-confirmation-strategy-timeout.d.ts +8 -0
- package/dist/types/transaction-confirmation.d.ts +37 -0
- package/package.json +17 -16
|
@@ -2,45 +2,69 @@ this.globalThis = this.globalThis || {};
|
|
|
2
2
|
this.globalThis.solanaWeb3 = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
var
|
|
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 $e(){if(V(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!="function")throw new Error("No key export implementation could be found")}async function We(){if(V(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!="function")throw new Error("No signing implementation could be found")}async function Me(){if(V(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.verify!="function")throw new Error("No signature verification implementation could be found")}function Ko(e){return !(e.length<32||e.length>44||B.serialize(e).byteLength!==32)}function Pt(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=B.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 base-58 encoded address`,{cause:t})}}function jo(e){return Pt(e),e}function U(e){return G({description:e?.description??(""),encoding:B,size:32})}function le(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}var Dt=37095705934669439343138083508754565189542113879843219016388785533085940283555n,I=57896044618658097711785492504343953926634992332820282019728792003956564819949n,Ue=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function T(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 $t(e){let r=e*e%I*e%I,n=C(r,2n)*r%I,o=C(n,1n)*e%I,s=C(o,5n)*o%I,i=C(s,10n)*s%I,a=C(i,20n)*i%I,u=C(a,40n)*a%I,l=C(u,80n)*u%I,p=C(l,80n)*u%I,f=C(p,10n)*s%I;return C(f,2n)*e%I}function Wt(e,t){let r=T(t*t*t),n=T(r*r*t),o=$t(e*n),s=T(e*r*o),i=T(t*s*s),a=s,u=T(s*Ue),l=i===e,p=i===T(-e),f=i===T(-e*Ue);return l&&(s=a),(p||f)&&(s=u),(T(s)&1n)===1n&&(s=T(-s)),!l&&!p?null:s}function Mt(e,t){let r=T(e*e),n=T(r-1n),o=T(Dt*r+1n),s=Wt(n,o);if(s===null)return !1;let i=(t&128)!==0;return !(s===0n&&i)}function Ut(e){let t=e.toString(16);return t.length===1?`0${t}`:t}function Ft(e){let r=`0x${e.reduce((n,o,s)=>`${Ut(s===31?o&-129:o)}${n}`,"")}`;return BigInt(r)}async function Kt(e){if(e.byteLength!==32)return !1;let t=Ft(e);return Mt(t,e[31])}var Ke=32,Fe=16,ue=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115],je=class extends Error{};async function jt({programAddress:e,seeds:t}){if(await Pe(),t.length>Fe)throw new Error(`A maximum of ${Fe} seeds may be supplied when creating an address`);let r,n=t.reduce((u,l,p)=>{let f=typeof l=="string"?(r||(r=new TextEncoder)).encode(l):l;if(f.byteLength>Ke)throw new Error(`The seed at index ${p} exceeds the maximum length of 32 bytes`);return u.push(...f),u},[]),o=U(),s=o.serialize(e),i=await crypto.subtle.digest("SHA-256",new Uint8Array([...n,...s,...ue])),a=new Uint8Array(i);if(await Kt(a))throw new je("Invalid seeds; point must fall off the Ed25519 curve");return o.deserialize(a)[0]}async function Ho({programAddress:e,seeds:t}){let r=255;for(;r>0;)try{return {bumpSeed:r,pda:await jt({programAddress:e,seeds:[...t,new Uint8Array([r])]})}}catch(n){if(n instanceof je)r--;else throw n}throw new Error("Unable to find a viable program address bump seed")}async function Go({baseAddress:e,programAddress:t,seed:r}){let{serialize:n,deserialize:o}=U(),s=typeof r=="string"?new TextEncoder().encode(r):r;if(s.byteLength>Ke)throw new Error("The seed exceeds the maximum length of 32 bytes");let i=n(t);if(i.length>=ue.length&&i.slice(-ue.length).every((l,p)=>l===ue[p]))throw new Error("programAddress cannot end with the PDA marker");let a=await crypto.subtle.digest("SHA-256",new Uint8Array([...n(e),...s,...i])),u=new Uint8Array(a);return o(u)[0]}async function He(e){if(await $e(),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]=U().deserialize(new Uint8Array(t));return r}c();var Ht=(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))(Ht||{}),Ge=2,ye=1;function Jo(e){return e&~Ge}function Xo(e){return e&~ye}function Zo(e){return e>=2}function Qo(e){return (e&ye)!==0}function es(e,t){return e|t}function ts(e){return e|Ge}function rs(e){return e|ye}c();async function is(){return await De(),await crypto.subtle.generateKey("Ed25519",!1,["sign","verify"])}async function Ve(e,t){await We();let r=await crypto.subtle.sign("Ed25519",e,t);return new Uint8Array(r)}async function as(e,t,r){return await Me(),await crypto.subtle.verify("Ed25519",e,t,r)}c();function J(e){if("signatures"in e){let{signatures:t,...r}=e;return r}else return e}function fs(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=B.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 ms(e,t){if("lifetimeConstraint"in t&&t.lifetimeConstraint.blockhash===e.blockhash&&t.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight)return t;let r={...J(t),lifetimeConstraint:e};return Object.freeze(r),r}function gs({version:e}){let t={instructions:[],version:e};return Object.freeze(t),t}var z=(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))(z||{}),Gt=1;function q(e){return e>=2}function Y(e){return (e&Gt)!==0}function qe(e,t){return e|t}var Xe="SysvarRecentB1ockHashes11111111111111111111",Ze="11111111111111111111111111111111";function bs(e){if(!Qe(e))throw new Error("Transaction is not a durable nonce transaction")}function Vt(e,t){return {accounts:[{address:e,role:z.WRITABLE},{address:Xe,role:z.READONLY},{address:t,role:z.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:Ze}}function qt(e){return e.programAddress===Ze&&e.data!=null&&Yt(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===z.WRITABLE&&e.accounts[1].address===Xe&&e.accounts[1].role===z.READONLY&&e.accounts[2].address!=null&&e.accounts[2].role===z.READONLY_SIGNER}function Yt(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function Qe(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&qt(e.instructions[0])}function hs({nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:r},n){let o=Qe(n);if(o&&n.lifetimeConstraint.nonce===e&&n.instructions[0].accounts[0].address===t&&n.instructions[0].accounts[2].address===r)return n;let s={...J(n),instructions:[Vt(t,r),...o?n.instructions.slice(1):n.instructions],lifetimeConstraint:{nonce:e}};return Object.freeze(s),s}function ys(e,t){if("feePayer"in t&&e===t.feePayer)return t;let r={...J(t),feePayer:e};return Object.freeze(r),r}function ws(e,t){let r={...J(t),instructions:[...t.instructions,e]};return Object.freeze(r),r}function Ss(e,t){let r={...J(t),instructions:[e,...t.instructions]};return Object.freeze(r),r}function Ye(e,t,r){e[t]=r(e[t]??{role:z.READONLY});}var w=Symbol("AddressMapTypeProperty");function Jt(e,t){let r={[e]:{[w]:0,role:z.WRITABLE_SIGNER}},n=new Set;for(let o of t){Ye(r,o.programAddress,i=>{if(n.add(o.programAddress),w in i){if(Y(i.role))switch(i[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(i[w]===2)return i}return {[w]:2,role:z.READONLY}});let s;if(o.accounts)for(let i of o.accounts)Ye(r,i.address,a=>{let{address:u,...l}=i;if(w in a)switch(a[w]){case 0:return a;case 1:{let p=qe(a.role,l.role);if("lookupTableAddress"in l){if(a.lookupTableAddress!==l.lookupTableAddress&&(s||(s=le()))(l.lookupTableAddress,a.lookupTableAddress)<0)return {[w]:1,...l,role:p}}else if(q(l.role))return {[w]:2,role:p};return a.role!==p?{...a,role:p}:a}case 2:{let p=qe(a.role,l.role);if(n.has(i.address)){if(Y(l.role))throw new Error(`This transaction includes an address (\`${i.address}\`) which is both invoked and marked writable. Program addresses may not be writable.`);return a.role!==p?{...a,role:p}:a}else return "lookupTableAddress"in l&&!q(a.role)?{...l,[w]:1,role:p}:a.role!==p?{...a,role:p}:a}}return "lookupTableAddress"in l?{...l,[w]:1}:{...l,[w]:2}});}return r}function Xt(e){let t;return Object.entries(e).sort(([n,o],[s,i])=>{if(o[w]!==i[w]){if(o[w]===0)return -1;if(i[w]===0)return 1;if(o[w]===2)return -1;if(i[w]===2)return 1}let a=q(o.role);if(a!==q(i.role))return a?-1:1;let u=Y(o.role);return u!==Y(i.role)?u?-1:1:(t||(t=le()),o[w]===1&&i[w]===1&&o.lookupTableAddress!==i.lookupTableAddress?t(o.lookupTableAddress,i.lookupTableAddress):t(n,s))}).map(([n,o])=>({address:n,...o}))}function Zt(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===z.WRITABLE?o.writableIndices.push(n.addressIndex):o.readableIndices.push(n.addressIndex);}return Object.keys(r).sort(le()).map(n=>({lookupTableAddress:n,...r[n]}))}function Qt(e){let t=0,r=0,n=0;for(let o of e){if("lookupTableAddress"in o)break;let s=Y(o.role);q(o.role)?(n++,s||r++):s||t++;}return {numReadonlyNonSignerAccounts:t,numReadonlySignerAccounts:r,numSignerAccounts:n}}function er(e){let t={};for(let[r,n]of e.entries())t[n.address]=r;return t}function tr(e,t){let r=er(t);return e.map(({accounts:n,data:o,programAddress:s})=>({programAddressIndex:r[s],...n?{accountIndices:n.map(({address:i})=>r[i])}:null,...o?{data:o}:null}))}function rr(e){return "nonce"in e?e.nonce:e.blockhash}function nr(e){let t=e.findIndex(n=>"lookupTableAddress"in n);return (t===-1?e:e.slice(0,t)).map(({address:n})=>n)}function et(e){let t=Jt(e.feePayer,e.instructions),r=Xt(t);return {...e.version!=="legacy"?{addressTableLookups:Zt(r)}:null,header:Qt(r),instructions:tr(e.instructions,r),lifetimeToken:rr(e.lifetimeConstraint),staticAccounts:nr(r),version:e.version}}function or(){return P([["lookupTableAddress",U(void 0)],["writableIndices",O(N(),{...null,size:_()})],["readableIndices",O(N(),{...void 0,size:_()})]],void 0)}function sr(){return P([["numSignerAccounts",N(void 0)],["numReadonlySignerAccounts",N(void 0)],["numReadonlyNonSignerAccounts",N(void 0)]],void 0)}function ir(){return ee(P([["programAddressIndex",N(void 0)],["accountIndices",O(N({description:""}),{description:"",size:_()})],["data",ce({description:"",size:_()})]]),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}})}function ar(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 tt(e){return ()=>{throw ar("decoder",e)}}var we=128,cr={description:"",fixedSize:null,maxSize:1};function ur(e,t=0){let r=e[t];return r&we?[r^we,t+1]:["legacy",t]}function lr(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|we])}function dr(){return {...cr,deserialize:ur,serialize:lr}}var pr={description:"",fixedSize:null,maxSize:null};function fr(e){return e.version==="legacy"?P(Je()).serialize(e):ee(P([...Je(),["addressTableLookups",mr()]]),t=>t.version==="legacy"?t:{...t,addressTableLookups:t.addressTableLookups??[]}).serialize(e)}function Je(){return [["version",dr()],["header",sr()],["staticAccounts",O(U(),{description:"",size:_()})],["lifetimeToken",G({description:"",encoding:B,size:32})],["instructions",O(ir(),{description:"",size:_()})]]}function mr(){return O(or(),{...null,size:_()})}function rt(){return {...pr,deserialize:tt("CompiledMessage"),serialize:fr}}async function gr(e,t){let r=rt().serialize(e);return await Ve(t,r)}async function Es(e,t){let r=et(t),n="signatures"in t?{...t.signatures}:{},o=await Promise.all(e.map(i=>Promise.all([He(i.publicKey),gr(r,i.privateKey)])));for(let[i,a]of o)n[i]=a;let s={...t,signatures:n};return Object.freeze(s),s}function br(e){let t=et(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}}var hr={description:"",fixedSize:null,maxSize:null};function yr(e){let t=br(e);return P([["signatures",O(ce({size:64}),{...null,size:_()})],["compiledMessage",rt()]]).serialize(t)}function wr(){return {...hr,deserialize:tt("CompiledMessage"),serialize:yr}}function xs(e){let t=wr().serialize(e);return btoa(String.fromCharCode(...t))}c();c();function F(e,...t){return t.reduce((r,n)=>n(r),e)}c();function xe(e,t,r){if(Array.isArray(e))return e.map((n,o)=>xe(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]=xe(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 ot(e,t){return xe(e,[],t)}var d={},Se,Ee;function Sr(){return Se||(Se={}),Se}function Er(){if(!Ee){let e=[["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"]],t=[...e,["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"]];Ee={getAccountInfo:t.map(r=>["value",...r]),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:t.map(r=>["value",d,...r]),getProgramAccounts:t.flatMap(r=>[["value",d,"account",...r],[d,"account",...r]]),getRecentPerformanceSamples:[[d,"samplePeriodSecs"]],getTokenAccountBalance:[["value","decimals"],["value","uiAmount"]],getTokenAccountsByDelegate:e.map(r=>["value",d,"account",...r]),getTokenAccountsByOwner:e.map(r=>["value",d,"account",...r]),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:t.map(r=>["value","accounts",d,...r])};}return Ee}function nt(e,t){return e.filter(r=>r[0]===d&&typeof t=="number"||r[0]===t).map(r=>r.slice(1))}function de(e,t){if(Array.isArray(e))return e.map((r,n)=>{let o=nt(t,n);return de(r,o)});if(typeof e=="object"&&e!==null){let r={};for(let[n,o]of Object.entries(e)){let s=nt(t,n);r[n]=de(o,s);}return r}else return typeof e=="number"&&t.length===0&&Number.isInteger(e)?BigInt(e):e}function xr(e,t){let r=t?Er()[t]:void 0;return de(e,r??[])}function Ir(e,t){let r=t?Sr()[t]:void 0;return de(e,r??[])}function st(e){return new Proxy({},{defineProperty(){return !1},deleteProperty(){return !1},get(...t){let[r,n]=t,o=n.toString();return function(...s){let i=e?.onIntegerOverflow,a=ot(s,i?(u,l)=>i(o,u,l):void 0);return {methodName:o,params:a,responseProcessor:u=>xr(u,o)}}}})}function it(e){return new Proxy({},{defineProperty(){return !1},deleteProperty(){return !1},get(...t){let[r,n]=t,o=n.toString();return function(...s){let i=e?.onIntegerOverflow;return {params:ot(s,i?(u,l)=>i(o,u,l):void 0),responseProcessor:u=>Ir(u,o),subscribeMethodName:o.replace(/Notifications$/,"Subscribe"),unsubscribeMethodName:o.replace(/Notifications$/,"Unsubscribe")}}}})}c();var ct=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"}},Ie=0;function Ar(){let e=Ie;return Ie=(Ie+1)%Number.MAX_SAFE_INTEGER,e}function Te(e,t){return {id:Ar(),jsonrpc:"2.0",method:e,params:t}}function Tr(e,t){return {async send(r){let{methodName:n,params:o,responseProcessor:s}=t,i=Te(n,o),a=await e.transport({payload:i,signal:r?.abortSignal});if("error"in a)throw new ct(a.error);return s?s(a.result):a.result}}}function Rr(e){return new Proxy(e.api,{defineProperty(){return !1},deleteProperty(){return !1},get(t,r,n){return function(...o){let s=r.toString(),i=Reflect.get(t,s,n),a=i?i(...o):{methodName:s,params:o};return Tr(e,a)}}})}function ut(e){return Rr(e)}function zr(e,t){(async()=>{try{for await(let r of e);}catch{}finally{t();}})();}function _r(e,{params:t,subscribeMethodName:r,unsubscribeMethodName:n,responseProcessor:o}){return {async subscribe({abortSignal:s}){s.throwIfAborted();let i;function a(){if(i!==void 0){let g=Te(n,[i]);p.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(g).finally(()=>{u.abort();});}else u.abort();}s.addEventListener("abort",a);let u=new AbortController,l=Te(r,t),p=await e.transport({payload:l,signal:u.signal});function f(){s.removeEventListener("abort",a);}zr(p,f);for await(let g of p)if("id"in g&&g.id===l.id){if("error"in g)throw new ct(g.error);i=g.result;break}if(i==null)throw new Error("Failed to obtain a subscription id from the server");return {async*[Symbol.asyncIterator](){for await(let g of p){if(!("params"in g)||g.params.subscription!==i)continue;let E=g.params.result;yield o?o(E):E;}}}}}}function Cr(e){return new Proxy(e.api,{defineProperty(){return !1},deleteProperty(){return !1},get(t,r,n){return function(...o){let s=r.toString(),i=Reflect.get(t,s,n);if(r.toString().endsWith("Notifications")===!1&&!i)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=i?i(...o):{params:o,subscribeMethodName:s.replace(/Notifications$/,"Subscribe"),unsubscribeMethodName:s.replace(/Notifications$/,"Unsubscribe")};return _r(e,a)}}})}function lt(e){return Cr(e)}var vr=globalThis.fetch,kr=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 Br(e){let t={};for(let r in e)t[r.toLowerCase()]=e[r];return t}function dt({httpAgentNodeOnly:e,headers:t,url:r}){let n=void 0;let o=t&&Br(t);return async function({payload:i,signal:a}){let u=JSON.stringify(i),l={agent:n,body:u,headers:{...o,accept:"application/json","content-length":u.length.toString(),"content-type":"application/json; charset=utf-8"},method:"POST",signal:a},p=await vr(r,l);if(!p.ok)throw new kr({message:p.statusText,statusCode:p.status});return await p.json()}}var X=globalThis.WebSocket,at=Symbol(void 0);async function Pr({sendBufferHighWatermark:e,signal:t,url:r}){return new Promise((n,o)=>{t.addEventListener("abort",a,{once:!0});let s=new Map;function i(h){let y=[...s.values()].filter(x=>x.__hasPolled).map(({onError:x})=>x);s.clear(),y.forEach(x=>{try{x(h);}catch{}});}function a(){i(at),b.readyState!==X.CLOSED&&b.readyState!==X.CLOSING&&b.close(1e3);}function u(h){f?.onCancel(),t.removeEventListener("abort",a),b.removeEventListener("close",u),b.removeEventListener("error",l),b.removeEventListener("open",g),b.removeEventListener("message",E),i(h);}function l(h){p||o(new Error("WebSocket failed to connect",{cause:h}));}let p=!1,f;function g(){p=!0,n({async send(h){let y=JSON.stringify(h);if(!f&&b.readyState===X.OPEN&&b.bufferedAmount>e){let x,L=new Promise((K,Et)=>{let Ce=setInterval(()=>{(b.readyState!==X.OPEN||!(b.bufferedAmount>e))&&(clearInterval(Ce),f=void 0,K());},16);x=()=>{f=void 0,clearInterval(Ce),Et(new Error("WebSocket was closed before payload could be sent"));};});f={onCancel:x,promise:L};}f&&await f.promise,b.send(y);},async*[Symbol.asyncIterator](){let h=Symbol();s.set(h,{__hasPolled:!1,queuedMessages:[]});try{for(;;){let y=s.get(h);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 x=y.queuedMessages;if(x.length)y.queuedMessages=[],yield*x;else try{yield await new Promise((L,K)=>{s.set(h,{__hasPolled:!0,onError:K,onMessage:L});});}catch(L){if(L===at)return;throw new Error("WebSocket connection closed",{cause:L})}}}finally{s.delete(h);}}});}function E({data:h}){let y=JSON.parse(h);s.forEach((x,L)=>{if(x.__hasPolled){let{onMessage:K}=x;s.set(L,{__hasPolled:!1,queuedMessages:[]}),K(y);}else x.queuedMessages.push(y);});}let b=new X(r);b.addEventListener("close",u),b.addEventListener("error",l),b.addEventListener("open",g),b.addEventListener("message",E);})}function pt({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 s=await Pr({sendBufferHighWatermark:e,signal:o,url:t});return o?.throwIfAborted(),await s.send(n),{[Symbol.asyncIterator]:s[Symbol.asyncIterator].bind(s),send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:s.send.bind(s)}}}var gt=ve(Re(),1);c();c();var pe=class extends Error{constructor(r,n,o){let s=(typeof n[0]=="number"?n[0]:parseInt(n[0],10))+1,i="",a=s%10,u=s%100;a==1&&u!=11?i=s+"st":a==2&&u!=12?i=s+"nd":a==3&&u!=13?i=s+"rd":i=s+"th";let l=n.length>1?n.slice(1).map(p=>typeof p=="number"?`[${p}]`:p).join("."):null;super(`The ${i} 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 ze={onIntegerOverflow(e,t,r){throw new pe(e,t,r)}};c();c();function Wr(e,t){(async()=>{try{for await(let r of e);}catch{}finally{t();}})();}function fe({getAbortSignalFromInputArgs:e,getCacheEntryMissingError:t,getCacheKeyFromInputArgs:r,onCacheHit:n,onCreateIterable:o}){let s=new Map;function i(a){let u=s.get(a);if(!u)throw t(a);return u}return async(...a)=>{let u=r(...a),l=e(...a);if(u===void 0)return await o(l,...a);let p=()=>{s.delete(u),l.removeEventListener("abort",f);},f=()=>{let g=i(u);g.purgeScheduled!==!0&&(g.purgeScheduled=!0,globalThis.queueMicrotask(()=>{g.purgeScheduled=!1,g.referenceCount===0&&(g.abortController.abort(),p());})),g.referenceCount--;};l.addEventListener("abort",f);try{let g=s.get(u);if(g){g.referenceCount++;let E=g.iterable,b="then"in E?await E:E;return await n(b,...a),b}else {let E=new AbortController,b=o(E.signal,...a),h={abortController:E,iterable:b,purgeScheduled:!1,referenceCount:1};s.set(u,h);let y=await b;return Wr(y,p),h.iterable=y,y}}catch(g){throw p(),g}}}var _e=Symbol(void 0);function Mr(e,t){(async()=>{try{for await(let r of e);}catch{}finally{t();}})();}function mt({getDeduplicationKey:e,rpcSubscriptions:t}){let r=new Map;return new Proxy(t,{defineProperty(){return !1},deleteProperty(){return !1},get(n,o,s){let i=Reflect.get(n,o,s);return typeof i!="function"?i:function(...a){let u=e(o,a);if(u===void 0)return i(...a);if(r.has(u))return r.get(u);let l=fe({getAbortSignalFromInputArgs:({abortSignal:f})=>f,getCacheEntryMissingError(f){return new Error(`Found no cache entry for subscription with deduplication key \`${f?.toString()}\``)},getCacheKeyFromInputArgs:()=>u,async onCacheHit(f,g){},async onCreateIterable(f,g){let b=await i(...a).subscribe({...g,abortSignal:f});return Mr(b,()=>{r.delete(u);}),b}}),p={async subscribe(...f){let g=await l(...f),{abortSignal:E}=f[0],b;return {...g,async*[Symbol.asyncIterator](){b||(b=E.aborted?Promise.reject(_e):new Promise((h,y)=>{E.addEventListener("abort",()=>{y(_e);});}));try{let h=g[Symbol.asyncIterator]();for(;;){let y=await Promise.race([h.next(),b]);if(y.done)return;yield y.value;}}catch(h){if(h===_e)return;throw r.delete(u),h}}}}};return r.set(u,p),p}}})}function Zs(e){return ut({...e,api:st(ze)})}function Qs(e){return F(lt({...e,api:it(ze)}),t=>mt({getDeduplicationKey:(...r)=>(0, gt.default)(r),rpcSubscriptions:t}))}c();c();function bt(e,t){let r;return async function(o){let{payload:s,signal:i}=o,a=t(s);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 u=r[a];if(u.numConsumers++,i){let l=u.responsePromise;return await new Promise((p,f)=>{let g=E=>{i.removeEventListener("abort",g),u.numConsumers-=1,u.numConsumers===0&&u.abortController.abort();let b=new DOMException(E.target.reason,"AbortError");f(b);};i.addEventListener("abort",g),l.then(p).finally(()=>{i.removeEventListener("abort",g);});})}else return await u.responsePromise}}c();var ht=ve(Re(),1);function Ur(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 yt(e){return Ur(e)?(0, ht.default)([e.method,e.params]):void 0}function Fr(e){let t={};for(let r in e)t[r.toLowerCase()]=e[r];return t}function li(e){return F(dt({...e,headers:{...e.headers?Fr(e.headers):void 0,"solana-client":"js/2.0.0-development"}}),t=>bt(t,yt))}c();c();var Kr={jsonrpc:"2.0",method:"ping"};function wt({intervalMs:e,transport:t}){let r=new Map;return async(...n)=>{let o=await t(...n),s;function i(){o.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(Kr);}function a(){clearInterval(s),s=setInterval(i,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:(...p)=>(a(),o.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(...p))}),(async()=>{try{for await(let p of o)a();}catch{}finally{r.delete(o),clearInterval(s),u&&globalThis.window.removeEventListener("offline",u),l&&globalThis.window.removeEventListener("online",l);}})(),globalThis.navigator.onLine&&a();let u,l;u=()=>{clearInterval(s);},l=()=>{i(),a();},globalThis.window.addEventListener("offline",u),globalThis.window.addEventListener("online",l);}return r.get(o)}}c();var jr=Symbol(void 0);function St({getShard:e,transport:t}){return fe({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):jr,onCacheHit:(r,{payload:n})=>r.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(n),onCreateIterable:(r,n)=>t({...n,signal:r})})}function xi(e){let{getShard:t,intervalMs:r,...n}=e;return F(pt({...n,sendBufferHighWatermark:e.sendBufferHighWatermark??131072}),o=>wt({intervalMs:r??5e3,transport:o}),o=>St({getShard:t,transport:o}))}
|
|
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 =
|
|
12
|
-
exports.address =
|
|
13
|
-
exports.appendTransactionInstruction =
|
|
14
|
-
exports.
|
|
15
|
-
exports.assertIsBlockhash =
|
|
16
|
-
exports.assertIsDurableNonceTransaction =
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
30
|
-
exports.
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.
|
|
43
|
-
exports.
|
|
11
|
+
exports.AccountRole = Tr;
|
|
12
|
+
exports.address = gr;
|
|
13
|
+
exports.appendTransactionInstruction = Ks;
|
|
14
|
+
exports.assertIsAddress = Ot;
|
|
15
|
+
exports.assertIsBlockhash = Ls;
|
|
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;
|
|
33
|
+
exports.createTransaction = Fs;
|
|
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;
|
|
50
|
+
exports.isTransactionSignature = Gs;
|
|
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;
|
|
58
|
+
exports.setTransactionLifetimeUsingBlockhash = Us;
|
|
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;
|
|
44
68
|
|
|
45
69
|
return exports;
|
|
46
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
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,7 +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';
|
|
10
|
+
export * from './transaction-confirmation';
|
|
11
|
+
export * from './transaction-confirmation-strategy-blockheight';
|
|
12
|
+
export * from './transaction-confirmation-strategy-nonce';
|
|
13
|
+
export * from './transaction-confirmation-strategy-recent-signature';
|
|
8
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/types/rpc.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { SolanaRpcMethods, SolanaRpcSubscriptions } from '@solana/rpc-core';
|
|
1
|
+
import { SolanaRpcMethods, SolanaRpcSubscriptions, SolanaRpcSubscriptionsUnstable } from '@solana/rpc-core';
|
|
2
2
|
import { createJsonRpc, createJsonSubscriptionRpc } from '@solana/rpc-transport';
|
|
3
3
|
import type { Rpc, RpcSubscriptions } from '@solana/rpc-transport/dist/types/json-rpc-types';
|
|
4
4
|
export declare function createSolanaRpc(config: Omit<Parameters<typeof createJsonRpc>[0], 'api'>): Rpc<SolanaRpcMethods>;
|
|
5
5
|
export declare function createSolanaRpcSubscriptions(config: Omit<Parameters<typeof createJsonSubscriptionRpc>[0], 'api'>): RpcSubscriptions<SolanaRpcSubscriptions>;
|
|
6
|
+
export declare function createSolanaRpcSubscriptions_UNSTABLE(config: Omit<Parameters<typeof createJsonSubscriptionRpc>[0], 'api'>): RpcSubscriptions<SolanaRpcSubscriptions & SolanaRpcSubscriptionsUnstable>;
|
|
6
7
|
//# sourceMappingURL=rpc.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 { Slot } from '@solana/rpc-core/dist/types/rpc-methods/common';
|
|
2
|
+
import type { SlotNotificationsApi } from '@solana/rpc-core/dist/types/rpc-subscriptions/slot-notifications';
|
|
3
|
+
import { RpcSubscriptions } from '@solana/rpc-transport/dist/types/json-rpc-types';
|
|
4
|
+
type GetBlockHeightExceedencePromiseFn = (config: {
|
|
5
|
+
abortSignal: AbortSignal;
|
|
6
|
+
lastValidBlockHeight: Slot;
|
|
7
|
+
}) => Promise<void>;
|
|
8
|
+
export declare function createBlockHeightExceedencePromiseFactory(rpcSubscriptions: RpcSubscriptions<SlotNotificationsApi>): GetBlockHeightExceedencePromiseFn;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=transaction-confirmation-strategy-blockheight.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Base58EncodedAddress } from '@solana/addresses';
|
|
2
|
+
import { Commitment } from '@solana/rpc-core';
|
|
3
|
+
import { GetAccountInfoApi } from '@solana/rpc-core/dist/types/rpc-methods/getAccountInfo';
|
|
4
|
+
import { AccountNotificationsApi } from '@solana/rpc-core/dist/types/rpc-subscriptions/account-notifications';
|
|
5
|
+
import { Rpc, RpcSubscriptions } from '@solana/rpc-transport/dist/types/json-rpc-types';
|
|
6
|
+
import { Nonce } from '@solana/transactions';
|
|
7
|
+
type GetNonceInvalidationPromiseFn = (config: {
|
|
8
|
+
abortSignal: AbortSignal;
|
|
9
|
+
commitment: Commitment;
|
|
10
|
+
currentNonceValue: Nonce;
|
|
11
|
+
nonceAccountAddress: Base58EncodedAddress;
|
|
12
|
+
}) => Promise<void>;
|
|
13
|
+
export declare function createNonceInvalidationPromiseFactory(rpc: Rpc<GetAccountInfoApi>, rpcSubscriptions: RpcSubscriptions<AccountNotificationsApi>): GetNonceInvalidationPromiseFn;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=transaction-confirmation-strategy-nonce.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
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Commitment } from '@solana/rpc-core';
|
|
2
|
+
import { GetSignatureStatusesApi } from '@solana/rpc-core/dist/types/rpc-methods/getSignatureStatuses';
|
|
3
|
+
import { SignatureNotificationsApi } from '@solana/rpc-core/dist/types/rpc-subscriptions/signature-notifications';
|
|
4
|
+
import { Rpc, RpcSubscriptions } from '@solana/rpc-transport/dist/types/json-rpc-types';
|
|
5
|
+
import { TransactionSignature } from '@solana/transactions';
|
|
6
|
+
type GetRecentSignatureConfirmationPromiseFn = (config: {
|
|
7
|
+
abortSignal: AbortSignal;
|
|
8
|
+
commitment: Commitment;
|
|
9
|
+
signature: TransactionSignature;
|
|
10
|
+
}) => Promise<void>;
|
|
11
|
+
export declare function createRecentSignatureConfirmationPromiseFactory(rpc: Rpc<GetSignatureStatusesApi>, rpcSubscriptions: RpcSubscriptions<SignatureNotificationsApi>): GetRecentSignatureConfirmationPromiseFn;
|
|
12
|
+
export {};
|
|
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
|