hyjs-test
Version:
first hymatrix-js sdk
167 lines • 4.15 kB
TypeScript
import { JWKInterface } from 'arweave/node/lib/wallet';
import { Web3Provider } from '@ethersproject/providers';
export type ArJWK = JWKInterface | 'use_wallet';
export type EthereumPrivateKey = `0x${string}`;
interface DefaultConfig {
debug?: boolean;
accid?: string;
url?: string;
}
export { Web3Provider };
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>;
export interface Tag {
name: string;
value: string;
}
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;
}
export interface MessageItemMap {
edges: Array<{
cursor: string;
node: MessageItem;
}>;
}
export interface BundleItem {
signatureType: number;
signature: string;
owner: string;
target: string;
anchor: string;
tags: Tag[];
data: string;
id: string;
tagsBy: string;
}
export interface HMNode {
['Acc-Id']: string;
Name: string;
Role: string;
Desc: string;
URL: string;
}
export interface HMInfo {
Protocol: string;
Variant: string;
['Join-Network']: string;
Hm: string;
Registry: string;
Node: HMNode;
}
export interface HMNodeMap {
[key: string]: HMNode;
}
export declare enum BaseType {
TypeModule = "Module",
TypeProcess = "Process",
TypeMessage = "Message",
TypeAssignment = "Assignment",
TypeSchedulerLocation = "Scheduler-Location",
TypeSchedulerTransfer = "Scheduler-Transfer",
TypeCheckpoint = "Checkpoint"
}
export interface Base {
'Data-Protocol': string;
Variant: string;
Type: string;
}
export interface Module {
'Module-Format': string;
'Memory-Limit': string;
'Compute-Limit': string;
'Input-Encoding'?: string;
'Output-Encoding'?: string;
Tags?: Tag[];
Base: Base;
}
export interface Process {
Module: string;
Scheduler: string;
'From-Process'?: string;
Tags: Tag[];
Base: Base;
}
export interface Message {
Action: string;
'From-Process'?: string;
'Pushed-For': string;
Sequence: string;
Tags?: Tag[];
Base: Base;
}
export interface Assignment {
Process: string;
Message: string;
Nonce: string;
Timestamp: string;
Base: Base;
}
export interface Checkpoint {
Process: string;
Nonce: string;
Base: Base;
}
export interface ResponseResult {
id: string;
message: string;
}
export interface Response {
id: string;
}
export interface SendMessageParams {
processId: string;
tags: Tag[];
data?: string;
}
export declare abstract class HyMatrixBase {
abstract info(): Promise<HMInfo>;
abstract getResult(msgId: string): Promise<MessageItem>;
abstract getResults(pid: string, limit: number): Promise<MessageItemMap>;
abstract getMessage(msgId: string): Promise<BundleItem>;
abstract getMessageByNonce(pid: string, nonce: number): Promise<BundleItem>;
abstract getAssignByNonce(pid: string, nonce: number): Promise<BundleItem>;
abstract getAssignByMessage(msgId: string): Promise<BundleItem>;
abstract getNodes(): Promise<HMNodeMap>;
abstract getNode(accid?: string): Promise<HMNode>;
abstract getNodesByProcess(processId: string): Promise<HMNode[]>;
abstract getProcesses(accid: string): Promise<string[]>;
abstract balanceOf(accid?: string): Promise<string>;
abstract stakeOf(accid?: string): Promise<string>;
abstract sendMessage(params: SendMessageParams): Promise<Response>;
}
//# sourceMappingURL=index.d.ts.map