block

package
v0.0.0-...-bd0efcb Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
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 */
)
View Source
const Baas20BurnPauseABI = "" /* 6093-byte string literal not displayed */
View Source
const Baas20BurnPauseMintABI = "" /* 7197-byte string literal not displayed */
View Source
const Baas20BurnPauseMintCapABI = "" /* 7408-byte string literal not displayed */
View Source
const Baas20StandardABI = "" /* 4117-byte string literal not displayed */
View Source
const Baas721ABI = "" /* 9527-byte string literal not displayed */

Variables

View Source
var (
	StormClient     *storm.EthRPC
	BigHelper       = big.NewInt(10)
	Wei             = BigHelper.Exp(BigHelper, big.NewInt(18), nil)
	Abi             abi.ABI
	GasCheckMinimum = 0.001
	GasPrice        int64
)
View Source
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"
)
View Source
var (
	NetworkID = "4452999"
)

Functions

func ExtractCipher

func ExtractCipher(c string) ([]byte, []byte)

return two array byte, first is 8 byte, second is 12 byte

func FloatToBigInt

func FloatToBigInt(val float64) *big.Int

func InitBlockService

func InitBlockService()

block service first connect storm block chain service

func IntStringToHex

func IntStringToHex(str string) string

func Padding

func Padding(src []byte, blockSize int) []byte

func SignAndSendTx

func SignAndSendTx(st storm.T, privateKey string) (*storm.TransactionReceipt, error)

sign struct for raw message

func UnPadding

func UnPadding(src []byte) []byte

func UnPaddingStr

func UnPaddingStr(src []byte) []byte

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 (s *Service) AllowanceErc20(ctx context.Context, addr, toAddr, contract string) (string, error)

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) BurnErc20

func (s *Service) BurnErc20(ctx context.Context, addr, password, contract string, value float64, gas int64) (string, error)

func (*Service) ChangePassword

func (s *Service) ChangePassword(ctx context.Context, email, oldpass, newpass string) error

change password with email oldpass, and newpass

func (*Service) Create

func (s *Service) Create(ctx context.Context, n *baas.NewBAASUser) (*baas.BAASUser, error)

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 (s *Service) CreateErc721Token(ctx context.Context, userid, password, contract, tokenid, meta, property string, gas int64) (string, error)

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 (s *Service) DecryptKey(origin, cipherFromWeb, cipherFromDb, rv, salt string) (string, error)

func (*Service) DeleteBAASUser

func (s *Service) DeleteBAASUser(ctx context.Context, id string) error

func (*Service) DeleteKey

func (s *Service) DeleteKey(ctx context.Context, id, password, applicationid string) error

remove a key

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 (s *Service) GetAddress(ctx context.Context, id, password string) (string, error)

func (*Service) GetAddressFromPK

func (s *Service) GetAddressFromPK(ctx context.Context, pk string) (string, error)

func (*Service) GetApplicationUsers

func (s *Service) GetApplicationUsers(ctx context.Context, id string, page, limit int) ([]*baas.BAASUser, error)

func (*Service) GetBalance

func (s *Service) GetBalance(ctx context.Context, addr string) (string, error)

func (*Service) GetBlockNumber

func (s *Service) GetBlockNumber(ctx context.Context) (string, error)

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 (s *Service) GetERC20TxList(ctx context.Context, contract, page, pagesize string) (string, error)

func (*Service) GetErc20Balance

func (s *Service) GetErc20Balance(ctx context.Context, userid, addr string) (string, error)

get user in erc20 contract hash

func (*Service) GetErc20Decimal

func (s *Service) GetErc20Decimal(ctx context.Context, addr string) (string, error)

func (*Service) GetErc20Info

func (s *Service) GetErc20Info(ctx context.Context, addr string) (map[string]interface{}, error)

func (*Service) GetErc20PauseStatus

func (s *Service) GetErc20PauseStatus(ctx context.Context, contract string) (string, error)

func (*Service) GetErc20TotalSupply

func (s *Service) GetErc20TotalSupply(ctx context.Context, addr string) (string, error)

func (*Service) GetErc20TxMemo

func (s *Service) GetErc20TxMemo(ctx context.Context, hash string) (string, error)

func (*Service) GetErc721Balance

func (s *Service) GetErc721Balance(ctx context.Context, addr, contractAddr string) (string, error)

func (*Service) GetErc721Info

func (s *Service) GetErc721Info(ctx context.Context, addr string) (map[string]interface{}, error)

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 (s *Service) GetErc721TokenTxList(ctx context.Context, contract, tokenid, page, size string) (string, error)

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 (s *Service) GetErc721TotalSupply(ctx context.Context, addr string) (string, error)

func (*Service) GetErc721TxList

func (s *Service) GetErc721TxList(ctx context.Context, contract, page, size string) (string, error)

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) GetKey

func (s *Service) GetKey(ctx context.Context, id, password, ciperText string) (string, error)

func (*Service) GetKeyStoreFromPK

func (s *Service) GetKeyStoreFromPK(ctx context.Context, pk, password string) (string, error)

func (*Service) GetPKFromKeyStore

func (s *Service) GetPKFromKeyStore(ctx context.Context, ks, password string) (string, error)

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) GetTx

func (s *Service) GetTx(ctx context.Context, addr string) (*baas.BlockTx, error)

func (*Service) GetTxByHash

func (s *Service) GetTxByHash(ctx context.Context, hash string) (string, error)

encaspulate tx to json string and return

func (*Service) GetTxByUserAddress

func (s *Service) GetTxByUserAddress(ctx context.Context, usrid, page, size string) (string, error)

encaspulate tx to json string and return

func (*Service) GetUserErc721TokenList

func (s *Service) GetUserErc721TokenList(ctx context.Context, userid, contractaddr string) (string, error)

func (*Service) Import

func (s *Service) Import(ctx context.Context, n *baas.NewBAASUser) (*baas.BAASUser, error)

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) MintErc20

func (s *Service) MintErc20(ctx context.Context, addr, password, contract string, value float64, gas int64) (string, error)

func (*Service) PauseErc20

func (s *Service) PauseErc20(ctx context.Context, addr, password, contract string, value bool, gas int64) (string, error)

func (*Service) ReadMsg

func (s *Service) ReadMsg(ctx context.Context, hash, encode string) (string, string, error)

/ read msg from blockchain

func (*Service) RecoverKey

func (s *Service) RecoverKey(ctx context.Context, id string) (string, error)

func (*Service) SendErc20Token

func (s *Service) SendErc20Token(ctx context.Context, addr, password, toAddr, contract, memo string, value float64, gas int64) (string, error)

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

func (*Service) SendToken

func (s *Service) SendToken(ctx context.Context, addr, password, toAddr, value, msg, encode string, gas int64) (string, error)

func (*Service) SetErc721TokenProperty

func (s *Service) SetErc721TokenProperty(ctx context.Context, userid, password, contract, tokenid, property string, gas int64) (string, error)

func (*Service) TransferFromErc20

func (s *Service) TransferFromErc20(ctx context.Context, user, password, fromaddr, toAddr, contract, memo string, value float64, gas int64) (string, error)

func (*Service) UpdateBAASUser

func (s *Service) UpdateBAASUser(ctx context.Context, u *baas.UpdateBAASUser) (*baas.BAASUser, error)

func (*Service) WriteMsg

func (s *Service) WriteMsg(ctx context.Context, addr, password, toAddr, msg string, gas int64) (string, error)

Jump to

Keyboard shortcuts

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