@nosana/kit
Version:
Nosana KIT
69 lines • 3.23 kB
JavaScript
/**
* 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, getBooleanDecoder, getBooleanEncoder, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, transformEncoder, } from '@solana/kit';
export const CLAIM_STATUS_DISCRIMINATOR = new Uint8Array([
22, 183, 249, 157, 247, 95, 150, 96,
]);
export function getClaimStatusDiscriminatorBytes() {
return fixEncoderSize(getBytesEncoder(), 8).encode(CLAIM_STATUS_DISCRIMINATOR);
}
/** Gets the encoder for {@link ClaimStatusArgs} account data. */
export function getClaimStatusEncoder() {
return transformEncoder(getStructEncoder([
['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
['claimant', getAddressEncoder()],
['lockedAmount', getU64Encoder()],
['lockedAmountWithdrawn', getU64Encoder()],
['unlockedAmount', getU64Encoder()],
['unlockedAmountClaimed', getU64Encoder()],
['closable', getBooleanEncoder()],
['distributor', getAddressEncoder()],
]), (value) => ({ ...value, discriminator: CLAIM_STATUS_DISCRIMINATOR }));
}
/** Gets the decoder for {@link ClaimStatus} account data. */
export function getClaimStatusDecoder() {
return getStructDecoder([
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
['claimant', getAddressDecoder()],
['lockedAmount', getU64Decoder()],
['lockedAmountWithdrawn', getU64Decoder()],
['unlockedAmount', getU64Decoder()],
['unlockedAmountClaimed', getU64Decoder()],
['closable', getBooleanDecoder()],
['distributor', getAddressDecoder()],
]);
}
/** Gets the codec for {@link ClaimStatus} account data. */
export function getClaimStatusCodec() {
return combineCodec(getClaimStatusEncoder(), getClaimStatusDecoder());
}
export function decodeClaimStatus(encodedAccount) {
return decodeAccount(encodedAccount, getClaimStatusDecoder());
}
export async function fetchClaimStatus(rpc, address, config) {
const maybeAccount = await fetchMaybeClaimStatus(rpc, address, config);
assertAccountExists(maybeAccount);
return maybeAccount;
}
export async function fetchMaybeClaimStatus(rpc, address, config) {
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
return decodeClaimStatus(maybeAccount);
}
export async function fetchAllClaimStatus(rpc, addresses, config) {
const maybeAccounts = await fetchAllMaybeClaimStatus(rpc, addresses, config);
assertAccountsExist(maybeAccounts);
return maybeAccounts;
}
export async function fetchAllMaybeClaimStatus(rpc, addresses, config) {
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
return maybeAccounts.map((maybeAccount) => decodeClaimStatus(maybeAccount));
}
export function getClaimStatusSize() {
return 105;
}
//# sourceMappingURL=claimStatus.js.map