v2

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package v2 provides CREC SDK extension for DTA (Digital Transfer Agent) v2.0.

This package is organized into sub-packages:

  • v2/events: Lightweight event types, decoders, and constants.
  • v2/operations: Extension client for preparing on-chain operations.

The root v2 package provides DecodeFromEvent for SDK consumers to decode watcher event payloads into typed Go structs with enrichment data.

Decoding Events

decoded, err := v2.DecodeFromEvent(ctx, event)
if err != nil {
	log.Fatal(err)
}
fmt.Println(decoded.EventName())

Preparing Operations

import "github.com/smartcontractkit/crec-sdk-ext-dta/v2/operations"

ext, err := operations.New(&operations.Options{
	DTARequestManagementAddress: "0x...",
	DTARequestSettlementAddress: "0x...",
	AccountAddress:              "0x...",
})
op, err := ext.PrepareRequestSubscriptionOperation(fundAdmin, fundTokenId, amount, referenceID)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecodedEvent

type DecodedEvent struct {
	apiClient.WatcherEventPayload
	// ConcreteEvent is the decoded event struct matching the blockchain event type.
	ConcreteEvent events.ConcreteEvent
	// FundTokenData holds fund token configuration from on-chain reference data, when present.
	FundTokenData *events.FundTokenData
	// DistributorRequest holds the distributor request from on-chain reference data, when present.
	DistributorRequest *events.DistributorRequest
	// PaymentRequests holds payment requests from the verifiable event reference data.
	PaymentRequests []workflows.PaymentRequest
}

DecodedEvent wraps WatcherEventPayload with a decoded ConcreteEvent and enrichment data.

func DecodeFromEvent

func DecodeFromEvent(_ context.Context, event apiClient.Event) (DecodedEvent, error)

DecodeFromEvent extracts the WatcherEventPayload from an apiClient.Event and decodes the ConcreteEvent and enrichment data (FundTokenData, DistributorRequest, PaymentRequests) based on the event type.

func (DecodedEvent) EventName

func (e DecodedEvent) EventName() events.EventName

EventName returns the parsed event name from the payload.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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