tx3sdk

package module
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package tx3sdk is the Tx3 SDK for Go — a client library for defining and executing UTxO-based blockchain transactions declaratively using the Tx3 protocol.

Quick start:

protocol, _ := tx3sdk.ProtocolFromFile("transfer.tii")
trpClient := tx3sdk.NewTRPClient(tx3sdk.TRPClientOptions{Endpoint: "http://localhost:3000"})

client := tx3sdk.NewClient(protocol, trpClient).
    WithProfile("preprod").
    WithParty("sender", tx3sdk.SignerParty(mySigner)).
    WithParty("receiver", tx3sdk.AddressParty("addr_test1..."))

status, _ := client.Tx("transfer").
    Arg("quantity", 10_000_000).
    Resolve(ctx).
    Sign().
    Submit(ctx).
    WaitForConfirmed(ctx, tx3sdk.DefaultPollConfig())

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTRPClient

func NewTRPClient(options TRPClientOptions) *trp.Client

NewTRPClient creates a new low-level TRP JSON-RPC client.

func ProtocolFromBytes added in v0.10.0

func ProtocolFromBytes(data []byte) (*tii.Protocol, error)

ProtocolFromBytes loads a Protocol from raw JSON bytes.

func ProtocolFromFile added in v0.10.0

func ProtocolFromFile(path string) (*tii.Protocol, error)

ProtocolFromFile loads a Protocol from a .tii file at the given path.

func ProtocolFromString added in v0.10.0

func ProtocolFromString(jsonStr string) (*tii.Protocol, error)

ProtocolFromString loads a Protocol from a JSON string.

Types

type CardanoSigner added in v0.10.0

type CardanoSigner = signer.CardanoSigner

CardanoSigner is a Cardano-specific signer using BIP32-Ed25519 key derivation.

func CardanoSignerFromHex added in v0.10.0

func CardanoSignerFromHex(address, privateKeyHex string) (*CardanoSigner, error)

CardanoSignerFromHex creates a CardanoSigner from a hex-encoded extended private key.

func CardanoSignerFromMnemonic added in v0.10.0

func CardanoSignerFromMnemonic(address, phrase string) (*CardanoSigner, error)

CardanoSignerFromMnemonic creates a CardanoSigner from a BIP39 mnemonic phrase. Keys are derived at the standard Cardano path m/1852'/1815'/0'/0/0.

type Ed25519Signer added in v0.10.0

type Ed25519Signer = signer.Ed25519Signer

Ed25519Signer is a generic raw-key signer using Ed25519.

func Ed25519SignerFromHex added in v0.10.0

func Ed25519SignerFromHex(address, privateKeyHex string) (*Ed25519Signer, error)

Ed25519SignerFromHex creates an Ed25519Signer from a hex-encoded private key.

func Ed25519SignerFromMnemonic added in v0.10.0

func Ed25519SignerFromMnemonic(address, phrase string) (*Ed25519Signer, error)

Ed25519SignerFromMnemonic creates an Ed25519Signer from a BIP39 mnemonic phrase.

func NewEd25519Signer added in v0.10.0

func NewEd25519Signer(address string, privateKey [32]byte) *Ed25519Signer

NewEd25519Signer creates an Ed25519Signer from a 32-byte private key seed and address.

type Party added in v0.10.0

type Party = facade.Party

Party represents a named participant in a transaction.

func AddressParty added in v0.10.0

func AddressParty(address string) Party

AddressParty creates a read-only party that provides only an address.

func SignerParty added in v0.10.0

func SignerParty(s signer.Signer) Party

SignerParty creates a signer party. The address is read from the signer.

type PollConfig added in v0.10.0

type PollConfig = facade.PollConfig

PollConfig controls the polling behaviour of wait methods.

func DefaultPollConfig added in v0.10.0

func DefaultPollConfig() PollConfig

DefaultPollConfig returns a PollConfig with sensible defaults (20 attempts, 5s delay).

type Profile added in v0.12.0

type Profile = facade.Profile

Profile is the value type embedded in a Tx3Client's selected profile slot.

type ResolvedTx added in v0.10.0

type ResolvedTx = facade.ResolvedTx

ResolvedTx is a transaction resolved by TRP, ready for signing.

type SignedTx added in v0.10.0

type SignedTx = facade.SignedTx

SignedTx is a signed transaction ready for submission.

type Signer added in v0.10.0

type Signer = signer.Signer

Signer is the interface for transaction signing.

type SubmittedTx added in v0.10.0

type SubmittedTx = facade.SubmittedTx

SubmittedTx is a submitted transaction that can be polled for status.

type TRPClientOptions added in v0.10.0

type TRPClientOptions = trp.ClientOptions

TRPClientOptions configures a TRP client.

type Tx3Client added in v0.10.0

type Tx3Client = facade.Tx3Client

Tx3Client is the high-level entry point for building and submitting transactions.

type Tx3ClientBuilder added in v0.12.0

type Tx3ClientBuilder = facade.Tx3ClientBuilder

Tx3ClientBuilder builds a Tx3Client. Obtained via Protocol.Client() or facade.FromParts.

func FromParts added in v0.12.0

func FromParts(
	transactions map[string]core.TirEnvelope,
	profiles map[string]facade.Profile,
	knownParties []string,
) *Tx3ClientBuilder

FromParts seeds a builder with already-deconstructed protocol fragments (the codegen flow's entry point).

func ProtocolClient added in v0.12.0

func ProtocolClient(protocol *tii.Protocol) *Tx3ClientBuilder

ProtocolClient returns a fresh Tx3ClientBuilder seeded with the protocol's transactions, profiles, and declared parties. Equivalent to facade.FromProtocol(protocol). Idiomatic entry point for the dynamic flow.

type TxBuilder added in v0.10.0

type TxBuilder = facade.TxBuilder

TxBuilder collects transaction arguments and resolves the transaction.

Directories

Path Synopsis
Package core provides fundamental data types shared across all Tx3 SDK packages.
Package core provides fundamental data types shared across all Tx3 SDK packages.
Package facade provides the high-level ergonomic API for the Tx3 SDK.
Package facade provides the high-level ergonomic API for the Tx3 SDK.
Package signer defines the Signer interface and built-in implementations for Ed25519 and Cardano (BIP32-Ed25519) key signing.
Package signer defines the Signer interface and built-in implementations for Ed25519 and Cardano (BIP32-Ed25519) key signing.
Package tii handles loading and introspecting TII (Transaction Invoke Interface) protocol files.
Package tii handles loading and introspecting TII (Transaction Invoke Interface) protocol files.
Package trp implements the low-level TRP (Transaction Resolve Protocol) JSON-RPC client.
Package trp implements the low-level TRP (Transaction Resolve Protocol) JSON-RPC client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL