Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractCipher(c string) ([]byte, []byte)
- func FloatToBigInt(val float64) *big.Int
- func InitBlockService()
- func IntStringToHex(str string) string
- func Padding(src []byte, blockSize int) []byte
- func SignAndSendTx(st storm.T, privateKey string) (*storm.TransactionReceipt, error)
- func UnPadding(src []byte) []byte
- func UnPaddingStr(src []byte) []byte
- type Service
- func (s *Service) AddErc721TokenMemo(ctx context.Context, userid, password, contract, tokenid, memo string, ...) (string, error)
- func (s *Service) AllowanceErc20(ctx context.Context, addr, toAddr, contract string) (string, error)
- func (s *Service) ApproveErc20(ctx context.Context, addr, password, toAddr, contract string, value float64, ...) (string, error)
- func (s *Service) BurnErc20(ctx context.Context, addr, password, contract string, value float64, gas int64) (string, error)
- func (s *Service) ChangePassword(ctx context.Context, email, oldpass, newpass string) error
- func (s *Service) Create(ctx context.Context, n *baas.NewBAASUser) (*baas.BAASUser, error)
- func (s *Service) CreateERC721Contract(ctx context.Context, userid, pass, name, symbol, class string) (string, string, error)
- func (s *Service) CreateErc721Token(ctx context.Context, ...) (string, error)
- func (s *Service) DecresaseAllowanceErc20(ctx context.Context, addr, password, toAddr, contract string, value float64, ...) (string, error)
- func (s *Service) DecryptKey(origin, cipherFromWeb, cipherFromDb, rv, salt string) (string, error)
- func (s *Service) DeleteBAASUser(ctx context.Context, id string) error
- func (s *Service) DeleteKey(ctx context.Context, id, password, applicationid string) error
- func (s *Service) DeployERC20Contract(ctx context.Context, userid, password, name, symbol, class string, ...) (string, string, error)
- func (s *Service) GetAddress(ctx context.Context, id, password string) (string, error)
- func (s *Service) GetAddressFromPK(ctx context.Context, pk string) (string, error)
- func (s *Service) GetApplicationUsers(ctx context.Context, id string, page, limit int) ([]*baas.BAASUser, error)
- func (s *Service) GetBalance(ctx context.Context, addr string) (string, error)
- func (s *Service) GetBlockNumber(ctx context.Context) (string, error)
- func (s *Service) GetERC20TxByUserAddress(ctx context.Context, userid, contract, page, pagesize string) (string, error)
- func (s *Service) GetERC20TxList(ctx context.Context, contract, page, pagesize string) (string, error)
- func (s *Service) GetErc20Balance(ctx context.Context, userid, addr string) (string, error)
- func (s *Service) GetErc20Decimal(ctx context.Context, addr string) (string, error)
- func (s *Service) GetErc20Info(ctx context.Context, addr string) (map[string]interface{}, error)
- func (s *Service) GetErc20PauseStatus(ctx context.Context, contract string) (string, error)
- func (s *Service) GetErc20TotalSupply(ctx context.Context, addr string) (string, error)
- func (s *Service) GetErc20TxMemo(ctx context.Context, hash string) (string, error)
- func (s *Service) GetErc721Balance(ctx context.Context, addr, contractAddr string) (string, error)
- func (s *Service) GetErc721Info(ctx context.Context, addr string) (map[string]interface{}, error)
- func (s *Service) GetErc721MetaData(ctx context.Context, contractaddr, tokenid string) (string, error)
- func (s *Service) GetErc721TokenMemoList(ctx context.Context, contractaddr, tokenid string) (string, error)
- func (s *Service) GetErc721TokenProperty(ctx context.Context, contractaddr, tokenid string) (string, error)
- func (s *Service) GetErc721TokenTxList(ctx context.Context, contract, tokenid, page, size string) (string, error)
- func (s *Service) GetErc721TokenTxListByUser(ctx context.Context, userid, contract, tokenid, page, size string) (string, error)
- func (s *Service) GetErc721TotalSupply(ctx context.Context, addr string) (string, error)
- func (s *Service) GetErc721TxList(ctx context.Context, contract, page, size string) (string, error)
- func (s *Service) GetErc721TxListByUser(ctx context.Context, userid, contract, page, size string) (string, error)
- func (s *Service) GetKey(ctx context.Context, id, password, ciperText string) (string, error)
- func (s *Service) GetKeyStoreFromPK(ctx context.Context, pk, password string) (string, error)
- func (s *Service) GetPKFromKeyStore(ctx context.Context, ks, password string) (string, error)
- func (s *Service) GetPeerToPeerTxByUserAddress(ctx context.Context, usrid, targetid, page, size string) (string, error)
- func (s *Service) GetSendErc721TokenMemo(ctx context.Context, contractaddr, tokenid, txhash string) (string, error)
- func (s *Service) GetTx(ctx context.Context, addr string) (*baas.BlockTx, error)
- func (s *Service) GetTxByHash(ctx context.Context, hash string) (string, error)
- func (s *Service) GetTxByUserAddress(ctx context.Context, usrid, page, size string) (string, error)
- func (s *Service) GetUserErc721TokenList(ctx context.Context, userid, contractaddr string) (string, error)
- func (s *Service) Import(ctx context.Context, n *baas.NewBAASUser) (*baas.BAASUser, error)
- func (s *Service) IncreaseAllowanceErc20(ctx context.Context, addr, password, toAddr, contract string, value float64, ...) (string, error)
- func (s *Service) MintErc20(ctx context.Context, addr, password, contract string, value float64, gas int64) (string, error)
- func (s *Service) PauseErc20(ctx context.Context, addr, password, contract string, value bool, gas int64) (string, error)
- func (s *Service) ReadMsg(ctx context.Context, hash, encode string) (string, string, error)
- func (s *Service) RecoverKey(ctx context.Context, id string) (string, error)
- func (s *Service) SendErc20Token(ctx context.Context, addr, password, toAddr, contract, memo string, ...) (string, error)
- func (s *Service) SendErc721Token(ctx context.Context, addr, pass, contract, tokenid, memo, targetid string, ...) (string, error)
- func (s *Service) SendToken(ctx context.Context, addr, password, toAddr, value, msg, encode string, ...) (string, error)
- func (s *Service) SetErc721TokenProperty(ctx context.Context, userid, password, contract, tokenid, property string, ...) (string, error)
- func (s *Service) TransferFromErc20(ctx context.Context, user, password, fromaddr, toAddr, contract, memo string, ...) (string, error)
- func (s *Service) UpdateBAASUser(ctx context.Context, u *baas.UpdateBAASUser) (*baas.BAASUser, error)
- func (s *Service) WriteMsg(ctx context.Context, addr, password, toAddr, msg string, gas int64) (string, error)
Constants ¶
const ( Sign721Log1 = "0x123392ef4dfc825252c018e5fdcbb56bd895e4f681eba5e936e164009a05f435" Sign721Log2 = "0x4a62fa304d9a5993f36546283e9d483bc1cb4909a24a0bb0104fb47505caea20" Baas721Code = "" /* 31770-byte string literal not displayed */ Baas20BaseCode = "" /* 9302-byte string literal not displayed */ Baas20BurnPauseCode = "" /* 16046-byte string literal not displayed */ Baas20BurnPauseMintCode = "" /* 18174-byte string literal not displayed */ Baas20BurnPauseMintCapCode = "" /* 19148-byte string literal not displayed */ )
const Baas20BurnPauseABI = "" /* 6093-byte string literal not displayed */
const Baas20BurnPauseMintABI = "" /* 7197-byte string literal not displayed */
const Baas20BurnPauseMintCapABI = "" /* 7408-byte string literal not displayed */
const Baas20StandardABI = "" /* 4117-byte string literal not displayed */
const Baas721ABI = "" /* 9527-byte string literal not displayed */
Variables ¶
var ( StormClient *storm.EthRPC BigHelper = big.NewInt(10) Wei = BigHelper.Exp(BigHelper, big.NewInt(18), nil) Abi abi.ABI GasCheckMinimum = 0.001 GasPrice int64 )
var ( BackEndGetAddressTx = "/api/v1/wallets/%s/tx" BackEndPeerToPeerTx = "/api/v1/wallets/%s/%s/txfilter" BackEndPeerToERC20Tx = "/api/v1/wallets/%s/%s/tx" BackEndPeerToERC721Tx = "/api/v1/wallets/%s/%s/tx" BackEndPeerERC721TokenTx = "/api/v1/erc721/%s/%s/%s/tokentx" )
var (
NetworkID = "4452999"
)
Functions ¶
func ExtractCipher ¶
return two array byte, first is 8 byte, second is 12 byte
func FloatToBigInt ¶
func InitBlockService ¶
func InitBlockService()
block service first connect storm block chain service
func IntStringToHex ¶
func SignAndSendTx ¶
sign struct for raw message
func UnPaddingStr ¶
Types ¶
type Service ¶
type Service struct { BlockStorage baas.BlockStorage ApplicationService baas.ApplicationService EncryptionService baas.EncryptionService GmService baas.EncryptionService UsageService baas.UsageService Log zerolog.Logger }
func (*Service) AddErc721TokenMemo ¶
func (s *Service) AddErc721TokenMemo(ctx context.Context, userid, password, contract, tokenid, memo string, gas int64) (string, error)
add memo to a 721 token
func (*Service) AllowanceErc20 ¶
func (*Service) ApproveErc20 ¶
func (s *Service) ApproveErc20(ctx context.Context, addr, password, toAddr, contract string, value float64, gas int64) (string, error)
ERC20 Approve interface
func (*Service) ChangePassword ¶
change password with email oldpass, and newpass
func (*Service) CreateERC721Contract ¶
func (s *Service) CreateERC721Contract(ctx context.Context, userid, pass, name, symbol, class string) (string, string, error)
Create new 721 token
func (*Service) CreateErc721Token ¶
func (*Service) DecresaseAllowanceErc20 ¶
func (s *Service) DecresaseAllowanceErc20(ctx context.Context, addr, password, toAddr, contract string, value float64, gas int64) (string, error)
ERC20 Approve interface
func (*Service) DecryptKey ¶
func (*Service) DeleteBAASUser ¶
func (*Service) DeployERC20Contract ¶
func (s *Service) DeployERC20Contract(ctx context.Context, userid, password, name, symbol, class string, total uint64, decimal uint8, capacity uint64) (string, string, error)
user create new ERC20 contranct with type
func (*Service) GetAddress ¶
func (*Service) GetAddressFromPK ¶
func (*Service) GetApplicationUsers ¶
func (*Service) GetBalance ¶
func (*Service) GetBlockNumber ¶
func (*Service) GetERC20TxByUserAddress ¶
func (s *Service) GetERC20TxByUserAddress(ctx context.Context, userid, contract, page, pagesize string) (string, error)
return erc20 a user tx list
func (*Service) GetERC20TxList ¶
func (*Service) GetErc20Balance ¶
get user in erc20 contract hash
func (*Service) GetErc20Decimal ¶
func (*Service) GetErc20Info ¶
func (*Service) GetErc20PauseStatus ¶
func (*Service) GetErc20TotalSupply ¶
func (*Service) GetErc20TxMemo ¶
func (*Service) GetErc721Balance ¶
func (*Service) GetErc721Info ¶
func (*Service) GetErc721MetaData ¶
func (s *Service) GetErc721MetaData(ctx context.Context, contractaddr, tokenid string) (string, error)
Get Erc721 token 's metadata
func (*Service) GetErc721TokenMemoList ¶
func (s *Service) GetErc721TokenMemoList(ctx context.Context, contractaddr, tokenid string) (string, error)
获取 memo list search by
func (*Service) GetErc721TokenProperty ¶
func (s *Service) GetErc721TokenProperty(ctx context.Context, contractaddr, tokenid string) (string, error)
获取property
func (*Service) GetErc721TokenTxList ¶
func (*Service) GetErc721TokenTxListByUser ¶
func (s *Service) GetErc721TokenTxListByUser(ctx context.Context, userid, contract, tokenid, page, size string) (string, error)
encaspulate tx to json string and return
func (*Service) GetErc721TotalSupply ¶
func (*Service) GetErc721TxList ¶
encaspulate tx to json string and return
func (*Service) GetErc721TxListByUser ¶
func (s *Service) GetErc721TxListByUser(ctx context.Context, userid, contract, page, size string) (string, error)
encaspulate tx to json string and return
func (*Service) GetKeyStoreFromPK ¶
func (*Service) GetPKFromKeyStore ¶
func (*Service) GetPeerToPeerTxByUserAddress ¶
func (s *Service) GetPeerToPeerTxByUserAddress(ctx context.Context, usrid, targetid, page, size string) (string, error)
encaspulate tx to json string and return
func (*Service) GetSendErc721TokenMemo ¶
func (s *Service) GetSendErc721TokenMemo(ctx context.Context, contractaddr, tokenid, txhash string) (string, error)
获取 memo search by blocknumber
func (*Service) GetTxByHash ¶
encaspulate tx to json string and return
func (*Service) GetTxByUserAddress ¶
encaspulate tx to json string and return
func (*Service) GetUserErc721TokenList ¶
func (*Service) IncreaseAllowanceErc20 ¶
func (s *Service) IncreaseAllowanceErc20(ctx context.Context, addr, password, toAddr, contract string, value float64, gas int64) (string, error)
ERC20 Approve interface
func (*Service) PauseErc20 ¶
func (*Service) RecoverKey ¶
func (*Service) SendErc20Token ¶
func (*Service) SendErc721Token ¶
func (s *Service) SendErc721Token(ctx context.Context, addr, pass, contract, tokenid, memo, targetid string, gas int64) (string, error)
send a 721 to other