Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Consensys/starknet-snap
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: starknet-snap-v0.7.0
Choose a base ref
...
head repository: Consensys/starknet-snap
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: starknet-snap-v0.8.0
Choose a head ref
  • 2 commits
  • 7 files changed
  • 2 contributors

Commits on Sep 21, 2022

  1. feat: ensure txns in snap state have the same status and timestamp as… (

    #10)
    
    * feat: ensure txns in snap state have the same status and timestamp as that of Voyager
    
    * feat: changed all blockIdentifier to latest to accommodate mainnet instability
    jonesho authored Sep 21, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    danharrin Dan Harrin
    Copy the full SHA
    7c6de7c View commit details
  2. chore: release main (#11)

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    github-actions[bot] authored Sep 21, 2022
    Copy the full SHA
    8b2efa2 View commit details
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"packages/starknet-snap": "0.7.0",
"packages/starknet-snap": "0.8.0",
"packages/wallet-ui": "0.13.0"
}
7 changes: 7 additions & 0 deletions packages/starknet-snap/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [0.8.0](https://github.com/ConsenSys/starknet-snap/compare/starknet-snap-v0.7.0...starknet-snap-v0.8.0) (2022-09-21)


### Features

* ensure txns in snap state have the same status and timestamp as… ([#10](https://github.com/ConsenSys/starknet-snap/issues/10)) ([7c6de7c](https://github.com/ConsenSys/starknet-snap/commit/7c6de7c17d67ca9813a7193d4ff17375cb0c1ceb))

## [0.7.0](https://github.com/ConsenSys/starknet-snap/compare/starknet-snap-v0.6.0...starknet-snap-v0.7.0) (2022-09-20)


Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"openrpc": "1.0.0-rc1",
"info": {
"version": "0.7.0",
"version": "0.8.0",
"title": "StarkNet MetaMask Snap API",
"license": {}
},
2 changes: 1 addition & 1 deletion packages/starknet-snap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@consensys/starknet-snap",
"version": "0.7.0",
"version": "0.8.0",
"license": "(Apache-2.0 OR MIT)",
"main": "src/index.ts",
"repository": {
4 changes: 2 additions & 2 deletions packages/starknet-snap/snap.manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"version": "0.7.0",
"version": "0.8.0",
"description": "StarkNet Snap",
"proposedName": "@consensys/starknet-snap",
"repository": {
"type": "git",
"url": "https://github.com/ConsenSys/starknet-snap.git"
},
"source": {
"shasum": "9k8ZDr5ZNJOsYza0mhp3KMiKBThzs9CXAKFq7f1yR9I=",
"shasum": "ZjVbz5xyzjNC8nS3bLJz3+C6VqHWxceozLOXUwk05Pk=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
13 changes: 11 additions & 2 deletions packages/starknet-snap/src/getTransactions.ts
Original file line number Diff line number Diff line change
@@ -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);
13 changes: 8 additions & 5 deletions packages/starknet-snap/src/utils/starknetUtils.ts
Original file line number Diff line number Diff line change
@@ -63,11 +63,14 @@ export const callContract = async (
contractCallData: RawCalldata = [],
): Promise<CallContractResponse> => {
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 (