Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Hash = graphql.NewScalar(graphql.ScalarConfig{ Name: "Hash", Description: "Hash represents the 32 byte Keccak256 hash of arbitrary data.", Serialize: coerceString, ParseValue: coerceString, ParseLiteral: func(valueAST ast.Value) interface{} { switch valueAST := valueAST.(type) { case *ast.StringValue: return common.HexToHash(valueAST.Value) } return nil }, }) Hex = graphql.NewScalar(graphql.ScalarConfig{ Name: "Hex", Description: "Hex is a hexadecimal string", Serialize: coerceString, ParseValue: coerceString, ParseLiteral: func(valueAST ast.Value) interface{} { switch valueAST := valueAST.(type) { case *ast.StringValue: if isHex(valueAST.Value) { return valueAST.Value } return nil } return nil }, }) Uint64 = graphql.NewScalar(graphql.ScalarConfig{ Name: "Uint64", Description: "", Serialize: coerceUint64, ParseValue: coerceUint64, ParseLiteral: func(valueAST ast.Value) interface{} { switch valueAST := valueAST.(type) { case *ast.StringValue: v, err := strconv.ParseUint(valueAST.Value, 10, 64) if err != nil { glog.Error(err) return nil } return v case *ast.IntValue: v, err := strconv.ParseUint(valueAST.Value, 10, 64) if err != nil { glog.Error(err) return nil } return v } return nil }, }) Uint32 = graphql.NewScalar(graphql.ScalarConfig{ Name: "Uint32", Description: "", Serialize: coerceUint32, ParseValue: coerceUint32, ParseLiteral: func(valueAST ast.Value) interface{} { switch valueAST := valueAST.(type) { case *ast.StringValue: v, err := strconv.ParseUint(valueAST.Value, 10, 32) if err != nil { glog.Error(err) return nil } return uint32(v) case *ast.IntValue: v, err := strconv.ParseUint(valueAST.Value, 10, 32) if err != nil { glog.Error(err) return nil } return uint32(v) } return nil }, }) Address = graphql.NewScalar(graphql.ScalarConfig{ Name: "Address", Description: "Address represents the 20 byte address of an Ethereum account.", Serialize: coerceString, ParseValue: coerceString, ParseLiteral: func(valueAST ast.Value) interface{} { switch valueAST := valueAST.(type) { case *ast.StringValue: return common.HexToAddress(valueAST.Value) } return nil }, }) )
scalar Hash scalar Address scalar Hex scalar Uint64 scalar Uint32
View Source
var BlockBodyObject = graphql.NewObject(graphql.ObjectConfig{ Name: "BlockBody", Fields: graphql.Fields{ "TxHashes": {Type: graphql.NewList(graphql.String)}, }, })
View Source
var BlockHeaderObject = graphql.NewObject(graphql.ObjectConfig{ Name: "BlockHeader", Fields: graphql.Fields{ "Prevhash": {Type: graphql.String}, "Timestamp": {Type: Uint64}, "Height": {Type: Uint64}, "StateRoot": {Type: graphql.String}, "TransactionRoot": {Type: graphql.String}, "ReceiptsRoot": {Type: graphql.String}, "QuotaUsed": {Type: Uint64}, "QuotaLimit": {Type: Uint64}, "Proposer": {Type: graphql.String}, }, })
View Source
var CryptoEnum = graphql.NewEnum(graphql.EnumConfig{ Name: "Crypto", Values: graphql.EnumValueConfigMap{ "SECP": &graphql.EnumValueConfig{Value: 0}, "SM2": &graphql.EnumValueConfig{Value: 1}, }, })
View Source
var LogEntryObject = graphql.NewObject(graphql.ObjectConfig{ Name: "LogEntry", Fields: graphql.Fields{ "address": {Type: Address}, "topics": {Type: graphql.NewList(Hex)}, "data": {Type: Hex}, }, })
View Source
var ReceiptObject = graphql.NewObject(graphql.ObjectConfig{ Name: "Receipt", Fields: graphql.Fields{ "block_height": {Type: Uint64}, "quota_used": {Type: Uint64}, "quota": {Type: Uint64}, "log_bloom": {Type: Hex}, "error": {Type: graphql.String}, "state_root": {Type: graphql.String}, "transaction_hash": {Type: Hex}, "contract_address": {Type: Hex}, "logs": {Type: graphql.NewList(LogEntryObject)}, }, })
View Source
var TransactionInput = graphql.NewInputObject(graphql.InputObjectConfig{ Name: "TransactionInput", Fields: graphql.InputObjectConfigFieldMap{ "to": {Type: Address}, "nonce": {Type: graphql.String}, "quota": {Type: graphql.NewNonNull(Uint64)}, "valid_until_block": {Type: Uint64}, "data": {Type: Hex}, "value": {Type: Hex}, "chain_id": {Type: graphql.NewNonNull(Uint32)}, "version": {Type: Uint32}, }, })
View Source
var TransactionObject = graphql.NewObject(graphql.ObjectConfig{ Name: "Transaction", Fields: graphql.Fields{ "to": {Type: Address}, "nonce": {Type: graphql.String}, "quota": {Type: graphql.NewNonNull(Uint64)}, "valid_until_block": {Type: Uint64}, "data": {Type: Hex}, "value": {Type: Hex}, "chain_id": {Type: graphql.NewNonNull(Uint32)}, "version": {Type: Uint32}, }, })
Functions ¶
This section is empty.
Types ¶
type BlockHeader ¶
type BlockHeader struct { Prevhash string `json:"prevhash" mapstructure:"prevhash"` Timestamp uint64 `json:"timestamp" mapstructure:"timestamp"` Height uint64 `json:"height" mapstructure:"height"` StateRoot string `json:"state_root" mapstructure:"state_root"` TransactionRoot string `json:"transactions_root" mapstructure:"transactions_root"` ReceiptsRoot string `json:"receipts_root" mapstructure:"receipts_root"` QuotaUsed uint64 `json:"quota_used" mapstructure:"quota_used"` QuotaLimit uint64 `json:"quota_limit" mapstructure:"quota_limit"` Proposer string `json:"proposer" mapstructure:"proposer"` }
type Receipt ¶
type Receipt struct { BlockHeight uint64 `json:"block_height" mapstructure:"quota_used"` QuotaUsed uint64 `json:"quota_used" mapstructure:"quota_used"` Quota uint64 `json:"quota" mapstructure:"quota"` LogBloom string `json:"log_bloom" mapstructure:"log_bloom"` Error string `json:"error" mapstructure:"error"` StateRoot string `json:"state_root" mapstructure:"state_root"` TransactionHash string `json:"transaction_hash" mapstructure:"transaction_hash"` ContractAddress string `json:"contract_address" mapstructure:"contract_address"` Logs []*LogEntry `json:"logs" mapstructure:"logs"` }
type Transaction ¶
type Transaction struct { To common.Address `json:"to" mapstructure:"to"` Nonce string `json:"nonce" mapstructure:"nonce"` Quota uint64 `json:"quota" mapstructure:"quota"` ValidUntilBlock uint64 `json:"valid_until_block" mapstructure:"valid_until_block"` Data string `json:"data" mapstructure:"data"` Value string `json:"value" mapstructure:"value"` ChainID uint32 `json:"chain_id" mapstructure:"chain_id"` Version uint32 `json:"version" mapstructure:"version"` }
type UnsafeTransaction ¶
type UnsafeTransaction struct { Transaction Transaction `json:"transaction" mapstructure:"transaction"` Crypto int32 `json:"crypto" mapstructure:"crypto"` PrivateKey string `json:"privateKey" mapstructure:"privateKey"` }
type UnverifiedTransaction ¶
type UnverifiedTransaction struct { Transaction Transaction `json:"transaction" mapstructure:"transaction"` Crypto int32 `json:"crypto" mapstructure:"crypto"` Signature string `json:"signature" mapstructure:"signature"` }
Click to show internal directories.
Click to hide internal directories.