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
将二进制数据转换为十六进制。
参数:
称号 | 范例 |
---|---|
data | Uint8Array |
返回:string
blockTimestampToDate
blockTimestampToDate(slot: number): string
将block_timestamp_type
(自差别纪元以来的半秒)转换为ISO花样的日期。
参数:
称号 | 范例 |
---|---|
slot | number |
返回:string
checkDateParse
checkDateParse(date: string): number
参数:
称号 | 范例 |
---|---|
date | string |
返回:number
checkRange
checkRange(orig: number, converted: number): number
参数:
称号 | 范例 |
---|---|
orig | number |
converted | number |
返回:number
createInitialTypes
createInitialTypes(): Map<string, Type>
建立内置到abi花样的范例集。
返回:Map<string, Type>
createType
createType(attrs: CreateTypeArgs): Type
参数:
称号 | 范例 |
---|---|
attrs | CreateTypeArgs |
返回:Type
dateToBlockTimestamp
dateToBlockTimestamp(date: string): number
将ISO花样的日期转换为block_timestamp_type
(自差别纪元以来的半秒)。
参数:
称号 | 范例 |
---|---|
date | string |
返回:number
dateToTimePoint
dateToTimePoint(date: string): number
将ISO花样的日期转换为time_point
(自纪元以来的毫秒数)。
参数:
称号 | 范例 |
---|---|
date | string |
返回:number
dateToTimePointSec
dateToTimePointSec(date: string): number
将ISO花样的日期转换为time_point_sec
(自纪元以来的秒数)。
参数:
称号 | 范例 |
---|---|
date | string |
返回:number
deserializeAction
deserializeAction(contract: Contract, account: string, name: string, authorization: Authorization[], data: string | Uint8Array | number[], textEncoder: TextEncoder, textDecoder: TextDecoder): Action
反序列化操纵,假如data
是一个string
,则假定它是十六进制。
参数:
称号 | 范例 |
---|---|
contract | Contract |
account | string |
name | string |
authorization | Authorization[] |
data | string | Uint8Array | number[] |
textEncoder | TextEncoder |
textDecoder | TextDecoder |
返回:Action
deserializeActionData
deserializeActionData(contract: Contract, account: string, name: string, data: string | Uint8Array | number[], textEncoder: TextEncoder, textDecoder: TextDecoder): any
反序列化操纵数据,假如data
是一个string
,则假定它是十六进制。
参数:
称号 | 范例 |
---|---|
contract | Contract |
account | string |
name | string |
data | string | Uint8Array | number[] |
textEncoder | TextEncoder |
textDecoder | TextDecoder |
返回:any
deserializeArray
deserializeArray(this: Type, buffer: SerialBuffer, state?: SerializerState, allowExtensions?: boolean): any[]
参数:
称号 | 范例 |
---|---|
this | Type |
buffer | SerialBuffer |
Optional state | SerializerState |
Optional allowExtensions | boolean |
返回:any[]
deserializeExtension
deserializeExtension(this: Type, buffer: SerialBuffer, state?: SerializerState, allowExtensions?: boolean): any
参数:
称号 | 范例 |
---|---|
this | Type |
buffer | SerialBuffer |
Optional state | SerializerState |
Optional allowExtensions | boolean |
返回:any
deserializeOptional
deserializeOptional(this: Type, buffer: SerialBuffer, state?: SerializerState, allowExtensions?: boolean): any
参数:
称号 | 范例 |
---|---|
this | Type |
buffer | SerialBuffer |
Optional state | SerializerState |
Optional allowExtensions | boolean |
返回:any
deserializeStruct
deserializeStruct(this: Type, buffer: SerialBuffer, state?: SerializerState, allowExtensions?: boolean): any
参数:
称号 | 范例 | 默认值 |
---|---|---|
this | Type | – |
buffer | SerialBuffer | – |
Optional state | SerializerState | new SerializerState() |
Optional allowExtensions | boolean | true |
返回:any
deserializeUnknown
deserializeUnknown(buffer: SerialBuffer): SerialBuffer
参数:
称号 | 范例 |
---|---|
buffer | SerialBuffer |
返回:SerialBuffer
deserializeVariant
deserializeVariant(this: Type, buffer: SerialBuffer, state?: SerializerState, allowExtensions?: boolean): any[]
参数:
称号 | 范例 |
---|---|
this | Type |
buffer | SerialBuffer |
Optional state | SerializerState |
Optional allowExtensions | boolean |
返回:any[]
getType
getType(types: Map<string, Type>, name: string): Type
从types
中猎取范例。
参数:
称号 | 范例 |
---|---|
types | Map<string, Type> |
name | string |
返回:Type
getTypesFromAbi
getTypesFromAbi(initialTypes: Map<string, Type>, abi: Abi): Map<string, Type>
从abi猎取范例。
参数:
称号 | 范例 | 形貌 |
---|---|---|
initialTypes | Map<string, Type> | 要构建的范例集,在大多数情况下,最好经由过程对getTypesFromAbi() 的新调用来添补它 |
abi | Abi |
返回:Map<string, Type>
hexToUint8Array
hexToUint8Array(hex: string): Uint8Array
将十六进制转换为二进制数据。
参数:
称号 | 范例 |
---|---|
hex | string |
返回:Uint8Array
serializeAction
serializeAction(contract: Contract, account: string, name: string, authorization: Authorization[], data: any, textEncoder: TextEncoder, textDecoder: TextDecoder): SerializedAction
以序列化情势返回操纵。
参数:
称号 | 范例 |
---|---|
contract | Contract |
account | string |
name | string |
authorization | Authorization[] |
data | any |
textEncoder | TextEncoder |
textDecoder | TextDecoder |
返回:SerializedAction
serializeActionData
serializeActionData(contract: Contract, account: string, name: string, data: any, textEncoder: TextEncoder, textDecoder: TextDecoder): string
将操纵数据转换为序列化情势(十六进制)。
参数:
称号 | 范例 |
---|---|
contract | Contract |
account | string |
name | string |
data | any |
textEncoder | TextEncoder |
textDecoder | TextDecoder |
返回:string
serializeArray
serializeArray(this: Type, buffer: SerialBuffer, data: any[], state?: SerializerState, allowExtensions?: boolean): void
参数:
称号 | 范例 |
---|---|
this | Type |
buffer | SerialBuffer |
data | any[] |
Optional state | SerializerState |
Optional allowExtensions | boolean |
返回:void
serializeExtension
serializeExtension(this: Type, buffer: SerialBuffer, data: any, state?: SerializerState, allowExtensions?: boolean): void
参数:
称号 | 范例 |
---|---|
this | Type |
buffer | SerialBuffer |
data | any |
Optional state | SerializerState |
Optional allowExtensions | boolean |
返回:void
serializeOptional
serializeOptional(this: Type, buffer: SerialBuffer, data: any, state?: SerializerState, allowExtensions?: boolean): void
参数:
称号 | 范例 |
---|---|
this | Type |
buffer | SerialBuffer |
data | any |
Optional state | SerializerState |
Optional allowExtensions | boolean |
返回:void
serializeStruct
serializeStruct(this: Type, buffer: SerialBuffer, data: any, state?: SerializerState, allowExtensions?: boolean): void
参数:
称号 | 范例 | 默认值 |
---|---|---|
this | Type | – |
buffer | SerialBuffer | – |
data | any | – |
Optional state | SerializerState | new SerializerState() |
Optional allowExtensions | boolean | true |
返回:void
serializeUnknown
serializeUnknown(buffer: SerialBuffer, data: any): SerialBuffer
参数:
称号 | 范例 |
---|---|
buffer | SerialBuffer |
data | any |
返回:SerialBuffer
serializeVariant
serializeVariant(this: Type, buffer: SerialBuffer, data: any, state?: SerializerState, allowExtensions?: boolean): void
参数:
称号 | 范例 |
---|---|
this | Type |
buffer | SerialBuffer |
data | any |
Optional state | SerializerState |
Optional allowExtensions | boolean |
返回:void
stringToSymbol
stringToSymbol(s: string): object
将string
转换为Symbol
,花样:precision,NAME
。
参数:
称号 | 范例 |
---|---|
s | string |
返回:object
supportedAbiVersion
supportedAbiVersion(version: string): boolean
这是受支撑的ABI版本吗?
参数:
称号 | 范例 |
---|---|
version | string |
返回:boolean
symbolToString
symbolToString(__namedParameters: object): string
将Symbol
转换为string
,花样:precision,NAME
。
参数:
__namedParameters:object
称号 | 范例 |
---|---|
name | string |
precision | number |
返回:string
timePointSecToDate
timePointSecToDate(sec: number): string
将time_point_sec
(自纪元以来的秒数)转换为ISO花样的日期。
参数:
称号 | 范例 |
---|---|
sec | number |
返回:string
timePointToDate
timePointToDate(us: number): string
将time_point
(自纪元以来的毫秒数)转换为ISO花样的日期。
参数:
称号 | 范例 |
---|---|
us | number |
返回:string
transactionHeader
transactionHeader(refBlock: BlockTaposInfo, expireSeconds: number): object
TAPoS:返回援用refBlock
的生意业务字段,并在refBlock.timestamp
以后expireSeconds
到期。
参数:
称号 | 范例 |
---|---|
refBlock | BlockTaposInfo |
expireSeconds | number |
返回:object