Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZKSYNC and Opensea #577

Closed
PipoBrown opened this issue Mar 1, 2024 · 0 comments
Closed

ZKSYNC and Opensea #577

PipoBrown opened this issue Mar 1, 2024 · 0 comments

Comments

@PipoBrown
Copy link

PipoBrown commented Mar 1, 2024

I suggest the integration, since Opensea mostly everyone uses.

use web3::types::{Address, U256};
use web3::transports::Http;
use web3::contract::{Contract, Options};
use web3::eth::Eth;
use web3::signing::Signer;
use web3::Transport;
use std::fs::File;
use std::io::Read;

#[tokio::main]
async fn main() {
// Connect to a local Ethereum node
let transport = Http::new("http://localhost:8545").expect("Failed to connect to Ethereum node");
let web3 = Web3::new(transport);

// Example contract address and ABI
let contract_address: Address = "your_contract_address".parse().expect("Failed to parse contract address");
let mut contract_abi = Vec::new();
let mut file = File::open("your_contract_abi.json").expect("Failed to open contract ABI file");
file.read_to_end(&mut contract_abi).expect("Failed to read contract ABI");

// Instantiate the contract
let contract = Contract::new(web3.eth(), contract_address, contract_abi);

// Example marketplace functionality
let seller_address: Address = "seller_address".parse().expect("Failed to parse seller address");
let item_id: U256 = 123.into();

// Perform a transaction to add an item to the marketplace
let options = Options::default();
let tx_hash = contract
    .call_with_confirmations("add_item", (seller_address, item_id), options, 1)
    .await
    .expect("Failed to add item to the marketplace");

println!("Transaction Hash: {:?}", tx_hash);

}

@bxpana bxpana closed this as completed Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants