Documentation ¶
Index ¶
- Constants
- Variables
- func CheckPrivateKey(privateKey string, netType int) (bool, error)
- func CheckWalletAddress(address string, netType int) (bool, error)
- func GenerateMnemonics() string
- func GetAddressFromMnemonic(words string, netType int) (string, error)
- func GetAddressFromPrivateKey(privateKey string, netType int) string
- func GetPrivateKeyFromMnemonic(words string, netType int) (string, error)
- func GetPubKeyFromPrivateKey(privKey string) (string, error)
- func SignAssetCreateTx(privateKey string, param *AssetIssueTxParam) (string, error)
- func SignAssetUpdateTx(privateKey string, param *AssetUpdateTxParam) (string, error)
- func SignCallContractTx(privateKey string, param *CallContractTxParam) (string, error)
- func SignCdpLiquidateTx(privateKey string, param *CdpLiquidateTxParam) (string, error)
- func SignCdpRedeemTx(privateKey string, param *CdpRedeemTxParam) (string, error)
- func SignCdpStakeTx(privateKey string, param *CdpStakeTxParam) (string, error)
- func SignCommonTx(privateKey string, param *CommonTxParam) (string, error)
- func SignDelegateTx(privateKey string, param *DelegateTxParam) (string, error)
- func SignDexBuyLimitTx(privateKey string, param *DexLimitTxParam) (string, error)
- func SignDexCancelTx(privateKey string, param *DexCancelTxParam) (string, error)
- func SignDexMarketBuyTx(privateKey string, param *DexMarketTxParam) (string, error)
- func SignDexMarketSellTx(privateKey string, param *DexMarketTxParam) (string, error)
- func SignDexSellLimitTx(privateKey string, param *DexLimitTxParam) (string, error)
- func SignRegisterAccountTx(privateKey string, param *RegisterAccountTxParam) (string, error)
- func SignRegisterContractTx(privateKey string, param *RegisterContractTxParam) (string, error)
- func SignUCoinCallContractTx(privateKey string, param *UCoinContractTxParam) (string, error)
- func SignUCoinRegisterContractTx(privateKey string, param *UCoinRegisterContractTxParam) (string, error)
- func SignUCoinTransferTx(privateKey string, param *UCoinTransferTxParam) (string, error)
- func VerifyMsgSignature(signature string, publicKey string, msg string, netType int) (isRight bool, addr string)
- type AssetIssueTxParam
- type AssetModel
- type AssetModels
- type AssetUpdateTxParam
- type CallContractTxParam
- type CdpLiquidateTxParam
- type CdpRedeemTxParam
- type CdpStakeTxParam
- type CommonTxParam
- type DelegateTxParam
- type Dest
- type DestArr
- type DexCancelTxParam
- type DexLimitTxParam
- type DexMarketTxParam
- type Mnemonic
- type OperVoteFund
- type OperVoteFunds
- type RegisterAccountTxParam
- type RegisterContractTxParam
- type SignMessageParam
- type UCoinContractTxParam
- type UCoinRegisterContractTxParam
- type UCoinTransferTxParam
Constants ¶
const ( ENGLISH string = "EN" JAPANESE = "JP" FRENCH = "FR" ITALIAN = "IT" KOREAN = "KR" SPANISH = "ES" )
List Mnemonic language support
const ( // network type WAYKI_MAINTNET int = 1 // mainnet WAYKI_TESTNET int = 2 // testnet // const for transactions TX_VERSION = 1 // transaction version INITIAL_COIN = 210000000 // initial coin, unit: wicc MONEY_PER_COIN = 100000000 // money per coin, unit: sawi MAX_MONEY = INITIAL_COIN * MONEY_PER_COIN // the max money in WaykiChain MIN_TX_FEE = 10000 // tx fee min value, unit: sawi CONTRACT_SCRIPT_MAX_SIZE = 65536 //64 KB max for contract script size, unit: bytes CONTRACT_SCRIPT_DESC_MAX_SIZE = 512 //max for contract script description size, unit: bytes MIN_TX_FEE_CDP = 100000 // cdp tx fee min value, unit: sawi )
Variables ¶
var ( ERR_INVALID_MNEMONIC = errors.New("Invalid Mnemonic") ERR_INVALID_NETWORK = errors.New("Invalid Network type") ERR_INVALID_PRIVATE_KEY = errors.New("privateKey invalid") ERR_NEGATIVE_VALID_HEIGHT = errors.New("ValidHeight can not be negative") ERR_INVALID_SRC_REG_ID = errors.New("SrcRegId must be a valid RegID") ERR_INVALID_DEST_ADDR = errors.New("DestAddr must be a valid RegID or Address") ERR_RANGE_VALUES = errors.New("Values out of range") ERR_RANGE_FEE = errors.New("Fees out of range") ERR_FEE_SMALLER_MIN = errors.New("Fees smaller than MinTxFee") ERR_EMPTY_VOTES = errors.New("Votes can be not empty") ERR_INVALID_VOTE_PUBKEY = errors.New("Vote PubKey invalid, PubKey len must equal 33") ERR_RANGE_VOTE_VALUE = errors.New("VoteValue out of range") ERR_INVALID_APP_ID = errors.New("AppId must be a valid RegID") ERR_INVALID_CONTRACT_HEX = errors.New("ContractHex must be valid hex format") ERR_INVALID_SCRIPT = errors.New("Script can not be empty or is too large") ERR_INVALID_SCRIPT_DESC = errors.New("Description of script is too large") ERR_CDP_TX_HASH = errors.New("CDP tx hash error") ERR_CDP_STAKE_NUMBER = errors.New("CDP stake number error") ERR_COIN_TYPE = errors.New("Coin type error") ERR_USER_PUBLICKEY = errors.New("PublicKey invalid") ERR_ASK_PRICE = errors.New("Ask Price invalid") ERR_SIGNATURE_ERROR = errors.New("Signature error") ERR_SYMBOL_ERROR = errors.New("Symbol Capital letter A-Z 6-7 digits [A_Z] error") ERR_ASSET_NAME_ERROR = errors.New("Asset Name error") ERR_TOTAl_SUPPLY_ERROR = errors.New("Asset Total Supply error") ERR_ASSET_UPDATE_TYPE_ERROR = errors.New("Asset Update Type error") ERR_ASSET_UPDATE_OWNER_ERROR = errors.New("Asset Update Owner error") )
errors
Functions ¶
func GenerateMnemonics ¶
func GenerateMnemonics() string
Generate Mnemonics string, saprated by space, default language is EN(english)
func GetAddressFromMnemonic ¶
助记词转换地址 netType: WAYKI_TESTNET or WAYKI_MAINTNET
func GetAddressFromPrivateKey ¶
GetAddressFromPrivateKey get address from private key netType: WAYKI_TESTNET or WAYKI_MAINTNET
func GetPrivateKeyFromMnemonic ¶
助记词转私钥 netType: WAYKI_TESTNET or WAYKI_MAINTNET
func GetPubKeyFromPrivateKey ¶
get publickey from privatekey
func SignAssetCreateTx ¶
func SignAssetCreateTx(privateKey string, param *AssetIssueTxParam) (string, error)
SignAssetIssueTx sign returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignAssetUpdateTx ¶
func SignAssetUpdateTx(privateKey string, param *AssetUpdateTxParam) (string, error)
SignAssetUpdateTx sign returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignCallContractTx ¶
func SignCallContractTx(privateKey string, param *CallContractTxParam) (string, error)
SignCallContractTx sign for call contract tx returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignCdpLiquidateTx ¶
func SignCdpLiquidateTx(privateKey string, param *CdpLiquidateTxParam) (string, error)
SignCdpLiquidateTx sign for liquidate a cdp tx returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignCdpRedeemTx ¶
func SignCdpRedeemTx(privateKey string, param *CdpRedeemTxParam) (string, error)
SignCdpRedeemTx sign for redeem a cdp tx returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignCdpStakeTx ¶
func SignCdpStakeTx(privateKey string, param *CdpStakeTxParam) (string, error)
SignCdpStakeTx sign for create a cdp tx returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignCommonTx ¶
func SignCommonTx(privateKey string, param *CommonTxParam) (string, error)
SignCommonTx sign for common tx returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignDelegateTx ¶
func SignDelegateTx(privateKey string, param *DelegateTxParam) (string, error)
SignDelegateTx sign for delegate tx returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignDexBuyLimitTx ¶
func SignDexBuyLimitTx(privateKey string, param *DexLimitTxParam) (string, error)
SignDexBuyLimitTx sign for dex buy limit Price tx returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignDexCancelTx ¶
func SignDexCancelTx(privateKey string, param *DexCancelTxParam) (string, error)
SignDexMarketBuyTx sign for cancel dex tx returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignDexMarketBuyTx ¶
func SignDexMarketBuyTx(privateKey string, param *DexMarketTxParam) (string, error)
SignDexMarketBuyTx sign for dex buy market price tx returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignDexMarketSellTx ¶
func SignDexMarketSellTx(privateKey string, param *DexMarketTxParam) (string, error)
SignDexMarketSellTx sign for dex sell market price tx returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignDexSellLimitTx ¶
func SignDexSellLimitTx(privateKey string, param *DexLimitTxParam) (string, error)
SignDexSellLimitTx sign for dex sell limit price tx returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignRegisterAccountTx ¶
func SignRegisterAccountTx(privateKey string, param *RegisterAccountTxParam) (string, error)
SignRegisterAccountTx sign for register account tx returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignRegisterContractTx ¶
func SignRegisterContractTx(privateKey string, param *RegisterContractTxParam) (string, error)
SignRegisterContractTx sign for call register contract tx returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignUCoinCallContractTx ¶
func SignUCoinCallContractTx(privateKey string, param *UCoinContractTxParam) (string, error)
SignUCoinCallContractTx sign for call contract tx returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignUCoinRegisterContractTx ¶
func SignUCoinRegisterContractTx(privateKey string, param *UCoinRegisterContractTxParam) (string, error)
SignUCoinRegisterContractTx sign for call register contract tx returns the signature hex string and nil error, or returns empty string and the error if it has error
func SignUCoinTransferTx ¶
func SignUCoinTransferTx(privateKey string, param *UCoinTransferTxParam) (string, error)
SignUCoinTransferTx sign for Multi-currency transfer returns the signature hex string and nil error, or returns empty string and the error if it has error
Types ¶
type AssetIssueTxParam ¶
type AssetIssueTxParam struct { ValidHeight int64 // valid height Within the height of the latest block SrcRegId string // the reg id of the register Fees int64 FeeSymbol string //Fee Type (WICC/WUSD) AssetSymbol string //From Coin Type AssetName string AssetTotal int64 AssetOwner string //owner regid MinTable bool }
type AssetModel ¶
type AssetModel struct { AssetAmount int64 //stake asset amount AssetSymbol string //stake asset symbol }
cdp stake Asset
type AssetModels ¶
type AssetModels struct {
// contains filtered or unexported fields
}
cdp stake asset list
func NewCdpAssets ¶
func NewCdpAssets() *AssetModels
func (*AssetModels) Add ¶
func (assetModels *AssetModels) Add(model *AssetModel)
type AssetUpdateTxParam ¶
type AssetUpdateTxParam struct { ValidHeight int64 // valid height Within the height of the latest block SrcRegId string // the reg id of the register Fees int64 UpdateType int FeeSymbol string //Fee Type (WICC/WUSD) AssetSymbol string //From Coin Type AssetName string AssetTotal int64 AssetOwner string //owner regid }
type CallContractTxParam ¶
type CallContractTxParam struct { ValidHeight int64 // valid height Within the height of the latest block SrcRegId string // the reg id of the caller AppId string // the reg id of the contract app Fees int64 // fees for mining Values int64 // the values send to the contract app ContractHex string // the command of contract, hex format PubKey string }
CallContractTxParam param of the call contract tx
type CdpLiquidateTxParam ¶
type CdpLiquidateTxParam struct { ValidHeight int64 // valid height Within the height of the latest block SrcRegId string // the reg id of the register PubKey string FeeSymbol string Fees int64 // fees for mining CdpTxid string // target CDP to liquidate ScoinsLiquidate int64 // partial liquidation is allowed, must include penalty fees in AssetSymbol string //stake asset symbol }
Cdp Redeem param of the tx
type CdpRedeemTxParam ¶
type CdpRedeemTxParam struct { ValidHeight int64 // valid height Within the height of the latest block SrcRegId string // the reg id of the register PubKey string FeeSymbol string Fees int64 // fees for mining CdpTxid string ScoinsToRepay int64 //repay coin number Assets *AssetModels }
Cdp Redeem param of the tx
type CdpStakeTxParam ¶
type CdpStakeTxParam struct { ValidHeight int64 // valid height Within the height of the latest block SrcRegId string // the reg id of the register PubKey string FeeSymbol string Fees int64 // fees for mining CdpTxid string ScoinSymbol string //get coin symbol ScoinMint int64 // get coin amount Assets *AssetModels }
Cdp Stake param of the tx
type CommonTxParam ¶
type CommonTxParam struct { ValidHeight int64 // valid height Within the height of the latest block SrcRegId string // the source reg id that the transaction send from DestAddr string // the dest address that the transaction send to Values int64 // transfer values Fees int64 // fees for mining PubKey string Memo string }
type DelegateTxParam ¶
type DelegateTxParam struct { ValidHeight int64 // valid height Within the height of the latest block SrcRegId string // the reg id of the voter Fees int64 // fees for mining Votes *OperVoteFunds // vote list PubKey string }
DelegateTxParam param of the delegate tx
type DestArr ¶
type DestArr struct {
// contains filtered or unexported fields
}
func NewDestArr ¶
func NewDestArr() *DestArr
type DexCancelTxParam ¶
type DexLimitTxParam ¶
type DexLimitTxParam struct { ValidHeight int64 // valid height Within the height of the latest block SrcRegId string // the reg id of the register PubKey string FeeSymbol string Fees int64 // fees for mining AssetSymbol string CoinSymbol string AssetAmount int64 Price int64 }
Dex Sell Limit param of the tx
type DexMarketTxParam ¶
type DexMarketTxParam struct { ValidHeight int64 // valid height Within the height of the latest block SrcRegId string // the reg id of the register PubKey string FeeSymbol string Fees int64 // fees for mining AssetSymbol string CoinSymbol string AssetAmount int64 }
Dex market Sell param of the tx
type Mnemonic ¶
func NewMnemonicWithDefaultOption ¶
func NewMnemonicWithDefaultOption() *Mnemonic
func NewMnemonicWithLanguage ¶
func (*Mnemonic) GenerateMnemonic ¶
New mnemonic follow the wordlists
func (*Mnemonic) GenerateSeed ¶
Generate seed from mnemonic and pass( optional )
type OperVoteFund ¶
type OperVoteFund struct { PubKey []byte //< public key, binary format VoteValue int64 //< add fund if >= 0, minus fund if < 0 }
OperVoteFund operation of vote fund
type OperVoteFunds ¶
type OperVoteFunds struct {
// contains filtered or unexported fields
}
OperVoteFunds array of OperVoteFund
func NewOperVoteFunds ¶
func NewOperVoteFunds() *OperVoteFunds
NewOperVoteFunds create new OperVoteFunds
func (*OperVoteFunds) Add ¶
func (votes *OperVoteFunds) Add(fund *OperVoteFund)
Add element to OperVoteFund pubKey is binary bytes voteValue add fund if >= 0, minus fund if < 0
func (*OperVoteFunds) Get ¶
func (votes *OperVoteFunds) Get(index int) *OperVoteFund
Get element of OperVoteFund by index
func (*OperVoteFunds) Len ¶
func (votes *OperVoteFunds) Len(index int) int
Len get the length of OperVoteFunds
type RegisterAccountTxParam ¶
type RegisterAccountTxParam struct { ValidHeight int64 // valid height Within the height of the latest block Fees int64 // fees for mining }
RegisterAccountTxParam register account tx param
type RegisterContractTxParam ¶
type RegisterContractTxParam struct { ValidHeight int64 // valid height Within the height of the latest block SrcRegId string // the reg id of the register Fees int64 // fees for mining Script []byte // the contract script, binary format Description string // description of contract }
RegisterContractTxParam param of the register contract tx
type SignMessageParam ¶
func SignMessage ¶
func SignMessage(privateKey string, message string) (*SignMessageParam, error)
Sign message by private Key
type UCoinContractTxParam ¶
type UCoinContractTxParam struct { ValidHeight int64 // valid height Within the height of the latest block SrcRegId string // the reg id of the caller AppId string // the reg id of the contract app Fees int64 // fees for mining CoinAmount int64 // the values send to the contract app ContractHex string // the command of contract, hex format PubKey string FeeSymbol string //Fee Type (WICC/WUSD) CoinSymbol string //From Coin Type }
UCoin Contract param of the tx
type UCoinRegisterContractTxParam ¶
type UCoinRegisterContractTxParam struct { ValidHeight int64 // valid height Within the height of the latest block SrcRegId string // the reg id of the register Fees int64 // fees for mining FeeSymbol string //WICC/WUSD Script []byte // the contract script, binary format Description string // description of contract }
RegisterUCoinContractTxParam param of the register contract tx
type UCoinTransferTxParam ¶
type UCoinTransferTxParam struct { ValidHeight int64 // valid height Within the height of the latest block SrcRegId string // the reg id of the register PubKey string FeeSymbol string Fees int64 // fees for mining Dests *DestArr Memo string }
UCoin Transfer param of the tx
Directories ¶
Path | Synopsis |
---|---|
Package bip32 provides ...
|
Package bip32 provides ... |
base58
Package base58 provides ...
|
Package base58 provides ... |
bytes
Package bytes provides ...
|
Package bytes provides ... |
ec
Package address provides ...
|
Package address provides ... |
hash
Package utils provides ...
|
Package utils provides ... |
wif
Package wif provides ...
|
Package wif provides ... |