diff --git a/src/app/connections/create/[owner]/components/View/View.tsx b/src/app/connections/create/[owner]/components/View/View.tsx index 8a855ce1..d4c2208c 100644 --- a/src/app/connections/create/[owner]/components/View/View.tsx +++ b/src/app/connections/create/[owner]/components/View/View.tsx @@ -137,7 +137,7 @@ export const View = ({ params }: { params: Promise<{ owner: string }> }) => { onClick={handlePurchaseAlert} disabled={!!nameValidationError} > - Purchase Connection License + Create Connection License @@ -157,20 +157,17 @@ export const View = ({ params }: { params: Promise<{ owner: string }> }) => { >
- Purchase Connection License + Create Connection License

- Warning! By proceeding, you - are agreeing to approve payment of{' '} - $100 worth of $DIMO tokens - at market prices for your DIMO Connection License. If you do not have enough - $DIMO tokens in your account, you will be unable to create a Connection - License. + You are about to create a DIMO Connection License. This license allows you + to host a DIMO Oracle and connect vehicles to the DIMO network.

- You only need to purchase a license if you are planning on hosting a DIMO - Oracle. + You only need a connection license if you are planning on hosting a DIMO + Oracle. Once created, you'll receive the necessary credentials to + manage your connection.

@@ -195,7 +192,7 @@ export const View = ({ params }: { params: Promise<{ owner: string }> }) => { onClick={handleContinuePayment} disabled={isProcessingPayment} > - Continue with Payment + Create Connection
diff --git a/src/components/SpendingLimitModal/SpendingLimitModal.tsx b/src/components/SpendingLimitModal/SpendingLimitModal.tsx index 53c815a0..b0739e67 100644 --- a/src/components/SpendingLimitModal/SpendingLimitModal.tsx +++ b/src/components/SpendingLimitModal/SpendingLimitModal.tsx @@ -76,8 +76,7 @@ export const SpendingLimitModal: FC = ({ Set spending limit

- Approve the Developer License to spend $DIMO on your connected wallet, we - recommend approving more than $100 USD worth of $DIMO + Approve the Developer License to spend $DIMO on your connected wallet

diff --git a/src/config/navigation.ts b/src/config/navigation.ts index 675ef4e9..b609f938 100644 --- a/src/config/navigation.ts +++ b/src/config/navigation.ts @@ -66,7 +66,7 @@ const baseMainMenu = [ label: 'Documentation', icon: SummarizeIcon, iconClassName: 'h-5 w-5', - link: 'https://docs.dimo.zone/developer-platform', + link: 'https://dimo.org/docs', external: true, disabled: false, }, diff --git a/src/hooks/useTransactions.ts b/src/hooks/useTransactions.ts index 1dbc2c4f..c452225e 100644 --- a/src/hooks/useTransactions.ts +++ b/src/hooks/useTransactions.ts @@ -8,7 +8,6 @@ import DimoCreditsABI from '@/contracts/DimoCreditABI.json'; import DimoConnectionABI from '@/contracts/DimoConnectionABI.json'; import { IDesiredTokenAmount, ITokenBalance } from '@/types/wallet'; import { utils } from 'web3'; -import { getCurrentDimoPrice } from '@/services/pricing'; const { CONTRACT_METHODS } = configuration; @@ -198,7 +197,7 @@ export const useMintLicense = () => { export const useMintConnection = () => { const { validateCurrentSession, currentUser } = useGlobalAccount(); - const { checkEnoughBalance, processTransactions } = useContractGA(); + const { processTransactions } = useContractGA(); return useCallback( async (connectionName: string) => { const nameBytes = new TextEncoder().encode(connectionName).length; @@ -211,40 +210,12 @@ export const useMintConnection = () => { } const currentSession = await validateCurrentSession(); - const enoughBalance = await checkEnoughBalance(); - - // Get current DIMO price and calculate required tokens for $100 USD - const dimoPrice = await getCurrentDimoPrice(); - const targetUsdAmount = 100; - // handle price fluctuations - const bufferPercentage = 0.05; - - // Calculate required DIMO tokens: $100 / DIMO price + 5% buffer for price flux. - const baseDimoAmount = targetUsdAmount / dimoPrice; - const requiredDIMO = baseDimoAmount * (1 + bufferPercentage); - const requiredDIMOInWei = BigInt(utils.toWei(requiredDIMO.toString(), 'ether')); if (!currentSession) throw new Error('Web3 connection failed'); if (!currentUser) throw new Error('User not found'); - if (!enoughBalance.dimo) { - return { - success: false, - reason: `Insufficient DIMO balance. You need at least ${requiredDIMO.toFixed(2)} DIMO tokens (approximately $${targetUsdAmount}) to mint a connection.`, - }; - } const transactions = [ - // Transaction 1: approve use of required $DIMO tokens ($100 USD worth + 5% buffer). - { - to: configuration.DC_ADDRESS, - value: BigInt(0), - data: encodeFunctionData({ - abi: DimoABI, - functionName: 'approve', - args: [configuration.DCC_ADDRESS, requiredDIMOInWei], - }), - }, - // Transaction 2: mint a connection license + // Mint a connection license { to: configuration.DCC_ADDRESS, value: BigInt(0), @@ -254,16 +225,6 @@ export const useMintConnection = () => { args: [currentUser.smartContractAddress, connectionName], }), }, - // Transaction 3: approve use of 0 $DIMO tokens - { - to: configuration.DC_ADDRESS, - value: BigInt(0), - data: encodeFunctionData({ - abi: DimoABI, - functionName: 'approve', - args: [configuration.DCC_ADDRESS, BigInt(0)], - }), - }, ]; try { @@ -276,17 +237,6 @@ export const useMintConnection = () => { const errorMessage = (error as Error)?.message || (error as Error)?.toString() || 'Unknown error'; - if ( - errorMessage.includes('ERC20: transfer amount exceeds balance') || - errorMessage.includes('transfer amount exceeds balance') || - errorMessage.includes('insufficient balance') - ) { - return { - success: false, - reason: 'You do not have enough $DIMO to mint a connection.', - }; - } - if ( errorMessage.includes('NameAlreadyInUse') || errorMessage.includes('name already in use') @@ -309,6 +259,6 @@ export const useMintConnection = () => { throw error; } }, - [checkEnoughBalance, currentUser, processTransactions, validateCurrentSession], + [currentUser, processTransactions, validateCurrentSession], ); };