- Notifications
You must be signed in to change notification settings - Fork33
gakonst/opensea-rs
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Rust bindings & CLI to the Opensea API and Contracts
Runcargo r -- --help
to get the top level help menu:
opensea-cli 0.1.0Choose what NFT subcommand you want to executeUSAGE: opensea-cli <SUBCOMMAND>FLAGS: -h, --help Prints help information -V, --version Prints version informationSUBCOMMANDS: buy Purchase 1 or more NFTs, with optional Flashbots support deploy Deploy the Ethereum contract for doing consistency checks inside a Flashbots bundle help Prints this message or the help of the given subcommand(s) prices Get OpenSea orderbook information about the token
To view each individual subcommand's help menu, run:opensea-cli <subcommand name> --help
Here's an example command for purchasing some 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
Instead of providingnft.ids
, you can also provide a CSV file via the--nft.ids_path
command,where the first column contains theid
of the NFT and the second column containsthequantity
of purchased NFT.
Here's an ERC1155 example (which also requires passing the--nft.erc1155
flag)
1,12,53,2
And an ERC721 example
123
Flashbots Support: This will proceed to create a Flashbots bundle with 4 transactions: 3 NFT take orders onOpenSea, and a 4th transaction which sends the bribe to the briber contract while also doingconsistency checks that we have received the NFTs
Public Mempool: If you omit the Flashbots parameters, it'll proceed to submit the transactions normallyvia the public mempool.
We use the stable Rust toolchain. Install by running:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo checkcargo testcargo doc --opencargo build [--release]
- Opensea API
- Opensea Types (Orders etc.)
- Opensea Contract clients
- ERC721
- ERC1155
- Fill a Sell order
- Generalize the API to arbitrary Opensea marketplace schemas
- CLI for operations
- Flashbots contract deployer
- Query prices
- Purchase NFT(s)
- Sniping drops (pre-configuring the target and looping)
- Create a
hardhat.config.js
file and fork from mainnet at this block:
export default { networks: { hardhat: { forking: { url: "https://eth-mainnet.alchemyapi.io/v2/<YOUR API KEY>", blockNumber: 13037331, }, hardfork: "london", } }}
cargo test --ignored
Briber.sol
contract written byAnish Agnihotri
About
Rust client to Opensea's APIs and Ethereum smart contracts
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.