package tezos-client-012-Psithaca
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=43723d096307603703a1a89ed1b2eb202b365f5e7824b96b0cbf813b343a6cf7
sha512=b2a637f2e965000d3d49ad85277ca24d6cb07a1a7cf2bc69d296d8b03ad78c3eaa8e21e94b9162e62c2e11649cd03bc845b2a3dafe623b91065df69d47dc8e4f
doc/tezos-client-012-Psithaca.sapling/Tezos_client_sapling_012_Psithaca/Context/index.html
Module Tezos_client_sapling_012_Psithaca.Context
Source
This module allows the creation Sapling transactions: shield, unshield and transfer. Because Sapling uses an UTXO model, it is necessary for the client to maintain locally the set of unspent outputs for each viewing key, for each smart contract. This operation is called scanning. This local cache is updated downloading from the node only the difference from the last scanned state.
This module is used to represent any shielded token to avoid confusing it with Tez.
Actual input to a smart contract handling Sapling transactions
State of a contract, potentially involving several viewing keys
val shield :
Tezos_client_base.Client_context.full ->
dst:Tezos_sapling.Core.Client.Viewing_key.address ->
?message:bytes ->
Tez.t ->
Contract_state.t ->
string ->
Shielded_tez_contract_input.t Tezos_base.TzPervasives.tzresult Lwt.t
shield ~message ~dst tez cstate anti-replay
returns a transaction shielding tez
tez to a sapling address dst
using a sapling storage cstate
and the anti-replay string.
val unshield :
src:Tezos_sapling.Core.Client.Spending_key.t ->
dst:Tezos_crypto.Signature.V0.public_key_hash ->
backdst:Tezos_sapling.Core.Client.Viewing_key.address ->
Shielded_tez.t ->
Contract_state.t ->
string ->
Shielded_tez_contract_input.t Tezos_base.TzPervasives.tzresult
unshield ~src_name ~src ~dst ~backdst stez cstate storage
returns a transaction unshielding stez
shielded tokens from a sapling wallet src
to a transparent tezos address dst
, sending the change back to backdst
and using a Sapling storage cstate
and a anti-replay string. The transaction is refused if there is an insufficient amount of shielded tez in the wallet src
, the error is raised with src_name
.
val transfer :
Tezos_client_base.Client_context.full ->
src:Tezos_sapling.Core.Client.Spending_key.t ->
dst:Tezos_sapling.Core.Client.Viewing_key.address ->
backdst:Tezos_sapling.Core.Client.Viewing_key.address ->
?message:bytes ->
Shielded_tez.t ->
Contract_state.t ->
string ->
UTXO.transaction Tezos_base.TzPervasives.tzresult Lwt.t
transfer ~message ~src ~dst ~backdst amount cstate anti-replay
creates a Sapling transaction of amount
shielded tez from Sapling wallet src
to Sapling address dst
, sending the change to backdst
, using a Sapling storage cstate
and a anti-replay string. ~message
is a message that will be uploaded encrypted on chain.