Closed pablosymc closed 1 year ago
I don't understand step 2. Is this coin selection? In Lucid this happens automatically. Here's an example:
// .. instantiated Lucid
lucid.selectWalletFrom({address});
const tx = await lucid.newTx()
.payToAddress(site_address, {lovelace: 2000000n})
.addSigner(address)
.addSigner(site_address)
.complete();
const cborTx = tx.toString();
// .. sending cbor to signer (address)
const signature = await lucid.fromTx(cborTx).partialSign();
// .. sending cbor to signer (site_address)
const signature2 = await lucid.fromTx(cborTx).partialSign();
// .. assemble and submit
const txHash = await lucid.fromTx(cborTx).assemble([signature, signature2])
.complete()
.then(tx => tx.submit())
Thanks so much @alessandrokonrad. Appreciate your time! :)
I'm coming from the Mesh SDK where doing a multi sig transaction is pretty simple. Essentially on the backend the steps to do a simple multi sig transaction are:
1) Get the user's stake -> Look up all the UTXO's using Blockfrost (for each address)
2) Find
x
number of UTXO's that combined have 2 ADA in them3) Then I set the tx inputs to use in the transaction:
4) Send the 2 ADA to my wallet and send the change back to the user
5) Set the required signers and build the tx
At this point you would send the
unsignedTx
CBOR to the user for them to sign and then send that CBOR back to the backend to also sign, then submit the tx.What would this look like with Lucid? I haven't been able to find any substantial examples of how I would accomplish this with Lucid (without using a Contract).
Any guidance would be appreciated!