{- Copyright 2022-2024 Vergara Technologies LLC This file is part of Zcash-Haskell. -} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DerivingVia #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE UndecidableInstances #-} module C.Zcash where #include "rustzcash_wrapper.h" import qualified Data.ByteString as BS import Codec.Borsh import qualified Data.Text as T import Data.Word import Data.Int import Data.Structured import Data.HexString (HexString(..)) import Foreign.C.Types import Foreign.Rust.Marshall.External import Foreign.Rust.Marshall.Fixed import Foreign.Rust.Marshall.Variable import Foreign.Rust.Serialisation.Raw import Foreign.Rust.Serialisation.Raw.Base16 import qualified Generics.SOP as SOP import qualified GHC.Generics as GHC import ZcashHaskell.Types {# fun unsafe rust_wrapper_bech32decode as rustWrapperBech32Decode { toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer RawData'& } -> `()' #} {# fun unsafe rust_wrapper_bech32m_encode as rustWrapperBech32mEncode { toBorshVar* `BS.ByteString'& , toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer (T.Text)'& } -> `()' #} {# fun unsafe rust_wrapper_f4jumble as rustWrapperF4Jumble { toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer (BS.ByteString)'& } -> `()' #} {# fun unsafe rust_wrapper_f4unjumble as rustWrapperF4UnJumble { toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer (BS.ByteString)'& } -> `()' #} {# fun unsafe rust_wrapper_ua_decode as rustWrapperUADecode { toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer RawUA'& } -> `()' #} {# fun pure unsafe rust_wrapper_shielded_decode as rustWrapperIsShielded { toBorshVar* `BS.ByteString'& } -> `Bool' #} {# fun pure unsafe rust_wrapper_svk_decode as rustWrapperSaplingVkDecode { toBorshVar* `BS.ByteString'& } -> `Bool' #} {# fun pure unsafe rust_wrapper_svk_check_address as rustWrapperSaplingCheck { toBorshVar* `BS.ByteString'& , toBorshVar* `BS.ByteString'& } -> `Bool' #} {# fun pure unsafe rust_wrapper_ufvk_check_address as rustWrapperOrchardCheck { toBorshVar* `BS.ByteString'& , toBorshVar* `BS.ByteString'& } -> `Bool' #} {# fun unsafe rust_wrapper_sapling_note_decrypt_v2 as rustWrapperSaplingNoteDecode { toBorshVar* `BS.ByteString'& , toBorshVar* `ShieldedOutput'& , getVarBuffer `Buffer DecodedNote'& } -> `()' #} {# fun unsafe rust_wrapper_sapling_esk_decrypt as rustWrapperSaplingDecodeEsk { toBorshVar* `BS.ByteString'& , toBorshVar* `ShieldedOutput'& , `Bool' , `Bool' , `Word64' , getVarBuffer `Buffer DecodedNote'& } -> `()' #} {# fun unsafe rust_wrapper_ufvk_decode as rustWrapperUfvkDecode { toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer UnifiedFullViewingKey'& } -> `()' #} {# fun unsafe rust_wrapper_orchard_note_decrypt as rustWrapperOrchardNoteDecode { toBorshVar* `BS.ByteString'& , toBorshVar* `OrchardAction'& , getVarBuffer `Buffer DecodedNote'& } -> `()' #} {# fun unsafe rust_wrapper_orchard_note_decrypt_sk as rustWrapperOrchardNoteDecodeSK { toBorshVar* `BS.ByteString'& , toBorshVar* `OrchardAction'& , `Bool' , getVarBuffer `Buffer DecodedNote'& } -> `()' #} {# fun unsafe rust_wrapper_tx_parse as rustWrapperTxParse { toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer [ShieldedOutput]'& } -> `()' #} {# fun unsafe rust_wrapper_tx_read as rustWrapperTxRead { toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer RawZebraTx'& } -> `()' #} {# fun unsafe rust_wrapper_gen_seed_phrase as rustWrapperGenSeedPhrase { getVarBuffer `Buffer Phrase'& } -> `()' #} {# fun unsafe rust_wrapper_recover_seed as rustWrapperGetSeed { toBorshVar* `Phrase'& , getVarBuffer `Buffer Seed'& } -> `()' #} {# fun unsafe rust_wrapper_sapling_spendingkey as rustWrapperSaplingSpendingkey { toBorshVar* `BS.ByteString'& , `Word32' , `Word32' , getVarBuffer `Buffer (BS.ByteString)'& } -> `()' #} {# fun unsafe rust_wrapper_sapling_paymentaddress as rustWrapperSaplingPaymentAddress { toBorshVar* `BS.ByteString'& , `Word32' , getVarBuffer `Buffer (BS.ByteString)'& } -> `()' #} {# fun unsafe rust_wrapper_sapling_chgpaymentaddress as rustWrapperSaplingChgPaymentAddress { toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer (BS.ByteString)'& } -> `()' #} {# fun unsafe rust_wrapper_derive_orchard_spending_key as rustWrapperGenOrchardSpendKey { toBorshVar* `BS.ByteString'& , `Word32' , `Word32' , getVarBuffer `Buffer (BS.ByteString)'& } -> `()' #} {# fun unsafe rust_wrapper_derive_orchard_receiver as rustWrapperGenOrchardReceiver { toBorshVar* `BS.ByteString'& , `Word32' , `Bool' , getVarBuffer `Buffer (BS.ByteString)'& } -> `()' #} {# fun unsafe rust_wrapper_read_sapling_commitment_tree as rustWrapperReadSaplingCommitmentTree { toBorshVar* `SaplingFrontier'& , toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer SaplingFrontier'& } -> `()' #} {# fun unsafe rust_wrapper_read_sapling_witness as rustWrapperReadSaplingWitness { toBorshVar* `SaplingFrontier'& , getVarBuffer `Buffer HexString'& } -> `()' #} {# fun pure unsafe rust_wrapper_read_sapling_position as rustWrapperReadSaplingPosition { toBorshVar* `BS.ByteString'& } -> `Word64' #} {# fun unsafe rust_wrapper_bech32_encode as rustWrapperBech32Encode { toBorshVar* `BS.ByteString'& , toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer (T.Text)'& } -> `()' #} {# fun unsafe rust_wrapper_read_sapling_frontier as rustWrapperReadSaplingFrontier { toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer SaplingFrontier'& } -> `()' #} {# fun unsafe rust_wrapper_decode_sapling_address as rustWrapperDecodeSaplingAddress { toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer (BS.ByteString)'& } -> `()' #} {# fun unsafe rust_wrapper_read_orchard_node as rustWrapperReadOrchardNode { toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer HexString'& } -> `()' #} {# fun unsafe rust_wrapper_combine_orchard_nodes as rustWrapperCombineOrchardNodes { `Int8' , toBorshVar* `BS.ByteString'& , toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer HexString'& } -> `()' #} {# fun unsafe rust_wrapper_read_orchard_tree_anchor as rustWrapperReadOrchardTreeAnchor { toBorshVar* `OrchardFrontier'& , getVarBuffer `Buffer HexString'& } -> `()' #} {# fun unsafe rust_wrapper_read_orchard_witness_anchor as rustWrapperReadOrchardWitnessAnchor { toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer HexString'& } -> `()' #} {# fun unsafe rust_wrapper_get_orchard_root as rustWrapperGetOrchardRootTest { `Int8' , getVarBuffer `Buffer HexString'& } -> `()' #} {# fun unsafe rust_wrapper_read_orchard_commitment_tree as rustWrapperReadOrchardCommitmentTree { toBorshVar* `OrchardFrontier'& , toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer OrchardFrontier'& } -> `()' #} {# fun unsafe rust_wrapper_read_orchard_frontier as rustWrapperReadOrchardFrontier { toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer OrchardFrontier'& } -> `()' #} {# fun unsafe rust_wrapper_read_orchard_witness as rustWrapperReadOrchardWitness { toBorshVar* `OrchardFrontier'& , getVarBuffer `Buffer HexString'& } -> `()' #} {# fun pure unsafe rust_wrapper_read_orchard_position as rustWrapperReadOrchardPosition { toBorshVar* `BS.ByteString'& } -> `Word64' #} {# fun unsafe rust_wrapper_orchard_add_node as rustWrapperOrchardAddNodeTest { toBorshVar* `BS.ByteString'& , getVarBuffer `Buffer HexString'& } -> `()' #} {# fun unsafe rust_wrapper_update_sapling_witness as rustWrapperUpdateSaplingWitness { toBorshVar* `BS.ByteString'& , toBorshVar* `[BS.ByteString]'& , getVarBuffer `Buffer HexString'& } -> `()' #} {# fun unsafe rust_wrapper_update_orchard_witness as rustWrapperUpdateOrchardWitness { toBorshVar* `BS.ByteString'& , toBorshVar* `[BS.ByteString]'& , getVarBuffer `Buffer HexString'& } -> `()' #} {# fun unsafe rust_wrapper_create_transaction as rustWrapperCreateTx { toBorshVar* `BS.ByteString'& , toBorshVar* `BS.ByteString'& , toBorshVar* `[TransparentTxSpend]'& , toBorshVar* `[SaplingTxSpend]'& , toBorshVar* `[OrchardTxSpend]'& , toBorshVar* `[OutgoingNote]'& , `Bool' , `Word64' , `Bool' , getVarBuffer `Buffer HexString'& } -> `()' #}