eosjs 文档(Serialize)

Serialize

  • SerialBuffer
  • SerializerState

接口

  • Action
  • Authorization
  • Contract
  • CreateTypeArgs
  • Field
  • SerializedAction
  • SerializerOptions
  • Symbol
  • Type

函数

  • arrayToHex
  • blockTimestampToDate
  • checkDateParse
  • checkRange
  • createInitialTypes
  • createType
  • dateToBlockTimestamp
  • dateToTimePoint
  • dateToTimePointSec
  • deserializeAction
  • deserializeActionData
  • deserializeArray
  • deserializeExtension
  • deserializeOptional
  • deserializeStruct
  • deserializeUnknown
  • deserializeVariant
  • getType
  • getTypesFromAbi
  • hexToUint8Array
  • serializeAction
  • serializeActionData
  • serializeArray
  • serializeExtension
  • serializeOptional
  • serializeStruct
  • serializeUnknown
  • serializeVariant
  • stringToSymbol
  • supportedAbiVersion
  • symbolToString
  • timePointSecToDate
  • timePointToDate
  • transactionHeader

函数

arrayToHex

arrayToHex(data: Uint8Array): string

定义于eosjs-serialize.ts:592

将二进制数据转换为十六进制。

参数:

称号范例
dataUint8Array

返回:string

blockTimestampToDate

blockTimestampToDate(slot: number): string

定义于eosjs-serialize.ts:569

block_timestamp_type(自差别纪元以来的半秒)转换为ISO花样的日期。

参数:

称号范例
slotnumber

返回:string

checkDateParse

checkDateParse(date: string): number

定义于eosjs-serialize.ts:533

参数:

称号范例
datestring

返回:number

checkRange

checkRange(orig: number, converted: number): number

定义于eosjs-serialize.ts:765

参数:

称号范例
orignumber
convertednumber

返回:number

createInitialTypes

createInitialTypes(): Map<string, Type>

定义于eosjs-serialize.ts:776

建立内置到abi花样的范例集。

返回:Map<string, Type>

createType

createType(attrs: CreateTypeArgs): Type

定义于eosjs-serialize.ts:749

参数:

称号范例
attrsCreateTypeArgs

返回:Type

dateToBlockTimestamp

dateToBlockTimestamp(date: string): number

定义于eosjs-serialize.ts:564

将ISO花样的日期转换为block_timestamp_type(自差别纪元以来的半秒)。

参数:

称号范例
datestring

返回:number

dateToTimePoint

dateToTimePoint(date: string): number

定义于eosjs-serialize.ts:542

将ISO花样的日期转换为time_point(自纪元以来的毫秒数)。

参数:

称号范例
datestring

返回:number

dateToTimePointSec

dateToTimePointSec(date: string): number

定义于eosjs-serialize.ts:553

将ISO花样的日期转换为time_point_sec(自纪元以来的秒数)。

参数:

称号范例
datestring

返回:number

deserializeAction

deserializeAction(contract: Contract, account: string, name: string, authorization: Authorization[], data: string | Uint8Array | number[], textEncoder: TextEncoder, textDecoder: TextDecoder): Action

定义于eosjs-serialize.ts:1104

反序列化操纵,假如data是一个string,则假定它是十六进制。

参数:

称号范例
contractContract
accountstring
namestring
authorizationAuthorization[]
data string | Uint8Array | number[]
textEncoderTextEncoder
textDecoderTextDecoder

返回:Action

deserializeActionData

deserializeActionData(contract: Contract, account: string, name: string, data: string | Uint8Array | number[], textEncoder: TextEncoder, textDecoder: TextDecoder): any

定义于eosjs-serialize.ts:1088

反序列化操纵数据,假如data是一个string,则假定它是十六进制。

参数:

称号范例
contractContract
accountstring
namestring
data string | Uint8Array | number[]
textEncoderTextEncoder
textDecoderTextDecoder

返回:any

deserializeArray

deserializeArray(this: Type, buffer: SerialBuffer, state?: SerializerState, allowExtensions?: boolean): any[]

定义于eosjs-serialize.ts:700

参数:

称号范例
thisType
bufferSerialBuffer
Optional stateSerializerState
Optional allowExtensionsboolean

返回:any[]

deserializeExtension

deserializeExtension(this: Type, buffer: SerialBuffer, state?: SerializerState, allowExtensions?: boolean): any

定义于eosjs-serialize.ts:732

参数:

称号范例
thisType
bufferSerialBuffer
Optional stateSerializerState
Optional allowExtensionsboolean

返回:any

deserializeOptional

deserializeOptional(this: Type, buffer: SerialBuffer, state?: SerializerState, allowExtensions?: boolean): any

定义于eosjs-serialize.ts:719

参数:

称号范例
thisType
bufferSerialBuffer
Optional stateSerializerState
Optional allowExtensionsboolean

返回:any

deserializeStruct

deserializeStruct(this: Type, buffer: SerialBuffer, state?: SerializerState, allowExtensions?: boolean): any

定义于eosjs-serialize.ts:653

参数:

称号范例默认值
thisType
bufferSerialBuffer
Optional stateSerializerStatenew SerializerState()
Optional allowExtensionsbooleantrue

返回:any

deserializeUnknown

deserializeUnknown(buffer: SerialBuffer): SerialBuffer

定义于eosjs-serialize.ts:624

参数:

称号范例
bufferSerialBuffer

返回:SerialBuffer

deserializeVariant

