From ea3dbc004c78f34734ef7599617c3233015e8f45 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Mon, 28 Oct 2024 12:00:30 +0530 Subject: [PATCH] Store address without chainId in DB --- .../components/projects/create/Configure.tsx | 24 ++++++++++++------- .../projects/create/ConnectWallet.tsx | 2 +- .../frontend/src/pages/components/modals.tsx | 2 +- .../frontend/src/stories/MockStoriesData.ts | 4 ++-- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/packages/frontend/src/components/projects/create/Configure.tsx b/packages/frontend/src/components/projects/create/Configure.tsx index 978399be..9a5e1501 100644 --- a/packages/frontend/src/components/projects/create/Configure.tsx +++ b/packages/frontend/src/components/projects/create/Configure.tsx @@ -157,7 +157,7 @@ const Configure = () => { const verifyTx = async ( senderAddress: string, txHash: string, - amount: string + amount: string, ): Promise => { const isValid = await client.verifyTx( txHash, @@ -176,7 +176,9 @@ const Configure = () => { const senderAddress = selectedAccount; const deployerLrn = createFormData.lrn; - const deployer = deployers.find(deployer => deployer.deployerLrn === deployerLrn); + const deployer = deployers.find( + (deployer) => deployer.deployerLrn === deployerLrn, + ); let amount: string; let txHash: string; @@ -193,10 +195,12 @@ const Configure = () => { if (createFormData.option === 'LRN') { amount = deployer?.minimumPayment!; } else { - amount = (createFormData.numProviders * createFormData.maxPrice).toString(); + amount = ( + createFormData.numProviders * createFormData.maxPrice + ).toString(); } - const amountToBePaid = (amount.replace(/\D/g, '')).toString(); + const amountToBePaid = amount.replace(/\D/g, '').toString(); const txHashResponse = await cosmosSendTokensHandler( selectedAccount, @@ -210,9 +214,13 @@ const Configure = () => { txHash = txHashResponse; - const isTxHashValid = verifyTx(senderAddress, txHash, amount.toString()); + const isTxHashValid = verifyTx( + senderAddress, + txHash, + amount.toString(), + ); if (!isTxHashValid) { - console.error("Invalid Tx hash", txHash) + console.error('Invalid Tx hash', txHash); return; } } @@ -232,7 +240,7 @@ const Configure = () => { const projectId = await createProject( createFormData, environmentVariables, - senderAddress, + senderAddress.split(':')[2], txHash, ); @@ -411,7 +419,7 @@ const Configure = () => { key={deployer.deployerLrn} value={deployer.deployerLrn} > - {deployer.deployerLrn} {deployer.minimumPayment} + {`${deployer.deployerLrn} ${deployer.minimumPayment ? `(${deployer.minimumPayment})` : ''}`} ))} diff --git a/packages/frontend/src/components/projects/create/ConnectWallet.tsx b/packages/frontend/src/components/projects/create/ConnectWallet.tsx index c1e57f13..fffa82eb 100644 --- a/packages/frontend/src/components/projects/create/ConnectWallet.tsx +++ b/packages/frontend/src/components/projects/create/ConnectWallet.tsx @@ -32,7 +32,7 @@ const ConnectWallet = ({ > {accounts.map((account, index) => ( ))} diff --git a/packages/frontend/src/pages/components/modals.tsx b/packages/frontend/src/pages/components/modals.tsx index 1044bd11..cf734d31 100644 --- a/packages/frontend/src/pages/components/modals.tsx +++ b/packages/frontend/src/pages/components/modals.tsx @@ -40,7 +40,7 @@ const deployment: Deployment = { deployerApiUrl: 'https://webapp-deployer-api.example.com', deployerId: 'bafyreicrtgmkir4evvvysxdqxddf2ftdq2wrzuodgvwnxr4rmubi4obdfu', deployerLrn: 'lrn://example/deployers/webapp-deployer-api.example.com', - minimumPayment: '1000alnt' + minimumPayment: '1000alnt', }, status: DeploymentStatus.Ready, createdBy: { diff --git a/packages/frontend/src/stories/MockStoriesData.ts b/packages/frontend/src/stories/MockStoriesData.ts index dd872fd1..d6dbb544 100644 --- a/packages/frontend/src/stories/MockStoriesData.ts +++ b/packages/frontend/src/stories/MockStoriesData.ts @@ -106,7 +106,7 @@ export const deployment0: Deployment = { deployerApiUrl: 'https://webapp-deployer-api.example.com', deployerId: 'bafyreicrtgmkir4evvvysxdqxddf2ftdq2wrzuodgvwnxr4rmubi4obdfu', deployerLrn: 'lrn://deployer.apps.snowballtools.com ', - minimumPayment: '1000alnt' + minimumPayment: '1000alnt', }, applicationDeploymentRequestId: 'bafyreiaycvq6imoppnpwdve4smj6t6ql5svt5zl3x6rimu4qwyzgjorize', @@ -133,7 +133,7 @@ export const project: Project = { deployerApiUrl: 'https://webapp-deployer-api.example.com', deployerId: 'bafyreicrtgmkir4evvvysxdqxddf2ftdq2wrzuodgvwnxr4rmubi4obdfu', deployerLrn: 'lrn://deployer.apps.snowballtools.com ', - minimumPayment: '1000alnt' + minimumPayment: '1000alnt', }, ], paymentAddress: '0x657868687686rb4787987br8497298r79284797487',