Documentation ¶
Index ¶
- Constants
- Variables
- func BroadcastTxCommit(url string, signedTx []byte) (string, error)
- func CheckBalance(url, account, amount string) error
- func CheckTokenBalance(url, token, account, amount string) error
- func GenerateKey() (seed, pub []byte, err error)
- func GeneratePubKeyByBase58(b58Key string) ([]byte, error)
- func GeneratePubKeyBySeed(seed []byte) ([]byte, error)
- func GetAccountNonce(url, account, publicKey string) (uint64, error)
- func GetBlockNumberByHash(url, hash string) (uint64, error)
- func GetLatestBlockHash(url string) (string, error)
- func GetLatestBlockNumber(url string) (uint64, error)
- func GetStubChainID(network string) *big.Int
- func SetRPCTimeout(timeout int)
- func StringToPrivateKey(priv string) (*ed25519.PrivateKey, error)
- func SupportsChainID(chainID *big.Int) bool
- type AccessKey
- type AccessKeyPermission
- type Action
- type AddKey
- type BlockDetail
- type BlockHeader
- type Bridge
- func (b *Bridge) BroadcastTxCommit(signedTx []byte) (result string, err error)
- func (b *Bridge) BuildRawTransaction(args *tokens.BuildTxArgs) (rawTx interface{}, err error)
- func (b *Bridge) CheckBalance(address, amount string) error
- func (b *Bridge) CheckTokenBalance(token, amount string) error
- func (b *Bridge) CreateFunctionCall(txHash, multichainToken, to, amount, fromChainID string, logIndex int, ...) (string, []Action, error)
- func (b *Bridge) GetAccountNonce(account, publicKey string) (uint64, error)
- func (b *Bridge) GetBlockNumberByHash(blockHash string) (uint64, error)
- func (b *Bridge) GetLatestBlockHash() (string, error)
- func (b *Bridge) GetLatestBlockNumber() (uint64, error)
- func (b *Bridge) GetLatestBlockNumberOf(apiAddress string) (uint64, error)
- func (b *Bridge) GetPoolNonce(address, _height string) (uint64, error)
- func (b *Bridge) GetSeq(args *tokens.BuildTxArgs) (nonceptr *uint64, err error)
- func (b *Bridge) GetTokenDecimals(tokenAddr string) (uint8, error)
- func (b *Bridge) GetTransaction(txHash string) (tx interface{}, err error)
- func (b *Bridge) GetTransactionByHash(txHash string) (result *TransactionResult, err error)
- func (b *Bridge) GetTransactionStatus(txHash string) (status *tokens.TxStatus, err error)
- func (b *Bridge) GetTxBlockInfo(txHash string) (blockHeight, blockTime uint64)
- func (b *Bridge) InitAfterConfig()
- func (b *Bridge) InitRouterInfo(routerContract, routerVersion string) (err error)
- func (b *Bridge) IsValidAddress(address string) bool
- func (b *Bridge) MPCSignTransaction(rawTx interface{}, args *tokens.BuildTxArgs) (signedTx interface{}, txHash string, err error)
- func (b *Bridge) PublicKeyToAddress(pubKeyHex string) (string, error)
- func (b *Bridge) RegisterSwap(txHash string, args *tokens.RegisterArgs) ([]*tokens.SwapTxInfo, []error)
- func (b *Bridge) SendTransaction(signedTx interface{}) (txHash string, err error)
- func (b *Bridge) SetTokenConfig(tokenAddr string, tokenCfg *tokens.TokenConfig)
- func (b *Bridge) SignTransactionWithPrivateKey(rawTx interface{}, privKey string) (signedTx interface{}, txHash string, err error)
- func (b *Bridge) VerifyMsgHash(rawTx interface{}, msgHashes []string) (err error)
- func (b *Bridge) VerifyPubKey(address, pubkey string) error
- func (b *Bridge) VerifyTokenConfig(tokenCfg *tokens.TokenConfig) error
- func (b *Bridge) VerifyTransaction(txHash string, args *tokens.VerifyArgs) (*tokens.SwapTxInfo, error)
- type CreateAccount
- type DeleteAccount
- type DeleteKey
- type DeployContract
- type EcdsaPublic
- type FtSwapIn
- type FtTransfer
- type FunctionCall
- type FunctionCallPermission
- type FunctionCallResult
- type FungibleTokenMetadata
- type Nep141V4TransferEvent
- type Nep141V4TransferMemo
- type Outcome
- type Proof
- type PublicKey
- type RawTransaction
- type ReceiptsOutcome
- type Signature
- type SignedTransaction
- type Stake
- type Status
- type Transaction
- type TransactionOutcome
- type TransactionResult
- type Transfer
Constants ¶
const ( // PubKeyBytesLenCompressed is compressed pubkey byte length PubKeyBytesLenCompressed = 33 // PubKeyBytesLenUncompressed is uncompressed pubkey byte length PubKeyBytesLenUncompressed = 65 )
const ( ED25519 = 0 ED25519Prefix = "ed25519:" )
All supported key types
const ( SWAPOUTLOG = "SwapOut" SWAPOUTNATIVELOG = "SwapOutNative" TRANSFERLOG = "Transfer" TRANSFERV4LOG = "ft_transfer" )
Variables ¶
var ( GetFtMetadata = "ft_metadata" GetFtBalance = "ft_balance_of" EmptyArgs = "e30=" )
Functions ¶
func CheckBalance ¶
func CheckTokenBalance ¶
func GenerateKey ¶
func GeneratePubKeyByBase58 ¶
func GeneratePubKeyBySeed ¶
func GetAccountNonce ¶
GetLatestBlockNumber get latest block height
func GetBlockNumberByHash ¶
func GetLatestBlockHash ¶
func GetLatestBlockNumber ¶
GetLatestBlockNumber get latest block height
func StringToPrivateKey ¶
func StringToPrivateKey(priv string) (*ed25519.PrivateKey, error)
Types ¶
type AccessKey ¶
type AccessKey struct { Nonce uint64 Permission AccessKeyPermission }
AccessKey encodes a NEAR access key.
type AccessKeyPermission ¶
type AccessKeyPermission struct { Enum borsh.Enum `borsh_enum:"true"` // treat struct as complex enum when serializing/deserializing FunctionCall FunctionCallPermission FullAccess borsh.Enum }
AccessKeyPermission encodes a NEAR access key permission.
type Action ¶
type Action struct { Enum borsh.Enum `borsh_enum:"true"` // treat struct as complex enum when serializing/deserializing CreateAccount borsh.Enum DeployContract DeployContract FunctionCall FunctionCall Transfer Transfer Stake Stake AddKey AddKey DeleteKey DeleteKey DeleteAccount DeleteAccount }
type BlockDetail ¶
type BlockDetail struct {
Header BlockHeader `json:"header"`
}
type BlockHeader ¶
type Bridge ¶
type Bridge struct {
*base.NonceSetterBase
}
Bridge near bridge
func (*Bridge) BroadcastTxCommit ¶
BroadcastTxCommit broadcast tx
func (*Bridge) BuildRawTransaction ¶
func (b *Bridge) BuildRawTransaction(args *tokens.BuildTxArgs) (rawTx interface{}, err error)
BuildRawTransaction build raw tx
func (*Bridge) CheckBalance ¶
func (*Bridge) CheckTokenBalance ¶
func (*Bridge) CreateFunctionCall ¶
func (*Bridge) GetAccountNonce ¶
func (*Bridge) GetBlockNumberByHash ¶
func (*Bridge) GetLatestBlockHash ¶
func (*Bridge) GetLatestBlockNumber ¶
GetLatestBlockNumber gets latest block number
func (*Bridge) GetLatestBlockNumberOf ¶
GetLatestBlockNumberOf gets latest block number from single api
func (*Bridge) GetPoolNonce ¶
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 ¶
GetTokenDecimals query token decimals
func (*Bridge) GetTransaction ¶
GetTransaction impl
func (*Bridge) GetTransactionByHash ¶
func (b *Bridge) GetTransactionByHash(txHash string) (result *TransactionResult, err error)
GetTransactionByHash get tx response by hash
func (*Bridge) GetTransactionStatus ¶
GetTransactionStatus impl
func (*Bridge) GetTxBlockInfo ¶
GetTxBlockInfo impl NonceSetter interface
func (*Bridge) InitAfterConfig ¶
func (b *Bridge) InitAfterConfig()
InitAfterConfig init variables (ie. extra members) after loading config
func (*Bridge) InitRouterInfo ¶
InitRouterInfo init router info
func (*Bridge) IsValidAddress ¶
IsValidAddress check address
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) PublicKeyToAddress ¶
PublicKeyToAddress public key hex string (may be uncompressed) to address
func (*Bridge) RegisterSwap ¶
func (b *Bridge) RegisterSwap(txHash string, args *tokens.RegisterArgs) ([]*tokens.SwapTxInfo, []error)
RegisterSwap api
func (*Bridge) SendTransaction ¶
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 ¶
VerifyMsgHash verify msg hash
func (*Bridge) VerifyPubKey ¶
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 CreateAccount ¶
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 FtTransfer ¶
type FunctionCall ¶
The FunctionCall action.
type FunctionCallPermission ¶
FunctionCallPermission encodes a NEAR function call permission (an access key permission).
type FunctionCallResult ¶
type FungibleTokenMetadata ¶
type Nep141V4TransferEvent ¶
type Nep141V4TransferEvent struct { Standard string `json:"standard"` Version string `json:"version"` Event string `json:"event"` Data []Nep141V4TransferMemo `json:"data"` }
type Nep141V4TransferMemo ¶
type PublicKey ¶
PublicKey encoding for NEAR.
func PublicKeyFromBytes ¶
func PublicKeyFromEd25519 ¶
PublicKeyFromEd25519 derives a public key in NEAR encoding from pk.
func PublicKeyFromHexString ¶
func PublicKeyFromString ¶
type RawTransaction ¶
type RawTransaction struct { SignerID string PublicKey PublicKey Nonce uint64 ReceiverID string BlockHash [32]byte Actions []Action }
A Transaction encodes a NEAR transaction.
func CreateTransaction ¶
type ReceiptsOutcome ¶
type SignedTransaction ¶
type SignedTransaction struct { Transaction RawTransaction Signature Signature }
type Status ¶
type Status struct { SuccessValue interface{} `json:"SuccessValue,omitempty"` SuccessReceiptID interface{} `json:"SuccessReceiptId,omitempty"` Failure interface{} `json:"Failure,omitempty"` Unknown interface{} `json:"Unknown,omitempty"` }
type Transaction ¶
type TransactionOutcome ¶
type TransactionResult ¶
type TransactionResult struct { Status Status `json:"status"` Transaction Transaction `json:"transaction"` TransactionOutcome TransactionOutcome `json:"transaction_outcome"` ReceiptsOutcome []ReceiptsOutcome `json:"receipts_outcome"` }
func GetTransactionByHash ¶
func GetTransactionByHash(url, txHash, senderID string) (*TransactionResult, error)
GetTransactionByHash get tx by hash