@invisi-labs/protocol 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/chunk-7SS2YSEF.js +199 -0
- package/dist/chunk-7SS2YSEF.js.map +1 -0
- package/dist/{chunk-BYJ4LXCJ.js → chunk-HHJLFLVJ.js} +616 -714
- package/dist/chunk-HHJLFLVJ.js.map +1 -0
- package/dist/chunk-MVQQD5W5.js +487 -0
- package/dist/chunk-MVQQD5W5.js.map +1 -0
- package/dist/chunk-Z2XPYNMC.js +446 -0
- package/dist/chunk-Z2XPYNMC.js.map +1 -0
- package/dist/contracts.cjs +615 -713
- package/dist/contracts.cjs.map +1 -1
- package/dist/contracts.d.cts +5 -5
- package/dist/contracts.d.ts +5 -5
- package/dist/contracts.js +1 -1
- package/dist/credit.cjs +3367 -0
- package/dist/credit.cjs.map +1 -0
- package/dist/credit.d.cts +252 -0
- package/dist/credit.d.ts +252 -0
- package/dist/credit.js +53 -0
- package/dist/credit.js.map +1 -0
- package/dist/index.cjs +4294 -4223
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +128 -933
- package/dist/index.d.ts +128 -933
- package/dist/index.js +2853 -3584
- package/dist/index.js.map +1 -1
- package/dist/note.cjs +3456 -0
- package/dist/note.cjs.map +1 -0
- package/dist/note.d.cts +232 -0
- package/dist/note.d.ts +232 -0
- package/dist/note.js +43 -0
- package/dist/note.js.map +1 -0
- package/dist/provenance.cjs +558 -0
- package/dist/provenance.cjs.map +1 -0
- package/dist/provenance.d.cts +188 -0
- package/dist/provenance.d.ts +188 -0
- package/dist/provenance.js +499 -0
- package/dist/provenance.js.map +1 -0
- package/dist/{types-BmUlasOg.d.cts → types-CUnFzl5S.d.cts} +530 -590
- package/dist/{types-BmUlasOg.d.ts → types-CUnFzl5S.d.ts} +530 -590
- package/dist/validation-8g0SQVE5.d.ts +235 -0
- package/dist/validation-MgURYiNF.d.cts +235 -0
- package/package.json +20 -5
- package/dist/chunk-BYJ4LXCJ.js.map +0 -1
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { Hex, Address } from '@invisi-labs/primitives';
|
|
2
|
+
import { F as FundingParams, D as Delivery, I as InputSource } from './types-CUnFzl5S.js';
|
|
3
|
+
|
|
4
|
+
interface DeploymentContext {
|
|
5
|
+
chainId: bigint;
|
|
6
|
+
protocolAddress: Address;
|
|
7
|
+
}
|
|
8
|
+
interface CanonicalBlock {
|
|
9
|
+
number: bigint;
|
|
10
|
+
hash: Hex;
|
|
11
|
+
parentHash: Hex;
|
|
12
|
+
timestamp: bigint;
|
|
13
|
+
}
|
|
14
|
+
interface Membership {
|
|
15
|
+
treeId: bigint;
|
|
16
|
+
leafIndex: number;
|
|
17
|
+
leaf: Hex;
|
|
18
|
+
root: Hex;
|
|
19
|
+
path: readonly bigint[];
|
|
20
|
+
block: CanonicalBlock;
|
|
21
|
+
}
|
|
22
|
+
/** Indexed service data is untrusted; the wallet verifies canonical facts through ChainReader. */
|
|
23
|
+
interface ProtocolDataStatus {
|
|
24
|
+
indexedHead: CanonicalBlock | null;
|
|
25
|
+
detectionEnabled: boolean;
|
|
26
|
+
checkedBits: number;
|
|
27
|
+
}
|
|
28
|
+
interface ProtocolUpdateRange {
|
|
29
|
+
fromBlock: bigint;
|
|
30
|
+
toBlock: bigint;
|
|
31
|
+
detectionKey?: Uint8Array;
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
}
|
|
34
|
+
interface ProtocolNoteUpdates {
|
|
35
|
+
block: CanonicalBlock;
|
|
36
|
+
notes: readonly ProtocolNoteOutput[];
|
|
37
|
+
}
|
|
38
|
+
interface ProtocolCreditUpdates {
|
|
39
|
+
block: CanonicalBlock;
|
|
40
|
+
transitions: readonly ProtocolCreditTransition[];
|
|
41
|
+
}
|
|
42
|
+
interface ProtocolCreditCandidates {
|
|
43
|
+
block: CanonicalBlock;
|
|
44
|
+
states: readonly IndexedCreditState[];
|
|
45
|
+
}
|
|
46
|
+
interface ProtocolDataProvider {
|
|
47
|
+
getMembership(context: DeploymentContext, input: {
|
|
48
|
+
treeId: bigint;
|
|
49
|
+
leafIndex: number;
|
|
50
|
+
commitment: Hex;
|
|
51
|
+
root?: Hex;
|
|
52
|
+
}, block: CanonicalBlock): Promise<Membership>;
|
|
53
|
+
getStatus(context: DeploymentContext, options?: {
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
}): Promise<ProtocolDataStatus>;
|
|
56
|
+
getNoteUpdates(context: DeploymentContext, range: ProtocolUpdateRange): Promise<ProtocolNoteUpdates>;
|
|
57
|
+
getCreditTransitions(context: DeploymentContext, range: ProtocolUpdateRange): Promise<ProtocolCreditUpdates>;
|
|
58
|
+
detectNotes(context: DeploymentContext, range: ProtocolUpdateRange): Promise<ProtocolNoteUpdates>;
|
|
59
|
+
detectCreditStates(context: DeploymentContext, range: ProtocolUpdateRange): Promise<ProtocolCreditCandidates>;
|
|
60
|
+
}
|
|
61
|
+
/** Registered public receiving address returned by a trusted indexed RPC read. */
|
|
62
|
+
interface RegisteredReceivingAddress {
|
|
63
|
+
receivingAddress: string;
|
|
64
|
+
nonce: bigint;
|
|
65
|
+
block: CanonicalBlock;
|
|
66
|
+
}
|
|
67
|
+
/** Indexed encrypted output; authenticate decryption and verify membership before spending. */
|
|
68
|
+
interface ProtocolNoteOutput {
|
|
69
|
+
block: CanonicalBlock;
|
|
70
|
+
treeId: bigint;
|
|
71
|
+
leafIndex: number;
|
|
72
|
+
commitment: Hex;
|
|
73
|
+
tokenAddress: Address;
|
|
74
|
+
ciphertext: Hex;
|
|
75
|
+
clue: Hex;
|
|
76
|
+
transactionHash: Hex;
|
|
77
|
+
logIndex: number;
|
|
78
|
+
kind: string;
|
|
79
|
+
}
|
|
80
|
+
/** Public indexed Credit event data; verify the canonical receipt before using it. */
|
|
81
|
+
interface ProtocolCreditTransition {
|
|
82
|
+
block: CanonicalBlock;
|
|
83
|
+
name: "CreditCreated" | "CreditDraw" | "CreditUpdated" | "CreditRevoked";
|
|
84
|
+
transactionHash: Hex;
|
|
85
|
+
logIndex: number;
|
|
86
|
+
data: Readonly<Record<string, unknown>>;
|
|
87
|
+
}
|
|
88
|
+
/** One public authority leaf retains both owner/spender deliveries in on-chain order. */
|
|
89
|
+
interface IndexedCreditState {
|
|
90
|
+
block: CanonicalBlock;
|
|
91
|
+
treeId: bigint;
|
|
92
|
+
leafIndex: number;
|
|
93
|
+
commitment: Hex;
|
|
94
|
+
tokenAddress: Address;
|
|
95
|
+
deliveries: readonly {
|
|
96
|
+
ciphertext: Hex;
|
|
97
|
+
clue: Hex;
|
|
98
|
+
}[];
|
|
99
|
+
transactionHash: Hex;
|
|
100
|
+
logIndex: number;
|
|
101
|
+
kind: "CreditCreated" | "CreditDraw" | "CreditUpdated";
|
|
102
|
+
}
|
|
103
|
+
interface TransactionCommon {
|
|
104
|
+
transactionHash: Hex;
|
|
105
|
+
indexedHead: CanonicalBlock | null;
|
|
106
|
+
}
|
|
107
|
+
type Availability<Collections> = TransactionCommon & (({
|
|
108
|
+
status: "not_found";
|
|
109
|
+
block: null;
|
|
110
|
+
receiptStatus: null;
|
|
111
|
+
} & {
|
|
112
|
+
[K in keyof Collections]: null;
|
|
113
|
+
}) | ({
|
|
114
|
+
status: "pending_index";
|
|
115
|
+
block: CanonicalBlock;
|
|
116
|
+
receiptStatus: 0 | 1;
|
|
117
|
+
} & {
|
|
118
|
+
[K in keyof Collections]: null;
|
|
119
|
+
}) | ({
|
|
120
|
+
status: "indexed";
|
|
121
|
+
block: CanonicalBlock;
|
|
122
|
+
receiptStatus: 0 | 1;
|
|
123
|
+
} & Collections));
|
|
124
|
+
type ProtocolTransactionNoteUpdates = Availability<{
|
|
125
|
+
notes: readonly ProtocolNoteOutput[];
|
|
126
|
+
}>;
|
|
127
|
+
type ProtocolTransactionCreditUpdates = Availability<{
|
|
128
|
+
states: readonly IndexedCreditState[];
|
|
129
|
+
transitions: readonly ProtocolCreditTransition[];
|
|
130
|
+
}>;
|
|
131
|
+
interface IndexedCreditAllocation {
|
|
132
|
+
block: CanonicalBlock;
|
|
133
|
+
shard: bigint;
|
|
134
|
+
slot: number;
|
|
135
|
+
}
|
|
136
|
+
interface IndexedCreditRevocationBitmap {
|
|
137
|
+
block: CanonicalBlock;
|
|
138
|
+
bitmap: bigint;
|
|
139
|
+
}
|
|
140
|
+
/** Public operator metadata from the selected registry's indexed state; not an endorsement. */
|
|
141
|
+
interface RegisteredBroadcaster {
|
|
142
|
+
block: CanonicalBlock;
|
|
143
|
+
operator: Address;
|
|
144
|
+
/** Raw contract declaration; the contact client must validate URL safety before use. */
|
|
145
|
+
endpoint: string;
|
|
146
|
+
metadataURI: string;
|
|
147
|
+
quoteSigner: Address;
|
|
148
|
+
feeRecipient: Address;
|
|
149
|
+
enabled: boolean;
|
|
150
|
+
}
|
|
151
|
+
interface BroadcasterQuery {
|
|
152
|
+
enabled?: boolean;
|
|
153
|
+
after?: Address;
|
|
154
|
+
limit?: number;
|
|
155
|
+
block?: CanonicalBlock;
|
|
156
|
+
signal?: AbortSignal;
|
|
157
|
+
}
|
|
158
|
+
interface BroadcasterPage {
|
|
159
|
+
block: CanonicalBlock;
|
|
160
|
+
broadcasters: readonly RegisteredBroadcaster[];
|
|
161
|
+
next?: Address;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
interface TransactionContext extends DeploymentContext {
|
|
165
|
+
tokenAddress: Address;
|
|
166
|
+
now?: bigint;
|
|
167
|
+
/** Explicit chain timestamp used to bind Credit draw UTC periods. */
|
|
168
|
+
timestamp?: bigint;
|
|
169
|
+
}
|
|
170
|
+
declare const FIELD_MODULUS = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;
|
|
171
|
+
declare const ZERO_ADDRESS: "0x0000000000000000000000000000000000000000";
|
|
172
|
+
declare const ZERO_WORD: Hex;
|
|
173
|
+
declare const EMPTY_PERMIT: {
|
|
174
|
+
readonly deadline: 0n;
|
|
175
|
+
readonly v: 0;
|
|
176
|
+
readonly r: `0x${string}`;
|
|
177
|
+
readonly s: `0x${string}`;
|
|
178
|
+
};
|
|
179
|
+
declare const EMPTY_FUNDING: FundingParams;
|
|
180
|
+
type FundingInput = Partial<Omit<FundingParams, "permit">> & {
|
|
181
|
+
permit?: FundingParams["permit"];
|
|
182
|
+
};
|
|
183
|
+
declare function uint(v: bigint | number | string, bits: number, name?: string): bigint;
|
|
184
|
+
declare function field(v: bigint | string, name?: string): bigint;
|
|
185
|
+
declare const word: (v: bigint | string) => Hex;
|
|
186
|
+
declare function dense<T>(v: readonly T[], name: string): readonly T[];
|
|
187
|
+
declare function known(v: object, keys: readonly string[], name?: string): void;
|
|
188
|
+
declare function notes(v: readonly Hex[], name: string): `0x${string}`[];
|
|
189
|
+
declare function envelope(v: Hex, length: number, version?: number, maximum?: number): Hex;
|
|
190
|
+
declare function normalizeContext(c: TransactionContext): {
|
|
191
|
+
chainId: bigint;
|
|
192
|
+
protocolAddress: Hex;
|
|
193
|
+
tokenAddress: Hex;
|
|
194
|
+
now?: bigint;
|
|
195
|
+
/** Explicit chain timestamp used to bind Credit draw UTC periods. */
|
|
196
|
+
timestamp?: bigint;
|
|
197
|
+
};
|
|
198
|
+
declare function checkDeadline(c: TransactionContext, value: bigint): bigint;
|
|
199
|
+
declare function normalizeSources(sources: readonly InputSource[], inputCount: number, capacity: number): {
|
|
200
|
+
treeId: bigint;
|
|
201
|
+
merkleRoot: `0x${string}`;
|
|
202
|
+
}[];
|
|
203
|
+
declare const pad: (v: readonly bigint[], n: number) => bigint[];
|
|
204
|
+
/** Receipt/transport validation must not reject unrelated future wallet codecs. */
|
|
205
|
+
declare function normalizeOpaqueDelivery(value: Delivery, options?: {
|
|
206
|
+
empty?: boolean;
|
|
207
|
+
allowEmpty?: boolean;
|
|
208
|
+
}): Delivery;
|
|
209
|
+
declare const deliveriesHash: (v: readonly Delivery[]) => Hex;
|
|
210
|
+
declare function normalizeFunding(input?: FundingInput): FundingParams;
|
|
211
|
+
declare function validateFundingSubmission(f: FundingParams, caller?: Address, now?: bigint): void;
|
|
212
|
+
declare const getEIP712Domain: (c: TransactionContext) => {
|
|
213
|
+
name: string;
|
|
214
|
+
version: string;
|
|
215
|
+
chainId: bigint;
|
|
216
|
+
verifyingContract: Hex;
|
|
217
|
+
};
|
|
218
|
+
declare const fundingFields: readonly [{
|
|
219
|
+
readonly name: "requestHash";
|
|
220
|
+
readonly type: "bytes32";
|
|
221
|
+
}, {
|
|
222
|
+
readonly name: "payer";
|
|
223
|
+
readonly type: "address";
|
|
224
|
+
}, {
|
|
225
|
+
readonly name: "amount";
|
|
226
|
+
readonly type: "uint256";
|
|
227
|
+
}, {
|
|
228
|
+
readonly name: "sigNonce";
|
|
229
|
+
readonly type: "uint256";
|
|
230
|
+
}, {
|
|
231
|
+
readonly name: "deadline";
|
|
232
|
+
readonly type: "uint256";
|
|
233
|
+
}];
|
|
234
|
+
|
|
235
|
+
export { normalizeOpaqueDelivery as A, type BroadcasterPage as B, type CanonicalBlock as C, type DeploymentContext as D, EMPTY_FUNDING as E, type FundingInput as F, normalizeSources as G, notes as H, type IndexedCreditAllocation as I, pad as J, uint as K, validateFundingSubmission as L, type Membership as M, word as N, type ProtocolCreditCandidates as P, type RegisteredBroadcaster as R, type TransactionContext as T, ZERO_ADDRESS as Z, type BroadcasterQuery as a, EMPTY_PERMIT as b, FIELD_MODULUS as c, type IndexedCreditRevocationBitmap as d, type IndexedCreditState as e, type ProtocolCreditTransition as f, type ProtocolCreditUpdates as g, type ProtocolDataProvider as h, type ProtocolDataStatus as i, type ProtocolNoteOutput as j, type ProtocolNoteUpdates as k, type ProtocolTransactionCreditUpdates as l, type ProtocolTransactionNoteUpdates as m, type ProtocolUpdateRange as n, type RegisteredReceivingAddress as o, ZERO_WORD as p, checkDeadline as q, deliveriesHash as r, dense as s, envelope as t, field as u, fundingFields as v, getEIP712Domain as w, known as x, normalizeContext as y, normalizeFunding as z };
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { Hex, Address } from '@invisi-labs/primitives';
|
|
2
|
+
import { F as FundingParams, D as Delivery, I as InputSource } from './types-CUnFzl5S.cjs';
|
|
3
|
+
|
|
4
|
+
interface DeploymentContext {
|
|
5
|
+
chainId: bigint;
|
|
6
|
+
protocolAddress: Address;
|
|
7
|
+
}
|
|
8
|
+
interface CanonicalBlock {
|
|
9
|
+
number: bigint;
|
|
10
|
+
hash: Hex;
|
|
11
|
+
parentHash: Hex;
|
|
12
|
+
timestamp: bigint;
|
|
13
|
+
}
|
|
14
|
+
interface Membership {
|
|
15
|
+
treeId: bigint;
|
|
16
|
+
leafIndex: number;
|
|
17
|
+
leaf: Hex;
|
|
18
|
+
root: Hex;
|
|
19
|
+
path: readonly bigint[];
|
|
20
|
+
block: CanonicalBlock;
|
|
21
|
+
}
|
|
22
|
+
/** Indexed service data is untrusted; the wallet verifies canonical facts through ChainReader. */
|
|
23
|
+
interface ProtocolDataStatus {
|
|
24
|
+
indexedHead: CanonicalBlock | null;
|
|
25
|
+
detectionEnabled: boolean;
|
|
26
|
+
checkedBits: number;
|
|
27
|
+
}
|
|
28
|
+
interface ProtocolUpdateRange {
|
|
29
|
+
fromBlock: bigint;
|
|
30
|
+
toBlock: bigint;
|
|
31
|
+
detectionKey?: Uint8Array;
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
}
|
|
34
|
+
interface ProtocolNoteUpdates {
|
|
35
|
+
block: CanonicalBlock;
|
|
36
|
+
notes: readonly ProtocolNoteOutput[];
|
|
37
|
+
}
|
|
38
|
+
interface ProtocolCreditUpdates {
|
|
39
|
+
block: CanonicalBlock;
|
|
40
|
+
transitions: readonly ProtocolCreditTransition[];
|
|
41
|
+
}
|
|
42
|
+
interface ProtocolCreditCandidates {
|
|
43
|
+
block: CanonicalBlock;
|
|
44
|
+
states: readonly IndexedCreditState[];
|
|
45
|
+
}
|
|
46
|
+
interface ProtocolDataProvider {
|
|
47
|
+
getMembership(context: DeploymentContext, input: {
|
|
48
|
+
treeId: bigint;
|
|
49
|
+
leafIndex: number;
|
|
50
|
+
commitment: Hex;
|
|
51
|
+
root?: Hex;
|
|
52
|
+
}, block: CanonicalBlock): Promise<Membership>;
|
|
53
|
+
getStatus(context: DeploymentContext, options?: {
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
}): Promise<ProtocolDataStatus>;
|
|
56
|
+
getNoteUpdates(context: DeploymentContext, range: ProtocolUpdateRange): Promise<ProtocolNoteUpdates>;
|
|
57
|
+
getCreditTransitions(context: DeploymentContext, range: ProtocolUpdateRange): Promise<ProtocolCreditUpdates>;
|
|
58
|
+
detectNotes(context: DeploymentContext, range: ProtocolUpdateRange): Promise<ProtocolNoteUpdates>;
|
|
59
|
+
detectCreditStates(context: DeploymentContext, range: ProtocolUpdateRange): Promise<ProtocolCreditCandidates>;
|
|
60
|
+
}
|
|
61
|
+
/** Registered public receiving address returned by a trusted indexed RPC read. */
|
|
62
|
+
interface RegisteredReceivingAddress {
|
|
63
|
+
receivingAddress: string;
|
|
64
|
+
nonce: bigint;
|
|
65
|
+
block: CanonicalBlock;
|
|
66
|
+
}
|
|
67
|
+
/** Indexed encrypted output; authenticate decryption and verify membership before spending. */
|
|
68
|
+
interface ProtocolNoteOutput {
|
|
69
|
+
block: CanonicalBlock;
|
|
70
|
+
treeId: bigint;
|
|
71
|
+
leafIndex: number;
|
|
72
|
+
commitment: Hex;
|
|
73
|
+
tokenAddress: Address;
|
|
74
|
+
ciphertext: Hex;
|
|
75
|
+
clue: Hex;
|
|
76
|
+
transactionHash: Hex;
|
|
77
|
+
logIndex: number;
|
|
78
|
+
kind: string;
|
|
79
|
+
}
|
|
80
|
+
/** Public indexed Credit event data; verify the canonical receipt before using it. */
|
|
81
|
+
interface ProtocolCreditTransition {
|
|
82
|
+
block: CanonicalBlock;
|
|
83
|
+
name: "CreditCreated" | "CreditDraw" | "CreditUpdated" | "CreditRevoked";
|
|
84
|
+
transactionHash: Hex;
|
|
85
|
+
logIndex: number;
|
|
86
|
+
data: Readonly<Record<string, unknown>>;
|
|
87
|
+
}
|
|
88
|
+
/** One public authority leaf retains both owner/spender deliveries in on-chain order. */
|
|
89
|
+
interface IndexedCreditState {
|
|
90
|
+
block: CanonicalBlock;
|
|
91
|
+
treeId: bigint;
|
|
92
|
+
leafIndex: number;
|
|
93
|
+
commitment: Hex;
|
|
94
|
+
tokenAddress: Address;
|
|
95
|
+
deliveries: readonly {
|
|
96
|
+
ciphertext: Hex;
|
|
97
|
+
clue: Hex;
|
|
98
|
+
}[];
|
|
99
|
+
transactionHash: Hex;
|
|
100
|
+
logIndex: number;
|
|
101
|
+
kind: "CreditCreated" | "CreditDraw" | "CreditUpdated";
|
|
102
|
+
}
|
|
103
|
+
interface TransactionCommon {
|
|
104
|
+
transactionHash: Hex;
|
|
105
|
+
indexedHead: CanonicalBlock | null;
|
|
106
|
+
}
|
|
107
|
+
type Availability<Collections> = TransactionCommon & (({
|
|
108
|
+
status: "not_found";
|
|
109
|
+
block: null;
|
|
110
|
+
receiptStatus: null;
|
|
111
|
+
} & {
|
|
112
|
+
[K in keyof Collections]: null;
|
|
113
|
+
}) | ({
|
|
114
|
+
status: "pending_index";
|
|
115
|
+
block: CanonicalBlock;
|
|
116
|
+
receiptStatus: 0 | 1;
|
|
117
|
+
} & {
|
|
118
|
+
[K in keyof Collections]: null;
|
|
119
|
+
}) | ({
|
|
120
|
+
status: "indexed";
|
|
121
|
+
block: CanonicalBlock;
|
|
122
|
+
receiptStatus: 0 | 1;
|
|
123
|
+
} & Collections));
|
|
124
|
+
type ProtocolTransactionNoteUpdates = Availability<{
|
|
125
|
+
notes: readonly ProtocolNoteOutput[];
|
|
126
|
+
}>;
|
|
127
|
+
type ProtocolTransactionCreditUpdates = Availability<{
|
|
128
|
+
states: readonly IndexedCreditState[];
|
|
129
|
+
transitions: readonly ProtocolCreditTransition[];
|
|
130
|
+
}>;
|
|
131
|
+
interface IndexedCreditAllocation {
|
|
132
|
+
block: CanonicalBlock;
|
|
133
|
+
shard: bigint;
|
|
134
|
+
slot: number;
|
|
135
|
+
}
|
|
136
|
+
interface IndexedCreditRevocationBitmap {
|
|
137
|
+
block: CanonicalBlock;
|
|
138
|
+
bitmap: bigint;
|
|
139
|
+
}
|
|
140
|
+
/** Public operator metadata from the selected registry's indexed state; not an endorsement. */
|
|
141
|
+
interface RegisteredBroadcaster {
|
|
142
|
+
block: CanonicalBlock;
|
|
143
|
+
operator: Address;
|
|
144
|
+
/** Raw contract declaration; the contact client must validate URL safety before use. */
|
|
145
|
+
endpoint: string;
|
|
146
|
+
metadataURI: string;
|
|
147
|
+
quoteSigner: Address;
|
|
148
|
+
feeRecipient: Address;
|
|
149
|
+
enabled: boolean;
|
|
150
|
+
}
|
|
151
|
+
interface BroadcasterQuery {
|
|
152
|
+
enabled?: boolean;
|
|
153
|
+
after?: Address;
|
|
154
|
+
limit?: number;
|
|
155
|
+
block?: CanonicalBlock;
|
|
156
|
+
signal?: AbortSignal;
|
|
157
|
+
}
|
|
158
|
+
interface BroadcasterPage {
|
|
159
|
+
block: CanonicalBlock;
|
|
160
|
+
broadcasters: readonly RegisteredBroadcaster[];
|
|
161
|
+
next?: Address;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
interface TransactionContext extends DeploymentContext {
|
|
165
|
+
tokenAddress: Address;
|
|
166
|
+
now?: bigint;
|
|
167
|
+
/** Explicit chain timestamp used to bind Credit draw UTC periods. */
|
|
168
|
+
timestamp?: bigint;
|
|
169
|
+
}
|
|
170
|
+
declare const FIELD_MODULUS = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;
|
|
171
|
+
declare const ZERO_ADDRESS: "0x0000000000000000000000000000000000000000";
|
|
172
|
+
declare const ZERO_WORD: Hex;
|
|
173
|
+
declare const EMPTY_PERMIT: {
|
|
174
|
+
readonly deadline: 0n;
|
|
175
|
+
readonly v: 0;
|
|
176
|
+
readonly r: `0x${string}`;
|
|
177
|
+
readonly s: `0x${string}`;
|
|
178
|
+
};
|
|
179
|
+
declare const EMPTY_FUNDING: FundingParams;
|
|
180
|
+
type FundingInput = Partial<Omit<FundingParams, "permit">> & {
|
|
181
|
+
permit?: FundingParams["permit"];
|
|
182
|
+
};
|
|
183
|
+
declare function uint(v: bigint | number | string, bits: number, name?: string): bigint;
|
|
184
|
+
declare function field(v: bigint | string, name?: string): bigint;
|
|
185
|
+
declare const word: (v: bigint | string) => Hex;
|
|
186
|
+
declare function dense<T>(v: readonly T[], name: string): readonly T[];
|
|
187
|
+
declare function known(v: object, keys: readonly string[], name?: string): void;
|
|
188
|
+
declare function notes(v: readonly Hex[], name: string): `0x${string}`[];
|
|
189
|
+
declare function envelope(v: Hex, length: number, version?: number, maximum?: number): Hex;
|
|
190
|
+
declare function normalizeContext(c: TransactionContext): {
|
|
191
|
+
chainId: bigint;
|
|
192
|
+
protocolAddress: Hex;
|
|
193
|
+
tokenAddress: Hex;
|
|
194
|
+
now?: bigint;
|
|
195
|
+
/** Explicit chain timestamp used to bind Credit draw UTC periods. */
|
|
196
|
+
timestamp?: bigint;
|
|
197
|
+
};
|
|
198
|
+
declare function checkDeadline(c: TransactionContext, value: bigint): bigint;
|
|
199
|
+
declare function normalizeSources(sources: readonly InputSource[], inputCount: number, capacity: number): {
|
|
200
|
+
treeId: bigint;
|
|
201
|
+
merkleRoot: `0x${string}`;
|
|
202
|
+
}[];
|
|
203
|
+
declare const pad: (v: readonly bigint[], n: number) => bigint[];
|
|
204
|
+
/** Receipt/transport validation must not reject unrelated future wallet codecs. */
|
|
205
|
+
declare function normalizeOpaqueDelivery(value: Delivery, options?: {
|
|
206
|
+
empty?: boolean;
|
|
207
|
+
allowEmpty?: boolean;
|
|
208
|
+
}): Delivery;
|
|
209
|
+
declare const deliveriesHash: (v: readonly Delivery[]) => Hex;
|
|
210
|
+
declare function normalizeFunding(input?: FundingInput): FundingParams;
|
|
211
|
+
declare function validateFundingSubmission(f: FundingParams, caller?: Address, now?: bigint): void;
|
|
212
|
+
declare const getEIP712Domain: (c: TransactionContext) => {
|
|
213
|
+
name: string;
|
|
214
|
+
version: string;
|
|
215
|
+
chainId: bigint;
|
|
216
|
+
verifyingContract: Hex;
|
|
217
|
+
};
|
|
218
|
+
declare const fundingFields: readonly [{
|
|
219
|
+
readonly name: "requestHash";
|
|
220
|
+
readonly type: "bytes32";
|
|
221
|
+
}, {
|
|
222
|
+
readonly name: "payer";
|
|
223
|
+
readonly type: "address";
|
|
224
|
+
}, {
|
|
225
|
+
readonly name: "amount";
|
|
226
|
+
readonly type: "uint256";
|
|
227
|
+
}, {
|
|
228
|
+
readonly name: "sigNonce";
|
|
229
|
+
readonly type: "uint256";
|
|
230
|
+
}, {
|
|
231
|
+
readonly name: "deadline";
|
|
232
|
+
readonly type: "uint256";
|
|
233
|
+
}];
|
|
234
|
+
|
|
235
|
+
export { normalizeOpaqueDelivery as A, type BroadcasterPage as B, type CanonicalBlock as C, type DeploymentContext as D, EMPTY_FUNDING as E, type FundingInput as F, normalizeSources as G, notes as H, type IndexedCreditAllocation as I, pad as J, uint as K, validateFundingSubmission as L, type Membership as M, word as N, type ProtocolCreditCandidates as P, type RegisteredBroadcaster as R, type TransactionContext as T, ZERO_ADDRESS as Z, type BroadcasterQuery as a, EMPTY_PERMIT as b, FIELD_MODULUS as c, type IndexedCreditRevocationBitmap as d, type IndexedCreditState as e, type ProtocolCreditTransition as f, type ProtocolCreditUpdates as g, type ProtocolDataProvider as h, type ProtocolDataStatus as i, type ProtocolNoteOutput as j, type ProtocolNoteUpdates as k, type ProtocolTransactionCreditUpdates as l, type ProtocolTransactionNoteUpdates as m, type ProtocolUpdateRange as n, type RegisteredReceivingAddress as o, ZERO_WORD as p, checkDeadline as q, deliveriesHash as r, dense as s, envelope as t, field as u, fundingFields as v, getEIP712Domain as w, known as x, normalizeContext as y, normalizeFunding as z };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@invisi-labs/protocol",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Pure Invisi public ABIs, types, strict codecs, statements, signatures, capacities and gas references",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -16,13 +16,28 @@
|
|
|
16
16
|
"types": "./dist/contracts.d.ts",
|
|
17
17
|
"import": "./dist/contracts.js",
|
|
18
18
|
"require": "./dist/contracts.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./note": {
|
|
21
|
+
"types": "./dist/note.d.ts",
|
|
22
|
+
"import": "./dist/note.js",
|
|
23
|
+
"require": "./dist/note.cjs"
|
|
24
|
+
},
|
|
25
|
+
"./credit": {
|
|
26
|
+
"types": "./dist/credit.d.ts",
|
|
27
|
+
"import": "./dist/credit.js",
|
|
28
|
+
"require": "./dist/credit.cjs"
|
|
29
|
+
},
|
|
30
|
+
"./provenance": {
|
|
31
|
+
"types": "./dist/provenance.d.ts",
|
|
32
|
+
"import": "./dist/provenance.js",
|
|
33
|
+
"require": "./dist/provenance.cjs"
|
|
19
34
|
}
|
|
20
35
|
},
|
|
21
36
|
"dependencies": {
|
|
22
37
|
"ethers": "^6.17.0",
|
|
23
|
-
"@
|
|
24
|
-
"@
|
|
25
|
-
"@invisi-labs/
|
|
38
|
+
"@noble/hashes": "1.8.0",
|
|
39
|
+
"@noble/curves": "1.9.1",
|
|
40
|
+
"@invisi-labs/primitives": "1.2.0"
|
|
26
41
|
},
|
|
27
42
|
"devDependencies": {
|
|
28
43
|
"tsup": "^8.0.0",
|