diff --git a/core/api/dev/apollo-federation/supergraph.graphql b/core/api/dev/apollo-federation/supergraph.graphql index c25e02d22d..861c96d64b 100644 --- a/core/api/dev/apollo-federation/supergraph.graphql +++ b/core/api/dev/apollo-federation/supergraph.graphql @@ -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.""" @@ -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!]! @@ -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!]! @@ -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!]! @@ -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!]! diff --git a/core/api/src/app/accounts/get-pending-onchain-transactions-for-account.ts b/core/api/src/app/accounts/get-pending-incoming-on-chain-transactions-for-account.ts similarity index 69% rename from core/api/src/app/accounts/get-pending-onchain-transactions-for-account.ts rename to core/api/src/app/accounts/get-pending-incoming-on-chain-transactions-for-account.ts index d2e92a9275..d6514479d8 100644 --- a/core/api/src/app/accounts/get-pending-onchain-transactions-for-account.ts +++ b/core/api/src/app/accounts/get-pending-incoming-on-chain-transactions-for-account.ts @@ -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, }: { @@ -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[] = [] @@ -32,5 +32,5 @@ export const getPendingOnChainTransactionsForAccountByWalletIds = async ({ checkedWalletIds.includes(wallet.id), ) - return getPendingOnChainTransactionsForWallets({ wallets: selectedWallets }) + return getPendingIncomingOnChainTransactionsForWallets({ wallets: selectedWallets }) } diff --git a/core/api/src/app/accounts/index.ts b/core/api/src/app/accounts/index.ts index 529d6a2710..f22232b2f1 100644 --- a/core/api/src/app/accounts/index.ts +++ b/core/api/src/app/accounts/index.ts @@ -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() diff --git a/core/api/src/app/wallets/get-pending-onchain-balance-for-wallet.ts b/core/api/src/app/wallets/get-pending-incoming-on-chain-balance-for-wallet.ts similarity index 93% rename from core/api/src/app/wallets/get-pending-onchain-balance-for-wallet.ts rename to core/api/src/app/wallets/get-pending-incoming-on-chain-balance-for-wallet.ts index 140223e949..09dfba8287 100644 --- a/core/api/src/app/wallets/get-pending-onchain-balance-for-wallet.ts +++ b/core/api/src/app/wallets/get-pending-incoming-on-chain-balance-for-wallet.ts @@ -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 ( +export const getPendingIncomingOnChainBalanceForWallets = async < + S extends WalletCurrency, +>( wallets: Wallet[], ): Promise<{ [key: WalletId]: PaymentAmount } | ApplicationError> => { const pendingIncoming = await WalletOnChainPendingReceiveRepository().listByWalletIds({ diff --git a/core/api/src/app/wallets/get-pending-transactions-by-addresses.ts b/core/api/src/app/wallets/get-pending-incoming-on-chain-transactions-by-addresses.ts similarity index 87% rename from core/api/src/app/wallets/get-pending-transactions-by-addresses.ts rename to core/api/src/app/wallets/get-pending-incoming-on-chain-transactions-by-addresses.ts index 5e77cdc418..db155f5ba9 100644 --- a/core/api/src/app/wallets/get-pending-transactions-by-addresses.ts +++ b/core/api/src/app/wallets/get-pending-incoming-on-chain-transactions-by-addresses.ts @@ -2,7 +2,7 @@ import { CouldNotFindError } from "@/domain/errors" import { WalletOnChainPendingReceiveRepository } from "@/services/mongoose" -export const getPendingTransactionsForWalletsByAddresses = async ({ +export const getPendingIncomingOnChainTransactionsForWalletsByAddresses = async ({ wallets, addresses, }: { diff --git a/core/api/src/app/wallets/get-pending-onchain-transactions-for-wallets.ts b/core/api/src/app/wallets/get-pending-incoming-on-chain-transactions-for-wallets.ts similarity index 87% rename from core/api/src/app/wallets/get-pending-onchain-transactions-for-wallets.ts rename to core/api/src/app/wallets/get-pending-incoming-on-chain-transactions-for-wallets.ts index f0edab562f..64e6613254 100644 --- a/core/api/src/app/wallets/get-pending-onchain-transactions-for-wallets.ts +++ b/core/api/src/app/wallets/get-pending-incoming-on-chain-transactions-for-wallets.ts @@ -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[] diff --git a/core/api/src/app/wallets/index.ts b/core/api/src/app/wallets/index.ts index 94ebd14bc7..98345aeebc 100644 --- a/core/api/src/app/wallets/index.ts +++ b/core/api/src/app/wallets/index.ts @@ -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" @@ -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" diff --git a/core/api/src/graphql/admin/schema.graphql b/core/api/src/graphql/admin/schema.graphql index 61a0fe6501..9455bd42f5 100644 --- a/core/api/src/graphql/admin/schema.graphql +++ b/core/api/src/graphql/admin/schema.graphql @@ -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!]! @@ -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!]! @@ -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!]! diff --git a/core/api/src/graphql/public/schema.graphql b/core/api/src/graphql/public/schema.graphql index 0e98dee6fe..a10647a3d0 100644 --- a/core/api/src/graphql/public/schema.graphql +++ b/core/api/src/graphql/public/schema.graphql @@ -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.""" @@ -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!]! @@ -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!]! @@ -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!]! @@ -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!]! diff --git a/core/api/src/graphql/public/types/abstract/account.ts b/core/api/src/graphql/public/types/abstract/account.ts index c084ef14c4..73d3e0ec67 100644 --- a/core/api/src/graphql/public/types/abstract/account.ts +++ b/core/api/src/graphql/public/types/abstract/account.ts @@ -62,7 +62,7 @@ const IAccount = GT.Interface({ }, }, }, - pendingTransactions: { + pendingIncomingTransactions: { type: GT.NonNullList(Transaction), args: { walletIds: { diff --git a/core/api/src/graphql/public/types/object/business-account.ts b/core/api/src/graphql/public/types/object/business-account.ts index d7506ca6b7..9d7ab4733c 100644 --- a/core/api/src/graphql/public/types/object/business-account.ts +++ b/core/api/src/graphql/public/types/object/business-account.ts @@ -161,7 +161,7 @@ const BusinessAccount = GT.Object({ ) }, }, - pendingTransactions: { + pendingIncomingTransactions: { type: GT.NonNullList(Transaction), args: { walletIds: { @@ -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, }) diff --git a/core/api/src/graphql/public/types/object/consumer-account.ts b/core/api/src/graphql/public/types/object/consumer-account.ts index 47428567c2..9730763390 100644 --- a/core/api/src/graphql/public/types/object/consumer-account.ts +++ b/core/api/src/graphql/public/types/object/consumer-account.ts @@ -209,7 +209,7 @@ const ConsumerAccount = GT.Object({ ) }, }, - pendingTransactions: { + pendingIncomingTransactions: { type: GT.NonNullList(Transaction), args: { walletIds: { @@ -220,7 +220,7 @@ const ConsumerAccount = GT.Object({ const { walletIds } = args const transactions = - await Accounts.getPendingOnChainTransactionsForAccountByWalletIds({ + await Accounts.getPendingIncomingOnChainTransactionsForAccountByWalletIds({ account: source, walletIds, }) diff --git a/core/api/src/graphql/shared/types/abstract/wallet.ts b/core/api/src/graphql/shared/types/abstract/wallet.ts index b896ee86bc..3e5998766d 100644 --- a/core/api/src/graphql/shared/types/abstract/wallet.ts +++ b/core/api/src/graphql/shared/types/abstract/wallet.ts @@ -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`, @@ -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`, diff --git a/core/api/src/graphql/shared/types/object/btc-wallet.ts b/core/api/src/graphql/shared/types/object/btc-wallet.ts index 5fca6fca9e..fbec59791e 100644 --- a/core/api/src/graphql/shared/types/object/btc-wallet.ts +++ b/core/api/src/graphql/shared/types/object/btc-wallet.ts @@ -57,7 +57,9 @@ const BtcWallet = GT.Object({ 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) } @@ -92,19 +94,20 @@ const BtcWallet = GT.Object({ }, 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: { @@ -116,10 +119,11 @@ const BtcWallet = GT.Object({ 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) } diff --git a/core/api/src/graphql/shared/types/object/usd-wallet.ts b/core/api/src/graphql/shared/types/object/usd-wallet.ts index d493d5d31b..99047532f7 100644 --- a/core/api/src/graphql/shared/types/object/usd-wallet.ts +++ b/core/api/src/graphql/shared/types/object/usd-wallet.ts @@ -56,7 +56,9 @@ const UsdWallet = GT.Object({ 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) } @@ -90,19 +92,20 @@ const UsdWallet = GT.Object({ ) }, }, - 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: { @@ -114,10 +117,11 @@ const UsdWallet = GT.Object({ 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) } diff --git a/core/api/test/bats/gql/pending-transactions-by-address.gql b/core/api/test/bats/gql/pending-incoming-transactions-by-address.gql similarity index 89% rename from core/api/test/bats/gql/pending-transactions-by-address.gql rename to core/api/test/bats/gql/pending-incoming-transactions-by-address.gql index a31fa42a2a..942f9503a4 100644 --- a/core/api/test/bats/gql/pending-transactions-by-address.gql +++ b/core/api/test/bats/gql/pending-incoming-transactions-by-address.gql @@ -1,4 +1,4 @@ -query pendingTransactionsByAddress($address: OnChainAddress!) { +query pendingIncomingTransactionsByAddress($address: OnChainAddress!) { me { defaultAccount { displayCurrency @@ -6,7 +6,7 @@ query pendingTransactionsByAddress($address: OnChainAddress!) { __typename id walletCurrency - pendingTransactionsByAddress(address: $address) { + pendingIncomingTransactionsByAddress(address: $address) { __typename id status diff --git a/core/api/test/bats/gql/pending-transactions.gql b/core/api/test/bats/gql/pending-incoming-transactions.gql similarity index 93% rename from core/api/test/bats/gql/pending-transactions.gql rename to core/api/test/bats/gql/pending-incoming-transactions.gql index bc26c2985a..9e7dde50fb 100644 --- a/core/api/test/bats/gql/pending-transactions.gql +++ b/core/api/test/bats/gql/pending-incoming-transactions.gql @@ -1,8 +1,8 @@ -query pendingTransactions { +query pendingIncomingTransactions { me { defaultAccount { displayCurrency - pendingTransactions { + pendingIncomingTransactions { __typename id status diff --git a/core/api/test/bats/onchain-receive.bats b/core/api/test/bats/onchain-receive.bats index 609a44618a..b42db0ffd2 100644 --- a/core/api/test/bats/onchain-receive.bats +++ b/core/api/test/bats/onchain-receive.bats @@ -127,12 +127,12 @@ create_new_lnd_onchain_address() { --arg address "$on_chain_address_created_1" \ '{"address": $address}' ) - exec_graphql "$token_name" 'pending-transactions-by-address' "$address_1_pending_txns_variables" + exec_graphql "$token_name" 'pending-incoming-transactions-by-address' "$address_1_pending_txns_variables" pending_txns_for_address_1=$( graphql_output ' .data.me.defaultAccount.wallets[] | select(.__typename == "BTCWallet") - .pendingTransactionsByAddress' + .pendingIncomingTransactionsByAddress' ) pending_txns_for_address_1_length="$(echo $pending_txns_for_address_1 | jq -r 'length')" [[ "$pending_txns_for_address_1_length" == "1" ]] || exit 1 @@ -146,12 +146,12 @@ create_new_lnd_onchain_address() { --arg address "$on_chain_address_created_2" \ '{"address": $address}' ) - exec_graphql "$token_name" 'pending-transactions-by-address' "$address_2_pending_txns_variables" + exec_graphql "$token_name" 'pending-incoming-transactions-by-address' "$address_2_pending_txns_variables" pending_txns_for_address_2=$( graphql_output ' .data.me.defaultAccount.wallets[] | select(.__typename == "BTCWallet") - .pendingTransactionsByAddress' + .pendingIncomingTransactionsByAddress' ) pending_txns_for_address_2_length="$(echo $pending_txns_for_address_2 | jq -r 'length')" [[ "$pending_txns_for_address_2_length" == "1" ]] || exit 1 @@ -160,10 +160,10 @@ create_new_lnd_onchain_address() { # Check pending transactions for account - exec_graphql "$token_name" 'pending-transactions' + exec_graphql "$token_name" 'pending-incoming-transactions' pending_txns_for_account=$( graphql_output ' - .data.me.defaultAccount.pendingTransactions' + .data.me.defaultAccount.pendingIncomingTransactions' ) pending_txns_for_account_length="$(echo $pending_txns_for_account | jq -r 'length')" [[ "$pending_txns_for_account_length" == "2" ]] || exit 1 @@ -213,10 +213,10 @@ create_new_lnd_onchain_address() { # Ensure no pending transactions for account - exec_graphql "$token_name" 'pending-transactions' + exec_graphql "$token_name" 'pending-incoming-transactions' pending_txns_for_account=$( graphql_output ' - .data.me.defaultAccount.pendingTransactions' + .data.me.defaultAccount.pendingIncomingTransactions' ) pending_txns_for_account_length="$(echo $pending_txns_for_account | jq -r 'length')" [[ "$pending_txns_for_account_length" == "0" ]] || exit 1 @@ -282,12 +282,12 @@ create_new_lnd_onchain_address() { --arg address "$on_chain_address_created" \ '{"address": $address}' ) - exec_graphql "$token_name" 'pending-transactions-by-address' "$address_pending_txns_variables" + exec_graphql "$token_name" 'pending-incoming-transactions-by-address' "$address_pending_txns_variables" pending_txns_for_address=$( graphql_output ' .data.me.defaultAccount.wallets[] | select(.__typename == "UsdWallet") - .pendingTransactionsByAddress' + .pendingIncomingTransactionsByAddress' ) pending_txns_for_address_length="$(echo $pending_txns_for_address | jq -r 'length')" [[ "$pending_txns_for_address_length" == "1" ]] || exit 1 @@ -296,10 +296,10 @@ create_new_lnd_onchain_address() { # Check pending transactions for account - exec_graphql "$token_name" 'pending-transactions' + exec_graphql "$token_name" 'pending-incoming-transactions' pending_txns_for_account=$( graphql_output ' - .data.me.defaultAccount.pendingTransactions' + .data.me.defaultAccount.pendingIncomingTransactions' ) pending_txns_for_account_length="$(echo $pending_txns_for_account | jq -r 'length')" [[ "$pending_txns_for_account_length" == "1" ]] || exit 1 @@ -309,10 +309,10 @@ create_new_lnd_onchain_address() { # Ensure no pending transactions for account - exec_graphql "$token_name" 'pending-transactions' + exec_graphql "$token_name" 'pending-incoming-transactions' pending_txns_for_account=$( graphql_output ' - .data.me.defaultAccount.pendingTransactions' + .data.me.defaultAccount.pendingIncomingTransactions' ) pending_txns_for_account_length="$(echo $pending_txns_for_account | jq -r 'length')" [[ "$pending_txns_for_account_length" == "0" ]] || exit 1 diff --git a/core/api/test/integration/app/wallets/get-pending-onchain-balance-for-wallets.spec.ts b/core/api/test/integration/app/wallets/get-pending-incoming-on-chain-balance-for-wallets.spec.ts similarity index 83% rename from core/api/test/integration/app/wallets/get-pending-onchain-balance-for-wallets.spec.ts rename to core/api/test/integration/app/wallets/get-pending-incoming-on-chain-balance-for-wallets.spec.ts index e72c2e9409..9803b06765 100644 --- a/core/api/test/integration/app/wallets/get-pending-onchain-balance-for-wallets.spec.ts +++ b/core/api/test/integration/app/wallets/get-pending-incoming-on-chain-balance-for-wallets.spec.ts @@ -14,7 +14,7 @@ describe("getPendingOnChainBalanceForWallets", () => { const wallet = await WalletsRepository().findById(newWalletDescriptor.id) if (wallet instanceof Error) throw wallet - const res = await Wallets.getPendingOnChainBalanceForWallets([wallet]) + const res = await Wallets.getPendingIncomingOnChainBalanceForWallets([wallet]) expect(res).toStrictEqual({ [newWalletDescriptor.id]: ZERO_SATS }) }) @@ -27,12 +27,15 @@ describe("getPendingOnChainBalanceForWallets", () => { const usdWallet = await WalletsRepository().findById(usdWalletDescriptor.id) if (usdWallet instanceof Error) throw usdWallet - const res = await Wallets.getPendingOnChainBalanceForWallets([btcWallet, usdWallet]) + const res = await Wallets.getPendingIncomingOnChainBalanceForWallets([ + btcWallet, + usdWallet, + ]) expect(res).toBeInstanceOf(MultipleCurrenciesForSingleCurrencyOperationError) }) it("returns error for no wallets passed", async () => { - const res = await Wallets.getPendingOnChainBalanceForWallets([]) + const res = await Wallets.getPendingIncomingOnChainBalanceForWallets([]) expect(res).toBeInstanceOf(MultipleCurrenciesForSingleCurrencyOperationError) }) }) diff --git a/dev/config/apollo-federation/supergraph.graphql b/dev/config/apollo-federation/supergraph.graphql index c25e02d22d..861c96d64b 100644 --- a/dev/config/apollo-federation/supergraph.graphql +++ b/dev/config/apollo-federation/supergraph.graphql @@ -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.""" @@ -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!]! @@ -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!]! @@ -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!]! @@ -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!]!