connext

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AssetETH  = "0x0000000000000000000000000000000000000000"
	AssetUSDT = "0xdac17f958d2ee523a2206206994597c13d831ec7"

	CurrencyETH  = "ETH"
	CurrencyUSDT = "USDT"
)
View Source
const (
	ReqHeaderContentType = "Content-Type"
	ReqHeaderJson        = "application/json"
)
View Source
const PreImageDelete = "0x0000000000000000000000000000000000000000000000000000000000000000"

Variables

This section is empty.

Functions

func CancelTransfer

func CancelTransfer(publicIdentifier string, channelId string, transferId string) error

func GetChannels

func GetChannels(publicIdentifier string) ([]string, error)

func SetHost

func SetHost(h string)

Types

type ActiveTransfer

type ActiveTransfer struct {
	InDispute             bool            `json:"inDispute"`
	ChannelFactoryAddress string          `json:"channelFactoryAddress"`
	AssetID               string          `json:"assetId"`
	ChainID               int             `json:"chainId"`
	ChannelAddress        string          `json:"channelAddress"`
	Balance               TransferBalance `json:"balance"`
	Initiator             string          `json:"initiator"`
	Responder             string          `json:"responder"`
	InitialStateHash      string          `json:"initialStateHash"`
	TransferDefinition    string          `json:"transferDefinition"`
	InitiatorIdentifier   string          `json:"initiatorIdentifier"`
	ResponderIdentifier   string          `json:"responderIdentifier"`
	ChannelNonce          int             `json:"channelNonce"`
	TransferEncodings     []string        `json:"transferEncodings"`
	TransferID            string          `json:"transferId"`
	TransferState         TransferState   `json:"transferState,omitempty"`
	TransferTimeout       string          `json:"transferTimeout,omitempty"`
	Meta                  struct {
		SenderIdentifier string `json:"senderIdentifier,omitempty"`
		RequireOnline    bool   `json:"requireOnline,omitempty"`
		RoutingID        string `json:"routingId,omitempty"`
		Path             []struct {
			Recipient        string `json:"recipient,omitempty"`
			RecipientChainID int    `json:"recipientChainId,omitempty"`
			RecipientAssetID string `json:"recipientAssetId,omitempty"`
		} `json:"path"`
	} `json:"meta,omitempty"`
}

func GetActiveTransfers

func GetActiveTransfers(publicIdentifier string, channelId string) ([]ActiveTransfer, error)

type CancelTransferResponse

type CancelTransferResponse struct {
	ChannelAddress string `json:"channelAddress"`
	TransferID     string `json:"transferId"`
}

type Config

type Config struct {
	PublicIdentifier string `json:"publicIdentifier"`
	SignerAddress    string `json:"signerAddress"`
	ChannelAddress   string `json:"channelAddress"`
	Host             string `json:"host"`
	GraceNonceDiff   int    `json:"graceNonceDiff"`
}

Config struct holds mandatory information how to connect to Connext and configs for operations

type TransferBalance

type TransferBalance struct {
	Amount []string `json:"amount"`
	To     []string `json:"to"`
}

type TransferResolve

type TransferResolve struct {
	PublicIdentifier string `json:"publicIdentifier"`
	ChannelAddress   string `json:"channelAddress"`
	TransferID       string `json:"transferId"`
	TransferResolver struct {
		PreImage string `json:"preImage"`
	} `json:"transferResolver"`
}

type TransferState

type TransferState struct {
	Expiry   interface{} `json:"expiry,omitempty"`
	LockHash string      `json:"lockHash,omitempty"`
}

type VectorChannel

type VectorChannel struct {
	AssetIds []string `json:"assetIds"`
	Balances []struct {
		Amount []string `json:"amount"`
		To     []string `json:"to"`
	} `json:"balances"`
	ChannelAddress     string   `json:"channelAddress"`
	MerkleRoot         string   `json:"merkleRoot"`
	ProcessedDepositsA []string `json:"processedDepositsA"`
	ProcessedDepositsB []string `json:"processedDepositsB"`
	DefundNonces       []string `json:"defundNonces"`
	NetworkContext     struct {
		ChainID                 int    `json:"chainId"`
		ChannelFactoryAddress   string `json:"channelFactoryAddress"`
		TransferRegistryAddress string `json:"transferRegistryAddress"`
		ProviderURL             string `json:"providerUrl"`
	} `json:"networkContext"`
	Nonce           int    `json:"nonce"`
	Alice           string `json:"alice"`
	AliceIdentifier string `json:"aliceIdentifier"`
	Bob             string `json:"bob"`
	BobIdentifier   string `json:"bobIdentifier"`
	Timeout         string `json:"timeout"`
	LatestUpdate    struct {
		AssetID string `json:"assetId"`
		Balance struct {
			Amount []string `json:"amount"`
			To     []string `json:"to"`
		} `json:"balance"`
		ChannelAddress string `json:"channelAddress"`
		Details        struct {
			Balance struct {
				To     []string `json:"to"`
				Amount []string `json:"amount"`
			} `json:"balance"`
			MerkleProofData      []string `json:"merkleProofData"`
			MerkleRoot           string   `json:"merkleRoot"`
			TransferDefinition   string   `json:"transferDefinition"`
			TransferTimeout      string   `json:"transferTimeout"`
			TransferID           string   `json:"transferId"`
			TransferEncodings    []string `json:"transferEncodings"`
			TransferInitialState struct {
				LockHash string `json:"lockHash"`
				Expiry   string `json:"expiry"`
			} `json:"transferInitialState"`
			Meta struct {
				RoutingID     string `json:"routingId"`
				Hello         string `json:"hello"`
				RequireOnline bool   `json:"requireOnline"`
			} `json:"meta"`
		} `json:"details"`
		FromIdentifier string `json:"fromIdentifier"`
		Nonce          int    `json:"nonce"`
		AliceSignature string `json:"aliceSignature"`
		BobSignature   string `json:"bobSignature"`
		ToIdentifier   string `json:"toIdentifier"`
		Type           string `json:"type"`
	} `json:"latestUpdate"`
	InDispute bool `json:"inDispute"`
}

func GetVectorChannel

func GetVectorChannel(publicIdentifier string, channelId string) (VectorChannel, error)

Jump to

Keyboard shortcuts

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