@trufnetwork/sdk-js 0.3.8 → 0.4.2
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.
- package/dist/cjs/client/client.cjs +44 -0
- package/dist/cjs/client/client.cjs.map +2 -2
- package/dist/cjs/contracts-api/action.cjs +301 -77
- package/dist/cjs/contracts-api/action.cjs.map +3 -3
- package/dist/cjs/contracts-api/cache.integration.test.cjs +265 -0
- package/dist/cjs/contracts-api/cache.integration.test.cjs.map +7 -0
- package/dist/cjs/contracts-api/composedAction.cjs +86 -0
- package/dist/cjs/contracts-api/composedAction.cjs.map +2 -2
- package/dist/cjs/contracts-api/composedAction.test.cjs +301 -0
- package/dist/cjs/contracts-api/composedAction.test.cjs.map +7 -0
- package/dist/cjs/index.common.cjs.map +1 -1
- package/dist/cjs/types/cache.cjs +34 -0
- package/dist/cjs/types/cache.cjs.map +7 -0
- package/dist/cjs/types/cache.test.cjs +205 -0
- package/dist/cjs/types/cache.test.cjs.map +7 -0
- package/dist/cjs/util/cacheMetadataParser.cjs +174 -0
- package/dist/cjs/util/cacheMetadataParser.cjs.map +7 -0
- package/dist/cjs/util/cacheMetadataParser.test.cjs +329 -0
- package/dist/cjs/util/cacheMetadataParser.test.cjs.map +7 -0
- package/dist/cjs/util/cacheValidation.cjs +88 -0
- package/dist/cjs/util/cacheValidation.cjs.map +7 -0
- package/dist/cjs/util/cacheValidation.test.cjs +108 -0
- package/dist/cjs/util/cacheValidation.test.cjs.map +7 -0
- package/dist/esm/client/client.mjs +44 -0
- package/dist/esm/client/client.mjs.map +2 -2
- package/dist/esm/contracts-api/action.mjs +302 -77
- package/dist/esm/contracts-api/action.mjs.map +3 -3
- package/dist/esm/contracts-api/cache.integration.test.mjs +263 -0
- package/dist/esm/contracts-api/cache.integration.test.mjs.map +7 -0
- package/dist/esm/contracts-api/composedAction.mjs +86 -0
- package/dist/esm/contracts-api/composedAction.mjs.map +2 -2
- package/dist/esm/contracts-api/composedAction.test.mjs +299 -0
- package/dist/esm/contracts-api/composedAction.test.mjs.map +7 -0
- package/dist/esm/index.common.mjs.map +1 -1
- package/dist/esm/types/cache.mjs +13 -0
- package/dist/esm/types/cache.mjs.map +7 -0
- package/dist/esm/types/cache.test.mjs +203 -0
- package/dist/esm/types/cache.test.mjs.map +7 -0
- package/dist/esm/util/cacheMetadataParser.mjs +153 -0
- package/dist/esm/util/cacheMetadataParser.mjs.map +7 -0
- package/dist/esm/util/cacheMetadataParser.test.mjs +327 -0
- package/dist/esm/util/cacheMetadataParser.test.mjs.map +7 -0
- package/dist/esm/util/cacheValidation.mjs +67 -0
- package/dist/esm/util/cacheValidation.mjs.map +7 -0
- package/dist/esm/util/cacheValidation.test.mjs +106 -0
- package/dist/esm/util/cacheValidation.test.mjs.map +7 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/client/client.d.ts +39 -1
- package/dist/types/client/client.d.ts.map +1 -1
- package/dist/types/contracts-api/action.d.ts +11 -1
- package/dist/types/contracts-api/action.d.ts.map +1 -1
- package/dist/types/contracts-api/cache.integration.test.d.ts +2 -0
- package/dist/types/contracts-api/cache.integration.test.d.ts.map +1 -0
- package/dist/types/contracts-api/composedAction.d.ts +75 -0
- package/dist/types/contracts-api/composedAction.d.ts.map +1 -1
- package/dist/types/contracts-api/composedAction.test.d.ts +2 -0
- package/dist/types/contracts-api/composedAction.test.d.ts.map +1 -0
- package/dist/types/index.common.d.ts +1 -1
- package/dist/types/index.common.d.ts.map +1 -1
- package/dist/types/types/cache.d.ts +129 -0
- package/dist/types/types/cache.d.ts.map +1 -0
- package/dist/types/types/cache.test.d.ts +2 -0
- package/dist/types/types/cache.test.d.ts.map +1 -0
- package/dist/types/util/cacheMetadataParser.d.ts +38 -0
- package/dist/types/util/cacheMetadataParser.d.ts.map +1 -0
- package/dist/types/util/cacheMetadataParser.test.d.ts +2 -0
- package/dist/types/util/cacheMetadataParser.test.d.ts.map +1 -0
- package/dist/types/util/cacheValidation.d.ts +27 -0
- package/dist/types/util/cacheValidation.d.ts.map +1 -0
- package/dist/types/util/cacheValidation.test.d.ts +2 -0
- package/dist/types/util/cacheValidation.test.d.ts.map +1 -0
- package/package.json +5 -3
- package/dist/cjs/client/client.test.cjs +0 -32
- package/dist/cjs/client/client.test.cjs.map +0 -7
- package/dist/esm/client/client.test.mjs +0 -30
- package/dist/esm/client/client.test.mjs.map +0 -7
- package/dist/types/client/client.test.d.ts +0 -2
- package/dist/types/client/client.test.d.ts.map +0 -1
|
@@ -6,7 +6,7 @@ import { EnvironmentType } from "@trufnetwork/kwil-js/dist/core/enums";
|
|
|
6
6
|
import { GenericResponse } from "@trufnetwork/kwil-js/dist/core/resreq";
|
|
7
7
|
import { TxReceipt } from "@trufnetwork/kwil-js/dist/core/tx";
|
|
8
8
|
import { TxInfoReceipt } from "@trufnetwork/kwil-js/dist/core/txQuery";
|
|
9
|
-
import { ComposedAction } from "../contracts-api/composedAction";
|
|
9
|
+
import { ComposedAction, ListTaxonomiesByHeightParams, GetTaxonomiesForStreamsParams, TaxonomyQueryResult } from "../contracts-api/composedAction";
|
|
10
10
|
import { PrimitiveAction } from "../contracts-api/primitiveAction";
|
|
11
11
|
import { Action } from "../contracts-api/action";
|
|
12
12
|
import { StreamType } from "../contracts-api/contractValues";
|
|
@@ -118,6 +118,44 @@ export declare abstract class BaseTNClient<T extends EnvironmentType> {
|
|
|
118
118
|
* @returns A promise that resolves to a list of last transactions.
|
|
119
119
|
*/
|
|
120
120
|
getLastTransactions(input: GetLastTransactionsInput): Promise<any[]>;
|
|
121
|
+
/**
|
|
122
|
+
* Lists taxonomies by height range for incremental synchronization.
|
|
123
|
+
* High-level wrapper for ComposedAction.listTaxonomiesByHeight()
|
|
124
|
+
*
|
|
125
|
+
* @param params Height range and pagination parameters
|
|
126
|
+
* @returns Promise resolving to taxonomy query results
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const taxonomies = await client.listTaxonomiesByHeight({
|
|
131
|
+
* fromHeight: 1000,
|
|
132
|
+
* toHeight: 2000,
|
|
133
|
+
* limit: 100,
|
|
134
|
+
* latestOnly: true
|
|
135
|
+
* });
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
listTaxonomiesByHeight(params?: ListTaxonomiesByHeightParams): Promise<TaxonomyQueryResult[]>;
|
|
139
|
+
/**
|
|
140
|
+
* Gets taxonomies for specific streams in batch.
|
|
141
|
+
* High-level wrapper for ComposedAction.getTaxonomiesForStreams()
|
|
142
|
+
*
|
|
143
|
+
* @param params Stream locators and options
|
|
144
|
+
* @returns Promise resolving to taxonomy query results
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* const streams = [
|
|
149
|
+
* { dataProvider: provider1, streamId: streamId1 },
|
|
150
|
+
* { dataProvider: provider2, streamId: streamId2 }
|
|
151
|
+
* ];
|
|
152
|
+
* const taxonomies = await client.getTaxonomiesForStreams({
|
|
153
|
+
* streams,
|
|
154
|
+
* latestOnly: true
|
|
155
|
+
* });
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
getTaxonomiesForStreams(params: GetTaxonomiesForStreamsParams): Promise<TaxonomyQueryResult[]>;
|
|
121
159
|
/**
|
|
122
160
|
* Get the default chain id for a provider. Use with caution, as this decreases the security of the TN.
|
|
123
161
|
* @param provider - The provider URL.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,UAAU,EAAqB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO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EAAE,eAAe,CAAC;QACvB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,eAAe,CAAC;KACzB,GAAG,OAAO,CAAC,OAAO,CAAC;IAUpB;;;OAGG;IACG,eAAe,CAAC,KAAK,EAAE;QAC3B,KAAK,EAAE,eAAe,CAAC;QACvB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,OAAO,eAAe,EAAE,UAAU,EAAE,CAAC;CASlD"}
|
|
@@ -6,6 +6,7 @@ import { TxReceipt } from "@trufnetwork/kwil-js/dist/core/tx";
|
|
|
6
6
|
import { Either } from "monads-io";
|
|
7
7
|
import { DateString } from "../types/other";
|
|
8
8
|
import { StreamLocator } from "../types/stream";
|
|
9
|
+
import { CacheAwareResponse, GetRecordOptions, GetIndexOptions, GetIndexChangeOptions, GetFirstRecordOptions } from "../types/cache";
|
|
9
10
|
import { EthereumAddress } from "../util/EthereumAddress";
|
|
10
11
|
import { VisibilityEnum } from "../util/visibility";
|
|
11
12
|
import { MetadataKey, MetadataValueTypeForKey, StreamType } from "./contractValues";
|
|
@@ -33,6 +34,8 @@ export interface GetIndexChangeInput extends GetRecordInput {
|
|
|
33
34
|
export declare class Action {
|
|
34
35
|
protected kwilClient: WebKwil | NodeKwil;
|
|
35
36
|
protected kwilSigner: KwilSigner;
|
|
37
|
+
/** Track if deprecation warnings were already emitted */
|
|
38
|
+
private static _legacyWarnEmitted;
|
|
36
39
|
constructor(kwilClient: WebKwil | NodeKwil, kwilSigner: KwilSigner);
|
|
37
40
|
/**
|
|
38
41
|
* Executes a method on the stream
|
|
@@ -47,21 +50,26 @@ export declare class Action {
|
|
|
47
50
|
*/
|
|
48
51
|
protected call<T>(method: string, inputs: NamedParams): Promise<Either<number, T>>;
|
|
49
52
|
/**
|
|
50
|
-
*
|
|
53
|
+
* @deprecated Use getRecord(stream, options?) to leverage cache support and future-proof parameter handling.
|
|
51
54
|
*/
|
|
52
55
|
getRecord(input: GetRecordInput): Promise<StreamRecord[]>;
|
|
56
|
+
getRecord(stream: StreamLocator, options?: GetRecordOptions): Promise<CacheAwareResponse<StreamRecord[]>>;
|
|
53
57
|
/**
|
|
54
58
|
* Returns the index of the stream within the given date range
|
|
59
|
+
* @deprecated Use getIndex(stream, options?) to leverage cache support and future-proof parameter handling.
|
|
55
60
|
*/
|
|
56
61
|
getIndex(input: GetRecordInput): Promise<StreamRecord[]>;
|
|
62
|
+
getIndex(stream: StreamLocator, options?: GetIndexOptions): Promise<CacheAwareResponse<StreamRecord[]>>;
|
|
57
63
|
/**
|
|
58
64
|
* Returns the type of the stream
|
|
59
65
|
*/
|
|
60
66
|
getType(stream: StreamLocator): Promise<StreamType>;
|
|
61
67
|
/**
|
|
62
68
|
* Returns the first record of the stream
|
|
69
|
+
* @deprecated Use getFirstRecord(stream, options?) to leverage cache support and future-proof parameter handling.
|
|
63
70
|
*/
|
|
64
71
|
getFirstRecord(input: GetFirstRecordInput): Promise<StreamRecord | null>;
|
|
72
|
+
getFirstRecord(stream: StreamLocator, options?: GetFirstRecordOptions): Promise<CacheAwareResponse<StreamRecord | null>>;
|
|
65
73
|
protected setMetadata<K extends MetadataKey>(stream: StreamLocator, key: K, value: MetadataValueTypeForKey<K>): Promise<GenericResponse<TxReceipt>>;
|
|
66
74
|
protected getMetadata<K extends MetadataKey>(stream: StreamLocator, key: K, filteredRef?: string, limit?: number, offset?: number, orderBy?: string): Promise<{
|
|
67
75
|
rowId: string;
|
|
@@ -111,8 +119,10 @@ export declare class Action {
|
|
|
111
119
|
getAllowedComposeStreams(stream: StreamLocator): Promise<StreamLocator[]>;
|
|
112
120
|
/**
|
|
113
121
|
* Returns the index change of the stream within the given date range
|
|
122
|
+
* @deprecated Use getIndexChange(stream, options) to leverage cache support and future-proof parameter handling.
|
|
114
123
|
*/
|
|
115
124
|
getIndexChange(input: GetIndexChangeInput): Promise<StreamRecord[]>;
|
|
125
|
+
getIndexChange(stream: StreamLocator, options: GetIndexChangeOptions): Promise<CacheAwareResponse<StreamRecord[]>>;
|
|
116
126
|
/**
|
|
117
127
|
* A custom method that accepts the procedure name and the input of GetRecordInput
|
|
118
128
|
* Returns the result of the procedure in the same format as StreamRecord
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAC,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAC,WAAW,EAAC,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EAAoB,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAC,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAC,WAAW,EAAC,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC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,CAAC,CAAC;IAQtC;;OAEG;IACU,oBAAoB,CAC/B,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;cAkBtB,eAAe,CAC7B,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAQtC;;OAEG;IACU,qBAAqB,CAChC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,eAAe,EAAE,CAAC;IAU7B;;OAEG;IACU,wBAAwB,CACnC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,aAAa,EAAE,CAAC;IAgB3B;;;OAGG;IACU,cAAc,CACzB,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,YAAY,EAAE,CAAC;IACb,cAAc,CACzB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,kBAAkB,CAAC,YAAY,EAAE,CAAC,CAAC;IAsG9C;;;;;OAKG;IACU,kBAAkB,CAC7B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,YAAY,EAAE,CAAC;IAsB1B;;;;;;;;OAQG;IACU,uBAAuB,CAClC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;;;;IAgB/C;;OAEG;IACU,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;CAShD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.integration.test.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/cache.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -2,6 +2,8 @@ import { KwilSigner, NodeKwil, WebKwil } from "@trufnetwork/kwil-js";
|
|
|
2
2
|
import { GenericResponse } from "@trufnetwork/kwil-js/dist/core/resreq";
|
|
3
3
|
import { TxReceipt } from "@trufnetwork/kwil-js/dist/core/tx";
|
|
4
4
|
import { StreamLocator } from "../types/stream";
|
|
5
|
+
import { EthereumAddress } from "../util/EthereumAddress";
|
|
6
|
+
import { StreamId } from "../util/StreamId";
|
|
5
7
|
import { Action } from "./action";
|
|
6
8
|
export declare const ErrorStreamNotComposed = "stream is not a composed stream";
|
|
7
9
|
export interface TaxonomySet {
|
|
@@ -20,6 +22,42 @@ export interface DescribeTaxonomiesParams {
|
|
|
20
22
|
*/
|
|
21
23
|
latestGroupSequence: boolean;
|
|
22
24
|
}
|
|
25
|
+
export interface ListTaxonomiesByHeightParams {
|
|
26
|
+
/** Start height (inclusive). If null, uses earliest available. */
|
|
27
|
+
fromHeight?: number;
|
|
28
|
+
/** End height (inclusive). If null, uses current height. */
|
|
29
|
+
toHeight?: number;
|
|
30
|
+
/** Maximum number of results to return. Default: 1000 */
|
|
31
|
+
limit?: number;
|
|
32
|
+
/** Number of results to skip for pagination. Default: 0 */
|
|
33
|
+
offset?: number;
|
|
34
|
+
/** If true, returns only latest group_sequence per stream. Default: false */
|
|
35
|
+
latestOnly?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface GetTaxonomiesForStreamsParams {
|
|
38
|
+
/** Array of stream locators to query */
|
|
39
|
+
streams: StreamLocator[];
|
|
40
|
+
/** If true, returns only latest group_sequence per stream. Default: false */
|
|
41
|
+
latestOnly?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface TaxonomyQueryResult {
|
|
44
|
+
/** Parent stream data provider */
|
|
45
|
+
dataProvider: EthereumAddress;
|
|
46
|
+
/** Parent stream ID */
|
|
47
|
+
streamId: StreamId;
|
|
48
|
+
/** Child stream data provider */
|
|
49
|
+
childDataProvider: EthereumAddress;
|
|
50
|
+
/** Child stream ID */
|
|
51
|
+
childStreamId: StreamId;
|
|
52
|
+
/** Weight of the child stream in the taxonomy */
|
|
53
|
+
weight: string;
|
|
54
|
+
/** Block height when taxonomy was created */
|
|
55
|
+
createdAt: number;
|
|
56
|
+
/** Group sequence number for this taxonomy set */
|
|
57
|
+
groupSequence: number;
|
|
58
|
+
/** Start time timestamp for this taxonomy */
|
|
59
|
+
startTime: number;
|
|
60
|
+
}
|
|
23
61
|
export declare class ComposedAction extends Action {
|
|
24
62
|
constructor(kwilClient: WebKwil | NodeKwil, kwilSigner: KwilSigner);
|
|
25
63
|
/**
|
|
@@ -34,6 +72,43 @@ export declare class ComposedAction extends Action {
|
|
|
34
72
|
* @returns A promise that resolves to the transaction receipt
|
|
35
73
|
*/
|
|
36
74
|
setTaxonomy(taxonomy: TaxonomySet): Promise<GenericResponse<TxReceipt>>;
|
|
75
|
+
/**
|
|
76
|
+
* Lists taxonomies by block height range for incremental synchronization.
|
|
77
|
+
* Enables efficient detection of taxonomy changes since a specific block height.
|
|
78
|
+
*
|
|
79
|
+
* @param params Height range and pagination parameters
|
|
80
|
+
* @returns Promise resolving to taxonomy query results
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* const taxonomies = await composedAction.listTaxonomiesByHeight({
|
|
85
|
+
* fromHeight: 1000,
|
|
86
|
+
* toHeight: 2000,
|
|
87
|
+
* limit: 100,
|
|
88
|
+
* latestOnly: true
|
|
89
|
+
* });
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
listTaxonomiesByHeight(params?: ListTaxonomiesByHeightParams): Promise<TaxonomyQueryResult[]>;
|
|
93
|
+
/**
|
|
94
|
+
* Gets taxonomies for specific streams in batch.
|
|
95
|
+
* Useful for validating taxonomy data for known streams.
|
|
96
|
+
*
|
|
97
|
+
* @param params Stream locators and filtering options
|
|
98
|
+
* @returns Promise resolving to taxonomy query results
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* const taxonomies = await composedAction.getTaxonomiesForStreams({
|
|
103
|
+
* streams: [
|
|
104
|
+
* { dataProvider: provider1, streamId: streamId1 },
|
|
105
|
+
* { dataProvider: provider2, streamId: streamId2 }
|
|
106
|
+
* ],
|
|
107
|
+
* latestOnly: true
|
|
108
|
+
* });
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
getTaxonomiesForStreams(params: GetTaxonomiesForStreamsParams): Promise<TaxonomyQueryResult[]>;
|
|
37
112
|
/**
|
|
38
113
|
* Creates a ComposedStream from a base Stream
|
|
39
114
|
* @param stream The base stream to convert
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composedAction.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/composedAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAS,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"composedAction.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/composedAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAS,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,eAAO,MAAM,sBAAsB,oCAAoC,CAAC;AAExE,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,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,CACtB,QAAQ,EAAE,WAAW,GACpB,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAqCtC;;;;;;;;;;;;;;;;OAgBG;IACU,sBAAsB,CACjC,MAAM,GAAE,4BAAiC,GACxC,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAuCjC;;;;;;;;;;;;;;;;;OAiBG;IACU,uBAAuB,CAClC,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,mBAAmB,EAAE,CAAC;IA6CjC;;;;OAIG;WACW,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc;CAMzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composedAction.test.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/composedAction.test.ts"],"names":[],"mappings":""}
|
|
@@ -4,7 +4,7 @@ export type { StreamLocator } from "./types/stream";
|
|
|
4
4
|
export type { StreamRecord } from "./contracts-api/action";
|
|
5
5
|
export type { GetRecordInput, GetFirstRecordInput } from "./contracts-api/action";
|
|
6
6
|
export type { InsertRecordInput } from "./contracts-api/primitiveAction";
|
|
7
|
-
export type { TaxonomySet, TaxonomyItem } from "./contracts-api/composedAction";
|
|
7
|
+
export type { TaxonomySet, TaxonomyItem, ListTaxonomiesByHeightParams, GetTaxonomiesForStreamsParams, TaxonomyQueryResult } from "./contracts-api/composedAction";
|
|
8
8
|
export { StreamId } from "./util/StreamId";
|
|
9
9
|
export { EthereumAddress } from "./util/EthereumAddress";
|
|
10
10
|
export { visibility } from "./util/visibility";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.common.d.ts","sourceRoot":"","sources":["../../src/index.common.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,YAAY,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGjE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,YAAY,EAAE,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EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache-related type definitions for the Truf Network SDK
|
|
3
|
+
* These types enable cache-aware operations with proper TypeScript support
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Metadata about cache operations
|
|
7
|
+
* Matches the Go SDK implementation structure
|
|
8
|
+
*/
|
|
9
|
+
export interface CacheMetadata {
|
|
10
|
+
/** Whether the data came from cache */
|
|
11
|
+
hit: boolean;
|
|
12
|
+
/** Whether cache was disabled for this query */
|
|
13
|
+
cacheDisabled?: boolean;
|
|
14
|
+
/** Block height when data was cached (optional) */
|
|
15
|
+
height?: number;
|
|
16
|
+
/** Stream ID used in the query */
|
|
17
|
+
streamId?: string;
|
|
18
|
+
/** Data provider address */
|
|
19
|
+
dataProvider?: string;
|
|
20
|
+
/** Start time of the query range */
|
|
21
|
+
from?: number;
|
|
22
|
+
/** End time of the query range */
|
|
23
|
+
to?: number;
|
|
24
|
+
/** Frozen time for historical queries */
|
|
25
|
+
frozenAt?: number;
|
|
26
|
+
/** Number of rows returned */
|
|
27
|
+
rowsServed?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Enhanced options for getRecord method with cache support
|
|
31
|
+
*/
|
|
32
|
+
export interface GetRecordOptions {
|
|
33
|
+
/** Start time for the query range */
|
|
34
|
+
from?: number;
|
|
35
|
+
/** End time for the query range */
|
|
36
|
+
to?: number;
|
|
37
|
+
/** Frozen time for historical queries */
|
|
38
|
+
frozenAt?: number;
|
|
39
|
+
/** Base time for index calculations */
|
|
40
|
+
baseTime?: string | number;
|
|
41
|
+
/** Procedure name prefix */
|
|
42
|
+
prefix?: string;
|
|
43
|
+
/** Enable cache usage for this query */
|
|
44
|
+
useCache?: boolean;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Enhanced options for getIndex method with cache support
|
|
48
|
+
*/
|
|
49
|
+
export interface GetIndexOptions {
|
|
50
|
+
/** Start time for the query range */
|
|
51
|
+
from?: number;
|
|
52
|
+
/** End time for the query range */
|
|
53
|
+
to?: number;
|
|
54
|
+
/** Frozen time for historical queries */
|
|
55
|
+
frozenAt?: number;
|
|
56
|
+
/** Base time for index calculations */
|
|
57
|
+
baseTime?: string | number;
|
|
58
|
+
/** Procedure name prefix */
|
|
59
|
+
prefix?: string;
|
|
60
|
+
/** Enable cache usage for this query */
|
|
61
|
+
useCache?: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Enhanced options for getIndexChange method with cache support
|
|
65
|
+
*/
|
|
66
|
+
export interface GetIndexChangeOptions {
|
|
67
|
+
/** Start time for the query range */
|
|
68
|
+
from?: number;
|
|
69
|
+
/** End time for the query range */
|
|
70
|
+
to?: number;
|
|
71
|
+
/** Frozen time for historical queries */
|
|
72
|
+
frozenAt?: number;
|
|
73
|
+
/** Base time for index calculations */
|
|
74
|
+
baseTime?: string | number;
|
|
75
|
+
/** Time interval for change calculations */
|
|
76
|
+
timeInterval: number;
|
|
77
|
+
/** Procedure name prefix */
|
|
78
|
+
prefix?: string;
|
|
79
|
+
/** Enable cache usage for this query */
|
|
80
|
+
useCache?: boolean;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Enhanced options for getFirstRecord method with cache support
|
|
84
|
+
*/
|
|
85
|
+
export interface GetFirstRecordOptions {
|
|
86
|
+
/** Return records after this time */
|
|
87
|
+
after?: number;
|
|
88
|
+
/** Frozen time for historical queries */
|
|
89
|
+
frozenAt?: number;
|
|
90
|
+
/** Enable cache usage for this query */
|
|
91
|
+
useCache?: boolean;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Response wrapper that includes cache metadata
|
|
95
|
+
* Provides structured access to both data and cache information
|
|
96
|
+
*/
|
|
97
|
+
export interface CacheAwareResponse<T> {
|
|
98
|
+
/** The actual response data */
|
|
99
|
+
data: T;
|
|
100
|
+
/** Cache metadata (if available) */
|
|
101
|
+
cache?: CacheMetadata;
|
|
102
|
+
/** Action logs for debugging (optional) */
|
|
103
|
+
logs?: string[];
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Aggregated cache metadata from multiple operations
|
|
107
|
+
*/
|
|
108
|
+
export interface CacheMetadataCollection {
|
|
109
|
+
/** Total number of queries performed */
|
|
110
|
+
totalQueries: number;
|
|
111
|
+
/** Number of cache hits */
|
|
112
|
+
cacheHits: number;
|
|
113
|
+
/** Number of cache misses */
|
|
114
|
+
cacheMisses: number;
|
|
115
|
+
/** Cache hit rate (0-1) */
|
|
116
|
+
cacheHitRate: number;
|
|
117
|
+
/** Total rows served across all queries */
|
|
118
|
+
totalRowsServed: number;
|
|
119
|
+
/** Individual metadata entries */
|
|
120
|
+
entries: CacheMetadata[];
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Error class for cache-related operations
|
|
124
|
+
*/
|
|
125
|
+
export declare class CacheError extends Error {
|
|
126
|
+
cause?: Error | undefined;
|
|
127
|
+
constructor(message: string, cause?: Error | undefined);
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/types/cache.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,uCAAuC;IACvC,GAAG,EAAE,OAAO,CAAC;IACb,gDAAgD;IAChD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4BAA4B;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,EAAE,CAAC,EAAE,MAAM,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,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,+BAA+B;IAC/B,IAAI,EAAE,CAAC,CAAC;IACR,oCAAoC;IACpC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,2BAA2B;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,eAAe,EAAE,MAAM,CAAC;IACxB,kCAAkC;IAClC,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACC,KAAK,CAAC,EAAE,KAAK;gBAArC,OAAO,EAAE,MAAM,EAAS,KAAK,CAAC,EAAE,KAAK,YAAA;CAOlD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.test.d.ts","sourceRoot":"","sources":["../../../src/types/cache.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CacheMetadata, CacheMetadataCollection } from '../types/cache';
|
|
2
|
+
/**
|
|
3
|
+
* Parser for extracting cache metadata from action logs
|
|
4
|
+
* Handles the parsing of cache-related information from SQL action responses
|
|
5
|
+
*/
|
|
6
|
+
export declare class CacheMetadataParser {
|
|
7
|
+
/**
|
|
8
|
+
* Parses logs and removes prepended numeric prefixes (e.g., "1. ", "2. ")
|
|
9
|
+
* @param logsInput - The logs string or array to parse
|
|
10
|
+
* @returns Array of clean log lines
|
|
11
|
+
*/
|
|
12
|
+
static parseLogsForMetadata(logsInput: string | string[]): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Extracts cache metadata from action logs
|
|
15
|
+
* @param logs - The action logs returned from the backend (may be a single string or array)
|
|
16
|
+
* @returns Cache metadata if found, null otherwise
|
|
17
|
+
*/
|
|
18
|
+
static extractFromLogs(logs: string | string[]): CacheMetadata | null;
|
|
19
|
+
/**
|
|
20
|
+
* Validates cache metadata structure
|
|
21
|
+
* @param metadata - The cache metadata to validate
|
|
22
|
+
* @returns True if metadata is valid, false otherwise
|
|
23
|
+
*/
|
|
24
|
+
static isValidCacheMetadata(metadata: any): metadata is CacheMetadata;
|
|
25
|
+
/**
|
|
26
|
+
* Extracts cache metadata from Kwil response structure
|
|
27
|
+
* @param response - The full response from Kwil client
|
|
28
|
+
* @returns Cache metadata if found, null otherwise
|
|
29
|
+
*/
|
|
30
|
+
static extractFromResponse(response: any): CacheMetadata | null;
|
|
31
|
+
/**
|
|
32
|
+
* Aggregates multiple cache metadata entries into a collection
|
|
33
|
+
* @param metadataList - Array of cache metadata entries
|
|
34
|
+
* @returns Aggregated cache metadata collection
|
|
35
|
+
*/
|
|
36
|
+
static aggregate(metadataList: CacheMetadata[]): CacheMetadataCollection;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=cacheMetadataParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheMetadataParser.d.ts","sourceRoot":"","sources":["../../../src/util/cacheMetadataParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAExE;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B;;;;OAIG;IACH,MAAM,CAAC,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE;IAsCnE;;;;OAIG;IACH,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,aAAa,GAAG,IAAI;IAyCrE;;;;OAIG;IACH,MAAM,CAAC,oBAAoB,CAAC,QAAQ,EAAE,GAAG,GAAG,QAAQ,IAAI,aAAa;IA8CrE;;;;OAIG;IACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,GAAG,GAAG,aAAa,GAAG,IAAI;IAc/D;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,aAAa,EAAE,GAAG,uBAAuB;CA2BzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheMetadataParser.test.d.ts","sourceRoot":"","sources":["../../../src/util/cacheMetadataParser.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GetRecordOptions, GetIndexOptions, GetIndexChangeOptions, GetFirstRecordOptions } from '../types/cache';
|
|
2
|
+
/**
|
|
3
|
+
* Validation utilities for cache-related parameters
|
|
4
|
+
*/
|
|
5
|
+
export declare class CacheValidation {
|
|
6
|
+
/**
|
|
7
|
+
* Validates GetRecordOptions parameters
|
|
8
|
+
*/
|
|
9
|
+
static validateGetRecordOptions(options: GetRecordOptions): void;
|
|
10
|
+
/**
|
|
11
|
+
* Validates GetIndexOptions parameters
|
|
12
|
+
*/
|
|
13
|
+
static validateGetIndexOptions(options: GetIndexOptions): void;
|
|
14
|
+
/**
|
|
15
|
+
* Validates GetIndexChangeOptions parameters
|
|
16
|
+
*/
|
|
17
|
+
static validateGetIndexChangeOptions(options: GetIndexChangeOptions): void;
|
|
18
|
+
/**
|
|
19
|
+
* Validates GetFirstRecordOptions parameters
|
|
20
|
+
*/
|
|
21
|
+
static validateGetFirstRecordOptions(options: GetFirstRecordOptions): void;
|
|
22
|
+
/**
|
|
23
|
+
* Validates time range parameters
|
|
24
|
+
*/
|
|
25
|
+
static validateTimeRange(from?: number, to?: number): void;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=cacheValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheValidation.d.ts","sourceRoot":"","sources":["../../../src/util/cacheValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEjH;;GAEG;AACH,qBAAa,eAAe;IAC1B;;OAEG;IACH,MAAM,CAAC,wBAAwB,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IA0BhE;;OAEG;IACH,MAAM,CAAC,uBAAuB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAK9D;;OAEG;IACH,MAAM,CAAC,6BAA6B,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI;IAU1E;;OAEG;IACH,MAAM,CAAC,6BAA6B,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI;IAc1E;;OAEG;IACH,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;CAK3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheValidation.test.d.ts","sourceRoot":"","sources":["../../../src/util/cacheValidation.test.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trufnetwork/sdk-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "TRUF.NETWORK SDK for JavaScript/TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -46,10 +46,12 @@
|
|
|
46
46
|
"prepublishOnly": "npm run build",
|
|
47
47
|
"tag:dev": "pnpm version 0.0.0-dev-$(date +%Y%m%d%H%M%S) --no-git-tag-version",
|
|
48
48
|
"publish:dev": "pnpm publish --tag dev --no-git-checks",
|
|
49
|
-
"test": "vitest"
|
|
49
|
+
"test": "vitest",
|
|
50
|
+
"test:unit": "vitest src/ --run",
|
|
51
|
+
"test:integration": "vitest tests/integration/ --run"
|
|
50
52
|
},
|
|
51
53
|
"dependencies": {
|
|
52
|
-
"@trufnetwork/kwil-js": "^0.9.
|
|
54
|
+
"@trufnetwork/kwil-js": "^0.9.6-rc.2",
|
|
53
55
|
"crypto-hash": "^3.1.0",
|
|
54
56
|
"ethers": "^6.13.5",
|
|
55
57
|
"lodash": "^4.17.21",
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// src/client/client.test.ts
|
|
4
|
-
var import_vitest = require("vitest");
|
|
5
|
-
var import_ethers = require("ethers");
|
|
6
|
-
var import_nodeClient = require("./nodeClient.cjs");
|
|
7
|
-
import_vitest.describe.sequential("Client", { timeout: 3e4 }, () => {
|
|
8
|
-
import_vitest.it.skipIf(process.env.CI);
|
|
9
|
-
const wallet = new import_ethers.ethers.Wallet(
|
|
10
|
-
"0x0000000000000000000000000000000000000000000000000000000000000001"
|
|
11
|
-
);
|
|
12
|
-
(0, import_vitest.it)("should create a client", async () => {
|
|
13
|
-
const chainId = await import_nodeClient.NodeTNClient.getDefaultChainId(
|
|
14
|
-
"http://localhost:8484"
|
|
15
|
-
);
|
|
16
|
-
if (!chainId) {
|
|
17
|
-
throw new Error("Chain id not found");
|
|
18
|
-
}
|
|
19
|
-
const client = new import_nodeClient.NodeTNClient({
|
|
20
|
-
endpoint: "http://localhost:8484",
|
|
21
|
-
signerInfo: {
|
|
22
|
-
address: wallet.address,
|
|
23
|
-
signer: wallet
|
|
24
|
-
},
|
|
25
|
-
chainId
|
|
26
|
-
});
|
|
27
|
-
const kwilClient = client.getKwilClient();
|
|
28
|
-
const chainInfo = await kwilClient.chainInfo();
|
|
29
|
-
(0, import_vitest.expect)(chainInfo.data?.chain_id).toBeDefined();
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
//# sourceMappingURL=client.test.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/client/client.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { describe, expect, it } from \"vitest\";\nimport { ethers } from \"ethers\";\nimport { NodeTNClient } from \"./nodeClient\";\n\ndescribe.sequential(\"Client\", { timeout: 30000 }, () => {\n // Skip in CI, because it needs a local node\n it.skipIf(process.env.CI);\n\n const wallet = new ethers.Wallet(\n \"0x0000000000000000000000000000000000000000000000000000000000000001\",\n );\n it(\"should create a client\", async () => {\n const chainId = await NodeTNClient.getDefaultChainId(\n \"http://localhost:8484\",\n );\n if (!chainId) {\n throw new Error(\"Chain id not found\");\n }\n const client = new NodeTNClient({\n endpoint: \"http://localhost:8484\",\n signerInfo: {\n address: wallet.address,\n signer: wallet,\n },\n chainId,\n });\n const kwilClient = client.getKwilClient();\n const chainInfo = await kwilClient.chainInfo();\n expect(chainInfo.data?.chain_id).toBeDefined();\n });\n});\n"],
|
|
5
|
-
"mappings": ";;;AAAA,oBAAqC;AACrC,oBAAuB;AACvB,wBAA6B;AAE7B,uBAAS,WAAW,UAAU,EAAE,SAAS,IAAM,GAAG,MAAM;AAEtD,mBAAG,OAAO,QAAQ,IAAI,EAAE;AAExB,QAAM,SAAS,IAAI,qBAAO;AAAA,IACxB;AAAA,EACF;AACA,wBAAG,0BAA0B,YAAY;AACvC,UAAM,UAAU,MAAM,+BAAa;AAAA,MACjC;AAAA,IACF;AACA,QAAI,CAAC,SAAS;AACZ,YAAM,IAAI,MAAM,oBAAoB;AAAA,IACtC;AACA,UAAM,SAAS,IAAI,+BAAa;AAAA,MAC9B,UAAU;AAAA,MACV,YAAY;AAAA,QACV,SAAS,OAAO;AAAA,QAChB,QAAQ;AAAA,MACV;AAAA,MACA;AAAA,IACF,CAAC;AACD,UAAM,aAAa,OAAO,cAAc;AACxC,UAAM,YAAY,MAAM,WAAW,UAAU;AAC7C,8BAAO,UAAU,MAAM,QAAQ,EAAE,YAAY;AAAA,EAC/C,CAAC;AACH,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// src/client/client.test.ts
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { ethers } from "ethers";
|
|
4
|
-
import { NodeTNClient } from "./nodeClient.mjs";
|
|
5
|
-
describe.sequential("Client", { timeout: 3e4 }, () => {
|
|
6
|
-
it.skipIf(process.env.CI);
|
|
7
|
-
const wallet = new ethers.Wallet(
|
|
8
|
-
"0x0000000000000000000000000000000000000000000000000000000000000001"
|
|
9
|
-
);
|
|
10
|
-
it("should create a client", async () => {
|
|
11
|
-
const chainId = await NodeTNClient.getDefaultChainId(
|
|
12
|
-
"http://localhost:8484"
|
|
13
|
-
);
|
|
14
|
-
if (!chainId) {
|
|
15
|
-
throw new Error("Chain id not found");
|
|
16
|
-
}
|
|
17
|
-
const client = new NodeTNClient({
|
|
18
|
-
endpoint: "http://localhost:8484",
|
|
19
|
-
signerInfo: {
|
|
20
|
-
address: wallet.address,
|
|
21
|
-
signer: wallet
|
|
22
|
-
},
|
|
23
|
-
chainId
|
|
24
|
-
});
|
|
25
|
-
const kwilClient = client.getKwilClient();
|
|
26
|
-
const chainInfo = await kwilClient.chainInfo();
|
|
27
|
-
expect(chainInfo.data?.chain_id).toBeDefined();
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
//# sourceMappingURL=client.test.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/client/client.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { describe, expect, it } from \"vitest\";\nimport { ethers } from \"ethers\";\nimport { NodeTNClient } from \"./nodeClient\";\n\ndescribe.sequential(\"Client\", { timeout: 30000 }, () => {\n // Skip in CI, because it needs a local node\n it.skipIf(process.env.CI);\n\n const wallet = new ethers.Wallet(\n \"0x0000000000000000000000000000000000000000000000000000000000000001\",\n );\n it(\"should create a client\", async () => {\n const chainId = await NodeTNClient.getDefaultChainId(\n \"http://localhost:8484\",\n );\n if (!chainId) {\n throw new Error(\"Chain id not found\");\n }\n const client = new NodeTNClient({\n endpoint: \"http://localhost:8484\",\n signerInfo: {\n address: wallet.address,\n signer: wallet,\n },\n chainId,\n });\n const kwilClient = client.getKwilClient();\n const chainInfo = await kwilClient.chainInfo();\n expect(chainInfo.data?.chain_id).toBeDefined();\n });\n});\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,UAAU,QAAQ,UAAU;AACrC,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAE7B,SAAS,WAAW,UAAU,EAAE,SAAS,IAAM,GAAG,MAAM;AAEtD,KAAG,OAAO,QAAQ,IAAI,EAAE;AAExB,QAAM,SAAS,IAAI,OAAO;AAAA,IACxB;AAAA,EACF;AACA,KAAG,0BAA0B,YAAY;AACvC,UAAM,UAAU,MAAM,aAAa;AAAA,MACjC;AAAA,IACF;AACA,QAAI,CAAC,SAAS;AACZ,YAAM,IAAI,MAAM,oBAAoB;AAAA,IACtC;AACA,UAAM,SAAS,IAAI,aAAa;AAAA,MAC9B,UAAU;AAAA,MACV,YAAY;AAAA,QACV,SAAS,OAAO;AAAA,QAChB,QAAQ;AAAA,MACV;AAAA,MACA;AAAA,IACF,CAAC;AACD,UAAM,aAAa,OAAO,cAAc;AACxC,UAAM,YAAY,MAAM,WAAW,UAAU;AAC7C,WAAO,UAAU,MAAM,QAAQ,EAAE,YAAY;AAAA,EAC/C,CAAC;AACH,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|