/**
 * 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 { __assign, __awaiter, __generator } from "tslib";
import { assertAccountExists, assertAccountsExist, combineCodec, decodeAccount, fetchEncodedAccount, fetchEncodedAccounts, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, transformEncoder, } from "@solana/kit";
export var RENT_CLAIM_DISCRIMINATOR = new Uint8Array([
    13, 5, 183, 82, 60, 122, 72, 11,
]);
export function getRentClaimDiscriminatorBytes() {
    return fixEncoderSize(getBytesEncoder(), 8).encode(RENT_CLAIM_DISCRIMINATOR);
}
/** Gets the encoder for {@link RentClaimArgs} account data. */
export function getRentClaimEncoder() {
    return transformEncoder(getStructEncoder([
        ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
        ["amount", getU64Encoder()],
    ]), function (value) { return (__assign(__assign({}, value), { discriminator: RENT_CLAIM_DISCRIMINATOR })); });
}
/** Gets the decoder for {@link RentClaim} account data. */
export function getRentClaimDecoder() {
    return getStructDecoder([
        ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
        ["amount", getU64Decoder()],
    ]);
}
/** Gets the codec for {@link RentClaim} account data. */
export function getRentClaimCodec() {
    return combineCodec(getRentClaimEncoder(), getRentClaimDecoder());
}
export function decodeRentClaim(encodedAccount) {
    return decodeAccount(encodedAccount, getRentClaimDecoder());
}
export function fetchRentClaim(rpc, address, config) {
    return __awaiter(this, void 0, void 0, function () {
        var maybeAccount;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0: return [4 /*yield*/, fetchMaybeRentClaim(rpc, address, config)];
                case 1:
                    maybeAccount = _a.sent();
                    assertAccountExists(maybeAccount);
                    return [2 /*return*/, maybeAccount];
            }
        });
    });
}
export function fetchMaybeRentClaim(rpc, address, config) {
    return __awaiter(this, void 0, void 0, function () {
        var maybeAccount;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0: return [4 /*yield*/, fetchEncodedAccount(rpc, address, config)];
                case 1:
                    maybeAccount = _a.sent();
                    return [2 /*return*/, decodeRentClaim(maybeAccount)];
            }
        });
    });
}
export function fetchAllRentClaim(rpc, addresses, config) {
    return __awaiter(this, void 0, void 0, function () {
        var maybeAccounts;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0: return [4 /*yield*/, fetchAllMaybeRentClaim(rpc, addresses, config)];
                case 1:
                    maybeAccounts = _a.sent();
                    assertAccountsExist(maybeAccounts);
                    return [2 /*return*/, maybeAccounts];
            }
        });
    });
}
export function fetchAllMaybeRentClaim(rpc, addresses, config) {
    return __awaiter(this, void 0, void 0, function () {
        var maybeAccounts;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0: return [4 /*yield*/, fetchEncodedAccounts(rpc, addresses, config)];
                case 1:
                    maybeAccounts = _a.sent();
                    return [2 /*return*/, maybeAccounts.map(function (maybeAccount) { return decodeRentClaim(maybeAccount); })];
            }
        });
    });
}
export function getRentClaimSize() {
    return 16;
}
//# sourceMappingURL=rentClaim.js.map