deserializeVariant(this: Type, buffer: SerialBuffer, state?: SerializerState, allowExtensions?: boolean): any[]

定义于eosjs-serialize.ts:683

参数:

称号范例
thisType
bufferSerialBuffer
Optional stateSerializerState
Optional allowExtensionsboolean

返回:any[]

getType

getType(types: Map<string, Type>, name: string): Type

定义于eosjs-serialize.ts:974

types中猎取范例。

参数:

称号范例
typesMap<string, Type>
namestring

返回:Type

getTypesFromAbi

getTypesFromAbi(initialTypes: Map<string, Type>, abi: Abi): Map<string, Type>

定义于eosjs-serialize.ts:1014

从abi猎取范例。

参数:

称号范例形貌
initialTypesMap<string, Type>要构建的范例集,在大多数情况下,最好经由过程对getTypesFromAbi()的新调用来添补它
abiAbi

返回:Map<string, Type>

hexToUint8Array

hexToUint8Array(hex: string): Uint8Array

定义于eosjs-serialize.ts:601

将十六进制转换为二进制数据。

参数:

称号范例
hexstring

返回:Uint8Array

serializeAction

serializeAction(contract: Contract, account: string, name: string, authorization: Authorization[], data: any, textEncoder: TextEncoder, textDecoder: TextDecoder): SerializedAction

定义于eosjs-serialize.ts:1076

以序列化情势返回操纵。

参数:

称号范例
contractContract
accountstring
namestring
authorizationAuthorization[]
dataany
textEncoderTextEncoder
textDecoderTextDecoder

返回:SerializedAction

serializeActionData

serializeActionData(contract: Contract, account: string, name: string, data: any, textEncoder: TextEncoder, textDecoder: TextDecoder): string

定义于eosjs-serialize.ts:1064

将操纵数据转换为序列化情势(十六进制)。

参数:

称号范例
contractContract
accountstring
namestring
dataany
textEncoderTextEncoder
textDecoderTextDecoder

返回:string

serializeArray

serializeArray(this: Type, buffer: SerialBuffer, data: any[], state?: SerializerState, allowExtensions?: boolean): void

定义于eosjs-serialize.ts:692

参数:

称号范例
thisType
bufferSerialBuffer
dataany[]
Optional stateSerializerState
Optional allowExtensionsboolean

返回:void

serializeExtension

serializeExtension(this: Type, buffer: SerialBuffer, data: any, state?: SerializerState, allowExtensions?: boolean): void

定义于eosjs-serialize.ts:727

参数:

称号范例
thisType
bufferSerialBuffer
dataany
Optional stateSerializerState
Optional allowExtensionsboolean

返回:void

serializeOptional

serializeOptional(this: Type, buffer: SerialBuffer, data: any, state?: SerializerState, allowExtensions?: boolean): void

定义于eosjs-serialize.ts:709

参数:

称号范例
thisType
bufferSerialBuffer
dataany
Optional stateSerializerState
Optional allowExtensionsboolean

返回:void

serializeStruct

serializeStruct(this: Type, buffer: SerialBuffer, data: any, state?: SerializerState, allowExtensions?: boolean): void

定义于eosjs-serialize.ts:628

参数:

称号范例默认值
thisType
bufferSerialBuffer
dataany
Optional stateSerializerStatenew SerializerState()
Optional allowExtensionsbooleantrue

返回:void

serializeUnknown

serializeUnknown(buffer: SerialBuffer, data: any): SerialBuffer

定义于eosjs-serialize.ts:620

参数:

称号范例
bufferSerialBuffer
dataany

返回:SerialBuffer

serializeVariant

serializeVariant(this: Type, buffer: SerialBuffer, data: any, state?: SerializerState, allowExtensions?: boolean): void

定义于eosjs-serialize.ts:670

参数:

称号范例
thisType
bufferSerialBuffer
dataany
Optional stateSerializerState
Optional allowExtensionsboolean

返回:void

stringToSymbol

stringToSymbol(s: string): object

定义于eosjs-serialize.ts:575

string转换为Symbol,花样:precision,NAME

参数:

称号范例
sstring

返回:object

supportedAbiVersion

supportedAbiVersion(version: string): boolean

定义于eosjs-serialize.ts:529

这是受支撑的ABI版本吗?

参数:

称号范例
versionstring

返回:boolean

symbolToString

symbolToString(__namedParameters: object): string

定义于eosjs-serialize.ts:587

Symbol转换为string,花样:precision,NAME

参数:

__namedParameters:object

称号范例
namestring
precisionnumber

返回:string

timePointSecToDate

timePointSecToDate(sec: number): string

定义于eosjs-serialize.ts:558

time_point_sec(自纪元以来的秒数)转换为ISO花样的日期。

参数:

称号范例
secnumber

返回:string

timePointToDate

timePointToDate(us: number): string

定义于eosjs-serialize.ts:547

time_point(自纪元以来的毫秒数)转换为ISO花样的日期。

参数:

称号范例
usnumber

返回:string

transactionHeader

transactionHeader(refBlock: BlockTaposInfo, expireSeconds: number): object

定义于eosjs-serialize.ts:1055

TAPoS:返回援用refBlock的生意业务字段,并在refBlock.timestamp以后expireSeconds到期。

参数:

称号范例
refBlockBlockTaposInfo
expireSecondsnumber

返回:object

上一篇:RPC接口

下一篇:Serialize类

    原文作者:博弈
    原文地址: https://segmentfault.com/a/1190000017761383
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