From 461d3e03b4f52b8ba932bb2a1345ff90fc90f69a Mon Sep 17 00:00:00 2001 From: Kamal Nayan Date: Mon, 8 Jul 2024 11:27:39 +0000 Subject: [PATCH 1/2] fixed signing and sending the transaction error --- components/molecules/form-pledge/index.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/components/molecules/form-pledge/index.tsx b/components/molecules/form-pledge/index.tsx index 08c6629..4d016f3 100644 --- a/components/molecules/form-pledge/index.tsx +++ b/components/molecules/form-pledge/index.tsx @@ -4,9 +4,9 @@ import { TransactionModal } from '../../molecules/transaction-modal' import { Utils } from '../../../shared/utils' import styles from './style.module.css' import { Spacer } from '../../atoms/spacer' -import { abundance, crowdfund } from '../../../shared/contracts' +import { abundance, crowdfund, server } from '../../../shared/contracts' import { signTransaction } from '@stellar/freighter-api' -import { BASE_FEE, xdr } from '@stellar/stellar-sdk' +import { BASE_FEE, TransactionBuilder, xdr } from '@stellar/stellar-sdk' export interface IFormPledgeProps { account: string @@ -47,8 +47,16 @@ function MintButton({ title={`Mint ${displayAmount} ${symbol}`} onClick={async () => { setSubmitting(true) - const tx = await abundance.mint({ to: account, amount: amount }) - await tx.signAndSend() + const tx = await abundance.mint({ to: account, amount: amount }); + const signedXdr = await signTransaction(tx.toXDR(), { + network: 'TESTNET', + networkPassphrase: tx.raw.networkPassphrase, + }); + let signed_tx = TransactionBuilder.fromXDR( + signedXdr, + tx.raw.networkPassphrase + ); + const txRes = await server.sendTransaction(signed_tx); setSubmitting(false) onComplete() }} From 2b721038360b55930d79eb0853a8aaf6eb97c847 Mon Sep 17 00:00:00 2001 From: Kamal Nayan Date: Mon, 8 Jul 2024 14:09:59 +0000 Subject: [PATCH 2/2] fix the build error --- components/molecules/form-pledge/index.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/molecules/form-pledge/index.tsx b/components/molecules/form-pledge/index.tsx index 4d016f3..bed41c5 100644 --- a/components/molecules/form-pledge/index.tsx +++ b/components/molecules/form-pledge/index.tsx @@ -50,11 +50,10 @@ function MintButton({ const tx = await abundance.mint({ to: account, amount: amount }); const signedXdr = await signTransaction(tx.toXDR(), { network: 'TESTNET', - networkPassphrase: tx.raw.networkPassphrase, }); let signed_tx = TransactionBuilder.fromXDR( signedXdr, - tx.raw.networkPassphrase + "Test SDF Network ; September 2015" ); const txRes = await server.sendTransaction(signed_tx); setSubmitting(false)