类型
以下类型,都可通过 typescript 从 hymatrix-js 中 import
Web3Provider
import { Web3Provider } from '@ethersproject/providers'
export { Web3Provider }
privateKey
export type EthereumPrivateKey = `0x${string}`
ArJWK
export type ArJWK = JWKInterface | 'use_wallet'
其中 JWKInterface 来源于 arweave-js JWKInterface
Config
interface DefaultConfig {
debug?: boolean
accid?: string
}
// 三种 类型 互斥
type SignerConfig =
| { signer: Web3Provider, privateKey?: never, arJWK?: never }
| { privateKey: EthereumPrivateKey, signer?: never, arJWK?: never }
| { arJWK: ArJWK, signer?: never, privateKey?: never }
export type Config = DefaultConfig & Partial<SignerConfig>
HyMatrix 构造函数配置项
Tag
export interface Tag {
name: string
value: string
}
MessageItem
export interface ResMessage {
Sequence: string
Target: string
Data: string
Tags: Tag[]
}
export interface ResSpawn {
Sequance: string
Data: string
Tags: Tag[]
}
export interface MessageItem {
Nonce: string
Timestamp: string
'Item-Id': string
'From-Process': string
'Pushed-For': string
Messages: ResMessage[]
Spawns: ResSpawn[]
Assignmengts: any
Output: any
Data: string
Cache?: Record<string, string>
Error: string
}
MessageItemMap
export interface MessageItemMap {
edges: Array<{
cursor: string
node: MessageItem
}>
}
BundleItem
export interface BundleItem {
signatureType: number
signature: string
owner: string
target: string
anchor: string
tags: Tag[]
data: string
id: string
tagsBy: string
}
HMNode
export interface HMNode {
['Acc-Id']: string
Name: string
Role: string
Desc: string
URL: string
}
HMInfo
export interface HMInfo {
Protocol: string
Variant: string
['Join-Network']: string
Hm: string
Registry: string
Node: HMNode
}
HMNodeMap
export interface HMNodeMap {
[key: string]: HMNode;
}
Response
export interface Response {
id: string;
}
BaseType
export enum BaseType {
TypeModule = 'Module',
TypeProcess = 'Process',
TypeMessage = 'Message',
TypeAssignment = 'Assignment',
TypeSchedulerLocation = 'Scheduler-Location',
TypeSchedulerTransfer = 'Scheduler-Transfer',
TypeCheckpoint = 'Checkpoint'
}
Base
export interface Base {
'Data-Protocol': string
Variant: string
Type: string
}
SendMessageParams
export interface SendMessageParams {
processId: string
tags: Tag[]
data?: string
}