mirror of
https://github.com/aljazceru/ark.git
synced 2026-01-23 05:34:24 +01:00
Add support for Out Of Round txs (#359)
* [common] rework address encoding * new address encoding * replace offchain address by vtxo output key in DB * merge migrations files into init one * fix txbuilder fixtures * fix transaction events * OOR scheme * fix conflicts * [sdk] OOR * update WASM wrappers * revert renaming * revert API changes * update parser.go * fix vtxosToTxsCovenantless * add settled and spent in Utxo and Transaction * Fixes (#5) * Revert unneeded changes and rename claim to settle * Revert changes to wasm and rename claim to settle --------- Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
This commit is contained in:
@@ -84,13 +84,13 @@ func main() {
|
||||
log.Infof("alice onchain balance: %d", aliceBalance.OnchainBalance.SpendableAmount)
|
||||
log.Infof("alice offchain balance: %d", aliceBalance.OffchainBalance.Total)
|
||||
|
||||
log.Infof("alice claiming onboarding funds...")
|
||||
txid, err := aliceArkClient.Claim(ctx)
|
||||
log.Infof("alice is settling the onboard funds...")
|
||||
txid, err := aliceArkClient.Settle(ctx)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Infof("alice claimed onboarding funds in round %s", txid)
|
||||
log.Infof("alice settled the onboard funds in round %s", txid)
|
||||
|
||||
fmt.Println("")
|
||||
log.Info("bob is setting up his ark wallet...")
|
||||
@@ -128,7 +128,7 @@ func main() {
|
||||
fmt.Println("")
|
||||
log.Infof("alice is sending %d sats to bob offchain...", amount)
|
||||
|
||||
if _, err = aliceArkClient.SendAsync(ctx, false, receivers); err != nil {
|
||||
if _, err = aliceArkClient.SendOffChain(ctx, false, receivers); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -158,13 +158,13 @@ func main() {
|
||||
log.Infof("bob offchain balance: %d", bobBalance.OffchainBalance.Total)
|
||||
|
||||
fmt.Println("")
|
||||
log.Info("bob is claiming the incoming payment...")
|
||||
roundTxid, err := bobArkClient.Claim(ctx)
|
||||
log.Info("bob is settling the received funds...")
|
||||
roundTxid, err := bobArkClient.Settle(ctx)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Infof("bob claimed the incoming payment in round %s", roundTxid)
|
||||
log.Infof("bob settled the received funds in round %s", roundTxid)
|
||||
|
||||
time.Sleep(500 * time.Second)
|
||||
}
|
||||
|
||||
@@ -90,19 +90,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function claimVtxos() {
|
||||
async function settleVtxos() {
|
||||
const password = document.getElementById("c_password").value;
|
||||
if (!password) {
|
||||
logMessage("Claim error: password is required");
|
||||
logMessage("Settle error: password is required");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await unlock(password);
|
||||
const txID = await claim();
|
||||
logMessage("Claimed money with tx ID: " + txID);
|
||||
const txID = await settle();
|
||||
logMessage("Settled money with tx ID: " + txID);
|
||||
} catch (err) {
|
||||
logMessage("Claim error: " + err.message);
|
||||
logMessage("Settle error: " + err.message);
|
||||
} finally {
|
||||
await lock(password);
|
||||
}
|
||||
@@ -166,7 +166,7 @@
|
||||
<input type="password" id="s_password" placeholder="password">
|
||||
</div>
|
||||
<div>
|
||||
<button onclick="claimVtxos()">Claim</button>
|
||||
<button onclick="settleVtxos()">Settle</button>
|
||||
<input type="password" id="c_password" placeholder="password">
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user