Skip to content

Commit

Permalink
Added content specific links for StarkScan block explorer (#2476)
Browse files Browse the repository at this point in the history
## Introduced changes

<!-- A brief description of the changes -->

- Links to StarkScan are now differentiated by type. Instead of the
generic `/search/<HASH>`, they go to `/tx/<HASH>`, `/class/<HASH>` or
`/contract/<ADDR>`, similar as with Voyager.

## Checklist

<!-- Make sure all of these are complete -->

- [ ] Linked relevant issue
- [x] Updated relevant documentation
- [ ] Added relevant tests
- [x] Performed self-review of the code
- [x] Added changes to `CHANGELOG.md`

Co-authored-by: Jan Smółka <[email protected]>
  • Loading branch information
milancermak and integraledelebesgue authored Sep 26, 2024
1 parent dd6a207 commit 3638f02
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
#### Changed

- `declare` and `verify` commands now use the Scarb `release` profile instead of the `dev` profile as the default for building artifacts
- StarkScan links now point to specific pages for transactions, contracts and classes.

#### Fixed

Expand Down
8 changes: 4 additions & 4 deletions crates/sncast/src/helpers/block_explorer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use starknet::core::types::Felt;

use crate::{response::explorer_link::ExplorerError, Network};

const STARKSCAN: &str = "starkscan.co/search";
const STARKSCAN: &str = "starkscan.co";
const VOYAGER: &str = "voyager.online";
const VIEWBLOCK: &str = "https://viewblock.io/starknet";
const OKLINK: &str = "https://www.oklink.com/starknet";
Expand Down Expand Up @@ -52,21 +52,21 @@ pub struct StarkScan {
impl LinkProvider for StarkScan {
fn transaction(&self, hash: Felt) -> String {
format!(
"https://{}{STARKSCAN}/{hash:#x}",
"https://{}{STARKSCAN}/tx/{hash:#x}",
network_subdomain(self.network)
)
}

fn class(&self, hash: Felt) -> String {
format!(
"https://{}{STARKSCAN}/{hash:#x}",
"https://{}{STARKSCAN}/class/{hash:#x}",
network_subdomain(self.network)
)
}

fn contract(&self, address: Felt) -> String {
format!(
"https://{}{STARKSCAN}/{address:#x}",
"https://{}{STARKSCAN}/contract/{address:#x}",
network_subdomain(self.network)
)
}
Expand Down
28 changes: 14 additions & 14 deletions docs/src/starknet/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ $ sncast \
account create \
--url http://127.0.0.1:5050 \
--name some-name

Account successfully created. Prefund generated address with at least 432300000000 tokens. It is good to send more in the case of higher demand, max_fee * 2 = 864600000000
command: account create
max_fee: 0x64a7168300
address: 0x7a949e83b243068d0cbedd8d5b8b32fafea66c54de23c40e68b126b5c845b61

To see account creation details, visit:
account: https://starkscan.co/search/0x7a949e83b2...
account: https://starkscan.co/tx/0x7a949e83b2...
```
You can also pass common `--accounts-file` argument with a path to (existing or not existing) file where you want to save account info.
For a detailed CLI description, see [account create command reference](../appendix/sncast/account/create.md).
Expand All @@ -59,17 +59,17 @@ $ sncast \
--name some-name \
--fee-token strk \
--max-fee 9999999999999

command: account deploy
transaction_hash: 0x20b20896ce63371ef015d66b4dd89bf18c5510a840b4a85a43a983caa6e2579

To see invocation details, visit:
transaction: https://starkscan.co/search/0x20b20896ce...
transaction: https://starkscan.co/tx/0x20b20896ce...
```
Note that you don't have to pass `url`, `accounts-file` and `network` parameters if `add-profile` flag
was set in the `account create` command. Just pass `profile` argument with the account name.
For a detailed CLI description, see [account deploy command reference](../appendix/sncast/account/deploy.md).
> 💡 **Info**
Expand All @@ -84,14 +84,14 @@ $ sncast \
account create \
--name some-name \
--salt 0x1

Account successfully created. Prefund generated address with at least 432300000000 tokens. It is good to send more in the case of higher demand, max_fee * 2 = 864600000000
command: account create
max_fee: 0x64a7168300
address: 0x7a949e83b243068d0cbedd8d5b8b32fafea66c54de23c40e68b126b5c845b61

To see account creation details, visit:
account: https://starkscan.co/search/0x7ad0d6e449...
account: https://starkscan.co/tx/0x7ad0d6e449...
```
### `account delete`
Expand All @@ -104,7 +104,7 @@ $ sncast \
account delete \
--name some-name \
--network alpha-sepolia

Do you want to remove account some-name from network alpha-sepolia? (Y/n)
Y
command: account delete
Expand Down Expand Up @@ -166,7 +166,7 @@ max_fee: 0x64a7168300
address: 0x7a949e83b243068d0cbedd8d5b8b32fafea66c54de23c40e68b126b5c845b61
To see account creation details, visit:
account: https://starkscan.co/search/0x7a949e83b2...
account: https://starkscan.co/tx/0x7a949e83b2...
$ sncast \
account deploy \
Expand All @@ -177,7 +177,7 @@ command: account deploy
transaction_hash: 0x20b20896ce63371ef015d66b4dd89bf18c5510a840b4a85a43a983caa6e2579
To see invocaton details, visit:
transaction: https://starkscan.co/search/0x20b20896ce...
transaction: https://starkscan.co/tx/0x20b20896ce...
```
### Using Keystore and Starkli Account
Expand Down Expand Up @@ -225,7 +225,7 @@ $ sncast \
--url http://127.0.0.1:5050 \
To see account creation details, visit:
transaction: https://starkscan.co/search/...
transaction: https://starkscan.co/tx/...
```
The command above will generate a keystore file containing the private key, as well as an account file containing the openzeppelin account info that can later be used with starkli.
8 changes: 4 additions & 4 deletions docs/src/starknet/invoke.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ $ sncast \
--contract-address 0x4a739ab73aa3cac01f9da5d55f49fb67baee4919224454a2e3f85b16462a911 \
--function "some_function" \
--calldata 1 2 0x1e

command: invoke
transaction_hash: 0x7ad0d6e449e33b6581a4bb8df866c0fce3919a5ee05a30840ba521dafee217f

To see invocation details, visit:
transaction: https://starkscan.co/search/0x7ad0d6e449...
transaction: https://starkscan.co/tx/0x7ad0d6e449...
```

> 💡 **Info**
Expand All @@ -48,10 +48,10 @@ $ sncast invoke \
--fee-token strk \
--contract-address 0x4a739ab73aa3cac01f9da5d55f49fb67baee4919224454a2e3f85b16462a911 \
--function "function_without_params"

command: invoke
transaction_hash: 0x7ad0d6e449e33b6581a4bb8df866c0fce3919a5ee05a30840ba521dafee217f

To see invocation details, visit:
transaction: https://starkscan.co/search/0x7ad0d6e449...
transaction: https://starkscan.co/tx/0x7ad0d6e449...
```
2 changes: 1 addition & 1 deletion docs/src/starknet/multicall.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ command: multicall
transaction_hash: 0x38fb8a0432f71bf2dae746a1b4f159a75a862e253002b48599c9611fa271dcb

To see invocation details, visit:
transaction: https://starkscan.co/search/0x38fb8a0432...
transaction: https://starkscan.co/tx/0x38fb8a0432...
```

> 💡 **Info**
Expand Down

0 comments on commit 3638f02

Please sign in to comment.