Documentation ¶
Index ¶
- Constants
- Variables
- func AddressFromPubKey(key ed25519.PublicKey, version VersionConfig, subwallet uint32) (*address.Address, error)
- func CreateCommentCell(text string) (*cell.Cell, error)
- func CreateEncryptedCommentCell(text string, senderAddr *address.Address, ourKey ed25519.PrivateKey, ...) (*cell.Cell, error)
- func DecryptCommentCell(commentCell *cell.Cell, sender *address.Address, ourKey ed25519.PrivateKey, ...) ([]byte, error)
- func GetPublicKey(ctx context.Context, api TonAPI, addr *address.Address) (ed25519.PublicKey, error)
- func GetStateInit(pubKey ed25519.PublicKey, version VersionConfig, subWallet uint32) (*tlb.StateInit, error)
- func NewSeed() []string
- func NewSeedWithPassword(password string) []string
- type ConfigHighloadV3
- type Message
- type RegularBuilder
- type SpecHighloadV2R2
- type SpecHighloadV3
- type SpecQuery
- type SpecRegular
- type SpecSeqno
- type SpecV3
- type SpecV4R2
- type SpecV5R1
- type TonAPI
- type Version
- type VersionConfig
- type Wallet
- func (w *Wallet) Address() *address.Address
- func (w *Wallet) BuildExternalMessage(ctx context.Context, message *Message) (*tlb.ExternalMessage, error)
- func (w *Wallet) BuildExternalMessageForMany(ctx context.Context, messages []*Message) (*tlb.ExternalMessage, error)
- func (w *Wallet) BuildMessageForMany(ctx context.Context, messages []*Message) (*tlb.ExternalMessage, error)deprecated
- func (w *Wallet) BuildTransfer(to *address.Address, amount tlb.Coins, bounce bool, comment string) (_ *Message, err error)
- func (w *Wallet) BuildTransferEncrypted(ctx context.Context, to *address.Address, amount tlb.Coins, bounce bool, ...) (_ *Message, err error)
- func (w *Wallet) DeployContract(ctx context.Context, amount tlb.Coins, ...) (*address.Address, error)deprecated
- func (w *Wallet) DeployContractWaitTransaction(ctx context.Context, amount tlb.Coins, ...) (*address.Address, *tlb.Transaction, *ton.BlockIDExt, error)
- func (w *Wallet) FindTransactionByInMsgHash(ctx context.Context, msgHash []byte, maxTxNumToScan ...int) (*tlb.Transaction, error)deprecated
- func (w *Wallet) GetBalance(ctx context.Context, block *ton.BlockIDExt) (tlb.Coins, error)
- func (w *Wallet) GetSpec() any
- func (w *Wallet) GetSubwallet(subwallet uint32) (*Wallet, error)
- func (w *Wallet) PrepareExternalMessageForMany(ctx context.Context, withStateInit bool, messages []*Message) (_ *tlb.ExternalMessage, err error)
- func (w *Wallet) PrivateKey() ed25519.PrivateKey
- func (w *Wallet) Send(ctx context.Context, message *Message, waitConfirmation ...bool) error
- func (w *Wallet) SendMany(ctx context.Context, messages []*Message, waitConfirmation ...bool) error
- func (w *Wallet) SendManyGetInMsgHash(ctx context.Context, messages []*Message, waitConfirmation ...bool) ([]byte, error)
- func (w *Wallet) SendManyWaitTransaction(ctx context.Context, messages []*Message) (*tlb.Transaction, *ton.BlockIDExt, error)
- func (w *Wallet) SendManyWaitTxHash(ctx context.Context, messages []*Message) ([]byte, error)
- func (w *Wallet) SendWaitTransaction(ctx context.Context, message *Message) (*tlb.Transaction, *ton.BlockIDExt, error)
- func (w *Wallet) Transfer(ctx context.Context, to *address.Address, amount tlb.Coins, comment string, ...) error
- func (w *Wallet) TransferNoBounce(ctx context.Context, to *address.Address, amount tlb.Coins, comment string, ...) error
- func (w *Wallet) TransferWithEncryptedComment(ctx context.Context, to *address.Address, amount tlb.Coins, comment string, ...) error
- func (w *Wallet) WalletAddress() *address.Address
Constants ¶
const DefaultSubwallet = 698983191
const EncryptedCommentOpcode = 0x2167da4b
Variables ¶
var ( ErrUnsupportedWalletVersion = errors.New("wallet version is not supported") ErrTxWasNotConfirmed = errors.New("transaction was not confirmed in a given deadline, but it may still be confirmed later") // Deprecated: use ton.ErrTxWasNotFound ErrTxWasNotFound = errors.New("requested transaction is not found") )
Functions ¶
func AddressFromPubKey ¶
func DecryptCommentCell ¶
func GetPublicKey ¶
func GetStateInit ¶
func NewSeedWithPassword ¶
Types ¶
type ConfigHighloadV3 ¶
type ConfigHighloadV3 struct { // MessageTTL must be > 5 and less than 1<<22 MessageTTL uint32 // This function wil be used to get query id and creation time for the new message. // ID can be iterator from your database, max id is 1<<23, when it is higher, start from 0 and repeat // MessageBuilder should be defined if you want to send transactions MessageBuilder func(ctx context.Context, subWalletId uint32) (id uint32, createdAt int64, err error) }
type Message ¶
type Message struct { Mode uint8 InternalMessage *tlb.InternalMessage }
func SimpleMessage ¶
type RegularBuilder ¶
type SpecHighloadV2R2 ¶
type SpecHighloadV2R2 struct { SpecRegular SpecQuery }
func (*SpecHighloadV2R2) BuildMessage ¶
type SpecHighloadV3 ¶
type SpecHighloadV3 struct {
// contains filtered or unexported fields
}
func (*SpecHighloadV3) BuildMessage ¶
type SpecQuery ¶
type SpecQuery struct {
// contains filtered or unexported fields
}
func (*SpecQuery) SetCustomQueryIDFetcher ¶
type SpecRegular ¶
type SpecRegular struct {
// contains filtered or unexported fields
}
func (*SpecRegular) SetMessagesTTL ¶
func (s *SpecRegular) SetMessagesTTL(ttl uint32)
type SpecSeqno ¶
type SpecSeqno struct {
// contains filtered or unexported fields
}
func (*SpecSeqno) SetCustomSeqnoFetcher
deprecated
type SpecV3 ¶
type SpecV3 struct { SpecRegular SpecSeqno }
type SpecV4R2 ¶
type SpecV4R2 struct { SpecRegular SpecSeqno }
type SpecV5R1 ¶
type SpecV5R1 struct { SpecRegular SpecSeqno }
type TonAPI ¶
type TonAPI interface { WaitForBlock(seqno uint32) ton.APIClientWrapped Client() ton.LiteClient CurrentMasterchainInfo(ctx context.Context) (*ton.BlockIDExt, error) GetAccount(ctx context.Context, block *ton.BlockIDExt, addr *address.Address) (*tlb.Account, error) SendExternalMessage(ctx context.Context, msg *tlb.ExternalMessage) error RunGetMethod(ctx context.Context, blockInfo *ton.BlockIDExt, addr *address.Address, method string, params ...interface{}) (*ton.ExecutionResult, error) ListTransactions(ctx context.Context, addr *address.Address, num uint32, lt uint64, txHash []byte) ([]*tlb.Transaction, error) FindLastTransactionByInMsgHash(ctx context.Context, addr *address.Address, msgHash []byte, maxTxNumToScan ...int) (*tlb.Transaction, error) FindLastTransactionByOutMsgHash(ctx context.Context, addr *address.Address, msgHash []byte, maxTxNumToScan ...int) (*tlb.Transaction, error) }
type Version ¶
type Version int
const ( V1R1 Version = 11 V1R2 Version = 12 V1R3 Version = 13 V2R1 Version = 21 V2R2 Version = 22 V3R1 Version = 31 V3R2 Version = 32 V3 = V3R2 V4R1 Version = 41 V4R2 Version = 42 V5R1 Version = 51 HighloadV2R2 Version = 122 HighloadV2Verified Version = 123 HighloadV3 Version = 300 Lockup Version = 200 Unknown Version = 0 )
func GetWalletVersion ¶
type VersionConfig ¶
type VersionConfig any
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
func FromPrivateKey ¶
func FromPrivateKey(api TonAPI, key ed25519.PrivateKey, version VersionConfig) (*Wallet, error)
func FromSeedWithPassword ¶
func (*Wallet) Address ¶
Address - returns old (bounce) version of wallet address DEPRECATED: because of address reform, use WalletAddress, it will return UQ format
func (*Wallet) BuildExternalMessage ¶
func (*Wallet) BuildExternalMessageForMany ¶
func (*Wallet) BuildMessageForMany
deprecated
func (*Wallet) BuildTransfer ¶
func (*Wallet) BuildTransferEncrypted ¶
func (*Wallet) DeployContractWaitTransaction ¶
func (*Wallet) FindTransactionByInMsgHash
deprecated
func (*Wallet) GetBalance ¶
func (*Wallet) PrepareExternalMessageForMany ¶
func (w *Wallet) PrepareExternalMessageForMany(ctx context.Context, withStateInit bool, messages []*Message) (_ *tlb.ExternalMessage, err error)
PrepareExternalMessageForMany - Prepares external message for wallet can be used directly for offline signing but custom fetchers should be defined in this case
func (*Wallet) PrivateKey ¶
func (w *Wallet) PrivateKey() ed25519.PrivateKey
func (*Wallet) SendManyGetInMsgHash ¶
func (w *Wallet) SendManyGetInMsgHash(ctx context.Context, messages []*Message, waitConfirmation ...bool) ([]byte, error)
SendManyGetInMsgHash returns hash of external incoming message payload.
func (*Wallet) SendManyWaitTransaction ¶
func (w *Wallet) SendManyWaitTransaction(ctx context.Context, messages []*Message) (*tlb.Transaction, *ton.BlockIDExt, error)
SendManyWaitTransaction always waits for tx block confirmation and returns found tx.
func (*Wallet) SendManyWaitTxHash ¶
SendManyWaitTxHash always waits for tx block confirmation and returns found tx hash in block.
func (*Wallet) SendWaitTransaction ¶
func (w *Wallet) SendWaitTransaction(ctx context.Context, message *Message) (*tlb.Transaction, *ton.BlockIDExt, error)
SendWaitTransaction always waits for tx block confirmation and returns found tx.
func (*Wallet) Transfer ¶
func (w *Wallet) Transfer(ctx context.Context, to *address.Address, amount tlb.Coins, comment string, waitConfirmation ...bool) 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 ¶
func (w *Wallet) TransferNoBounce(ctx context.Context, to *address.Address, amount tlb.Coins, comment string, waitConfirmation ...bool) error
TransferNoBounce - can be used to transfer TON to not yet initialized contract/wallet
func (*Wallet) TransferWithEncryptedComment ¶
func (w *Wallet) TransferWithEncryptedComment(ctx context.Context, to *address.Address, amount tlb.Coins, comment string, waitConfirmation ...bool) error
TransferWithEncryptedComment - same as Transfer but encrypts comment, throws error if target contract (address) has no get_public_key method.
func (*Wallet) WalletAddress ¶
WalletAddress - returns new standard non bounce address