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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@
**/escrow-generated/
**/withdraw-generated/

# Un-ignore TypeScript generated clients (needed for admin-ui Docker build)
!contra-escrow-program/clients/typescript/src/generated/
!contra-withdraw-program/clients/typescript/src/generated/

# Javascript / Typescript
**/node_modules/
**/dist/
.pnpm-store/

# AI
.claude/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/**
* 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,
getU8Decoder,
getU8Encoder,
type Account,
type Address,
type EncodedAccount,
type FetchAccountConfig,
type FetchAccountsConfig,
type FixedSizeCodec,
type FixedSizeDecoder,
type FixedSizeEncoder,
type MaybeAccount,
type MaybeEncodedAccount,
} from '@solana/kit';

export type AllowedMint = { discriminator: number; bump: number };

export type AllowedMintArgs = AllowedMint;

export function getAllowedMintEncoder(): FixedSizeEncoder<AllowedMintArgs> {
return getStructEncoder([
['discriminator', getU8Encoder()],
['bump', getU8Encoder()],
]);
}

export function getAllowedMintDecoder(): FixedSizeDecoder<AllowedMint> {
return getStructDecoder([
['discriminator', getU8Decoder()],
['bump', getU8Decoder()],
]);
}

export function getAllowedMintCodec(): FixedSizeCodec<
AllowedMintArgs,
AllowedMint
> {
return combineCodec(getAllowedMintEncoder(), getAllowedMintDecoder());
}

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

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

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

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

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

export function getAllowedMintSize(): number {
return 2;
}
Original file line number Diff line number Diff line change
@@ -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 './allowedMint';
export * from './instance';
export * from './operator';
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/**
* 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,
getStructDecoder,
getStructEncoder,
getU64Decoder,
getU64Encoder,
getU8Decoder,
getU8Encoder,
type Account,
type Address,
type EncodedAccount,
type FetchAccountConfig,
type FetchAccountsConfig,
type FixedSizeCodec,
type FixedSizeDecoder,
type FixedSizeEncoder,
type MaybeAccount,
type MaybeEncodedAccount,
type ReadonlyUint8Array,
} from '@solana/kit';

export type Instance = {
discriminator: number;
bump: number;
version: number;
instanceSeed: Address;
admin: Address;
withdrawalTransactionsRoot: ReadonlyUint8Array;
currentTreeIndex: bigint;
};

export type InstanceArgs = {
discriminator: number;
bump: number;
version: number;
instanceSeed: Address;
admin: Address;
withdrawalTransactionsRoot: ReadonlyUint8Array;
currentTreeIndex: number | bigint;
};

export function getInstanceEncoder(): FixedSizeEncoder<InstanceArgs> {
return getStructEncoder([
['discriminator', getU8Encoder()],
['bump', getU8Encoder()],
['version', getU8Encoder()],
['instanceSeed', getAddressEncoder()],
['admin', getAddressEncoder()],
['withdrawalTransactionsRoot', fixEncoderSize(getBytesEncoder(), 32)],
['currentTreeIndex', getU64Encoder()],
]);
}

export function getInstanceDecoder(): FixedSizeDecoder<Instance> {
return getStructDecoder([
['discriminator', getU8Decoder()],
['bump', getU8Decoder()],
['version', getU8Decoder()],
['instanceSeed', getAddressDecoder()],
['admin', getAddressDecoder()],
['withdrawalTransactionsRoot', fixDecoderSize(getBytesDecoder(), 32)],
['currentTreeIndex', getU64Decoder()],
]);
}

export function getInstanceCodec(): FixedSizeCodec<InstanceArgs, Instance> {
return combineCodec(getInstanceEncoder(), getInstanceDecoder());
}

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

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

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

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

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

export function getInstanceSize(): number {
return 107;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/**
* 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,
getU8Decoder,
getU8Encoder,
type Account,
type Address,
type EncodedAccount,
type FetchAccountConfig,
type FetchAccountsConfig,
type FixedSizeCodec,
type FixedSizeDecoder,
type FixedSizeEncoder,
type MaybeAccount,
type MaybeEncodedAccount,
} from '@solana/kit';

export type Operator = { discriminator: number; bump: number };

export type OperatorArgs = Operator;

export function getOperatorEncoder(): FixedSizeEncoder<OperatorArgs> {
return getStructEncoder([
['discriminator', getU8Encoder()],
['bump', getU8Encoder()],
]);
}

export function getOperatorDecoder(): FixedSizeDecoder<Operator> {
return getStructDecoder([
['discriminator', getU8Decoder()],
['bump', getU8Decoder()],
]);
}

export function getOperatorCodec(): FixedSizeCodec<OperatorArgs, Operator> {
return combineCodec(getOperatorEncoder(), getOperatorDecoder());
}

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

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

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

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

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

export function getOperatorSize(): number {
return 2;
}
Loading