-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDK - Tx Storage & Ark SDK func update #320
base: master
Are you sure you want to change the base?
Conversation
Cli fix config
- Add listenForVtxos function to poll server for new VTXOs - Implement listenToVtxoChan to process and insert VTXOs and transactions - Handle both spendable and spent VTXOs, as well as boarding transactions - Use goroutines and channels for asynchronous processing - Add error handling and logging for better debugging
is the title correct? Only touches the covenant version? We should mention a new big feature like adding a SQLite storage. Also how that will impact WASM wrapper? |
@sekulicd we made some changes to covenant's GetTransactionHistory() yesterday. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to start with KV implementation of the repos (badger) instead of sqlite. We'll make it available once the persistency layer of the SDK client is validated.
explorer explorer.Explorer | ||
client client.ASPClient | ||
|
||
vtxosChan chan map[spent]client.Vtxo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain why map[spent]client.Vtxo
?
func (a *arkClient) ListVtxos( | ||
ctx context.Context, | ||
) (spendableVtxos, spentVtxos []client.Vtxo, err error) { | ||
offchainAddrs, _, _, err := a.wallet.GetAddresses(ctx) | ||
if err != nil { | ||
return | ||
} | ||
|
||
for _, addr := range offchainAddrs { | ||
spendable, spent, err := a.client.ListVtxos(ctx, addr) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
spendableVtxos = append(spendableVtxos, spendable...) | ||
spentVtxos = append(spentVtxos, spent...) | ||
} | ||
|
||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after syncing with master this must be dropped
This adds storage for transactions and vtxos into SDK sqlite storage.
This refactors ark sdk api by adding GetTransactionEventChannel which can be used to listen for new events, it replaces PaymentNotification that was discussed before, this to be closed.
It also updates GetTransactionHistory to read txs from db.
Main idea is to add listenForVtxos function that polls the server every 1(or smtn diff) seconds for new VTXOs,
Func listenToVtxoChan will listen for new vtxos and with help of current state in db will create tx history by using existing
vtxosToTxsCovenant/vtxosToTxsCovenantless funcs.
I pushed changes to the same PR in which i emphasised potential bug in how we handle covenant transaction history, PSB:
@bordalix let me know if u agree that this is bug.
@tiero @louisinger @bordalix @altafan please review.