user2797: I am tiring to use Cardano Sterilization Lib to get the Stake/Usable address from Stake Hash or Address Hash.
https://adaex.org/address/addr1q8d27ughqsqras7k9wnr4dlustzjlhadhe9rf6t3tr90u5yc4vxfxvmpr0hfktjc7md2n8er05tnurr676n6yq7khcnss8msq0/all-addresses#data
Address Hash: 01daaf711704003ec3d62ba63ab7fc82c52fdfadbe4a34e97158cafe5098ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27
Stake Key Hash: e198ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27
I saw Convert xpub public key from ccvault to bech32 or acct_ public key which showed a way but I couldn't get it to work.
wasm.StakeCredential.from_bytes(new TextEncoder().encode("98ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27"))
returns  Deserialization failed in StakeCredential because: Invalid cbor: not the right type, expected Array' byte received Text'.
Thanks!

user2897: You can try with this line:
wasm.StakeCredential.from_bytes(
 Buffer.from("98ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27", "hex")
)

Alternatively, you can try using from_keyhash method. This method expects to receive a Ed25519KeyHash, which you can build from the given Stake Key Hash, all in the same instruction, like this:
wasm.StakeCredential.from_keyhash(
 wasm.Ed25519KeyHash.from_bytes(
  Buffer.from("e198ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27", "hex")
 )
)


2797: <p>I am tiring to use Cardano Sterilization Lib to get the Stake/Usable address from Stake Hash or Address Hash.</p>
<p><a href="https://adaex.org/address/addr1q8d27ughqsqras7k9wnr4dlustzjlhadhe9rf6t3tr90u5yc4vxfxvmpr0hfktjc7md2n8er05tnurr676n6yq7khcnss8msq0/all-addresses#data" rel="nofollow noreferrer">https://adaex.org/address/addr1q8d27ughqsqras7k9wnr4dlustzjlhadhe9rf6t3tr90u5yc4vxfxvmpr0hfktjc7md2n8er05tnurr676n6yq7khcnss8msq0/all-addresses#data</a></p>
<p>Address Hash: 01daaf711704003ec3d62ba63ab7fc82c52fdfadbe4a34e97158cafe5098ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27</p>
<p>Stake Key Hash: e198ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27</p>
<p>I saw <a href="https://cardano.stackexchange.com/questions/7689/convert-xpub-public-key-from-ccvault-to-bech32-or-acct-public-key">Convert xpub public key from ccvault to bech32 or acct_ public key</a> which showed a way but I couldn't get it to work.</p>
<p><code>wasm.StakeCredential.from_bytes(new TextEncoder().encode(&quot;98ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27&quot;))</code></p>
<p>returns  Deserialization failed in StakeCredential because: Invalid cbor: not the right type, expected <code>Array' byte received </code>Text'.</p>
<p>Thanks!</p>
 2897: <p>You can try with this line:</p>
<pre><code>wasm.StakeCredential.from_bytes(
 Buffer.from(&quot;98ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27&quot;, &quot;hex&quot;)
)
</code></pre>
<p>Alternatively, you can try using <code>from_keyhash</code> method. This method expects to receive a <code>Ed25519KeyHash</code>, which you can build from the given Stake Key Hash, all in the same instruction, like this:</p>
<pre><code>wasm.StakeCredential.from_keyhash(
 wasm.Ed25519KeyHash.from_bytes(
  Buffer.from(&quot;e198ab0c9333611bee9b2e58f6daa99f237d173e0c7af6a7a203d6be27&quot;, &quot;hex&quot;)
 )
)
</code></pre>
