Crate brc20_prog

Source
Expand description

This crate provides a BRC20 programmable module implementation.

It has a JSON-RPC server that runs the BRC20 programmable module, and a client for interacting with the server. The server is built using the jsonrpsee crate.

Types used in the BRC20 programmable module are defined in the types module.

The server is started using the start function, and it allows configuring the server with a custom configuration. The server listens for incoming JSON-RPC requests and responds to them. The server supports the Ethereum JSON-RPC API, which allows users to interact with the BRC20 programmable module using standard Ethereum JSON-RPC methods.

The client includes methods for deploying contracts, calling contracts, depositing and withdrawing tokens, it also includes methods for interacting with the underlying EVM, such as getting block information, transaction information, and logs.

Refer to README for more details on JSON-RPC methods and their usage.

§Example

use std::error::Error;

use brc20_prog::Brc20ProgApiClient;
use jsonrpsee::http_client::HttpClientBuilder;

async fn print_block_number() -> Result<(), Box<dyn Error>> {
    let client = HttpClientBuilder::default().build("https://url:port")?;
    println!("eth_blockNumber: {}", client.eth_block_number().await?);
    Ok(())
}

Modules§

types
This module contains the types used in the BRC20 programmable module.

Structs§

Brc20ProgConfig
Configuration for the BRC20 Prog server This struct holds the configuration values for the BRC20 Prog server.

Traits§

Brc20ProgApiClient
Client implementation for the Brc20ProgApi RPC API.

Functions§

startserver
Starts the BRC20 programmable module server.