Pass payment tx hash in deployment request (#19)

Part of [Service provider auctions for web deployments](https://www.notion.so/Service-provider-auctions-for-web-deployments-104a6b22d47280dbad51d28aa3a91d75)

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: cerc-io/snowballtools-base#19
This commit is contained in:
2024-10-29 09:12:39 +00:00
co-authored by IshaVenikar
parent 519e318190
commit 0f18bc978e
8 changed files with 121 additions and 56 deletions
@@ -173,17 +173,13 @@ const Configure = () => {
const handleFormSubmit = useCallback(
async (createFormData: FieldValues) => {
if (!selectedAccount) {
return;
}
const senderAddress = selectedAccount;
const deployerLrn = createFormData.lrn;
const deployer = deployers.find(
(deployer) => deployer.deployerLrn === deployerLrn,
);
let amount: string;
let senderAddress: string;
let txHash: string;
if (createFormData.option === 'LRN' && !deployer?.minimumPayment) {
toast({
@@ -194,7 +190,12 @@ const Configure = () => {
});
txHash = '';
senderAddress = '';
} else {
if (!selectedAccount) return;
senderAddress = selectedAccount.split(':')[2];
if (createFormData.option === 'LRN') {
amount = deployer?.minimumPayment!;
} else {
@@ -220,8 +221,9 @@ const Configure = () => {
const isTxHashValid = await verifyTx(
senderAddress,
txHash,
amount.toString(),
amountToBePaid.toString(),
);
if (isTxHashValid === false) {
console.error('Invalid Tx hash', txHash);
return;
@@ -243,7 +245,7 @@ const Configure = () => {
const projectId = await createProject(
createFormData,
environmentVariables,
senderAddress.split(':')[2],
senderAddress,
txHash,
);