Skip to content

Commit fc7aa88

Browse files
committed
chore: Added support for Sonic chain
1 parent 6e96d40 commit fc7aa88

File tree

9 files changed

+29
-6
lines changed

9 files changed

+29
-6
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Nick Addison
3+
Copyright (c) 2025 Nick Addison
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Options:
5757
-f, --outputFormat <value> output file format (choices: "png", "svg", "eps", "puml", default: "svg")
5858
-o, --outputFileName <value> output file name. Defaults to shortened tx hashes joined together with a 'v' prefix for value transfer diagrams.
5959
-u, --url <url> URL of the archive node with trace transaction support (default: "http://localhost:8545", env: ARCHIVE_NODE_URL)
60-
-c, --chain <value> blockchain explorer to get contract source code from. `none` will not get any source code. `custom` will use the `explorerUrl` option. (choices: "mainnet", "custom", "none", "sepolia", "holesky", "arbitrum", "optimisim", "polygon", "avalanche", "bsc", "crono", "fantom", "gnosis", "moonbeam", "celo", "scroll", "base", default: "mainnet", env: ETH_NETWORK)
60+
-c, --chain <value> blockchain explorer to get contract source code from. `none` will not get any source code. `custom` will use the `explorerUrl` option. (choices: "mainnet", "custom", "none", "sepolia", "holesky", "arbitrum", "optimisim", "polygon", "avalanche", "bsc", "crono", "fantom", "gnosis", "moonbeam", "celo", "scroll", "base", "sonic", default: "mainnet", env: ETH_NETWORK)
6161
-k, --etherscanKey <value> Etherscan like block explorer API key
6262
-e, --explorerUrl <url> required if a `custom` chain is used. eg a testnet like Polygon Mumbai https://api-testnet.polygonscan.com/api (env: EXPLORER_URL)
6363
-cf, --configFile <value> name of the json configuration file that can override contract details like name and ABI (default: "tx.config.json")

lib/clients/EtherscanClient.js

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/types/tx2umlTypes.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ export type ParamTypeInternal = {
149149
components?: ParamTypeInternal[];
150150
};
151151
export declare const nodeTypes: readonly ["geth", "erigon", "nether", "openeth", "tgeth", "besu", "anvil", "reth"];
152-
export declare const networks: readonly ["mainnet", "custom", "none", "sepolia", "holesky", "arbitrum", "optimisim", "polygon", "avalanche", "bsc", "crono", "fantom", "gnosis", "moonbeam", "celo", "scroll", "base"];
152+
export declare const networks: readonly ["mainnet", "custom", "none", "sepolia", "holesky", "arbitrum", "optimisim", "polygon", "avalanche", "bsc", "crono", "fantom", "gnosis", "moonbeam", "celo", "scroll", "base", "sonic"];
153153
export type Network = (typeof networks)[number];
154-
export declare const setNetworkCurrency: (network: Network) => "AVAX" | "MATIC" | "BNB" | "CRO" | "FTM" | "xDAI" | "GLMR" | "CELO" | "ETH";
154+
export declare const setNetworkCurrency: (network: Network) => "AVAX" | "MATIC" | "BNB" | "CRO" | "FTM" | "xDAI" | "GLMR" | "CELO" | "S" | "ETH";
155155
export declare const outputFormats: readonly ["png", "svg", "eps", "puml"];
156156
export type OutputFormat = (typeof outputFormats)[number];
157157
export interface OutputOptions {

lib/types/tx2umlTypes.js

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ts/clients/EtherscanClient.ts

+3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ export default class EtherscanClient {
6363
} else if (network === "base") {
6464
this.url = "https://api.basescan.org/api"
6565
this.apiKey = apiKey || "9I5HUJHPD4ZNXJ4M8TZJ1HD2QBVP1U3M3J"
66+
} else if (network === "sonic") {
67+
this.url = "https://api.sonicscan.org/api"
68+
this.apiKey = apiKey || "STCM7CPYP341C66C4IVV1IFMWDYRUTI1QY"
6669
} else {
6770
if (!apiKey) {
6871
throw new Error(

src/ts/types/tx2umlTypes.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ export const networks = <const>[
187187
"celo",
188188
"scroll",
189189
"base",
190+
"sonic",
190191
]
191192
export type Network = (typeof networks)[number]
192193

@@ -207,7 +208,9 @@ export const setNetworkCurrency = (network: Network) =>
207208
? "GLMR"
208209
: network === "celo"
209210
? "CELO"
210-
: "ETH"
211+
: network === "sonic"
212+
? "S"
213+
: "ETH"
211214

212215
export const outputFormats = <const>["png", "svg", "eps", "puml"]
213216
export type OutputFormat = (typeof outputFormats)[number]

tests/holesky.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"0x4242424242424242424242424242424242424242": {
3+
"protocolName": "Beacon",
4+
"contractName": "DepositContract",
5+
"abi": [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"pubkey","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"withdrawal_credentials","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"amount","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"signature","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"index","type":"bytes"}],"name":"DepositEvent","type":"event"},{"inputs":[{"internalType":"bytes","name":"pubkey","type":"bytes"},{"internalType":"bytes","name":"withdrawal_credentials","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"deposit_data_root","type":"bytes32"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"get_deposit_count","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"get_deposit_root","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"}]
6+
}
7+
}

tests/tests.sh

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ tx2uml value 0x4d2d405d380274c7a2afba7e4881be0f6ae99033597a96b237ceb83cc377615a,
5151
tx2uml value --hideFooter --hideBalances 0x4d2d405d380274c7a2afba7e4881be0f6ae99033597a96b237ceb83cc377615a,0x459b469609e613d95865fd08369d6f92fb4ce8ce168efd9764d75524d9711777 -v
5252
tx2uml value --chain none 0x4d2d405d380274c7a2afba7e4881be0f6ae99033597a96b237ceb83cc377615a,0x459b469609e613d95865fd08369d6f92fb4ce8ce168efd9764d75524d9711777 -v
5353

54+
# Prime No delegate calls
55+
tx2uml call 0x3a89de87d4a039af246474e1573f4687bba402471ab83285d9aa1271edde5eda --noDelegates -v
56+
5457
##### Goerli
5558
export ARCHIVE_NODE_URL=https://eth-goerli.g.alchemy.com/v2/rU87yfwzx4Xv0HSrZAENZO0Otr1x4hqo
5659

0 commit comments

Comments
 (0)