Help us shape the future of Go! Take the 2026 Go Developer Survey

mersennet

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 15 Imported by: 0

README

Mersennet

Mersennet Go SDK

MIT license CI Docs Telegram

Go client for Mersennet - JSON-RPC and CLOB (order book) operations.

Installation

go get github.com/mersennet/sdk-go@latest

Quick Start

package main

import (
    "fmt"
    "log"

    mersennet "github.com/mersennet/sdk-go"
)

func main() {
    provider := mersennet.NewProvider("http://localhost:8545")

    chainID, err := provider.ChainID()
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Chain ID:", chainID)

    blockNum, err := provider.BlockNumber()
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Block:", blockNum)

    balance, err := provider.GetBalance("0xYourAddress")
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Balance:", balance)

    orders := mersennet.NewOrders(provider)
    book, err := orders.GetOrderBook(1)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Bids:", book.Bids)
    fmt.Println("Asks:", book.Asks)
}

API Reference

Provider

Method Description
GetBlock(number, includeTxs) Get block by number or "latest"
GetBlockByHash(hash, includeTxs) Get block by hash
GetTransaction(hash) Get transaction by hash
GetBalance(address) Get balance
GetNonce(address) Get nonce
SendRawTransaction(rawTx) Send signed transaction
Call(txObject) Simulate call
ChainID() Chain ID
BlockNumber() Latest block number
ViewNotes(grantID, limit, cursorHex) Grant-gated encrypted note export
GasPrice() Current gas price

Orders

Method Description
AddMarket(base, quote, lot, tick) Add market (admin)
PlaceOrder(market, side, price, amount, tif, owner) Place order
CancelOrder(orderID) Cancel order
GetOrderBook(market) Get order book

Shielded Notes

Use ViewNotes to fetch encrypted note envelopes, then call ScanGrantedNotes with a decrypt function that applies your delegated viewing material locally.

material := mersennet.GrantedViewingMaterial{
    GrantID:            "0x...",
    RecipientPublicKey: "0x...",
    Decrypt:            mersennet.NewMockNoteDecryptor("0x..."),
}

result, err := mersennet.ScanGrantedNotes(provider, material, &mersennet.GrantedNoteScanOptions{
    Limit: 64,
})
if err != nil {
    log.Fatal(err)
}
fmt.Println("Decrypted notes:", len(result.Notes))

See the runnable end-to-end example in examples/view-notes-end-to-end/main.go.


Part of the Mersennet ecosystem — trade · explorer · docs · run a node · Telegram
© 2026 Mersennet Foundation · MIT License · security@mersennet.com

Documentation

Overview

