Skip to content

Commit 1b2930f

Browse files
authored
[SDK] Update tx/vtxo management in tx feed (#468)
* Update bg handler for tx feed * Fix + debug logs * Update store interface * Drop Transaction.SpentBy * Fixes * Fixes * Add log * Fixes * Fixes * Fix * Rename api
1 parent eb5e4d5 commit 1b2930f

11 files changed

+448
-372
lines changed

pkg/client-sdk/ark_sdk.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type ArkClient interface {
3232
ListVtxos(ctx context.Context) (spendable, spent []client.Vtxo, err error)
3333
Dump(ctx context.Context) (seed string, err error)
3434
GetTransactionHistory(ctx context.Context) ([]types.Transaction, error)
35-
GetTransactionEventChannel() chan types.TransactionEvent
35+
GetTransactionChannel() chan types.Transaction
3636
RedeemNotes(ctx context.Context, notes []string, opts ...Option) (string, error)
3737
SetNostrNotificationRecipient(ctx context.Context, nostrRecipient string) error
3838
SignTransaction(ctx context.Context, tx string) (string, error)

pkg/client-sdk/client.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (a *arkClient) Receive(ctx context.Context) (string, string, error) {
9999
return offchainAddr.Address, boardingAddr.Address, nil
100100
}
101101

102-
func (a *arkClient) GetTransactionEventChannel() chan types.TransactionEvent {
102+
func (a *arkClient) GetTransactionChannel() chan types.Transaction {
103103
return a.store.TransactionStore().GetEventChannel()
104104
}
105105

@@ -373,10 +373,6 @@ func getWalletStore(storeType, datadir string) (walletstore.WalletStore, error)
373373
}
374374
}
375375

376-
func getCreatedAtFromExpiry(vtxoTreeExpiry common.RelativeLocktime, expiry time.Time) time.Time {
377-
return expiry.Add(-time.Duration(vtxoTreeExpiry.Seconds()) * time.Second)
378-
}
379-
380376
func filterByOutpoints(vtxos []client.Vtxo, outpoints []client.Outpoint) []client.Vtxo {
381377
filtered := make([]client.Vtxo, 0, len(vtxos))
382378
for _, vtxo := range vtxos {

pkg/client-sdk/covenant_client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1827,7 +1827,7 @@ func vtxosToTxsCovenant(
18271827
},
18281828
Amount: uint64(math.Abs(float64(amount))),
18291829
Type: txType,
1830-
CreatedAt: getCreatedAtFromExpiry(vtxoTreeExpiry, v.ExpiresAt),
1830+
CreatedAt: v.CreatedAt,
18311831
})
18321832
}
18331833

0 commit comments

Comments
 (0)