Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct { Funds int64 `json:"funds"` SumDeposits int64 `json:"sum_deposits"` Channels int64 `json:"channels"` }
Connection represents a high level information about the Funds, Total deposits and numbers of channels for a given network.
type Connections ¶
type Connections map[common.Address]*Connection
Connections represent a map of token network address to a Connection pointer.
type Joiner ¶
Joiner is an interface to allow for a Raiden node to join a new token network with a given number of funds.
Example ¶
var ( connClient *Client config = &config.Config{ Host: "http://localhost:5001", APIVersion: "v1", } tokenAddress = common.HexToAddress("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359") // DAI Stablecoin funds = int64(1000) err error ) connClient = NewClient(config, http.DefaultClient) if err = connClient.Join(context.Background(), tokenAddress, funds); err != nil { panic(fmt.Sprintf("unable to join connection: %s", err.Error())) } fmt.Printf("succuessfully join connection")
Output:
type Leaver ¶
type Leaver interface {
Leave(ctx context.Context, tokenAddress common.Address) ([]common.Address, error)
}
Leaver is an interface to leave a token network.
Example ¶
var ( connClient *Client config = &config.Config{ Host: "http://localhost:5001", APIVersion: "v1", } tokenAddress = common.HexToAddress("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359") // DAI Stablecoin addresses []common.Address err error ) connClient = NewClient(config, http.DefaultClient) if addresses, err = connClient.Leave(context.Background(), tokenAddress); err != nil { panic(fmt.Sprintf("unable to leave connection: %s", err.Error())) } for _, a := range addresses { fmt.Println("address:", a.String()) }
Output:
type Lister ¶
type Lister interface {
List(ctx context.Context) (Connections, error)
}
Lister is an interface to list all token network connections on a given Raiden node.
Example ¶
var ( connClient *Client config = &config.Config{ Host: "http://localhost:5001", APIVersion: "v1", } connections Connections err error ) connClient = NewClient(config, http.DefaultClient) if connections, err = connClient.List(context.Background()); err != nil { panic(fmt.Sprintf("unable to leave connection: %s", err.Error())) } for address, conn := range connections { fmt.Printf("%s: %+v\n", address.String(), conn) }
Output:
Click to show internal directories.
Click to hide internal directories.