Package mersennet is the official Go client for Mersennet, the private, verifiable network (https://mersennet.com).

It covers the JSON-RPC API (eth_* plus the mersennet_* namespace), the on-chain order book exposed by the MersennetOrders precompile (markets, protocol switches, positions, collateral, agent keys, liquidatable accounts), and the shielded layer (viewing keys, note scanning, client-side balance and position reconstruction, portfolio attestations).

Quick start:

p := mersennet.NewProvider("https://rpc.mersennet.com")
orders := mersennet.NewOrders(p)
markets, err := orders.GetMarkets()

Documentation: https://docs.mersennet.com/developers/sdks/go/

Index

Constants

View Source
const AttestationVersion = "mersennet-attestation-v1"

AttestationVersion is the canonical attestation version string.

Variables

View Source
var ErrSignedOrderRequired = errors.New(
	"orders must be signed txs to the CLOB precompile (0x…0100) and submitted via SendRawTransaction; the unsigned RPC was removed")

ErrSignedOrderRequired is returned by the mutating order methods. Orders are now signed transactions to the CLOB precompile (0x0000000000000000000000000000000000000100); the unsigned owner-field RPC was removed for security (it let anyone trade as anyone). Build the placeOrder/cancelOrder/depositCollateral call, sign it, and submit via Provider.SendRawTransaction. Native Go signing helpers are a tracked follow-up; the TypeScript SDK is the reference implementation.

Functions

func ComputePortfolioDigest

func ComputePortfolioDigest(grantID, grantorCommitment string, blockNumber uint64, shieldedStateRoot string, perAsset map[uint32]*big.Int, unspent, spentNullifiers int) string

ComputePortfolioDigest returns the deterministic 0x-hex SHA-256 digest over the disclosed facts. Identical across the TS/Python/Go SDKs.

func DefaultNullifierDeriver

func DefaultNullifierDeriver(note ShieldedNote) string

DefaultNullifierDeriver mirrors the chain's mock scheme: sha256(ownerPk || rho || psi). Production wallets override this with their real nullifier-viewing-key derivation (chain scheme: Poseidon(spend_sk, rho)).

func DelegateViewToken

func DelegateViewToken(vk ViewingKey, scope []string, expiry int64) (string, error)

DelegateViewToken encodes a one-shot viewing token an auditor/counterparty can submit for selective disclosure. Base64-encoded JSON, parity with TS.

func NewMockNoteDecryptor

func NewMockNoteDecryptor(viewSecretHex string) func(GrantedNoteDecryptInput) ([]byte, error)

NewMockNoteDecryptor returns the example/mock decryptor used by the SDK examples. This is not production viewing-key cryptography.

func ToChainPrice

func ToChainPrice(human float64, priceScale uint64) uint64

ToChainPrice converts a human price to on-chain units for a market.

func ToHumanPrice

func ToHumanPrice(chain uint64, priceScale uint64) float64

ToHumanPrice converts an on-chain price to a human price for a market.

func VerifyAttestation

func VerifyAttestation(a *ComplianceAttestation, verify Verifier) (bool, string)

VerifyAttestation checks integrity (recompute digest from the attestation's own disclosed fields) and, if a Verifier is supplied and a signature is present, the signature. Returns (ok, reason).

Types

type BalanceReconstructionResult

type BalanceReconstructionResult struct {
	ReconstructedPortfolio
	GrantID                 string
	BlockNumber             uint64
	ShieldedStateRoot       string
	TotalEncryptedNoteCount int
	FetchedEncryptedNoteCnt int
	SkippedMalformedCount   int
	SpentNullifierCount     int
}

BalanceReconstructionResult is the end-to-end grant-gated balance read result.

func ScanAndReconstructBalances

func ScanAndReconstructBalances(provider *Provider, material GrantedViewingMaterial, opts *GrantedNoteScanOptions, deriveNullifier NullifierDeriver) (*BalanceReconstructionResult, error)

ScanAndReconstructBalances pages mersennet_viewBalances, decrypts owned notes, collects the spent-nullifier set, and reconstructs spendable per-asset balances locally (Workstream F2 + F5).

type Block

type Block struct {
	Number       string        `json:"number"`
	Hash         string        `json:"hash"`
	GasLimit     string        `json:"gasLimit"`
	GasUsed      string        `json:"gasUsed"`
	BaseFee      string        `json:"baseFeePerGas"`
	StateRoot    string        `json:"stateRoot"`
	Transactions []interface{} `json:"transactions"`
	DomainEvents []interface{} `json:"domainEvents,omitempty"`
}

Block represents block data from eth_getBlockByNumber / eth_getBlockByHash. JSON tags match the camelCase field names emitted by the node's BlockDto.

type BuildAttestationOptions

type BuildAttestationOptions struct {
	GrantorCommitment     string
	Scope                 string
	OnchainPortfolioDigst string
	Attester              string
	Sign                  Signer
	IssuedAt              int64 // 0 => now
}

BuildAttestationOptions configures BuildPortfolioAttestation.

type ComplianceAttestation

type ComplianceAttestation struct {
	Version               string            `json:"version"`
	GrantID               string            `json:"grantId"`
	GrantorCommitment     string            `json:"grantorCommitment"`
	BlockNumber           uint64            `json:"blockNumber"`
	ShieldedStateRoot     string            `json:"shieldedStateRoot"`
	PerAsset              map[string]string `json:"perAsset"` // assetId -> balance, decimal strings
	UnspentNoteCount      int               `json:"unspentNoteCount"`
	SpentNullifierCount   int               `json:"spentNullifierCount"`
	PortfolioDigest       string            `json:"portfolioDigest"`
	IssuedAt              int64             `json:"issuedAt"`
	Scope                 string            `json:"scope"`
	OnchainPortfolioDigst *string           `json:"onchainPortfolioDigest"`
	DigestMatchesOnchain  *bool             `json:"digestMatchesOnchain"`
	Attester              string            `json:"attester,omitempty"`
	Signature             string            `json:"signature,omitempty"`
}

ComplianceAttestation is the portable disclosure artifact.

func BuildPortfolioAttestation

func BuildPortfolioAttestation(result *BalanceReconstructionResult, opts BuildAttestationOptions) (*ComplianceAttestation, error)

BuildPortfolioAttestation builds a compliance attestation from a reconstructed balance result.

type EncryptedNoteEnvelope

type EncryptedNoteEnvelope struct {
	Recipient   string
	Ciphertext  []byte
	EphemeralPK string
}

EncryptedNoteEnvelope is the canonical encrypted note wrapper emitted by Mersennet.

func ParseEncryptedNotePayload

func ParseEncryptedNotePayload(payloadHex string) (*EncryptedNoteEnvelope, error)

ParseEncryptedNotePayload decodes the bincode-encoded EncryptedNote envelope returned by mersennet_viewNotes.

type FillRecord

type FillRecord struct {
	OrderID  string
	MarketID int
	Side     string
	Price    *big.Int
	Size     *big.Int
}

FillRecord is a fill the wallet attributed to one of its orders.

type GrantedDecryptedNote

type GrantedDecryptedNote struct {
	NoteCommitment string
	Envelope       EncryptedNoteEnvelope
	Note           ShieldedNote
}

GrantedDecryptedNote is one successfully decrypted note record.

type GrantedNoteDecryptInput

type GrantedNoteDecryptInput struct {
	NoteCommitment   string
	EncryptedNoteHex string
	Envelope         EncryptedNoteEnvelope
}

GrantedNoteDecryptInput is the input passed to a caller-supplied note decryptor.

type GrantedNoteScanOptions

type GrantedNoteScanOptions struct {
	Limit           int
	CursorHex       string
	MaxPages        int
	IgnoreMalformed bool
}

GrantedNoteScanOptions controls pagination for note scanning.

type GrantedNoteScanResult

type GrantedNoteScanResult struct {
	GrantID                   string
	BlockNumber               uint64
	TotalEncryptedNoteCount   int
	FetchedEncryptedNoteCount int
	NextCursor                string
	SkippedMalformedCount     int
	Notes                     []GrantedDecryptedNote
}

GrantedNoteScanResult is the aggregated result of scanning mersennet_viewNotes pages.

func ScanGrantedNotes

func ScanGrantedNotes(provider *Provider, material GrantedViewingMaterial, opts *GrantedNoteScanOptions) (*GrantedNoteScanResult, error)

ScanGrantedNotes pages through mersennet_viewNotes and locally decrypts matching note envelopes.

type GrantedViewingMaterial

type GrantedViewingMaterial struct {
	GrantID            string
	RecipientPublicKey string
	Decrypt            func(GrantedNoteDecryptInput) ([]byte, error)
}

GrantedViewingMaterial carries the grant id plus the decryptor that uses the delegated viewing material.

func CreateOwnerViewingMaterial

func CreateOwnerViewingMaterial(vk ViewingKey, grantIDHex string) GrantedViewingMaterial

CreateOwnerViewingMaterial builds the viewing material a wallet uses to scan its OWN notes. The decryptor is keyed by the wallet's secret viewing scalar; the scan is filtered to notes addressed to its public viewing key.

type LogEntry

type LogEntry struct {
	Address          string   `json:"address"`
	Topics           []string `json:"topics"`
	Data             string   `json:"data"`
	BlockNumber      string   `json:"blockNumber"`
	BlockHash        string   `json:"blockHash"`
	TransactionHash  string   `json:"transactionHash"`
	TransactionIndex string   `json:"transactionIndex"`
	LogIndex         string   `json:"logIndex"`
	Removed          bool     `json:"removed"`
}

LogEntry represents a log entry. JSON tags match the camelCase field names emitted by the node's LogDto.

type Market

type Market struct {
	ID         uint64 `json:"id"`
	Symbol     string `json:"symbol"`
	TickSize   string `json:"tickSize"`
	LotSize    string `json:"lotSize"`
	LastPrice  string `json:"lastPrice"`
	PriceScale uint64 `json:"priceScale"`
	Status     string `json:"status"`
}

Market is a listed market as reported by mersennet_orders_getMarkets. PriceScale: on-chain price = human price × PriceScale (1 = integer prices).

type MersennetError

type MersennetError struct {
	Message string
	Code    int
}

MersennetError represents an RPC or SDK error

func (*MersennetError) Error

func (e *MersennetError) Error() string

type NullifierDeriver

type NullifierDeriver func(ShieldedNote) string

NullifierDeriver maps an owned note to its on-chain nullifier (0x-prefixed hex).

type OpenOrder

type OpenOrder struct {
	OrderID   string
	MarketID  int
	Side      string
	Price     *big.Int
	Remaining *big.Int
}

OpenOrder is a still-resting order with its unfilled remainder.

func ReconstructOpenOrders

func ReconstructOpenOrders(orders []OrderRecord, fills []FillRecord) ([]OpenOrder, error)

ReconstructOpenOrders reports every non-cancelled order whose filled size is below its original size, with the unfilled remainder.

type Order

type Order struct {
	ID       string `json:"id"`
	Owner    string `json:"owner"`
	MarketID string `json:"market_id"`
	Side     string `json:"side"`
	Price    string `json:"price"`
	Size     string `json:"size"`
	TIF      string `json:"tif"`
}

Order represents an order in the order book

type OrderBook

type OrderBook struct {
	Bids []OrderBookLevel `json:"bids"`
	Asks []OrderBookLevel `json:"asks"`
}

OrderBook represents the full order book

type OrderBookLevel

type OrderBookLevel struct {
	Price string `json:"price"`
	Size  string `json:"size"`
}

OrderBookLevel represents a price level

type OrderRecord

type OrderRecord struct {
	OrderID  string
	MarketID int
	Side     string // "buy" | "sell"
	Price    *big.Int
	Size     *big.Int
	Status   string // "" | "open" | "cancelled"
}

OrderRecord is an order the wallet submitted, as recorded at submit time.

type Orders

type Orders struct {
	// contains filtered or unexported fields
}

Orders provides CLOB interaction for Mersennet

func NewOrders

func NewOrders(provider *Provider) *Orders

NewOrders creates a new Orders client

func (*Orders) AddMarket

func (o *Orders) AddMarket(base, quote, lot, tick string) (uint64, error)

AddMarket adds a new market (admin). Returns market ID.

func (*Orders) CancelOrder

func (o *Orders) CancelOrder(orderID uint64) (bool, error)

CancelOrder is deprecated: cancels are signed txs to the CLOB precompile (the chain enforces order ownership). See ErrSignedOrderRequired.

func (*Orders) CollateralUnitsPerMRSN

func (o *Orders) CollateralUnitsPerMRSN() (*big.Int, error)

CollateralUnitsPerMRSN returns the collateral units that make up one MRSN in the current era: 10^18 before the settlement switch (a unit was one wei) and 1 from it (a unit is one MRSN), read from getProtocol().weiPerCollateralUnit.

func (*Orders) GetAgents

func (o *Orders) GetAgents(owner string) (map[string]interface{}, error)

GetAgents returns the agent keys granted by owner and whether delegation is active.

func (*Orders) GetLiquidatable

func (o *Orders) GetLiquidatable() ([]string, error)

GetLiquidatable returns the accounts below maintenance margin at the head (keeper feed; empty before the settlement switch).

func (*Orders) GetMarkets

func (o *Orders) GetMarkets() ([]Market, error)

GetMarkets lists the markets with tick/lot sizes and price scales.

func (*Orders) GetOrderBook

func (o *Orders) GetOrderBook(market uint64) (*OrderBook, error)

GetOrderBook returns the order book for a market

func (*Orders) GetProtocol

func (o *Orders) GetProtocol() (map[string]interface{}, error)

GetProtocol returns every CLOB consensus switch and live parameter (mersennet_orders_getProtocol): margin bps, wei per collateral unit, insurance fund, bad debt, market price scales.

func (*Orders) PlaceOrder

func (o *Orders) PlaceOrder(market uint64, side, price, amount, tif, owner string) (map[string]interface{}, error)

PlaceOrder is deprecated: orders are signed txs to the CLOB precompile. See ErrSignedOrderRequired. Build the placeOrder call, sign it, and submit via Provider.SendRawTransaction.

func (*Orders) ToCollateralUnits

func (o *Orders) ToCollateralUnits(mrsn string) (*big.Int, error)

ToCollateralUnits converts a human MRSN amount ("10.5") to integer collateral units for the current era (floor). Pass the result to depositCollateral/withdrawCollateral calldata.

type PortfolioNote

type PortfolioNote struct {
	Note      ShieldedNote
	Nullifier string
	Spent     bool
}

PortfolioNote is a decrypted note tagged with its derived nullifier and spent flag.

type Provider

type Provider struct {
	URL string
	// contains filtered or unexported fields
}

Provider is the JSON-RPC client for Mersennet

func NewProvider

func NewProvider(rpcURL string) *Provider

NewProvider creates a new Provider

func (*Provider) BlockNumber

func (p *Provider) BlockNumber() (uint64, error)

BlockNumber returns the latest block number

func (*Provider) Call

func (p *Provider) Call(txObject map[string]interface{}) (string, error)

Call performs eth_call

func (*Provider) ChainID

func (p *Provider) ChainID() (uint64, error)

ChainID returns the chain ID

func (*Provider) GasPrice

func (p *Provider) GasPrice() (string, error)

GasPrice returns the current gas price

func (*Provider) GetBalance

func (p *Provider) GetBalance(address string) (string, error)

GetBalance returns the balance of an address

func (*Provider) GetBlock

func (p *Provider) GetBlock(number interface{}, includeTxs bool) (*Block, error)

GetBlock returns a block by number (use "latest" for latest)

func (*Provider) GetBlockByHash

func (p *Provider) GetBlockByHash(hash string, includeTxs bool) (*Block, error)

GetBlockByHash returns a block by hash

func (*Provider) GetCodeAttestation

func (p *Provider) GetCodeAttestation(address string) (map[string]interface{}, error)

GetCodeAttestation returns the on-chain code-publication attestation for a contract, or nil if unpublished.

func (*Provider) GetNonce

func (p *Provider) GetNonce(address string) (uint64, error)

GetNonce returns the nonce of an address

func (*Provider) GetTransaction

func (p *Provider) GetTransaction(hash string) (*Transaction, error)

GetTransaction returns a transaction by hash

func (*Provider) SendRawTransaction

func (p *Provider) SendRawTransaction(rawTx string) (string, error)

SendRawTransaction sends a raw signed transaction

func (*Provider) ViewBalances

func (p *Provider) ViewBalances(grantID string, limit *int, cursorHex *string) (*ViewBalancesResult, error)

ViewBalances returns a grant-gated (`balances:read`) page from mersennet_viewBalances: the encrypted-note page plus the spent-nullifier set. Pair with ReconstructPortfolio to derive spendable balances locally.

func (*Provider) ViewGrantStatus

func (p *Provider) ViewGrantStatus(grantID string) (*ViewGrantStatus, error)

ViewGrantStatus returns the lifecycle/status of a viewing grant.

func (*Provider) ViewNotes

func (p *Provider) ViewNotes(grantID string, limit *int, cursorHex *string) (*ViewNotesResult, error)

ViewNotes returns grant-gated encrypted notes from mersennet_viewNotes.

func (*Provider) ViewOrders

func (p *Provider) ViewOrders(grantID string) (*ViewTradingResult, error)

ViewOrders returns the grant-gated (`orders:read`) public market context + grant binding from mersennet_viewOrders. Pair with ReconstructOpenOrders over the wallet's local order records.

func (*Provider) ViewPositions

func (p *Provider) ViewPositions(grantID string) (*ViewTradingResult, error)

ViewPositions returns the grant-gated (`positions:read`) public market context + grant binding from mersennet_viewPositions. Pair with ReconstructPositions over the wallet's local fill records.

type Receipt

type Receipt struct {
	TransactionHash   string     `json:"transactionHash"`
	BlockHash         string     `json:"blockHash"`
	BlockNumber       string     `json:"blockNumber"`
	TransactionIndex  string     `json:"transactionIndex"`
	From              string     `json:"from"`
	To                *string    `json:"to"`
	GasUsed           string     `json:"gasUsed"`
	CumulativeGasUsed string     `json:"cumulativeGasUsed"`
	EffectiveGasPrice string     `json:"effectiveGasPrice"`
	Status            string     `json:"status"`
	ContractAddress   *string    `json:"contractAddress"`
	LogsBloom         string     `json:"logsBloom"`
	Type              string     `json:"type"`
	Logs              []LogEntry `json:"logs"`
}

Receipt represents a transaction receipt. JSON tags match the camelCase field names emitted by the node's ReceiptDto.

type ReconstructOptions

type ReconstructOptions struct {
	DeriveNullifier NullifierDeriver
	SpentNullifiers []string
	IsSpent         func(string) bool
}

ReconstructOptions configures reconstruction.

type ReconstructedPortfolio

type ReconstructedPortfolio struct {
	PerAsset         map[uint32]*big.Int
	UnspentNoteCount int
	SpentNoteCount   int
	TotalNoteCount   int
	Notes            []PortfolioNote
}

ReconstructedPortfolio holds spendable balances per asset (unspent notes only).

func ReconstructPortfolio

func ReconstructPortfolio(notes []ShieldedNote, opts *ReconstructOptions) ReconstructedPortfolio

ReconstructPortfolio reconstructs spendable balances from decrypted notes. Notes are de-duplicated by nullifier; only unspent notes contribute.

type ReconstructedPosition

type ReconstructedPosition struct {
	MarketID    int
	NetSize     *big.Int // signed: positive long, negative short, 0 flat
	EntryPrice  *big.Int // size-weighted average entry of open exposure
	RealizedPnl *big.Int
}

ReconstructedPosition is a per-market net position.

func ReconstructPositions

func ReconstructPositions(fills []FillRecord) ([]ReconstructedPosition, error)

ReconstructPositions reconstructs per-market positions from fills using average-cost accounting. Pass fills chronologically.

type ShieldedNote

type ShieldedNote struct {
	Value   *big.Int
	AssetID uint32
	OwnerPK string
	Rho     string
	Psi     string
}

ShieldedNote is the decoded note plaintext recovered client-side after decryption.

func ParseShieldedNotePlaintext

func ParseShieldedNotePlaintext(plaintext []byte) (*ShieldedNote, error)

ParseShieldedNotePlaintext decodes a bincode-encoded Note plaintext.

type Signer

type Signer func(digestHex string) (string, error)

Signer signs a digest and returns a signature (both 0x-hex).

type Trade

type Trade struct {
	Taker    string `json:"taker"`
	Maker    string `json:"maker"`
	MarketID string `json:"market_id"`
	Side     string `json:"side"`
	Price    string `json:"price"`
	Size     string `json:"size"`
}

Trade represents a trade execution

type Transaction

type Transaction struct {
	Hash     string  `json:"hash"`
	From     string  `json:"from"`
	To       *string `json:"to"`
	Value    string  `json:"value"`
	Nonce    string  `json:"nonce"`
	Gas      string  `json:"gas"`
	GasPrice string  `json:"gasPrice"`
	Input    string  `json:"input"`
}

Transaction represents transaction data. JSON tags match the camelCase field names emitted by the node's TxDto.

type Verifier

type Verifier func(digestHex, signatureHex, attester string) bool

Verifier verifies a signature over a digest by the named attester.

type ViewBalancesResult

type ViewBalancesResult struct {
	GrantID                    string           `json:"grantId"`
	GrantorCommitment          string           `json:"grantorCommitment"`
	BlockNumber                uint64           `json:"blockNumber"`
	ShieldedStateRoot          string           `json:"shieldedStateRoot"`
	TotalEncryptedNoteCount    int              `json:"totalEncryptedNoteCount"`
	ReturnedEncryptedNoteCount int              `json:"returnedEncryptedNoteCount"`
	NextCursor                 *string          `json:"nextCursor"`
	Notes                      []ViewNotesEntry `json:"notes"`
	SpentNullifiers            []string         `json:"spentNullifiers"`
	SpentNullifierCount        int              `json:"spentNullifierCount"`
	Reconstruction             string           `json:"reconstruction"`
	SignatureVerified          bool             `json:"signatureVerified"`
}

ViewBalancesResult is the mersennet_viewBalances response: an encrypted-note page plus the spent-nullifier set for client-side balance reconstruction.

type ViewGrantStatus

type ViewGrantStatus struct {
	Exists            bool                   `json:"exists"`
	Status            string                 `json:"status"`
	ActiveNow         bool                   `json:"activeNow"`
	SignatureVerified bool                   `json:"signatureVerified"`
	Revoked           bool                   `json:"revoked"`
	RevokedAtBlock    *uint64                `json:"revokedAtBlock"`
	GrantToken        map[string]interface{} `json:"grantToken"`
}

ViewGrantStatus is the mersennet_viewGrantStatus response.

type ViewMarketAggregate

type ViewMarketAggregate struct {
	MarketID          int    `json:"marketId"`
	MarkPrice         string `json:"markPrice"`
	LongOpenInterest  string `json:"longOpenInterest"`
	ShortOpenInterest string `json:"shortOpenInterest"`
	LastClearingPrice string `json:"lastClearingPrice"`
	LastVolume        string `json:"lastVolume"`
	LiquidatableCount int    `json:"liquidatableCount"`
}

ViewMarketAggregate is one public per-market aggregate in a trading view read.

type ViewNotesEntry

type ViewNotesEntry struct {
	NoteCommitment string `json:"noteCommitment"`
	EncryptedNote  string `json:"encryptedNote"`
}

ViewNotesEntry represents one encrypted note returned by mersennet_viewNotes.

type ViewNotesResult

type ViewNotesResult struct {
	GrantID                    string           `json:"grantId"`
	GrantorCommitment          string           `json:"grantorCommitment"`
	BlockNumber                uint64           `json:"blockNumber"`
	ShieldedStateRoot          string           `json:"shieldedStateRoot"`
	TotalEncryptedNoteCount    int              `json:"totalEncryptedNoteCount"`
	ReturnedEncryptedNoteCount int              `json:"returnedEncryptedNoteCount"`
	NextCursor                 *string          `json:"nextCursor"`
	Notes                      []ViewNotesEntry `json:"notes"`
	SignatureVerified          bool             `json:"signatureVerified"`
}

ViewNotesResult represents the mersennet_viewNotes response.

type ViewTradingResult

type ViewTradingResult struct {
	GrantID           string `json:"grantId"`
	GrantorCommitment string `json:"grantorCommitment"`
	BlockNumber       uint64 `json:"blockNumber"`
	ShieldedStateRoot string `json:"shieldedStateRoot"`
	MarketAggregates  struct {
		Markets []ViewMarketAggregate `json:"markets"`
	} `json:"marketAggregates"`
	Reconstruction    string `json:"reconstruction"`
	SignatureVerified bool   `json:"signatureVerified"`
}

ViewTradingResult is the mersennet_viewPositions / mersennet_viewOrders response: public market context + grant binding only (rows reconstructed client-side).

type ViewingKey

type ViewingKey struct {
	SpendPK string
	SpendSK string
	ViewPK  string
	ViewSK  string
}

ViewingKey is a shielded viewing/spend keypair.

func ViewingKeyFromSeed

func ViewingKeyFromSeed(seed string) ViewingKey

ViewingKeyFromSeed derives a viewing key from a seed (parity with ViewingKeyHelpers.fromSeed). Deterministic placeholder; do not use for real funds.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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