@trufnetwork/sdk-js 0.2.2 → 0.3.0
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/README.md +91 -13
- package/dist/cjs/client/client.cjs +41 -32
- package/dist/cjs/client/client.cjs.map +2 -2
- package/dist/cjs/client/getLastTransactions.cjs +67 -0
- package/dist/cjs/client/getLastTransactions.cjs.map +7 -0
- package/dist/cjs/client/listStreams.cjs +46 -0
- package/dist/cjs/client/listStreams.cjs.map +7 -0
- package/dist/cjs/contracts-api/{stream.cjs → action.cjs} +140 -159
- package/dist/cjs/contracts-api/action.cjs.map +7 -0
- package/dist/cjs/contracts-api/composedAction.cjs +183 -0
- package/dist/cjs/contracts-api/composedAction.cjs.map +7 -0
- package/dist/cjs/contracts-api/{destroyStream.cjs → deleteStream.cjs} +16 -16
- package/dist/cjs/contracts-api/deleteStream.cjs.map +7 -0
- package/dist/cjs/contracts-api/deployStream.cjs +33 -16
- package/dist/cjs/contracts-api/deployStream.cjs.map +3 -3
- package/dist/cjs/contracts-api/primitiveAction.cjs +92 -0
- package/dist/cjs/contracts-api/primitiveAction.cjs.map +7 -0
- package/dist/cjs/index.common.cjs +6 -6
- package/dist/cjs/index.common.cjs.map +1 -1
- package/dist/cjs/types/transaction.cjs +19 -0
- package/dist/cjs/types/transaction.cjs.map +7 -0
- package/dist/cjs/util/EthereumAddress.cjs +0 -1
- package/dist/cjs/util/EthereumAddress.cjs.map +2 -2
- package/dist/cjs/util/StreamId.cjs +7 -2
- package/dist/cjs/util/StreamId.cjs.map +2 -2
- package/dist/esm/client/client.mjs +41 -32
- package/dist/esm/client/client.mjs.map +2 -2
- package/dist/esm/client/getLastTransactions.mjs +46 -0
- package/dist/esm/client/getLastTransactions.mjs.map +7 -0
- package/dist/esm/client/listStreams.mjs +25 -0
- package/dist/esm/client/listStreams.mjs.map +7 -0
- package/dist/esm/contracts-api/{stream.mjs → action.mjs} +137 -156
- package/dist/esm/contracts-api/action.mjs.map +7 -0
- package/dist/esm/contracts-api/composedAction.mjs +156 -0
- package/dist/esm/contracts-api/composedAction.mjs.map +7 -0
- package/dist/esm/contracts-api/deleteStream.mjs +24 -0
- package/dist/esm/contracts-api/deleteStream.mjs.map +7 -0
- package/dist/esm/contracts-api/deployStream.mjs +23 -21
- package/dist/esm/contracts-api/deployStream.mjs.map +2 -2
- package/dist/esm/contracts-api/primitiveAction.mjs +71 -0
- package/dist/esm/contracts-api/primitiveAction.mjs.map +7 -0
- package/dist/esm/index.common.mjs +6 -6
- package/dist/esm/index.common.mjs.map +1 -1
- package/dist/esm/types/transaction.mjs +1 -0
- package/dist/esm/types/transaction.mjs.map +7 -0
- package/dist/esm/util/EthereumAddress.mjs +0 -1
- package/dist/esm/util/EthereumAddress.mjs.map +2 -2
- package/dist/esm/util/StreamId.mjs +7 -2
- package/dist/esm/util/StreamId.mjs.map +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/client/client.d.ts +38 -15
- package/dist/types/client/client.d.ts.map +1 -1
- package/dist/types/client/getLastTransactions.d.ts +5 -0
- package/dist/types/client/getLastTransactions.d.ts.map +1 -0
- package/dist/types/client/listStreams.d.ts +12 -0
- package/dist/types/client/listStreams.d.ts.map +1 -0
- package/dist/types/contracts-api/action.d.ts +136 -0
- package/dist/types/contracts-api/action.d.ts.map +1 -0
- package/dist/types/contracts-api/{composedStream.d.ts → composedAction.d.ts} +11 -22
- package/dist/types/contracts-api/composedAction.d.ts.map +1 -0
- package/dist/types/contracts-api/{destroyStream.d.ts → deleteStream.d.ts} +7 -7
- package/dist/types/contracts-api/deleteStream.d.ts.map +1 -0
- package/dist/types/contracts-api/deployStream.d.ts +2 -2
- package/dist/types/contracts-api/deployStream.d.ts.map +1 -1
- package/dist/types/contracts-api/primitiveAction.d.ts +33 -0
- package/dist/types/contracts-api/primitiveAction.d.ts.map +1 -0
- package/dist/types/index.common.d.ts +7 -7
- package/dist/types/types/transaction.d.ts +11 -0
- package/dist/types/types/transaction.d.ts.map +1 -0
- package/dist/types/util/EthereumAddress.d.ts.map +1 -1
- package/dist/types/util/StreamId.d.ts +2 -0
- package/dist/types/util/StreamId.d.ts.map +1 -1
- package/dist/types/util/visibility.d.ts.map +1 -1
- package/package.json +10 -6
- package/dist/cjs/client/listAllStreams.cjs +0 -51
- package/dist/cjs/client/listAllStreams.cjs.map +0 -7
- package/dist/cjs/contracts/composed_stream_template.json +0 -1638
- package/dist/cjs/contracts/composed_stream_template_unix.json +0 -2122
- package/dist/cjs/contracts/contractsContent.cjs +0 -65
- package/dist/cjs/contracts/contractsContent.cjs.map +0 -7
- package/dist/cjs/contracts/primitive_stream_template.json +0 -952
- package/dist/cjs/contracts/primitive_stream_template_unix.json +0 -1173
- package/dist/cjs/contracts-api/composedStream.cjs +0 -137
- package/dist/cjs/contracts-api/composedStream.cjs.map +0 -7
- package/dist/cjs/contracts-api/destroyStream.cjs.map +0 -7
- package/dist/cjs/contracts-api/primitiveStream.cjs +0 -86
- package/dist/cjs/contracts-api/primitiveStream.cjs.map +0 -7
- package/dist/cjs/contracts-api/stream.cjs.map +0 -7
- package/dist/esm/client/listAllStreams.mjs +0 -30
- package/dist/esm/client/listAllStreams.mjs.map +0 -7
- package/dist/esm/contracts/composed_stream_template.json +0 -1638
- package/dist/esm/contracts/composed_stream_template_unix.json +0 -2122
- package/dist/esm/contracts/contractsContent.mjs +0 -33
- package/dist/esm/contracts/contractsContent.mjs.map +0 -7
- package/dist/esm/contracts/primitive_stream_template.json +0 -952
- package/dist/esm/contracts/primitive_stream_template_unix.json +0 -1173
- package/dist/esm/contracts-api/composedStream.mjs +0 -116
- package/dist/esm/contracts-api/composedStream.mjs.map +0 -7
- package/dist/esm/contracts-api/destroyStream.mjs +0 -24
- package/dist/esm/contracts-api/destroyStream.mjs.map +0 -7
- package/dist/esm/contracts-api/primitiveStream.mjs +0 -65
- package/dist/esm/contracts-api/primitiveStream.mjs.map +0 -7
- package/dist/esm/contracts-api/stream.mjs.map +0 -7
- package/dist/types/client/listAllStreams.d.ts +0 -14
- package/dist/types/client/listAllStreams.d.ts.map +0 -1
- package/dist/types/contracts/contractsContent.d.ts +0 -6
- package/dist/types/contracts/contractsContent.d.ts.map +0 -1
- package/dist/types/contracts-api/composedStream.d.ts.map +0 -1
- package/dist/types/contracts-api/destroyStream.d.ts.map +0 -1
- package/dist/types/contracts-api/primitiveStream.d.ts +0 -39
- package/dist/types/contracts-api/primitiveStream.d.ts.map +0 -1
- package/dist/types/contracts-api/stream.d.ts +0 -142
- package/dist/types/contracts-api/stream.d.ts.map +0 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { KwilSigner, NodeKwil, WebKwil } from "@kwilteam/kwil-js";
|
|
2
|
+
import { ActionBody } from '@kwilteam/kwil-js/dist/core/action';
|
|
3
|
+
import { NamedParams } from "@kwilteam/kwil-js/dist/core/action";
|
|
4
|
+
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq";
|
|
5
|
+
import { TxReceipt } from "@kwilteam/kwil-js/dist/core/tx";
|
|
6
|
+
import { Either } from "monads-io";
|
|
7
|
+
import { DateString } from "../types/other";
|
|
8
|
+
import { StreamLocator } from "../types/stream";
|
|
9
|
+
import { EthereumAddress } from "../util/EthereumAddress";
|
|
10
|
+
import { VisibilityEnum } from "../util/visibility";
|
|
11
|
+
import { MetadataKey, MetadataValueTypeForKey, StreamType } from "./contractValues";
|
|
12
|
+
import { ValueType } from "@kwilteam/kwil-js/dist/utils/types";
|
|
13
|
+
export interface GetRecordInput {
|
|
14
|
+
stream: StreamLocator;
|
|
15
|
+
from?: number;
|
|
16
|
+
to?: number;
|
|
17
|
+
frozenAt?: number;
|
|
18
|
+
baseTime?: DateString | number;
|
|
19
|
+
}
|
|
20
|
+
export interface GetFirstRecordInput {
|
|
21
|
+
stream: StreamLocator;
|
|
22
|
+
after?: number;
|
|
23
|
+
frozenAt?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface StreamRecord {
|
|
26
|
+
eventTime: number;
|
|
27
|
+
value: string;
|
|
28
|
+
}
|
|
29
|
+
export interface GetIndexChangeInput extends GetRecordInput {
|
|
30
|
+
timeInterval: number;
|
|
31
|
+
}
|
|
32
|
+
export declare class Action {
|
|
33
|
+
protected kwilClient: WebKwil | NodeKwil;
|
|
34
|
+
protected kwilSigner: KwilSigner;
|
|
35
|
+
constructor(kwilClient: WebKwil | NodeKwil, kwilSigner: KwilSigner);
|
|
36
|
+
/**
|
|
37
|
+
* Executes a method on the stream
|
|
38
|
+
*/
|
|
39
|
+
protected executeWithNamedParams(method: string, inputs: NamedParams[]): Promise<GenericResponse<TxReceipt>>;
|
|
40
|
+
/**
|
|
41
|
+
* Executes a method on the stream
|
|
42
|
+
*/
|
|
43
|
+
protected executeWithActionBody(inputs: ActionBody, synchronous?: boolean): Promise<GenericResponse<TxReceipt>>;
|
|
44
|
+
/**
|
|
45
|
+
* Calls a method on the stream
|
|
46
|
+
*/
|
|
47
|
+
protected call<T>(method: string, inputs: NamedParams): Promise<Either<number, T>>;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the records of the stream within the given date range
|
|
50
|
+
*/
|
|
51
|
+
getRecord(input: GetRecordInput): Promise<StreamRecord[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Returns the index of the stream within the given date range
|
|
54
|
+
*/
|
|
55
|
+
getIndex(input: GetRecordInput): Promise<StreamRecord[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Returns the type of the stream
|
|
58
|
+
*/
|
|
59
|
+
getType(stream: StreamLocator): Promise<StreamType>;
|
|
60
|
+
/**
|
|
61
|
+
* Returns the first record of the stream
|
|
62
|
+
*/
|
|
63
|
+
getFirstRecord(input: GetFirstRecordInput): Promise<StreamRecord | null>;
|
|
64
|
+
protected setMetadata<K extends MetadataKey>(stream: StreamLocator, key: K, value: MetadataValueTypeForKey<K>): Promise<GenericResponse<TxReceipt>>;
|
|
65
|
+
protected getMetadata<K extends MetadataKey>(stream: StreamLocator, key: K, filteredRef?: string, limit?: number, offset?: number, orderBy?: string): Promise<{
|
|
66
|
+
rowId: string;
|
|
67
|
+
value: MetadataValueTypeForKey<K>;
|
|
68
|
+
createdAt: number;
|
|
69
|
+
}[]>;
|
|
70
|
+
/**
|
|
71
|
+
* Sets the read visibility of the stream
|
|
72
|
+
*/
|
|
73
|
+
setReadVisibility(stream: StreamLocator, visibility: VisibilityEnum): Promise<GenericResponse<TxReceipt>>;
|
|
74
|
+
/**
|
|
75
|
+
* Returns the read visibility of the stream
|
|
76
|
+
*/
|
|
77
|
+
getReadVisibility(stream: StreamLocator): Promise<VisibilityEnum | null>;
|
|
78
|
+
/**
|
|
79
|
+
* Sets the compose visibility of the stream
|
|
80
|
+
*/
|
|
81
|
+
setComposeVisibility(stream: StreamLocator, visibility: VisibilityEnum): Promise<GenericResponse<TxReceipt>>;
|
|
82
|
+
/**
|
|
83
|
+
* Returns the compose visibility of the stream
|
|
84
|
+
*/
|
|
85
|
+
getComposeVisibility(stream: StreamLocator): Promise<VisibilityEnum | null>;
|
|
86
|
+
/**
|
|
87
|
+
* Allows a wallet to read the stream
|
|
88
|
+
*/
|
|
89
|
+
allowReadWallet(stream: StreamLocator, wallet: EthereumAddress): Promise<GenericResponse<TxReceipt>>;
|
|
90
|
+
/**
|
|
91
|
+
* Disables a wallet from reading the stream
|
|
92
|
+
*/
|
|
93
|
+
disableReadWallet(stream: StreamLocator, wallet: EthereumAddress): Promise<GenericResponse<TxReceipt>>;
|
|
94
|
+
/**
|
|
95
|
+
* Allows a stream to use this stream as child
|
|
96
|
+
*/
|
|
97
|
+
allowComposeStream(stream: StreamLocator, wallet: StreamLocator): Promise<GenericResponse<TxReceipt>>;
|
|
98
|
+
/**
|
|
99
|
+
* Disables a stream from using this stream as child
|
|
100
|
+
*/
|
|
101
|
+
disableComposeStream(stream: StreamLocator, wallet: StreamLocator): Promise<GenericResponse<TxReceipt>>;
|
|
102
|
+
protected disableMetadata(stream: StreamLocator, rowId: string): Promise<GenericResponse<TxReceipt>>;
|
|
103
|
+
/**
|
|
104
|
+
* Returns the wallets allowed to read the stream
|
|
105
|
+
*/
|
|
106
|
+
getAllowedReadWallets(stream: StreamLocator): Promise<EthereumAddress[]>;
|
|
107
|
+
/**
|
|
108
|
+
* Returns the streams allowed to compose the stream
|
|
109
|
+
*/
|
|
110
|
+
getAllowedComposeStreams(stream: StreamLocator): Promise<StreamLocator[]>;
|
|
111
|
+
/**
|
|
112
|
+
* Returns the index change of the stream within the given date range
|
|
113
|
+
*/
|
|
114
|
+
getIndexChange(input: GetIndexChangeInput): Promise<StreamRecord[]>;
|
|
115
|
+
/**
|
|
116
|
+
* A custom method that accepts the procedure name and the input of GetRecordInput
|
|
117
|
+
* Returns the result of the procedure in the same format as StreamRecord
|
|
118
|
+
* I.e. a custom procedure named "get_price" that returns a list of date_value and value
|
|
119
|
+
* can be called with customGetProcedure("get_price", { dateFrom: "2021-01-01", dateTo: "2021-01-31" })
|
|
120
|
+
*/
|
|
121
|
+
customGetProcedure(procedure: string, input: GetRecordInput): Promise<StreamRecord[]>;
|
|
122
|
+
/**
|
|
123
|
+
* A custom method that accepts the procedure name and custom input of type Record<string, any>
|
|
124
|
+
* Returns the result of the procedure in the same format as StreamRecord
|
|
125
|
+
* I.e. a custom procedure named "get_custom_index" that returns a list of date_value and value
|
|
126
|
+
* can be called with customProcedureWithArgs("get_custom_index", { $customArg1: "value1", $customArg2: "value2" })
|
|
127
|
+
* where $customArg1 and $customArg2 are the arguments of the procedure
|
|
128
|
+
* @param procedure
|
|
129
|
+
* @param args
|
|
130
|
+
*/
|
|
131
|
+
customProcedureWithArgs(procedure: string, args: Record<string, ValueType | ValueType[]>): Promise<{
|
|
132
|
+
eventTime: number;
|
|
133
|
+
value: string;
|
|
134
|
+
}[]>;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/action.ts"],"names":[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AQtC;;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;;OAEG;IACU,cAAc,CACzB,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,YAAY,EAAE,CAAC;IAwB1B;;;;;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;;;;CAehD"}
|
|
@@ -1,40 +1,28 @@
|
|
|
1
1
|
import { KwilSigner, NodeKwil, WebKwil } from "@kwilteam/kwil-js";
|
|
2
2
|
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq";
|
|
3
3
|
import { TxReceipt } from "@kwilteam/kwil-js/dist/core/tx";
|
|
4
|
-
import { DateString } from "../types/other";
|
|
5
4
|
import { StreamLocator } from "../types/stream";
|
|
6
|
-
import {
|
|
5
|
+
import { Action } from "./action";
|
|
7
6
|
export declare const ErrorStreamNotComposed = "stream is not a composed stream";
|
|
8
7
|
export interface TaxonomySet {
|
|
8
|
+
stream: StreamLocator;
|
|
9
9
|
taxonomyItems: TaxonomyItem[];
|
|
10
|
-
startDate:
|
|
10
|
+
startDate: number;
|
|
11
11
|
}
|
|
12
12
|
export interface TaxonomyItem {
|
|
13
13
|
childStream: StreamLocator;
|
|
14
14
|
weight: string;
|
|
15
15
|
}
|
|
16
16
|
export interface DescribeTaxonomiesParams {
|
|
17
|
+
stream: StreamLocator;
|
|
17
18
|
/**
|
|
18
19
|
* if true, will return the latest version of the taxonomy only
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
|
+
latestGroupSequence: boolean;
|
|
21
22
|
}
|
|
22
|
-
export declare class
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* Checks if the stream is a valid composed stream.
|
|
26
|
-
* A valid composed stream must be:
|
|
27
|
-
* - initialized
|
|
28
|
-
* - of type composed
|
|
29
|
-
*/
|
|
30
|
-
private checkValidComposedStream;
|
|
31
|
-
/**
|
|
32
|
-
* Executes a method after checking if the stream is a valid composed stream
|
|
33
|
-
* @param method The method name to execute
|
|
34
|
-
* @param inputs The inputs for the action
|
|
35
|
-
* @returns A generic response containing the transaction receipt
|
|
36
|
-
*/
|
|
37
|
-
private checkedComposedExecute;
|
|
23
|
+
export declare class ComposedAction extends Action {
|
|
24
|
+
protected neonConnectionString: string | undefined;
|
|
25
|
+
constructor(kwilClient: WebKwil | NodeKwil, kwilSigner: KwilSigner, neonConnectionString?: string);
|
|
38
26
|
/**
|
|
39
27
|
* Returns the taxonomy of the stream
|
|
40
28
|
* @param params Parameters for describing taxonomies
|
|
@@ -50,8 +38,9 @@ export declare class ComposedStream extends Stream {
|
|
|
50
38
|
/**
|
|
51
39
|
* Creates a ComposedStream from a base Stream
|
|
52
40
|
* @param stream The base stream to convert
|
|
41
|
+
* @param neonConnectionString The Neon connection string
|
|
53
42
|
* @returns A ComposedStream instance
|
|
54
43
|
*/
|
|
55
|
-
static fromStream(stream:
|
|
44
|
+
static fromStream(stream: Action, neonConnectionString?: string): ComposedAction;
|
|
56
45
|
}
|
|
57
|
-
//# sourceMappingURL=
|
|
46
|
+
//# sourceMappingURL=composedAction.d.ts.map
|
|
@@ -0,0 +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,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAKlC,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,CAAC;CAC9B;AAED,qBAAa,cAAe,SAAQ,MAAM;IACxC,SAAS,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;gBAGjD,UAAU,EAAE,OAAO,GAAG,QAAQ,EAC9B,UAAU,EAAE,UAAU,EACtB,oBAAoB,CAAC,EAAE,MAAM;IAM/B;;;;OAIG;IACU,kBAAkB,CAC7B,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,WAAW,EAAE,CAAC;IA2DzB;;;;OAIG;IACU,WAAW,CACtB,QAAQ,EAAE,WAAW,GACpB,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IA+EtC;;;;;OAKG;WACW,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,cAAc;CAOxF"}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { StreamId } from "../util/StreamId";
|
|
2
1
|
import { Kwil } from "@kwilteam/kwil-js/dist/client/kwil";
|
|
3
2
|
import { KwilSigner } from "@kwilteam/kwil-js";
|
|
4
3
|
import { TxReceipt } from "@kwilteam/kwil-js/dist/core/tx";
|
|
5
4
|
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq";
|
|
5
|
+
import { StreamLocator } from "../types/stream";
|
|
6
6
|
/**
|
|
7
7
|
* Input parameters for destroying a stream.
|
|
8
8
|
*/
|
|
9
9
|
export interface DestroyStreamInput {
|
|
10
|
-
|
|
10
|
+
stream: StreamLocator;
|
|
11
11
|
kwilClient: Kwil<any>;
|
|
12
12
|
kwilSigner: KwilSigner;
|
|
13
13
|
synchronous?: boolean;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Output after
|
|
16
|
+
* Output after deleting a stream.
|
|
17
17
|
*/
|
|
18
|
-
export interface
|
|
18
|
+
export interface DeleteStreamOutput {
|
|
19
19
|
receipt: TxReceipt;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Delete a stream from TN.
|
|
23
23
|
* @param input - The input parameters for destroying the stream.
|
|
24
24
|
* @returns The transaction receipt of the destruction.
|
|
25
25
|
*/
|
|
26
|
-
export declare function
|
|
27
|
-
//# sourceMappingURL=
|
|
26
|
+
export declare function deleteStream(input: DestroyStreamInput): Promise<GenericResponse<TxReceipt>>;
|
|
27
|
+
//# sourceMappingURL=deleteStream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteStream.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/deleteStream.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,oCAAoC,CAAC;AACxD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAC,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAC,eAAe,EAAC,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,SAAS,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAgBrC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { StreamType } from "./contractValues";
|
|
2
2
|
import { TxReceipt } from "@kwilteam/kwil-js/dist/core/tx";
|
|
3
3
|
import { Kwil } from "@kwilteam/kwil-js/dist/client/kwil";
|
|
4
|
-
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq";
|
|
5
4
|
import { KwilSigner } from "@kwilteam/kwil-js";
|
|
5
|
+
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq";
|
|
6
6
|
import { StreamId } from "../util/StreamId";
|
|
7
7
|
export interface DeployStreamInput {
|
|
8
8
|
streamId: StreamId;
|
|
@@ -10,7 +10,7 @@ export interface DeployStreamInput {
|
|
|
10
10
|
kwilClient: Kwil<any>;
|
|
11
11
|
kwilSigner: KwilSigner;
|
|
12
12
|
synchronous?: boolean;
|
|
13
|
-
|
|
13
|
+
neonConnectionString?: string;
|
|
14
14
|
}
|
|
15
15
|
export interface DeployStreamOutput {
|
|
16
16
|
receipt: TxReceipt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployStream.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/deployStream.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"deployStream.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/deployStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,SAAS,EAAC,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAC,IAAI,EAAC,MAAM,oCAAoC,CAAC;AACxD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,eAAe,EAAC,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAI1C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,SAAS,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAuCrC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { KwilSigner, NodeKwil, WebKwil } from "@kwilteam/kwil-js";
|
|
2
|
+
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq";
|
|
3
|
+
import { TxReceipt } from "@kwilteam/kwil-js/dist/core/tx";
|
|
4
|
+
import { Action } from "./action";
|
|
5
|
+
import { StreamLocator } from "../types/stream";
|
|
6
|
+
export declare class PrimitiveAction extends Action {
|
|
7
|
+
constructor(kwilClient: WebKwil | NodeKwil, kwilSigner: KwilSigner);
|
|
8
|
+
/**
|
|
9
|
+
* Insert a record into the stream
|
|
10
|
+
* @param input of a single record to insert
|
|
11
|
+
* @returns Transaction receipt
|
|
12
|
+
*/
|
|
13
|
+
insertRecord(input: InsertRecordInput): Promise<GenericResponse<TxReceipt>>;
|
|
14
|
+
/**
|
|
15
|
+
* Inserts records into the stream
|
|
16
|
+
* @param inputs Array of records to insert
|
|
17
|
+
* @param synchronous If true, the transaction will be executed synchronously
|
|
18
|
+
* @returns Transaction receipt
|
|
19
|
+
*/
|
|
20
|
+
insertRecords(inputs: InsertRecordInput[], synchronous?: boolean): Promise<GenericResponse<TxReceipt>>;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a PrimitiveStream from a base Stream
|
|
23
|
+
* @param stream The base stream to convert
|
|
24
|
+
* @returns A Promise that resolves to a PrimitiveStream instance
|
|
25
|
+
*/
|
|
26
|
+
static fromStream(stream: Action): PrimitiveAction;
|
|
27
|
+
}
|
|
28
|
+
export interface InsertRecordInput {
|
|
29
|
+
stream: StreamLocator;
|
|
30
|
+
eventTime: number;
|
|
31
|
+
value: string;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=primitiveAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitiveAction.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/primitiveAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAS,OAAO,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAC,eAAe,EAAC,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAC,SAAS,EAAC,MAAM,gCAAgC,CAAC;AAEzD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAK9C,qBAAa,eAAgB,SAAQ,MAAM;gBAEvC,UAAU,EAAE,OAAO,GAAG,QAAQ,EAC9B,UAAU,EAAE,UAAU;IAKxB;;;;OAIG;IACU,YAAY,CACrB,KAAK,EAAE,iBAAiB,GACzB,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAmBpC;;;;;OAKG;IACU,aAAa,CACtB,MAAM,EAAE,iBAAiB,EAAE,EAC3B,WAAW,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAmBxC;;;;OAIG;WACW,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe;CAM1D;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAElB,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export type { TNClientOptions } from "./client/client";
|
|
2
2
|
export type { SignerInfo as EthProvider } from "./client/client";
|
|
3
3
|
export type { StreamLocator } from "./types/stream";
|
|
4
|
-
export type { StreamRecord } from "./contracts-api/
|
|
5
|
-
export type { GetRecordInput, GetFirstRecordInput } from "./contracts-api/
|
|
6
|
-
export type { InsertRecordInput } from "./contracts-api/
|
|
7
|
-
export type { TaxonomySet, TaxonomyItem } from "./contracts-api/
|
|
4
|
+
export type { StreamRecord } from "./contracts-api/action";
|
|
5
|
+
export type { GetRecordInput, GetFirstRecordInput } from "./contracts-api/action";
|
|
6
|
+
export type { InsertRecordInput } from "./contracts-api/primitiveAction";
|
|
7
|
+
export type { TaxonomySet, TaxonomyItem } 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";
|
|
11
11
|
export type { VisibilityEnum } from "./util/visibility";
|
|
12
12
|
export { StreamType } from "./contracts-api/contractValues";
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
13
|
+
export { Action } from "./contracts-api/action";
|
|
14
|
+
export { PrimitiveAction } from "./contracts-api/primitiveAction";
|
|
15
|
+
export { ComposedAction } from "./contracts-api/composedAction";
|
|
16
16
|
//# sourceMappingURL=index.common.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface LastTransaction {
|
|
2
|
+
/** Block height */
|
|
3
|
+
blockHeight: number;
|
|
4
|
+
/** Which action was taken */
|
|
5
|
+
method: string;
|
|
6
|
+
/** Address that sent the on‐chain tx */
|
|
7
|
+
sender: string;
|
|
8
|
+
/** Hash of the on‐chain transaction */
|
|
9
|
+
transactionHash: string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/types/transaction.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC5B,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,eAAe,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumAddress.d.ts","sourceRoot":"","sources":["../../../src/util/EthereumAddress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAe,MAAM,kBAAkB,CAAC;AAEvD,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAkB;gBAEvC,OAAO,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"EthereumAddress.d.ts","sourceRoot":"","sources":["../../../src/util/EthereumAddress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAe,MAAM,kBAAkB,CAAC;AAEvD,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAkB;gBAEvC,OAAO,EAAE,MAAM;IAa3B,OAAO,CAAC,uBAAuB;IAIxB,UAAU,IAAI,MAAM;IAQpB,QAAQ,IAAI,UAAU;IAItB,MAAM,IAAI,MAAM;WAIT,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe;WAIvC,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC,KAAK,EAAE,eAAe,CAAC;WAQ5D,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,eAAe,CAAC;CAOtE"}
|
|
@@ -2,8 +2,10 @@ import { Either } from "monads-io";
|
|
|
2
2
|
export declare class StreamId {
|
|
3
3
|
private readonly id;
|
|
4
4
|
private readonly correctlyCreated;
|
|
5
|
+
private readonly name?;
|
|
5
6
|
private constructor();
|
|
6
7
|
getId(): string;
|
|
8
|
+
getName(): string | undefined;
|
|
7
9
|
validate(): boolean;
|
|
8
10
|
toJSON(): string;
|
|
9
11
|
static fromJSON(json: string): StreamId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamId.d.ts","sourceRoot":"","sources":["../../../src/util/StreamId.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAkB;
|
|
1
|
+
{"version":3,"file":"StreamId.d.ts","sourceRoot":"","sources":["../../../src/util/StreamId.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAkB;IACnD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAS;IAE/B,OAAO;IAMA,KAAK,IAAI,MAAM;IAQf,OAAO,IAAI,MAAM,GAAG,SAAS;IAI7B,QAAQ,IAAI,OAAO;IAInB,MAAM,IAAI,MAAM;WAIT,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ;WAI1B,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;WAe5C,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC;CAO7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../../src/util/visibility.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IAAE,OAAO,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAEpE,eAAO,MAAM,UAAU;YACR,cAAc;aACb,cAAc;CAC7B,CAAC;AAEF,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../../src/util/visibility.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IAAE,OAAO,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAEpE,eAAO,MAAM,UAAU;YACR,cAAc;aACb,cAAc;CAC7B,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,GAAG,MAAM,KAAG,cAMzD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,cAAc,KAAG,MAErD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trufnetwork/sdk-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Truf Network SDK for JavaScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -45,22 +45,28 @@
|
|
|
45
45
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
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
|
-
"publish:dev": "pnpm publish --tag dev --no-git-checks"
|
|
48
|
+
"publish:dev": "pnpm publish --tag dev --no-git-checks",
|
|
49
|
+
"test": "vitest"
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
51
|
-
"@kwilteam/kwil-js": "^0.
|
|
52
|
+
"@kwilteam/kwil-js": "^0.9.4",
|
|
52
53
|
"crypto-hash": "^3.1.0",
|
|
54
|
+
"ethers": "^6.13.5",
|
|
53
55
|
"lodash": "^4.17.21",
|
|
54
56
|
"monads-io": "^4.0.2",
|
|
55
|
-
"
|
|
57
|
+
"uuid": "^11.1.0",
|
|
58
|
+
"pg": "^8.14.1"
|
|
56
59
|
},
|
|
57
60
|
"devDependencies": {
|
|
58
61
|
"@types/lodash": "4.17.12",
|
|
59
62
|
"@types/node": "18.18.1",
|
|
63
|
+
"@types/pg": "^8.11.13",
|
|
60
64
|
"@typescript-eslint/eslint-plugin": "8.11.0",
|
|
61
65
|
"@typescript-eslint/parser": "8.11.0",
|
|
62
66
|
"disposablestack": "1.1.6",
|
|
63
67
|
"esbuild": "0.24.0",
|
|
68
|
+
"esbuild-plugin-file-path-extensions": "^2.1.3",
|
|
69
|
+
"esbuild-plugin-import-assertions": "1.0.1",
|
|
64
70
|
"eslint": "9.13.0",
|
|
65
71
|
"eslint-config-prettier": "9.1.0",
|
|
66
72
|
"eslint-import-resolver-alias": "1.1.2",
|
|
@@ -70,8 +76,6 @@
|
|
|
70
76
|
"eslint-plugin-prettier": "5.2.1",
|
|
71
77
|
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
72
78
|
"eslint-plugin-unused-imports": "4.1.4",
|
|
73
|
-
"esbuild-plugin-file-path-extensions": "^2.1.3",
|
|
74
|
-
"esbuild-plugin-import-assertions": "1.0.1",
|
|
75
79
|
"glob": "11.0.0",
|
|
76
80
|
"prettier": "3.3.3",
|
|
77
81
|
"tsx": "^4.19.1",
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/client/listAllStreams.ts
|
|
21
|
-
var listAllStreams_exports = {};
|
|
22
|
-
__export(listAllStreams_exports, {
|
|
23
|
-
isStream: () => isStream,
|
|
24
|
-
listAllStreams: () => listAllStreams
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(listAllStreams_exports);
|
|
27
|
-
var import_EthereumAddress = require("../util/EthereumAddress.cjs");
|
|
28
|
-
var import_StreamId = require("../util/StreamId.cjs");
|
|
29
|
-
async function listAllStreams(kwilClient, owner) {
|
|
30
|
-
const databases = await kwilClient.listDatabases(owner?.getAddress());
|
|
31
|
-
const schemas = await Promise.all(
|
|
32
|
-
databases.data?.map(async (database) => {
|
|
33
|
-
const schema = await kwilClient.getSchema(database.dbid);
|
|
34
|
-
if (schema.status === 200 && schema.data && isStream(schema.data)) {
|
|
35
|
-
return schema.data;
|
|
36
|
-
}
|
|
37
|
-
return void 0;
|
|
38
|
-
}) ?? []
|
|
39
|
-
);
|
|
40
|
-
return schemas.filter((schema) => schema !== void 0).map((schema) => ({
|
|
41
|
-
streamId: import_StreamId.StreamId.fromString(schema.name).throw(),
|
|
42
|
-
dataProvider: import_EthereumAddress.EthereumAddress.fromBytes(schema.owner).throw()
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
var isStream = (schema) => {
|
|
46
|
-
const requiredProcedures = ["get_index", "get_record", "get_metadata"];
|
|
47
|
-
return requiredProcedures.every(
|
|
48
|
-
(procedure) => schema.procedures.some((p) => p.name === procedure)
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=listAllStreams.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/client/listAllStreams.ts"],
|
|
4
|
-
"sourcesContent": ["import { Kwil } from \"@kwilteam/kwil-js/dist/client/kwil\";\nimport { EnvironmentType } from \"@kwilteam/kwil-js/dist/core/enums\";\nimport { StreamLocator } from \"../types/stream\";\nimport { EthereumAddress } from \"../util/EthereumAddress\";\nimport { StreamId } from \"../util/StreamId\";\nimport { Database } from \"@kwilteam/kwil-js/dist/core/database\";\n\n/**\n * List all streams from the TN network.\n * @param kwilClient - The Kwil client.\n * @param owner - The owner of the streams. If not provided, all streams will be returned.\n * @returns A list of stream locators.\n */\nexport async function listAllStreams(\n kwilClient: Kwil<EnvironmentType>,\n owner?: EthereumAddress,\n): Promise<StreamLocator[]> {\n const databases = await kwilClient.listDatabases(owner?.getAddress());\n const schemas = await Promise.all(\n databases.data?.map(async (database) => {\n const schema = await kwilClient.getSchema(database.dbid);\n if (schema.status === 200 && schema.data && isStream(schema.data)) {\n return schema.data;\n }\n return undefined;\n }) ?? [],\n );\n return schemas\n .filter((schema) => schema !== undefined)\n .map((schema) => ({\n streamId: StreamId.fromString(schema.name).throw(),\n dataProvider: EthereumAddress.fromBytes(schema.owner).throw(),\n }));\n}\n\nexport const isStream = (schema: Database) => {\n const requiredProcedures = [\"get_index\", \"get_record\", \"get_metadata\"];\n return requiredProcedures.every((procedure) =>\n schema.procedures.some((p) => p.name === procedure),\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,6BAAgC;AAChC,sBAAyB;AASzB,eAAsB,eACpB,YACA,OAC0B;AAC1B,QAAM,YAAY,MAAM,WAAW,cAAc,OAAO,WAAW,CAAC;AACpE,QAAM,UAAU,MAAM,QAAQ;AAAA,IAC5B,UAAU,MAAM,IAAI,OAAO,aAAa;AACtC,YAAM,SAAS,MAAM,WAAW,UAAU,SAAS,IAAI;AACvD,UAAI,OAAO,WAAW,OAAO,OAAO,QAAQ,SAAS,OAAO,IAAI,GAAG;AACjE,eAAO,OAAO;AAAA,MAChB;AACA,aAAO;AAAA,IACT,CAAC,KAAK,CAAC;AAAA,EACT;AACA,SAAO,QACJ,OAAO,CAAC,WAAW,WAAW,MAAS,EACvC,IAAI,CAAC,YAAY;AAAA,IAChB,UAAU,yBAAS,WAAW,OAAO,IAAI,EAAE,MAAM;AAAA,IACjD,cAAc,uCAAgB,UAAU,OAAO,KAAK,EAAE,MAAM;AAAA,EAC9D,EAAE;AACN;AAEO,IAAM,WAAW,CAAC,WAAqB;AAC5C,QAAM,qBAAqB,CAAC,aAAa,cAAc,cAAc;AACrE,SAAO,mBAAmB;AAAA,IAAM,CAAC,cAC/B,OAAO,WAAW,KAAK,CAAC,MAAM,EAAE,SAAS,SAAS;AAAA,EACpD;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|