I would like to create a simple escrow account with two preauthorized timebound transactions, but not sure how to approach the problem. I am fairly new to Stellar, so correct me if I am wrong.
I have to build two transactions with different destinations but same sequence number (one higher than current on the acc). Third transaction will contain 2 signers with tx1.hash()
and tx2.hash()
with some weight e.g. 2 on both. This one will be signed and submitted.
How can I send same preauth transaction in the future so it matches the signer key? Do i have to store the original transactions as XDR? I am using stellar-sdk, building both works, signers are also getting created. Just need to get on the right track, maybe whole approach is completely wrong.
let encodedEnvelope = transaction.toEnvelope().toXDR().toString("base64")
and use in the future aslet tx2 = new StellarSdk.Transaction(encodedEnvelope)
? If above is correct, how do I sign?tx2.sign(keypair)
or using the hash?