flow

package
v3.0.0-...-e8b7a4c Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PubKeyBytesLenCompressed is compressed pubkey byte length
	PubKeyBytesLenCompressed = 33
	// PubKeyBytesLenUncompressed is uncompressed pubkey byte length
	PubKeyBytesLenUncompressed = 65
)
View Source
const (
	Success_Status = "SEALED"
)

Variables

View Source
var (
	LenForPubKey  = 128
	AddressLength = 16
)
View Source
var (
	Event_Type = "A.%s.Router.LogSwapOut"
)
View Source
var (
	FixLen = 8
)

Functions

func CreateTransaction

func CreateTransaction(
	signerAddress sdk.Address,
	signerIndex int,
	signerSequence uint64,
	gas uint64,
	blockID string,
	swapInArgs *SwapIn,
) (*sdk.Transaction, error)

func GetAccount

func GetAccount(url, address string) (*sdk.Account, error)

GetLatestBlockNumber get latest block height

func GetBlockNumberByHash

func GetBlockNumberByHash(url string, blockId sdk.Identifier) (uint64, error)

func GetLatestBlock

func GetLatestBlock(url string) (*sdk.Block, error)

GetLatestBlockNumber get latest block height

func GetStubChainID

func GetStubChainID(network string) *big.Int

GetStubChainID get stub chainID

func GetTransactionByHash

func GetTransactionByHash(url, txHash string) (*sdk.TransactionResult, error)

GetTransactionByHash get tx by hash

func ParseFlowNumber

func ParseFlowNumber(amount *big.Int) string

func SupportsChainID

func SupportsChainID(chainID *big.Int) bool

SupportsChainID supports chainID

Types

type Bridge

type Bridge struct {
	*base.NonceSetterBase
}

Bridge near bridge

func NewCrossChainBridge

func NewCrossChainBridge() *Bridge

NewCrossChainBridge new bridge

func (*Bridge) BroadcastTxCommit

func (b *Bridge) BroadcastTxCommit(signedTx *sdk.Transaction) (txHash string, err error)

func (*Bridge) BuildRawTransaction

func (b *Bridge) BuildRawTransaction(args *tokens.BuildTxArgs) (rawTx interface{}, err error)

BuildRawTransaction build raw tx

func (*Bridge) GetAccountIndex

func (b *Bridge) GetAccountIndex(address, pubKey string) (int, error)

func (*Bridge) GetAccountNonce

func (b *Bridge) GetAccountNonce(address, pubKey string) (uint64, error)

func (*Bridge) GetBlockNumberByHash

func (b *Bridge) GetBlockNumberByHash(blockId sdk.Identifier) (uint64, error)

func (*Bridge) GetLatestBlockID

func (b *Bridge) GetLatestBlockID() (sdk.Identifier, error)

func (*Bridge) GetLatestBlockNumber

func (b *Bridge) GetLatestBlockNumber() (uint64, error)

GetLatestBlockNumber gets latest block number

func (*Bridge) GetLatestBlockNumberOf

func (b *Bridge) GetLatestBlockNumberOf(apiAddress string) (uint64, error)

GetLatestBlockNumberOf gets latest block number from single api

func (*Bridge) GetMPCAddress

func (b *Bridge) GetMPCAddress() (string, error)

GetMPCAddress query mpc address

func (*Bridge) GetPoolNonce

func (b *Bridge) GetPoolNonce(address, _height string) (uint64, error)

GetPoolNonce impl NonceSetter interface

func (*Bridge) GetSeq

func (b *Bridge) GetSeq(args *tokens.BuildTxArgs) (nonceptr *uint64, err error)

GetSeq returns account tx sequence

func (*Bridge) GetTokenDecimals

func (b *Bridge) GetTokenDecimals(tokenAddr string) (uint8, error)

GetTokenDecimals query token decimals

func (*Bridge) GetTransaction

func (b *Bridge) GetTransaction(txHash string) (tx interface{}, err error)

GetTransaction impl

func (*Bridge) GetTransactionByHash

func (b *Bridge) GetTransactionByHash(txHash string) (result *sdk.TransactionResult, err error)

GetTransactionByHash get tx response by hash

