API Reference Cartouche v#0.1.3

Copy Markdown View Source

Modules

Cartouche is a library for interacting with private keys, signatures, and Etheruem.

Helpers for Ethereum addresses.

A for-fun assembler of EVM assembly code from a simple lisp-like language used to construct Quark scripts.

Base58 encoding and decoding using the Bitcoin/Solana alphabet.

Represents a block from the Ethereum JSON-RPC endpoint.

A validator withdrawal entry from a post-Shanghai block (EIP-4895).

Chain registry and chain-id parsing helpers.

This module was auto-generated by Cartouche. Any changes may be lost.

This module was auto-generated by Cartouche. Any changes may be lost.

Represents an Ethereum transaction debug trace, which contains information about the call graph of an executed transaction. Note: this is different from trace_call and instead has deep struct logs for execution.

One execution step inside a Cartouche.DebugTrace — the EVM opcode, program counter, call depth, remaining gas, gas cost of this step, and the stack snapshot at that point.

A wrapper for an ERC-20 contract, allowing the code to interact by pulling data from the contract, or sending transaction to it.

Module to call operations and receive return value, without sending a transaction.

Module to encode calldata for given adaptor operations.

Represents fee history data as defined in EIP-1559.

A system to create an Ethereum log filter and have parsed events passed back to registered processes.

HTTP helpers used by cartouche's RPC transports.

Keccak-256 helpers for hashing arbitrary binaries.

Helper module for parsing and encoding hex values.

Raised by Cartouche.Hex decode/encode bang functions when input is not valid hex (wrong length, non-hex characters, missing/extra 0x prefix, etc.).

Cartouche library to generate Ethereum key pairs.

API Client for [OpenChain.xyz](https://openchain.xyz] API.

Excessively simple RPC client for Ethereum.

Represents an Ethereum transaction receipt, which contains information about the success or failure of an Ethereum transaction after it has been included in a mined Ethereum block.

An event log entry emitted during the transaction referenced by a Cartouche.Receipt — address, data, indexed topics, and the block/tx position needed to locate the log on chain.

EIP-191 (personal_sign) signature recovery primitives.

There are a number of ways to look at recovery bits. Either

Cartouche.Signer is a GenServer which can sign messages. This module takes an mfa (mod, func, args triple) which defines how to actually sign messages. For instance, Cartouche.Signer.Curvy will sign with a public key, or Cartouche.Signer.CloudKMS will sign using a GCP Cloud KMS key. In either case, the caller should start the GenServer, and then call: Cartouche.Signer.sign(MySigner, "message"). This should return back a properly signed message.

Signer to sign messages from a Google Cloud KMS key.

Signer to sign messages using a private key directly.

Sleuth allows you to run a contract call as a single eth_call call.

Associated Token Account (ATA) utilities for Solana.

Ed25519 keypair generation and management for Solana.

Program Derived Addresses (PDAs) for Solana.

Well-known Solana program IDs and addresses.

JSON-RPC client for Solana.

GenServer that wraps Ed25519 signing backends for Solana.

Ed25519 signing backend using Google Cloud KMS.

Ed25519 signing backend using a local private key seed.

Instructions for the Solana System Program.

High-level token operations for Solana: balance queries, transfers, and ATA management.

Instruction builders for the SPL Token Program.

Build, serialize, sign, and deserialize Solana transactions (legacy format).

Account reference with permission flags.

An instruction compiled to account indices.

Message header with account permission counts.

A high-level instruction before compilation.

The transaction message that gets signed.

Represents an Ethereum transaction trace, which contains information about the call graph of an executed transaction.

A single sub-action inside a Cartouche.Trace — the call, create, or suicide operation the traced transaction performed at one frame of its call graph (from, to, value, gas, input, and call-type metadata).

Represents an Ethereum eth_callMany trace, which contains information about the call graph of the speculative execution of several transactions.

A module to help build, sign and encode Ethereum transactions.

Represents a V1 or "Legacy" (that is, pre-EIP-1559) transaction.

Represents a V2 or EIP-1559 transaction.

Module to build EIP-712 typed data, which can then be signed or recovered from.

EIP-712 domain separator — the standard EIP712Domain struct (name, version, chainId, verifyingContract, salt). Each field is optional; only the populated fields contribute to the encoded domain type.

EIP-712 type definition — an ordered list of {name, field_type} field entries. Field types are either primitives (:address, {:uint, 256}, :bool, …) or string references to other named types.

An Ethereum VM in Cartouche, that can only execute pure functions.

Runtime execution state of a Cartouche.VM step: program counter, stack, memory, transient storage, halt/revert flags, return data, and the FFI table available to the VM.

Terminal result of a Cartouche.VM run: the final stack, whether the call reverted, and the return data.

Input to a Cartouche.VM execution: the calldata handed to the EVM entrypoint and the call's msg.value.

Raised by Cartouche.VM.exec/3 (and friends) when the EVM run terminates in a non-recoverable error state — e.g. invalid opcode, stack underflow, or unhandled exception inside an opcode handler.

Conversions between Ethereum denominations and wei.

Mix Tasks

cartouche.gen generates wrapper modules from Solidity artifacts.