package octez-shell-libs
Octez shell libraries
Install
Dune Dependency
Authors
Maintainers
Sources
tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/src/octez-shell-libs.mockup-commands/mockup_wallet.ml.html
Source file mockup_wallet.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2020 Nomadic Labs, <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) open Tezos_client_base type bootstrap_secret = {name : string; sk_uri : Client_keys.sk_uri} let default_bootstrap_accounts = let open Lwt_result_syntax in let unencrypted_keys = [ "edsk3gUfUPyBSfrS9CCgmCiQsTCHGkviBDusMxDJstFtojtc1zcpsh"; "edsk39qAm1fiMjgmPkw1EgQYkMzkJezLNewd7PLNHTkr6w9XA2zdfo"; "edsk4ArLQgBTLWG5FJmnGnT689VKoqhXwmDPBuGx3z4cvwU9MmrPZZ"; "edsk2uqQB9AY4FvioK2YMdfmyMrer5R8mGFyuaLLFfSRo8EoyNdht3"; "edsk4QLrcijEffxV31gGdN2HU7UpyJjA8drFoNcmnB28n89YjPNRFm"; ] in let basename = "bootstrap" in List.mapi_es (fun i ukey -> let*? sk_uri = Client_keys.make_sk_uri @@ Uri.of_string ("unencrypted:" ^ ukey) in let name = basename ^ string_of_int (i + 1) in return {name; sk_uri}) unencrypted_keys let add_bootstrap_secret cctxt {name; sk_uri} = let open Lwt_result_syntax in let force = false in let* pk_uri = Client_keys.neuterize sk_uri in let* () = let* o = Client_keys.Public_key.find_opt cctxt name in match o with | None -> return_unit | Some (pk_uri_found, _) -> fail_unless (pk_uri = pk_uri_found || force) (error_of_fmt "public and secret keys '%s' don't correspond, please don't use \ --force" name) in let* pkh, public_key = Client_keys.import_secret_key ~io:(cctxt :> Client_context.io_wallet) pk_uri in let*! () = cctxt#message "Tezos address added: %a" Tezos_crypto.Signature.Public_key_hash.pp pkh in Client_keys.register_key cctxt ~force (pkh, pk_uri, sk_uri) ?public_key name let bootstrap_secret_encoding = let open Data_encoding in conv (fun p -> (p.name, p.sk_uri, "")) (fun (name, sk_uri, _) -> {name; sk_uri}) (obj3 (req "name" string) (req "sk_uri" Client_keys.Secret_key.encoding) (req "amount" string)) let bootstrap_secrets_encoding = Data_encoding.list bootstrap_secret_encoding let populate (cctxt : #Tezos_client_base.Client_context.io_wallet) bootstrap_accounts_file = let open Lwt_result_syntax in let* accounts = match bootstrap_accounts_file with | None -> default_bootstrap_accounts | Some accounts_file -> ( let* json = Tezos_stdlib_unix.Lwt_utils_unix.Json.read_file accounts_file in match Data_encoding.Json.destruct bootstrap_secrets_encoding json with | accounts -> return accounts | exception e -> failwith "cannot read definitions of bootstrap accounts in %s because: %s" accounts_file (Printexc.to_string e)) in List.iter_es (add_bootstrap_secret cctxt) accounts
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>