Documentation ¶
Index ¶
- Variables
- func CurrentCallerDir() string
- func GetRouterFunctionId(address, modelname, function string) string
- func GetRouterModelId(address, modelname string) string
- func GetStubChainID(network string) *big.Int
- func InstallTsModules()
- func PublicKeyToAddress(pubKeyHex string) (string, error)
- func RunTxHashScript(txbody, argTypes *string, chainId uint) (string, error)
- func SupportsChainID(chainID *big.Int) bool
- type Account
- type AccountInfo
- type AptosError
- type Bridge
- func (b *Bridge) BuildCopyCapTransaction(address, coin string) (*Transaction, error)
- func (b *Bridge) BuildDeployModuleTransaction(address, packagemetadata string, moduleHexs []string) (*Transaction, error)
- func (b *Bridge) BuildDepositTransaction(sender, pool, underlying, anycoin string, amount uint64) (*Transaction, error)
- func (b *Bridge) BuildManagedCoinInitializeTransaction(address, coin, poolCoinName, poolCoinSymbol string, decimals uint8, ...) (*Transaction, error)
- func (b *Bridge) BuildMintCoinTransaction(minter, toaddress, coin string, amount uint64) (*Transaction, error)
- func (b *Bridge) BuildRawTransaction(args *tokens.BuildTxArgs) (rawTx interface{}, err error)
- func (b *Bridge) BuildRegisterCoinTransaction(address, coin string) (*Transaction, error)
- func (b *Bridge) BuildRegisterPoolCoinTransaction(address, underlyingCoin, poolCoin, poolCoinName, poolCoinSymbol string, ...) (*Transaction, error)
- func (b *Bridge) BuildSetCoinTransaction(address, coin string, coinType uint8) (*Transaction, error)
- func (b *Bridge) BuildSetPoolcoinCapTransaction(address, coin string) (*Transaction, error)
- func (b *Bridge) BuildSetStatusTransaction(address string, status uint8) (*Transaction, error)
- func (b *Bridge) BuildSwapinTransferTransaction(args *tokens.BuildTxArgs, tokenCfg *tokens.TokenConfig) (*Transaction, error)
- func (b *Bridge) BuildSwapinTransferTransactionForScript(router, coin, poolcoin, receiver, amount, swapID, FromChainID string) (*Transaction, error)
- func (b *Bridge) BuildSwapoutTransaction(sender, router, coin, toAddress, tochainId string, amount uint64) (*Transaction, error)
- func (b *Bridge) BuildTestUnderlyingCoinMintTransaction(minter, toaddress, coin string, amount uint64) (*Transaction, error)
- func (b *Bridge) BuildTransferTransaction(sender, coin, receiver, amount string) (*Transaction, error)
- func (b *Bridge) BuildWithdrawTransaction(sender, pool, underlying, anycoin string, amount uint64) (*Transaction, error)
- func (b *Bridge) CalcTxHashByTSScirpt(rawTx interface{}, argTypes string) (txHash string, err error)
- func (b *Bridge) EstimateGasPrice() (result *GasEstimate, err error)
- func (b *Bridge) GetAccount(address string) (result *AccountInfo, err error)
- func (b *Bridge) GetAccountBalance(address, resourceType string) (result *CoinStoreResource, err error)
- func (b *Bridge) GetAccountResource(address, resourceType string, resp interface{}) (err error)
- func (b *Bridge) GetLatestBlockNumber() (num uint64, err error)
- func (b *Bridge) GetLatestBlockNumberOf(apiAddress string) (num uint64, err error)
- func (b *Bridge) GetLedger() (result *LedgerInfo, err error)
- func (b *Bridge) GetPoolNonce(address, _height string) (uint64, error)
- func (b *Bridge) GetSigningMessage(request interface{}) (result *string, err error)
- func (b *Bridge) GetTokenDecimals(resource string) (uint8, error)
- func (b *Bridge) GetTransaction(txHash string) (tx interface{}, err error)
- func (b *Bridge) GetTransactionInfo(txHash string, allowUnstable bool) (*TransactionInfo, error)
- func (b *Bridge) GetTransactionStatus(txHash string) (status *tokens.TxStatus, err error)
- func (b *Bridge) GetTransactions(txHash string) (result *TransactionInfo, err error)
- func (b *Bridge) GetTransactionsNotPending(txHash string) (result *TransactionInfo, err error)
- func (b *Bridge) GetTxBlockInfo(txHash string) (blockHeight, blockTime uint64)
- func (b *Bridge) HasRegisterAptosCoin(address string, tokenCfg *tokens.TokenConfig) error
- func (b *Bridge) InitAfterConfig()
- func (b *Bridge) InitRouterInfo(routerContract, routerVersion string) (err error)
- func (b *Bridge) IsNative(resource string) bool
- func (b *Bridge) IsValidAddress(address string) bool
- func (b *Bridge) MPCSignTransaction(rawTx interface{}, args *tokens.BuildTxArgs) (signTx 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) SetExtraArgs(args *tokens.BuildTxArgs, tokenCfg *tokens.TokenConfig) error
- func (b *Bridge) SetTokenConfig(tokenAddr string, tokenCfg *tokens.TokenConfig)
- func (b *Bridge) SignTransactionWithPrivateKey(rawTx interface{}, privKey string) (signTx interface{}, txHash string, err error)
- func (b *Bridge) SimulateTranscation(request interface{}, publikKey string) (err error)
- func (b *Bridge) SubmitTranscation(tx interface{}) (result *TransactionInfo, err error)
- func (b *Bridge) VerifyMsgHash(rawTx interface{}, msgHashes []string) (err error)
- func (b *Bridge) VerifyTransaction(txHash string, args *tokens.VerifyArgs) (*tokens.SwapTxInfo, error)
- type CoinCoinInfoData
- type CoinEvent
- type CoinEventData
- type CoinInfoResource
- type CoinStoreData
- type CoinStoreResource
- type CoinValue
- type Event
- type EventData
- type GasEstimate
- type LedgerInfo
- type RestClient
- func (c *RestClient) EstimateGasPrice() (*GasEstimate, error)
- func (c *RestClient) GetAccount(address string) (*AccountInfo, error)
- func (c *RestClient) GetAccountCoin(address, coinType string) (*CoinStoreResource, error)
- func (c *RestClient) GetAccountResource(address, resourceType string, resp interface{}) error
- func (c *RestClient) GetEventsByEventHandle(request interface{}, target, struct_resource, field_name string, ...) error
- func (c *RestClient) GetLedger() (*LedgerInfo, error)
- func (c *RestClient) GetRequest(result interface{}, uri string, params map[string]string) error
- func (c *RestClient) GetSigningMessage(request interface{}) (*string, error)
- func (c *RestClient) GetTransactionByVersion(version string) (*TransactionInfo, error)
- func (c *RestClient) GetTransactions(txHash string) (*TransactionInfo, error)
- func (c *RestClient) GetTransactionsNotPending(txHash string) (*TransactionInfo, error)
- func (c *RestClient) PostRequest(result interface{}, uri string, body interface{}) error
- func (c *RestClient) SimulateTranscation(request interface{}, publikKey string) error
- func (c *RestClient) SubmitTranscation(request interface{}) (*TransactionInfo, error)
- type ScriptPayload
- type ScriptPayloadCode
- type ScriptTransaction
- type SwapinData
- type SwapinEvent
- type SwapoutData
- type SwapoutEvent
- type Transaction
- type TransactionInfo
- type TransactionPayload
- type TransactionSignature
Constants ¶
This section is empty.
Variables ¶
var ( API_VERSION = "/v1/" AccountPath = API_VERSION + "accounts/{address}" AccountResourcePath = API_VERSION + "accounts/{address}/resource/{resource_type}" GetTransactionsPath = API_VERSION + "transactions/by_hash/{txn_hash}" GetTransactionByVersionPath = API_VERSION + "transactions/by_version/{txn_version}" GetSigningMessagePath = API_VERSION + "transactions/encode_submission" SubmitTranscationPath = API_VERSION + "transactions" SimulateTranscationPath = API_VERSION + "transactions/simulate" GetEventsByEventHandlePath = API_VERSION + "accounts/{address}/events/{event_handle}/{field_name}" EstimateGasPricePath = API_VERSION + "estimate_gas_price" SCRIPT_FUNCTION_PAYLOAD = "entry_function_payload" SCRIPT_PAYLOAD = "script_payload" SPLIT_SYMBOL = "::" CONTRACT_NAME_ROUTER = "Router" CONTRACT_NAME_POOL = "Pool" CONTRACT_FUNC_SWAPIN = "swapin" CONTRACT_FUNC_SWAPOUT = "swapout" CONTRACT_FUNC_REGISTER_COIN = "register_coin" CONTRACT_FUNC_SET_COIN = "set_coin" CONTRACT_FUNC_SET_POOLCOIN_CAP = "set_poolcoin_cap" CONTRACT_FUNC_SET_STATUS = "set_status" CONTRACT_FUNC_SET_UNDERLYING_CAP = "copy_cap" CONTRACT_FUNC_DEPOSIT = "deposit" CONTRACT_FUNC_WITHDRAW = "withdraw" NATIVE_COIN = "0x1::aptos_coin::AptosCoin" PUBLISH_PACKAGE = "0x1::code::publish_package_txn" COIN_INFO_PREFIX = "0x1::coin::CoinInfo<%s>" SUCCESS_HTTP_STATUS_CODE = map[int]bool{200: true, 202: true} )
Functions ¶
func CurrentCallerDir ¶
func CurrentCallerDir() string
func GetRouterFunctionId ¶
func GetRouterModelId ¶
func InstallTsModules ¶
func InstallTsModules()
func PublicKeyToAddress ¶
Types ¶
type Account ¶
func NewAccount ¶
func NewAccount() *Account
func NewAccountFromPubkey ¶
func NewAccountFromSeed ¶
func (*Account) GetHexAddress ¶
func (*Account) GetPublicKeyHex ¶
type AccountInfo ¶
type AptosError ¶
type Bridge ¶
type Bridge struct {
*base.NonceSetterBase
}
Bridge block bridge inherit from btc bridge
func (*Bridge) BuildCopyCapTransaction ¶
func (b *Bridge) BuildCopyCapTransaction(address, coin string) (*Transaction, error)
func (*Bridge) BuildDeployModuleTransaction ¶
func (b *Bridge) BuildDeployModuleTransaction(address, packagemetadata string, moduleHexs []string) (*Transaction, error)
func (*Bridge) BuildDepositTransaction ¶
func (b *Bridge) BuildDepositTransaction(sender, pool, underlying, anycoin string, amount uint64) (*Transaction, error)
func (*Bridge) BuildManagedCoinInitializeTransaction ¶
func (*Bridge) BuildMintCoinTransaction ¶
func (b *Bridge) BuildMintCoinTransaction(minter, toaddress, coin string, amount uint64) (*Transaction, error)
func (*Bridge) BuildRawTransaction ¶
func (b *Bridge) BuildRawTransaction(args *tokens.BuildTxArgs) (rawTx interface{}, err error)
BuildRawTransaction impl
func (*Bridge) BuildRegisterCoinTransaction ¶
func (b *Bridge) BuildRegisterCoinTransaction(address, coin string) (*Transaction, error)
func (*Bridge) BuildRegisterPoolCoinTransaction ¶
func (b *Bridge) BuildRegisterPoolCoinTransaction(address, underlyingCoin, poolCoin, poolCoinName, poolCoinSymbol string, decimals uint8) (*Transaction, error)
func (*Bridge) BuildSetCoinTransaction ¶
func (b *Bridge) BuildSetCoinTransaction(address, coin string, coinType uint8) (*Transaction, error)
func (*Bridge) BuildSetPoolcoinCapTransaction ¶
func (b *Bridge) BuildSetPoolcoinCapTransaction(address, coin string) (*Transaction, error)
func (*Bridge) BuildSetStatusTransaction ¶
func (b *Bridge) BuildSetStatusTransaction(address string, status uint8) (*Transaction, error)
func (*Bridge) BuildSwapinTransferTransaction ¶
func (b *Bridge) BuildSwapinTransferTransaction(args *tokens.BuildTxArgs, tokenCfg *tokens.TokenConfig) (*Transaction, error)
BuildSwapinTransferTransaction build swapin transfer tx
func (*Bridge) BuildSwapinTransferTransactionForScript ¶
func (b *Bridge) BuildSwapinTransferTransactionForScript(router, coin, poolcoin, receiver, amount, swapID, FromChainID string) (*Transaction, error)
func (*Bridge) BuildSwapoutTransaction ¶
func (b *Bridge) BuildSwapoutTransaction(sender, router, coin, toAddress, tochainId string, amount uint64) (*Transaction, error)
func (*Bridge) BuildTestUnderlyingCoinMintTransaction ¶
func (b *Bridge) BuildTestUnderlyingCoinMintTransaction(minter, toaddress, coin string, amount uint64) (*Transaction, error)
func (*Bridge) BuildTransferTransaction ¶
func (b *Bridge) BuildTransferTransaction(sender, coin, receiver, amount string) (*Transaction, error)
func (*Bridge) BuildWithdrawTransaction ¶
func (b *Bridge) BuildWithdrawTransaction(sender, pool, underlying, anycoin string, amount uint64) (*Transaction, error)
func (*Bridge) CalcTxHashByTSScirpt ¶
func (*Bridge) EstimateGasPrice ¶
func (b *Bridge) EstimateGasPrice() (result *GasEstimate, err error)
EstimateGasPrice estimate gas price
func (*Bridge) GetAccount ¶
func (b *Bridge) GetAccount(address string) (result *AccountInfo, err error)
GetAccount get account info
func (*Bridge) GetAccountBalance ¶
func (b *Bridge) GetAccountBalance(address, resourceType string) (result *CoinStoreResource, err error)
func (*Bridge) GetAccountResource ¶
GetAccountResource get account resource
func (*Bridge) GetLatestBlockNumber ¶
func (*Bridge) GetLatestBlockNumberOf ¶
func (*Bridge) GetLedger ¶
func (b *Bridge) GetLedger() (result *LedgerInfo, err error)
GetLedger get ledger info
func (*Bridge) GetPoolNonce ¶
GetPoolNonce impl NonceSetter interface
func (*Bridge) GetSigningMessage ¶
GetSigningMessage get signing message
func (*Bridge) GetTokenDecimals ¶
GetTokenDecimals query
func (*Bridge) GetTransaction ¶
GetTransaction impl
func (*Bridge) GetTransactionInfo ¶
func (b *Bridge) GetTransactionInfo(txHash string, allowUnstable bool) (*TransactionInfo, error)
GetTransactionInfo get tx info (verify tx status and check stable)
func (*Bridge) GetTransactionStatus ¶
GetTransactionStatus impl
func (*Bridge) GetTransactions ¶
func (b *Bridge) GetTransactions(txHash string) (result *TransactionInfo, err error)
GetTransactions get tx by hash
func (*Bridge) GetTransactionsNotPending ¶
func (b *Bridge) GetTransactionsNotPending(txHash string) (result *TransactionInfo, err error)
GetTransactionsNotPending get non pending tx by hash
func (*Bridge) GetTxBlockInfo ¶
GetTxBlockInfo impl NonceSetter interface
func (*Bridge) HasRegisterAptosCoin ¶
func (b *Bridge) HasRegisterAptosCoin(address string, tokenCfg *tokens.TokenConfig) error
func (*Bridge) InitAfterConfig ¶
func (b *Bridge) InitAfterConfig()
InitAfterConfig init variables (ie. extra members) after loading config
func (*Bridge) InitRouterInfo ¶
func (*Bridge) IsValidAddress ¶
IsValidAddress check address
func (*Bridge) MPCSignTransaction ¶
func (b *Bridge) MPCSignTransaction(rawTx interface{}, args *tokens.BuildTxArgs) (signTx interface{}, txHash string, err error)
MPCSignTransaction impl
func (*Bridge) PublicKeyToAddress ¶
PublicKeyToAddress impl
func (*Bridge) RegisterSwap ¶
func (b *Bridge) RegisterSwap(txHash string, args *tokens.RegisterArgs) ([]*tokens.SwapTxInfo, []error)
RegisterSwap api
func (*Bridge) SendTransaction ¶
SendTransaction impl
func (*Bridge) SetExtraArgs ¶
func (b *Bridge) SetExtraArgs(args *tokens.BuildTxArgs, tokenCfg *tokens.TokenConfig) error
func (*Bridge) SetTokenConfig ¶
func (b *Bridge) SetTokenConfig(tokenAddr string, tokenCfg *tokens.TokenConfig)
SetTokenConfig set token config
func (*Bridge) SignTransactionWithPrivateKey ¶
func (b *Bridge) SignTransactionWithPrivateKey(rawTx interface{}, privKey string) (signTx interface{}, txHash string, err error)
SignTransactionWithPrivateKey sign tx with ECDSA private key
func (*Bridge) SimulateTranscation ¶
SimulateTranscation simulate tx
func (*Bridge) SubmitTranscation ¶
func (b *Bridge) SubmitTranscation(tx interface{}) (result *TransactionInfo, err error)
SubmitTranscation submit to all urls
func (*Bridge) VerifyMsgHash ¶
VerifyMsgHash verify msg hash
func (*Bridge) VerifyTransaction ¶
func (b *Bridge) VerifyTransaction(txHash string, args *tokens.VerifyArgs) (*tokens.SwapTxInfo, error)
VerifyTransaction impl
type CoinCoinInfoData ¶
type CoinEvent ¶
type CoinEvent struct { EventData Data CoinEventData `json:"data"` }
type CoinEventData ¶
type CoinEventData struct {
Amount string `json:"amount"`
}
type CoinInfoResource ¶
type CoinInfoResource struct { Type string `json:"type"` Data CoinCoinInfoData `json:"data"` }
type CoinStoreData ¶
type CoinStoreResource ¶
type CoinStoreResource struct { Type string `json:"type"` Data *CoinStoreData `json:"data,omitempty"` }
type GasEstimate ¶
type GasEstimate struct {
GasPrice int `json:"gas_estimate"`
}
type LedgerInfo ¶
type LedgerInfo struct { ChainId uint `json:"chain_id"` Epoch string `json:"epoch"` LedgerVersion string `json:"ledger_version"` OldestLedgerVersion string `json:"oldest_ledger_version"` BlockHeight string `json:"block_height"` OldestBlockHeight string `json:"oldest_block_height"` LedgerTimestamp string `json:"ledger_timestamp"` NodeRole string `json:"node_role"` }
type RestClient ¶
func (*RestClient) EstimateGasPrice ¶
func (c *RestClient) EstimateGasPrice() (*GasEstimate, error)
func (*RestClient) GetAccount ¶
func (c *RestClient) GetAccount(address string) (*AccountInfo, error)
func (*RestClient) GetAccountCoin ¶
func (c *RestClient) GetAccountCoin(address, coinType string) (*CoinStoreResource, error)
func (*RestClient) GetAccountResource ¶
func (c *RestClient) GetAccountResource(address, resourceType string, resp interface{}) error
func (*RestClient) GetEventsByEventHandle ¶
func (c *RestClient) GetEventsByEventHandle(request interface{}, target, struct_resource, field_name string, start, limit int) error
func (*RestClient) GetLedger ¶
func (c *RestClient) GetLedger() (*LedgerInfo, error)
func (*RestClient) GetRequest ¶
func (c *RestClient) GetRequest(result interface{}, uri string, params map[string]string) error
func (*RestClient) GetSigningMessage ¶
func (c *RestClient) GetSigningMessage(request interface{}) (*string, error)
func (*RestClient) GetTransactionByVersion ¶
func (c *RestClient) GetTransactionByVersion(version string) (*TransactionInfo, error)
func (*RestClient) GetTransactions ¶
func (c *RestClient) GetTransactions(txHash string) (*TransactionInfo, error)
func (*RestClient) GetTransactionsNotPending ¶
func (c *RestClient) GetTransactionsNotPending(txHash string) (*TransactionInfo, error)
func (*RestClient) PostRequest ¶
func (c *RestClient) PostRequest(result interface{}, uri string, body interface{}) error
func (*RestClient) SimulateTranscation ¶
func (c *RestClient) SimulateTranscation(request interface{}, publikKey string) error
func (*RestClient) SubmitTranscation ¶
func (c *RestClient) SubmitTranscation(request interface{}) (*TransactionInfo, error)
type ScriptPayload ¶
type ScriptPayload struct { Type string `json:"type"` Code ScriptPayloadCode `json:"code"` TypeArguments []string `json:"type_arguments"` Arguments []interface{} `json:"arguments"` }
type ScriptPayloadCode ¶
type ScriptPayloadCode struct {
Bytecode string `json:"bytecode"`
}
type ScriptTransaction ¶
type ScriptTransaction struct { Sender string `json:"sender"` SequenceNumber string `json:"sequence_number"` MaxGasAmount string `json:"max_gas_amount"` GasUnitPrice string `json:"gas_unit_price"` GasCurrencyCode string `json:"gas_currency_code,omitempty"` ExpirationTimestampSecs string `json:"expiration_timestamp_secs"` Payload *ScriptPayload `json:"payload"` Signature *TransactionSignature `json:"signature,omitempty"` }
type SwapinData ¶
type SwapinEvent ¶
type SwapinEvent struct { EventData Data SwapinData `json:"data"` }
type SwapoutData ¶
type SwapoutEvent ¶
type SwapoutEvent struct { EventData Data SwapoutData `json:"data"` }
type Transaction ¶
type Transaction struct { Sender string `json:"sender"` SequenceNumber string `json:"sequence_number"` MaxGasAmount string `json:"max_gas_amount"` GasUnitPrice string `json:"gas_unit_price"` GasCurrencyCode string `json:"gas_currency_code,omitempty"` ExpirationTimestampSecs string `json:"expiration_timestamp_secs"` Payload *TransactionPayload `json:"payload"` Signature *TransactionSignature `json:"signature,omitempty"` }
type TransactionInfo ¶
type TransactionInfo struct { Type string `json:"type"` Version string `json:"version,omitempty"` Hash string `json:"hash"` StateRootHash string `json:"state_root_hash,omitempty"` EventRootHash string `json:"event_root_hash,omitempty"` GasUsed string `json:"gas_used,omitempty"` Success bool `json:"success,omitempty"` VmStatus string `json:"vm_status,omitempty"` AccumulatorRootHash string `json:"accumulator_root_hash,omitempty"` Sender string `json:"sender"` SequenceNumber string `json:"sequence_number"` MaxGasAmount string `json:"max_gas_amount"` GasUnitPrice string `json:"gas_unit_price"` ExpirationTimestampSecs string `json:"expiration_timestamp_secs"` Timestamp string `json:"timestamp,omitempty"` PayLoad TransactionPayload `json:"payload,omitempty"` Events []Event `json:"events,omitempty"` }
type TransactionPayload ¶
type TransactionSignature ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
tools
|
|
tweetnacl-go is a port of Dan Bernstein's "crypto library in a 100 tweets" code to the Go language.
|
tweetnacl-go is a port of Dan Bernstein's "crypto library in a 100 tweets" code to the Go language. |