diff --git a/sdk/codama.descro.json b/sdk/codama.descro.json new file mode 100644 index 0000000..9cf422b --- /dev/null +++ b/sdk/codama.descro.json @@ -0,0 +1,11 @@ +{ + "idl": "./src/idl/descro.json", + "scripts": { + "js": [ + { + "from": "@codama/renderers-js", + "args": ["./src/generated/descro"] + } + ] + } +} diff --git a/sdk/codama.registry.json b/sdk/codama.registry.json new file mode 100644 index 0000000..ba07ed0 --- /dev/null +++ b/sdk/codama.registry.json @@ -0,0 +1,11 @@ +{ + "idl": "./src/idl/descro_ext_resolvers.json", + "scripts": { + "js": [ + { + "from": "@codama/renderers-js", + "args": ["./src/generated/descro_ext_resolvers"] + } + ] + } +} diff --git a/sdk/package.json b/sdk/package.json index 60fd30a..36afcd3 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -4,13 +4,16 @@ "private": true, "main": "./src/index.ts", "types": "./src/index.ts", + "scripts": { + "generate": "codama run js --config codama.descro.json && codama run js --config codama.registry.json" + }, "dependencies": { - "@coral-xyz/anchor": "^0.32.1", - "@solana/web3.js": "^1.98.4", - "bn.js": "^5.2.3" + "@solana/kit": "^6.0.0" }, "devDependencies": { - "@types/bn.js": "^5.2.0", + "@codama/nodes-from-anchor": "^1.4.1", + "@codama/renderers-js": "^2.2.0", + "codama": "^1.6.0", "typescript": "^6.0.3" } } diff --git a/sdk/src/generated/descro/package.json b/sdk/src/generated/descro/package.json new file mode 100644 index 0000000..3250d35 --- /dev/null +++ b/sdk/src/generated/descro/package.json @@ -0,0 +1,22 @@ +{ + "name": "js-client", + "version": "1.0.0", + "description": "", + "main": "src/index.ts", + "files": [ + "./dist/src", + "./dist/types", + "./src/" + ], + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "peerDependencies": { + "@solana/kit": "^6.4.0" + }, + "dependencies": { + "@solana/program-client-core": "^6.4.0" + } +} diff --git a/sdk/src/generated/descro/src/generated/accounts/escrowAccount.ts b/sdk/src/generated/descro/src/generated/accounts/escrowAccount.ts new file mode 100644 index 0000000..68df5c5 --- /dev/null +++ b/sdk/src/generated/descro/src/generated/accounts/escrowAccount.ts @@ -0,0 +1,181 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + assertAccountExists, + assertAccountsExist, + combineCodec, + decodeAccount, + fetchEncodedAccount, + fetchEncodedAccounts, + fixDecoderSize, + fixEncoderSize, + getAddressDecoder, + getAddressEncoder, + getBytesDecoder, + getBytesEncoder, + getOptionDecoder, + getOptionEncoder, + getStructDecoder, + getStructEncoder, + getU64Decoder, + getU64Encoder, + getU8Decoder, + getU8Encoder, + transformEncoder, + type Account, + type Address, + type Codec, + type Decoder, + type EncodedAccount, + type Encoder, + type FetchAccountConfig, + type FetchAccountsConfig, + type MaybeAccount, + type MaybeEncodedAccount, + type Option, + type OptionOrNullable, + type ReadonlyUint8Array, +} from "@solana/kit"; +import { + getEscrowStateDecoder, + getEscrowStateEncoder, + type EscrowState, + type EscrowStateArgs, +} from "../types"; + +export const ESCROW_ACCOUNT_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([ + 36, 69, 48, 18, 128, 225, 125, 135, +]); + +export function getEscrowAccountDiscriminatorBytes(): ReadonlyUint8Array { + return fixEncoderSize(getBytesEncoder(), 8).encode( + ESCROW_ACCOUNT_DISCRIMINATOR, + ); +} + +export type EscrowAccount = { + discriminator: ReadonlyUint8Array; + seller: Address; + buyer: Address; + amount: bigint; + disputeResolver: Option
; + state: EscrowState; + bump: number; + vaultBump: number; + escrowId: bigint; +}; + +export type EscrowAccountArgs = { + seller: Address; + buyer: Address; + amount: number | bigint; + disputeResolver: OptionOrNullable
; + state: EscrowStateArgs; + bump: number; + vaultBump: number; + escrowId: number | bigint; +}; + +/** Gets the encoder for {@link EscrowAccountArgs} account data. */ +export function getEscrowAccountEncoder(): Encoder { + return transformEncoder( + getStructEncoder([ + ["discriminator", fixEncoderSize(getBytesEncoder(), 8)], + ["seller", getAddressEncoder()], + ["buyer", getAddressEncoder()], + ["amount", getU64Encoder()], + ["disputeResolver", getOptionEncoder(getAddressEncoder())], + ["state", getEscrowStateEncoder()], + ["bump", getU8Encoder()], + ["vaultBump", getU8Encoder()], + ["escrowId", getU64Encoder()], + ]), + (value) => ({ ...value, discriminator: ESCROW_ACCOUNT_DISCRIMINATOR }), + ); +} + +/** Gets the decoder for {@link EscrowAccount} account data. */ +export function getEscrowAccountDecoder(): Decoder { + return getStructDecoder([ + ["discriminator", fixDecoderSize(getBytesDecoder(), 8)], + ["seller", getAddressDecoder()], + ["buyer", getAddressDecoder()], + ["amount", getU64Decoder()], + ["disputeResolver", getOptionDecoder(getAddressDecoder())], + ["state", getEscrowStateDecoder()], + ["bump", getU8Decoder()], + ["vaultBump", getU8Decoder()], + ["escrowId", getU64Decoder()], + ]); +} + +/** Gets the codec for {@link EscrowAccount} account data. */ +export function getEscrowAccountCodec(): Codec< + EscrowAccountArgs, + EscrowAccount +> { + return combineCodec(getEscrowAccountEncoder(), getEscrowAccountDecoder()); +} + +export function decodeEscrowAccount( + encodedAccount: EncodedAccount, +): Account; +export function decodeEscrowAccount( + encodedAccount: MaybeEncodedAccount, +): MaybeAccount; +export function decodeEscrowAccount( + encodedAccount: EncodedAccount | MaybeEncodedAccount, +): Account | MaybeAccount { + return decodeAccount( + encodedAccount as MaybeEncodedAccount, + getEscrowAccountDecoder(), + ); +} + +export async function fetchEscrowAccount( + rpc: Parameters[0], + address: Address, + config?: FetchAccountConfig, +): Promise> { + const maybeAccount = await fetchMaybeEscrowAccount(rpc, address, config); + assertAccountExists(maybeAccount); + return maybeAccount; +} + +export async function fetchMaybeEscrowAccount( + rpc: Parameters[0], + address: Address, + config?: FetchAccountConfig, +): Promise> { + const maybeAccount = await fetchEncodedAccount(rpc, address, config); + return decodeEscrowAccount(maybeAccount); +} + +export async function fetchAllEscrowAccount( + rpc: Parameters[0], + addresses: Array
, + config?: FetchAccountsConfig, +): Promise[]> { + const maybeAccounts = await fetchAllMaybeEscrowAccount( + rpc, + addresses, + config, + ); + assertAccountsExist(maybeAccounts); + return maybeAccounts; +} + +export async function fetchAllMaybeEscrowAccount( + rpc: Parameters[0], + addresses: Array
, + config?: FetchAccountsConfig, +): Promise[]> { + const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config); + return maybeAccounts.map((maybeAccount) => decodeEscrowAccount(maybeAccount)); +} diff --git a/sdk/src/generated/descro/src/generated/accounts/index.ts b/sdk/src/generated/descro/src/generated/accounts/index.ts new file mode 100644 index 0000000..d298919 --- /dev/null +++ b/sdk/src/generated/descro/src/generated/accounts/index.ts @@ -0,0 +1,9 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +export * from "./escrowAccount"; diff --git a/sdk/src/generated/descro/src/generated/errors/descro.ts b/sdk/src/generated/descro/src/generated/errors/descro.ts new file mode 100644 index 0000000..d05604d --- /dev/null +++ b/sdk/src/generated/descro/src/generated/errors/descro.ts @@ -0,0 +1,68 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + isProgramError, + type Address, + type SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM, + type SolanaError, +} from "@solana/kit"; +import { DESCRO_PROGRAM_ADDRESS } from "../programs"; + +/** InvalidState: Invalid state for this instruction */ +export const DESCRO_ERROR__INVALID_STATE = 0x1770; // 6000 +/** Unauthorized: Signer is not authorized */ +export const DESCRO_ERROR__UNAUTHORIZED = 0x1771; // 6001 +/** NoResolverConfigured: No resolver configured for this escrow */ +export const DESCRO_ERROR__NO_RESOLVER_CONFIGURED = 0x1772; // 6002 +/** UnauthorizedResolver: Signer is not the configured resolver */ +export const DESCRO_ERROR__UNAUTHORIZED_RESOLVER = 0x1773; // 6003 +/** Expired: Escrow has expired */ +export const DESCRO_ERROR__EXPIRED = 0x1774; // 6004 + +export type DescroError = + | typeof DESCRO_ERROR__EXPIRED + | typeof DESCRO_ERROR__INVALID_STATE + | typeof DESCRO_ERROR__NO_RESOLVER_CONFIGURED + | typeof DESCRO_ERROR__UNAUTHORIZED + | typeof DESCRO_ERROR__UNAUTHORIZED_RESOLVER; + +let descroErrorMessages: Record | undefined; +if (process.env["NODE_ENV"] !== "production") { + descroErrorMessages = { + [DESCRO_ERROR__EXPIRED]: `Escrow has expired`, + [DESCRO_ERROR__INVALID_STATE]: `Invalid state for this instruction`, + [DESCRO_ERROR__NO_RESOLVER_CONFIGURED]: `No resolver configured for this escrow`, + [DESCRO_ERROR__UNAUTHORIZED]: `Signer is not authorized`, + [DESCRO_ERROR__UNAUTHORIZED_RESOLVER]: `Signer is not the configured resolver`, + }; +} + +export function getDescroErrorMessage(code: DescroError): string { + if (process.env["NODE_ENV"] !== "production") { + return (descroErrorMessages as Record)[code]; + } + + return "Error message not available in production bundles."; +} + +export function isDescroError( + error: unknown, + transactionMessage: { + instructions: Record; + }, + code?: TProgramErrorCode, +): error is SolanaError & + Readonly<{ context: Readonly<{ code: TProgramErrorCode }> }> { + return isProgramError( + error, + transactionMessage, + DESCRO_PROGRAM_ADDRESS, + code, + ); +} diff --git a/sdk/src/generated/descro/src/generated/errors/index.ts b/sdk/src/generated/descro/src/generated/errors/index.ts new file mode 100644 index 0000000..3d77c4e --- /dev/null +++ b/sdk/src/generated/descro/src/generated/errors/index.ts @@ -0,0 +1,9 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +export * from "./descro"; diff --git a/sdk/src/generated/descro/src/generated/index.ts b/sdk/src/generated/descro/src/generated/index.ts new file mode 100644 index 0000000..74d2752 --- /dev/null +++ b/sdk/src/generated/descro/src/generated/index.ts @@ -0,0 +1,14 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +export * from "./accounts"; +export * from "./errors"; +export * from "./instructions"; +export * from "./pdas"; +export * from "./programs"; +export * from "./types"; diff --git a/sdk/src/generated/descro/src/generated/instructions/cancel.ts b/sdk/src/generated/descro/src/generated/instructions/cancel.ts new file mode 100644 index 0000000..a3ac96f --- /dev/null +++ b/sdk/src/generated/descro/src/generated/instructions/cancel.ts @@ -0,0 +1,211 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + combineCodec, + fixDecoderSize, + fixEncoderSize, + getBytesDecoder, + getBytesEncoder, + getStructDecoder, + getStructEncoder, + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + SolanaError, + transformEncoder, + type AccountMeta, + type AccountSignerMeta, + type Address, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, + type ReadonlyAccount, + type ReadonlyUint8Array, + type TransactionSigner, + type WritableAccount, + type WritableSignerAccount, +} from "@solana/kit"; +import { + getAccountMetaFactory, + type ResolvedInstructionAccount, +} from "@solana/program-client-core"; +import { DESCRO_PROGRAM_ADDRESS } from "../programs"; + +export const CANCEL_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([ + 232, 219, 223, 41, 219, 236, 220, 190, +]); + +export function getCancelDiscriminatorBytes(): ReadonlyUint8Array { + return fixEncoderSize(getBytesEncoder(), 8).encode(CANCEL_DISCRIMINATOR); +} + +export type CancelInstruction< + TProgram extends string = typeof DESCRO_PROGRAM_ADDRESS, + TAccountSeller extends string | AccountMeta = string, + TAccountEscrowAccount extends string | AccountMeta = string, + TAccountSystemProgram extends string | AccountMeta = + "11111111111111111111111111111111", + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< + [ + TAccountSeller extends string + ? WritableSignerAccount & + AccountSignerMeta + : TAccountSeller, + TAccountEscrowAccount extends string + ? WritableAccount + : TAccountEscrowAccount, + TAccountSystemProgram extends string + ? ReadonlyAccount + : TAccountSystemProgram, + ...TRemainingAccounts, + ] + >; + +export type CancelInstructionData = { discriminator: ReadonlyUint8Array }; + +export type CancelInstructionDataArgs = {}; + +export function getCancelInstructionDataEncoder(): FixedSizeEncoder { + return transformEncoder( + getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]), + (value) => ({ ...value, discriminator: CANCEL_DISCRIMINATOR }), + ); +} + +export function getCancelInstructionDataDecoder(): FixedSizeDecoder { + return getStructDecoder([ + ["discriminator", fixDecoderSize(getBytesDecoder(), 8)], + ]); +} + +export function getCancelInstructionDataCodec(): FixedSizeCodec< + CancelInstructionDataArgs, + CancelInstructionData +> { + return combineCodec( + getCancelInstructionDataEncoder(), + getCancelInstructionDataDecoder(), + ); +} + +export type CancelInput< + TAccountSeller extends string = string, + TAccountEscrowAccount extends string = string, + TAccountSystemProgram extends string = string, +> = { + seller: TransactionSigner; + escrowAccount: Address; + systemProgram?: Address; +}; + +export function getCancelInstruction< + TAccountSeller extends string, + TAccountEscrowAccount extends string, + TAccountSystemProgram extends string, + TProgramAddress extends Address = typeof DESCRO_PROGRAM_ADDRESS, +>( + input: CancelInput< + TAccountSeller, + TAccountEscrowAccount, + TAccountSystemProgram + >, + config?: { programAddress?: TProgramAddress }, +): CancelInstruction< + TProgramAddress, + TAccountSeller, + TAccountEscrowAccount, + TAccountSystemProgram +> { + // Program address. + const programAddress = config?.programAddress ?? DESCRO_PROGRAM_ADDRESS; + + // Original accounts. + const originalAccounts = { + seller: { value: input.seller ?? null, isWritable: true }, + escrowAccount: { value: input.escrowAccount ?? null, isWritable: true }, + systemProgram: { value: input.systemProgram ?? null, isWritable: false }, + }; + const accounts = originalAccounts as Record< + keyof typeof originalAccounts, + ResolvedInstructionAccount + >; + + // Resolve default values. + if (!accounts.systemProgram.value) { + accounts.systemProgram.value = + "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">; + } + + const getAccountMeta = getAccountMetaFactory(programAddress, "programId"); + return Object.freeze({ + accounts: [ + getAccountMeta("seller", accounts.seller), + getAccountMeta("escrowAccount", accounts.escrowAccount), + getAccountMeta("systemProgram", accounts.systemProgram), + ], + data: getCancelInstructionDataEncoder().encode({}), + programAddress, + } as CancelInstruction< + TProgramAddress, + TAccountSeller, + TAccountEscrowAccount, + TAccountSystemProgram + >); +} + +export type ParsedCancelInstruction< + TProgram extends string = typeof DESCRO_PROGRAM_ADDRESS, + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], +> = { + programAddress: Address; + accounts: { + seller: TAccountMetas[0]; + escrowAccount: TAccountMetas[1]; + systemProgram: TAccountMetas[2]; + }; + data: CancelInstructionData; +}; + +export function parseCancelInstruction< + TProgram extends string, + TAccountMetas extends readonly AccountMeta[], +>( + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData, +): ParsedCancelInstruction { + if (instruction.accounts.length < 3) { + throw new SolanaError( + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + { + actualAccountMetas: instruction.accounts.length, + expectedAccountMetas: 3, + }, + ); + } + let accountIndex = 0; + const getNextAccount = () => { + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; + accountIndex += 1; + return accountMeta; + }; + return { + programAddress: instruction.programAddress, + accounts: { + seller: getNextAccount(), + escrowAccount: getNextAccount(), + systemProgram: getNextAccount(), + }, + data: getCancelInstructionDataDecoder().decode(instruction.data), + }; +} diff --git a/sdk/src/generated/descro/src/generated/instructions/complete.ts b/sdk/src/generated/descro/src/generated/instructions/complete.ts new file mode 100644 index 0000000..5d43f22 --- /dev/null +++ b/sdk/src/generated/descro/src/generated/instructions/complete.ts @@ -0,0 +1,332 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + combineCodec, + fixDecoderSize, + fixEncoderSize, + getBytesDecoder, + getBytesEncoder, + getStructDecoder, + getStructEncoder, + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + SolanaError, + transformEncoder, + type AccountMeta, + type AccountSignerMeta, + type Address, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, + type ReadonlyAccount, + type ReadonlySignerAccount, + type ReadonlyUint8Array, + type TransactionSigner, + type WritableAccount, +} from "@solana/kit"; +import { + getAccountMetaFactory, + getAddressFromResolvedInstructionAccount, + type ResolvedInstructionAccount, +} from "@solana/program-client-core"; +import { findVaultPda } from "../pdas"; +import { DESCRO_PROGRAM_ADDRESS } from "../programs"; + +export const COMPLETE_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([ + 0, 77, 224, 147, 136, 25, 88, 76, +]); + +export function getCompleteDiscriminatorBytes(): ReadonlyUint8Array { + return fixEncoderSize(getBytesEncoder(), 8).encode(COMPLETE_DISCRIMINATOR); +} + +export type CompleteInstruction< + TProgram extends string = typeof DESCRO_PROGRAM_ADDRESS, + TAccountBuyer extends string | AccountMeta = string, + TAccountSeller extends string | AccountMeta = string, + TAccountEscrowAccount extends string | AccountMeta = string, + TAccountVault extends string | AccountMeta = string, + TAccountSystemProgram extends string | AccountMeta = + "11111111111111111111111111111111", + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< + [ + TAccountBuyer extends string + ? ReadonlySignerAccount & + AccountSignerMeta + : TAccountBuyer, + TAccountSeller extends string + ? WritableAccount + : TAccountSeller, + TAccountEscrowAccount extends string + ? WritableAccount + : TAccountEscrowAccount, + TAccountVault extends string + ? WritableAccount + : TAccountVault, + TAccountSystemProgram extends string + ? ReadonlyAccount + : TAccountSystemProgram, + ...TRemainingAccounts, + ] + >; + +export type CompleteInstructionData = { discriminator: ReadonlyUint8Array }; + +export type CompleteInstructionDataArgs = {}; + +export function getCompleteInstructionDataEncoder(): FixedSizeEncoder { + return transformEncoder( + getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]), + (value) => ({ ...value, discriminator: COMPLETE_DISCRIMINATOR }), + ); +} + +export function getCompleteInstructionDataDecoder(): FixedSizeDecoder { + return getStructDecoder([ + ["discriminator", fixDecoderSize(getBytesDecoder(), 8)], + ]); +} + +export function getCompleteInstructionDataCodec(): FixedSizeCodec< + CompleteInstructionDataArgs, + CompleteInstructionData +> { + return combineCodec( + getCompleteInstructionDataEncoder(), + getCompleteInstructionDataDecoder(), + ); +} + +export type CompleteAsyncInput< + TAccountBuyer extends string = string, + TAccountSeller extends string = string, + TAccountEscrowAccount extends string = string, + TAccountVault extends string = string, + TAccountSystemProgram extends string = string, +> = { + buyer: TransactionSigner; + seller: Address; + escrowAccount: Address; + vault?: Address; + systemProgram?: Address; +}; + +export async function getCompleteInstructionAsync< + TAccountBuyer extends string, + TAccountSeller extends string, + TAccountEscrowAccount extends string, + TAccountVault extends string, + TAccountSystemProgram extends string, + TProgramAddress extends Address = typeof DESCRO_PROGRAM_ADDRESS, +>( + input: CompleteAsyncInput< + TAccountBuyer, + TAccountSeller, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram + >, + config?: { programAddress?: TProgramAddress }, +): Promise< + CompleteInstruction< + TProgramAddress, + TAccountBuyer, + TAccountSeller, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram + > +> { + // Program address. + const programAddress = config?.programAddress ?? DESCRO_PROGRAM_ADDRESS; + + // Original accounts. + const originalAccounts = { + buyer: { value: input.buyer ?? null, isWritable: false }, + seller: { value: input.seller ?? null, isWritable: true }, + escrowAccount: { value: input.escrowAccount ?? null, isWritable: true }, + vault: { value: input.vault ?? null, isWritable: true }, + systemProgram: { value: input.systemProgram ?? null, isWritable: false }, + }; + const accounts = originalAccounts as Record< + keyof typeof originalAccounts, + ResolvedInstructionAccount + >; + + // Resolve default values. + if (!accounts.vault.value) { + accounts.vault.value = await findVaultPda({ + escrowAccount: getAddressFromResolvedInstructionAccount( + "escrowAccount", + accounts.escrowAccount.value, + ), + }); + } + if (!accounts.systemProgram.value) { + accounts.systemProgram.value = + "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">; + } + + const getAccountMeta = getAccountMetaFactory(programAddress, "programId"); + return Object.freeze({ + accounts: [ + getAccountMeta("buyer", accounts.buyer), + getAccountMeta("seller", accounts.seller), + getAccountMeta("escrowAccount", accounts.escrowAccount), + getAccountMeta("vault", accounts.vault), + getAccountMeta("systemProgram", accounts.systemProgram), + ], + data: getCompleteInstructionDataEncoder().encode({}), + programAddress, + } as CompleteInstruction< + TProgramAddress, + TAccountBuyer, + TAccountSeller, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram + >); +} + +export type CompleteInput< + TAccountBuyer extends string = string, + TAccountSeller extends string = string, + TAccountEscrowAccount extends string = string, + TAccountVault extends string = string, + TAccountSystemProgram extends string = string, +> = { + buyer: TransactionSigner; + seller: Address; + escrowAccount: Address; + vault: Address; + systemProgram?: Address; +}; + +export function getCompleteInstruction< + TAccountBuyer extends string, + TAccountSeller extends string, + TAccountEscrowAccount extends string, + TAccountVault extends string, + TAccountSystemProgram extends string, + TProgramAddress extends Address = typeof DESCRO_PROGRAM_ADDRESS, +>( + input: CompleteInput< + TAccountBuyer, + TAccountSeller, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram + >, + config?: { programAddress?: TProgramAddress }, +): CompleteInstruction< + TProgramAddress, + TAccountBuyer, + TAccountSeller, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram +> { + // Program address. + const programAddress = config?.programAddress ?? DESCRO_PROGRAM_ADDRESS; + + // Original accounts. + const originalAccounts = { + buyer: { value: input.buyer ?? null, isWritable: false }, + seller: { value: input.seller ?? null, isWritable: true }, + escrowAccount: { value: input.escrowAccount ?? null, isWritable: true }, + vault: { value: input.vault ?? null, isWritable: true }, + systemProgram: { value: input.systemProgram ?? null, isWritable: false }, + }; + const accounts = originalAccounts as Record< + keyof typeof originalAccounts, + ResolvedInstructionAccount + >; + + // Resolve default values. + if (!accounts.systemProgram.value) { + accounts.systemProgram.value = + "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">; + } + + const getAccountMeta = getAccountMetaFactory(programAddress, "programId"); + return Object.freeze({ + accounts: [ + getAccountMeta("buyer", accounts.buyer), + getAccountMeta("seller", accounts.seller), + getAccountMeta("escrowAccount", accounts.escrowAccount), + getAccountMeta("vault", accounts.vault), + getAccountMeta("systemProgram", accounts.systemProgram), + ], + data: getCompleteInstructionDataEncoder().encode({}), + programAddress, + } as CompleteInstruction< + TProgramAddress, + TAccountBuyer, + TAccountSeller, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram + >); +} + +export type ParsedCompleteInstruction< + TProgram extends string = typeof DESCRO_PROGRAM_ADDRESS, + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], +> = { + programAddress: Address; + accounts: { + buyer: TAccountMetas[0]; + seller: TAccountMetas[1]; + escrowAccount: TAccountMetas[2]; + vault: TAccountMetas[3]; + systemProgram: TAccountMetas[4]; + }; + data: CompleteInstructionData; +}; + +export function parseCompleteInstruction< + TProgram extends string, + TAccountMetas extends readonly AccountMeta[], +>( + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData, +): ParsedCompleteInstruction { + if (instruction.accounts.length < 5) { + throw new SolanaError( + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + { + actualAccountMetas: instruction.accounts.length, + expectedAccountMetas: 5, + }, + ); + } + let accountIndex = 0; + const getNextAccount = () => { + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; + accountIndex += 1; + return accountMeta; + }; + return { + programAddress: instruction.programAddress, + accounts: { + buyer: getNextAccount(), + seller: getNextAccount(), + escrowAccount: getNextAccount(), + vault: getNextAccount(), + systemProgram: getNextAccount(), + }, + data: getCompleteInstructionDataDecoder().decode(instruction.data), + }; +} diff --git a/sdk/src/generated/descro/src/generated/instructions/createEscrow.ts b/sdk/src/generated/descro/src/generated/instructions/createEscrow.ts new file mode 100644 index 0000000..ac45626 --- /dev/null +++ b/sdk/src/generated/descro/src/generated/instructions/createEscrow.ts @@ -0,0 +1,385 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + combineCodec, + fixDecoderSize, + fixEncoderSize, + getAddressDecoder, + getAddressEncoder, + getBytesDecoder, + getBytesEncoder, + getOptionDecoder, + getOptionEncoder, + getStructDecoder, + getStructEncoder, + getU64Decoder, + getU64Encoder, + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + SolanaError, + transformEncoder, + type AccountMeta, + type AccountSignerMeta, + type Address, + type Codec, + type Decoder, + type Encoder, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, + type Option, + type OptionOrNullable, + type ReadonlyAccount, + type ReadonlyUint8Array, + type TransactionSigner, + type WritableAccount, + type WritableSignerAccount, +} from "@solana/kit"; +import { + getAccountMetaFactory, + getAddressFromResolvedInstructionAccount, + getNonNullResolvedInstructionInput, + type ResolvedInstructionAccount, +} from "@solana/program-client-core"; +import { findEscrowAccountPda, findVaultPda } from "../pdas"; +import { DESCRO_PROGRAM_ADDRESS } from "../programs"; + +export const CREATE_ESCROW_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([ + 253, 215, 165, 116, 36, 108, 68, 80, +]); + +export function getCreateEscrowDiscriminatorBytes(): ReadonlyUint8Array { + return fixEncoderSize(getBytesEncoder(), 8).encode( + CREATE_ESCROW_DISCRIMINATOR, + ); +} + +export type CreateEscrowInstruction< + TProgram extends string = typeof DESCRO_PROGRAM_ADDRESS, + TAccountSeller extends string | AccountMeta = string, + TAccountBuyer extends string | AccountMeta = string, + TAccountEscrowAccount extends string | AccountMeta = string, + TAccountVault extends string | AccountMeta = string, + TAccountSystemProgram extends string | AccountMeta = + "11111111111111111111111111111111", + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< + [ + TAccountSeller extends string + ? WritableSignerAccount & + AccountSignerMeta + : TAccountSeller, + TAccountBuyer extends string + ? ReadonlyAccount + : TAccountBuyer, + TAccountEscrowAccount extends string + ? WritableAccount + : TAccountEscrowAccount, + TAccountVault extends string + ? WritableAccount + : TAccountVault, + TAccountSystemProgram extends string + ? ReadonlyAccount + : TAccountSystemProgram, + ...TRemainingAccounts, + ] + >; + +export type CreateEscrowInstructionData = { + discriminator: ReadonlyUint8Array; + amount: bigint; + disputeResolver: Option
; + escrowId: bigint; +}; + +export type CreateEscrowInstructionDataArgs = { + amount: number | bigint; + disputeResolver: OptionOrNullable
; + escrowId: number | bigint; +}; + +export function getCreateEscrowInstructionDataEncoder(): Encoder { + return transformEncoder( + getStructEncoder([ + ["discriminator", fixEncoderSize(getBytesEncoder(), 8)], + ["amount", getU64Encoder()], + ["disputeResolver", getOptionEncoder(getAddressEncoder())], + ["escrowId", getU64Encoder()], + ]), + (value) => ({ ...value, discriminator: CREATE_ESCROW_DISCRIMINATOR }), + ); +} + +export function getCreateEscrowInstructionDataDecoder(): Decoder { + return getStructDecoder([ + ["discriminator", fixDecoderSize(getBytesDecoder(), 8)], + ["amount", getU64Decoder()], + ["disputeResolver", getOptionDecoder(getAddressDecoder())], + ["escrowId", getU64Decoder()], + ]); +} + +export function getCreateEscrowInstructionDataCodec(): Codec< + CreateEscrowInstructionDataArgs, + CreateEscrowInstructionData +> { + return combineCodec( + getCreateEscrowInstructionDataEncoder(), + getCreateEscrowInstructionDataDecoder(), + ); +} + +export type CreateEscrowAsyncInput< + TAccountSeller extends string = string, + TAccountBuyer extends string = string, + TAccountEscrowAccount extends string = string, + TAccountVault extends string = string, + TAccountSystemProgram extends string = string, +> = { + seller: TransactionSigner; + buyer: Address; + escrowAccount?: Address; + vault?: Address; + systemProgram?: Address; + amount: CreateEscrowInstructionDataArgs["amount"]; + disputeResolver: CreateEscrowInstructionDataArgs["disputeResolver"]; + escrowId: CreateEscrowInstructionDataArgs["escrowId"]; +}; + +export async function getCreateEscrowInstructionAsync< + TAccountSeller extends string, + TAccountBuyer extends string, + TAccountEscrowAccount extends string, + TAccountVault extends string, + TAccountSystemProgram extends string, + TProgramAddress extends Address = typeof DESCRO_PROGRAM_ADDRESS, +>( + input: CreateEscrowAsyncInput< + TAccountSeller, + TAccountBuyer, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram + >, + config?: { programAddress?: TProgramAddress }, +): Promise< + CreateEscrowInstruction< + TProgramAddress, + TAccountSeller, + TAccountBuyer, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram + > +> { + // Program address. + const programAddress = config?.programAddress ?? DESCRO_PROGRAM_ADDRESS; + + // Original accounts. + const originalAccounts = { + seller: { value: input.seller ?? null, isWritable: true }, + buyer: { value: input.buyer ?? null, isWritable: false }, + escrowAccount: { value: input.escrowAccount ?? null, isWritable: true }, + vault: { value: input.vault ?? null, isWritable: true }, + systemProgram: { value: input.systemProgram ?? null, isWritable: false }, + }; + const accounts = originalAccounts as Record< + keyof typeof originalAccounts, + ResolvedInstructionAccount + >; + + // Original args. + const args = { ...input }; + + // Resolve default values. + if (!accounts.escrowAccount.value) { + accounts.escrowAccount.value = await findEscrowAccountPda({ + seller: getAddressFromResolvedInstructionAccount( + "seller", + accounts.seller.value, + ), + escrowId: getNonNullResolvedInstructionInput("escrowId", args.escrowId), + }); + } + if (!accounts.vault.value) { + accounts.vault.value = await findVaultPda({ + escrowAccount: getAddressFromResolvedInstructionAccount( + "escrowAccount", + accounts.escrowAccount.value, + ), + }); + } + if (!accounts.systemProgram.value) { + accounts.systemProgram.value = + "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">; + } + + const getAccountMeta = getAccountMetaFactory(programAddress, "programId"); + return Object.freeze({ + accounts: [ + getAccountMeta("seller", accounts.seller), + getAccountMeta("buyer", accounts.buyer), + getAccountMeta("escrowAccount", accounts.escrowAccount), + getAccountMeta("vault", accounts.vault), + getAccountMeta("systemProgram", accounts.systemProgram), + ], + data: getCreateEscrowInstructionDataEncoder().encode( + args as CreateEscrowInstructionDataArgs, + ), + programAddress, + } as CreateEscrowInstruction< + TProgramAddress, + TAccountSeller, + TAccountBuyer, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram + >); +} + +export type CreateEscrowInput< + TAccountSeller extends string = string, + TAccountBuyer extends string = string, + TAccountEscrowAccount extends string = string, + TAccountVault extends string = string, + TAccountSystemProgram extends string = string, +> = { + seller: TransactionSigner; + buyer: Address; + escrowAccount: Address; + vault: Address; + systemProgram?: Address; + amount: CreateEscrowInstructionDataArgs["amount"]; + disputeResolver: CreateEscrowInstructionDataArgs["disputeResolver"]; + escrowId: CreateEscrowInstructionDataArgs["escrowId"]; +}; + +export function getCreateEscrowInstruction< + TAccountSeller extends string, + TAccountBuyer extends string, + TAccountEscrowAccount extends string, + TAccountVault extends string, + TAccountSystemProgram extends string, + TProgramAddress extends Address = typeof DESCRO_PROGRAM_ADDRESS, +>( + input: CreateEscrowInput< + TAccountSeller, + TAccountBuyer, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram + >, + config?: { programAddress?: TProgramAddress }, +): CreateEscrowInstruction< + TProgramAddress, + TAccountSeller, + TAccountBuyer, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram +> { + // Program address. + const programAddress = config?.programAddress ?? DESCRO_PROGRAM_ADDRESS; + + // Original accounts. + const originalAccounts = { + seller: { value: input.seller ?? null, isWritable: true }, + buyer: { value: input.buyer ?? null, isWritable: false }, + escrowAccount: { value: input.escrowAccount ?? null, isWritable: true }, + vault: { value: input.vault ?? null, isWritable: true }, + systemProgram: { value: input.systemProgram ?? null, isWritable: false }, + }; + const accounts = originalAccounts as Record< + keyof typeof originalAccounts, + ResolvedInstructionAccount + >; + + // Original args. + const args = { ...input }; + + // Resolve default values. + if (!accounts.systemProgram.value) { + accounts.systemProgram.value = + "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">; + } + + const getAccountMeta = getAccountMetaFactory(programAddress, "programId"); + return Object.freeze({ + accounts: [ + getAccountMeta("seller", accounts.seller), + getAccountMeta("buyer", accounts.buyer), + getAccountMeta("escrowAccount", accounts.escrowAccount), + getAccountMeta("vault", accounts.vault), + getAccountMeta("systemProgram", accounts.systemProgram), + ], + data: getCreateEscrowInstructionDataEncoder().encode( + args as CreateEscrowInstructionDataArgs, + ), + programAddress, + } as CreateEscrowInstruction< + TProgramAddress, + TAccountSeller, + TAccountBuyer, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram + >); +} + +export type ParsedCreateEscrowInstruction< + TProgram extends string = typeof DESCRO_PROGRAM_ADDRESS, + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], +> = { + programAddress: Address; + accounts: { + seller: TAccountMetas[0]; + buyer: TAccountMetas[1]; + escrowAccount: TAccountMetas[2]; + vault: TAccountMetas[3]; + systemProgram: TAccountMetas[4]; + }; + data: CreateEscrowInstructionData; +}; + +export function parseCreateEscrowInstruction< + TProgram extends string, + TAccountMetas extends readonly AccountMeta[], +>( + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData, +): ParsedCreateEscrowInstruction { + if (instruction.accounts.length < 5) { + throw new SolanaError( + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + { + actualAccountMetas: instruction.accounts.length, + expectedAccountMetas: 5, + }, + ); + } + let accountIndex = 0; + const getNextAccount = () => { + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; + accountIndex += 1; + return accountMeta; + }; + return { + programAddress: instruction.programAddress, + accounts: { + seller: getNextAccount(), + buyer: getNextAccount(), + escrowAccount: getNextAccount(), + vault: getNextAccount(), + systemProgram: getNextAccount(), + }, + data: getCreateEscrowInstructionDataDecoder().decode(instruction.data), + }; +} diff --git a/sdk/src/generated/descro/src/generated/instructions/deposit.ts b/sdk/src/generated/descro/src/generated/instructions/deposit.ts new file mode 100644 index 0000000..1d60b5c --- /dev/null +++ b/sdk/src/generated/descro/src/generated/instructions/deposit.ts @@ -0,0 +1,310 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + combineCodec, + fixDecoderSize, + fixEncoderSize, + getBytesDecoder, + getBytesEncoder, + getStructDecoder, + getStructEncoder, + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + SolanaError, + transformEncoder, + type AccountMeta, + type AccountSignerMeta, + type Address, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, + type ReadonlyAccount, + type ReadonlyUint8Array, + type TransactionSigner, + type WritableAccount, + type WritableSignerAccount, +} from "@solana/kit"; +import { + getAccountMetaFactory, + getAddressFromResolvedInstructionAccount, + type ResolvedInstructionAccount, +} from "@solana/program-client-core"; +import { findVaultPda } from "../pdas"; +import { DESCRO_PROGRAM_ADDRESS } from "../programs"; + +export const DEPOSIT_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([ + 242, 35, 198, 137, 82, 225, 242, 182, +]); + +export function getDepositDiscriminatorBytes(): ReadonlyUint8Array { + return fixEncoderSize(getBytesEncoder(), 8).encode(DEPOSIT_DISCRIMINATOR); +} + +export type DepositInstruction< + TProgram extends string = typeof DESCRO_PROGRAM_ADDRESS, + TAccountBuyer extends string | AccountMeta = string, + TAccountEscrowAccount extends string | AccountMeta = string, + TAccountVault extends string | AccountMeta = string, + TAccountSystemProgram extends string | AccountMeta = + "11111111111111111111111111111111", + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< + [ + TAccountBuyer extends string + ? WritableSignerAccount & + AccountSignerMeta + : TAccountBuyer, + TAccountEscrowAccount extends string + ? WritableAccount + : TAccountEscrowAccount, + TAccountVault extends string + ? WritableAccount + : TAccountVault, + TAccountSystemProgram extends string + ? ReadonlyAccount + : TAccountSystemProgram, + ...TRemainingAccounts, + ] + >; + +export type DepositInstructionData = { discriminator: ReadonlyUint8Array }; + +export type DepositInstructionDataArgs = {}; + +export function getDepositInstructionDataEncoder(): FixedSizeEncoder { + return transformEncoder( + getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]), + (value) => ({ ...value, discriminator: DEPOSIT_DISCRIMINATOR }), + ); +} + +export function getDepositInstructionDataDecoder(): FixedSizeDecoder { + return getStructDecoder([ + ["discriminator", fixDecoderSize(getBytesDecoder(), 8)], + ]); +} + +export function getDepositInstructionDataCodec(): FixedSizeCodec< + DepositInstructionDataArgs, + DepositInstructionData +> { + return combineCodec( + getDepositInstructionDataEncoder(), + getDepositInstructionDataDecoder(), + ); +} + +export type DepositAsyncInput< + TAccountBuyer extends string = string, + TAccountEscrowAccount extends string = string, + TAccountVault extends string = string, + TAccountSystemProgram extends string = string, +> = { + buyer: TransactionSigner; + escrowAccount: Address; + vault?: Address; + systemProgram?: Address; +}; + +export async function getDepositInstructionAsync< + TAccountBuyer extends string, + TAccountEscrowAccount extends string, + TAccountVault extends string, + TAccountSystemProgram extends string, + TProgramAddress extends Address = typeof DESCRO_PROGRAM_ADDRESS, +>( + input: DepositAsyncInput< + TAccountBuyer, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram + >, + config?: { programAddress?: TProgramAddress }, +): Promise< + DepositInstruction< + TProgramAddress, + TAccountBuyer, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram + > +> { + // Program address. + const programAddress = config?.programAddress ?? DESCRO_PROGRAM_ADDRESS; + + // Original accounts. + const originalAccounts = { + buyer: { value: input.buyer ?? null, isWritable: true }, + escrowAccount: { value: input.escrowAccount ?? null, isWritable: true }, + vault: { value: input.vault ?? null, isWritable: true }, + systemProgram: { value: input.systemProgram ?? null, isWritable: false }, + }; + const accounts = originalAccounts as Record< + keyof typeof originalAccounts, + ResolvedInstructionAccount + >; + + // Resolve default values. + if (!accounts.vault.value) { + accounts.vault.value = await findVaultPda({ + escrowAccount: getAddressFromResolvedInstructionAccount( + "escrowAccount", + accounts.escrowAccount.value, + ), + }); + } + if (!accounts.systemProgram.value) { + accounts.systemProgram.value = + "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">; + } + + const getAccountMeta = getAccountMetaFactory(programAddress, "programId"); + return Object.freeze({ + accounts: [ + getAccountMeta("buyer", accounts.buyer), + getAccountMeta("escrowAccount", accounts.escrowAccount), + getAccountMeta("vault", accounts.vault), + getAccountMeta("systemProgram", accounts.systemProgram), + ], + data: getDepositInstructionDataEncoder().encode({}), + programAddress, + } as DepositInstruction< + TProgramAddress, + TAccountBuyer, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram + >); +} + +export type DepositInput< + TAccountBuyer extends string = string, + TAccountEscrowAccount extends string = string, + TAccountVault extends string = string, + TAccountSystemProgram extends string = string, +> = { + buyer: TransactionSigner; + escrowAccount: Address; + vault: Address; + systemProgram?: Address; +}; + +export function getDepositInstruction< + TAccountBuyer extends string, + TAccountEscrowAccount extends string, + TAccountVault extends string, + TAccountSystemProgram extends string, + TProgramAddress extends Address = typeof DESCRO_PROGRAM_ADDRESS, +>( + input: DepositInput< + TAccountBuyer, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram + >, + config?: { programAddress?: TProgramAddress }, +): DepositInstruction< + TProgramAddress, + TAccountBuyer, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram +> { + // Program address. + const programAddress = config?.programAddress ?? DESCRO_PROGRAM_ADDRESS; + + // Original accounts. + const originalAccounts = { + buyer: { value: input.buyer ?? null, isWritable: true }, + escrowAccount: { value: input.escrowAccount ?? null, isWritable: true }, + vault: { value: input.vault ?? null, isWritable: true }, + systemProgram: { value: input.systemProgram ?? null, isWritable: false }, + }; + const accounts = originalAccounts as Record< + keyof typeof originalAccounts, + ResolvedInstructionAccount + >; + + // Resolve default values. + if (!accounts.systemProgram.value) { + accounts.systemProgram.value = + "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">; + } + + const getAccountMeta = getAccountMetaFactory(programAddress, "programId"); + return Object.freeze({ + accounts: [ + getAccountMeta("buyer", accounts.buyer), + getAccountMeta("escrowAccount", accounts.escrowAccount), + getAccountMeta("vault", accounts.vault), + getAccountMeta("systemProgram", accounts.systemProgram), + ], + data: getDepositInstructionDataEncoder().encode({}), + programAddress, + } as DepositInstruction< + TProgramAddress, + TAccountBuyer, + TAccountEscrowAccount, + TAccountVault, + TAccountSystemProgram + >); +} + +export type ParsedDepositInstruction< + TProgram extends string = typeof DESCRO_PROGRAM_ADDRESS, + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], +> = { + programAddress: Address; + accounts: { + buyer: TAccountMetas[0]; + escrowAccount: TAccountMetas[1]; + vault: TAccountMetas[2]; + systemProgram: TAccountMetas[3]; + }; + data: DepositInstructionData; +}; + +export function parseDepositInstruction< + TProgram extends string, + TAccountMetas extends readonly AccountMeta[], +>( + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData, +): ParsedDepositInstruction { + if (instruction.accounts.length < 4) { + throw new SolanaError( + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + { + actualAccountMetas: instruction.accounts.length, + expectedAccountMetas: 4, + }, + ); + } + let accountIndex = 0; + const getNextAccount = () => { + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; + accountIndex += 1; + return accountMeta; + }; + return { + programAddress: instruction.programAddress, + accounts: { + buyer: getNextAccount(), + escrowAccount: getNextAccount(), + vault: getNextAccount(), + systemProgram: getNextAccount(), + }, + data: getDepositInstructionDataDecoder().decode(instruction.data), + }; +} diff --git a/sdk/src/generated/descro/src/generated/instructions/dispute.ts b/sdk/src/generated/descro/src/generated/instructions/dispute.ts new file mode 100644 index 0000000..1786688 --- /dev/null +++ b/sdk/src/generated/descro/src/generated/instructions/dispute.ts @@ -0,0 +1,183 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + combineCodec, + fixDecoderSize, + fixEncoderSize, + getBytesDecoder, + getBytesEncoder, + getStructDecoder, + getStructEncoder, + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + SolanaError, + transformEncoder, + type AccountMeta, + type AccountSignerMeta, + type Address, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, + type ReadonlySignerAccount, + type ReadonlyUint8Array, + type TransactionSigner, + type WritableAccount, +} from "@solana/kit"; +import { + getAccountMetaFactory, + type ResolvedInstructionAccount, +} from "@solana/program-client-core"; +import { DESCRO_PROGRAM_ADDRESS } from "../programs"; + +export const DISPUTE_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([ + 216, 92, 128, 146, 202, 85, 135, 73, +]); + +export function getDisputeDiscriminatorBytes(): ReadonlyUint8Array { + return fixEncoderSize(getBytesEncoder(), 8).encode(DISPUTE_DISCRIMINATOR); +} + +export type DisputeInstruction< + TProgram extends string = typeof DESCRO_PROGRAM_ADDRESS, + TAccountInitiator extends string | AccountMeta = string, + TAccountEscrowAccount extends string | AccountMeta = string, + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< + [ + TAccountInitiator extends string + ? ReadonlySignerAccount & + AccountSignerMeta + : TAccountInitiator, + TAccountEscrowAccount extends string + ? WritableAccount + : TAccountEscrowAccount, + ...TRemainingAccounts, + ] + >; + +export type DisputeInstructionData = { discriminator: ReadonlyUint8Array }; + +export type DisputeInstructionDataArgs = {}; + +export function getDisputeInstructionDataEncoder(): FixedSizeEncoder { + return transformEncoder( + getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]), + (value) => ({ ...value, discriminator: DISPUTE_DISCRIMINATOR }), + ); +} + +export function getDisputeInstructionDataDecoder(): FixedSizeDecoder { + return getStructDecoder([ + ["discriminator", fixDecoderSize(getBytesDecoder(), 8)], + ]); +} + +export function getDisputeInstructionDataCodec(): FixedSizeCodec< + DisputeInstructionDataArgs, + DisputeInstructionData +> { + return combineCodec( + getDisputeInstructionDataEncoder(), + getDisputeInstructionDataDecoder(), + ); +} + +export type DisputeInput< + TAccountInitiator extends string = string, + TAccountEscrowAccount extends string = string, +> = { + initiator: TransactionSigner; + escrowAccount: Address; +}; + +export function getDisputeInstruction< + TAccountInitiator extends string, + TAccountEscrowAccount extends string, + TProgramAddress extends Address = typeof DESCRO_PROGRAM_ADDRESS, +>( + input: DisputeInput, + config?: { programAddress?: TProgramAddress }, +): DisputeInstruction< + TProgramAddress, + TAccountInitiator, + TAccountEscrowAccount +> { + // Program address. + const programAddress = config?.programAddress ?? DESCRO_PROGRAM_ADDRESS; + + // Original accounts. + const originalAccounts = { + initiator: { value: input.initiator ?? null, isWritable: false }, + escrowAccount: { value: input.escrowAccount ?? null, isWritable: true }, + }; + const accounts = originalAccounts as Record< + keyof typeof originalAccounts, + ResolvedInstructionAccount + >; + + const getAccountMeta = getAccountMetaFactory(programAddress, "programId"); + return Object.freeze({ + accounts: [ + getAccountMeta("initiator", accounts.initiator), + getAccountMeta("escrowAccount", accounts.escrowAccount), + ], + data: getDisputeInstructionDataEncoder().encode({}), + programAddress, + } as DisputeInstruction< + TProgramAddress, + TAccountInitiator, + TAccountEscrowAccount + >); +} + +export type ParsedDisputeInstruction< + TProgram extends string = typeof DESCRO_PROGRAM_ADDRESS, + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], +> = { + programAddress: Address; + accounts: { + initiator: TAccountMetas[0]; + escrowAccount: TAccountMetas[1]; + }; + data: DisputeInstructionData; +}; + +export function parseDisputeInstruction< + TProgram extends string, + TAccountMetas extends readonly AccountMeta[], +>( + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData, +): ParsedDisputeInstruction { + if (instruction.accounts.length < 2) { + throw new SolanaError( + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + { + actualAccountMetas: instruction.accounts.length, + expectedAccountMetas: 2, + }, + ); + } + let accountIndex = 0; + const getNextAccount = () => { + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; + accountIndex += 1; + return accountMeta; + }; + return { + programAddress: instruction.programAddress, + accounts: { initiator: getNextAccount(), escrowAccount: getNextAccount() }, + data: getDisputeInstructionDataDecoder().decode(instruction.data), + }; +} diff --git a/sdk/src/generated/descro/src/generated/instructions/index.ts b/sdk/src/generated/descro/src/generated/instructions/index.ts new file mode 100644 index 0000000..d643386 --- /dev/null +++ b/sdk/src/generated/descro/src/generated/instructions/index.ts @@ -0,0 +1,14 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +export * from "./cancel"; +export * from "./complete"; +export * from "./createEscrow"; +export * from "./deposit"; +export * from "./dispute"; +export * from "./resolve"; diff --git a/sdk/src/generated/descro/src/generated/instructions/resolve.ts b/sdk/src/generated/descro/src/generated/instructions/resolve.ts new file mode 100644 index 0000000..718ef0f --- /dev/null +++ b/sdk/src/generated/descro/src/generated/instructions/resolve.ts @@ -0,0 +1,460 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + combineCodec, + fixDecoderSize, + fixEncoderSize, + getBytesDecoder, + getBytesEncoder, + getStructDecoder, + getStructEncoder, + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + SolanaError, + transformEncoder, + type AccountMeta, + type AccountSignerMeta, + type Address, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, + type ReadonlyAccount, + type ReadonlySignerAccount, + type ReadonlyUint8Array, + type TransactionSigner, + type WritableAccount, +} from "@solana/kit"; +import { + getAccountMetaFactory, + getAddressFromResolvedInstructionAccount, + type ResolvedInstructionAccount, +} from "@solana/program-client-core"; +import { findEscrowAuthorityPda, findVaultPda } from "../pdas"; +import { DESCRO_PROGRAM_ADDRESS } from "../programs"; +import { + getWinnerDecoder, + getWinnerEncoder, + type Winner, + type WinnerArgs, +} from "../types"; + +export const RESOLVE_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([ + 246, 150, 236, 206, 108, 63, 58, 10, +]); + +export function getResolveDiscriminatorBytes(): ReadonlyUint8Array { + return fixEncoderSize(getBytesEncoder(), 8).encode(RESOLVE_DISCRIMINATOR); +} + +export type ResolveInstruction< + TProgram extends string = typeof DESCRO_PROGRAM_ADDRESS, + TAccountResolver extends string | AccountMeta = string, + TAccountWinner extends string | AccountMeta = string, + TAccountSeller extends string | AccountMeta = string, + TAccountEscrowAccount extends string | AccountMeta = string, + TAccountVault extends string | AccountMeta = string, + TAccountResolverEntry extends string | AccountMeta = string, + TAccountEscrowAuthority extends string | AccountMeta = string, + TAccountRegistryProgram extends string | AccountMeta = string, + TAccountSystemProgram extends string | AccountMeta = + "11111111111111111111111111111111", + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< + [ + TAccountResolver extends string + ? ReadonlySignerAccount & + AccountSignerMeta + : TAccountResolver, + TAccountWinner extends string + ? WritableAccount + : TAccountWinner, + TAccountSeller extends string + ? WritableAccount + : TAccountSeller, + TAccountEscrowAccount extends string + ? WritableAccount + : TAccountEscrowAccount, + TAccountVault extends string + ? WritableAccount + : TAccountVault, + TAccountResolverEntry extends string + ? WritableAccount + : TAccountResolverEntry, + TAccountEscrowAuthority extends string + ? ReadonlyAccount + : TAccountEscrowAuthority, + TAccountRegistryProgram extends string + ? ReadonlyAccount + : TAccountRegistryProgram, + TAccountSystemProgram extends string + ? ReadonlyAccount + : TAccountSystemProgram, + ...TRemainingAccounts, + ] + >; + +export type ResolveInstructionData = { + discriminator: ReadonlyUint8Array; + winner: Winner; +}; + +export type ResolveInstructionDataArgs = { winner: WinnerArgs }; + +export function getResolveInstructionDataEncoder(): FixedSizeEncoder { + return transformEncoder( + getStructEncoder([ + ["discriminator", fixEncoderSize(getBytesEncoder(), 8)], + ["winner", getWinnerEncoder()], + ]), + (value) => ({ ...value, discriminator: RESOLVE_DISCRIMINATOR }), + ); +} + +export function getResolveInstructionDataDecoder(): FixedSizeDecoder { + return getStructDecoder([ + ["discriminator", fixDecoderSize(getBytesDecoder(), 8)], + ["winner", getWinnerDecoder()], + ]); +} + +export function getResolveInstructionDataCodec(): FixedSizeCodec< + ResolveInstructionDataArgs, + ResolveInstructionData +> { + return combineCodec( + getResolveInstructionDataEncoder(), + getResolveInstructionDataDecoder(), + ); +} + +export type ResolveAsyncInput< + TAccountResolver extends string = string, + TAccountWinner extends string = string, + TAccountSeller extends string = string, + TAccountEscrowAccount extends string = string, + TAccountVault extends string = string, + TAccountResolverEntry extends string = string, + TAccountEscrowAuthority extends string = string, + TAccountRegistryProgram extends string = string, + TAccountSystemProgram extends string = string, +> = { + resolver: TransactionSigner; + winner: Address; + seller: Address; + escrowAccount: Address; + vault?: Address; + resolverEntry: Address; + escrowAuthority?: Address; + registryProgram: Address; + systemProgram?: Address; + winnerArg: ResolveInstructionDataArgs["winner"]; +}; + +export async function getResolveInstructionAsync< + TAccountResolver extends string, + TAccountWinner extends string, + TAccountSeller extends string, + TAccountEscrowAccount extends string, + TAccountVault extends string, + TAccountResolverEntry extends string, + TAccountEscrowAuthority extends string, + TAccountRegistryProgram extends string, + TAccountSystemProgram extends string, + TProgramAddress extends Address = typeof DESCRO_PROGRAM_ADDRESS, +>( + input: ResolveAsyncInput< + TAccountResolver, + TAccountWinner, + TAccountSeller, + TAccountEscrowAccount, + TAccountVault, + TAccountResolverEntry, + TAccountEscrowAuthority, + TAccountRegistryProgram, + TAccountSystemProgram + >, + config?: { programAddress?: TProgramAddress }, +): Promise< + ResolveInstruction< + TProgramAddress, + TAccountResolver, + TAccountWinner, + TAccountSeller, + TAccountEscrowAccount, + TAccountVault, + TAccountResolverEntry, + TAccountEscrowAuthority, + TAccountRegistryProgram, + TAccountSystemProgram + > +> { + // Program address. + const programAddress = config?.programAddress ?? DESCRO_PROGRAM_ADDRESS; + + // Original accounts. + const originalAccounts = { + resolver: { value: input.resolver ?? null, isWritable: false }, + winner: { value: input.winner ?? null, isWritable: true }, + seller: { value: input.seller ?? null, isWritable: true }, + escrowAccount: { value: input.escrowAccount ?? null, isWritable: true }, + vault: { value: input.vault ?? null, isWritable: true }, + resolverEntry: { value: input.resolverEntry ?? null, isWritable: true }, + escrowAuthority: { + value: input.escrowAuthority ?? null, + isWritable: false, + }, + registryProgram: { + value: input.registryProgram ?? null, + isWritable: false, + }, + systemProgram: { value: input.systemProgram ?? null, isWritable: false }, + }; + const accounts = originalAccounts as Record< + keyof typeof originalAccounts, + ResolvedInstructionAccount + >; + + // Original args. + const args = { ...input, winner: input.winnerArg }; + + // Resolve default values. + if (!accounts.vault.value) { + accounts.vault.value = await findVaultPda({ + escrowAccount: getAddressFromResolvedInstructionAccount( + "escrowAccount", + accounts.escrowAccount.value, + ), + }); + } + if (!accounts.escrowAuthority.value) { + accounts.escrowAuthority.value = await findEscrowAuthorityPda(); + } + if (!accounts.systemProgram.value) { + accounts.systemProgram.value = + "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">; + } + + const getAccountMeta = getAccountMetaFactory(programAddress, "programId"); + return Object.freeze({ + accounts: [ + getAccountMeta("resolver", accounts.resolver), + getAccountMeta("winner", accounts.winner), + getAccountMeta("seller", accounts.seller), + getAccountMeta("escrowAccount", accounts.escrowAccount), + getAccountMeta("vault", accounts.vault), + getAccountMeta("resolverEntry", accounts.resolverEntry), + getAccountMeta("escrowAuthority", accounts.escrowAuthority), + getAccountMeta("registryProgram", accounts.registryProgram), + getAccountMeta("systemProgram", accounts.systemProgram), + ], + data: getResolveInstructionDataEncoder().encode( + args as ResolveInstructionDataArgs, + ), + programAddress, + } as ResolveInstruction< + TProgramAddress, + TAccountResolver, + TAccountWinner, + TAccountSeller, + TAccountEscrowAccount, + TAccountVault, + TAccountResolverEntry, + TAccountEscrowAuthority, + TAccountRegistryProgram, + TAccountSystemProgram + >); +} + +export type ResolveInput< + TAccountResolver extends string = string, + TAccountWinner extends string = string, + TAccountSeller extends string = string, + TAccountEscrowAccount extends string = string, + TAccountVault extends string = string, + TAccountResolverEntry extends string = string, + TAccountEscrowAuthority extends string = string, + TAccountRegistryProgram extends string = string, + TAccountSystemProgram extends string = string, +> = { + resolver: TransactionSigner; + winner: Address; + seller: Address; + escrowAccount: Address; + vault: Address; + resolverEntry: Address; + escrowAuthority: Address; + registryProgram: Address; + systemProgram?: Address; + winnerArg: ResolveInstructionDataArgs["winner"]; +}; + +export function getResolveInstruction< + TAccountResolver extends string, + TAccountWinner extends string, + TAccountSeller extends string, + TAccountEscrowAccount extends string, + TAccountVault extends string, + TAccountResolverEntry extends string, + TAccountEscrowAuthority extends string, + TAccountRegistryProgram extends string, + TAccountSystemProgram extends string, + TProgramAddress extends Address = typeof DESCRO_PROGRAM_ADDRESS, +>( + input: ResolveInput< + TAccountResolver, + TAccountWinner, + TAccountSeller, + TAccountEscrowAccount, + TAccountVault, + TAccountResolverEntry, + TAccountEscrowAuthority, + TAccountRegistryProgram, + TAccountSystemProgram + >, + config?: { programAddress?: TProgramAddress }, +): ResolveInstruction< + TProgramAddress, + TAccountResolver, + TAccountWinner, + TAccountSeller, + TAccountEscrowAccount, + TAccountVault, + TAccountResolverEntry, + TAccountEscrowAuthority, + TAccountRegistryProgram, + TAccountSystemProgram +> { + // Program address. + const programAddress = config?.programAddress ?? DESCRO_PROGRAM_ADDRESS; + + // Original accounts. + const originalAccounts = { + resolver: { value: input.resolver ?? null, isWritable: false }, + winner: { value: input.winner ?? null, isWritable: true }, + seller: { value: input.seller ?? null, isWritable: true }, + escrowAccount: { value: input.escrowAccount ?? null, isWritable: true }, + vault: { value: input.vault ?? null, isWritable: true }, + resolverEntry: { value: input.resolverEntry ?? null, isWritable: true }, + escrowAuthority: { + value: input.escrowAuthority ?? null, + isWritable: false, + }, + registryProgram: { + value: input.registryProgram ?? null, + isWritable: false, + }, + systemProgram: { value: input.systemProgram ?? null, isWritable: false }, + }; + const accounts = originalAccounts as Record< + keyof typeof originalAccounts, + ResolvedInstructionAccount + >; + + // Original args. + const args = { ...input, winner: input.winnerArg }; + + // Resolve default values. + if (!accounts.systemProgram.value) { + accounts.systemProgram.value = + "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">; + } + + const getAccountMeta = getAccountMetaFactory(programAddress, "programId"); + return Object.freeze({ + accounts: [ + getAccountMeta("resolver", accounts.resolver), + getAccountMeta("winner", accounts.winner), + getAccountMeta("seller", accounts.seller), + getAccountMeta("escrowAccount", accounts.escrowAccount), + getAccountMeta("vault", accounts.vault), + getAccountMeta("resolverEntry", accounts.resolverEntry), + getAccountMeta("escrowAuthority", accounts.escrowAuthority), + getAccountMeta("registryProgram", accounts.registryProgram), + getAccountMeta("systemProgram", accounts.systemProgram), + ], + data: getResolveInstructionDataEncoder().encode( + args as ResolveInstructionDataArgs, + ), + programAddress, + } as ResolveInstruction< + TProgramAddress, + TAccountResolver, + TAccountWinner, + TAccountSeller, + TAccountEscrowAccount, + TAccountVault, + TAccountResolverEntry, + TAccountEscrowAuthority, + TAccountRegistryProgram, + TAccountSystemProgram + >); +} + +export type ParsedResolveInstruction< + TProgram extends string = typeof DESCRO_PROGRAM_ADDRESS, + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], +> = { + programAddress: Address; + accounts: { + resolver: TAccountMetas[0]; + winner: TAccountMetas[1]; + seller: TAccountMetas[2]; + escrowAccount: TAccountMetas[3]; + vault: TAccountMetas[4]; + resolverEntry: TAccountMetas[5]; + escrowAuthority: TAccountMetas[6]; + registryProgram: TAccountMetas[7]; + systemProgram: TAccountMetas[8]; + }; + data: ResolveInstructionData; +}; + +export function parseResolveInstruction< + TProgram extends string, + TAccountMetas extends readonly AccountMeta[], +>( + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData, +): ParsedResolveInstruction { + if (instruction.accounts.length < 9) { + throw new SolanaError( + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + { + actualAccountMetas: instruction.accounts.length, + expectedAccountMetas: 9, + }, + ); + } + let accountIndex = 0; + const getNextAccount = () => { + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; + accountIndex += 1; + return accountMeta; + }; + return { + programAddress: instruction.programAddress, + accounts: { + resolver: getNextAccount(), + winner: getNextAccount(), + seller: getNextAccount(), + escrowAccount: getNextAccount(), + vault: getNextAccount(), + resolverEntry: getNextAccount(), + escrowAuthority: getNextAccount(), + registryProgram: getNextAccount(), + systemProgram: getNextAccount(), + }, + data: getResolveInstructionDataDecoder().decode(instruction.data), + }; +} diff --git a/sdk/src/generated/descro/src/generated/pdas/escrowAccount.ts b/sdk/src/generated/descro/src/generated/pdas/escrowAccount.ts new file mode 100644 index 0000000..894c9c1 --- /dev/null +++ b/sdk/src/generated/descro/src/generated/pdas/escrowAccount.ts @@ -0,0 +1,38 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + getAddressEncoder, + getBytesEncoder, + getProgramDerivedAddress, + getU64Encoder, + type Address, + type ProgramDerivedAddress, +} from "@solana/kit"; + +export type EscrowAccountSeeds = { + seller: Address; + escrowId: number | bigint; +}; + +export async function findEscrowAccountPda( + seeds: EscrowAccountSeeds, + config: { programAddress?: Address | undefined } = {}, +): Promise { + const { + programAddress = "DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3" as Address<"DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3">, + } = config; + return await getProgramDerivedAddress({ + programAddress, + seeds: [ + getBytesEncoder().encode(new Uint8Array([101, 115, 99, 114, 111, 119])), + getAddressEncoder().encode(seeds.seller), + getU64Encoder().encode(seeds.escrowId), + ], + }); +} diff --git a/sdk/src/generated/descro/src/generated/pdas/escrowAuthority.ts b/sdk/src/generated/descro/src/generated/pdas/escrowAuthority.ts new file mode 100644 index 0000000..3e0d93a --- /dev/null +++ b/sdk/src/generated/descro/src/generated/pdas/escrowAuthority.ts @@ -0,0 +1,33 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + getBytesEncoder, + getProgramDerivedAddress, + type Address, + type ProgramDerivedAddress, +} from "@solana/kit"; + +export async function findEscrowAuthorityPda( + config: { programAddress?: Address | undefined } = {}, +): Promise { + const { + programAddress = "DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3" as Address<"DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3">, + } = config; + return await getProgramDerivedAddress({ + programAddress, + seeds: [ + getBytesEncoder().encode( + new Uint8Array([ + 101, 115, 99, 114, 111, 119, 95, 97, 117, 116, 104, 111, 114, 105, + 116, 121, + ]), + ), + ], + }); +} diff --git a/sdk/src/generated/descro/src/generated/pdas/index.ts b/sdk/src/generated/descro/src/generated/pdas/index.ts new file mode 100644 index 0000000..78009cd --- /dev/null +++ b/sdk/src/generated/descro/src/generated/pdas/index.ts @@ -0,0 +1,11 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +export * from "./escrowAccount"; +export * from "./escrowAuthority"; +export * from "./vault"; diff --git a/sdk/src/generated/descro/src/generated/pdas/vault.ts b/sdk/src/generated/descro/src/generated/pdas/vault.ts new file mode 100644 index 0000000..2586c5e --- /dev/null +++ b/sdk/src/generated/descro/src/generated/pdas/vault.ts @@ -0,0 +1,35 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + getAddressEncoder, + getBytesEncoder, + getProgramDerivedAddress, + type Address, + type ProgramDerivedAddress, +} from "@solana/kit"; + +export type VaultSeeds = { + escrowAccount: Address; +}; + +export async function findVaultPda( + seeds: VaultSeeds, + config: { programAddress?: Address | undefined } = {}, +): Promise { + const { + programAddress = "DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3" as Address<"DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3">, + } = config; + return await getProgramDerivedAddress({ + programAddress, + seeds: [ + getBytesEncoder().encode(new Uint8Array([118, 97, 117, 108, 116])), + getAddressEncoder().encode(seeds.escrowAccount), + ], + }); +} diff --git a/sdk/src/generated/descro/src/generated/programs/descro.ts b/sdk/src/generated/descro/src/generated/programs/descro.ts new file mode 100644 index 0000000..0b08d2f --- /dev/null +++ b/sdk/src/generated/descro/src/generated/programs/descro.ts @@ -0,0 +1,351 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + assertIsInstructionWithAccounts, + containsBytes, + extendClient, + fixEncoderSize, + getBytesEncoder, + SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, + SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, + SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, + SolanaError, + type Address, + type ClientWithRpc, + type ClientWithTransactionPlanning, + type ClientWithTransactionSending, + type GetAccountInfoApi, + type GetMultipleAccountsApi, + type Instruction, + type InstructionWithData, + type ReadonlyUint8Array, +} from "@solana/kit"; +import { + addSelfFetchFunctions, + addSelfPlanAndSendFunctions, + type SelfFetchFunctions, + type SelfPlanAndSendFunctions, +} from "@solana/program-client-core"; +import { + getEscrowAccountCodec, + type EscrowAccount, + type EscrowAccountArgs, +} from "../accounts"; +import { + getCancelInstruction, + getCompleteInstructionAsync, + getCreateEscrowInstructionAsync, + getDepositInstructionAsync, + getDisputeInstruction, + getResolveInstructionAsync, + parseCancelInstruction, + parseCompleteInstruction, + parseCreateEscrowInstruction, + parseDepositInstruction, + parseDisputeInstruction, + parseResolveInstruction, + type CancelInput, + type CompleteAsyncInput, + type CreateEscrowAsyncInput, + type DepositAsyncInput, + type DisputeInput, + type ParsedCancelInstruction, + type ParsedCompleteInstruction, + type ParsedCreateEscrowInstruction, + type ParsedDepositInstruction, + type ParsedDisputeInstruction, + type ParsedResolveInstruction, + type ResolveAsyncInput, +} from "../instructions"; +import { + findEscrowAccountPda, + findEscrowAuthorityPda, + findVaultPda, +} from "../pdas"; + +export const DESCRO_PROGRAM_ADDRESS = + "DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3" as Address<"DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3">; + +export enum DescroAccount { + EscrowAccount, +} + +export function identifyDescroAccount( + account: { data: ReadonlyUint8Array } | ReadonlyUint8Array, +): DescroAccount { + const data = "data" in account ? account.data : account; + if ( + containsBytes( + data, + fixEncoderSize(getBytesEncoder(), 8).encode( + new Uint8Array([36, 69, 48, 18, 128, 225, 125, 135]), + ), + 0, + ) + ) { + return DescroAccount.EscrowAccount; + } + throw new SolanaError( + SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, + { accountData: data, programName: "descro" }, + ); +} + +export enum DescroInstruction { + Cancel, + Complete, + CreateEscrow, + Deposit, + Dispute, + Resolve, +} + +export function identifyDescroInstruction( + instruction: { data: ReadonlyUint8Array } | ReadonlyUint8Array, +): DescroInstruction { + const data = "data" in instruction ? instruction.data : instruction; + if ( + containsBytes( + data, + fixEncoderSize(getBytesEncoder(), 8).encode( + new Uint8Array([232, 219, 223, 41, 219, 236, 220, 190]), + ), + 0, + ) + ) { + return DescroInstruction.Cancel; + } + if ( + containsBytes( + data, + fixEncoderSize(getBytesEncoder(), 8).encode( + new Uint8Array([0, 77, 224, 147, 136, 25, 88, 76]), + ), + 0, + ) + ) { + return DescroInstruction.Complete; + } + if ( + containsBytes( + data, + fixEncoderSize(getBytesEncoder(), 8).encode( + new Uint8Array([253, 215, 165, 116, 36, 108, 68, 80]), + ), + 0, + ) + ) { + return DescroInstruction.CreateEscrow; + } + if ( + containsBytes( + data, + fixEncoderSize(getBytesEncoder(), 8).encode( + new Uint8Array([242, 35, 198, 137, 82, 225, 242, 182]), + ), + 0, + ) + ) { + return DescroInstruction.Deposit; + } + if ( + containsBytes( + data, + fixEncoderSize(getBytesEncoder(), 8).encode( + new Uint8Array([216, 92, 128, 146, 202, 85, 135, 73]), + ), + 0, + ) + ) { + return DescroInstruction.Dispute; + } + if ( + containsBytes( + data, + fixEncoderSize(getBytesEncoder(), 8).encode( + new Uint8Array([246, 150, 236, 206, 108, 63, 58, 10]), + ), + 0, + ) + ) { + return DescroInstruction.Resolve; + } + throw new SolanaError( + SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, + { instructionData: data, programName: "descro" }, + ); +} + +export type ParsedDescroInstruction< + TProgram extends string = "DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3", +> = + | ({ + instructionType: DescroInstruction.Cancel; + } & ParsedCancelInstruction) + | ({ + instructionType: DescroInstruction.Complete; + } & ParsedCompleteInstruction) + | ({ + instructionType: DescroInstruction.CreateEscrow; + } & ParsedCreateEscrowInstruction) + | ({ + instructionType: DescroInstruction.Deposit; + } & ParsedDepositInstruction) + | ({ + instructionType: DescroInstruction.Dispute; + } & ParsedDisputeInstruction) + | ({ + instructionType: DescroInstruction.Resolve; + } & ParsedResolveInstruction); + +export function parseDescroInstruction( + instruction: Instruction & InstructionWithData, +): ParsedDescroInstruction { + const instructionType = identifyDescroInstruction(instruction); + switch (instructionType) { + case DescroInstruction.Cancel: { + assertIsInstructionWithAccounts(instruction); + return { + instructionType: DescroInstruction.Cancel, + ...parseCancelInstruction(instruction), + }; + } + case DescroInstruction.Complete: { + assertIsInstructionWithAccounts(instruction); + return { + instructionType: DescroInstruction.Complete, + ...parseCompleteInstruction(instruction), + }; + } + case DescroInstruction.CreateEscrow: { + assertIsInstructionWithAccounts(instruction); + return { + instructionType: DescroInstruction.CreateEscrow, + ...parseCreateEscrowInstruction(instruction), + }; + } + case DescroInstruction.Deposit: { + assertIsInstructionWithAccounts(instruction); + return { + instructionType: DescroInstruction.Deposit, + ...parseDepositInstruction(instruction), + }; + } + case DescroInstruction.Dispute: { + assertIsInstructionWithAccounts(instruction); + return { + instructionType: DescroInstruction.Dispute, + ...parseDisputeInstruction(instruction), + }; + } + case DescroInstruction.Resolve: { + assertIsInstructionWithAccounts(instruction); + return { + instructionType: DescroInstruction.Resolve, + ...parseResolveInstruction(instruction), + }; + } + default: + throw new SolanaError( + SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, + { instructionType: instructionType as string, programName: "descro" }, + ); + } +} + +export type DescroPlugin = { + accounts: DescroPluginAccounts; + instructions: DescroPluginInstructions; + pdas: DescroPluginPdas; +}; + +export type DescroPluginAccounts = { + escrowAccount: ReturnType & + SelfFetchFunctions; +}; + +export type DescroPluginInstructions = { + cancel: ( + input: CancelInput, + ) => ReturnType & SelfPlanAndSendFunctions; + complete: ( + input: CompleteAsyncInput, + ) => ReturnType & + SelfPlanAndSendFunctions; + createEscrow: ( + input: CreateEscrowAsyncInput, + ) => ReturnType & + SelfPlanAndSendFunctions; + deposit: ( + input: DepositAsyncInput, + ) => ReturnType & SelfPlanAndSendFunctions; + dispute: ( + input: DisputeInput, + ) => ReturnType & SelfPlanAndSendFunctions; + resolve: ( + input: ResolveAsyncInput, + ) => ReturnType & SelfPlanAndSendFunctions; +}; + +export type DescroPluginPdas = { + vault: typeof findVaultPda; + escrowAccount: typeof findEscrowAccountPda; + escrowAuthority: typeof findEscrowAuthorityPda; +}; + +export type DescroPluginRequirements = ClientWithRpc< + GetAccountInfoApi & GetMultipleAccountsApi +> & + ClientWithTransactionPlanning & + ClientWithTransactionSending; + +export function descroProgram() { + return ( + client: T, + ): Omit & { descro: DescroPlugin } => { + return extendClient(client, { + descro: { + accounts: { + escrowAccount: addSelfFetchFunctions(client, getEscrowAccountCodec()), + }, + instructions: { + cancel: (input) => + addSelfPlanAndSendFunctions(client, getCancelInstruction(input)), + complete: (input) => + addSelfPlanAndSendFunctions( + client, + getCompleteInstructionAsync(input), + ), + createEscrow: (input) => + addSelfPlanAndSendFunctions( + client, + getCreateEscrowInstructionAsync(input), + ), + deposit: (input) => + addSelfPlanAndSendFunctions( + client, + getDepositInstructionAsync(input), + ), + dispute: (input) => + addSelfPlanAndSendFunctions(client, getDisputeInstruction(input)), + resolve: (input) => + addSelfPlanAndSendFunctions( + client, + getResolveInstructionAsync(input), + ), + }, + pdas: { + vault: findVaultPda, + escrowAccount: findEscrowAccountPda, + escrowAuthority: findEscrowAuthorityPda, + }, + }, + }); + }; +} diff --git a/sdk/src/generated/descro/src/generated/programs/index.ts b/sdk/src/generated/descro/src/generated/programs/index.ts new file mode 100644 index 0000000..3d77c4e --- /dev/null +++ b/sdk/src/generated/descro/src/generated/programs/index.ts @@ -0,0 +1,9 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +export * from "./descro"; diff --git a/sdk/src/generated/descro/src/generated/types/escrowState.ts b/sdk/src/generated/descro/src/generated/types/escrowState.ts new file mode 100644 index 0000000..7453e67 --- /dev/null +++ b/sdk/src/generated/descro/src/generated/types/escrowState.ts @@ -0,0 +1,41 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + combineCodec, + getEnumDecoder, + getEnumEncoder, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, +} from "@solana/kit"; + +export enum EscrowState { + AwaitingDeposit, + Active, + Disputed, + Complete, + Cancelled, +} + +export type EscrowStateArgs = EscrowState; + +export function getEscrowStateEncoder(): FixedSizeEncoder { + return getEnumEncoder(EscrowState); +} + +export function getEscrowStateDecoder(): FixedSizeDecoder { + return getEnumDecoder(EscrowState); +} + +export function getEscrowStateCodec(): FixedSizeCodec< + EscrowStateArgs, + EscrowState +> { + return combineCodec(getEscrowStateEncoder(), getEscrowStateDecoder()); +} diff --git a/sdk/src/generated/descro/src/generated/types/index.ts b/sdk/src/generated/descro/src/generated/types/index.ts new file mode 100644 index 0000000..269e5f8 --- /dev/null +++ b/sdk/src/generated/descro/src/generated/types/index.ts @@ -0,0 +1,10 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +export * from "./escrowState"; +export * from "./winner"; diff --git a/sdk/src/generated/descro/src/generated/types/winner.ts b/sdk/src/generated/descro/src/generated/types/winner.ts new file mode 100644 index 0000000..870fc04 --- /dev/null +++ b/sdk/src/generated/descro/src/generated/types/winner.ts @@ -0,0 +1,35 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + combineCodec, + getEnumDecoder, + getEnumEncoder, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, +} from "@solana/kit"; + +export enum Winner { + Buyer, + Seller, +} + +export type WinnerArgs = Winner; + +export function getWinnerEncoder(): FixedSizeEncoder { + return getEnumEncoder(Winner); +} + +export function getWinnerDecoder(): FixedSizeDecoder { + return getEnumDecoder(Winner); +} + +export function getWinnerCodec(): FixedSizeCodec { + return combineCodec(getWinnerEncoder(), getWinnerDecoder()); +} diff --git a/sdk/src/generated/descro_ext_resolvers/package.json b/sdk/src/generated/descro_ext_resolvers/package.json new file mode 100644 index 0000000..3250d35 --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/package.json @@ -0,0 +1,22 @@ +{ + "name": "js-client", + "version": "1.0.0", + "description": "", + "main": "src/index.ts", + "files": [ + "./dist/src", + "./dist/types", + "./src/" + ], + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "peerDependencies": { + "@solana/kit": "^6.4.0" + }, + "dependencies": { + "@solana/program-client-core": "^6.4.0" + } +} diff --git a/sdk/src/generated/descro_ext_resolvers/src/generated/accounts/index.ts b/sdk/src/generated/descro_ext_resolvers/src/generated/accounts/index.ts new file mode 100644 index 0000000..4ac749e --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/src/generated/accounts/index.ts @@ -0,0 +1,9 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +export * from "./resolverEntry"; diff --git a/sdk/src/generated/descro_ext_resolvers/src/generated/accounts/resolverEntry.ts b/sdk/src/generated/descro_ext_resolvers/src/generated/accounts/resolverEntry.ts new file mode 100644 index 0000000..8334673 --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/src/generated/accounts/resolverEntry.ts @@ -0,0 +1,197 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + addDecoderSizePrefix, + addEncoderSizePrefix, + assertAccountExists, + assertAccountsExist, + combineCodec, + decodeAccount, + fetchEncodedAccount, + fetchEncodedAccounts, + fixDecoderSize, + fixEncoderSize, + getAddressDecoder, + getAddressEncoder, + getBytesDecoder, + getBytesEncoder, + getI64Decoder, + getI64Encoder, + getStructDecoder, + getStructEncoder, + getU16Decoder, + getU16Encoder, + getU32Decoder, + getU32Encoder, + getU64Decoder, + getU64Encoder, + getUtf8Decoder, + getUtf8Encoder, + transformEncoder, + type Account, + type Address, + type Codec, + type Decoder, + type EncodedAccount, + type Encoder, + type FetchAccountConfig, + type FetchAccountsConfig, + type MaybeAccount, + type MaybeEncodedAccount, + type ReadonlyUint8Array, +} from "@solana/kit"; +import { + getResolverTypeDecoder, + getResolverTypeEncoder, + type ResolverType, + type ResolverTypeArgs, +} from "../types"; + +export const RESOLVER_ENTRY_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([ + 0, 60, 55, 58, 157, 135, 51, 191, +]); + +export function getResolverEntryDiscriminatorBytes(): ReadonlyUint8Array { + return fixEncoderSize(getBytesEncoder(), 8).encode( + RESOLVER_ENTRY_DISCRIMINATOR, + ); +} + +export type ResolverEntry = { + discriminator: ReadonlyUint8Array; + authority: Address; + resolverType: ResolverType; + name: string; + description: string; + feeBps: number; + feeRecipient: Address; + metadataUri: string; + totalResolved: bigint; + ruledForBuyer: bigint; + ruledForSeller: bigint; + registeredAt: bigint; +}; + +export type ResolverEntryArgs = { + authority: Address; + resolverType: ResolverTypeArgs; + name: string; + description: string; + feeBps: number; + feeRecipient: Address; + metadataUri: string; + totalResolved: number | bigint; + ruledForBuyer: number | bigint; + ruledForSeller: number | bigint; + registeredAt: number | bigint; +}; + +/** Gets the encoder for {@link ResolverEntryArgs} account data. */ +export function getResolverEntryEncoder(): Encoder { + return transformEncoder( + getStructEncoder([ + ["discriminator", fixEncoderSize(getBytesEncoder(), 8)], + ["authority", getAddressEncoder()], + ["resolverType", getResolverTypeEncoder()], + ["name", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())], + ["description", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())], + ["feeBps", getU16Encoder()], + ["feeRecipient", getAddressEncoder()], + ["metadataUri", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())], + ["totalResolved", getU64Encoder()], + ["ruledForBuyer", getU64Encoder()], + ["ruledForSeller", getU64Encoder()], + ["registeredAt", getI64Encoder()], + ]), + (value) => ({ ...value, discriminator: RESOLVER_ENTRY_DISCRIMINATOR }), + ); +} + +/** Gets the decoder for {@link ResolverEntry} account data. */ +export function getResolverEntryDecoder(): Decoder { + return getStructDecoder([ + ["discriminator", fixDecoderSize(getBytesDecoder(), 8)], + ["authority", getAddressDecoder()], + ["resolverType", getResolverTypeDecoder()], + ["name", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())], + ["description", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())], + ["feeBps", getU16Decoder()], + ["feeRecipient", getAddressDecoder()], + ["metadataUri", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())], + ["totalResolved", getU64Decoder()], + ["ruledForBuyer", getU64Decoder()], + ["ruledForSeller", getU64Decoder()], + ["registeredAt", getI64Decoder()], + ]); +} + +/** Gets the codec for {@link ResolverEntry} account data. */ +export function getResolverEntryCodec(): Codec< + ResolverEntryArgs, + ResolverEntry +> { + return combineCodec(getResolverEntryEncoder(), getResolverEntryDecoder()); +} + +export function decodeResolverEntry( + encodedAccount: EncodedAccount, +): Account; +export function decodeResolverEntry( + encodedAccount: MaybeEncodedAccount, +): MaybeAccount; +export function decodeResolverEntry( + encodedAccount: EncodedAccount | MaybeEncodedAccount, +): Account | MaybeAccount { + return decodeAccount( + encodedAccount as MaybeEncodedAccount, + getResolverEntryDecoder(), + ); +} + +export async function fetchResolverEntry( + rpc: Parameters[0], + address: Address, + config?: FetchAccountConfig, +): Promise> { + const maybeAccount = await fetchMaybeResolverEntry(rpc, address, config); + assertAccountExists(maybeAccount); + return maybeAccount; +} + +export async function fetchMaybeResolverEntry( + rpc: Parameters[0], + address: Address, + config?: FetchAccountConfig, +): Promise> { + const maybeAccount = await fetchEncodedAccount(rpc, address, config); + return decodeResolverEntry(maybeAccount); +} + +export async function fetchAllResolverEntry( + rpc: Parameters[0], + addresses: Array
, + config?: FetchAccountsConfig, +): Promise[]> { + const maybeAccounts = await fetchAllMaybeResolverEntry( + rpc, + addresses, + config, + ); + assertAccountsExist(maybeAccounts); + return maybeAccounts; +} + +export async function fetchAllMaybeResolverEntry( + rpc: Parameters[0], + addresses: Array
, + config?: FetchAccountsConfig, +): Promise[]> { + const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config); + return maybeAccounts.map((maybeAccount) => decodeResolverEntry(maybeAccount)); +} diff --git a/sdk/src/generated/descro_ext_resolvers/src/generated/errors/descroExtResolvers.ts b/sdk/src/generated/descro_ext_resolvers/src/generated/errors/descroExtResolvers.ts new file mode 100644 index 0000000..6a730ba --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/src/generated/errors/descroExtResolvers.ts @@ -0,0 +1,72 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + isProgramError, + type Address, + type SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM, + type SolanaError, +} from "@solana/kit"; +import { DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS } from "../programs"; + +/** Unauthorized: Signer is not the registered authority */ +export const DESCRO_EXT_RESOLVERS_ERROR__UNAUTHORIZED = 0x1770; // 6000 +/** UnauthorizedCaller: Caller is not the authorized escrow program */ +export const DESCRO_EXT_RESOLVERS_ERROR__UNAUTHORIZED_CALLER = 0x1771; // 6001 +/** InvalidFeeBps: Fee basis points must be <= 10000 */ +export const DESCRO_EXT_RESOLVERS_ERROR__INVALID_FEE_BPS = 0x1772; // 6002 +/** EmptyName: Name must not be empty */ +export const DESCRO_EXT_RESOLVERS_ERROR__EMPTY_NAME = 0x1773; // 6003 + +export type DescroExtResolversError = + | typeof DESCRO_EXT_RESOLVERS_ERROR__EMPTY_NAME + | typeof DESCRO_EXT_RESOLVERS_ERROR__INVALID_FEE_BPS + | typeof DESCRO_EXT_RESOLVERS_ERROR__UNAUTHORIZED + | typeof DESCRO_EXT_RESOLVERS_ERROR__UNAUTHORIZED_CALLER; + +let descroExtResolversErrorMessages: + | Record + | undefined; +if (process.env["NODE_ENV"] !== "production") { + descroExtResolversErrorMessages = { + [DESCRO_EXT_RESOLVERS_ERROR__EMPTY_NAME]: `Name must not be empty`, + [DESCRO_EXT_RESOLVERS_ERROR__INVALID_FEE_BPS]: `Fee basis points must be <= 10000`, + [DESCRO_EXT_RESOLVERS_ERROR__UNAUTHORIZED]: `Signer is not the registered authority`, + [DESCRO_EXT_RESOLVERS_ERROR__UNAUTHORIZED_CALLER]: `Caller is not the authorized escrow program`, + }; +} + +export function getDescroExtResolversErrorMessage( + code: DescroExtResolversError, +): string { + if (process.env["NODE_ENV"] !== "production") { + return ( + descroExtResolversErrorMessages as Record + )[code]; + } + + return "Error message not available in production bundles."; +} + +export function isDescroExtResolversError< + TProgramErrorCode extends DescroExtResolversError, +>( + error: unknown, + transactionMessage: { + instructions: Record; + }, + code?: TProgramErrorCode, +): error is SolanaError & + Readonly<{ context: Readonly<{ code: TProgramErrorCode }> }> { + return isProgramError( + error, + transactionMessage, + DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS, + code, + ); +} diff --git a/sdk/src/generated/descro_ext_resolvers/src/generated/errors/index.ts b/sdk/src/generated/descro_ext_resolvers/src/generated/errors/index.ts new file mode 100644 index 0000000..59bd767 --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/src/generated/errors/index.ts @@ -0,0 +1,9 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +export * from "./descroExtResolvers"; diff --git a/sdk/src/generated/descro_ext_resolvers/src/generated/index.ts b/sdk/src/generated/descro_ext_resolvers/src/generated/index.ts new file mode 100644 index 0000000..74d2752 --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/src/generated/index.ts @@ -0,0 +1,14 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +export * from "./accounts"; +export * from "./errors"; +export * from "./instructions"; +export * from "./pdas"; +export * from "./programs"; +export * from "./types"; diff --git a/sdk/src/generated/descro_ext_resolvers/src/generated/instructions/index.ts b/sdk/src/generated/descro_ext_resolvers/src/generated/instructions/index.ts new file mode 100644 index 0000000..ba91d26 --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/src/generated/instructions/index.ts @@ -0,0 +1,11 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +export * from "./registerResolver"; +export * from "./updateResolver"; +export * from "./updateStats"; diff --git a/sdk/src/generated/descro_ext_resolvers/src/generated/instructions/registerResolver.ts b/sdk/src/generated/descro_ext_resolvers/src/generated/instructions/registerResolver.ts new file mode 100644 index 0000000..b1a03d7 --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/src/generated/instructions/registerResolver.ts @@ -0,0 +1,358 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + addDecoderSizePrefix, + addEncoderSizePrefix, + combineCodec, + fixDecoderSize, + fixEncoderSize, + getAddressDecoder, + getAddressEncoder, + getBytesDecoder, + getBytesEncoder, + getStructDecoder, + getStructEncoder, + getU16Decoder, + getU16Encoder, + getU32Decoder, + getU32Encoder, + getUtf8Decoder, + getUtf8Encoder, + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + SolanaError, + transformEncoder, + type AccountMeta, + type AccountSignerMeta, + type Address, + type Codec, + type Decoder, + type Encoder, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, + type ReadonlyAccount, + type ReadonlyUint8Array, + type TransactionSigner, + type WritableAccount, + type WritableSignerAccount, +} from "@solana/kit"; +import { + getAccountMetaFactory, + getAddressFromResolvedInstructionAccount, + type ResolvedInstructionAccount, +} from "@solana/program-client-core"; +import { findResolverEntryPda } from "../pdas"; +import { DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS } from "../programs"; +import { + getResolverTypeDecoder, + getResolverTypeEncoder, + type ResolverType, + type ResolverTypeArgs, +} from "../types"; + +export const REGISTER_RESOLVER_DISCRIMINATOR: ReadonlyUint8Array = + new Uint8Array([76, 101, 253, 229, 153, 242, 212, 230]); + +export function getRegisterResolverDiscriminatorBytes(): ReadonlyUint8Array { + return fixEncoderSize(getBytesEncoder(), 8).encode( + REGISTER_RESOLVER_DISCRIMINATOR, + ); +} + +export type RegisterResolverInstruction< + TProgram extends string = typeof DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS, + TAccountAuthority extends string | AccountMeta = string, + TAccountResolverEntry extends string | AccountMeta = string, + TAccountSystemProgram extends string | AccountMeta = + "11111111111111111111111111111111", + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< + [ + TAccountAuthority extends string + ? WritableSignerAccount & + AccountSignerMeta + : TAccountAuthority, + TAccountResolverEntry extends string + ? WritableAccount + : TAccountResolverEntry, + TAccountSystemProgram extends string + ? ReadonlyAccount + : TAccountSystemProgram, + ...TRemainingAccounts, + ] + >; + +export type RegisterResolverInstructionData = { + discriminator: ReadonlyUint8Array; + resolverType: ResolverType; + name: string; + description: string; + feeBps: number; + feeRecipient: Address; + metadataUri: string; +}; + +export type RegisterResolverInstructionDataArgs = { + resolverType: ResolverTypeArgs; + name: string; + description: string; + feeBps: number; + feeRecipient: Address; + metadataUri: string; +}; + +export function getRegisterResolverInstructionDataEncoder(): Encoder { + return transformEncoder( + getStructEncoder([ + ["discriminator", fixEncoderSize(getBytesEncoder(), 8)], + ["resolverType", getResolverTypeEncoder()], + ["name", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())], + ["description", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())], + ["feeBps", getU16Encoder()], + ["feeRecipient", getAddressEncoder()], + ["metadataUri", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())], + ]), + (value) => ({ ...value, discriminator: REGISTER_RESOLVER_DISCRIMINATOR }), + ); +} + +export function getRegisterResolverInstructionDataDecoder(): Decoder { + return getStructDecoder([ + ["discriminator", fixDecoderSize(getBytesDecoder(), 8)], + ["resolverType", getResolverTypeDecoder()], + ["name", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())], + ["description", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())], + ["feeBps", getU16Decoder()], + ["feeRecipient", getAddressDecoder()], + ["metadataUri", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())], + ]); +} + +export function getRegisterResolverInstructionDataCodec(): Codec< + RegisterResolverInstructionDataArgs, + RegisterResolverInstructionData +> { + return combineCodec( + getRegisterResolverInstructionDataEncoder(), + getRegisterResolverInstructionDataDecoder(), + ); +} + +export type RegisterResolverAsyncInput< + TAccountAuthority extends string = string, + TAccountResolverEntry extends string = string, + TAccountSystemProgram extends string = string, +> = { + authority: TransactionSigner; + resolverEntry?: Address; + systemProgram?: Address; + resolverType: RegisterResolverInstructionDataArgs["resolverType"]; + name: RegisterResolverInstructionDataArgs["name"]; + description: RegisterResolverInstructionDataArgs["description"]; + feeBps: RegisterResolverInstructionDataArgs["feeBps"]; + feeRecipient: RegisterResolverInstructionDataArgs["feeRecipient"]; + metadataUri: RegisterResolverInstructionDataArgs["metadataUri"]; +}; + +export async function getRegisterResolverInstructionAsync< + TAccountAuthority extends string, + TAccountResolverEntry extends string, + TAccountSystemProgram extends string, + TProgramAddress extends Address = typeof DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS, +>( + input: RegisterResolverAsyncInput< + TAccountAuthority, + TAccountResolverEntry, + TAccountSystemProgram + >, + config?: { programAddress?: TProgramAddress }, +): Promise< + RegisterResolverInstruction< + TProgramAddress, + TAccountAuthority, + TAccountResolverEntry, + TAccountSystemProgram + > +> { + // Program address. + const programAddress = + config?.programAddress ?? DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS; + + // Original accounts. + const originalAccounts = { + authority: { value: input.authority ?? null, isWritable: true }, + resolverEntry: { value: input.resolverEntry ?? null, isWritable: true }, + systemProgram: { value: input.systemProgram ?? null, isWritable: false }, + }; + const accounts = originalAccounts as Record< + keyof typeof originalAccounts, + ResolvedInstructionAccount + >; + + // Original args. + const args = { ...input }; + + // Resolve default values. + if (!accounts.resolverEntry.value) { + accounts.resolverEntry.value = await findResolverEntryPda({ + authority: getAddressFromResolvedInstructionAccount( + "authority", + accounts.authority.value, + ), + }); + } + if (!accounts.systemProgram.value) { + accounts.systemProgram.value = + "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">; + } + + const getAccountMeta = getAccountMetaFactory(programAddress, "programId"); + return Object.freeze({ + accounts: [ + getAccountMeta("authority", accounts.authority), + getAccountMeta("resolverEntry", accounts.resolverEntry), + getAccountMeta("systemProgram", accounts.systemProgram), + ], + data: getRegisterResolverInstructionDataEncoder().encode( + args as RegisterResolverInstructionDataArgs, + ), + programAddress, + } as RegisterResolverInstruction< + TProgramAddress, + TAccountAuthority, + TAccountResolverEntry, + TAccountSystemProgram + >); +} + +export type RegisterResolverInput< + TAccountAuthority extends string = string, + TAccountResolverEntry extends string = string, + TAccountSystemProgram extends string = string, +> = { + authority: TransactionSigner; + resolverEntry: Address; + systemProgram?: Address; + resolverType: RegisterResolverInstructionDataArgs["resolverType"]; + name: RegisterResolverInstructionDataArgs["name"]; + description: RegisterResolverInstructionDataArgs["description"]; + feeBps: RegisterResolverInstructionDataArgs["feeBps"]; + feeRecipient: RegisterResolverInstructionDataArgs["feeRecipient"]; + metadataUri: RegisterResolverInstructionDataArgs["metadataUri"]; +}; + +export function getRegisterResolverInstruction< + TAccountAuthority extends string, + TAccountResolverEntry extends string, + TAccountSystemProgram extends string, + TProgramAddress extends Address = typeof DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS, +>( + input: RegisterResolverInput< + TAccountAuthority, + TAccountResolverEntry, + TAccountSystemProgram + >, + config?: { programAddress?: TProgramAddress }, +): RegisterResolverInstruction< + TProgramAddress, + TAccountAuthority, + TAccountResolverEntry, + TAccountSystemProgram +> { + // Program address. + const programAddress = + config?.programAddress ?? DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS; + + // Original accounts. + const originalAccounts = { + authority: { value: input.authority ?? null, isWritable: true }, + resolverEntry: { value: input.resolverEntry ?? null, isWritable: true }, + systemProgram: { value: input.systemProgram ?? null, isWritable: false }, + }; + const accounts = originalAccounts as Record< + keyof typeof originalAccounts, + ResolvedInstructionAccount + >; + + // Original args. + const args = { ...input }; + + // Resolve default values. + if (!accounts.systemProgram.value) { + accounts.systemProgram.value = + "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">; + } + + const getAccountMeta = getAccountMetaFactory(programAddress, "programId"); + return Object.freeze({ + accounts: [ + getAccountMeta("authority", accounts.authority), + getAccountMeta("resolverEntry", accounts.resolverEntry), + getAccountMeta("systemProgram", accounts.systemProgram), + ], + data: getRegisterResolverInstructionDataEncoder().encode( + args as RegisterResolverInstructionDataArgs, + ), + programAddress, + } as RegisterResolverInstruction< + TProgramAddress, + TAccountAuthority, + TAccountResolverEntry, + TAccountSystemProgram + >); +} + +export type ParsedRegisterResolverInstruction< + TProgram extends string = typeof DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS, + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], +> = { + programAddress: Address; + accounts: { + authority: TAccountMetas[0]; + resolverEntry: TAccountMetas[1]; + systemProgram: TAccountMetas[2]; + }; + data: RegisterResolverInstructionData; +}; + +export function parseRegisterResolverInstruction< + TProgram extends string, + TAccountMetas extends readonly AccountMeta[], +>( + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData, +): ParsedRegisterResolverInstruction { + if (instruction.accounts.length < 3) { + throw new SolanaError( + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + { + actualAccountMetas: instruction.accounts.length, + expectedAccountMetas: 3, + }, + ); + } + let accountIndex = 0; + const getNextAccount = () => { + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; + accountIndex += 1; + return accountMeta; + }; + return { + programAddress: instruction.programAddress, + accounts: { + authority: getNextAccount(), + resolverEntry: getNextAccount(), + systemProgram: getNextAccount(), + }, + data: getRegisterResolverInstructionDataDecoder().decode(instruction.data), + }; +} diff --git a/sdk/src/generated/descro_ext_resolvers/src/generated/instructions/updateResolver.ts b/sdk/src/generated/descro_ext_resolvers/src/generated/instructions/updateResolver.ts new file mode 100644 index 0000000..b39b5b0 --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/src/generated/instructions/updateResolver.ts @@ -0,0 +1,296 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + addDecoderSizePrefix, + addEncoderSizePrefix, + combineCodec, + fixDecoderSize, + fixEncoderSize, + getBytesDecoder, + getBytesEncoder, + getStructDecoder, + getStructEncoder, + getU16Decoder, + getU16Encoder, + getU32Decoder, + getU32Encoder, + getUtf8Decoder, + getUtf8Encoder, + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + SolanaError, + transformEncoder, + type AccountMeta, + type AccountSignerMeta, + type Address, + type Codec, + type Decoder, + type Encoder, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, + type ReadonlySignerAccount, + type ReadonlyUint8Array, + type TransactionSigner, + type WritableAccount, +} from "@solana/kit"; +import { + getAccountMetaFactory, + getAddressFromResolvedInstructionAccount, + type ResolvedInstructionAccount, +} from "@solana/program-client-core"; +import { findResolverEntryPda } from "../pdas"; +import { DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS } from "../programs"; + +export const UPDATE_RESOLVER_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array( + [108, 227, 28, 163, 123, 230, 190, 84], +); + +export function getUpdateResolverDiscriminatorBytes(): ReadonlyUint8Array { + return fixEncoderSize(getBytesEncoder(), 8).encode( + UPDATE_RESOLVER_DISCRIMINATOR, + ); +} + +export type UpdateResolverInstruction< + TProgram extends string = typeof DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS, + TAccountAuthority extends string | AccountMeta = string, + TAccountResolverEntry extends string | AccountMeta = string, + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< + [ + TAccountAuthority extends string + ? ReadonlySignerAccount & + AccountSignerMeta + : TAccountAuthority, + TAccountResolverEntry extends string + ? WritableAccount + : TAccountResolverEntry, + ...TRemainingAccounts, + ] + >; + +export type UpdateResolverInstructionData = { + discriminator: ReadonlyUint8Array; + name: string; + description: string; + feeBps: number; + metadataUri: string; +}; + +export type UpdateResolverInstructionDataArgs = { + name: string; + description: string; + feeBps: number; + metadataUri: string; +}; + +export function getUpdateResolverInstructionDataEncoder(): Encoder { + return transformEncoder( + getStructEncoder([ + ["discriminator", fixEncoderSize(getBytesEncoder(), 8)], + ["name", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())], + ["description", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())], + ["feeBps", getU16Encoder()], + ["metadataUri", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())], + ]), + (value) => ({ ...value, discriminator: UPDATE_RESOLVER_DISCRIMINATOR }), + ); +} + +export function getUpdateResolverInstructionDataDecoder(): Decoder { + return getStructDecoder([ + ["discriminator", fixDecoderSize(getBytesDecoder(), 8)], + ["name", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())], + ["description", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())], + ["feeBps", getU16Decoder()], + ["metadataUri", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())], + ]); +} + +export function getUpdateResolverInstructionDataCodec(): Codec< + UpdateResolverInstructionDataArgs, + UpdateResolverInstructionData +> { + return combineCodec( + getUpdateResolverInstructionDataEncoder(), + getUpdateResolverInstructionDataDecoder(), + ); +} + +export type UpdateResolverAsyncInput< + TAccountAuthority extends string = string, + TAccountResolverEntry extends string = string, +> = { + authority: TransactionSigner; + resolverEntry?: Address; + name: UpdateResolverInstructionDataArgs["name"]; + description: UpdateResolverInstructionDataArgs["description"]; + feeBps: UpdateResolverInstructionDataArgs["feeBps"]; + metadataUri: UpdateResolverInstructionDataArgs["metadataUri"]; +}; + +export async function getUpdateResolverInstructionAsync< + TAccountAuthority extends string, + TAccountResolverEntry extends string, + TProgramAddress extends Address = typeof DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS, +>( + input: UpdateResolverAsyncInput, + config?: { programAddress?: TProgramAddress }, +): Promise< + UpdateResolverInstruction< + TProgramAddress, + TAccountAuthority, + TAccountResolverEntry + > +> { + // Program address. + const programAddress = + config?.programAddress ?? DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS; + + // Original accounts. + const originalAccounts = { + authority: { value: input.authority ?? null, isWritable: false }, + resolverEntry: { value: input.resolverEntry ?? null, isWritable: true }, + }; + const accounts = originalAccounts as Record< + keyof typeof originalAccounts, + ResolvedInstructionAccount + >; + + // Original args. + const args = { ...input }; + + // Resolve default values. + if (!accounts.resolverEntry.value) { + accounts.resolverEntry.value = await findResolverEntryPda({ + authority: getAddressFromResolvedInstructionAccount( + "authority", + accounts.authority.value, + ), + }); + } + + const getAccountMeta = getAccountMetaFactory(programAddress, "programId"); + return Object.freeze({ + accounts: [ + getAccountMeta("authority", accounts.authority), + getAccountMeta("resolverEntry", accounts.resolverEntry), + ], + data: getUpdateResolverInstructionDataEncoder().encode( + args as UpdateResolverInstructionDataArgs, + ), + programAddress, + } as UpdateResolverInstruction< + TProgramAddress, + TAccountAuthority, + TAccountResolverEntry + >); +} + +export type UpdateResolverInput< + TAccountAuthority extends string = string, + TAccountResolverEntry extends string = string, +> = { + authority: TransactionSigner; + resolverEntry: Address; + name: UpdateResolverInstructionDataArgs["name"]; + description: UpdateResolverInstructionDataArgs["description"]; + feeBps: UpdateResolverInstructionDataArgs["feeBps"]; + metadataUri: UpdateResolverInstructionDataArgs["metadataUri"]; +}; + +export function getUpdateResolverInstruction< + TAccountAuthority extends string, + TAccountResolverEntry extends string, + TProgramAddress extends Address = typeof DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS, +>( + input: UpdateResolverInput, + config?: { programAddress?: TProgramAddress }, +): UpdateResolverInstruction< + TProgramAddress, + TAccountAuthority, + TAccountResolverEntry +> { + // Program address. + const programAddress = + config?.programAddress ?? DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS; + + // Original accounts. + const originalAccounts = { + authority: { value: input.authority ?? null, isWritable: false }, + resolverEntry: { value: input.resolverEntry ?? null, isWritable: true }, + }; + const accounts = originalAccounts as Record< + keyof typeof originalAccounts, + ResolvedInstructionAccount + >; + + // Original args. + const args = { ...input }; + + const getAccountMeta = getAccountMetaFactory(programAddress, "programId"); + return Object.freeze({ + accounts: [ + getAccountMeta("authority", accounts.authority), + getAccountMeta("resolverEntry", accounts.resolverEntry), + ], + data: getUpdateResolverInstructionDataEncoder().encode( + args as UpdateResolverInstructionDataArgs, + ), + programAddress, + } as UpdateResolverInstruction< + TProgramAddress, + TAccountAuthority, + TAccountResolverEntry + >); +} + +export type ParsedUpdateResolverInstruction< + TProgram extends string = typeof DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS, + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], +> = { + programAddress: Address; + accounts: { + authority: TAccountMetas[0]; + resolverEntry: TAccountMetas[1]; + }; + data: UpdateResolverInstructionData; +}; + +export function parseUpdateResolverInstruction< + TProgram extends string, + TAccountMetas extends readonly AccountMeta[], +>( + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData, +): ParsedUpdateResolverInstruction { + if (instruction.accounts.length < 2) { + throw new SolanaError( + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + { + actualAccountMetas: instruction.accounts.length, + expectedAccountMetas: 2, + }, + ); + } + let accountIndex = 0; + const getNextAccount = () => { + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; + accountIndex += 1; + return accountMeta; + }; + return { + programAddress: instruction.programAddress, + accounts: { authority: getNextAccount(), resolverEntry: getNextAccount() }, + data: getUpdateResolverInstructionDataDecoder().decode(instruction.data), + }; +} diff --git a/sdk/src/generated/descro_ext_resolvers/src/generated/instructions/updateStats.ts b/sdk/src/generated/descro_ext_resolvers/src/generated/instructions/updateStats.ts new file mode 100644 index 0000000..b0f56e0 --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/src/generated/instructions/updateStats.ts @@ -0,0 +1,291 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + combineCodec, + fixDecoderSize, + fixEncoderSize, + getBytesDecoder, + getBytesEncoder, + getProgramDerivedAddress, + getStructDecoder, + getStructEncoder, + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + SolanaError, + transformEncoder, + type AccountMeta, + type AccountSignerMeta, + type Address, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, + type Instruction, + type InstructionWithAccounts, + type InstructionWithData, + type ReadonlySignerAccount, + type ReadonlyUint8Array, + type TransactionSigner, + type WritableAccount, +} from "@solana/kit"; +import { + getAccountMetaFactory, + type ResolvedInstructionAccount, +} from "@solana/program-client-core"; +import { DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS } from "../programs"; +import { + getRulingDecoder, + getRulingEncoder, + type Ruling, + type RulingArgs, +} from "../types"; + +export const UPDATE_STATS_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([ + 145, 138, 9, 150, 178, 31, 158, 244, +]); + +export function getUpdateStatsDiscriminatorBytes(): ReadonlyUint8Array { + return fixEncoderSize(getBytesEncoder(), 8).encode( + UPDATE_STATS_DISCRIMINATOR, + ); +} + +export type UpdateStatsInstruction< + TProgram extends string = typeof DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS, + TAccountEscrowAuthority extends string | AccountMeta = string, + TAccountResolverEntry extends string | AccountMeta = string, + TRemainingAccounts extends readonly AccountMeta[] = [], +> = Instruction & + InstructionWithData & + InstructionWithAccounts< + [ + TAccountEscrowAuthority extends string + ? ReadonlySignerAccount & + AccountSignerMeta + : TAccountEscrowAuthority, + TAccountResolverEntry extends string + ? WritableAccount + : TAccountResolverEntry, + ...TRemainingAccounts, + ] + >; + +export type UpdateStatsInstructionData = { + discriminator: ReadonlyUint8Array; + ruling: Ruling; +}; + +export type UpdateStatsInstructionDataArgs = { ruling: RulingArgs }; + +export function getUpdateStatsInstructionDataEncoder(): FixedSizeEncoder { + return transformEncoder( + getStructEncoder([ + ["discriminator", fixEncoderSize(getBytesEncoder(), 8)], + ["ruling", getRulingEncoder()], + ]), + (value) => ({ ...value, discriminator: UPDATE_STATS_DISCRIMINATOR }), + ); +} + +export function getUpdateStatsInstructionDataDecoder(): FixedSizeDecoder { + return getStructDecoder([ + ["discriminator", fixDecoderSize(getBytesDecoder(), 8)], + ["ruling", getRulingDecoder()], + ]); +} + +export function getUpdateStatsInstructionDataCodec(): FixedSizeCodec< + UpdateStatsInstructionDataArgs, + UpdateStatsInstructionData +> { + return combineCodec( + getUpdateStatsInstructionDataEncoder(), + getUpdateStatsInstructionDataDecoder(), + ); +} + +export type UpdateStatsAsyncInput< + TAccountEscrowAuthority extends string = string, + TAccountResolverEntry extends string = string, +> = { + /** Must be the Escrow Program's authority PDA — only it can sign this. */ + escrowAuthority?: TransactionSigner; + resolverEntry: Address; + ruling: UpdateStatsInstructionDataArgs["ruling"]; +}; + +export async function getUpdateStatsInstructionAsync< + TAccountEscrowAuthority extends string, + TAccountResolverEntry extends string, + TProgramAddress extends Address = typeof DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS, +>( + input: UpdateStatsAsyncInput, + config?: { programAddress?: TProgramAddress }, +): Promise< + UpdateStatsInstruction< + TProgramAddress, + TAccountEscrowAuthority, + TAccountResolverEntry + > +> { + // Program address. + const programAddress = + config?.programAddress ?? DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS; + + // Original accounts. + const originalAccounts = { + escrowAuthority: { + value: input.escrowAuthority ?? null, + isWritable: false, + }, + resolverEntry: { value: input.resolverEntry ?? null, isWritable: true }, + }; + const accounts = originalAccounts as Record< + keyof typeof originalAccounts, + ResolvedInstructionAccount + >; + + // Original args. + const args = { ...input }; + + // Resolve default values. + if (!accounts.escrowAuthority.value) { + accounts.escrowAuthority.value = await getProgramDerivedAddress({ + programAddress: + "DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3" as Address<"DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3">, + seeds: [ + getBytesEncoder().encode( + new Uint8Array([ + 101, 115, 99, 114, 111, 119, 95, 97, 117, 116, 104, 111, 114, 105, + 116, 121, + ]), + ), + ], + }); + } + + const getAccountMeta = getAccountMetaFactory(programAddress, "programId"); + return Object.freeze({ + accounts: [ + getAccountMeta("escrowAuthority", accounts.escrowAuthority), + getAccountMeta("resolverEntry", accounts.resolverEntry), + ], + data: getUpdateStatsInstructionDataEncoder().encode( + args as UpdateStatsInstructionDataArgs, + ), + programAddress, + } as UpdateStatsInstruction< + TProgramAddress, + TAccountEscrowAuthority, + TAccountResolverEntry + >); +} + +export type UpdateStatsInput< + TAccountEscrowAuthority extends string = string, + TAccountResolverEntry extends string = string, +> = { + /** Must be the Escrow Program's authority PDA — only it can sign this. */ + escrowAuthority: TransactionSigner; + resolverEntry: Address; + ruling: UpdateStatsInstructionDataArgs["ruling"]; +}; + +export function getUpdateStatsInstruction< + TAccountEscrowAuthority extends string, + TAccountResolverEntry extends string, + TProgramAddress extends Address = typeof DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS, +>( + input: UpdateStatsInput, + config?: { programAddress?: TProgramAddress }, +): UpdateStatsInstruction< + TProgramAddress, + TAccountEscrowAuthority, + TAccountResolverEntry +> { + // Program address. + const programAddress = + config?.programAddress ?? DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS; + + // Original accounts. + const originalAccounts = { + escrowAuthority: { + value: input.escrowAuthority ?? null, + isWritable: false, + }, + resolverEntry: { value: input.resolverEntry ?? null, isWritable: true }, + }; + const accounts = originalAccounts as Record< + keyof typeof originalAccounts, + ResolvedInstructionAccount + >; + + // Original args. + const args = { ...input }; + + const getAccountMeta = getAccountMetaFactory(programAddress, "programId"); + return Object.freeze({ + accounts: [ + getAccountMeta("escrowAuthority", accounts.escrowAuthority), + getAccountMeta("resolverEntry", accounts.resolverEntry), + ], + data: getUpdateStatsInstructionDataEncoder().encode( + args as UpdateStatsInstructionDataArgs, + ), + programAddress, + } as UpdateStatsInstruction< + TProgramAddress, + TAccountEscrowAuthority, + TAccountResolverEntry + >); +} + +export type ParsedUpdateStatsInstruction< + TProgram extends string = typeof DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS, + TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[], +> = { + programAddress: Address; + accounts: { + /** Must be the Escrow Program's authority PDA — only it can sign this. */ + escrowAuthority: TAccountMetas[0]; + resolverEntry: TAccountMetas[1]; + }; + data: UpdateStatsInstructionData; +}; + +export function parseUpdateStatsInstruction< + TProgram extends string, + TAccountMetas extends readonly AccountMeta[], +>( + instruction: Instruction & + InstructionWithAccounts & + InstructionWithData, +): ParsedUpdateStatsInstruction { + if (instruction.accounts.length < 2) { + throw new SolanaError( + SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, + { + actualAccountMetas: instruction.accounts.length, + expectedAccountMetas: 2, + }, + ); + } + let accountIndex = 0; + const getNextAccount = () => { + const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!; + accountIndex += 1; + return accountMeta; + }; + return { + programAddress: instruction.programAddress, + accounts: { + escrowAuthority: getNextAccount(), + resolverEntry: getNextAccount(), + }, + data: getUpdateStatsInstructionDataDecoder().decode(instruction.data), + }; +} diff --git a/sdk/src/generated/descro_ext_resolvers/src/generated/pdas/index.ts b/sdk/src/generated/descro_ext_resolvers/src/generated/pdas/index.ts new file mode 100644 index 0000000..4ac749e --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/src/generated/pdas/index.ts @@ -0,0 +1,9 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +export * from "./resolverEntry"; diff --git a/sdk/src/generated/descro_ext_resolvers/src/generated/pdas/resolverEntry.ts b/sdk/src/generated/descro_ext_resolvers/src/generated/pdas/resolverEntry.ts new file mode 100644 index 0000000..66e4b5a --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/src/generated/pdas/resolverEntry.ts @@ -0,0 +1,37 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + getAddressEncoder, + getBytesEncoder, + getProgramDerivedAddress, + type Address, + type ProgramDerivedAddress, +} from "@solana/kit"; + +export type ResolverEntrySeeds = { + authority: Address; +}; + +export async function findResolverEntryPda( + seeds: ResolverEntrySeeds, + config: { programAddress?: Address | undefined } = {}, +): Promise { + const { + programAddress = "GwUPAKs3HHzCpj8uhet4NAnxk9GWNwfrYbpihu5DyFp" as Address<"GwUPAKs3HHzCpj8uhet4NAnxk9GWNwfrYbpihu5DyFp">, + } = config; + return await getProgramDerivedAddress({ + programAddress, + seeds: [ + getBytesEncoder().encode( + new Uint8Array([114, 101, 115, 111, 108, 118, 101, 114]), + ), + getAddressEncoder().encode(seeds.authority), + ], + }); +} diff --git a/sdk/src/generated/descro_ext_resolvers/src/generated/programs/descroExtResolvers.ts b/sdk/src/generated/descro_ext_resolvers/src/generated/programs/descroExtResolvers.ts new file mode 100644 index 0000000..6d07ccf --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/src/generated/programs/descroExtResolvers.ts @@ -0,0 +1,251 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + assertIsInstructionWithAccounts, + containsBytes, + extendClient, + fixEncoderSize, + getBytesEncoder, + SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, + SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, + SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, + SolanaError, + type Address, + type ClientWithRpc, + type ClientWithTransactionPlanning, + type ClientWithTransactionSending, + type GetAccountInfoApi, + type GetMultipleAccountsApi, + type Instruction, + type InstructionWithData, + type ReadonlyUint8Array, +} from "@solana/kit"; +import { + addSelfFetchFunctions, + addSelfPlanAndSendFunctions, + type SelfFetchFunctions, + type SelfPlanAndSendFunctions, +} from "@solana/program-client-core"; +import { + getResolverEntryCodec, + type ResolverEntry, + type ResolverEntryArgs, +} from "../accounts"; +import { + getRegisterResolverInstructionAsync, + getUpdateResolverInstructionAsync, + getUpdateStatsInstructionAsync, + parseRegisterResolverInstruction, + parseUpdateResolverInstruction, + parseUpdateStatsInstruction, + type ParsedRegisterResolverInstruction, + type ParsedUpdateResolverInstruction, + type ParsedUpdateStatsInstruction, + type RegisterResolverAsyncInput, + type UpdateResolverAsyncInput, + type UpdateStatsAsyncInput, +} from "../instructions"; +import { findResolverEntryPda } from "../pdas"; + +export const DESCRO_EXT_RESOLVERS_PROGRAM_ADDRESS = + "GwUPAKs3HHzCpj8uhet4NAnxk9GWNwfrYbpihu5DyFp" as Address<"GwUPAKs3HHzCpj8uhet4NAnxk9GWNwfrYbpihu5DyFp">; + +export enum DescroExtResolversAccount { + ResolverEntry, +} + +export function identifyDescroExtResolversAccount( + account: { data: ReadonlyUint8Array } | ReadonlyUint8Array, +): DescroExtResolversAccount { + const data = "data" in account ? account.data : account; + if ( + containsBytes( + data, + fixEncoderSize(getBytesEncoder(), 8).encode( + new Uint8Array([0, 60, 55, 58, 157, 135, 51, 191]), + ), + 0, + ) + ) { + return DescroExtResolversAccount.ResolverEntry; + } + throw new SolanaError( + SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, + { accountData: data, programName: "descroExtResolvers" }, + ); +} + +export enum DescroExtResolversInstruction { + RegisterResolver, + UpdateResolver, + UpdateStats, +} + +export function identifyDescroExtResolversInstruction( + instruction: { data: ReadonlyUint8Array } | ReadonlyUint8Array, +): DescroExtResolversInstruction { + const data = "data" in instruction ? instruction.data : instruction; + if ( + containsBytes( + data, + fixEncoderSize(getBytesEncoder(), 8).encode( + new Uint8Array([76, 101, 253, 229, 153, 242, 212, 230]), + ), + 0, + ) + ) { + return DescroExtResolversInstruction.RegisterResolver; + } + if ( + containsBytes( + data, + fixEncoderSize(getBytesEncoder(), 8).encode( + new Uint8Array([108, 227, 28, 163, 123, 230, 190, 84]), + ), + 0, + ) + ) { + return DescroExtResolversInstruction.UpdateResolver; + } + if ( + containsBytes( + data, + fixEncoderSize(getBytesEncoder(), 8).encode( + new Uint8Array([145, 138, 9, 150, 178, 31, 158, 244]), + ), + 0, + ) + ) { + return DescroExtResolversInstruction.UpdateStats; + } + throw new SolanaError( + SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, + { instructionData: data, programName: "descroExtResolvers" }, + ); +} + +export type ParsedDescroExtResolversInstruction< + TProgram extends string = "GwUPAKs3HHzCpj8uhet4NAnxk9GWNwfrYbpihu5DyFp", +> = + | ({ + instructionType: DescroExtResolversInstruction.RegisterResolver; + } & ParsedRegisterResolverInstruction) + | ({ + instructionType: DescroExtResolversInstruction.UpdateResolver; + } & ParsedUpdateResolverInstruction) + | ({ + instructionType: DescroExtResolversInstruction.UpdateStats; + } & ParsedUpdateStatsInstruction); + +export function parseDescroExtResolversInstruction( + instruction: Instruction & InstructionWithData, +): ParsedDescroExtResolversInstruction { + const instructionType = identifyDescroExtResolversInstruction(instruction); + switch (instructionType) { + case DescroExtResolversInstruction.RegisterResolver: { + assertIsInstructionWithAccounts(instruction); + return { + instructionType: DescroExtResolversInstruction.RegisterResolver, + ...parseRegisterResolverInstruction(instruction), + }; + } + case DescroExtResolversInstruction.UpdateResolver: { + assertIsInstructionWithAccounts(instruction); + return { + instructionType: DescroExtResolversInstruction.UpdateResolver, + ...parseUpdateResolverInstruction(instruction), + }; + } + case DescroExtResolversInstruction.UpdateStats: { + assertIsInstructionWithAccounts(instruction); + return { + instructionType: DescroExtResolversInstruction.UpdateStats, + ...parseUpdateStatsInstruction(instruction), + }; + } + default: + throw new SolanaError( + SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, + { + instructionType: instructionType as string, + programName: "descroExtResolvers", + }, + ); + } +} + +export type DescroExtResolversPlugin = { + accounts: DescroExtResolversPluginAccounts; + instructions: DescroExtResolversPluginInstructions; + pdas: DescroExtResolversPluginPdas; +}; + +export type DescroExtResolversPluginAccounts = { + resolverEntry: ReturnType & + SelfFetchFunctions; +}; + +export type DescroExtResolversPluginInstructions = { + registerResolver: ( + input: RegisterResolverAsyncInput, + ) => ReturnType & + SelfPlanAndSendFunctions; + updateResolver: ( + input: UpdateResolverAsyncInput, + ) => ReturnType & + SelfPlanAndSendFunctions; + updateStats: ( + input: UpdateStatsAsyncInput, + ) => ReturnType & + SelfPlanAndSendFunctions; +}; + +export type DescroExtResolversPluginPdas = { + resolverEntry: typeof findResolverEntryPda; +}; + +export type DescroExtResolversPluginRequirements = ClientWithRpc< + GetAccountInfoApi & GetMultipleAccountsApi +> & + ClientWithTransactionPlanning & + ClientWithTransactionSending; + +export function descroExtResolversProgram() { + return ( + client: T, + ): Omit & { + descroExtResolvers: DescroExtResolversPlugin; + } => { + return extendClient(client, { + descroExtResolvers: { + accounts: { + resolverEntry: addSelfFetchFunctions(client, getResolverEntryCodec()), + }, + instructions: { + registerResolver: (input) => + addSelfPlanAndSendFunctions( + client, + getRegisterResolverInstructionAsync(input), + ), + updateResolver: (input) => + addSelfPlanAndSendFunctions( + client, + getUpdateResolverInstructionAsync(input), + ), + updateStats: (input) => + addSelfPlanAndSendFunctions( + client, + getUpdateStatsInstructionAsync(input), + ), + }, + pdas: { resolverEntry: findResolverEntryPda }, + }, + }); + }; +} diff --git a/sdk/src/generated/descro_ext_resolvers/src/generated/programs/index.ts b/sdk/src/generated/descro_ext_resolvers/src/generated/programs/index.ts new file mode 100644 index 0000000..59bd767 --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/src/generated/programs/index.ts @@ -0,0 +1,9 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +export * from "./descroExtResolvers"; diff --git a/sdk/src/generated/descro_ext_resolvers/src/generated/types/index.ts b/sdk/src/generated/descro_ext_resolvers/src/generated/types/index.ts new file mode 100644 index 0000000..121f2e9 --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/src/generated/types/index.ts @@ -0,0 +1,10 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +export * from "./resolverType"; +export * from "./ruling"; diff --git a/sdk/src/generated/descro_ext_resolvers/src/generated/types/resolverType.ts b/sdk/src/generated/descro_ext_resolvers/src/generated/types/resolverType.ts new file mode 100644 index 0000000..4c22a60 --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/src/generated/types/resolverType.ts @@ -0,0 +1,41 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + combineCodec, + getEnumDecoder, + getEnumEncoder, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, +} from "@solana/kit"; + +export enum ResolverType { + CentralAuthority, + JuryDAO, + MAD, + Algorithmic, + Multisig, +} + +export type ResolverTypeArgs = ResolverType; + +export function getResolverTypeEncoder(): FixedSizeEncoder { + return getEnumEncoder(ResolverType); +} + +export function getResolverTypeDecoder(): FixedSizeDecoder { + return getEnumDecoder(ResolverType); +} + +export function getResolverTypeCodec(): FixedSizeCodec< + ResolverTypeArgs, + ResolverType +> { + return combineCodec(getResolverTypeEncoder(), getResolverTypeDecoder()); +} diff --git a/sdk/src/generated/descro_ext_resolvers/src/generated/types/ruling.ts b/sdk/src/generated/descro_ext_resolvers/src/generated/types/ruling.ts new file mode 100644 index 0000000..c9d765e --- /dev/null +++ b/sdk/src/generated/descro_ext_resolvers/src/generated/types/ruling.ts @@ -0,0 +1,36 @@ +/** + * This code was AUTOGENERATED using the Codama library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun Codama to update it. + * + * @see https://github.com/codama-idl/codama + */ + +import { + combineCodec, + getEnumDecoder, + getEnumEncoder, + type FixedSizeCodec, + type FixedSizeDecoder, + type FixedSizeEncoder, +} from "@solana/kit"; + +/** Passed to update_stats; mirrors the Escrow program's Winner enum. */ +export enum Ruling { + Buyer, + Seller, +} + +export type RulingArgs = Ruling; + +export function getRulingEncoder(): FixedSizeEncoder { + return getEnumEncoder(Ruling); +} + +export function getRulingDecoder(): FixedSizeDecoder { + return getEnumDecoder(Ruling); +} + +export function getRulingCodec(): FixedSizeCodec { + return combineCodec(getRulingEncoder(), getRulingDecoder()); +} diff --git a/yarn.lock b/yarn.lock index a9a9b93..a6e1ed7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -269,6 +269,124 @@ __metadata: languageName: node linkType: hard +"@codama/cli@npm:1.5.1": + version: 1.5.1 + resolution: "@codama/cli@npm:1.5.1" + dependencies: + "@codama/nodes": "npm:1.6.0" + "@codama/visitors": "npm:1.6.0" + "@codama/visitors-core": "npm:1.6.0" + commander: "npm:^14.0.2" + picocolors: "npm:^1.1.1" + prompts: "npm:^2.4.2" + bin: + codama: bin/cli.cjs + checksum: 10c0/31dcf2be24ab0918c07bfb5e46d4c8f94063def834d732b5605ace5ff50869a47171a4eb27f0543b3f6abc943bdf4684a5e5047c9e44c3bd3e606bb0c5d56c72 + languageName: node + linkType: hard + +"@codama/errors@npm:1.6.0, @codama/errors@npm:^1.4.4": + version: 1.6.0 + resolution: "@codama/errors@npm:1.6.0" + dependencies: + "@codama/node-types": "npm:1.6.0" + commander: "npm:^14.0.2" + picocolors: "npm:^1.1.1" + bin: + errors: bin/cli.cjs + checksum: 10c0/e08a89277a2443d138de592ba6a6d4a8d8b0c57112a329b448bdfe62d23a3e437bedd37d6199812717f9e186c595034457bce886240093beeb928c2ae72440dd + languageName: node + linkType: hard + +"@codama/node-types@npm:1.6.0": + version: 1.6.0 + resolution: "@codama/node-types@npm:1.6.0" + checksum: 10c0/00e318c6d962b6125d2145ce2977f469c3a69f95b439e20c6b9c51a809853fbc1843b57fb04f00333b6812d75997dff1e729831f483133a314f8fa41c25ade1b + languageName: node + linkType: hard + +"@codama/nodes-from-anchor@npm:^1.4.1": + version: 1.4.1 + resolution: "@codama/nodes-from-anchor@npm:1.4.1" + dependencies: + "@codama/errors": "npm:1.6.0" + "@codama/nodes": "npm:1.6.0" + "@codama/visitors": "npm:1.6.0" + "@noble/hashes": "npm:^2.0.1" + "@solana/codecs": "npm:^5.3.0" + checksum: 10c0/b2e164e824597c464138b1106f8fd322d78f868d1ba289a941a23f70bf3725031ea823b744ba4e6ff168a13bff415e1d197d6f3064cfa51237ef3534a9a53cbb + languageName: node + linkType: hard + +"@codama/nodes@npm:1.6.0, @codama/nodes@npm:^1.4.4": + version: 1.6.0 + resolution: "@codama/nodes@npm:1.6.0" + dependencies: + "@codama/errors": "npm:1.6.0" + "@codama/node-types": "npm:1.6.0" + checksum: 10c0/e60d5b3093705422e3830cc33e15eb482a69499ffb06a2b908905be5617ddb08545089fc782b34ded601cc11e0b06dbc3e322181cde2f14209d9eba327c41a07 + languageName: node + linkType: hard + +"@codama/renderers-core@npm:^1.3.4": + version: 1.3.7 + resolution: "@codama/renderers-core@npm:1.3.7" + dependencies: + "@codama/errors": "npm:1.6.0" + "@codama/nodes": "npm:1.6.0" + "@codama/visitors-core": "npm:1.6.0" + checksum: 10c0/0024b394f42779bf5a5b395a386c81e3f4b3e28eeb295bf022f5553ec7f61ce8d38dd2ee2ad9a89a9b446fca3dfa5fd338f62eecd88399f9ab991d40c771ff89 + languageName: node + linkType: hard + +"@codama/renderers-js@npm:^2.2.0": + version: 2.2.0 + resolution: "@codama/renderers-js@npm:2.2.0" + dependencies: + "@codama/errors": "npm:^1.4.4" + "@codama/nodes": "npm:^1.4.4" + "@codama/renderers-core": "npm:^1.3.4" + "@codama/visitors-core": "npm:^1.4.4" + "@solana/codecs-strings": "npm:^6.0.0" + prettier: "npm:^3.8.1" + semver: "npm:^7.7.3" + checksum: 10c0/d0d7515e30fb129e13085e2ac882c4c62e8d7199cb1366b3c835cfe5677e80be2cca2b3d97c5bef7fe6c288db8a9ce11ae880151e382871483bda6060d5c2cf3 + languageName: node + linkType: hard + +"@codama/validators@npm:1.6.0": + version: 1.6.0 + resolution: "@codama/validators@npm:1.6.0" + dependencies: + "@codama/errors": "npm:1.6.0" + "@codama/nodes": "npm:1.6.0" + "@codama/visitors-core": "npm:1.6.0" + checksum: 10c0/af94e965740b48aeed21df3cb79d391a7e6d5d19e93020c1745d4cbba04e9a2f57659b1b84c549c5d340bd19e4cce7ea0cf6fa3167b3ce6b5d1af3a198964ed9 + languageName: node + linkType: hard + +"@codama/visitors-core@npm:1.6.0, @codama/visitors-core@npm:^1.4.4": + version: 1.6.0 + resolution: "@codama/visitors-core@npm:1.6.0" + dependencies: + "@codama/errors": "npm:1.6.0" + "@codama/nodes": "npm:1.6.0" + json-stable-stringify: "npm:^1.3.0" + checksum: 10c0/1f6006a8bee4df8da9d6ad706d291771702de55966d328543527a8eddafca56d036b116fc5344413b647121a9720dd301a1b155c5b52a70bcc52d14515f60042 + languageName: node + linkType: hard + +"@codama/visitors@npm:1.6.0": + version: 1.6.0 + resolution: "@codama/visitors@npm:1.6.0" + dependencies: + "@codama/errors": "npm:1.6.0" + "@codama/nodes": "npm:1.6.0" + "@codama/visitors-core": "npm:1.6.0" + checksum: 10c0/2715a0c95ab824e452426b215a7b8eb961928e223d43f27b0a892e0ec0a46e9fc362d51268235800b4ff29dec58b5c198f868bf4754925615284145db40a6369 + languageName: node + linkType: hard + "@colors/colors@npm:1.5.0": version: 1.5.0 resolution: "@colors/colors@npm:1.5.0" @@ -320,10 +438,10 @@ __metadata: version: 0.0.0-use.local resolution: "@descro/sdk@workspace:sdk" dependencies: - "@coral-xyz/anchor": "npm:^0.32.1" - "@solana/web3.js": "npm:^1.98.4" - "@types/bn.js": "npm:^5.2.0" - bn.js: "npm:^5.2.3" + "@codama/nodes-from-anchor": "npm:^1.4.1" + "@codama/renderers-js": "npm:^2.2.0" + "@solana/kit": "npm:^6.0.0" + codama: "npm:^1.6.0" typescript: "npm:^6.0.3" languageName: unknown linkType: soft @@ -1151,6 +1269,13 @@ __metadata: languageName: node linkType: hard +"@noble/hashes@npm:^2.0.1": + version: 2.2.0 + resolution: "@noble/hashes@npm:2.2.0" + checksum: 10c0/cad8630c504d6b9271984f685cd0af9101b40988fc2dfbe17ccdf068a9941f95cc5c9957d89e9ca4b7ca94c15cb35f93510c5d53a09fbcc83ee503b93d0a1034 + languageName: node + linkType: hard + "@nodelib/fs.scandir@npm:2.1.5": version: 2.1.5 resolution: "@nodelib/fs.scandir@npm:2.1.5" @@ -1249,6 +1374,25 @@ __metadata: languageName: node linkType: hard +"@solana/accounts@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/accounts@npm:6.9.0" + dependencies: + "@solana/addresses": "npm:6.9.0" + "@solana/codecs-core": "npm:6.9.0" + "@solana/codecs-strings": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + "@solana/rpc-spec": "npm:6.9.0" + "@solana/rpc-types": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/e6cb58b97105ca85622df8bdb9de257a50197c6bfaae4aedbe84c6cd1f4db9f2e9d51df81cf63f36bf12819aa6d1a6cc6ba059dc64d9b45b632bc89c507255f1 + languageName: node + linkType: hard + "@solana/addresses@npm:5.5.1, @solana/addresses@npm:^5.0.0": version: 5.5.1 resolution: "@solana/addresses@npm:5.5.1" @@ -1267,6 +1411,24 @@ __metadata: languageName: node linkType: hard +"@solana/addresses@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/addresses@npm:6.9.0" + dependencies: + "@solana/assertions": "npm:6.9.0" + "@solana/codecs-core": "npm:6.9.0" + "@solana/codecs-strings": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + "@solana/nominal-types": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/d7e493f5397b4ddd5a6fd9b66063208399874542dcd4dbf793aa0de80941dbf773a1812f211daa999efb6d86dc0da911a732576cf4d95c8fae91a78d935fe148 + languageName: node + linkType: hard + "@solana/assertions@npm:5.5.1": version: 5.5.1 resolution: "@solana/assertions@npm:5.5.1" @@ -1281,6 +1443,20 @@ __metadata: languageName: node linkType: hard +"@solana/assertions@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/assertions@npm:6.9.0" + dependencies: + "@solana/errors": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/7c2fecbc48a6c6d9171ec3ba8d5aa18eda6eae8a13c3952933c46b5f51bc59fb681bf79105ff6ae52e8a318da36b78893efbed0795233830113620ec342a0beb + languageName: node + linkType: hard + "@solana/buffer-layout@npm:^4.0.1": version: 4.0.1 resolution: "@solana/buffer-layout@npm:4.0.1" @@ -1345,6 +1521,22 @@ __metadata: languageName: node linkType: hard +"@solana/codecs-data-structures@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/codecs-data-structures@npm:6.9.0" + dependencies: + "@solana/codecs-core": "npm:6.9.0" + "@solana/codecs-numbers": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/7389142b0954edf5b1feb6a8a4af69527eb64f49e755eeb2dd869ef92b0faecc3341089a663f35a5aa823356a78e0daf6dd51d62196f5e6fce07f45db96f7f23 + languageName: node + linkType: hard + "@solana/codecs-numbers@npm:5.5.1": version: 5.5.1 resolution: "@solana/codecs-numbers@npm:5.5.1" @@ -1406,7 +1598,7 @@ __metadata: languageName: node linkType: hard -"@solana/codecs-strings@npm:^6.0.0": +"@solana/codecs-strings@npm:6.9.0, @solana/codecs-strings@npm:^6.0.0": version: 6.9.0 resolution: "@solana/codecs-strings@npm:6.9.0" dependencies: @@ -1425,7 +1617,7 @@ __metadata: languageName: node linkType: hard -"@solana/codecs@npm:5.5.1, @solana/codecs@npm:^5.0.0": +"@solana/codecs@npm:5.5.1, @solana/codecs@npm:^5.0.0, @solana/codecs@npm:^5.3.0": version: 5.5.1 resolution: "@solana/codecs@npm:5.5.1" dependencies: @@ -1443,6 +1635,25 @@ __metadata: languageName: node linkType: hard +"@solana/codecs@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/codecs@npm:6.9.0" + dependencies: + "@solana/codecs-core": "npm:6.9.0" + "@solana/codecs-data-structures": "npm:6.9.0" + "@solana/codecs-numbers": "npm:6.9.0" + "@solana/codecs-strings": "npm:6.9.0" + "@solana/fixed-points": "npm:6.9.0" + "@solana/options": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/62cdc3773a4f808020060f14f821c2cd8ef29cbcc8802a353d61e239bc4b902dfa697f94da3a56c3ac6c0f36880ee169fdb85338ca1aa66a9de5e35de83f82c2 + languageName: node + linkType: hard + "@solana/connector@npm:^0.2.4": version: 0.2.4 resolution: "@solana/connector@npm:0.2.4" @@ -1550,6 +1761,33 @@ __metadata: languageName: node linkType: hard +"@solana/fast-stable-stringify@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/fast-stable-stringify@npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/229176dbe3d03dcddc62ad22dc66109562eab3aa769810ee60203dc868a6636577ffa9bbbadcfbb0a4e51549af4bb6e35200d1c29152802e8bc91c583ed1be4b + languageName: node + linkType: hard + +"@solana/fixed-points@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/fixed-points@npm:6.9.0" + dependencies: + "@solana/codecs-core": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/ec5a0b693fbc89e913af5ba82dcb135fd1ed897a2755e0c62eda3eb7aa9763ccc7fe95c34a9b43f21bcf5aff175885d78351b6d37bd1664f7e19d03f95c1a9f2 + languageName: node + linkType: hard + "@solana/functional@npm:5.5.1": version: 5.5.1 resolution: "@solana/functional@npm:5.5.1" @@ -1562,6 +1800,18 @@ __metadata: languageName: node linkType: hard +"@solana/functional@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/functional@npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/21a72cbb820b4183f67cfacfba8c172009869abcb6667bf43af994cc69922b2a133747ec7e4e66493ad7e1226cfab8dab45b3cb43a97dedca4bd3d9692569fa7 + languageName: node + linkType: hard + "@solana/instruction-plans@npm:5.5.1": version: 5.5.1 resolution: "@solana/instruction-plans@npm:5.5.1" @@ -1581,6 +1831,25 @@ __metadata: languageName: node linkType: hard +"@solana/instruction-plans@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/instruction-plans@npm:6.9.0" + dependencies: + "@solana/errors": "npm:6.9.0" + "@solana/instructions": "npm:6.9.0" + "@solana/keys": "npm:6.9.0" + "@solana/promises": "npm:6.9.0" + "@solana/transaction-messages": "npm:6.9.0" + "@solana/transactions": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/569ef7efde18c46a3461b06410d7c9922b5f432b18874b5d6e0f3a8ebd04f3efb7cde9b3631ea116373a3eb50f2bd219911fccba7006037d3eca6684b4c5a506 + languageName: node + linkType: hard + "@solana/instructions@npm:5.5.1": version: 5.5.1 resolution: "@solana/instructions@npm:5.5.1" @@ -1596,6 +1865,21 @@ __metadata: languageName: node linkType: hard +"@solana/instructions@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/instructions@npm:6.9.0" + dependencies: + "@solana/codecs-core": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/06b2a0ae6ad917a2fdfa8ff95eaf976f480c2d19fcb942005bed5e7c25916d498d76260e4cd09d4d0375675c1867f1510fb6579d78902eb03d3b87887c00cca8 + languageName: node + linkType: hard + "@solana/keys@npm:5.5.1, @solana/keys@npm:^5.0.0": version: 5.5.1 resolution: "@solana/keys@npm:5.5.1" @@ -1614,6 +1898,25 @@ __metadata: languageName: node linkType: hard +"@solana/keys@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/keys@npm:6.9.0" + dependencies: + "@solana/assertions": "npm:6.9.0" + "@solana/codecs-core": "npm:6.9.0" + "@solana/codecs-strings": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + "@solana/nominal-types": "npm:6.9.0" + "@solana/promises": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/5558fce85f3aef195feb9e56dca6795ef6a8090e35e7b62fa197d6d2588fb0be14740ae88527d13a314fed06c1adf3a7c5966fccfd32fe4e0a6deb2ffef48099 + languageName: node + linkType: hard + "@solana/kit@npm:^5.0.0": version: 5.5.1 resolution: "@solana/kit@npm:5.5.1" @@ -1649,6 +1952,44 @@ __metadata: languageName: node linkType: hard +"@solana/kit@npm:^6.0.0": + version: 6.9.0 + resolution: "@solana/kit@npm:6.9.0" + dependencies: + "@solana/accounts": "npm:6.9.0" + "@solana/addresses": "npm:6.9.0" + "@solana/codecs": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + "@solana/functional": "npm:6.9.0" + "@solana/instruction-plans": "npm:6.9.0" + "@solana/instructions": "npm:6.9.0" + "@solana/keys": "npm:6.9.0" + "@solana/offchain-messages": "npm:6.9.0" + "@solana/plugin-core": "npm:6.9.0" + "@solana/plugin-interfaces": "npm:6.9.0" + "@solana/program-client-core": "npm:6.9.0" + "@solana/programs": "npm:6.9.0" + "@solana/rpc": "npm:6.9.0" + "@solana/rpc-api": "npm:6.9.0" + "@solana/rpc-parsed-types": "npm:6.9.0" + "@solana/rpc-spec-types": "npm:6.9.0" + "@solana/rpc-subscriptions": "npm:6.9.0" + "@solana/rpc-types": "npm:6.9.0" + "@solana/signers": "npm:6.9.0" + "@solana/subscribable": "npm:6.9.0" + "@solana/sysvars": "npm:6.9.0" + "@solana/transaction-confirmation": "npm:6.9.0" + "@solana/transaction-messages": "npm:6.9.0" + "@solana/transactions": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/36b7b932fc40b45457cf352513416cdf0bb8f9c394aaedb00e488d6220504065f5d02a161a5b483eb71c47f11fe76be1f215c884cee46ef1e454d6a266cb6b6b + languageName: node + linkType: hard + "@solana/nominal-types@npm:5.5.1": version: 5.5.1 resolution: "@solana/nominal-types@npm:5.5.1" @@ -1661,6 +2002,18 @@ __metadata: languageName: node linkType: hard +"@solana/nominal-types@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/nominal-types@npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/518e47473767c622387b891b8a30f57a1a75cfcb7047c187a2e7c4a1bc295ceb1c3c9a41b29970ca54f4593126bfa7734110003142051b1de3c14993ae46e315 + languageName: node + linkType: hard + "@solana/offchain-messages@npm:5.5.1": version: 5.5.1 resolution: "@solana/offchain-messages@npm:5.5.1" @@ -1682,6 +2035,27 @@ __metadata: languageName: node linkType: hard +"@solana/offchain-messages@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/offchain-messages@npm:6.9.0" + dependencies: + "@solana/addresses": "npm:6.9.0" + "@solana/codecs-core": "npm:6.9.0" + "@solana/codecs-data-structures": "npm:6.9.0" + "@solana/codecs-numbers": "npm:6.9.0" + "@solana/codecs-strings": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + "@solana/keys": "npm:6.9.0" + "@solana/nominal-types": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/b647aaeff50067eea5dcfeb16190344b09145c05aebaf70a5ea9c89d2c51cbca13dee07224a370a81a5afa82c7b07c0d3500ab8c4c1d0938570ad08ee0acdd9c + languageName: node + linkType: hard + "@solana/options@npm:5.5.1": version: 5.5.1 resolution: "@solana/options@npm:5.5.1" @@ -1700,6 +2074,24 @@ __metadata: languageName: node linkType: hard +"@solana/options@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/options@npm:6.9.0" + dependencies: + "@solana/codecs-core": "npm:6.9.0" + "@solana/codecs-data-structures": "npm:6.9.0" + "@solana/codecs-numbers": "npm:6.9.0" + "@solana/codecs-strings": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/097ada8f8addfbbd4f3c646a2b8a962d7bd963d6fbed2cc684e6a106d8c2fd2c10f2bfd1f1a89058188d0beec94c52525ed028858e0846bf398680f9fe7899b4 + languageName: node + linkType: hard + "@solana/plugin-core@npm:5.5.1": version: 5.5.1 resolution: "@solana/plugin-core@npm:5.5.1" @@ -1712,6 +2104,60 @@ __metadata: languageName: node linkType: hard +"@solana/plugin-core@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/plugin-core@npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/6dba11307524e0a1838dfc89a7776d5c997216abdcbb78a76e3dd10884f9f17e774942b2c49ac0494c7e64421fc698ef160c36d5f5c646460fad5f42daa172c9 + languageName: node + linkType: hard + +"@solana/plugin-interfaces@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/plugin-interfaces@npm:6.9.0" + dependencies: + "@solana/addresses": "npm:6.9.0" + "@solana/instruction-plans": "npm:6.9.0" + "@solana/keys": "npm:6.9.0" + "@solana/rpc-spec": "npm:6.9.0" + "@solana/rpc-subscriptions-spec": "npm:6.9.0" + "@solana/rpc-types": "npm:6.9.0" + "@solana/signers": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/cbf74098412a184b2ad23076eac5e508feed117e0dc4435692f9c630386c1adbafc6be0d201b3a5c5fb0766931eb0d67e8572c4c0382bcf19cfb89aa6881b782 + languageName: node + linkType: hard + +"@solana/program-client-core@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/program-client-core@npm:6.9.0" + dependencies: + "@solana/accounts": "npm:6.9.0" + "@solana/addresses": "npm:6.9.0" + "@solana/codecs-core": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + "@solana/instruction-plans": "npm:6.9.0" + "@solana/instructions": "npm:6.9.0" + "@solana/plugin-interfaces": "npm:6.9.0" + "@solana/rpc-api": "npm:6.9.0" + "@solana/signers": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/304ca469a9e2e87e01312febd70eaae9c2e8c4d5afa689b12a04062c33c805d8fa136e4ecc068ed1b86e811f8e99cc12f82085ad9ad0fc7bfef438fc3a51fac0 + languageName: node + linkType: hard + "@solana/programs@npm:5.5.1": version: 5.5.1 resolution: "@solana/programs@npm:5.5.1" @@ -1727,6 +2173,21 @@ __metadata: languageName: node linkType: hard +"@solana/programs@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/programs@npm:6.9.0" + dependencies: + "@solana/addresses": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/155c24be0bb5cb37651defeaf7a6fbc9ab831227d58514a67797d97c9dad1d6b37bfbcb6f211a8c3d4b249d70bd0525be19f532a314033505216506e24604af9 + languageName: node + linkType: hard + "@solana/promises@npm:5.5.1": version: 5.5.1 resolution: "@solana/promises@npm:5.5.1" @@ -1739,6 +2200,18 @@ __metadata: languageName: node linkType: hard +"@solana/promises@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/promises@npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/0da4ffd2e63cc773cdc10d4cef1267ea37b2191bfcc2f4fb93282a7ed5af174f73ed65047a322ff7a1b6713eccd16e360bb777d273a7af5ab44af580c5cd7f59 + languageName: node + linkType: hard + "@solana/rpc-api@npm:5.5.1": version: 5.5.1 resolution: "@solana/rpc-api@npm:5.5.1" @@ -1763,6 +2236,30 @@ __metadata: languageName: node linkType: hard +"@solana/rpc-api@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/rpc-api@npm:6.9.0" + dependencies: + "@solana/addresses": "npm:6.9.0" + "@solana/codecs-core": "npm:6.9.0" + "@solana/codecs-strings": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + "@solana/keys": "npm:6.9.0" + "@solana/rpc-parsed-types": "npm:6.9.0" + "@solana/rpc-spec": "npm:6.9.0" + "@solana/rpc-transformers": "npm:6.9.0" + "@solana/rpc-types": "npm:6.9.0" + "@solana/transaction-messages": "npm:6.9.0" + "@solana/transactions": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/daadd86d97134b54efa5fbd89ee57d96fde8932af9affddf9b463f56bf9bff8c501ad00a6544fe745dacc89bb06765317a4898af695e5df42095ed209e7a92bd + languageName: node + linkType: hard + "@solana/rpc-parsed-types@npm:5.5.1": version: 5.5.1 resolution: "@solana/rpc-parsed-types@npm:5.5.1" @@ -1775,6 +2272,18 @@ __metadata: languageName: node linkType: hard +"@solana/rpc-parsed-types@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/rpc-parsed-types@npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/4e28953ae776d7a9ef09ca2cbab30e3a015e693f4137e30cad926e652f2d60e2e07587056d9a421e9b46d4f2327cc49c4fba19dedf11f4cf61c4b7c2d58d8267 + languageName: node + linkType: hard + "@solana/rpc-spec-types@npm:5.5.1": version: 5.5.1 resolution: "@solana/rpc-spec-types@npm:5.5.1" @@ -1787,6 +2296,18 @@ __metadata: languageName: node linkType: hard +"@solana/rpc-spec-types@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/rpc-spec-types@npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/5e733eae11f99ca7494f7cf046b171f5d8c1117a6621c75605c5e414c271624eb1ac13e7811906e2646963b5c467d218099ee1d837cc077c666a274f919d4220 + languageName: node + linkType: hard + "@solana/rpc-spec@npm:5.5.1": version: 5.5.1 resolution: "@solana/rpc-spec@npm:5.5.1" @@ -1802,6 +2323,21 @@ __metadata: languageName: node linkType: hard +"@solana/rpc-spec@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/rpc-spec@npm:6.9.0" + dependencies: + "@solana/errors": "npm:6.9.0" + "@solana/rpc-spec-types": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/6d6a440d024b1bfe9e6e2e70945a09218e3aaaa70ebffe5f4f87e84d45604031f7eaa21e6fef41c552dc77be8e5ab3a76200920b7bcdc4cf4d7a76872b242e39 + languageName: node + linkType: hard + "@solana/rpc-subscriptions-api@npm:5.5.1": version: 5.5.1 resolution: "@solana/rpc-subscriptions-api@npm:5.5.1" @@ -1822,6 +2358,26 @@ __metadata: languageName: node linkType: hard +"@solana/rpc-subscriptions-api@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/rpc-subscriptions-api@npm:6.9.0" + dependencies: + "@solana/addresses": "npm:6.9.0" + "@solana/keys": "npm:6.9.0" + "@solana/rpc-subscriptions-spec": "npm:6.9.0" + "@solana/rpc-transformers": "npm:6.9.0" + "@solana/rpc-types": "npm:6.9.0" + "@solana/transaction-messages": "npm:6.9.0" + "@solana/transactions": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/fd4e405a36df4c501bdaa5318ad2ef91a554d4e67d0d107d9999310cc776f8a7c655dabc9627f8b747de6a276323a2cb739aefe976e16e1fa463477d239424d3 + languageName: node + linkType: hard + "@solana/rpc-subscriptions-channel-websocket@npm:5.5.1": version: 5.5.1 resolution: "@solana/rpc-subscriptions-channel-websocket@npm:5.5.1" @@ -1840,6 +2396,24 @@ __metadata: languageName: node linkType: hard +"@solana/rpc-subscriptions-channel-websocket@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/rpc-subscriptions-channel-websocket@npm:6.9.0" + dependencies: + "@solana/errors": "npm:6.9.0" + "@solana/functional": "npm:6.9.0" + "@solana/rpc-subscriptions-spec": "npm:6.9.0" + "@solana/subscribable": "npm:6.9.0" + ws: "npm:^8.19.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/b3658999ea15efa7f3a8c3f4cc7d79f7557936f3f3e8191bb0fa0b2227c31ae57d976577732306a950866edfb122f9a27eff8d48e9d9f4d40c3a1fffef1e9c3d + languageName: node + linkType: hard + "@solana/rpc-subscriptions-spec@npm:5.5.1": version: 5.5.1 resolution: "@solana/rpc-subscriptions-spec@npm:5.5.1" @@ -1857,6 +2431,23 @@ __metadata: languageName: node linkType: hard +"@solana/rpc-subscriptions-spec@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/rpc-subscriptions-spec@npm:6.9.0" + dependencies: + "@solana/errors": "npm:6.9.0" + "@solana/promises": "npm:6.9.0" + "@solana/rpc-spec-types": "npm:6.9.0" + "@solana/subscribable": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/da264d158c25ab56a831f58af62651ed44f2325c44b7cfdf4ddcced22b76c03d5843f0cb15b337eacdd2bc8cd0888f1299a72db50b15c8835f615fb7afeb6d03 + languageName: node + linkType: hard + "@solana/rpc-subscriptions@npm:5.5.1": version: 5.5.1 resolution: "@solana/rpc-subscriptions@npm:5.5.1" @@ -1881,6 +2472,30 @@ __metadata: languageName: node linkType: hard +"@solana/rpc-subscriptions@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/rpc-subscriptions@npm:6.9.0" + dependencies: + "@solana/errors": "npm:6.9.0" + "@solana/fast-stable-stringify": "npm:6.9.0" + "@solana/functional": "npm:6.9.0" + "@solana/promises": "npm:6.9.0" + "@solana/rpc-spec-types": "npm:6.9.0" + "@solana/rpc-subscriptions-api": "npm:6.9.0" + "@solana/rpc-subscriptions-channel-websocket": "npm:6.9.0" + "@solana/rpc-subscriptions-spec": "npm:6.9.0" + "@solana/rpc-transformers": "npm:6.9.0" + "@solana/rpc-types": "npm:6.9.0" + "@solana/subscribable": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/ce57f26860848957d0756d9ec22b26660d37229cb5f2170db8bb889e4bea4b30c65bed4e6b3bfff3e6e282bf7094bf01158295e94b2af86ec6e4fa9b3da49da3 + languageName: node + linkType: hard + "@solana/rpc-transformers@npm:5.5.1": version: 5.5.1 resolution: "@solana/rpc-transformers@npm:5.5.1" @@ -1899,6 +2514,24 @@ __metadata: languageName: node linkType: hard +"@solana/rpc-transformers@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/rpc-transformers@npm:6.9.0" + dependencies: + "@solana/errors": "npm:6.9.0" + "@solana/functional": "npm:6.9.0" + "@solana/nominal-types": "npm:6.9.0" + "@solana/rpc-spec-types": "npm:6.9.0" + "@solana/rpc-types": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/65053fa3d687754d2f5951234b5f1735c86e5f8daf167b3877f580345cc9dca0b8eaafbe99e65e9abda98c0c90a08740065a093ce6244402d6c5fceaf9588d73 + languageName: node + linkType: hard + "@solana/rpc-transport-http@npm:5.5.1": version: 5.5.1 resolution: "@solana/rpc-transport-http@npm:5.5.1" @@ -1916,6 +2549,23 @@ __metadata: languageName: node linkType: hard +"@solana/rpc-transport-http@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/rpc-transport-http@npm:6.9.0" + dependencies: + "@solana/errors": "npm:6.9.0" + "@solana/rpc-spec": "npm:6.9.0" + "@solana/rpc-spec-types": "npm:6.9.0" + undici-types: "npm:^8.2.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/9582182632f4858d59413ec61b8debf977b2f44ab6a7ce192ca6991f4b565151ae098e312d8ac8dfb734204ccbe53ecbfee07a667471faca3b02f802206dad03 + languageName: node + linkType: hard + "@solana/rpc-types@npm:5.5.1": version: 5.5.1 resolution: "@solana/rpc-types@npm:5.5.1" @@ -1935,6 +2585,26 @@ __metadata: languageName: node linkType: hard +"@solana/rpc-types@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/rpc-types@npm:6.9.0" + dependencies: + "@solana/addresses": "npm:6.9.0" + "@solana/codecs-core": "npm:6.9.0" + "@solana/codecs-numbers": "npm:6.9.0" + "@solana/codecs-strings": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + "@solana/fixed-points": "npm:6.9.0" + "@solana/nominal-types": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/4af132234a554f71024b1949f3e8d5f011072a3c92363acd5bc64cfb9996648828c7df7dd858b228f7061f65a92f4c262a5d359b5fa3e13002456357c7d28d1a + languageName: node + linkType: hard + "@solana/rpc@npm:5.5.1": version: 5.5.1 resolution: "@solana/rpc@npm:5.5.1" @@ -1957,6 +2627,28 @@ __metadata: languageName: node linkType: hard +"@solana/rpc@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/rpc@npm:6.9.0" + dependencies: + "@solana/errors": "npm:6.9.0" + "@solana/fast-stable-stringify": "npm:6.9.0" + "@solana/functional": "npm:6.9.0" + "@solana/rpc-api": "npm:6.9.0" + "@solana/rpc-spec": "npm:6.9.0" + "@solana/rpc-spec-types": "npm:6.9.0" + "@solana/rpc-transformers": "npm:6.9.0" + "@solana/rpc-transport-http": "npm:6.9.0" + "@solana/rpc-types": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/db9bb34756532f1aed652b6916c58892089a53dcb2e79dacdc7c492e441a93c9be5d6c4fbdabb55d88d3bf851dfed381447fd0982b92ed683e626b2c494af38d + languageName: node + linkType: hard + "@solana/signers@npm:5.5.1, @solana/signers@npm:^5.0.0": version: 5.5.1 resolution: "@solana/signers@npm:5.5.1" @@ -1979,6 +2671,28 @@ __metadata: languageName: node linkType: hard +"@solana/signers@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/signers@npm:6.9.0" + dependencies: + "@solana/addresses": "npm:6.9.0" + "@solana/codecs-core": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + "@solana/instructions": "npm:6.9.0" + "@solana/keys": "npm:6.9.0" + "@solana/nominal-types": "npm:6.9.0" + "@solana/offchain-messages": "npm:6.9.0" + "@solana/transaction-messages": "npm:6.9.0" + "@solana/transactions": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/1405693cbfc2079ac1f683ab1479f80844e44548017d49748d171eb6e6cdd89d1c849afbdfd7d7d9244c971c614cc31556e918b58ca2b29717663f4389f09fb6 + languageName: node + linkType: hard + "@solana/subscribable@npm:5.5.1": version: 5.5.1 resolution: "@solana/subscribable@npm:5.5.1" @@ -1993,6 +2707,20 @@ __metadata: languageName: node linkType: hard +"@solana/subscribable@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/subscribable@npm:6.9.0" + dependencies: + "@solana/errors": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/68b786a8d8139809a516a14a9d59ba51f09481dc6cd3cac412feba7a54154669d0bf7650c843cb238d4baa4195b1d5f37ecaede3ac882eadf18c86e8d5fcdd5f + languageName: node + linkType: hard + "@solana/sysvars@npm:5.5.1": version: 5.5.1 resolution: "@solana/sysvars@npm:5.5.1" @@ -2010,6 +2738,25 @@ __metadata: languageName: node linkType: hard +"@solana/sysvars@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/sysvars@npm:6.9.0" + dependencies: + "@solana/accounts": "npm:6.9.0" + "@solana/codecs-core": "npm:6.9.0" + "@solana/codecs-data-structures": "npm:6.9.0" + "@solana/codecs-numbers": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + "@solana/rpc-types": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/f732dd9c315ff56ef40f32c1701813a317ddc3579ba9392a69db185314a7fcccd911bba303ce81739fc0e528dbb47223b07eb0af6e8b1ca611a47438995925cc + languageName: node + linkType: hard + "@solana/transaction-confirmation@npm:5.5.1": version: 5.5.1 resolution: "@solana/transaction-confirmation@npm:5.5.1" @@ -2033,6 +2780,29 @@ __metadata: languageName: node linkType: hard +"@solana/transaction-confirmation@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/transaction-confirmation@npm:6.9.0" + dependencies: + "@solana/addresses": "npm:6.9.0" + "@solana/codecs-strings": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + "@solana/keys": "npm:6.9.0" + "@solana/promises": "npm:6.9.0" + "@solana/rpc": "npm:6.9.0" + "@solana/rpc-subscriptions": "npm:6.9.0" + "@solana/rpc-types": "npm:6.9.0" + "@solana/transaction-messages": "npm:6.9.0" + "@solana/transactions": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/59e99fc0d5333c02938a87372ae1f1fc3584858561f57bf9de48735ae889647bce79bc90b44c6c2abbf6ec0a7edd1b98d762d194917b733471537fd445f3d6e0 + languageName: node + linkType: hard + "@solana/transaction-messages@npm:5.5.1, @solana/transaction-messages@npm:^5.0.0": version: 5.5.1 resolution: "@solana/transaction-messages@npm:5.5.1" @@ -2055,6 +2825,28 @@ __metadata: languageName: node linkType: hard +"@solana/transaction-messages@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/transaction-messages@npm:6.9.0" + dependencies: + "@solana/addresses": "npm:6.9.0" + "@solana/codecs-core": "npm:6.9.0" + "@solana/codecs-data-structures": "npm:6.9.0" + "@solana/codecs-numbers": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + "@solana/functional": "npm:6.9.0" + "@solana/instructions": "npm:6.9.0" + "@solana/nominal-types": "npm:6.9.0" + "@solana/rpc-types": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/16c8e8e82e6e5e48d36233afcd6394764938c5cc00da3d5d3098c378a226653bb04c0b3c6e25999856925e184172a58ad3f16b4206156884a9f975c72f0c4ea9 + languageName: node + linkType: hard + "@solana/transactions@npm:5.5.1, @solana/transactions@npm:^5.0.0": version: 5.5.1 resolution: "@solana/transactions@npm:5.5.1" @@ -2080,6 +2872,31 @@ __metadata: languageName: node linkType: hard +"@solana/transactions@npm:6.9.0": + version: 6.9.0 + resolution: "@solana/transactions@npm:6.9.0" + dependencies: + "@solana/addresses": "npm:6.9.0" + "@solana/codecs-core": "npm:6.9.0" + "@solana/codecs-data-structures": "npm:6.9.0" + "@solana/codecs-numbers": "npm:6.9.0" + "@solana/codecs-strings": "npm:6.9.0" + "@solana/errors": "npm:6.9.0" + "@solana/functional": "npm:6.9.0" + "@solana/instructions": "npm:6.9.0" + "@solana/keys": "npm:6.9.0" + "@solana/nominal-types": "npm:6.9.0" + "@solana/rpc-types": "npm:6.9.0" + "@solana/transaction-messages": "npm:6.9.0" + peerDependencies: + typescript: ">=5.4.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/0b95263a86d457c2fc0e1d7ecfa7f144ecf4a36d7ccba67cd8741b73b0e61611cbee590276388d7957f2c637c827241bf98153ff84a18813ffa83113d29fc33f + languageName: node + linkType: hard + "@solana/wallet-standard-chains@npm:^1.1.0, @solana/wallet-standard-chains@npm:^1.1.1": version: 1.1.1 resolution: "@solana/wallet-standard-chains@npm:1.1.1" @@ -4436,7 +5253,7 @@ __metadata: languageName: node linkType: hard -"bn.js@npm:^5.1.2, bn.js@npm:^5.2.0, bn.js@npm:^5.2.1, bn.js@npm:^5.2.3": +"bn.js@npm:^5.1.2, bn.js@npm:^5.2.0, bn.js@npm:^5.2.1": version: 5.2.3 resolution: "bn.js@npm:5.2.3" checksum: 10c0/eef19cb9cf5e91e91e3e0f036b799ce6c72f79463c3934d62991c3dcdb58f6c94dc3d806495d9b0bf31cd121870ed79bb2115cea71b56c03e794fb71485031fa @@ -4576,7 +5393,19 @@ __metadata: languageName: node linkType: hard -"call-bound@npm:^1.0.2": +"call-bind@npm:^1.0.8": + version: 1.0.9 + resolution: "call-bind@npm:1.0.9" + dependencies: + call-bind-apply-helpers: "npm:^1.0.2" + es-define-property: "npm:^1.0.1" + get-intrinsic: "npm:^1.3.0" + set-function-length: "npm:^1.2.2" + checksum: 10c0/a6621f6da1444481919ce3b4983dff725691e0754d3507ae483ce56e54985f2da7d6f1df512c56dbf28660745cf1ca52553f1fc9aef5557f3ce353ef14fab714 + languageName: node + linkType: hard + +"call-bound@npm:^1.0.2, call-bound@npm:^1.0.4": version: 1.0.4 resolution: "call-bound@npm:1.0.4" dependencies: @@ -4780,6 +5609,21 @@ __metadata: languageName: node linkType: hard +"codama@npm:^1.6.0": + version: 1.6.0 + resolution: "codama@npm:1.6.0" + dependencies: + "@codama/cli": "npm:1.5.1" + "@codama/errors": "npm:1.6.0" + "@codama/nodes": "npm:1.6.0" + "@codama/validators": "npm:1.6.0" + "@codama/visitors": "npm:1.6.0" + bin: + codama: bin/cli.cjs + checksum: 10c0/ebc1a3356d7d72dc2ce32c40337775635bd6c513df6eb4b708009f7de73a3e639376517735f686f0afcf3ed6360778429ee61881c3a12a1bfa24a0b3486d656e + languageName: node + linkType: hard + "code-block-writer@npm:^11.0.0": version: 11.0.3 resolution: "code-block-writer@npm:11.0.3" @@ -4817,7 +5661,7 @@ __metadata: languageName: node linkType: hard -"commander@npm:14.0.3, commander@npm:^14.0.0": +"commander@npm:14.0.3, commander@npm:^14.0.0, commander@npm:^14.0.2": version: 14.0.3 resolution: "commander@npm:14.0.3" checksum: 10c0/755652564bbf56ff2ff083313912b326450d3f8d8c85f4b71416539c9a05c3c67dbd206821ca72635bf6b160e2afdefcb458e86b317827d5cb333b69ce7f1a24 @@ -4971,6 +5815,17 @@ __metadata: languageName: node linkType: hard +"define-data-property@npm:^1.1.4": + version: 1.1.4 + resolution: "define-data-property@npm:1.1.4" + dependencies: + es-define-property: "npm:^1.0.0" + es-errors: "npm:^1.3.0" + gopd: "npm:^1.0.1" + checksum: 10c0/dea0606d1483eb9db8d930d4eac62ca0fa16738b0b3e07046cddfacf7d8c868bbe13fa0cb263eb91c7d0d527960dc3f2f2471a69ed7816210307f6744fe62e37 + languageName: node + linkType: hard + "delay@npm:^5.0.0": version: 5.0.0 resolution: "delay@npm:5.0.0" @@ -5144,7 +5999,7 @@ __metadata: languageName: node linkType: hard -"es-define-property@npm:^1.0.1": +"es-define-property@npm:^1.0.0, es-define-property@npm:^1.0.1": version: 1.0.1 resolution: "es-define-property@npm:1.0.1" checksum: 10c0/3f54eb49c16c18707949ff25a1456728c883e81259f045003499efba399c08bad00deebf65cccde8c0e07908c1a225c9d472b7107e558f2a48e28d530e34527c @@ -5663,7 +6518,7 @@ __metadata: languageName: node linkType: hard -"get-intrinsic@npm:^1.2.5, get-intrinsic@npm:^1.3.0": +"get-intrinsic@npm:^1.2.4, get-intrinsic@npm:^1.2.5, get-intrinsic@npm:^1.3.0": version: 1.3.1 resolution: "get-intrinsic@npm:1.3.1" dependencies: @@ -5739,7 +6594,7 @@ __metadata: languageName: node linkType: hard -"gopd@npm:^1.2.0": +"gopd@npm:^1.0.1, gopd@npm:^1.2.0": version: 1.2.0 resolution: "gopd@npm:1.2.0" checksum: 10c0/50fff1e04ba2b7737c097358534eacadad1e68d24cccee3272e04e007bed008e68d2614f3987788428fd192a5ae3889d08fb2331417e4fc4a9ab366b2043cead @@ -5760,6 +6615,15 @@ __metadata: languageName: node linkType: hard +"has-property-descriptors@npm:^1.0.2": + version: 1.0.2 + resolution: "has-property-descriptors@npm:1.0.2" + dependencies: + es-define-property: "npm:^1.0.0" + checksum: 10c0/253c1f59e80bb476cf0dde8ff5284505d90c3bdb762983c3514d36414290475fe3fd6f574929d84de2a8eec00d35cf07cb6776205ff32efd7c50719125f00236 + languageName: node + linkType: hard + "has-symbols@npm:^1.1.0": version: 1.1.0 resolution: "has-symbols@npm:1.1.0" @@ -5955,6 +6819,13 @@ __metadata: languageName: node linkType: hard +"isarray@npm:^2.0.5": + version: 2.0.5 + resolution: "isarray@npm:2.0.5" + checksum: 10c0/4199f14a7a13da2177c66c31080008b7124331956f47bca57dd0b6ea9f11687aa25e565a2c7a2b519bc86988d10398e3049a1f5df13c9f6b7664154690ae79fd + languageName: node + linkType: hard + "isexe@npm:^2.0.0": version: 2.0.0 resolution: "isexe@npm:2.0.0" @@ -6068,6 +6939,19 @@ __metadata: languageName: node linkType: hard +"json-stable-stringify@npm:^1.3.0": + version: 1.3.0 + resolution: "json-stable-stringify@npm:1.3.0" + dependencies: + call-bind: "npm:^1.0.8" + call-bound: "npm:^1.0.4" + isarray: "npm:^2.0.5" + jsonify: "npm:^0.0.1" + object-keys: "npm:^1.1.1" + checksum: 10c0/8b3ff19e4c23c0ad591a49bc3a015d89a538db787d12fe9c4072e1d64d8cfa481f8c37719c629c3d84e848847617bf49f5fee894cf1d25959ab5b67e1c517f31 + languageName: node + linkType: hard + "json-stringify-safe@npm:^5.0.1": version: 5.0.1 resolution: "json-stringify-safe@npm:5.0.1" @@ -6097,7 +6981,14 @@ __metadata: languageName: node linkType: hard -"kleur@npm:^3.0.2": +"jsonify@npm:^0.0.1": + version: 0.0.1 + resolution: "jsonify@npm:0.0.1" + checksum: 10c0/7f5499cdd59a0967ed35bda48b7cec43d850bbc8fb955cdd3a1717bb0efadbe300724d5646de765bb7a99fc1c3ab06eb80d93503c6faaf99b4ff50a3326692f6 + languageName: node + linkType: hard + +"kleur@npm:^3.0.2, kleur@npm:^3.0.3": version: 3.0.3 resolution: "kleur@npm:3.0.3" checksum: 10c0/cd3a0b8878e7d6d3799e54340efe3591ca787d9f95f109f28129bdd2915e37807bf8918bb295ab86afb8c82196beec5a1adcaf29042ce3f2bd932b038fe3aa4b @@ -6612,6 +7503,13 @@ __metadata: languageName: node linkType: hard +"object-keys@npm:^1.1.1": + version: 1.1.1 + resolution: "object-keys@npm:1.1.1" + checksum: 10c0/b11f7ccdbc6d406d1f186cdadb9d54738e347b2692a14439ca5ac70c225fa6db46db809711b78589866d47b25fc3e8dee0b4c722ac751e11180f9380e3d8601d + languageName: node + linkType: hard + "on-finished@npm:~2.4.1": version: 2.4.1 resolution: "on-finished@npm:2.4.1" @@ -6843,7 +7741,7 @@ __metadata: languageName: node linkType: hard -"prettier@npm:^3.8.3": +"prettier@npm:^3.8.1, prettier@npm:^3.8.3": version: 3.8.3 resolution: "prettier@npm:3.8.3" bin: @@ -6878,6 +7776,16 @@ __metadata: languageName: node linkType: hard +"prompts@npm:^2.4.2": + version: 2.4.2 + resolution: "prompts@npm:2.4.2" + dependencies: + kleur: "npm:^3.0.3" + sisteransi: "npm:^1.0.5" + checksum: 10c0/16f1ac2977b19fe2cf53f8411cc98db7a3c8b115c479b2ca5c82b5527cd937aa405fa04f9a5960abeb9daef53191b53b4d13e35c1f5d50e8718c76917c5f1ea4 + languageName: node + linkType: hard + "proxy-addr@npm:~2.0.7": version: 2.0.7 resolution: "proxy-addr@npm:2.0.7" @@ -7199,6 +8107,20 @@ __metadata: languageName: node linkType: hard +"set-function-length@npm:^1.2.2": + version: 1.2.2 + resolution: "set-function-length@npm:1.2.2" + dependencies: + define-data-property: "npm:^1.1.4" + es-errors: "npm:^1.3.0" + function-bind: "npm:^1.1.2" + get-intrinsic: "npm:^1.2.4" + gopd: "npm:^1.0.1" + has-property-descriptors: "npm:^1.0.2" + checksum: 10c0/82850e62f412a258b71e123d4ed3873fa9377c216809551192bb6769329340176f109c2eeae8c22a8d386c76739855f78e8716515c818bcaef384b51110f0f3c + languageName: node + linkType: hard + "set-value@npm:^4.1.0": version: 4.1.0 resolution: "set-value@npm:4.1.0" @@ -7378,7 +8300,7 @@ __metadata: languageName: node linkType: hard -"sisteransi@npm:^1.0.0": +"sisteransi@npm:^1.0.0, sisteransi@npm:^1.0.5": version: 1.0.5 resolution: "sisteransi@npm:1.0.5" checksum: 10c0/230ac975cca485b7f6fe2b96a711aa62a6a26ead3e6fb8ba17c5a00d61b8bed0d7adc21f5626b70d7c33c62ff4e63933017a6462942c719d1980bb0b1207ad46 @@ -7822,6 +8744,13 @@ __metadata: languageName: node linkType: hard +"undici-types@npm:^8.2.0": + version: 8.3.0 + resolution: "undici-types@npm:8.3.0" + checksum: 10c0/c8aa7e2fbebfce519654dafadc0ece59be888d2ccaf180fb4495da875e7b536d2456345c384069c7e6f3e9c9ab7435f074957da306f142343eee86ff8048855a + languageName: node + linkType: hard + "undici-types@npm:~7.19.0": version: 7.19.2 resolution: "undici-types@npm:7.19.2"