Skip to content

Commit

Permalink
Revert "fix: get nonce without override pending txs"
Browse files Browse the repository at this point in the history
  • Loading branch information
ind-igo authored Sep 4, 2024
1 parent 33ef967 commit 102a947
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/BatchScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -438,16 +438,14 @@ abstract contract BatchScript is Script {

function _getNonce(address safe_) private returns (uint256) {
string memory endpoint = string.concat(
_getSafeAPIEndpoint(safe_),
"?limit=1"
SAFE_API_BASE_URL,
vm.toString(safe_),
"/"
);
(uint256 status, bytes memory data) = endpoint.get();
if (status == 200) {
string memory resp = string(data);
string[] memory results;
results = resp.readStringArray(".results");
if (results.length == 0) return 0;
return resp.readUint(".results[0].nonce") + 1;
string memory result = string(data);
return result.readUint(".nonce");
} else {
revert("Get nonce failed!");
}
Expand Down

0 comments on commit 102a947

Please sign in to comment.