@orca-so/wavebreak
Version:
The wavebreak JS client for interacting with the wavebreak program.
1,336 lines (1,334 loc) • 412 kB
JavaScript
var xB = 1, ZB = 2, XB = 3, zB = 4, jB = 5, $B = 6, AE = 7, gE = 8, IE = 9, CE = 10, BE = -32700, EE = -32603, QE = -32602, eE = -32601, iE = -32600, oE = -32019, tE = -32018, nE = -32017, aE = -32016, rE = -32015, sE = -32014, cE = -32013, DE = -32012, uE = -32011, lE = -32010, RE = -32009, wE = -32008, NE = -32007, dE = -32006, hE = -32005, SE = -32004, ME = -32003, yE = -32002, fE = -32001, fg = 28e5, Gg = 2800001, GE = 2800002, _E = 2800003, kE = 2800004, mE = 2800005, _g = 2800006, kg = 2800007, Cg = 2800008, mg = 2800009, FE = 2800010, UE = 2800011, Fg = 323e4, Ug = 32300001, Lg = 3230002, LE = 3230003, JE = 3230004, TE = 361e4, Jg = 3610001, YE = 3610002, OE = 3610003, bE = 3610004, KE = 3610005, pE = 3610006, PE = 3610007, HE = 3611e3, qE = 3704e3, vE = 3704001, WE = 3704002, VE = 3704003, xE = 3704004, ZE = 4128e3, XE = 4128001, zE = 4128002, jE = 4615e3, $E = 4615001, AQ = 4615002, gQ = 4615003, IQ = 4615004, CQ = 4615005, BQ = 4615006, EQ = 4615007, QQ = 4615008, eQ = 4615009, iQ = 4615010, oQ = 4615011, tQ = 4615012, nQ = 4615013, aQ = 4615014, rQ = 4615015, sQ = 4615016, cQ = 4615017, DQ = 4615018, uQ = 4615019, lQ = 4615020, RQ = 4615021, wQ = 4615022, NQ = 4615023, dQ = 4615024, hQ = 4615025, Tg = 4615026, SQ = 4615027, MQ = 4615028, yQ = 4615029, fQ = 4615030, GQ = 4615031, _Q = 4615032, kQ = 4615033, mQ = 4615034, FQ = 4615035, UQ = 4615036, LQ = 4615037, JQ = 4615038, TQ = 4615039, YQ = 4615040, OQ = 4615041, bQ = 4615042, KQ = 4615043, pQ = 4615044, PQ = 4615045, HQ = 4615046, qQ = 4615047, vQ = 4615048, WQ = 4615049, VQ = 4615050, xQ = 4615051, ZQ = 4615052, XQ = 4615053, zQ = 4615054, jQ = 5508e3, $Q = 5508001, Ae = 5508002, ge = 5508003, Ie = 5508004, Ce = 5508005, Be = 5508006, Ee = 5508007, Qe = 5508008, ee = 5508009, ie = 5508010, oe = 5508011, te = 5663e3, ne = 5663001, ae = 5663002, re = 5663003, se = 5663004, ce = 5663005, De = 5663006, ue = 5663007, le = 5663008, Re = 5663009, we = 5663010, Ne = 5663011, de = 5663012, he = 5663013, Se = 5663014, Me = 5663015, ye = 5663016, fe = 5663017, Ge = 5663018, _e = 5663019, ke = 5663020, me = 705e4, Fe = 7050001, Ue = 7050002, Le = 7050003, Je = 7050004, Te = 7050005, Ye = 7050006, Oe = 7050007, be = 7050008, Ke = 7050009, pe = 7050010, Pe = 7050011, He = 7050012, qe = 7050013, ve = 7050014, We = 7050015, Ve = 7050016, xe = 7050017, Ze = 7050018, Xe = 7050019, ze = 7050020, je = 7050021, $e = 7050022, Ai = 7050023, gi = 7050024, Ii = 7050025, Ci = 7050026, Bi = 7050027, Ei = 7050028, Qi = 7050029, ei = 7050030, ii = 7050031, oi = 7050032, ti = 7050033, ni = 7050034, ai = 7050035, ri = 7050036, si = 7618e3, ci = 7618001, Di = 7618002, ui = 7618003, Yg = 8078e3, Og = 8078001, bg = 8078002, li = 8078003, Kg = 8078004, pg = 8078005, Pg = 8078006, Hg = 8078007, qg = 8078008, vg = 8078009, Wg = 8078010, Vg = 8078011, pA = 8078012, Ri = 8078013, wi = 8078014, Ni = 8078015, di = 8078016, xg = 8078017, Zg = 8078018, hi = 8078019, Si = 8078020, Mi = 8078021, Bg = 8078022, yi = 81e5, fi = 8100001, Gi = 8100002, _i = 8100003, ki = 819e4, mi = 8190001, Fi = 8190002, Ui = 8190003, Li = 8190004, Ji = 99e5, Ti = 9900001, Yi = 9900002, Oi = 9900003, bi = 9900004, Ki = 9900005, pi = 9900006;
function Xg(A) {
return Array.isArray(A) ? "%5B" + A.map(Xg).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 Pi([A, I]) {
return `${A}=${Xg(I)}`;
}
function Hi(A) {
const I = Object.entries(A).map(Pi).join("&");
return btoa(I);
}
var qi = {
[Fg]: "Account not found at address: $address",
[JE]: "Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",
[LE]: "Expected decoded account at address: $address",
[Lg]: "Failed to decode account data at address: $address",
[Ug]: "Accounts not found at addresses: $addresses",
[mg]: "Unable to find a viable program address bump seed.",
[GE]: "$putativeAddress is not a base58-encoded address.",
[fg]: "Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",
[_E]: "The `CryptoKey` must be an `Ed25519` public key.",
[UE]: "$putativeOffCurveAddress is not a base58-encoded off-curve address.",
[Cg]: "Invalid seeds; point must fall off the Ed25519 curve.",
[kE]: "Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",
[_g]: "A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",
[kg]: "The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",
[mE]: "Expected program derived address bump to be in the range [0, 255], got: $bump.",
[FE]: "Program address cannot end with PDA marker.",
[Gg]: "Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",
[zB]: "Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",
[xB]: "The network has progressed past the last block for which this transaction could have been committed.",
[Yg]: "Codec [$codecDescription] cannot decode empty byte arrays.",
[Bg]: "Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",
[Si]: "Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",
[pg]: "Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",
[Pg]: "Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",
[Kg]: "Encoder and decoder must either both be fixed-size or variable-size.",
[qg]: "Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",
[bg]: "Expected a fixed-size codec, got a variable-size one.",
[Ri]: "Codec [$codecDescription] expected a positive byte length, got $bytesLength.",
[li]: "Expected a variable-size codec, got a fixed-size one.",
[hi]: "Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",
[Og]: "Codec [$codecDescription] expected $expected bytes, got $bytesLength.",
[Zg]: "Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",
[vg]: "Invalid discriminated union variant. Expected one of [$variants], got $value.",
[Wg]: "Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",
[Ni]: "Invalid literal union variant. Expected one of [$variants], got $value.",
[Hg]: "Expected [$codecDescription] to have $expected items, got $actual.",
[pA]: "Invalid value $value for base $base with alphabet $alphabet.",
[di]: "Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",
[Vg]: "Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",
[wi]: "Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",
[Mi]: "Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",
[xg]: "Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",
[HE]: "No random values implementation could be found.",
[eQ]: "instruction requires an uninitialized account",
[NQ]: "instruction tries to borrow reference for an account which is already borrowed",
[dQ]: "instruction left account with an outstanding borrowed reference",
[RQ]: "program other than the account's owner changed the size of the account data",
[CQ]: "account data too small for instruction",
[wQ]: "instruction expected an executable account",
[HQ]: "An account does not have enough lamports to be rent-exempt",
[vQ]: "Program arithmetic overflowed",
[PQ]: "Failed to serialize or deserialize account data: $encodedData",
[zQ]: "Builtin programs must consume compute units",
[_Q]: "Cross-program invocation call depth too deep",
[JQ]: "Computational budget exceeded",
[Tg]: "custom program error: #$code",
[cQ]: "instruction contains duplicate accounts",
[hQ]: "instruction modifications of multiply-passed account differ",
[fQ]: "executable accounts must be rent exempt",
[MQ]: "instruction changed executable accounts data",
[yQ]: "instruction changed the balance of an executable account",
[DQ]: "instruction changed executable bit of an account",
[aQ]: "instruction modified data of an account it does not own",
[nQ]: "instruction spent from the balance of an account it does not own",
[$E]: "generic instruction error",
[VQ]: "Provided owner is not allowed",
[KQ]: "Account is immutable",
[pQ]: "Incorrect authority provided",
[EQ]: "incorrect program id for instruction",
[BQ]: "insufficient funds for instruction",
[IQ]: "invalid account data for instruction",
[qQ]: "Invalid account owner",
[AQ]: "invalid program argument",
[SQ]: "program returned invalid error code",
[gQ]: "invalid instruction data",
[LQ]: "Failed to reallocate account data",
[UQ]: "Provided seeds do not result in a valid address",
[xQ]: "Accounts data allocations exceeded the maximum allowed per transaction",
[ZQ]: "Max accounts exceeded",
[XQ]: "Max instruction trace length exceeded",
[FQ]: "Length of the seed is too long for address generation",
[kQ]: "An account required by the instruction is missing",
[QQ]: "missing required signature for instruction",
[tQ]: "instruction illegally modified the program id of an account",
[lQ]: "insufficient account keys for instruction",
[TQ]: "Cross-program invocation with unauthorized signer or writable account",
[YQ]: "Failed to create program execution environment",
[bQ]: "Program failed to compile",
[OQ]: "Program failed to complete",
[sQ]: "instruction modified data of a read-only account",
[rQ]: "instruction changed the balance of a read-only account",
[mQ]: "Cross-program invocation reentrancy not allowed for this instruction",
[uQ]: "instruction modified rent epoch of an account",
[oQ]: "sum of account balances before and after instruction do not match",
[iQ]: "instruction requires an initialized account",
[jE]: "",
[GQ]: "Unsupported program id",
[WQ]: "Unsupported sysvar",
[Ki]: "Invalid instruction plan kind: $kind.",
[Di]: "The provided instruction plan is empty.",
[ui]: "The provided transaction plan failed to execute. See the `transactionPlanResult` attribute and the `cause` error for more details.",
[si]: "The provided message has insufficient capacity to accommodate the next instruction(s) in this plan. Expected at least $numBytesRequired free byte(s), got $numFreeBytes byte(s).",
[pi]: "Invalid transaction plan kind: $kind.",
[ci]: "No more instructions to pack; the message packer has completed the instruction plan.",
[ZE]: "The instruction does not have any accounts.",
[XE]: "The instruction does not have any data.",
[zE]: "Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",
[jB]: "Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",
[ZB]: "The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",
[Yi]: "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",
[bi]: "Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",
[Ti]: "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",
[Ji]: "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",
[Oi]: "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",
[EE]: "JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",
[QE]: "JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",
[iE]: "JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",
[eE]: "JSON-RPC error: The method does not exist / is not available ($__serverMessage)",
[BE]: "JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",
[DE]: "$__serverMessage",
[fE]: "$__serverMessage",
[SE]: "$__serverMessage",
[sE]: "$__serverMessage",
[nE]: "Epoch rewards period still active at slot $slot",
[lE]: "$__serverMessage",
[RE]: "$__serverMessage",
[oE]: "Failed to query long-term storage; please try again",
[aE]: "Minimum context slot has not been reached",
[hE]: "Node is unhealthy; behind by $numSlotsBehind slots",
[wE]: "No snapshot",
[yE]: "Transaction simulation failed",
[tE]: "Rewards cannot be found because slot $slot is not the epoch boundary. This may be due to gap in the queried node's local ledger or long-term storage",
[NE]: "$__serverMessage",
[uE]: "Transaction history is not available from this node",
[dE]: "$__serverMessage",
[cE]: "Transaction signature length mismatch",
[ME]: "Transaction signature verification failure",
[rE]: "$__serverMessage",
[qE]: "Key pair bytes must be of length 64, got $byteLength.",
[vE]: "Expected private key bytes with length 32. Actual length: $actualLength.",
[WE]: "Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",
[xE]: "The provided private key does not match the provided public key.",
[VE]: "Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",
[$B]: "Lamports value must be in the range [0, 2e64-1]",
[AE]: "`$value` cannot be parsed as a `BigInt`",
[CE]: "$message",
[gE]: "`$value` cannot be parsed as a `Number`",
[XB]: "No nonce account could be found at address `$nonceAccountAddress`",
[ki]: "The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",
[Fi]: "WebSocket was closed before payload could be added to the send buffer",
[Ui]: "WebSocket connection closed",
[Li]: "WebSocket failed to connect",
[mi]: "Failed to obtain a subscription id from the server",
[_i]: "Could not find an API plan for RPC method: `$method`",
[yi]: "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`.",
[Gi]: "HTTP error ($statusCode): $message",
[fi]: "HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",
[jQ]: "Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",
[$Q]: "The provided value does not implement the `KeyPairSigner` interface",
[ge]: "The provided value does not implement the `MessageModifyingSigner` interface",
[Ie]: "The provided value does not implement the `MessagePartialSigner` interface",
[Ae]: "The provided value does not implement any of the `MessageSigner` interfaces",
[Be]: "The provided value does not implement the `TransactionModifyingSigner` interface",
[Ee]: "The provided value does not implement the `TransactionPartialSigner` interface",
[Qe]: "The provided value does not implement the `TransactionSendingSigner` interface",
[Ce]: "The provided value does not implement any of the `TransactionSigner` interfaces",
[ee]: "More than one `TransactionSendingSigner` was identified.",
[ie]: "No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",
[oe]: "Wallet account signers do not support signing multiple messages/transactions in a single operation",
[PE]: "Cannot export a non-extractable key.",
[Jg]: "No digest implementation could be found.",
[TE]: "Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",
[YE]: `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.`,
[OE]: "No signature verification implementation could be found.",
[bE]: "No key generation implementation could be found.",
[KE]: "No signing implementation could be found.",
[pE]: "No key export implementation could be found.",
[IE]: "Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",
[Ve]: "Transaction processing left an account with an outstanding borrowed reference",
[Fe]: "Account in use",
[Ue]: "Account loaded twice",
[Le]: "Attempt to debit an account but found no record of a prior credit.",
[Ai]: "Transaction loads an address table account that doesn't exist",
[Oe]: "This transaction has already been processed",
[be]: "Blockhash not found",
[Ke]: "Loader call chain is too deep",
[We]: "Transactions are currently disabled due to cluster maintenance",
[ei]: "Transaction contains a duplicate instruction ($index) that is not allowed",
[Te]: "Insufficient funds for fee",
[ii]: "Transaction results in an account ($accountIndex) with insufficient funds for rent",
[Ye]: "This account may not be used to pay transaction fees",
[Pe]: "Transaction contains an invalid account reference",
[Ii]: "Transaction loads an address table account with invalid data",
[Ci]: "Transaction address table lookup uses an invalid index",
[gi]: "Transaction loads an address table account with an invalid owner",
[ti]: "LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",
[qe]: "This program may not be used for executing instructions",
[Bi]: "Transaction leaves an account with a lower balance than rent-exempt minimum",
[Xe]: "Transaction loads a writable account that cannot be written",
[oi]: "Transaction exceeded max loaded accounts data size cap",
[pe]: "Transaction requires a fee but has no signature present",
[Je]: "Attempt to load a program that does not exist",
[ai]: "Execution of the program referenced by account at index $accountIndex is temporarily restricted.",
[ni]: "ResanitizationNeeded",
[ve]: "Transaction failed to sanitize accounts offsets correctly",
[He]: "Transaction did not pass signature verification",
[$e]: "Transaction locked too many accounts",
[ri]: "Sum of account balances before and after transaction do not match",
[me]: "The transaction failed with the error `$errorName`",
[Ze]: "Transaction version is unsupported",
[je]: "Transaction would exceed account data limit within the block",
[Qi]: "Transaction would exceed total account data limit",
[ze]: "Transaction would exceed max account limit within the block",
[xe]: "Transaction would exceed max Block Cost Limit",
[Ei]: "Transaction would exceed max Vote Cost Limit",
[Me]: "Attempted to sign a transaction with an address that is not a signer for it",
[we]: "Transaction is missing an address at index: $index.",
[ye]: "Transaction has no expected signers therefore it cannot be encoded",
[ke]: "Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",
[ae]: "Transaction does not have a blockhash lifetime",
[re]: "Transaction is not a durable nonce transaction",
[ce]: "Contents of these address lookup tables unknown: $lookupTableAddresses",
[De]: "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",
[le]: "No fee payer set in CompiledTransaction",
[ue]: "Could not find program address at index $index",
[Ge]: "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",
[_e]: "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",
[Ne]: "Transaction is missing a fee payer.",
[de]: "Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",
[Se]: "Transaction first instruction is not advance nonce account instruction.",
[he]: "Transaction with no instructions cannot be durable nonce transaction.",
[te]: "This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",
[ne]: "This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",
[fe]: "The transaction message expected the transaction to have $signerAddressesLength signatures, got $signaturesLength.",
[Re]: "Transaction is missing signatures for addresses: $addresses.",
[se]: "Transaction version must be in the range [0, 127]. `$actualVersion` given"
}, oA = "i", BA = "t";
function vi(A, I = {}) {
const g = qi[A];
if (g.length === 0)
return "";
let B;
function C(Q) {
if (B[BA] === 2) {
const i = g.slice(B[oA] + 1, Q);
E.push(
i in I ? (
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
`${I[i]}`
) : `$${i}`
);
} else B[BA] === 1 && E.push(g.slice(B[oA], Q));
}
const E = [];
return g.split("").forEach((Q, i) => {
if (i === 0) {
B = {
[oA]: 0,
[BA]: g[0] === "\\" ? 0 : g[0] === "$" ? 2 : 1
/* Text */
};
return;
}
let n;
switch (B[BA]) {
case 0:
n = {
[oA]: i,
[BA]: 1
/* Text */
};
break;
case 1:
Q === "\\" ? n = {
[oA]: i,
[BA]: 0
/* EscapeSequence */
} : Q === "$" && (n = {
[oA]: i,
[BA]: 2
/* Variable */
});
break;
case 2:
Q === "\\" ? n = {
[oA]: i,
[BA]: 0
/* EscapeSequence */
} : Q === "$" ? n = {
[oA]: i,
[BA]: 2
/* Variable */
} : Q.match(/\w/) || (n = {
[oA]: i,
[BA]: 1
/* Text */
});
break;
}
n && (B !== n && C(i), B = n);
}), C(), E.join("");
}
function Wi(A, I = {}) {
if (process.env.NODE_ENV !== "production")
return vi(A, I);
{
let g = `Solana error #${A}; Decode this error by running \`npx @solana/errors decode -- ${A}`;
return Object.keys(I).length && (g += ` '${Hi(I)}'`), `${g}\``;
}
}
function zg(A, I) {
return A instanceof Error && A.name === "SolanaError" ? I !== void 0 ? A.context.__code === I : !0 : !1;
}
var J = 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;
I && Object.entries(Object.getOwnPropertyDescriptors(I)).forEach(([E, Q]) => {
E === "cause" ? B = { cause: Q.value } : (g === void 0 && (g = {}), Object.defineProperty(g, E, Q));
});
const C = Wi(A, g);
super(C, B), this.context = g === void 0 ? {} : g, this.context.__code = A, this.name = "SolanaError";
}
};
function Vi(A, I) {
if (A.length >= I) return A;
const g = new Uint8Array(I).fill(0);
return g.set(A), g;
}
var xi = (A, I) => Vi(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, E) => C === B[E]);
}
function nA(A, I) {
return "fixedSize" in I ? I.fixedSize : I.getSizeFromValue(A);
}
function j(A) {
return Object.freeze({
...A,
encode: (I) => {
const g = new Uint8Array(nA(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 jg(A) {
if (!v(A))
throw new J(bg);
}
function Zi(A) {
return !v(A);
}
function c(A, I) {
if (v(A) !== v(I))
throw new J(Kg);
if (v(A) && v(I) && A.fixedSize !== I.fixedSize)
throw new J(pg, {
decoderFixedSize: I.fixedSize,
encoderFixedSize: A.fixedSize
});
if (!v(A) && !v(I) && A.maxSize !== I.maxSize)
throw new J(Pg, {
decoderMaxSize: I.maxSize,
encoderMaxSize: A.maxSize
});
return {
...I,
...A,
decode: I.decode,
encode: A.encode,
read: I.read,
write: A.write
};
}
function Xi(A, I, g = 0) {
if (I.length - g <= 0)
throw new J(Yg, {
codecDescription: A
});
}
function Eg(A, I, g, B = 0) {
const C = g.length - B;
if (C < I)
throw new J(Og, {
bytesLength: C,
codecDescription: A,
expected: I
});
}
function W(A, I) {
const g = (Q, i, n) => {
const M = A.encode(Q);
return n = I.write(M.length, i, n), i.set(M, n), n + M.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, E = B !== null && C !== null ? B + C : null;
return j({
...A,
...E !== null ? { maxSize: E } : {},
getSizeFromValue: (Q) => {
const i = nA(Q, A);
return nA(i, I) + i;
},
write: g
});
}
function V(A, I) {
const g = (Q, i) => {
const [n, M] = I.read(Q, i), x = Number(n);
return i = M, (i > 0 || Q.length > x) && (Q = Q.slice(i, i + x)), Eg("addDecoderSizePrefix", x, Q), [A.decode(Q), i + x];
};
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, E = B !== null && C !== null ? B + C : null;
return $({ ...A, ...E !== null ? { maxSize: E } : {}, read: g });
}
function y(A, I) {
return j({
fixedSize: I,
write: (g, B, C) => {
const E = A.encode(g), Q = E.length > I ? E.slice(0, I) : E;
return B.set(Q, C), C + I;
}
});
}
function f(A, I) {
return $({
fixedSize: I,
read: (g, B) => {
Eg("fixCodecSize", I, g, B), (B > 0 || g.length > I) && (g = g.slice(B, B + I)), v(A) && (g = xi(g, A.fixedSize));
const [C] = A.read(g, 0);
return [C, B + I];
}
});
}
function d(A, I) {
return j({
...Zi(A) ? { ...A, getSizeFromValue: (g) => A.getSizeFromValue(I(g)) } : A,
write: (g, B, C) => A.write(I(g), B, C)
});
}
function hA(A, I) {
return $({
...A,
read: (g, B) => {
const [C, E] = A.read(g, B);
return [I(C, g, B), E];
}
});
}
function zi(A, I, g = I) {
if (!I.match(new RegExp(`^[${A}]*$`)))
throw new J(pA, {
alphabet: A,
base: A.length,
value: g
});
}
var ji = (A) => j({
getSizeFromValue: (I) => {
const [g, B] = ug(I, A[0]);
if (!B) return I.length;
const C = lg(B, A);
return g.length + Math.ceil(C.toString(16).length / 2);
},
write(I, g, B) {
if (zi(A, I), I === "") return B;
const [C, E] = ug(I, A[0]);
if (!E)
return g.set(new Uint8Array(C.length).fill(0), B), B + C.length;
let Q = lg(E, A);
const i = [];
for (; Q > 0n; )
i.unshift(Number(Q % 256n)), Q /= 256n;
const n = [...Array(C.length).fill(0), ...i];
return g.set(n, B), B + n.length;
}
}), $i = (A) => $({
read(I, g) {
const B = g === 0 ? I : I.slice(g);
if (B.length === 0) return ["", 0];
let C = B.findIndex((n) => n !== 0);
C = C === -1 ? B.length : C;
const E = A[0].repeat(C);
if (C === B.length) return [E, I.length];
const Q = B.slice(C).reduce((n, M) => n * 256n + BigInt(M), 0n), i = Ao(Q, A);
return [E + i, I.length];
}
});
function ug(A, I) {
const [g, B] = A.split(new RegExp(`((?!${I}).*)`));
return [g, B];
}
function lg(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 Ao(A, I) {
const g = BigInt(I.length), B = [];
for (; A > 0n; )
B.unshift(I[Number(A % g)]), A /= g;
return B.join("");
}
var $g = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz", go = () => ji($g), Io = () => $i($g), Rg = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Co = () => j({
getSizeFromValue: (A) => {
try {
return atob(A).length;
} catch {
throw new J(pA, {
alphabet: Rg,
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 J(pA, {
alphabet: Rg,
base: 64,
value: A
});
}
}
}), Bo = (A) => (
// eslint-disable-next-line no-control-regex
A.replace(/\u0000/g, "")
), Eo = globalThis.TextDecoder, wg = globalThis.TextEncoder, Z = () => {
let A;
return j({
getSizeFromValue: (I) => (A ||= new wg()).encode(I).length,
write: (I, g, B) => {
const C = (A ||= new wg()).encode(I);
return g.set(C, B), B + C.length;
}
});
}, X = () => {
let A;
return $({
read(I, g) {
const B = (A ||= new Eo()).decode(I.slice(g));
return [Bo(B), I.length];
}
});
};
function GA(A, I) {
try {
return "exists" in A && !A.exists ? A : Object.freeze({ ...A, data: I.decode(A.data) });
} catch {
throw new J(Lg, {
address: A.address
});
}
}
function AI(A, I) {
if (!I) return Object.freeze({ address: A, exists: !1 });
const g = Co().encode(I.data[0]);
return Object.freeze({ ...Qo(I), address: A, data: g, exists: !0 });
}
function Qo(A) {
return Object.freeze({
executable: A.executable,
lamports: A.lamports,
programAddress: A.owner,
space: A.space
});
}
async function _A(A, I, g = {}) {
const { abortSignal: B, ...C } = g, E = await A.getAccountInfo(I, { ...C, encoding: "base64" }).send({ abortSignal: B });
return AI(I, E.value);
}
async function kA(A, I, g = {}) {
const { abortSignal: B, ...C } = g;
return (await A.getMultipleAccounts(I, { ...C, encoding: "base64" }).send({ abortSignal: B })).value.map((Q, i) => AI(I[i], Q));
}
function mA(A) {
if (!A.exists)
throw new J(Fg, { address: A.address });
}
function FA(A) {
const I = A.filter((g) => !g.exists);
if (I.length > 0) {
const g = I.map((B) => B.address);
throw new J(Ug, { addresses: g });
}
}
function eo() {
if (typeof globalThis.crypto > "u" || typeof globalThis.crypto.subtle?.digest != "function")
throw new J(Jg);
}
var $A, Ag;
function gI() {
return $A || ($A = go()), $A;
}
function io() {
return Ag || (Ag = Io()), Ag;
}
function oo(A) {
if (
// Lowest address (32 bytes of zeroes)
A.length < 32 || // Highest address (32 bytes of 255)
A.length > 44
)
throw new J(Gg, {
actualLength: A.length
});
const B = gI().encode(A).byteLength;
if (B !== 32)
throw new J(fg, {
actualLength: B
});
}
function to(A) {
return oo(A), A;
}
function s() {
return d(
y(gI(), 32),
(A) => to(A)
);
}
function D() {
return f(io(), 32);
}
function no() {
return c(s(), D());
}
var ao = 37095705934669439343138083508754565189542113879843219016388785533085940283555n, AA = 57896044618658097711785492504343953926634992332820282019728792003956564819949n, Ng = 19681161376707505956807079304988542015446066515923890162744021073123829784752n;
function CA(A) {
const I = A % AA;
return I >= 0n ? I : AA + I;
}
function EA(A, I) {
let g = A;
for (; I-- > 0n; )
g *= g, g %= AA;
return g;
}
function ro(A) {
const g = A * A % AA * A % AA, B = EA(g, 2n) * g % AA, C = EA(B, 1n) * A % AA, E = EA(C, 5n) * C % AA, Q = EA(E, 10n) * E % AA, i = EA(Q, 20n) * Q % AA, n = EA(i, 40n) * i % AA, M = EA(n, 80n) * n % AA, x = EA(M, 80n) * n % AA, IA = EA(x, 10n) * E % AA;
return EA(IA, 2n) * A % AA;
}
function so(A, I) {
const g = CA(I * I * I), B = CA(g * g * I), C = ro(A * B);
let E = CA(A * g * C);
const Q = CA(I * E * E), i = E, n = CA(E * Ng), M = Q === A, x = Q === CA(-A), IA = Q === CA(-A * Ng);
return M && (E = i), (x || IA) && (E = n), (CA(E) & 1n) === 1n && (E = CA(-E)), !M && !x ? null : E;
}
function co(A, I) {
const g = CA(A * A), B = CA(g - 1n), C = CA(ao * g + 1n), E = so(B, C);
if (E === null)
return !1;
const Q = (I & 128) !== 0;
return !(E === 0n && Q);
}
function Do(A) {
const I = A.toString(16);
return I.length === 1 ? `0${I}` : I;
}
function uo(A) {
const g = `0x${A.reduce((B, C, E) => `${Do(E === 31 ? C & -129 : C)}${B}`, "")}`;
return BigInt(g);
}
function lo(A) {
if (A.byteLength !== 32)
return !1;
const I = uo(A);
return co(I, A[31]);
}
var dg = 32, hg = 16, Ro = [
// 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 wo({ programAddress: A, seeds: I }) {
if (eo(), I.length > hg)
throw new J(_g, {
actual: I.length,
maxSeeds: hg
});
let g;
const B = I.reduce((n, M, x) => {
const IA = typeof M == "string" ? (g ||= new TextEncoder()).encode(M) : M;
if (IA.byteLength > dg)
throw new J(kg, {
actual: IA.byteLength,
index: x,
maxSeedLength: dg
});
return n.push(...IA), n;
}, []), C = no(), E = C.encode(A), Q = await crypto.subtle.digest(
"SHA-256",
new Uint8Array([...B, ...E, ...Ro])
), i = new Uint8Array(Q);
if (lo(i))
throw new J(Cg);
return C.decode(i);
}
async function UA({
programAddress: A,
seeds: I
}) {
let g = 255;
for (; g > 0; )
try {
return [await wo({
programAddress: A,
seeds: [...I, new Uint8Array([g])]
}), g];
} catch (B) {
if (zg(B, Cg))
g--;
else
throw B;
}
throw new J(mg);
}
function No(A, I, g, B) {
if (B < I || B > g)
throw new J(Vg, {
codecDescription: A,
max: g,
min: I,
value: B
});
}
function II(A) {
return A?.endian !== 1;
}
function uA(A) {
return j({
fixedSize: A.size,
write(I, g, B) {
A.range && No(A.name, A.range[0], A.range[1], I);
const C = new ArrayBuffer(A.size);
return A.set(new DataView(C), I, II(A.config)), g.set(new Uint8Array(C), B), B + A.size;
}
});
}
function lA(A) {
return $({
fixedSize: A.size,
read(I, g = 0) {
Xi(A.name, I, g), Eg(A.name, A.size, I, g);
const B = new DataView(ho(I, g, A.size));
return [A.get(B, II(A.config)), g + A.size];
}
});
}
function ho(A, I, g) {
const B = A.byteOffset + (I ?? 0), C = g ?? A.byteLength;
return A.buffer.slice(B, B + C);
}
var PA = (A = {}) => uA({
config: A,
name: "i32",
range: [-+"0x7fffffff" - 1, +"0x7fffffff"],
set: (I, g, B) => I.setInt32(0, Number(g), B),
size: 4
}), HA = (A = {}) => lA({
config: A,
get: (I, g) => I.getInt32(0, g),
name: "i32",
size: 4
}), QA = (A = {}) => uA({
config: A,
name: "i64",
range: [-BigInt("0x7fffffffffffffff") - 1n, BigInt("0x7fffffffffffffff")],
set: (I, g, B) => I.setBigInt64(0, BigInt(g), B),
size: 8
}), eA = (A = {}) => lA({
config: A,
get: (I, g) => I.getBigInt64(0, g),
name: "i64",
size: 8
}), U = (A = {}) => uA({
config: A,
name: "u128",
range: [0n, BigInt("0xffffffffffffffffffffffffffffffff")],
set: (I, g, B) => {
const C = B ? 8 : 0, E = B ? 0 : 8, Q = 0xffffffffffffffffn;
I.setBigUint64(C, BigInt(g) >> 64n, B), I.setBigUint64(E, BigInt(g) & Q, B);
},
size: 16
}), L = (A = {}) => lA({
config: A,
get: (I, g) => {
const B = g ? 8 : 0, C = g ? 0 : 8, E = I.getBigUint64(B, g), Q = I.getBigUint64(C, g);
return (E << 64n) + Q;
},
name: "u128",
size: 16
}), l = (A = {}) => uA({
config: A,
name: "u16",
range: [0, +"0xffff"],
set: (I, g, B) => I.setUint16(0, Number(g), B),
size: 2
}), R = (A = {}) => lA({
config: A,
get: (I, g) => I.getUint16(0, g),
name: "u16",
size: 2
}), T = (A = {}) => uA({
config: A,
name: "u32",
range: [0, +"0xffffffff"],
set: (I, g, B) => I.setUint32(0, Number(g), B),
size: 4
}), Y = (A = {}) => lA({
config: A,
get: (I, g) => I.getUint32(0, g),
name: "u32",
size: 4
}), a = (A = {}) => uA({
config: A,
name: "u64",
range: [0n, BigInt("0xffffffffffffffff")],
set: (I, g, B) => I.setBigUint64(0, BigInt(g), B),
size: 8
}), r = (A = {}) => lA({
config: A,
get: (I, g) => I.getBigUint64(0, g),
name: "u64",
size: 8
}), e = () => uA({
name: "u8",
range: [0, +"0xff"],
set: (A, I) => A.setUint8(0, Number(I)),
size: 1
}), N = () => lA({
get: (A) => A.getUint8(0),
name: "u8",
size: 1
});
function CI(A, I, g) {
if (I !== g)
throw new J(Hg, {
actual: g,
codecDescription: A,
expected: I
});
}
function So(A) {
return A.reduce(
(I, g) => I === null || g === null ? null : Math.max(I, g),
0
);
}
function aA(A) {
return A.reduce((I, g) => I === null || g === null ? null : I + g, 0);
}
function SA(A) {
return v(A) ? A.fixedSize : null;
}
function RA(A) {
return v(A) ? A.fixedSize : A.maxSize ?? null;
}
function H(A, I = {}) {
const g = I.size ?? T(), B = qA(g, SA(A)), C = qA(g, RA(A)) ?? void 0;
return j({
...B !== null ? { fixedSize: B } : {
getSizeFromValue: (E) => (typeof g == "object" ? nA(E.length, g) : 0) + [...E].reduce((i, n) => i + nA(n, A), 0),
maxSize: C
},
write: (E, Q, i) => (typeof g == "number" && CI("array", g, E.length), typeof g == "object" && (i = g.write(E.length, Q, i)), E.forEach((n) => {
i = A.write(n, Q, i);
}), i)
});
}
function q(A, I = {}) {
const g = I.size ?? Y(), B = SA(A), C = qA(g, B), E = qA(g, RA(A)) ?? void 0;
return $({
...C !== null ? { fixedSize: C } : { maxSize: E },
read: (Q, i) => {
const n = [];
if (typeof g == "object" && Q.slice(i).length === 0)
return [n, i];
if (g === "remainder") {
for (; i < Q.length; ) {
const [IA, LA] = A.read(Q, i);
i = LA, n.push(IA);
}
return [n, i];
}
const [M, x] = typeof g == "number" ? [g, i] : g.read(Q, i);
i = x;
for (let IA = 0; IA < M; IA += 1) {
const [LA, VB] = A.read(Q, i);
i = VB, n.push(LA);
}
return [n, i];
}
});
}
function qA(A, I) {
return typeof A != "number" ? null : A === 0 ? 0 : I === null ? null : I * A;
}
function b(A = {}) {
return d(A.size ?? e(), (I) => I ? 1 : 0);
}
function K(A = {}) {
return hA(A.size ?? N(), (I) => Number(I) === 1);
}
function G() {
return j({
getSizeFromValue: (A) => A.length,
write: (A, I, g) => (I.set(A, g), g + A.length)
});
}
function _() {
return $({
read: (A, I) => {
const g = A.slice(I);
return [g, I + g.length];
}
});
}
var Mo = () => $({
read(A, I) {
return [A.slice(I).reduce((B, C) => B + C.toString(16).padStart(2, "0"), ""), A.length];
}
});
function yo(A) {
return j({
fixedSize: A.length,
write: (I, g, B) => (g.set(A, B), B + A.length)
});
}
function fo(A) {
return $({
fixedSize: A.length,
read: (I, g) => {
const B = Mo();
if (!h(I, A, g))
throw new J(Zg, {
constant: A,
data: I,
hexConstant: B.decode(A),
hexData: B.decode(I),
offset: g
});
return [void 0, g + A.length];
}
});
}
function p(A) {
const I = aA(A.map(SA)), g = aA(A.map(RA)) ?? void 0;
return j({
...I === null ? {
getSizeFromValue: (B) => A.map((C, E) => nA(B[E], C)).reduce((C, E) => C + E, 0),
maxSize: g
} : { fixedSize: I },
write: (B, C, E) => (CI("tuple", A.length, B.length), A.forEach((Q, i) => {
E = Q.write(B[i], C, E);
}), E)
});
}
function P(A) {
const I = aA(A.map(SA)), g = aA(A.map(RA)) ?? void 0;
return $({
...I === null ? { maxSize: g } : { fixedSize: I },
read: (B, C) => {
const E = [];
return A.forEach((Q) => {
const [i, n] = Q.read(B, C);
E.push(i), C = n;
}), [E, C];
}
});
}
function BI(A, I) {
const g = QI(A), B = (E, Q, i) => {
const n = I(E);
return gg(A, n), A[n].write(E, Q, i);
};
if (g !== null)
return j({ fixedSize: g, write: B });
const C = eI(A);
return j({
...C !== null ? { maxSize: C } : {},
getSizeFromValue: (E) => {
const Q = I(E);
return gg(A, Q), nA(E, A[Q]);
},
write: B
});
}
function EI(A, I) {
const g = QI(A), B = (E, Q) => {
const i = I(E, Q);
return gg(A, i), A[i].read(E, Q);
};
if (g !== null)
return $({ fixedSize: g, read: B });
const C = eI(A);
return $({ ...C !== null ? { maxSize: C } : {}, read: B });
}
function gg(A, I) {
if (typeof A[I] > "u")
throw new J(xg, {
maxRange: A.length - 1,
minRange: 0,
variant: I
});
}
function QI(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 eI(A) {
return So(A.map((I) => RA(I)));
}
function wA(A, I = {}) {
const g = I.discriminator ?? "__kind", B = I.size ?? e();
return BI(
A.map(
([, C], E) => d(p([B, C]), (Q) => [E, Q])
),
(C) => Go(A, C[g])
);
}
function NA(A, I = {}) {
const g = I.discriminator ?? "__kind", B = I.size ?? N();
return EI(
A.map(
([C, E]) => hA(P([B, E]), ([, Q]) => ({
[g]: C,
...Q
}))
),
(C, E) => Number(B.read(C, E)[0])
);
}
function Go(A, I) {
const g = A.findIndex(([B]) => I === B);
if (g < 0)
throw new J(vg, {
value: I,
variants: A.map(([B]) => B)
});
return g;
}
function iI(A) {
const I = [...new Set(Object.values(A).filter((Q) => typeof Q == "number"))].sort(), g = Object.fromEntries(Object.entries(A).slice(I.length)), B = Object.keys(g), C = Object.values(g), E = [
.../* @__PURE__ */ new Set([...B, ...C.filter((Q) => typeof Q == "string")])
];
return { enumKeys: B, enumRecord: g, enumValues: C, numericalValues: I, stringValues: E };
}
function _o({
enumKeys: A,
enumValues: I,
variant: g
}) {
const B = oI(I, (C) => C === g);
return B >= 0 ? B : A.findIndex((C) => C === g);
}
function ko({
discriminator: A,
enumKeys: I,
enumValues: g,
useValuesAsDiscriminators: B
}) {
return B ? oI(g, (C) => C === A) : A >= 0 && A < I.length ? A : -1;
}
function oI(A, I) {
let g = A.length;
for (; g--; )
if (I(A[g], g, A)) return g;
return -1;
}
function tI(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 rA(A, I = {}) {
const g = I.size ?? e(), B = I.useValuesAsDiscriminators ?? !1, { enumKeys: C, enumValues: E, numericalValues: Q, stringValues: i } = iI(A);
if (B && E.some((n) => typeof n == "string"))
throw new J(Bg, {
stringValues: E.filter((n) => typeof n == "string")
});
return d(g, (n) => {
const M = _o({ enumKeys: C, enumValues: E, variant: n });
if (M < 0)
throw new J(Wg, {
formattedNumericalValues: tI(Q),
numericalValues: Q,
stringValues: i,
variant: n
});
return B ? E[M] : M;
});
}
function sA(A, I = {}) {
const g = I.size ?? N(), B = I.useValuesAsDiscriminators ?? !1, { enumKeys: C, enumValues: E, numericalValues: Q } = iI(A);
if (B && E.some((i) => typeof i == "string"))
throw new J(Bg, {
stringValues: E.filter((i) => typeof i == "string")
});
return hA(g, (i) => {
const n = Number(i), M = ko({
discriminator: n,
enumKeys: C,
enumValues: E,
useValuesAsDiscriminators: B
});
if (M < 0) {
const x = B ? Q : [...Array(C.length).keys()];
throw new J(qg, {
discriminator: n,
formattedValidDiscriminators: tI(x),
validDiscriminators: x
});
}
return E[M];
});
}
function TA() {
return j({
fixedSize: 0,
write: (A, I, g) => g
});
}
function YA() {
return $({
fixedSize: 0,
read: (A, I) => [void 0, I]
});
}
function o(A) {
const I = A.map(([, C]) => C), g = aA(I.map(SA)), B = aA(I.map(RA)) ?? void 0;
return j({
...g === null ? {
getSizeFromValue: (C) => A.map(([E, Q]) => nA(C[E], Q)).reduce((E, Q) => E + Q, 0),
maxSize: B
} : { fixedSize: g },
write: (C, E, Q) => (A.forEach(([i, n]) => {
Q = n.write(C[i], E, Q);
}), Q)
});
}
function t(A) {
const I = A.map(([, C]) => C), g = aA(I.map(SA)), B = aA(I.map(RA)) ?? void 0;
return $({
...g === null ? { maxSize: B } : { fixedSize: g },
read: (C, E) => {
const Q = {};
return A.forEach(([i, n]) => {
const [M, x] = n.read(C, E);
E = x, Q[i] = M;
}), [Q, E];
}
});
}
var nI = (A) => ({ __option: "Some", value: A }), aI = () => ({ __option: "None" }), Sg = (A) => !!(A && typeof A == "object" && "__option" in A && (A.__option === "Some" && "value" in A || A.__option === "None")), Mg = (A) => A.__option === "Some", mo = (A) => A !== null ? nI(A) : aI();
function k(A, I = {}) {
const g = I.prefix === null ? d(TA(), (C) => {
}) : b({ size: I.prefix ?? e() }), B = I.noneValue === "zeroes" ? (jg(A), y(TA(), A.fixedSize)) : I.noneValue ? yo(I.noneValue) : TA();
return BI(
[
d(p([g, B]), (C) => [
!1,
void 0
]),
d(p([g, A]), (C) => [
!0,
Sg(C) && Mg(C) ? C.value : C
])
],
(C) => {
const E = Sg(C) ? C : mo(C);
return Number(Mg(E));
}
);
}
function m(A, I = {}) {
const g = I.prefix === null ? hA(YA(), () => !1) : K({ size: I.prefix ?? N() }), B = I.noneValue === "zeroes" ? (jg(A), f(YA(), A.fixedSize)) : I.noneValue ? fo(I.noneValue) : YA();
return EI(
[
hA(P([g, B]), () => aI()),
hA(P([g, A]), ([, C]) => nI(C))
],
(C, E) => {
if (I.prefix === null && !I.noneValue)
return +(E < C.length);
if (I.prefix === null && I.noneValue != null) {
const Q = I.noneValue === "zeroes" ? new Uint8Array(B.fixedSize).fill(0) : I.noneValue;
return h(C, Q, E) ? 0 : 1;
}
return Number(g.read(C, E)[0]);
}
);
}
var OA = /* @__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))(OA || {}), Fo = 2;
function Uo(A) {
return A | Fo;
}
function Lo(A, I, g, B) {
if (!zg(A, Tg))
return !1;
const C = I.instructions[A.context.index]?.programAddress;
return !C || C !== g ? !1 : typeof B > "u" || A.context.code === B;
}
function Jo(A) {
return "modifyAndSignTransactions" in A && typeof A.modifyAndSignTransactions == "function";
}
function To(A) {
return "signTransactions" in A && typeof A.signTransactions == "function";
}
function Yo(A) {
return "signAndSendTransactions" in A && typeof A.signAndSendTransactions == "function";
}
function Oo(A) {
return To(A) || Jo(A) || Yo(A);
}
var gA = /* @__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))(gA || {});
function z() {
return rA(gA);
}
function MA() {
return sA(gA);
}
function Ar() {
return c(
z(),
MA()
);
}
var Qg = /* @__PURE__ */ ((A) => (A[A.Manual = 0] = "Manual", A[A.Launch = 1] = "Launch", A[A.Lockedlaunch = 2] = "Lockedlaunch", A[A.Presale = 3] = "Presale", A))(Qg || {});
function rI() {
return rA(Qg);
}
function sI() {
return sA(Qg);
}
function gr() {
return c(
rI(),
sI()
);
}
function bo() {
return wA([
[
"BondingCurveCreated",
o([
["creationType", rI()],
["baseMint", s()],
["quoteMint", s()],
["creato