@hashgraphonline/standards-sdk 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,5 @@
1
1
  export * from './hcs-7';
2
- import * as HCS10 from './hcs-10';
3
- export { HCS10 };
4
- import * as HCS3 from './hcs-3/src';
5
- export { HCS3 };
2
+ export * as HCS10 from './hcs-10';
3
+ export * as HCS3 from './hcs-3/src';
6
4
  export * from './utils';
7
5
  export * from './inscribe';
@@ -9,4 +9,4 @@ export {
9
9
  q as inscribeWithSigner,
10
10
  s as retrieveInscription
11
11
  };
12
- //# sourceMappingURL=inscription-sdk.es.js.map
12
+ //# sourceMappingURL=standards-sdk.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standards-sdk.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,109 @@
1
+ import { PublicKey, TransactionReceipt } from '@hashgraph/sdk';
2
+ import { HashinalsWalletConnectSDK } from '@hashgraphonline/hashinal-wc';
3
+ import { Logger } from '../utils/logger';
4
+ import { RetrievedInscriptionResult } from '@kiloscribe/inscription-sdk';
5
+ import { Outbound, HCSMessage, LogLevel } from './outbound';
6
+ import { AgentConfig, NetworkType } from './sdk';
7
+ export type BrowserHCSClientConfig = {
8
+ network: 'mainnet' | 'testnet';
9
+ hwc: HashinalsWalletConnectSDK;
10
+ logLevel?: LogLevel;
11
+ guardedRegistryTopicId: string;
12
+ guardedRegistryBaseUrl: string;
13
+ };
14
+ interface AgentMetadata {
15
+ name: string;
16
+ description: string;
17
+ tags: string[];
18
+ version?: string;
19
+ type?: string;
20
+ logo?: string;
21
+ socials?: SocialLinks;
22
+ }
23
+ interface SocialLinks {
24
+ twitter?: string;
25
+ discord?: string;
26
+ github?: string;
27
+ website?: string;
28
+ }
29
+ export type BrowserAgentConfig = Omit<AgentConfig, 'client' | 'privateKey'> & {
30
+ client: BrowserHCSClient;
31
+ };
32
+ export declare class BrowserHCSClient extends Outbound {
33
+ private hwc;
34
+ protected logger: Logger;
35
+ private guardedRegistryTopicId;
36
+ private guardedRegistryBaseUrl;
37
+ private validTags;
38
+ constructor(config: BrowserHCSClientConfig);
39
+ sendMessage(connectionTopicId: string, operatorId: string, data: string, memo?: string): Promise<void>;
40
+ submitConnectionRequest(inboundTopicId: string, requestingAccountId: string, operatorId: string, memo: string): Promise<TransactionReceipt | undefined>;
41
+ recordOutboundConnectionConfirmation({ outboundTopicId, connectionRequestId, confirmedRequestId, connectionTopicId, operatorId, memo, }: {
42
+ outboundTopicId: string;
43
+ connectionRequestId: number;
44
+ confirmedRequestId: number;
45
+ connectionTopicId: string;
46
+ operatorId: string;
47
+ memo: string;
48
+ }): Promise<{
49
+ result?: TransactionReceipt;
50
+ error?: string;
51
+ }>;
52
+ getPublicKey(accountId: string): Promise<PublicKey>;
53
+ handleConnectionRequest(inboundTopicId: string, requestingAccountId: string, connectionId: number, connectionMemo?: string): Promise<{
54
+ connectionTopicId: string;
55
+ confirmedConnectionSequenceNumber: number;
56
+ operatorId: string;
57
+ }>;
58
+ confirmConnection(inboundTopicId: string, connectionTopicId: string, connectedAccountId: string, connectionId: number, operatorId: string, memo: string): Promise<number>;
59
+ submitMessage(topicId: string, content: string, metadata?: object, memo?: string): Promise<{
60
+ result?: TransactionReceipt;
61
+ error?: string;
62
+ }>;
63
+ createAgent(pfpBuffer: Buffer, pfpFileName: string, agentName: string, agentDescription: string, tags: string[], metadata: AgentMetadata): Promise<{
64
+ outboundTopicId: string;
65
+ inboundTopicId: string;
66
+ pfpTopicId: string;
67
+ profileTopicId: string;
68
+ error?: string;
69
+ success: boolean;
70
+ }>;
71
+ createAndRegisterAgent(name: string, description: string, tags: string[], metadata: AgentMetadata, pfpBuffer: Buffer, pfpFileName: string, network: NetworkType): Promise<BrowserAgentConfig>;
72
+ registerAgentWithGaurdedRegistry(accountId: string, inboundTopicId: string, metadata: {
73
+ tags: string[];
74
+ [key: string]: any;
75
+ }, network: string, maxAttempts?: number, delayMs?: number): Promise<{
76
+ error?: string;
77
+ success: boolean;
78
+ }>;
79
+ storeHCS11Profile(agentName: string, agentDescription: string, inboundTopicId: string, outboundTopicId: string, tags?: string[], metadata?: Record<string, any>, pfpBuffer?: Buffer, pfpFileName?: string): Promise<{
80
+ profileTopicId: string;
81
+ pfpTopicId?: string;
82
+ error?: string;
83
+ success: boolean;
84
+ }>;
85
+ createTopic(memo: string, adminKey?: boolean, submitKey?: boolean): Promise<{
86
+ success: boolean;
87
+ topicId?: string;
88
+ error?: string;
89
+ }>;
90
+ private submitPayload;
91
+ inscribeFile(buffer: Buffer, fileName: string): Promise<RetrievedInscriptionResult>;
92
+ getAccountAndSigner(): {
93
+ accountId: string;
94
+ signer: any;
95
+ };
96
+ protected getMessages(topicId: string): Promise<{
97
+ messages: HCSMessage[];
98
+ }>;
99
+ retrieveOutboundConnectTopicFromNetwork(accountId: string): Promise<{
100
+ inboundTopic: string;
101
+ outboundTopic: string;
102
+ }>;
103
+ inscribePfp(buffer: Buffer, fileName: string): Promise<{
104
+ pfpTopicId: string;
105
+ success: boolean;
106
+ error?: string;
107
+ }>;
108
+ }
109
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare class PayloadSizeError extends Error {
2
+ payloadSize: number;
3
+ constructor(message: string, payloadSize: number);
4
+ }
5
+ export declare class AccountCreationError extends Error {
6
+ constructor(message: string);
7
+ }
8
+ export declare class TopicCreationError extends Error {
9
+ constructor(message: string);
10
+ }
11
+ export declare class ConnectionConfirmationError extends Error {
12
+ constructor(message: string);
13
+ }
@@ -0,0 +1,4 @@
1
+ export * from './sdk';
2
+ export * from './browser';
3
+ export * from './errors';
4
+ export * from './outbound';
@@ -0,0 +1,140 @@
1
+ import { Logger } from '../utils/logger';
2
+ import { Registration } from './registrations';
3
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
4
+ export interface AccountResponse {
5
+ account: string;
6
+ alias: string;
7
+ auto_renew_period: number;
8
+ balance: Balance;
9
+ created_timestamp: string;
10
+ decline_reward: boolean;
11
+ deleted: boolean;
12
+ ethereum_nonce: number;
13
+ evm_address: string;
14
+ expiry_timestamp: string;
15
+ key: Key;
16
+ max_automatic_token_associations: number;
17
+ memo: string;
18
+ pending_reward: number;
19
+ receiver_sig_required: boolean;
20
+ staked_account_id: string | null;
21
+ staked_node_id: string | null;
22
+ stake_period_start: string | null;
23
+ transactions: Transaction[];
24
+ links: Links;
25
+ }
26
+ export interface Balance {
27
+ balance: number;
28
+ timestamp: string;
29
+ tokens: TokenBalance[];
30
+ }
31
+ export interface TokenBalance {
32
+ token_id: string;
33
+ balance: number;
34
+ }
35
+ export interface Key {
36
+ _type: string;
37
+ key: string;
38
+ }
39
+ export interface Transaction {
40
+ bytes: string | null;
41
+ charged_tx_fee: number;
42
+ consensus_timestamp: string;
43
+ entity_id: string | null;
44
+ max_fee: string;
45
+ memo_base64: string;
46
+ name: string;
47
+ nft_transfers: NftTransfer[];
48
+ node: string;
49
+ nonce: number;
50
+ parent_consensus_timestamp: string | null;
51
+ result: string;
52
+ scheduled: boolean;
53
+ staking_reward_transfers: Transfer[];
54
+ token_transfers: TokenTransfer[];
55
+ transaction_hash: string;
56
+ transaction_id: string;
57
+ transfers: Transfer[];
58
+ valid_duration_seconds: string;
59
+ valid_start_timestamp: string;
60
+ }
61
+ export interface Transfer {
62
+ account: string;
63
+ amount: number;
64
+ is_approval: boolean;
65
+ }
66
+ export interface TokenTransfer {
67
+ token_id: string;
68
+ account: string;
69
+ amount: string;
70
+ is_approval: boolean;
71
+ }
72
+ export interface NftTransfer {
73
+ receiver_account_id: string;
74
+ sender_account_id: string;
75
+ serial_number: number;
76
+ is_approval: boolean;
77
+ }
78
+ export interface Links {
79
+ next: string;
80
+ }
81
+ export interface OutboundConfig {
82
+ network: 'mainnet' | 'testnet';
83
+ logLevel?: LogLevel;
84
+ }
85
+ export interface TopicInfo {
86
+ inboundTopic: string;
87
+ outboundTopic: string;
88
+ }
89
+ export interface HCSMessage {
90
+ p: 'hcs-10';
91
+ op: 'connection_request' | 'connection_created' | 'message';
92
+ data: string;
93
+ created?: Date;
94
+ consensus_timestamp?: string;
95
+ m?: string;
96
+ payer: string;
97
+ outbound_topic_id?: string;
98
+ connection_request_id?: number;
99
+ confirmed_request_id?: number;
100
+ connection_topic_id?: string;
101
+ connected_account_id?: string;
102
+ requesting_account_id?: string;
103
+ connection_id?: number;
104
+ sequence_number: number;
105
+ operator_id?: string;
106
+ }
107
+ export declare abstract class Outbound extends Registration {
108
+ private static topicCache;
109
+ protected network: string;
110
+ protected logger: Logger;
111
+ constructor(config: OutboundConfig);
112
+ abstract getAccountAndSigner(): {
113
+ accountId: string;
114
+ signer: any;
115
+ };
116
+ protected abstract getMessages(topicId: string): Promise<{
117
+ messages: HCSMessage[];
118
+ }>;
119
+ requestAccount(account: string): Promise<AccountResponse>;
120
+ getAccountMemo(accountId: string): Promise<string | null>;
121
+ private getTopicInfoFromMemo;
122
+ private getMirrorNodeUrl;
123
+ getTopicInfo(accountId: string): Promise<TopicInfo | null>;
124
+ retrieveOutboundConnectTopic(accountId: string): Promise<string | null>;
125
+ retrieveOutboundConnectTopicFromNetwork(accountId: string): Promise<TopicInfo>;
126
+ retrieveOutboundMessages(agentAccountId: string): Promise<HCSMessage[]>;
127
+ hasConnectionCreated(agentAccountId: string, connectionId: number): Promise<boolean>;
128
+ clearCache(): void;
129
+ }
130
+ export declare class OutboundCache {
131
+ private static instance;
132
+ private cache;
133
+ private cacheExpiry;
134
+ private readonly CACHE_TTL;
135
+ private constructor();
136
+ static getInstance(): OutboundCache;
137
+ set(key: string, value: TopicInfo): void;
138
+ get(key: string): TopicInfo | undefined;
139
+ clear(): void;
140
+ }
@@ -0,0 +1,26 @@
1
+ import { AgentMetadata } from './sdk';
2
+ export interface RegistrationSearchOptions {
3
+ tags?: string[];
4
+ accountId?: string;
5
+ network?: string;
6
+ }
7
+ export interface RegistrationSearchResult {
8
+ registrations: Array<{
9
+ id: string;
10
+ transaction_id: string;
11
+ status: 'pending' | 'success' | 'failed';
12
+ network: string;
13
+ account_id: string;
14
+ requester_topic_id: string;
15
+ operator_id: string;
16
+ metadata: AgentMetadata;
17
+ registry_topic_id: string;
18
+ created_at: string;
19
+ updated_at: string;
20
+ }>;
21
+ error?: string;
22
+ success: boolean;
23
+ }
24
+ export declare abstract class Registration {
25
+ findRegistrations(options?: RegistrationSearchOptions): Promise<RegistrationSearchResult>;
26
+ }
@@ -0,0 +1,173 @@
1
+ import { Client, PrivateKey, Transaction, TransactionReceipt, PublicKey } from '@hashgraph/sdk';
2
+ import { HCSClientConfig } from 'hcs10-sdk';
3
+ import { RetrievedInscriptionResult } from '@kiloscribe/inscription-sdk';
4
+ import { Logger } from '../utils/logger';
5
+ import { Outbound, HCSMessage } from './outbound';
6
+ export declare class HCS10Client extends Outbound {
7
+ private client;
8
+ private operatorPrivateKey;
9
+ protected network: string;
10
+ protected logger: Logger;
11
+ protected guardedRegistryBaseUrl: string;
12
+ constructor(config: HCSClientConfig);
13
+ getClient(): Client;
14
+ createAccount(): Promise<{
15
+ accountId: string;
16
+ privateKey: string;
17
+ }>;
18
+ createAgent(pfpBuffer: Buffer, pfpFileName: string, agentName: string, agentDescription: string, tags: string[], metadata: AgentMetadata): Promise<{
19
+ outboundTopicId: string;
20
+ inboundTopicId: string;
21
+ pfpTopicId: string;
22
+ profileTopicId: string;
23
+ }>;
24
+ inscribePfp(buffer: Buffer, fileName: string): Promise<{
25
+ pfpTopicId: string;
26
+ transactionId: string;
27
+ success: boolean;
28
+ }>;
29
+ storeHCS11Profile(agentName: string, agentDescription: string, inboundTopicId: string, outboundTopicId: string, tags?: string[], metadata?: Record<string, any>, pfpBuffer?: Buffer, pfpFileName?: string): Promise<{
30
+ profileTopicId: string;
31
+ pfpTopicId?: string;
32
+ transactionId: string;
33
+ success: boolean;
34
+ }>;
35
+ retrieveOutboundConnectTopicFromNetwork(accountId: string): Promise<{
36
+ inboundTopic: string;
37
+ outboundTopic: string;
38
+ }>;
39
+ registerAgentWithGaurdedRegistry(accountId: string, inboundTopicId: string, metadata: {
40
+ tags: string[];
41
+ [key: string]: any;
42
+ }, network: string, maxAttempts?: number, delayMs?: number): Promise<AgentRegistrationResult>;
43
+ private executeRegistration;
44
+ private checkRegistrationStatus;
45
+ private waitForConfirmation;
46
+ /**
47
+ * Registers an agent with the guarded registry. Should be called by a registry.
48
+ * @param registryTopicId - The topic ID of the guarded registry.
49
+ * @param accountId - The account ID of the agent
50
+ * @param inboundTopicId - The topic ID of the inbound topic
51
+ * @param metadata - The metadata of the agent
52
+ * @param memo - The memo of the agent
53
+ * @param submitKey - The submit key of the agent
54
+ */
55
+ registerAgent(registryTopicId: string, accountId: string, inboundTopicId: string, metadata: {
56
+ tags: string[];
57
+ [key: string]: any;
58
+ }, memo: string, submitKey?: PrivateKey): Promise<void>;
59
+ handleConnectionRequest(inboundTopicId: string, requestingAccountId: string, connectionRequestId: number): Promise<{
60
+ connectionTopicId: string;
61
+ confirmedConnectionSequenceNumber: number;
62
+ operatorId: string;
63
+ }>;
64
+ confirmConnection(inboundTopicId: string, connectionTopicId: string, connectedAccountId: string, connectionId: number, operatorId: string, memo: string, submitKey?: PrivateKey): Promise<number>;
65
+ sendMessage(connectionTopicId: string, operatorId: string, data: string, memo?: string, submitKey?: PrivateKey): Promise<void>;
66
+ getPublicKey(accountId: string): Promise<PublicKey>;
67
+ createThresholdTopic(memo: string, requesterPublicKey: string): Promise<string>;
68
+ createTopic(memo: string, adminKey?: boolean, submitKey?: boolean): Promise<string>;
69
+ submitMessage(topicId: string, message: string, submitKey?: PrivateKey): Promise<TransactionReceipt>;
70
+ private submitPayload;
71
+ queryTopicMessages(topicId: string): Promise<string[]>;
72
+ submitConnectionRequest(inboundTopicId: string, requestingAccountId: string, operatorId: string, memo: string): Promise<TransactionReceipt>;
73
+ recordOutboundConnectionConfirmation({ outboundTopicId, connectionRequestId, confirmedRequestId, connectionTopicId, operatorId, memo, }: {
74
+ outboundTopicId: string;
75
+ connectionRequestId: number;
76
+ confirmedRequestId: number;
77
+ connectionTopicId: string;
78
+ operatorId: string;
79
+ memo: string;
80
+ }): Promise<TransactionReceipt>;
81
+ inscribeFile(buffer: Buffer, fileName: string): Promise<RetrievedInscriptionResult>;
82
+ waitForConnectionConfirmation(inboundTopicId: string, connectionRequestId: number, maxAttempts?: number, delayMs?: number): Promise<{
83
+ connectionTopicId: string;
84
+ confirmedBy: string;
85
+ sequence_number: number;
86
+ memo: string;
87
+ }>;
88
+ getAccountAndSigner(): {
89
+ accountId: string;
90
+ signer: any;
91
+ };
92
+ protected getMessages(topicId: string): Promise<{
93
+ messages: HCSMessage[];
94
+ }>;
95
+ /**
96
+ * Creates and registers an agent with a Gaurded registry.
97
+ *
98
+ * This function performs the following steps:
99
+ * 1. Creates a new account if no existing account is provided.
100
+ * 2. Initializes an HCS10 client with the new account.
101
+ * 3. Creates an agent on the client.
102
+ * 4. Registers the agent with the Hashgraph Online Gaurded Registry.
103
+ *
104
+ * @param name
105
+ * @param description
106
+ * @param tags
107
+ * @param metadata
108
+ * @param pfpBuffer
109
+ * @param pfpFileName
110
+ * @param network
111
+ * @param existingAccount
112
+ * @returns
113
+ */
114
+ createAndRegisterAgent(name: string, description: string, tags: string[], metadata: AgentMetadata, pfpBuffer: Buffer, pfpFileName: string, network: NetworkType, existingAccount?: {
115
+ accountId: string;
116
+ privateKey: string;
117
+ }): Promise<AgentConfig>;
118
+ }
119
+ export interface ValidationError {
120
+ validation: string;
121
+ code: string;
122
+ message: string;
123
+ path: string[];
124
+ }
125
+ export interface AgentRegistrationResult {
126
+ transaction?: Transaction;
127
+ transactionId?: string;
128
+ confirmed?: boolean;
129
+ validationErrors?: ValidationError[];
130
+ error?: string;
131
+ success: boolean;
132
+ }
133
+ export interface AgentCreationResult {
134
+ outboundTopicId: string;
135
+ inboundTopicId: string;
136
+ registration?: AgentRegistrationResult;
137
+ error?: string;
138
+ success: boolean;
139
+ }
140
+ export interface AgentMetadata {
141
+ name: string;
142
+ description: string;
143
+ tags: string[];
144
+ type?: 'assistant' | 'agent' | 'bot';
145
+ version?: string;
146
+ logo?: string;
147
+ socials?: {
148
+ x?: string;
149
+ github?: string;
150
+ website?: string;
151
+ discord?: string;
152
+ };
153
+ [key: string]: any;
154
+ }
155
+ export type RegistrationOptions = {
156
+ maxAttempts: number;
157
+ delayMs: number;
158
+ baseUrl: string;
159
+ };
160
+ export type RegistrationStatus = {
161
+ status: 'pending' | 'success' | 'failed';
162
+ };
163
+ export type NetworkType = 'mainnet' | 'testnet';
164
+ export type AgentConfig = {
165
+ accountId: string;
166
+ privateKey: string;
167
+ operatorId: string;
168
+ inboundTopicId: string;
169
+ outboundTopicId: string;
170
+ profileTopicId: string;
171
+ pfpTopicId?: string;
172
+ client: HCS10Client;
173
+ };
@@ -0,0 +1 @@
1
+ export * from './src';
@@ -0,0 +1,48 @@
1
+ import { HCSSDK, LoadQueueItem, HCSConfigMapping, HCSConfig, LoadType } from './types';
2
+ export declare const sleep: (ms: number) => Promise<unknown>;
3
+ export declare class HCS implements HCSSDK {
4
+ config: HCSConfig;
5
+ configMapping: HCSConfigMapping;
6
+ LoadedScripts: Record<string, string>;
7
+ LoadedWasm: Record<string, WebAssembly.Instance>;
8
+ LoadedImages: Record<string, string>;
9
+ LoadedVideos: Record<string, string>;
10
+ LoadedAudios: Record<string, HTMLAudioElement>;
11
+ LoadedAudioUrls: Record<string, string>;
12
+ LoadedGLBs: Record<string, string>;
13
+ scriptLoadedEvent: Event;
14
+ loadQueue: LoadQueueItem[];
15
+ isProcessingQueue: boolean;
16
+ private modelViewerLoaded;
17
+ private modelViewerLoading;
18
+ private logger;
19
+ constructor();
20
+ private createFallbackLogger;
21
+ log(...args: any[]): void;
22
+ error(...args: any[]): void;
23
+ loadConfigFromHTML(): void;
24
+ updateLoadingStatus(id: string, status: string): void;
25
+ fetchWithRetry(url: string, retries?: number, backoff?: number): Promise<Response>;
26
+ sleep(ms: number): Promise<unknown>;
27
+ isDuplicate(topicId: string): boolean;
28
+ retrieveHCS1Data(topicId: string, cdnUrl?: string, network?: string): Promise<Blob>;
29
+ loadScript(scriptElement: HTMLElement): Promise<void>;
30
+ loadModuleExports(scriptId: string): Promise<any>;
31
+ loadStylesheet(linkElement: HTMLElement): Promise<void>;
32
+ loadImage(imageElement: HTMLElement): Promise<void>;
33
+ loadMedia(mediaElement: HTMLElement, mediaType: 'video' | 'audio'): Promise<void>;
34
+ private loadModelViewer;
35
+ loadGLB(glbElement: HTMLElement): Promise<void>;
36
+ loadResource(element: HTMLElement, type: LoadType, order: number): Promise<void>;
37
+ processQueue(): Promise<void>;
38
+ private replaceHCSInStyle;
39
+ private processInlineStyles;
40
+ init(): Promise<void>;
41
+ preloadImage(topicId: string): Promise<string>;
42
+ preloadAudio(topicId: string): Promise<string>;
43
+ playAudio(topicId: string, volume?: number): Promise<void>;
44
+ pauseAudio(topicId: string): Promise<void>;
45
+ loadAndPlayAudio(topicId: string, autoplay?: boolean, volume?: number): Promise<void>;
46
+ }
47
+ declare const _default: any;
48
+ export default _default;
@@ -0,0 +1,24 @@
1
+ import { AccountId, ContractId } from '@hashgraph/sdk';
2
+ import { EVMConfig } from './wasm-bridge';
3
+ export interface EVMCache {
4
+ get(key: string): Promise<string | undefined> | string | undefined;
5
+ set(key: string, value: string): Promise<void> | void;
6
+ delete(key: string): Promise<void> | void;
7
+ clear(): Promise<void> | void;
8
+ }
9
+ export declare class EVMBridge {
10
+ network: string;
11
+ mirrorNodeUrl: string;
12
+ private cache;
13
+ private logger;
14
+ constructor(network?: string, mirrorNodeUrl?: string, cache?: EVMCache);
15
+ executeCommands(evmConfigs: EVMConfig[], initialState?: Record<string, string>): Promise<{
16
+ results: Record<string, any>;
17
+ stateData: Record<string, any>;
18
+ }>;
19
+ executeCommand(evmConfig: EVMConfig, stateData?: Record<string, string>): Promise<any>;
20
+ readFromMirrorNode(command: string, from: AccountId, to: ContractId): Promise<any>;
21
+ clearCache(): Promise<void>;
22
+ clearCacheForContract(contractAddress: string, functionName: string): Promise<void>;
23
+ setLogLevel(level: 'debug' | 'info' | 'warn' | 'error'): void;
24
+ }
@@ -0,0 +1,2 @@
1
+ export * from './wasm-bridge';
2
+ export * from './evm-bridge';
@@ -0,0 +1,25 @@
1
+ import { EVMCache } from './evm-bridge';
2
+ export interface RedisConfig {
3
+ host?: string;
4
+ port?: number;
5
+ password?: string;
6
+ db?: number;
7
+ keyPrefix?: string;
8
+ tls?: boolean;
9
+ connectTimeout?: number;
10
+ retryStrategy?: (times: number) => number | void;
11
+ logLevel?: 'debug' | 'info' | 'warn' | 'error';
12
+ }
13
+ export declare class RedisCache implements EVMCache {
14
+ private client;
15
+ private prefix;
16
+ private logger;
17
+ constructor(config?: RedisConfig);
18
+ private getKey;
19
+ get(key: string): Promise<string | undefined>;
20
+ set(key: string, value: string, ttlSeconds?: number): Promise<void>;
21
+ delete(key: string): Promise<void>;
22
+ clear(): Promise<void>;
23
+ disconnect(): Promise<void>;
24
+ setLogLevel(level: 'debug' | 'info' | 'warn' | 'error'): void;
25
+ }
@@ -0,0 +1,71 @@
1
+ export interface BaseMessage {
2
+ p: string;
3
+ op: string;
4
+ m: string;
5
+ t?: string;
6
+ t_id?: string;
7
+ d?: Record<string, unknown>;
8
+ }
9
+ export interface EVMConfig extends BaseMessage {
10
+ c: {
11
+ contractAddress: string;
12
+ abi: {
13
+ inputs: Array<{
14
+ name: string;
15
+ type: string;
16
+ }>;
17
+ name: string;
18
+ outputs: Array<{
19
+ name: string;
20
+ type: string;
21
+ }>;
22
+ stateMutability: string;
23
+ type: string;
24
+ };
25
+ };
26
+ }
27
+ export interface WASMConfig extends BaseMessage {
28
+ c: {
29
+ wasmTopicId: string;
30
+ inputType: {
31
+ stateData: Record<string, string>;
32
+ };
33
+ outputType: {
34
+ type: string;
35
+ format: string;
36
+ };
37
+ };
38
+ }
39
+ export interface WasmExports extends WebAssembly.Exports {
40
+ __wbindgen_add_to_stack_pointer: (a: number) => number;
41
+ __wbindgen_malloc: (a: number, b: number) => number;
42
+ __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
43
+ __wbindgen_free: (a: number, b: number, c: number) => void;
44
+ memory: WebAssembly.Memory;
45
+ process_state: (state_json: string, messages_json: string) => string;
46
+ get_params: () => string;
47
+ [key: string]: any;
48
+ }
49
+ export declare class WasmBridge {
50
+ wasm: WasmExports | null;
51
+ private WASM_VECTOR_LEN;
52
+ private cachedUint8Memory;
53
+ private cachedDataViewMemory;
54
+ private readonly textEncoder;
55
+ private readonly textDecoder;
56
+ private logger;
57
+ constructor();
58
+ setLogLevel(level: 'debug' | 'info' | 'warn' | 'error'): void;
59
+ get wasmInstance(): WasmExports;
60
+ private getUint8Memory;
61
+ private getDataViewMemory;
62
+ private encodeString;
63
+ private passStringToWasm;
64
+ private getStringFromWasm;
65
+ createWasmFunction(wasmFn: (...args: any[]) => any): (...args: string[]) => string;
66
+ initWasm(wasmBytes: BufferSource): Promise<WasmExports>;
67
+ createStateData(wasmConfig: WASMConfig, stateData?: Record<string, any>): Record<string, any>;
68
+ private getDefaultValueForType;
69
+ executeWasm(stateData: Record<string, any>, messages: BaseMessage[]): string;
70
+ getParams(): string;
71
+ }
@@ -0,0 +1,5 @@
1
+ export * from './hcs-7';
2
+ export * as HCS10 from './hcs-10';
3
+ export * as HCS3 from './hcs-3/src';
4
+ export * from './utils';
5
+ export * from './inscribe';
@@ -0,0 +1,2 @@
1
+ export * from './inscriber';
2
+ export * from './types';