@unlink-xyz/core 0.1.3-canary.455d0fd → 0.1.3-canary.52eebfe
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/account/{account.d.ts → zkAccount.d.ts} +4 -6
- package/dist/account/zkAccount.d.ts.map +1 -0
- package/dist/account/{account.js → zkAccount.js} +3 -9
- package/dist/clients/http.d.ts +0 -6
- package/dist/clients/http.d.ts.map +1 -1
- package/dist/clients/http.js +0 -8
- package/dist/clients/indexer.d.ts +0 -1
- package/dist/clients/indexer.d.ts.map +1 -1
- package/dist/clients/indexer.js +0 -1
- package/dist/config.d.ts +9 -31
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +26 -29
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +0 -2
- package/dist/crypto-adapters/index.d.ts +0 -7
- package/dist/crypto-adapters/index.d.ts.map +1 -1
- package/dist/crypto-adapters/index.js +2 -28
- package/dist/index.d.ts +4 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -5
- package/dist/key-derivation/bip39.d.ts.map +1 -1
- package/dist/key-derivation/bip39.js +0 -1
- package/dist/keys.d.ts +1 -4
- package/dist/keys.d.ts.map +1 -1
- package/dist/keys.js +0 -4
- package/dist/prover/config.d.ts +15 -1
- package/dist/prover/config.d.ts.map +1 -1
- package/dist/prover/config.js +11 -1
- package/dist/prover/prover.d.ts +4 -15
- package/dist/prover/prover.d.ts.map +1 -1
- package/dist/prover/prover.js +86 -103
- package/dist/prover/registry.d.ts +1 -1
- package/dist/prover/registry.js +3 -3
- package/dist/state/merkle/index.d.ts +1 -1
- package/dist/state/merkle/index.d.ts.map +1 -1
- package/dist/state/merkle/index.js +1 -1
- package/dist/state/merkle/merkle-tree.d.ts +0 -8
- package/dist/state/merkle/merkle-tree.d.ts.map +1 -1
- package/dist/state/merkle/merkle-tree.js +0 -8
- package/dist/state/store/index.d.ts +2 -3
- package/dist/state/store/index.d.ts.map +1 -1
- package/dist/state/store/index.js +0 -1
- package/dist/state/store/job-store.d.ts +7 -7
- package/dist/state/store/job-store.d.ts.map +1 -1
- package/dist/state/store/job-store.js +11 -15
- package/dist/state/store/jobs.d.ts +11 -34
- package/dist/state/store/jobs.d.ts.map +1 -1
- package/dist/state/store/leaf-store.d.ts.map +1 -1
- package/dist/state/store/leaf-store.js +3 -0
- package/dist/state/store/note-store.d.ts +7 -3
- package/dist/state/store/note-store.d.ts.map +1 -1
- package/dist/state/store/note-store.js +33 -19
- package/dist/state/store/nullifier-store.d.ts.map +1 -1
- package/dist/state/store/nullifier-store.js +2 -0
- package/dist/state/store/records.d.ts +2 -25
- package/dist/state/store/records.d.ts.map +1 -1
- package/dist/state/store/root-store.d.ts.map +1 -1
- package/dist/state/store/root-store.js +4 -0
- package/dist/state/store/store.d.ts +27 -45
- package/dist/state/store/store.d.ts.map +1 -1
- package/dist/state/store/store.js +0 -3
- package/dist/transactions/deposit.d.ts +16 -9
- package/dist/transactions/deposit.d.ts.map +1 -1
- package/dist/transactions/deposit.js +154 -110
- package/dist/transactions/index.d.ts +4 -6
- package/dist/transactions/index.d.ts.map +1 -1
- package/dist/transactions/index.js +2 -6
- package/dist/transactions/note-sync.d.ts +30 -7
- package/dist/transactions/note-sync.d.ts.map +1 -1
- package/dist/transactions/note-sync.js +5 -21
- package/dist/transactions/reconcile.d.ts +12 -10
- package/dist/transactions/reconcile.d.ts.map +1 -1
- package/dist/transactions/reconcile.js +6 -51
- package/dist/transactions/transact.d.ts +28 -9
- package/dist/transactions/transact.d.ts.map +1 -1
- package/dist/transactions/transact.js +505 -342
- package/dist/transactions/types.d.ts +114 -0
- package/dist/transactions/types.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/crypto.d.ts +5 -5
- package/dist/utils/crypto.d.ts.map +1 -1
- package/dist/utils/validators.d.ts +10 -21
- package/dist/utils/validators.d.ts.map +1 -1
- package/dist/utils/validators.js +1 -27
- package/dist/vitest.config.d.ts.map +1 -1
- package/dist/vitest.config.js +0 -1
- package/package.json +2 -2
- package/dist/account/account.d.ts.map +0 -1
- package/dist/crypto-adapters/auto-init.d.ts +0 -2
- package/dist/crypto-adapters/auto-init.d.ts.map +0 -1
- package/dist/crypto-adapters/auto-init.js +0 -7
- package/dist/history/index.d.ts +0 -3
- package/dist/history/index.d.ts.map +0 -1
- package/dist/history/index.js +0 -2
- package/dist/history/service.d.ts +0 -46
- package/dist/history/service.d.ts.map +0 -1
- package/dist/history/service.js +0 -354
- package/dist/history/types.d.ts +0 -21
- package/dist/history/types.d.ts.map +0 -1
- package/dist/state/store/history-store.d.ts +0 -24
- package/dist/state/store/history-store.d.ts.map +0 -1
- package/dist/state/store/history-store.js +0 -53
- package/dist/transactions/note-selection.d.ts +0 -17
- package/dist/transactions/note-selection.d.ts.map +0 -1
- package/dist/transactions/note-selection.js +0 -196
- package/dist/transactions/transaction-planner.d.ts +0 -34
- package/dist/transactions/transaction-planner.d.ts.map +0 -1
- package/dist/transactions/transaction-planner.js +0 -115
- package/dist/transactions/types/deposit.d.ts +0 -48
- package/dist/transactions/types/deposit.d.ts.map +0 -1
- package/dist/transactions/types/deposit.js +0 -1
- package/dist/transactions/types/domain.d.ts +0 -67
- package/dist/transactions/types/domain.d.ts.map +0 -1
- package/dist/transactions/types/domain.js +0 -4
- package/dist/transactions/types/index.d.ts +0 -18
- package/dist/transactions/types/index.d.ts.map +0 -1
- package/dist/transactions/types/index.js +0 -17
- package/dist/transactions/types/options.d.ts +0 -41
- package/dist/transactions/types/options.d.ts.map +0 -1
- package/dist/transactions/types/options.js +0 -1
- package/dist/transactions/types/planning.d.ts +0 -80
- package/dist/transactions/types/planning.d.ts.map +0 -1
- package/dist/transactions/types/planning.js +0 -1
- package/dist/transactions/types/state-stores.d.ts +0 -51
- package/dist/transactions/types/state-stores.d.ts.map +0 -1
- package/dist/transactions/types/state-stores.js +0 -1
- package/dist/transactions/types/transact.d.ts +0 -61
- package/dist/transactions/types/transact.d.ts.map +0 -1
- package/dist/transactions/types/transact.js +0 -1
- package/dist/transactions/withdrawal-planner.d.ts +0 -61
- package/dist/transactions/withdrawal-planner.d.ts.map +0 -1
- package/dist/transactions/withdrawal-planner.js +0 -99
- package/dist/utils/format.d.ts +0 -25
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/format.js +0 -33
- package/dist/utils/notes.d.ts +0 -15
- package/dist/utils/notes.d.ts.map +0 -1
- package/dist/utils/notes.js +0 -14
- package/dist/utils/random.d.ts +0 -13
- package/dist/utils/random.d.ts.map +0 -1
- package/dist/utils/random.js +0 -27
- /package/dist/{history → transactions}/types.js +0 -0
|
@@ -14,16 +14,14 @@ export type GenerateMasterSeedOptions = {
|
|
|
14
14
|
export declare const MASTER_SEED_LENGTH = 64;
|
|
15
15
|
export declare const MASTER_SEED_KEY = "cfg:wallet:master_seed/v1";
|
|
16
16
|
export declare const MASTER_MNEMONIC_KEY = "cfg:wallet:master_mnemonic/v1";
|
|
17
|
-
export type
|
|
17
|
+
export type ZkAccount = {
|
|
18
18
|
spendingKeyPair: SpendingKeyPair;
|
|
19
19
|
viewingKeyPair: ViewingKeyPair;
|
|
20
20
|
nullifyingKey: bigint;
|
|
21
21
|
masterPublicKey: bigint;
|
|
22
|
-
/** Bech32m address (0zk1...) for this account */
|
|
23
|
-
address: string;
|
|
24
22
|
};
|
|
25
|
-
export declare function
|
|
26
|
-
export declare function
|
|
23
|
+
export declare function deriveZkAccount(masterSeed: Uint8Array, accountIndex?: number): Promise<ZkAccount>;
|
|
24
|
+
export declare function deriveZkAccountFromMnemonic(mnemonic: string, accountIndex?: number, password?: string): Promise<ZkAccount>;
|
|
27
25
|
export declare function generateMasterSeed({ storage, rng, crypto, overwrite, mnemonicPassphrase, }: GenerateMasterSeedOptions): Promise<Uint8Array>;
|
|
28
26
|
export declare function loadMasterSeed(storage: Storage, crypto?: MasterSeedCrypto): Promise<Uint8Array | null>;
|
|
29
27
|
export declare function storeMasterSeed(storage: Storage, seed: Uint8Array, crypto?: MasterSeedCrypto): Promise<void>;
|
|
@@ -37,4 +35,4 @@ export type ImportMasterMnemonicOptions = {
|
|
|
37
35
|
};
|
|
38
36
|
export declare function importMasterMnemonic({ storage, mnemonic, crypto, overwrite, password, }: ImportMasterMnemonicOptions): Promise<Uint8Array>;
|
|
39
37
|
export declare function storeMasterMnemonic(storage: Storage, mnemonic: string, crypto?: MasterSeedCrypto): Promise<void>;
|
|
40
|
-
//# sourceMappingURL=
|
|
38
|
+
//# sourceMappingURL=zkAccount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zkAccount.d.ts","sourceRoot":"","sources":["../../account/zkAccount.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;IAC5D,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,UAAU,CAAC;IAC/B,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,eAAe,8BAA8B,CAAC;AAC3D,eAAO,MAAM,mBAAmB,kCAAkC,CAAC;AAOnE,MAAM,MAAM,SAAS,GAAG;IACtB,eAAe,EAAE,eAAe,CAAC;IACjC,cAAc,EAAE,cAA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vC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,gBAA2C,GAClD,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { encodeAddress } from "../key-derivation/bech32.js";
|
|
2
1
|
import { Mnemonic } from "../key-derivation/bip39.js";
|
|
3
2
|
import { ByteUtils } from "../key-derivation/bytes.js";
|
|
4
3
|
import { deriveNodesFromSeed, WalletNode, } from "../key-derivation/wallet-node.js";
|
|
@@ -9,7 +8,7 @@ export const MASTER_MNEMONIC_KEY = "cfg:wallet:master_mnemonic/v1";
|
|
|
9
8
|
const MNEMONIC_ENTROPY_BYTES = 32;
|
|
10
9
|
const textEncoder = new TextEncoder();
|
|
11
10
|
const textDecoder = new TextDecoder();
|
|
12
|
-
export async function
|
|
11
|
+
export async function deriveZkAccount(masterSeed, accountIndex = 0) {
|
|
13
12
|
const seed = normalizeMasterSeed(masterSeed);
|
|
14
13
|
if (!Number.isInteger(accountIndex) || accountIndex < 0) {
|
|
15
14
|
throw new Error("accountIndex must be a non-negative integer");
|
|
@@ -19,23 +18,18 @@ export async function deriveAccount(masterSeed, accountIndex = 0) {
|
|
|
19
18
|
const viewingKeyPair = await viewing.getViewingKeyPair();
|
|
20
19
|
const nullifyingKey = WalletNode.getNullifyingKey(viewingKeyPair.privateKey);
|
|
21
20
|
const masterPublicKey = WalletNode.getMasterPublicKey(spendingKeyPair.pubkey, nullifyingKey);
|
|
22
|
-
const address = encodeAddress({
|
|
23
|
-
masterPublicKey,
|
|
24
|
-
viewingPublicKey: viewingKeyPair.pubkey,
|
|
25
|
-
});
|
|
26
21
|
return {
|
|
27
22
|
spendingKeyPair,
|
|
28
23
|
viewingKeyPair,
|
|
29
24
|
nullifyingKey,
|
|
30
25
|
masterPublicKey,
|
|
31
|
-
address,
|
|
32
26
|
};
|
|
33
27
|
}
|
|
34
|
-
export async function
|
|
28
|
+
export async function deriveZkAccountFromMnemonic(mnemonic, accountIndex = 0, password = "") {
|
|
35
29
|
const normalized = normalizeMnemonic(mnemonic);
|
|
36
30
|
const seed = mnemonicToSeed(normalized, password);
|
|
37
31
|
try {
|
|
38
|
-
return await
|
|
32
|
+
return await deriveZkAccount(seed, accountIndex);
|
|
39
33
|
}
|
|
40
34
|
finally {
|
|
41
35
|
zeroize(seed);
|
package/dist/clients/http.d.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
export type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
2
|
-
/**
|
|
3
|
-
* Resolve fetch implementation from options or global.
|
|
4
|
-
* @param providedFetch - Optional fetch implementation
|
|
5
|
-
* @returns Fetch function or undefined if not available
|
|
6
|
-
*/
|
|
7
|
-
export declare function resolveFetch(providedFetch?: FetchLike): typeof fetch | undefined;
|
|
8
2
|
export type JsonHttpDeps = {
|
|
9
3
|
fetch: FetchLike;
|
|
10
4
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../clients/http.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,CACtB,KAAK,EAAE,WAAW,GAAG,GAAG,EACxB,IAAI,CAAC,EAAE,WAAW,KACf,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEvB
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../clients/http.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,CACtB,KAAK,EAAE,WAAW,GAAG,GAAG,EACxB,IAAI,CAAC,EAAE,WAAW,KACf,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEvB,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAEhD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;IAC9D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAClD,CAAC;AAEF,qBAAa,SAAU,SAAQ,KAAK;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;CAK3D;AAWD,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,YAAY,GACjB,cAAc,CA+ChB"}
|
package/dist/clients/http.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import ky, { HTTPError, TimeoutError } from "ky";
|
|
2
|
-
/**
|
|
3
|
-
* Resolve fetch implementation from options or global.
|
|
4
|
-
* @param providedFetch - Optional fetch implementation
|
|
5
|
-
* @returns Fetch function or undefined if not available
|
|
6
|
-
*/
|
|
7
|
-
export function resolveFetch(providedFetch) {
|
|
8
|
-
return providedFetch ?? (typeof fetch === "function" ? fetch : undefined);
|
|
9
|
-
}
|
|
10
2
|
export class HttpError extends Error {
|
|
11
3
|
status;
|
|
12
4
|
body;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../../clients/indexer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|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AAO,CAAC,uBAAuB,CAAC;0BAgBzB,mBAAmB,GAC1B,OAAO,CAAC,gBAAgB,CAAC;yBAQlB,kBAAkB,GACzB,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC;+BAcR,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;EAQ5D"}
|
package/dist/clients/indexer.js
CHANGED
|
@@ -11,7 +11,6 @@ export function createIndexerClient(baseUrl, deps) {
|
|
|
11
11
|
root: record.root,
|
|
12
12
|
txHash: record.tx_hash,
|
|
13
13
|
insertedAt: record.inserted_at,
|
|
14
|
-
eventType: record.event_type ?? "unknown",
|
|
15
14
|
});
|
|
16
15
|
const normalizeNullifierRecord = (record) => ({
|
|
17
16
|
nullifier: record.nullifier,
|
package/dist/config.d.ts
CHANGED
|
@@ -1,34 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Configuration for a specific environment.
|
|
7
|
-
*/
|
|
8
|
-
export interface EnvironmentConfig {
|
|
9
|
-
rpcUrl: string;
|
|
10
|
-
poolAddress: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Service configuration with broadcaster and indexer URLs.
|
|
14
|
-
*/
|
|
15
|
-
export interface ServiceConfig {
|
|
1
|
+
export declare const serviceConfig: {
|
|
2
|
+
/**
|
|
3
|
+
* Base URL for the Broadcaster HTTP API (default: http://localhost:8081).
|
|
4
|
+
*/
|
|
16
5
|
broadcasterBaseUrl: string;
|
|
6
|
+
/**
|
|
7
|
+
* Base URL for the Indexer HTTP API (default: http://localhost:8082).
|
|
8
|
+
*/
|
|
17
9
|
indexerBaseUrl: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
* Fetch environment configuration from the hosted config file.
|
|
21
|
-
*
|
|
22
|
-
* @param env - The environment to fetch config for
|
|
23
|
-
* @returns Promise resolving to the environment configuration
|
|
24
|
-
* @throws If fetch fails or environment is not found
|
|
25
|
-
*/
|
|
26
|
-
export declare function fetchEnvironmentConfig(env: Environment): Promise<EnvironmentConfig>;
|
|
27
|
-
/**
|
|
28
|
-
* Create service configuration from an RPC URL.
|
|
29
|
-
*
|
|
30
|
-
* @param rpcUrl - The base RPC URL
|
|
31
|
-
* @returns Service configuration with broadcaster and indexer URLs
|
|
32
|
-
*/
|
|
33
|
-
export declare function createServiceConfig(rpcUrl: string): ServiceConfig;
|
|
10
|
+
};
|
|
11
|
+
export type ServiceConfig = typeof serviceConfig;
|
|
34
12
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../config.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,aAAa;IACxB;;OAEG;;IAGH;;OAEG;;CAGJ,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* @param env - The environment to fetch config for
|
|
6
|
-
* @returns Promise resolving to the environment configuration
|
|
7
|
-
* @throws If fetch fails or environment is not found
|
|
8
|
-
*/
|
|
9
|
-
export async function fetchEnvironmentConfig(env) {
|
|
10
|
-
const res = await fetch(CONFIG_URL);
|
|
11
|
-
if (!res.ok) {
|
|
12
|
-
throw new Error(`Failed to fetch SDK config: ${res.status}`);
|
|
1
|
+
const DEFAULT_RPC_URL = "http://localhost:3030";
|
|
2
|
+
function readEnv(key) {
|
|
3
|
+
if (typeof process !== "undefined" && process?.env) {
|
|
4
|
+
return process.env[key];
|
|
13
5
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
return config[env];
|
|
6
|
+
// Support environments where process isn't defined but a shim sets globalThis.process
|
|
7
|
+
const globalProcess = globalThis.process;
|
|
8
|
+
return globalProcess?.env?.[key];
|
|
19
9
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return
|
|
29
|
-
broadcasterBaseUrl: baseUrl + "/broadcaster",
|
|
30
|
-
indexerBaseUrl: baseUrl + "/indexer",
|
|
31
|
-
};
|
|
10
|
+
function readServiceUrl(envKey, fallback) {
|
|
11
|
+
const raw = readEnv(envKey);
|
|
12
|
+
if (!raw)
|
|
13
|
+
return fallback;
|
|
14
|
+
const trimmed = raw.trim();
|
|
15
|
+
if (!trimmed) {
|
|
16
|
+
throw new Error(`${envKey} must not be empty when set`);
|
|
17
|
+
}
|
|
18
|
+
return trimmed.replace(/\/+$/, "");
|
|
32
19
|
}
|
|
20
|
+
export const serviceConfig = {
|
|
21
|
+
/**
|
|
22
|
+
* Base URL for the Broadcaster HTTP API (default: http://localhost:8081).
|
|
23
|
+
*/
|
|
24
|
+
broadcasterBaseUrl: readServiceUrl("UNLINK_RPC_URL", DEFAULT_RPC_URL) + "/broadcaster",
|
|
25
|
+
/**
|
|
26
|
+
* Base URL for the Indexer HTTP API (default: http://localhost:8082).
|
|
27
|
+
*/
|
|
28
|
+
indexerBaseUrl: readServiceUrl("UNLINK_RPC_URL", DEFAULT_RPC_URL) + "/indexer",
|
|
29
|
+
};
|
package/dist/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../core.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,UAAU,CAAC;CAChC,CAAC;AAEF,wBAAsB,QAAQ,CAAC,IAAI,EAAE,QAAQ;;aAHlC,MAAM,KAAK,UAAU;GAW/B"}
|
package/dist/core.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { initCrypto } from "./crypto-adapters/index.js";
|
|
2
1
|
import { migrate } from "./schema.js";
|
|
3
2
|
export async function initCore(deps) {
|
|
4
3
|
if (!deps?.storage)
|
|
5
4
|
throw new Error("storage dep required");
|
|
6
5
|
if (!deps?.rng)
|
|
7
6
|
throw new Error("rng dep required");
|
|
8
|
-
await initCrypto();
|
|
9
7
|
await migrate(deps.storage);
|
|
10
8
|
return {
|
|
11
9
|
storage: deps.storage,
|
|
@@ -4,15 +4,8 @@
|
|
|
4
4
|
* Exports:
|
|
5
5
|
* - poseidon: Poseidon hash from circomlibjs (iden3)
|
|
6
6
|
* - deriveSpendingPublicKey, signMessage, verifySignature: EdDSA from @zk-kit/eddsa-poseidon
|
|
7
|
-
* - initCrypto: Async function to initialize crypto primitives (must be called before using poseidon)
|
|
8
7
|
*/
|
|
9
8
|
import "./polyfills.js";
|
|
10
|
-
/**
|
|
11
|
-
* Initialize the crypto primitives (Poseidon hash function).
|
|
12
|
-
* This must be called before using the poseidon function.
|
|
13
|
-
* Safe to call multiple times - subsequent calls return the same promise.
|
|
14
|
-
*/
|
|
15
|
-
export declare function initCrypto(): Promise<void>;
|
|
16
9
|
/**
|
|
17
10
|
* Poseidon hash function compatible with circomlib circuits.
|
|
18
11
|
* Wraps circomlibjs buildPoseidon to return bigint directly.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../crypto-adapters/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../crypto-adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,gBAAgB,CAAC;AAKxB;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KAAG,MAGtD,CAAC;AAEF,OAAO,EACL,eAAe,IAAI,uBAAuB,EAC1C,WAAW,EACX,eAAe,GAChB,MAAM,wBAAwB,CAAC"}
|
|
@@ -4,42 +4,16 @@
|
|
|
4
4
|
* Exports:
|
|
5
5
|
* - poseidon: Poseidon hash from circomlibjs (iden3)
|
|
6
6
|
* - deriveSpendingPublicKey, signMessage, verifySignature: EdDSA from @zk-kit/eddsa-poseidon
|
|
7
|
-
* - initCrypto: Async function to initialize crypto primitives (must be called before using poseidon)
|
|
8
7
|
*/
|
|
9
8
|
// Polyfill must be the first import
|
|
10
9
|
import "./polyfills.js";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Initialize the crypto primitives (Poseidon hash function).
|
|
15
|
-
* This must be called before using the poseidon function.
|
|
16
|
-
* Safe to call multiple times - subsequent calls return the same promise.
|
|
17
|
-
*/
|
|
18
|
-
export async function initCrypto() {
|
|
19
|
-
if (_poseidon)
|
|
20
|
-
return; // Already initialized
|
|
21
|
-
if (_initPromise)
|
|
22
|
-
return _initPromise; // Initialization in progress
|
|
23
|
-
_initPromise = (async () => {
|
|
24
|
-
try {
|
|
25
|
-
const { buildPoseidon } = await import("circomlibjs");
|
|
26
|
-
_poseidon = await buildPoseidon();
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
_initPromise = null; // Reset to allow retry
|
|
30
|
-
throw error;
|
|
31
|
-
}
|
|
32
|
-
})();
|
|
33
|
-
return _initPromise;
|
|
34
|
-
}
|
|
10
|
+
const { buildPoseidon } = await import("circomlibjs");
|
|
11
|
+
const _poseidon = await buildPoseidon();
|
|
35
12
|
/**
|
|
36
13
|
* Poseidon hash function compatible with circomlib circuits.
|
|
37
14
|
* Wraps circomlibjs buildPoseidon to return bigint directly.
|
|
38
15
|
*/
|
|
39
16
|
export const poseidon = (inputs) => {
|
|
40
|
-
if (!_poseidon) {
|
|
41
|
-
throw new Error("Crypto not initialized. Call initCrypto() before using poseidon().");
|
|
42
|
-
}
|
|
43
17
|
const hash = _poseidon(inputs);
|
|
44
18
|
return _poseidon.F.toObject(hash);
|
|
45
19
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -10,14 +10,12 @@ export * from "./utils/validators.js";
|
|
|
10
10
|
export * from "./utils/bigint.js";
|
|
11
11
|
export * from "./utils/secure-memory.js";
|
|
12
12
|
export * from "./utils/amounts.js";
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./utils/format.js";
|
|
15
|
-
export * from "./account/account.js";
|
|
13
|
+
export * from "./account/zkAccount.js";
|
|
16
14
|
export * from "./key-derivation/index.js";
|
|
17
|
-
export * from "./history/index.js";
|
|
18
15
|
export * from "./transactions/index.js";
|
|
19
|
-
export {
|
|
20
|
-
export
|
|
16
|
+
export { createJobReconciler } from "./transactions/reconcile.js";
|
|
17
|
+
export { serviceConfig } from "./config.js";
|
|
18
|
+
export type { ServiceConfig } from "./config.js";
|
|
21
19
|
export * from "./clients/broadcaster.js";
|
|
22
20
|
export * from "./clients/indexer.js";
|
|
23
21
|
export * from "./crypto-adapters/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,iBAAiB,CAAuB;AAEnE,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,iBAAiB,CAAuB;AAEnE,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,13 +11,11 @@ export * from "./utils/validators.js";
|
|
|
11
11
|
export * from "./utils/bigint.js";
|
|
12
12
|
export * from "./utils/secure-memory.js";
|
|
13
13
|
export * from "./utils/amounts.js";
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./utils/format.js";
|
|
16
|
-
export * from "./account/account.js";
|
|
14
|
+
export * from "./account/zkAccount.js";
|
|
17
15
|
export * from "./key-derivation/index.js";
|
|
18
|
-
export * from "./history/index.js";
|
|
19
16
|
export * from "./transactions/index.js";
|
|
20
|
-
export {
|
|
17
|
+
export { createJobReconciler } from "./transactions/reconcile.js";
|
|
18
|
+
export { serviceConfig } from "./config.js";
|
|
21
19
|
export * from "./clients/broadcaster.js";
|
|
22
20
|
export * from "./clients/indexer.js";
|
|
23
21
|
export * from "./crypto-adapters/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bip39.d.ts","sourceRoot":"","sources":["../../key-derivation/bip39.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bip39.d.ts","sourceRoot":"","sources":["../../key-derivation/bip39.ts"],"names":[],"mappings":"AAqBA,qBAAa,QAAQ;IACnB;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAE,GAAG,GAAG,GAAG,GAAG,GAAS,GAAG,MAAM;IAIxD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI1C;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAW,GAAG,MAAM;IAK9D,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAK1C,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAK9C;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM;IAWzE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM;CAOvE"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Buffer } from "buffer";
|
|
2
1
|
import { entropyToMnemonic, generateMnemonic, mnemonicToEntropy, mnemonicToSeedSync, validateMnemonic, } from "@scure/bip39";
|
|
3
2
|
import { wordlist } from "@scure/bip39/wordlists/english.js";
|
|
4
3
|
import { HDKey } from "ethereum-cryptography/hdkey";
|
package/dist/keys.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
export declare const RESERVED_PREFIXES: readonly ["meta:", "
|
|
1
|
+
export declare const RESERVED_PREFIXES: readonly ["meta:", "notes:", "leaves:", "roots:", "nullifiers:", "ciphertexts:", "jobs:", "proof_cache:", "cfg:", "idx:", "locks:"];
|
|
2
2
|
/** Canonical builders for storage key namespaces used across core */
|
|
3
3
|
export declare const keys: {
|
|
4
4
|
note: (c: number, i: number) => string;
|
|
5
|
-
historyEntry: (id: string) => string;
|
|
6
|
-
historyPrefix: (chainId: number, mpk: string) => string;
|
|
7
|
-
historyMeta: (chainId: number, mpk: string) => string;
|
|
8
5
|
leaf: (c: number, i: number) => string;
|
|
9
6
|
ciphertext: (c: number, i: number) => string;
|
|
10
7
|
/** Track note indices that remain unspent for a given master public key (mpk acts as the account identifier). */
|
package/dist/keys.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../keys.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../keys.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,qIAYpB,CAAC;AAEX,qEAAqE;AACrE,eAAO,MAAM,IAAI;cACL,MAAM,KAAK,MAAM;cACjB,MAAM,KAAK,MAAM;oBACX,MAAM,KAAK,MAAM;IACjC,iHAAiH;iBACpG,MAAM,OAAO,MAAM,KAAK,MAAM;uBAExB,MAAM,OAAO,MAAM;sBACpB,MAAM,KAAK,MAAM;qBAClB,MAAM,KAAK,MAAM;mBACnB,MAAM,KAAK,MAAM;cACtB,MAAM,SAAS,MAAM;oBACf,MAAM;oBACN,MAAM;gBACV,MAAM;mBACH,MAAM,KAAK,MAAM;mBACjB,MAAM;CACtB,CAAC;AAEF,eAAO,MAAM,WAAW,MAAM,CAAC;AAE/B,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,QAQtC"}
|
package/dist/keys.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { KeyValidationError } from "./errors.js";
|
|
2
2
|
export const RESERVED_PREFIXES = [
|
|
3
3
|
"meta:",
|
|
4
|
-
"history:",
|
|
5
4
|
"notes:",
|
|
6
5
|
"leaves:",
|
|
7
6
|
"roots:",
|
|
@@ -16,9 +15,6 @@ export const RESERVED_PREFIXES = [
|
|
|
16
15
|
/** Canonical builders for storage key namespaces used across core */
|
|
17
16
|
export const keys = {
|
|
18
17
|
note: (c, i) => `notes:${c}:${i}`,
|
|
19
|
-
historyEntry: (id) => `history:${id}`,
|
|
20
|
-
historyPrefix: (chainId, mpk) => `history:${chainId}:${mpk}:`,
|
|
21
|
-
historyMeta: (chainId, mpk) => `history:${chainId}:${mpk}:__meta__`,
|
|
22
18
|
leaf: (c, i) => `leaves:${c}:${i}`,
|
|
23
19
|
ciphertext: (c, i) => `ciphertexts:${c}:${i}`,
|
|
24
20
|
/** Track note indices that remain unspent for a given master public key (mpk acts as the account identifier). */
|
package/dist/prover/config.d.ts
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
* Configuration for the prover system
|
|
3
3
|
* Handles artifact loading from local files or remote artifact server
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Environment-based configuration for artifact loading
|
|
7
|
+
*/
|
|
8
|
+
export interface ProverConfig {
|
|
9
|
+
/** Base URL for the artifact server (browser mode) */
|
|
10
|
+
rpcUrl: string;
|
|
11
|
+
/** Whether to enable artifact caching */
|
|
12
|
+
enableCache: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Default configuration
|
|
16
|
+
* Can be overridden via environment variables
|
|
17
|
+
*/
|
|
18
|
+
export declare const DEFAULT_CONFIG: ProverConfig;
|
|
5
19
|
/**
|
|
6
20
|
* Artifact file types
|
|
7
21
|
*/
|
|
@@ -17,7 +31,7 @@ export declare enum ArtifactType {
|
|
|
17
31
|
* @param baseUrl Base URL of the artifact server
|
|
18
32
|
* @returns Full URL to the artifact
|
|
19
33
|
*/
|
|
20
|
-
export declare function buildArtifactUrl(circuitName: string, artifactType: ArtifactType, baseUrl
|
|
34
|
+
export declare function buildArtifactUrl(circuitName: string, artifactType: ArtifactType, baseUrl?: string): string;
|
|
21
35
|
/**
|
|
22
36
|
* Get relative path for local artifact loading
|
|
23
37
|
* Used in Node.js environment when artifacts are bundled
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../prover/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,oBAAY,YAAY;IACtB,IAAI,mBAAmB;IACvB,IAAI,mBAAmB;IACvB,IAAI,wBAAwB;CAC7B;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,YAAY,EAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../prover/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,YAM5B,CAAC;AAEF;;GAEG;AACH,oBAAY,YAAY;IACtB,IAAI,mBAAmB;IACvB,IAAI,mBAAmB;IACvB,IAAI,wBAAwB;CAC7B;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,YAAY,EAC1B,OAAO,GAAE,MAA8B,GACtC,MAAM,CAIR;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,YAAY,GACzB,MAAM,EAAE,CAQV;AAED;;GAEG;AACH,eAAO,MAAM,OAAO;IAClB;;OAEG;iBACU,OAAO;IAIpB;;OAEG;cACO,OAAO;IAQjB;;OAEG;sBACe,MAAM;CAKzB,CAAC"}
|
package/dist/prover/config.js
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
* Configuration for the prover system
|
|
3
3
|
* Handles artifact loading from local files or remote artifact server
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Default configuration
|
|
7
|
+
* Can be overridden via environment variables
|
|
8
|
+
*/
|
|
9
|
+
export const DEFAULT_CONFIG = {
|
|
10
|
+
rpcUrl: typeof process !== "undefined" && process.env?.UNLINK_RPC_URL
|
|
11
|
+
? process.env.UNLINK_RPC_URL
|
|
12
|
+
: "http://localhost:3030",
|
|
13
|
+
enableCache: true,
|
|
14
|
+
};
|
|
5
15
|
/**
|
|
6
16
|
* Artifact file types
|
|
7
17
|
*/
|
|
@@ -18,7 +28,7 @@ export var ArtifactType;
|
|
|
18
28
|
* @param baseUrl Base URL of the artifact server
|
|
19
29
|
* @returns Full URL to the artifact
|
|
20
30
|
*/
|
|
21
|
-
export function buildArtifactUrl(circuitName, artifactType, baseUrl) {
|
|
31
|
+
export function buildArtifactUrl(circuitName, artifactType, baseUrl = DEFAULT_CONFIG.rpcUrl) {
|
|
22
32
|
// Remove trailing slash from baseUrl
|
|
23
33
|
const cleanBaseUrl = baseUrl.replace(/\/$/, "");
|
|
24
34
|
return `${cleanBaseUrl}/artifacts/${circuitName}/${artifactType}`;
|
package/dist/prover/prover.d.ts
CHANGED
|
@@ -30,30 +30,22 @@ export interface JoinsplitProofInput {
|
|
|
30
30
|
readonly npkOut: bigint[];
|
|
31
31
|
readonly valueOut: bigint[];
|
|
32
32
|
}
|
|
33
|
-
export declare function proveTransaction(input: JoinsplitProofInput
|
|
34
|
-
rpcUrl?: string;
|
|
35
|
-
}): Promise<JoinsplitProof>;
|
|
33
|
+
export declare function proveTransaction(input: JoinsplitProofInput): Promise<JoinsplitProof>;
|
|
36
34
|
/**
|
|
37
35
|
* Get verification key for a specific circuit configuration
|
|
38
36
|
* @param inputs Number of inputs (nullifiers)
|
|
39
37
|
* @param outputs Number of outputs (commitments)
|
|
40
|
-
* @param options Configuration including rpcUrl
|
|
41
38
|
* @returns Verification key for the circuit
|
|
42
39
|
*/
|
|
43
|
-
export declare function getVerificationKey(inputs: number, outputs: number
|
|
44
|
-
rpcUrl?: string;
|
|
45
|
-
}): Promise<VerificationKey>;
|
|
40
|
+
export declare function getVerificationKey(inputs: number, outputs: number): Promise<VerificationKey>;
|
|
46
41
|
/**
|
|
47
42
|
* Verify a proof with public signals
|
|
48
43
|
* Auto-detects the circuit from the public signals structure
|
|
49
44
|
* @param proof Groth16 proof
|
|
50
45
|
* @param publicSignals Public signals array
|
|
51
|
-
* @param options Optional configuration including rpcUrl
|
|
52
46
|
* @returns True if proof is valid
|
|
53
47
|
*/
|
|
54
|
-
export declare function verifyProof(proof: Groth16Proof, publicSignals: PublicSignals
|
|
55
|
-
rpcUrl?: string;
|
|
56
|
-
}): Promise<boolean>;
|
|
48
|
+
export declare function verifyProof(proof: Groth16Proof, publicSignals: PublicSignals): Promise<boolean>;
|
|
57
49
|
/**
|
|
58
50
|
* Verify a proof with explicit circuit specification
|
|
59
51
|
* Preferred method when you know the circuit dimensions
|
|
@@ -61,10 +53,7 @@ export declare function verifyProof(proof: Groth16Proof, publicSignals: PublicSi
|
|
|
61
53
|
* @param publicSignals Public signals array
|
|
62
54
|
* @param inputs Number of inputs (nullifiers)
|
|
63
55
|
* @param outputs Number of outputs (commitments)
|
|
64
|
-
* @param options Optional configuration including rpcUrl
|
|
65
56
|
* @returns True if proof is valid
|
|
66
57
|
*/
|
|
67
|
-
export declare function verifyProofWithCircuit(proof: Groth16Proof, publicSignals: PublicSignals, inputs: number, outputs: number
|
|
68
|
-
rpcUrl?: string;
|
|
69
|
-
}): Promise<boolean>;
|
|
58
|
+
export declare function verifyProofWithCircuit(proof: Groth16Proof, publicSignals: PublicSignals, inputs: number, outputs: number): Promise<boolean>;
|
|
70
59
|
//# sourceMappingURL=prover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prover.d.ts","sourceRoot":"","sources":["../../prover/prover.ts"],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