#pragma once /** * @brief Cartallum CBE Public key */ #include #ifdef __cplusplus extern "C" { #endif /** * Size of Public key in bytes */ #define SIZE_PUBKEY 32 /** * Public key */ typedef struct { uint8_t x[SIZE_PUBKEY]; } CBEPubkey; /** * Prints the hexadecimal representation of a public key * * @param key The public key to print */ /* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE sdk/sbf/c/inc/cbe/inc/pubkey.inc AND RUN `cargo run --bin gen-headers` */ #ifndef CBE_SBFV2 void cbe_log_pubkey(const CBEPubkey *); #else typedef void(*cbe_log_pubkey_pointer_type)(const CBEPubkey *); static void cbe_log_pubkey(const CBEPubkey * arg1) { cbe_log_pubkey_pointer_type cbe_log_pubkey_pointer = (cbe_log_pubkey_pointer_type) 2129692874; cbe_log_pubkey_pointer(arg1); } #endif /** * Compares two public keys * * @param one First public key * @param two Second public key * @return true if the same */ static bool CBEPubkey_same(const CBEPubkey *one, const CBEPubkey *two) { for (int i = 0; i < sizeof(*one); i++) { if (one->x[i] != two->x[i]) { return false; } } return true; } /** * Seed used to create a program address or passed to cbe_invoke_signed */ typedef struct { const uint8_t *addr; /** Seed bytes */ uint64_t len; /** Length of the seed bytes */ } CBESignerSeed; /** * Seeds used by a signer to create a program address or passed to * cbe_invoke_signed */ typedef struct { const CBESignerSeed *addr; /** An array of a signer's seeds */ uint64_t len; /** Number of seeds */ } CBESignerSeeds; /** * Create a program address * * @param seeds Seed bytes used to sign program accounts * @param seeds_len Length of the seeds array * @param program_id Program id of the signer * @param program_address Program address created, filled on return */ /* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE sdk/sbf/c/inc/cbe/inc/pubkey.inc AND RUN `cargo run --bin gen-headers` */ #ifndef CBE_SBFV2 uint64_t cbe_create_program_address(const CBESignerSeed *, int, const CBEPubkey *, CBEPubkey *); #else typedef uint64_t(*cbe_create_program_address_pointer_type)(const CBESignerSeed *, int, const CBEPubkey *, CBEPubkey *); static uint64_t cbe_create_program_address(const CBESignerSeed * arg1, int arg2, const CBEPubkey * arg3, CBEPubkey * arg4) { cbe_create_program_address_pointer_type cbe_create_program_address_pointer = (cbe_create_program_address_pointer_type) 2474062396; return cbe_create_program_address_pointer(arg1, arg2, arg3, arg4); } #endif /** * Try to find a program address and return corresponding bump seed * * @param seeds Seed bytes used to sign program accounts * @param seeds_len Length of the seeds array * @param program_id Program id of the signer * @param program_address Program address created, filled on return * @param bump_seed Bump seed required to create a valid program address */ /* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE sdk/sbf/c/inc/cbe/inc/pubkey.inc AND RUN `cargo run --bin gen-headers` */ #ifndef CBE_SBFV2 uint64_t cbe_try_find_program_address(const CBESignerSeed *, int, const CBEPubkey *, CBEPubkey *, uint8_t *); #else typedef uint64_t(*cbe_try_find_program_address_pointer_type)(const CBESignerSeed *, int, const CBEPubkey *, CBEPubkey *, uint8_t *); static uint64_t cbe_try_find_program_address(const CBESignerSeed * arg1, int arg2, const CBEPubkey * arg3, CBEPubkey * arg4, uint8_t * arg5) { cbe_try_find_program_address_pointer_type cbe_try_find_program_address_pointer = (cbe_try_find_program_address_pointer_type) 1213221432; return cbe_try_find_program_address_pointer(arg1, arg2, arg3, arg4, arg5); } #endif #ifdef CBE_TEST /** * Stub functions when building tests */ #include void cbe_log_pubkey( const CBEPubkey *pubkey ) { printf("Program log: "); for (int i = 0; i < SIZE_PUBKEY; i++) { printf("%02 ", pubkey->x[i]); } printf("\n"); } #endif #ifdef __cplusplus } #endif /**@}*/