ton

package
v0.0.0-...-cc3bc86 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotHealthy = fmt.Errorf("TON node is not healthy yet")

Functions

This section is empty.

Types

type AccountInit

type AccountInit struct {
	Code      *boc.Cell
	Data      *boc.Cell
	StateInit *tlb.StateInit
	ID        ton.AccountID
}

func ConstructAccount

func ConstructAccount(code, data *boc.Cell) (*AccountInit, error)

func ConstructGatewayAccount

func ConstructGatewayAccount(authority ton.AccountID, tss eth.Address) (*AccountInit, error)

ConstructGatewayAccount constructs gateway AccountInit. - Authority is the address of the gateway "admin". - TSS is the EVM address of TSS. - Deposits are enabled by default.

func ConstructWalletFromPrivateKey

func ConstructWalletFromPrivateKey(pk ed25519.PrivateKey, client blockchain) (*AccountInit, *wallet.Wallet, error)

func ConstructWalletFromSeed

func ConstructWalletFromSeed(seed string, client blockchain) (*AccountInit, *wallet.Wallet, error)

ConstructWalletFromSeed constructs wallet AccountInit from seed. Used for wallets deployment.

type Client

type Client struct {
	*ton.Client
	*SidecarClient
}

func (*Client) WaitForBlocks

func (c *Client) WaitForBlocks(ctx context.Context) error

type Deployer

type Deployer struct {
	wallet.Wallet
	// contains filtered or unexported fields
}

Deployer represents a wrapper around ton Wallet with some helpful methods.

func NewDeployer

func NewDeployer(client blockchain, cfg Faucet) (*Deployer, error)

NewDeployer deployer constructor.

func (*Deployer) CreateWallet

func (d *Deployer) CreateWallet(ctx context.Context, amount math.Uint) (*wallet.Wallet, error)

func (*Deployer) Deploy

func (d *Deployer) Deploy(ctx context.Context, account *AccountInit, amount math.Uint) error

Deploy deploys AccountInit with the given amount of coins. Returns tx hash and error.

func (*Deployer) Fund

func (d *Deployer) Fund(ctx context.Context, recipient ton.AccountID, amount math.Uint) (ton.Bits256, error)

Fund sends the given amount of coins to the recipient. Returns tx hash and error.

func (*Deployer) GetBalanceOf

func (d *Deployer) GetBalanceOf(ctx context.Context, id ton.AccountID, wait bool) (math.Uint, error)

GetBalanceOf returns the balance of a given account. wait=true waits for account activation.

func (*Deployer) Seqno

func (d *Deployer) Seqno(ctx context.Context) (uint32, error)

type Faucet

type Faucet struct {
	InitialBalance   int64  `json:"initialBalance"`
	PrivateKey       string `json:"privateKey"`
	PublicKey        string `json:"publicKey"`
	WalletRawAddress string `json:"walletRawAddress"`
	Mnemonic         string `json:"mnemonic"`
	WalletVersion    string `json:"walletVersion"`
	WorkChain        int32  `json:"workChain"`
	SubWalletId      int    `json:"subWalletId"`
	Created          bool   `json:"created"`
}

Faucet represents the faucet information.

type SidecarClient

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

func NewSidecarClient

func NewSidecarClient(baseURL string) *SidecarClient

func (*SidecarClient) GetFaucet

func (c *SidecarClient) GetFaucet(ctx context.Context) (Faucet, error)

GetFaucet returns the faucet information.

func (*SidecarClient) LiteServerURL

func (c *SidecarClient) LiteServerURL() string

LiteServerURL returns the URL to the lite server config

func (*SidecarClient) Status

func (c *SidecarClient) Status(ctx context.Context) error

Status checks the health of the TON node. Returns ErrNotHealthy or nil.

Jump to

Keyboard shortcuts

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