diff --git a/packages/starknet-snap/snap.manifest.json b/packages/starknet-snap/snap.manifest.json index 0f2ab426..f9717b2d 100644 --- a/packages/starknet-snap/snap.manifest.json +++ b/packages/starknet-snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/ConsenSys/starknet-snap.git" }, "source": { - "shasum": "9k8ZDr5ZNJOsYza0mhp3KMiKBThzs9CXAKFq7f1yR9I=", + "shasum": "ZjVbz5xyzjNC8nS3bLJz3+C6VqHWxceozLOXUwk05Pk=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/starknet-snap/src/getTransactions.ts b/packages/starknet-snap/src/getTransactions.ts index d9967451..bb35f764 100644 --- a/packages/starknet-snap/src/getTransactions.ts +++ b/packages/starknet-snap/src/getTransactions.ts @@ -71,6 +71,16 @@ export async function getTransactions(params: ApiParams) { console.log(`getTransactions\nstoredUnsettledDeployTxns:\n${JSON.stringify(storedUnsettledDeployTxns)}`); storedUnsettledTxns = [...storedUnsettledTxns, ...storedUnsettledDeployTxns]; } + + // For each "unsettled" txn, update the status and timestamp from the same txn found in massagedTxns + storedUnsettledTxns.forEach((txn) => { + const foundMassagedTxn = massagedTxns.find((massagedTxn) => + number.toBN(massagedTxn.txnHash).eq(number.toBN(txn.txnHash)), + ); + txn.status = foundMassagedTxn?.status ?? txn.status; + txn.timestamp = foundMassagedTxn?.timestamp ?? txn.timestamp; + }); + console.log(`getTransactions\nstoredUnsettledTxns:\n${JSON.stringify(storedUnsettledTxns)}`); // Retrieve the REJECTED txns from snap state @@ -85,8 +95,7 @@ export async function getTransactions(params: ApiParams) { ); console.log(`getTransactions\nstoredRejectedTxns:\n${JSON.stringify(storedRejectedTxns)}`); - // For each "unsettled" txn, call get_transacton_status endpoint from feeder_gateway to - // get the latest status + // For each "unsettled" txn, get the latest status from the provider (RPC or sequencer) await Promise.allSettled( storedUnsettledTxns.map(async (txn) => { const txnStatus = await utils.getTransactionStatus(txn.txnHash, network); diff --git a/packages/starknet-snap/src/utils/starknetUtils.ts b/packages/starknet-snap/src/utils/starknetUtils.ts index b31ba747..06b16e2e 100644 --- a/packages/starknet-snap/src/utils/starknetUtils.ts +++ b/packages/starknet-snap/src/utils/starknetUtils.ts @@ -63,11 +63,14 @@ export const callContract = async ( contractCallData: RawCalldata = [], ): Promise => { const provider = getProvider(network); - return provider.callContract({ - contractAddress, - entrypoint: contractFuncName, - calldata: contractCallData, - }); + return provider.callContract( + { + contractAddress, + entrypoint: contractFuncName, + calldata: contractCallData, + }, + 'latest', + ); }; export const estimateFee = async (