request

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: Apache-2.0, BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromMarshalUtil

func FromMarshalUtil(mu *marshalutil.MarshalUtil) (iscp.Request, error)

FromMarshalUtil re-creates request from bytes. First byte is treated as type of the request

func RequestsInTransaction

func RequestsInTransaction(chainID *iscp.ChainID, tx *ledgerstate.Transaction) []iscp.RequestID

func SolidifyArgs

func SolidifyArgs(req iscp.Request, reg registry.BlobCache) (bool, error)

SolidifyArgs solidifies the request arguments

Types

type Metadata

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

Metadata represents content of the data payload of the output

func MetadataFromBytes

func MetadataFromBytes(data []byte) *Metadata

func MetadataFromMarshalUtil

func MetadataFromMarshalUtil(mu *marshalutil.MarshalUtil) *Metadata

func NewMetadata

func NewMetadata() *Metadata

func (*Metadata) Args

func (p *Metadata) Args() requestargs.RequestArgs

func (*Metadata) Bytes

func (p *Metadata) Bytes() []byte

func (*Metadata) Clone

func (p *Metadata) Clone() *Metadata

func (*Metadata) EntryPoint

func (p *Metadata) EntryPoint() iscp.Hname

func (*Metadata) ParsedError

func (p *Metadata) ParsedError() error

func (*Metadata) ParsedOk

func (p *Metadata) ParsedOk() bool

func (*Metadata) ReadFromMarshalUtil

func (p *Metadata) ReadFromMarshalUtil(mu *marshalutil.MarshalUtil) error

func (*Metadata) SenderContract

func (p *Metadata) SenderContract() iscp.Hname

func (*Metadata) TargetContract

func (p *Metadata) TargetContract() iscp.Hname

func (*Metadata) WithArgs

func (p *Metadata) WithArgs(args requestargs.RequestArgs) *Metadata

func (*Metadata) WithEntryPoint

func (p *Metadata) WithEntryPoint(ep iscp.Hname) *Metadata

func (*Metadata) WithRequestNonce

func (p *Metadata) WithRequestNonce(nonce uint8) *Metadata

func (*Metadata) WithSender

func (p *Metadata) WithSender(s iscp.Hname) *Metadata

func (*Metadata) WithTarget

func (p *Metadata) WithTarget(t iscp.Hname) *Metadata

func (*Metadata) WriteToMarshalUtil

func (p *Metadata) WriteToMarshalUtil(mu *marshalutil.MarshalUtil)

type OffLedger

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

func NewOffLedger

func NewOffLedger(chainID *iscp.ChainID, contract, entryPoint iscp.Hname, args requestargs.RequestArgs) *OffLedger

NewOffLedger creates a basic request

func (*OffLedger) Args

func (req *OffLedger) Args() requestargs.RequestArgs

func (*OffLedger) Bytes

func (req *OffLedger) Bytes() []byte

Bytes encodes request as bytes with first type byte

func (*OffLedger) ChainID added in v0.2.3

func (req *OffLedger) ChainID() (chainID *iscp.ChainID)

func (*OffLedger) Hash

func (req *OffLedger) Hash() [32]byte

only used for consensus

func (*OffLedger) ID

func (req *OffLedger) ID() (requestID iscp.RequestID)

ID returns request id for this request index part of request id is always 0 for off ledger requests note that request needs to have been signed before this value is considered valid

func (*OffLedger) IsFeePrepaid

func (req *OffLedger) IsFeePrepaid() bool

IsFeePrepaid always true for off-ledger

func (*OffLedger) IsOffLedger

func (req *OffLedger) IsOffLedger() bool

func (*OffLedger) Nonce

func (req *OffLedger) Nonce() uint64

Order number used for replay protection

func (*OffLedger) Params

func (req *OffLedger) Params() (dict.Dict, bool)

func (*OffLedger) SenderAccount

func (req *OffLedger) SenderAccount() *iscp.AgentID

func (*OffLedger) SenderAddress

func (req *OffLedger) SenderAddress() ledgerstate.Address

func (*OffLedger) SetParams

func (req *OffLedger) SetParams(params dict.Dict)

func (*OffLedger) Sign

func (req *OffLedger) Sign(keyPair *ed25519.KeyPair)

Sign signs essence

func (*OffLedger) String

func (req *OffLedger) String() string

func (*OffLedger) Target

func (req *OffLedger) Target() iscp.RequestTarget

func (*OffLedger) Timestamp

func (req *OffLedger) Timestamp() time.Time

func (*OffLedger) Tokens

func (req *OffLedger) Tokens() colored.Balances

Tokens returns the transfers passed to the request

func (*OffLedger) VerifySignature

func (req *OffLedger) VerifySignature() bool

VerifySignature verifies essence signature

func (*OffLedger) WithNonce

func (req *OffLedger) WithNonce(nonce uint64) iscp.Request

func (*OffLedger) WithTransfer

func (req *OffLedger) WithTransfer(transfer colored.Balances) *OffLedger

Tokens sets the transfers passed to the request

type OnLedger

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

func OnLedgerFromOutput

func OnLedgerFromOutput(output *ledgerstate.ExtendedLockedOutput, senderAddr ledgerstate.Address, txTimestamp time.Time, minted ...colored.Balances) *OnLedger

func OnLedgerFromTransaction

func OnLedgerFromTransaction(tx *ledgerstate.Transaction, targetAddr ledgerstate.Address) ([]*OnLedger, error)

OnLedgerFromTransaction creates OnLedger object from transaction and output index

func (*OnLedger) Args

func (req *OnLedger) Args() requestargs.RequestArgs

func (*OnLedger) Bytes

func (req *OnLedger) Bytes() []byte

Bytes serializes with the request type in the first byte

func (*OnLedger) FallbackAddress

func (req *OnLedger) FallbackAddress() ledgerstate.Address

func (*OnLedger) FallbackDeadline

func (req *OnLedger) FallbackDeadline() time.Time

func (*OnLedger) GetMetadata

func (req *OnLedger) GetMetadata() *Metadata

func (*OnLedger) Hash

func (req *OnLedger) Hash() [32]byte

only used for consensus

func (*OnLedger) ID

func (req *OnLedger) ID() iscp.RequestID

func (*OnLedger) IsFeePrepaid

func (req *OnLedger) IsFeePrepaid() bool

func (*OnLedger) IsOffLedger

func (req *OnLedger) IsOffLedger() bool

func (*OnLedger) MintedAmounts

func (req *OnLedger) MintedAmounts() colored.Balances

func (*OnLedger) Output

func (req *OnLedger) Output() ledgerstate.Output

func (*OnLedger) Params

func (req *OnLedger) Params() (dict.Dict, bool)

Params returns solid args if decoded already or nil otherwise

func (*OnLedger) SenderAccount

func (req *OnLedger) SenderAccount() *iscp.AgentID

func (*OnLedger) SenderAddress

func (req *OnLedger) SenderAddress() ledgerstate.Address

func (*OnLedger) SetMetadata

func (req *OnLedger) SetMetadata(d *Metadata)

func (*OnLedger) SetParams

func (req *OnLedger) SetParams(params dict.Dict)

func (*OnLedger) Short

func (req *OnLedger) Short() string

func (*OnLedger) String added in v0.2.1

func (req *OnLedger) String() string

func (*OnLedger) Target

func (req *OnLedger) Target() iscp.RequestTarget

Target returns target contract and target entry point

func (*OnLedger) TimeLock

func (req *OnLedger) TimeLock() time.Time

func (*OnLedger) Timestamp

func (req *OnLedger) Timestamp() time.Time

type SolidifiableRequest

type SolidifiableRequest interface {
	Params() (dict.Dict, bool)
	SetParams(params dict.Dict)
	Args() requestargs.RequestArgs
}

SolidifiableRequest is the minimal interface required for SolidifyArgs

Jump to

Keyboard shortcuts

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