opensea.rs is a powerful Rust library and CLI tool designed to interact with the Opensea API and its associated Ethereum smart contracts. This project aims to provide developers with a robust and efficient interface for managing and transacting NFTs on the Opensea marketplace using the Rust programming language.
opensea.rs offers a range of features tailored for developers:
The CLI tool is versatile and user-friendly. To access the top-level help menu, run:
cargo r -- --help
This command provides information on available subcommands such as buying NFTs, deploying contracts, and querying prices. Each subcommand comes with its own help menu, accessible via:
opensea-cli <subcommand> --help
The CLI allows for purchasing NFTs with detailed options for ERC1155 and ERC721 tokens. Here is an example command for buying ERC1155 NFTs using Flashbots:
cargo run buy \
--nft.erc1155 \
--nft.address "0xTheNFTAddress" \
--nft.ids 1 --nft.ids 2 --nft.ids 3 \
--eth.private_key "0xMyPrivateKey" \
--eth.url http://localhost:8545 \
--flashbots.bribe 1000000000000000000 \
--flashbots.bribe_receiver 0xYourBriberContract
The tool supports Flashbots, allowing transactions to be included in Flashbots bundles, ensuring efficient and private transaction execution. If Flashbots parameters are omitted, transactions are submitted via the public mempool.
opensea.rs is built using the stable Rust toolchain. Developers can install Rust by running:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
The following commands are available for building and testing the project:
cargo check
cargo test
cargo doc --open
cargo build [--release]
To run ignored tests, follow these steps:
hardhat.config.js
file with the following configuration:export default {
networks: {
hardhat: {
forking: {
url: "https://eth-mainnet.alchemyapi.io/v2/<YOUR API KEY>",
blockNumber: 13037331,
},
hardfork: "london",
},
},
}
cargo test --ignored
The project currently supports the following features, with more in development: