Skip to content

Commit

Permalink
feat: add detailed logging for transaction processing in FuelWalletCo…
Browse files Browse the repository at this point in the history
…nnector
  • Loading branch information
nelitow committed Dec 20, 2024
1 parent af53163 commit 0f2c512
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/fuel-wallet/src/FuelWalletConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,25 @@ export class FuelWalletConnector extends FuelConnector {
if (!transaction) {
throw new Error('Transaction is required');
}

// Log the incoming transaction details
console.log('FuelWalletConnector - Incoming Transaction:', {
inputs: transaction.inputs?.map((input) => ({
type: input.type,
owner: 'owner' in input ? input.owner : undefined,
amount: 'amount' in input ? input.amount?.toString() : undefined,
assetId: 'assetId' in input ? input.assetId : undefined,
})),
outputs: transaction.outputs?.map((output) => ({
type: output.type,
to: 'to' in output ? output.to : undefined,
amount: 'amount' in output ? output.amount?.toString() : undefined,
assetId: 'assetId' in output ? output.assetId : undefined,
})),
witnesses: transaction.witnesses?.length,
params,
});

// Transform transaction object to a transaction request
const txRequest = transactionRequestify(transaction);

Expand All @@ -211,6 +230,15 @@ export class FuelWalletConnector extends FuelConnector {
url: network.url,
};

// Log the final request being sent
console.log('FuelWalletConnector - Sending Request:', {
address,
provider,
skipCustomFee: params?.skipCustomFee,
maxFee: txRequest.maxFee?.toString(),
tip: txRequest.tip?.toString(),
});

return this.client.request('sendTransaction', {
address,
transaction: JSON.stringify(txRequest),
Expand Down

0 comments on commit 0f2c512

Please sign in to comment.