Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev/apollo-federation/supergraph.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2039,7 +2039,7 @@ type UsdtWallet implements Wallet
@join__type(graph: PUBLIC)
{
accountId: ID!
balance: FractionalCentAmount!
balance: FractionalCentAmount
id: ID!
isExternal: Boolean!
lnurlp: Lnurl
Expand Down
2 changes: 1 addition & 1 deletion src/graphql/admin/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ A wallet belonging to an account which contains a USDT balance and a list of tra
"""
type UsdtWallet implements Wallet {
accountId: ID!
balance: FractionalCentAmount!
balance: FractionalCentAmount
id: ID!
isExternal: Boolean!
lnurlp: Lnurl
Expand Down
2 changes: 1 addition & 1 deletion src/graphql/public/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,7 @@ A wallet belonging to an account which contains a USDT balance and a list of tra
"""
type UsdtWallet implements Wallet {
accountId: ID!
balance: FractionalCentAmount!
balance: FractionalCentAmount
id: ID!
isExternal: Boolean!
lnurlp: Lnurl
Expand Down
2 changes: 1 addition & 1 deletion src/graphql/shared/types/object/usdt-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const UsdtWallet = GT.Object<Wallet>({
},

balance: {
type: GT.NonNull(FractionalCentAmount),
type: FractionalCentAmount,
resolve: async (source) => {
const balance = await Wallets.getBalanceForWallet({
walletId: source.id,
Expand Down
30 changes: 30 additions & 0 deletions test/flash/unit/graphql/wallet-balance-validation.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { parse, validate } from "graphql"

import { gqlMainSchema } from "@graphql/public"

describe("wallet balance query validation", () => {
it("allows querying USD and USDT wallet balances with the same response name", () => {
const query = parse(`
query Me {
me {
defaultAccount {
wallets {
... on UsdtWallet {
id
balance
}
... on UsdWallet {
id
balance
}
}
}
}
}
`)

const errors = validate(gqlMainSchema, query)

expect(errors).toEqual([])
})
})