Skip to content

Commit

Permalink
chore: rename pendingTransactions to pendingIncomingTransactions
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleSamtoshi committed Nov 14, 2023
1 parent 682702d commit 7861729
Show file tree
Hide file tree
Showing 20 changed files with 112 additions and 99 deletions.
20 changes: 10 additions & 10 deletions core/api/dev/apollo-federation/supergraph.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ interface Account
level: AccountLevel!
limits: AccountLimits!
notificationSettings: NotificationSettings!
pendingTransactions(walletIds: [WalletId]): [Transaction!]!
pendingIncomingTransactions(walletIds: [WalletId]): [Transaction!]!
realtimePrice: RealtimePrice!
transactions(
"""Returns the items in the list that come after the specified cursor."""
Expand Down Expand Up @@ -251,8 +251,8 @@ type BTCWallet implements Wallet

"""An unconfirmed incoming onchain balance."""
pendingIncomingBalance: SignedAmount!
pendingTransactions: [Transaction!]!
pendingTransactionsByAddress(
pendingIncomingTransactions: [Transaction!]!
pendingIncomingTransactionsByAddress(
"""Returns the items that include this address."""
address: OnChainAddress!
): [Transaction!]!
Expand Down Expand Up @@ -395,7 +395,7 @@ type ConsumerAccount implements Account
level: AccountLevel!
limits: AccountLimits!
notificationSettings: NotificationSettings!
pendingTransactions(walletIds: [WalletId]): [Transaction!]!
pendingIncomingTransactions(walletIds: [WalletId]): [Transaction!]!

"""List the quiz questions of the consumer account"""
quiz: [Quiz!]!
Expand Down Expand Up @@ -1749,8 +1749,8 @@ type UsdWallet implements Wallet

"""An unconfirmed incoming onchain balance."""
pendingIncomingBalance: SignedAmount!
pendingTransactions: [Transaction!]!
pendingTransactionsByAddress(
pendingIncomingTransactions: [Transaction!]!
pendingIncomingTransactionsByAddress(
"""Returns the items that include this address."""
address: OnChainAddress!
): [Transaction!]!
Expand Down Expand Up @@ -2077,20 +2077,20 @@ interface Wallet
pendingIncomingBalance: SignedAmount!

"""
Pending OnChain transactions. When transactions
Pending incoming OnChain transactions. When transactions
are confirmed they will receive a new id and be found in the transactions
list. Transactions are ordered anti-chronologically,
ie: the newest transaction will be first
"""
pendingTransactions: [Transaction!]!
pendingIncomingTransactions: [Transaction!]!

"""
Pending OnChain transactions. When transactions
Pending incoming OnChain transactions. When transactions
are confirmed they will receive a new id and be found in the transactions
list. Transactions are ordered anti-chronologically,
ie: the newest transaction will be first
"""
pendingTransactionsByAddress(
pendingIncomingTransactionsByAddress(
"""Returns the items that include this address."""
address: OnChainAddress!
): [Transaction!]!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { getPendingOnChainTransactionsForWallets } from "../wallets/get-pending-onchain-transactions-for-wallets"
import { getPendingIncomingOnChainTransactionsForWallets } from "../wallets/get-pending-incoming-on-chain-transactions-for-wallets"

import { RepositoryError } from "@/domain/errors"
import { checkedToWalletId } from "@/domain/wallets"
import { WalletsRepository } from "@/services/mongoose"

export const getPendingOnChainTransactionsForAccountByWalletIds = async ({
export const getPendingIncomingOnChainTransactionsForAccountByWalletIds = async ({
account,
walletIds,
}: {
Expand All @@ -17,7 +17,7 @@ export const getPendingOnChainTransactionsForAccountByWalletIds = async ({
if (accountWallets instanceof RepositoryError) return accountWallets

if (!walletIds) {
return getPendingOnChainTransactionsForWallets({ wallets: accountWallets })
return getPendingIncomingOnChainTransactionsForWallets({ wallets: accountWallets })
}

const checkedWalletIds: WalletId[] = []
Expand All @@ -32,5 +32,5 @@ export const getPendingOnChainTransactionsForAccountByWalletIds = async ({
checkedWalletIds.includes(wallet.id),
)

return getPendingOnChainTransactionsForWallets({ wallets: selectedWallets })
return getPendingIncomingOnChainTransactionsForWallets({ wallets: selectedWallets })
}
2 changes: 1 addition & 1 deletion core/api/src/app/accounts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export * from "./disable-notification-category"
export * from "./enable-notification-category"
export * from "./enable-notification-channel"
export * from "./disable-notification-channel"
export * from "./get-pending-onchain-transactions-for-account"
export * from "./get-pending-incoming-on-chain-transactions-for-account"
export * from "./get-invoices-for-account"

const accounts = AccountsRepository()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { WalletOnChainPendingReceiveRepository } from "@/services/mongoose"
import { IncomingOnChainTxHandler } from "@/domain/bitcoin/onchain/incoming-tx-handler"
import { WalletCurrency, ZERO_CENTS, ZERO_SATS } from "@/domain/shared"

export const getPendingOnChainBalanceForWallets = async <S extends WalletCurrency>(
export const getPendingIncomingOnChainBalanceForWallets = async <
S extends WalletCurrency,
>(
wallets: Wallet[],
): Promise<{ [key: WalletId]: PaymentAmount<S> } | ApplicationError> => {
const pendingIncoming = await WalletOnChainPendingReceiveRepository().listByWalletIds({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CouldNotFindError } from "@/domain/errors"

import { WalletOnChainPendingReceiveRepository } from "@/services/mongoose"

export const getPendingTransactionsForWalletsByAddresses = async ({
export const getPendingIncomingOnChainTransactionsForWalletsByAddresses = async ({
wallets,
addresses,
}: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CouldNotFindError } from "@/domain/errors"

import { WalletOnChainPendingReceiveRepository } from "@/services/mongoose"

export const getPendingOnChainTransactionsForWallets = async ({
export const getPendingIncomingOnChainTransactionsForWallets = async ({
wallets,
}: {
wallets: Wallet[]
Expand Down
6 changes: 3 additions & 3 deletions core/api/src/app/wallets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export * from "./create-on-chain-address"
export * from "./get-balance-for-wallet"
export * from "./get-last-on-chain-address"
export * from "./get-on-chain-fee"
export * from "./get-pending-onchain-balance-for-wallet"
export * from "./get-pending-incoming-on-chain-balance-for-wallet"
export * from "./get-transaction-by-id"
export * from "./get-transactions-by-addresses"
export * from "./get-transactions-by-hash"
Expand All @@ -17,8 +17,8 @@ export * from "./update-legacy-on-chain-receipt"
export * from "./update-pending-invoices"
export * from "./validate"
export * from "./get-invoice-for-wallet-by-hash"
export * from "./get-pending-onchain-transactions-for-wallets"
export * from "./get-pending-transactions-by-addresses"
export * from "./get-pending-incoming-on-chain-transactions-for-wallets"
export * from "./get-pending-incoming-on-chain-transactions-by-addresses"
export * from "./get-invoices-for-wallets"

import { WalletsRepository } from "@/services/mongoose"
Expand Down
16 changes: 8 additions & 8 deletions core/api/src/graphql/admin/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ type BTCWallet implements Wallet {

"""An unconfirmed incoming onchain balance."""
pendingIncomingBalance: SignedAmount!
pendingTransactions: [Transaction!]!
pendingTransactionsByAddress(
pendingIncomingTransactions: [Transaction!]!
pendingIncomingTransactionsByAddress(
"""Returns the items that include this address."""
address: OnChainAddress!
): [Transaction!]!
Expand Down Expand Up @@ -479,8 +479,8 @@ type UsdWallet implements Wallet {

"""An unconfirmed incoming onchain balance."""
pendingIncomingBalance: SignedAmount!
pendingTransactions: [Transaction!]!
pendingTransactionsByAddress(
pendingIncomingTransactions: [Transaction!]!
pendingIncomingTransactionsByAddress(
"""Returns the items that include this address."""
address: OnChainAddress!
): [Transaction!]!
Expand Down Expand Up @@ -555,20 +555,20 @@ interface Wallet {
pendingIncomingBalance: SignedAmount!

"""
Pending OnChain transactions. When transactions
Pending incoming OnChain transactions. When transactions
are confirmed they will receive a new id and be found in the transactions
list. Transactions are ordered anti-chronologically,
ie: the newest transaction will be first
"""
pendingTransactions: [Transaction!]!
pendingIncomingTransactions: [Transaction!]!

"""
Pending OnChain transactions. When transactions
Pending incoming OnChain transactions. When transactions
are confirmed they will receive a new id and be found in the transactions
list. Transactions are ordered anti-chronologically,
ie: the newest transaction will be first
"""
pendingTransactionsByAddress(
pendingIncomingTransactionsByAddress(
"""Returns the items that include this address."""
address: OnChainAddress!
): [Transaction!]!
Expand Down
20 changes: 10 additions & 10 deletions core/api/src/graphql/public/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface Account {
level: AccountLevel!
limits: AccountLimits!
notificationSettings: NotificationSettings!
pendingTransactions(walletIds: [WalletId]): [Transaction!]!
pendingIncomingTransactions(walletIds: [WalletId]): [Transaction!]!
realtimePrice: RealtimePrice!
transactions(
"""Returns the items in the list that come after the specified cursor."""
Expand Down Expand Up @@ -156,8 +156,8 @@ type BTCWallet implements Wallet {

"""An unconfirmed incoming onchain balance."""
pendingIncomingBalance: SignedAmount!
pendingTransactions: [Transaction!]!
pendingTransactionsByAddress(
pendingIncomingTransactions: [Transaction!]!
pendingIncomingTransactionsByAddress(
"""Returns the items that include this address."""
address: OnChainAddress!
): [Transaction!]!
Expand Down Expand Up @@ -278,7 +278,7 @@ type ConsumerAccount implements Account {
level: AccountLevel!
limits: AccountLimits!
notificationSettings: NotificationSettings!
pendingTransactions(walletIds: [WalletId]): [Transaction!]!
pendingIncomingTransactions(walletIds: [WalletId]): [Transaction!]!

"""List the quiz questions of the consumer account"""
quiz: [Quiz!]!
Expand Down Expand Up @@ -1358,8 +1358,8 @@ type UsdWallet implements Wallet {

"""An unconfirmed incoming onchain balance."""
pendingIncomingBalance: SignedAmount!
pendingTransactions: [Transaction!]!
pendingTransactionsByAddress(
pendingIncomingTransactions: [Transaction!]!
pendingIncomingTransactionsByAddress(
"""Returns the items that include this address."""
address: OnChainAddress!
): [Transaction!]!
Expand Down Expand Up @@ -1619,20 +1619,20 @@ interface Wallet {
pendingIncomingBalance: SignedAmount!

"""
Pending OnChain transactions. When transactions
Pending incoming OnChain transactions. When transactions
are confirmed they will receive a new id and be found in the transactions
list. Transactions are ordered anti-chronologically,
ie: the newest transaction will be first
"""
pendingTransactions: [Transaction!]!
pendingIncomingTransactions: [Transaction!]!

"""
Pending OnChain transactions. When transactions
Pending incoming OnChain transactions. When transactions
are confirmed they will receive a new id and be found in the transactions
list. Transactions are ordered anti-chronologically,
ie: the newest transaction will be first
"""
pendingTransactionsByAddress(
pendingIncomingTransactionsByAddress(
"""Returns the items that include this address."""
address: OnChainAddress!
): [Transaction!]!
Expand Down
2 changes: 1 addition & 1 deletion core/api/src/graphql/public/types/abstract/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const IAccount = GT.Interface({
},
},
},
pendingTransactions: {
pendingIncomingTransactions: {
type: GT.NonNullList(Transaction),
args: {
walletIds: {
Expand Down
4 changes: 2 additions & 2 deletions core/api/src/graphql/public/types/object/business-account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ const BusinessAccount = GT.Object({
)
},
},
pendingTransactions: {
pendingIncomingTransactions: {
type: GT.NonNullList(Transaction),
args: {
walletIds: {
Expand All @@ -171,7 +171,7 @@ const BusinessAccount = GT.Object({
resolve: async (source, args) => {
const { walletIds } = args
const transactions =
await Accounts.getPendingOnChainTransactionsForAccountByWalletIds({
await Accounts.getPendingIncomingOnChainTransactionsForAccountByWalletIds({
account: source,
walletIds,
})
Expand Down
4 changes: 2 additions & 2 deletions core/api/src/graphql/public/types/object/consumer-account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ const ConsumerAccount = GT.Object<Account, GraphQLPublicContextAuth>({
)
},
},
pendingTransactions: {
pendingIncomingTransactions: {
type: GT.NonNullList(Transaction),
args: {
walletIds: {
Expand All @@ -220,7 +220,7 @@ const ConsumerAccount = GT.Object<Account, GraphQLPublicContextAuth>({
const { walletIds } = args

const transactions =
await Accounts.getPendingOnChainTransactionsForAccountByWalletIds({
await Accounts.getPendingIncomingOnChainTransactionsForAccountByWalletIds({
account: source,
walletIds,
})
Expand Down
8 changes: 4 additions & 4 deletions core/api/src/graphql/shared/types/abstract/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ const IWallet = GT.Interface({
},
},
},
pendingTransactionsByAddress: {
description: dedent`Pending OnChain transactions. When transactions
pendingIncomingTransactionsByAddress: {
description: dedent`Pending incoming OnChain transactions. When transactions
are confirmed they will receive a new id and be found in the transactions
list. Transactions are ordered anti-chronologically,
ie: the newest transaction will be first`,
Expand All @@ -61,8 +61,8 @@ const IWallet = GT.Interface({
},
},
},
pendingTransactions: {
description: dedent`Pending OnChain transactions. When transactions
pendingIncomingTransactions: {
description: dedent`Pending incoming OnChain transactions. When transactions
are confirmed they will receive a new id and be found in the transactions
list. Transactions are ordered anti-chronologically,
ie: the newest transaction will be first`,
Expand Down
24 changes: 14 additions & 10 deletions core/api/src/graphql/shared/types/object/btc-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ const BtcWallet = GT.Object<Wallet>({
type: GT.NonNull(SignedAmount),
description: "An unconfirmed incoming onchain balance.",
resolve: async (source) => {
const balanceSats = await Wallets.getPendingOnChainBalanceForWallets([source])
const balanceSats = await Wallets.getPendingIncomingOnChainBalanceForWallets([
source,
])
if (balanceSats instanceof Error) {
throw mapError(balanceSats)
}
Expand Down Expand Up @@ -92,19 +94,20 @@ const BtcWallet = GT.Object<Wallet>({
},
description: "A list of BTC transactions associated with this wallet.",
},
pendingTransactions: {
pendingIncomingTransactions: {
type: GT.NonNullList(Transaction),
resolve: async (source) => {
const transactions = await Wallets.getPendingOnChainTransactionsForWallets({
wallets: [source],
})
const transactions =
await Wallets.getPendingIncomingOnChainTransactionsForWallets({
wallets: [source],
})
if (transactions instanceof Error) {
throw mapError(transactions)
}
return transactions
},
},
pendingTransactionsByAddress: {
pendingIncomingTransactionsByAddress: {
type: GT.NonNullList(Transaction),
args: {
address: {
Expand All @@ -116,10 +119,11 @@ const BtcWallet = GT.Object<Wallet>({
const { address } = args
if (address instanceof Error) throw address

const transactions = await Wallets.getPendingTransactionsForWalletsByAddresses({
wallets: [source],
addresses: [address],
})
const transactions =
await Wallets.getPendingIncomingOnChainTransactionsForWalletsByAddresses({
wallets: [source],
addresses: [address],
})
if (transactions instanceof Error) {
throw mapError(transactions)
}
Expand Down
Loading

0 comments on commit 7861729

Please sign in to comment.