@invisi-labs/sdk 1.1.6 → 1.2.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 +5 -0
- package/dist/broadcaster-3KTB4JO2.cjs +21 -0
- package/dist/broadcaster-3KTB4JO2.cjs.map +1 -0
- package/dist/broadcaster-7ZKKSTZQ.js +21 -0
- package/dist/broadcaster-preparation-PJ263WBL.cjs +15 -0
- package/dist/broadcaster-preparation-PJ263WBL.cjs.map +1 -0
- package/dist/broadcaster-preparation-ZQAPZAUG.js +15 -0
- package/dist/broadcaster-preparation-ZQAPZAUG.js.map +1 -0
- package/dist/chunk-2URICDPW.cjs +167 -0
- package/dist/chunk-2URICDPW.cjs.map +1 -0
- package/dist/chunk-3D24ABYR.js +86 -0
- package/dist/chunk-3D24ABYR.js.map +1 -0
- package/dist/chunk-3KTQQZOW.cjs +71 -0
- package/dist/chunk-3KTQQZOW.cjs.map +1 -0
- package/dist/chunk-4H4FARQK.js +1582 -0
- package/dist/chunk-4H4FARQK.js.map +1 -0
- package/dist/chunk-4SDP53YQ.cjs +765 -0
- package/dist/chunk-4SDP53YQ.cjs.map +1 -0
- package/dist/{chunk-QC6TQR3R.js → chunk-4VI6LYGH.js} +35 -12
- package/dist/chunk-4VI6LYGH.js.map +1 -0
- package/dist/chunk-BBSRP4MH.cjs +287 -0
- package/dist/chunk-BBSRP4MH.cjs.map +1 -0
- package/dist/chunk-DGMVGFKM.js +41 -0
- package/dist/chunk-DGMVGFKM.js.map +1 -0
- package/dist/chunk-GUD3LAUO.js +765 -0
- package/dist/chunk-GUD3LAUO.js.map +1 -0
- package/dist/chunk-HCB7RQ3S.cjs +79 -0
- package/dist/chunk-HCB7RQ3S.cjs.map +1 -0
- package/dist/{broadcaster-preparation-QVL62KM6.js → chunk-HKGJXQVN.js} +73 -34
- package/dist/chunk-HKGJXQVN.js.map +1 -0
- package/dist/chunk-HLH5JZD4.js +287 -0
- package/dist/chunk-HLH5JZD4.js.map +1 -0
- package/dist/chunk-J6TZZVAM.cjs +230 -0
- package/dist/chunk-J6TZZVAM.cjs.map +1 -0
- package/dist/chunk-LOR6PYH5.cjs +397 -0
- package/dist/chunk-LOR6PYH5.cjs.map +1 -0
- package/dist/chunk-MA2QZEF5.cjs +399 -0
- package/dist/chunk-MA2QZEF5.cjs.map +1 -0
- package/dist/chunk-MI4IP4ZD.cjs +86 -0
- package/dist/chunk-MI4IP4ZD.cjs.map +1 -0
- package/dist/chunk-NKYHYIRP.cjs +1582 -0
- package/dist/chunk-NKYHYIRP.cjs.map +1 -0
- package/dist/chunk-OCZLJKIA.cjs +41 -0
- package/dist/chunk-OCZLJKIA.cjs.map +1 -0
- package/dist/chunk-R5YAOJKB.js +71 -0
- package/dist/chunk-R5YAOJKB.js.map +1 -0
- package/dist/chunk-RY4M2CIQ.js +399 -0
- package/dist/chunk-RY4M2CIQ.js.map +1 -0
- package/dist/chunk-THMD5QO2.js +79 -0
- package/dist/chunk-THMD5QO2.js.map +1 -0
- package/dist/chunk-ZD2652WH.js +230 -0
- package/dist/chunk-ZD2652WH.js.map +1 -0
- package/dist/credit.cjs +1 -0
- package/dist/credit.cjs.map +1 -0
- package/dist/credit.d.cts +12 -0
- package/dist/credit.d.ts +12 -0
- package/dist/credit.js +1 -0
- package/dist/credit.js.map +1 -0
- package/dist/ethers.cjs +11 -385
- package/dist/ethers.cjs.map +1 -1
- package/dist/ethers.d.cts +16 -6
- package/dist/ethers.d.ts +16 -6
- package/dist/ethers.js +1 -1
- package/dist/index-CLhGwLxZ.d.cts +42 -0
- package/dist/index-Crp-ZFiM.d.ts +42 -0
- package/dist/index.cjs +479 -7847
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +87 -710
- package/dist/index.d.ts +87 -710
- package/dist/index.js +407 -869
- package/dist/index.js.map +1 -1
- package/dist/note.cjs +11 -0
- package/dist/note.cjs.map +1 -0
- package/dist/note.d.cts +29 -0
- package/dist/note.d.ts +29 -0
- package/dist/note.js +11 -0
- package/dist/note.js.map +1 -0
- package/dist/operation-bridge-CoECSxfi.d.cts +472 -0
- package/dist/operation-bridge-CoECSxfi.d.ts +472 -0
- package/dist/preparation-HUBTVCZE.js +404 -0
- package/dist/preparation-HUBTVCZE.js.map +1 -0
- package/dist/preparation-QD3ZSYV5.cjs +404 -0
- package/dist/preparation-QD3ZSYV5.cjs.map +1 -0
- package/dist/provenance-preparation-43DN2WK7.cjs +16 -0
- package/dist/provenance-preparation-43DN2WK7.cjs.map +1 -0
- package/dist/provenance-preparation-HEZE4L5H.js +16 -0
- package/dist/provenance-preparation-HEZE4L5H.js.map +1 -0
- package/dist/provenance.cjs +59 -0
- package/dist/provenance.cjs.map +1 -0
- package/dist/provenance.d.cts +34 -0
- package/dist/provenance.d.ts +34 -0
- package/dist/provenance.js +59 -0
- package/dist/provenance.js.map +1 -0
- package/dist/receipt-logs-8Msm_HZS.d.ts +322 -0
- package/dist/receipt-logs-DWG4In8N.d.cts +322 -0
- package/dist/session-support.cjs +189 -0
- package/dist/session-support.cjs.map +1 -0
- package/dist/session-support.d.cts +284 -0
- package/dist/session-support.d.ts +284 -0
- package/dist/session-support.js +189 -0
- package/dist/session-support.js.map +1 -0
- package/package.json +25 -19
- package/dist/NoteOutput-DRkVnwlx.d.cts +0 -398
- package/dist/NoteOutput-DpDC6T2O.d.ts +0 -398
- package/dist/broadcaster-preparation-QVL62KM6.js.map +0 -1
- package/dist/chunk-4SD3MW6N.js +0 -4711
- package/dist/chunk-4SD3MW6N.js.map +0 -1
- package/dist/chunk-FL4TIGWW.js +0 -1781
- package/dist/chunk-FL4TIGWW.js.map +0 -1
- package/dist/chunk-QC6TQR3R.js.map +0 -1
- package/dist/indexeddb.cjs +0 -6878
- package/dist/indexeddb.cjs.map +0 -1
- package/dist/indexeddb.d.cts +0 -20
- package/dist/indexeddb.d.ts +0 -20
- package/dist/indexeddb.js +0 -71
- package/dist/indexeddb.js.map +0 -1
- package/dist/memory.cjs +0 -6886
- package/dist/memory.cjs.map +0 -1
- package/dist/memory.d.cts +0 -12
- package/dist/memory.d.ts +0 -12
- package/dist/memory.js +0 -11
- package/dist/sqlite.cjs +0 -6862
- package/dist/sqlite.cjs.map +0 -1
- package/dist/sqlite.d.cts +0 -28
- package/dist/sqlite.d.ts +0 -28
- package/dist/sqlite.js +0 -55
- package/dist/sqlite.js.map +0 -1
- package/dist/state-C4HZFotm.d.cts +0 -78
- package/dist/state-C4HZFotm.d.ts +0 -78
- package/dist/store-8aBhnbGr.d.ts +0 -42
- package/dist/store-YrbXb6CY.d.cts +0 -42
- /package/dist/{memory.js.map → broadcaster-7ZKKSTZQ.js.map} +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PublicResult } from '@invisi-labs/protocol/provenance';
|
|
2
|
+
export * from '@invisi-labs/protocol/provenance';
|
|
3
|
+
import { ProvenanceClient } from '@invisi-labs/rpc/provenance';
|
|
4
|
+
export * from '@invisi-labs/rpc/provenance';
|
|
5
|
+
import { ProvenanceProvider } from '@invisi-labs/prover/provenance-witness';
|
|
6
|
+
export * from '@invisi-labs/prover/provenance-witness';
|
|
7
|
+
import { B as BroadcasterTransaction, P as ProvenanceProof } from './operation-bridge-CoECSxfi.js';
|
|
8
|
+
export { a as PreparedProvenanceCapability } from './operation-bridge-CoECSxfi.js';
|
|
9
|
+
import '@invisi-labs/primitives';
|
|
10
|
+
import '@invisi-labs/prover';
|
|
11
|
+
import '@invisi-labs/protocol';
|
|
12
|
+
import '@invisi-labs/rpc/broadcaster';
|
|
13
|
+
import '@invisi-labs/protocol/contracts';
|
|
14
|
+
import 'ethers';
|
|
15
|
+
import '@invisi-labs/rpc';
|
|
16
|
+
|
|
17
|
+
interface ProvenanceOptions {
|
|
18
|
+
prover?: ProvenanceProvider;
|
|
19
|
+
client?: ProvenanceClient;
|
|
20
|
+
maxRootPages?: number;
|
|
21
|
+
maxLeaves?: number;
|
|
22
|
+
}
|
|
23
|
+
declare class Provenance {
|
|
24
|
+
#private;
|
|
25
|
+
private readonly options;
|
|
26
|
+
constructor(options?: ProvenanceOptions);
|
|
27
|
+
private client;
|
|
28
|
+
prove(ready: BroadcasterTransaction, options?: {
|
|
29
|
+
reprove?: boolean;
|
|
30
|
+
}): Promise<ProvenanceProof>;
|
|
31
|
+
submit(proof: ProvenanceProof): Promise<PublicResult>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { Provenance, type ProvenanceOptions, ProvenanceProof };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
validateProvenanceProof
|
|
3
|
+
} from "./chunk-3D24ABYR.js";
|
|
4
|
+
import {
|
|
5
|
+
operationProvenanceContext,
|
|
6
|
+
proveOperationProvenance,
|
|
7
|
+
readOperationProvenance
|
|
8
|
+
} from "./chunk-R5YAOJKB.js";
|
|
9
|
+
|
|
10
|
+
// src/provenance.ts
|
|
11
|
+
export * from "@invisi-labs/protocol/provenance";
|
|
12
|
+
export * from "@invisi-labs/rpc/provenance";
|
|
13
|
+
export * from "@invisi-labs/prover/provenance-witness";
|
|
14
|
+
|
|
15
|
+
// src/provenance/Provenance.ts
|
|
16
|
+
import { OfficialProvenanceClients } from "@invisi-labs/rpc/provenance";
|
|
17
|
+
var Provenance = class {
|
|
18
|
+
constructor(options = {}) {
|
|
19
|
+
this.options = options;
|
|
20
|
+
}
|
|
21
|
+
#official = new OfficialProvenanceClients();
|
|
22
|
+
async client(scope) {
|
|
23
|
+
const client = this.options.client ?? await this.#official.get(scope);
|
|
24
|
+
if (BigInt(client.trust.chainId) !== BigInt(scope.chainId) || BigInt(client.trust.protocolAddress) !== BigInt(scope.protocolAddress))
|
|
25
|
+
throw Error("Provenance client deployment mismatch");
|
|
26
|
+
return client;
|
|
27
|
+
}
|
|
28
|
+
async prove(ready, options = {}) {
|
|
29
|
+
const cached = options.reprove ? void 0 : await readOperationProvenance(ready);
|
|
30
|
+
if (cached)
|
|
31
|
+
return validateProvenanceProof(cached, (await this.client(cached.context)).trust);
|
|
32
|
+
const prover = this.options.prover;
|
|
33
|
+
if (!prover) throw Error("NativeProver required to generate Provenance proof");
|
|
34
|
+
const scope = await operationProvenanceContext(ready);
|
|
35
|
+
const capability = await prover.getProvenanceCapability();
|
|
36
|
+
const client = await this.client(scope);
|
|
37
|
+
const proof = await proveOperationProvenance(
|
|
38
|
+
ready,
|
|
39
|
+
{
|
|
40
|
+
...capability,
|
|
41
|
+
client,
|
|
42
|
+
...this.options.maxRootPages === void 0 ? {} : { maxRootPages: this.options.maxRootPages },
|
|
43
|
+
...this.options.maxLeaves === void 0 ? {} : { maxLeaves: this.options.maxLeaves }
|
|
44
|
+
},
|
|
45
|
+
options.reprove === true
|
|
46
|
+
);
|
|
47
|
+
return validateProvenanceProof(proof, client.trust);
|
|
48
|
+
}
|
|
49
|
+
async submit(proof) {
|
|
50
|
+
const copy = structuredClone(proof);
|
|
51
|
+
const client = await this.client(copy.context);
|
|
52
|
+
const packet = await validateProvenanceProof(copy, client.trust);
|
|
53
|
+
return client.submitSourceProof(packet.data, packet.sidecars);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
Provenance
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=provenance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/provenance.ts","../src/provenance/Provenance.ts"],"sourcesContent":["export * from \"@invisi-labs/protocol/provenance\";\nexport * from \"@invisi-labs/rpc/provenance\";\nexport * from \"@invisi-labs/prover/provenance-witness\";\nexport { Provenance, type ProvenanceOptions } from \"./provenance/Provenance\";\nexport type { ProvenanceProof } from \"./provenance/proof-record\";\n\nexport type { PreparedProvenanceCapability } from \"./broadcaster/provenance-preparation\";\n","import { OfficialProvenanceClients, type ProvenanceClient } from \"@invisi-labs/rpc/provenance\";\nimport { type PublicResult, type Scope } from \"@invisi-labs/protocol/provenance\";\nimport { type ProvenanceProvider } from \"@invisi-labs/prover/provenance-witness\";\nimport {\n proveOperationProvenance,\n readOperationProvenance,\n operationProvenanceContext,\n type BroadcasterTransaction,\n} from \"../broadcaster/operation-bridge\";\nimport { validateProvenanceProof, type ProvenanceProof } from \"./proof-record\";\n\nexport interface ProvenanceOptions {\n prover?: ProvenanceProvider;\n client?: ProvenanceClient;\n maxRootPages?: number;\n maxLeaves?: number;\n}\n\nexport class Provenance {\n readonly #official = new OfficialProvenanceClients();\n constructor(private readonly options: ProvenanceOptions = {}) {}\n\n private async client(scope: Scope): Promise<ProvenanceClient> {\n const client = this.options.client ?? (await this.#official.get(scope));\n if (\n BigInt(client.trust.chainId) !== BigInt(scope.chainId) ||\n BigInt(client.trust.protocolAddress) !== BigInt(scope.protocolAddress)\n )\n throw Error(\"Provenance client deployment mismatch\");\n return client;\n }\n\n async prove(\n ready: BroadcasterTransaction,\n options: { reprove?: boolean } = {}\n ): Promise<ProvenanceProof> {\n const cached = options.reprove ? undefined : await readOperationProvenance(ready);\n if (cached)\n return validateProvenanceProof(cached, (await this.client(cached.context)).trust);\n const prover = this.options.prover;\n if (!prover) throw Error(\"NativeProver required to generate Provenance proof\");\n const scope = await operationProvenanceContext(ready);\n const capability = await prover.getProvenanceCapability();\n const client = await this.client(scope);\n const proof = await proveOperationProvenance(\n ready,\n {\n ...capability,\n client,\n ...(this.options.maxRootPages === undefined\n ? {}\n : { maxRootPages: this.options.maxRootPages }),\n ...(this.options.maxLeaves === undefined\n ? {}\n : { maxLeaves: this.options.maxLeaves }),\n },\n options.reprove === true\n );\n return validateProvenanceProof(proof, client.trust);\n }\n\n async submit(proof: ProvenanceProof): Promise<PublicResult> {\n const copy = structuredClone(proof);\n const client = await this.client(copy.context);\n const packet = await validateProvenanceProof(copy, client.trust);\n return client.submitSourceProof(packet.data, packet.sidecars);\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,cAAc;AACd,cAAc;AACd,cAAc;;;ACFd,SAAS,iCAAwD;AAkB1D,IAAM,aAAN,MAAiB;AAAA,EAEpB,YAA6B,UAA6B,CAAC,GAAG;AAAjC;AAAA,EAAkC;AAAA,EADtD,YAAY,IAAI,0BAA0B;AAAA,EAGnD,MAAc,OAAO,OAAyC;AAC1D,UAAM,SAAS,KAAK,QAAQ,UAAW,MAAM,KAAK,UAAU,IAAI,KAAK;AACrE,QACI,OAAO,OAAO,MAAM,OAAO,MAAM,OAAO,MAAM,OAAO,KACrD,OAAO,OAAO,MAAM,eAAe,MAAM,OAAO,MAAM,eAAe;AAErE,YAAM,MAAM,uCAAuC;AACvD,WAAO;AAAA,EACX;AAAA,EAEA,MAAM,MACF,OACA,UAAiC,CAAC,GACV;AACxB,UAAM,SAAS,QAAQ,UAAU,SAAY,MAAM,wBAAwB,KAAK;AAChF,QAAI;AACA,aAAO,wBAAwB,SAAS,MAAM,KAAK,OAAO,OAAO,OAAO,GAAG,KAAK;AACpF,UAAM,SAAS,KAAK,QAAQ;AAC5B,QAAI,CAAC,OAAQ,OAAM,MAAM,oDAAoD;AAC7E,UAAM,QAAQ,MAAM,2BAA2B,KAAK;AACpD,UAAM,aAAa,MAAM,OAAO,wBAAwB;AACxD,UAAM,SAAS,MAAM,KAAK,OAAO,KAAK;AACtC,UAAM,QAAQ,MAAM;AAAA,MAChB;AAAA,MACA;AAAA,QACI,GAAG;AAAA,QACH;AAAA,QACA,GAAI,KAAK,QAAQ,iBAAiB,SAC5B,CAAC,IACD,EAAE,cAAc,KAAK,QAAQ,aAAa;AAAA,QAChD,GAAI,KAAK,QAAQ,cAAc,SACzB,CAAC,IACD,EAAE,WAAW,KAAK,QAAQ,UAAU;AAAA,MAC9C;AAAA,MACA,QAAQ,YAAY;AAAA,IACxB;AACA,WAAO,wBAAwB,OAAO,OAAO,KAAK;AAAA,EACtD;AAAA,EAEA,MAAM,OAAO,OAA+C;AACxD,UAAM,OAAO,gBAAgB,KAAK;AAClC,UAAM,SAAS,MAAM,KAAK,OAAO,KAAK,OAAO;AAC7C,UAAM,SAAS,MAAM,wBAAwB,MAAM,OAAO,KAAK;AAC/D,WAAO,OAAO,kBAAkB,OAAO,MAAM,OAAO,QAAQ;AAAA,EAChE;AACJ;","names":[]}
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { RegistrationPreparation, RegistrationOperation } from '@invisi-labs/rpc';
|
|
2
|
+
import * as _invisi_labs_primitives from '@invisi-labs/primitives';
|
|
3
|
+
import { WalletResponse, CreditDeliveryState, Note, authenticatedDecryptor } from '@invisi-labs/primitives';
|
|
4
|
+
import * as _invisi_labs_protocol from '@invisi-labs/protocol';
|
|
5
|
+
import { TransactionCall, CanonicalReceipt } from '@invisi-labs/protocol';
|
|
6
|
+
import { O as OperationStatus, T as TransactionRuntime, d as PreparationIntent, e as OperationPlan, f as TransactionProveOptions, g as OperationAggregateMember, h as TransactionInfrastructure } from './operation-bridge-CoECSxfi.js';
|
|
7
|
+
import { Hex, Address } from '@invisi-labs/protocol/contracts';
|
|
8
|
+
import { TransactionOutput } from './note.js';
|
|
9
|
+
import { Prover, ProofBundle } from '@invisi-labs/prover';
|
|
10
|
+
import { T as TransactionIdentity, E as ExplicitTransferPreparation, a as ExplicitShieldPreparation, b as ExplicitCreateCreditPreparation, c as ExplicitDrawCreditPreparation, d as ExplicitUpdateCreditPreparation, e as ExplicitRevokeCreditPreparation } from './index-Crp-ZFiM.js';
|
|
11
|
+
|
|
12
|
+
interface BroadcasterQuote {
|
|
13
|
+
token: string;
|
|
14
|
+
feeRecipient: string;
|
|
15
|
+
feeAmount: string;
|
|
16
|
+
deadline: string;
|
|
17
|
+
maxGas: string;
|
|
18
|
+
requestHash: string;
|
|
19
|
+
}
|
|
20
|
+
interface SignedBroadcasterQuote {
|
|
21
|
+
quote: BroadcasterQuote;
|
|
22
|
+
signature: string;
|
|
23
|
+
provenanceRequired?: boolean;
|
|
24
|
+
requestHashFormat?: string;
|
|
25
|
+
context?: {
|
|
26
|
+
chainId: bigint;
|
|
27
|
+
protocol: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type Runtime = TransactionRuntime & {
|
|
32
|
+
reprepare?: (intent: PreparationIntent) => Promise<OperationPlan>;
|
|
33
|
+
};
|
|
34
|
+
/** An immutable, local transaction handle. No wallet inventory, reservations or persistence. */
|
|
35
|
+
declare class PreparedTransaction {
|
|
36
|
+
#private;
|
|
37
|
+
readonly status: OperationStatus;
|
|
38
|
+
private constructor();
|
|
39
|
+
static prepare(runtime: Runtime, plan: OperationPlan): PreparedTransaction;
|
|
40
|
+
broadcasterQuote(): SignedBroadcasterQuote | undefined;
|
|
41
|
+
get id(): string;
|
|
42
|
+
get kind(): "create-credit" | "update-credit" | "transfer" | "shield" | "draw-credit" | "revoke-credit";
|
|
43
|
+
estimateGas(options?: {
|
|
44
|
+
from?: `0x${string}`;
|
|
45
|
+
}): Promise<{
|
|
46
|
+
source: "rpc";
|
|
47
|
+
gasUnits: bigint;
|
|
48
|
+
}>;
|
|
49
|
+
getGasReference(): _invisi_labs_protocol.DocumentedGasReference;
|
|
50
|
+
/** Final Note outputs, including change; Credit outputs are not exported as IPN. */
|
|
51
|
+
getOutputs(): readonly TransactionOutput[];
|
|
52
|
+
preview(): {
|
|
53
|
+
id: string;
|
|
54
|
+
kind: "create-credit" | "update-credit" | "transfer" | "shield" | "draw-credit" | "revoke-credit";
|
|
55
|
+
status: OperationStatus;
|
|
56
|
+
context: {
|
|
57
|
+
tokenAddress: _invisi_labs_primitives.Address;
|
|
58
|
+
now?: bigint;
|
|
59
|
+
timestamp?: bigint;
|
|
60
|
+
chainId: bigint;
|
|
61
|
+
protocolAddress: _invisi_labs_primitives.Address;
|
|
62
|
+
};
|
|
63
|
+
inputs: number;
|
|
64
|
+
inputDetails: ({
|
|
65
|
+
kind: "notes";
|
|
66
|
+
commitment: `0x${string}`;
|
|
67
|
+
amount: bigint;
|
|
68
|
+
owner: `0x${string}`;
|
|
69
|
+
treeId: bigint;
|
|
70
|
+
leafIndex: number;
|
|
71
|
+
} | {
|
|
72
|
+
kind: "credits";
|
|
73
|
+
commitment: `0x${string}`;
|
|
74
|
+
revocationShard: bigint;
|
|
75
|
+
revocationSlot: bigint;
|
|
76
|
+
owner: `0x${string}`;
|
|
77
|
+
spender: `0x${string}`;
|
|
78
|
+
expiry: bigint;
|
|
79
|
+
availableCredit: bigint;
|
|
80
|
+
unlimited: boolean;
|
|
81
|
+
role: "owner" | "spender";
|
|
82
|
+
treeId: bigint;
|
|
83
|
+
leafIndex: number;
|
|
84
|
+
})[];
|
|
85
|
+
funding: {
|
|
86
|
+
payer: `0x${string}`;
|
|
87
|
+
amount: bigint;
|
|
88
|
+
authorization: "signature" | "none" | "caller";
|
|
89
|
+
sigNonce: bigint;
|
|
90
|
+
deadline: bigint;
|
|
91
|
+
permit: {
|
|
92
|
+
deadline: bigint;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
creditOutputs: {
|
|
96
|
+
lastDay: bigint;
|
|
97
|
+
dailySpent: bigint;
|
|
98
|
+
lastMonth: bigint;
|
|
99
|
+
monthlySpent: bigint;
|
|
100
|
+
totalSpent: bigint;
|
|
101
|
+
availableCredit: bigint;
|
|
102
|
+
unlimited: boolean;
|
|
103
|
+
singleLimit: bigint;
|
|
104
|
+
dailyLimit: bigint;
|
|
105
|
+
monthlyLimit: bigint;
|
|
106
|
+
commitment: `0x${string}`;
|
|
107
|
+
revocationShard: bigint;
|
|
108
|
+
revocationSlot: bigint;
|
|
109
|
+
expiry: bigint;
|
|
110
|
+
owner: `0x${string}`;
|
|
111
|
+
spender: `0x${string}`;
|
|
112
|
+
}[] | undefined;
|
|
113
|
+
creditUpdate: _invisi_labs_primitives.CreditUpdateChanges | undefined;
|
|
114
|
+
creditDraw: {
|
|
115
|
+
grossAmount: bigint;
|
|
116
|
+
feeAmount: bigint;
|
|
117
|
+
netAmount: bigint;
|
|
118
|
+
payers: {
|
|
119
|
+
payer: _invisi_labs_primitives.Address;
|
|
120
|
+
amount: bigint;
|
|
121
|
+
}[];
|
|
122
|
+
} | undefined;
|
|
123
|
+
creditFeePayer: `0x${string}` | undefined;
|
|
124
|
+
outputs: {
|
|
125
|
+
commitment: `0x${string}`;
|
|
126
|
+
to: string;
|
|
127
|
+
amount: bigint;
|
|
128
|
+
change: boolean;
|
|
129
|
+
}[];
|
|
130
|
+
capacity: number | undefined;
|
|
131
|
+
deadline: bigint;
|
|
132
|
+
feeRecipient: `0x${string}` | undefined;
|
|
133
|
+
feeAmount: bigint;
|
|
134
|
+
fundingAmount: bigint;
|
|
135
|
+
fundingPayer: `0x${string}` | undefined;
|
|
136
|
+
withdrawalAmount: bigint;
|
|
137
|
+
withdrawalAddress: `0x${string}` | undefined;
|
|
138
|
+
permissions: {
|
|
139
|
+
walletAuthorization: boolean;
|
|
140
|
+
proof: boolean;
|
|
141
|
+
fundingAuthorization: boolean;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
/** Obtain a firm quote before signing. This intent contains no private inputs or witness. */
|
|
145
|
+
exportBroadcasterIntent(): Promise<{
|
|
146
|
+
sendable: false;
|
|
147
|
+
data: Hex;
|
|
148
|
+
}>;
|
|
149
|
+
private current;
|
|
150
|
+
private stage;
|
|
151
|
+
exportRevocationAuthorization(): Promise<_invisi_labs_primitives.SigningRequest>;
|
|
152
|
+
withRevocationSignature(signature: Hex): Promise<PreparedTransaction>;
|
|
153
|
+
/** Export the same portable request used by managed native wallet transports. */
|
|
154
|
+
exportWalletRequest(id: string, options?: {
|
|
155
|
+
signal?: AbortSignal;
|
|
156
|
+
}): Promise<_invisi_labs_primitives.WalletRequest<"wallet.authorize">>;
|
|
157
|
+
/** Independently validate host authorization against the retained request and frozen plan. */
|
|
158
|
+
withWalletResponse(response: WalletResponse, options?: {
|
|
159
|
+
signal?: AbortSignal;
|
|
160
|
+
}): Promise<PreparedTransaction>;
|
|
161
|
+
/** Public EIP-712 request; signing transport and key custody belong to the caller. */
|
|
162
|
+
exportWalletAuthorization(options?: {
|
|
163
|
+
signal?: AbortSignal;
|
|
164
|
+
}): Promise<_invisi_labs_primitives.SigningRequest>;
|
|
165
|
+
/** Attach an external EOA signature, retaining its witness only at the private proving boundary. */
|
|
166
|
+
withWalletSignature(signature: string, options?: {
|
|
167
|
+
signal?: AbortSignal;
|
|
168
|
+
}): Promise<PreparedTransaction>;
|
|
169
|
+
/** Export only after proving when the funding authorization binds an actual proof hash. */
|
|
170
|
+
exportFundingAuthorization(options?: {
|
|
171
|
+
signal?: AbortSignal;
|
|
172
|
+
}): Promise<_invisi_labs_primitives.SigningRequest>;
|
|
173
|
+
/** Verify an external signature against this handle's own frozen operation. */
|
|
174
|
+
withFundingSignature(signature: string, options?: {
|
|
175
|
+
signal?: AbortSignal;
|
|
176
|
+
}): Promise<PreparedTransaction>;
|
|
177
|
+
prove(options?: TransactionProveOptions): Promise<PreparedTransaction>;
|
|
178
|
+
prove(backend: Prover, options?: TransactionProveOptions): Promise<PreparedTransaction>;
|
|
179
|
+
private encode;
|
|
180
|
+
/** Shield caller funding needs no wallet signing or proof; this step only encodes its frozen request. */
|
|
181
|
+
ready(): Promise<PreparedTransaction>;
|
|
182
|
+
exportTransaction(): Promise<TransactionCall>;
|
|
183
|
+
exportProof(): ProofBundle;
|
|
184
|
+
exportAggregateMember(): OperationAggregateMember;
|
|
185
|
+
toJSON(): {
|
|
186
|
+
transaction: boolean;
|
|
187
|
+
id: string;
|
|
188
|
+
kind: "create-credit" | "update-credit" | "transfer" | "shield" | "draw-credit" | "revoke-credit";
|
|
189
|
+
status: OperationStatus;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Compose independent Chain RPC and indexed Protocol RPC with local wallet capabilities. */
|
|
194
|
+
type InvisiOptions = Omit<TransactionInfrastructure, "wallet" | "protocol" | "coinSelector">;
|
|
195
|
+
/** Public wallet and registry-specific inputs; signing remains external. */
|
|
196
|
+
type RegistrationPreparationOptions = Pick<RegistrationPreparation, "update" | "deadline"> & Pick<TransactionIdentity, "wallet">;
|
|
197
|
+
/** Stateless transaction preparation and independent infrastructure composition. */
|
|
198
|
+
declare class Invisi {
|
|
199
|
+
#private;
|
|
200
|
+
constructor(options?: InvisiOptions);
|
|
201
|
+
/** A detached snapshot of shared infrastructure; wallet permissions and persistence stay external. */
|
|
202
|
+
getInfrastructure(): Readonly<InvisiOptions>;
|
|
203
|
+
private resolve;
|
|
204
|
+
/** Discover the selected chain's registry and prepare an independent signing request. */
|
|
205
|
+
prepareRegistration(options: RegistrationPreparationOptions): Promise<RegistrationOperation>;
|
|
206
|
+
private assertPublicIdentity;
|
|
207
|
+
private resolveExplicit;
|
|
208
|
+
prepareTransfer(options: ExplicitTransferPreparation): Promise<PreparedTransaction>;
|
|
209
|
+
prepareShield(options: ExplicitShieldPreparation): Promise<PreparedTransaction>;
|
|
210
|
+
prepareCreateCredit(options: ExplicitCreateCreditPreparation): Promise<PreparedTransaction>;
|
|
211
|
+
prepareDrawCredit(options: ExplicitDrawCreditPreparation): Promise<PreparedTransaction>;
|
|
212
|
+
prepareUpdateCredit(options: ExplicitUpdateCreditPreparation): Promise<PreparedTransaction>;
|
|
213
|
+
prepareRevokeCredit(options: ExplicitRevokeCreditPreparation): Promise<PreparedTransaction>;
|
|
214
|
+
toJSON(): {
|
|
215
|
+
invisi: boolean;
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** Stable codes returned by public SDK prepare* methods; inspect details instead of matching messages. */
|
|
220
|
+
type InvisiErrorCode =
|
|
221
|
+
/**
|
|
222
|
+
* Other preparation failure, such as invalid amounts, expired deadlines,
|
|
223
|
+
* or conflicting registration state. Inspect message and cause.
|
|
224
|
+
*/
|
|
225
|
+
"PREPARATION_FAILED"
|
|
226
|
+
/**
|
|
227
|
+
* Required infrastructure or permissions were not supplied.
|
|
228
|
+
* The capability field identifies what is missing.
|
|
229
|
+
*/
|
|
230
|
+
| "MISSING_CAPABILITY"
|
|
231
|
+
/**
|
|
232
|
+
* The recipient string is not a valid full 0i address or nonzero EVM owner address.
|
|
233
|
+
* No registration lookup is attempted for this invalid string.
|
|
234
|
+
*/
|
|
235
|
+
| "INVALID_RECIPIENT"
|
|
236
|
+
/**
|
|
237
|
+
* A successful lookup found no receiving keys for this short 0x owner
|
|
238
|
+
* at the queried state. Indexed data may lag behind the latest chain state.
|
|
239
|
+
* Full 0i addresses contain receiving keys and do not require registration.
|
|
240
|
+
*/
|
|
241
|
+
| "EVM_ADDRESS_NOT_REGISTERED"
|
|
242
|
+
/**
|
|
243
|
+
* Recipient lookup failed or returned invalid keys. Inspect cause.
|
|
244
|
+
* Registration status is unknown; this does not mean the owner is unregistered.
|
|
245
|
+
*/
|
|
246
|
+
| "RECIPIENT_LOOKUP_FAILED";
|
|
247
|
+
interface InvisiErrorDetails {
|
|
248
|
+
operation?: string;
|
|
249
|
+
address?: string;
|
|
250
|
+
/** Zero-based index into the caller's outputs array, excluding automatic change. */
|
|
251
|
+
outputIndex?: number;
|
|
252
|
+
field?: string;
|
|
253
|
+
capability?: string;
|
|
254
|
+
cause?: unknown;
|
|
255
|
+
}
|
|
256
|
+
/** Stable application-facing preparation failure with the original cause. */
|
|
257
|
+
declare class InvisiError extends Error {
|
|
258
|
+
readonly code: InvisiErrorCode;
|
|
259
|
+
readonly operation: string | undefined;
|
|
260
|
+
readonly address: string | undefined;
|
|
261
|
+
readonly outputIndex: number | undefined;
|
|
262
|
+
readonly field: string | undefined;
|
|
263
|
+
readonly capability: string | undefined;
|
|
264
|
+
constructor(code: InvisiErrorCode, message: string, details?: InvisiErrorDetails);
|
|
265
|
+
}
|
|
266
|
+
/** Keep nested failures intact; do not infer business codes from English messages. */
|
|
267
|
+
declare function prepareWithErrors<T>(operation: string, prepare: () => Promise<T>): Promise<T>;
|
|
268
|
+
|
|
269
|
+
interface DiscoveryContext {
|
|
270
|
+
chainId: bigint;
|
|
271
|
+
protocolAddress: Address;
|
|
272
|
+
}
|
|
273
|
+
/** Decoded logs from complete canonical transaction receipts, including insertion logs. */
|
|
274
|
+
interface DeliveryEventLog {
|
|
275
|
+
address: string;
|
|
276
|
+
eventName: string;
|
|
277
|
+
args?: Record<string, unknown>;
|
|
278
|
+
blockNumber?: bigint | null;
|
|
279
|
+
blockHash?: Hex | null;
|
|
280
|
+
transactionHash?: Hex | null;
|
|
281
|
+
logIndex?: number | null;
|
|
282
|
+
removed?: boolean;
|
|
283
|
+
}
|
|
284
|
+
interface DeliveryCandidate {
|
|
285
|
+
tokenAddress: Address;
|
|
286
|
+
treeId: bigint;
|
|
287
|
+
leafIndex: number;
|
|
288
|
+
commitment: Hex;
|
|
289
|
+
role: "funds" | "owner" | "spender";
|
|
290
|
+
delivery: {
|
|
291
|
+
ciphertext: Hex;
|
|
292
|
+
clue: Hex;
|
|
293
|
+
};
|
|
294
|
+
blockNumber: bigint;
|
|
295
|
+
blockHash: Hex;
|
|
296
|
+
transactionHash: Hex;
|
|
297
|
+
}
|
|
298
|
+
/** Correlate deliveries with canonical insertion events, never service-supplied balances or positions.
|
|
299
|
+
* The caller selects a confirmed chain/deployment and supplies complete decoded receipts.
|
|
300
|
+
*/
|
|
301
|
+
declare function extractDeliveryCandidates(logs: readonly DeliveryEventLog[], context: DiscoveryContext, confirmedThrough: bigint): DeliveryCandidate[];
|
|
302
|
+
interface DiscoveredNote extends Omit<DeliveryCandidate, "delivery" | "role"> {
|
|
303
|
+
note: Note;
|
|
304
|
+
}
|
|
305
|
+
interface DiscoveredCredit extends Omit<DeliveryCandidate, "delivery"> {
|
|
306
|
+
role: "owner" | "spender";
|
|
307
|
+
state: CreditDeliveryState;
|
|
308
|
+
}
|
|
309
|
+
/** Authenticate private deliveries from a single batch of canonical receipts. */
|
|
310
|
+
declare function decryptCandidates(logs: readonly DeliveryEventLog[], options: {
|
|
311
|
+
context: DiscoveryContext;
|
|
312
|
+
viewing: ReturnType<typeof authenticatedDecryptor>;
|
|
313
|
+
confirmedThrough: bigint;
|
|
314
|
+
}): Promise<{
|
|
315
|
+
notes: DiscoveredNote[];
|
|
316
|
+
credits: DiscoveredCredit[];
|
|
317
|
+
}>;
|
|
318
|
+
|
|
319
|
+
/** Decode independently fetched canonical receipt bytes, never normalized service events. */
|
|
320
|
+
declare function readProtocolLogs(receipt: CanonicalReceipt, protocolAddress: Address): DeliveryEventLog[];
|
|
321
|
+
|
|
322
|
+
export { type DeliveryEventLog as D, Invisi as I, PreparedTransaction as P, type RegistrationPreparationOptions as R, type DiscoveredCredit as a, type DiscoveredNote as b, InvisiError as c, type InvisiErrorCode as d, type InvisiErrorDetails as e, type InvisiOptions as f, decryptCandidates as g, type DeliveryCandidate as h, type DiscoveryContext as i, extractDeliveryCandidates as j, prepareWithErrors as p, readProtocolLogs as r };
|