Store address without chainId in DB

This commit is contained in:
IshaVenikar 2024-10-28 12:00:30 +05:30
parent e1f5fbab3c
commit ea3dbc004c
4 changed files with 20 additions and 12 deletions

View File

@ -157,7 +157,7 @@ const Configure = () => {
const verifyTx = async (
senderAddress: string,
txHash: string,
amount: string
amount: string,
): Promise<boolean> => {
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})` : ''}`}
</MenuItem>
))}
</Select>

View File

@ -32,7 +32,7 @@ const ConnectWallet = ({
>
{accounts.map((account, index) => (
<Option key={index} value={account.address}>
{account.address.split(':')[2]}
{account.address}
</Option>
))}
</Select>

View File

@ -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: {

View File

@ -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',