Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.DS_Store
target
test-ledger

node_modules/
9 changes: 9 additions & 0 deletions clients/js/src/generated/accounts/index.ts
Original file line number Diff line number Diff line change
@@ -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 "./vault";
105 changes: 105 additions & 0 deletions clients/js/src/generated/accounts/vault.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/**
* 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,
getStructDecoder,
getStructEncoder,
type Account,
type Address,
type EncodedAccount,
type FetchAccountConfig,
type FetchAccountsConfig,
type FixedSizeCodec,
type FixedSizeDecoder,
type FixedSizeEncoder,
type MaybeAccount,
type MaybeEncodedAccount,
} from "@solana/kit";

/** stORE mint authority. */
export type Vault = {};

export type VaultArgs = Vault;

/** Gets the encoder for {@link VaultArgs} account data. */
export function getVaultEncoder(): FixedSizeEncoder<VaultArgs> {
return getStructEncoder([]);
}

/** Gets the decoder for {@link Vault} account data. */
export function getVaultDecoder(): FixedSizeDecoder<Vault> {
return getStructDecoder([]);
}

/** Gets the codec for {@link Vault} account data. */
export function getVaultCodec(): FixedSizeCodec<VaultArgs, Vault> {
return combineCodec(getVaultEncoder(), getVaultDecoder());
}

export function decodeVault<TAddress extends string = string>(
encodedAccount: EncodedAccount<TAddress>,
): Account<Vault, TAddress>;
export function decodeVault<TAddress extends string = string>(
encodedAccount: MaybeEncodedAccount<TAddress>,
): MaybeAccount<Vault, TAddress>;
export function decodeVault<TAddress extends string = string>(
encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress>,
): Account<Vault, TAddress> | MaybeAccount<Vault, TAddress> {
return decodeAccount(
encodedAccount as MaybeEncodedAccount<TAddress>,
getVaultDecoder(),
);
}

export async function fetchVault<TAddress extends string = string>(
rpc: Parameters<typeof fetchEncodedAccount>[0],
address: Address<TAddress>,
config?: FetchAccountConfig,
): Promise<Account<Vault, TAddress>> {
const maybeAccount = await fetchMaybeVault(rpc, address, config);
assertAccountExists(maybeAccount);
return maybeAccount;
}

export async function fetchMaybeVault<TAddress extends string = string>(
rpc: Parameters<typeof fetchEncodedAccount>[0],
address: Address<TAddress>,
config?: FetchAccountConfig,
): Promise<MaybeAccount<Vault, TAddress>> {
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
return decodeVault(maybeAccount);
}

export async function fetchAllVault(
rpc: Parameters<typeof fetchEncodedAccounts>[0],
addresses: Array<Address>,
config?: FetchAccountsConfig,
): Promise<Account<Vault>[]> {
const maybeAccounts = await fetchAllMaybeVault(rpc, addresses, config);
assertAccountsExist(maybeAccounts);
return maybeAccounts;
}

export async function fetchAllMaybeVault(
rpc: Parameters<typeof fetchEncodedAccounts>[0],
addresses: Array<Address>,
config?: FetchAccountsConfig,
): Promise<MaybeAccount<Vault>[]> {
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
return maybeAccounts.map((maybeAccount) => decodeVault(maybeAccount));
}

export function getVaultSize(): number {
return 0;
}
9 changes: 9 additions & 0 deletions clients/js/src/generated/errors/index.ts
Original file line number Diff line number Diff line change
@@ -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 "./oreLst";
49 changes: 49 additions & 0 deletions clients/js/src/generated/errors/oreLst.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* 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 { ORE_LST_PROGRAM_ADDRESS } from "../programs";

/** Dummy: Dummy */
export const ORE_LST_ERROR__DUMMY = 0x0; // 0

export type OreLstError = typeof ORE_LST_ERROR__DUMMY;

let oreLstErrorMessages: Record<OreLstError, string> | undefined;
if (process.env.NODE_ENV !== "production") {
oreLstErrorMessages = { [ORE_LST_ERROR__DUMMY]: `Dummy` };
}

export function getOreLstErrorMessage(code: OreLstError): string {
if (process.env.NODE_ENV !== "production") {
return (oreLstErrorMessages as Record<OreLstError, string>)[code];
}

return "Error message not available in production bundles.";
}

export function isOreLstError<TProgramErrorCode extends OreLstError>(
error: unknown,
transactionMessage: {
instructions: Record<number, { programAddress: Address }>;
},
code?: TProgramErrorCode,
): error is SolanaError<typeof SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM> &
Readonly<{ context: Readonly<{ code: TProgramErrorCode }> }> {
return isProgramError<TProgramErrorCode>(
error,
transactionMessage,
ORE_LST_PROGRAM_ADDRESS,
code,
);
}
12 changes: 12 additions & 0 deletions clients/js/src/generated/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* 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 "./programs";
Loading