@ignitionfi/spl-stake-pool 1.1.17 → 1.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.browser.cjs.js","sources":["../../../node_modules/.pnpm/superstruct@2.0.2/node_modules/superstruct/dist/index.mjs","../src/constants.ts","../src/utils/instruction.ts","../src/utils/math.ts","../src/utils/program-address.ts","../src/codecs.ts","../src/layouts.ts","../src/utils/stake.ts","../src/utils/index.ts","../src/instructions.ts","../src/index.ts"],"sourcesContent":["/**\n * A `StructFailure` represents a single specific failure in validation.\n */\n/**\n * `StructError` objects are thrown (or returned) when validation fails.\n *\n * Validation logic is design to exit early for maximum performance. The error\n * represents the first error encountered during validation. For more detail,\n * the `error.failures` property is a generator function that can be run to\n * continue validation and receive all the failures in the data.\n */\nclass StructError extends TypeError {\n constructor(failure, failures) {\n let cached;\n const { message, explanation, ...rest } = failure;\n const { path } = failure;\n const msg = path.length === 0 ? message : `At path: ${path.join('.')} -- ${message}`;\n super(explanation ?? msg);\n if (explanation != null)\n this.cause = msg;\n Object.assign(this, rest);\n this.name = this.constructor.name;\n this.failures = () => {\n return (cached ?? (cached = [failure, ...failures()]));\n };\n }\n}\n\n/**\n * Check if a value is an iterator.\n */\nfunction isIterable(x) {\n return isObject(x) && typeof x[Symbol.iterator] === 'function';\n}\n/**\n * Check if a value is a plain object.\n */\nfunction isObject(x) {\n return typeof x === 'object' && x != null;\n}\n/**\n * Check if a value is a non-array object.\n */\nfunction isNonArrayObject(x) {\n return isObject(x) && !Array.isArray(x);\n}\n/**\n * Check if a value is a plain object.\n */\nfunction isPlainObject(x) {\n if (Object.prototype.toString.call(x) !== '[object Object]') {\n return false;\n }\n const prototype = Object.getPrototypeOf(x);\n return prototype === null || prototype === Object.prototype;\n}\n/**\n * Return a value as a printable string.\n */\nfunction print(value) {\n if (typeof value === 'symbol') {\n return value.toString();\n }\n return typeof value === 'string' ? JSON.stringify(value) : `${value}`;\n}\n/**\n * Shifts (removes and returns) the first value from the `input` iterator.\n * Like `Array.prototype.shift()` but for an `Iterator`.\n */\nfunction shiftIterator(input) {\n const { done, value } = input.next();\n return done ? undefined : value;\n}\n/**\n * Convert a single validation result to a failure.\n */\nfunction toFailure(result, context, struct, value) {\n if (result === true) {\n return;\n }\n else if (result === false) {\n result = {};\n }\n else if (typeof result === 'string') {\n result = { message: result };\n }\n const { path, branch } = context;\n const { type } = struct;\n const { refinement, message = `Expected a value of type \\`${type}\\`${refinement ? ` with refinement \\`${refinement}\\`` : ''}, but received: \\`${print(value)}\\``, } = result;\n return {\n value,\n type,\n refinement,\n key: path[path.length - 1],\n path,\n branch,\n ...result,\n message,\n };\n}\n/**\n * Convert a validation result to an iterable of failures.\n */\nfunction* toFailures(result, context, struct, value) {\n if (!isIterable(result)) {\n result = [result];\n }\n for (const r of result) {\n const failure = toFailure(r, context, struct, value);\n if (failure) {\n yield failure;\n }\n }\n}\n/**\n * Check a value against a struct, traversing deeply into nested values, and\n * returning an iterator of failures or success.\n */\nfunction* run(value, struct, options = {}) {\n const { path = [], branch = [value], coerce = false, mask = false } = options;\n const ctx = { path, branch, mask };\n if (coerce) {\n value = struct.coercer(value, ctx);\n }\n let status = 'valid';\n for (const failure of struct.validator(value, ctx)) {\n failure.explanation = options.message;\n status = 'not_valid';\n yield [failure, undefined];\n }\n for (let [k, v, s] of struct.entries(value, ctx)) {\n const ts = run(v, s, {\n path: k === undefined ? path : [...path, k],\n branch: k === undefined ? branch : [...branch, v],\n coerce,\n mask,\n message: options.message,\n });\n for (const t of ts) {\n if (t[0]) {\n status = t[0].refinement != null ? 'not_refined' : 'not_valid';\n yield [t[0], undefined];\n }\n else if (coerce) {\n v = t[1];\n if (k === undefined) {\n value = v;\n }\n else if (value instanceof Map) {\n value.set(k, v);\n }\n else if (value instanceof Set) {\n value.add(v);\n }\n else if (isObject(value)) {\n if (v !== undefined || k in value)\n value[k] = v;\n }\n }\n }\n }\n if (status !== 'not_valid') {\n for (const failure of struct.refiner(value, ctx)) {\n failure.explanation = options.message;\n status = 'not_refined';\n yield [failure, undefined];\n }\n }\n if (status === 'valid') {\n yield [undefined, value];\n }\n}\n\n/**\n * `Struct` objects encapsulate the validation logic for a specific type of\n * values. Once constructed, you use the `assert`, `is` or `validate` helpers to\n * validate unknown input data against the struct.\n */\nclass Struct {\n constructor(props) {\n const { type, schema, validator, refiner, coercer = (value) => value, entries = function* () { }, } = props;\n this.type = type;\n this.schema = schema;\n this.entries = entries;\n this.coercer = coercer;\n if (validator) {\n this.validator = (value, context) => {\n const result = validator(value, context);\n return toFailures(result, context, this, value);\n };\n }\n else {\n this.validator = () => [];\n }\n if (refiner) {\n this.refiner = (value, context) => {\n const result = refiner(value, context);\n return toFailures(result, context, this, value);\n };\n }\n else {\n this.refiner = () => [];\n }\n }\n /**\n * Assert that a value passes the struct's validation, throwing if it doesn't.\n */\n assert(value, message) {\n return assert(value, this, message);\n }\n /**\n * Create a value with the struct's coercion logic, then validate it.\n */\n create(value, message) {\n return create(value, this, message);\n }\n /**\n * Check if a value passes the struct's validation.\n */\n is(value) {\n return is(value, this);\n }\n /**\n * Mask a value, coercing and validating it, but returning only the subset of\n * properties defined by the struct's schema. Masking applies recursively to\n * props of `object` structs only.\n */\n mask(value, message) {\n return mask(value, this, message);\n }\n /**\n * Validate a value with the struct's validation logic, returning a tuple\n * representing the result.\n *\n * You may optionally pass `true` for the `coerce` argument to coerce\n * the value before attempting to validate it. If you do, the result will\n * contain the coerced result when successful. Also, `mask` will turn on\n * masking of the unknown `object` props recursively if passed.\n */\n validate(value, options = {}) {\n return validate(value, this, options);\n }\n}\n/**\n * Assert that a value passes a struct, throwing if it doesn't.\n */\nfunction assert(value, struct, message) {\n const result = validate(value, struct, { message });\n if (result[0]) {\n throw result[0];\n }\n}\n/**\n * Create a value with the coercion logic of struct and validate it.\n */\nfunction create(value, struct, message) {\n const result = validate(value, struct, { coerce: true, message });\n if (result[0]) {\n throw result[0];\n }\n else {\n return result[1];\n }\n}\n/**\n * Mask a value, returning only the subset of properties defined by a struct.\n */\nfunction mask(value, struct, message) {\n const result = validate(value, struct, { coerce: true, mask: true, message });\n if (result[0]) {\n throw result[0];\n }\n else {\n return result[1];\n }\n}\n/**\n * Check if a value passes a struct.\n */\nfunction is(value, struct) {\n const result = validate(value, struct);\n return !result[0];\n}\n/**\n * Validate a value against a struct, returning an error if invalid, or the\n * value (with potential coercion) if valid.\n */\nfunction validate(value, struct, options = {}) {\n const tuples = run(value, struct, options);\n const tuple = shiftIterator(tuples);\n if (tuple[0]) {\n const error = new StructError(tuple[0], function* () {\n for (const t of tuples) {\n if (t[0]) {\n yield t[0];\n }\n }\n });\n return [error, undefined];\n }\n else {\n const v = tuple[1];\n return [undefined, v];\n }\n}\n\nfunction assign(...Structs) {\n const isType = Structs[0].type === 'type';\n const schemas = Structs.map((s) => s.schema);\n const schema = Object.assign({}, ...schemas);\n return isType ? type(schema) : object(schema);\n}\n/**\n * Define a new struct type with a custom validation function.\n */\nfunction define(name, validator) {\n return new Struct({ type: name, schema: null, validator });\n}\n/**\n * Create a new struct based on an existing struct, but the value is allowed to\n * be `undefined`. `log` will be called if the value is not `undefined`.\n */\nfunction deprecated(struct, log) {\n return new Struct({\n ...struct,\n refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx),\n validator(value, ctx) {\n if (value === undefined) {\n return true;\n }\n else {\n log(value, ctx);\n return struct.validator(value, ctx);\n }\n },\n });\n}\n/**\n * Create a struct with dynamic validation logic.\n *\n * The callback will receive the value currently being validated, and must\n * return a struct object to validate it with. This can be useful to model\n * validation logic that changes based on its input.\n */\nfunction dynamic(fn) {\n return new Struct({\n type: 'dynamic',\n schema: null,\n *entries(value, ctx) {\n const struct = fn(value, ctx);\n yield* struct.entries(value, ctx);\n },\n validator(value, ctx) {\n const struct = fn(value, ctx);\n return struct.validator(value, ctx);\n },\n coercer(value, ctx) {\n const struct = fn(value, ctx);\n return struct.coercer(value, ctx);\n },\n refiner(value, ctx) {\n const struct = fn(value, ctx);\n return struct.refiner(value, ctx);\n },\n });\n}\n/**\n * Create a struct with lazily evaluated validation logic.\n *\n * The first time validation is run with the struct, the callback will be called\n * and must return a struct object to use. This is useful for cases where you\n * want to have self-referential structs for nested data structures to avoid a\n * circular definition problem.\n */\nfunction lazy(fn) {\n let struct;\n return new Struct({\n type: 'lazy',\n schema: null,\n *entries(value, ctx) {\n struct ?? (struct = fn());\n yield* struct.entries(value, ctx);\n },\n validator(value, ctx) {\n struct ?? (struct = fn());\n return struct.validator(value, ctx);\n },\n coercer(value, ctx) {\n struct ?? (struct = fn());\n return struct.coercer(value, ctx);\n },\n refiner(value, ctx) {\n struct ?? (struct = fn());\n return struct.refiner(value, ctx);\n },\n });\n}\n/**\n * Create a new struct based on an existing object struct, but excluding\n * specific properties.\n *\n * Like TypeScript's `Omit` utility.\n */\nfunction omit(struct, keys) {\n const { schema } = struct;\n const subschema = { ...schema };\n for (const key of keys) {\n delete subschema[key];\n }\n switch (struct.type) {\n case 'type':\n return type(subschema);\n default:\n return object(subschema);\n }\n}\n/**\n * Create a new struct based on an existing object struct, but with all of its\n * properties allowed to be `undefined`.\n *\n * Like TypeScript's `Partial` utility.\n */\nfunction partial(struct) {\n const isStruct = struct instanceof Struct;\n const schema = isStruct ? { ...struct.schema } : { ...struct };\n for (const key in schema) {\n schema[key] = optional(schema[key]);\n }\n if (isStruct && struct.type === 'type') {\n return type(schema);\n }\n return object(schema);\n}\n/**\n * Create a new struct based on an existing object struct, but only including\n * specific properties.\n *\n * Like TypeScript's `Pick` utility.\n */\nfunction pick(struct, keys) {\n const { schema } = struct;\n const subschema = {};\n for (const key of keys) {\n subschema[key] = schema[key];\n }\n switch (struct.type) {\n case 'type':\n return type(subschema);\n default:\n return object(subschema);\n }\n}\n/**\n * Define a new struct type with a custom validation function.\n *\n * @deprecated This function has been renamed to `define`.\n */\nfunction struct(name, validator) {\n console.warn('superstruct@0.11 - The `struct` helper has been renamed to `define`.');\n return define(name, validator);\n}\n\n/**\n * Ensure that any value passes validation.\n */\nfunction any() {\n return define('any', () => true);\n}\nfunction array(Element) {\n return new Struct({\n type: 'array',\n schema: Element,\n *entries(value) {\n if (Element && Array.isArray(value)) {\n for (const [i, v] of value.entries()) {\n yield [i, v, Element];\n }\n }\n },\n coercer(value) {\n return Array.isArray(value) ? value.slice() : value;\n },\n validator(value) {\n return (Array.isArray(value) ||\n `Expected an array value, but received: ${print(value)}`);\n },\n });\n}\n/**\n * Ensure that a value is a bigint.\n */\nfunction bigint() {\n return define('bigint', (value) => {\n return typeof value === 'bigint';\n });\n}\n/**\n * Ensure that a value is a boolean.\n */\nfunction boolean() {\n return define('boolean', (value) => {\n return typeof value === 'boolean';\n });\n}\n/**\n * Ensure that a value is a valid `Date`.\n *\n * Note: this also ensures that the value is *not* an invalid `Date` object,\n * which can occur when parsing a date fails but still returns a `Date`.\n */\nfunction date() {\n return define('date', (value) => {\n return ((value instanceof Date && !isNaN(value.getTime())) ||\n `Expected a valid \\`Date\\` object, but received: ${print(value)}`);\n });\n}\nfunction enums(values) {\n const schema = {};\n const description = values.map((v) => print(v)).join();\n for (const key of values) {\n schema[key] = key;\n }\n return new Struct({\n type: 'enums',\n schema,\n validator(value) {\n return (values.includes(value) ||\n `Expected one of \\`${description}\\`, but received: ${print(value)}`);\n },\n });\n}\n/**\n * Ensure that a value is a function.\n */\nfunction func() {\n return define('func', (value) => {\n return (typeof value === 'function' ||\n `Expected a function, but received: ${print(value)}`);\n });\n}\n/**\n * Ensure that a value is an instance of a specific class.\n */\nfunction instance(Class) {\n return define('instance', (value) => {\n return (value instanceof Class ||\n `Expected a \\`${Class.name}\\` instance, but received: ${print(value)}`);\n });\n}\n/**\n * Ensure that a value is an integer.\n */\nfunction integer() {\n return define('integer', (value) => {\n return ((typeof value === 'number' && !isNaN(value) && Number.isInteger(value)) ||\n `Expected an integer, but received: ${print(value)}`);\n });\n}\n/**\n * Ensure that a value matches all of a set of types.\n */\nfunction intersection(Structs) {\n return new Struct({\n type: 'intersection',\n schema: null,\n *entries(value, ctx) {\n for (const S of Structs) {\n yield* S.entries(value, ctx);\n }\n },\n *validator(value, ctx) {\n for (const S of Structs) {\n yield* S.validator(value, ctx);\n }\n },\n *refiner(value, ctx) {\n for (const S of Structs) {\n yield* S.refiner(value, ctx);\n }\n },\n });\n}\nfunction literal(constant) {\n const description = print(constant);\n const t = typeof constant;\n return new Struct({\n type: 'literal',\n schema: t === 'string' || t === 'number' || t === 'boolean' ? constant : null,\n validator(value) {\n return (value === constant ||\n `Expected the literal \\`${description}\\`, but received: ${print(value)}`);\n },\n });\n}\nfunction map(Key, Value) {\n return new Struct({\n type: 'map',\n schema: null,\n *entries(value) {\n if (Key && Value && value instanceof Map) {\n for (const [k, v] of value.entries()) {\n yield [k, k, Key];\n yield [k, v, Value];\n }\n }\n },\n coercer(value) {\n return value instanceof Map ? new Map(value) : value;\n },\n validator(value) {\n return (value instanceof Map ||\n `Expected a \\`Map\\` object, but received: ${print(value)}`);\n },\n });\n}\n/**\n * Ensure that no value ever passes validation.\n */\nfunction never() {\n return define('never', () => false);\n}\n/**\n * Augment an existing struct to allow `null` values.\n */\nfunction nullable(struct) {\n return new Struct({\n ...struct,\n validator: (value, ctx) => value === null || struct.validator(value, ctx),\n refiner: (value, ctx) => value === null || struct.refiner(value, ctx),\n });\n}\n/**\n * Ensure that a value is a number.\n */\nfunction number() {\n return define('number', (value) => {\n return ((typeof value === 'number' && !isNaN(value)) ||\n `Expected a number, but received: ${print(value)}`);\n });\n}\nfunction object(schema) {\n const knowns = schema ? Object.keys(schema) : [];\n const Never = never();\n return new Struct({\n type: 'object',\n schema: schema ? schema : null,\n *entries(value) {\n if (schema && isObject(value)) {\n const unknowns = new Set(Object.keys(value));\n for (const key of knowns) {\n unknowns.delete(key);\n yield [key, value[key], schema[key]];\n }\n for (const key of unknowns) {\n yield [key, value[key], Never];\n }\n }\n },\n validator(value) {\n return (isNonArrayObject(value) ||\n `Expected an object, but received: ${print(value)}`);\n },\n coercer(value, ctx) {\n if (!isNonArrayObject(value)) {\n return value;\n }\n const coerced = { ...value };\n // The `object` struct has special behaviour enabled by the mask flag.\n // When masking, properties that are not in the schema are deleted from\n // the coerced object instead of eventually failing validaiton.\n if (ctx.mask && schema) {\n for (const key in coerced) {\n if (schema[key] === undefined) {\n delete coerced[key];\n }\n }\n }\n return coerced;\n },\n });\n}\n/**\n * Augment a struct to allow `undefined` values.\n */\nfunction optional(struct) {\n return new Struct({\n ...struct,\n validator: (value, ctx) => value === undefined || struct.validator(value, ctx),\n refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx),\n });\n}\n/**\n * Ensure that a value is an object with keys and values of specific types, but\n * without ensuring any specific shape of properties.\n *\n * Like TypeScript's `Record` utility.\n */\nfunction record(Key, Value) {\n return new Struct({\n type: 'record',\n schema: null,\n *entries(value) {\n if (isObject(value)) {\n for (const k in value) {\n const v = value[k];\n yield [k, k, Key];\n yield [k, v, Value];\n }\n }\n },\n validator(value) {\n return (isNonArrayObject(value) ||\n `Expected an object, but received: ${print(value)}`);\n },\n coercer(value) {\n return isNonArrayObject(value) ? { ...value } : value;\n },\n });\n}\n/**\n * Ensure that a value is a `RegExp`.\n *\n * Note: this does not test the value against the regular expression! For that\n * you need to use the `pattern()` refinement.\n */\nfunction regexp() {\n return define('regexp', (value) => {\n return value instanceof RegExp;\n });\n}\nfunction set(Element) {\n return new Struct({\n type: 'set',\n schema: null,\n *entries(value) {\n if (Element && value instanceof Set) {\n for (const v of value) {\n yield [v, v, Element];\n }\n }\n },\n coercer(value) {\n return value instanceof Set ? new Set(value) : value;\n },\n validator(value) {\n return (value instanceof Set ||\n `Expected a \\`Set\\` object, but received: ${print(value)}`);\n },\n });\n}\n/**\n * Ensure that a value is a string.\n */\nfunction string() {\n return define('string', (value) => {\n return (typeof value === 'string' ||\n `Expected a string, but received: ${print(value)}`);\n });\n}\n/**\n * Ensure that a value is a tuple of a specific length, and that each of its\n * elements is of a specific type.\n */\nfunction tuple(Structs) {\n const Never = never();\n return new Struct({\n type: 'tuple',\n schema: null,\n *entries(value) {\n if (Array.isArray(value)) {\n const length = Math.max(Structs.length, value.length);\n for (let i = 0; i < length; i++) {\n yield [i, value[i], Structs[i] || Never];\n }\n }\n },\n validator(value) {\n return (Array.isArray(value) ||\n `Expected an array, but received: ${print(value)}`);\n },\n coercer(value) {\n return Array.isArray(value) ? value.slice() : value;\n },\n });\n}\n/**\n * Ensure that a value has a set of known properties of specific types.\n *\n * Note: Unrecognized properties are allowed and untouched. This is similar to\n * how TypeScript's structural typing works.\n */\nfunction type(schema) {\n const keys = Object.keys(schema);\n return new Struct({\n type: 'type',\n schema,\n *entries(value) {\n if (isObject(value)) {\n for (const k of keys) {\n yield [k, value[k], schema[k]];\n }\n }\n },\n validator(value) {\n return (isNonArrayObject(value) ||\n `Expected an object, but received: ${print(value)}`);\n },\n coercer(value) {\n return isNonArrayObject(value) ? { ...value } : value;\n },\n });\n}\n/**\n * Ensure that a value matches one of a set of types.\n */\nfunction union(Structs) {\n const description = Structs.map((s) => s.type).join(' | ');\n return new Struct({\n type: 'union',\n schema: null,\n coercer(value, ctx) {\n for (const S of Structs) {\n const [error, coerced] = S.validate(value, {\n coerce: true,\n mask: ctx.mask,\n });\n if (!error) {\n return coerced;\n }\n }\n return value;\n },\n validator(value, ctx) {\n const failures = [];\n for (const S of Structs) {\n const [...tuples] = run(value, S, ctx);\n const [first] = tuples;\n if (!first[0]) {\n return [];\n }\n else {\n for (const [failure] of tuples) {\n if (failure) {\n failures.push(failure);\n }\n }\n }\n }\n return [\n `Expected the value to satisfy a union of \\`${description}\\`, but received: ${print(value)}`,\n ...failures,\n ];\n },\n });\n}\n/**\n * Ensure that any value passes validation, without widening its type to `any`.\n */\nfunction unknown() {\n return define('unknown', () => true);\n}\n\n/**\n * Augment a `Struct` to add an additional coercion step to its input.\n *\n * This allows you to transform input data before validating it, to increase the\n * likelihood that it passes validation—for example for default values, parsing\n * different formats, etc.\n *\n * Note: You must use `create(value, Struct)` on the value to have the coercion\n * take effect! Using simply `assert()` or `is()` will not use coercion.\n */\nfunction coerce(struct, condition, coercer) {\n return new Struct({\n ...struct,\n coercer: (value, ctx) => {\n return is(value, condition)\n ? struct.coercer(coercer(value, ctx), ctx)\n : struct.coercer(value, ctx);\n },\n });\n}\n/**\n * Augment a struct to replace `undefined` values with a default.\n *\n * Note: You must use `create(value, Struct)` on the value to have the coercion\n * take effect! Using simply `assert()` or `is()` will not use coercion.\n */\nfunction defaulted(struct, fallback, options = {}) {\n return coerce(struct, unknown(), (x) => {\n const f = typeof fallback === 'function' ? fallback() : fallback;\n if (x === undefined) {\n return f;\n }\n if (!options.strict && isPlainObject(x) && isPlainObject(f)) {\n const ret = { ...x };\n let changed = false;\n for (const key in f) {\n if (ret[key] === undefined) {\n ret[key] = f[key];\n changed = true;\n }\n }\n if (changed) {\n return ret;\n }\n }\n return x;\n });\n}\n/**\n * Augment a struct to trim string inputs.\n *\n * Note: You must use `create(value, Struct)` on the value to have the coercion\n * take effect! Using simply `assert()` or `is()` will not use coercion.\n */\nfunction trimmed(struct) {\n return coerce(struct, string(), (x) => x.trim());\n}\n\n/**\n * Ensure that a string, array, map, or set is empty.\n */\nfunction empty(struct) {\n return refine(struct, 'empty', (value) => {\n const size = getSize(value);\n return (size === 0 ||\n `Expected an empty ${struct.type} but received one with a size of \\`${size}\\``);\n });\n}\nfunction getSize(value) {\n if (value instanceof Map || value instanceof Set) {\n return value.size;\n }\n else {\n return value.length;\n }\n}\n/**\n * Ensure that a number or date is below a threshold.\n */\nfunction max(struct, threshold, options = {}) {\n const { exclusive } = options;\n return refine(struct, 'max', (value) => {\n return exclusive\n ? value < threshold\n : value <= threshold ||\n `Expected a ${struct.type} less than ${exclusive ? '' : 'or equal to '}${threshold} but received \\`${value}\\``;\n });\n}\n/**\n * Ensure that a number or date is above a threshold.\n */\nfunction min(struct, threshold, options = {}) {\n const { exclusive } = options;\n return refine(struct, 'min', (value) => {\n return exclusive\n ? value > threshold\n : value >= threshold ||\n `Expected a ${struct.type} greater than ${exclusive ? '' : 'or equal to '}${threshold} but received \\`${value}\\``;\n });\n}\n/**\n * Ensure that a string, array, map or set is not empty.\n */\nfunction nonempty(struct) {\n return refine(struct, 'nonempty', (value) => {\n const size = getSize(value);\n return (size > 0 || `Expected a nonempty ${struct.type} but received an empty one`);\n });\n}\n/**\n * Ensure that a string matches a regular expression.\n */\nfunction pattern(struct, regexp) {\n return refine(struct, 'pattern', (value) => {\n return (regexp.test(value) ||\n `Expected a ${struct.type} matching \\`/${regexp.source}/\\` but received \"${value}\"`);\n });\n}\n/**\n * Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`.\n */\nfunction size(struct, min, max = min) {\n const expected = `Expected a ${struct.type}`;\n const of = min === max ? `of \\`${min}\\`` : `between \\`${min}\\` and \\`${max}\\``;\n return refine(struct, 'size', (value) => {\n if (typeof value === 'number' || value instanceof Date) {\n return ((min <= value && value <= max) ||\n `${expected} ${of} but received \\`${value}\\``);\n }\n else if (value instanceof Map || value instanceof Set) {\n const { size } = value;\n return ((min <= size && size <= max) ||\n `${expected} with a size ${of} but received one with a size of \\`${size}\\``);\n }\n else {\n const { length } = value;\n return ((min <= length && length <= max) ||\n `${expected} with a length ${of} but received one with a length of \\`${length}\\``);\n }\n });\n}\n/**\n * Augment a `Struct` to add an additional refinement to the validation.\n *\n * The refiner function is guaranteed to receive a value of the struct's type,\n * because the struct's existing validation will already have passed. This\n * allows you to layer additional validation on top of existing structs.\n */\nfunction refine(struct, name, refiner) {\n return new Struct({\n ...struct,\n *refiner(value, ctx) {\n yield* struct.refiner(value, ctx);\n const result = refiner(value, ctx);\n const failures = toFailures(result, ctx, struct, value);\n for (const failure of failures) {\n yield { ...failure, refinement: name };\n }\n },\n });\n}\n\nexport { Struct, StructError, any, array, assert, assign, bigint, boolean, coerce, create, date, defaulted, define, deprecated, dynamic, empty, enums, func, instance, integer, intersection, is, lazy, literal, map, mask, max, min, never, nonempty, nullable, number, object, omit, optional, partial, pattern, pick, record, refine, regexp, set, size, string, struct, trimmed, tuple, type, union, unknown, validate };\n//# sourceMappingURL=index.mjs.map\n","import { Buffer } from 'node:buffer'\nimport { LAMPORTS_PER_SOL, PublicKey } from '@solana/web3.js'\n\n// Public key that identifies the metadata program.\nexport const METADATA_PROGRAM_ID = new PublicKey('metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s')\nexport const METADATA_MAX_NAME_LENGTH = 32\nexport const METADATA_MAX_SYMBOL_LENGTH = 10\nexport const METADATA_MAX_URI_LENGTH = 200\n\n// Public key that identifies the SPL Stake Pool program.\nexport const STAKE_POOL_PROGRAM_ID = new PublicKey('SP1s4uFeTAX9jsXXmwyDs1gxYYf7cdDZ8qHUHVxE1yr')\n\n// Public key that identifies the SPL Stake Pool program deployed to devnet.\nexport const DEVNET_STAKE_POOL_PROGRAM_ID = new PublicKey(\n 'DPoo15wWDqpPJJtS2MUZ49aRxqz5ZaaJCJP4z8bLuib',\n)\n\n// Maximum number of validators to update during UpdateValidatorListBalance.\nexport const MAX_VALIDATORS_TO_UPDATE = 4\n\n// Seed for ephemeral stake account\nexport const EPHEMERAL_STAKE_SEED_PREFIX = Buffer.from('ephemeral')\n\n// Seed used to derive transient stake accounts.\nexport const TRANSIENT_STAKE_SEED_PREFIX = Buffer.from('transient')\n\n// Minimum amount of staked SOL required in a validator stake account to allow\n// for merges without a mismatch on credits observed\nexport const MINIMUM_ACTIVE_STAKE = LAMPORTS_PER_SOL\n","import { Buffer } from 'node:buffer'\nimport * as BufferLayout from '@solana/buffer-layout'\n\n/**\n * @internal\n */\nexport type InstructionType = {\n /** The Instruction index (from solana upstream program) */\n index: number\n /** The BufferLayout to use to build data */\n layout: BufferLayout.Layout<any>\n}\n\n/**\n * Populate a buffer of instruction data using an InstructionType\n * @internal\n */\nexport function encodeData(type: InstructionType, fields?: any): Buffer {\n const allocLength = type.layout.span\n const data = Buffer.alloc(allocLength)\n const layoutFields = Object.assign({ instruction: type.index }, fields)\n type.layout.encode(layoutFields, data)\n\n return data\n}\n\n/**\n * Decode instruction data buffer using an InstructionType\n * @internal\n */\nexport function decodeData(type: InstructionType, buffer: Buffer): any {\n let data\n try {\n data = type.layout.decode(buffer)\n } catch (err) {\n throw new Error(`invalid instruction; ${err}`)\n }\n\n if (data.instruction !== type.index) {\n throw new Error(\n `invalid instruction; instruction index mismatch ${data.instruction} != ${type.index}`,\n )\n }\n\n return data\n}\n","import { LAMPORTS_PER_SOL } from '@solana/web3.js'\nimport BN from 'bn.js'\n\nexport function solToLamports(amount: number): number {\n if (isNaN(amount)) {\n return Number(0)\n }\n return Number(amount * LAMPORTS_PER_SOL)\n}\n\nexport function lamportsToSol(lamports: number | BN | bigint): number {\n if (typeof lamports === 'number') {\n return Math.abs(lamports) / LAMPORTS_PER_SOL\n }\n if (typeof lamports === 'bigint') {\n return Math.abs(Number(lamports)) / LAMPORTS_PER_SOL\n }\n\n let signMultiplier = 1\n if (lamports.isNeg()) {\n signMultiplier = -1\n }\n\n const absLamports = lamports.abs()\n const lamportsString = absLamports.toString(10).padStart(10, '0')\n const splitIndex = lamportsString.length - 9\n const solString = `${lamportsString.slice(0, splitIndex)}.${lamportsString.slice(splitIndex)}`\n return signMultiplier * Number.parseFloat(solString)\n}\n","import { Buffer } from 'node:buffer'\nimport { PublicKey } from '@solana/web3.js'\nimport BN from 'bn.js'\nimport {\n EPHEMERAL_STAKE_SEED_PREFIX,\n METADATA_PROGRAM_ID,\n TRANSIENT_STAKE_SEED_PREFIX,\n} from '../constants'\n\n/**\n * Generates the wSOL transient program address for the stake pool\n */\nexport function findWsolTransientProgramAddress(\n programId: PublicKey,\n userPubkey: PublicKey,\n) {\n const [publicKey] = PublicKey.findProgramAddressSync(\n [Buffer.from('transient_wsol'), userPubkey.toBuffer()],\n programId,\n )\n return publicKey\n}\n\n/**\n * Generates the withdraw authority program address for the stake pool\n */\nexport async function findWithdrawAuthorityProgramAddress(\n programId: PublicKey,\n stakePoolAddress: PublicKey,\n) {\n const [publicKey] = PublicKey.findProgramAddressSync(\n [stakePoolAddress.toBuffer(), Buffer.from('withdraw')],\n programId,\n )\n return publicKey\n}\n\n/**\n * Generates the stake program address for a validator's vote account\n */\nexport async function findStakeProgramAddress(\n programId: PublicKey,\n voteAccountAddress: PublicKey,\n stakePoolAddress: PublicKey,\n seed?: number,\n) {\n const [publicKey] = PublicKey.findProgramAddressSync(\n [\n voteAccountAddress.toBuffer(),\n stakePoolAddress.toBuffer(),\n seed ? new BN(seed).toArrayLike(Buffer, 'le', 4) : Buffer.alloc(0),\n ],\n programId,\n )\n return publicKey\n}\n\n/**\n * Generates the stake program address for a validator's vote account\n */\nexport async function findTransientStakeProgramAddress(\n programId: PublicKey,\n voteAccountAddress: PublicKey,\n stakePoolAddress: PublicKey,\n seed: BN,\n) {\n const [publicKey] = PublicKey.findProgramAddressSync(\n [\n TRANSIENT_STAKE_SEED_PREFIX,\n voteAccountAddress.toBuffer(),\n stakePoolAddress.toBuffer(),\n seed.toArrayLike(Buffer, 'le', 8),\n ],\n programId,\n )\n return publicKey\n}\n\n/**\n * Generates the ephemeral program address for stake pool redelegation\n */\nexport async function findEphemeralStakeProgramAddress(\n programId: PublicKey,\n stakePoolAddress: PublicKey,\n seed: BN,\n) {\n const [publicKey] = PublicKey.findProgramAddressSync(\n [EPHEMERAL_STAKE_SEED_PREFIX, stakePoolAddress.toBuffer(), seed.toArrayLike(Buffer, 'le', 8)],\n programId,\n )\n return publicKey\n}\n\n/**\n * Generates the metadata program address for the stake pool\n */\nexport function findMetadataAddress(stakePoolMintAddress: PublicKey) {\n const [publicKey] = PublicKey.findProgramAddressSync(\n [Buffer.from('metadata'), METADATA_PROGRAM_ID.toBuffer(), stakePoolMintAddress.toBuffer()],\n METADATA_PROGRAM_ID,\n )\n return publicKey\n}\n","import { PublicKey } from '@solana/web3.js'\nimport BN from 'bn.js'\nimport { blob, Layout as LayoutCls, offset, seq, struct, u8, u32 } from 'buffer-layout'\n\nexport interface Layout<T> {\n span: number\n property?: string\n\n decode: (b: Buffer, offset?: number) => T\n\n encode: (src: T, b: Buffer, offset?: number) => number\n\n getSpan: (b: Buffer, offset?: number) => number\n\n replicate: (name: string) => this\n}\n\nclass BNLayout extends LayoutCls<BN> {\n blob: Layout<Buffer>\n signed: boolean\n\n constructor(span: number, signed: boolean, property?: string) {\n super(span, property)\n this.blob = blob(span)\n this.signed = signed\n }\n\n decode(b: Buffer, offset = 0) {\n const num = new BN(this.blob.decode(b, offset), 10, 'le')\n if (this.signed) {\n return num.fromTwos(this.span * 8).clone()\n }\n return num\n }\n\n encode(src: BN, b: Buffer, offset = 0) {\n if (this.signed) {\n src = src.toTwos(this.span * 8)\n }\n return this.blob.encode(src.toArrayLike(Buffer, 'le', this.span), b, offset)\n }\n}\n\nexport function u64(property?: string): Layout<BN> {\n return new BNLayout(8, false, property)\n}\n\nclass WrappedLayout<T, U> extends LayoutCls<U> {\n layout: Layout<T>\n decoder: (data: T) => U\n encoder: (src: U) => T\n\n constructor(\n layout: Layout<T>,\n decoder: (data: T) => U,\n encoder: (src: U) => T,\n property?: string,\n ) {\n super(layout.span, property)\n this.layout = layout\n this.decoder = decoder\n this.encoder = encoder\n }\n\n decode(b: Buffer, offset?: number): U {\n return this.decoder(this.layout.decode(b, offset))\n }\n\n encode(src: U, b: Buffer, offset?: number): number {\n return this.layout.encode(this.encoder(src), b, offset)\n }\n\n getSpan(b: Buffer, offset?: number): number {\n return this.layout.getSpan(b, offset)\n }\n}\n\nexport function publicKey(property?: string): Layout<PublicKey> {\n return new WrappedLayout(\n blob(32),\n (b: Buffer) => new PublicKey(b),\n (key: PublicKey) => key.toBuffer(),\n property,\n )\n}\n\nclass OptionLayout<T> extends LayoutCls<T | null> {\n layout: Layout<T>\n discriminator: Layout<number>\n\n constructor(layout: Layout<T>, property?: string) {\n super(-1, property)\n this.layout = layout\n this.discriminator = u8()\n }\n\n encode(src: T | null, b: Buffer, offset = 0): number {\n if (src === null || src === undefined) {\n return this.discriminator.encode(0, b, offset)\n }\n this.discriminator.encode(1, b, offset)\n return this.layout.encode(src, b, offset + 1) + 1\n }\n\n decode(b: Buffer, offset = 0): T | null {\n const discriminator = this.discriminator.decode(b, offset)\n if (discriminator === 0) {\n return null\n } else if (discriminator === 1) {\n return this.layout.decode(b, offset + 1)\n }\n throw new Error(`Invalid option ${this.property}`)\n }\n\n getSpan(b: Buffer, offset = 0): number {\n const discriminator = this.discriminator.decode(b, offset)\n if (discriminator === 0) {\n return 1\n } else if (discriminator === 1) {\n return this.layout.getSpan(b, offset + 1) + 1\n }\n throw new Error(`Invalid option ${this.property}`)\n }\n}\n\nexport function option<T>(layout: Layout<T>, property?: string): Layout<T | null> {\n return new OptionLayout<T>(layout, property)\n}\n\nexport function bool(property?: string): Layout<boolean> {\n return new WrappedLayout(u8(), decodeBool, encodeBool, property)\n}\n\nfunction decodeBool(value: number): boolean {\n if (value === 0) {\n return false\n } else if (value === 1) {\n return true\n }\n throw new Error(`Invalid bool: ${value}`)\n}\n\nfunction encodeBool(value: boolean): number {\n return value ? 1 : 0\n}\n\nexport function vec<T>(elementLayout: Layout<T>, property?: string): Layout<T[]> {\n const length = u32('length')\n const layout: Layout<{ values: T[] }> = struct([\n length,\n seq(elementLayout, offset(length, -length.span), 'values'),\n ])\n return new WrappedLayout(\n layout,\n ({ values }) => values,\n values => ({ values }),\n property,\n )\n}\n","import { PublicKey } from '@solana/web3.js'\nimport BN from 'bn.js'\nimport { Layout as LayoutCls, struct, u8, u32 } from 'buffer-layout'\nimport {\n coerce,\n enums,\n Infer,\n instance,\n nullable,\n number,\n optional,\n string,\n type,\n} from 'superstruct'\nimport { Layout, option, publicKey, u64, vec } from './codecs'\n\nexport interface Fee {\n denominator: BN\n numerator: BN\n}\n\nconst feeFields = [u64('denominator'), u64('numerator')]\n\nexport enum AccountType {\n Uninitialized,\n StakePool,\n ValidatorList,\n}\n\nexport const BigNumFromString = coerce(instance(BN), string(), (value) => {\n if (typeof value === 'string') {\n return new BN(value, 10)\n }\n throw new Error('invalid big num')\n})\n\nexport const PublicKeyFromString = coerce(\n instance(PublicKey),\n string(),\n value => new PublicKey(value),\n)\n\nexport class FutureEpochLayout<T> extends LayoutCls<T | null> {\n layout: Layout<T>\n discriminator: Layout<number>\n\n constructor(layout: Layout<T>, property?: string) {\n super(-1, property)\n this.layout = layout\n this.discriminator = u8()\n }\n\n encode(src: T | null, b: Buffer, offset = 0): number {\n if (src === null || src === undefined) {\n return this.discriminator.encode(0, b, offset)\n }\n // This isn't right, but we don't typically encode outside of tests\n this.discriminator.encode(2, b, offset)\n return this.layout.encode(src, b, offset + 1) + 1\n }\n\n decode(b: Buffer, offset = 0): T | null {\n const discriminator = this.discriminator.decode(b, offset)\n if (discriminator === 0) {\n return null\n } else if (discriminator === 1 || discriminator === 2) {\n return this.layout.decode(b, offset + 1)\n }\n throw new Error(`Invalid future epoch ${this.property}`)\n }\n\n getSpan(b: Buffer, offset = 0): number {\n const discriminator = this.discriminator.decode(b, offset)\n if (discriminator === 0) {\n return 1\n } else if (discriminator === 1 || discriminator === 2) {\n return this.layout.getSpan(b, offset + 1) + 1\n }\n throw new Error(`Invalid future epoch ${this.property}`)\n }\n}\n\nexport function futureEpoch<T>(layout: Layout<T>, property?: string): LayoutCls<T | null> {\n return new FutureEpochLayout<T>(layout, property)\n}\n\nexport type StakeAccountType = Infer<typeof StakeAccountType>\nexport const StakeAccountType = enums(['uninitialized', 'initialized', 'delegated', 'rewardsPool'])\n\nexport type StakeMeta = Infer<typeof StakeMeta>\nexport const StakeMeta = type({\n rentExemptReserve: BigNumFromString,\n authorized: type({\n staker: PublicKeyFromString,\n withdrawer: PublicKeyFromString,\n }),\n lockup: type({\n unixTimestamp: number(),\n epoch: number(),\n custodian: PublicKeyFromString,\n }),\n})\n\nexport type StakeAccountInfo = Infer<typeof StakeAccountInfo>\nexport const StakeAccountInfo = type({\n meta: StakeMeta,\n stake: nullable(\n type({\n delegation: type({\n voter: PublicKeyFromString,\n stake: BigNumFromString,\n activationEpoch: BigNumFromString,\n deactivationEpoch: BigNumFromString,\n warmupCooldownRate: number(),\n }),\n creditsObserved: number(),\n }),\n ),\n})\n\nexport type StakeAccount = Infer<typeof StakeAccount>\nexport const StakeAccount = type({\n type: StakeAccountType,\n info: optional(StakeAccountInfo),\n})\nexport interface Lockup {\n unixTimestamp: BN\n epoch: BN\n custodian: PublicKey\n}\n\nexport interface StakePool {\n accountType: AccountType\n manager: PublicKey\n staker: PublicKey\n stakeDepositAuthority: PublicKey\n stakeWithdrawBumpSeed: number\n validatorList: PublicKey\n reserveStake: PublicKey\n poolMint: PublicKey\n managerFeeAccount: PublicKey\n tokenProgramId: PublicKey\n totalLamports: BN\n poolTokenSupply: BN\n lastUpdateEpoch: BN\n lockup: Lockup\n epochFee: Fee\n nextEpochFee?: Fee | undefined\n preferredDepositValidatorVoteAddress?: PublicKey | undefined\n preferredWithdrawValidatorVoteAddress?: PublicKey | undefined\n stakeDepositFee: Fee\n stakeWithdrawalFee: Fee\n nextStakeWithdrawalFee?: Fee | undefined\n stakeReferralFee: number\n solDepositAuthority?: PublicKey | undefined\n solDepositFee: Fee\n solReferralFee: number\n solWithdrawAuthority?: PublicKey | undefined\n solWithdrawalFee: Fee\n nextSolWithdrawalFee?: Fee | undefined\n lastEpochPoolTokenSupply: BN\n lastEpochTotalLamports: BN\n}\n\nexport const StakePoolLayout = struct<StakePool>([\n u8('accountType'),\n publicKey('manager'),\n publicKey('staker'),\n publicKey('stakeDepositAuthority'),\n u8('stakeWithdrawBumpSeed'),\n publicKey('validatorList'),\n publicKey('reserveStake'),\n publicKey('poolMint'),\n publicKey('managerFeeAccount'),\n publicKey('tokenProgramId'),\n u64('totalLamports'),\n u64('poolTokenSupply'),\n u64('lastUpdateEpoch'),\n struct([u64('unixTimestamp'), u64('epoch'), publicKey('custodian')], 'lockup'),\n struct(feeFields, 'epochFee'),\n futureEpoch(struct(feeFields), 'nextEpochFee'),\n option(publicKey(), 'preferredDepositValidatorVoteAddress'),\n option(publicKey(), 'preferredWithdrawValidatorVoteAddress'),\n struct(feeFields, 'stakeDepositFee'),\n struct(feeFields, 'stakeWithdrawalFee'),\n futureEpoch(struct(feeFields), 'nextStakeWithdrawalFee'),\n u8('stakeReferralFee'),\n option(publicKey(), 'solDepositAuthority'),\n struct(feeFields, 'solDepositFee'),\n u8('solReferralFee'),\n option(publicKey(), 'solWithdrawAuthority'),\n struct(feeFields, 'solWithdrawalFee'),\n futureEpoch(struct(feeFields), 'nextSolWithdrawalFee'),\n u64('lastEpochPoolTokenSupply'),\n u64('lastEpochTotalLamports'),\n])\n\nexport enum ValidatorStakeInfoStatus {\n Active,\n DeactivatingTransient,\n ReadyForRemoval,\n}\n\nexport interface ValidatorStakeInfo {\n status: ValidatorStakeInfoStatus\n voteAccountAddress: PublicKey\n activeStakeLamports: BN\n transientStakeLamports: BN\n transientSeedSuffixStart: BN\n transientSeedSuffixEnd: BN\n lastUpdateEpoch: BN\n}\n\nexport const ValidatorStakeInfoLayout = struct<ValidatorStakeInfo>([\n /// Amount of active stake delegated to this validator\n /// Note that if `last_update_epoch` does not match the current epoch then\n /// this field may not be accurate\n u64('activeStakeLamports'),\n /// Amount of transient stake delegated to this validator\n /// Note that if `last_update_epoch` does not match the current epoch then\n /// this field may not be accurate\n u64('transientStakeLamports'),\n /// Last epoch the active and transient stake lamports fields were updated\n u64('lastUpdateEpoch'),\n /// Start of the validator transient account seed suffixes\n u64('transientSeedSuffixStart'),\n /// End of the validator transient account seed suffixes\n u64('transientSeedSuffixEnd'),\n /// Status of the validator stake account\n u8('status'),\n /// Validator vote account address\n publicKey('voteAccountAddress'),\n])\n\nexport interface ValidatorList {\n /// Account type, must be ValidatorList currently\n accountType: number\n /// Maximum allowable number of validators\n maxValidators: number\n /// List of stake info for each validator in the pool\n validators: ValidatorStakeInfo[]\n}\n\nexport const ValidatorListLayout = struct<ValidatorList>([\n u8('accountType'),\n u32('maxValidators'),\n vec(ValidatorStakeInfoLayout, 'validators'),\n])\n","import {\n Connection,\n Keypair,\n PublicKey,\n StakeProgram,\n SystemProgram,\n TransactionInstruction,\n} from '@solana/web3.js'\nimport BN from 'bn.js'\nimport { MINIMUM_ACTIVE_STAKE } from '../constants'\n\nimport { getStakePoolProgramId, WithdrawAccount } from '../index'\nimport {\n Fee,\n StakePool,\n ValidatorList,\n ValidatorListLayout,\n ValidatorStakeInfoStatus,\n} from '../layouts'\nimport { lamportsToSol } from './math'\nimport { findStakeProgramAddress, findTransientStakeProgramAddress } from './program-address'\n\nexport async function getValidatorListAccount(connection: Connection, pubkey: PublicKey) {\n const account = await connection.getAccountInfo(pubkey)\n if (!account) {\n throw new Error('Invalid validator list account')\n }\n\n return {\n pubkey,\n account: {\n data: ValidatorListLayout.decode(account?.data) as ValidatorList,\n executable: account.executable,\n lamports: account.lamports,\n owner: account.owner,\n },\n }\n}\n\nexport interface ValidatorAccount {\n type: 'preferred' | 'active' | 'transient' | 'reserve'\n voteAddress?: PublicKey | undefined\n stakeAddress: PublicKey\n lamports: BN\n}\n\nexport async function prepareWithdrawAccounts(\n connection: Connection,\n stakePool: StakePool,\n stakePoolAddress: PublicKey,\n amount: BN,\n compareFn?: (a: ValidatorAccount, b: ValidatorAccount) => number,\n skipFee?: boolean,\n): Promise<WithdrawAccount[]> {\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const validatorListAcc = await connection.getAccountInfo(stakePool.validatorList)\n const validatorList = ValidatorListLayout.decode(validatorListAcc?.data) as ValidatorList\n\n if (!validatorList?.validators || validatorList?.validators.length == 0) {\n throw new Error('No accounts found')\n }\n\n const minBalanceForRentExemption = await connection.getMinimumBalanceForRentExemption(\n StakeProgram.space,\n )\n const minBalance = new BN(minBalanceForRentExemption + MINIMUM_ACTIVE_STAKE)\n\n let accounts = [] as Array<{\n type: 'preferred' | 'active' | 'transient' | 'reserve'\n voteAddress?: PublicKey | undefined\n stakeAddress: PublicKey\n lamports: BN\n }>\n\n // Prepare accounts\n for (const validator of validatorList.validators) {\n if (validator.status !== ValidatorStakeInfoStatus.Active) {\n continue\n }\n\n const stakeAccountAddress = await findStakeProgramAddress(\n stakePoolProgramId,\n validator.voteAccountAddress,\n stakePoolAddress,\n )\n\n if (!validator.activeStakeLamports.isZero()) {\n const isPreferred = stakePool?.preferredWithdrawValidatorVoteAddress?.equals(\n validator.voteAccountAddress,\n )\n accounts.push({\n type: isPreferred ? 'preferred' : 'active',\n voteAddress: validator.voteAccountAddress,\n stakeAddress: stakeAccountAddress,\n lamports: validator.activeStakeLamports,\n })\n }\n\n const transientStakeLamports = validator.transientStakeLamports.sub(minBalance)\n if (transientStakeLamports.gt(new BN(0))) {\n const transientStakeAccountAddress = await findTransientStakeProgramAddress(\n stakePoolProgramId,\n validator.voteAccountAddress,\n stakePoolAddress,\n validator.transientSeedSuffixStart,\n )\n accounts.push({\n type: 'transient',\n voteAddress: validator.voteAccountAddress,\n stakeAddress: transientStakeAccountAddress,\n lamports: transientStakeLamports,\n })\n }\n }\n\n // Sort from highest to lowest balance\n accounts = accounts.sort(compareFn || ((a, b) => b.lamports.sub(a.lamports).toNumber()))\n\n const reserveStake = await connection.getAccountInfo(stakePool.reserveStake)\n const reserveStakeBalance = new BN((reserveStake?.lamports ?? 0) - minBalanceForRentExemption)\n if (reserveStakeBalance.gt(new BN(0))) {\n accounts.push({\n type: 'reserve',\n stakeAddress: stakePool.reserveStake,\n lamports: reserveStakeBalance,\n })\n }\n\n // Prepare the list of accounts to withdraw from\n const withdrawFrom: WithdrawAccount[] = []\n let remainingAmount = new BN(amount)\n\n const fee = stakePool.stakeWithdrawalFee\n const inverseFee: Fee = {\n numerator: fee.denominator.sub(fee.numerator),\n denominator: fee.denominator,\n }\n\n for (const type of ['preferred', 'active', 'transient', 'reserve']) {\n const filteredAccounts = accounts.filter(a => a.type == type)\n\n for (const { stakeAddress, voteAddress, lamports } of filteredAccounts) {\n if (lamports.lte(minBalance) && type == 'transient') {\n continue\n }\n\n let availableForWithdrawal = calcPoolTokensForDeposit(stakePool, lamports)\n\n if (!skipFee && !inverseFee.numerator.isZero()) {\n availableForWithdrawal = availableForWithdrawal\n .mul(inverseFee.denominator)\n .div(inverseFee.numerator)\n }\n\n const poolAmount = BN.min(availableForWithdrawal, remainingAmount)\n if (poolAmount.lte(new BN(0))) {\n continue\n }\n\n // Those accounts will be withdrawn completely with `claim` instruction\n withdrawFrom.push({ stakeAddress, voteAddress, poolAmount })\n remainingAmount = remainingAmount.sub(poolAmount)\n\n if (remainingAmount.isZero()) {\n break\n }\n }\n\n if (remainingAmount.isZero()) {\n break\n }\n }\n\n // Not enough stake to withdraw the specified amount\n if (remainingAmount.gt(new BN(0))) {\n throw new Error(\n `No stake accounts found in this pool with enough balance to withdraw ${lamportsToSol(\n amount,\n )} pool tokens.`,\n )\n }\n\n return withdrawFrom\n}\n\n/**\n * Calculate the pool tokens that should be minted for a deposit of `stakeLamports`\n */\nexport function calcPoolTokensForDeposit(stakePool: StakePool, stakeLamports: BN): BN {\n if (stakePool.poolTokenSupply.isZero() || stakePool.totalLamports.isZero()) {\n return stakeLamports\n }\n const numerator = stakeLamports.mul(stakePool.poolTokenSupply)\n return numerator.div(stakePool.totalLamports)\n}\n\n/**\n * Calculate lamports amount on withdrawal\n */\nexport function calcLamportsWithdrawAmount(stakePool: StakePool, poolTokens: BN): BN {\n const numerator = poolTokens.mul(stakePool.totalLamports)\n const denominator = stakePool.poolTokenSupply\n if (numerator.lt(denominator)) {\n return new BN(0)\n }\n return numerator.div(denominator)\n}\n\nexport function newStakeAccount(\n feePayer: PublicKey,\n instructions: TransactionInstruction[],\n lamports: number,\n): Keypair {\n // Account for tokens not specified, creating one\n const stakeReceiverKeypair = Keypair.generate()\n console.log(`Creating account to receive stake ${stakeReceiverKeypair.publicKey}`)\n\n instructions.push(\n // Creating new account\n SystemProgram.createAccount({\n fromPubkey: feePayer,\n newAccountPubkey: stakeReceiverKeypair.publicKey,\n lamports,\n space: StakeProgram.space,\n programId: StakeProgram.programId,\n }),\n )\n\n return stakeReceiverKeypair\n}\n","export * from './instruction'\nexport * from './math'\nexport * from './program-address'\nexport * from './stake'\n\nexport function arrayChunk(array: any[], size: number): any[] {\n const result = []\n for (let i = 0; i < array.length; i += size) {\n result.push(array.slice(i, i + size))\n }\n return result\n}\n","import * as BufferLayout from '@solana/buffer-layout'\nimport { TOKEN_PROGRAM_ID } from '@solana/spl-token'\nimport {\n PublicKey,\n STAKE_CONFIG_ID,\n StakeProgram,\n SystemProgram,\n SYSVAR_CLOCK_PUBKEY,\n SYSVAR_RENT_PUBKEY,\n SYSVAR_STAKE_HISTORY_PUBKEY,\n TransactionInstruction,\n} from '@solana/web3.js'\nimport {\n DEVNET_STAKE_POOL_PROGRAM_ID,\n METADATA_MAX_NAME_LENGTH,\n METADATA_MAX_SYMBOL_LENGTH,\n METADATA_MAX_URI_LENGTH,\n METADATA_PROGRAM_ID,\n STAKE_POOL_PROGRAM_ID,\n} from './constants'\nimport { decodeData, encodeData, InstructionType } from './utils'\n\n/**\n * An enumeration of valid StakePoolInstructionType's\n */\nexport type StakePoolInstructionType\n = | 'IncreaseValidatorStake'\n | 'DecreaseValidatorStake'\n | 'UpdateValidatorListBalance'\n | 'UpdateStakePoolBalance'\n | 'CleanupRemovedValidatorEntries'\n | 'DepositStake'\n | 'DepositSol'\n | 'WithdrawStake'\n | 'WithdrawSol'\n | 'IncreaseAdditionalValidatorStake'\n | 'DecreaseAdditionalValidatorStake'\n | 'DecreaseValidatorStakeWithReserve'\n | 'Redelegate'\n | 'AddValidatorToPool'\n | 'RemoveValidatorFromPool'\n | 'DepositWsolWithSession'\n | 'WithdrawWsolWithSession'\n\n// 'UpdateTokenMetadata' and 'CreateTokenMetadata' have dynamic layouts\n\nconst MOVE_STAKE_LAYOUT = BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamports'),\n BufferLayout.ns64('transientStakeSeed'),\n])\n\nconst UPDATE_VALIDATOR_LIST_BALANCE_LAYOUT = BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.u32('startIndex'),\n BufferLayout.u8('noMerge'),\n])\n\nexport function tokenMetadataLayout(\n instruction: number,\n nameLength: number,\n symbolLength: number,\n uriLength: number,\n) {\n if (nameLength > METADATA_MAX_NAME_LENGTH) {\n // eslint-disable-next-line no-throw-literal\n throw 'maximum token name length is 32 characters'\n }\n\n if (symbolLength > METADATA_MAX_SYMBOL_LENGTH) {\n // eslint-disable-next-line no-throw-literal\n throw 'maximum token symbol length is 10 characters'\n }\n\n if (uriLength > METADATA_MAX_URI_LENGTH) {\n // eslint-disable-next-line no-throw-literal\n throw 'maximum token uri length is 200 characters'\n }\n\n return {\n index: instruction,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.u32('nameLen'),\n BufferLayout.blob(nameLength, 'name'),\n BufferLayout.u32('symbolLen'),\n BufferLayout.blob(symbolLength, 'symbol'),\n BufferLayout.u32('uriLen'),\n BufferLayout.blob(uriLength, 'uri'),\n ]),\n }\n}\n\n/**\n * An enumeration of valid stake InstructionType's\n * @internal\n */\nexport const STAKE_POOL_INSTRUCTION_LAYOUTS: {\n [type in StakePoolInstructionType]: InstructionType;\n} = Object.freeze({\n AddValidatorToPool: {\n index: 1,\n layout: BufferLayout.struct<any>([BufferLayout.u8('instruction'), BufferLayout.u32('seed')]),\n },\n RemoveValidatorFromPool: {\n index: 2,\n layout: BufferLayout.struct<any>([BufferLayout.u8('instruction')]),\n },\n DecreaseValidatorStake: {\n index: 3,\n layout: MOVE_STAKE_LAYOUT,\n },\n IncreaseValidatorStake: {\n index: 4,\n layout: MOVE_STAKE_LAYOUT,\n },\n UpdateValidatorListBalance: {\n index: 6,\n layout: UPDATE_VALIDATOR_LIST_BALANCE_LAYOUT,\n },\n UpdateStakePoolBalance: {\n index: 7,\n layout: BufferLayout.struct<any>([BufferLayout.u8('instruction')]),\n },\n CleanupRemovedValidatorEntries: {\n index: 8,\n layout: BufferLayout.struct<any>([BufferLayout.u8('instruction')]),\n },\n DepositStake: {\n index: 9,\n layout: BufferLayout.struct<any>([BufferLayout.u8('instruction')]),\n },\n /// Withdraw the token from the pool at the current ratio.\n WithdrawStake: {\n index: 10,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('poolTokens'),\n ]),\n },\n /// Deposit SOL directly into the pool's reserve account. The output is a \"pool\" token\n /// representing ownership into the pool. Inputs are converted to the current ratio.\n DepositSol: {\n index: 14,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamports'),\n ]),\n },\n /// Withdraw SOL directly from the pool's reserve account. Fails if the\n /// reserve does not have enough SOL.\n WithdrawSol: {\n index: 16,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('poolTokens'),\n ]),\n },\n IncreaseAdditionalValidatorStake: {\n index: 19,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamports'),\n BufferLayout.ns64('transientStakeSeed'),\n BufferLayout.ns64('ephemeralStakeSeed'),\n ]),\n },\n DecreaseAdditionalValidatorStake: {\n index: 20,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamports'),\n BufferLayout.ns64('transientStakeSeed'),\n BufferLayout.ns64('ephemeralStakeSeed'),\n ]),\n },\n DecreaseValidatorStakeWithReserve: {\n index: 21,\n layout: MOVE_STAKE_LAYOUT,\n },\n Redelegate: {\n index: 22,\n layout: BufferLayout.struct<any>([BufferLayout.u8('instruction')]),\n },\n DepositStakeWithSlippage: {\n index: 23,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamports'),\n ]),\n },\n WithdrawStakeWithSlippage: {\n index: 24,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamports'),\n ]),\n },\n DepositSolWithSlippage: {\n index: 25,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamports'),\n ]),\n },\n WithdrawSolWithSlippage: {\n index: 26,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamports'),\n ]),\n },\n DepositWsolWithSession: {\n index: 27,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamportsIn'),\n BufferLayout.ns64('minimumPoolTokensOut'),\n ]),\n },\n WithdrawWsolWithSession: {\n index: 28,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('poolTokensIn'),\n BufferLayout.ns64('minimumLamportsOut'),\n ]),\n },\n})\n\n/**\n * Cleans up validator stake account entries marked as `ReadyForRemoval`\n */\nexport type CleanupRemovedValidatorEntriesParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n validatorList: PublicKey\n}\n\n/**\n * Updates balances of validator and transient stake accounts in the pool.\n */\nexport type UpdateValidatorListBalanceParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n withdrawAuthority: PublicKey\n validatorList: PublicKey\n reserveStake: PublicKey\n validatorAndTransientStakePairs: PublicKey[]\n startIndex: number\n noMerge: boolean\n}\n\n/**\n * Updates total pool balance based on balances in the reserve and validator list.\n */\nexport type UpdateStakePoolBalanceParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n withdrawAuthority: PublicKey\n validatorList: PublicKey\n reserveStake: PublicKey\n managerFeeAccount: PublicKey\n poolMint: PublicKey\n}\n\n/**\n * (Staker only) Decrease active stake on a validator, eventually moving it to the reserve\n */\nexport type DecreaseValidatorStakeParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n staker: PublicKey\n withdrawAuthority: PublicKey\n validatorList: PublicKey\n validatorStake: PublicKey\n transientStake: PublicKey\n // Amount of lamports to split into the transient stake account\n lamports: number\n // Seed to used to create the transient stake account\n transientStakeSeed: number\n}\n\nexport interface DecreaseValidatorStakeWithReserveParams extends DecreaseValidatorStakeParams {\n reserveStake: PublicKey\n}\n\nexport interface DecreaseAdditionalValidatorStakeParams extends DecreaseValidatorStakeParams {\n reserveStake: PublicKey\n ephemeralStake: PublicKey\n ephemeralStakeSeed: number\n}\n\n/**\n * (Staker only) Increase stake on a validator from the reserve account.\n */\nexport type IncreaseValidatorStakeParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n staker: PublicKey\n withdrawAuthority: PublicKey\n validatorList: PublicKey\n reserveStake: PublicKey\n transientStake: PublicKey\n validatorStake: PublicKey\n validatorVote: PublicKey\n // Amount of lamports to split into the transient stake account\n lamports: number\n // Seed to used to create the transient stake account\n transientStakeSeed: number\n}\n\nexport interface IncreaseAdditionalValidatorStakeParams extends IncreaseValidatorStakeParams {\n ephemeralStake: PublicKey\n ephemeralStakeSeed: number\n}\n\n/**\n * Deposits a stake account into the pool in exchange for pool tokens\n */\nexport type DepositStakeParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n validatorList: PublicKey\n depositAuthority: PublicKey\n withdrawAuthority: PublicKey\n depositStake: PublicKey\n validatorStake: PublicKey\n reserveStake: PublicKey\n destinationPoolAccount: PublicKey\n managerFeeAccount: PublicKey\n referralPoolAccount: PublicKey\n poolMint: PublicKey\n}\n\n/**\n * Withdraws a stake account from the pool in exchange for pool tokens\n */\nexport type WithdrawStakeParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n validatorList: PublicKey\n withdrawAuthority: PublicKey\n validatorStake: PublicKey\n destinationStake: PublicKey\n destinationStakeAuthority: PublicKey\n sourceTransferAuthority: PublicKey\n sourcePoolAccount: PublicKey\n managerFeeAccount: PublicKey\n poolMint: PublicKey\n poolTokens: number\n}\n\n/**\n * Withdraw sol instruction params\n */\nexport type WithdrawSolParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n sourcePoolAccount: PublicKey\n withdrawAuthority: PublicKey\n reserveStake: PublicKey\n destinationSystemAccount: PublicKey\n sourceTransferAuthority: PublicKey\n solWithdrawAuthority?: PublicKey | undefined\n managerFeeAccount: PublicKey\n poolMint: PublicKey\n poolTokens: number\n}\n\n/**\n * Withdraw WSOL with session instruction params\n */\nexport type WithdrawWsolWithSessionParams = {\n programId: PublicKey\n stakePool: PublicKey\n withdrawAuthority: PublicKey\n userTransferAuthority: PublicKey\n poolTokensFrom: PublicKey\n reserveStake: PublicKey\n userWsolAccount: PublicKey\n managerFeeAccount: PublicKey\n poolMint: PublicKey\n tokenProgramId: PublicKey\n solWithdrawAuthority?: PublicKey\n wsolMint: PublicKey\n programSigner: PublicKey\n poolTokensIn: number\n minimumLamportsOut: number\n}\n\n/**\n * Deposit SOL directly into the pool's reserve account. The output is a \"pool\" token\n * representing ownership into the pool. Inputs are converted to the current ratio.\n */\nexport type DepositSolParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n depositAuthority?: PublicKey | undefined\n withdrawAuthority: PublicKey\n reserveStake: PublicKey\n fundingAccount: PublicKey\n destinationPoolAccount: PublicKey\n managerFeeAccount: PublicKey\n referralPoolAccount: PublicKey\n poolMint: PublicKey\n lamports: number\n}\n\nexport type CreateTokenMetadataParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n manager: PublicKey\n tokenMetadata: PublicKey\n withdrawAuthority: PublicKey\n poolMint: PublicKey\n payer: PublicKey\n name: string\n symbol: string\n uri: string\n}\n\nexport type UpdateTokenMetadataParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n manager: PublicKey\n tokenMetadata: PublicKey\n withdrawAuthority: PublicKey\n name: string\n symbol: string\n uri: string\n}\n\nexport type AddValidatorToPoolParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n staker: PublicKey\n reserveStake: PublicKey\n withdrawAuthority: PublicKey\n validatorList: PublicKey\n validatorStake: PublicKey\n validatorVote: PublicKey\n seed?: number\n}\n\nexport type RemoveValidatorFromPoolParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n staker: PublicKey\n withdrawAuthority: PublicKey\n validatorList: PublicKey\n validatorStake: PublicKey\n transientStake: PublicKey\n}\n\n/**\n * Stake Pool Instruction class\n */\nexport class StakePoolInstruction {\n /**\n * Creates instruction to add a validator into the stake pool.\n */\n static addValidatorToPool(params: AddValidatorToPoolParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n staker,\n reserveStake,\n withdrawAuthority,\n validatorList,\n validatorStake,\n validatorVote,\n seed,\n } = params\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.AddValidatorToPool\n const data = encodeData(type, { seed: seed ?? 0 })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: true },\n { pubkey: staker, isSigner: true, isWritable: false },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: validatorStake, isSigner: false, isWritable: true },\n { pubkey: validatorVote, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: STAKE_CONFIG_ID, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates instruction to remove a validator from the stake pool.\n */\n static removeValidatorFromPool(params: RemoveValidatorFromPoolParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n staker,\n withdrawAuthority,\n validatorList,\n validatorStake,\n transientStake,\n } = params\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.RemoveValidatorFromPool\n const data = encodeData(type)\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: true },\n { pubkey: staker, isSigner: true, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: validatorStake, isSigner: false, isWritable: true },\n { pubkey: transientStake, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates instruction to update a set of validators in the stake pool.\n */\n static updateValidatorListBalance(\n params: UpdateValidatorListBalanceParams,\n ): TransactionInstruction {\n const {\n programId,\n stakePool,\n withdrawAuthority,\n validatorList,\n reserveStake,\n startIndex,\n noMerge,\n validatorAndTransientStakePairs,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.UpdateValidatorListBalance\n const data = encodeData(type, { startIndex, noMerge: noMerge ? 1 : 0 })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ...validatorAndTransientStakePairs.map(pubkey => ({\n pubkey,\n isSigner: false,\n isWritable: true,\n })),\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates instruction to update the overall stake pool balance.\n */\n static updateStakePoolBalance(params: UpdateStakePoolBalanceParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n withdrawAuthority,\n validatorList,\n reserveStake,\n managerFeeAccount,\n poolMint,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.UpdateStakePoolBalance\n const data = encodeData(type)\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: true },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: reserveStake, isSigner: false, isWritable: false },\n { pubkey: managerFeeAccount, isSigner: false, isWritable: true },\n { pubkey: poolMint, isSigner: false, isWritable: true },\n { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates instruction to cleanup removed validator entries.\n */\n static cleanupRemovedValidatorEntries(\n params: CleanupRemovedValidatorEntriesParams,\n ): TransactionInstruction {\n const { programId, stakePool, validatorList } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.CleanupRemovedValidatorEntries\n const data = encodeData(type)\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates `IncreaseValidatorStake` instruction (rebalance from reserve account to\n * transient account)\n */\n static increaseValidatorStake(params: IncreaseValidatorStakeParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n staker,\n withdrawAuthority,\n validatorList,\n reserveStake,\n transientStake,\n validatorStake,\n validatorVote,\n lamports,\n transientStakeSeed,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.IncreaseValidatorStake\n const data = encodeData(type, { lamports, transientStakeSeed })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: staker, isSigner: true, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: transientStake, isSigner: false, isWritable: true },\n { pubkey: validatorStake, isSigner: false, isWritable: false },\n { pubkey: validatorVote, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: STAKE_CONFIG_ID, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates `IncreaseAdditionalValidatorStake` instruction (rebalance from reserve account to\n * transient account)\n */\n static increaseAdditionalValidatorStake(\n params: IncreaseAdditionalValidatorStakeParams,\n ): TransactionInstruction {\n const {\n programId,\n stakePool,\n staker,\n withdrawAuthority,\n validatorList,\n reserveStake,\n transientStake,\n validatorStake,\n validatorVote,\n lamports,\n transientStakeSeed,\n ephemeralStake,\n ephemeralStakeSeed,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.IncreaseAdditionalValidatorStake\n const data = encodeData(type, { lamports, transientStakeSeed, ephemeralStakeSeed })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: staker, isSigner: true, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: ephemeralStake, isSigner: false, isWritable: true },\n { pubkey: transientStake, isSigner: false, isWritable: true },\n { pubkey: validatorStake, isSigner: false, isWritable: false },\n { pubkey: validatorVote, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: STAKE_CONFIG_ID, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates `DecreaseValidatorStake` instruction (rebalance from validator account to\n * transient account)\n */\n static decreaseValidatorStake(params: DecreaseValidatorStakeParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n staker,\n withdrawAuthority,\n validatorList,\n validatorStake,\n transientStake,\n lamports,\n transientStakeSeed,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DecreaseValidatorStake\n const data = encodeData(type, { lamports, transientStakeSeed })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: staker, isSigner: true, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: validatorStake, isSigner: false, isWritable: true },\n { pubkey: transientStake, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates `DecreaseValidatorStakeWithReserve` instruction (rebalance from\n * validator account to transient account)\n */\n static decreaseValidatorStakeWithReserve(\n params: DecreaseValidatorStakeWithReserveParams,\n ): TransactionInstruction {\n const {\n programId,\n stakePool,\n staker,\n withdrawAuthority,\n validatorList,\n reserveStake,\n validatorStake,\n transientStake,\n lamports,\n transientStakeSeed,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DecreaseValidatorStakeWithReserve\n const data = encodeData(type, { lamports, transientStakeSeed })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: staker, isSigner: true, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: validatorStake, isSigner: false, isWritable: true },\n { pubkey: transientStake, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates `DecreaseAdditionalValidatorStake` instruction (rebalance from\n * validator account to transient account)\n */\n static decreaseAdditionalValidatorStake(\n params: DecreaseAdditionalValidatorStakeParams,\n ): TransactionInstruction {\n const {\n programId,\n stakePool,\n staker,\n withdrawAuthority,\n validatorList,\n reserveStake,\n validatorStake,\n transientStake,\n lamports,\n transientStakeSeed,\n ephemeralStakeSeed,\n ephemeralStake,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DecreaseAdditionalValidatorStake\n const data = encodeData(type, { lamports, transientStakeSeed, ephemeralStakeSeed })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: staker, isSigner: true, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: validatorStake, isSigner: false, isWritable: true },\n { pubkey: ephemeralStake, isSigner: false, isWritable: true },\n { pubkey: transientStake, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates a transaction instruction to deposit a stake account into a stake pool.\n */\n static depositStake(params: DepositStakeParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n validatorList,\n depositAuthority,\n withdrawAuthority,\n depositStake,\n validatorStake,\n reserveStake,\n destinationPoolAccount,\n managerFeeAccount,\n referralPoolAccount,\n poolMint,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DepositStake\n const data = encodeData(type)\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: true },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: depositAuthority, isSigner: false, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: depositStake, isSigner: false, isWritable: true },\n { pubkey: validatorStake, isSigner: false, isWritable: true },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: destinationPoolAccount, isSigner: false, isWritable: true },\n { pubkey: managerFeeAccount, isSigner: false, isWritable: true },\n { pubkey: referralPoolAccount, isSigner: false, isWritable: true },\n { pubkey: poolMint, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates a transaction instruction to deposit SOL into a stake pool.\n */\n static depositSol(params: DepositSolParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n withdrawAuthority,\n depositAuthority,\n reserveStake,\n fundingAccount,\n destinationPoolAccount,\n managerFeeAccount,\n referralPoolAccount,\n poolMint,\n lamports,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DepositSol\n const data = encodeData(type, { lamports })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: true },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: fundingAccount, isSigner: true, isWritable: true },\n { pubkey: destinationPoolAccount, isSigner: false, isWritable: true },\n { pubkey: managerFeeAccount, isSigner: false, isWritable: true },\n { pubkey: referralPoolAccount, isSigner: false, isWritable: true },\n { pubkey: poolMint, isSigner: false, isWritable: true },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },\n ]\n\n if (depositAuthority) {\n keys.push({\n pubkey: depositAuthority,\n isSigner: true,\n isWritable: false,\n })\n }\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates a transaction instruction to deposit WSOL into a stake pool.\n */\n static depositWsolWithSession(params: Omit<DepositSolParams, 'lamports'> & {\n wsolMint: PublicKey\n wsolTokenAccount: PublicKey\n wsolTransientAccount: PublicKey\n programSigner: PublicKey\n tokenProgramId: PublicKey\n programId: PublicKey\n payer?: PublicKey\n userWallet: PublicKey\n lamportsIn: number\n minimumPoolTokensOut: number\n }): TransactionInstruction {\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DepositWsolWithSession\n const data = encodeData(type, {\n lamportsIn: params.lamportsIn,\n minimumPoolTokensOut: params.minimumPoolTokensOut,\n })\n\n const keys = [\n { pubkey: params.stakePool, isSigner: false, isWritable: true },\n { pubkey: params.withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: params.reserveStake, isSigner: false, isWritable: true },\n { pubkey: params.fundingAccount, isSigner: true, isWritable: true },\n { pubkey: params.destinationPoolAccount, isSigner: false, isWritable: true },\n { pubkey: params.managerFeeAccount, isSigner: false, isWritable: true },\n { pubkey: params.referralPoolAccount, isSigner: false, isWritable: true },\n { pubkey: params.poolMint, isSigner: false, isWritable: true },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: params.tokenProgramId, isSigner: false, isWritable: false },\n\n // wsol specific accounts\n { pubkey: params.wsolMint, isSigner: false, isWritable: false },\n { pubkey: params.wsolTokenAccount, isSigner: false, isWritable: true },\n { pubkey: params.wsolTransientAccount, isSigner: false, isWritable: true },\n { pubkey: params.programSigner, isSigner: false, isWritable: true },\n { pubkey: params.payer ?? params.fundingAccount, isSigner: true, isWritable: true },\n { pubkey: params.userWallet, isSigner: false, isWritable: false },\n ]\n\n if (params.depositAuthority) {\n keys.push({\n pubkey: params.depositAuthority,\n isSigner: true,\n isWritable: false,\n })\n }\n\n return new TransactionInstruction({\n programId: params.programId,\n keys,\n data,\n })\n }\n\n /**\n * Creates a transaction instruction to withdraw active stake from a stake pool.\n */\n static withdrawStake(params: WithdrawStakeParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n validatorList,\n withdrawAuthority,\n validatorStake,\n destinationStake,\n destinationStakeAuthority,\n sourceTransferAuthority,\n sourcePoolAccount,\n managerFeeAccount,\n poolMint,\n poolTokens,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawStake\n const data = encodeData(type, { poolTokens })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: true },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorStake, isSigner: false, isWritable: true },\n { pubkey: destinationStake, isSigner: false, isWritable: true },\n { pubkey: destinationStakeAuthority, isSigner: false, isWritable: false },\n { pubkey: sourceTransferAuthority, isSigner: true, isWritable: false },\n { pubkey: sourcePoolAccount, isSigner: false, isWritable: true },\n { pubkey: managerFeeAccount, isSigner: false, isWritable: true },\n { pubkey: poolMint, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates a transaction instruction to withdraw SOL from a stake pool.\n */\n static withdrawSol(params: WithdrawSolParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n withdrawAuthority,\n sourceTransferAuthority,\n sourcePoolAccount,\n reserveStake,\n destinationSystemAccount,\n managerFeeAccount,\n solWithdrawAuthority,\n poolMint,\n poolTokens,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawSol\n const data = encodeData(type, { poolTokens })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: true },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: sourceTransferAuthority, isSigner: true, isWritable: false },\n { pubkey: sourcePoolAccount, isSigner: false, isWritable: true },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: destinationSystemAccount, isSigner: false, isWritable: true },\n { pubkey: managerFeeAccount, isSigner: false, isWritable: true },\n { pubkey: poolMint, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },\n ]\n\n if (solWithdrawAuthority) {\n keys.push({\n pubkey: solWithdrawAuthority,\n isSigner: true,\n isWritable: false,\n })\n }\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates a transaction instruction to withdraw WSOL from a stake pool using a session.\n */\n static withdrawWsolWithSession(\n params: WithdrawWsolWithSessionParams,\n ): TransactionInstruction {\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawWsolWithSession\n const data = encodeData(type, {\n poolTokensIn: params.poolTokensIn,\n minimumLamportsOut: params.minimumLamportsOut,\n })\n\n const keys = [\n { pubkey: params.stakePool, isSigner: false, isWritable: true },\n { pubkey: params.withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: params.userTransferAuthority, isSigner: true, isWritable: true },\n { pubkey: params.poolTokensFrom, isSigner: false, isWritable: true },\n { pubkey: params.reserveStake, isSigner: false, isWritable: true },\n { pubkey: params.userWsolAccount, isSigner: false, isWritable: true },\n { pubkey: params.managerFeeAccount, isSigner: false, isWritable: true },\n { pubkey: params.poolMint, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n { pubkey: params.tokenProgramId, isSigner: false, isWritable: false },\n\n { pubkey: params.wsolMint, isSigner: false, isWritable: false },\n { pubkey: params.programSigner, isSigner: false, isWritable: true },\n ]\n\n if (params.solWithdrawAuthority) {\n keys.push({\n pubkey: params.solWithdrawAuthority,\n isSigner: true,\n isWritable: false,\n })\n }\n\n return new TransactionInstruction({\n programId: params.programId,\n keys,\n data,\n })\n }\n\n /**\n * Creates an instruction to create metadata\n * using the mpl token metadata program for the pool token\n */\n static createTokenMetadata(params: CreateTokenMetadataParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n withdrawAuthority,\n tokenMetadata,\n manager,\n payer,\n poolMint,\n name,\n symbol,\n uri,\n } = params\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: manager, isSigner: true, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: poolMint, isSigner: false, isWritable: false },\n { pubkey: payer, isSigner: true, isWritable: true },\n { pubkey: tokenMetadata, isSigner: false, isWritable: true },\n { pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n ]\n\n const type = tokenMetadataLayout(17, name.length, symbol.length, uri.length)\n const data = encodeData(type, {\n nameLen: name.length,\n name: Buffer.from(name),\n symbolLen: symbol.length,\n symbol: Buffer.from(symbol),\n uriLen: uri.length,\n uri: Buffer.from(uri),\n })\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates an instruction to update metadata\n * in the mpl token metadata program account for the pool token\n */\n static updateTokenMetadata(params: UpdateTokenMetadataParams): TransactionInstruction {\n const { programId, stakePool, withdrawAuthority, tokenMetadata, manager, name, symbol, uri }\n = params\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: manager, isSigner: true, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: tokenMetadata, isSigner: false, isWritable: true },\n { pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false },\n ]\n\n const type = tokenMetadataLayout(18, name.length, symbol.length, uri.length)\n const data = encodeData(type, {\n nameLen: name.length,\n name: Buffer.from(name),\n symbolLen: symbol.length,\n symbol: Buffer.from(symbol),\n uriLen: uri.length,\n uri: Buffer.from(uri),\n })\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Decode a deposit stake pool instruction and retrieve the instruction params.\n */\n static decodeDepositStake(instruction: TransactionInstruction): DepositStakeParams {\n this.checkProgramId(instruction.programId)\n this.checkKeyLength(instruction.keys, 11)\n\n decodeData(STAKE_POOL_INSTRUCTION_LAYOUTS.DepositStake, instruction.data)\n\n return {\n programId: instruction.programId,\n stakePool: instruction.keys[0].pubkey,\n validatorList: instruction.keys[1].pubkey,\n depositAuthority: instruction.keys[2].pubkey,\n withdrawAuthority: instruction.keys[3].pubkey,\n depositStake: instruction.keys[4].pubkey,\n validatorStake: instruction.keys[5].pubkey,\n reserveStake: instruction.keys[6].pubkey,\n destinationPoolAccount: instruction.keys[7].pubkey,\n managerFeeAccount: instruction.keys[8].pubkey,\n referralPoolAccount: instruction.keys[9].pubkey,\n poolMint: instruction.keys[10].pubkey,\n }\n }\n\n /**\n * Decode a deposit sol instruction and retrieve the instruction params.\n */\n static decodeDepositSol(instruction: TransactionInstruction): DepositSolParams {\n this.checkProgramId(instruction.programId)\n this.checkKeyLength(instruction.keys, 9)\n\n const { amount } = decodeData(STAKE_POOL_INSTRUCTION_LAYOUTS.DepositSol, instruction.data)\n\n return {\n programId: instruction.programId,\n stakePool: instruction.keys[0].pubkey,\n depositAuthority: instruction.keys[1].pubkey,\n withdrawAuthority: instruction.keys[2].pubkey,\n reserveStake: instruction.keys[3].pubkey,\n fundingAccount: instruction.keys[4].pubkey,\n destinationPoolAccount: instruction.keys[5].pubkey,\n managerFeeAccount: instruction.keys[6].pubkey,\n referralPoolAccount: instruction.keys[7].pubkey,\n poolMint: instruction.keys[8].pubkey,\n lamports: amount,\n }\n }\n\n /**\n * @internal\n */\n private static checkProgramId(programId: PublicKey) {\n if (\n !programId.equals(STAKE_POOL_PROGRAM_ID)\n && !programId.equals(DEVNET_STAKE_POOL_PROGRAM_ID)\n ) {\n throw new Error('Invalid instruction; programId is not the stake pool program')\n }\n }\n\n /**\n * @internal\n */\n private static checkKeyLength(keys: Array<any>, expectedLength: number) {\n if (keys.length < expectedLength) {\n throw new Error(\n `Invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`,\n )\n }\n }\n}\n","import {\n createApproveInstruction,\n createAssociatedTokenAccountIdempotentInstruction,\n getAccount,\n getAssociatedTokenAddressSync,\n NATIVE_MINT,\n} from '@solana/spl-token'\nimport {\n AccountInfo,\n Connection,\n Keypair,\n PublicKey,\n Signer,\n StakeAuthorizationLayout,\n StakeProgram,\n SystemProgram,\n TransactionInstruction,\n} from '@solana/web3.js'\nimport BN from 'bn.js'\nimport { create } from 'superstruct'\nimport {\n DEVNET_STAKE_POOL_PROGRAM_ID,\n MAX_VALIDATORS_TO_UPDATE,\n MINIMUM_ACTIVE_STAKE,\n STAKE_POOL_PROGRAM_ID,\n} from './constants'\nimport { StakePoolInstruction } from './instructions'\nimport {\n StakeAccount,\n StakePool,\n StakePoolLayout,\n ValidatorList,\n ValidatorListLayout,\n ValidatorStakeInfo,\n} from './layouts'\nimport {\n arrayChunk,\n calcLamportsWithdrawAmount,\n findEphemeralStakeProgramAddress,\n findMetadataAddress,\n findStakeProgramAddress,\n findTransientStakeProgramAddress,\n findWithdrawAuthorityProgramAddress,\n findWsolTransientProgramAddress,\n getValidatorListAccount,\n lamportsToSol,\n newStakeAccount,\n prepareWithdrawAccounts,\n solToLamports,\n ValidatorAccount,\n} from './utils'\n\nexport {\n DEVNET_STAKE_POOL_PROGRAM_ID,\n STAKE_POOL_PROGRAM_ID,\n} from './constants'\nexport * from './instructions'\nexport type {\n AccountType,\n StakePool,\n ValidatorList,\n ValidatorStakeInfo,\n} from './layouts'\nexport {\n StakePoolLayout,\n ValidatorListLayout,\n ValidatorStakeInfoLayout,\n} from './layouts'\n\nexport interface ValidatorListAccount {\n pubkey: PublicKey\n account: AccountInfo<ValidatorList>\n}\n\nexport interface StakePoolAccount {\n pubkey: PublicKey\n account: AccountInfo<StakePool>\n}\n\nexport interface WithdrawAccount {\n stakeAddress: PublicKey\n voteAddress?: PublicKey\n poolAmount: BN\n}\n\n/**\n * Wrapper class for a stake pool.\n * Each stake pool has a stake pool account and a validator list account.\n */\nexport interface StakePoolAccounts {\n stakePool: StakePoolAccount | undefined\n validatorList: ValidatorListAccount | undefined\n}\n\nexport function getStakePoolProgramId(rpcEndpoint: string): PublicKey {\n if (rpcEndpoint.includes('devnet')) {\n return DEVNET_STAKE_POOL_PROGRAM_ID\n } else {\n return STAKE_POOL_PROGRAM_ID\n }\n}\n\n/**\n * Retrieves and deserializes a StakePool account using a web3js connection and the stake pool address.\n * @param connection An active web3js connection.\n * @param stakePoolAddress The public key (address) of the stake pool account.\n */\nexport async function getStakePoolAccount(\n connection: Connection,\n stakePoolAddress: PublicKey,\n): Promise<StakePoolAccount> {\n const account = await connection.getAccountInfo(stakePoolAddress)\n\n if (!account) {\n throw new Error('Invalid stake pool account')\n }\n\n return {\n pubkey: stakePoolAddress,\n account: {\n data: StakePoolLayout.decode(account.data),\n executable: account.executable,\n lamports: account.lamports,\n owner: account.owner,\n },\n }\n}\n\n/**\n * Retrieves and deserializes a Stake account using a web3js connection and the stake address.\n * @param connection An active web3js connection.\n * @param stakeAccount The public key (address) of the stake account.\n */\nexport async function getStakeAccount(\n connection: Connection,\n stakeAccount: PublicKey,\n): Promise<StakeAccount> {\n const result = (await connection.getParsedAccountInfo(stakeAccount)).value\n if (!result || !('parsed' in result.data)) {\n throw new Error('Invalid stake account')\n }\n const program = result.data.program\n if (program !== 'stake') {\n throw new Error('Not a stake account')\n }\n return create(result.data.parsed, StakeAccount)\n}\n\n/**\n * Retrieves all StakePool and ValidatorList accounts that are running a particular StakePool program.\n * @param connection An active web3js connection.\n * @param stakePoolProgramAddress The public key (address) of the StakePool program.\n */\nexport async function getStakePoolAccounts(\n connection: Connection,\n stakePoolProgramAddress: PublicKey,\n): Promise<\n (StakePoolAccount | ValidatorListAccount | undefined)[] | undefined\n> {\n const response = await connection.getProgramAccounts(stakePoolProgramAddress)\n\n return response\n .map((a) => {\n try {\n if (a.account.data.readUInt8() === 1) {\n const data = StakePoolLayout.decode(a.account.data)\n return {\n pubkey: a.pubkey,\n account: {\n data,\n executable: a.account.executable,\n lamports: a.account.lamports,\n owner: a.account.owner,\n },\n }\n } else if (a.account.data.readUInt8() === 2) {\n const data = ValidatorListLayout.decode(a.account.data)\n return {\n pubkey: a.pubkey,\n account: {\n data,\n executable: a.account.executable,\n lamports: a.account.lamports,\n owner: a.account.owner,\n },\n }\n } else {\n console.error(\n `Could not decode. StakePoolAccount Enum is ${a.account.data.readUInt8()}, expected 1 or 2!`,\n )\n return undefined\n }\n } catch (error) {\n console.error('Could not decode account. Error:', error)\n return undefined\n }\n })\n .filter(a => a !== undefined)\n}\n\n/**\n * Creates instructions required to deposit stake to stake pool.\n */\nexport async function depositStake(\n connection: Connection,\n stakePoolAddress: PublicKey,\n authorizedPubkey: PublicKey,\n validatorVote: PublicKey,\n depositStake: PublicKey,\n poolTokenReceiverAccount?: PublicKey,\n) {\n const stakePool = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n const validatorStake = await findStakeProgramAddress(\n stakePoolProgramId,\n validatorVote,\n stakePoolAddress,\n )\n\n const instructions: TransactionInstruction[] = []\n const signers: Signer[] = []\n\n const poolMint = stakePool.account.data.poolMint\n\n // Create token account if not specified\n if (!poolTokenReceiverAccount) {\n const associatedAddress = getAssociatedTokenAddressSync(\n poolMint,\n authorizedPubkey,\n )\n instructions.push(\n createAssociatedTokenAccountIdempotentInstruction(\n authorizedPubkey,\n associatedAddress,\n authorizedPubkey,\n poolMint,\n ),\n )\n poolTokenReceiverAccount = associatedAddress\n }\n\n instructions.push(\n ...StakeProgram.authorize({\n stakePubkey: depositStake,\n authorizedPubkey,\n newAuthorizedPubkey: stakePool.account.data.stakeDepositAuthority,\n stakeAuthorizationType: StakeAuthorizationLayout.Staker,\n }).instructions,\n )\n\n instructions.push(\n ...StakeProgram.authorize({\n stakePubkey: depositStake,\n authorizedPubkey,\n newAuthorizedPubkey: stakePool.account.data.stakeDepositAuthority,\n stakeAuthorizationType: StakeAuthorizationLayout.Withdrawer,\n }).instructions,\n )\n\n instructions.push(\n StakePoolInstruction.depositStake({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n validatorList: stakePool.account.data.validatorList,\n depositAuthority: stakePool.account.data.stakeDepositAuthority,\n reserveStake: stakePool.account.data.reserveStake,\n managerFeeAccount: stakePool.account.data.managerFeeAccount,\n referralPoolAccount: poolTokenReceiverAccount,\n destinationPoolAccount: poolTokenReceiverAccount,\n withdrawAuthority,\n depositStake,\n validatorStake,\n poolMint,\n }),\n )\n\n return {\n instructions,\n signers,\n }\n}\n\n/**\n * Creates instructions required to deposit sol to stake pool.\n */\nexport async function depositWsolWithSession(\n connection: Connection,\n stakePoolAddress: PublicKey,\n signerOrSession: PublicKey,\n userPubkey: PublicKey,\n lamports: number,\n minimumPoolTokensOut: number = 0,\n destinationTokenAccount?: PublicKey,\n referrerTokenAccount?: PublicKey,\n depositAuthority?: PublicKey,\n payer?: PublicKey,\n) {\n const wsolTokenAccount = getAssociatedTokenAddressSync(NATIVE_MINT, userPubkey)\n\n const tokenAccountInfo = await connection.getTokenAccountBalance(\n wsolTokenAccount,\n 'confirmed',\n )\n const wsolBalance = tokenAccountInfo\n ? parseInt(tokenAccountInfo.value.amount)\n : 0\n\n if (wsolBalance < lamports) {\n throw new Error(\n `Not enough WSOL to deposit into pool. Maximum deposit amount is ${lamportsToSol(\n wsolBalance,\n )} WSOL.`,\n )\n }\n\n const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const stakePool = stakePoolAccount.account.data\n\n const instructions: TransactionInstruction[] = []\n\n // The program handles ATA creation internally using funds from the user's deposit\n // This prevents rent drain attacks where paymaster pays for ATA and user reclaims rent\n if (!destinationTokenAccount) {\n destinationTokenAccount = getAssociatedTokenAddressSync(\n stakePool.poolMint,\n userPubkey,\n )\n }\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n const [programSigner] = PublicKey.findProgramAddressSync(\n [Buffer.from('fogo_session_program_signer')],\n stakePoolProgramId,\n )\n\n const wsolTransientAccount = findWsolTransientProgramAddress(\n stakePoolProgramId,\n userPubkey,\n )\n\n instructions.push(\n StakePoolInstruction.depositWsolWithSession({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n reserveStake: stakePool.reserveStake,\n fundingAccount: signerOrSession,\n destinationPoolAccount: destinationTokenAccount,\n managerFeeAccount: stakePool.managerFeeAccount,\n referralPoolAccount: referrerTokenAccount ?? destinationTokenAccount,\n poolMint: stakePool.poolMint,\n lamportsIn: lamports,\n minimumPoolTokensOut,\n withdrawAuthority,\n depositAuthority,\n wsolMint: NATIVE_MINT,\n wsolTokenAccount,\n wsolTransientAccount,\n tokenProgramId: stakePool.tokenProgramId,\n programSigner,\n payer,\n userWallet: userPubkey,\n }),\n )\n return {\n instructions,\n signers: [],\n }\n}\n\n/**\n * Creates instructions required to deposit sol to stake pool.\n */\nexport async function depositSol(\n connection: Connection,\n stakePoolAddress: PublicKey,\n from: PublicKey,\n lamports: number,\n destinationTokenAccount?: PublicKey,\n referrerTokenAccount?: PublicKey,\n depositAuthority?: PublicKey,\n) {\n const fromBalance = await connection.getBalance(from, 'confirmed')\n if (fromBalance < lamports) {\n throw new Error(\n `Not enough SOL to deposit into pool. Maximum deposit amount is ${lamportsToSol(\n fromBalance,\n )} SOL.`,\n )\n }\n\n const stakePoolAccount = await getStakePoolAccount(\n connection,\n stakePoolAddress,\n )\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const stakePool = stakePoolAccount.account.data\n\n // Ephemeral SOL account just to do the transfer\n const userSolTransfer = new Keypair()\n const signers: Signer[] = [userSolTransfer]\n const instructions: TransactionInstruction[] = []\n\n // Create the ephemeral SOL account\n instructions.push(\n SystemProgram.transfer({\n fromPubkey: from,\n toPubkey: userSolTransfer.publicKey,\n lamports,\n }),\n )\n\n // Create token account if not specified\n if (!destinationTokenAccount) {\n const associatedAddress = getAssociatedTokenAddressSync(\n stakePool.poolMint,\n from,\n )\n instructions.push(\n createAssociatedTokenAccountIdempotentInstruction(\n from,\n associatedAddress,\n from,\n stakePool.poolMint,\n ),\n )\n destinationTokenAccount = associatedAddress\n }\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n instructions.push(\n StakePoolInstruction.depositSol({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n reserveStake: stakePool.reserveStake,\n fundingAccount: userSolTransfer.publicKey,\n destinationPoolAccount: destinationTokenAccount,\n managerFeeAccount: stakePool.managerFeeAccount,\n referralPoolAccount: referrerTokenAccount ?? destinationTokenAccount,\n poolMint: stakePool.poolMint,\n lamports,\n withdrawAuthority,\n depositAuthority,\n }),\n )\n\n return {\n instructions,\n signers,\n }\n}\n\n/**\n * Creates instructions required to withdraw stake from a stake pool.\n */\nexport async function withdrawStake(\n connection: Connection,\n stakePoolAddress: PublicKey,\n tokenOwner: PublicKey,\n amount: number,\n useReserve = false,\n voteAccountAddress?: PublicKey,\n stakeReceiver?: PublicKey,\n poolTokenAccount?: PublicKey,\n validatorComparator?: (_a: ValidatorAccount, _b: ValidatorAccount) => number,\n) {\n const stakePool = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const poolAmount = new BN(solToLamports(amount))\n\n if (!poolTokenAccount) {\n poolTokenAccount = getAssociatedTokenAddressSync(\n stakePool.account.data.poolMint,\n tokenOwner,\n )\n }\n\n const tokenAccount = await getAccount(connection, poolTokenAccount)\n\n // Check withdrawFrom balance\n if (tokenAccount.amount < poolAmount.toNumber()) {\n throw new Error(\n `Not enough token balance to withdraw ${lamportsToSol(poolAmount)} pool tokens.\n Maximum withdraw amount is ${lamportsToSol(tokenAccount.amount)} pool tokens.`,\n )\n }\n\n const stakeAccountRentExemption\n = await connection.getMinimumBalanceForRentExemption(StakeProgram.space)\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n let stakeReceiverAccount = null\n if (stakeReceiver) {\n stakeReceiverAccount = await getStakeAccount(connection, stakeReceiver)\n }\n\n const withdrawAccounts: WithdrawAccount[] = []\n\n if (useReserve) {\n withdrawAccounts.push({\n stakeAddress: stakePool.account.data.reserveStake,\n voteAddress: undefined,\n poolAmount,\n })\n } else if (\n stakeReceiverAccount\n && stakeReceiverAccount?.type === 'delegated'\n ) {\n const voteAccount = stakeReceiverAccount.info?.stake?.delegation.voter\n if (!voteAccount) {\n throw new Error(`Invalid stake receiver ${stakeReceiver} delegation`)\n }\n const validatorListAccount = await connection.getAccountInfo(\n stakePool.account.data.validatorList,\n )\n const validatorList = ValidatorListLayout.decode(\n validatorListAccount?.data,\n ) as ValidatorList\n const isValidVoter = validatorList.validators.find(val =>\n val.voteAccountAddress.equals(voteAccount),\n )\n if (voteAccountAddress && voteAccountAddress !== voteAccount) {\n throw new Error(`Provided withdrawal vote account ${voteAccountAddress} does not match delegation on stake receiver account ${voteAccount},\n remove this flag or provide a different stake account delegated to ${voteAccountAddress}`)\n }\n if (isValidVoter) {\n const stakeAccountAddress = await findStakeProgramAddress(\n stakePoolProgramId,\n voteAccount,\n stakePoolAddress,\n )\n\n const stakeAccount = await connection.getAccountInfo(stakeAccountAddress)\n if (!stakeAccount) {\n throw new Error(\n `Preferred withdraw valdator's stake account is invalid`,\n )\n }\n\n const availableForWithdrawal = calcLamportsWithdrawAmount(\n stakePool.account.data,\n new BN(\n stakeAccount.lamports\n - MINIMUM_ACTIVE_STAKE\n - stakeAccountRentExemption,\n ),\n )\n\n if (availableForWithdrawal.lt(poolAmount)) {\n throw new Error(\n `Not enough lamports available for withdrawal from ${stakeAccountAddress},\n ${poolAmount} asked, ${availableForWithdrawal} available.`,\n )\n }\n withdrawAccounts.push({\n stakeAddress: stakeAccountAddress,\n voteAddress: voteAccount,\n poolAmount,\n })\n } else {\n throw new Error(\n `Provided stake account is delegated to a vote account ${voteAccount} which does not exist in the stake pool`,\n )\n }\n } else if (voteAccountAddress) {\n const stakeAccountAddress = await findStakeProgramAddress(\n stakePoolProgramId,\n voteAccountAddress,\n stakePoolAddress,\n )\n const stakeAccount = await connection.getAccountInfo(stakeAccountAddress)\n if (!stakeAccount) {\n throw new Error('Invalid Stake Account')\n }\n\n const availableLamports = new BN(\n stakeAccount.lamports - MINIMUM_ACTIVE_STAKE - stakeAccountRentExemption,\n )\n if (availableLamports.lt(new BN(0))) {\n throw new Error('Invalid Stake Account')\n }\n const availableForWithdrawal = calcLamportsWithdrawAmount(\n stakePool.account.data,\n availableLamports,\n )\n\n if (availableForWithdrawal.lt(poolAmount)) {\n // noinspection ExceptionCaughtLocallyJS\n throw new Error(\n `Not enough lamports available for withdrawal from ${stakeAccountAddress},\n ${poolAmount} asked, ${availableForWithdrawal} available.`,\n )\n }\n withdrawAccounts.push({\n stakeAddress: stakeAccountAddress,\n voteAddress: voteAccountAddress,\n poolAmount,\n })\n } else {\n // Get the list of accounts to withdraw from\n withdrawAccounts.push(\n ...(await prepareWithdrawAccounts(\n connection,\n stakePool.account.data,\n stakePoolAddress,\n poolAmount,\n validatorComparator,\n poolTokenAccount.equals(stakePool.account.data.managerFeeAccount),\n )),\n )\n }\n\n // Construct transaction to withdraw from withdrawAccounts account list\n const instructions: TransactionInstruction[] = []\n const userTransferAuthority = Keypair.generate()\n\n const signers: Signer[] = [userTransferAuthority]\n\n instructions.push(\n createApproveInstruction(\n poolTokenAccount,\n userTransferAuthority.publicKey,\n tokenOwner,\n poolAmount.toNumber(),\n ),\n )\n\n let totalRentFreeBalances = 0\n\n // Max 5 accounts to prevent an error: \"Transaction too large\"\n const maxWithdrawAccounts = 5\n let i = 0\n\n // Go through prepared accounts and withdraw/claim them\n for (const withdrawAccount of withdrawAccounts) {\n if (i > maxWithdrawAccounts) {\n break\n }\n // Convert pool tokens amount to lamports\n const solWithdrawAmount = calcLamportsWithdrawAmount(\n stakePool.account.data,\n withdrawAccount.poolAmount,\n )\n\n let infoMsg = `Withdrawing ◎${solWithdrawAmount},\n from stake account ${withdrawAccount.stakeAddress?.toBase58()}`\n\n if (withdrawAccount.voteAddress) {\n infoMsg = `${infoMsg}, delegated to ${withdrawAccount.voteAddress?.toBase58()}`\n }\n\n console.info(infoMsg)\n let stakeToReceive\n\n if (\n !stakeReceiver\n || (stakeReceiverAccount && stakeReceiverAccount.type === 'delegated')\n ) {\n const stakeKeypair = newStakeAccount(\n tokenOwner,\n instructions,\n stakeAccountRentExemption,\n )\n signers.push(stakeKeypair)\n totalRentFreeBalances += stakeAccountRentExemption\n stakeToReceive = stakeKeypair.publicKey\n } else {\n stakeToReceive = stakeReceiver\n }\n\n instructions.push(\n StakePoolInstruction.withdrawStake({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n validatorList: stakePool.account.data.validatorList,\n validatorStake: withdrawAccount.stakeAddress,\n destinationStake: stakeToReceive,\n destinationStakeAuthority: tokenOwner,\n sourceTransferAuthority: userTransferAuthority.publicKey,\n sourcePoolAccount: poolTokenAccount,\n managerFeeAccount: stakePool.account.data.managerFeeAccount,\n poolMint: stakePool.account.data.poolMint,\n poolTokens: withdrawAccount.poolAmount.toNumber(),\n withdrawAuthority,\n }),\n )\n i++\n }\n if (\n stakeReceiver\n && stakeReceiverAccount\n && stakeReceiverAccount.type === 'delegated'\n ) {\n signers.forEach((newStakeKeypair) => {\n instructions.concat(\n StakeProgram.merge({\n stakePubkey: stakeReceiver,\n sourceStakePubKey: newStakeKeypair.publicKey,\n authorizedPubkey: tokenOwner,\n }).instructions,\n )\n })\n }\n\n return {\n instructions,\n signers,\n stakeReceiver,\n totalRentFreeBalances,\n }\n}\n\n/**\n * Creates instructions required to withdraw SOL directly from a stake pool.\n */\nexport async function withdrawSol(\n connection: Connection,\n stakePoolAddress: PublicKey,\n tokenOwner: PublicKey,\n solReceiver: PublicKey,\n amount: number,\n solWithdrawAuthority?: PublicKey,\n) {\n const stakePool = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const poolAmount = solToLamports(amount)\n\n const poolTokenAccount = getAssociatedTokenAddressSync(\n stakePool.account.data.poolMint,\n tokenOwner,\n )\n\n const tokenAccount = await getAccount(connection, poolTokenAccount)\n\n // Check withdrawFrom balance\n if (tokenAccount.amount < poolAmount) {\n throw new Error(\n `Not enough token balance to withdraw ${lamportsToSol(poolAmount)} pool tokens.\n Maximum withdraw amount is ${lamportsToSol(tokenAccount.amount)} pool tokens.`,\n )\n }\n\n // Construct transaction to withdraw from withdrawAccounts account list\n const instructions: TransactionInstruction[] = []\n const userTransferAuthority = Keypair.generate()\n const signers: Signer[] = [userTransferAuthority]\n\n instructions.push(\n createApproveInstruction(\n poolTokenAccount,\n userTransferAuthority.publicKey,\n tokenOwner,\n poolAmount,\n ),\n )\n\n const poolWithdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n if (solWithdrawAuthority) {\n const expectedSolWithdrawAuthority\n = stakePool.account.data.solWithdrawAuthority\n if (!expectedSolWithdrawAuthority) {\n throw new Error(\n 'SOL withdraw authority specified in arguments but stake pool has none',\n )\n }\n if (\n solWithdrawAuthority.toBase58() !== expectedSolWithdrawAuthority.toBase58()\n ) {\n throw new Error(\n `Invalid deposit withdraw specified, expected ${expectedSolWithdrawAuthority.toBase58()}, received ${solWithdrawAuthority.toBase58()}`,\n )\n }\n }\n\n const withdrawTransaction = StakePoolInstruction.withdrawSol({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n withdrawAuthority: poolWithdrawAuthority,\n reserveStake: stakePool.account.data.reserveStake,\n sourcePoolAccount: poolTokenAccount,\n sourceTransferAuthority: userTransferAuthority.publicKey,\n destinationSystemAccount: solReceiver,\n managerFeeAccount: stakePool.account.data.managerFeeAccount,\n poolMint: stakePool.account.data.poolMint,\n poolTokens: poolAmount,\n solWithdrawAuthority,\n })\n\n instructions.push(withdrawTransaction)\n\n return {\n instructions,\n signers,\n }\n}\n\n/**\n * Creates instructions required to withdraw wSOL from a stake pool.\n */\nexport async function withdrawWsolWithSession(\n connection: Connection,\n stakePoolAddress: PublicKey,\n signerOrSession: PublicKey,\n userPubkey: PublicKey,\n amount: number,\n minimumLamportsOut: number = 0,\n solWithdrawAuthority?: PublicKey,\n) {\n const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const stakePool = stakePoolAccount.account.data\n const poolTokens = solToLamports(amount)\n\n const poolTokenAccount = getAssociatedTokenAddressSync(stakePool.poolMint, userPubkey)\n const tokenAccount = await getAccount(connection, poolTokenAccount)\n\n if (tokenAccount.amount < poolTokens) {\n throw new Error(\n `Not enough token balance to withdraw ${amount} pool tokens.\n Maximum withdraw amount is ${lamportsToSol(tokenAccount.amount)} pool tokens.`,\n )\n }\n\n const userWsolAccount = getAssociatedTokenAddressSync(NATIVE_MINT, userPubkey)\n\n const instructions: TransactionInstruction[] = []\n const signers: Signer[] = []\n\n instructions.push(\n createAssociatedTokenAccountIdempotentInstruction(\n signerOrSession,\n userWsolAccount,\n userPubkey,\n NATIVE_MINT,\n ),\n )\n\n const [programSigner] = PublicKey.findProgramAddressSync(\n [Buffer.from('fogo_session_program_signer')],\n stakePoolProgramId,\n )\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n instructions.push(\n StakePoolInstruction.withdrawWsolWithSession({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n withdrawAuthority,\n userTransferAuthority: signerOrSession,\n poolTokensFrom: poolTokenAccount,\n reserveStake: stakePool.reserveStake,\n userWsolAccount,\n managerFeeAccount: stakePool.managerFeeAccount,\n poolMint: stakePool.poolMint,\n tokenProgramId: stakePool.tokenProgramId,\n solWithdrawAuthority,\n wsolMint: NATIVE_MINT,\n programSigner,\n poolTokensIn: poolTokens,\n minimumLamportsOut,\n }),\n )\n\n return {\n instructions,\n signers,\n }\n}\n\nexport async function addValidatorToPool(\n connection: Connection,\n stakePoolAddress: PublicKey,\n validatorVote: PublicKey,\n seed?: number,\n) {\n const stakePoolAccount = await getStakePoolAccount(\n connection,\n stakePoolAddress,\n )\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const stakePool = stakePoolAccount.account.data\n const { reserveStake, staker, validatorList } = stakePool\n\n const validatorListAccount = await getValidatorListAccount(\n connection,\n validatorList,\n )\n\n const validatorInfo = validatorListAccount.account.data.validators.find(\n v => v.voteAccountAddress.toBase58() === validatorVote.toBase58(),\n )\n\n if (validatorInfo) {\n throw new Error('Vote account is already in validator list')\n }\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n const validatorStake = await findStakeProgramAddress(\n stakePoolProgramId,\n validatorVote,\n stakePoolAddress,\n seed,\n )\n\n const instructions: TransactionInstruction[] = [\n StakePoolInstruction.addValidatorToPool({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n staker,\n reserveStake,\n withdrawAuthority,\n validatorList,\n validatorStake,\n validatorVote,\n }),\n ]\n\n return {\n instructions,\n }\n}\n\nexport async function removeValidatorFromPool(\n connection: Connection,\n stakePoolAddress: PublicKey,\n validatorVote: PublicKey,\n seed?: number,\n) {\n const stakePoolAccount = await getStakePoolAccount(\n connection,\n stakePoolAddress,\n )\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const stakePool = stakePoolAccount.account.data\n const { staker, validatorList } = stakePool\n\n const validatorListAccount = await getValidatorListAccount(\n connection,\n validatorList,\n )\n\n const validatorInfo = validatorListAccount.account.data.validators.find(\n v => v.voteAccountAddress.toBase58() === validatorVote.toBase58(),\n )\n\n if (!validatorInfo) {\n throw new Error('Vote account is not already in validator list')\n }\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n const validatorStake = await findStakeProgramAddress(\n stakePoolProgramId,\n validatorVote,\n stakePoolAddress,\n seed,\n )\n\n const transientStakeSeed = validatorInfo.transientSeedSuffixStart\n\n const transientStake = await findTransientStakeProgramAddress(\n stakePoolProgramId,\n validatorInfo.voteAccountAddress,\n stakePoolAddress,\n transientStakeSeed,\n )\n\n const instructions: TransactionInstruction[] = [\n StakePoolInstruction.removeValidatorFromPool({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n staker,\n withdrawAuthority,\n validatorList,\n validatorStake,\n transientStake,\n }),\n ]\n\n return {\n instructions,\n }\n}\n\n/**\n * Creates instructions required to increase validator stake.\n */\nexport async function increaseValidatorStake(\n connection: Connection,\n stakePoolAddress: PublicKey,\n validatorVote: PublicKey,\n lamports: number,\n ephemeralStakeSeed?: number,\n) {\n const stakePool = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n\n const validatorList = await getValidatorListAccount(\n connection,\n stakePool.account.data.validatorList,\n )\n\n const validatorInfo = validatorList.account.data.validators.find(\n v => v.voteAccountAddress.toBase58() === validatorVote.toBase58(),\n )\n\n if (!validatorInfo) {\n throw new Error('Vote account not found in validator list')\n }\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n // Bump transient seed suffix by one to avoid reuse when not using the increaseAdditionalStake instruction\n const transientStakeSeed\n = ephemeralStakeSeed === undefined\n ? validatorInfo.transientSeedSuffixStart.addn(1)\n : validatorInfo.transientSeedSuffixStart\n\n const transientStake = await findTransientStakeProgramAddress(\n stakePoolProgramId,\n validatorInfo.voteAccountAddress,\n stakePoolAddress,\n transientStakeSeed,\n )\n\n const validatorStake = await findStakeProgramAddress(\n stakePoolProgramId,\n validatorInfo.voteAccountAddress,\n stakePoolAddress,\n )\n\n const instructions: TransactionInstruction[] = []\n\n if (ephemeralStakeSeed !== undefined) {\n const ephemeralStake = await findEphemeralStakeProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n new BN(ephemeralStakeSeed),\n )\n instructions.push(\n StakePoolInstruction.increaseAdditionalValidatorStake({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n staker: stakePool.account.data.staker,\n validatorList: stakePool.account.data.validatorList,\n reserveStake: stakePool.account.data.reserveStake,\n transientStakeSeed: transientStakeSeed.toNumber(),\n withdrawAuthority,\n transientStake,\n validatorStake,\n validatorVote,\n lamports,\n ephemeralStake,\n ephemeralStakeSeed,\n }),\n )\n } else {\n instructions.push(\n StakePoolInstruction.increaseValidatorStake({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n staker: stakePool.account.data.staker,\n validatorList: stakePool.account.data.validatorList,\n reserveStake: stakePool.account.data.reserveStake,\n transientStakeSeed: transientStakeSeed.toNumber(),\n withdrawAuthority,\n transientStake,\n validatorStake,\n validatorVote,\n lamports,\n }),\n )\n }\n\n return {\n instructions,\n }\n}\n\n/**\n * Creates instructions required to decrease validator stake.\n */\nexport async function decreaseValidatorStake(\n connection: Connection,\n stakePoolAddress: PublicKey,\n validatorVote: PublicKey,\n lamports: number,\n ephemeralStakeSeed?: number,\n) {\n const stakePool = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const validatorList = await getValidatorListAccount(\n connection,\n stakePool.account.data.validatorList,\n )\n\n const validatorInfo = validatorList.account.data.validators.find(\n v => v.voteAccountAddress.toBase58() === validatorVote.toBase58(),\n )\n\n if (!validatorInfo) {\n throw new Error('Vote account not found in validator list')\n }\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n const validatorStake = await findStakeProgramAddress(\n stakePoolProgramId,\n validatorInfo.voteAccountAddress,\n stakePoolAddress,\n )\n\n // Bump transient seed suffix by one to avoid reuse when not using the decreaseAdditionalStake instruction\n const transientStakeSeed\n = ephemeralStakeSeed === undefined\n ? validatorInfo.transientSeedSuffixStart.addn(1)\n : validatorInfo.transientSeedSuffixStart\n\n const transientStake = await findTransientStakeProgramAddress(\n stakePoolProgramId,\n validatorInfo.voteAccountAddress,\n stakePoolAddress,\n transientStakeSeed,\n )\n\n const instructions: TransactionInstruction[] = []\n\n if (ephemeralStakeSeed !== undefined) {\n const ephemeralStake = await findEphemeralStakeProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n new BN(ephemeralStakeSeed),\n )\n instructions.push(\n StakePoolInstruction.decreaseAdditionalValidatorStake({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n staker: stakePool.account.data.staker,\n validatorList: stakePool.account.data.validatorList,\n reserveStake: stakePool.account.data.reserveStake,\n transientStakeSeed: transientStakeSeed.toNumber(),\n withdrawAuthority,\n validatorStake,\n transientStake,\n lamports,\n ephemeralStake,\n ephemeralStakeSeed,\n }),\n )\n } else {\n instructions.push(\n StakePoolInstruction.decreaseValidatorStakeWithReserve({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n staker: stakePool.account.data.staker,\n validatorList: stakePool.account.data.validatorList,\n reserveStake: stakePool.account.data.reserveStake,\n transientStakeSeed: transientStakeSeed.toNumber(),\n withdrawAuthority,\n validatorStake,\n transientStake,\n lamports,\n }),\n )\n }\n\n return {\n instructions,\n }\n}\n\n/**\n * Creates instructions required to completely update a stake pool after epoch change.\n */\nexport async function updateStakePool(\n connection: Connection,\n stakePool: StakePoolAccount,\n noMerge = false,\n) {\n const stakePoolAddress = stakePool.pubkey\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n\n const validatorList = await getValidatorListAccount(\n connection,\n stakePool.account.data.validatorList,\n )\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n const updateListInstructions: TransactionInstruction[] = []\n const instructions: TransactionInstruction[] = []\n\n let startIndex = 0\n const validatorChunks: Array<ValidatorStakeInfo[]> = arrayChunk(\n validatorList.account.data.validators,\n MAX_VALIDATORS_TO_UPDATE,\n )\n\n for (const validatorChunk of validatorChunks) {\n const validatorAndTransientStakePairs: PublicKey[] = []\n\n for (const validator of validatorChunk) {\n const validatorStake = await findStakeProgramAddress(\n stakePoolProgramId,\n validator.voteAccountAddress,\n stakePoolAddress,\n )\n validatorAndTransientStakePairs.push(validatorStake)\n\n const transientStake = await findTransientStakeProgramAddress(\n stakePoolProgramId,\n validator.voteAccountAddress,\n stakePoolAddress,\n validator.transientSeedSuffixStart,\n )\n validatorAndTransientStakePairs.push(transientStake)\n }\n\n updateListInstructions.push(\n StakePoolInstruction.updateValidatorListBalance({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n validatorList: stakePool.account.data.validatorList,\n reserveStake: stakePool.account.data.reserveStake,\n validatorAndTransientStakePairs,\n withdrawAuthority,\n startIndex,\n noMerge,\n }),\n )\n startIndex += MAX_VALIDATORS_TO_UPDATE\n }\n\n instructions.push(\n StakePoolInstruction.updateStakePoolBalance({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n validatorList: stakePool.account.data.validatorList,\n reserveStake: stakePool.account.data.reserveStake,\n managerFeeAccount: stakePool.account.data.managerFeeAccount,\n poolMint: stakePool.account.data.poolMint,\n withdrawAuthority,\n }),\n )\n\n instructions.push(\n StakePoolInstruction.cleanupRemovedValidatorEntries({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n validatorList: stakePool.account.data.validatorList,\n }),\n )\n\n return {\n updateListInstructions,\n finalInstructions: instructions,\n }\n}\n\n/**\n * Retrieves detailed information about the StakePool.\n */\nexport async function stakePoolInfo(\n connection: Connection,\n stakePoolAddress: PublicKey,\n) {\n const stakePool = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const reserveAccountStakeAddress = stakePool.account.data.reserveStake\n const totalLamports = stakePool.account.data.totalLamports\n const lastUpdateEpoch = stakePool.account.data.lastUpdateEpoch\n\n const validatorList = await getValidatorListAccount(\n connection,\n stakePool.account.data.validatorList,\n )\n\n const maxNumberOfValidators = validatorList.account.data.maxValidators\n const currentNumberOfValidators\n = validatorList.account.data.validators.length\n\n const epochInfo = await connection.getEpochInfo()\n const reserveStake = await connection.getAccountInfo(\n reserveAccountStakeAddress,\n )\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n const minimumReserveStakeBalance\n = await connection.getMinimumBalanceForRentExemption(StakeProgram.space)\n\n const stakeAccounts = await Promise.all(\n validatorList.account.data.validators.map(async (validator) => {\n const stakeAccountAddress = await findStakeProgramAddress(\n stakePoolProgramId,\n validator.voteAccountAddress,\n stakePoolAddress,\n )\n const transientStakeAccountAddress\n = await findTransientStakeProgramAddress(\n stakePoolProgramId,\n validator.voteAccountAddress,\n stakePoolAddress,\n validator.transientSeedSuffixStart,\n )\n const updateRequired = !validator.lastUpdateEpoch.eqn(epochInfo.epoch)\n return {\n voteAccountAddress: validator.voteAccountAddress.toBase58(),\n stakeAccountAddress: stakeAccountAddress.toBase58(),\n validatorActiveStakeLamports: validator.activeStakeLamports.toString(),\n validatorLastUpdateEpoch: validator.lastUpdateEpoch.toString(),\n validatorLamports: validator.activeStakeLamports\n .add(validator.transientStakeLamports)\n .toString(),\n validatorTransientStakeAccountAddress:\n transientStakeAccountAddress.toBase58(),\n validatorTransientStakeLamports:\n validator.transientStakeLamports.toString(),\n updateRequired,\n }\n }),\n )\n\n const totalPoolTokens = lamportsToSol(stakePool.account.data.poolTokenSupply)\n const updateRequired = !lastUpdateEpoch.eqn(epochInfo.epoch)\n\n return {\n address: stakePoolAddress.toBase58(),\n poolWithdrawAuthority: withdrawAuthority.toBase58(),\n manager: stakePool.account.data.manager.toBase58(),\n staker: stakePool.account.data.staker.toBase58(),\n stakeDepositAuthority:\n stakePool.account.data.stakeDepositAuthority.toBase58(),\n stakeWithdrawBumpSeed: stakePool.account.data.stakeWithdrawBumpSeed,\n maxValidators: maxNumberOfValidators,\n validatorList: validatorList.account.data.validators.map((validator) => {\n return {\n activeStakeLamports: validator.activeStakeLamports.toString(),\n transientStakeLamports: validator.transientStakeLamports.toString(),\n lastUpdateEpoch: validator.lastUpdateEpoch.toString(),\n transientSeedSuffixStart: validator.transientSeedSuffixStart.toString(),\n transientSeedSuffixEnd: validator.transientSeedSuffixEnd.toString(),\n status: validator.status.toString(),\n voteAccountAddress: validator.voteAccountAddress.toString(),\n }\n }), // CliStakePoolValidator\n validatorListStorageAccount:\n stakePool.account.data.validatorList.toBase58(),\n reserveStake: stakePool.account.data.reserveStake.toBase58(),\n poolMint: stakePool.account.data.poolMint.toBase58(),\n managerFeeAccount: stakePool.account.data.managerFeeAccount.toBase58(),\n tokenProgramId: stakePool.account.data.tokenProgramId.toBase58(),\n totalLamports: stakePool.account.data.totalLamports.toString(),\n poolTokenSupply: stakePool.account.data.poolTokenSupply.toString(),\n lastUpdateEpoch: stakePool.account.data.lastUpdateEpoch.toString(),\n lockup: stakePool.account.data.lockup, // pub lockup: CliStakePoolLockup\n epochFee: stakePool.account.data.epochFee,\n nextEpochFee: stakePool.account.data.nextEpochFee,\n preferredDepositValidatorVoteAddress:\n stakePool.account.data.preferredDepositValidatorVoteAddress,\n preferredWithdrawValidatorVoteAddress:\n stakePool.account.data.preferredWithdrawValidatorVoteAddress,\n stakeDepositFee: stakePool.account.data.stakeDepositFee,\n stakeWithdrawalFee: stakePool.account.data.stakeWithdrawalFee,\n // CliStakePool the same\n nextStakeWithdrawalFee: stakePool.account.data.nextStakeWithdrawalFee,\n stakeReferralFee: stakePool.account.data.stakeReferralFee,\n solDepositAuthority: stakePool.account.data.solDepositAuthority?.toBase58(),\n solDepositFee: stakePool.account.data.solDepositFee,\n solReferralFee: stakePool.account.data.solReferralFee,\n solWithdrawAuthority:\n stakePool.account.data.solWithdrawAuthority?.toBase58(),\n solWithdrawalFee: stakePool.account.data.solWithdrawalFee,\n nextSolWithdrawalFee: stakePool.account.data.nextSolWithdrawalFee,\n lastEpochPoolTokenSupply:\n stakePool.account.data.lastEpochPoolTokenSupply.toString(),\n lastEpochTotalLamports:\n stakePool.account.data.lastEpochTotalLamports.toString(),\n details: {\n reserveStakeLamports: reserveStake?.lamports,\n reserveAccountStakeAddress: reserveAccountStakeAddress.toBase58(),\n minimumReserveStakeBalance,\n stakeAccounts,\n totalLamports,\n totalPoolTokens,\n currentNumberOfValidators,\n maxNumberOfValidators,\n updateRequired,\n }, // CliStakePoolDetails\n }\n}\n\n/**\n * Creates instructions required to create pool token metadata.\n */\nexport async function createPoolTokenMetadata(\n connection: Connection,\n stakePoolAddress: PublicKey,\n payer: PublicKey,\n name: string,\n symbol: string,\n uri: string,\n) {\n const stakePool = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n const tokenMetadata = findMetadataAddress(stakePool.account.data.poolMint)\n const manager = stakePool.account.data.manager\n\n const instructions: TransactionInstruction[] = []\n instructions.push(\n StakePoolInstruction.createTokenMetadata({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n poolMint: stakePool.account.data.poolMint,\n payer,\n manager,\n tokenMetadata,\n withdrawAuthority,\n name,\n symbol,\n uri,\n }),\n )\n\n return {\n instructions,\n }\n}\n\n/**\n * Creates instructions required to update pool token metadata.\n */\nexport async function updatePoolTokenMetadata(\n connection: Connection,\n stakePoolAddress: PublicKey,\n name: string,\n symbol: string,\n uri: string,\n) {\n const stakePool = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n const tokenMetadata = findMetadataAddress(stakePool.account.data.poolMint)\n\n const instructions: TransactionInstruction[] = []\n instructions.push(\n StakePoolInstruction.updateTokenMetadata({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n manager: stakePool.account.data.manager,\n tokenMetadata,\n withdrawAuthority,\n name,\n symbol,\n uri,\n }),\n )\n\n return {\n instructions,\n }\n}\n"],"names":["PublicKey","Buffer","LAMPORTS_PER_SOL","LayoutCls","blob","u8","u32","struct","seq","offset","StakeProgram","Keypair","SystemProgram","BufferLayout","SYSVAR_RENT_PUBKEY","SYSVAR_CLOCK_PUBKEY","SYSVAR_STAKE_HISTORY_PUBKEY","STAKE_CONFIG_ID","TransactionInstruction","TOKEN_PROGRAM_ID","getAssociatedTokenAddressSync","createAssociatedTokenAccountIdempotentInstruction","StakeAuthorizationLayout","NATIVE_MINT","getAccount","createApproveInstruction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,WAAW,SAAS,SAAS,CAAC;AACpC,IAAI,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE;AACnC,QAAQ,IAAI,MAAM;AAClB,QAAQ,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO;AACzD,QAAQ,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO;AAChC,QAAQ,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,KAAK,CAAC,GAAG,OAAO,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5F,QAAQ,KAAK,CAAC,WAAW,IAAI,GAAG,CAAC;AACjC,QAAQ,IAAI,WAAW,IAAI,IAAI;AAC/B,YAAY,IAAI,CAAC,KAAK,GAAG,GAAG;AAC5B,QAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC;AACjC,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI;AACzC,QAAQ,IAAI,CAAC,QAAQ,GAAG,MAAM;AAC9B,YAAY,QAAQ,MAAM,KAAK,MAAM,GAAG,CAAC,OAAO,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC;AACjE,Q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,CAAC,QAAQ;QACzC,KAAK;QACL,OAAO;QACP,aAAa;QACb,iBAAiB;QACjB,IAAI;QACJ,MAAM;QACN,GAAG;AACJ,KAAA,CAAC,CACH;IAED,OAAO;QACL,YAAY;KACb;AACH;AAEA;;AAEG;AACI,eAAe,uBAAuB,CAC3C,UAAsB,EACtB,gBAA2B,EAC3B,IAAY,EACZ,MAAc,EACd,GAAW,EAAA;IAEX,MAAM,SAAS,GAAG,MAAM,mBAAmB,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACzE,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,UAAU,CAAC,WAAW,CAAC;IAExE,MAAM,iBAAiB,GAAG,MAAM,mCAAmC,CACjE,kBAAkB,EAClB,gBAAgB,CACjB;AAED,IAAA,MAAM,aAAa,GAAG,mBAAmB,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;IAE1E,MAAM,YAAY,GAA6B,EAAE;AACjD,IAAA,YAAY,CAAC,IAAI,CACf,oBAAoB,CAAC,mBAAmB,CAAC;AACvC,QAAA,SAAS,EAAE,kBAAkB;AAC7B,QAAA,SAAS,EAAE,gBAAgB;AAC3B,QAAA,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO;QACvC,aAAa;QACb,iBAAiB;QACjB,IAAI;QACJ,MAAM;QACN,GAAG;AACJ,KAAA,CAAC,CACH;IAED,OAAO;QACL,YAAY;KACb;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.browser.cjs.js","sources":["../../../node_modules/.pnpm/superstruct@2.0.2/node_modules/superstruct/dist/index.mjs","../src/constants.ts","../src/utils/instruction.ts","../src/utils/math.ts","../src/utils/program-address.ts","../src/codecs.ts","../src/layouts.ts","../src/utils/stake.ts","../src/utils/index.ts","../src/instructions.ts","../src/index.ts"],"sourcesContent":["/**\n * A `StructFailure` represents a single specific failure in validation.\n */\n/**\n * `StructError` objects are thrown (or returned) when validation fails.\n *\n * Validation logic is design to exit early for maximum performance. The error\n * represents the first error encountered during validation. For more detail,\n * the `error.failures` property is a generator function that can be run to\n * continue validation and receive all the failures in the data.\n */\nclass StructError extends TypeError {\n constructor(failure, failures) {\n let cached;\n const { message, explanation, ...rest } = failure;\n const { path } = failure;\n const msg = path.length === 0 ? message : `At path: ${path.join('.')} -- ${message}`;\n super(explanation ?? msg);\n if (explanation != null)\n this.cause = msg;\n Object.assign(this, rest);\n this.name = this.constructor.name;\n this.failures = () => {\n return (cached ?? (cached = [failure, ...failures()]));\n };\n }\n}\n\n/**\n * Check if a value is an iterator.\n */\nfunction isIterable(x) {\n return isObject(x) && typeof x[Symbol.iterator] === 'function';\n}\n/**\n * Check if a value is a plain object.\n */\nfunction isObject(x) {\n return typeof x === 'object' && x != null;\n}\n/**\n * Check if a value is a non-array object.\n */\nfunction isNonArrayObject(x) {\n return isObject(x) && !Array.isArray(x);\n}\n/**\n * Check if a value is a plain object.\n */\nfunction isPlainObject(x) {\n if (Object.prototype.toString.call(x) !== '[object Object]') {\n return false;\n }\n const prototype = Object.getPrototypeOf(x);\n return prototype === null || prototype === Object.prototype;\n}\n/**\n * Return a value as a printable string.\n */\nfunction print(value) {\n if (typeof value === 'symbol') {\n return value.toString();\n }\n return typeof value === 'string' ? JSON.stringify(value) : `${value}`;\n}\n/**\n * Shifts (removes and returns) the first value from the `input` iterator.\n * Like `Array.prototype.shift()` but for an `Iterator`.\n */\nfunction shiftIterator(input) {\n const { done, value } = input.next();\n return done ? undefined : value;\n}\n/**\n * Convert a single validation result to a failure.\n */\nfunction toFailure(result, context, struct, value) {\n if (result === true) {\n return;\n }\n else if (result === false) {\n result = {};\n }\n else if (typeof result === 'string') {\n result = { message: result };\n }\n const { path, branch } = context;\n const { type } = struct;\n const { refinement, message = `Expected a value of type \\`${type}\\`${refinement ? ` with refinement \\`${refinement}\\`` : ''}, but received: \\`${print(value)}\\``, } = result;\n return {\n value,\n type,\n refinement,\n key: path[path.length - 1],\n path,\n branch,\n ...result,\n message,\n };\n}\n/**\n * Convert a validation result to an iterable of failures.\n */\nfunction* toFailures(result, context, struct, value) {\n if (!isIterable(result)) {\n result = [result];\n }\n for (const r of result) {\n const failure = toFailure(r, context, struct, value);\n if (failure) {\n yield failure;\n }\n }\n}\n/**\n * Check a value against a struct, traversing deeply into nested values, and\n * returning an iterator of failures or success.\n */\nfunction* run(value, struct, options = {}) {\n const { path = [], branch = [value], coerce = false, mask = false } = options;\n const ctx = { path, branch, mask };\n if (coerce) {\n value = struct.coercer(value, ctx);\n }\n let status = 'valid';\n for (const failure of struct.validator(value, ctx)) {\n failure.explanation = options.message;\n status = 'not_valid';\n yield [failure, undefined];\n }\n for (let [k, v, s] of struct.entries(value, ctx)) {\n const ts = run(v, s, {\n path: k === undefined ? path : [...path, k],\n branch: k === undefined ? branch : [...branch, v],\n coerce,\n mask,\n message: options.message,\n });\n for (const t of ts) {\n if (t[0]) {\n status = t[0].refinement != null ? 'not_refined' : 'not_valid';\n yield [t[0], undefined];\n }\n else if (coerce) {\n v = t[1];\n if (k === undefined) {\n value = v;\n }\n else if (value instanceof Map) {\n value.set(k, v);\n }\n else if (value instanceof Set) {\n value.add(v);\n }\n else if (isObject(value)) {\n if (v !== undefined || k in value)\n value[k] = v;\n }\n }\n }\n }\n if (status !== 'not_valid') {\n for (const failure of struct.refiner(value, ctx)) {\n failure.explanation = options.message;\n status = 'not_refined';\n yield [failure, undefined];\n }\n }\n if (status === 'valid') {\n yield [undefined, value];\n }\n}\n\n/**\n * `Struct` objects encapsulate the validation logic for a specific type of\n * values. Once constructed, you use the `assert`, `is` or `validate` helpers to\n * validate unknown input data against the struct.\n */\nclass Struct {\n constructor(props) {\n const { type, schema, validator, refiner, coercer = (value) => value, entries = function* () { }, } = props;\n this.type = type;\n this.schema = schema;\n this.entries = entries;\n this.coercer = coercer;\n if (validator) {\n this.validator = (value, context) => {\n const result = validator(value, context);\n return toFailures(result, context, this, value);\n };\n }\n else {\n this.validator = () => [];\n }\n if (refiner) {\n this.refiner = (value, context) => {\n const result = refiner(value, context);\n return toFailures(result, context, this, value);\n };\n }\n else {\n this.refiner = () => [];\n }\n }\n /**\n * Assert that a value passes the struct's validation, throwing if it doesn't.\n */\n assert(value, message) {\n return assert(value, this, message);\n }\n /**\n * Create a value with the struct's coercion logic, then validate it.\n */\n create(value, message) {\n return create(value, this, message);\n }\n /**\n * Check if a value passes the struct's validation.\n */\n is(value) {\n return is(value, this);\n }\n /**\n * Mask a value, coercing and validating it, but returning only the subset of\n * properties defined by the struct's schema. Masking applies recursively to\n * props of `object` structs only.\n */\n mask(value, message) {\n return mask(value, this, message);\n }\n /**\n * Validate a value with the struct's validation logic, returning a tuple\n * representing the result.\n *\n * You may optionally pass `true` for the `coerce` argument to coerce\n * the value before attempting to validate it. If you do, the result will\n * contain the coerced result when successful. Also, `mask` will turn on\n * masking of the unknown `object` props recursively if passed.\n */\n validate(value, options = {}) {\n return validate(value, this, options);\n }\n}\n/**\n * Assert that a value passes a struct, throwing if it doesn't.\n */\nfunction assert(value, struct, message) {\n const result = validate(value, struct, { message });\n if (result[0]) {\n throw result[0];\n }\n}\n/**\n * Create a value with the coercion logic of struct and validate it.\n */\nfunction create(value, struct, message) {\n const result = validate(value, struct, { coerce: true, message });\n if (result[0]) {\n throw result[0];\n }\n else {\n return result[1];\n }\n}\n/**\n * Mask a value, returning only the subset of properties defined by a struct.\n */\nfunction mask(value, struct, message) {\n const result = validate(value, struct, { coerce: true, mask: true, message });\n if (result[0]) {\n throw result[0];\n }\n else {\n return result[1];\n }\n}\n/**\n * Check if a value passes a struct.\n */\nfunction is(value, struct) {\n const result = validate(value, struct);\n return !result[0];\n}\n/**\n * Validate a value against a struct, returning an error if invalid, or the\n * value (with potential coercion) if valid.\n */\nfunction validate(value, struct, options = {}) {\n const tuples = run(value, struct, options);\n const tuple = shiftIterator(tuples);\n if (tuple[0]) {\n const error = new StructError(tuple[0], function* () {\n for (const t of tuples) {\n if (t[0]) {\n yield t[0];\n }\n }\n });\n return [error, undefined];\n }\n else {\n const v = tuple[1];\n return [undefined, v];\n }\n}\n\nfunction assign(...Structs) {\n const isType = Structs[0].type === 'type';\n const schemas = Structs.map((s) => s.schema);\n const schema = Object.assign({}, ...schemas);\n return isType ? type(schema) : object(schema);\n}\n/**\n * Define a new struct type with a custom validation function.\n */\nfunction define(name, validator) {\n return new Struct({ type: name, schema: null, validator });\n}\n/**\n * Create a new struct based on an existing struct, but the value is allowed to\n * be `undefined`. `log` will be called if the value is not `undefined`.\n */\nfunction deprecated(struct, log) {\n return new Struct({\n ...struct,\n refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx),\n validator(value, ctx) {\n if (value === undefined) {\n return true;\n }\n else {\n log(value, ctx);\n return struct.validator(value, ctx);\n }\n },\n });\n}\n/**\n * Create a struct with dynamic validation logic.\n *\n * The callback will receive the value currently being validated, and must\n * return a struct object to validate it with. This can be useful to model\n * validation logic that changes based on its input.\n */\nfunction dynamic(fn) {\n return new Struct({\n type: 'dynamic',\n schema: null,\n *entries(value, ctx) {\n const struct = fn(value, ctx);\n yield* struct.entries(value, ctx);\n },\n validator(value, ctx) {\n const struct = fn(value, ctx);\n return struct.validator(value, ctx);\n },\n coercer(value, ctx) {\n const struct = fn(value, ctx);\n return struct.coercer(value, ctx);\n },\n refiner(value, ctx) {\n const struct = fn(value, ctx);\n return struct.refiner(value, ctx);\n },\n });\n}\n/**\n * Create a struct with lazily evaluated validation logic.\n *\n * The first time validation is run with the struct, the callback will be called\n * and must return a struct object to use. This is useful for cases where you\n * want to have self-referential structs for nested data structures to avoid a\n * circular definition problem.\n */\nfunction lazy(fn) {\n let struct;\n return new Struct({\n type: 'lazy',\n schema: null,\n *entries(value, ctx) {\n struct ?? (struct = fn());\n yield* struct.entries(value, ctx);\n },\n validator(value, ctx) {\n struct ?? (struct = fn());\n return struct.validator(value, ctx);\n },\n coercer(value, ctx) {\n struct ?? (struct = fn());\n return struct.coercer(value, ctx);\n },\n refiner(value, ctx) {\n struct ?? (struct = fn());\n return struct.refiner(value, ctx);\n },\n });\n}\n/**\n * Create a new struct based on an existing object struct, but excluding\n * specific properties.\n *\n * Like TypeScript's `Omit` utility.\n */\nfunction omit(struct, keys) {\n const { schema } = struct;\n const subschema = { ...schema };\n for (const key of keys) {\n delete subschema[key];\n }\n switch (struct.type) {\n case 'type':\n return type(subschema);\n default:\n return object(subschema);\n }\n}\n/**\n * Create a new struct based on an existing object struct, but with all of its\n * properties allowed to be `undefined`.\n *\n * Like TypeScript's `Partial` utility.\n */\nfunction partial(struct) {\n const isStruct = struct instanceof Struct;\n const schema = isStruct ? { ...struct.schema } : { ...struct };\n for (const key in schema) {\n schema[key] = optional(schema[key]);\n }\n if (isStruct && struct.type === 'type') {\n return type(schema);\n }\n return object(schema);\n}\n/**\n * Create a new struct based on an existing object struct, but only including\n * specific properties.\n *\n * Like TypeScript's `Pick` utility.\n */\nfunction pick(struct, keys) {\n const { schema } = struct;\n const subschema = {};\n for (const key of keys) {\n subschema[key] = schema[key];\n }\n switch (struct.type) {\n case 'type':\n return type(subschema);\n default:\n return object(subschema);\n }\n}\n/**\n * Define a new struct type with a custom validation function.\n *\n * @deprecated This function has been renamed to `define`.\n */\nfunction struct(name, validator) {\n console.warn('superstruct@0.11 - The `struct` helper has been renamed to `define`.');\n return define(name, validator);\n}\n\n/**\n * Ensure that any value passes validation.\n */\nfunction any() {\n return define('any', () => true);\n}\nfunction array(Element) {\n return new Struct({\n type: 'array',\n schema: Element,\n *entries(value) {\n if (Element && Array.isArray(value)) {\n for (const [i, v] of value.entries()) {\n yield [i, v, Element];\n }\n }\n },\n coercer(value) {\n return Array.isArray(value) ? value.slice() : value;\n },\n validator(value) {\n return (Array.isArray(value) ||\n `Expected an array value, but received: ${print(value)}`);\n },\n });\n}\n/**\n * Ensure that a value is a bigint.\n */\nfunction bigint() {\n return define('bigint', (value) => {\n return typeof value === 'bigint';\n });\n}\n/**\n * Ensure that a value is a boolean.\n */\nfunction boolean() {\n return define('boolean', (value) => {\n return typeof value === 'boolean';\n });\n}\n/**\n * Ensure that a value is a valid `Date`.\n *\n * Note: this also ensures that the value is *not* an invalid `Date` object,\n * which can occur when parsing a date fails but still returns a `Date`.\n */\nfunction date() {\n return define('date', (value) => {\n return ((value instanceof Date && !isNaN(value.getTime())) ||\n `Expected a valid \\`Date\\` object, but received: ${print(value)}`);\n });\n}\nfunction enums(values) {\n const schema = {};\n const description = values.map((v) => print(v)).join();\n for (const key of values) {\n schema[key] = key;\n }\n return new Struct({\n type: 'enums',\n schema,\n validator(value) {\n return (values.includes(value) ||\n `Expected one of \\`${description}\\`, but received: ${print(value)}`);\n },\n });\n}\n/**\n * Ensure that a value is a function.\n */\nfunction func() {\n return define('func', (value) => {\n return (typeof value === 'function' ||\n `Expected a function, but received: ${print(value)}`);\n });\n}\n/**\n * Ensure that a value is an instance of a specific class.\n */\nfunction instance(Class) {\n return define('instance', (value) => {\n return (value instanceof Class ||\n `Expected a \\`${Class.name}\\` instance, but received: ${print(value)}`);\n });\n}\n/**\n * Ensure that a value is an integer.\n */\nfunction integer() {\n return define('integer', (value) => {\n return ((typeof value === 'number' && !isNaN(value) && Number.isInteger(value)) ||\n `Expected an integer, but received: ${print(value)}`);\n });\n}\n/**\n * Ensure that a value matches all of a set of types.\n */\nfunction intersection(Structs) {\n return new Struct({\n type: 'intersection',\n schema: null,\n *entries(value, ctx) {\n for (const S of Structs) {\n yield* S.entries(value, ctx);\n }\n },\n *validator(value, ctx) {\n for (const S of Structs) {\n yield* S.validator(value, ctx);\n }\n },\n *refiner(value, ctx) {\n for (const S of Structs) {\n yield* S.refiner(value, ctx);\n }\n },\n });\n}\nfunction literal(constant) {\n const description = print(constant);\n const t = typeof constant;\n return new Struct({\n type: 'literal',\n schema: t === 'string' || t === 'number' || t === 'boolean' ? constant : null,\n validator(value) {\n return (value === constant ||\n `Expected the literal \\`${description}\\`, but received: ${print(value)}`);\n },\n });\n}\nfunction map(Key, Value) {\n return new Struct({\n type: 'map',\n schema: null,\n *entries(value) {\n if (Key && Value && value instanceof Map) {\n for (const [k, v] of value.entries()) {\n yield [k, k, Key];\n yield [k, v, Value];\n }\n }\n },\n coercer(value) {\n return value instanceof Map ? new Map(value) : value;\n },\n validator(value) {\n return (value instanceof Map ||\n `Expected a \\`Map\\` object, but received: ${print(value)}`);\n },\n });\n}\n/**\n * Ensure that no value ever passes validation.\n */\nfunction never() {\n return define('never', () => false);\n}\n/**\n * Augment an existing struct to allow `null` values.\n */\nfunction nullable(struct) {\n return new Struct({\n ...struct,\n validator: (value, ctx) => value === null || struct.validator(value, ctx),\n refiner: (value, ctx) => value === null || struct.refiner(value, ctx),\n });\n}\n/**\n * Ensure that a value is a number.\n */\nfunction number() {\n return define('number', (value) => {\n return ((typeof value === 'number' && !isNaN(value)) ||\n `Expected a number, but received: ${print(value)}`);\n });\n}\nfunction object(schema) {\n const knowns = schema ? Object.keys(schema) : [];\n const Never = never();\n return new Struct({\n type: 'object',\n schema: schema ? schema : null,\n *entries(value) {\n if (schema && isObject(value)) {\n const unknowns = new Set(Object.keys(value));\n for (const key of knowns) {\n unknowns.delete(key);\n yield [key, value[key], schema[key]];\n }\n for (const key of unknowns) {\n yield [key, value[key], Never];\n }\n }\n },\n validator(value) {\n return (isNonArrayObject(value) ||\n `Expected an object, but received: ${print(value)}`);\n },\n coercer(value, ctx) {\n if (!isNonArrayObject(value)) {\n return value;\n }\n const coerced = { ...value };\n // The `object` struct has special behaviour enabled by the mask flag.\n // When masking, properties that are not in the schema are deleted from\n // the coerced object instead of eventually failing validaiton.\n if (ctx.mask && schema) {\n for (const key in coerced) {\n if (schema[key] === undefined) {\n delete coerced[key];\n }\n }\n }\n return coerced;\n },\n });\n}\n/**\n * Augment a struct to allow `undefined` values.\n */\nfunction optional(struct) {\n return new Struct({\n ...struct,\n validator: (value, ctx) => value === undefined || struct.validator(value, ctx),\n refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx),\n });\n}\n/**\n * Ensure that a value is an object with keys and values of specific types, but\n * without ensuring any specific shape of properties.\n *\n * Like TypeScript's `Record` utility.\n */\nfunction record(Key, Value) {\n return new Struct({\n type: 'record',\n schema: null,\n *entries(value) {\n if (isObject(value)) {\n for (const k in value) {\n const v = value[k];\n yield [k, k, Key];\n yield [k, v, Value];\n }\n }\n },\n validator(value) {\n return (isNonArrayObject(value) ||\n `Expected an object, but received: ${print(value)}`);\n },\n coercer(value) {\n return isNonArrayObject(value) ? { ...value } : value;\n },\n });\n}\n/**\n * Ensure that a value is a `RegExp`.\n *\n * Note: this does not test the value against the regular expression! For that\n * you need to use the `pattern()` refinement.\n */\nfunction regexp() {\n return define('regexp', (value) => {\n return value instanceof RegExp;\n });\n}\nfunction set(Element) {\n return new Struct({\n type: 'set',\n schema: null,\n *entries(value) {\n if (Element && value instanceof Set) {\n for (const v of value) {\n yield [v, v, Element];\n }\n }\n },\n coercer(value) {\n return value instanceof Set ? new Set(value) : value;\n },\n validator(value) {\n return (value instanceof Set ||\n `Expected a \\`Set\\` object, but received: ${print(value)}`);\n },\n });\n}\n/**\n * Ensure that a value is a string.\n */\nfunction string() {\n return define('string', (value) => {\n return (typeof value === 'string' ||\n `Expected a string, but received: ${print(value)}`);\n });\n}\n/**\n * Ensure that a value is a tuple of a specific length, and that each of its\n * elements is of a specific type.\n */\nfunction tuple(Structs) {\n const Never = never();\n return new Struct({\n type: 'tuple',\n schema: null,\n *entries(value) {\n if (Array.isArray(value)) {\n const length = Math.max(Structs.length, value.length);\n for (let i = 0; i < length; i++) {\n yield [i, value[i], Structs[i] || Never];\n }\n }\n },\n validator(value) {\n return (Array.isArray(value) ||\n `Expected an array, but received: ${print(value)}`);\n },\n coercer(value) {\n return Array.isArray(value) ? value.slice() : value;\n },\n });\n}\n/**\n * Ensure that a value has a set of known properties of specific types.\n *\n * Note: Unrecognized properties are allowed and untouched. This is similar to\n * how TypeScript's structural typing works.\n */\nfunction type(schema) {\n const keys = Object.keys(schema);\n return new Struct({\n type: 'type',\n schema,\n *entries(value) {\n if (isObject(value)) {\n for (const k of keys) {\n yield [k, value[k], schema[k]];\n }\n }\n },\n validator(value) {\n return (isNonArrayObject(value) ||\n `Expected an object, but received: ${print(value)}`);\n },\n coercer(value) {\n return isNonArrayObject(value) ? { ...value } : value;\n },\n });\n}\n/**\n * Ensure that a value matches one of a set of types.\n */\nfunction union(Structs) {\n const description = Structs.map((s) => s.type).join(' | ');\n return new Struct({\n type: 'union',\n schema: null,\n coercer(value, ctx) {\n for (const S of Structs) {\n const [error, coerced] = S.validate(value, {\n coerce: true,\n mask: ctx.mask,\n });\n if (!error) {\n return coerced;\n }\n }\n return value;\n },\n validator(value, ctx) {\n const failures = [];\n for (const S of Structs) {\n const [...tuples] = run(value, S, ctx);\n const [first] = tuples;\n if (!first[0]) {\n return [];\n }\n else {\n for (const [failure] of tuples) {\n if (failure) {\n failures.push(failure);\n }\n }\n }\n }\n return [\n `Expected the value to satisfy a union of \\`${description}\\`, but received: ${print(value)}`,\n ...failures,\n ];\n },\n });\n}\n/**\n * Ensure that any value passes validation, without widening its type to `any`.\n */\nfunction unknown() {\n return define('unknown', () => true);\n}\n\n/**\n * Augment a `Struct` to add an additional coercion step to its input.\n *\n * This allows you to transform input data before validating it, to increase the\n * likelihood that it passes validation—for example for default values, parsing\n * different formats, etc.\n *\n * Note: You must use `create(value, Struct)` on the value to have the coercion\n * take effect! Using simply `assert()` or `is()` will not use coercion.\n */\nfunction coerce(struct, condition, coercer) {\n return new Struct({\n ...struct,\n coercer: (value, ctx) => {\n return is(value, condition)\n ? struct.coercer(coercer(value, ctx), ctx)\n : struct.coercer(value, ctx);\n },\n });\n}\n/**\n * Augment a struct to replace `undefined` values with a default.\n *\n * Note: You must use `create(value, Struct)` on the value to have the coercion\n * take effect! Using simply `assert()` or `is()` will not use coercion.\n */\nfunction defaulted(struct, fallback, options = {}) {\n return coerce(struct, unknown(), (x) => {\n const f = typeof fallback === 'function' ? fallback() : fallback;\n if (x === undefined) {\n return f;\n }\n if (!options.strict && isPlainObject(x) && isPlainObject(f)) {\n const ret = { ...x };\n let changed = false;\n for (const key in f) {\n if (ret[key] === undefined) {\n ret[key] = f[key];\n changed = true;\n }\n }\n if (changed) {\n return ret;\n }\n }\n return x;\n });\n}\n/**\n * Augment a struct to trim string inputs.\n *\n * Note: You must use `create(value, Struct)` on the value to have the coercion\n * take effect! Using simply `assert()` or `is()` will not use coercion.\n */\nfunction trimmed(struct) {\n return coerce(struct, string(), (x) => x.trim());\n}\n\n/**\n * Ensure that a string, array, map, or set is empty.\n */\nfunction empty(struct) {\n return refine(struct, 'empty', (value) => {\n const size = getSize(value);\n return (size === 0 ||\n `Expected an empty ${struct.type} but received one with a size of \\`${size}\\``);\n });\n}\nfunction getSize(value) {\n if (value instanceof Map || value instanceof Set) {\n return value.size;\n }\n else {\n return value.length;\n }\n}\n/**\n * Ensure that a number or date is below a threshold.\n */\nfunction max(struct, threshold, options = {}) {\n const { exclusive } = options;\n return refine(struct, 'max', (value) => {\n return exclusive\n ? value < threshold\n : value <= threshold ||\n `Expected a ${struct.type} less than ${exclusive ? '' : 'or equal to '}${threshold} but received \\`${value}\\``;\n });\n}\n/**\n * Ensure that a number or date is above a threshold.\n */\nfunction min(struct, threshold, options = {}) {\n const { exclusive } = options;\n return refine(struct, 'min', (value) => {\n return exclusive\n ? value > threshold\n : value >= threshold ||\n `Expected a ${struct.type} greater than ${exclusive ? '' : 'or equal to '}${threshold} but received \\`${value}\\``;\n });\n}\n/**\n * Ensure that a string, array, map or set is not empty.\n */\nfunction nonempty(struct) {\n return refine(struct, 'nonempty', (value) => {\n const size = getSize(value);\n return (size > 0 || `Expected a nonempty ${struct.type} but received an empty one`);\n });\n}\n/**\n * Ensure that a string matches a regular expression.\n */\nfunction pattern(struct, regexp) {\n return refine(struct, 'pattern', (value) => {\n return (regexp.test(value) ||\n `Expected a ${struct.type} matching \\`/${regexp.source}/\\` but received \"${value}\"`);\n });\n}\n/**\n * Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`.\n */\nfunction size(struct, min, max = min) {\n const expected = `Expected a ${struct.type}`;\n const of = min === max ? `of \\`${min}\\`` : `between \\`${min}\\` and \\`${max}\\``;\n return refine(struct, 'size', (value) => {\n if (typeof value === 'number' || value instanceof Date) {\n return ((min <= value && value <= max) ||\n `${expected} ${of} but received \\`${value}\\``);\n }\n else if (value instanceof Map || value instanceof Set) {\n const { size } = value;\n return ((min <= size && size <= max) ||\n `${expected} with a size ${of} but received one with a size of \\`${size}\\``);\n }\n else {\n const { length } = value;\n return ((min <= length && length <= max) ||\n `${expected} with a length ${of} but received one with a length of \\`${length}\\``);\n }\n });\n}\n/**\n * Augment a `Struct` to add an additional refinement to the validation.\n *\n * The refiner function is guaranteed to receive a value of the struct's type,\n * because the struct's existing validation will already have passed. This\n * allows you to layer additional validation on top of existing structs.\n */\nfunction refine(struct, name, refiner) {\n return new Struct({\n ...struct,\n *refiner(value, ctx) {\n yield* struct.refiner(value, ctx);\n const result = refiner(value, ctx);\n const failures = toFailures(result, ctx, struct, value);\n for (const failure of failures) {\n yield { ...failure, refinement: name };\n }\n },\n });\n}\n\nexport { Struct, StructError, any, array, assert, assign, bigint, boolean, coerce, create, date, defaulted, define, deprecated, dynamic, empty, enums, func, instance, integer, intersection, is, lazy, literal, map, mask, max, min, never, nonempty, nullable, number, object, omit, optional, partial, pattern, pick, record, refine, regexp, set, size, string, struct, trimmed, tuple, type, union, unknown, validate };\n//# sourceMappingURL=index.mjs.map\n","import { Buffer } from 'node:buffer'\nimport { LAMPORTS_PER_SOL, PublicKey } from '@solana/web3.js'\n\n// Public key that identifies the metadata program.\nexport const METADATA_PROGRAM_ID = new PublicKey('metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s')\nexport const METADATA_MAX_NAME_LENGTH = 32\nexport const METADATA_MAX_SYMBOL_LENGTH = 10\nexport const METADATA_MAX_URI_LENGTH = 200\n\n// Public key that identifies the SPL Stake Pool program.\nexport const STAKE_POOL_PROGRAM_ID = new PublicKey('SP1s4uFeTAX9jsXXmwyDs1gxYYf7cdDZ8qHUHVxE1yr')\n\n// Public key that identifies the SPL Stake Pool program deployed to devnet.\nexport const DEVNET_STAKE_POOL_PROGRAM_ID = new PublicKey(\n 'DPoo15wWDqpPJJtS2MUZ49aRxqz5ZaaJCJP4z8bLuib',\n)\n\n// Maximum number of validators to update during UpdateValidatorListBalance.\nexport const MAX_VALIDATORS_TO_UPDATE = 4\n\n// Seed for ephemeral stake account\nexport const EPHEMERAL_STAKE_SEED_PREFIX = Buffer.from('ephemeral')\n\n// Seed used to derive transient stake accounts.\nexport const TRANSIENT_STAKE_SEED_PREFIX = Buffer.from('transient')\n\n// Minimum amount of staked SOL required in a validator stake account to allow\n// for merges without a mismatch on credits observed\nexport const MINIMUM_ACTIVE_STAKE = LAMPORTS_PER_SOL\n","import { Buffer } from 'node:buffer'\nimport * as BufferLayout from '@solana/buffer-layout'\n\n/**\n * @internal\n */\nexport type InstructionType = {\n /** The Instruction index (from solana upstream program) */\n index: number\n /** The BufferLayout to use to build data */\n layout: BufferLayout.Layout<any>\n}\n\n/**\n * Populate a buffer of instruction data using an InstructionType\n * @internal\n */\nexport function encodeData(type: InstructionType, fields?: any): Buffer {\n const allocLength = type.layout.span\n const data = Buffer.alloc(allocLength)\n const layoutFields = Object.assign({ instruction: type.index }, fields)\n type.layout.encode(layoutFields, data)\n\n return data\n}\n\n/**\n * Decode instruction data buffer using an InstructionType\n * @internal\n */\nexport function decodeData(type: InstructionType, buffer: Buffer): any {\n let data\n try {\n data = type.layout.decode(buffer)\n } catch (err) {\n throw new Error(`invalid instruction; ${err}`)\n }\n\n if (data.instruction !== type.index) {\n throw new Error(\n `invalid instruction; instruction index mismatch ${data.instruction} != ${type.index}`,\n )\n }\n\n return data\n}\n","import { LAMPORTS_PER_SOL } from '@solana/web3.js'\nimport BN from 'bn.js'\n\nexport function solToLamports(amount: number): number {\n if (isNaN(amount)) {\n return Number(0)\n }\n return Number(amount * LAMPORTS_PER_SOL)\n}\n\nexport function lamportsToSol(lamports: number | BN | bigint): number {\n if (typeof lamports === 'number') {\n return Math.abs(lamports) / LAMPORTS_PER_SOL\n }\n if (typeof lamports === 'bigint') {\n return Math.abs(Number(lamports)) / LAMPORTS_PER_SOL\n }\n\n let signMultiplier = 1\n if (lamports.isNeg()) {\n signMultiplier = -1\n }\n\n const absLamports = lamports.abs()\n const lamportsString = absLamports.toString(10).padStart(10, '0')\n const splitIndex = lamportsString.length - 9\n const solString = `${lamportsString.slice(0, splitIndex)}.${lamportsString.slice(splitIndex)}`\n return signMultiplier * Number.parseFloat(solString)\n}\n","import { Buffer } from 'node:buffer'\nimport { PublicKey } from '@solana/web3.js'\nimport BN from 'bn.js'\nimport {\n EPHEMERAL_STAKE_SEED_PREFIX,\n METADATA_PROGRAM_ID,\n TRANSIENT_STAKE_SEED_PREFIX,\n} from '../constants'\n\n/**\n * Generates the wSOL transient program address for the stake pool\n */\nexport function findWsolTransientProgramAddress(\n programId: PublicKey,\n userPubkey: PublicKey,\n) {\n const [publicKey] = PublicKey.findProgramAddressSync(\n [Buffer.from('transient_wsol'), userPubkey.toBuffer()],\n programId,\n )\n return publicKey\n}\n\n/**\n * Generates the withdraw authority program address for the stake pool\n */\nexport async function findWithdrawAuthorityProgramAddress(\n programId: PublicKey,\n stakePoolAddress: PublicKey,\n) {\n const [publicKey] = PublicKey.findProgramAddressSync(\n [stakePoolAddress.toBuffer(), Buffer.from('withdraw')],\n programId,\n )\n return publicKey\n}\n\n/**\n * Generates the stake program address for a validator's vote account\n */\nexport async function findStakeProgramAddress(\n programId: PublicKey,\n voteAccountAddress: PublicKey,\n stakePoolAddress: PublicKey,\n seed?: number,\n) {\n const [publicKey] = PublicKey.findProgramAddressSync(\n [\n voteAccountAddress.toBuffer(),\n stakePoolAddress.toBuffer(),\n seed ? new BN(seed).toArrayLike(Buffer, 'le', 4) : Buffer.alloc(0),\n ],\n programId,\n )\n return publicKey\n}\n\n/**\n * Generates the stake program address for a validator's vote account\n */\nexport async function findTransientStakeProgramAddress(\n programId: PublicKey,\n voteAccountAddress: PublicKey,\n stakePoolAddress: PublicKey,\n seed: BN,\n) {\n const [publicKey] = PublicKey.findProgramAddressSync(\n [\n TRANSIENT_STAKE_SEED_PREFIX,\n voteAccountAddress.toBuffer(),\n stakePoolAddress.toBuffer(),\n seed.toArrayLike(Buffer, 'le', 8),\n ],\n programId,\n )\n return publicKey\n}\n\n/**\n * Generates the ephemeral program address for stake pool redelegation\n */\nexport async function findEphemeralStakeProgramAddress(\n programId: PublicKey,\n stakePoolAddress: PublicKey,\n seed: BN,\n) {\n const [publicKey] = PublicKey.findProgramAddressSync(\n [EPHEMERAL_STAKE_SEED_PREFIX, stakePoolAddress.toBuffer(), seed.toArrayLike(Buffer, 'le', 8)],\n programId,\n )\n return publicKey\n}\n\n/**\n * Generates the metadata program address for the stake pool\n */\nexport function findMetadataAddress(stakePoolMintAddress: PublicKey) {\n const [publicKey] = PublicKey.findProgramAddressSync(\n [Buffer.from('metadata'), METADATA_PROGRAM_ID.toBuffer(), stakePoolMintAddress.toBuffer()],\n METADATA_PROGRAM_ID,\n )\n return publicKey\n}\n","import { PublicKey } from '@solana/web3.js'\nimport BN from 'bn.js'\nimport { blob, Layout as LayoutCls, offset, seq, struct, u8, u32 } from 'buffer-layout'\n\nexport interface Layout<T> {\n span: number\n property?: string\n\n decode: (b: Buffer, offset?: number) => T\n\n encode: (src: T, b: Buffer, offset?: number) => number\n\n getSpan: (b: Buffer, offset?: number) => number\n\n replicate: (name: string) => this\n}\n\nclass BNLayout extends LayoutCls<BN> {\n blob: Layout<Buffer>\n signed: boolean\n\n constructor(span: number, signed: boolean, property?: string) {\n super(span, property)\n this.blob = blob(span)\n this.signed = signed\n }\n\n decode(b: Buffer, offset = 0) {\n const num = new BN(this.blob.decode(b, offset), 10, 'le')\n if (this.signed) {\n return num.fromTwos(this.span * 8).clone()\n }\n return num\n }\n\n encode(src: BN, b: Buffer, offset = 0) {\n if (this.signed) {\n src = src.toTwos(this.span * 8)\n }\n return this.blob.encode(src.toArrayLike(Buffer, 'le', this.span), b, offset)\n }\n}\n\nexport function u64(property?: string): Layout<BN> {\n return new BNLayout(8, false, property)\n}\n\nclass WrappedLayout<T, U> extends LayoutCls<U> {\n layout: Layout<T>\n decoder: (data: T) => U\n encoder: (src: U) => T\n\n constructor(\n layout: Layout<T>,\n decoder: (data: T) => U,\n encoder: (src: U) => T,\n property?: string,\n ) {\n super(layout.span, property)\n this.layout = layout\n this.decoder = decoder\n this.encoder = encoder\n }\n\n decode(b: Buffer, offset?: number): U {\n return this.decoder(this.layout.decode(b, offset))\n }\n\n encode(src: U, b: Buffer, offset?: number): number {\n return this.layout.encode(this.encoder(src), b, offset)\n }\n\n getSpan(b: Buffer, offset?: number): number {\n return this.layout.getSpan(b, offset)\n }\n}\n\nexport function publicKey(property?: string): Layout<PublicKey> {\n return new WrappedLayout(\n blob(32),\n (b: Buffer) => new PublicKey(b),\n (key: PublicKey) => key.toBuffer(),\n property,\n )\n}\n\nclass OptionLayout<T> extends LayoutCls<T | null> {\n layout: Layout<T>\n discriminator: Layout<number>\n\n constructor(layout: Layout<T>, property?: string) {\n super(-1, property)\n this.layout = layout\n this.discriminator = u8()\n }\n\n encode(src: T | null, b: Buffer, offset = 0): number {\n if (src === null || src === undefined) {\n return this.discriminator.encode(0, b, offset)\n }\n this.discriminator.encode(1, b, offset)\n return this.layout.encode(src, b, offset + 1) + 1\n }\n\n decode(b: Buffer, offset = 0): T | null {\n const discriminator = this.discriminator.decode(b, offset)\n if (discriminator === 0) {\n return null\n } else if (discriminator === 1) {\n return this.layout.decode(b, offset + 1)\n }\n throw new Error(`Invalid option ${this.property}`)\n }\n\n getSpan(b: Buffer, offset = 0): number {\n const discriminator = this.discriminator.decode(b, offset)\n if (discriminator === 0) {\n return 1\n } else if (discriminator === 1) {\n return this.layout.getSpan(b, offset + 1) + 1\n }\n throw new Error(`Invalid option ${this.property}`)\n }\n}\n\nexport function option<T>(layout: Layout<T>, property?: string): Layout<T | null> {\n return new OptionLayout<T>(layout, property)\n}\n\nexport function bool(property?: string): Layout<boolean> {\n return new WrappedLayout(u8(), decodeBool, encodeBool, property)\n}\n\nfunction decodeBool(value: number): boolean {\n if (value === 0) {\n return false\n } else if (value === 1) {\n return true\n }\n throw new Error(`Invalid bool: ${value}`)\n}\n\nfunction encodeBool(value: boolean): number {\n return value ? 1 : 0\n}\n\nexport function vec<T>(elementLayout: Layout<T>, property?: string): Layout<T[]> {\n const length = u32('length')\n const layout: Layout<{ values: T[] }> = struct([\n length,\n seq(elementLayout, offset(length, -length.span), 'values'),\n ])\n return new WrappedLayout(\n layout,\n ({ values }) => values,\n values => ({ values }),\n property,\n )\n}\n","import { PublicKey } from '@solana/web3.js'\nimport BN from 'bn.js'\nimport { Layout as LayoutCls, struct, u8, u32 } from 'buffer-layout'\nimport {\n coerce,\n enums,\n Infer,\n instance,\n nullable,\n number,\n optional,\n string,\n type,\n} from 'superstruct'\nimport { Layout, option, publicKey, u64, vec } from './codecs'\n\nexport interface Fee {\n denominator: BN\n numerator: BN\n}\n\nconst feeFields = [u64('denominator'), u64('numerator')]\n\nexport enum AccountType {\n Uninitialized,\n StakePool,\n ValidatorList,\n}\n\nexport const BigNumFromString = coerce(instance(BN), string(), (value) => {\n if (typeof value === 'string') {\n return new BN(value, 10)\n }\n throw new Error('invalid big num')\n})\n\nexport const PublicKeyFromString = coerce(\n instance(PublicKey),\n string(),\n value => new PublicKey(value),\n)\n\nexport class FutureEpochLayout<T> extends LayoutCls<T | null> {\n layout: Layout<T>\n discriminator: Layout<number>\n\n constructor(layout: Layout<T>, property?: string) {\n super(-1, property)\n this.layout = layout\n this.discriminator = u8()\n }\n\n encode(src: T | null, b: Buffer, offset = 0): number {\n if (src === null || src === undefined) {\n return this.discriminator.encode(0, b, offset)\n }\n // This isn't right, but we don't typically encode outside of tests\n this.discriminator.encode(2, b, offset)\n return this.layout.encode(src, b, offset + 1) + 1\n }\n\n decode(b: Buffer, offset = 0): T | null {\n const discriminator = this.discriminator.decode(b, offset)\n if (discriminator === 0) {\n return null\n } else if (discriminator === 1 || discriminator === 2) {\n return this.layout.decode(b, offset + 1)\n }\n throw new Error(`Invalid future epoch ${this.property}`)\n }\n\n getSpan(b: Buffer, offset = 0): number {\n const discriminator = this.discriminator.decode(b, offset)\n if (discriminator === 0) {\n return 1\n } else if (discriminator === 1 || discriminator === 2) {\n return this.layout.getSpan(b, offset + 1) + 1\n }\n throw new Error(`Invalid future epoch ${this.property}`)\n }\n}\n\nexport function futureEpoch<T>(layout: Layout<T>, property?: string): LayoutCls<T | null> {\n return new FutureEpochLayout<T>(layout, property)\n}\n\nexport type StakeAccountType = Infer<typeof StakeAccountType>\nexport const StakeAccountType = enums(['uninitialized', 'initialized', 'delegated', 'rewardsPool'])\n\nexport type StakeMeta = Infer<typeof StakeMeta>\nexport const StakeMeta = type({\n rentExemptReserve: BigNumFromString,\n authorized: type({\n staker: PublicKeyFromString,\n withdrawer: PublicKeyFromString,\n }),\n lockup: type({\n unixTimestamp: number(),\n epoch: number(),\n custodian: PublicKeyFromString,\n }),\n})\n\nexport type StakeAccountInfo = Infer<typeof StakeAccountInfo>\nexport const StakeAccountInfo = type({\n meta: StakeMeta,\n stake: nullable(\n type({\n delegation: type({\n voter: PublicKeyFromString,\n stake: BigNumFromString,\n activationEpoch: BigNumFromString,\n deactivationEpoch: BigNumFromString,\n warmupCooldownRate: number(),\n }),\n creditsObserved: number(),\n }),\n ),\n})\n\nexport type StakeAccount = Infer<typeof StakeAccount>\nexport const StakeAccount = type({\n type: StakeAccountType,\n info: optional(StakeAccountInfo),\n})\nexport interface Lockup {\n unixTimestamp: BN\n epoch: BN\n custodian: PublicKey\n}\n\nexport interface StakePool {\n accountType: AccountType\n manager: PublicKey\n staker: PublicKey\n stakeDepositAuthority: PublicKey\n stakeWithdrawBumpSeed: number\n validatorList: PublicKey\n reserveStake: PublicKey\n poolMint: PublicKey\n managerFeeAccount: PublicKey\n tokenProgramId: PublicKey\n totalLamports: BN\n poolTokenSupply: BN\n lastUpdateEpoch: BN\n lockup: Lockup\n epochFee: Fee\n nextEpochFee?: Fee | undefined\n preferredDepositValidatorVoteAddress?: PublicKey | undefined\n preferredWithdrawValidatorVoteAddress?: PublicKey | undefined\n stakeDepositFee: Fee\n stakeWithdrawalFee: Fee\n nextStakeWithdrawalFee?: Fee | undefined\n stakeReferralFee: number\n solDepositAuthority?: PublicKey | undefined\n solDepositFee: Fee\n solReferralFee: number\n solWithdrawAuthority?: PublicKey | undefined\n solWithdrawalFee: Fee\n nextSolWithdrawalFee?: Fee | undefined\n lastEpochPoolTokenSupply: BN\n lastEpochTotalLamports: BN\n}\n\nexport const StakePoolLayout = struct<StakePool>([\n u8('accountType'),\n publicKey('manager'),\n publicKey('staker'),\n publicKey('stakeDepositAuthority'),\n u8('stakeWithdrawBumpSeed'),\n publicKey('validatorList'),\n publicKey('reserveStake'),\n publicKey('poolMint'),\n publicKey('managerFeeAccount'),\n publicKey('tokenProgramId'),\n u64('totalLamports'),\n u64('poolTokenSupply'),\n u64('lastUpdateEpoch'),\n struct([u64('unixTimestamp'), u64('epoch'), publicKey('custodian')], 'lockup'),\n struct(feeFields, 'epochFee'),\n futureEpoch(struct(feeFields), 'nextEpochFee'),\n option(publicKey(), 'preferredDepositValidatorVoteAddress'),\n option(publicKey(), 'preferredWithdrawValidatorVoteAddress'),\n struct(feeFields, 'stakeDepositFee'),\n struct(feeFields, 'stakeWithdrawalFee'),\n futureEpoch(struct(feeFields), 'nextStakeWithdrawalFee'),\n u8('stakeReferralFee'),\n option(publicKey(), 'solDepositAuthority'),\n struct(feeFields, 'solDepositFee'),\n u8('solReferralFee'),\n option(publicKey(), 'solWithdrawAuthority'),\n struct(feeFields, 'solWithdrawalFee'),\n futureEpoch(struct(feeFields), 'nextSolWithdrawalFee'),\n u64('lastEpochPoolTokenSupply'),\n u64('lastEpochTotalLamports'),\n])\n\nexport enum ValidatorStakeInfoStatus {\n Active,\n DeactivatingTransient,\n ReadyForRemoval,\n}\n\nexport interface ValidatorStakeInfo {\n status: ValidatorStakeInfoStatus\n voteAccountAddress: PublicKey\n activeStakeLamports: BN\n transientStakeLamports: BN\n transientSeedSuffixStart: BN\n transientSeedSuffixEnd: BN\n lastUpdateEpoch: BN\n}\n\nexport const ValidatorStakeInfoLayout = struct<ValidatorStakeInfo>([\n /// Amount of active stake delegated to this validator\n /// Note that if `last_update_epoch` does not match the current epoch then\n /// this field may not be accurate\n u64('activeStakeLamports'),\n /// Amount of transient stake delegated to this validator\n /// Note that if `last_update_epoch` does not match the current epoch then\n /// this field may not be accurate\n u64('transientStakeLamports'),\n /// Last epoch the active and transient stake lamports fields were updated\n u64('lastUpdateEpoch'),\n /// Start of the validator transient account seed suffixes\n u64('transientSeedSuffixStart'),\n /// End of the validator transient account seed suffixes\n u64('transientSeedSuffixEnd'),\n /// Status of the validator stake account\n u8('status'),\n /// Validator vote account address\n publicKey('voteAccountAddress'),\n])\n\nexport interface ValidatorList {\n /// Account type, must be ValidatorList currently\n accountType: number\n /// Maximum allowable number of validators\n maxValidators: number\n /// List of stake info for each validator in the pool\n validators: ValidatorStakeInfo[]\n}\n\nexport const ValidatorListLayout = struct<ValidatorList>([\n u8('accountType'),\n u32('maxValidators'),\n vec(ValidatorStakeInfoLayout, 'validators'),\n])\n","import {\n Connection,\n Keypair,\n PublicKey,\n StakeProgram,\n SystemProgram,\n TransactionInstruction,\n} from '@solana/web3.js'\nimport BN from 'bn.js'\nimport { MINIMUM_ACTIVE_STAKE } from '../constants'\n\nimport { getStakePoolProgramId, WithdrawAccount } from '../index'\nimport {\n Fee,\n StakePool,\n ValidatorList,\n ValidatorListLayout,\n ValidatorStakeInfoStatus,\n} from '../layouts'\nimport { lamportsToSol } from './math'\nimport { findStakeProgramAddress, findTransientStakeProgramAddress } from './program-address'\n\nexport async function getValidatorListAccount(connection: Connection, pubkey: PublicKey) {\n const account = await connection.getAccountInfo(pubkey)\n if (!account) {\n throw new Error('Invalid validator list account')\n }\n\n return {\n pubkey,\n account: {\n data: ValidatorListLayout.decode(account?.data) as ValidatorList,\n executable: account.executable,\n lamports: account.lamports,\n owner: account.owner,\n },\n }\n}\n\nexport interface ValidatorAccount {\n type: 'preferred' | 'active' | 'transient' | 'reserve'\n voteAddress?: PublicKey | undefined\n stakeAddress: PublicKey\n lamports: BN\n}\n\nexport async function prepareWithdrawAccounts(\n connection: Connection,\n stakePool: StakePool,\n stakePoolAddress: PublicKey,\n amount: BN,\n compareFn?: (a: ValidatorAccount, b: ValidatorAccount) => number,\n skipFee?: boolean,\n): Promise<WithdrawAccount[]> {\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const validatorListAcc = await connection.getAccountInfo(stakePool.validatorList)\n const validatorList = ValidatorListLayout.decode(validatorListAcc?.data) as ValidatorList\n\n if (!validatorList?.validators || validatorList?.validators.length == 0) {\n throw new Error('No accounts found')\n }\n\n const minBalanceForRentExemption = await connection.getMinimumBalanceForRentExemption(\n StakeProgram.space,\n )\n const minBalance = new BN(minBalanceForRentExemption + MINIMUM_ACTIVE_STAKE)\n\n let accounts = [] as Array<{\n type: 'preferred' | 'active' | 'transient' | 'reserve'\n voteAddress?: PublicKey | undefined\n stakeAddress: PublicKey\n lamports: BN\n }>\n\n // Prepare accounts\n for (const validator of validatorList.validators) {\n if (validator.status !== ValidatorStakeInfoStatus.Active) {\n continue\n }\n\n const stakeAccountAddress = await findStakeProgramAddress(\n stakePoolProgramId,\n validator.voteAccountAddress,\n stakePoolAddress,\n )\n\n if (!validator.activeStakeLamports.isZero()) {\n const isPreferred = stakePool?.preferredWithdrawValidatorVoteAddress?.equals(\n validator.voteAccountAddress,\n )\n accounts.push({\n type: isPreferred ? 'preferred' : 'active',\n voteAddress: validator.voteAccountAddress,\n stakeAddress: stakeAccountAddress,\n lamports: validator.activeStakeLamports,\n })\n }\n\n const transientStakeLamports = validator.transientStakeLamports.sub(minBalance)\n if (transientStakeLamports.gt(new BN(0))) {\n const transientStakeAccountAddress = await findTransientStakeProgramAddress(\n stakePoolProgramId,\n validator.voteAccountAddress,\n stakePoolAddress,\n validator.transientSeedSuffixStart,\n )\n accounts.push({\n type: 'transient',\n voteAddress: validator.voteAccountAddress,\n stakeAddress: transientStakeAccountAddress,\n lamports: transientStakeLamports,\n })\n }\n }\n\n // Sort from highest to lowest balance\n accounts = accounts.sort(compareFn || ((a, b) => b.lamports.sub(a.lamports).toNumber()))\n\n const reserveStake = await connection.getAccountInfo(stakePool.reserveStake)\n const reserveStakeBalance = new BN((reserveStake?.lamports ?? 0) - minBalanceForRentExemption)\n if (reserveStakeBalance.gt(new BN(0))) {\n accounts.push({\n type: 'reserve',\n stakeAddress: stakePool.reserveStake,\n lamports: reserveStakeBalance,\n })\n }\n\n // Prepare the list of accounts to withdraw from\n const withdrawFrom: WithdrawAccount[] = []\n let remainingAmount = new BN(amount)\n\n const fee = stakePool.stakeWithdrawalFee\n const inverseFee: Fee = {\n numerator: fee.denominator.sub(fee.numerator),\n denominator: fee.denominator,\n }\n\n for (const type of ['preferred', 'active', 'transient', 'reserve']) {\n const filteredAccounts = accounts.filter(a => a.type == type)\n\n for (const { stakeAddress, voteAddress, lamports } of filteredAccounts) {\n if (lamports.lte(minBalance) && type == 'transient') {\n continue\n }\n\n let availableForWithdrawal = calcPoolTokensForDeposit(stakePool, lamports)\n\n if (!skipFee && !inverseFee.numerator.isZero()) {\n availableForWithdrawal = availableForWithdrawal\n .mul(inverseFee.denominator)\n .div(inverseFee.numerator)\n }\n\n const poolAmount = BN.min(availableForWithdrawal, remainingAmount)\n if (poolAmount.lte(new BN(0))) {\n continue\n }\n\n // Those accounts will be withdrawn completely with `claim` instruction\n withdrawFrom.push({ stakeAddress, voteAddress, poolAmount })\n remainingAmount = remainingAmount.sub(poolAmount)\n\n if (remainingAmount.isZero()) {\n break\n }\n }\n\n if (remainingAmount.isZero()) {\n break\n }\n }\n\n // Not enough stake to withdraw the specified amount\n if (remainingAmount.gt(new BN(0))) {\n throw new Error(\n `No stake accounts found in this pool with enough balance to withdraw ${lamportsToSol(\n amount,\n )} pool tokens.`,\n )\n }\n\n return withdrawFrom\n}\n\n/**\n * Calculate the pool tokens that should be minted for a deposit of `stakeLamports`\n */\nexport function calcPoolTokensForDeposit(stakePool: StakePool, stakeLamports: BN): BN {\n if (stakePool.poolTokenSupply.isZero() || stakePool.totalLamports.isZero()) {\n return stakeLamports\n }\n const numerator = stakeLamports.mul(stakePool.poolTokenSupply)\n return numerator.div(stakePool.totalLamports)\n}\n\n/**\n * Calculate lamports amount on withdrawal\n */\nexport function calcLamportsWithdrawAmount(stakePool: StakePool, poolTokens: BN): BN {\n const numerator = poolTokens.mul(stakePool.totalLamports)\n const denominator = stakePool.poolTokenSupply\n if (numerator.lt(denominator)) {\n return new BN(0)\n }\n return numerator.div(denominator)\n}\n\nexport function newStakeAccount(\n feePayer: PublicKey,\n instructions: TransactionInstruction[],\n lamports: number,\n): Keypair {\n // Account for tokens not specified, creating one\n const stakeReceiverKeypair = Keypair.generate()\n console.log(`Creating account to receive stake ${stakeReceiverKeypair.publicKey}`)\n\n instructions.push(\n // Creating new account\n SystemProgram.createAccount({\n fromPubkey: feePayer,\n newAccountPubkey: stakeReceiverKeypair.publicKey,\n lamports,\n space: StakeProgram.space,\n programId: StakeProgram.programId,\n }),\n )\n\n return stakeReceiverKeypair\n}\n","export * from './instruction'\nexport * from './math'\nexport * from './program-address'\nexport * from './stake'\n\nexport function arrayChunk(array: any[], size: number): any[] {\n const result = []\n for (let i = 0; i < array.length; i += size) {\n result.push(array.slice(i, i + size))\n }\n return result\n}\n","import * as BufferLayout from '@solana/buffer-layout'\nimport { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '@solana/spl-token'\nimport {\n PublicKey,\n STAKE_CONFIG_ID,\n StakeProgram,\n SystemProgram,\n SYSVAR_CLOCK_PUBKEY,\n SYSVAR_RENT_PUBKEY,\n SYSVAR_STAKE_HISTORY_PUBKEY,\n TransactionInstruction,\n} from '@solana/web3.js'\nimport {\n DEVNET_STAKE_POOL_PROGRAM_ID,\n METADATA_MAX_NAME_LENGTH,\n METADATA_MAX_SYMBOL_LENGTH,\n METADATA_MAX_URI_LENGTH,\n METADATA_PROGRAM_ID,\n STAKE_POOL_PROGRAM_ID,\n} from './constants'\nimport { decodeData, encodeData, InstructionType } from './utils'\n\n/**\n * An enumeration of valid StakePoolInstructionType's\n */\nexport type StakePoolInstructionType\n = | 'IncreaseValidatorStake'\n | 'DecreaseValidatorStake'\n | 'UpdateValidatorListBalance'\n | 'UpdateStakePoolBalance'\n | 'CleanupRemovedValidatorEntries'\n | 'DepositStake'\n | 'DepositSol'\n | 'WithdrawStake'\n | 'WithdrawSol'\n | 'IncreaseAdditionalValidatorStake'\n | 'DecreaseAdditionalValidatorStake'\n | 'DecreaseValidatorStakeWithReserve'\n | 'Redelegate'\n | 'AddValidatorToPool'\n | 'RemoveValidatorFromPool'\n | 'DepositWsolWithSession'\n | 'WithdrawWsolWithSession'\n\n// 'UpdateTokenMetadata' and 'CreateTokenMetadata' have dynamic layouts\n\nconst MOVE_STAKE_LAYOUT = BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamports'),\n BufferLayout.ns64('transientStakeSeed'),\n])\n\nconst UPDATE_VALIDATOR_LIST_BALANCE_LAYOUT = BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.u32('startIndex'),\n BufferLayout.u8('noMerge'),\n])\n\nexport function tokenMetadataLayout(\n instruction: number,\n nameLength: number,\n symbolLength: number,\n uriLength: number,\n) {\n if (nameLength > METADATA_MAX_NAME_LENGTH) {\n // eslint-disable-next-line no-throw-literal\n throw 'maximum token name length is 32 characters'\n }\n\n if (symbolLength > METADATA_MAX_SYMBOL_LENGTH) {\n // eslint-disable-next-line no-throw-literal\n throw 'maximum token symbol length is 10 characters'\n }\n\n if (uriLength > METADATA_MAX_URI_LENGTH) {\n // eslint-disable-next-line no-throw-literal\n throw 'maximum token uri length is 200 characters'\n }\n\n return {\n index: instruction,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.u32('nameLen'),\n BufferLayout.blob(nameLength, 'name'),\n BufferLayout.u32('symbolLen'),\n BufferLayout.blob(symbolLength, 'symbol'),\n BufferLayout.u32('uriLen'),\n BufferLayout.blob(uriLength, 'uri'),\n ]),\n }\n}\n\n/**\n * An enumeration of valid stake InstructionType's\n * @internal\n */\nexport const STAKE_POOL_INSTRUCTION_LAYOUTS: {\n [type in StakePoolInstructionType]: InstructionType;\n} = Object.freeze({\n AddValidatorToPool: {\n index: 1,\n layout: BufferLayout.struct<any>([BufferLayout.u8('instruction'), BufferLayout.u32('seed')]),\n },\n RemoveValidatorFromPool: {\n index: 2,\n layout: BufferLayout.struct<any>([BufferLayout.u8('instruction')]),\n },\n DecreaseValidatorStake: {\n index: 3,\n layout: MOVE_STAKE_LAYOUT,\n },\n IncreaseValidatorStake: {\n index: 4,\n layout: MOVE_STAKE_LAYOUT,\n },\n UpdateValidatorListBalance: {\n index: 6,\n layout: UPDATE_VALIDATOR_LIST_BALANCE_LAYOUT,\n },\n UpdateStakePoolBalance: {\n index: 7,\n layout: BufferLayout.struct<any>([BufferLayout.u8('instruction')]),\n },\n CleanupRemovedValidatorEntries: {\n index: 8,\n layout: BufferLayout.struct<any>([BufferLayout.u8('instruction')]),\n },\n DepositStake: {\n index: 9,\n layout: BufferLayout.struct<any>([BufferLayout.u8('instruction')]),\n },\n /// Withdraw the token from the pool at the current ratio.\n WithdrawStake: {\n index: 10,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('poolTokens'),\n ]),\n },\n /// Deposit SOL directly into the pool's reserve account. The output is a \"pool\" token\n /// representing ownership into the pool. Inputs are converted to the current ratio.\n DepositSol: {\n index: 14,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamports'),\n ]),\n },\n /// Withdraw SOL directly from the pool's reserve account. Fails if the\n /// reserve does not have enough SOL.\n WithdrawSol: {\n index: 16,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('poolTokens'),\n ]),\n },\n IncreaseAdditionalValidatorStake: {\n index: 19,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamports'),\n BufferLayout.ns64('transientStakeSeed'),\n BufferLayout.ns64('ephemeralStakeSeed'),\n ]),\n },\n DecreaseAdditionalValidatorStake: {\n index: 20,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamports'),\n BufferLayout.ns64('transientStakeSeed'),\n BufferLayout.ns64('ephemeralStakeSeed'),\n ]),\n },\n DecreaseValidatorStakeWithReserve: {\n index: 21,\n layout: MOVE_STAKE_LAYOUT,\n },\n Redelegate: {\n index: 22,\n layout: BufferLayout.struct<any>([BufferLayout.u8('instruction')]),\n },\n DepositStakeWithSlippage: {\n index: 23,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamports'),\n ]),\n },\n WithdrawStakeWithSlippage: {\n index: 24,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamports'),\n ]),\n },\n DepositSolWithSlippage: {\n index: 25,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamports'),\n ]),\n },\n WithdrawSolWithSlippage: {\n index: 26,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamports'),\n ]),\n },\n DepositWsolWithSession: {\n index: 27,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('lamportsIn'),\n BufferLayout.ns64('minimumPoolTokensOut'),\n ]),\n },\n WithdrawWsolWithSession: {\n index: 28,\n layout: BufferLayout.struct<any>([\n BufferLayout.u8('instruction'),\n BufferLayout.ns64('poolTokensIn'),\n BufferLayout.ns64('minimumLamportsOut'),\n ]),\n },\n})\n\n/**\n * Cleans up validator stake account entries marked as `ReadyForRemoval`\n */\nexport type CleanupRemovedValidatorEntriesParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n validatorList: PublicKey\n}\n\n/**\n * Updates balances of validator and transient stake accounts in the pool.\n */\nexport type UpdateValidatorListBalanceParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n withdrawAuthority: PublicKey\n validatorList: PublicKey\n reserveStake: PublicKey\n validatorAndTransientStakePairs: PublicKey[]\n startIndex: number\n noMerge: boolean\n}\n\n/**\n * Updates total pool balance based on balances in the reserve and validator list.\n */\nexport type UpdateStakePoolBalanceParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n withdrawAuthority: PublicKey\n validatorList: PublicKey\n reserveStake: PublicKey\n managerFeeAccount: PublicKey\n poolMint: PublicKey\n}\n\n/**\n * (Staker only) Decrease active stake on a validator, eventually moving it to the reserve\n */\nexport type DecreaseValidatorStakeParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n staker: PublicKey\n withdrawAuthority: PublicKey\n validatorList: PublicKey\n validatorStake: PublicKey\n transientStake: PublicKey\n // Amount of lamports to split into the transient stake account\n lamports: number\n // Seed to used to create the transient stake account\n transientStakeSeed: number\n}\n\nexport interface DecreaseValidatorStakeWithReserveParams extends DecreaseValidatorStakeParams {\n reserveStake: PublicKey\n}\n\nexport interface DecreaseAdditionalValidatorStakeParams extends DecreaseValidatorStakeParams {\n reserveStake: PublicKey\n ephemeralStake: PublicKey\n ephemeralStakeSeed: number\n}\n\n/**\n * (Staker only) Increase stake on a validator from the reserve account.\n */\nexport type IncreaseValidatorStakeParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n staker: PublicKey\n withdrawAuthority: PublicKey\n validatorList: PublicKey\n reserveStake: PublicKey\n transientStake: PublicKey\n validatorStake: PublicKey\n validatorVote: PublicKey\n // Amount of lamports to split into the transient stake account\n lamports: number\n // Seed to used to create the transient stake account\n transientStakeSeed: number\n}\n\nexport interface IncreaseAdditionalValidatorStakeParams extends IncreaseValidatorStakeParams {\n ephemeralStake: PublicKey\n ephemeralStakeSeed: number\n}\n\n/**\n * Deposits a stake account into the pool in exchange for pool tokens\n */\nexport type DepositStakeParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n validatorList: PublicKey\n depositAuthority: PublicKey\n withdrawAuthority: PublicKey\n depositStake: PublicKey\n validatorStake: PublicKey\n reserveStake: PublicKey\n destinationPoolAccount: PublicKey\n managerFeeAccount: PublicKey\n referralPoolAccount: PublicKey\n poolMint: PublicKey\n}\n\n/**\n * Withdraws a stake account from the pool in exchange for pool tokens\n */\nexport type WithdrawStakeParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n validatorList: PublicKey\n withdrawAuthority: PublicKey\n validatorStake: PublicKey\n destinationStake: PublicKey\n destinationStakeAuthority: PublicKey\n sourceTransferAuthority: PublicKey\n sourcePoolAccount: PublicKey\n managerFeeAccount: PublicKey\n poolMint: PublicKey\n poolTokens: number\n}\n\n/**\n * Withdraw sol instruction params\n */\nexport type WithdrawSolParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n sourcePoolAccount: PublicKey\n withdrawAuthority: PublicKey\n reserveStake: PublicKey\n destinationSystemAccount: PublicKey\n sourceTransferAuthority: PublicKey\n solWithdrawAuthority?: PublicKey | undefined\n managerFeeAccount: PublicKey\n poolMint: PublicKey\n poolTokens: number\n}\n\n/**\n * Withdraw WSOL with session instruction params\n */\nexport type WithdrawWsolWithSessionParams = {\n programId: PublicKey\n stakePool: PublicKey\n withdrawAuthority: PublicKey\n userTransferAuthority: PublicKey\n poolTokensFrom: PublicKey\n reserveStake: PublicKey\n userWsolAccount: PublicKey\n managerFeeAccount: PublicKey\n poolMint: PublicKey\n tokenProgramId: PublicKey\n solWithdrawAuthority?: PublicKey\n wsolMint: PublicKey\n programSigner: PublicKey\n poolTokensIn: number\n minimumLamportsOut: number\n}\n\n/**\n * Deposit SOL directly into the pool's reserve account. The output is a \"pool\" token\n * representing ownership into the pool. Inputs are converted to the current ratio.\n */\nexport type DepositSolParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n depositAuthority?: PublicKey | undefined\n withdrawAuthority: PublicKey\n reserveStake: PublicKey\n fundingAccount: PublicKey\n destinationPoolAccount: PublicKey\n managerFeeAccount: PublicKey\n referralPoolAccount: PublicKey\n poolMint: PublicKey\n lamports: number\n}\n\nexport type CreateTokenMetadataParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n manager: PublicKey\n tokenMetadata: PublicKey\n withdrawAuthority: PublicKey\n poolMint: PublicKey\n payer: PublicKey\n name: string\n symbol: string\n uri: string\n}\n\nexport type UpdateTokenMetadataParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n manager: PublicKey\n tokenMetadata: PublicKey\n withdrawAuthority: PublicKey\n name: string\n symbol: string\n uri: string\n}\n\nexport type AddValidatorToPoolParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n staker: PublicKey\n reserveStake: PublicKey\n withdrawAuthority: PublicKey\n validatorList: PublicKey\n validatorStake: PublicKey\n validatorVote: PublicKey\n seed?: number\n}\n\nexport type RemoveValidatorFromPoolParams = {\n programId?: PublicKey | undefined\n stakePool: PublicKey\n staker: PublicKey\n withdrawAuthority: PublicKey\n validatorList: PublicKey\n validatorStake: PublicKey\n transientStake: PublicKey\n}\n\n/**\n * Stake Pool Instruction class\n */\nexport class StakePoolInstruction {\n /**\n * Creates instruction to add a validator into the stake pool.\n */\n static addValidatorToPool(params: AddValidatorToPoolParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n staker,\n reserveStake,\n withdrawAuthority,\n validatorList,\n validatorStake,\n validatorVote,\n seed,\n } = params\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.AddValidatorToPool\n const data = encodeData(type, { seed: seed ?? 0 })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: true },\n { pubkey: staker, isSigner: true, isWritable: false },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: validatorStake, isSigner: false, isWritable: true },\n { pubkey: validatorVote, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: STAKE_CONFIG_ID, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates instruction to remove a validator from the stake pool.\n */\n static removeValidatorFromPool(params: RemoveValidatorFromPoolParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n staker,\n withdrawAuthority,\n validatorList,\n validatorStake,\n transientStake,\n } = params\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.RemoveValidatorFromPool\n const data = encodeData(type)\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: true },\n { pubkey: staker, isSigner: true, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: validatorStake, isSigner: false, isWritable: true },\n { pubkey: transientStake, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates instruction to update a set of validators in the stake pool.\n */\n static updateValidatorListBalance(\n params: UpdateValidatorListBalanceParams,\n ): TransactionInstruction {\n const {\n programId,\n stakePool,\n withdrawAuthority,\n validatorList,\n reserveStake,\n startIndex,\n noMerge,\n validatorAndTransientStakePairs,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.UpdateValidatorListBalance\n const data = encodeData(type, { startIndex, noMerge: noMerge ? 1 : 0 })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ...validatorAndTransientStakePairs.map(pubkey => ({\n pubkey,\n isSigner: false,\n isWritable: true,\n })),\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates instruction to update the overall stake pool balance.\n */\n static updateStakePoolBalance(params: UpdateStakePoolBalanceParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n withdrawAuthority,\n validatorList,\n reserveStake,\n managerFeeAccount,\n poolMint,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.UpdateStakePoolBalance\n const data = encodeData(type)\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: true },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: reserveStake, isSigner: false, isWritable: false },\n { pubkey: managerFeeAccount, isSigner: false, isWritable: true },\n { pubkey: poolMint, isSigner: false, isWritable: true },\n { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates instruction to cleanup removed validator entries.\n */\n static cleanupRemovedValidatorEntries(\n params: CleanupRemovedValidatorEntriesParams,\n ): TransactionInstruction {\n const { programId, stakePool, validatorList } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.CleanupRemovedValidatorEntries\n const data = encodeData(type)\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates `IncreaseValidatorStake` instruction (rebalance from reserve account to\n * transient account)\n */\n static increaseValidatorStake(params: IncreaseValidatorStakeParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n staker,\n withdrawAuthority,\n validatorList,\n reserveStake,\n transientStake,\n validatorStake,\n validatorVote,\n lamports,\n transientStakeSeed,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.IncreaseValidatorStake\n const data = encodeData(type, { lamports, transientStakeSeed })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: staker, isSigner: true, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: transientStake, isSigner: false, isWritable: true },\n { pubkey: validatorStake, isSigner: false, isWritable: false },\n { pubkey: validatorVote, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: STAKE_CONFIG_ID, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates `IncreaseAdditionalValidatorStake` instruction (rebalance from reserve account to\n * transient account)\n */\n static increaseAdditionalValidatorStake(\n params: IncreaseAdditionalValidatorStakeParams,\n ): TransactionInstruction {\n const {\n programId,\n stakePool,\n staker,\n withdrawAuthority,\n validatorList,\n reserveStake,\n transientStake,\n validatorStake,\n validatorVote,\n lamports,\n transientStakeSeed,\n ephemeralStake,\n ephemeralStakeSeed,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.IncreaseAdditionalValidatorStake\n const data = encodeData(type, { lamports, transientStakeSeed, ephemeralStakeSeed })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: staker, isSigner: true, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: ephemeralStake, isSigner: false, isWritable: true },\n { pubkey: transientStake, isSigner: false, isWritable: true },\n { pubkey: validatorStake, isSigner: false, isWritable: false },\n { pubkey: validatorVote, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: STAKE_CONFIG_ID, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates `DecreaseValidatorStake` instruction (rebalance from validator account to\n * transient account)\n */\n static decreaseValidatorStake(params: DecreaseValidatorStakeParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n staker,\n withdrawAuthority,\n validatorList,\n validatorStake,\n transientStake,\n lamports,\n transientStakeSeed,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DecreaseValidatorStake\n const data = encodeData(type, { lamports, transientStakeSeed })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: staker, isSigner: true, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: validatorStake, isSigner: false, isWritable: true },\n { pubkey: transientStake, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates `DecreaseValidatorStakeWithReserve` instruction (rebalance from\n * validator account to transient account)\n */\n static decreaseValidatorStakeWithReserve(\n params: DecreaseValidatorStakeWithReserveParams,\n ): TransactionInstruction {\n const {\n programId,\n stakePool,\n staker,\n withdrawAuthority,\n validatorList,\n reserveStake,\n validatorStake,\n transientStake,\n lamports,\n transientStakeSeed,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DecreaseValidatorStakeWithReserve\n const data = encodeData(type, { lamports, transientStakeSeed })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: staker, isSigner: true, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: validatorStake, isSigner: false, isWritable: true },\n { pubkey: transientStake, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates `DecreaseAdditionalValidatorStake` instruction (rebalance from\n * validator account to transient account)\n */\n static decreaseAdditionalValidatorStake(\n params: DecreaseAdditionalValidatorStakeParams,\n ): TransactionInstruction {\n const {\n programId,\n stakePool,\n staker,\n withdrawAuthority,\n validatorList,\n reserveStake,\n validatorStake,\n transientStake,\n lamports,\n transientStakeSeed,\n ephemeralStakeSeed,\n ephemeralStake,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DecreaseAdditionalValidatorStake\n const data = encodeData(type, { lamports, transientStakeSeed, ephemeralStakeSeed })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: staker, isSigner: true, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: validatorStake, isSigner: false, isWritable: true },\n { pubkey: ephemeralStake, isSigner: false, isWritable: true },\n { pubkey: transientStake, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates a transaction instruction to deposit a stake account into a stake pool.\n */\n static depositStake(params: DepositStakeParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n validatorList,\n depositAuthority,\n withdrawAuthority,\n depositStake,\n validatorStake,\n reserveStake,\n destinationPoolAccount,\n managerFeeAccount,\n referralPoolAccount,\n poolMint,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DepositStake\n const data = encodeData(type)\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: true },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: depositAuthority, isSigner: false, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: depositStake, isSigner: false, isWritable: true },\n { pubkey: validatorStake, isSigner: false, isWritable: true },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: destinationPoolAccount, isSigner: false, isWritable: true },\n { pubkey: managerFeeAccount, isSigner: false, isWritable: true },\n { pubkey: referralPoolAccount, isSigner: false, isWritable: true },\n { pubkey: poolMint, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates a transaction instruction to deposit SOL into a stake pool.\n */\n static depositSol(params: DepositSolParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n withdrawAuthority,\n depositAuthority,\n reserveStake,\n fundingAccount,\n destinationPoolAccount,\n managerFeeAccount,\n referralPoolAccount,\n poolMint,\n lamports,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DepositSol\n const data = encodeData(type, { lamports })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: true },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: fundingAccount, isSigner: true, isWritable: true },\n { pubkey: destinationPoolAccount, isSigner: false, isWritable: true },\n { pubkey: managerFeeAccount, isSigner: false, isWritable: true },\n { pubkey: referralPoolAccount, isSigner: false, isWritable: true },\n { pubkey: poolMint, isSigner: false, isWritable: true },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },\n ]\n\n if (depositAuthority) {\n keys.push({\n pubkey: depositAuthority,\n isSigner: true,\n isWritable: false,\n })\n }\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates a transaction instruction to deposit WSOL into a stake pool.\n */\n static depositWsolWithSession(params: Omit<DepositSolParams, 'lamports'> & {\n wsolMint: PublicKey\n wsolTokenAccount: PublicKey\n wsolTransientAccount: PublicKey\n programSigner: PublicKey\n tokenProgramId: PublicKey\n programId: PublicKey\n payer?: PublicKey\n userWallet: PublicKey\n lamportsIn: number\n minimumPoolTokensOut: number\n }): TransactionInstruction {\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DepositWsolWithSession\n const data = encodeData(type, {\n lamportsIn: params.lamportsIn,\n minimumPoolTokensOut: params.minimumPoolTokensOut,\n })\n\n const keys = [\n { pubkey: params.stakePool, isSigner: false, isWritable: true },\n { pubkey: params.withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: params.reserveStake, isSigner: false, isWritable: true },\n { pubkey: params.fundingAccount, isSigner: true, isWritable: true },\n { pubkey: params.destinationPoolAccount, isSigner: false, isWritable: true },\n { pubkey: params.managerFeeAccount, isSigner: false, isWritable: true },\n { pubkey: params.referralPoolAccount, isSigner: false, isWritable: true },\n { pubkey: params.poolMint, isSigner: false, isWritable: true },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: params.tokenProgramId, isSigner: false, isWritable: false },\n\n // wsol specific accounts\n { pubkey: params.wsolMint, isSigner: false, isWritable: false },\n { pubkey: params.wsolTokenAccount, isSigner: false, isWritable: true },\n { pubkey: params.wsolTransientAccount, isSigner: false, isWritable: true },\n { pubkey: params.programSigner, isSigner: false, isWritable: true },\n { pubkey: params.payer ?? params.fundingAccount, isSigner: true, isWritable: true },\n { pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: params.userWallet, isSigner: false, isWritable: false },\n ]\n\n if (params.depositAuthority) {\n keys.push({\n pubkey: params.depositAuthority,\n isSigner: true,\n isWritable: false,\n })\n }\n\n return new TransactionInstruction({\n programId: params.programId,\n keys,\n data,\n })\n }\n\n /**\n * Creates a transaction instruction to withdraw active stake from a stake pool.\n */\n static withdrawStake(params: WithdrawStakeParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n validatorList,\n withdrawAuthority,\n validatorStake,\n destinationStake,\n destinationStakeAuthority,\n sourceTransferAuthority,\n sourcePoolAccount,\n managerFeeAccount,\n poolMint,\n poolTokens,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawStake\n const data = encodeData(type, { poolTokens })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: true },\n { pubkey: validatorList, isSigner: false, isWritable: true },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: validatorStake, isSigner: false, isWritable: true },\n { pubkey: destinationStake, isSigner: false, isWritable: true },\n { pubkey: destinationStakeAuthority, isSigner: false, isWritable: false },\n { pubkey: sourceTransferAuthority, isSigner: true, isWritable: false },\n { pubkey: sourcePoolAccount, isSigner: false, isWritable: true },\n { pubkey: managerFeeAccount, isSigner: false, isWritable: true },\n { pubkey: poolMint, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n ]\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates a transaction instruction to withdraw SOL from a stake pool.\n */\n static withdrawSol(params: WithdrawSolParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n withdrawAuthority,\n sourceTransferAuthority,\n sourcePoolAccount,\n reserveStake,\n destinationSystemAccount,\n managerFeeAccount,\n solWithdrawAuthority,\n poolMint,\n poolTokens,\n } = params\n\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawSol\n const data = encodeData(type, { poolTokens })\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: true },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: sourceTransferAuthority, isSigner: true, isWritable: false },\n { pubkey: sourcePoolAccount, isSigner: false, isWritable: true },\n { pubkey: reserveStake, isSigner: false, isWritable: true },\n { pubkey: destinationSystemAccount, isSigner: false, isWritable: true },\n { pubkey: managerFeeAccount, isSigner: false, isWritable: true },\n { pubkey: poolMint, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },\n ]\n\n if (solWithdrawAuthority) {\n keys.push({\n pubkey: solWithdrawAuthority,\n isSigner: true,\n isWritable: false,\n })\n }\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates a transaction instruction to withdraw WSOL from a stake pool using a session.\n */\n static withdrawWsolWithSession(\n params: WithdrawWsolWithSessionParams,\n ): TransactionInstruction {\n const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawWsolWithSession\n const data = encodeData(type, {\n poolTokensIn: params.poolTokensIn,\n minimumLamportsOut: params.minimumLamportsOut,\n })\n\n const keys = [\n { pubkey: params.stakePool, isSigner: false, isWritable: true },\n { pubkey: params.withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: params.userTransferAuthority, isSigner: true, isWritable: true },\n { pubkey: params.poolTokensFrom, isSigner: false, isWritable: true },\n { pubkey: params.reserveStake, isSigner: false, isWritable: true },\n { pubkey: params.userWsolAccount, isSigner: false, isWritable: true },\n { pubkey: params.managerFeeAccount, isSigner: false, isWritable: true },\n { pubkey: params.poolMint, isSigner: false, isWritable: true },\n { pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },\n { pubkey: StakeProgram.programId, isSigner: false, isWritable: false },\n { pubkey: params.tokenProgramId, isSigner: false, isWritable: false },\n\n { pubkey: params.wsolMint, isSigner: false, isWritable: false },\n { pubkey: params.programSigner, isSigner: false, isWritable: true },\n ]\n\n if (params.solWithdrawAuthority) {\n keys.push({\n pubkey: params.solWithdrawAuthority,\n isSigner: true,\n isWritable: false,\n })\n }\n\n return new TransactionInstruction({\n programId: params.programId,\n keys,\n data,\n })\n }\n\n /**\n * Creates an instruction to create metadata\n * using the mpl token metadata program for the pool token\n */\n static createTokenMetadata(params: CreateTokenMetadataParams): TransactionInstruction {\n const {\n programId,\n stakePool,\n withdrawAuthority,\n tokenMetadata,\n manager,\n payer,\n poolMint,\n name,\n symbol,\n uri,\n } = params\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: manager, isSigner: true, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: poolMint, isSigner: false, isWritable: false },\n { pubkey: payer, isSigner: true, isWritable: true },\n { pubkey: tokenMetadata, isSigner: false, isWritable: true },\n { pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false },\n { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },\n ]\n\n const type = tokenMetadataLayout(17, name.length, symbol.length, uri.length)\n const data = encodeData(type, {\n nameLen: name.length,\n name: Buffer.from(name),\n symbolLen: symbol.length,\n symbol: Buffer.from(symbol),\n uriLen: uri.length,\n uri: Buffer.from(uri),\n })\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Creates an instruction to update metadata\n * in the mpl token metadata program account for the pool token\n */\n static updateTokenMetadata(params: UpdateTokenMetadataParams): TransactionInstruction {\n const { programId, stakePool, withdrawAuthority, tokenMetadata, manager, name, symbol, uri }\n = params\n\n const keys = [\n { pubkey: stakePool, isSigner: false, isWritable: false },\n { pubkey: manager, isSigner: true, isWritable: false },\n { pubkey: withdrawAuthority, isSigner: false, isWritable: false },\n { pubkey: tokenMetadata, isSigner: false, isWritable: true },\n { pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false },\n ]\n\n const type = tokenMetadataLayout(18, name.length, symbol.length, uri.length)\n const data = encodeData(type, {\n nameLen: name.length,\n name: Buffer.from(name),\n symbolLen: symbol.length,\n symbol: Buffer.from(symbol),\n uriLen: uri.length,\n uri: Buffer.from(uri),\n })\n\n return new TransactionInstruction({\n programId: programId ?? STAKE_POOL_PROGRAM_ID,\n keys,\n data,\n })\n }\n\n /**\n * Decode a deposit stake pool instruction and retrieve the instruction params.\n */\n static decodeDepositStake(instruction: TransactionInstruction): DepositStakeParams {\n this.checkProgramId(instruction.programId)\n this.checkKeyLength(instruction.keys, 11)\n\n decodeData(STAKE_POOL_INSTRUCTION_LAYOUTS.DepositStake, instruction.data)\n\n return {\n programId: instruction.programId,\n stakePool: instruction.keys[0].pubkey,\n validatorList: instruction.keys[1].pubkey,\n depositAuthority: instruction.keys[2].pubkey,\n withdrawAuthority: instruction.keys[3].pubkey,\n depositStake: instruction.keys[4].pubkey,\n validatorStake: instruction.keys[5].pubkey,\n reserveStake: instruction.keys[6].pubkey,\n destinationPoolAccount: instruction.keys[7].pubkey,\n managerFeeAccount: instruction.keys[8].pubkey,\n referralPoolAccount: instruction.keys[9].pubkey,\n poolMint: instruction.keys[10].pubkey,\n }\n }\n\n /**\n * Decode a deposit sol instruction and retrieve the instruction params.\n */\n static decodeDepositSol(instruction: TransactionInstruction): DepositSolParams {\n this.checkProgramId(instruction.programId)\n this.checkKeyLength(instruction.keys, 9)\n\n const { amount } = decodeData(STAKE_POOL_INSTRUCTION_LAYOUTS.DepositSol, instruction.data)\n\n return {\n programId: instruction.programId,\n stakePool: instruction.keys[0].pubkey,\n depositAuthority: instruction.keys[1].pubkey,\n withdrawAuthority: instruction.keys[2].pubkey,\n reserveStake: instruction.keys[3].pubkey,\n fundingAccount: instruction.keys[4].pubkey,\n destinationPoolAccount: instruction.keys[5].pubkey,\n managerFeeAccount: instruction.keys[6].pubkey,\n referralPoolAccount: instruction.keys[7].pubkey,\n poolMint: instruction.keys[8].pubkey,\n lamports: amount,\n }\n }\n\n /**\n * @internal\n */\n private static checkProgramId(programId: PublicKey) {\n if (\n !programId.equals(STAKE_POOL_PROGRAM_ID)\n && !programId.equals(DEVNET_STAKE_POOL_PROGRAM_ID)\n ) {\n throw new Error('Invalid instruction; programId is not the stake pool program')\n }\n }\n\n /**\n * @internal\n */\n private static checkKeyLength(keys: Array<any>, expectedLength: number) {\n if (keys.length < expectedLength) {\n throw new Error(\n `Invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`,\n )\n }\n }\n}\n","import {\n createApproveInstruction,\n createAssociatedTokenAccountIdempotentInstruction,\n getAccount,\n getAssociatedTokenAddressSync,\n NATIVE_MINT,\n} from '@solana/spl-token'\nimport {\n AccountInfo,\n Connection,\n Keypair,\n PublicKey,\n Signer,\n StakeAuthorizationLayout,\n StakeProgram,\n SystemProgram,\n TransactionInstruction,\n} from '@solana/web3.js'\nimport BN from 'bn.js'\nimport { create } from 'superstruct'\nimport {\n DEVNET_STAKE_POOL_PROGRAM_ID,\n MAX_VALIDATORS_TO_UPDATE,\n MINIMUM_ACTIVE_STAKE,\n STAKE_POOL_PROGRAM_ID,\n} from './constants'\nimport { StakePoolInstruction } from './instructions'\nimport {\n StakeAccount,\n StakePool,\n StakePoolLayout,\n ValidatorList,\n ValidatorListLayout,\n ValidatorStakeInfo,\n} from './layouts'\nimport {\n arrayChunk,\n calcLamportsWithdrawAmount,\n findEphemeralStakeProgramAddress,\n findMetadataAddress,\n findStakeProgramAddress,\n findTransientStakeProgramAddress,\n findWithdrawAuthorityProgramAddress,\n findWsolTransientProgramAddress,\n getValidatorListAccount,\n lamportsToSol,\n newStakeAccount,\n prepareWithdrawAccounts,\n solToLamports,\n ValidatorAccount,\n} from './utils'\n\nexport {\n DEVNET_STAKE_POOL_PROGRAM_ID,\n STAKE_POOL_PROGRAM_ID,\n} from './constants'\nexport * from './instructions'\nexport type {\n AccountType,\n StakePool,\n ValidatorList,\n ValidatorStakeInfo,\n} from './layouts'\nexport {\n StakePoolLayout,\n ValidatorListLayout,\n ValidatorStakeInfoLayout,\n} from './layouts'\n\nexport interface ValidatorListAccount {\n pubkey: PublicKey\n account: AccountInfo<ValidatorList>\n}\n\nexport interface StakePoolAccount {\n pubkey: PublicKey\n account: AccountInfo<StakePool>\n}\n\nexport interface WithdrawAccount {\n stakeAddress: PublicKey\n voteAddress?: PublicKey\n poolAmount: BN\n}\n\n/**\n * Wrapper class for a stake pool.\n * Each stake pool has a stake pool account and a validator list account.\n */\nexport interface StakePoolAccounts {\n stakePool: StakePoolAccount | undefined\n validatorList: ValidatorListAccount | undefined\n}\n\nexport function getStakePoolProgramId(rpcEndpoint: string): PublicKey {\n if (rpcEndpoint.includes('devnet')) {\n return DEVNET_STAKE_POOL_PROGRAM_ID\n } else {\n return STAKE_POOL_PROGRAM_ID\n }\n}\n\n/**\n * Retrieves and deserializes a StakePool account using a web3js connection and the stake pool address.\n * @param connection An active web3js connection.\n * @param stakePoolAddress The public key (address) of the stake pool account.\n */\nexport async function getStakePoolAccount(\n connection: Connection,\n stakePoolAddress: PublicKey,\n): Promise<StakePoolAccount> {\n const account = await connection.getAccountInfo(stakePoolAddress)\n\n if (!account) {\n throw new Error('Invalid stake pool account')\n }\n\n return {\n pubkey: stakePoolAddress,\n account: {\n data: StakePoolLayout.decode(account.data),\n executable: account.executable,\n lamports: account.lamports,\n owner: account.owner,\n },\n }\n}\n\n/**\n * Retrieves and deserializes a Stake account using a web3js connection and the stake address.\n * @param connection An active web3js connection.\n * @param stakeAccount The public key (address) of the stake account.\n */\nexport async function getStakeAccount(\n connection: Connection,\n stakeAccount: PublicKey,\n): Promise<StakeAccount> {\n const result = (await connection.getParsedAccountInfo(stakeAccount)).value\n if (!result || !('parsed' in result.data)) {\n throw new Error('Invalid stake account')\n }\n const program = result.data.program\n if (program !== 'stake') {\n throw new Error('Not a stake account')\n }\n return create(result.data.parsed, StakeAccount)\n}\n\n/**\n * Retrieves all StakePool and ValidatorList accounts that are running a particular StakePool program.\n * @param connection An active web3js connection.\n * @param stakePoolProgramAddress The public key (address) of the StakePool program.\n */\nexport async function getStakePoolAccounts(\n connection: Connection,\n stakePoolProgramAddress: PublicKey,\n): Promise<\n (StakePoolAccount | ValidatorListAccount | undefined)[] | undefined\n> {\n const response = await connection.getProgramAccounts(stakePoolProgramAddress)\n\n return response\n .map((a) => {\n try {\n if (a.account.data.readUInt8() === 1) {\n const data = StakePoolLayout.decode(a.account.data)\n return {\n pubkey: a.pubkey,\n account: {\n data,\n executable: a.account.executable,\n lamports: a.account.lamports,\n owner: a.account.owner,\n },\n }\n } else if (a.account.data.readUInt8() === 2) {\n const data = ValidatorListLayout.decode(a.account.data)\n return {\n pubkey: a.pubkey,\n account: {\n data,\n executable: a.account.executable,\n lamports: a.account.lamports,\n owner: a.account.owner,\n },\n }\n } else {\n console.error(\n `Could not decode. StakePoolAccount Enum is ${a.account.data.readUInt8()}, expected 1 or 2!`,\n )\n return undefined\n }\n } catch (error) {\n console.error('Could not decode account. Error:', error)\n return undefined\n }\n })\n .filter(a => a !== undefined)\n}\n\n/**\n * Creates instructions required to deposit stake to stake pool.\n */\nexport async function depositStake(\n connection: Connection,\n stakePoolAddress: PublicKey,\n authorizedPubkey: PublicKey,\n validatorVote: PublicKey,\n depositStake: PublicKey,\n poolTokenReceiverAccount?: PublicKey,\n) {\n const stakePool = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n const validatorStake = await findStakeProgramAddress(\n stakePoolProgramId,\n validatorVote,\n stakePoolAddress,\n )\n\n const instructions: TransactionInstruction[] = []\n const signers: Signer[] = []\n\n const poolMint = stakePool.account.data.poolMint\n\n // Create token account if not specified\n if (!poolTokenReceiverAccount) {\n const associatedAddress = getAssociatedTokenAddressSync(\n poolMint,\n authorizedPubkey,\n )\n instructions.push(\n createAssociatedTokenAccountIdempotentInstruction(\n authorizedPubkey,\n associatedAddress,\n authorizedPubkey,\n poolMint,\n ),\n )\n poolTokenReceiverAccount = associatedAddress\n }\n\n instructions.push(\n ...StakeProgram.authorize({\n stakePubkey: depositStake,\n authorizedPubkey,\n newAuthorizedPubkey: stakePool.account.data.stakeDepositAuthority,\n stakeAuthorizationType: StakeAuthorizationLayout.Staker,\n }).instructions,\n )\n\n instructions.push(\n ...StakeProgram.authorize({\n stakePubkey: depositStake,\n authorizedPubkey,\n newAuthorizedPubkey: stakePool.account.data.stakeDepositAuthority,\n stakeAuthorizationType: StakeAuthorizationLayout.Withdrawer,\n }).instructions,\n )\n\n instructions.push(\n StakePoolInstruction.depositStake({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n validatorList: stakePool.account.data.validatorList,\n depositAuthority: stakePool.account.data.stakeDepositAuthority,\n reserveStake: stakePool.account.data.reserveStake,\n managerFeeAccount: stakePool.account.data.managerFeeAccount,\n referralPoolAccount: poolTokenReceiverAccount,\n destinationPoolAccount: poolTokenReceiverAccount,\n withdrawAuthority,\n depositStake,\n validatorStake,\n poolMint,\n }),\n )\n\n return {\n instructions,\n signers,\n }\n}\n\n/**\n * Creates instructions required to deposit sol to stake pool.\n */\nexport async function depositWsolWithSession(\n connection: Connection,\n stakePoolAddress: PublicKey,\n signerOrSession: PublicKey,\n userPubkey: PublicKey,\n lamports: number,\n minimumPoolTokensOut: number = 0,\n destinationTokenAccount?: PublicKey,\n referrerTokenAccount?: PublicKey,\n depositAuthority?: PublicKey,\n payer?: PublicKey,\n) {\n const wsolTokenAccount = getAssociatedTokenAddressSync(NATIVE_MINT, userPubkey)\n\n const tokenAccountInfo = await connection.getTokenAccountBalance(\n wsolTokenAccount,\n 'confirmed',\n )\n const wsolBalance = tokenAccountInfo\n ? parseInt(tokenAccountInfo.value.amount)\n : 0\n\n if (wsolBalance < lamports) {\n throw new Error(\n `Not enough WSOL to deposit into pool. Maximum deposit amount is ${lamportsToSol(\n wsolBalance,\n )} WSOL.`,\n )\n }\n\n const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const stakePool = stakePoolAccount.account.data\n\n const instructions: TransactionInstruction[] = []\n\n // The program handles ATA creation internally using funds from the user's deposit\n // This prevents rent drain attacks where paymaster pays for ATA and user reclaims rent\n if (!destinationTokenAccount) {\n destinationTokenAccount = getAssociatedTokenAddressSync(\n stakePool.poolMint,\n userPubkey,\n )\n }\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n const [programSigner] = PublicKey.findProgramAddressSync(\n [Buffer.from('fogo_session_program_signer')],\n stakePoolProgramId,\n )\n\n const wsolTransientAccount = findWsolTransientProgramAddress(\n stakePoolProgramId,\n userPubkey,\n )\n\n instructions.push(\n StakePoolInstruction.depositWsolWithSession({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n reserveStake: stakePool.reserveStake,\n fundingAccount: signerOrSession,\n destinationPoolAccount: destinationTokenAccount,\n managerFeeAccount: stakePool.managerFeeAccount,\n referralPoolAccount: referrerTokenAccount ?? destinationTokenAccount,\n poolMint: stakePool.poolMint,\n lamportsIn: lamports,\n minimumPoolTokensOut,\n withdrawAuthority,\n depositAuthority,\n wsolMint: NATIVE_MINT,\n wsolTokenAccount,\n wsolTransientAccount,\n tokenProgramId: stakePool.tokenProgramId,\n programSigner,\n payer,\n userWallet: userPubkey,\n }),\n )\n return {\n instructions,\n signers: [],\n }\n}\n\n/**\n * Creates instructions required to deposit sol to stake pool.\n */\nexport async function depositSol(\n connection: Connection,\n stakePoolAddress: PublicKey,\n from: PublicKey,\n lamports: number,\n destinationTokenAccount?: PublicKey,\n referrerTokenAccount?: PublicKey,\n depositAuthority?: PublicKey,\n) {\n const fromBalance = await connection.getBalance(from, 'confirmed')\n if (fromBalance < lamports) {\n throw new Error(\n `Not enough SOL to deposit into pool. Maximum deposit amount is ${lamportsToSol(\n fromBalance,\n )} SOL.`,\n )\n }\n\n const stakePoolAccount = await getStakePoolAccount(\n connection,\n stakePoolAddress,\n )\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const stakePool = stakePoolAccount.account.data\n\n // Ephemeral SOL account just to do the transfer\n const userSolTransfer = new Keypair()\n const signers: Signer[] = [userSolTransfer]\n const instructions: TransactionInstruction[] = []\n\n // Create the ephemeral SOL account\n instructions.push(\n SystemProgram.transfer({\n fromPubkey: from,\n toPubkey: userSolTransfer.publicKey,\n lamports,\n }),\n )\n\n // Create token account if not specified\n if (!destinationTokenAccount) {\n const associatedAddress = getAssociatedTokenAddressSync(\n stakePool.poolMint,\n from,\n )\n instructions.push(\n createAssociatedTokenAccountIdempotentInstruction(\n from,\n associatedAddress,\n from,\n stakePool.poolMint,\n ),\n )\n destinationTokenAccount = associatedAddress\n }\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n instructions.push(\n StakePoolInstruction.depositSol({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n reserveStake: stakePool.reserveStake,\n fundingAccount: userSolTransfer.publicKey,\n destinationPoolAccount: destinationTokenAccount,\n managerFeeAccount: stakePool.managerFeeAccount,\n referralPoolAccount: referrerTokenAccount ?? destinationTokenAccount,\n poolMint: stakePool.poolMint,\n lamports,\n withdrawAuthority,\n depositAuthority,\n }),\n )\n\n return {\n instructions,\n signers,\n }\n}\n\n/**\n * Creates instructions required to withdraw stake from a stake pool.\n */\nexport async function withdrawStake(\n connection: Connection,\n stakePoolAddress: PublicKey,\n tokenOwner: PublicKey,\n amount: number,\n useReserve = false,\n voteAccountAddress?: PublicKey,\n stakeReceiver?: PublicKey,\n poolTokenAccount?: PublicKey,\n validatorComparator?: (_a: ValidatorAccount, _b: ValidatorAccount) => number,\n) {\n const stakePool = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const poolAmount = new BN(solToLamports(amount))\n\n if (!poolTokenAccount) {\n poolTokenAccount = getAssociatedTokenAddressSync(\n stakePool.account.data.poolMint,\n tokenOwner,\n )\n }\n\n const tokenAccount = await getAccount(connection, poolTokenAccount)\n\n // Check withdrawFrom balance\n if (tokenAccount.amount < poolAmount.toNumber()) {\n throw new Error(\n `Not enough token balance to withdraw ${lamportsToSol(poolAmount)} pool tokens.\n Maximum withdraw amount is ${lamportsToSol(tokenAccount.amount)} pool tokens.`,\n )\n }\n\n const stakeAccountRentExemption\n = await connection.getMinimumBalanceForRentExemption(StakeProgram.space)\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n let stakeReceiverAccount = null\n if (stakeReceiver) {\n stakeReceiverAccount = await getStakeAccount(connection, stakeReceiver)\n }\n\n const withdrawAccounts: WithdrawAccount[] = []\n\n if (useReserve) {\n withdrawAccounts.push({\n stakeAddress: stakePool.account.data.reserveStake,\n voteAddress: undefined,\n poolAmount,\n })\n } else if (\n stakeReceiverAccount\n && stakeReceiverAccount?.type === 'delegated'\n ) {\n const voteAccount = stakeReceiverAccount.info?.stake?.delegation.voter\n if (!voteAccount) {\n throw new Error(`Invalid stake receiver ${stakeReceiver} delegation`)\n }\n const validatorListAccount = await connection.getAccountInfo(\n stakePool.account.data.validatorList,\n )\n const validatorList = ValidatorListLayout.decode(\n validatorListAccount?.data,\n ) as ValidatorList\n const isValidVoter = validatorList.validators.find(val =>\n val.voteAccountAddress.equals(voteAccount),\n )\n if (voteAccountAddress && voteAccountAddress !== voteAccount) {\n throw new Error(`Provided withdrawal vote account ${voteAccountAddress} does not match delegation on stake receiver account ${voteAccount},\n remove this flag or provide a different stake account delegated to ${voteAccountAddress}`)\n }\n if (isValidVoter) {\n const stakeAccountAddress = await findStakeProgramAddress(\n stakePoolProgramId,\n voteAccount,\n stakePoolAddress,\n )\n\n const stakeAccount = await connection.getAccountInfo(stakeAccountAddress)\n if (!stakeAccount) {\n throw new Error(\n `Preferred withdraw valdator's stake account is invalid`,\n )\n }\n\n const availableForWithdrawal = calcLamportsWithdrawAmount(\n stakePool.account.data,\n new BN(\n stakeAccount.lamports\n - MINIMUM_ACTIVE_STAKE\n - stakeAccountRentExemption,\n ),\n )\n\n if (availableForWithdrawal.lt(poolAmount)) {\n throw new Error(\n `Not enough lamports available for withdrawal from ${stakeAccountAddress},\n ${poolAmount} asked, ${availableForWithdrawal} available.`,\n )\n }\n withdrawAccounts.push({\n stakeAddress: stakeAccountAddress,\n voteAddress: voteAccount,\n poolAmount,\n })\n } else {\n throw new Error(\n `Provided stake account is delegated to a vote account ${voteAccount} which does not exist in the stake pool`,\n )\n }\n } else if (voteAccountAddress) {\n const stakeAccountAddress = await findStakeProgramAddress(\n stakePoolProgramId,\n voteAccountAddress,\n stakePoolAddress,\n )\n const stakeAccount = await connection.getAccountInfo(stakeAccountAddress)\n if (!stakeAccount) {\n throw new Error('Invalid Stake Account')\n }\n\n const availableLamports = new BN(\n stakeAccount.lamports - MINIMUM_ACTIVE_STAKE - stakeAccountRentExemption,\n )\n if (availableLamports.lt(new BN(0))) {\n throw new Error('Invalid Stake Account')\n }\n const availableForWithdrawal = calcLamportsWithdrawAmount(\n stakePool.account.data,\n availableLamports,\n )\n\n if (availableForWithdrawal.lt(poolAmount)) {\n // noinspection ExceptionCaughtLocallyJS\n throw new Error(\n `Not enough lamports available for withdrawal from ${stakeAccountAddress},\n ${poolAmount} asked, ${availableForWithdrawal} available.`,\n )\n }\n withdrawAccounts.push({\n stakeAddress: stakeAccountAddress,\n voteAddress: voteAccountAddress,\n poolAmount,\n })\n } else {\n // Get the list of accounts to withdraw from\n withdrawAccounts.push(\n ...(await prepareWithdrawAccounts(\n connection,\n stakePool.account.data,\n stakePoolAddress,\n poolAmount,\n validatorComparator,\n poolTokenAccount.equals(stakePool.account.data.managerFeeAccount),\n )),\n )\n }\n\n // Construct transaction to withdraw from withdrawAccounts account list\n const instructions: TransactionInstruction[] = []\n const userTransferAuthority = Keypair.generate()\n\n const signers: Signer[] = [userTransferAuthority]\n\n instructions.push(\n createApproveInstruction(\n poolTokenAccount,\n userTransferAuthority.publicKey,\n tokenOwner,\n poolAmount.toNumber(),\n ),\n )\n\n let totalRentFreeBalances = 0\n\n // Max 5 accounts to prevent an error: \"Transaction too large\"\n const maxWithdrawAccounts = 5\n let i = 0\n\n // Go through prepared accounts and withdraw/claim them\n for (const withdrawAccount of withdrawAccounts) {\n if (i > maxWithdrawAccounts) {\n break\n }\n // Convert pool tokens amount to lamports\n const solWithdrawAmount = calcLamportsWithdrawAmount(\n stakePool.account.data,\n withdrawAccount.poolAmount,\n )\n\n let infoMsg = `Withdrawing ◎${solWithdrawAmount},\n from stake account ${withdrawAccount.stakeAddress?.toBase58()}`\n\n if (withdrawAccount.voteAddress) {\n infoMsg = `${infoMsg}, delegated to ${withdrawAccount.voteAddress?.toBase58()}`\n }\n\n console.info(infoMsg)\n let stakeToReceive\n\n if (\n !stakeReceiver\n || (stakeReceiverAccount && stakeReceiverAccount.type === 'delegated')\n ) {\n const stakeKeypair = newStakeAccount(\n tokenOwner,\n instructions,\n stakeAccountRentExemption,\n )\n signers.push(stakeKeypair)\n totalRentFreeBalances += stakeAccountRentExemption\n stakeToReceive = stakeKeypair.publicKey\n } else {\n stakeToReceive = stakeReceiver\n }\n\n instructions.push(\n StakePoolInstruction.withdrawStake({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n validatorList: stakePool.account.data.validatorList,\n validatorStake: withdrawAccount.stakeAddress,\n destinationStake: stakeToReceive,\n destinationStakeAuthority: tokenOwner,\n sourceTransferAuthority: userTransferAuthority.publicKey,\n sourcePoolAccount: poolTokenAccount,\n managerFeeAccount: stakePool.account.data.managerFeeAccount,\n poolMint: stakePool.account.data.poolMint,\n poolTokens: withdrawAccount.poolAmount.toNumber(),\n withdrawAuthority,\n }),\n )\n i++\n }\n if (\n stakeReceiver\n && stakeReceiverAccount\n && stakeReceiverAccount.type === 'delegated'\n ) {\n signers.forEach((newStakeKeypair) => {\n instructions.concat(\n StakeProgram.merge({\n stakePubkey: stakeReceiver,\n sourceStakePubKey: newStakeKeypair.publicKey,\n authorizedPubkey: tokenOwner,\n }).instructions,\n )\n })\n }\n\n return {\n instructions,\n signers,\n stakeReceiver,\n totalRentFreeBalances,\n }\n}\n\n/**\n * Creates instructions required to withdraw SOL directly from a stake pool.\n */\nexport async function withdrawSol(\n connection: Connection,\n stakePoolAddress: PublicKey,\n tokenOwner: PublicKey,\n solReceiver: PublicKey,\n amount: number,\n solWithdrawAuthority?: PublicKey,\n) {\n const stakePool = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const poolAmount = solToLamports(amount)\n\n const poolTokenAccount = getAssociatedTokenAddressSync(\n stakePool.account.data.poolMint,\n tokenOwner,\n )\n\n const tokenAccount = await getAccount(connection, poolTokenAccount)\n\n // Check withdrawFrom balance\n if (tokenAccount.amount < poolAmount) {\n throw new Error(\n `Not enough token balance to withdraw ${lamportsToSol(poolAmount)} pool tokens.\n Maximum withdraw amount is ${lamportsToSol(tokenAccount.amount)} pool tokens.`,\n )\n }\n\n // Construct transaction to withdraw from withdrawAccounts account list\n const instructions: TransactionInstruction[] = []\n const userTransferAuthority = Keypair.generate()\n const signers: Signer[] = [userTransferAuthority]\n\n instructions.push(\n createApproveInstruction(\n poolTokenAccount,\n userTransferAuthority.publicKey,\n tokenOwner,\n poolAmount,\n ),\n )\n\n const poolWithdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n if (solWithdrawAuthority) {\n const expectedSolWithdrawAuthority\n = stakePool.account.data.solWithdrawAuthority\n if (!expectedSolWithdrawAuthority) {\n throw new Error(\n 'SOL withdraw authority specified in arguments but stake pool has none',\n )\n }\n if (\n solWithdrawAuthority.toBase58() !== expectedSolWithdrawAuthority.toBase58()\n ) {\n throw new Error(\n `Invalid deposit withdraw specified, expected ${expectedSolWithdrawAuthority.toBase58()}, received ${solWithdrawAuthority.toBase58()}`,\n )\n }\n }\n\n const withdrawTransaction = StakePoolInstruction.withdrawSol({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n withdrawAuthority: poolWithdrawAuthority,\n reserveStake: stakePool.account.data.reserveStake,\n sourcePoolAccount: poolTokenAccount,\n sourceTransferAuthority: userTransferAuthority.publicKey,\n destinationSystemAccount: solReceiver,\n managerFeeAccount: stakePool.account.data.managerFeeAccount,\n poolMint: stakePool.account.data.poolMint,\n poolTokens: poolAmount,\n solWithdrawAuthority,\n })\n\n instructions.push(withdrawTransaction)\n\n return {\n instructions,\n signers,\n }\n}\n\n/**\n * Creates instructions required to withdraw wSOL from a stake pool.\n */\nexport async function withdrawWsolWithSession(\n connection: Connection,\n stakePoolAddress: PublicKey,\n signerOrSession: PublicKey,\n userPubkey: PublicKey,\n amount: number,\n minimumLamportsOut: number = 0,\n solWithdrawAuthority?: PublicKey,\n) {\n const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const stakePool = stakePoolAccount.account.data\n const poolTokens = solToLamports(amount)\n\n const poolTokenAccount = getAssociatedTokenAddressSync(stakePool.poolMint, userPubkey)\n const tokenAccount = await getAccount(connection, poolTokenAccount)\n\n if (tokenAccount.amount < poolTokens) {\n throw new Error(\n `Not enough token balance to withdraw ${amount} pool tokens.\n Maximum withdraw amount is ${lamportsToSol(tokenAccount.amount)} pool tokens.`,\n )\n }\n\n const userWsolAccount = getAssociatedTokenAddressSync(NATIVE_MINT, userPubkey)\n\n const instructions: TransactionInstruction[] = []\n const signers: Signer[] = []\n\n instructions.push(\n createAssociatedTokenAccountIdempotentInstruction(\n signerOrSession,\n userWsolAccount,\n userPubkey,\n NATIVE_MINT,\n ),\n )\n\n const [programSigner] = PublicKey.findProgramAddressSync(\n [Buffer.from('fogo_session_program_signer')],\n stakePoolProgramId,\n )\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n instructions.push(\n StakePoolInstruction.withdrawWsolWithSession({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n withdrawAuthority,\n userTransferAuthority: signerOrSession,\n poolTokensFrom: poolTokenAccount,\n reserveStake: stakePool.reserveStake,\n userWsolAccount,\n managerFeeAccount: stakePool.managerFeeAccount,\n poolMint: stakePool.poolMint,\n tokenProgramId: stakePool.tokenProgramId,\n solWithdrawAuthority,\n wsolMint: NATIVE_MINT,\n programSigner,\n poolTokensIn: poolTokens,\n minimumLamportsOut,\n }),\n )\n\n return {\n instructions,\n signers,\n }\n}\n\nexport async function addValidatorToPool(\n connection: Connection,\n stakePoolAddress: PublicKey,\n validatorVote: PublicKey,\n seed?: number,\n) {\n const stakePoolAccount = await getStakePoolAccount(\n connection,\n stakePoolAddress,\n )\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const stakePool = stakePoolAccount.account.data\n const { reserveStake, staker, validatorList } = stakePool\n\n const validatorListAccount = await getValidatorListAccount(\n connection,\n validatorList,\n )\n\n const validatorInfo = validatorListAccount.account.data.validators.find(\n v => v.voteAccountAddress.toBase58() === validatorVote.toBase58(),\n )\n\n if (validatorInfo) {\n throw new Error('Vote account is already in validator list')\n }\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n const validatorStake = await findStakeProgramAddress(\n stakePoolProgramId,\n validatorVote,\n stakePoolAddress,\n seed,\n )\n\n const instructions: TransactionInstruction[] = [\n StakePoolInstruction.addValidatorToPool({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n staker,\n reserveStake,\n withdrawAuthority,\n validatorList,\n validatorStake,\n validatorVote,\n }),\n ]\n\n return {\n instructions,\n }\n}\n\nexport async function removeValidatorFromPool(\n connection: Connection,\n stakePoolAddress: PublicKey,\n validatorVote: PublicKey,\n seed?: number,\n) {\n const stakePoolAccount = await getStakePoolAccount(\n connection,\n stakePoolAddress,\n )\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const stakePool = stakePoolAccount.account.data\n const { staker, validatorList } = stakePool\n\n const validatorListAccount = await getValidatorListAccount(\n connection,\n validatorList,\n )\n\n const validatorInfo = validatorListAccount.account.data.validators.find(\n v => v.voteAccountAddress.toBase58() === validatorVote.toBase58(),\n )\n\n if (!validatorInfo) {\n throw new Error('Vote account is not already in validator list')\n }\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n const validatorStake = await findStakeProgramAddress(\n stakePoolProgramId,\n validatorVote,\n stakePoolAddress,\n seed,\n )\n\n const transientStakeSeed = validatorInfo.transientSeedSuffixStart\n\n const transientStake = await findTransientStakeProgramAddress(\n stakePoolProgramId,\n validatorInfo.voteAccountAddress,\n stakePoolAddress,\n transientStakeSeed,\n )\n\n const instructions: TransactionInstruction[] = [\n StakePoolInstruction.removeValidatorFromPool({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n staker,\n withdrawAuthority,\n validatorList,\n validatorStake,\n transientStake,\n }),\n ]\n\n return {\n instructions,\n }\n}\n\n/**\n * Creates instructions required to increase validator stake.\n */\nexport async function increaseValidatorStake(\n connection: Connection,\n stakePoolAddress: PublicKey,\n validatorVote: PublicKey,\n lamports: number,\n ephemeralStakeSeed?: number,\n) {\n const stakePool = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n\n const validatorList = await getValidatorListAccount(\n connection,\n stakePool.account.data.validatorList,\n )\n\n const validatorInfo = validatorList.account.data.validators.find(\n v => v.voteAccountAddress.toBase58() === validatorVote.toBase58(),\n )\n\n if (!validatorInfo) {\n throw new Error('Vote account not found in validator list')\n }\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n // Bump transient seed suffix by one to avoid reuse when not using the increaseAdditionalStake instruction\n const transientStakeSeed\n = ephemeralStakeSeed === undefined\n ? validatorInfo.transientSeedSuffixStart.addn(1)\n : validatorInfo.transientSeedSuffixStart\n\n const transientStake = await findTransientStakeProgramAddress(\n stakePoolProgramId,\n validatorInfo.voteAccountAddress,\n stakePoolAddress,\n transientStakeSeed,\n )\n\n const validatorStake = await findStakeProgramAddress(\n stakePoolProgramId,\n validatorInfo.voteAccountAddress,\n stakePoolAddress,\n )\n\n const instructions: TransactionInstruction[] = []\n\n if (ephemeralStakeSeed !== undefined) {\n const ephemeralStake = await findEphemeralStakeProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n new BN(ephemeralStakeSeed),\n )\n instructions.push(\n StakePoolInstruction.increaseAdditionalValidatorStake({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n staker: stakePool.account.data.staker,\n validatorList: stakePool.account.data.validatorList,\n reserveStake: stakePool.account.data.reserveStake,\n transientStakeSeed: transientStakeSeed.toNumber(),\n withdrawAuthority,\n transientStake,\n validatorStake,\n validatorVote,\n lamports,\n ephemeralStake,\n ephemeralStakeSeed,\n }),\n )\n } else {\n instructions.push(\n StakePoolInstruction.increaseValidatorStake({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n staker: stakePool.account.data.staker,\n validatorList: stakePool.account.data.validatorList,\n reserveStake: stakePool.account.data.reserveStake,\n transientStakeSeed: transientStakeSeed.toNumber(),\n withdrawAuthority,\n transientStake,\n validatorStake,\n validatorVote,\n lamports,\n }),\n )\n }\n\n return {\n instructions,\n }\n}\n\n/**\n * Creates instructions required to decrease validator stake.\n */\nexport async function decreaseValidatorStake(\n connection: Connection,\n stakePoolAddress: PublicKey,\n validatorVote: PublicKey,\n lamports: number,\n ephemeralStakeSeed?: number,\n) {\n const stakePool = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const validatorList = await getValidatorListAccount(\n connection,\n stakePool.account.data.validatorList,\n )\n\n const validatorInfo = validatorList.account.data.validators.find(\n v => v.voteAccountAddress.toBase58() === validatorVote.toBase58(),\n )\n\n if (!validatorInfo) {\n throw new Error('Vote account not found in validator list')\n }\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n const validatorStake = await findStakeProgramAddress(\n stakePoolProgramId,\n validatorInfo.voteAccountAddress,\n stakePoolAddress,\n )\n\n // Bump transient seed suffix by one to avoid reuse when not using the decreaseAdditionalStake instruction\n const transientStakeSeed\n = ephemeralStakeSeed === undefined\n ? validatorInfo.transientSeedSuffixStart.addn(1)\n : validatorInfo.transientSeedSuffixStart\n\n const transientStake = await findTransientStakeProgramAddress(\n stakePoolProgramId,\n validatorInfo.voteAccountAddress,\n stakePoolAddress,\n transientStakeSeed,\n )\n\n const instructions: TransactionInstruction[] = []\n\n if (ephemeralStakeSeed !== undefined) {\n const ephemeralStake = await findEphemeralStakeProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n new BN(ephemeralStakeSeed),\n )\n instructions.push(\n StakePoolInstruction.decreaseAdditionalValidatorStake({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n staker: stakePool.account.data.staker,\n validatorList: stakePool.account.data.validatorList,\n reserveStake: stakePool.account.data.reserveStake,\n transientStakeSeed: transientStakeSeed.toNumber(),\n withdrawAuthority,\n validatorStake,\n transientStake,\n lamports,\n ephemeralStake,\n ephemeralStakeSeed,\n }),\n )\n } else {\n instructions.push(\n StakePoolInstruction.decreaseValidatorStakeWithReserve({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n staker: stakePool.account.data.staker,\n validatorList: stakePool.account.data.validatorList,\n reserveStake: stakePool.account.data.reserveStake,\n transientStakeSeed: transientStakeSeed.toNumber(),\n withdrawAuthority,\n validatorStake,\n transientStake,\n lamports,\n }),\n )\n }\n\n return {\n instructions,\n }\n}\n\n/**\n * Creates instructions required to completely update a stake pool after epoch change.\n */\nexport async function updateStakePool(\n connection: Connection,\n stakePool: StakePoolAccount,\n noMerge = false,\n) {\n const stakePoolAddress = stakePool.pubkey\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n\n const validatorList = await getValidatorListAccount(\n connection,\n stakePool.account.data.validatorList,\n )\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n const updateListInstructions: TransactionInstruction[] = []\n const instructions: TransactionInstruction[] = []\n\n let startIndex = 0\n const validatorChunks: Array<ValidatorStakeInfo[]> = arrayChunk(\n validatorList.account.data.validators,\n MAX_VALIDATORS_TO_UPDATE,\n )\n\n for (const validatorChunk of validatorChunks) {\n const validatorAndTransientStakePairs: PublicKey[] = []\n\n for (const validator of validatorChunk) {\n const validatorStake = await findStakeProgramAddress(\n stakePoolProgramId,\n validator.voteAccountAddress,\n stakePoolAddress,\n )\n validatorAndTransientStakePairs.push(validatorStake)\n\n const transientStake = await findTransientStakeProgramAddress(\n stakePoolProgramId,\n validator.voteAccountAddress,\n stakePoolAddress,\n validator.transientSeedSuffixStart,\n )\n validatorAndTransientStakePairs.push(transientStake)\n }\n\n updateListInstructions.push(\n StakePoolInstruction.updateValidatorListBalance({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n validatorList: stakePool.account.data.validatorList,\n reserveStake: stakePool.account.data.reserveStake,\n validatorAndTransientStakePairs,\n withdrawAuthority,\n startIndex,\n noMerge,\n }),\n )\n startIndex += MAX_VALIDATORS_TO_UPDATE\n }\n\n instructions.push(\n StakePoolInstruction.updateStakePoolBalance({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n validatorList: stakePool.account.data.validatorList,\n reserveStake: stakePool.account.data.reserveStake,\n managerFeeAccount: stakePool.account.data.managerFeeAccount,\n poolMint: stakePool.account.data.poolMint,\n withdrawAuthority,\n }),\n )\n\n instructions.push(\n StakePoolInstruction.cleanupRemovedValidatorEntries({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n validatorList: stakePool.account.data.validatorList,\n }),\n )\n\n return {\n updateListInstructions,\n finalInstructions: instructions,\n }\n}\n\n/**\n * Retrieves detailed information about the StakePool.\n */\nexport async function stakePoolInfo(\n connection: Connection,\n stakePoolAddress: PublicKey,\n) {\n const stakePool = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n const reserveAccountStakeAddress = stakePool.account.data.reserveStake\n const totalLamports = stakePool.account.data.totalLamports\n const lastUpdateEpoch = stakePool.account.data.lastUpdateEpoch\n\n const validatorList = await getValidatorListAccount(\n connection,\n stakePool.account.data.validatorList,\n )\n\n const maxNumberOfValidators = validatorList.account.data.maxValidators\n const currentNumberOfValidators\n = validatorList.account.data.validators.length\n\n const epochInfo = await connection.getEpochInfo()\n const reserveStake = await connection.getAccountInfo(\n reserveAccountStakeAddress,\n )\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n const minimumReserveStakeBalance\n = await connection.getMinimumBalanceForRentExemption(StakeProgram.space)\n\n const stakeAccounts = await Promise.all(\n validatorList.account.data.validators.map(async (validator) => {\n const stakeAccountAddress = await findStakeProgramAddress(\n stakePoolProgramId,\n validator.voteAccountAddress,\n stakePoolAddress,\n )\n const transientStakeAccountAddress\n = await findTransientStakeProgramAddress(\n stakePoolProgramId,\n validator.voteAccountAddress,\n stakePoolAddress,\n validator.transientSeedSuffixStart,\n )\n const updateRequired = !validator.lastUpdateEpoch.eqn(epochInfo.epoch)\n return {\n voteAccountAddress: validator.voteAccountAddress.toBase58(),\n stakeAccountAddress: stakeAccountAddress.toBase58(),\n validatorActiveStakeLamports: validator.activeStakeLamports.toString(),\n validatorLastUpdateEpoch: validator.lastUpdateEpoch.toString(),\n validatorLamports: validator.activeStakeLamports\n .add(validator.transientStakeLamports)\n .toString(),\n validatorTransientStakeAccountAddress:\n transientStakeAccountAddress.toBase58(),\n validatorTransientStakeLamports:\n validator.transientStakeLamports.toString(),\n updateRequired,\n }\n }),\n )\n\n const totalPoolTokens = lamportsToSol(stakePool.account.data.poolTokenSupply)\n const updateRequired = !lastUpdateEpoch.eqn(epochInfo.epoch)\n\n return {\n address: stakePoolAddress.toBase58(),\n poolWithdrawAuthority: withdrawAuthority.toBase58(),\n manager: stakePool.account.data.manager.toBase58(),\n staker: stakePool.account.data.staker.toBase58(),\n stakeDepositAuthority:\n stakePool.account.data.stakeDepositAuthority.toBase58(),\n stakeWithdrawBumpSeed: stakePool.account.data.stakeWithdrawBumpSeed,\n maxValidators: maxNumberOfValidators,\n validatorList: validatorList.account.data.validators.map((validator) => {\n return {\n activeStakeLamports: validator.activeStakeLamports.toString(),\n transientStakeLamports: validator.transientStakeLamports.toString(),\n lastUpdateEpoch: validator.lastUpdateEpoch.toString(),\n transientSeedSuffixStart: validator.transientSeedSuffixStart.toString(),\n transientSeedSuffixEnd: validator.transientSeedSuffixEnd.toString(),\n status: validator.status.toString(),\n voteAccountAddress: validator.voteAccountAddress.toString(),\n }\n }), // CliStakePoolValidator\n validatorListStorageAccount:\n stakePool.account.data.validatorList.toBase58(),\n reserveStake: stakePool.account.data.reserveStake.toBase58(),\n poolMint: stakePool.account.data.poolMint.toBase58(),\n managerFeeAccount: stakePool.account.data.managerFeeAccount.toBase58(),\n tokenProgramId: stakePool.account.data.tokenProgramId.toBase58(),\n totalLamports: stakePool.account.data.totalLamports.toString(),\n poolTokenSupply: stakePool.account.data.poolTokenSupply.toString(),\n lastUpdateEpoch: stakePool.account.data.lastUpdateEpoch.toString(),\n lockup: stakePool.account.data.lockup, // pub lockup: CliStakePoolLockup\n epochFee: stakePool.account.data.epochFee,\n nextEpochFee: stakePool.account.data.nextEpochFee,\n preferredDepositValidatorVoteAddress:\n stakePool.account.data.preferredDepositValidatorVoteAddress,\n preferredWithdrawValidatorVoteAddress:\n stakePool.account.data.preferredWithdrawValidatorVoteAddress,\n stakeDepositFee: stakePool.account.data.stakeDepositFee,\n stakeWithdrawalFee: stakePool.account.data.stakeWithdrawalFee,\n // CliStakePool the same\n nextStakeWithdrawalFee: stakePool.account.data.nextStakeWithdrawalFee,\n stakeReferralFee: stakePool.account.data.stakeReferralFee,\n solDepositAuthority: stakePool.account.data.solDepositAuthority?.toBase58(),\n solDepositFee: stakePool.account.data.solDepositFee,\n solReferralFee: stakePool.account.data.solReferralFee,\n solWithdrawAuthority:\n stakePool.account.data.solWithdrawAuthority?.toBase58(),\n solWithdrawalFee: stakePool.account.data.solWithdrawalFee,\n nextSolWithdrawalFee: stakePool.account.data.nextSolWithdrawalFee,\n lastEpochPoolTokenSupply:\n stakePool.account.data.lastEpochPoolTokenSupply.toString(),\n lastEpochTotalLamports:\n stakePool.account.data.lastEpochTotalLamports.toString(),\n details: {\n reserveStakeLamports: reserveStake?.lamports,\n reserveAccountStakeAddress: reserveAccountStakeAddress.toBase58(),\n minimumReserveStakeBalance,\n stakeAccounts,\n totalLamports,\n totalPoolTokens,\n currentNumberOfValidators,\n maxNumberOfValidators,\n updateRequired,\n }, // CliStakePoolDetails\n }\n}\n\n/**\n * Creates instructions required to create pool token metadata.\n */\nexport async function createPoolTokenMetadata(\n connection: Connection,\n stakePoolAddress: PublicKey,\n payer: PublicKey,\n name: string,\n symbol: string,\n uri: string,\n) {\n const stakePool = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n const tokenMetadata = findMetadataAddress(stakePool.account.data.poolMint)\n const manager = stakePool.account.data.manager\n\n const instructions: TransactionInstruction[] = []\n instructions.push(\n StakePoolInstruction.createTokenMetadata({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n poolMint: stakePool.account.data.poolMint,\n payer,\n manager,\n tokenMetadata,\n withdrawAuthority,\n name,\n symbol,\n uri,\n }),\n )\n\n return {\n instructions,\n }\n}\n\n/**\n * Creates instructions required to update pool token metadata.\n */\nexport async function updatePoolTokenMetadata(\n connection: Connection,\n stakePoolAddress: PublicKey,\n name: string,\n symbol: string,\n uri: string,\n) {\n const stakePool = await getStakePoolAccount(connection, stakePoolAddress)\n const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)\n\n const withdrawAuthority = await findWithdrawAuthorityProgramAddress(\n stakePoolProgramId,\n stakePoolAddress,\n )\n\n const tokenMetadata = findMetadataAddress(stakePool.account.data.poolMint)\n\n const instructions: TransactionInstruction[] = []\n instructions.push(\n StakePoolInstruction.updateTokenMetadata({\n programId: stakePoolProgramId,\n stakePool: stakePoolAddress,\n manager: stakePool.account.data.manager,\n tokenMetadata,\n withdrawAuthority,\n name,\n symbol,\n uri,\n }),\n )\n\n return {\n instructions,\n }\n}\n"],"names":["PublicKey","Buffer","LAMPORTS_PER_SOL","LayoutCls","blob","u8","u32","struct","seq","offset","StakeProgram","Keypair","SystemProgram","BufferLayout","SYSVAR_RENT_PUBKEY","SYSVAR_CLOCK_PUBKEY","SYSVAR_STAKE_HISTORY_PUBKEY","STAKE_CONFIG_ID","TransactionInstruction","TOKEN_PROGRAM_ID","ASSOCIATED_TOKEN_PROGRAM_ID","getAssociatedTokenAddressSync","createAssociatedTokenAccountIdempotentInstruction","StakeAuthorizationLayout","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