get cake balance from bsc wallet
This commit is contained in:
7
app/javascript/__generated__/schema.graphql
generated
7
app/javascript/__generated__/schema.graphql
generated
@@ -553,5 +553,10 @@ type User {
|
||||
firstName: String!
|
||||
id: ID!
|
||||
lastName: String!
|
||||
walletAddress: String
|
||||
wallet: Wallet!
|
||||
}
|
||||
|
||||
type Wallet {
|
||||
address: String
|
||||
cakeBalance: String!
|
||||
}
|
||||
|
||||
23
app/javascript/src/__generated__/AppQuery.graphql.ts
generated
23
app/javascript/src/__generated__/AppQuery.graphql.ts
generated
@@ -27,7 +27,9 @@ query AppQuery {
|
||||
|
||||
fragment UserProvider_user on User {
|
||||
firstName
|
||||
walletAddress
|
||||
wallet {
|
||||
address
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -82,8 +84,19 @@ const node: ConcreteRequest = {
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "walletAddress",
|
||||
"concreteType": "Wallet",
|
||||
"kind": "LinkedField",
|
||||
"name": "wallet",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "address",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
@@ -99,12 +112,12 @@ const node: ConcreteRequest = {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "56b4be302cf9b9ec226ad8145170961b",
|
||||
"cacheID": "ae618245e5a3baf946034e1efe3682de",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "AppQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query AppQuery {\n currentUser {\n ...UserProvider_user\n id\n }\n}\n\nfragment UserProvider_user on User {\n firstName\n walletAddress\n}\n"
|
||||
"text": "query AppQuery {\n currentUser {\n ...UserProvider_user\n id\n }\n}\n\nfragment UserProvider_user on User {\n firstName\n wallet {\n address\n }\n}\n"
|
||||
}
|
||||
};
|
||||
(node as any).hash = 'aac57a65620cf50754d54f3c8d6495cf';
|
||||
|
||||
@@ -33,7 +33,9 @@ export const UserProvider: FC<Props> = ({ userRef, children }) => {
|
||||
graphql`
|
||||
fragment UserProvider_user on User {
|
||||
firstName
|
||||
walletAddress
|
||||
wallet {
|
||||
address
|
||||
}
|
||||
}
|
||||
`,
|
||||
userRef
|
||||
@@ -42,7 +44,7 @@ export const UserProvider: FC<Props> = ({ userRef, children }) => {
|
||||
const user = userData
|
||||
? {
|
||||
firstName: userData.firstName,
|
||||
walletAddress: userData.walletAddress,
|
||||
walletAddress: userData.wallet.address,
|
||||
}
|
||||
: null;
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@ import { ReaderFragment } from "relay-runtime";
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type UserProvider_user = {
|
||||
readonly firstName: string;
|
||||
readonly walletAddress: string | null;
|
||||
readonly wallet: {
|
||||
readonly address: string | null;
|
||||
};
|
||||
readonly " $refType": "UserProvider_user";
|
||||
};
|
||||
export type UserProvider_user$data = UserProvider_user;
|
||||
@@ -33,13 +35,24 @@ const node: ReaderFragment = {
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "walletAddress",
|
||||
"concreteType": "Wallet",
|
||||
"kind": "LinkedField",
|
||||
"name": "wallet",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "address",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "User",
|
||||
"abstractKey": null
|
||||
};
|
||||
(node as any).hash = 'ef997d2646b4d39178c6f3318509a7cb';
|
||||
(node as any).hash = '4f6b86f489ce0df288106cd92060b889';
|
||||
export default node;
|
||||
|
||||
@@ -1,14 +1,30 @@
|
||||
import React from "react";
|
||||
import { useLazyLoadQuery } from "react-relay";
|
||||
import { graphql } from "babel-plugin-relay/macro";
|
||||
|
||||
import { Pool } from "./Pool";
|
||||
import { Spinner } from "../../components";
|
||||
import { usePoolListing } from "./hooks";
|
||||
import type { PoolListingQuery } from "./__generated__/PoolListingQuery.graphql";
|
||||
import { formatCake } from "../../utils/cake";
|
||||
|
||||
export const PoolListing = () => {
|
||||
const { isLoading, validPools } = usePoolListing();
|
||||
|
||||
// TODO<wallet>: puxar valor da wallet
|
||||
const balance = "0";
|
||||
const { currentUser } = useLazyLoadQuery<PoolListingQuery>(
|
||||
graphql`
|
||||
query PoolListingQuery {
|
||||
currentUser {
|
||||
wallet {
|
||||
cakeBalance
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
{}
|
||||
);
|
||||
|
||||
const balance = formatCake(currentUser?.wallet.cakeBalance);
|
||||
|
||||
if (isLoading && !validPools.length) {
|
||||
return (
|
||||
|
||||
112
app/javascript/src/pages/Home/__generated__/PoolListingQuery.graphql.ts
generated
Normal file
112
app/javascript/src/pages/Home/__generated__/PoolListingQuery.graphql.ts
generated
Normal file
@@ -0,0 +1,112 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from "relay-runtime";
|
||||
export type PoolListingQueryVariables = {};
|
||||
export type PoolListingQueryResponse = {
|
||||
readonly currentUser: {
|
||||
readonly wallet: {
|
||||
readonly cakeBalance: string;
|
||||
};
|
||||
} | null;
|
||||
};
|
||||
export type PoolListingQuery = {
|
||||
readonly response: PoolListingQueryResponse;
|
||||
readonly variables: PoolListingQueryVariables;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
query PoolListingQuery {
|
||||
currentUser {
|
||||
wallet {
|
||||
cakeBalance
|
||||
}
|
||||
id
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Wallet",
|
||||
"kind": "LinkedField",
|
||||
"name": "wallet",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cakeBalance",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": [],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "PoolListingQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "User",
|
||||
"kind": "LinkedField",
|
||||
"name": "currentUser",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v0/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Query",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": [],
|
||||
"kind": "Operation",
|
||||
"name": "PoolListingQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "User",
|
||||
"kind": "LinkedField",
|
||||
"name": "currentUser",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v0/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "555226365d27590d8236ea1effdf9ddc",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "PoolListingQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query PoolListingQuery {\n currentUser {\n wallet {\n cakeBalance\n }\n id\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
(node as any).hash = 'afdc45802c0d92b114c2ebb5c3530ec2';
|
||||
export default node;
|
||||
@@ -9,6 +9,7 @@ import { commitCreateSellCryptoOrderMutation } from "./createSellCryptoOrder";
|
||||
import { commitCreateBuyCryptoOrderMutation } from "./createBuyCryptoOrder";
|
||||
import { Input, Button } from "../../../../components";
|
||||
import type { ExchangePanel_user$key } from "./__generated__/ExchangePanel_user.graphql";
|
||||
import { formatCake } from "../../../../utils/cake";
|
||||
|
||||
const tabBaseStyles =
|
||||
"w-full text-base font-bold text-black px-4 py-2 focus:ring-blue-500";
|
||||
@@ -32,14 +33,15 @@ export const ExchangePanel: FC<Props> = ({ userRef }) => {
|
||||
fiatBalance {
|
||||
amountCents
|
||||
}
|
||||
wallet {
|
||||
cakeBalance
|
||||
}
|
||||
}
|
||||
`,
|
||||
userRef
|
||||
);
|
||||
|
||||
// TODO<wallet>: puxar valor da wallet
|
||||
const balanceAmount = 0;
|
||||
|
||||
const balanceAmount = formatCake(user?.wallet.cakeBalance);
|
||||
const fiatBalanceAmount = user?.fiatBalance.amountCents ?? 0;
|
||||
|
||||
const avaliableCrypto = new BigNumber(balanceAmount);
|
||||
|
||||
@@ -8,6 +8,9 @@ export type ExchangePanel_user = {
|
||||
readonly fiatBalance: {
|
||||
readonly amountCents: number;
|
||||
};
|
||||
readonly wallet: {
|
||||
readonly cakeBalance: string;
|
||||
};
|
||||
readonly " $refType": "ExchangePanel_user";
|
||||
};
|
||||
export type ExchangePanel_user$data = ExchangePanel_user;
|
||||
@@ -41,10 +44,28 @@ const node: ReaderFragment = {
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Wallet",
|
||||
"kind": "LinkedField",
|
||||
"name": "wallet",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cakeBalance",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "User",
|
||||
"abstractKey": null
|
||||
};
|
||||
(node as any).hash = '2058ddb20a60f148a524083fa0a680ea';
|
||||
(node as any).hash = '88cc0dedfa3a3b9bb73d6b4745e0cf5a';
|
||||
export default node;
|
||||
|
||||
@@ -68,6 +68,9 @@ fragment ExchangePanel_user on User {
|
||||
amountCents
|
||||
id
|
||||
}
|
||||
wallet {
|
||||
cakeBalance
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -192,6 +195,24 @@ return {
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Wallet",
|
||||
"kind": "LinkedField",
|
||||
"name": "wallet",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cakeBalance",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v0/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
@@ -301,12 +322,12 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "30aa6f9d81cfe033aee64b8577d15936",
|
||||
"cacheID": "2168c066ea4bb43d5ab066a00a35a33b",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "ExchangeQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query ExchangeQuery {\n currentUser {\n ...ExchangePanel_user\n id\n }\n buyCryptoOrders {\n ...ExchangeHistory_buyCryptoOrders\n }\n sellCryptoOrders {\n ...ExchangeHistory_sellCryptoOrders\n }\n}\n\nfragment ExchangeHistory_buyCryptoOrders on BuyCryptoOrderConnection {\n edges {\n node {\n id\n status\n createdAt\n paidAmountCents\n receivedAmount\n __typename\n }\n }\n}\n\nfragment ExchangeHistory_sellCryptoOrders on SellCryptoOrderConnection {\n edges {\n node {\n id\n status\n paidAmount\n receivedAmountCents\n createdAt\n __typename\n }\n }\n}\n\nfragment ExchangePanel_user on User {\n fiatBalance {\n amountCents\n id\n }\n}\n"
|
||||
"text": "query ExchangeQuery {\n currentUser {\n ...ExchangePanel_user\n id\n }\n buyCryptoOrders {\n ...ExchangeHistory_buyCryptoOrders\n }\n sellCryptoOrders {\n ...ExchangeHistory_sellCryptoOrders\n }\n}\n\nfragment ExchangeHistory_buyCryptoOrders on BuyCryptoOrderConnection {\n edges {\n node {\n id\n status\n createdAt\n paidAmountCents\n receivedAmount\n __typename\n }\n }\n}\n\nfragment ExchangeHistory_sellCryptoOrders on SellCryptoOrderConnection {\n edges {\n node {\n id\n status\n paidAmount\n receivedAmountCents\n createdAt\n __typename\n }\n }\n}\n\nfragment ExchangePanel_user on User {\n fiatBalance {\n amountCents\n id\n }\n wallet {\n cakeBalance\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -1,13 +1,30 @@
|
||||
import { graphql } from "babel-plugin-relay/macro";
|
||||
import type { FC } from "react";
|
||||
import React from "react";
|
||||
import { useFragment } from "react-relay";
|
||||
|
||||
import { Table, TableRow } from "../../components";
|
||||
import { formatCake } from "../../utils/cake";
|
||||
import { getCurrencyLogo } from "../../utils/getCurrencyLogo";
|
||||
import type { Balance_wallet$key } from "./__generated__/Balance_wallet.graphql";
|
||||
|
||||
export const Balance: FC = () => {
|
||||
const node = {
|
||||
amount: "PUXAR VALOR DA CARTEIRA",
|
||||
};
|
||||
type Props = {
|
||||
userRef: Balance_wallet$key;
|
||||
};
|
||||
|
||||
export const Balance: FC<Props> = ({ userRef }) => {
|
||||
const { wallet } = useFragment<Balance_wallet$key>(
|
||||
graphql`
|
||||
fragment Balance_wallet on User {
|
||||
wallet {
|
||||
cakeBalance
|
||||
}
|
||||
}
|
||||
`,
|
||||
userRef
|
||||
);
|
||||
|
||||
const cakeBalance = formatCake(wallet.cakeBalance);
|
||||
|
||||
return (
|
||||
<div className="-mx-4 sm:-mx-8 px-4 sm:px-8 py-4 overflow-x-auto">
|
||||
@@ -27,7 +44,7 @@ export const Balance: FC = () => {
|
||||
<p className="text-gray-900 whitespace-no-wrap">CAKE</p>
|
||||
</div>
|
||||
</div>,
|
||||
node.amount,
|
||||
cakeBalance,
|
||||
]}
|
||||
/>
|
||||
</Table>
|
||||
|
||||
@@ -6,22 +6,24 @@ import { useFragment } from "react-relay";
|
||||
import type { FiatBalance_fiatBalance$key } from "./__generated__/FiatBalance_fiatBalance.graphql";
|
||||
|
||||
type Props = {
|
||||
fiatBalancesRef: FiatBalance_fiatBalance$key;
|
||||
userRef: FiatBalance_fiatBalance$key;
|
||||
};
|
||||
export const FiatBalance: FC<Props> = ({ fiatBalancesRef }) => {
|
||||
const userFiatBalance = useFragment<FiatBalance_fiatBalance$key>(
|
||||
export const FiatBalance: FC<Props> = ({ userRef }) => {
|
||||
const { fiatBalance } = useFragment<FiatBalance_fiatBalance$key>(
|
||||
graphql`
|
||||
fragment FiatBalance_fiatBalance on FiatBalance {
|
||||
amountCents
|
||||
amountCurrency
|
||||
fragment FiatBalance_fiatBalance on User {
|
||||
fiatBalance {
|
||||
amountCents
|
||||
amountCurrency
|
||||
}
|
||||
}
|
||||
`,
|
||||
fiatBalancesRef
|
||||
userRef
|
||||
);
|
||||
|
||||
if (!userFiatBalance) return null;
|
||||
if (!fiatBalance) return null;
|
||||
|
||||
const { amountCents, amountCurrency } = userFiatBalance;
|
||||
const { amountCents, amountCurrency } = fiatBalance;
|
||||
|
||||
const amount = (amountCents ? amountCents / 100 : 0).toFixed(2);
|
||||
|
||||
|
||||
@@ -15,9 +15,8 @@ export const Wallet: FC = () => {
|
||||
graphql`
|
||||
query WalletQuery {
|
||||
currentUser {
|
||||
fiatBalance {
|
||||
...FiatBalance_fiatBalance
|
||||
}
|
||||
...FiatBalance_fiatBalance
|
||||
...Balance_wallet
|
||||
}
|
||||
}
|
||||
`,
|
||||
@@ -30,8 +29,8 @@ export const Wallet: FC = () => {
|
||||
<div className="flex flex-col h-full w-full overflow-x-hidden">
|
||||
<div className="container mx-auto px-4 sm:px-8 max-w-3xl">
|
||||
<div className="py-8">
|
||||
<FiatBalance fiatBalancesRef={currentUser.fiatBalance} />
|
||||
<Balance />
|
||||
<FiatBalance userRef={currentUser} />
|
||||
<Balance userRef={currentUser} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
50
app/javascript/src/pages/Wallet/__generated__/Balance_wallet.graphql.ts
generated
Normal file
50
app/javascript/src/pages/Wallet/__generated__/Balance_wallet.graphql.ts
generated
Normal file
@@ -0,0 +1,50 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ReaderFragment } from "relay-runtime";
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type Balance_wallet = {
|
||||
readonly wallet: {
|
||||
readonly cakeBalance: string;
|
||||
};
|
||||
readonly " $refType": "Balance_wallet";
|
||||
};
|
||||
export type Balance_wallet$data = Balance_wallet;
|
||||
export type Balance_wallet$key = {
|
||||
readonly " $data"?: Balance_wallet$data;
|
||||
readonly " $fragmentRefs": FragmentRefs<"Balance_wallet">;
|
||||
};
|
||||
|
||||
|
||||
|
||||
const node: ReaderFragment = {
|
||||
"argumentDefinitions": [],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "Balance_wallet",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Wallet",
|
||||
"kind": "LinkedField",
|
||||
"name": "wallet",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cakeBalance",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "User",
|
||||
"abstractKey": null
|
||||
};
|
||||
(node as any).hash = '27ddb42954aa66b033735eeea5746516';
|
||||
export default node;
|
||||
@@ -5,8 +5,10 @@
|
||||
import { ReaderFragment } from "relay-runtime";
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type FiatBalance_fiatBalance = {
|
||||
readonly amountCents: number;
|
||||
readonly amountCurrency: string;
|
||||
readonly fiatBalance: {
|
||||
readonly amountCents: number;
|
||||
readonly amountCurrency: string;
|
||||
};
|
||||
readonly " $refType": "FiatBalance_fiatBalance";
|
||||
};
|
||||
export type FiatBalance_fiatBalance$data = FiatBalance_fiatBalance;
|
||||
@@ -26,20 +28,31 @@ const node: ReaderFragment = {
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "amountCents",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "amountCurrency",
|
||||
"concreteType": "FiatBalance",
|
||||
"kind": "LinkedField",
|
||||
"name": "fiatBalance",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "amountCents",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "amountCurrency",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "FiatBalance",
|
||||
"type": "User",
|
||||
"abstractKey": null
|
||||
};
|
||||
(node as any).hash = 'dc28e4dca104c7d25465a30412661af2';
|
||||
(node as any).hash = '4371bbd59e9a50e7f32aa65bf982c19e';
|
||||
export default node;
|
||||
|
||||
@@ -7,9 +7,7 @@ import { FragmentRefs } from "relay-runtime";
|
||||
export type WalletQueryVariables = {};
|
||||
export type WalletQueryResponse = {
|
||||
readonly currentUser: {
|
||||
readonly fiatBalance: {
|
||||
readonly " $fragmentRefs": FragmentRefs<"FiatBalance_fiatBalance">;
|
||||
};
|
||||
readonly " $fragmentRefs": FragmentRefs<"FiatBalance_fiatBalance" | "Balance_wallet">;
|
||||
} | null;
|
||||
};
|
||||
export type WalletQuery = {
|
||||
@@ -22,17 +20,24 @@ export type WalletQuery = {
|
||||
/*
|
||||
query WalletQuery {
|
||||
currentUser {
|
||||
fiatBalance {
|
||||
...FiatBalance_fiatBalance
|
||||
id
|
||||
}
|
||||
...FiatBalance_fiatBalance
|
||||
...Balance_wallet
|
||||
id
|
||||
}
|
||||
}
|
||||
|
||||
fragment FiatBalance_fiatBalance on FiatBalance {
|
||||
amountCents
|
||||
amountCurrency
|
||||
fragment Balance_wallet on User {
|
||||
wallet {
|
||||
cakeBalance
|
||||
}
|
||||
}
|
||||
|
||||
fragment FiatBalance_fiatBalance on User {
|
||||
fiatBalance {
|
||||
amountCents
|
||||
amountCurrency
|
||||
id
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -60,20 +65,14 @@ return {
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "FiatBalance",
|
||||
"kind": "LinkedField",
|
||||
"name": "fiatBalance",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
"name": "FiatBalance_fiatBalance"
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
"kind": "FragmentSpread",
|
||||
"name": "FiatBalance_fiatBalance"
|
||||
},
|
||||
{
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
"name": "Balance_wallet"
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
@@ -122,6 +121,24 @@ return {
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Wallet",
|
||||
"kind": "LinkedField",
|
||||
"name": "wallet",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cakeBalance",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v0/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
@@ -129,14 +146,14 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "4397ad78f82d23c0a186b71bea7c3898",
|
||||
"cacheID": "4631f43e84d22d8fdfa82706d907f478",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "WalletQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query WalletQuery {\n currentUser {\n fiatBalance {\n ...FiatBalance_fiatBalance\n id\n }\n id\n }\n}\n\nfragment FiatBalance_fiatBalance on FiatBalance {\n amountCents\n amountCurrency\n}\n"
|
||||
"text": "query WalletQuery {\n currentUser {\n ...FiatBalance_fiatBalance\n ...Balance_wallet\n id\n }\n}\n\nfragment Balance_wallet on User {\n wallet {\n cakeBalance\n }\n}\n\nfragment FiatBalance_fiatBalance on User {\n fiatBalance {\n amountCents\n amountCurrency\n id\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
(node as any).hash = '83fd609428103b13e79c14d20fefaabe';
|
||||
(node as any).hash = 'a91fc17a25b5a68672b3016813de17bc';
|
||||
export default node;
|
||||
|
||||
2
app/javascript/src/utils/cake.ts
Normal file
2
app/javascript/src/utils/cake.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export const formatCake = (value?: string) =>
|
||||
parseFloat(value ?? "0").toFixed(5);
|
||||
Reference in New Issue
Block a user