Versions in this module Expand all Collapse all v0 v0.1.0 Sep 19, 2026 Changes in this version + const AttestationVersion + var ErrSignedOrderRequired = errors.New(...) + func ComputePortfolioDigest(grantID, grantorCommitment string, blockNumber uint64, ...) string + func DefaultNullifierDeriver(note ShieldedNote) string + func DelegateViewToken(vk ViewingKey, scope []string, expiry int64) (string, error) + func NewMockNoteDecryptor(viewSecretHex string) func(GrantedNoteDecryptInput) ([]byte, error) + func ToChainPrice(human float64, priceScale uint64) uint64 + func ToHumanPrice(chain uint64, priceScale uint64) float64 + func VerifyAttestation(a *ComplianceAttestation, verify Verifier) (bool, string) + type BalanceReconstructionResult struct + BlockNumber uint64 + FetchedEncryptedNoteCnt int + GrantID string + ShieldedStateRoot string + SkippedMalformedCount int + SpentNullifierCount int + TotalEncryptedNoteCount int + func ScanAndReconstructBalances(provider *Provider, material GrantedViewingMaterial, ...) (*BalanceReconstructionResult, error) + type Block struct + BaseFee string + DomainEvents []interface{} + GasLimit string + GasUsed string + Hash string + Number string + StateRoot string + Transactions []interface{} + type BuildAttestationOptions struct + Attester string + GrantorCommitment string + IssuedAt int64 + OnchainPortfolioDigst string + Scope string + Sign Signer + type ComplianceAttestation struct + Attester string + BlockNumber uint64 + DigestMatchesOnchain *bool + GrantID string + GrantorCommitment string + IssuedAt int64 + OnchainPortfolioDigst *string + PerAsset map[string]string + PortfolioDigest string + Scope string + ShieldedStateRoot string + Signature string + SpentNullifierCount int + UnspentNoteCount int + Version string + func BuildPortfolioAttestation(result *BalanceReconstructionResult, opts BuildAttestationOptions) (*ComplianceAttestation, error) + type EncryptedNoteEnvelope struct + Ciphertext []byte + EphemeralPK string + Recipient string + func ParseEncryptedNotePayload(payloadHex string) (*EncryptedNoteEnvelope, error) + type FillRecord struct + MarketID int + OrderID string + Price *big.Int + Side string + Size *big.Int + type GrantedDecryptedNote struct + Envelope EncryptedNoteEnvelope + Note ShieldedNote + NoteCommitment string + type GrantedNoteDecryptInput struct + EncryptedNoteHex string + Envelope EncryptedNoteEnvelope + NoteCommitment string + type GrantedNoteScanOptions struct + CursorHex string + IgnoreMalformed bool + Limit int + MaxPages int + type GrantedNoteScanResult struct + BlockNumber uint64 + FetchedEncryptedNoteCount int + GrantID string + NextCursor string + Notes []GrantedDecryptedNote + SkippedMalformedCount int + TotalEncryptedNoteCount int + func ScanGrantedNotes(provider *Provider, material GrantedViewingMaterial, ...) (*GrantedNoteScanResult, error) + type GrantedViewingMaterial struct + Decrypt func(GrantedNoteDecryptInput) ([]byte, error) + GrantID string + RecipientPublicKey string + func CreateOwnerViewingMaterial(vk ViewingKey, grantIDHex string) GrantedViewingMaterial + type LogEntry struct + Address string + BlockHash string + BlockNumber string + Data string + LogIndex string + Removed bool + Topics []string + TransactionHash string + TransactionIndex string + type Market struct + ID uint64 + LastPrice string + LotSize string + PriceScale uint64 + Status string + Symbol string + TickSize string + type MersennetError struct + Code int + Message string + func (e *MersennetError) Error() string + type NullifierDeriver func(ShieldedNote) string + type OpenOrder struct + MarketID int + OrderID string + Price *big.Int + Remaining *big.Int + Side string + func ReconstructOpenOrders(orders []OrderRecord, fills []FillRecord) ([]OpenOrder, error) + type Order struct + ID string + MarketID string + Owner string + Price string + Side string + Size string + TIF string + type OrderBook struct + Asks []OrderBookLevel + Bids []OrderBookLevel + type OrderBookLevel struct + Price string + Size string + type OrderRecord struct + MarketID int + OrderID string + Price *big.Int + Side string + Size *big.Int + Status string + type Orders struct + func NewOrders(provider *Provider) *Orders + func (o *Orders) AddMarket(base, quote, lot, tick string) (uint64, error) + func (o *Orders) CancelOrder(orderID uint64) (bool, error) + func (o *Orders) CollateralUnitsPerMRSN() (*big.Int, error) + func (o *Orders) GetAgents(owner string) (map[string]interface{}, error) + func (o *Orders) GetLiquidatable() ([]string, error) + func (o *Orders) GetMarkets() ([]Market, error) + func (o *Orders) GetOrderBook(market uint64) (*OrderBook, error) + func (o *Orders) GetProtocol() (map[string]interface{}, error) + func (o *Orders) PlaceOrder(market uint64, side, price, amount, tif, owner string) (map[string]interface{}, error) + func (o *Orders) ToCollateralUnits(mrsn string) (*big.Int, error) + type PortfolioNote struct + Note ShieldedNote + Nullifier string + Spent bool + type Provider struct + URL string + func NewProvider(rpcURL string) *Provider + func (p *Provider) BlockNumber() (uint64, error) + func (p *Provider) Call(txObject map[string]interface{}) (string, error) + func (p *Provider) ChainID() (uint64, error) + func (p *Provider) GasPrice() (string, error) + func (p *Provider) GetBalance(address string) (string, error) + func (p *Provider) GetBlock(number interface{}, includeTxs bool) (*Block, error) + func (p *Provider) GetBlockByHash(hash string, includeTxs bool) (*Block, error) + func (p *Provider) GetCodeAttestation(address string) (map[string]interface{}, error) + func (p *Provider) GetNonce(address string) (uint64, error) + func (p *Provider) GetTransaction(hash string) (*Transaction, error) + func (p *Provider) SendRawTransaction(rawTx string) (string, error) + func (p *Provider) ViewBalances(grantID string, limit *int, cursorHex *string) (*ViewBalancesResult, error) + func (p *Provider) ViewGrantStatus(grantID string) (*ViewGrantStatus, error) + func (p *Provider) ViewNotes(grantID string, limit *int, cursorHex *string) (*ViewNotesResult, error) + func (p *Provider) ViewOrders(grantID string) (*ViewTradingResult, error) + func (p *Provider) ViewPositions(grantID string) (*ViewTradingResult, error) + type Receipt struct + BlockHash string + BlockNumber string + ContractAddress *string + CumulativeGasUsed string + EffectiveGasPrice string + From string + GasUsed string + Logs []LogEntry + LogsBloom string + Status string + To *string + TransactionHash string + TransactionIndex string + Type string + type ReconstructOptions struct + DeriveNullifier NullifierDeriver + IsSpent func(string) bool + SpentNullifiers []string + type ReconstructedPortfolio struct + Notes []PortfolioNote + PerAsset map[uint32]*big.Int + SpentNoteCount int + TotalNoteCount int + UnspentNoteCount int + func ReconstructPortfolio(notes []ShieldedNote, opts *ReconstructOptions) ReconstructedPortfolio + type ReconstructedPosition struct + EntryPrice *big.Int + MarketID int + NetSize *big.Int + RealizedPnl *big.Int + func ReconstructPositions(fills []FillRecord) ([]ReconstructedPosition, error) + type ShieldedNote struct + AssetID uint32 + OwnerPK string + Psi string + Rho string + Value *big.Int + func ParseShieldedNotePlaintext(plaintext []byte) (*ShieldedNote, error) + type Signer func(digestHex string) (string, error) + type Trade struct + Maker string + MarketID string + Price string + Side string + Size string + Taker string + type Transaction struct + From string + Gas string + GasPrice string + Hash string + Input string + Nonce string + To *string + Value string + type Verifier func(digestHex, signatureHex, attester string) bool + type ViewBalancesResult struct + BlockNumber uint64 + GrantID string + GrantorCommitment string + NextCursor *string + Notes []ViewNotesEntry + Reconstruction string + ReturnedEncryptedNoteCount int + ShieldedStateRoot string + SignatureVerified bool + SpentNullifierCount int + SpentNullifiers []string + TotalEncryptedNoteCount int + type ViewGrantStatus struct + ActiveNow bool + Exists bool + GrantToken map[string]interface{} + Revoked bool + RevokedAtBlock *uint64 + SignatureVerified bool + Status string + type ViewMarketAggregate struct + LastClearingPrice string + LastVolume string + LiquidatableCount int + LongOpenInterest string + MarkPrice string + MarketID int + ShortOpenInterest string + type ViewNotesEntry struct + EncryptedNote string + NoteCommitment string + type ViewNotesResult struct + BlockNumber uint64 + GrantID string + GrantorCommitment string + NextCursor *string + Notes []ViewNotesEntry + ReturnedEncryptedNoteCount int + ShieldedStateRoot string + SignatureVerified bool + TotalEncryptedNoteCount int + type ViewTradingResult struct + BlockNumber uint64 + GrantID string + GrantorCommitment string + MarketAggregates struct{ ... } + Reconstruction string + ShieldedStateRoot string + SignatureVerified bool + type ViewingKey struct + SpendPK string + SpendSK string + ViewPK string + ViewSK string + func ViewingKeyFromSeed(seed string) ViewingKey