[SDK] Export ListVtxos (#282)

This commit is contained in:
Pietralberto Mazza
2024-08-30 17:30:47 +02:00
committed by GitHub
parent c183f99244
commit e46f2ce392
2 changed files with 22 additions and 0 deletions

View File

@@ -209,6 +209,26 @@ func (a *arkClient) Receive(ctx context.Context) (string, string, error) {
return offchainAddr, onchainAddr, nil
}
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
}
func (a *arkClient) ping(
ctx context.Context, paymentID string,
) func() {