wasm

package
v1.15.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package wasm supports smart contract integration with the provenance metadata module.

Package wasm supports smart contract integration with the metadata module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encoder added in v1.8.0

func Encoder(contract sdk.AccAddress, msg json.RawMessage, version string) ([]sdk.Msg, error)

Encoder returns a smart contract message encoder for the metadata module.

func Querier

func Querier(keeper keeper.Keeper) provwasm.Querier

Querier returns a smart contract querier for the metadata module.

Types

type GetRecordsParams

type GetRecordsParams struct {
	// The bech32 address of the scope we want to get records for.
	ScopeID string `json:"scope_id"`
	// The optional record name.
	Name string `json:"name,omitempty"`
}

GetRecordsParams are the inputs for a records query.

func (*GetRecordsParams) Run

func (params *GetRecordsParams) Run(ctx sdk.Context, keeper keeper.Keeper) ([]byte, error)

Run gets records by scope ID and name (optional)

type GetScopeParams

type GetScopeParams struct {
	// The bech32 address of the scope we want to get.
	ScopeID string `json:"scope_id"`
}

GetScopeParams are the inputs for a scope query.

func (*GetScopeParams) Run

func (params *GetScopeParams) Run(ctx sdk.Context, keeper keeper.Keeper) ([]byte, error)

Run gets a scope by ID.

type GetSessionsParams

type GetSessionsParams struct {
	// The bech32 address of the scope we want to get sessions for.
	ScopeID string `json:"scope_id"`
}

GetSessionsParams are the inputs for a session query.

func (*GetSessionsParams) Run

func (params *GetSessionsParams) Run(ctx sdk.Context, keeper keeper.Keeper) ([]byte, error)

Run gets sessions by scope ID and name (optional)

type InputStatus

type InputStatus string

InputStatus defines record input status types.

const (
	// InputStatusRecord is a concrete record input status type.
	InputStatusRecord InputStatus = "record"
	// InputStatusProposed is a concrete record input status type.
	InputStatusProposed InputStatus = "proposed"
	// InputStatusUnspecified is a concrete record input status type.
	InputStatusUnspecified InputStatus = "unspecified"
)

type MetadataMsgParams added in v1.8.0

type MetadataMsgParams struct {
	// Params for encoding a MsgWriteScopeRequest
	WriteScope *WriteScope `json:"write_scope,omitempty"`
}

MetadataMsgParams are params for encoding []sdk.Msg types from the scope module. Only one field should be set per request.

type MetadataQueryParams

type MetadataQueryParams struct {
	// Get a scope by ID.
	GetScope *GetScopeParams `json:"get_scope,omitempty"`
	// Get sessions by scope ID and name (optional).
	GetSessions *GetSessionsParams `json:"get_sessions,omitempty"`
	// Get records by scope ID and name (optional).
	GetRecords *GetRecordsParams `json:"get_records,omitempty"`
}

MetadataQueryParams represents the query request type for the metadata module sent by smart contracts. Only one query field should be set.

type Party

type Party struct {
	Address string    `json:"address"`
	Role    PartyType `json:"role"`
}

Party is an address with an associated role.

type PartyType

type PartyType string

PartyType defines roles that can be associated to a party.

const (
	// PartyTypeAffiliate is a concrete party type.
	PartyTypeAffiliate PartyType = "affiliate"
	// PartyTypeCustodian is a concrete party type.
	PartyTypeCustodian PartyType = "custodian"
	// PartyTypeInvestor is a concrete party type.
	PartyTypeInvestor PartyType = "investor"
	// PartyTypeOmnibus is a concrete party type.
	PartyTypeOmnibus PartyType = "omnibus"
	// PartyTypeOriginator is a concrete party type.
	PartyTypeOriginator PartyType = "originator"
	// PartyTypeOwner is a concrete party type.
	PartyTypeOwner PartyType = "owner"
	// PartyTypeProvenance is a concrete party type.
	PartyTypeProvenance PartyType = "provenance"
	// PartyTypeServicer is a concrete party type.
	PartyTypeServicer PartyType = "servicer"
	// PartyTypeController is a concrete party type.
	PartyTypeController PartyType = "controller"
	// PartyTypeValidator is a concrete party type.
	PartyTypeValidator PartyType = "validator"
	// PartyTypeUnspecified is a concrete party type.
	PartyTypeUnspecified PartyType = "unspecified"
)

