@trufnetwork/sdk-js 0.4.1 → 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/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/esm/client/client.mjs +44 -0
- package/dist/esm/client/client.mjs.map +2 -2
- 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/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/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/package.json +1 -1
|
@@ -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,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,aAAa,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,aAAa,CAAC;IACtB;;OAEG;IACH,mBAAmB,EAAE,OAAO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,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,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClF,YAAY,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzE,YAAY,EAAE,WAAW,EAA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