Skip to content

Commit

Permalink
refactor: wallet receive flow redesign (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
secondl1ght authored Sep 17, 2024
1 parent 095c3e1 commit 2ff0886
Show file tree
Hide file tree
Showing 14 changed files with 717 additions and 112 deletions.
5 changes: 5 additions & 0 deletions messages/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"App": {
"copy": "Copy",
"Dashboard": {
"asset": "An asset in your wallet.",
"buy": "Buy",
Expand All @@ -14,8 +15,12 @@
"what-asset": "What is {asset}?"
},
"miban": "MIBAN Code",
"save": "Save",
"view-all": "View all",
"Wallet": {
"amount": "Please specify an amount.",
"amount-custom": "Customize Amount",
"amount-ln": "Please specify an amount to generate a Lightning invoice.",
"assets": "Assets",
"receive": "Receive",
"send": "Send"
Expand Down
5 changes: 5 additions & 0 deletions messages/es.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"App": {
"copy": "Copiar",
"Dashboard": {
"asset": "Un activo en tu billetera.",
"buy": "Comprar",
Expand All @@ -14,8 +15,12 @@
"what-asset": "Qué es {asset}?"
},
"miban": "Código MIBAN",
"save": "Guardar",
"view-all": "Ver todos",
"Wallet": {
"amount": "Especifíca una cantidad.",
"amount-custom": "Cambia la cantidad",
"amount-ln": "Por favor especifíca una cantidad para generar un recibo de Lightning.",
"assets": "Activos",
"receive": "Recibir",
"send": "Envíar"
Expand Down

This file was deleted.

7 changes: 7 additions & 0 deletions src/app/(app)/(layout)/wallet/receive/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use client';

import { Receive } from '@/views/wallet/Receive';

export default function Page() {
return <Receive />;
}
75 changes: 75 additions & 0 deletions src/graphql/mutations/__generated__/createInvoice.generated.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/graphql/mutations/createInvoice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { gql } from '@apollo/client';

export const CreateLightningInvoice = gql`
mutation CreateLightningInvoice($input: CreateLightingInvoiceInput!) {
wallets {
create_lightning_invoice(input: $input) {
payment_request
}
}
}
`;
97 changes: 97 additions & 0 deletions src/graphql/queries/__generated__/prices.generated.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions src/graphql/queries/prices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,17 @@ export const getPricesHistorical = gql`
}
}
`;

export const getPriceCurrent = gql`
query getPriceCurrent {
prices {
current {
currency
date
id
value
}
id
}
}
`;
16 changes: 16 additions & 0 deletions src/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ export type CreateContactInput = {
wallet_id: Scalars['String']['input'];
};

export type CreateLightingInvoice = {
__typename?: 'CreateLightingInvoice';
payment_request: Scalars['String']['output'];
};

export type CreateLightingInvoiceInput = {
amount: Scalars['Float']['input'];
wallet_account_id: Scalars['String']['input'];
};

export type CreateLiquidTransaction = {
__typename?: 'CreateLiquidTransaction';
base_64: Scalars['String']['output'];
Expand Down Expand Up @@ -457,6 +467,7 @@ export type PricePoint = {

export type PriceQueries = {
__typename?: 'PriceQueries';
current: PricePoint;
historical: PriceHistorical;
id: Scalars['String']['output'];
};
Expand Down Expand Up @@ -810,6 +821,7 @@ export type WalletMutations = {
broadcast_liquid_transaction: BroadcastLiquidTransaction;
change_name: Scalars['Boolean']['output'];
create: CreateWallet;
create_lightning_invoice: CreateLightingInvoice;
create_onchain_address: CreateOnchainAddress;
create_onchain_address_swap: ReceiveSwap;
refresh_wallet: Scalars['Boolean']['output'];
Expand All @@ -828,6 +840,10 @@ export type WalletMutationsCreateArgs = {
input: CreateWalletInput;
};

export type WalletMutationsCreate_Lightning_InvoiceArgs = {
input: CreateLightingInvoiceInput;
};

export type WalletMutationsCreate_Onchain_AddressArgs = {
input: CreateOnchainAddressInput;
};
Expand Down
3 changes: 1 addition & 2 deletions src/utils/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export const ROUTES = {
wallet: {
home: '/wallet',
settings: (id: string) => `/wallet/${id}/settings`,
receive: (walletId: string, accountId: string) =>
`/wallet/${walletId}/account/${accountId}/receive`,
receive: '/wallet/receive',
send: {
home: (walletId: string, accountId: string, assetId?: string) =>
`/wallet/${walletId}/account/${accountId}/send${assetId ? `?assetId=${assetId}` : ''}`,
Expand Down
2 changes: 1 addition & 1 deletion src/views/dashboard/BancoCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const BancoCode: FC<{ id: string }> = ({ id }) => {

<div className="round-canvas mx-auto w-fit">
<Canvas
text={'lightning:' + address}
text={address}
options={{
margin: 3,
width: 250,
Expand Down
Loading

0 comments on commit 2ff0886

Please sign in to comment.