@invisi-labs/sdk 1.1.6 → 1.1.7
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/{NoteOutput-DRkVnwlx.d.cts → broadcaster-preparation-DMxxZ_1Q.d.cts} +309 -120
- package/dist/{NoteOutput-DpDC6T2O.d.ts → broadcaster-preparation-DMxxZ_1Q.d.ts} +309 -120
- package/dist/broadcaster-preparation-RMWQFYNL.js +11 -0
- package/dist/broadcaster-preparation-UGOTO4SX.cjs +11 -0
- package/dist/broadcaster-preparation-UGOTO4SX.cjs.map +1 -0
- package/dist/chunk-7F7ZZW3L.cjs +374 -0
- package/dist/chunk-7F7ZZW3L.cjs.map +1 -0
- package/dist/{chunk-4SD3MW6N.js → chunk-EHP5TBC6.js} +1347 -2493
- package/dist/chunk-EHP5TBC6.js.map +1 -0
- package/dist/{broadcaster-preparation-QVL62KM6.js → chunk-GTPUYPQL.js} +6 -6
- package/dist/chunk-GTPUYPQL.js.map +1 -0
- package/dist/{chunk-FL4TIGWW.js → chunk-ITTGBIG2.js} +617 -521
- package/dist/chunk-ITTGBIG2.js.map +1 -0
- package/dist/chunk-J2JH6HIG.cjs +1877 -0
- package/dist/chunk-J2JH6HIG.cjs.map +1 -0
- package/dist/chunk-LOU7AP2B.cjs +128 -0
- package/dist/chunk-LOU7AP2B.cjs.map +1 -0
- package/dist/chunk-RHNIHI4P.cjs +3565 -0
- package/dist/chunk-RHNIHI4P.cjs.map +1 -0
- package/dist/{chunk-QC6TQR3R.js → chunk-XHKQ2BO2.js} +12 -12
- package/dist/chunk-XHKQ2BO2.js.map +1 -0
- package/dist/ethers.cjs +11 -385
- package/dist/ethers.cjs.map +1 -1
- package/dist/ethers.d.cts +3 -4
- package/dist/ethers.d.ts +3 -4
- package/dist/ethers.js +1 -1
- package/dist/index.cjs +451 -7845
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -702
- package/dist/index.d.ts +72 -702
- package/dist/index.js +374 -862
- package/dist/index.js.map +1 -1
- package/dist/receipt-logs-CvC951p7.d.cts +318 -0
- package/dist/receipt-logs-m0-bhaxW.d.ts +318 -0
- package/dist/session-support.cjs +168 -0
- package/dist/session-support.cjs.map +1 -0
- package/dist/session-support.d.cts +252 -0
- package/dist/session-support.d.ts +252 -0
- package/dist/session-support.js +168 -0
- package/dist/session-support.js.map +1 -0
- package/package.json +10 -20
- package/dist/broadcaster-preparation-QVL62KM6.js.map +0 -1
- package/dist/chunk-4SD3MW6N.js.map +0 -1
- 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-preparation-RMWQFYNL.js.map} +0 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
var _chunkRHNIHI4Pcjs = require('./chunk-RHNIHI4P.cjs');
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
var _chunkLOU7AP2Bcjs = require('./chunk-LOU7AP2B.cjs');
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
var _chunkJ2JH6HIGcjs = require('./chunk-J2JH6HIG.cjs');
|
|
59
|
+
require('./chunk-7F7ZZW3L.cjs');
|
|
60
|
+
|
|
61
|
+
// src/transactions/proving/aggregate-receipt.ts
|
|
62
|
+
var _ethers = require('ethers');
|
|
63
|
+
var _protocol = require('@invisi-labs/protocol');
|
|
64
|
+
var _contracts = require('@invisi-labs/protocol/contracts');
|
|
65
|
+
var aggregateAbi = _contracts.invisiProtocolAbi.filter(
|
|
66
|
+
(item) => item.type === "function" && item.name === "transact" && item.inputs.length === 2 && _optionalChain([item, 'access', _ => _.inputs, 'access', _2 => _2[1], 'optionalAccess', _3 => _3.type]) === "tuple[]"
|
|
67
|
+
);
|
|
68
|
+
function matchesAggregateTransaction(saved, transaction) {
|
|
69
|
+
const plan = saved.plan;
|
|
70
|
+
if (_optionalChain([plan, 'access', _4 => _4.statement, 'optionalAccess', _5 => _5.target]) !== "noir-recursive" || !plan.params || !saved.externalized || transaction.to.toLowerCase() !== plan.context.protocolAddress.toLowerCase() || transaction.value !== 0n)
|
|
71
|
+
return false;
|
|
72
|
+
try {
|
|
73
|
+
const decoded = new (0, _ethers.Interface)(aggregateAbi).parseTransaction({ data: transaction.data }), requests = decoded.args[1].map((request) => {
|
|
74
|
+
const member = request.toObject(true);
|
|
75
|
+
member.params.sources = request.params.sources.map(
|
|
76
|
+
(source) => source.toObject(true)
|
|
77
|
+
);
|
|
78
|
+
member.params.nullifiers = request.params.nullifiers.toArray(true);
|
|
79
|
+
member.params.outputCommitments = request.params.outputCommitments.toArray(true);
|
|
80
|
+
member.deliveries = request.deliveries.map(
|
|
81
|
+
(delivery) => delivery.toObject(true)
|
|
82
|
+
);
|
|
83
|
+
member.funding.permit.v = Number(member.funding.permit.v);
|
|
84
|
+
return {
|
|
85
|
+
params: member.params,
|
|
86
|
+
deliveries: member.deliveries,
|
|
87
|
+
funding: member.funding
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
if (decoded.name !== "transact" || !Array.isArray(requests) || ![4, 8, 12].includes(requests.length))
|
|
91
|
+
return false;
|
|
92
|
+
const canonical = (request) => _protocol.buildTransactCalldata.call(void 0, {
|
|
93
|
+
context: { ...plan.context, tokenAddress: request.params.token },
|
|
94
|
+
proof: "0x00",
|
|
95
|
+
params: request.params,
|
|
96
|
+
deliveries: request.deliveries,
|
|
97
|
+
funding: request.funding,
|
|
98
|
+
caller: transaction.from
|
|
99
|
+
}).data.toLowerCase();
|
|
100
|
+
const expected = _protocol.buildTransactCalldata.call(void 0, {
|
|
101
|
+
context: plan.context,
|
|
102
|
+
proof: "0x00",
|
|
103
|
+
params: plan.params,
|
|
104
|
+
deliveries: plan.outputs.map((output) => output.delivery),
|
|
105
|
+
funding: plan.funding,
|
|
106
|
+
caller: transaction.from
|
|
107
|
+
}).data.toLowerCase();
|
|
108
|
+
return requests.filter((request) => canonical(request) === expected).length === 1;
|
|
109
|
+
} catch (e) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
exports.BroadcasterClient = _chunkRHNIHI4Pcjs.BroadcasterClient; exports.BroadcasterRpcError = _chunkRHNIHI4Pcjs.BroadcasterRpcError; exports.Invisi = _chunkRHNIHI4Pcjs.Invisi; exports.InvisiError = _chunkJ2JH6HIGcjs.InvisiError; exports.NoteOutput = _chunkJ2JH6HIGcjs.NoteOutput; exports.TransactionOutput = _chunkRHNIHI4Pcjs.TransactionOutput; exports.TransactionPreparation = _chunkJ2JH6HIGcjs.TransactionPreparation; exports.acceptFundingSignature = _chunkRHNIHI4Pcjs.acceptFundingSignature; exports.acceptWalletSignature = _chunkRHNIHI4Pcjs.acceptWalletSignature; exports.authorizationRequest = _chunkJ2JH6HIGcjs.authorizationRequest; exports.authorizeOperation = _chunkRHNIHI4Pcjs.authorizeOperation; exports.broadcasterQuoteDomain = _chunkRHNIHI4Pcjs.broadcasterQuoteDomain; exports.broadcasterQuoteTypes = _chunkRHNIHI4Pcjs.broadcasterQuoteTypes; exports.broadcasterRequestHash = _chunkRHNIHI4Pcjs.broadcasterRequestHash; exports.broadcasterTransactInterface = _chunkRHNIHI4Pcjs.broadcasterTransactInterface; exports.configureRecipientInfrastructure = _chunkJ2JH6HIGcjs.configureRecipientInfrastructure; exports.configureTransactionInfrastructure = _chunkRHNIHI4Pcjs.configureTransactionInfrastructure; exports.copyGasBenchmarks = _chunkRHNIHI4Pcjs.copyGasBenchmarks; exports.creditLeaf = _chunkJ2JH6HIGcjs.creditLeaf; exports.creditReservationKey = _chunkRHNIHI4Pcjs.creditReservationKey; exports.decodeBroadcasterIntent = _chunkRHNIHI4Pcjs.decodeBroadcasterIntent; exports.decodeProtocolEvent = _chunkRHNIHI4Pcjs.decodeProtocolEvent; exports.decryptCandidates = _chunkRHNIHI4Pcjs.decryptCandidates; exports.defineGasBenchmarks = _chunkRHNIHI4Pcjs.defineGasBenchmarks; exports.encodeOperation = _chunkRHNIHI4Pcjs.encodeOperation; exports.estimateBenchmarkGas = _chunkRHNIHI4Pcjs.estimateBenchmarkGas; exports.estimateGasReference = _chunkRHNIHI4Pcjs.estimateGasReference; exports.estimateShapeGas = _chunkRHNIHI4Pcjs.estimateShapeGas; exports.exportBroadcasterIntent = _chunkJ2JH6HIGcjs.exportBroadcasterIntent; exports.extractDeliveryCandidates = _chunkRHNIHI4Pcjs.extractDeliveryCandidates; exports.fundingSigningRequest = _chunkRHNIHI4Pcjs.fundingSigningRequest; exports.fundingTypedData = _chunkRHNIHI4Pcjs.fundingTypedData; exports.inputFacts = _chunkRHNIHI4Pcjs.inputFacts; exports.matchesAggregateTransaction = matchesAggregateTransaction; exports.operationExpired = _chunkJ2JH6HIGcjs.operationExpired; exports.operationPreview = _chunkRHNIHI4Pcjs.operationPreview; exports.operationSources = _chunkRHNIHI4Pcjs.operationSources; exports.prepareBroadcasterPlan = _chunkLOU7AP2Bcjs.prepareBroadcasterPlan; exports.prepareIntent = _chunkLOU7AP2Bcjs.prepareIntent; exports.prepareWithErrors = _chunkJ2JH6HIGcjs.prepareWithErrors; exports.proveOperation = _chunkRHNIHI4Pcjs.proveOperation; exports.publicProof = _chunkRHNIHI4Pcjs.publicProof; exports.readProtocolLogs = _chunkRHNIHI4Pcjs.readProtocolLogs; exports.recipientLookup = _chunkJ2JH6HIGcjs.recipientLookup; exports.requiresAuthorization = _chunkJ2JH6HIGcjs.requiresAuthorization; exports.sameStatement = _chunkRHNIHI4Pcjs.sameStatement; exports.signOperationFunding = _chunkRHNIHI4Pcjs.signOperationFunding; exports.statement = _chunkJ2JH6HIGcjs.statement; exports.validateTransactionInfrastructure = _chunkRHNIHI4Pcjs.validateTransactionInfrastructure; exports.verifyBroadcasterQuote = _chunkRHNIHI4Pcjs.verifyBroadcasterQuote; exports.verifyMembership = _chunkJ2JH6HIGcjs.verifyMembership; exports.walletSigningRequest = _chunkRHNIHI4Pcjs.walletSigningRequest; exports.witnessFor = _chunkRHNIHI4Pcjs.witnessFor;
|
|
168
|
+
//# sourceMappingURL=session-support.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/invisi-sdk-ts/invisi-sdk-ts/packages/sdk/dist/session-support.cjs","../src/transactions/proving/aggregate-receipt.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AAAA,MACP,MAAA,EAAQ,OAAA,CAAQ,MAAA;AAAA,MAChB,UAAA,EAAY,OAAA,CAAQ,UAAA;AAAA,MACpB,OAAA,EAAS,OAAA,CAAQ,OAAA;AAAA,MACjB,MAAA,EAAQ,WAAA,CAAY;AAAA,IACxB,CAAC,CAAA,CAAE,IAAA,CAAK,WAAA,CAAY,CAAA;AACxB,IAAA,MAAM,SAAA,EAAW,6CAAA;AAAsB,MACnC,OAAA,EAAS,IAAA,CAAK,OAAA;AAAA,MACd,KAAA,EAAO,MAAA;AAAA,MACP,MAAA,EAAQ,IAAA,CAAK,MAAA;AAAA,MACb,UAAA,EAAY,IAAA,CAAK,OAAA,CAAQ,GAAA,CAAI,CAAC,MAAA,EAAA,GAAW,MAAA,CAAO,QAAQ,CAAA;AAAA,MACxD,OAAA,EAAS,IAAA,CAAK,OAAA;AAAA,MACd,MAAA,EAAQ,WAAA,CAAY;AAAA,IACxB,CAAC,CAAA,CAAE,IAAA,CAAK,WAAA,CAAY,CAAA;AACpB,IAAA,OAAO,QAAA,CAAS,MAAA,CAAO,CAAC,OAAA,EAAA,GAAY,SAAA,CAAU,OAAO,EAAA,IAAM,QAAQ,CAAA,CAAE,OAAA,IAAW,CAAA;AAAA,EACpF,EAAA,UAAQ;AACJ,IAAA,OAAO,KAAA;AAAA,EACX;AACJ;ADuCA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,ggHAAC","file":"/home/runner/work/invisi-sdk-ts/invisi-sdk-ts/packages/sdk/dist/session-support.cjs","sourcesContent":[null,"import type { Address } from \"@invisi-labs/protocol/contracts\";\nimport { Interface, type Result } from \"ethers\";\n\nimport { buildTransactCalldata, type TransactionCall } from \"@invisi-labs/protocol\";\nimport { invisiProtocolAbi, type TransactRequest } from \"@invisi-labs/protocol/contracts\";\nimport type { SavedOperation } from \"../operation-types\";\nconst aggregateAbi = invisiProtocolAbi.filter(\n (item) =>\n item.type === \"function\" &&\n item.name === \"transact\" &&\n item.inputs.length === 2 &&\n item.inputs[1]?.type === \"tuple[]\"\n);\n/** Match the whole frozen member, including funding nonce, signature and permit, in one successful aggregate. */\nexport function matchesAggregateTransaction(\n saved: SavedOperation,\n transaction: TransactionCall & { from: Address }\n): boolean {\n const plan = saved.plan;\n if (\n plan.statement?.target !== \"noir-recursive\" ||\n !plan.params ||\n !saved.externalized ||\n transaction.to.toLowerCase() !== plan.context.protocolAddress.toLowerCase() ||\n transaction.value !== 0n\n )\n return false;\n try {\n const decoded = new Interface(aggregateAbi).parseTransaction({ data: transaction.data })!,\n requests = (decoded.args[1] as Result[]).map((request) => {\n const member = request.toObject(true);\n member.params.sources = request.params.sources.map((source: Result) =>\n source.toObject(true)\n );\n member.params.nullifiers = request.params.nullifiers.toArray(true);\n member.params.outputCommitments = request.params.outputCommitments.toArray(true);\n member.deliveries = request.deliveries.map((delivery: Result) =>\n delivery.toObject(true)\n );\n member.funding.permit.v = Number(member.funding.permit.v);\n return {\n params: member.params,\n deliveries: member.deliveries,\n funding: member.funding,\n };\n }) as readonly TransactRequest[];\n if (\n decoded.name !== \"transact\" ||\n !Array.isArray(requests) ||\n ![4, 8, 12].includes(requests.length)\n )\n return false;\n const canonical = (request: TransactRequest) =>\n buildTransactCalldata({\n context: { ...plan.context, tokenAddress: request.params.token },\n proof: \"0x00\",\n params: request.params,\n deliveries: request.deliveries,\n funding: request.funding,\n caller: transaction.from,\n }).data.toLowerCase();\n const expected = buildTransactCalldata({\n context: plan.context,\n proof: \"0x00\",\n params: plan.params,\n deliveries: plan.outputs.map((output) => output.delivery),\n funding: plan.funding,\n caller: transaction.from,\n }).data.toLowerCase();\n return requests.filter((request) => canonical(request) === expected).length === 1;\n } catch {\n return false;\n }\n}\n"]}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { I as GasEstimateRequest, m as GasBenchmarkProfile, p as GasReference, J as OperationPlan, K as BenchmarkGasEstimate, L as SavedOperation, M as TransactionRuntime, v as TransactionProveOptions, i as FundingSigner, F as FundingAuthorizationVerifier, Q as OperationStatus, R as PreparationRuntime, w as TransferPreparation, S as ShieldPreparation, h as CreateCreditPreparation, D as DrawCreditPreparation, T as TopUpCreditPreparation, C as CancelCreditPreparation, U as TransactionInfrastructure } from './broadcaster-preparation-DMxxZ_1Q.cjs';
|
|
2
|
+
export { V as AddressLookup, B as BroadcasterClient, a as BroadcasterConfiguration, b as BroadcasterFeeSource, c as BroadcasterQuote, d as BroadcasterRpcError, e as BroadcasterStatus, f as BroadcasterTransport, g as BroadcasterTrust, X as Checkpoint, Y as CoinSelector, Z as CreditPlan, _ as CreditRecord, j as FundingSource, k as FundingTypedData, G as GasBenchmarkCircuit, l as GasBenchmarkDeployment, n as GasBenchmarkSample, o as GasBenchmarkShape, $ as LocalOperationSecrets, N as NoteOutput, a0 as NoteRecord, O as OperationAggregateMember, a1 as PreparationIntent, a2 as PreparationInventory, a3 as PreparedCreditInput, a4 as PreparedCreditOutput, a5 as PreparedOutput, a6 as ReceiptPosition, t as SignedBroadcasterQuote, a7 as SpentState, u as TransactionExecution, a8 as WalletScope, W as WithBroadcasterOptions, x as broadcasterQuoteDomain, y as broadcasterQuoteTypes, z as broadcasterRequestHash, A as broadcasterTransactInterface, a9 as configureRecipientInfrastructure, aa as creditReservationKey, E as decodeBroadcasterIntent, ab as prepareBroadcasterPlan, ac as prepareIntent, ad as recipientLookup, H as verifyBroadcasterQuote } from './broadcaster-preparation-DMxxZ_1Q.cjs';
|
|
3
|
+
import { Hex as Hex$1, InputSource, Address as Address$1 } from '@invisi-labs/protocol/contracts';
|
|
4
|
+
export { o as DeliveryCandidate, D as DeliveryEventLog, a as DiscoveredCredit, b as DiscoveredNote, p as DiscoveryContext, I as Invisi, h as InvisiError, i as InvisiErrorCode, j as InvisiErrorDetails, l as TransactionOutput, q as copyGasBenchmarks, m as decryptCandidates, n as defineGasBenchmarks, s as extractDeliveryCandidates, t as prepareWithErrors, r as readProtocolLogs } from './receipt-logs-CvC951p7.cjs';
|
|
5
|
+
import { TokenProtocol, ChainReader, TransactionContext, CanonicalBlock, Membership, TransactionCall } from '@invisi-labs/protocol';
|
|
6
|
+
import * as _invisi_labs_core from '@invisi-labs/core';
|
|
7
|
+
import { AuthorizedStatement, WalletAuthorizationProvider, CreditDeliveryState } from '@invisi-labs/core';
|
|
8
|
+
import * as _invisi_labs_prover from '@invisi-labs/prover';
|
|
9
|
+
import { Prover, ProofBundle, ProofStatement, ProvingRequest } from '@invisi-labs/prover';
|
|
10
|
+
import 'ethers';
|
|
11
|
+
|
|
12
|
+
/** Internal workload envelope for combinations without an exact receipt measurement. */
|
|
13
|
+
declare function estimateShapeGas(request: GasEstimateRequest, profiles?: readonly GasBenchmarkProfile[]): GasReference;
|
|
14
|
+
|
|
15
|
+
/** Pure reference lookup. No proof, RPC, current fee price, extrapolation or transaction gas limit. */
|
|
16
|
+
declare function estimateBenchmarkGas(plan: OperationPlan, protocol: TokenProtocol, profiles?: readonly GasBenchmarkProfile[]): BenchmarkGasEstimate;
|
|
17
|
+
declare function estimateGasReference(plan: OperationPlan, protocol: TokenProtocol, profiles?: readonly GasBenchmarkProfile[]): GasReference;
|
|
18
|
+
|
|
19
|
+
/** Public frozen request for quote signing. Empty proof/signature make this deliberately non-sendable. */
|
|
20
|
+
declare function exportBroadcasterIntent(plan: OperationPlan): {
|
|
21
|
+
sendable: false;
|
|
22
|
+
data: Hex$1;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
declare function verifyMembership(reader: ChainReader, context: TransactionContext, block: CanonicalBlock, input: {
|
|
26
|
+
treeId: bigint;
|
|
27
|
+
leafIndex: number;
|
|
28
|
+
commitment: Hex$1;
|
|
29
|
+
}, proof: Membership): Promise<void>;
|
|
30
|
+
|
|
31
|
+
/** Decode only canonical protocol receipt bytes before routing events to token wallets. */
|
|
32
|
+
declare function decodeProtocolEvent(log: {
|
|
33
|
+
data: string;
|
|
34
|
+
topics: readonly string[];
|
|
35
|
+
}): {
|
|
36
|
+
eventName: string;
|
|
37
|
+
args: Record<string, any>;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
declare function encodeOperation(saved: SavedOperation): Promise<TransactionCall>;
|
|
41
|
+
|
|
42
|
+
/** Both managed and detached handles authorize the same frozen statement. */
|
|
43
|
+
declare function authorizeOperation(plan: OperationPlan, provider: WalletAuthorizationProvider): Promise<AuthorizedStatement>;
|
|
44
|
+
declare function proveOperation(protocol: TokenProtocol, plan: OperationPlan, authorization: AuthorizedStatement | undefined, prover: Prover, options: TransactionProveOptions): Promise<_invisi_labs_prover.ProofBundle>;
|
|
45
|
+
declare function signOperationFunding(saved: SavedOperation, signer: FundingSigner, verifier?: FundingAuthorizationVerifier): Promise<`0x${string}`>;
|
|
46
|
+
/** Export only typed commitments, never private note openings or authorization witnesses. */
|
|
47
|
+
declare function walletSigningRequest(plan: OperationPlan): _invisi_labs_core.SigningRequest;
|
|
48
|
+
/** Recover the EOA key and build the existing private witness without receiving a private key. */
|
|
49
|
+
declare function acceptWalletSignature(plan: OperationPlan, signature: string): Promise<AuthorizedStatement>;
|
|
50
|
+
/** The remote round trip may outlive the nonce or deadline selected during preparation. */
|
|
51
|
+
declare function fundingSigningRequest(saved: SavedOperation, runtime: Pick<TransactionRuntime, "reader" | "options">): Promise<_invisi_labs_core.SigningRequest>;
|
|
52
|
+
/** Verify against reconstructed operation data, never caller-supplied typed data. */
|
|
53
|
+
declare function acceptFundingSignature(saved: SavedOperation, signature: string, runtime: Pick<TransactionRuntime, "reader" | "options">): Promise<`0x${string}`>;
|
|
54
|
+
|
|
55
|
+
type Hex = `0x${string}`;
|
|
56
|
+
type Address = `0x${string}`;
|
|
57
|
+
|
|
58
|
+
declare function operationPreview(plan: OperationPlan, status: OperationStatus): {
|
|
59
|
+
id: string;
|
|
60
|
+
kind: "shield" | "transfer" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
|
|
61
|
+
status: OperationStatus;
|
|
62
|
+
context: {
|
|
63
|
+
tokenAddress: Address;
|
|
64
|
+
now?: bigint;
|
|
65
|
+
timestamp?: bigint;
|
|
66
|
+
chainId: bigint;
|
|
67
|
+
protocolAddress: Address;
|
|
68
|
+
};
|
|
69
|
+
inputs: number;
|
|
70
|
+
inputDetails: ({
|
|
71
|
+
kind: "notes";
|
|
72
|
+
commitment: `0x${string}`;
|
|
73
|
+
amount: bigint;
|
|
74
|
+
owner: `0x${string}`;
|
|
75
|
+
treeId: bigint;
|
|
76
|
+
leafIndex: number;
|
|
77
|
+
} | {
|
|
78
|
+
kind: "credits";
|
|
79
|
+
commitment: `0x${string}`;
|
|
80
|
+
amount: bigint;
|
|
81
|
+
owner: `0x${string}`;
|
|
82
|
+
spender: `0x${string}`;
|
|
83
|
+
expiry: bigint;
|
|
84
|
+
role: "owner" | "spender";
|
|
85
|
+
treeId: bigint;
|
|
86
|
+
leafIndex: number;
|
|
87
|
+
})[];
|
|
88
|
+
funding: {
|
|
89
|
+
payer: `0x${string}`;
|
|
90
|
+
amount: bigint;
|
|
91
|
+
authorization: "signature" | "none" | "caller";
|
|
92
|
+
sigNonce: bigint;
|
|
93
|
+
deadline: bigint;
|
|
94
|
+
permit: {
|
|
95
|
+
deadline: bigint;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
creditOutputs: {
|
|
99
|
+
commitment: `0x${string}`;
|
|
100
|
+
amount: bigint;
|
|
101
|
+
expiry: bigint;
|
|
102
|
+
owner: `0x${string}`;
|
|
103
|
+
spender: `0x${string}`;
|
|
104
|
+
ownerPayout: bigint;
|
|
105
|
+
spenderPayout: bigint;
|
|
106
|
+
}[] | undefined;
|
|
107
|
+
outputs: {
|
|
108
|
+
commitment: `0x${string}`;
|
|
109
|
+
to: string;
|
|
110
|
+
amount: bigint;
|
|
111
|
+
change: boolean;
|
|
112
|
+
}[];
|
|
113
|
+
capacity: number | undefined;
|
|
114
|
+
deadline: bigint;
|
|
115
|
+
feeRecipient: `0x${string}` | undefined;
|
|
116
|
+
feeAmount: bigint;
|
|
117
|
+
fundingAmount: bigint;
|
|
118
|
+
fundingPayer: `0x${string}` | undefined;
|
|
119
|
+
withdrawalAmount: bigint;
|
|
120
|
+
withdrawalAddress: `0x${string}` | undefined;
|
|
121
|
+
permissions: {
|
|
122
|
+
walletAuthorization: boolean;
|
|
123
|
+
proof: boolean;
|
|
124
|
+
fundingAuthorization: boolean;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
declare function creditLeaf(state: CreditDeliveryState): Promise<Hex$1>;
|
|
129
|
+
|
|
130
|
+
declare function inputFacts(plan: OperationPlan): Array<{
|
|
131
|
+
key: string;
|
|
132
|
+
reservationKey: string;
|
|
133
|
+
nullifier: Hex$1;
|
|
134
|
+
kind: "notes" | "credits";
|
|
135
|
+
}>;
|
|
136
|
+
declare function operationSources(plan: OperationPlan): readonly InputSource[];
|
|
137
|
+
|
|
138
|
+
/** Shared preparation engine for managed sessions and explicitly supplied inputs. */
|
|
139
|
+
declare class TransactionPreparation<Result> {
|
|
140
|
+
#private;
|
|
141
|
+
readonly context: PreparationRuntime<Result>;
|
|
142
|
+
constructor(context: PreparationRuntime<Result>);
|
|
143
|
+
private runtime;
|
|
144
|
+
private get scope();
|
|
145
|
+
prepareTransfer(options: TransferPreparation): Promise<Result>;
|
|
146
|
+
private funds;
|
|
147
|
+
prepareShield(options: ShieldPreparation): Promise<Result>;
|
|
148
|
+
prepareCreateCredit(options: CreateCreditPreparation): Promise<Result>;
|
|
149
|
+
prepareDrawCredit(options: DrawCreditPreparation): Promise<Result>;
|
|
150
|
+
prepareTopUpCredit(options: TopUpCreditPreparation): Promise<Result>;
|
|
151
|
+
prepareCancelCredit(options: CancelCreditPreparation): Promise<Result>;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** Match the whole frozen member, including funding nonce, signature and permit, in one successful aggregate. */
|
|
155
|
+
declare function matchesAggregateTransaction(saved: SavedOperation, transaction: TransactionCall & {
|
|
156
|
+
from: Address$1;
|
|
157
|
+
}): boolean;
|
|
158
|
+
|
|
159
|
+
/** Whitelist the public proof fields; a custom local backend cannot accidentally export its witness. */
|
|
160
|
+
declare function publicProof(bundle: ProofBundle): ProofBundle;
|
|
161
|
+
|
|
162
|
+
declare function sameStatement(proof: ProofBundle, expected: ProofStatement): void;
|
|
163
|
+
|
|
164
|
+
declare function witnessFor(protocol: TokenProtocol, plan: OperationPlan, authorization?: AuthorizedStatement): Promise<ProvingRequest>;
|
|
165
|
+
|
|
166
|
+
declare function fundingTypedData(saved: SavedOperation): Promise<{
|
|
167
|
+
domain: {
|
|
168
|
+
name: string;
|
|
169
|
+
version: string;
|
|
170
|
+
chainId: bigint;
|
|
171
|
+
verifyingContract: Hex;
|
|
172
|
+
};
|
|
173
|
+
primaryType: "FundTransact";
|
|
174
|
+
types: {
|
|
175
|
+
FundTransact: readonly [{
|
|
176
|
+
readonly name: "requestHash";
|
|
177
|
+
readonly type: "bytes32";
|
|
178
|
+
}, {
|
|
179
|
+
readonly name: "payer";
|
|
180
|
+
readonly type: "address";
|
|
181
|
+
}, {
|
|
182
|
+
readonly name: "amount";
|
|
183
|
+
readonly type: "uint256";
|
|
184
|
+
}, {
|
|
185
|
+
readonly name: "sigNonce";
|
|
186
|
+
readonly type: "uint256";
|
|
187
|
+
}, {
|
|
188
|
+
readonly name: "deadline";
|
|
189
|
+
readonly type: "uint256";
|
|
190
|
+
}];
|
|
191
|
+
};
|
|
192
|
+
message: {
|
|
193
|
+
requestHash: `0x${string}`;
|
|
194
|
+
payer: `0x${string}`;
|
|
195
|
+
amount: bigint;
|
|
196
|
+
sigNonce: bigint;
|
|
197
|
+
deadline: bigint;
|
|
198
|
+
};
|
|
199
|
+
} | {
|
|
200
|
+
domain: {
|
|
201
|
+
name: string;
|
|
202
|
+
version: string;
|
|
203
|
+
chainId: bigint;
|
|
204
|
+
verifyingContract: Hex;
|
|
205
|
+
};
|
|
206
|
+
primaryType: "FundShield";
|
|
207
|
+
types: {
|
|
208
|
+
FundShield: readonly [{
|
|
209
|
+
readonly name: "requestHash";
|
|
210
|
+
readonly type: "bytes32";
|
|
211
|
+
}, {
|
|
212
|
+
readonly name: "payer";
|
|
213
|
+
readonly type: "address";
|
|
214
|
+
}, {
|
|
215
|
+
readonly name: "amount";
|
|
216
|
+
readonly type: "uint256";
|
|
217
|
+
}, {
|
|
218
|
+
readonly name: "sigNonce";
|
|
219
|
+
readonly type: "uint256";
|
|
220
|
+
}, {
|
|
221
|
+
readonly name: "deadline";
|
|
222
|
+
readonly type: "uint256";
|
|
223
|
+
}];
|
|
224
|
+
};
|
|
225
|
+
message: {
|
|
226
|
+
requestHash: `0x${string}`;
|
|
227
|
+
payer: `0x${string}`;
|
|
228
|
+
amount: bigint;
|
|
229
|
+
sigNonce: bigint;
|
|
230
|
+
deadline: bigint;
|
|
231
|
+
};
|
|
232
|
+
}>;
|
|
233
|
+
|
|
234
|
+
declare function requiresAuthorization(plan: OperationPlan): boolean;
|
|
235
|
+
declare function statement(plan: OperationPlan): ProofStatement;
|
|
236
|
+
declare function authorizationRequest(plan: OperationPlan): {
|
|
237
|
+
context: {
|
|
238
|
+
chainId: bigint;
|
|
239
|
+
protocolAddress: bigint;
|
|
240
|
+
};
|
|
241
|
+
operation: "transact" | "create-credit" | "top-up-credit" | "cancel-credit" | "credit-draw";
|
|
242
|
+
capacity: number;
|
|
243
|
+
words: bigint[];
|
|
244
|
+
};
|
|
245
|
+
declare function operationExpired(plan: OperationPlan, now: bigint): boolean;
|
|
246
|
+
|
|
247
|
+
/** Resolve adapters without starting synchronization or accessing wallet state. */
|
|
248
|
+
declare function configureTransactionInfrastructure<T extends TransactionInfrastructure>(options: T): T;
|
|
249
|
+
/** Validate the selected chain and pinned deployment before any managed state access. */
|
|
250
|
+
declare function validateTransactionInfrastructure(options: TransactionInfrastructure): Promise<void>;
|
|
251
|
+
|
|
252
|
+
export { BenchmarkGasEstimate, CancelCreditPreparation, CreateCreditPreparation, DrawCreditPreparation, FundingAuthorizationVerifier, FundingSigner, GasBenchmarkProfile, GasEstimateRequest, GasReference, OperationPlan, OperationStatus, PreparationRuntime, SavedOperation, ShieldPreparation, TopUpCreditPreparation, TransactionInfrastructure, TransactionPreparation, TransactionProveOptions, TransactionRuntime, TransferPreparation, acceptFundingSignature, acceptWalletSignature, authorizationRequest, authorizeOperation, configureTransactionInfrastructure, creditLeaf, decodeProtocolEvent, encodeOperation, estimateBenchmarkGas, estimateGasReference, estimateShapeGas, exportBroadcasterIntent, fundingSigningRequest, fundingTypedData, inputFacts, matchesAggregateTransaction, operationExpired, operationPreview, operationSources, proveOperation, publicProof, requiresAuthorization, sameStatement, signOperationFunding, statement, validateTransactionInfrastructure, verifyMembership, walletSigningRequest, witnessFor };
|