type Process

type Process struct {
	ProcessID *ProcessID `json:"process_id"`
	Name      string     `json:"name"`
	Method    string     `json:"method"`
}

Process is the entity that generated a record.

type ProcessID

type ProcessID struct {
	Address *ProcessIDAddress `json:"address,omitempty"`
	Hash    *ProcessIDHash    `json:"hash,omitempty"`
}

ProcessID is a process identifier. Either address or hash should be set, but not both.

type ProcessIDAddress

type ProcessIDAddress struct {
	Address string `json:"address"`
}

ProcessIDAddress is the on-chain address of a process.

type ProcessIDHash

type ProcessIDHash struct {
	Hash string `json:"hash"`
}

ProcessIDHash is the hash of an off-chain process.

type Record

type Record struct {
	SessionID       string          `json:"session_id"`
	SpecificationID string          `json:"specification_id"`
	Name            string          `json:"name"`
	Process         *Process        `json:"process"`
	Inputs          []*RecordInput  `json:"inputs,omitempty"`
	Outputs         []*RecordOutput `json:"outputs,omitempty"`
}

Record is a record of fact for a session.

type RecordInput

type RecordInput struct {
	Name     string             `json:"name"`
	TypeName string             `json:"type_name"`
	Source   *RecordInputSource `json:"source"`
	Status   InputStatus        `json:"status"`
}

RecordInput is an input used to produce a record.

type RecordInputSource

type RecordInputSource struct {
	Record *RecordInputSourceRecord `json:"record,omitempty"`
	Hash   *RecordInputSourceHash   `json:"hash,omitempty"`
}

RecordInputSource is a record input source. Either record or hash should be set, but not both.

type RecordInputSourceHash

type RecordInputSourceHash struct {
	Hash string `json:"hash"`
}

RecordInputSourceHash is the hash of an off-chain piece of information (proposed records).

type RecordInputSourceRecord

type RecordInputSourceRecord struct {
	RecordID string `json:"record_id"`
}

RecordInputSourceRecord is the address of a record on chain (established records).

type RecordOutput

type RecordOutput struct {
	Hash   string       `json:"hash"`
	Status ResultStatus `json:"status"`
}

RecordOutput is the output of a process.

type Records

type Records struct {
	Records []*Record `json:"records"`
}

Records is a group of records.

type ResultStatus

type ResultStatus string

Result status types.

const (
	// ResultStatusPass is a concrete result status type.
	ResultStatusPass ResultStatus = "pass"
	// ResultStatusFail is a concrete result status type.
	ResultStatusFail ResultStatus = "fail"
	// ResultStatusSkip is a concrete result status type.
	ResultStatusSkip ResultStatus = "skip"
	// ResultStatusUnspecified is a concrete result status type.
	ResultStatusUnspecified ResultStatus = "unspecified"
)

type Scope

type Scope struct {
	ScopeID           string   `json:"scope_id"`
	SpecificationID   string   `json:"specification_id"`
	DataAccess        []string `json:"data_access,omitempty"`
	Owners            []*Party `json:"owners,omitempty"`
	ValueOwnerAddress string   `json:"value_owner_address"`
}

Scope is a root reference for a collection of records owned by one or more parties.

type Session

type Session struct {
	SessionID       string   `json:"session_id"`
	SpecificationID string   `json:"specification_id"`
	Name            string   `json:"name"`
	Context         []byte   `json:"context"`
	Parties         []*Party `json:"parties,omitempty"`
}

Session is the state of an execution context for a specification instance.

type Sessions

type Sessions struct {
	Sessions []*Session `json:"sessions"`
}

Sessions is a group of sessions.

type WriteScope added in v1.8.0

type WriteScope struct {
	// The scope we want to create/update.
	Scope Scope `json:"scope"`
	// The signers' addresses.
	Signers []string `json:"signers"`
}

WriteScope are params for encoding a MsgWriteScopeRequest.

func (*WriteScope) Encode added in v1.8.0

func (params *WriteScope) Encode() ([]sdk.Msg, error)

Encode creates a MsgAddScopeDataAccessRequest.

Jump to

Keyboard shortcuts

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