From 96b9e6684130b3e9bddecbc48c275f1150d98f86 Mon Sep 17 00:00:00 2001 From: Roza Eisenberg <45665959+rozanagy@users.noreply.github.com> Date: Tue, 5 Nov 2024 11:01:25 +0100 Subject: [PATCH 01/12] fix: adjust height of points box and fix decimal format (#206) * fix: adjust height of points box and fix decimal format --- .../components/points-table/components/points-table-item.tsx | 4 ++-- .../points/components/points-table/points-table.tsx | 2 +- src/app/components/points/points.tsx | 4 ++-- src/shared/utils.ts | 4 ++++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/app/components/points/components/points-table/components/points-table-item.tsx b/src/app/components/points/components/points-table/components/points-table-item.tsx index da067c3d..e6a05407 100644 --- a/src/app/components/points/components/points-table/components/points-table-item.tsx +++ b/src/app/components/points/components/points-table/components/points-table-item.tsx @@ -3,7 +3,7 @@ import { CustomSkeleton } from '@components/custom-skeleton/custom-skeleton'; import { ProtocolRewards } from '@models/points.models'; import { unshiftValue } from 'dlc-btc-lib/utilities'; -import { formatNumber } from '@shared/utils'; +import { formatNumber, formatToFourDecimals } from '@shared/utils'; export function PointsTableItem(pointsTableItem: ProtocolRewards): React.JSX.Element { const isMobile = useBreakpointValue({ base: true, md: false }); @@ -49,7 +49,7 @@ export function PointsTableItem(pointsTableItem: ProtocolRewards): React.JSX.Ele {'dlc - {unshiftValue(currentTokens)} + {formatToFourDecimals(unshiftValue(currentTokens))} diff --git a/src/app/components/points/components/points-table/points-table.tsx b/src/app/components/points/components/points-table/points-table.tsx index f6aa7a2c..e26a52da 100644 --- a/src/app/components/points/components/points-table/points-table.tsx +++ b/src/app/components/points/components/points-table/points-table.tsx @@ -11,7 +11,7 @@ interface PointsTableProps { } export function PointsTable({ items }: PointsTableProps): React.JSX.Element { - const dynamicHeight = items ? items.length * 59 + 20 : 20; + const dynamicHeight = items ? items.length * 59 + 50 : 20; const isMobile = useBreakpointValue({ base: true, md: false }); return ( diff --git a/src/app/components/points/points.tsx b/src/app/components/points/points.tsx index dacd3040..30ada3e0 100644 --- a/src/app/components/points/points.tsx +++ b/src/app/components/points/points.tsx @@ -70,7 +70,7 @@ export function Points(): React.JSX.Element { diff --git a/src/shared/utils.ts b/src/shared/utils.ts index bdf6bdc2..53f98c03 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -51,5 +51,9 @@ export function formatEvent(event: DetailedEvent): FormattedEvent { }; } +export function formatToFourDecimals(value: number): number { + return parseFloat(value.toFixed(4)); +} + export const breakpoints = ['300px', '400px', '600px', '850px', '1280px', '1400px']; export const titleTextSize = ['2xl', '2xl', '4xl', '6xl']; From ad95f39b62a157268352cb3f22809718d974f60d Mon Sep 17 00:00:00 2001 From: Roza Eisenberg <45665959+rozanagy@users.noreply.github.com> Date: Thu, 7 Nov 2024 13:35:37 +0100 Subject: [PATCH 02/12] Feat/updated pagination (#209) * feat: add pagination to protocol history table --- .../protocol-history-table.tsx | 88 +++++++++++++------ 1 file changed, 63 insertions(+), 25 deletions(-) diff --git a/src/app/components/protocol-history-table/protocol-history-table.tsx b/src/app/components/protocol-history-table/protocol-history-table.tsx index d7ea3638..687d6b2e 100644 --- a/src/app/components/protocol-history-table/protocol-history-table.tsx +++ b/src/app/components/protocol-history-table/protocol-history-table.tsx @@ -1,4 +1,6 @@ -import { Skeleton, useBreakpointValue } from '@chakra-ui/react'; +import { useState } from 'react'; + +import { Button, HStack, Skeleton, Spacer, VStack, useBreakpointValue } from '@chakra-ui/react'; import { GenericTableBody } from '@components/generic-table/components/generic-table-body'; import { GenericTableHeader } from '@components/generic-table/components/generic-table-header'; import { GenericTableHeaderText } from '@components/generic-table/components/generic-table-header-text'; @@ -10,32 +12,68 @@ interface ProtocolHistoryTableProps { } export function ProtocolHistoryTable({ items }: ProtocolHistoryTableProps): React.JSX.Element { - const dynamicHeight = items ? items.length * 59 + 20 : 20; + const [currentPage, setCurrentPage] = useState(1); + const itemsPerPage = 10; const isMobile = useBreakpointValue({ base: true, md: false }); + const totalPages = Math.ceil((items?.length || 0) / itemsPerPage); + + const currentItems = items?.slice((currentPage - 1) * itemsPerPage, currentPage * itemsPerPage); + + const handlePageChange = (direction: number) => { + setCurrentPage(prevPage => { + const newPage = prevPage + direction; + if (newPage < 1 || newPage > totalPages) return prevPage; + return newPage; + }); + }; + return ( - - - {isMobile ? ( - <> - Order Book - Transaction - - ) : ( - <> - Order Book - Merchant - Chain - Transaction - Date - - )} - - - - {items?.map(item => )} - - - + + + + {isMobile ? ( + <> + Order Book + Transaction + + ) : ( + <> + Order Book + Merchant + Chain + Transaction + Date + + )} + + + + {currentItems?.map(item => )} + + + + + + + + + ); } From 794c4e002005f900c04b13cdae94385e06d6a3dc Mon Sep 17 00:00:00 2001 From: Roza Eisenberg <45665959+rozanagy@users.noreply.github.com> Date: Tue, 19 Nov 2024 09:18:33 +0100 Subject: [PATCH 03/12] fix: updating loading message (#212) --- src/app/hooks/use-leather.ts | 2 +- src/app/hooks/use-unisat.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/hooks/use-leather.ts b/src/app/hooks/use-leather.ts index c8b13e6c..2c9e4ade 100644 --- a/src/app/hooks/use-leather.ts +++ b/src/app/hooks/use-leather.ts @@ -158,7 +158,7 @@ export function useLeather(): UseLeatherReturnType { feeRateMultiplier: number ): Promise { try { - setIsLoading([true, 'Creating Funding Transaction']); + setIsLoading([true, 'Creating Deposit Transaction']); // ==> Create Funding Transaction const fundingPSBT = await dlcHandler?.createFundingPSBT( diff --git a/src/app/hooks/use-unisat.ts b/src/app/hooks/use-unisat.ts index 3cf6c13f..60380227 100644 --- a/src/app/hooks/use-unisat.ts +++ b/src/app/hooks/use-unisat.ts @@ -207,7 +207,7 @@ export function useUnisat(): UseUnisatReturnType { feeRateMultiplier: number ): Promise { try { - setIsLoading([true, 'Creating Funding Transaction']); + setIsLoading([true, 'Creating Deposit Transaction']); // ==> Create Funding Transaction const fundingPSBT = await dlcHandler?.createFundingPSBT( From 301f526f2cb60f3f995f8141d0342de7b76e117c Mon Sep 17 00:00:00 2001 From: Polybius93 <99192647+Polybius93@users.noreply.github.com> Date: Wed, 20 Nov 2024 16:20:46 +0100 Subject: [PATCH 04/12] feat: modify confirmation checker return value and form input parsing (#213) * feat: modify confirmation checker return value and form input parsing * feat: disable lint errors where expected --- .../transaction-screen.transaction-form.tsx | 15 ++++++--------- src/app/hooks/use-blockchain-height-query.ts | 1 + src/app/hooks/use-confirmation-checker.ts | 3 ++- src/app/hooks/use-mint-burn-events.ts | 2 ++ src/app/hooks/use-points.ts | 1 + src/app/hooks/use-proof-of-reserve.ts | 1 + src/app/hooks/use-total-supply.ts | 1 + src/shared/utils.ts | 13 +++++++++++++ 8 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/app/components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/transaction-screen.transaction-form.tsx b/src/app/components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/transaction-screen.transaction-form.tsx index 917c90c5..0c8b0f63 100644 --- a/src/app/components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/transaction-screen.transaction-form.tsx +++ b/src/app/components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/transaction-screen.transaction-form.tsx @@ -8,7 +8,8 @@ import { BitcoinTransactionConfirmationsContext } from '@providers/bitcoin-query import { BitcoinWalletContextState } from '@providers/bitcoin-wallet-context-provider'; import { useForm } from '@tanstack/react-form'; import Decimal from 'decimal.js'; -import { isEmpty } from 'ramda'; + +import { parseAssetAmount } from '@shared/utils'; import { TransactionFormNavigateButtonGroup } from './components/transaction-screen.transaction-form.navigate-button-group'; import { TransactionFormProgressStack } from './components/transaction-screen.transaction-form.progress-stack/components/transaction-screen.transaction-form.progress-stack'; @@ -141,16 +142,12 @@ export function VaultTransactionForm({ }, validators: { onChange: ({ value }) => { - const assetAmount = value.assetAmount; - setCurrentFieldValue(isEmpty(assetAmount) ? 0 : new Decimal(value.assetAmount).toNumber()); + const decimalValue = parseAssetAmount(value.assetAmount); + setCurrentFieldValue(decimalValue.toNumber()); + return { fields: { - assetAmount: validateFormAmount( - parseFloat(value.assetAmount), - flow, - depositLimit, - vault - ), + assetAmount: validateFormAmount(decimalValue.toNumber(), flow, depositLimit, vault), }, }; }, diff --git a/src/app/hooks/use-blockchain-height-query.ts b/src/app/hooks/use-blockchain-height-query.ts index 3d204876..306f698a 100644 --- a/src/app/hooks/use-blockchain-height-query.ts +++ b/src/app/hooks/use-blockchain-height-query.ts @@ -9,6 +9,7 @@ export function useBlockchainHeightQuery(): number | undefined { if (!response.ok) throw new Error('Network response was not ok'); return response.json(); } catch (error) { + // eslint-disable-next-line no-console console.error('Error fetching blockchain height', error); return undefined; } diff --git a/src/app/hooks/use-confirmation-checker.ts b/src/app/hooks/use-confirmation-checker.ts index 62054ee9..56cfb826 100644 --- a/src/app/hooks/use-confirmation-checker.ts +++ b/src/app/hooks/use-confirmation-checker.ts @@ -34,7 +34,8 @@ export function useConfirmationChecker(): [string, number][] { try { const bitcoinTransactionBlockHeight = await fetchBitcoinTransactionBlockHeight(vault); - return blockHeight - bitcoinTransactionBlockHeight; + const difference = blockHeight - bitcoinTransactionBlockHeight; + return Math.max(difference, 0); } catch (error) { return 0; } diff --git a/src/app/hooks/use-mint-burn-events.ts b/src/app/hooks/use-mint-burn-events.ts index b9cfdbdb..19c597b1 100644 --- a/src/app/hooks/use-mint-burn-events.ts +++ b/src/app/hooks/use-mint-burn-events.ts @@ -22,6 +22,7 @@ export function useMintBurnEvents(): UseMintBurnEventsReturnType { return await response.json(); } catch (error) { + // eslint-disable-next-line no-console console.error(`Error fetching mint burn events`, error); return []; } @@ -60,6 +61,7 @@ export function useMintBurnEvents(): UseMintBurnEventsReturnType { merchantMintBurnEvents: mintBurnEvents, }; } catch (error) { + // eslint-disable-next-line no-console console.error(`Error fetching mint burn events`, error); return undefined; } diff --git a/src/app/hooks/use-points.ts b/src/app/hooks/use-points.ts index 27200971..7f7187ae 100644 --- a/src/app/hooks/use-points.ts +++ b/src/app/hooks/use-points.ts @@ -25,6 +25,7 @@ export function usePoints(): UsePointsReturnType { return responseData.points; } catch (error) { + // eslint-disable-next-line no-console console.error(`Error fetching user: ${address} points`, error); return undefined; } diff --git a/src/app/hooks/use-proof-of-reserve.ts b/src/app/hooks/use-proof-of-reserve.ts index 5d353f49..0bfccaf2 100644 --- a/src/app/hooks/use-proof-of-reserve.ts +++ b/src/app/hooks/use-proof-of-reserve.ts @@ -29,6 +29,7 @@ export function useProofOfReserve(): UseProofOfReserveReturnType { return await response.json(); } catch (error) { + // eslint-disable-next-line no-console console.error('Error fetching Proof of Reserve', error); return 0; } diff --git a/src/app/hooks/use-total-supply.ts b/src/app/hooks/use-total-supply.ts index 0a61d161..ee0aaef2 100644 --- a/src/app/hooks/use-total-supply.ts +++ b/src/app/hooks/use-total-supply.ts @@ -19,6 +19,7 @@ export function useTotalSupply(): UseTotalSupplyReturnType { return responseData; } catch (error) { + // eslint-disable-next-line no-console console.error('Error fetching Total Supply', error); return undefined; } diff --git a/src/shared/utils.ts b/src/shared/utils.ts index 53f98c03..91f22573 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -51,6 +51,19 @@ export function formatEvent(event: DetailedEvent): FormattedEvent { }; } +export function parseAssetAmount(assetAmount: string): Decimal { + const isValidNumber = /^-?\d*\.?\d*$/.test(assetAmount); + + if (isValidNumber) { + try { + return new Decimal(assetAmount); + } catch { + return new Decimal(0); + } + } + return new Decimal(0); +} + export function formatToFourDecimals(value: number): number { return parseFloat(value.toFixed(4)); } From fd97e619301f74615af81c014576b71e19c8fdc4 Mon Sep 17 00:00:00 2001 From: Polybius93 <99192647+Polybius93@users.noreply.github.com> Date: Thu, 21 Nov 2024 10:06:50 +0100 Subject: [PATCH 05/12] feat: add xrpl (#202) * feat: add xrpl --- config.devnet.json | 3 + config.mainnet.json | 3 + config.testnet.json | 3 + .../fetch-attestor-group-public-key.ts | 42 +++ .../functions/submit-xrpl-vault-request.ts | 62 ++++ package.json | 7 +- public/images/logos/gem-wallet-logo.svg | 1 + public/images/logos/xrp-logo.svg | 16 + src/app/app.tsx | 65 ++-- src/app/components/account/account.tsx | 52 +++- .../account/components/account-menu.tsx | 13 +- src/app/components/header/header.tsx | 16 +- .../bottom/components/how-to-mint.tsx | 3 +- .../bottom/components/how-to-unmint.tsx | 5 +- .../burn-transaction-screen.tsx | 66 ++-- .../deposit-transaction-screen.tsx | 19 +- .../mint-unmint/components/mint/mint.tsx | 11 +- .../setup-vault-screen/setup-vault-screen.tsx | 28 +- .../components/unmint-vault-selector.tsx | 12 +- .../unmint/components/withdraw-screen.tsx | 10 +- .../mint-unmint/components/unmint/unmint.tsx | 11 +- .../components/walkthrough-blockchain-tag.tsx | 10 +- .../components/walkthrough-header.tsx | 4 +- .../components/walkthrough/walkthrough.tsx | 129 ++++---- .../modals/components/modal-container.tsx | 8 +- ...nu.tsx => select-ethereum-wallet-menu.tsx} | 6 +- .../components/select-ripple-wallet-menu.tsx | 33 ++ .../select-wallet-modal.tsx | 179 +++++++++-- .../successful-flow-modal.tsx | 15 +- .../my-vaults-small/my-vaults-small.tsx | 51 ++-- .../my-vaults-header/my-vaults-header.tsx | 8 +- .../components/my-vaults/my-vaults-large.tsx | 47 +-- .../network/components/networks-menu.tsx | 18 +- .../protocol-history-table-item.tsx | 1 - .../select-network-button.tsx | 57 +++- ...on-screen.transaction-form.field-input.tsx | 2 +- ...transaction-form.navigate-button-group.tsx | 24 +- ...n.transaction-form.submit-button-group.tsx | 10 +- .../vault.detaills/vault.details.tsx | 24 +- src/app/components/vault/vault.tsx | 6 +- .../vaults-list-group-container.tsx | 11 +- .../functions/attestor-request.functions.ts | 36 +++ src/app/functions/configuration.functions.ts | 10 + src/app/functions/vault.functions.ts | 9 - src/app/hooks/use-active-tabs.ts | 33 +- src/app/hooks/use-connected.ts | 35 +++ src/app/hooks/use-deposit-limits.ts | 35 ++- src/app/hooks/use-ethereum-observer.ts | 149 --------- src/app/hooks/use-evm-vaults.ts | 204 +++++++++++++ src/app/hooks/use-psbt.ts | 73 +++-- src/app/hooks/use-vaults.ts | 126 -------- src/app/hooks/use-xrp-wallet.ts | 89 ++++++ src/app/hooks/use-xrpl-gem.ts | 109 +++++++ src/app/hooks/use-xrpl-ledger.ts | 165 ++++++++++ src/app/hooks/use-xrpl-vaults.ts | 200 ++++++++++++ src/app/pages/dashboard/dashboard.tsx | 6 +- .../providers/balance-context-provider.tsx | 64 ++-- .../providers/ethereum-observer-provider.tsx | 8 - .../network-configuration.provider.tsx | 29 ++ .../providers/network-connection.provider.tsx | 25 ++ .../ripple-network-configuration.provider.tsx | 106 +++++++ src/app/providers/vault-context-provider.tsx | 39 ++- .../providers/xrp-wallet-context-provider.tsx | 71 +++++ src/app/store/index.ts | 3 - .../slices/mintunmint/mintunmint.slice.ts | 44 ++- src/app/store/slices/modal/modal.slice.ts | 8 +- src/app/store/slices/vault/vault.actions.ts | 3 - src/app/store/slices/vault/vault.slice.ts | 55 ---- src/shared/constants/network.constants.ts | 5 + src/shared/constants/ripple.constants.ts | 14 + src/shared/models/configuration.ts | 4 + src/shared/models/error-types.ts | 7 + src/shared/models/ledger.ts | 1 + src/shared/models/ripple.models.ts | 17 ++ src/shared/models/wallet.ts | 24 ++ yarn.lock | 286 +++++++++++++----- 76 files changed, 2357 insertions(+), 826 deletions(-) create mode 100644 netlify/functions/fetch-attestor-group-public-key.ts create mode 100644 netlify/functions/submit-xrpl-vault-request.ts create mode 100644 public/images/logos/gem-wallet-logo.svg create mode 100644 public/images/logos/xrp-logo.svg rename src/app/components/modals/select-wallet-modal/components/{select-wallet-menu.tsx => select-ethereum-wallet-menu.tsx} (91%) create mode 100644 src/app/components/modals/select-wallet-modal/components/select-ripple-wallet-menu.tsx create mode 100644 src/app/functions/attestor-request.functions.ts create mode 100644 src/app/hooks/use-connected.ts delete mode 100644 src/app/hooks/use-ethereum-observer.ts create mode 100644 src/app/hooks/use-evm-vaults.ts delete mode 100644 src/app/hooks/use-vaults.ts create mode 100644 src/app/hooks/use-xrp-wallet.ts create mode 100644 src/app/hooks/use-xrpl-gem.ts create mode 100644 src/app/hooks/use-xrpl-ledger.ts create mode 100644 src/app/hooks/use-xrpl-vaults.ts delete mode 100644 src/app/providers/ethereum-observer-provider.tsx create mode 100644 src/app/providers/network-configuration.provider.tsx create mode 100644 src/app/providers/network-connection.provider.tsx create mode 100644 src/app/providers/ripple-network-configuration.provider.tsx create mode 100644 src/app/providers/xrp-wallet-context-provider.tsx delete mode 100644 src/app/store/slices/vault/vault.actions.ts delete mode 100644 src/app/store/slices/vault/vault.slice.ts create mode 100644 src/shared/constants/network.constants.ts create mode 100644 src/shared/constants/ripple.constants.ts create mode 100644 src/shared/models/ripple.models.ts diff --git a/config.devnet.json b/config.devnet.json index 524e8cd6..da279717 100644 --- a/config.devnet.json +++ b/config.devnet.json @@ -2,12 +2,15 @@ "appEnvironment": "devnet", "coordinatorURL": "https://devnet.dlc.link/attestor-1", "enabledEthereumNetworkIDs": ["421614", "84532", "11155111"], + "enabledRippleNetworkIDs": ["1"], "bitcoinNetwork": "regtest", "bitcoinNetworkIndex": 1, "bitcoinNetworkPreFix": "bcrt1", "bitcoinBlockchainURL": "https://devnet.dlc.link/electrs", "bitcoinBlockchainExplorerURL": "https://devnet.dlc.link/electrs", "bitcoinBlockchainFeeEstimateURL": "https://devnet.dlc.link/electrs/fee-estimates", + "rippleIssuerAddress": "rLTBw1MEy45uE5qmkWseinbj7h4zmdQuR8", + "xrplWebsocket": "wss://s.altnet.rippletest.net:51233", "ledgerApp": "Bitcoin Test", "merchants": [ { diff --git a/config.mainnet.json b/config.mainnet.json index a545d9ed..30288755 100644 --- a/config.mainnet.json +++ b/config.mainnet.json @@ -2,12 +2,15 @@ "appEnvironment": "mainnet", "coordinatorURL": "https://mainnet.dlc.link/attestor-1", "enabledEthereumNetworkIDs": ["42161", "8453"], + "enabledRippleNetworkIDs": ["0"], "bitcoinNetwork": "mainnet", "bitcoinNetworkIndex": 0, "bitcoinNetworkPreFix": "bc1", "bitcoinBlockchainURL": "https://mainnet.dlc.link/electrs", "bitcoinBlockchainExplorerURL": "https://mempool.space", "bitcoinBlockchainFeeEstimateURL": "https://mempool.space/api/v1/fees/recommended", + "rippleIssuerAddress": "rGcyRGrZPaJAZbZDi4NqRFLA5GQH63iFpD", + "xrplWebsocket": "wss://xrpl.ws/", "ledgerApp": "Bitcoin", "merchants": [ { diff --git a/config.testnet.json b/config.testnet.json index 5b62a442..ac5dad86 100644 --- a/config.testnet.json +++ b/config.testnet.json @@ -2,12 +2,15 @@ "appEnvironment": "testnet", "coordinatorURL": "https://testnet.dlc.link/attestor-1", "enabledEthereumNetworkIDs": ["421614", "84532", "11155111"], + "enabledRippleNetworkIDs": ["1"], "bitcoinNetwork": "testnet", "bitcoinNetworkIndex": 1, "bitcoinNetworkPreFix": "tb1", "bitcoinBlockchainURL": "https://testnet.dlc.link/electrs", "bitcoinBlockchainExplorerURL": "https://mempool.space/testnet", "bitcoinBlockchainFeeEstimateURL": "https://mempool.space/testnet/api/v1/fees/recommended", + "rippleIssuerAddress": "ra3oyRVfy4yD4NJPrVcewvDtisZ3FhkcYL", + "xrplWebsocket": "wss://testnet.xrpl-labs.com/", "ledgerApp": "Bitcoin Test", "merchants": [ { diff --git a/netlify/functions/fetch-attestor-group-public-key.ts b/netlify/functions/fetch-attestor-group-public-key.ts new file mode 100644 index 00000000..ad9b605f --- /dev/null +++ b/netlify/functions/fetch-attestor-group-public-key.ts @@ -0,0 +1,42 @@ +import { Handler, HandlerEvent } from '@netlify/functions'; +import { getAttestorExtendedGroupPublicKey } from 'dlc-btc-lib/attestor-request-functions'; + +const handler: Handler = async (event: HandlerEvent) => { + try { + if (!event.queryStringParameters) { + return { + statusCode: 400, + body: JSON.stringify({ + message: 'No Parameters were provided', + }), + }; + } + + if (!event.queryStringParameters.coordinatorURL) { + return { + statusCode: 400, + body: JSON.stringify({ + message: 'No Coordinator URL was provided', + }), + }; + } + + const coordinatorURL = event.queryStringParameters.coordinatorURL; + + const attestorGroupPublicKey = await getAttestorExtendedGroupPublicKey(coordinatorURL); + + return { + statusCode: 200, + body: attestorGroupPublicKey, + }; + } catch (error: any) { + return { + statusCode: 500, + body: JSON.stringify({ + message: `Failed to get Attestor Group Public Key: ${error.message}`, + }), + }; + } +}; + +export { handler }; diff --git a/netlify/functions/submit-xrpl-vault-request.ts b/netlify/functions/submit-xrpl-vault-request.ts new file mode 100644 index 00000000..2dd564db --- /dev/null +++ b/netlify/functions/submit-xrpl-vault-request.ts @@ -0,0 +1,62 @@ +import { Handler, HandlerEvent } from '@netlify/functions'; +import { submitSetupXRPLVaultRequest } from 'dlc-btc-lib/attestor-request-functions'; +import { AttestorChainID } from 'dlc-btc-lib/models'; + +const handler: Handler = async (event: HandlerEvent) => { + try { + if (!event.queryStringParameters) { + return { + statusCode: 400, + body: JSON.stringify({ + message: 'No Parameters were provided', + }), + }; + } + + if (!event.queryStringParameters.coordinatorURL) { + return { + statusCode: 400, + body: JSON.stringify({ + message: 'No Coordinator URL was provided', + }), + }; + } + + if (!event.queryStringParameters.userXRPLAddress) { + return { + statusCode: 400, + body: JSON.stringify({ + message: 'No XRPL User Address was provided', + }), + }; + } + + if (!event.queryStringParameters.attestorChainID) { + return { + statusCode: 400, + body: JSON.stringify({ + message: 'No Attestor Chain ID was provided', + }), + }; + } + + const coordinatorURL = event.queryStringParameters.coordinatorURL; + const userXRPLAddress = event.queryStringParameters.userXRPLAddress; + const attestorChainID = event.queryStringParameters.attestorChainID as AttestorChainID; + + await submitSetupXRPLVaultRequest(coordinatorURL, userXRPLAddress, attestorChainID); + + return { + statusCode: 200, + }; + } catch (error: any) { + return { + statusCode: 500, + body: JSON.stringify({ + message: `Failed to submit Setup XRPL Vault Request: ${error.message}`, + }), + }; + } +}; + +export { handler }; diff --git a/package.json b/package.json index 63b19aed..46d91a62 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,8 @@ "@fontsource/inter": "^5.0.18", "@fontsource/onest": "^5.0.3", "@fontsource/poppins": "^5.0.8", + "@gemwallet/api": "^3.8.0", + "@ledgerhq/hw-app-xrp": "^6.29.4", "@ledgerhq/hw-transport-webusb": "^6.28.6", "@netlify/functions": "^2.8.1", "@reduxjs/toolkit": "^1.9.7", @@ -44,7 +46,7 @@ "concurrently": "^8.2.2", "d3": "^7.9.0", "decimal.js": "^10.4.3", - "dlc-btc-lib": "2.2.7", + "dlc-btc-lib": "2.4.12", "dotenv": "^16.3.1", "ethers": "5.7.2", "formik": "^2.4.5", @@ -64,7 +66,8 @@ "redux-persist-expire": "^1.1.1", "viem": "2.x", "vite-plugin-toml": "^0.7.0", - "wagmi": "^2.12.2" + "wagmi": "^2.12.2", + "xrpl": "^4.0.0" }, "devDependencies": { "@ls-lint/ls-lint": "^2.2.2", diff --git a/public/images/logos/gem-wallet-logo.svg b/public/images/logos/gem-wallet-logo.svg new file mode 100644 index 00000000..592bf617 --- /dev/null +++ b/public/images/logos/gem-wallet-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/logos/xrp-logo.svg b/public/images/logos/xrp-logo.svg new file mode 100644 index 00000000..b340e958 --- /dev/null +++ b/public/images/logos/xrp-logo.svg @@ -0,0 +1,16 @@ + + + + + x + + + + + + + diff --git a/src/app/app.tsx b/src/app/app.tsx index d2f0d892..f3cc5404 100644 --- a/src/app/app.tsx +++ b/src/app/app.tsx @@ -12,8 +12,11 @@ import { BalanceContextProvider } from '@providers/balance-context-provider'; import { BitcoinTransactionConfirmationsProvider } from '@providers/bitcoin-query-provider'; import { BitcoinWalletContextProvider } from '@providers/bitcoin-wallet-context-provider'; import { EthereumNetworkConfigurationContextProvider } from '@providers/ethereum-network-configuration.provider'; -import { EthereumObserverProvider } from '@providers/ethereum-observer-provider'; +import { NetworkConfigurationContextProvider } from '@providers/network-configuration.provider'; +import { NetworkConnectionContextProvider } from '@providers/network-connection.provider'; import { ProofOfReserveContextProvider } from '@providers/proof-of-reserve-context-provider'; +import { RippleNetworkConfigurationContextProvider } from '@providers/ripple-network-configuration.provider'; +import { XRPWalletContextProvider } from '@providers/xrp-wallet-context-provider'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { WagmiProvider } from 'wagmi'; @@ -28,33 +31,39 @@ export function App(): React.JSX.Element { return ( - - - - - - - - - } /> - } /> - {/* } /> */} - } /> - } /> - } - /> - } /> - } /> - - - - - - - - + + + + + + + + + + + + } /> + } /> + {/* } /> */} + } /> + } /> + } + /> + } /> + } /> + + + + + + + + + + + ); diff --git a/src/app/components/account/account.tsx b/src/app/components/account/account.tsx index f79719fc..9aa75da3 100644 --- a/src/app/components/account/account.tsx +++ b/src/app/components/account/account.tsx @@ -1,24 +1,64 @@ +import { useContext } from 'react'; import { useDispatch } from 'react-redux'; import { Button, HStack, useBreakpointValue } from '@chakra-ui/react'; import { AccountMenu } from '@components/account/components/account-menu'; +import { XRPWallet, xrpWallets } from '@models/wallet'; +import { NetworkConfigurationContext } from '@providers/network-configuration.provider'; +import { NetworkConnectionContext } from '@providers/network-connection.provider'; +import { XRPWalletContext } from '@providers/xrp-wallet-context-provider'; import { mintUnmintActions } from '@store/slices/mintunmint/mintunmint.actions'; import { modalActions } from '@store/slices/modal/modal.actions'; -import { useAccount, useDisconnect } from 'wagmi'; +import { Connector, useAccount, useDisconnect } from 'wagmi'; + +import { NetworkType } from '@shared/constants/network.constants'; export function Account(): React.JSX.Element { const dispatch = useDispatch(); - const { address, connector, isConnected } = useAccount(); - const { disconnect } = useDisconnect(); + const { isConnected } = useContext(NetworkConnectionContext); + const { networkType } = useContext(NetworkConfigurationContext); + const isMobile = useBreakpointValue({ base: true, md: false }); + const { address: ethereumUserAddress, connector: ethereumWallet } = useAccount(); + const { disconnect: disconnectEthereumWallet } = useDisconnect(); + const { + userAddress: rippleUserAddress, + xrpWalletType, + resetXRPWalletContext, + } = useContext(XRPWalletContext); + + function getWalletInformation(): { address: string; wallet: XRPWallet | Connector } | undefined { + switch (networkType) { + case NetworkType.EVM: + if (!ethereumUserAddress || !ethereumWallet) return undefined; + return { address: ethereumUserAddress, wallet: ethereumWallet }; + case NetworkType.XRPL: + if (!rippleUserAddress) return undefined; + return { + address: rippleUserAddress, + wallet: xrpWallets.find(xrpWallet => xrpWallet.id === xrpWalletType)!, + }; + default: + throw new Error('Invalid Network Type'); + } + } function onConnectWalletClick(): void { dispatch(modalActions.toggleSelectWalletModalVisibility()); } function onDisconnectWalletClick(): void { - disconnect(); + switch (networkType) { + case NetworkType.EVM: + disconnectEthereumWallet(); + break; + case NetworkType.XRPL: + resetXRPWalletContext(); + break; + default: + break; + } dispatch(mintUnmintActions.resetMintUnmintState()); } @@ -26,8 +66,8 @@ export function Account(): React.JSX.Element { {isConnected ? ( onDisconnectWalletClick()} /> ) : ( diff --git a/src/app/components/account/components/account-menu.tsx b/src/app/components/account/components/account-menu.tsx index 175ee4a8..553f7cdb 100644 --- a/src/app/components/account/components/account-menu.tsx +++ b/src/app/components/account/components/account-menu.tsx @@ -9,23 +9,24 @@ import { Text, useBreakpointValue, } from '@chakra-ui/react'; +import { XRPWallet } from '@models/wallet'; import { truncateAddress } from 'dlc-btc-lib/utilities'; import { Connector } from 'wagmi'; interface AccountMenuProps { address?: string; - wagmiConnector?: Connector; + wallet?: Connector | XRPWallet; handleDisconnectWallet: () => void; } export function AccountMenu({ address, - wagmiConnector, + wallet, handleDisconnectWallet, }: AccountMenuProps): React.JSX.Element | false { const isMobile = useBreakpointValue({ base: true, md: false }); - if (!address || !wagmiConnector) return false; + if (!address) return false; return ( @@ -35,11 +36,11 @@ export function AccountMenu({ {wagmiConnector.name} {truncateAddress(address)} diff --git a/src/app/components/header/header.tsx b/src/app/components/header/header.tsx index 50c29ed6..55e9127e 100644 --- a/src/app/components/header/header.tsx +++ b/src/app/components/header/header.tsx @@ -1,16 +1,23 @@ -import React, { useEffect, useState } from 'react'; +import React, { useContext, useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { VStack, useBreakpointValue } from '@chakra-ui/react'; +import { NetworkConfigurationContext } from '@providers/network-configuration.provider'; +import { NetworkConnectionContext } from '@providers/network-connection.provider'; import { useAccount } from 'wagmi'; +import { NetworkType } from '@shared/constants/network.constants'; + import { Banner } from './components/banner'; import DesktopHeader from './components/desktop-header'; import MobileHeader from './components/mobile-header'; export function Header(): React.JSX.Element { const navigate = useNavigate(); - const { chain, isConnected } = useAccount(); + const { isConnected } = useContext(NetworkConnectionContext); + + const { networkType } = useContext(NetworkConfigurationContext); + const { chain: ethereumNetwork } = useAccount(); const [showBanner, setShowBanner] = useState(false); const [isNetworkMenuOpen, setIsNetworkMenuOpen] = useState(false); @@ -22,14 +29,13 @@ export function Header(): React.JSX.Element { const isMobile = useBreakpointValue({ base: true, md: false }); useEffect(() => { - if (isConnected && !chain) { + if (networkType === NetworkType.EVM && isConnected && !ethereumNetwork) { setShowBanner(true); } else { setShowBanner(false); } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [chain]); + }, [isConnected, ethereumNetwork]); return ( diff --git a/src/app/components/how-it-works/bottom/components/how-to-mint.tsx b/src/app/components/how-it-works/bottom/components/how-to-mint.tsx index 3d1cc3a8..b5b56e0c 100644 --- a/src/app/components/how-it-works/bottom/components/how-to-mint.tsx +++ b/src/app/components/how-it-works/bottom/components/how-to-mint.tsx @@ -4,6 +4,7 @@ import { useNavigate } from 'react-router-dom'; import { Box, Button, Image, Text } from '@chakra-ui/react'; import { IntroVideo } from '@components/how-it-works/top/components/intro-video'; import { mintUnmintActions } from '@store/slices/mintunmint/mintunmint.actions'; +import { MintSteps } from '@store/slices/mintunmint/mintunmint.slice'; import { CustomCard } from '../../components/custom-card'; import { FlowStep } from './flow-step'; @@ -77,7 +78,7 @@ export function HowToMint(): React.JSX.Element { + ); } diff --git a/src/app/components/mint-unmint/components/unmint/components/unmint-vault-selector.tsx b/src/app/components/mint-unmint/components/unmint/components/unmint-vault-selector.tsx index 63ae7a42..445ffe6a 100644 --- a/src/app/components/mint-unmint/components/unmint/components/unmint-vault-selector.tsx +++ b/src/app/components/mint-unmint/components/unmint/components/unmint-vault-selector.tsx @@ -6,6 +6,7 @@ import { VaultsListGroupContainer } from '@components/vaults-list/components/vau import { VaultsList } from '@components/vaults-list/vaults-list'; import { VaultContext } from '@providers/vault-context-provider'; import { RootState } from '@store/index'; +import { VaultState } from 'dlc-btc-lib/models'; import { BurnTokenTransactionForm } from '../../burn-transaction-screen/burn-transaction-screen'; @@ -26,7 +27,7 @@ export function UnmintVaultSelector({ return ( <> - {unmintStep[1] ? ( + {unmintStep.vault ? ( Select vault to withdraw Bitcoin: - - + + )} diff --git a/src/app/components/mint-unmint/components/unmint/components/withdraw-screen.tsx b/src/app/components/mint-unmint/components/unmint/components/withdraw-screen.tsx index 392e4792..3327bace 100644 --- a/src/app/components/mint-unmint/components/unmint/components/withdraw-screen.tsx +++ b/src/app/components/mint-unmint/components/unmint/components/withdraw-screen.tsx @@ -9,9 +9,9 @@ import { BitcoinWalletContextState, } from '@providers/bitcoin-wallet-context-provider'; import { ProofOfReserveContext } from '@providers/proof-of-reserve-context-provider'; -import { VaultContext } from '@providers/vault-context-provider'; import { RootState } from '@store/index'; import { mintUnmintActions } from '@store/slices/mintunmint/mintunmint.actions'; +import { RedeemSteps } from '@store/slices/mintunmint/mintunmint.slice'; import { modalActions } from '@store/slices/modal/modal.actions'; interface WithdrawScreenProps { @@ -29,10 +29,10 @@ export function WithdrawScreen({ const { bitcoinWalletContextState, resetBitcoinWalletContext } = useContext(BitcoinWalletContext); const { bitcoinPrice, depositLimit } = useContext(ProofOfReserveContext); - const { allVaults } = useContext(VaultContext); const { unmintStep } = useSelector((state: RootState) => state.mintunmint); - const currentVault = allVaults.find(vault => vault.uuid === unmintStep[1]); + + const currentVault = unmintStep.vault; const [isSubmitting, setIsSubmitting] = useState(false); @@ -60,7 +60,7 @@ export function WithdrawScreen({ function handleCancel() { resetBitcoinWalletContext(); - dispatch(mintUnmintActions.setUnmintStep([0, ''])); + dispatch(mintUnmintActions.setUnmintStep({ step: RedeemSteps.BURN, vault: undefined })); } async function handleButtonClick(assetAmount: number) { @@ -75,7 +75,7 @@ export function WithdrawScreen({ state.mintunmint); const { risk, fetchUserAddressRisk, isLoading } = useRisk(); return ( - + - - {[0].includes(unmintStep[0]) && ( + + {[0].includes(unmintStep.step) && ( )} - {[1, 2].includes(unmintStep[0]) && ( + {[1, 2].includes(unmintStep.step) && ( - - Initiate a Vault on the blockchain and confirm it in your{' '} - - Ethereum Wallet - - . - + {networkType === NetworkType.EVM ? ( + + Initiate a Vault on the blockchain and confirm it in your{' '} + + Ethereum Wallet + + . + + ) : ( + + Initiate a Setup Vault request. If the TrustLine is not yet established, sign the + Set TrustLine Transaction in your wallet. Then, wait for the Attestors to confirm + your request and set up the Vault on the blockchain. + + )} ); @@ -45,20 +60,12 @@ export function Walkthrough({ flow, currentStep }: WalkthroughProps): React.JSX. Enter the Bitcoin amount you wish to deposit into the vault, then verify the - transaction through your{' '} - - Bitcoin Wallet{' '} - - which will lock your Bitcoin on-chain. You will receive equivalent amount of dlcBTC. + transaction through your Bitcoin Wallet which will lock your Bitcoin on-chain. You + will receive equivalent amount of dlcBTC. ); @@ -68,32 +75,33 @@ export function Walkthrough({ flow, currentStep }: WalkthroughProps): React.JSX. - Wait for Bitcoin to get locked on chain{' '} - - (~1 hour) - - . After 6 confirmations, dlcBTC tokens will appear in your Ethereum Wallet. - - - To ensure your dlcBTC tokens - are visible - simply add them - to your Ethereum Wallet. + Wait for Bitcoin to get locked on chain (~1 hour). After 6 confirmations, dlcBTC + tokens will appear in your Wallet. - + {networkType === NetworkType.EVM && ( + <> + + To ensure your dlcBTC tokens + are visible + simply add them + to your Ethereum Wallet. + + + + + )} ); default: @@ -102,7 +110,7 @@ export function Walkthrough({ flow, currentStep }: WalkthroughProps): React.JSX. ); @@ -115,12 +123,19 @@ export function Walkthrough({ flow, currentStep }: WalkthroughProps): React.JSX. - - Select the dlcBTC vault you would like to withdraw from. Burn the desired amount of - dlcBTC to receive the equivalent amount of BTC. - + {networkType === NetworkType.EVM ? ( + + Select the dlcBTC vault you would like to withdraw from. Burn the desired amount + of dlcBTC to receive the equivalent amount of BTC. + + ) : ( + + Select the dlcBTC vault you would like to withdraw from. Sign a check with the + desired amount of dlcBTC to receive the equivalent amount of BTC. + + )} ); case 1: @@ -129,7 +144,7 @@ export function Walkthrough({ flow, currentStep }: WalkthroughProps): React.JSX. {`Once the dlcBTC has been burned, you can withdraw an `} @@ -146,7 +161,7 @@ export function Walkthrough({ flow, currentStep }: WalkthroughProps): React.JSX. After a successful withdraw ( @@ -161,7 +176,7 @@ export function Walkthrough({ flow, currentStep }: WalkthroughProps): React.JSX. ); diff --git a/src/app/components/modals/components/modal-container.tsx b/src/app/components/modals/components/modal-container.tsx index 761fa989..84b71b2e 100644 --- a/src/app/components/modals/components/modal-container.tsx +++ b/src/app/components/modals/components/modal-container.tsx @@ -35,18 +35,20 @@ export function ModalContainer(): React.JSX.Element { /> handleClosingModal(() => modalActions.toggleSuccessfulFlowModalVisibility({ vaultUUID: '', + vault: undefined, flow: 'mint', assetAmount: 0, }) ) } - vaultUUID={isSuccesfulFlowModalOpen[1] ? isSuccesfulFlowModalOpen[1] : ''} + vaultUUID={isSuccesfulFlowModalOpen[2] ? isSuccesfulFlowModalOpen[2] : ''} /> void; } -export function SelectWalletMenu({ +export function SelectEthereumWalletMenu({ wagmiConnector, selectedWagmiConnectorID, isConnectWalletPending, isConnectWalletSuccess, handleConnectWallet, -}: SelectWalletMenuProps): React.JSX.Element { +}: SelectEthereumWalletMenuProps): React.JSX.Element { const { id, icon, name } = wagmiConnector; const isThisWalletSelected = selectedWagmiConnectorID === id; diff --git a/src/app/components/modals/select-wallet-modal/components/select-ripple-wallet-menu.tsx b/src/app/components/modals/select-wallet-modal/components/select-ripple-wallet-menu.tsx new file mode 100644 index 00000000..f9c35fa1 --- /dev/null +++ b/src/app/components/modals/select-wallet-modal/components/select-ripple-wallet-menu.tsx @@ -0,0 +1,33 @@ +import { Box, Button, HStack, Image, Text } from '@chakra-ui/react'; +import { XRPWallet, XRPWalletType } from '@models/wallet'; + +interface SelectRippleWalletMenuProps { + rippleWallet: XRPWallet; + handleConnectWallet: (xrpWalletType: XRPWalletType) => void; +} + +export function SelectRippleWalletMenu({ + rippleWallet, + handleConnectWallet, +}: SelectRippleWalletMenuProps): React.JSX.Element { + const { id, icon, name } = rippleWallet; + + return ( + + ); +} diff --git a/src/app/components/modals/select-wallet-modal/select-wallet-modal.tsx b/src/app/components/modals/select-wallet-modal/select-wallet-modal.tsx index ea08d08d..8d94aeef 100644 --- a/src/app/components/modals/select-wallet-modal/select-wallet-modal.tsx +++ b/src/app/components/modals/select-wallet-modal/select-wallet-modal.tsx @@ -1,56 +1,147 @@ -import { useEffect, useState } from 'react'; +import { useContext, useEffect, useState } from 'react'; import { CheckIcon } from '@chakra-ui/icons'; -import { HStack, ScaleFade, Text, VStack } from '@chakra-ui/react'; +import { HStack, ScaleFade, Tab, TabList, Tabs, Text, VStack, useToast } from '@chakra-ui/react'; import { ModalComponentProps } from '@components/modals/components/modal-container'; import { ModalLayout } from '@components/modals/components/modal.layout'; -import { SelectWalletMenu } from '@components/modals/select-wallet-modal/components/select-wallet-menu'; import { SelectNetworkButton } from '@components/select-network-button/select-network-button'; +import { TransactionScreenWalletInformation } from '@components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/components/transaction-screen.transaction-form.wallet-information'; +import { useGemWallet } from '@hooks/use-xrpl-gem'; +import { useXRPLLedger } from '@hooks/use-xrpl-ledger'; +import { RippleNetworkID } from '@models/ripple.models'; +import { XRPWalletType, xrpWallets } from '@models/wallet'; +import { NetworkConfigurationContext } from '@providers/network-configuration.provider'; +import { RippleNetworkConfigurationContext } from '@providers/ripple-network-configuration.provider'; +import { XRPWalletContext, XRPWalletContextState } from '@providers/xrp-wallet-context-provider'; +import { EthereumNetworkID } from 'dlc-btc-lib/models'; import { delay } from 'dlc-btc-lib/utilities'; -import { Chain } from 'viem'; import { Connector, useConfig, useConnect } from 'wagmi'; +import { NetworkType } from '@shared/constants/network.constants'; + +import { SelectEthereumWalletMenu } from './components/select-ethereum-wallet-menu'; +import { SelectRippleWalletMenu } from './components/select-ripple-wallet-menu'; + +function formatErrorMessage(error: string): string { + if (error.includes('0x6985')) { + return 'Action Rejected by User'; + } else if (error.includes('0x5515')) { + return 'Locked Device'; + } else { + return error; + } +} + export function SelectWalletModal({ isOpen, handleClose }: ModalComponentProps): React.JSX.Element { + const toast = useToast(); const { connect, isPending, isSuccess, connectors } = useConnect(); - const { chains } = useConfig(); + const { chains: ethereumNetworks } = useConfig(); - const [selectedEthereumNetwork, setSelectedEthereumNetwork] = useState( - undefined + const { setNetworkType } = useContext(NetworkConfigurationContext); + const { + setXRPWalletType, + setXRPWalletContextState, + setUserAddress, + xrpWalletContextState, + setXRPHandler, + } = useContext(XRPWalletContext); + const { connectLedgerWallet, isLoading } = useXRPLLedger(); + const { connectGemWallet } = useGemWallet(); + const { enabledRippleNetworks } = useContext(RippleNetworkConfigurationContext); + + const ethereumNetworkIDs = ethereumNetworks.map( + ethereumNetwork => ethereumNetwork.id.toString() as EthereumNetworkID ); + const rippleNetworkIDs = enabledRippleNetworks.map(rippleNetwork => rippleNetwork.id); + + const [selectedNetworkType, setSelectedNetworkType] = useState(NetworkType.EVM); + + const [selectedNetworkID, setSelectedNetworkID] = useState< + EthereumNetworkID | RippleNetworkID | undefined + >(undefined); + const [selectedWagmiConnectorID, setSelectedWagmiConnectorID] = useState( undefined ); useEffect(() => { - if (isSuccess) { + if (isSuccess || xrpWalletContextState === XRPWalletContextState.READY) { void handleCloseAfterSuccess(); } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [isSuccess]); + }, [isSuccess, xrpWalletContextState]); async function handleCloseAfterSuccess() { await delay(1000); - setSelectedEthereumNetwork(undefined); + setSelectedNetworkID(undefined); setSelectedWagmiConnectorID(undefined); - if (selectedWagmiConnectorID && selectedWagmiConnectorID !== 'walletConnect') handleClose(); + if (selectedWagmiConnectorID !== 'walletConnect') handleClose(); + setSelectedNetworkType(NetworkType.EVM); } - async function handleConnectWallet(wagmiConnector: Connector) { + async function handleConnectEthereumWallet(wagmiConnector: Connector) { + if (selectedNetworkID === undefined) return; setSelectedWagmiConnectorID(wagmiConnector.id); - connect({ chainId: selectedEthereumNetwork?.id, connector: wagmiConnector }); + connect({ chainId: Number(selectedNetworkID), connector: wagmiConnector }); + setNetworkType(NetworkType.EVM); if (wagmiConnector.id === 'walletConnect') { handleClose(); } } - const handleChangeNetwork = (ethereumNetwork: Chain) => { - setSelectedEthereumNetwork(ethereumNetwork); + async function handleConnectGemWallet() { + setNetworkType(NetworkType.XRPL); + setXRPWalletType(XRPWalletType.Gem); + + const { xrpHandler, userAddress } = await connectGemWallet(); + + setXRPHandler(xrpHandler); + setUserAddress(userAddress); + setXRPWalletContextState(XRPWalletContextState.READY); + } + + async function handleConnectLedgerWallet() { + try { + setNetworkType(NetworkType.XRPL); + setXRPWalletType(XRPWalletType.Ledger); + + const { xrpHandler, userAddress } = await connectLedgerWallet("44'/144'/0'/0/0"); + + setXRPHandler(xrpHandler); + setUserAddress(userAddress); + setXRPWalletContextState(XRPWalletContextState.READY); + } catch (error: any) { + toast({ + title: 'Failed to connect Ledger Wallet', + description: error instanceof Error ? formatErrorMessage(error.message) : '', + status: 'error', + duration: 9000, + isClosable: true, + }); + } + } + + async function handleConnectRippleWallet(xrpWalletType: XRPWalletType) { + switch (xrpWalletType) { + case XRPWalletType.Gem: + await handleConnectGemWallet(); + break; + case XRPWalletType.Ledger: + await handleConnectLedgerWallet(); + break; + default: + break; + } + } + + const handleChangeNetwork = (networkID: EthereumNetworkID | RippleNetworkID) => { + setSelectedNetworkID(networkID); }; return ( handleClose()}> - {!selectedEthereumNetwork ? ( + {!selectedNetworkID ? ( Select Network ) : ( @@ -58,16 +149,29 @@ export function SelectWalletModal({ isOpen, handleClose }: ModalComponentProps): )} + { + setSelectedNetworkType(index === 0 ? NetworkType.EVM : NetworkType.XRPL); + setSelectedNetworkID(undefined); + }} + > + + Ethereum + XRPL + + - + {!isSuccess ? ( Select Wallet @@ -77,16 +181,25 @@ export function SelectWalletModal({ isOpen, handleClose }: ModalComponentProps): )} - {connectors.map(wagmiConnector => ( - - ))} + {selectedNetworkType === NetworkType.EVM + ? connectors.map(wagmiConnector => ( + + )) + : xrpWallets.map(rippleWallet => ( + + ))} + diff --git a/src/app/components/modals/successful-flow-modal/successful-flow-modal.tsx b/src/app/components/modals/successful-flow-modal/successful-flow-modal.tsx index bf54afd7..acc305f3 100644 --- a/src/app/components/modals/successful-flow-modal/successful-flow-modal.tsx +++ b/src/app/components/modals/successful-flow-modal/successful-flow-modal.tsx @@ -1,15 +1,14 @@ -import { useContext } from 'react'; - import { HStack, Text, VStack } from '@chakra-ui/react'; import { TransactionFormNavigateButtonGroup } from '@components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/components/transaction-screen.transaction-form.navigate-button-group'; import { Vault } from '@components/vault/vault'; -import { VaultContext } from '@providers/vault-context-provider'; +import { Vault as VaultModel } from '@models/vault'; import { ModalComponentProps } from '../components/modal-container'; import { ModalVaultLayout } from '../components/modal.vault.layout'; interface SuccessfulFlowModalProps extends ModalComponentProps { vaultUUID: string; + vault: VaultModel; flow: 'mint' | 'burn'; assetAmount: number; } @@ -25,14 +24,10 @@ function getModalText(flow: 'mint' | 'burn', assetAmount?: number): string { export function SuccessfulFlowModal({ isOpen, handleClose, - vaultUUID, + vault, flow, assetAmount, }: SuccessfulFlowModalProps): React.JSX.Element { - const { allVaults } = useContext(VaultContext); - - const currentVault = allVaults.find(vault => vault.uuid === vaultUUID); - return ( handleClose()}> @@ -41,8 +36,8 @@ export function SuccessfulFlowModal({ {getModalText(flow, assetAmount)} - - + + ); diff --git a/src/app/components/my-vaults-small/my-vaults-small.tsx b/src/app/components/my-vaults-small/my-vaults-small.tsx index 54fbe30c..be0bb3b5 100644 --- a/src/app/components/my-vaults-small/my-vaults-small.tsx +++ b/src/app/components/my-vaults-small/my-vaults-small.tsx @@ -4,6 +4,7 @@ import { useNavigate } from 'react-router-dom'; import { Button, Skeleton } from '@chakra-ui/react'; import { VaultsList } from '@components/vaults-list/vaults-list'; import { VaultContext } from '@providers/vault-context-provider'; +import { VaultState } from 'dlc-btc-lib/models'; import { VaultsListGroupContainer } from '../vaults-list/components/vaults-list-group-container'; import { MyVaultsSmallLayout } from './components/my-vaults-small.layout'; @@ -11,30 +12,38 @@ import { MyVaultsSmallLayout } from './components/my-vaults-small.layout'; export function MyVaultsSmall(): React.JSX.Element { const navigate = useNavigate(); - const vaultContext = useContext(VaultContext); - const { - readyVaults, - pendingVaults, - fundedVaults, - closingVaults, - closedVaults, - isLoading, - allVaults, - } = vaultContext; + const { readyVaults, pendingVaults, fundedVaults, closingVaults, closedVaults, allVaults } = + useContext(VaultContext); return ( - 0} - > - - - - - - + 0}> + + + + + + diff --git a/src/app/components/vault/components/vault.detaills/vault.details.tsx b/src/app/components/vault/components/vault.detaills/vault.details.tsx index 4eb08e74..92dee556 100644 --- a/src/app/components/vault/components/vault.detaills/vault.details.tsx +++ b/src/app/components/vault/components/vault.detaills/vault.details.tsx @@ -1,8 +1,11 @@ +import { useContext } from 'react'; import { useDispatch } from 'react-redux'; import { useNavigate } from 'react-router-dom'; import { Collapse, Stack, VStack } from '@chakra-ui/react'; +import { VaultContext } from '@providers/vault-context-provider'; import { mintUnmintActions } from '@store/slices/mintunmint/mintunmint.actions'; +import { MintSteps, RedeemSteps } from '@store/slices/mintunmint/mintunmint.slice'; import { VaultState } from 'dlc-btc-lib/models'; import { VaultExpandedInformationButtonGroup } from './components/vault.details.button-group/vault.details.button-group'; @@ -17,6 +20,7 @@ interface VaultDetailsProps { vaultFundingTX?: string; vaultWithdrawDepositTX?: string; variant?: 'select' | 'selected'; + handleClose?: () => void; } export function VaultDetails({ @@ -28,30 +32,40 @@ export function VaultDetails({ vaultTotalMintedValue, isVaultExpanded, variant, + handleClose, }: VaultDetailsProps): React.JSX.Element { const navigate = useNavigate(); const dispatch = useDispatch(); + const { allVaults } = useContext(VaultContext); + const vault = allVaults.find(vault => vault.uuid === vaultUUID); + function handleDepositClick() { navigate('/mint-withdraw'); - dispatch(mintUnmintActions.setMintStep([1, vaultUUID])); + dispatch(mintUnmintActions.setMintStep({ step: MintSteps.DEPOSIT, vault: vault })); + if (handleClose) { + handleClose(); + } } function handleWithdrawClick() { navigate('/mint-withdraw'); if (vaultTotalLockedValue === vaultTotalMintedValue) { - dispatch(mintUnmintActions.setUnmintStep([0, vaultUUID])); + dispatch(mintUnmintActions.setUnmintStep({ step: RedeemSteps.BURN, vault: vault })); } else { - dispatch(mintUnmintActions.setUnmintStep([1, vaultUUID])); + dispatch(mintUnmintActions.setUnmintStep({ step: RedeemSteps.WITHDRAW, vault: vault })); + } + if (handleClose) { + handleClose(); } } function handleResumeClick() { navigate('/mint-withdraw'); if (vaultTotalLockedValue === vaultTotalMintedValue) { - dispatch(mintUnmintActions.setMintStep([2, vaultUUID])); + dispatch(mintUnmintActions.setMintStep({ step: MintSteps.PENDING, vault: vault })); } else { - dispatch(mintUnmintActions.setUnmintStep([2, vaultUUID])); + dispatch(mintUnmintActions.setUnmintStep({ step: RedeemSteps.PENDING, vault: vault })); } } diff --git a/src/app/components/vault/vault.tsx b/src/app/components/vault/vault.tsx index 36d819c5..142e457b 100644 --- a/src/app/components/vault/vault.tsx +++ b/src/app/components/vault/vault.tsx @@ -15,16 +15,17 @@ import { VaultProgressBar } from './components/vault.progress-bar'; interface VaultProps { vault: VaultModel; variant?: 'select' | 'selected'; + handleClose?: () => void; } -export function Vault({ vault, variant }: VaultProps): React.JSX.Element { +export function Vault({ vault, variant, handleClose }: VaultProps): React.JSX.Element { const dispatch = useDispatch(); const [isVaultExpanded, setIsVaultExpanded] = useState(false); function handleMainButtonClick() { if (variant === 'select') { const step = vault.valueLocked === vault.valueMinted ? 0 : 1; - dispatch(mintUnmintActions.setUnmintStep([step, vault.uuid])); + dispatch(mintUnmintActions.setUnmintStep([step, vault.uuid, vault])); } else { setIsVaultExpanded(!isVaultExpanded); } @@ -55,6 +56,7 @@ export function Vault({ vault, variant }: VaultProps): React.JSX.Element { isVaultExpanded={isVaultExpanded} vaultFundingTX={vault.fundingTX} vaultWithdrawDepositTX={vault.withdrawDepositTX} + handleClose={handleClose} /> diff --git a/src/app/components/vaults-list/components/vaults-list-group-container.tsx b/src/app/components/vaults-list/components/vaults-list-group-container.tsx index ea4d1f60..84b4fe31 100644 --- a/src/app/components/vaults-list/components/vaults-list-group-container.tsx +++ b/src/app/components/vaults-list/components/vaults-list-group-container.tsx @@ -1,10 +1,17 @@ +import { useContext } from 'react'; + import { Button, HStack, Image, Spinner, Text, VStack } from '@chakra-ui/react'; import { Vault } from '@components/vault/vault'; import { useAddToken } from '@hooks/use-add-token'; import { Vault as VaultModel } from '@models/vault'; +import { NetworkConfigurationContext } from '@providers/network-configuration.provider'; +import { VaultState } from 'dlc-btc-lib/models'; + +import { NetworkType } from '@shared/constants/network.constants'; interface VaultsListGroupContainerProps { label?: string; + vaultState?: VaultState; variant?: 'select'; vaults: VaultModel[]; selectedVaultUUID?: string; @@ -14,10 +21,12 @@ interface VaultsListGroupContainerProps { export function VaultsListGroupContainer({ label, + vaultState, variant, vaults, }: VaultsListGroupContainerProps): React.JSX.Element | boolean { const addToken = useAddToken(); + const { networkType } = useContext(NetworkConfigurationContext); if (vaults.length === 0) return false; @@ -29,7 +38,7 @@ export function VaultsListGroupContainer({ {['Pending'].includes(label) && } {label} - {label === 'Minted dlcBTC' && ( + {vaultState === VaultState.FUNDED && networkType === NetworkType.EVM && ( diff --git a/src/app/hooks/use-add-token.ts b/src/app/hooks/use-add-token.ts index c2e26d22..7f5741d4 100644 --- a/src/app/hooks/use-add-token.ts +++ b/src/app/hooks/use-add-token.ts @@ -20,7 +20,7 @@ export function useAddToken(): () => Promise { type: 'ERC20', options: { address: ethereumNetworkConfiguration.dlcBTCContract.address, - symbol: 'dlcBTC', + symbol: 'IBTC', decimals: 8, image: 'https://dlc-public-assets.s3.amazonaws.com/dlcBTC_Token.png', }, From b243a67982058f5a1628b75e757ddb6ecf2953d2 Mon Sep 17 00:00:00 2001 From: Polybius93 <99192647+Polybius93@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:28:21 +0100 Subject: [PATCH 09/12] feat: modify por merchant table render order (#217) --- .../components/merchant-table/merchant-table.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/components/proof-of-reserve/components/merchant-table/merchant-table.tsx b/src/app/components/proof-of-reserve/components/merchant-table/merchant-table.tsx index 8f255759..3cfbbd52 100644 --- a/src/app/components/proof-of-reserve/components/merchant-table/merchant-table.tsx +++ b/src/app/components/proof-of-reserve/components/merchant-table/merchant-table.tsx @@ -27,7 +27,9 @@ export function MerchantTable({ items }: MerchantTableProps): React.JSX.Element - {items?.map(item => )} + {items + ?.sort((a, b) => b.dlcBTCAmount - a.dlcBTCAmount) + .map(item => )} ); From c80f6051831c8f1645a2d55a1e59bcc99bc51f1a Mon Sep 17 00:00:00 2001 From: Polybius93 <99192647+Polybius93@users.noreply.github.com> Date: Wed, 27 Nov 2024 14:53:32 +0100 Subject: [PATCH 10/12] feat: rebrand to ibtc (#218) * feat: rebrand to ibtc --- README.md | 4 +-- config.devnet.json | 2 +- config.localhost.json | 2 +- config.mainnet.json | 2 +- config.testnet.json | 2 +- index.html | 2 +- .../logos/{dlc-btc-logo.svg => ibtc-logo.svg} | 0 ...{dlcBTC-logotype.svg => ibtc-logotype.svg} | 0 .../attestor-details-select.tsx | 2 +- .../attestor-details/attestor-details.tsx | 2 +- .../attestor-details-rate-card.tsx | 6 ++-- .../attestor-details-table-item.tsx | 2 +- .../components/attestor-select-table-item.tsx | 2 +- .../company-website-button.tsx | 4 +-- src/app/components/header/components/tabs.tsx | 2 +- .../bottom/components/how-to-mint.tsx | 12 ++++---- .../bottom/components/how-to-unmint.tsx | 8 ++--- .../how-it-works/middle/middle-section.tsx | 4 +-- .../how-it-works/top/top-section.tsx | 4 +-- .../landing-page/components/welcome-stack.tsx | 2 +- .../progress-timeline/progress-timeline.tsx | 4 +-- .../setup-vault-screen.vault-graphics.tsx | 4 +-- .../components/walkthrough/walkthrough.tsx | 30 ++++++++----------- .../successful-flow-modal.tsx | 4 +-- .../my-vaults-small/my-vaults-small.tsx | 2 +- .../my-vaults-header/my-vaults-header.tsx | 12 ++++---- .../components/my-vaults/my-vaults-large.tsx | 6 ++-- .../components/points-table-item.tsx | 2 +- .../components/points-table/points-table.tsx | 2 +- src/app/components/points/points.tsx | 20 ++++++------- .../merchant-details/merchant-details.tsx | 8 ++--- .../merchant-details-table-item.tsx | 10 +++---- .../components/merchant-table-item.tsx | 10 +++---- .../merchant-table/merchant-table.tsx | 4 +-- .../components/token-stats-board-token.tsx | 2 +- .../proof-of-reserve/proof-of-reserve.tsx | 6 ++-- .../protocol-history-table-item.tsx | 14 ++++----- ...nsaction-screen.transaction-form.input.tsx | 6 ++-- ...screen.transaction-form.progress-stack.tsx | 4 +-- .../transaction-screen.transaction-form.tsx | 4 +-- .../vault.details.button-group.tsx | 2 +- ...ult.main-stack.asset-information-stack.tsx | 4 +-- .../vaults-list-group-container.tsx | 3 +- src/app/hooks/use-add-token.ts | 2 +- src/app/hooks/use-deposit-limits.ts | 2 +- src/app/hooks/use-proof-of-reserve.ts | 4 +-- .../providers/balance-context-provider.tsx | 16 +++++----- ...thereum-network-configuration.provider.tsx | 28 ++++++++--------- .../example-attestor-select-table-items.ts | 16 +++++----- src/shared/models/ethereum-models.ts | 4 +-- src/shared/models/merchant.ts | 2 +- src/shared/models/token.ts | 8 ++--- src/shared/utils.ts | 2 +- vite.config.ts | 2 +- 54 files changed, 155 insertions(+), 158 deletions(-) rename public/images/logos/{dlc-btc-logo.svg => ibtc-logo.svg} (100%) rename public/images/logos/{dlcBTC-logotype.svg => ibtc-logotype.svg} (100%) diff --git a/README.md b/README.md index 0e714b59..3b616baf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# DLC.Link - dlcBTC Bridge +# DLC.Link - iBTC Bridge -**dlcBTC Website** is an interface for interacting with DLC.Link smart contracts and the Bitcoin blockchain. This platform provides a secure and efficient self-custodial way to lock Bitcoin as collateral and mint dlcBTC tokens based on the amount of Bitcoin locked. +**iBTC Website** is an interface for interacting with DLC.Link smart contracts and the Bitcoin blockchain. This platform provides a secure and efficient self-custodial way to lock Bitcoin as collateral and mint iBTC tokens based on the amount of Bitcoin locked. ## Installation diff --git a/config.devnet.json b/config.devnet.json index da279717..bf038547 100644 --- a/config.devnet.json +++ b/config.devnet.json @@ -21,7 +21,7 @@ { "name": "DLC.Link", "addresses": ["0x0DD4f29E21F10cb2E485cf9bDAb9F2dD1f240Bfa"], - "logo": "/images/logos/dlcBTC-logotype.svg" + "logo": "/images/logos/ibtc-logotype.svg" }, { "name": "Smart Bitcoin Labs", diff --git a/config.localhost.json b/config.localhost.json index 246b27a2..8be2a06c 100644 --- a/config.localhost.json +++ b/config.localhost.json @@ -17,7 +17,7 @@ { "name": "DLC.Link", "addresses": ["0x0DD4f29E21F10cb2E485cf9bDAb9F2dD1f240Bfa"], - "logo": "/images/logos/dlcBTC-logotype.svg" + "logo": "/images/logos/ibtc-logotype.svg" } ], "protocols": [ diff --git a/config.mainnet.json b/config.mainnet.json index 30288755..915bbee4 100644 --- a/config.mainnet.json +++ b/config.mainnet.json @@ -25,7 +25,7 @@ { "name": "DLC.Link", "addresses": ["0x0DD4f29E21F10cb2E485cf9bDAb9F2dD1f240Bfa"], - "logo": "/images/logos/dlcBTC-logotype.svg" + "logo": "/images/logos/ibtc-logotype.svg" }, { "name": "Smart Bitcoin Labs", diff --git a/config.testnet.json b/config.testnet.json index ac5dad86..81e7f9bc 100644 --- a/config.testnet.json +++ b/config.testnet.json @@ -21,7 +21,7 @@ { "name": "DLC.Link", "addresses": ["0x0DD4f29E21F10cb2E485cf9bDAb9F2dD1f240Bfa"], - "logo": "/images/logos/dlcBTC-logotype.svg" + "logo": "/images/logos/ibtc-logotype.svg" }, { "name": "Smart Bitcoin Labs", diff --git a/index.html b/index.html index 6e7b70f6..3054b1df 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,7 @@ - DLC.Link dlcBTC Website + DLC.Link iBTC Website
diff --git a/public/images/logos/dlc-btc-logo.svg b/public/images/logos/ibtc-logo.svg similarity index 100% rename from public/images/logos/dlc-btc-logo.svg rename to public/images/logos/ibtc-logo.svg diff --git a/public/images/logos/dlcBTC-logotype.svg b/public/images/logos/ibtc-logotype.svg similarity index 100% rename from public/images/logos/dlcBTC-logotype.svg rename to public/images/logos/ibtc-logotype.svg diff --git a/src/app/components/attestor-details/attestor-details-select.tsx b/src/app/components/attestor-details/attestor-details-select.tsx index a2af4cb5..7b6bb280 100644 --- a/src/app/components/attestor-details/attestor-details-select.tsx +++ b/src/app/components/attestor-details/attestor-details-select.tsx @@ -82,7 +82,7 @@ export function AttestorDetailsSelect(): React.JSX.Element { diff --git a/src/app/components/attestor-details/attestor-details.tsx b/src/app/components/attestor-details/attestor-details.tsx index bd9d6b8a..b86096c5 100644 --- a/src/app/components/attestor-details/attestor-details.tsx +++ b/src/app/components/attestor-details/attestor-details.tsx @@ -20,7 +20,7 @@ export function AttestorDetails(): React.JSX.Element { return ( - dlcBTC Attestor Details + iBTC Attestor Details diff --git a/src/app/components/attestor-details/components/attestor-details-card/attestor-details-rate-card.tsx b/src/app/components/attestor-details/components/attestor-details-card/attestor-details-rate-card.tsx index 101b9769..f9bfeb5b 100644 --- a/src/app/components/attestor-details/components/attestor-details-card/attestor-details-rate-card.tsx +++ b/src/app/components/attestor-details/components/attestor-details-card/attestor-details-rate-card.tsx @@ -1,5 +1,5 @@ import { Divider, HStack, Image, Spacer, Text, VStack } from '@chakra-ui/react'; -import { dlcBTC } from '@models/token'; +import { iBTC } from '@models/token'; interface AttestorDetailsRateCardProps { width: string; @@ -16,9 +16,9 @@ export function AttestorDetailsRateCard({ Nakamoto Coefficient - {dlcBTC.logoAlt} + {iBTC.logoAlt} - dlcBTC + iBTC diff --git a/src/app/components/attestor-details/components/attestor-details-table/components/attestor-details-table-item.tsx b/src/app/components/attestor-details/components/attestor-details-table/components/attestor-details-table-item.tsx index 5e2b3f0c..24b7a85a 100644 --- a/src/app/components/attestor-details/components/attestor-details-table/components/attestor-details-table-item.tsx +++ b/src/app/components/attestor-details/components/attestor-details-table/components/attestor-details-table-item.tsx @@ -38,7 +38,7 @@ export function AttestorDetailsTableItem( justifyContent={'space-between'} > - {'dlcBTC + {'iBTC - {'dlcBTC + {'iBTC {hash} diff --git a/src/app/components/company-website-button/company-website-button.tsx b/src/app/components/company-website-button/company-website-button.tsx index def33795..1f4a75b5 100644 --- a/src/app/components/company-website-button/company-website-button.tsx +++ b/src/app/components/company-website-button/company-website-button.tsx @@ -5,8 +5,8 @@ import { Button, Image, useBreakpointValue } from '@chakra-ui/react'; export function CompanyWebsiteButton(): React.JSX.Element { const navigate = useNavigate(); - const logoPath = './images/logos/dlc-btc-logo.svg'; - const altText = 'dlcBTC Logo'; + const logoPath = './images/logos/ibtc-logo.svg'; + const altText = 'iBTC Logo'; const isMobile = useBreakpointValue({ base: true, md: false }); return ( diff --git a/src/app/components/header/components/tabs.tsx b/src/app/components/header/components/tabs.tsx index 09739fa6..8e7ab180 100644 --- a/src/app/components/header/components/tabs.tsx +++ b/src/app/components/header/components/tabs.tsx @@ -34,7 +34,7 @@ export function NavigationTabs({ {isActiveTabs && ( <> handleTabClick('/mint-withdraw')} /> diff --git a/src/app/components/how-it-works/bottom/components/how-to-mint.tsx b/src/app/components/how-it-works/bottom/components/how-to-mint.tsx index b5b56e0c..d49b4209 100644 --- a/src/app/components/how-it-works/bottom/components/how-to-mint.tsx +++ b/src/app/components/how-it-works/bottom/components/how-to-mint.tsx @@ -16,7 +16,7 @@ export function HowToMint(): React.JSX.Element { { <> - How to Mint dlcBTC + How to Mint iBTC {'mint Ethereum Wallet.{' '} - You will receive your deposit token dlcBTC to the same address. + You will receive your deposit token iBTC to the same address. } hasBadge={false} @@ -49,18 +49,18 @@ export function HowToMint(): React.JSX.Element { /> Wait for Bitcoin to get locked on chain{' '} (~1 hour).{' '} - After confirmation dlcBTC tokens will automatically appear in your{' '} + After confirmation iBTC tokens will automatically appear in your{' '} Ethereum Wallet.{' '} {' '} - You can use dlcBTC in big{' '} + You can use iBTC in big{' '} supported DeFi protocols {' '} @@ -83,7 +83,7 @@ export function HowToMint(): React.JSX.Element { }} variant={'account'} > - Mint dlcBTC + Mint iBTC } diff --git a/src/app/components/how-it-works/bottom/components/how-to-unmint.tsx b/src/app/components/how-it-works/bottom/components/how-to-unmint.tsx index 28c802ba..607bcf52 100644 --- a/src/app/components/how-it-works/bottom/components/how-to-unmint.tsx +++ b/src/app/components/how-it-works/bottom/components/how-to-unmint.tsx @@ -15,15 +15,15 @@ export function HowToUnmint(): React.JSX.Element { { <> - How to Unmint dlcBTC + How to withdraw BTC {'unmint - Select the vault you would like to unmint. After a successful unmint you will + Select the vault you would like to redeem from. After a successful withdraw you will receive BTC in the same amount back to your wallet. } @@ -39,7 +39,7 @@ export function HowToUnmint(): React.JSX.Element { }} variant={'account'} > - Unmint dlcBTC + Unmint iBTC } diff --git a/src/app/components/how-it-works/middle/middle-section.tsx b/src/app/components/how-it-works/middle/middle-section.tsx index fa022f99..458e4c67 100644 --- a/src/app/components/how-it-works/middle/middle-section.tsx +++ b/src/app/components/how-it-works/middle/middle-section.tsx @@ -17,11 +17,11 @@ export function MiddleSection(): React.JSX.Element { > } content={ - dlcBTC is a{' '} + iBTC is a{' '} non-custodial {' '} diff --git a/src/app/components/how-it-works/top/top-section.tsx b/src/app/components/how-it-works/top/top-section.tsx index 1f15b55f..22b6fdb8 100644 --- a/src/app/components/how-it-works/top/top-section.tsx +++ b/src/app/components/how-it-works/top/top-section.tsx @@ -16,10 +16,10 @@ export function TopSection(): React.JSX.Element { - dlcBTC + iBTC - dlcBTC lets you use your Bitcoin on different DeFi platforms, all without giving up + iBTC lets you use your Bitcoin on different DeFi platforms, all without giving up control of your actual Bitcoin. diff --git a/src/app/components/mint-unmint/components/landing-page/components/welcome-stack.tsx b/src/app/components/mint-unmint/components/landing-page/components/welcome-stack.tsx index 655424d2..9ffc16cb 100644 --- a/src/app/components/mint-unmint/components/landing-page/components/welcome-stack.tsx +++ b/src/app/components/mint-unmint/components/landing-page/components/welcome-stack.tsx @@ -8,7 +8,7 @@ export function WelcomeStack(): React.JSX.Element { // const navigate = useNavigate(); const dispatch = useDispatch(); - const setupText = 'Ready to\n mint dlcBTC?'; + const setupText = 'Ready to\n mint iBTC?'; function onConnectWalletClick(): void { dispatch(modalActions.toggleSelectWalletModalVisibility()); diff --git a/src/app/components/mint-unmint/components/progress-timeline/progress-timeline.tsx b/src/app/components/mint-unmint/components/progress-timeline/progress-timeline.tsx index 3668ee82..75df337f 100644 --- a/src/app/components/mint-unmint/components/progress-timeline/progress-timeline.tsx +++ b/src/app/components/mint-unmint/components/progress-timeline/progress-timeline.tsx @@ -21,7 +21,7 @@ export function ProgressTimeline({ - + @@ -49,7 +49,7 @@ export function ProgressTimeline({ stepIndex={3} width={'12.5%'} isLastStep - title="Mint dlcBTC" + title="Mint iBTC" /> diff --git a/src/app/components/mint-unmint/components/setup-vault-screen/components/setup-vault-screen.vault-graphics.tsx b/src/app/components/mint-unmint/components/setup-vault-screen/components/setup-vault-screen.vault-graphics.tsx index 8ee091b2..270e5e3d 100644 --- a/src/app/components/mint-unmint/components/setup-vault-screen/components/setup-vault-screen.vault-graphics.tsx +++ b/src/app/components/mint-unmint/components/setup-vault-screen/components/setup-vault-screen.vault-graphics.tsx @@ -27,7 +27,7 @@ export function SetupVaultScreenVaultGraphics(): React.JSX.Element { right="37.5%" /> {'DLC - BTC/dlcBTC Vault + BTC/iBTC Vault diff --git a/src/app/components/mint-unmint/components/walkthrough/walkthrough.tsx b/src/app/components/mint-unmint/components/walkthrough/walkthrough.tsx index 2d2bf3a9..490aa7d8 100644 --- a/src/app/components/mint-unmint/components/walkthrough/walkthrough.tsx +++ b/src/app/components/mint-unmint/components/walkthrough/walkthrough.tsx @@ -65,7 +65,7 @@ export function Walkthrough({ Enter the Bitcoin amount you wish to deposit into the vault, then verify the transaction through your Bitcoin Wallet which will lock your Bitcoin on-chain. You - will receive equivalent amount of dlcBTC. + will receive equivalent amount of iBTC. ); @@ -74,17 +74,17 @@ export function Walkthrough({ - Wait for Bitcoin to get locked on chain (~1 hour). After 6 confirmations, dlcBTC + Wait for Bitcoin to get locked on chain (~1 hour). After 6 confirmations, iBTC tokens will appear in your Wallet. {networkType === NetworkType.EVM && ( <> - To ensure your dlcBTC tokens + To ensure your iBTC tokens are visible simply add them to your Ethereum Wallet. @@ -92,11 +92,7 @@ export function Walkthrough({ @@ -109,7 +105,7 @@ export function Walkthrough({ @@ -122,18 +118,18 @@ export function Walkthrough({ {networkType === NetworkType.EVM ? ( - Select the dlcBTC vault you would like to withdraw from. Burn the desired amount - of dlcBTC to receive the equivalent amount of BTC. + Select the iBTC vault you would like to withdraw from. Burn the desired amount of + iBTC to receive the equivalent amount of BTC. ) : ( - Select the dlcBTC vault you would like to withdraw from. Sign a check with the - desired amount of dlcBTC to receive the equivalent amount of BTC. + Select the iBTC vault you would like to withdraw from. Sign a check with the + desired amount of iBTC to receive the equivalent amount of BTC. )} @@ -147,7 +143,7 @@ export function Walkthrough({ blockchain={NetworkType.BTC} /> - {`Once the dlcBTC has been burned, you can withdraw an `} + {`Once the iBTC has been burned, you can withdraw an `} {` equivalent amount of Bitcoin `} @@ -175,7 +171,7 @@ export function Walkthrough({ diff --git a/src/app/components/modals/successful-flow-modal/successful-flow-modal.tsx b/src/app/components/modals/successful-flow-modal/successful-flow-modal.tsx index acc305f3..a556036e 100644 --- a/src/app/components/modals/successful-flow-modal/successful-flow-modal.tsx +++ b/src/app/components/modals/successful-flow-modal/successful-flow-modal.tsx @@ -15,9 +15,9 @@ interface SuccessfulFlowModalProps extends ModalComponentProps { function getModalText(flow: 'mint' | 'burn', assetAmount?: number): string { if (flow === 'mint') { - return `You have successfully deposited ${assetAmount} BTC from your Bitcoin Wallet into your Vault, and minted ${assetAmount} dlcBTC to your destination address.`; + return `You have successfully deposited ${assetAmount} BTC from your Bitcoin Wallet into your Vault, and minted ${assetAmount} iBTC to your destination address.`; } else { - return `You have successfully burned ${assetAmount} dlcBTC from your destination address, and withdrawn ${assetAmount} BTC from your Vault into your Bitcoin Wallet.`; + return `You have successfully burned ${assetAmount} iBTC from your destination address, and withdrawn ${assetAmount} BTC from your Vault into your Bitcoin Wallet.`; } } diff --git a/src/app/components/my-vaults-small/my-vaults-small.tsx b/src/app/components/my-vaults-small/my-vaults-small.tsx index be0bb3b5..02db6693 100644 --- a/src/app/components/my-vaults-small/my-vaults-small.tsx +++ b/src/app/components/my-vaults-small/my-vaults-small.tsx @@ -35,7 +35,7 @@ export function MyVaultsSmall(): React.JSX.Element { vaultState={VaultState.READY} /> diff --git a/src/app/components/my-vaults/components/my-vaults-header/my-vaults-header.tsx b/src/app/components/my-vaults/components/my-vaults-header/my-vaults-header.tsx index 6c6d5b6b..c5abb282 100644 --- a/src/app/components/my-vaults/components/my-vaults-header/my-vaults-header.tsx +++ b/src/app/components/my-vaults/components/my-vaults-header/my-vaults-header.tsx @@ -4,13 +4,13 @@ import { MyVaultsHeaderBalanceInfo } from './components/my-vaults-header-balance interface MyVaultsLargeHeaderProps { isConnected: boolean; - dlcBTCBalance?: number; + iBTCBalance?: number; lockedBTCBalance?: number; } export function MyVaultsLargeHeader({ isConnected, - dlcBTCBalance, + iBTCBalance, lockedBTCBalance, }: MyVaultsLargeHeaderProps): React.JSX.Element { return ( @@ -22,10 +22,10 @@ export function MyVaultsLargeHeader({ diff --git a/src/app/components/my-vaults/my-vaults-large.tsx b/src/app/components/my-vaults/my-vaults-large.tsx index 03d35c9b..f7c09678 100644 --- a/src/app/components/my-vaults/my-vaults-large.tsx +++ b/src/app/components/my-vaults/my-vaults-large.tsx @@ -15,7 +15,7 @@ import { MyVaultsSetupInformationStack } from './components/my-vaults-setup-info export function MyVaultsLarge(): React.JSX.Element { const { isConnected } = useContext(NetworkConnectionContext); - const { dlcBTCBalance, lockedBTCBalance } = useContext(BalanceContext); + const { iBTCBalance, lockedBTCBalance } = useContext(BalanceContext); const { readyVaults, pendingVaults, fundedVaults, closingVaults, closedVaults, allVaults } = useContext(VaultContext); @@ -24,7 +24,7 @@ export function MyVaultsLarge(): React.JSX.Element { @@ -54,7 +54,7 @@ export function MyVaultsLarge(): React.JSX.Element { )} 0} > diff --git a/src/app/components/points/components/points-table/components/points-table-item.tsx b/src/app/components/points/components/points-table/components/points-table-item.tsx index e6a05407..16c7eb86 100644 --- a/src/app/components/points/components/points-table/components/points-table-item.tsx +++ b/src/app/components/points/components/points-table/components/points-table-item.tsx @@ -47,7 +47,7 @@ export function PointsTableItem(pointsTableItem: ProtocolRewards): React.JSX.Ele ) : ( <> - {'dlc + {'dlc {formatToFourDecimals(unshiftValue(currentTokens))} diff --git a/src/app/components/points/components/points-table/points-table.tsx b/src/app/components/points/components/points-table/points-table.tsx index e26a52da..7080949e 100644 --- a/src/app/components/points/components/points-table/points-table.tsx +++ b/src/app/components/points/components/points-table/points-table.tsx @@ -24,7 +24,7 @@ export function PointsTable({ items }: PointsTableProps): React.JSX.Element { ) : ( <> - dlcBTC Used + iBTC Used Points Earned DeFi Protocol diff --git a/src/app/components/points/points.tsx b/src/app/components/points/points.tsx index 30ada3e0..4cd70420 100644 --- a/src/app/components/points/points.tsx +++ b/src/app/components/points/points.tsx @@ -12,7 +12,7 @@ import { } from '@chakra-ui/react'; import { TokenStatsBoardLayout } from '@components/proof-of-reserve/components/token-stats-board/token-stats-board.layout'; import { usePoints } from '@hooks/use-points'; -import { dlcBTC } from '@models/token'; +import { iBTC } from '@models/token'; import { modalActions } from '@store/slices/modal/modal.actions'; import { useAccount } from 'wagmi'; @@ -38,7 +38,7 @@ export function Points(): React.JSX.Element { <> - Use dlcBTC -{' '} + Use iBTC -{' '} Earn Points @@ -83,7 +83,7 @@ export function Points(): React.JSX.Element { direction={isMobile ? 'column' : 'row'} > @@ -94,7 +94,7 @@ export function Points(): React.JSX.Element { variant={'thick'} /> p.name == 'dlcBTC')?.points} tokenSuffix={'Hold'} /> @@ -128,8 +128,8 @@ export function Points(): React.JSX.Element { {'dlcBTC - Use dlcBTC + Use iBTC - Put your dlcBTC to work in various activities like lending, staking, or - trading Participate and earn points for your involvement. + Put your iBTC to work in various activities like lending, staking, or trading + Participate and earn points for your involvement. @@ -173,7 +173,7 @@ export function Points(): React.JSX.Element { {'dlcBTC - + - +
diff --git a/src/app/components/proof-of-reserve/components/merchant-table/components/merchant-details-table-item.tsx b/src/app/components/proof-of-reserve/components/merchant-table/components/merchant-details-table-item.tsx index 43bdec8d..855d6f32 100644 --- a/src/app/components/proof-of-reserve/components/merchant-table/components/merchant-details-table-item.tsx +++ b/src/app/components/proof-of-reserve/components/merchant-table/components/merchant-details-table-item.tsx @@ -10,7 +10,7 @@ export function MerchantDetailsTableItem(merchantFocusTableItem: DetailedEvent): if (!merchantFocusTableItem) return ; const { - dlcBTCAmount, + iBTCAmount, txHash, date, isMint, @@ -40,9 +40,9 @@ export function MerchantDetailsTableItem(merchantFocusTableItem: DetailedEvent):
- {'dlc + {'dlc - {unshiftValue(dlcBTCAmount)} + {unshiftValue(iBTCAmount)} @@ -67,9 +67,9 @@ export function MerchantDetailsTableItem(merchantFocusTableItem: DetailedEvent): - {'dlc + {'dlc - {unshiftValue(dlcBTCAmount)} + {unshiftValue(iBTCAmount)} {/* add back the USD calculation later and adjus the width accordingly */} diff --git a/src/app/components/proof-of-reserve/components/merchant-table/components/merchant-table-item.tsx b/src/app/components/proof-of-reserve/components/merchant-table/components/merchant-table-item.tsx index efc596b8..ae40693b 100644 --- a/src/app/components/proof-of-reserve/components/merchant-table/components/merchant-table-item.tsx +++ b/src/app/components/proof-of-reserve/components/merchant-table/components/merchant-table-item.tsx @@ -16,12 +16,12 @@ import { Merchant } from '@models/merchant'; interface MerchantTableItemProps { merchant: Merchant; - dlcBTCAmount: number | undefined; + iBTCAmount: number | undefined; } export function MerchantTableItem({ merchant, - dlcBTCAmount, + iBTCAmount, }: MerchantTableItemProps): React.ReactElement { const navigate = useNavigate(); @@ -42,8 +42,8 @@ export function MerchantTableItem({ {merchant.name} - {'dlcBTC - + {'iBTC + - {Number(dlcBTCAmount?.toFixed(4))} + {Number(iBTCAmount?.toFixed(4))} diff --git a/src/app/components/proof-of-reserve/components/merchant-table/merchant-table.tsx b/src/app/components/proof-of-reserve/components/merchant-table/merchant-table.tsx index 3cfbbd52..f986380f 100644 --- a/src/app/components/proof-of-reserve/components/merchant-table/merchant-table.tsx +++ b/src/app/components/proof-of-reserve/components/merchant-table/merchant-table.tsx @@ -23,12 +23,12 @@ export function MerchantTable({ items }: MerchantTableProps): React.JSX.Element > Merchant - dlcBTC Minted + iBTC Minted {items - ?.sort((a, b) => b.dlcBTCAmount - a.dlcBTCAmount) + ?.sort((a, b) => b.iBTCAmount - a.iBTCAmount) .map(item => )} diff --git a/src/app/components/proof-of-reserve/components/token-stats-board/components/token-stats-board-token.tsx b/src/app/components/proof-of-reserve/components/token-stats-board/components/token-stats-board-token.tsx index e74da9b4..1679a92f 100644 --- a/src/app/components/proof-of-reserve/components/token-stats-board/components/token-stats-board-token.tsx +++ b/src/app/components/proof-of-reserve/components/token-stats-board/components/token-stats-board-token.tsx @@ -12,7 +12,7 @@ export function TokenStatsBoardToken({ }: TokenStatsBoardTokenProps): React.JSX.Element { let tokenSuffix: string; switch (token.name) { - case 'dlcBTC': + case 'iBTC': tokenSuffix = 'Minted'; break; default: diff --git a/src/app/components/proof-of-reserve/proof-of-reserve.tsx b/src/app/components/proof-of-reserve/proof-of-reserve.tsx index 3a1f2a0b..c3ef8299 100644 --- a/src/app/components/proof-of-reserve/proof-of-reserve.tsx +++ b/src/app/components/proof-of-reserve/proof-of-reserve.tsx @@ -3,7 +3,7 @@ import { useContext } from 'react'; import { Divider, Stack, Text, useBreakpointValue } from '@chakra-ui/react'; import { ProtocolHistoryTable } from '@components/protocol-history-table/protocol-history-table'; import { Merchant } from '@models/merchant'; -import { bitcoin, dlcBTC } from '@models/token'; +import { bitcoin, iBTC } from '@models/token'; import { ProofOfReserveContext } from '@providers/proof-of-reserve-context-provider'; import { titleTextSize } from '@shared/utils'; @@ -23,7 +23,7 @@ export function ProofOfReserve(): React.JSX.Element { appConfiguration.merchants.map((merchant: Merchant) => { return { merchant, - dlcBTCAmount: undefined, + iBTCBalance: undefined, }; }), ]; @@ -50,7 +50,7 @@ export function ProofOfReserve(): React.JSX.Element { height={isMobile ? '1px' : '75px'} variant={'thick'} /> - + - {'dlcBTC + {'iBTC - {unshiftValue(dlcBTCAmount)} + {unshiftValue(iBTCAmount)} @@ -60,9 +60,9 @@ export function ProtocolHistoryTableItem( ) : ( <> - {'dlcBTC + {'iBTC - {unshiftValue(dlcBTCAmount)} + {unshiftValue(iBTCAmount)} @@ -96,9 +96,9 @@ export function ProtocolHistoryTableItem( )} {/* - {'dlcBTC + {'iBTCAmount - {unshiftValue(dlcBTCAmount)} + {unshiftValue(iBTCAmount)} diff --git a/src/app/components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/components/transaction-screen.transaction-form.input.tsx b/src/app/components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/components/transaction-screen.transaction-form.input.tsx index 42194f64..9ef3c6ee 100644 --- a/src/app/components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/components/transaction-screen.transaction-form.input.tsx +++ b/src/app/components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/components/transaction-screen.transaction-form.input.tsx @@ -12,9 +12,9 @@ const bitcoinFormProperties = { color: 'orange.01', }; const tokenFormProperties = { - label: 'Burn dlcBTC', - logo: '/images/logos/dlc-btc-logo.svg', - symbol: 'dlcBTC', + label: 'Burn iBTC', + logo: '/images/logos/ibtc-logo.svg', + symbol: 'iBTC', color: 'purple.01', }; diff --git a/src/app/components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/components/transaction-screen.transaction-form.progress-stack/components/transaction-screen.transaction-form.progress-stack.tsx b/src/app/components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/components/transaction-screen.transaction-form.progress-stack/components/transaction-screen.transaction-form.progress-stack.tsx index 358574bf..b589127d 100644 --- a/src/app/components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/components/transaction-screen.transaction-form.progress-stack/components/transaction-screen.transaction-form.progress-stack.tsx +++ b/src/app/components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/components/transaction-screen.transaction-form.progress-stack/components/transaction-screen.transaction-form.progress-stack.tsx @@ -14,10 +14,10 @@ interface ProgressStackItemProps { const componentsMap = { mint: { A: { label: 'Deposit', assetLogo: '/images/logos/bitcoin-logo.svg', assetSymbol: 'BTC' }, - B: { label: 'Mint', assetLogo: '/images/logos/dlc-btc-logo.svg', assetSymbol: 'dlcBTC' }, + B: { label: 'Mint', assetLogo: '/images/logos/ibtc-logo.svg', assetSymbol: 'iBTC' }, }, burn: { - A: { label: 'Burn', assetLogo: '/images/logos/dlc-btc-logo.svg', assetSymbol: 'dlcBTC' }, + A: { label: 'Burn', assetLogo: '/images/logos/ibtc-logo.svg', assetSymbol: 'iBTC' }, B: { label: 'Withdraw', assetLogo: '/images/logos/bitcoin-logo.svg', assetSymbol: 'BTC' }, }, }; diff --git a/src/app/components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/transaction-screen.transaction-form.tsx b/src/app/components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/transaction-screen.transaction-form.tsx index 0c8b0f63..f5a4a71f 100644 --- a/src/app/components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/transaction-screen.transaction-form.tsx +++ b/src/app/components/transaction-screen/transaction-screen.transaction-form/components/transaction-screen.transaction-form/transaction-screen.transaction-form.tsx @@ -38,9 +38,9 @@ function validateBurnAmount(value: number, valueMinted: number): string | undefi let error; if (!value) { - error = 'Please enter a valid amount of dlcBTC'; + error = 'Please enter a valid amount of iBTC'; } else if (valueMinted && value > valueMinted) { - error = `You can't burn more than ${valueMinted} dlcBTC`; + error = `You can't burn more than ${valueMinted} iBTC`; } return error; } diff --git a/src/app/components/vault/components/vault.detaills/components/vault.details.button-group/vault.details.button-group.tsx b/src/app/components/vault/components/vault.detaills/components/vault.details.button-group/vault.details.button-group.tsx index 7d63307b..cd1ac9ed 100644 --- a/src/app/components/vault/components/vault.detaills/components/vault.details.button-group/vault.details.button-group.tsx +++ b/src/app/components/vault/components/vault.detaills/components/vault.details.button-group/vault.details.button-group.tsx @@ -38,7 +38,7 @@ export function VaultExpandedInformationButtonGroup({ diff --git a/src/app/components/vault/components/vault.main-stack/components/vault.main-stack.asset-information-stack/vault.main-stack.asset-information-stack.tsx b/src/app/components/vault/components/vault.main-stack/components/vault.main-stack.asset-information-stack/vault.main-stack.asset-information-stack.tsx index 813f466a..2b7a0aa5 100644 --- a/src/app/components/vault/components/vault.main-stack/components/vault.main-stack.asset-information-stack/vault.main-stack.asset-information-stack.tsx +++ b/src/app/components/vault/components/vault.main-stack/components/vault.main-stack.asset-information-stack/vault.main-stack.asset-information-stack.tsx @@ -13,9 +13,9 @@ export function VaultAssetInformationStack({ return ( await addToken()} > - {'dlcBTC'} + {iBTC.logoAlt} {' '} Add Token to Wallet diff --git a/src/app/hooks/use-add-token.ts b/src/app/hooks/use-add-token.ts index 7f5741d4..0b0da83f 100644 --- a/src/app/hooks/use-add-token.ts +++ b/src/app/hooks/use-add-token.ts @@ -19,7 +19,7 @@ export function useAddToken(): () => Promise { await walletClient.watchAsset({ type: 'ERC20', options: { - address: ethereumNetworkConfiguration.dlcBTCContract.address, + address: ethereumNetworkConfiguration.iBTCContract.address, symbol: 'IBTC', decimals: 8, image: 'https://dlc-public-assets.s3.amazonaws.com/dlcBTC_Token.png', diff --git a/src/app/hooks/use-deposit-limits.ts b/src/app/hooks/use-deposit-limits.ts index 4e278c71..4595c8b1 100644 --- a/src/app/hooks/use-deposit-limits.ts +++ b/src/app/hooks/use-deposit-limits.ts @@ -52,7 +52,7 @@ export function useDepositLimits(): UseDepositLimitsReturnType { } const { data: evmDepositLimit } = useQuery({ - queryKey: ['evmDepositLimit', ethereumNetworkConfiguration.dlcBTCContract.address], + queryKey: ['evmDepositLimit', ethereumNetworkConfiguration.iBTCContract.address], queryFn: fetchEVMDepositLimit, enabled: !!ethereumNetworkConfiguration, }); diff --git a/src/app/hooks/use-proof-of-reserve.ts b/src/app/hooks/use-proof-of-reserve.ts index 0bfccaf2..49812383 100644 --- a/src/app/hooks/use-proof-of-reserve.ts +++ b/src/app/hooks/use-proof-of-reserve.ts @@ -51,7 +51,7 @@ export function useProofOfReserve(): UseProofOfReserveReturnType { ); return { merchant, - dlcBTCAmount: unshiftValue(proofOfReserve), + iBTCAmount: unshiftValue(proofOfReserve), }; }); @@ -66,7 +66,7 @@ export function useProofOfReserve(): UseProofOfReserveReturnType { appConfiguration.merchants.map((merchant: Merchant) => { return { merchant, - dlcBTCAmount: undefined, + iBTCAmount: undefined, }; }), ], diff --git a/src/app/providers/balance-context-provider.tsx b/src/app/providers/balance-context-provider.tsx index 0cc1722f..00294e2d 100644 --- a/src/app/providers/balance-context-provider.tsx +++ b/src/app/providers/balance-context-provider.tsx @@ -17,18 +17,18 @@ import { NetworkConnectionContext } from './network-connection.provider'; import { XRPWalletContext } from './xrp-wallet-context-provider'; interface VaultContextType { - dlcBTCBalance: number | undefined; + iBTCBalance: number | undefined; lockedBTCBalance: number | undefined; } export const BalanceContext = createContext({ - dlcBTCBalance: undefined, + iBTCBalance: undefined, lockedBTCBalance: undefined, }); export function BalanceContextProvider({ children }: HasChildren): React.JSX.Element { const { - ethereumNetworkConfiguration: { dlcBTCContract, dlcManagerContract }, + ethereumNetworkConfiguration: { iBTCContract, dlcManagerContract }, } = useContext(EthereumNetworkConfigurationContext); const { networkType } = useContext(NetworkConfigurationContext); const { isConnected } = useContext(NetworkConnectionContext); @@ -38,19 +38,19 @@ export function BalanceContextProvider({ children }: HasChildren): React.JSX.Ele const { address: ethereumUserAddress } = useAccount(); const fetchEVMBalances = async () => { - const dlcBTCBalance = await getAddressDLCBTCBalance(dlcBTCContract, ethereumUserAddress!); + const iBTCBalance = await getAddressDLCBTCBalance(iBTCContract, ethereumUserAddress!); const lockedBTCBalance = await getLockedBTCBalance( await getAllAddressVaults(dlcManagerContract, ethereumUserAddress!) ); - return { dlcBTCBalance, lockedBTCBalance }; + return { iBTCBalance, lockedBTCBalance }; }; const fetchXRPLBalances = async () => { - const dlcBTCBalance = await xrpHandler?.getDLCBTCBalance(); + const iBTCBalance = await xrpHandler?.getDLCBTCBalance(); const lockedBTCBalance = await xrpHandler?.getLockedBTCBalance(); - return { dlcBTCBalance, lockedBTCBalance }; + return { iBTCBalance, lockedBTCBalance }; }; const { data } = useQuery({ @@ -62,7 +62,7 @@ export function BalanceContextProvider({ children }: HasChildren): React.JSX.Ele return ( {children} diff --git a/src/app/providers/ethereum-network-configuration.provider.tsx b/src/app/providers/ethereum-network-configuration.provider.tsx index 86ad0330..3cbb64d5 100644 --- a/src/app/providers/ethereum-network-configuration.provider.tsx +++ b/src/app/providers/ethereum-network-configuration.provider.tsx @@ -54,10 +54,10 @@ function getEthereumNetworkConfiguration( 'DLCManager', appConfiguration.l1Websocket ), - dlcBTCContract: getEthereumContractWithProvider( + iBTCContract: getEthereumContractWithProvider( getEthereumNetworkDeploymentPlans(mainnet), mainnet, - 'DLCBTC', + 'IBTC', appConfiguration.l1Websocket ), chain: mainnet, @@ -75,10 +75,10 @@ function getEthereumNetworkConfiguration( 'DLCManager', appConfiguration.l1Websocket ), - dlcBTCContract: getEthereumContractWithProvider( + iBTCContract: getEthereumContractWithProvider( getEthereumNetworkDeploymentPlans(sepolia), sepolia, - 'DLCBTC', + 'IBTC', appConfiguration.l1Websocket ), chain: sepolia, @@ -96,10 +96,10 @@ function getEthereumNetworkConfiguration( 'DLCManager', appConfiguration.baseWebsocket ), - dlcBTCContract: getEthereumContractWithProvider( + iBTCContract: getEthereumContractWithProvider( getEthereumNetworkDeploymentPlans(base), base, - 'DLCBTC', + 'IBTC', appConfiguration.baseWebsocket ), chain: base, @@ -117,10 +117,10 @@ function getEthereumNetworkConfiguration( 'DLCManager', baseSepolia.rpcUrls.default.http[0] ), - dlcBTCContract: getEthereumContractWithProvider( + iBTCContract: getEthereumContractWithProvider( getEthereumNetworkDeploymentPlans(baseSepolia), baseSepolia, - 'DLCBTC', + 'IBTC', baseSepolia.rpcUrls.default.http[0] ), chain: baseSepolia, @@ -138,10 +138,10 @@ function getEthereumNetworkConfiguration( 'DLCManager', appConfiguration.arbitrumWebsocket ), - dlcBTCContract: getEthereumContractWithProvider( + iBTCContract: getEthereumContractWithProvider( getEthereumNetworkDeploymentPlans(arbitrum), arbitrum, - 'DLCBTC', + 'IBTC', appConfiguration.arbitrumWebsocket ), chain: arbitrum, @@ -159,10 +159,10 @@ function getEthereumNetworkConfiguration( 'DLCManager', appConfiguration.arbitrumWebsocket ), - dlcBTCContract: getEthereumContractWithProvider( + iBTCContract: getEthereumContractWithProvider( getEthereumNetworkDeploymentPlans(arbitrumSepolia), arbitrumSepolia, - 'DLCBTC', + 'IBTC', appConfiguration.arbitrumWebsocket ), chain: arbitrumSepolia, @@ -179,10 +179,10 @@ function getEthereumNetworkConfiguration( hardhat, 'DLCManager' ), - dlcBTCContract: getEthereumContractWithProvider( + iBTCContract: getEthereumContractWithProvider( getEthereumNetworkDeploymentPlans(hardhat), hardhat, - 'DLCBTC' + 'IBTC' ), chain: hardhat, }; diff --git a/src/shared/examples/example-attestor-select-table-items.ts b/src/shared/examples/example-attestor-select-table-items.ts index baac68ee..1ba44213 100644 --- a/src/shared/examples/example-attestor-select-table-items.ts +++ b/src/shared/examples/example-attestor-select-table-items.ts @@ -4,7 +4,7 @@ export const exampleAttestorSelectTableItems = [ time: '8 hours ago', action: 'Update Vote State', programs: 'TS', - value: '0.8059 dlcBTC', + value: '0.8059 iBTC', token: 'N/A', }, { @@ -12,7 +12,7 @@ export const exampleAttestorSelectTableItems = [ time: '1 hours ago', action: 'Create Proposal', programs: 'VP', - value: '0.8415 dlcBTC', + value: '0.8415 iBTC', token: 'N/A', }, { @@ -20,7 +20,7 @@ export const exampleAttestorSelectTableItems = [ time: '11 hours ago', action: 'Execute Transaction', programs: 'DL', - value: '0.5634 dlcBTC', + value: '0.5634 iBTC', token: 'N/A', }, { @@ -28,7 +28,7 @@ export const exampleAttestorSelectTableItems = [ time: '13 hours ago', action: 'Create Proposal', programs: 'DL2', - value: '0.6588 dlcBTC', + value: '0.6588 iBTC', token: 'N/A', }, { @@ -36,7 +36,7 @@ export const exampleAttestorSelectTableItems = [ time: '3 hours ago', action: 'Update Vote State', programs: 'VP', - value: '0.4762 dlcBTC', + value: '0.4762 iBTC', token: 'N/A', }, { @@ -44,7 +44,7 @@ export const exampleAttestorSelectTableItems = [ time: '18 hours ago', action: 'Create Proposal', programs: 'TS', - value: '0.1499 dlcBTC', + value: '0.1499 iBTC', token: 'N/A', }, { @@ -52,7 +52,7 @@ export const exampleAttestorSelectTableItems = [ time: '7 hours ago', action: 'Update Vote State', programs: 'DL2', - value: '0.5255 dlcBTC', + value: '0.5255 iBTC', token: 'N/A', }, { @@ -60,7 +60,7 @@ export const exampleAttestorSelectTableItems = [ time: '6 hours ago', action: 'Create Proposal', programs: 'TS', - value: '0.9675 dlcBTC', + value: '0.9675 iBTC', token: 'N/A', }, ]; diff --git a/src/shared/models/ethereum-models.ts b/src/shared/models/ethereum-models.ts index 4c72a60f..d4e0b0da 100644 --- a/src/shared/models/ethereum-models.ts +++ b/src/shared/models/ethereum-models.ts @@ -17,7 +17,7 @@ export interface EthereumNetworkConfiguration { | 'evm-hardhat-eth'; enabledEthereumNetworks: EthereumNetwork[]; dlcManagerContract: Contract; - dlcBTCContract: Contract; + iBTCContract: Contract; chain: Chain; } @@ -33,7 +33,7 @@ export interface DetailedEvent { } export interface FormattedEvent { merchant: string; - dlcBTCAmount: number; + iBTCAmount: number; txHash: string; date: string; chain: string; diff --git a/src/shared/models/merchant.ts b/src/shared/models/merchant.ts index 8e4d4dfc..d0982fb7 100644 --- a/src/shared/models/merchant.ts +++ b/src/shared/models/merchant.ts @@ -6,5 +6,5 @@ export interface Merchant { export interface MerchantProofOfReserve { merchant: Merchant; - dlcBTCAmount: number | undefined; + iBTCAmount: number | undefined; } diff --git a/src/shared/models/token.ts b/src/shared/models/token.ts index ef793425..31cb5722 100644 --- a/src/shared/models/token.ts +++ b/src/shared/models/token.ts @@ -4,10 +4,10 @@ export interface Token { logoAlt: string; } -export const dlcBTC: Token = { - name: 'dlcBTC', - logo: '/images/logos/dlc-btc-logo.svg', - logoAlt: 'dlcBTC Logo', +export const iBTC: Token = { + name: 'iBTC', + logo: '/images/logos/ibtc-logo.svg', + logoAlt: 'iBTC Logo', }; export const bitcoin: Token = { diff --git a/src/shared/utils.ts b/src/shared/utils.ts index 91f22573..e7f52334 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -39,7 +39,7 @@ export function formatEvent(event: DetailedEvent): FormattedEvent { const isMint = event.eventType === 'mint'; const date = new Date(event.timestamp * 1000); return { - dlcBTCAmount: isMint ? event.value : -event.value, + iBTCAmount: isMint ? event.value : -event.value, merchant: isMint ? event.to : event.from, txHash: event.txHash, date: date diff --git a/vite.config.ts b/vite.config.ts index 052bfd72..4070689d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -20,7 +20,7 @@ async function fetchEthereumDeploymentPlans( network => network.id === ethereumNetworkID ); - const networkDeploymentPlans = await Promise.all(['DLCManager', 'DLCBTC'].map(async (contractName) => { + const networkDeploymentPlans = await Promise.all(['DLCManager', 'IBTC'].map(async (contractName) => { let deploymentPlanURL: string; switch (appEnvironment) { case 'mainnet': From 135c5d94f632564863137dfddcb28f8a037107eb Mon Sep 17 00:00:00 2001 From: Polybius93 <99192647+Polybius93@users.noreply.github.com> Date: Fri, 29 Nov 2024 13:48:17 +0100 Subject: [PATCH 11/12] chore: update dlc-btc-lib to v.2.4.17 (#219) --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 0e30fd93..2d934487 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "concurrently": "^8.2.2", "d3": "^7.9.0", "decimal.js": "^10.4.3", - "dlc-btc-lib": "2.4.17", + "dlc-btc-lib": "2.4.18", "dotenv": "^16.3.1", "ethers": "5.7.2", "formik": "^2.4.5", diff --git a/yarn.lock b/yarn.lock index a5f40f86..8395a43a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5195,10 +5195,10 @@ dir-glob@^3.0.1: dependencies: path-type "^4.0.0" -dlc-btc-lib@2.4.17: - version "2.4.17" - resolved "https://registry.yarnpkg.com/dlc-btc-lib/-/dlc-btc-lib-2.4.17.tgz#44ff9dab788562cfa08ad299f65b275f7f7f5ff4" - integrity sha512-8gzJ40MttJHHtO8i0+qMoEtltVCwQ6U7y76w93lI/7jvVs4fBu+HlQvFtmfboNBJF1uAsoO1Hic5W6OzVlIrgQ== +dlc-btc-lib@2.4.18: + version "2.4.18" + resolved "https://registry.yarnpkg.com/dlc-btc-lib/-/dlc-btc-lib-2.4.18.tgz#246c15af91bfcf03212f8abd440b122f575510f4" + integrity sha512-Q7t8VGrrbA2ioyNvvNXxH8dfqQwFUDLpLNWHwqqY0H8zaD4gXpKswi1clDHy7gASZhcLvBBOKAYp5+PUkja/YA== dependencies: "@gemwallet/api" "3.8.0" "@ledgerhq/hw-app-btc" "10.4.1" From 2a2c23982c27c29e1ccaeeccd7334087a83c64cb Mon Sep 17 00:00:00 2001 From: Polybius93 <99192647+Polybius93@users.noreply.github.com> Date: Mon, 2 Dec 2024 10:57:01 +0100 Subject: [PATCH 12/12] chore: modify esplora endpoint from custom to public (#220) --- config.mainnet.json | 2 +- config.testnet.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config.mainnet.json b/config.mainnet.json index 915bbee4..ecb72180 100644 --- a/config.mainnet.json +++ b/config.mainnet.json @@ -6,7 +6,7 @@ "bitcoinNetwork": "mainnet", "bitcoinNetworkIndex": 0, "bitcoinNetworkPreFix": "bc1", - "bitcoinBlockchainURL": "https://mainnet.dlc.link/electrs", + "bitcoinBlockchainURL": "https://blockstream.info/api", "bitcoinBlockchainExplorerURL": "https://mempool.space", "bitcoinBlockchainFeeEstimateURL": "https://mempool.space/api/v1/fees/recommended", "rippleIssuerAddress": "rGcyRGrZPaJAZbZDi4NqRFLA5GQH63iFpD", diff --git a/config.testnet.json b/config.testnet.json index 81e7f9bc..5e039a57 100644 --- a/config.testnet.json +++ b/config.testnet.json @@ -6,7 +6,7 @@ "bitcoinNetwork": "testnet", "bitcoinNetworkIndex": 1, "bitcoinNetworkPreFix": "tb1", - "bitcoinBlockchainURL": "https://testnet.dlc.link/electrs", + "bitcoinBlockchainURL": "https://blockstream.info/testnet/api", "bitcoinBlockchainExplorerURL": "https://mempool.space/testnet", "bitcoinBlockchainFeeEstimateURL": "https://mempool.space/testnet/api/v1/fees/recommended", "rippleIssuerAddress": "ra3oyRVfy4yD4NJPrVcewvDtisZ3FhkcYL",