package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type WalletOwnershipProof struct {
Timestamp int
Signature []byte
}
const WalletOwnershipProofTypeID = 0x60bccb0d
var (
_ bin .Encoder = &WalletOwnershipProof {}
_ bin .Decoder = &WalletOwnershipProof {}
_ bin .BareEncoder = &WalletOwnershipProof {}
_ bin .BareDecoder = &WalletOwnershipProof {}
)
func (w *WalletOwnershipProof ) Zero () bool {
if w == nil {
return true
}
if !(w .Timestamp == 0 ) {
return false
}
if !(w .Signature == nil ) {
return false
}
return true
}
func (w *WalletOwnershipProof ) String () string {
if w == nil {
return "WalletOwnershipProof(nil)"
}
type Alias WalletOwnershipProof
return fmt .Sprintf ("WalletOwnershipProof%+v" , Alias (*w ))
}
func (w *WalletOwnershipProof ) FillFrom (from interface {
GetTimestamp () (value int )
GetSignature () (value []byte )
}) {
w .Timestamp = from .GetTimestamp ()
w .Signature = from .GetSignature ()
}
func (*WalletOwnershipProof ) TypeID () uint32 {
return WalletOwnershipProofTypeID
}
func (*WalletOwnershipProof ) TypeName () string {
return "walletOwnershipProof"
}
func (w *WalletOwnershipProof ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "walletOwnershipProof" ,
ID : WalletOwnershipProofTypeID ,
}
if w == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Timestamp" ,
SchemaName : "timestamp" ,
},
{
Name : "Signature" ,
SchemaName : "signature" ,
},
}
return typ
}
func (w *WalletOwnershipProof ) Encode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode walletOwnershipProof#60bccb0d as nil" )
}
b .PutID (WalletOwnershipProofTypeID )
return w .EncodeBare (b )
}
func (w *WalletOwnershipProof ) EncodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't encode walletOwnershipProof#60bccb0d as nil" )
}
b .PutInt (w .Timestamp )
b .PutBytes (w .Signature )
return nil
}
func (w *WalletOwnershipProof ) Decode (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode walletOwnershipProof#60bccb0d to nil" )
}
if err := b .ConsumeID (WalletOwnershipProofTypeID ); err != nil {
return fmt .Errorf ("unable to decode walletOwnershipProof#60bccb0d: %w" , err )
}
return w .DecodeBare (b )
}
func (w *WalletOwnershipProof ) DecodeBare (b *bin .Buffer ) error {
if w == nil {
return fmt .Errorf ("can't decode walletOwnershipProof#60bccb0d to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode walletOwnershipProof#60bccb0d: field timestamp: %w" , err )
}
w .Timestamp = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode walletOwnershipProof#60bccb0d: field signature: %w" , err )
}
w .Signature = value
}
return nil
}
func (w *WalletOwnershipProof ) GetTimestamp () (value int ) {
if w == nil {
return
}
return w .Timestamp
}
func (w *WalletOwnershipProof ) GetSignature () (value []byte ) {
if w == nil {
return
}
return w .Signature
}
The pages are generated with Golds v0.8.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .