signer

package
v0.0.0-...-495235e Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LiteClient

type LiteClient interface {
	GetTransactionsSince(ctx context.Context, acc ton.AccountID, lt uint64, hash ton.Bits256) ([]ton.Transaction, error)
	GetAccountState(ctx context.Context, accountID ton.AccountID) (tlb.ShardAccount, error)
	SendMessage(ctx context.Context, payload []byte) (uint32, error)
}

LiteClient represents a TON client see https://github.com/ton-blockchain/ton/blob/master/tl/generate/scheme/tonlib_api.tl

type Outcome

type Outcome string

Outcome possible outbound processing outcomes.

const (
	Invalid Outcome = "invalid"
	Fail    Outcome = "fail"
	Success Outcome = "success"
)

type Signable

type Signable interface {
	Hash() ([32]byte, error)
	SetSignature(sig [65]byte)
}

Signable represents a message that can be signed.

type Signer

type Signer struct {
	*base.Signer
	// contains filtered or unexported fields
}

Signer represents TON signer.

func New

func New(baseSigner *base.Signer, client LiteClient, gateway *toncontracts.Gateway) *Signer

New Signer constructor.

func (*Signer) GetERC20CustodyAddress

func (s *Signer) GetERC20CustodyAddress() (_ ethcommon.Address)

func (*Signer) GetGatewayAddress

func (s *Signer) GetGatewayAddress() string

GetGatewayAddress returns gateway address as raw TON address "0:ABC..."

func (*Signer) GetZetaConnectorAddress

func (s *Signer) GetZetaConnectorAddress() (_ ethcommon.Address)

func (*Signer) ProcessOutbound

func (s *Signer) ProcessOutbound(
	ctx context.Context,
	cctx *cc.CrossChainTx,
	zetacore interfaces.ZetacoreClient,
	zetaHeight uint64,
) (Outcome, error)

ProcessOutbound signs and broadcasts an outbound cross-chain transaction.

func (*Signer) SetERC20CustodyAddress

func (s *Signer) SetERC20CustodyAddress(_ ethcommon.Address)

func (*Signer) SetGatewayAddress

func (s *Signer) SetGatewayAddress(addr string)

SetGatewayAddress sets gateway address. Has a check for noop.

func (*Signer) SetZetaConnectorAddress

func (s *Signer) SetZetaConnectorAddress(_ ethcommon.Address)

func (*Signer) SignMessage

func (s *Signer) SignMessage(ctx context.Context, msg Signable, zetaHeight, nonce uint64) error

SignMessage signs TON external message using TSS

func (*Signer) TryProcessOutbound

func (s *Signer) TryProcessOutbound(
	ctx context.Context,
	cctx *cc.CrossChainTx,
	proc *outboundprocessor.Processor,
	outboundID string,
	_ interfaces.ChainObserver,
	zetacore interfaces.ZetacoreClient,
	zetaBlockHeight uint64,
)

TryProcessOutbound tries to process outbound cctx. Note that this API signature will be refactored in orchestrator V2

Jump to

Keyboard shortcuts

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