Skip to content

Commit

Permalink
remove mocked values
Browse files Browse the repository at this point in the history
  • Loading branch information
gianfra-t committed Sep 23, 2024
1 parent 8b08240 commit 37304c5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 34 deletions.
11 changes: 5 additions & 6 deletions src/pages/swap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,11 @@ export const SwapPage = () => {
// Do not show any error if the user is disconnected
if (isDisconnected) return;

// TESTING - TODO: Remove comment
// if (typeof userInputTokenBalance === 'string') {
// if (Big(userInputTokenBalance).lt(fromAmount ?? 0)) {
// return `Insufficient balance. Your balance is ${userInputTokenBalance} ${fromToken?.assetSymbol}.`;
// }
// }
if (typeof userInputTokenBalance === 'string') {
if (Big(userInputTokenBalance).lt(fromAmount ?? 0)) {
return `Insufficient balance. Your balance is ${userInputTokenBalance} ${fromToken?.assetSymbol}.`;
}
}

const amountOut = tokenOutData.data?.amountOut;

Expand Down
46 changes: 18 additions & 28 deletions src/services/signedTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,38 +39,28 @@ export async function prepareTransactions(state: OfframpingState, context: Execu
squidRouterReceiverHash,
} = state;

// TESTING - TODO: Remove commented
// const spacewalkRedeemTransaction = await prepareSpacewalkRedeemTransaction(state, context);
// const nablaApproveTransaction = await prepareNablaApproveTransaction(state, context);
// const nablaSwapTransaction = await prepareNablaSwapTransaction(state, context);
const spacewalkRedeemTransaction = await prepareSpacewalkRedeemTransaction(state, context);
const nablaApproveTransaction = await prepareNablaApproveTransaction(state, context);
const nablaSwapTransaction = await prepareNablaSwapTransaction(state, context);

// // Fund Stellar ephemeral only after all other transactions are prepared
// await stellarCreateEphemeral(stellarEphemeralSecret, outputTokenType);
// const stellarFundingAccountId = (await fetchSigningServiceAccountId()).stellar.public;
// Fund Stellar ephemeral only after all other transactions are prepared
await stellarCreateEphemeral(stellarEphemeralSecret, outputTokenType);
const stellarFundingAccountId = (await fetchSigningServiceAccountId()).stellar.public;
const stellarEphemeralKeypair = Keypair.fromSecret(stellarEphemeralSecret);
const stellarEphemeralPublicKey = stellarEphemeralKeypair.publicKey();
// const { offrampingTransaction, mergeAccountTransaction } = await setUpAccountAndOperations(
// stellarFundingAccountId,
// stellarEphemeralKeypair,
// sepResult,
// outputTokenType,
// );

// const transactions = {
// stellarOfframpingTransaction: offrampingTransaction.toEnvelope().toXDR().toString('base64'),
// stellarCleanupTransaction: mergeAccountTransaction.toEnvelope().toXDR().toString('base64'),
// spacewalkRedeemTransaction: encodeSubmittableExtrinsic(spacewalkRedeemTransaction),
// nablaSwapTransaction: encodeSubmittableExtrinsic(nablaSwapTransaction),
// nablaApproveTransaction: encodeSubmittableExtrinsic(nablaApproveTransaction),
// };
const { offrampingTransaction, mergeAccountTransaction } = await setUpAccountAndOperations(
stellarFundingAccountId,
stellarEphemeralKeypair,
sepResult,
outputTokenType,
);

// mock all
const transactions = {
stellarOfframpingTransaction: 'stellarOfframpingTransaction',
stellarCleanupTransaction: 'stellarCleanupTransaction',
spacewalkRedeemTransaction: 'spacewalkRedeemTransaction',
nablaSwapTransaction: 'nablaSwapTransaction',
nablaApproveTransaction: 'nablaApproveTransaction',
stellarOfframpingTransaction: offrampingTransaction.toEnvelope().toXDR().toString('base64'),
stellarCleanupTransaction: mergeAccountTransaction.toEnvelope().toXDR().toString('base64'),
spacewalkRedeemTransaction: encodeSubmittableExtrinsic(spacewalkRedeemTransaction),
nablaSwapTransaction: encodeSubmittableExtrinsic(nablaSwapTransaction),
nablaApproveTransaction: encodeSubmittableExtrinsic(nablaApproveTransaction),
};

const apiManager = await getApiManagerInstance();
Expand Down Expand Up @@ -102,7 +92,7 @@ export async function prepareTransactions(state: OfframpingState, context: Execu
squidRouterReceiverId,
squidRouterReceiverHash,
};
//await storeDataInBackend(data);
await storeDataInBackend(data);
} catch (error) {
console.error('Error storing data', error);
}
Expand Down

0 comments on commit 37304c5

Please sign in to comment.