@orca-so/wavebreak
Version:
The wavebreak JS client for interacting with the wavebreak program.
1,374 lines (1,371 loc) • 396 kB
JavaScript
var OB = 1, bB = 2, KB = 3, HB = 4, pB = 5, PB = 6, qB = 7, vB = 8, VB = 9, xB = 10, WB = -32700, ZB = -32603, XB = -32602, zB = -32601, jB = -32600, $B = -32016, AQ = -32015, IQ = -32014, gQ = -32013, CQ = -32012, BQ = -32011, QQ = -32010, EQ = -32009, eQ = -32008, iQ = -32007, oQ = -32006, tQ = -32005, nQ = -32004, aQ = -32003, rQ = -32002, sQ = -32001, MI = 28e5, yI = 2800001, cQ = 2800002, DQ = 2800003, uQ = 2800004, RQ = 2800005, GI = 2800006, fI = 2800007, II = 2800008, _I = 2800009, lQ = 2800010, kI = 323e4, UI = 32300001, mI = 3230002, NQ = 3230003, wQ = 3230004, FI = 361e4, LI = 3610001, dQ = 3610002, hQ = 3610003, SQ = 3610004, MQ = 3610005, yQ = 3610006, GQ = 3610007, fQ = 3611e3, _Q = 3704e3, kQ = 3704001, UQ = 3704002, mQ = 3704003, FQ = 3704004, LQ = 4128e3, JQ = 4128001, TQ = 4128002, YQ = 4615e3, OQ = 4615001, bQ = 4615002, KQ = 4615003, HQ = 4615004, pQ = 4615005, PQ = 4615006, qQ = 4615007, vQ = 4615008, VQ = 4615009, xQ = 4615010, WQ = 4615011, ZQ = 4615012, XQ = 4615013, zQ = 4615014, jQ = 4615015, $Q = 4615016, AE = 4615017, IE = 4615018, gE = 4615019, CE = 4615020, BE = 4615021, QE = 4615022, EE = 4615023, eE = 4615024, iE = 4615025, JI = 4615026, oE = 4615027, tE = 4615028, nE = 4615029, aE = 4615030, rE = 4615031, sE = 4615032, cE = 4615033, DE = 4615034, uE = 4615035, RE = 4615036, lE = 4615037, NE = 4615038, wE = 4615039, dE = 4615040, hE = 4615041, SE = 4615042, ME = 4615043, yE = 4615044, GE = 4615045, fE = 4615046, _E = 4615047, kE = 4615048, UE = 4615049, mE = 4615050, FE = 4615051, LE = 4615052, JE = 4615053, TE = 4615054, YE = 5508e3, OE = 5508001, bE = 5508002, KE = 5508003, HE = 5508004, pE = 5508005, PE = 5508006, qE = 5508007, vE = 5508008, VE = 5508009, xE = 5508010, WE = 5508011, ZE = 5663e3, XE = 5663001, zE = 5663002, jE = 5663003, $E = 5663004, Ae = 5663005, Ie = 5663006, ge = 5663007, Ce = 5663008, Be = 5663009, Qe = 5663010, Ee = 5663011, ee = 5663012, ie = 5663013, oe = 5663014, te = 5663015, ne = 5663016, ae = 5663017, re = 5663018, se = 5663019, ce = 705e4, De = 7050001, ue = 7050002, Re = 7050003, le = 7050004, Ne = 7050005, we = 7050006, de = 7050007, he = 7050008, Se = 7050009, Me = 7050010, ye = 7050011, Ge = 7050012, fe = 7050013, _e = 7050014, ke = 7050015, Ue = 7050016, me = 7050017, Fe = 7050018, Le = 7050019, Je = 7050020, Te = 7050021, Ye = 7050022, Oe = 7050023, be = 7050024, Ke = 7050025, He = 7050026, pe = 7050027, Pe = 7050028, qe = 7050029, ve = 7050030, Ve = 7050031, xe = 7050032, We = 7050033, Ze = 7050034, Xe = 7050035, ze = 7050036, TI = 8078e3, YI = 8078001, OI = 8078002, je = 8078003, bI = 8078004, KI = 8078005, HI = 8078006, pI = 8078007, PI = 8078008, qI = 8078009, vI = 8078010, VI = 8078011, YA = 8078012, $e = 8078013, Ai = 8078014, Ii = 8078015, gi = 8078016, xI = 8078017, WI = 8078018, Ci = 8078019, Bi = 8078020, Qi = 8078021, gI = 8078022, Ei = 81e5, ei = 8100001, ii = 8100002, oi = 8100003, ti = 819e4, ni = 8190001, ai = 8190002, ri = 8190003, si = 8190004, ci = 99e5, Di = 9900001, ui = 9900002, Ri = 9900003, li = 9900004;
function ZI(A) {
return Array.isArray(A) ? "%5B" + A.map(ZI).join(
"%2C%20"
/* ", " */
) + /* "]" */
"%5D" : typeof A == "bigint" ? `${A}n` : encodeURIComponent(
String(
A != null && Object.getPrototypeOf(A) === null ? (
// Plain objects with no prototype don't have a `toString` method.
// Convert them before stringifying them.
{ ...A }
) : A
)
);
}
function Ni([A, I]) {
return `${A}=${ZI(I)}`;
}
function wi(A) {
const I = Object.entries(A).map(Ni).join("&");
return btoa(I);
}
var di = {
[kI]: "Account not found at address: $address",
[wQ]: "Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",
[NQ]: "Expected decoded account at address: $address",
[mI]: "Failed to decode account data at address: $address",
[UI]: "Accounts not found at addresses: $addresses",
[_I]: "Unable to find a viable program address bump seed.",
[cQ]: "$putativeAddress is not a base58-encoded address.",
[MI]: "Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",
[DQ]: "The `CryptoKey` must be an `Ed25519` public key.",
[II]: "Invalid seeds; point must fall off the Ed25519 curve.",
[uQ]: "Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",
[GI]: "A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",
[fI]: "The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",
[RQ]: "Expected program derived address bump to be in the range [0, 255], got: $bump.",
[lQ]: "Program address cannot end with PDA marker.",
[yI]: "Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",
[HB]: "Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",
[OB]: "The network has progressed past the last block for which this transaction could have been committed.",
[TI]: "Codec [$codecDescription] cannot decode empty byte arrays.",
[gI]: "Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",
[Bi]: "Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",
[KI]: "Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",
[HI]: "Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",
[bI]: "Encoder and decoder must either both be fixed-size or variable-size.",
[PI]: "Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",
[OI]: "Expected a fixed-size codec, got a variable-size one.",
[$e]: "Codec [$codecDescription] expected a positive byte length, got $bytesLength.",
[je]: "Expected a variable-size codec, got a fixed-size one.",
[Ci]: "Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",
[YI]: "Codec [$codecDescription] expected $expected bytes, got $bytesLength.",
[WI]: "Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",
[qI]: "Invalid discriminated union variant. Expected one of [$variants], got $value.",
[vI]: "Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",
[Ii]: "Invalid literal union variant. Expected one of [$variants], got $value.",
[pI]: "Expected [$codecDescription] to have $expected items, got $actual.",
[YA]: "Invalid value $value for base $base with alphabet $alphabet.",
[gi]: "Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",
[VI]: "Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",
[Ai]: "Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",
[Qi]: "Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",
[xI]: "Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",
[fQ]: "No random values implementation could be found.",
[VQ]: "instruction requires an uninitialized account",
[EE]: "instruction tries to borrow reference for an account which is already borrowed",
[eE]: "instruction left account with an outstanding borrowed reference",
[BE]: "program other than the account's owner changed the size of the account data",
[pQ]: "account data too small for instruction",
[QE]: "instruction expected an executable account",
[fE]: "An account does not have enough lamports to be rent-exempt",
[kE]: "Program arithmetic overflowed",
[GE]: "Failed to serialize or deserialize account data: $encodedData",
[TE]: "Builtin programs must consume compute units",
[sE]: "Cross-program invocation call depth too deep",
[NE]: "Computational budget exceeded",
[JI]: "custom program error: #$code",
[AE]: "instruction contains duplicate accounts",
[iE]: "instruction modifications of multiply-passed account differ",
[aE]: "executable accounts must be rent exempt",
[tE]: "instruction changed executable accounts data",
[nE]: "instruction changed the balance of an executable account",
[IE]: "instruction changed executable bit of an account",
[zQ]: "instruction modified data of an account it does not own",
[XQ]: "instruction spent from the balance of an account it does not own",
[OQ]: "generic instruction error",
[mE]: "Provided owner is not allowed",
[ME]: "Account is immutable",
[yE]: "Incorrect authority provided",
[qQ]: "incorrect program id for instruction",
[PQ]: "insufficient funds for instruction",
[HQ]: "invalid account data for instruction",
[_E]: "Invalid account owner",
[bQ]: "invalid program argument",
[oE]: "program returned invalid error code",
[KQ]: "invalid instruction data",
[lE]: "Failed to reallocate account data",
[RE]: "Provided seeds do not result in a valid address",
[FE]: "Accounts data allocations exceeded the maximum allowed per transaction",
[LE]: "Max accounts exceeded",
[JE]: "Max instruction trace length exceeded",
[uE]: "Length of the seed is too long for address generation",
[cE]: "An account required by the instruction is missing",
[vQ]: "missing required signature for instruction",
[ZQ]: "instruction illegally modified the program id of an account",
[CE]: "insufficient account keys for instruction",
[wE]: "Cross-program invocation with unauthorized signer or writable account",
[dE]: "Failed to create program execution environment",
[SE]: "Program failed to compile",
[hE]: "Program failed to complete",
[$Q]: "instruction modified data of a read-only account",
[jQ]: "instruction changed the balance of a read-only account",
[DE]: "Cross-program invocation reentrancy not allowed for this instruction",
[gE]: "instruction modified rent epoch of an account",
[WQ]: "sum of account balances before and after instruction do not match",
[xQ]: "instruction requires an initialized account",
[YQ]: "",
[rE]: "Unsupported program id",
[UE]: "Unsupported sysvar",
[LQ]: "The instruction does not have any accounts.",
[JQ]: "The instruction does not have any data.",
[TQ]: "Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",
[pB]: "Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",
[bB]: "The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",
[ui]: "Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",
[li]: "Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",
[Di]: "Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",
[ci]: "Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",
[Ri]: "Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",
[ZB]: "JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",
[XB]: "JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",
[jB]: "JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",
[zB]: "JSON-RPC error: The method does not exist / is not available ($__serverMessage)",
[WB]: "JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",
[CQ]: "$__serverMessage",
[sQ]: "$__serverMessage",
[nQ]: "$__serverMessage",
[IQ]: "$__serverMessage",
[QQ]: "$__serverMessage",
[EQ]: "$__serverMessage",
[$B]: "Minimum context slot has not been reached",
[tQ]: "Node is unhealthy; behind by $numSlotsBehind slots",
[eQ]: "No snapshot",
[rQ]: "Transaction simulation failed",
[iQ]: "$__serverMessage",
[BQ]: "Transaction history is not available from this node",
[oQ]: "$__serverMessage",
[gQ]: "Transaction signature length mismatch",
[aQ]: "Transaction signature verification failure",
[AQ]: "$__serverMessage",
[_Q]: "Key pair bytes must be of length 64, got $byteLength.",
[kQ]: "Expected private key bytes with length 32. Actual length: $actualLength.",
[UQ]: "Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",
[FQ]: "The provided private key does not match the provided public key.",
[mQ]: "Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",
[PB]: "Lamports value must be in the range [0, 2e64-1]",
[qB]: "`$value` cannot be parsed as a `BigInt`",
[xB]: "$message",
[vB]: "`$value` cannot be parsed as a `Number`",
[KB]: "No nonce account could be found at address `$nonceAccountAddress`",
[ti]: "The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",
[ai]: "WebSocket was closed before payload could be added to the send buffer",
[ri]: "WebSocket connection closed",
[si]: "WebSocket failed to connect",
[ni]: "Failed to obtain a subscription id from the server",
[oi]: "Could not find an API plan for RPC method: `$method`",
[Ei]: "The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.",
[ii]: "HTTP error ($statusCode): $message",
[ei]: "HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",
[YE]: "Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",
[OE]: "The provided value does not implement the `KeyPairSigner` interface",
[KE]: "The provided value does not implement the `MessageModifyingSigner` interface",
[HE]: "The provided value does not implement the `MessagePartialSigner` interface",
[bE]: "The provided value does not implement any of the `MessageSigner` interfaces",
[PE]: "The provided value does not implement the `TransactionModifyingSigner` interface",
[qE]: "The provided value does not implement the `TransactionPartialSigner` interface",
[vE]: "The provided value does not implement the `TransactionSendingSigner` interface",
[pE]: "The provided value does not implement any of the `TransactionSigner` interfaces",
[VE]: "More than one `TransactionSendingSigner` was identified.",
[xE]: "No `TransactionSendingSigner` was identified. Please provide a valid `ITransactionWithSingleSendingSigner` transaction.",
[WE]: "Wallet account signers do not support signing multiple messages/transactions in a single operation",
[GQ]: "Cannot export a non-extractable key.",
[LI]: "No digest implementation could be found.",
[FI]: "Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",
[dQ]: `This runtime does not support the generation of Ed25519 key pairs.
Install @solana/webcrypto-ed25519-polyfill and call its \`install\` function before generating keys in environments that do not support Ed25519.
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.`,
[hQ]: "No signature verification implementation could be found.",
[SQ]: "No key generation implementation could be found.",
[MQ]: "No signing implementation could be found.",
[yQ]: "No key export implementation could be found.",
[VB]: "Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",
[Ue]: "Transaction processing left an account with an outstanding borrowed reference",
[De]: "Account in use",
[ue]: "Account loaded twice",
[Re]: "Attempt to debit an account but found no record of a prior credit.",
[Oe]: "Transaction loads an address table account that doesn't exist",
[de]: "This transaction has already been processed",
[he]: "Blockhash not found",
[Se]: "Loader call chain is too deep",
[ke]: "Transactions are currently disabled due to cluster maintenance",
[ve]: "Transaction contains a duplicate instruction ($index) that is not allowed",
[Ne]: "Insufficient funds for fee",
[Ve]: "Transaction results in an account ($accountIndex) with insufficient funds for rent",
[we]: "This account may not be used to pay transaction fees",
[ye]: "Transaction contains an invalid account reference",
[Ke]: "Transaction loads an address table account with invalid data",
[He]: "Transaction address table lookup uses an invalid index",
[be]: "Transaction loads an address table account with an invalid owner",
[We]: "LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",
[fe]: "This program may not be used for executing instructions",
[pe]: "Transaction leaves an account with a lower balance than rent-exempt minimum",
[Le]: "Transaction loads a writable account that cannot be written",
[xe]: "Transaction exceeded max loaded accounts data size cap",
[Me]: "Transaction requires a fee but has no signature present",
[le]: "Attempt to load a program that does not exist",
[Xe]: "Execution of the program referenced by account at index $accountIndex is temporarily restricted.",
[Ze]: "ResanitizationNeeded",
[_e]: "Transaction failed to sanitize accounts offsets correctly",
[Ge]: "Transaction did not pass signature verification",
[Ye]: "Transaction locked too many accounts",
[ze]: "Sum of account balances before and after transaction do not match",
[ce]: "The transaction failed with the error `$errorName`",
[Fe]: "Transaction version is unsupported",
[Te]: "Transaction would exceed account data limit within the block",
[qe]: "Transaction would exceed total account data limit",
[Je]: "Transaction would exceed max account limit within the block",
[me]: "Transaction would exceed max Block Cost Limit",
[Pe]: "Transaction would exceed max Vote Cost Limit",
[te]: "Attempted to sign a transaction with an address that is not a signer for it",
[Qe]: "Transaction is missing an address at index: $index.",
[ne]: "Transaction has no expected signers therefore it cannot be encoded",
[zE]: "Transaction does not have a blockhash lifetime",
[jE]: "Transaction is not a durable nonce transaction",
[Ae]: "Contents of these address lookup tables unknown: $lookupTableAddresses",
[Ie]: "Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved",
[Ce]: "No fee payer set in CompiledTransaction",
[ge]: "Could not find program address at index $index",
[re]: "Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more",
[se]: "Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more",
[Ee]: "Transaction is missing a fee payer.",
[ee]: "Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",
[oe]: "Transaction first instruction is not advance nonce account instruction.",
[ie]: "Transaction with no instructions cannot be durable nonce transaction.",
[ZE]: "This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",
[XE]: "This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",
[ae]: "The transaction message expected the transaction to have $signerAddressesLength signatures, got $signaturesLength.",
[Be]: "Transaction is missing signatures for addresses: $addresses.",
[$E]: "Transaction version must be in the range [0, 127]. `$actualVersion` given"
}, eA = "i", BA = "t";
function hi(A, I = {}) {
const g = di[A];
if (g.length === 0)
return "";
let B;
function C(E) {
if (B[BA] === 2) {
const e = g.slice(B[eA] + 1, E);
Q.push(
e in I ? (
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
`${I[e]}`
) : `$${e}`
);
} else B[BA] === 1 && Q.push(g.slice(B[eA], E));
}
const Q = [];
return g.split("").forEach((E, e) => {
if (e === 0) {
B = {
[eA]: 0,
[BA]: g[0] === "\\" ? 0 : g[0] === "$" ? 2 : 1
/* Text */
};
return;
}
let r;
switch (B[BA]) {
case 0:
r = {
[eA]: e,
[BA]: 1
/* Text */
};
break;
case 1:
E === "\\" ? r = {
[eA]: e,
[BA]: 0
/* EscapeSequence */
} : E === "$" && (r = {
[eA]: e,
[BA]: 2
/* Variable */
});
break;
case 2:
E === "\\" ? r = {
[eA]: e,
[BA]: 0
/* EscapeSequence */
} : E === "$" ? r = {
[eA]: e,
[BA]: 2
/* Variable */
} : E.match(/\w/) || (r = {
[eA]: e,
[BA]: 1
/* Text */
});
break;
}
r && (B !== r && C(e), B = r);
}), C(), Q.join("");
}
function Si(A, I = {}) {
if (process.env.NODE_ENV !== "production")
return hi(A, I);
{
let g = `Solana error #${A}; Decode this error by running \`npx @solana/errors decode -- ${A}`;
return Object.keys(I).length && (g += ` '${wi(I)}'`), `${g}\``;
}
}
function XI(A, I) {
return A instanceof Error && A.name === "SolanaError" ? I !== void 0 ? A.context.__code === I : !0 : !1;
}
var F = class extends Error {
/**
* Indicates the root cause of this {@link SolanaError}, if any.
*
* For example, a transaction error might have an instruction error as its root cause. In this
* case, you will be able to access the instruction error on the transaction error as `cause`.
*/
cause = this.cause;
/**
* Contains context that can assist in understanding or recovering from a {@link SolanaError}.
*/
context;
constructor(...[A, I]) {
let g, B;
if (I) {
const { cause: Q, ...E } = I;
Q && (B = { cause: Q }), Object.keys(E).length > 0 && (g = E);
}
const C = Si(A, g);
super(C, B), this.context = {
__code: A,
...g
}, this.name = "SolanaError";
}
}, Mi = (A, I) => {
if (A.length >= I) return A;
const g = new Uint8Array(I).fill(0);
return g.set(A), g;
}, yi = (A, I) => Mi(A.length <= I ? A : A.slice(0, I), I);
function h(A, I, g) {
const B = g === 0 && A.length === I.length ? A : A.slice(g, g + I.length);
return B.length !== I.length ? !1 : I.every((C, Q) => C === B[Q]);
}
function oA(A, I) {
return "fixedSize" in I ? I.fixedSize : I.getSizeFromValue(A);
}
function j(A) {
return Object.freeze({
...A,
encode: (I) => {
const g = new Uint8Array(oA(I, A));
return A.write(I, g, 0), g;
}
});
}
function $(A) {
return Object.freeze({
...A,
decode: (I, g = 0) => A.read(I, g)[0]
});
}
function v(A) {
return "fixedSize" in A && typeof A.fixedSize == "number";
}
function zI(A) {
if (!v(A))
throw new F(OI);
}
function Gi(A) {
return !v(A);
}
function D(A, I) {
if (v(A) !== v(I))
throw new F(bI);
if (v(A) && v(I) && A.fixedSize !== I.fixedSize)
throw new F(KI, {
decoderFixedSize: I.fixedSize,
encoderFixedSize: A.fixedSize
});
if (!v(A) && !v(I) && A.maxSize !== I.maxSize)
throw new F(HI, {
decoderMaxSize: I.maxSize,
encoderMaxSize: A.maxSize
});
return {
...I,
...A,
decode: I.decode,
encode: A.encode,
read: I.read,
write: A.write
};
}
function fi(A, I, g = 0) {
if (I.length - g <= 0)
throw new F(TI, {
codecDescription: A
});
}
function CI(A, I, g, B = 0) {
const C = g.length - B;
if (C < I)
throw new F(YI, {
bytesLength: C,
codecDescription: A,
expected: I
});
}
function V(A, I) {
const g = (E, e, r) => {
const L = A.encode(E);
return r = I.write(L.length, e, r), e.set(L, r), r + L.length;
};
if (v(I) && v(A))
return j({ ...A, fixedSize: I.fixedSize + A.fixedSize, write: g });
const B = v(I) ? I.fixedSize : I.maxSize ?? null, C = v(A) ? A.fixedSize : A.maxSize ?? null, Q = B !== null && C !== null ? B + C : null;
return j({
...A,
...Q !== null ? { maxSize: Q } : {},
getSizeFromValue: (E) => {
const e = oA(E, A);
return oA(e, I) + e;
},
write: g
});
}
function x(A, I) {
const g = (E, e) => {
const [r, L] = I.read(E, e), W = Number(r);
return e = L, (e > 0 || E.length > W) && (E = E.slice(e, e + W)), CI("addDecoderSizePrefix", W, E), [A.decode(E), e + W];
};
if (v(I) && v(A))
return $({ ...A, fixedSize: I.fixedSize + A.fixedSize, read: g });
const B = v(I) ? I.fixedSize : I.maxSize ?? null, C = v(A) ? A.fixedSize : A.maxSize ?? null, Q = B !== null && C !== null ? B + C : null;
return $({ ...A, ...Q !== null ? { maxSize: Q } : {}, read: g });
}
function S(A, I) {
return j({
fixedSize: I,
write: (g, B, C) => {
const Q = A.encode(g), E = Q.length > I ? Q.slice(0, I) : Q;
return B.set(E, C), C + I;
}
});
}
function M(A, I) {
return $({
fixedSize: I,
read: (g, B) => {
CI("fixCodecSize", I, g, B), (B > 0 || g.length > I) && (g = g.slice(B, B + I)), v(A) && (g = yi(g, A.fixedSize));
const [C] = A.read(g, 0);
return [C, B + I];
}
});
}
function d(A, I) {
return j({
...Gi(A) ? { ...A, getSizeFromValue: (g) => A.getSizeFromValue(I(g)) } : A,
write: (g, B, C) => A.write(I(g), B, C)
});
}
function lA(A, I) {
return $({
...A,
read: (g, B) => {
const [C, Q] = A.read(g, B);
return [I(C, g, B), Q];
}
});
}
function _i(A, I, g = I) {
if (!I.match(new RegExp(`^[${A}]*$`)))
throw new F(YA, {
alphabet: A,
base: A.length,
value: g
});
}
var ki = (A) => j({
getSizeFromValue: (I) => {
const [g, B] = cI(I, A[0]);
if (!B) return I.length;
const C = DI(B, A);
return g.length + Math.ceil(C.toString(16).length / 2);
},
write(I, g, B) {
if (_i(A, I), I === "") return B;
const [C, Q] = cI(I, A[0]);
if (!Q)
return g.set(new Uint8Array(C.length).fill(0), B), B + C.length;
let E = DI(Q, A);
const e = [];
for (; E > 0n; )
e.unshift(Number(E % 256n)), E /= 256n;
const r = [...Array(C.length).fill(0), ...e];
return g.set(r, B), B + r.length;
}
}), Ui = (A) => $({
read(I, g) {
const B = g === 0 ? I : I.slice(g);
if (B.length === 0) return ["", 0];
let C = B.findIndex((r) => r !== 0);
C = C === -1 ? B.length : C;
const Q = A[0].repeat(C);
if (C === B.length) return [Q, I.length];
const E = B.slice(C).reduce((r, L) => r * 256n + BigInt(L), 0n), e = mi(E, A);
return [Q + e, I.length];
}
});
function cI(A, I) {
const [g, B] = A.split(new RegExp(`((?!${I}).*)`));
return [g, B];
}
function DI(A, I) {
const g = BigInt(I.length);
let B = 0n;
for (const C of A)
B *= g, B += BigInt(I.indexOf(C));
return B;
}
function mi(A, I) {
const g = BigInt(I.length), B = [];
for (; A > 0n; )
B.unshift(I[Number(A % g)]), A /= g;
return B.join("");
}
var jI = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz", Fi = () => ki(jI), Li = () => Ui(jI), uI = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ji = () => j({
getSizeFromValue: (A) => {
try {
return atob(A).length;
} catch {
throw new F(YA, {
alphabet: uI,
base: 64,
value: A
});
}
},
write(A, I, g) {
try {
const B = atob(A).split("").map((C) => C.charCodeAt(0));
return I.set(B, g), B.length + g;
} catch {
throw new F(YA, {
alphabet: uI,
base: 64,
value: A
});
}
}
}), Ti = (A) => (
// eslint-disable-next-line no-control-regex
A.replace(/\u0000/g, "")
), Yi = globalThis.TextDecoder, RI = globalThis.TextEncoder, Z = () => {
let A;
return j({
getSizeFromValue: (I) => (A ||= new RI()).encode(I).length,
write: (I, g, B) => {
const C = (A ||= new RI()).encode(I);
return g.set(C, B), B + C.length;
}
});
}, X = () => {
let A;
return $({
read(I, g) {
const B = (A ||= new Yi()).decode(I.slice(g));
return [Ti(B), I.length];
}
});
};
function yA(A, I) {
try {
return "exists" in A && !A.exists ? A : Object.freeze({ ...A, data: I.decode(A.data) });
} catch {
throw new F(mI, {
address: A.address
});
}
}
function $I(A, I) {
if (!I) return Object.freeze({ address: A, exists: !1 });
const g = Ji().encode(I.data[0]);
return Object.freeze({ ...Oi(I), address: A, data: g, exists: !0 });
}
function Oi(A) {
return Object.freeze({
executable: A.executable,
lamports: A.lamports,
programAddress: A.owner,
space: A.space
});
}
async function GA(A, I, g = {}) {
const { abortSignal: B, ...C } = g, Q = await A.getAccountInfo(I, { ...C, encoding: "base64" }).send({ abortSignal: B });
return $I(I, Q.value);
}
async function fA(A, I, g = {}) {
const { abortSignal: B, ...C } = g;
return (await A.getMultipleAccounts(I, { ...C, encoding: "base64" }).send({ abortSignal: B })).value.map((E, e) => $I(I[e], E));
}
function _A(A) {
if (!A.exists)
throw new F(kI, { address: A.address });
}
function kA(A) {
const I = A.filter((g) => !g.exists);
if (I.length > 0) {
const g = I.map((B) => B.address);
throw new F(UI, { addresses: g });
}
}
function bi() {
if (!globalThis.isSecureContext)
throw new F(FI);
}
function Ki() {
if (bi(), typeof globalThis.crypto > "u" || typeof globalThis.crypto.subtle?.digest != "function")
throw new F(LI);
}
var ZA, XA;
function Ag() {
return ZA || (ZA = Fi()), ZA;
}
function Hi() {
return XA || (XA = Li()), XA;
}
function pi(A) {
if (
// Lowest address (32 bytes of zeroes)
A.length < 32 || // Highest address (32 bytes of 255)
A.length > 44
)
throw new F(yI, {
actualLength: A.length
});
const B = Ag().encode(A).byteLength;
if (B !== 32)
throw new F(MI, {
actualLength: B
});
}
function Pi(A) {
return pi(A), A;
}
function s() {
return d(
S(Ag(), 32),
(A) => Pi(A)
);
}
function c() {
return M(Hi(), 32);
}
function qi() {
return D(s(), c());
}
var vi = 37095705934669439343138083508754565189542113879843219016388785533085940283555n, AA = 57896044618658097711785492504343953926634992332820282019728792003956564819949n, lI = 19681161376707505956807079304988542015446066515923890162744021073123829784752n;
function CA(A) {
const I = A % AA;
return I >= 0n ? I : AA + I;
}
function QA(A, I) {
let g = A;
for (; I-- > 0n; )
g *= g, g %= AA;
return g;
}
function Vi(A) {
const g = A * A % AA * A % AA, B = QA(g, 2n) * g % AA, C = QA(B, 1n) * A % AA, Q = QA(C, 5n) * C % AA, E = QA(Q, 10n) * Q % AA, e = QA(E, 20n) * E % AA, r = QA(e, 40n) * e % AA, L = QA(r, 80n) * r % AA, W = QA(L, 80n) * r % AA, gA = QA(W, 10n) * Q % AA;
return QA(gA, 2n) * A % AA;
}
function xi(A, I) {
const g = CA(I * I * I), B = CA(g * g * I), C = Vi(A * B);
let Q = CA(A * g * C);
const E = CA(I * Q * Q), e = Q, r = CA(Q * lI), L = E === A, W = E === CA(-A), gA = E === CA(-A * lI);
return L && (Q = e), (W || gA) && (Q = r), (CA(Q) & 1n) === 1n && (Q = CA(-Q)), !L && !W ? null : Q;
}
function Wi(A, I) {
const g = CA(A * A), B = CA(g - 1n), C = CA(vi * g + 1n), Q = xi(B, C);
if (Q === null)
return !1;
const E = (I & 128) !== 0;
return !(Q === 0n && E);
}
function Zi(A) {
const I = A.toString(16);
return I.length === 1 ? `0${I}` : I;
}
function Xi(A) {
const g = `0x${A.reduce((B, C, Q) => `${Zi(Q === 31 ? C & -129 : C)}${B}`, "")}`;
return BigInt(g);
}
function zi(A) {
if (A.byteLength !== 32)
return !1;
const I = Xi(A);
return Wi(I, A[31]);
}
var NI = 32, wI = 16, ji = [
// The string 'ProgramDerivedAddress'
80,
114,
111,
103,
114,
97,
109,
68,
101,
114,
105,
118,
101,
100,
65,
100,
100,
114,
101,
115,
115
];
async function $i({ programAddress: A, seeds: I }) {
if (Ki(), I.length > wI)
throw new F(GI, {
actual: I.length,
maxSeeds: wI
});
let g;
const B = I.reduce((r, L, W) => {
const gA = typeof L == "string" ? (g ||= new TextEncoder()).encode(L) : L;
if (gA.byteLength > NI)
throw new F(fI, {
actual: gA.byteLength,
index: W,
maxSeedLength: NI
});
return r.push(...gA), r;
}, []), C = qi(), Q = C.encode(A), E = await crypto.subtle.digest(
"SHA-256",
new Uint8Array([...B, ...Q, ...ji])
), e = new Uint8Array(E);
if (zi(e))
throw new F(II);
return C.decode(e);
}
async function UA({
programAddress: A,
seeds: I
}) {
let g = 255;
for (; g > 0; )
try {
return [await $i({
programAddress: A,
seeds: [...I, new Uint8Array([g])]
}), g];
} catch (B) {
if (XI(B, II))
g--;
else
throw B;
}
throw new F(_I);
}
function Ao(A, I, g, B) {
if (B < I || B > g)
throw new F(VI, {
codecDescription: A,
max: g,
min: I,
value: B
});
}
function Ig(A) {
return A?.endian !== 1;
}
function NA(A) {
return j({
fixedSize: A.size,
write(I, g, B) {
A.range && Ao(A.name, A.range[0], A.range[1], I);
const C = new ArrayBuffer(A.size);
return A.set(new DataView(C), I, Ig(A.config)), g.set(new Uint8Array(C), B), B + A.size;
}
});
}
function wA(A) {
return $({
fixedSize: A.size,
read(I, g = 0) {
fi(A.name, I, g), CI(A.name, A.size, I, g);
const B = new DataView(Io(I, g, A.size));
return [A.get(B, Ig(A.config)), g + A.size];
}
});
}
function Io(A, I, g) {
const B = A.byteOffset + (I ?? 0), C = g ?? A.byteLength;
return A.buffer.slice(B, B + C);
}
var OA = (A = {}) => NA({
config: A,
name: "i32",
range: [-+"0x7fffffff" - 1, +"0x7fffffff"],
set: (I, g, B) => I.setInt32(0, Number(g), B),
size: 4
}), bA = (A = {}) => wA({
config: A,
get: (I, g) => I.getInt32(0, g),
name: "i32",
size: 4
}), U = (A = {}) => NA({
config: A,
name: "u128",
range: [0n, BigInt("0xffffffffffffffffffffffffffffffff")],
set: (I, g, B) => {
const C = B ? 8 : 0, Q = B ? 0 : 8, E = 0xffffffffffffffffn;
I.setBigUint64(C, BigInt(g) >> 64n, B), I.setBigUint64(Q, BigInt(g) & E, B);
},
size: 16
}), m = (A = {}) => wA({
config: A,
get: (I, g) => {
const B = g ? 8 : 0, C = g ? 0 : 8, Q = I.getBigUint64(B, g), E = I.getBigUint64(C, g);
return (Q << 64n) + E;
},
name: "u128",
size: 16
}), R = (A = {}) => NA({
config: A,
name: "u16",
range: [0, +"0xffff"],
set: (I, g, B) => I.setUint16(0, Number(g), B),
size: 2
}), l = (A = {}) => wA({
config: A,
get: (I, g) => I.getUint16(0, g),
name: "u16",
size: 2
}), J = (A = {}) => NA({
config: A,
name: "u32",
range: [0, +"0xffffffff"],
set: (I, g, B) => I.setUint32(0, Number(g), B),
size: 4
}), T = (A = {}) => wA({
config: A,
get: (I, g) => I.getUint32(0, g),
name: "u32",
size: 4
}), o = (A = {}) => NA({
config: A,
name: "u64",
range: [0n, BigInt("0xffffffffffffffff")],
set: (I, g, B) => I.setBigUint64(0, BigInt(g), B),
size: 8
}), t = (A = {}) => wA({
config: A,
get: (I, g) => I.getBigUint64(0, g),
name: "u64",
size: 8
}), i = () => NA({
name: "u8",
range: [0, +"0xff"],
set: (A, I) => A.setUint8(0, Number(I)),
size: 1
}), w = () => wA({
get: (A) => A.getUint8(0),
name: "u8",
size: 1
});
function gg(A, I, g) {
if (I !== g)
throw new F(pI, {
actual: g,
codecDescription: A,
expected: I
});
}
function go(A) {
return A.reduce(
(I, g) => I === null || g === null ? null : Math.max(I, g),
0
);
}
function tA(A) {
return A.reduce((I, g) => I === null || g === null ? null : I + g, 0);
}
function dA(A) {
return v(A) ? A.fixedSize : null;
}
function cA(A) {
return v(A) ? A.fixedSize : A.maxSize ?? null;
}
function P(A, I = {}) {
const g = I.size ?? J(), B = KA(g, dA(A)), C = KA(g, cA(A)) ?? void 0;
return j({
...B !== null ? { fixedSize: B } : {
getSizeFromValue: (Q) => (typeof g == "object" ? oA(Q.length, g) : 0) + [...Q].reduce((e, r) => e + oA(r, A), 0),
maxSize: C
},
write: (Q, E, e) => (typeof g == "number" && gg("array", g, Q.length), typeof g == "object" && (e = g.write(Q.length, E, e)), Q.forEach((r) => {
e = A.write(r, E, e);
}), e)
});
}
function q(A, I = {}) {
const g = I.size ?? T(), B = dA(A), C = KA(g, B), Q = KA(g, cA(A)) ?? void 0;
return $({
...C !== null ? { fixedSize: C } : { maxSize: Q },
read: (E, e) => {
const r = [];
if (typeof g == "object" && E.slice(e).length === 0)
return [r, e];
if (g === "remainder") {
for (; e < E.length; ) {
const [gA, mA] = A.read(E, e);
e = mA, r.push(gA);
}
return [r, e];
}
const [L, W] = typeof g == "number" ? [g, e] : g.read(E, e);
e = W;
for (let gA = 0; gA < L; gA += 1) {
const [mA, YB] = A.read(E, e);
e = YB, r.push(mA);
}
return [r, e];
}
});
}
function KA(A, I) {
return typeof A != "number" ? null : A === 0 ? 0 : I === null ? null : I * A;
}
function H(A = {}) {
return d(A.size ?? i(), (I) => I ? 1 : 0);
}
function p(A = {}) {
return lA(A.size ?? w(), (I) => Number(I) === 1);
}
function y() {
return j({
getSizeFromValue: (A) => A.length,
write: (A, I, g) => (I.set(A, g), g + A.length)
});
}
function G() {
return $({
read: (A, I) => {
const g = A.slice(I);
return [g, I + g.length];
}
});
}
var Co = () => $({
read(A, I) {
return [A.slice(I).reduce((B, C) => B + C.toString(16).padStart(2, "0"), ""), A.length];
}
});
function Bo(A) {
return j({
fixedSize: A.length,
write: (I, g, B) => (g.set(A, B), B + A.length)
});
}
function Qo(A) {
return $({
fixedSize: A.length,
read: (I, g) => {
const B = Co();
if (!h(I, A, g))
throw new F(WI, {
constant: A,
data: I,
hexConstant: B.decode(A),
hexData: B.decode(I),
offset: g
});
return [void 0, g + A.length];
}
});
}
function b(A) {
const I = tA(A.map(dA)), g = tA(A.map(cA)) ?? void 0;
return j({
...I === null ? {
getSizeFromValue: (B) => A.map((C, Q) => oA(B[Q], C)).reduce((C, Q) => C + Q, 0),
maxSize: g
} : { fixedSize: I },
write: (B, C, Q) => (gg("tuple", A.length, B.length), A.forEach((E, e) => {
Q = E.write(B[e], C, Q);
}), Q)
});
}
function K(A) {
const I = tA(A.map(dA)), g = tA(A.map(cA)) ?? void 0;
return $({
...I === null ? { maxSize: g } : { fixedSize: I },
read: (B, C) => {
const Q = [];
return A.forEach((E) => {
const [e, r] = E.read(B, C);
Q.push(e), C = r;
}), [Q, C];
}
});
}
function Cg(A, I) {
const g = Qg(A), B = (Q, E, e) => {
const r = I(Q);
return $A(A, r), A[r].write(Q, E, e);
};
if (g !== null)
return j({ fixedSize: g, write: B });
const C = Eg(A);
return j({
...C !== null ? { maxSize: C } : {},
getSizeFromValue: (Q) => {
const E = I(Q);
return $A(A, E), oA(Q, A[E]);
},
write: B
});
}
function Bg(A, I) {
const g = Qg(A), B = (Q, E) => {
const e = I(Q, E);
return $A(A, e), A[e].read(Q, E);
};
if (g !== null)
return $({ fixedSize: g, read: B });
const C = Eg(A);
return $({ ...C !== null ? { maxSize: C } : {}, read: B });
}
function $A(A, I) {
if (typeof A[I] > "u")
throw new F(xI, {
maxRange: A.length - 1,
minRange: 0,
variant: I
});
}
function Qg(A) {
if (A.length === 0) return 0;
if (!v(A[0])) return null;
const I = A[0].fixedSize;
return A.every((B) => v(B) && B.fixedSize === I) ? I : null;
}
function Eg(A) {
return go(A.map((I) => cA(I)));
}
function DA(A, I = {}) {
const g = I.discriminator ?? "__kind", B = I.size ?? i();
return Cg(
A.map(
([, C], Q) => d(b([B, C]), (E) => [Q, E])
),
(C) => Eo(A, C[g])
);
}
function uA(A, I = {}) {
const g = I.discriminator ?? "__kind", B = I.size ?? w();
return Bg(
A.map(
([C, Q]) => lA(K([B, Q]), ([, E]) => ({
[g]: C,
...E
}))
),
(C, Q) => Number(B.read(C, Q)[0])
);
}
function Eo(A, I) {
const g = A.findIndex(([B]) => I === B);
if (g < 0)
throw new F(qI, {
value: I,
variants: A.map(([B]) => B)
});
return g;
}
function eg(A) {
const I = [...new Set(Object.values(A).filter((E) => typeof E == "number"))].sort(), g = Object.fromEntries(Object.entries(A).slice(I.length)), B = Object.keys(g), C = Object.values(g), Q = [
.../* @__PURE__ */ new Set([...B, ...C.filter((E) => typeof E == "string")])
];
return { enumKeys: B, enumRecord: g, enumValues: C, numericalValues: I, stringValues: Q };
}
function eo({
enumKeys: A,
enumValues: I,
variant: g
}) {
const B = ig(I, (C) => C === g);
return B >= 0 ? B : A.findIndex((C) => C === g);
}
function io({
discriminator: A,
enumKeys: I,
enumValues: g,
useValuesAsDiscriminators: B
}) {
return B ? ig(g, (C) => C === A) : A >= 0 && A < I.length ? A : -1;
}
function ig(A, I) {
let g = A.length;
for (; g--; )
if (I(A[g], g, A)) return g;
return -1;
}
function og(A) {
if (A.length === 0) return "";
let I = [A[0], A[0]];
const g = [];
for (let B = 1; B < A.length; B++) {
const C = A[B];
I[1] + 1 === C ? I[1] = C : (g.push(I[0] === I[1] ? `${I[0]}` : `${I[0]}-${I[1]}`), I = [C, C]);
}
return g.push(I[0] === I[1] ? `${I[0]}` : `${I[0]}-${I[1]}`), g.join(", ");
}
function nA(A, I = {}) {
const g = I.size ?? i(), B = I.useValuesAsDiscriminators ?? !1, { enumKeys: C, enumValues: Q, numericalValues: E, stringValues: e } = eg(A);
if (B && Q.some((r) => typeof r == "string"))
throw new F(gI, {
stringValues: Q.filter((r) => typeof r == "string")
});
return d(g, (r) => {
const L = eo({ enumKeys: C, enumValues: Q, variant: r });
if (L < 0)
throw new F(vI, {
formattedNumericalValues: og(E),
numericalValues: E,
stringValues: e,
variant: r
});
return B ? Q[L] : L;
});
}
function aA(A, I = {}) {
const g = I.size ?? w(), B = I.useValuesAsDiscriminators ?? !1, { enumKeys: C, enumValues: Q, numericalValues: E } = eg(A);
if (B && Q.some((e) => typeof e == "string"))
throw new F(gI, {
stringValues: Q.filter((e) => typeof e == "string")
});
return lA(g, (e) => {
const r = Number(e), L = io({
discriminator: r,
enumKeys: C,
enumValues: Q,
useValuesAsDiscriminators: B
});
if (L < 0) {
const W = B ? E : [...Array(C.length).keys()];
throw new F(PI, {
discriminator: r,
formattedValidDiscriminators: og(W),
validDiscriminators: W
});
}
return Q[L];
});
}
function zA() {
return j({
fixedSize: 0,
write: (A, I, g) => g
});
}
function jA() {
return $({
fixedSize: 0,
read: (A, I) => [void 0, I]
});
}
function n(A) {
const I = A.map(([, C]) => C), g = tA(I.map(dA)), B = tA(I.map(cA)) ?? void 0;
return j({
...g === null ? {
getSizeFromValue: (C) => A.map(([Q, E]) => oA(C[Q], E)).reduce((Q, E) => Q + E, 0),
maxSize: B
} : { fixedSize: g },
write: (C, Q, E) => (A.forEach(([e, r]) => {
E = r.write(C[e], Q, E);
}), E)
});
}
function a(A) {
const I = A.map(([, C]) => C), g = tA(I.map(dA)), B = tA(I.map(cA)) ?? void 0;
return $({
...g === null ? { maxSize: B } : { fixedSize: g },
read: (C, Q) => {
const E = {};
return A.forEach(([e, r]) => {
const [L, W] = r.read(C, Q);
Q = W, E[e] = L;
}), [E, Q];
}
});
}
var tg = (A) => ({ __option: "Some", value: A }), ng = () => ({ __option: "None" }), dI = (A) => !!(A && typeof A == "object" && "__option" in A && (A.__option === "Some" && "value" in A || A.__option === "None")), hI = (A) => A.__option === "Some", oo = (A) => A !== null ? tg(A) : ng();
function _(A, I = {}) {
const g = I.prefix === null ? d(zA(), (C) => {
}) : H({ size: I.prefix ?? i() }), B = I.noneValue === "zeroes" ? (zI(A), S(zA(), A.fixedSize)) : I.noneValue ? Bo(I.noneValue) : zA();
return Cg(
[
d(b([g, B]), (C) => [
!1,
void 0
]),
d(b([g, A]), (C) => [
!0,
dI(C) && hI(C) ? C.value : C
])
],
(C) => {
const Q = dI(C) ? C : oo(C);
return Number(hI(Q));
}
);
}
function k(A, I = {}) {
const g = I.prefix === null ? lA(jA(), () => !1) : p({ size: I.prefix ?? w() }), B = I.noneValue === "zeroes" ? (zI(A), M(jA(), A.fixedSize)) : I.noneValue ? Qo(I.noneValue) : jA();
return Bg(
[
lA(K([g, B]), () => ng()),
lA(K([g, A]), ([, C]) => tg(C))
],
(C, Q) => {
if (I.prefix === null && !I.noneValue)
return +(Q < C.length);
if (I.prefix === null && I.noneValue != null) {
const E = I.noneValue === "zeroes" ? new Uint8Array(B.fixedSize).fill(0) : I.noneValue;
return h(C, E, Q) ? 0 : 1;
}
return Number(g.read(C, Q)[0]);
}
);
}
var LA = /* @__PURE__ */ ((A) => (A[A.WRITABLE_SIGNER = /* 3 */
3] = "WRITABLE_SIGNER", A[A.READONLY_SIGNER = /* 2 */
2] = "READONLY_SIGNER", A[A.WRITABLE = /* 1 */
1] = "WRITABLE", A[A.READONLY = /* 0 */
0] = "READONLY", A))(LA || {}), to = 2;
function no(A) {
return A | to;
}
function ao(A, I, g, B) {
if (!XI(A, JI))
return !1;
const C = I.instructions[A.context.index]?.programAddress;
return !C || C !== g ? !1 : typeof B > "u" || A.context.code === B;
}
function ro(A) {
return "modifyAndSignTransactions" in A && typeof A.modifyAndSignTransactions == "function";
}
function so(A) {
return "signTransactions" in A && typeof A.signTransactions == "function";
}
function co(A) {
return "signAndSendTransactions" in A && typeof A.signAndSendTransactions == "function";
}
function Do(A) {
return so(A) || ro(A) || co(A);
}
var IA = /* @__PURE__ */ ((A) => (A[A.Uninitialized = 0] = "Uninitialized", A[A.Closed = 1] = "Closed", A[A.BondingCurve = 2] = "BondingCurve", A[A.AuthorityConfig = 3] = "AuthorityConfig", A[A.PermissionConfig = 4] = "PermissionConfig", A[A.ConsumedPermission = 5] = "ConsumedPermission", A[A.MintConfig = 6] = "MintConfig", A))(IA || {});
function z() {
return nA(IA);
}
function hA() {
return aA(IA);
}
function Fa() {
return D(
z(),
hA()
);
}
var BI = /* @__PURE__ */ ((A) => (A[A.Manual = 0] = "Manual", A[A.Launch = 1] = "Launch", A[A.Lockedlaunch = 2] = "Lockedlaunch", A[A.Presale = 3] = "Presale", A))(BI || {});
function ag() {
return nA(BI);
}
function rg() {
return aA(BI);
}
function La() {
return D(
ag(),
rg()
);
}
function uo() {
return DA([
[
"BondingCurveCreated",
n([
["creationType", ag()],
["baseMint", s()],
["quoteMint", s()],
["creator", s()],
["startPrice", U()],
["endPrice", U()],
["controlPoints", P(R(), { size: 4 })],
["swapFeeBps", R()],
["quoteFeeBps", R()],
["baseFeeBps", R()],
["baseAllocationBps", R()],
["launchSlot", o()],
["creatorReward", o()],
[
"graduationMethods",
P(HA(), { size: 8 })
],
["graduationTarget", o()],
["graduationSlot", o()],
["graduationReward", o()],
["retainMintAuthority", H()],
["minReserveBps", R()],
["buyRequiresPermission", H()],
["buyPermissionBitmap", S(y(), 32)],
["maxBuyAmount", o()],
["sellRequiresPermission", H()],
["sellPermissionBitmap", S(y(), 32)],
["maxSellAmount", o()],
["quoteTokenProgram", s()],
["baseTokenProgram", s()],
["quoteTokenDecimals", i()],
["baseTokenDecimals", i()]
])
],
[
"TokenBought",
n([
["buyer", s()],
["baseMint", s()],
["quoteMint", s()],
["amountIn", o()],
["amountOut", o()],
["priceBefore", U()],
["priceAfter", U()],
["quoteAmountBefore", o()],
["quoteAmountAfter", o()],
["baseAmountBefore", o()],
["baseAmountAfter", o()],
["protocolFee", o()]
])
],
[
"TokenSold",
n([
["seller", s()],
["baseMint", s()],
["quoteMint", s()],