user6436: If you can help me with this I will really appreciate it. I have worked through the token construction tutorial on Cardano docs https://docs.cardano.org/core-concepts/cardano-addresses. Using the command line I can successfully create transactions
cardano-cli transaction-build-raw /
--fee 0 /
--tx-in ${TxHash}#$T{xIX} /
--tx-out ${receiveAddress}+${amountToSend} /
--out-file mat.raw
when running this command I can successfully send ada to my Nami wallet if I set the variable:
receiveAddress="addr_test1qq5vc9wurul0cd3f2n8fu5uahdaefp6r4rn6nq9tmnvdwzdgchadmnjxnqgaf4k3ju8t74jaj80uwdrcvnxfjmawzats23jjcl"
This address can be obtained by clicking the nami wallet "receive button" and copying the address.
This part works fine.
I am trying to tie this transaction building command to a button in javascript.  To do this I am looking at CIP-30. https://cips.cardano.org/cips/cip30/.  But when I use the injected javascript from Namie wallet
'''
let address = await cardano.getChangeAddress()
'''
the variable address is a string not in the proper format.
"0028cc15dc1f3efc362954ce9e539dbb7b948743a8e7a980abdcd8d709a8c5faddce469811d4d6d1970ebf565d91dfc7347864cc996fae1757".
What is this format? How do I convert it to the Addr_test- string?
Thank you in advance!

user2068: It is hex encoded byteString. You can use the Cardano serialization lib browser
https://www.npmjs.com/package/@emurgo/cardano-serialization-lib-browser
And the following code in javascript
const addressBech32 = async () => {
  await Loader.load();
  const address = (await window.cardano.getUsedAddresses())[0];
  return Loader.Cardano.Address.from_bytes(
    Buffer.from(address, "hex")
  ).to_bech32();
};

Where Loader is my loader to the above Library :) the Address class has a method for converting Hex encoded bytes to Address Bech 32 :
class Loader {
  async load() {
    if (this._wasm) {
      return;
    }
    /**
     * @private
     */
    this._wasm = await import(
      "./@emurgo/cardano-serialization-lib-browser/cardano_serialization_lib_bg"
    );
  }

  get Cardano() {
    return this._wasm;
  }
}

export default new Loader();


6436: <p>If you can help me with this I will really appreciate it. I have worked through the token construction tutorial on Cardano docs <a href="https://docs.cardano.org/core-concepts/cardano-addresses" rel="nofollow noreferrer">https://docs.cardano.org/core-concepts/cardano-addresses</a>. Using the command line I can successfully create transactions</p>
<p>cardano-cli transaction-build-raw /<br />
--fee 0 /<br />
--tx-in ${TxHash}#$T{xIX} /<br />
--tx-out ${receiveAddress}+${amountToSend} /<br />
--out-file mat.raw</p>
<p>when running this command I can successfully send ada to my Nami wallet if I set the variable:</p>
<p>receiveAddress=&quot;addr_test1qq5vc9wurul0cd3f2n8fu5uahdaefp6r4rn6nq9tmnvdwzdgchadmnjxnqgaf4k3ju8t74jaj80uwdrcvnxfjmawzats23jjcl&quot;</p>
<p>This address can be obtained by clicking the nami wallet &quot;receive button&quot; and copying the address.
This part works fine.</p>
<p>I am trying to tie this transaction building command to a button in javascript.  To do this I am looking at CIP-30. <a href="https://cips.cardano.org/cips/cip30/" rel="nofollow noreferrer">https://cips.cardano.org/cips/cip30/</a>.  But when I use the injected javascript from Namie wallet</p>
<p>'''
let address = await cardano.getChangeAddress()
'''
the variable address is a string not in the proper format.
&quot;0028cc15dc1f3efc362954ce9e539dbb7b948743a8e7a980abdcd8d709a8c5faddce469811d4d6d1970ebf565d91dfc7347864cc996fae1757&quot;.
What is this format? How do I convert it to the Addr_test- string?</p>
<p>Thank you in advance!</p>
 2068: <p>It is hex encoded byteString. You can use the Cardano serialization lib browser
<a href="https://www.npmjs.com/package/@emurgo/cardano-serialization-lib-browser" rel="nofollow noreferrer">https://www.npmjs.com/package/@emurgo/cardano-serialization-lib-browser</a></p>
<p>And the following code in javascript</p>
<pre><code>const addressBech32 = async () =&gt; {
  await Loader.load();
  const address = (await window.cardano.getUsedAddresses())[0];
  return Loader.Cardano.Address.from_bytes(
    Buffer.from(address, &quot;hex&quot;)
  ).to_bech32();
};
</code></pre>
<p>Where Loader is my loader to the above Library :) the Address class has a method for converting Hex encoded bytes to Address Bech 32 :</p>
<pre><code>class Loader {
  async load() {
    if (this._wasm) {
      return;
    }
    /**
     * @private
     */
    this._wasm = await import(
      &quot;./@emurgo/cardano-serialization-lib-browser/cardano_serialization_lib_bg&quot;
    );
  }

  get Cardano() {
    return this._wasm;
  }
}

export default new Loader();
</code></pre>
