contractsapi

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorStreamNotComposed = "stream is not a composed stream"
)
View Source
const (
	ErrorStreamNotFound = "stream not found"
)
View Source
const (
	ErrorStreamNotPrimitive = "stream is not a primitive stream"
)

Variables

View Source
var MetadataValueNotFound = errors.New("metadata value not found")

Functions

func DecodeCallResult

func DecodeCallResult[T any](result *client.CallResult) ([]T, error)

DecodeCallResult decodes the result of a view call to the specified struct.

func GetContractContent

func GetContractContent(input DeployStreamInput) ([]byte, error)

GetContractContent returns the contract content based on the stream type

Types

type ComposedStream

type ComposedStream struct {
	Stream
}

func ComposedStreamFromStream

func ComposedStreamFromStream(stream Stream) (*ComposedStream, error)

func NewComposedStream

func NewComposedStream(opts NewStreamOptions) (*ComposedStream, error)

func (*ComposedStream) DescribeTaxonomies

func (c *ComposedStream) DescribeTaxonomies(ctx context.Context, params types.DescribeTaxonomiesParams) ([]types.TaxonomyItem, error)

func (*ComposedStream) SetTaxonomy

func (c *ComposedStream) SetTaxonomy(ctx context.Context, taxonomies []types.TaxonomyItem) (transactions.TxHash, error)

type DeployStreamInput

type DeployStreamInput struct {
	StreamId   util.StreamId    `validate:"required"`
	StreamType types.StreamType `validate:"required"`
	KwilClient client.Client    `validate:"required"`
	Deployer   []byte           `validate:"required"`
}

type DeployStreamOutput

type DeployStreamOutput struct {
	DeployedStream Stream
	TxHash         transactions.TxHash
}

func DeployStream

func DeployStream(ctx context.Context, input DeployStreamInput) (*DeployStreamOutput, error)

DeployStream deploys a stream to TSN

type DescribeTaxonomiesResult

type DescribeTaxonomiesResult struct {
	ChildStreamId     util.StreamId `json:"child_stream_id"`
	ChildDataProvider string        `json:"child_data_provider"`
	// decimals are received as strings by kwil to avoid precision loss
	// as decimal are more arbitrary than golang's float64
	Weight    string `json:"weight"`
	CreatedAt int    `json:"created_at"`
	Version   int    `json:"version"`
}

type DestroyStreamInput

type DestroyStreamInput struct {
	StreamId   util.StreamId `validate:"required"`
	KwilClient client.Client `validate:"required"`
}

func (DestroyStreamInput) Validate

func (i DestroyStreamInput) Validate() error

type DestroyStreamOutput

type DestroyStreamOutput struct {
	TxHash transactions.TxHash
}

func DestroyStream

func DestroyStream(ctx context.Context, input DestroyStreamInput) (*DestroyStreamOutput, error)

DestroyStream destroys a stream from TSN

type GetIndexRawOutput

type GetIndexRawOutput = GetRecordRawOutput

type GetRecordRawOutput

type GetRecordRawOutput struct {
	DateValue string `json:"date_value"`
	Value     string `json:"value"`
}

type NewStreamOptions

type NewStreamOptions struct {
	Client   client.Client
	StreamId util.StreamId
	Deployer []byte
}

type PrimitiveStream

type PrimitiveStream struct {
	Stream
}

func NewPrimitiveStream

func NewPrimitiveStream(options NewStreamOptions) (*PrimitiveStream, error)

func PrimitiveStreamFromStream

func PrimitiveStreamFromStream(stream Stream) (*PrimitiveStream, error)

func (*PrimitiveStream) InsertRecords

func (p *PrimitiveStream) InsertRecords(ctx context.Context, inputs []types.InsertRecordInput) (transactions.TxHash, error)

type Stream

type Stream struct {
	StreamId util.StreamId

	DBID string
	// contains filtered or unexported fields
}

func NewStream

func NewStream(options NewStreamOptions) (*Stream, error)

func (*Stream) AllowComposeStream

func (s *Stream) AllowComposeStream(ctx context.Context, locator types.StreamLocator) (transactions.TxHash, error)

func (*Stream) AllowReadWallet

func (s *Stream) AllowReadWallet(ctx context.Context, wallet util.EthereumAddress) (transactions.TxHash, error)

func (*Stream) DisableComposeStream

func (s *Stream) DisableComposeStream(ctx context.Context, locator types.StreamLocator) (transactions.TxHash, error)

func (*Stream) DisableReadWallet

func (s *Stream) DisableReadWallet(ctx context.Context, wallet util.EthereumAddress) (transactions.TxHash, error)

func (*Stream) GetAllowedComposeStreams

func (s *Stream) GetAllowedComposeStreams(ctx context.Context) ([]types.StreamLocator, error)

func (*Stream) GetAllowedReadWallets

func (s *Stream) GetAllowedReadWallets(ctx context.Context) ([]util.EthereumAddress, error)

func (*Stream) GetComposeVisibility

func (s *Stream) GetComposeVisibility(ctx context.Context) (*util.VisibilityEnum, error)

func (*Stream) GetIndex

func (s *Stream) GetIndex(ctx context.Context, input types.GetIndexInput) ([]types.StreamIndex, error)

func (*Stream) GetReadVisibility

func (s *Stream) GetReadVisibility(ctx context.Context) (*util.VisibilityEnum, error)

func (*Stream) GetRecord

func (s *Stream) GetRecord(ctx context.Context, input types.GetRecordInput) ([]types.StreamRecord, error)

func (*Stream) GetSchema

func (s *Stream) GetSchema(ctx context.Context) (*types.Schema, error)

func (*Stream) GetStreamOwner

func (s *Stream) GetStreamOwner(ctx context.Context) ([]byte, error)

func (*Stream) GetType

func (s *Stream) GetType(ctx context.Context) (tsntypes.StreamType, error)

func (*Stream) InitializeStream

func (s *Stream) InitializeStream(ctx context.Context) (transactions.TxHash, error)

func (*Stream) SetComposeVisibility

func (s *Stream) SetComposeVisibility(ctx context.Context, visibility util.VisibilityEnum) (transactions.TxHash, error)

func (*Stream) SetReadVisibility

func (s *Stream) SetReadVisibility(ctx context.Context, visibility util.VisibilityEnum) (transactions.TxHash, error)

func (*Stream) ToComposedStream

func (s *Stream) ToComposedStream() (*ComposedStream, error)

func (*Stream) ToPrimitiveStream

func (s *Stream) ToPrimitiveStream() (*PrimitiveStream, error)

Jump to

Keyboard shortcuts

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