@midnight-ntwrk/midnight-js-types 0.1.10

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.
@@ -0,0 +1,9 @@
1
+ export * from './private-state-provider';
2
+ export * from './midnight-provider';
3
+ export { ProverKey, VerifierKey, ZKIR, ZKConfig, FailEntirely, FailFallible, SucceedEntirely, TxStatus, UnprovenTransaction, UnbalancedTransaction, BalancedTransaction, FinalizedTxData, createProverKey, createVerifierKey, createZKIR, createUnprovenTx, createBalancedTx, createUnbalancedTx } from './midnight-types';
4
+ export * from './proof-provider';
5
+ export * from './wallet-provider';
6
+ export * from './public-data-provider';
7
+ export * from './providers';
8
+ export * from './zk-config-provider';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EACL,SAAS,EACT,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,87 @@
1
+ const createProverKey = (uint8Array) => {
2
+ return uint8Array;
3
+ };
4
+ const createVerifierKey = (uint8Array) => {
5
+ return uint8Array;
6
+ };
7
+ const createZKIR = (string) => {
8
+ return string;
9
+ };
10
+ const UNPROVEN_TX_SYM = Symbol('unproven_tx');
11
+ /**
12
+ * Creates an {@link UnprovenTransaction} from an unproven ledger transaction.
13
+ * @param tx The ledger transaction to wrap.
14
+ */
15
+ const createUnprovenTx = (tx) => ({
16
+ UnprovenTransaction: UNPROVEN_TX_SYM,
17
+ tx
18
+ });
19
+ const UNBALANCED_TX_SYM = Symbol('unbalanced_tx');
20
+ /**
21
+ * Creates an {@link UnbalancedTransaction} from a ledger transaction.
22
+ * @param tx The ledger transaction to wrap.
23
+ */
24
+ const createUnbalancedTx = (tx) => ({
25
+ UnbalancedTransaction: UNBALANCED_TX_SYM,
26
+ tx
27
+ });
28
+ const BALANCED_TX_SYM = Symbol('balanced_tx');
29
+ /**
30
+ * Creates an {@link BalancedTransaction} from a ledger transaction.
31
+ * @param tx The ledger transaction to wrap.
32
+ */
33
+ const createBalancedTx = (tx) => ({
34
+ BalancedTransaction: BALANCED_TX_SYM,
35
+ tx
36
+ });
37
+ /**
38
+ * Indicates that the transaction is invalid.
39
+ */
40
+ const FailEntirely = 'FailEntirely';
41
+ /**
42
+ * Indicates that the transaction is valid but the portion of the transcript
43
+ * that is allowed to fail (the portion after a checkpoint) did fail. All effects
44
+ * from the guaranteed part of the transaction are kept but the effects from the
45
+ * fallible part of the transaction are discarded.
46
+ */
47
+ const FailFallible = 'FailFallible';
48
+ /**
49
+ * Indicates that the guaranteed and fallible portions of the transaction were
50
+ * successful.
51
+ */
52
+ const SucceedEntirely = 'SucceedEntirely';
53
+
54
+ /**
55
+ * A provider for zero-knowledge intermediate representations, prover keys, and verifier keys. All
56
+ * three are used by the {@link ProofProvider} to create a proof for a call transaction. The implementation
57
+ * of this provider depends on the runtime environment, since each environment has different conventions
58
+ * for accessing static artifacts.
59
+ * @typeParam K - The type of the circuit ID used by the provider.
60
+ */
61
+ class ZKConfigProvider {
62
+ /**
63
+ * Retrieves the verifier keys produced by `compactc` for the given circuits.
64
+ * @param circuitIds The circuit IDs of the verifier keys to retrieve.
65
+ */
66
+ async getVerifierKeys(circuitIds) {
67
+ return Promise.all(circuitIds.map(async (id) => {
68
+ const key = await this.getVerifierKey(id);
69
+ return [id, key];
70
+ }));
71
+ }
72
+ /**
73
+ * Retrieves all zero-knowledge artifacts produced by `compactc` for the given circuit.
74
+ * @param circuitId The circuit ID of the artifacts to retrieve.
75
+ */
76
+ async get(circuitId) {
77
+ return {
78
+ circuitId,
79
+ proverKey: await this.getProverKey(circuitId),
80
+ verifierKey: await this.getVerifierKey(circuitId),
81
+ zkir: await this.getZKIR(circuitId)
82
+ };
83
+ }
84
+ }
85
+
86
+ export { FailEntirely, FailFallible, SucceedEntirely, ZKConfigProvider, createBalancedTx, createProverKey, createUnbalancedTx, createUnprovenTx, createVerifierKey, createZKIR };
87
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/midnight-types.ts","../src/zk-config-provider.ts"],"sourcesContent":[null,null],"names":[],"mappings":"AAUa,MAAA,eAAe,GAAG,CAAC,UAAsB,KAAe;AACnE,IAAA,OAAO,UAAuB,CAAC;AACjC,EAAE;AAOW,MAAA,iBAAiB,GAAG,CAAC,UAAsB,KAAiB;AACvE,IAAA,OAAO,UAAyB,CAAC;AACnC,EAAE;AAOW,MAAA,UAAU,GAAG,CAAC,MAAc,KAAU;AACjD,IAAA,OAAO,MAAc,CAAC;AACxB,EAAE;AAyBF,MAAM,eAAe,GAAkB,MAAM,CAAC,aAAa,CAAC,CAAC;AAU7D;;;AAGG;MACU,gBAAgB,GAAG,CAAC,EAA6B,MAA2B;AACvF,IAAA,mBAAmB,EAAE,eAAe;IACpC,EAAE;AACH,CAAA,EAAE;AAEH,MAAM,iBAAiB,GAAkB,MAAM,CAAC,eAAe,CAAC,CAAC;AAUjE;;;AAGG;MACU,kBAAkB,GAAG,CAAC,EAAqB,MAA6B;AACnF,IAAA,qBAAqB,EAAE,iBAAiB;IACxC,EAAE;AACH,CAAA,EAAE;AAEH,MAAM,eAAe,GAAkB,MAAM,CAAC,aAAa,CAAC,CAAC;AAU7D;;;AAGG;MACU,gBAAgB,GAAG,CAAC,EAAqB,MAA2B;AAC/E,IAAA,mBAAmB,EAAE,eAAe;IACpC,EAAE;AACH,CAAA,EAAE;AAEH;;AAEG;AACI,MAAM,YAAY,GAAG,eAAwB;AAEpD;;;;;AAKG;AACI,MAAM,YAAY,GAAG,eAAwB;AAEpD;;;AAGG;AACI,MAAM,eAAe,GAAG;;AC/H/B;;;;;;AAMG;MACmB,gBAAgB,CAAA;AAmBpC;;;AAGG;IACH,MAAM,eAAe,CAAC,UAAe,EAAA;AACnC,QAAA,OAAO,OAAO,CAAC,GAAG,CAChB,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,KAAI;YAC1B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;AAC1C,YAAA,OAAO,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;SAClB,CAAC,CACH,CAAC;KACH;AAED;;;AAGG;IACH,MAAM,GAAG,CAAC,SAAY,EAAA;QACpB,OAAO;YACL,SAAS;AACT,YAAA,SAAS,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC;AAC7C,YAAA,WAAW,EAAE,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC;AACjD,YAAA,IAAI,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;SACpC,CAAC;KACH;AACF;;;;"}
package/dist/index.js ADDED
@@ -0,0 +1,98 @@
1
+ 'use strict';
2
+
3
+ const createProverKey = (uint8Array) => {
4
+ return uint8Array;
5
+ };
6
+ const createVerifierKey = (uint8Array) => {
7
+ return uint8Array;
8
+ };
9
+ const createZKIR = (string) => {
10
+ return string;
11
+ };
12
+ const UNPROVEN_TX_SYM = Symbol('unproven_tx');
13
+ /**
14
+ * Creates an {@link UnprovenTransaction} from an unproven ledger transaction.
15
+ * @param tx The ledger transaction to wrap.
16
+ */
17
+ const createUnprovenTx = (tx) => ({
18
+ UnprovenTransaction: UNPROVEN_TX_SYM,
19
+ tx
20
+ });
21
+ const UNBALANCED_TX_SYM = Symbol('unbalanced_tx');
22
+ /**
23
+ * Creates an {@link UnbalancedTransaction} from a ledger transaction.
24
+ * @param tx The ledger transaction to wrap.
25
+ */
26
+ const createUnbalancedTx = (tx) => ({
27
+ UnbalancedTransaction: UNBALANCED_TX_SYM,
28
+ tx
29
+ });
30
+ const BALANCED_TX_SYM = Symbol('balanced_tx');
31
+ /**
32
+ * Creates an {@link BalancedTransaction} from a ledger transaction.
33
+ * @param tx The ledger transaction to wrap.
34
+ */
35
+ const createBalancedTx = (tx) => ({
36
+ BalancedTransaction: BALANCED_TX_SYM,
37
+ tx
38
+ });
39
+ /**
40
+ * Indicates that the transaction is invalid.
41
+ */
42
+ const FailEntirely = 'FailEntirely';
43
+ /**
44
+ * Indicates that the transaction is valid but the portion of the transcript
45
+ * that is allowed to fail (the portion after a checkpoint) did fail. All effects
46
+ * from the guaranteed part of the transaction are kept but the effects from the
47
+ * fallible part of the transaction are discarded.
48
+ */
49
+ const FailFallible = 'FailFallible';
50
+ /**
51
+ * Indicates that the guaranteed and fallible portions of the transaction were
52
+ * successful.
53
+ */
54
+ const SucceedEntirely = 'SucceedEntirely';
55
+
56
+ /**
57
+ * A provider for zero-knowledge intermediate representations, prover keys, and verifier keys. All
58
+ * three are used by the {@link ProofProvider} to create a proof for a call transaction. The implementation
59
+ * of this provider depends on the runtime environment, since each environment has different conventions
60
+ * for accessing static artifacts.
61
+ * @typeParam K - The type of the circuit ID used by the provider.
62
+ */
63
+ class ZKConfigProvider {
64
+ /**
65
+ * Retrieves the verifier keys produced by `compactc` for the given circuits.
66
+ * @param circuitIds The circuit IDs of the verifier keys to retrieve.
67
+ */
68
+ async getVerifierKeys(circuitIds) {
69
+ return Promise.all(circuitIds.map(async (id) => {
70
+ const key = await this.getVerifierKey(id);
71
+ return [id, key];
72
+ }));
73
+ }
74
+ /**
75
+ * Retrieves all zero-knowledge artifacts produced by `compactc` for the given circuit.
76
+ * @param circuitId The circuit ID of the artifacts to retrieve.
77
+ */
78
+ async get(circuitId) {
79
+ return {
80
+ circuitId,
81
+ proverKey: await this.getProverKey(circuitId),
82
+ verifierKey: await this.getVerifierKey(circuitId),
83
+ zkir: await this.getZKIR(circuitId)
84
+ };
85
+ }
86
+ }
87
+
88
+ exports.FailEntirely = FailEntirely;
89
+ exports.FailFallible = FailFallible;
90
+ exports.SucceedEntirely = SucceedEntirely;
91
+ exports.ZKConfigProvider = ZKConfigProvider;
92
+ exports.createBalancedTx = createBalancedTx;
93
+ exports.createProverKey = createProverKey;
94
+ exports.createUnbalancedTx = createUnbalancedTx;
95
+ exports.createUnprovenTx = createUnprovenTx;
96
+ exports.createVerifierKey = createVerifierKey;
97
+ exports.createZKIR = createZKIR;
98
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/midnight-types.ts","../src/zk-config-provider.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;AAUa,MAAA,eAAe,GAAG,CAAC,UAAsB,KAAe;AACnE,IAAA,OAAO,UAAuB,CAAC;AACjC,EAAE;AAOW,MAAA,iBAAiB,GAAG,CAAC,UAAsB,KAAiB;AACvE,IAAA,OAAO,UAAyB,CAAC;AACnC,EAAE;AAOW,MAAA,UAAU,GAAG,CAAC,MAAc,KAAU;AACjD,IAAA,OAAO,MAAc,CAAC;AACxB,EAAE;AAyBF,MAAM,eAAe,GAAkB,MAAM,CAAC,aAAa,CAAC,CAAC;AAU7D;;;AAGG;MACU,gBAAgB,GAAG,CAAC,EAA6B,MAA2B;AACvF,IAAA,mBAAmB,EAAE,eAAe;IACpC,EAAE;AACH,CAAA,EAAE;AAEH,MAAM,iBAAiB,GAAkB,MAAM,CAAC,eAAe,CAAC,CAAC;AAUjE;;;AAGG;MACU,kBAAkB,GAAG,CAAC,EAAqB,MAA6B;AACnF,IAAA,qBAAqB,EAAE,iBAAiB;IACxC,EAAE;AACH,CAAA,EAAE;AAEH,MAAM,eAAe,GAAkB,MAAM,CAAC,aAAa,CAAC,CAAC;AAU7D;;;AAGG;MACU,gBAAgB,GAAG,CAAC,EAAqB,MAA2B;AAC/E,IAAA,mBAAmB,EAAE,eAAe;IACpC,EAAE;AACH,CAAA,EAAE;AAEH;;AAEG;AACI,MAAM,YAAY,GAAG,eAAwB;AAEpD;;;;;AAKG;AACI,MAAM,YAAY,GAAG,eAAwB;AAEpD;;;AAGG;AACI,MAAM,eAAe,GAAG;;AC/H/B;;;;;;AAMG;MACmB,gBAAgB,CAAA;AAmBpC;;;AAGG;IACH,MAAM,eAAe,CAAC,UAAe,EAAA;AACnC,QAAA,OAAO,OAAO,CAAC,GAAG,CAChB,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,KAAI;YAC1B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;AAC1C,YAAA,OAAO,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;SAClB,CAAC,CACH,CAAC;KACH;AAED;;;AAGG;IACH,MAAM,GAAG,CAAC,SAAY,EAAA;QACpB,OAAO;YACL,SAAS;AACT,YAAA,SAAS,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC;AAC7C,YAAA,WAAW,EAAE,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC;AACjD,YAAA,IAAI,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;SACpC,CAAC;KACH;AACF;;;;;;;;;;;;;"}
@@ -0,0 +1,15 @@
1
+ import type { TransactionId } from '@midnight-ntwrk/ledger';
2
+ import type { BalancedTransaction } from './midnight-types';
3
+ /**
4
+ * Interface for Midnight transaction submission logic. It could be implemented, e.g., by a wallet,
5
+ * a third-party service, or a node itself.
6
+ */
7
+ export interface MidnightProvider {
8
+ /**
9
+ * Submit a transaction to the network to be consensed upon.
10
+ * @param tx A balanced and proven transaction.
11
+ * @returns The transaction identifier of the submitted transaction.
12
+ */
13
+ submitTx(tx: BalancedTransaction): Promise<TransactionId>;
14
+ }
15
+ //# sourceMappingURL=midnight-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"midnight-provider.d.ts","sourceRoot":"","sources":["../src/midnight-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAC3D"}
@@ -0,0 +1,130 @@
1
+ import type { Transaction as LedgerTransaction, UnprovenTransaction as UnprovenLedgerTransaction } from '@midnight-ntwrk/ledger';
2
+ /**
3
+ * A type representing a prover key derived from a contract circuit.
4
+ */
5
+ export type ProverKey = Uint8Array & {
6
+ readonly ProverKey: unique symbol;
7
+ };
8
+ export declare const createProverKey: (uint8Array: Uint8Array) => ProverKey;
9
+ /**
10
+ * A type representing a verifier key derived from a contract circuit.
11
+ */
12
+ export type VerifierKey = Uint8Array & {
13
+ readonly VerifierKey: unique symbol;
14
+ };
15
+ export declare const createVerifierKey: (uint8Array: Uint8Array) => VerifierKey;
16
+ /**
17
+ * A type representing a zero-knowledge circuit intermediate representation derived from a contract circuit.
18
+ */
19
+ export type ZKIR = string & {
20
+ readonly ZKIR: unique symbol;
21
+ };
22
+ export declare const createZKIR: (string: string) => ZKIR;
23
+ /**
24
+ * Contains all information required by the {@link ProofProvider}
25
+ * @typeParam K - The type of the circuit ID.
26
+ */
27
+ export interface ZKConfig<K extends string> {
28
+ /**
29
+ * A circuit identifier.
30
+ */
31
+ readonly circuitId: K;
32
+ /**
33
+ * The prover key corresponding to {@link ZKConfig.circuitId}.
34
+ */
35
+ readonly proverKey: ProverKey;
36
+ /**
37
+ * The verifier key corresponding to {@link ZKConfig.circuitId}.
38
+ */
39
+ readonly verifierKey: VerifierKey;
40
+ /**
41
+ * The zero-knowledge intermediate representation corresponding to {@link ZKConfig.circuitId}.
42
+ */
43
+ readonly zkir: ZKIR;
44
+ }
45
+ declare const UNPROVEN_TX_SYM: unique symbol;
46
+ /**
47
+ * A type representing an unproven transaction.
48
+ */
49
+ export type UnprovenTransaction = {
50
+ readonly UnprovenTransaction: typeof UNPROVEN_TX_SYM;
51
+ readonly tx: UnprovenLedgerTransaction;
52
+ };
53
+ /**
54
+ * Creates an {@link UnprovenTransaction} from an unproven ledger transaction.
55
+ * @param tx The ledger transaction to wrap.
56
+ */
57
+ export declare const createUnprovenTx: (tx: UnprovenLedgerTransaction) => UnprovenTransaction;
58
+ declare const UNBALANCED_TX_SYM: unique symbol;
59
+ /**
60
+ * A type representing a proven, unbalanced transaction.
61
+ */
62
+ export type UnbalancedTransaction = {
63
+ readonly UnbalancedTransaction: typeof UNBALANCED_TX_SYM;
64
+ readonly tx: LedgerTransaction;
65
+ };
66
+ /**
67
+ * Creates an {@link UnbalancedTransaction} from a ledger transaction.
68
+ * @param tx The ledger transaction to wrap.
69
+ */
70
+ export declare const createUnbalancedTx: (tx: LedgerTransaction) => UnbalancedTransaction;
71
+ declare const BALANCED_TX_SYM: unique symbol;
72
+ /**
73
+ * A type representing a proven, balanced transaction.
74
+ */
75
+ export type BalancedTransaction = {
76
+ readonly BalancedTransaction: typeof BALANCED_TX_SYM;
77
+ readonly tx: LedgerTransaction;
78
+ };
79
+ /**
80
+ * Creates an {@link BalancedTransaction} from a ledger transaction.
81
+ * @param tx The ledger transaction to wrap.
82
+ */
83
+ export declare const createBalancedTx: (tx: LedgerTransaction) => BalancedTransaction;
84
+ /**
85
+ * Indicates that the transaction is invalid.
86
+ */
87
+ export declare const FailEntirely: "FailEntirely";
88
+ /**
89
+ * Indicates that the transaction is valid but the portion of the transcript
90
+ * that is allowed to fail (the portion after a checkpoint) did fail. All effects
91
+ * from the guaranteed part of the transaction are kept but the effects from the
92
+ * fallible part of the transaction are discarded.
93
+ */
94
+ export declare const FailFallible: "FailFallible";
95
+ /**
96
+ * Indicates that the guaranteed and fallible portions of the transaction were
97
+ * successful.
98
+ */
99
+ export declare const SucceedEntirely: "SucceedEntirely";
100
+ /**
101
+ * The status of a transaction.
102
+ */
103
+ export type TxStatus = typeof FailEntirely | typeof FailFallible | typeof SucceedEntirely;
104
+ /**
105
+ * Data for any finalized transaction.
106
+ */
107
+ export interface FinalizedTxData {
108
+ /**
109
+ * The status of a submitted transaction.
110
+ */
111
+ readonly status: TxStatus;
112
+ /**
113
+ * The transaction ID of the submitted transaction.
114
+ */
115
+ readonly txId: string;
116
+ /**
117
+ * The transaction hash of the transaction in which the original transaction was included.
118
+ */
119
+ readonly txHash: string;
120
+ /**
121
+ * The block hash of the block in which the transaction was included.
122
+ */
123
+ readonly blockHash: string;
124
+ /**
125
+ * The block height of the block in which the transaction was included.
126
+ */
127
+ readonly blockHeight: number;
128
+ }
129
+ export {};
130
+ //# sourceMappingURL=midnight-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"midnight-types.d.ts","sourceRoot":"","sources":["../src/midnight-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,IAAI,iBAAiB,EAChC,mBAAmB,IAAI,yBAAyB,EACjD,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG;IAAE,QAAQ,CAAC,SAAS,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;AAE3E,eAAO,MAAM,eAAe,eAAgB,UAAU,KAAG,SAExD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG;IAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;AAE/E,eAAO,MAAM,iBAAiB,eAAgB,UAAU,KAAG,WAE1D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;AAE7D,eAAO,MAAM,UAAU,WAAY,MAAM,KAAG,IAE3C,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,MAAM;IACxC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,eAAe,EAAE,OAAO,MAA8B,CAAC;AAE7D;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,mBAAmB,EAAE,OAAO,eAAe,CAAC;IACrD,QAAQ,CAAC,EAAE,EAAE,yBAAyB,CAAC;CACxC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,OAAQ,yBAAyB,KAAG,mBAG/D,CAAC;AAEH,QAAA,MAAM,iBAAiB,EAAE,OAAO,MAAgC,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,qBAAqB,EAAE,OAAO,iBAAiB,CAAC;IACzD,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC;CAChC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,OAAQ,iBAAiB,KAAG,qBAGzD,CAAC;AAEH,QAAA,MAAM,eAAe,EAAE,OAAO,MAA8B,CAAC;AAE7D;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,mBAAmB,EAAE,OAAO,eAAe,CAAC;IACrD,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC;CAChC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,OAAQ,iBAAiB,KAAG,mBAGvD,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY,gBAA0B,CAAC;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,gBAA0B,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,eAAe,mBAA6B,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,YAAY,GAAG,OAAO,YAAY,GAAG,OAAO,eAAe,CAAC;AAE1F;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Type representing valid private state schemas. Each value is a private state
3
+ * for a particular contract. Each key is the name used to refer to a private state.
4
+ */
5
+ export type PrivateStateSchema = Record<string | number, any>;
6
+ /**
7
+ * Interface for a typed key-valued store containing contract private states.
8
+ * @typeParam PSS - The schema for the private states stored. Each value is a
9
+ * private state for a particular contract. Each key is the name
10
+ * used to refer to a private state.
11
+ */
12
+ export interface PrivateStateProvider<PSS extends PrivateStateSchema> {
13
+ /**
14
+ * Store the given state at the given key.
15
+ * @param key The key of the private state.
16
+ * @param state The private state to store.
17
+ */
18
+ set<PSK extends keyof PSS>(key: PSK, state: PSS[PSK]): Promise<void>;
19
+ /**
20
+ * Retrieve the private state at the given key.
21
+ * @param key The key of the private state.
22
+ */
23
+ get<PSK extends keyof PSS>(key: PSK): Promise<PSS[PSK] | null>;
24
+ /**
25
+ * Remove the value at the given key.
26
+ * @param key The key of the private state.
27
+ */
28
+ remove<PSK extends keyof PSS>(key: PSK): Promise<void>;
29
+ /**
30
+ * Clear the entire private state store.
31
+ */
32
+ clear(): Promise<void>;
33
+ }
34
+ //# sourceMappingURL=private-state-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-state-provider.d.ts","sourceRoot":"","sources":["../src/private-state-provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB,CAAC,GAAG,SAAS,kBAAkB;IAClE;;;;OAIG;IACH,GAAG,CAAC,GAAG,SAAS,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErE;;;OAGG;IACH,GAAG,CAAC,GAAG,SAAS,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAE/D;;;OAGG;IACH,MAAM,CAAC,GAAG,SAAS,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvD;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
@@ -0,0 +1,17 @@
1
+ import type { UnprovenTransaction, UnbalancedTransaction, ZKConfig } from './midnight-types';
2
+ /**
3
+ * Interface for a proof server running in a trusted environment.
4
+ * @typeParam K - The type of the circuit ID used by the provider.
5
+ */
6
+ export interface ProofProvider<K extends string> {
7
+ /**
8
+ * Creates call proofs for an unproven transaction. The resulting transaction is unbalanced and
9
+ * must be balanced using the {@link WalletProvider} interface.
10
+ * @param tx The transaction to be proved. Prior to version 1.0.0, unproven transactions always only
11
+ * contain a single contract call.
12
+ * @param zkConfig The zero-knowledge configuration for the circuit that was called in `tx`.
13
+ * Undefined if `tx` is a deployment transaction.
14
+ */
15
+ proveTx(tx: UnprovenTransaction, zkConfig?: ZKConfig<K>): Promise<UnbalancedTransaction>;
16
+ }
17
+ //# sourceMappingURL=proof-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proof-provider.d.ts","sourceRoot":"","sources":["../src/proof-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE7F;;;GAGG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM;IAC7C;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,EAAE,mBAAmB,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAC1F"}
@@ -0,0 +1,38 @@
1
+ import type { PrivateStateProvider, PrivateStateSchema } from './private-state-provider';
2
+ import type { PublicDataProvider } from './public-data-provider';
3
+ import type { ProofProvider } from './proof-provider';
4
+ import type { WalletProvider } from './wallet-provider';
5
+ import type { MidnightProvider } from './midnight-provider';
6
+ import type { ZKConfigProvider } from './zk-config-provider';
7
+ /**
8
+ * Set of providers needed for transaction construction and submission.
9
+ * @typeParam ICK - A union of string literal types representing the callable circuits.
10
+ * @typeParam PSS - Type representing aggregate of all private state types stored by the private state provider.
11
+ */
12
+ export interface MidnightProviders<ICK extends string = string, PSS extends PrivateStateSchema = PrivateStateSchema> {
13
+ /**
14
+ * Manages the private state of a contract.
15
+ */
16
+ readonly privateStateProvider: PrivateStateProvider<PSS>;
17
+ /**
18
+ * Retrieves public data from the blockchain.
19
+ */
20
+ readonly publicDataProvider: PublicDataProvider;
21
+ /**
22
+ * Retrieves the ZK artifacts of a contract needed to create proofs.
23
+ */
24
+ readonly zkConfigProvider: ZKConfigProvider<ICK>;
25
+ /**
26
+ * Creates proven, unbalanced transactions.
27
+ */
28
+ readonly proofProvider: ProofProvider<ICK>;
29
+ /**
30
+ * Creates proven, balanced transactions.
31
+ */
32
+ readonly walletProvider: WalletProvider;
33
+ /**
34
+ * Submits proven, balanced transactions to the network.
35
+ */
36
+ readonly midnightProvider: MidnightProvider;
37
+ }
38
+ //# sourceMappingURL=providers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,iBAAiB,CAChC,GAAG,SAAS,MAAM,GAAG,MAAM,EAC3B,GAAG,SAAS,kBAAkB,GAAG,kBAAkB;IAEnD;;OAEG;IACH,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC;IACzD;;OAEG;IACH,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAChD;;OAEG;IACH,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACjD;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;IAC3C;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;CAC7C"}
@@ -0,0 +1,117 @@
1
+ import type { ContractAddress, TransactionId, ZswapChainState } from '@midnight-ntwrk/ledger';
2
+ import type { ContractState } from '@midnight-ntwrk/compact-runtime';
3
+ import type { Observable } from 'rxjs';
4
+ import type { FinalizedTxData } from './midnight-types';
5
+ /**
6
+ * Streams all previous states of a contract.
7
+ */
8
+ export type All = {
9
+ readonly type: 'all';
10
+ };
11
+ /**
12
+ * Streams all states of a contract starting with the most recent.
13
+ */
14
+ export type Latest = {
15
+ readonly type: 'latest';
16
+ };
17
+ /**
18
+ * Starts a contract state stream at the given transaction identifier.
19
+ */
20
+ export type TxIdConfig = {
21
+ readonly type: 'txId';
22
+ /**
23
+ * The transaction identifier indicating where to begin the state stream.
24
+ */
25
+ readonly txId: TransactionId;
26
+ };
27
+ /**
28
+ * Starts a contract state stream at the given block height.
29
+ * @type
30
+ */
31
+ export type BlockHeightConfig = {
32
+ readonly type: 'blockHeight';
33
+ /**
34
+ * The block height indicating where to begin the state stream.
35
+ */
36
+ readonly blockHeight: number;
37
+ };
38
+ /**
39
+ * Starts a contract state stream at the given block hash.
40
+ */
41
+ export type BlockHashConfig = {
42
+ readonly type: 'blockHash';
43
+ /**
44
+ * The block height indicating where to begin the state stream.
45
+ */
46
+ readonly blockHash: string;
47
+ };
48
+ /**
49
+ * The configuration for a contract state observable. The corresponding observables may begin at different
50
+ * places (e.g. after a specific transaction identifier / block height) depending on the configuration, but
51
+ * all state updates after the beginning are always included.
52
+ */
53
+ export type ContractStateObservableConfig = ((TxIdConfig | BlockHashConfig | BlockHeightConfig) & {
54
+ /**
55
+ * If `true`, the state of the contract after the last block or transaction specified by the configuration
56
+ * is the first value emitted. If `false`, the state of the contract after the next state update is the
57
+ * first value emitted. If `undefined`, defaults to `true`.
58
+ */
59
+ readonly inclusive?: boolean;
60
+ }) | Latest | All;
61
+ /**
62
+ * Interface for a public data service. This service retrieves public data from the blockchain.
63
+ * TODO: Add timeouts or retry limits to 'watchFor' queries.
64
+ */
65
+ export interface PublicDataProvider {
66
+ /**
67
+ * Retrieves the on-chain state of a contract. If no block hash or block height are provided, the
68
+ * contract state at the address in the latest block is returned.
69
+ * Immediately returns null if no matching data is found.
70
+ * @param contractAddress The address of the contract of interest.
71
+ * @param config The configuration of the query.
72
+ * If `undefined` returns the latest states.
73
+ */
74
+ queryContractState(contractAddress: ContractAddress, config?: BlockHeightConfig | BlockHashConfig): Promise<ContractState | null>;
75
+ /**
76
+ * Retrieves the zswap chain state (token balances) and the contract state of the contract at the
77
+ * given address. Both states are retrieved in a single query to ensure consistency between the two.
78
+ * Immediately returns null if no matching data is found.
79
+ * @param contractAddress The address of the contract of interest.
80
+ * @param config The configuration of the query.
81
+ * If `undefined` returns the latest states.
82
+ */
83
+ queryZSwapAndContractState(contractAddress: ContractAddress, config?: BlockHeightConfig | BlockHashConfig): Promise<[ZswapChainState, ContractState] | null>;
84
+ /**
85
+ * Retrieves the contract state included in the deployment of the contract at the given contract address.
86
+ * Immediately returns null if no matching data is found.
87
+ * @param contractAddress The address of the contract of interest.
88
+ */
89
+ queryDeployContractState(contractAddress: ContractAddress): Promise<ContractState | null>;
90
+ /**
91
+ * Retrieves the contract state of the contract with the given address.
92
+ * Waits indefinitely for matching data to appear.
93
+ * @param contractAddress The address of the contract of interest.
94
+ */
95
+ watchForContractState(contractAddress: ContractAddress): Promise<ContractState>;
96
+ /**
97
+ * Retrieves data of the deployment transaction for the contract at the given contract address.
98
+ * Waits indefinitely for matching data to appear.
99
+ * @param contractAddress The address of the contract of interest.
100
+ */
101
+ watchForDeployTxData(contractAddress: ContractAddress): Promise<FinalizedTxData>;
102
+ /**
103
+ * Retrieves data of the transaction containing the call or deployment with the given identifier.
104
+ * Waits indefinitely for matching data to appear.
105
+ * @param txId The identifier of the call or deployment of interest.
106
+ */
107
+ watchForTxData(txId: TransactionId): Promise<FinalizedTxData>;
108
+ /**
109
+ * Creates a stream of contract states. The observable emits a value every time a state is either
110
+ * created or updated at the given address.
111
+ * Waits indefinitely for matching data to appear.
112
+ * @param address The address of the contract of interest.
113
+ * @param config The configuration for the observable.
114
+ */
115
+ contractStateObservable(address: ContractAddress, config: ContractStateObservableConfig): Observable<ContractState>;
116
+ }
117
+ //# sourceMappingURL=public-data-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-data-provider.d.ts","sourceRoot":"","sources":["../src/public-data-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG;IAChB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,6BAA6B,GACrC,CAAC,CAAC,UAAU,GAAG,eAAe,GAAG,iBAAiB,CAAC,GAAG;IACpD;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC,GACF,MAAM,GACN,GAAG,CAAC;AAER;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;OAOG;IACH,kBAAkB,CAChB,eAAe,EAAE,eAAe,EAChC,MAAM,CAAC,EAAE,iBAAiB,GAAG,eAAe,GAC3C,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IAEjC;;;;;;;OAOG;IACH,0BAA0B,CACxB,eAAe,EAAE,eAAe,EAChC,MAAM,CAAC,EAAE,iBAAiB,GAAG,eAAe,GAC3C,OAAO,CAAC,CAAC,eAAe,EAAE,aAAa,CAAC,GAAG,IAAI,CAAC,CAAC;IAEpD;;;;OAIG;IACH,wBAAwB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IAE1F;;;;OAIG;IACH,qBAAqB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAEhF;;;;OAIG;IACH,oBAAoB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEjF;;;;OAIG;IACH,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE9D;;;;;;OAMG;IACH,uBAAuB,CACrB,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,6BAA6B,GACpC,UAAU,CAAC,aAAa,CAAC,CAAC;CAC9B"}
@@ -0,0 +1,18 @@
1
+ import type { CoinInfo, CoinPublicKey } from '@midnight-ntwrk/ledger';
2
+ import type { BalancedTransaction, UnbalancedTransaction } from './midnight-types';
3
+ /**
4
+ * Interface for a wallet
5
+ */
6
+ export interface WalletProvider {
7
+ /**
8
+ * Wallet public coin key
9
+ */
10
+ readonly coinPublicKey: CoinPublicKey;
11
+ /**
12
+ * Balances selects coins, creates spend proofs, and pays fees for a transaction with call proofs.
13
+ * @param tx The transaction to balance.
14
+ * @param newCoins The outputs created during a transaction.
15
+ */
16
+ balanceTx(tx: UnbalancedTransaction, newCoins: CoinInfo[]): Promise<BalancedTransaction>;
17
+ }
18
+ //# sourceMappingURL=wallet-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-provider.d.ts","sourceRoot":"","sources":["../src/wallet-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEnF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IAEtC;;;;OAIG;IACH,SAAS,CAAC,EAAE,EAAE,qBAAqB,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC1F"}
@@ -0,0 +1,36 @@
1
+ import type { ProverKey, VerifierKey, ZKIR, ZKConfig } from './midnight-types';
2
+ /**
3
+ * A provider for zero-knowledge intermediate representations, prover keys, and verifier keys. All
4
+ * three are used by the {@link ProofProvider} to create a proof for a call transaction. The implementation
5
+ * of this provider depends on the runtime environment, since each environment has different conventions
6
+ * for accessing static artifacts.
7
+ * @typeParam K - The type of the circuit ID used by the provider.
8
+ */
9
+ export declare abstract class ZKConfigProvider<K extends string> {
10
+ /**
11
+ * Retrieves the zero-knowledge intermediate representation produced by `compactc` for the given circuit.
12
+ * @param circuitId The circuit ID of the ZKIR to retrieve.
13
+ */
14
+ abstract getZKIR(circuitId: K): Promise<ZKIR>;
15
+ /**
16
+ * Retrieves the prover key produced by `compactc` for the given circuit.
17
+ * @param circuitId The circuit ID of the prover key to retrieve.
18
+ */
19
+ abstract getProverKey(circuitId: K): Promise<ProverKey>;
20
+ /**
21
+ * Retrieves the verifier key produced by `compactc` for the given circuit.
22
+ * @param circuitId The circuit ID of the verifier key to retrieve.
23
+ */
24
+ abstract getVerifierKey(circuitId: K): Promise<VerifierKey>;
25
+ /**
26
+ * Retrieves the verifier keys produced by `compactc` for the given circuits.
27
+ * @param circuitIds The circuit IDs of the verifier keys to retrieve.
28
+ */
29
+ getVerifierKeys(circuitIds: K[]): Promise<[K, VerifierKey][]>;
30
+ /**
31
+ * Retrieves all zero-knowledge artifacts produced by `compactc` for the given circuit.
32
+ * @param circuitId The circuit ID of the artifacts to retrieve.
33
+ */
34
+ get(circuitId: K): Promise<ZKConfig<K>>;
35
+ }
36
+ //# sourceMappingURL=zk-config-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zk-config-provider.d.ts","sourceRoot":"","sources":["../src/zk-config-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE/E;;;;;;GAMG;AACH,8BAAsB,gBAAgB,CAAC,CAAC,SAAS,MAAM;IACrD;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAE7C;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAEvD;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;IAE3D;;;OAGG;IACG,eAAe,CAAC,UAAU,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC;IASnE;;;OAGG;IACG,GAAG,CAAC,SAAS,EAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;CAQ9C"}
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@midnight-ntwrk/midnight-js-types",
3
+ "version": "0.1.10",
4
+ "description": "Shared data types and interfaces for MidnightJS modules",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "repository": "git@github.com:midnight-ntwrk/artifacts",
9
+ "packageManager": "yarn@3.6.3",
10
+ "author": "IOHK",
11
+ "license": "Apache-2.0",
12
+ "scripts": {
13
+ "clean": "rm -rf dist tsconfig.build.tsbuildinfo .rollup.cache",
14
+ "build": "yarn clean && rollup -c rollup.config.mjs",
15
+ "test": "jest --passWithNoTests",
16
+ "deploy": "yarn npm publish"
17
+ },
18
+ "files": [
19
+ "dist/"
20
+ ],
21
+ "dependencies": {
22
+ "rxjs": "^7.5.0"
23
+ }
24
+ }