0

how I can get users collateral address from wallet?

I am using nft-maker-pro for creating a small NFT market place. I need collateral address for that like https://d-wallet-playground.yellowhouse.gmbh/wallet this.

3 Answers 3

0

I am not familiar with the tool but the collateral is usually provided by whoever is creating the transaction to be submitted. And as long as a smart contract isn't being run and fails during validation your collateral is save.

So if you use a light wallet like nami send yourself 5-10 ADA and use that as collateral.

2
  • Is there any way to get that address? Apr 13, 2022 at 18:39
  • It's your own wallet address. You can just copy it when you have Nami installed and setup.
    – Will
    Apr 14, 2022 at 5:58
0

According to CIP-30

"api.getCollateral()"

so you can get it in your react application by using:

const api = await window.cardano[WALLET-NAME].enable()
const changeAddress = await api.getCollateral()
0

The easiest way to get a collateral UTXO is to use a library like Helios which is both an on-chain smart contract Plutus compiler and an off-chain transaction builder. Helios has some convenience wrappers/helpers for working with CIP30 spec so you don’t have to do the CBOR conversions for example.

Here is the code.


    // Determine the UTXO used for collateral
    const colatUtxo = await walletHelper.pickCollateral();
    
    tx.addCollateral(colatUtxo);

Or if you need the change wallet address, you can use.

// Get change address
const changeAddr = await walletHelper.changeAddress;

Check out the full source code here in my Helios examples repo: https://github.com/lley154/helios-examples/blob/main/nft/pages/index.tsx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.