Documentation ¶
Index ¶
- Constants
- type AdjudicatorSubscriptionActivationBody
- type AdjudicatorSubscriptionActivationID
- type AssetClass
- type ChannelDatum
- type ChannelID
- type ChannelParameters
- type ChannelState
- type ChannelStateSigningRequest
- type ChannelStateVerificationRequest
- type ChannelToken
- type CloseParams
- type ContractActivationWallet
- type ContractInstanceID
- type CurrencySymbol
- type DisputeParams
- type Event
- type ForceCloseParams
- type FundParams
- type KeyAvailabilityRequest
- type KeyAvailabilityResponse
- type OpenParams
- type PaymentPubKey
- type PaymentPubKeyHash
- type PerunActivationBody
- type PerunContractActivationID
- type PubKey
- type PubKeyHash
- type Signature
- type SigningRequest
- type SigningResponse
- type StateSignatures
- type SubscriptionMessage
- type TokenName
- type VerificationRequest
- type VerificationResponse
Constants ¶
const ( PerunContractTag = "PerunContract" AdjudicatorTag = "AdjudicatorContract" )
const ChannelIDLength = 32
const EventMessageTag = "NewObservableState"
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 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 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 ¶
func (cp ChannelParameters) Decode() (types.ChannelParameters, error)
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"` }
func MakeOpenParams ¶
func MakeOpenParams(id ChannelID, p types.ChannelParameters, s types.ChannelState) OpenParams
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).
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 ¶
MakeSignature returns a new Signature. Note that this does not check the length of the received wallet.Sig.
type SigningRequest ¶
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.
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 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.