func (*Bridge) GetTransactionStatus

func (b *Bridge) GetTransactionStatus(txHash string) (status *tokens.TxStatus, err error)

GetTransactionStatus impl

func (*Bridge) GetTxBlockInfo

func (b *Bridge) GetTxBlockInfo(txHash string) (blockHeight, blockTime uint64)

GetTxBlockInfo impl NonceSetter interface

func (*Bridge) GetUnderlyingAddress

func (b *Bridge) GetUnderlyingAddress(contractAddr string) (string, error)

GetUnderlyingAddress query underlying address

func (*Bridge) InitAfterConfig

func (b *Bridge) InitAfterConfig()

InitAfterConfig init variables (ie. extra members) after loading config

func (*Bridge) InitRouterInfo

func (b *Bridge) InitRouterInfo(routerContract, routerVersion string) (err error)

InitRouterInfo init router info

func (*Bridge) IsValidAddress

func (b *Bridge) IsValidAddress(address string) bool

func (*Bridge) MPCSignTransaction

func (b *Bridge) MPCSignTransaction(rawTx interface{}, args *tokens.BuildTxArgs) (signedTx interface{}, txHash string, err error)

MPCSignTransaction mpc sign raw tx

func (*Bridge) PubKeyToAccountKey

func (b *Bridge) PubKeyToAccountKey(pubKey string) (string, error)

func (*Bridge) PubKeyToMpcPubKey

func (b *Bridge) PubKeyToMpcPubKey(pubKey string) (string, error)

func (*Bridge) PublicKeyToAddress

func (b *Bridge) PublicKeyToAddress(pubKey string) (string, error)

func (*Bridge) RegisterSwap

func (b *Bridge) RegisterSwap(txHash string, args *tokens.RegisterArgs) ([]*tokens.SwapTxInfo, []error)

RegisterSwap api

func (*Bridge) SendTransaction

func (b *Bridge) SendTransaction(signedTx interface{}) (txHash string, err error)

SendTransaction send signed tx

func (*Bridge) SetTokenConfig

func (b *Bridge) SetTokenConfig(tokenAddr string, tokenCfg *tokens.TokenConfig)

SetTokenConfig set and verify token config

func (*Bridge) SignTransactionWithPrivateKey

func (b *Bridge) SignTransactionWithPrivateKey(rawTx interface{}, privKey string) (signedTx interface{}, txHash string, err error)

SignTransactionWithPrivateKey sign tx with ECDSA private key string

func (*Bridge) VerifyMsgHash

func (b *Bridge) VerifyMsgHash(rawTx interface{}, msgHashes []string) (err error)

VerifyMsgHash verify msg hash

func (*Bridge) VerifyPubKey

func (b *Bridge) VerifyPubKey(address, pubKey string) error

func (*Bridge) VerifyTokenConfig

func (b *Bridge) VerifyTokenConfig(tokenCfg *tokens.TokenConfig) error

VerifyTokenConfig verify token config

func (*Bridge) VerifyTransaction

func (b *Bridge) VerifyTransaction(txHash string, args *tokens.VerifyArgs) (*tokens.SwapTxInfo, error)

VerifyTransaction impl

type EcdsaPublic

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

EcdsaPublic struct ripple ecdsa pubkey key

func (*EcdsaPublic) Private

func (k *EcdsaPublic) Private(sequence *uint32) []byte

Private not used

func (*EcdsaPublic) Public

func (k *EcdsaPublic) Public(sequence *uint32) []byte

Public returns pubkey bytes

type SwapIn

type SwapIn struct {
	Tx           cadence.String  `json:"tx"`
	Token        cadence.String  `json:"token"`
	Receiver     cadence.Address `json:"Receiver"`
	FromChainId  cadence.UInt64  `json:"fromChainId"`
	Amount       cadence.UFix64  `json:"amount"`
	ReceivePaths cadence.Array   `json:"receivePaths"`
}

func CreateSwapInArgs

func CreateSwapInArgs(
	txHash string,
	tokenIdentifier string,
	receiver sdk.Address,
	fromChainID *big.Int,
	amount *big.Int,
	path string,
) (*SwapIn, error)

Jump to

Keyboard shortcuts

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