Pass payment tx hash in deployment request #19
@ -173,17 +173,13 @@ const Configure = () => {
|
|||||||
|
|
||||||
const handleFormSubmit = useCallback(
|
const handleFormSubmit = useCallback(
|
||||||
async (createFormData: FieldValues) => {
|
async (createFormData: FieldValues) => {
|
||||||
if (!selectedAccount) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const senderAddress = selectedAccount;
|
|
||||||
const deployerLrn = createFormData.lrn;
|
const deployerLrn = createFormData.lrn;
|
||||||
const deployer = deployers.find(
|
const deployer = deployers.find(
|
||||||
(deployer) => deployer.deployerLrn === deployerLrn,
|
(deployer) => deployer.deployerLrn === deployerLrn,
|
||||||
);
|
);
|
||||||
|
|
||||||
let amount: string;
|
let amount: string;
|
||||||
|
let senderAddress: string;
|
||||||
let txHash: string;
|
let txHash: string;
|
||||||
if (createFormData.option === 'LRN' && !deployer?.minimumPayment) {
|
if (createFormData.option === 'LRN' && !deployer?.minimumPayment) {
|
||||||
toast({
|
toast({
|
||||||
@ -194,7 +190,12 @@ const Configure = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
txHash = '';
|
txHash = '';
|
||||||
|
senderAddress = '';
|
||||||
} else {
|
} else {
|
||||||
|
if (!selectedAccount) return;
|
||||||
|
|
||||||
|
senderAddress = selectedAccount.split(':')[2];
|
||||||
|
|
||||||
if (createFormData.option === 'LRN') {
|
if (createFormData.option === 'LRN') {
|
||||||
amount = deployer?.minimumPayment!;
|
amount = deployer?.minimumPayment!;
|
||||||
} else {
|
} else {
|
||||||
@ -222,6 +223,7 @@ const Configure = () => {
|
|||||||
txHash,
|
txHash,
|
||||||
amount.toString(),
|
amount.toString(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isTxHashValid === false) {
|
if (isTxHashValid === false) {
|
||||||
console.error('Invalid Tx hash', txHash);
|
console.error('Invalid Tx hash', txHash);
|
||||||
return;
|
return;
|
||||||
@ -243,7 +245,7 @@ const Configure = () => {
|
|||||||
const projectId = await createProject(
|
const projectId = await createProject(
|
||||||
createFormData,
|
createFormData,
|
||||||
environmentVariables,
|
environmentVariables,
|
||||||
senderAddress.split(':')[2],
|
senderAddress,
|
||||||
txHash,
|
txHash,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ export class GQLClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async verifyTx(txHash: string, amount: string, senderAddress: string): Promise<boolean> {
|
async verifyTx(txHash: string, amount: string, senderAddress: string): Promise<boolean> {
|
||||||
const { data: verifyTx } = await this.client.query({
|
const { data } = await this.client.query({
|
||||||
query: queries.verifyTx,
|
query: queries.verifyTx,
|
||||||
variables: {
|
variables: {
|
||||||
txHash,
|
txHash,
|
||||||
@ -451,6 +451,6 @@ export class GQLClient {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return verifyTx;
|
return data.verifyTx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user