Skip to content

Commit

Permalink
Release v1.1.17 (#62)
Browse files Browse the repository at this point in the history
* fix: throttle Etherscan getContracts
* chore: bumped version to 1.1.17
* chore: added more tests
  • Loading branch information
naddison36 authored Mar 19, 2023
1 parent cf3a9c3 commit d957186
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/clients/EtherscanClient.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/utils/time.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare const sleep: (ms: number) => Promise<void>;
6 changes: 6 additions & 0 deletions lib/utils/time.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tx2uml",
"version": "1.1.16",
"version": "1.1.17",
"description": "Ethereum transaction visualizer that generates UML sequence diagrams.",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down
3 changes: 3 additions & 0 deletions src/ts/clients/EtherscanClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { BigNumber, Contract as EthersContract } from "ethers"

import { Contract, Network, networks, Token } from "../types/tx2umlTypes"
import { ethereumAddress } from "../utils/regEx"
import { sleep } from "../utils/time"

const debug = require("debug")("tx2uml")

Expand Down Expand Up @@ -76,6 +77,8 @@ export default class EtherscanClient {
debug(
`Contract ${contractAddress} is not verified on Etherscan`
)
// Sleep for a 0.8 seconds if no contract was returned to avoid Etherscan rate limits
await sleep(800)
return {
address: contractAddress,
noContract: false,
Expand Down
2 changes: 2 additions & 0 deletions src/ts/utils/time.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const sleep = (ms: number): Promise<void> =>
new Promise(resolve => setTimeout(resolve, ms))
31 changes: 31 additions & 0 deletions tests/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,37 @@ tx2uml copy 0xd44ea70656c70fe64d29783815b9d3eb3d3b8ef92fa213c59c996baafbe2ecc1
tx2uml 0xd44ea70656c70fe64d29783815b9d3eb3d3b8ef92fa213c59c996baafbe2ecc1 -v --chain goerli -n anvil --url http://localhost:8545
tx2uml value 0xd44ea70656c70fe64d29783815b9d3eb3d3b8ef92fa213c59c996baafbe2ecc1 -v --chain goerli --url http://localhost:8545

# Account Abstraction Stackup
anvil --fork-block-number 8633347 --steps-tracing -f $ARCHIVE_NODE_URL
tx2uml copy 0xc2ed857dd8396e4029c9f9d7a6f5c5eedad3210fd0bf2b3da4d8e29af06b6167
# this delegate calls
tx2uml call 0xc2ed857dd8396e4029c9f9d7a6f5c5eedad3210fd0bf2b3da4d8e29af06b6167 -v --chain goerli -n anvil --url http://localhost:8545
# no delegate calls
tx2uml call 0xc2ed857dd8396e4029c9f9d7a6f5c5eedad3210fd0bf2b3da4d8e29af06b6167 -v -x --chain goerli -n anvil --url http://localhost:8545

# Account Abstraction my contracts
anvil --fork-block-number 8645315 --steps-tracing -f $ARCHIVE_NODE_URL
# Deploy SimpleAccountFactory
tx2uml copy 0xdcf4f2b59ebe51cd09438f310c08e39f1358162b676cfb62b0c078127cfc82d6
tx2uml call 0xdcf4f2b59ebe51cd09438f310c08e39f1358162b676cfb62b0c078127cfc82d6 -v --chain goerli -n anvil --url http://localhost:8545
# Create Account with salt
anvil --fork-block-number 8646391 --steps-tracing -f $ARCHIVE_NODE_URL
tx2uml copy 0x62ed9f7f678b9bb8161876b69a874af855286d8d36e88cb6f9c2aa665bb58359
tx2uml call 0x62ed9f7f678b9bb8161876b69a874af855286d8d36e88cb6f9c2aa665bb58359 -v --chain goerli -n anvil --url http://localhost:8545

# Create Account with 0 salt
anvil --fork-block-number 8650302 --steps-tracing -f $ARCHIVE_NODE_URL
tx2uml copy 0xb9faada5808916e4bb0ccd9757bb5971698a089bf8ebe6fa73ef12e6b7d471e6
tx2uml call 0xb9faada5808916e4bb0ccd9757bb5971698a089bf8ebe6fa73ef12e6b7d471e6 -v --chain goerli -n anvil --url http://localhost:8545
# Send ETH from abstract account wallet to owner's signer account
anvil --fork-block-number 8651997 --steps-tracing -f $ARCHIVE_NODE_URL
tx2uml copy 0xec3076b33e04ff331e27bdf3188c50e3520d570580f794f253de1ed5298df9af
tx2uml call 0xec3076b33e04ff331e27bdf3188c50e3520d570580f794f253de1ed5298df9af -v --chain goerli -n anvil --url http://localhost:8545
# Send ETH from abstract account wallet to two different EOAs
anvil --fork-block-number 8661585 --steps-tracing -f $ARCHIVE_NODE_URL
tx2uml copy 0x3afa8fe219e83fb6cc30e5db6e9e6d2ea1e701ea338c3c47c9beb18c6b7e571a
tx2uml call 0x3afa8fe219e83fb6cc30e5db6e9e6d2ea1e701ea338c3c47c9beb18c6b7e571a -v --chain goerli -n anvil --url http://localhost:8545

###### Sepolia
#export ARCHIVE_NODE_URL=https://sepolia.infura.io/v3/your-api
# MiladyColaTest
Expand Down

0 comments on commit d957186

Please sign in to comment.