30 lines
5.4 KiB
HTML
30 lines
5.4 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Decodes a `TransparentAddress` from a Base58Check-encoded string."><title>decode_transparent_address in zcash_keys::encoding - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-84e720fa.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="zcash_keys" data-themes="" data-resource-suffix="" data-rustdoc-version="1.89.0-nightly (99e7c15e8 2025-06-01)" data-channel="nightly" data-search-js="search-f7877310.js" data-settings-js="settings-5514c975.js" ><script src="../../static.files/storage-4e99c027.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-fd3af306.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../zcash_keys/index.html">zcash_<wbr>keys</a><span class="version">0.9.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">decode_<wbr>transparent_<wbr>address</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In zcash_<wbr>keys::<wbr>encoding</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">zcash_keys</a>::<wbr><a href="index.html">encoding</a></div><h1>Function <span class="fn">decode_transparent_address</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/zcash_keys/encoding.rs.html#475-495">Source</a> </span></div><pre class="rust item-decl"><code>pub fn decode_transparent_address(
|
|
pubkey_version: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>],
|
|
script_version: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>],
|
|
s: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
|
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><TransparentAddress>, Error></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Decodes a [<code>TransparentAddress</code>] from a Base58Check-encoded string.</p>
|
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zcash_protocol::consensus::{TEST_NETWORK, NetworkConstants, Parameters};
|
|
<span class="kw">use </span>transparent::address::TransparentAddress;
|
|
<span class="kw">use </span>zcash_keys::{
|
|
encoding::decode_transparent_address,
|
|
};
|
|
|
|
<span class="macro">assert_eq!</span>(
|
|
decode_transparent_address(
|
|
<span class="kw-2">&</span>TEST_NETWORK.b58_pubkey_address_prefix(),
|
|
<span class="kw-2">&</span>TEST_NETWORK.b58_script_address_prefix(),
|
|
<span class="string">"tm9iMLAuYMzJ6jtFLcA7rzUmfreGuKvr7Ma"</span>,
|
|
),
|
|
<span class="prelude-val">Ok</span>(<span class="prelude-val">Some</span>(TransparentAddress::PublicKeyHash([<span class="number">0</span>; <span class="number">20</span>]))),
|
|
);
|
|
|
|
<span class="macro">assert_eq!</span>(
|
|
decode_transparent_address(
|
|
<span class="kw-2">&</span>TEST_NETWORK.b58_pubkey_address_prefix(),
|
|
<span class="kw-2">&</span>TEST_NETWORK.b58_script_address_prefix(),
|
|
<span class="string">"t26YoyZ1iPgiMEWL4zGUm74eVWfhyDMXzY2"</span>,
|
|
),
|
|
<span class="prelude-val">Ok</span>(<span class="prelude-val">Some</span>(TransparentAddress::ScriptHash([<span class="number">0</span>; <span class="number">20</span>]))),
|
|
);</code></pre></div>
|
|
</div></details></section></div></main></body></html> |