Skip to content

Commit

Permalink
[AMB-319] feat: send/receive bitcoin onchain (#82)
Browse files Browse the repository at this point in the history
* feat: send/receive feedback improvements

* fix: dynamic import component using wasm package

* feat: send/receive bitcoin onchain
  • Loading branch information
secondl1ght authored Oct 1, 2024
1 parent 59deaad commit 2777563
Show file tree
Hide file tree
Showing 15 changed files with 529 additions and 25 deletions.
4 changes: 3 additions & 1 deletion messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"add-desc": "Add Description",
"amount": "Please specify an amount.",
"amount-custom": "Customize Amount",
"amount-ln": "Please specify an amount to generate a Lightning invoice.",
"assets": "Assets",
"available": "Available",
"confirm-pay": "Confirm Payment",
Expand All @@ -48,6 +47,7 @@
"fee": "Fee",
"locked": "Your vault is locked.",
"receive": "Receive",
"receive-warn": "Please do not send to this address more than once or after 24 hours from generation.",
"recipient": "Enter recipient",
"send": "Send",
"send-options": "MIBAN Code, Lightning Invoice, or Payment Address",
Expand All @@ -73,11 +73,13 @@
"done": "Done",
"email": "Email",
"error": "Error",
"important": "Important",
"mnemonic": "Encrypted Mnemonic",
"next": "Next",
"optional": "Optional",
"password": "Password",
"private": "Keep this phrase private to avoid loss of funds.",
"refresh": "Please <refresh>refresh</refresh> to try again.",
"your-password": "Your password"
},
"Index": {
Expand Down
4 changes: 3 additions & 1 deletion messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"add-desc": "Agrega una descripción",
"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",
"available": "Disponible",
"confirm-pay": "Confirmar Pago",
Expand All @@ -48,6 +47,7 @@
"fee": "Comisión",
"locked": "Tu bóveda esta bloqueada.",
"receive": "Recibir",
"receive-warn": "Please do not send to this address more than once or after 24 hours from generation.",
"recipient": "Ingrese el destinatario",
"send": "Envíar",
"send-options": "Código MIBAN, factura Lightning o dirección de pago",
Expand All @@ -73,11 +73,13 @@
"done": "Terminado",
"email": "Correo",
"error": "Error",
"important": "Important",
"mnemonic": "Mnemonic Cifrada",
"next": "Siguiente",
"optional": "Opcional",
"password": "Contraseña",
"private": "Manten esta frase privada para evitar la perdida de fondos.",
"refresh": "Please <refresh>refresh</refresh> to try again.",
"your-password": "Tu contraseña"
},
"Index": {
Expand Down
29 changes: 29 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@yudiel/react-qr-scanner": "^2.0.8",
"argon2-browser": "^1.18.0",
"big.js": "^6.2.1",
"bitcoin-address-validation": "^2.2.3",
"bolt11": "^1.4.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
Expand Down

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

78 changes: 78 additions & 0 deletions src/graphql/mutations/__generated__/pay.generated.tsx

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

2 changes: 1 addition & 1 deletion src/graphql/mutations/createOnchainAddress.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { gql } from '@apollo/client';

export const BroadcastLiquidTransaction = gql`
export const CreateOnchainAddress = gql`
mutation CreateOnchainAddress($input: CreateOnchainAddressInput!) {
wallets {
create_onchain_address(input: $input) {
Expand Down
13 changes: 13 additions & 0 deletions src/graphql/mutations/createOnchainAddressSwap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { gql } from '@apollo/client';

export const CreateOnchainAddressSwap = gql`
mutation CreateOnchainAddressSwap($input: ReceiveSwapInput!) {
wallets {
create_onchain_address_swap(input: $input) {
bip21
id
receive_address
}
}
}
`;
14 changes: 14 additions & 0 deletions src/graphql/mutations/pay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,17 @@ export const PayLightningInvoice = gql`
}
}
`;

export const PaySwapAddress = gql`
mutation PaySwapAddress($input: PaySwapAddressInput!, $payInput2: PayInput!) {
pay(input: $payInput2) {
swap_address(input: $input) {
wallet_account {
id
descriptor
}
base_64
}
}
}
`;
10 changes: 10 additions & 0 deletions src/utils/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,13 @@ export const addEllipsis = (

return `${beginning}...`;
};

export const getAddressFromBip21 = (str: string) => {
if (!str.includes(':')) return str;

const prefix = str.split(':');
const params = prefix[1].split('?');
const address = params[0];

return address;
};
Loading

0 comments on commit 2777563

Please sign in to comment.