UNPKG

@nosana/kit

Version:

Nosana KIT

70 lines 3.5 kB
/** * 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 { containsBytes, fixEncoderSize, getBytesEncoder, } from '@solana/kit'; export const NOSANA_STAKING_PROGRAM_ADDRESS = ''; export const NosanaStakingAccount = { SettingsAccount: "SettingsAccount", StakeAccount: "StakeAccount", }; export function identifyNosanaStakingAccount(account) { const data = 'data' in account ? account.data : account; if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([63, 89, 203, 155, 76, 237, 115, 58])), 0)) { return NosanaStakingAccount.SettingsAccount; } if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([80, 158, 67, 124, 50, 189, 192, 255])), 0)) { return NosanaStakingAccount.StakeAccount; } throw new Error('The provided account could not be identified as a nosanaStaking account.'); } export const NosanaStakingInstruction = { Init: "Init", Stake: "Stake", Unstake: "Unstake", Restake: "Restake", Topup: "Topup", Extend: "Extend", Close: "Close", Withdraw: "Withdraw", Slash: "Slash", UpdateSettings: "UpdateSettings", }; export function identifyNosanaStakingInstruction(instruction) { const data = 'data' in instruction ? instruction.data : instruction; if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([220, 59, 207, 236, 108, 250, 47, 100])), 0)) { return NosanaStakingInstruction.Init; } if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([206, 176, 202, 18, 200, 209, 179, 108])), 0)) { return NosanaStakingInstruction.Stake; } if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([90, 95, 107, 42, 205, 124, 50, 225])), 0)) { return NosanaStakingInstruction.Unstake; } if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([97, 161, 241, 167, 6, 32, 213, 53])), 0)) { return NosanaStakingInstruction.Restake; } if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([126, 42, 49, 78, 225, 151, 99, 77])), 0)) { return NosanaStakingInstruction.Topup; } if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([228, 127, 0, 1, 227, 154, 54, 168])), 0)) { return NosanaStakingInstruction.Extend; } if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([98, 165, 201, 177, 108, 65, 206, 96])), 0)) { return NosanaStakingInstruction.Close; } if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([183, 18, 70, 156, 148, 109, 161, 34])), 0)) { return NosanaStakingInstruction.Withdraw; } if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([204, 141, 18, 161, 8, 177, 92, 142])), 0)) { return NosanaStakingInstruction.Slash; } if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([81, 166, 51, 213, 158, 84, 157, 108])), 0)) { return NosanaStakingInstruction.UpdateSettings; } throw new Error('The provided instruction could not be identified as a nosanaStaking instruction.'); } //# sourceMappingURL=nosanaStaking.js.map