diff --git a/api/models.go b/api/models.go index f7583030..b6668f43 100644 --- a/api/models.go +++ b/api/models.go @@ -213,6 +213,7 @@ type Transaction struct { AppId *uint `json:"appId"` Metadata Metadata `json:"metadata,omitempty"` Boostagram *Boostagram `json:"boostagram,omitempty"` + IsPending bool `json:"isPending,omitempty"` } type Metadata = map[string]interface{} diff --git a/api/transactions.go b/api/transactions.go index 49900f1f..8c255940 100644 --- a/api/transactions.go +++ b/api/transactions.go @@ -6,6 +6,7 @@ import ( "errors" "time" + "github.com/getAlby/hub/constants" "github.com/getAlby/hub/logger" "github.com/getAlby/hub/transactions" "github.com/sirupsen/logrus" @@ -38,7 +39,7 @@ func (api *api) ListTransactions(ctx context.Context, limit uint64, offset uint6 if api.svc.GetLNClient() == nil { return nil, errors.New("LNClient not started") } - transactions, err := api.svc.GetTransactionsService().ListTransactions(ctx, 0, 0, limit, offset, false, nil, api.svc.GetLNClient(), nil) + transactions, err := api.svc.GetTransactionsService().ListTransactions(ctx, 0, 0, limit, offset, true, false, nil, api.svc.GetLNClient(), nil) if err != nil { return nil, err } @@ -111,6 +112,7 @@ func toApiTransaction(transaction *transactions.Transaction) *Transaction { SettledAt: settledAt, Metadata: metadata, Boostagram: boostagram, + IsPending: transaction.State == constants.TRANSACTION_STATE_PENDING, } } diff --git a/frontend/src/components/TransactionItem.tsx b/frontend/src/components/TransactionItem.tsx index c8a32367..4298b958 100644 --- a/frontend/src/components/TransactionItem.tsx +++ b/frontend/src/components/TransactionItem.tsx @@ -86,7 +86,15 @@ function TransactionItem({ tx }: Props) {
- {app ? app.name : type == "incoming" ? "Received" : "Sent"} + {tx.isPending + ? type == "incoming" + ? "Receiving" + : "Sending" + : app + ? app.name + : type == "incoming" + ? "Received" + : "Sent"}
{dayjs(tx.settledAt).fromNow()}
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index 3cb04a58..b6471b1f 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -385,6 +385,7 @@ export type Transaction = {
settledAt: string | undefined;
metadata?: Record