Documentation
¶
Index ¶
- Constants
- Variables
- type AsyncChannel
- type AsyncChannelStorageData
- type ChallengeQuarantinedState
- type ChannelID
- type ChannelStatus
- type Client
- func (c *Client) GetAsyncChannel(ctx context.Context, block *ton.BlockIDExt, addr *address.Address, verify bool) (*AsyncChannel, error)
- func (c *Client) GetDeployAsyncChannelParams(channelId ChannelID, isA bool, initialBalance tlb.Coins, ...) (body, code, data *cell.Cell, err error)
- func (c *Client) ParseAsyncChannel(addr *address.Address, code, data *cell.Cell, verify bool) (*AsyncChannel, error)
- type ClosingConfig
- type ConditionalPayment
- type CooperativeClose
- type CooperativeCommit
- type FinishUncooperativeClose
- type InitChannel
- type PaymentConfig
- type QuarantinedState
- type SemiChannel
- type SemiChannelBody
- type SettleConditionals
- type Signature
- type SignedSemiChannel
- type StartUncooperativeClose
- type TonApi
- type TopupBalance
Constants ¶
View Source
const AsyncPaymentChannelCodeBoC = "" /* 4118-byte string literal not displayed */
AsyncPaymentChannelCodeBoC Taken from https://github.com/ton-blockchain/payment-channels/tree/master#compiled-code
Variables ¶
View Source
var AsyncPaymentChannelCode = func() *cell.Cell { codeBoC, _ := hex.DecodeString(AsyncPaymentChannelCodeBoC) code, _ := cell.FromBOC(codeBoC) return code }()
View Source
var AsyncPaymentChannelCodeHash = AsyncPaymentChannelCode.Hash()
View Source
var ErrVerificationNotPassed = fmt.Errorf("verification not passed")
Functions ¶
This section is empty.
Types ¶
type AsyncChannel ¶
type AsyncChannel struct {
Status ChannelStatus
Storage AsyncChannelStorageData
// contains filtered or unexported fields
}
func (*AsyncChannel) Address ¶
func (c *AsyncChannel) Address() *address.Address
type AsyncChannelStorageData ¶
type AsyncChannelStorageData struct {
Initialized bool `tlb:"bool"`
BalanceA tlb.Coins `tlb:"."`
BalanceB tlb.Coins `tlb:"."`
KeyA []byte `tlb:"bits 256"`
KeyB []byte `tlb:"bits 256"`
ChannelID ChannelID `tlb:"bits 128"`
ClosingConfig ClosingConfig `tlb:"^"`
CommittedSeqnoA uint32 `tlb:"## 32"`
CommittedSeqnoB uint32 `tlb:"## 32"`
Quarantine *QuarantinedState `tlb:"maybe ^"`
Payments PaymentConfig `tlb:"^"`
}
type ChallengeQuarantinedState ¶
type ChallengeQuarantinedState struct {
IsChallengedByA bool `tlb:"bool"`
Signature Signature `tlb:"."`
Signed struct {
ChannelID ChannelID `tlb:"bits 128"`
A SignedSemiChannel `tlb:"^"`
B SignedSemiChannel `tlb:"^"`
// contains filtered or unexported fields
} `tlb:"."`
// contains filtered or unexported fields
}
type ChannelStatus ¶
type ChannelStatus int8
const ( ChannelStatusUninitialized ChannelStatus = iota ChannelStatusOpen ChannelStatusClosureStarted ChannelStatusSettlingConditionals ChannelStatusAwaitingFinalization )
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewPaymentChannelClient ¶
func (*Client) GetAsyncChannel ¶
func (c *Client) GetAsyncChannel(ctx context.Context, block *ton.BlockIDExt, addr *address.Address, verify bool) (*AsyncChannel, error)
func (*Client) GetDeployAsyncChannelParams ¶
func (c *Client) GetDeployAsyncChannelParams(channelId ChannelID, isA bool, initialBalance tlb.Coins, ourKey ed25519.PrivateKey, theirKey ed25519.PublicKey, closingConfig ClosingConfig, paymentConfig PaymentConfig) (body, code, data *cell.Cell, err error)
func (*Client) ParseAsyncChannel ¶
type ClosingConfig ¶
type ConditionalPayment ¶
type CooperativeClose ¶
type CooperativeClose struct {
SignatureA Signature `tlb:"^"`
SignatureB Signature `tlb:"^"`
Signed struct {
ChannelID ChannelID `tlb:"bits 128"`
BalanceA tlb.Coins `tlb:"."`
BalanceB tlb.Coins `tlb:"."`
SeqnoA uint64 `tlb:"## 64"`
SeqnoB uint64 `tlb:"## 64"`
// contains filtered or unexported fields
} `tlb:"."`
// contains filtered or unexported fields
}
type CooperativeCommit ¶
type CooperativeCommit struct {
IsA bool `tlb:"bool"`
SignatureA Signature `tlb:"^"`
SignatureB Signature `tlb:"^"`
Signed struct {
ChannelID ChannelID `tlb:"bits 128"`
SeqnoA uint64 `tlb:"## 64"`
SeqnoB uint64 `tlb:"## 64"`
// contains filtered or unexported fields
} `tlb:"."`
// contains filtered or unexported fields
}
type FinishUncooperativeClose ¶
type FinishUncooperativeClose struct {
// contains filtered or unexported fields
}
type InitChannel ¶
type PaymentConfig ¶
type QuarantinedState ¶
type QuarantinedState struct {
StateA SemiChannelBody `tlb:"."`
StateB SemiChannelBody `tlb:"."`
QuarantineStarts uint32 `tlb:"## 32"`
StateCommittedByA bool `tlb:"bool"`
StateChallenged bool `tlb:"bool"`
}
type SemiChannel ¶
type SemiChannel struct {
Data SemiChannelBody `tlb:"."`
CounterpartyData *SemiChannelBody `tlb:"maybe ^"`
// contains filtered or unexported fields
}
type SemiChannelBody ¶
type SemiChannelBody struct {
Seqno uint64 `tlb:"## 64"`
Sent tlb.Coins `tlb:"."`
Conditionals *cell.Dictionary `tlb:"dict 32"`
}
type SettleConditionals ¶
type SettleConditionals struct {
IsFromA bool `tlb:"bool"`
Signature Signature `tlb:"."`
Signed struct {
ChannelID ChannelID `tlb:"bits 128"`
ConditionalsToSettle *cell.Dictionary `tlb:"dict 32"`
B SignedSemiChannel `tlb:"^"`
// contains filtered or unexported fields
} `tlb:"."`
// contains filtered or unexported fields
}
type SignedSemiChannel ¶
type SignedSemiChannel struct {
Signature Signature `tlb:"."`
State SemiChannel `tlb:"."`
}
type StartUncooperativeClose ¶
type StartUncooperativeClose struct {
IsSignedByA bool `tlb:"bool"`
Signature Signature `tlb:"."`
Signed struct {
ChannelID ChannelID `tlb:"bits 128"`
A SignedSemiChannel `tlb:"^"`
B SignedSemiChannel `tlb:"^"`
// contains filtered or unexported fields
} `tlb:"."`
// contains filtered or unexported fields
}
type TonApi ¶
type TonApi interface {
WaitForBlock(seqno uint32) ton.APIClientWrapped
CurrentMasterchainInfo(ctx context.Context) (_ *ton.BlockIDExt, err error)
RunGetMethod(ctx context.Context, blockInfo *ton.BlockIDExt, addr *address.Address, method string, params ...any) (*ton.ExecutionResult, error)
SendExternalMessage(ctx context.Context, msg *tlb.ExternalMessage) error
GetAccount(ctx context.Context, block *ton.BlockIDExt, addr *address.Address) (*tlb.Account, error)
}
Click to show internal directories.
Click to hide internal directories.