ProductPromotion
Logo

Rust

made by https://0x3d.site

GitHub - gakonst/opensea-rs: Rust client to Opensea's APIs and Ethereum smart contracts
Rust client to Opensea's APIs and Ethereum smart contracts - gakonst/opensea-rs
Visit Site

GitHub - gakonst/opensea-rs: Rust client to Opensea's APIs and Ethereum smart contracts

GitHub - gakonst/opensea-rs: Rust client to Opensea's APIs and Ethereum smart contracts

opensea.rs

Rust bindings & CLI to the Opensea API and Contracts

Github Actions

CLI Usage

Run cargo r -- --help to get the top level help menu:

opensea-cli 0.1.0
Choose what NFT subcommand you want to execute

USAGE:
    opensea-cli <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    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

Buying NFT(s)

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 providing nft.ids, you can also provide a CSV file via the --nft.ids_path command, where the first column contains the id of the NFT and the second column contains the quantity of purchased NFT.

Here's an ERC1155 example (which also requires passing the --nft.erc1155 flag)

1,1
2,5
3,2

And an ERC721 example

1
2
3

Flashbots Support: This will proceed to create a Flashbots bundle with 4 transactions: 3 NFT take orders on OpenSea, and a 4th transaction which sends the bribe to the briber contract while also doing consistency checks that we have received the NFTs

Public Mempool: If you omit the Flashbots parameters, it'll proceed to submit the transactions normally via the public mempool.

Development

Rust Toolchain

We use the stable Rust toolchain. Install by running: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Building & testing

cargo check
cargo test
cargo doc --open
cargo build [--release]

Features

  • 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)

Running ignored tests

  1. 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",
    }
  }
}
  1. cargo test --ignored

Acknowledgements

Briber.sol contract written by Anish Agnihotri

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory