wire

package
v0.0.0-...-7bd1b19 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	PerunContractTag = "PerunContract"
	AdjudicatorTag   = "AdjudicatorContract"
)
View Source
const ChannelIDLength = 32
View Source
const EventMessageTag = "NewObservableState"
View Source
const SignatureLength = 64

SignatureLength is the length of valid Cardano signatures in bytes.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdjudicatorSubscriptionActivationBody

type AdjudicatorSubscriptionActivationBody struct {
	CaID   AdjudicatorSubscriptionActivationID `json:"caID"`
	Wallet ContractActivationWallet            `json:"caWallet"`
}

func MakeAdjudicatorSubscriptionActivationBody

func MakeAdjudicatorSubscriptionActivationBody(channelId ChannelID, walletId string) AdjudicatorSubscriptionActivationBody

type AdjudicatorSubscriptionActivationID

type AdjudicatorSubscriptionActivationID struct {
	Tag       string    `json:"tag"`
	ChannelID ChannelID `json:"contents"`
}

type AssetClass

type AssetClass struct {
	A []interface{} `json:"unAssetClass"`
}

func MakeAssetClass

func MakeAssetClass(token types.ChannelToken) AssetClass

type ChannelDatum

type ChannelDatum struct {
	ChannelParameters ChannelParameters `json:"channelParameters"`
	ChannelToken      ChannelToken      `json:"channelToken"`
	Disputed          bool              `json:"disputed"`
	Funded            bool              `json:"funded"`
	Funding           []uint64          `json:"funding"`
	ChannelState      ChannelState      `json:"state"`
	Time              int64             `json:"time"`
}

func MakeChannelDatum

func MakeChannelDatum(datum types.ChannelDatum) ChannelDatum

func (ChannelDatum) Decode

func (c ChannelDatum) Decode() (types.ChannelDatum, error)

type ChannelID

type ChannelID channel.ID

func (ChannelID) MarshalJSON

func (cid ChannelID) MarshalJSON() ([]byte, error)

func (*ChannelID) UnmarshalJSON

func (cid *ChannelID) UnmarshalJSON(bytes []byte) error

type ChannelParameters

type ChannelParameters struct {
	Nonce               string              `json:"pNonce"`
	PaymentPubKeyHashes []PaymentPubKeyHash `json:"pPaymentPKs"`
	SigningPubKeys      []PaymentPubKey     `json:"pSigningPKs"`
	TimeLock            int64               `json:"pTimeLock"`
}

ChannelParameters reflects the Haskell type `Channel` of the Channel Smart Contract in respect to its json encoding.

func MakeChannelParameters

func MakeChannelParameters(parameters types.ChannelParameters) ChannelParameters

func (ChannelParameters) Decode

type ChannelState

type ChannelState struct {
	Balances  []uint64  `json:"balances"`
	ChannelID ChannelID `json:"channelId"`
	Final     bool      `json:"final"`
	Version   uint64    `json:"version"`
}

ChannelState reflects the Haskell type `ChannelState` of the Channel Smart Contract in respect to its json encoding.

func MakeChannelState

func MakeChannelState(cs types.ChannelState) ChannelState

func (ChannelState) Decode

func (cs ChannelState) Decode() types.ChannelState

type ChannelStateSigningRequest

type ChannelStateSigningRequest struct {
	PubKey       PubKey       `json:"csPubKey"`
	ChannelState ChannelState `json:"csState"`
}

ChannelStateSigningRequest is the json-serializable request for signing ChannelState via the perun-cardano-wallet api.

func MakeChannelStateSigningRequest

func MakeChannelStateSigningRequest(address address.Address, channelState types.ChannelState) ChannelStateSigningRequest

MakeChannelStateSigningRequest returns a new ChannelStateSigningRequest.

type ChannelStateVerificationRequest

type ChannelStateVerificationRequest struct {
	Signature    Signature    `json:"cvSignature"`
	PubKey       PubKey       `json:"cvPubKey"`
	ChannelState ChannelState `json:"cvState"`
}

ChannelStateVerificationRequest is the json serializable request for verifying a signature on a ChannelState via the perun-cardano-wallet api.

func MakeChannelStateVerificationRequest

func MakeChannelStateVerificationRequest(sig wallet.Sig, address address.Address, channelState types.ChannelState) ChannelStateVerificationRequest

MakeChannelStateVerificationRequest returns a new ChannelStateVerificationRequest.

type ChannelToken

type ChannelToken struct {
	TokenName      TokenName      `json:"ctName"`
	CurrencySymbol CurrencySymbol `json:"ctSymbol"`
	CtTxOutRef     struct {
		TxOutRefId struct {
			GetTxId string `json:"getTxId"`
		} `json:"txOutRefId"`
		TxOutRefIdx int `json:"txOutRefIdx"`
	} `json:"ctTxOutRef"`
}

func MakeChannelToken

func MakeChannelToken(token types.ChannelToken) ChannelToken

func (ChannelToken) Decode

func (t ChannelToken) Decode() types.ChannelToken

type CloseParams

type CloseParams struct {
	SigningPubKeys []PaymentPubKey `json:"cpSigningPKs"`
	SignedState    StateSignatures `json:"cpSignedState"`
	ChannelToken   AssetClass      `json:"cpChannelToken"`
	ChannelID      ChannelID       `json:"cpChannelId"`
}

func MakeCloseParams

func MakeCloseParams(id ChannelID, token types.ChannelToken, params types.ChannelParameters, state types.ChannelState, sigs []wallet.Sig) CloseParams

type ContractActivationWallet

type ContractActivationWallet struct {
	WalletID string `json:"getWalletId"`
}

type ContractInstanceID

type ContractInstanceID struct {
	ID string `json:"unContractInstanceId"`
}

func (ContractInstanceID) Decode

func (id ContractInstanceID) Decode() string

type CurrencySymbol

type CurrencySymbol struct {
	Symbol string `json:"unCurrencySymbol"`
}

type DisputeParams

type DisputeParams struct {
	ChannelID      ChannelID       `json:"dpChannelId"`
	ChannelToken   AssetClass      `json:"dpChannelToken"`
	SignedState    StateSignatures `json:"dpSignedState"`
	SigningPubKeys []PaymentPubKey `json:"dpSigningPKs"`
}

type Event

type Event struct {
	Tag        string         `json:"tag"`
	DatumList  []ChannelDatum `json:"eventDatums"`
	Signatures []Signature    `json:"eventSigs"`
}

type ForceCloseParams

type ForceCloseParams struct {
	ChannelToken AssetClass `json:"fcpChannelToken"`
	ChannelID    ChannelID  `json:"fcpChannelId"`
}

type FundParams

type FundParams struct {
	ChannelID    ChannelID  `json:"fpChannelId"`
	ChannelToken AssetClass `json:"fpChannelToken"`
	Index        uint16     `json:"fpIndex"`
}

func MakeFundParams

func MakeFundParams(id ChannelID, token types.ChannelToken, index uint16) FundParams

type KeyAvailabilityRequest

type KeyAvailabilityRequest = PubKey

KeyAvailabilityRequest is the json serializable request for key-availability via the perun-cardano-wallet api.

func MakeKeyAvailabilityRequest

func MakeKeyAvailabilityRequest(address address.Address) KeyAvailabilityRequest

MakeKeyAvailabilityRequest returns a new KeyAvailabilityRequest for the given address.

type KeyAvailabilityResponse

type KeyAvailabilityResponse = bool

KeyAvailabilityResponse is json serializable response when requesting key-availability via the perun-cardano-wallet api.

type OpenParams

type OpenParams struct {
	Balances            []uint64            `json:"spBalances"`
	ChannelID           ChannelID           `json:"spChannelId"`
	Nonce               string              `json:"spNonce"`
	PaymentPubKeyHashes []PaymentPubKeyHash `json:"spPaymentPKs"`
	SigningPubKeys      []PaymentPubKey     `json:"spSigningPKs"`
	TimeLock            int64               `json:"spTimeLock"`
}

type PaymentPubKey

type PaymentPubKey struct {
	PubKey PubKey `json:"unPaymentPubKey"`
}

func MakePaymentPubKey

func MakePaymentPubKey(address address.Address) PaymentPubKey

type PaymentPubKeyHash

type PaymentPubKeyHash struct {
	PubKeyHash PubKeyHash `json:"unPaymentPubKeyHash"`
}

func MakePaymentPubKeyHash

func MakePaymentPubKeyHash(address address.Address) PaymentPubKeyHash

type PerunActivationBody

type PerunActivationBody struct {
	Tag    PerunContractActivationID `json:"caID"`
	Wallet ContractActivationWallet  `json:"caWallet"`
}

func MakePerunActivationBody

func MakePerunActivationBody(walletId string) PerunActivationBody

type PerunContractActivationID

type PerunContractActivationID struct {
	Tag string `json:"tag"`
}

type PubKey

type PubKey struct {
	Hex string `json:"getPubKey"`
}

PubKey is a json serializable public key to communicate with cardano apis (see: Ledger.Crypto.PubKey).

func MakePubKey

func MakePubKey(address address.Address) PubKey

MakePubKey returns a PubKey

func (PubKey) Decode

func (key PubKey) Decode() (address.Address, error)

type PubKeyHash

type PubKeyHash struct {
	Hex string `json:"getPubKeyHash"`
}

func (PubKeyHash) Decode

func (pkh PubKeyHash) Decode() ([]byte, error)

type Signature

type Signature struct {
	Hex string `json:"getSignature"`
}

Signature is the json serialization for the cardano signature type (see: Ledger.Crypto.Signature).

func MakeSignature

func MakeSignature(sig wallet.Sig) Signature

MakeSignature returns a new Signature. Note that this does not check the length of the received wallet.Sig.

type SigningRequest

type SigningRequest struct {
	PubKey  PubKey `json:"sPubKey"`
	Message string `json:"sMessage"`
}

SigningRequest is the json serializable request for signing via the perun-cardano-wallet api.

func MakeSigningRequest

func MakeSigningRequest(address address.Address, message []byte) SigningRequest

MakeSigningRequest returns a new SigningRequest.

type SigningResponse

type SigningResponse = Signature

SigningResponse is the json serializable response when signing via the perun-cardano-wallet api.

func (SigningResponse) Decode

func (sr SigningResponse) Decode() (wallet.Sig, error)

Decode decodes the siganture from a SigningResponse.

type StateSignatures

type StateSignatures struct {
	ChannelState ChannelState `json:"aChannelState"`
	Signatures   []Signature  `json:"aSignatures"`
}

func MakeStateSignatures

func MakeStateSignatures(state types.ChannelState, sigs []wallet.Sig) StateSignatures

type SubscriptionMessage

type SubscriptionMessage struct {
	Contents json.RawMessage `json:"contents"`
	Tag      string          `json:"tag"`
}

type TokenName

type TokenName struct {
	Name string `json:"unTokenName"`
}

type VerificationRequest

type VerificationRequest struct {
	Signature Signature `json:"vSignature"`
	PubKey    PubKey    `json:"vPubKey"`
	Message   string    `json:"vMessage"`
}

VerificationRequest is the json serializable request for verifying via the perun-cardano-wallet api.

func MakeVerificationRequest

func MakeVerificationRequest(sig wallet.Sig, address address.Address, message []byte) VerificationRequest

MakeVerificationRequest returns a new VerificationRequest.

type VerificationResponse

type VerificationResponse = bool

VerificationResponse is the json serializable response when verifying signatures via the perun-cardano-wallet api.

Jump to

Keyboard shortcuts

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