wallet

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: Apache-2.0 Imports: 14 Imported by: 51

Documentation

Index

Constants

View Source
const DefaultSubwallet = 698983191

Variables

This section is empty.

Functions

func AddressFromPubKey

func AddressFromPubKey(key ed25519.PublicKey, ver Version, subwallet uint32) (*address.Address, error)

func GetStateInit

func GetStateInit(pubKey ed25519.PublicKey, ver Version, subWallet uint32) (*tlb.StateInit, error)

func NewSeed

func NewSeed() []string

func NewSeedWithPassword

func NewSeedWithPassword(password string) []string

Types

type Message added in v1.0.0

type Message struct {
	Mode            uint8
	InternalMessage *tlb.InternalMessage
}

type RegularBuilder added in v1.0.0

type RegularBuilder interface {
	BuildMessage(ctx context.Context, isInitialized bool, block *tlb.BlockInfo, messages []*Message) (*cell.Cell, error)
}

type SpecRegular added in v1.0.0

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

func (*SpecRegular) SetMessagesTTL added in v1.0.0

func (s *SpecRegular) SetMessagesTTL(ttl uint32)

type SpecV3 added in v1.0.0

type SpecV3 struct {
	SpecRegular
}

func (*SpecV3) BuildMessage added in v1.0.0

func (s *SpecV3) BuildMessage(ctx context.Context, isInitialized bool, block *tlb.BlockInfo, messages []*Message) (*cell.Cell, error)

type SpecV4R2 added in v1.0.0

type SpecV4R2 struct {
	SpecRegular
}

func (*SpecV4R2) BuildMessage added in v1.0.0

func (s *SpecV4R2) BuildMessage(ctx context.Context, isInitialized bool, block *tlb.BlockInfo, messages []*Message) (*cell.Cell, error)

type TonAPI

type TonAPI interface {
	GetMasterchainInfo(ctx context.Context) (*tlb.BlockInfo, error)
	GetAccount(ctx context.Context, block *tlb.BlockInfo, addr *address.Address) (*tlb.Account, error)
	SendExternalMessage(ctx context.Context, msg *tlb.ExternalMessage) error
	RunGetMethod(ctx context.Context, blockInfo *tlb.BlockInfo, addr *address.Address, method string, params ...interface{}) ([]interface{}, error)
}

type Version

type Version int
const (
	V3         Version = 3
	V4R2       Version = 42
	HighloadV2 Version = 102
)

type Wallet

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

func FromPrivateKey

func FromPrivateKey(api TonAPI, key ed25519.PrivateKey, version Version) (*Wallet, error)

func FromSeed

func FromSeed(api TonAPI, seed []string, version Version) (*Wallet, error)

func FromSeedWithPassword

func FromSeedWithPassword(api TonAPI, seed []string, password string, version Version) (*Wallet, error)

func (*Wallet) Address

func (w *Wallet) Address() *address.Address

func (*Wallet) DeployContract added in v0.7.0

func (w *Wallet) DeployContract(ctx context.Context, amount tlb.Coins, msgBody, contractCode, contractData *cell.Cell) (*address.Address, error)

func (*Wallet) GetBalance

func (w *Wallet) GetBalance(ctx context.Context, block *tlb.BlockInfo) (tlb.Coins, error)

func (*Wallet) GetSpec added in v1.0.0

func (w *Wallet) GetSpec() any

func (*Wallet) GetSubwallet added in v1.0.0

func (w *Wallet) GetSubwallet(subwallet uint32) (*Wallet, error)

func (*Wallet) Send

func (w *Wallet) Send(ctx context.Context, message *Message) error

func (*Wallet) SendMany added in v1.0.0

func (w *Wallet) SendMany(ctx context.Context, messages []*Message) error

func (*Wallet) Transfer

func (w *Wallet) Transfer(ctx context.Context, to *address.Address, amount tlb.Coins, comment string) error

Transfer - safe transfer, in case of error on smart contract side, you will get coins back, cannot be used to transfer TON to not yet initialized contract/wallet

func (*Wallet) TransferNoBounce added in v1.0.0

func (w *Wallet) TransferNoBounce(ctx context.Context, to *address.Address, amount tlb.Coins, comment string) error

TransferNoBounce - can be used to transfer TON to not yet initialized contract/wallet

Jump to

Keyboard shortcuts

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