@gol/sdk 0.3.0 → 0.5.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 +24 -17
- package/dist/account-dialects.d.ts +14 -6
- package/dist/account-dialects.d.ts.map +1 -1
- package/dist/account-dialects.js +31 -4
- package/dist/account-dialects.js.map +1 -1
- package/dist/agent.d.ts +232 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +299 -0
- package/dist/agent.js.map +1 -0
- package/dist/eip7702.d.ts +73 -0
- package/dist/eip7702.d.ts.map +1 -0
- package/dist/eip7702.js +173 -0
- package/dist/eip7702.js.map +1 -0
- package/dist/gas-approval.d.ts +8 -3
- package/dist/gas-approval.d.ts.map +1 -1
- package/dist/gas-approval.js +17 -9
- package/dist/gas-approval.js.map +1 -1
- package/dist/generated/platform.d.ts +2924 -544
- package/dist/generated/platform.d.ts.map +1 -1
- package/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/owner.d.ts +131 -27
- package/dist/owner.d.ts.map +1 -1
- package/dist/owner.js +257 -92
- package/dist/owner.js.map +1 -1
- package/dist/server.d.ts +38 -4
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +108 -2
- package/dist/server.js.map +1 -1
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/v3.d.ts +39 -0
- package/dist/v3.d.ts.map +1 -0
- package/dist/v3.js +41 -0
- package/dist/v3.js.map +1 -0
- package/package.json +18 -19
package/dist/agent.js
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { decodeFunctionData, encodeAbiParameters, getAddress, hashTypedData, keccak256, parseAbi, recoverAddress, } from "viem";
|
|
2
|
+
import { BASE_SEPOLIA_CHAIN_ID } from "./account-dialects.js";
|
|
3
|
+
import { hashGasMandate } from "./gas-approval.js";
|
|
4
|
+
import { BASE_SEPOLIA_USDC, encodeCreateChildMandate, encodeTransferPolicy, toGasMandateTerms, } from "./owner.js";
|
|
5
|
+
import { coreDomain, HOSTED_TREE_LIMITS, TRANSFER_ACTION_TAG, TRANSFER_CAPABILITY_DIGEST, TRANSFER_SCHEMA_VERSION, } from "./v3.js";
|
|
6
|
+
export const GAS_ACTION_TYPES = {
|
|
7
|
+
GasActionAuthorization: [
|
|
8
|
+
{ name: "mandateId", type: "bytes32" },
|
|
9
|
+
{ name: "actionTag", type: "uint32" },
|
|
10
|
+
{ name: "schemaVersion", type: "uint16" },
|
|
11
|
+
{ name: "actionId", type: "bytes32" },
|
|
12
|
+
{ name: "capabilityDigest", type: "bytes32" },
|
|
13
|
+
{ name: "deadline", type: "uint48" },
|
|
14
|
+
{ name: "inputHash", type: "bytes32" },
|
|
15
|
+
{ name: "gasPolicyId", type: "bytes32" },
|
|
16
|
+
{ name: "maxCharge", type: "uint128" },
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
export const MANDATE_TERMS_TYPES = {
|
|
20
|
+
MandateTerms: [
|
|
21
|
+
{ name: "parentId", type: "bytes32" },
|
|
22
|
+
{ name: "account", type: "address" },
|
|
23
|
+
{ name: "agent", type: "address" },
|
|
24
|
+
{ name: "accountProfileId", type: "bytes32" },
|
|
25
|
+
{ name: "installEpoch", type: "uint64" },
|
|
26
|
+
{ name: "projectId", type: "bytes32" },
|
|
27
|
+
{ name: "mode", type: "uint8" },
|
|
28
|
+
{ name: "policyVersion", type: "uint8" },
|
|
29
|
+
{ name: "policyHash", type: "bytes32" },
|
|
30
|
+
{ name: "validFrom", type: "uint48" },
|
|
31
|
+
{ name: "expiresAt", type: "uint48" },
|
|
32
|
+
{ name: "maxDepth", type: "uint32" },
|
|
33
|
+
{ name: "maxActiveDescendants", type: "uint32" },
|
|
34
|
+
{ name: "approvalExpiresAt", type: "uint48" },
|
|
35
|
+
{ name: "salt", type: "bytes32" },
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
/** The 96-byte `fungible_asset.transfer@1` input: `abi.encode(asset, recipient, amount)`. */
|
|
39
|
+
export function encodeTransferInput(asset, recipient, amount) {
|
|
40
|
+
return encodeAbiParameters([{ type: "address" }, { type: "address" }, { type: "uint256" }], [getAddress(asset), getAddress(recipient), amount]);
|
|
41
|
+
}
|
|
42
|
+
/** Typed data the executing mandate's agent signs for one inline-settled action. */
|
|
43
|
+
export function gasActionTypedData(message, core, chainId = BASE_SEPOLIA_CHAIN_ID) {
|
|
44
|
+
return {
|
|
45
|
+
domain: coreDomain(chainId, getAddress(core)),
|
|
46
|
+
types: GAS_ACTION_TYPES,
|
|
47
|
+
primaryType: "GasActionAuthorization",
|
|
48
|
+
message: {
|
|
49
|
+
mandateId: message.mandateId,
|
|
50
|
+
actionTag: TRANSFER_ACTION_TAG,
|
|
51
|
+
schemaVersion: TRANSFER_SCHEMA_VERSION,
|
|
52
|
+
actionId: message.actionId,
|
|
53
|
+
capabilityDigest: TRANSFER_CAPABILITY_DIGEST,
|
|
54
|
+
deadline: message.deadline,
|
|
55
|
+
inputHash: message.inputHash,
|
|
56
|
+
gasPolicyId: message.gasPolicyId,
|
|
57
|
+
maxCharge: message.maxCharge,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export function hashGasActionAuthorization(message, core, chainId = BASE_SEPOLIA_CHAIN_ID) {
|
|
62
|
+
return hashTypedData(gasActionTypedData(message, core, chainId));
|
|
63
|
+
}
|
|
64
|
+
const eq = (a, b) => String(a).toLowerCase() === String(b).toLowerCase();
|
|
65
|
+
/**
|
|
66
|
+
* Recompute the agent's `GasActionAuthorization` from the typed transfer
|
|
67
|
+
* without trusting the API. Throws `prepared_execution_mismatch` on any
|
|
68
|
+
* difference, including a `maxChargeWei` above the agent's own ceiling.
|
|
69
|
+
*/
|
|
70
|
+
export function verifyPreparedGasExecution(prepared, expected = {}) {
|
|
71
|
+
const fail = (what) => {
|
|
72
|
+
throw new Error(`prepared_execution_mismatch: ${what}`);
|
|
73
|
+
};
|
|
74
|
+
if (prepared.chainId !== BASE_SEPOLIA_CHAIN_ID)
|
|
75
|
+
fail("chain");
|
|
76
|
+
const core = getAddress(prepared.core);
|
|
77
|
+
if (expected.core && !eq(expected.core, core))
|
|
78
|
+
fail("core");
|
|
79
|
+
if (!eq(prepared.asset, BASE_SEPOLIA_USDC))
|
|
80
|
+
fail("asset");
|
|
81
|
+
const amount = BigInt(prepared.amountBaseUnits);
|
|
82
|
+
const maxCharge = BigInt(prepared.maxChargeWei);
|
|
83
|
+
if (amount <= 0n || maxCharge <= 0n || maxCharge >= 1n << 128n)
|
|
84
|
+
fail("amounts");
|
|
85
|
+
const message = prepared.typedData.message;
|
|
86
|
+
const deadline = Number(message.deadline);
|
|
87
|
+
const inputHash = keccak256(encodeTransferInput(prepared.asset, prepared.recipient, amount));
|
|
88
|
+
const rebuilt = gasActionTypedData({
|
|
89
|
+
mandateId: prepared.mandateId,
|
|
90
|
+
actionId: prepared.actionId,
|
|
91
|
+
deadline,
|
|
92
|
+
inputHash,
|
|
93
|
+
gasPolicyId: prepared.gasPolicyId,
|
|
94
|
+
maxCharge,
|
|
95
|
+
}, core);
|
|
96
|
+
const digest = hashTypedData(rebuilt);
|
|
97
|
+
const received = hashTypedData(prepared.typedData);
|
|
98
|
+
if (!Number.isSafeInteger(deadline) ||
|
|
99
|
+
deadline <= 0 ||
|
|
100
|
+
prepared.typedData.primaryType !== "GasActionAuthorization" ||
|
|
101
|
+
!eq(received, digest) ||
|
|
102
|
+
!eq(prepared.digest, digest))
|
|
103
|
+
fail("typed data");
|
|
104
|
+
if (expected.mandateId && !eq(expected.mandateId, prepared.mandateId))
|
|
105
|
+
fail("mandate");
|
|
106
|
+
if (expected.gasPolicyId && !eq(expected.gasPolicyId, prepared.gasPolicyId))
|
|
107
|
+
fail("gas policy");
|
|
108
|
+
if (expected.agent && !eq(expected.agent, prepared.agent))
|
|
109
|
+
fail("agent");
|
|
110
|
+
if (expected.recipient && !eq(expected.recipient, prepared.recipient))
|
|
111
|
+
fail("recipient");
|
|
112
|
+
if (expected.amountBaseUnits !== undefined &&
|
|
113
|
+
expected.amountBaseUnits !== amount)
|
|
114
|
+
fail("amount");
|
|
115
|
+
if (expected.deadline !== undefined && expected.deadline !== deadline)
|
|
116
|
+
fail("deadline");
|
|
117
|
+
if (expected.maxChargeWei !== undefined && maxCharge > expected.maxChargeWei)
|
|
118
|
+
fail("max charge");
|
|
119
|
+
if (expected.relayerMode !== undefined &&
|
|
120
|
+
expected.relayerMode !== prepared.relayerMode)
|
|
121
|
+
fail("relayer mode");
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Verify, ask the agent wallet to sign, and return the submission body for
|
|
125
|
+
* `submitGasExecution`. The signature must recover to the prepared agent.
|
|
126
|
+
*/
|
|
127
|
+
export async function signPreparedGasExecution(signer, prepared, expected = {}) {
|
|
128
|
+
verifyPreparedGasExecution(prepared, expected);
|
|
129
|
+
const agentSignature = await signer.signTypedData(prepared.typedData);
|
|
130
|
+
const recovered = await recoverAddress({
|
|
131
|
+
hash: prepared.digest,
|
|
132
|
+
signature: agentSignature,
|
|
133
|
+
});
|
|
134
|
+
if (!eq(recovered, prepared.agent))
|
|
135
|
+
throw new Error("agent_signature_mismatch");
|
|
136
|
+
return {
|
|
137
|
+
mandateId: prepared.mandateId,
|
|
138
|
+
gasPolicyId: prepared.gasPolicyId,
|
|
139
|
+
recipient: prepared.recipient,
|
|
140
|
+
amountBaseUnits: prepared.amountBaseUnits,
|
|
141
|
+
deadline: Number(prepared.typedData.message.deadline),
|
|
142
|
+
maxChargeWei: prepared.maxChargeWei,
|
|
143
|
+
agentSignature,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Recompute a prepared child mandate: its policy bytes from the reviewed
|
|
148
|
+
* intent, its terms and identifier under the version 3 domain, and the parent
|
|
149
|
+
* agent's signing payload. Throws `prepared_child_mismatch` on any difference.
|
|
150
|
+
* The core enforces every ancestor's limits regardless.
|
|
151
|
+
*/
|
|
152
|
+
export function verifyPreparedChildMandate(prepared, expected = {}) {
|
|
153
|
+
const fail = (what) => {
|
|
154
|
+
throw new Error(`prepared_child_mismatch: ${what}`);
|
|
155
|
+
};
|
|
156
|
+
const review = prepared.review;
|
|
157
|
+
const terms = toGasMandateTerms(prepared.authority.mandateTerms);
|
|
158
|
+
const domain = prepared.signing.typedData.domain;
|
|
159
|
+
const core = getAddress(String(domain.verifyingContract));
|
|
160
|
+
if (domain.name !== "GOL Mandate" ||
|
|
161
|
+
domain.version !== "3" ||
|
|
162
|
+
Number(domain.chainId) !== BASE_SEPOLIA_CHAIN_ID)
|
|
163
|
+
fail("domain");
|
|
164
|
+
if (expected.core && !eq(expected.core, core))
|
|
165
|
+
fail("core");
|
|
166
|
+
if (!eq(prepared.submission.to, core))
|
|
167
|
+
fail("submission");
|
|
168
|
+
const recipients = review.recipients;
|
|
169
|
+
const policy = encodeTransferPolicy({
|
|
170
|
+
asset: BASE_SEPOLIA_USDC,
|
|
171
|
+
recipients,
|
|
172
|
+
maxPerActionBaseUnits: BigInt(String(review.maxPerActionBaseUnits)),
|
|
173
|
+
maxTotalBaseUnits: BigInt(String(review.maxTotalBaseUnits)),
|
|
174
|
+
});
|
|
175
|
+
if (!eq(policy, prepared.authority.mandatePolicy) ||
|
|
176
|
+
!eq(keccak256(policy), terms.policyHash))
|
|
177
|
+
fail("policy bytes");
|
|
178
|
+
const depth = Number(review.depth);
|
|
179
|
+
if (!eq(terms.parentId, prepared.parentMandateId) ||
|
|
180
|
+
!eq(terms.agent, review.agent) ||
|
|
181
|
+
terms.mode !== 1 ||
|
|
182
|
+
terms.policyVersion !== 1 ||
|
|
183
|
+
terms.validFrom !== Number(review.validFrom) ||
|
|
184
|
+
terms.expiresAt !== Number(review.expiresAt) ||
|
|
185
|
+
terms.maxDepth !== Number(review.maxDepth) ||
|
|
186
|
+
terms.maxActiveDescendants !== Number(review.maxActiveDescendants) ||
|
|
187
|
+
!Number.isInteger(depth) ||
|
|
188
|
+
depth < 1 ||
|
|
189
|
+
depth > HOSTED_TREE_LIMITS.maxDepth ||
|
|
190
|
+
terms.maxDepth > HOSTED_TREE_LIMITS.maxDepth - depth ||
|
|
191
|
+
terms.maxActiveDescendants > HOSTED_TREE_LIMITS.maxActiveDescendants)
|
|
192
|
+
fail("terms");
|
|
193
|
+
const mandateId = hashGasMandate(terms, BASE_SEPOLIA_CHAIN_ID, core);
|
|
194
|
+
const received = hashTypedData(prepared.signing.typedData);
|
|
195
|
+
if (!eq(mandateId, prepared.authority.mandateId) ||
|
|
196
|
+
!eq(mandateId, prepared.signing.expectedHash) ||
|
|
197
|
+
!eq(received, mandateId) ||
|
|
198
|
+
prepared.signing.typedData.primaryType !== "MandateTerms" ||
|
|
199
|
+
!eq(prepared.signing.signer, prepared.parentAgent))
|
|
200
|
+
fail("mandate id");
|
|
201
|
+
if (expected.parentMandateId &&
|
|
202
|
+
!eq(expected.parentMandateId, prepared.parentMandateId))
|
|
203
|
+
fail("parent");
|
|
204
|
+
if (expected.parentAgent && !eq(expected.parentAgent, prepared.parentAgent))
|
|
205
|
+
fail("parent agent");
|
|
206
|
+
if (expected.agent && !eq(expected.agent, terms.agent))
|
|
207
|
+
fail("agent");
|
|
208
|
+
if (expected.recipients &&
|
|
209
|
+
(expected.recipients.length !== recipients.length ||
|
|
210
|
+
!expected.recipients.every((a) => recipients.some((b) => eq(a, b)))))
|
|
211
|
+
fail("recipients");
|
|
212
|
+
if (expected.maxPerActionBaseUnits !== undefined &&
|
|
213
|
+
BigInt(String(review.maxPerActionBaseUnits)) !==
|
|
214
|
+
expected.maxPerActionBaseUnits)
|
|
215
|
+
fail("per-action cap");
|
|
216
|
+
if (expected.maxTotalBaseUnits !== undefined &&
|
|
217
|
+
BigInt(String(review.maxTotalBaseUnits)) !== expected.maxTotalBaseUnits)
|
|
218
|
+
fail("total cap");
|
|
219
|
+
if (expected.tree &&
|
|
220
|
+
(expected.tree.maxDepth !== terms.maxDepth ||
|
|
221
|
+
expected.tree.maxActiveDescendants !== terms.maxActiveDescendants))
|
|
222
|
+
fail("tree limits");
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Verify, ask the parent agent to sign the child's `MandateTerms`, and return
|
|
226
|
+
* the `authorization` for `submitChildMandate` plus the call anyone may send
|
|
227
|
+
* to create the child without GOL's sponsorship.
|
|
228
|
+
*/
|
|
229
|
+
export async function signPreparedChildMandate(parentAgent, prepared, expected = {}) {
|
|
230
|
+
verifyPreparedChildMandate(prepared, expected);
|
|
231
|
+
const authorization = await parentAgent.signTypedData(prepared.signing.typedData);
|
|
232
|
+
const recovered = await recoverAddress({
|
|
233
|
+
hash: prepared.authority.mandateId,
|
|
234
|
+
signature: authorization,
|
|
235
|
+
});
|
|
236
|
+
if (!eq(recovered, prepared.parentAgent))
|
|
237
|
+
throw new Error("parent_agent_signature_mismatch");
|
|
238
|
+
return {
|
|
239
|
+
authorization,
|
|
240
|
+
submission: {
|
|
241
|
+
to: getAddress(prepared.submission.to),
|
|
242
|
+
data: encodeCreateChildMandate(prepared.authority.mandateTerms, prepared.authority.mandatePolicy, authorization),
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
// ---------------------------------------------------------------------------
|
|
247
|
+
// Developer-operated relayer
|
|
248
|
+
// ---------------------------------------------------------------------------
|
|
249
|
+
const executeWithGasAbi = parseAbi([
|
|
250
|
+
"function executeWithGas((bytes32 mandateId,uint32 actionTag,uint16 schemaVersion,bytes32 actionId,bytes32 capabilityDigest,uint48 deadline,bytes input) request,bytes agentSignature,(bytes32 policyId,uint128 maxCharge,uint128 l1Fee,uint128 operatorFee) gas) returns (bool executed,uint256 charged)",
|
|
251
|
+
]);
|
|
252
|
+
/**
|
|
253
|
+
* The exact EIP-1559 transaction a developer-operated relayer signs for an
|
|
254
|
+
* execution in `external_pending`, after checking that its calldata is the
|
|
255
|
+
* agent's signed transfer under this execution's mandate, action, and policy.
|
|
256
|
+
* The relayer chooses its own nonce and a priority fee not above
|
|
257
|
+
* `maxFeePerGas`, signs with its own key, and submits the raw bytes.
|
|
258
|
+
*/
|
|
259
|
+
export function developerRelayerTransaction(execution, expected = {}) {
|
|
260
|
+
const fail = (what) => {
|
|
261
|
+
throw new Error(`developer_transaction_mismatch: ${what}`);
|
|
262
|
+
};
|
|
263
|
+
const transaction = execution.transaction;
|
|
264
|
+
if (!transaction || execution.relayerMode !== "developer")
|
|
265
|
+
fail("not a developer relayer execution");
|
|
266
|
+
if (transaction.chainId !== BASE_SEPOLIA_CHAIN_ID ||
|
|
267
|
+
!eq(transaction.to, execution.core) ||
|
|
268
|
+
(expected.core && !eq(expected.core, transaction.to)) ||
|
|
269
|
+
!eq(transaction.submitter, execution.submitter) ||
|
|
270
|
+
(expected.submitter && !eq(expected.submitter, transaction.submitter)))
|
|
271
|
+
fail("envelope");
|
|
272
|
+
const decoded = decodeFunctionData({
|
|
273
|
+
abi: executeWithGasAbi,
|
|
274
|
+
data: transaction.data,
|
|
275
|
+
});
|
|
276
|
+
const [request, , gas] = decoded.args;
|
|
277
|
+
if (!eq(request.mandateId, execution.mandateId) ||
|
|
278
|
+
!eq(request.actionId, execution.actionId) ||
|
|
279
|
+
!eq(gas.policyId, execution.gasPolicyId) ||
|
|
280
|
+
request.actionTag !== TRANSFER_ACTION_TAG ||
|
|
281
|
+
request.schemaVersion !== TRANSFER_SCHEMA_VERSION ||
|
|
282
|
+
!eq(request.capabilityDigest, TRANSFER_CAPABILITY_DIGEST))
|
|
283
|
+
fail("calldata");
|
|
284
|
+
const gasLimit = BigInt(transaction.gasLimit);
|
|
285
|
+
const maxFeePerGas = BigInt(transaction.maxFeePerGasWei);
|
|
286
|
+
if (gasLimit <= 0n || maxFeePerGas <= 0n)
|
|
287
|
+
fail("fees");
|
|
288
|
+
return {
|
|
289
|
+
chainId: BASE_SEPOLIA_CHAIN_ID,
|
|
290
|
+
type: "eip1559",
|
|
291
|
+
from: getAddress(transaction.submitter),
|
|
292
|
+
to: getAddress(transaction.to),
|
|
293
|
+
data: transaction.data,
|
|
294
|
+
value: 0n,
|
|
295
|
+
gas: gasLimit,
|
|
296
|
+
maxFeePerGas,
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,UAAU,EACV,aAAa,EACb,SAAS,EACT,QAAQ,EACR,cAAc,GAGf,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACpB,iBAAiB,GAGlB,MAAM,YAAY,CAAC;AAMpB,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAOjB,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,sBAAsB,EAAE;QACtB,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;QACtC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;QACrC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,QAAQ,EAAE;QACzC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;QACrC,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,SAAS,EAAE;QAC7C,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE;QACpC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;QACtC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAA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AU,CAAC,CAAC;IACnB,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAY,CAAC,QAAQ,CAAC,CAAC;IAC/C,MAAM,YAAY,GAAG,MAAM,CAAC,WAAY,CAAC,eAAe,CAAC,CAAC;IAC1D,IAAI,QAAQ,IAAI,EAAE,IAAI,YAAY,IAAI,EAAE;QAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACvD,OAAO;QACL,OAAO,EAAE,qBAAqB;QAC9B,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,UAAU,CAAC,WAAY,CAAC,SAAS,CAAC;QACxC,EAAE,EAAE,UAAU,CAAC,WAAY,CAAC,EAAE,CAAC;QAC/B,IAAI,EAAE,WAAY,CAAC,IAAW;QAC9B,KAAK,EAAE,EAAE;QACT,GAAG,EAAE,QAAQ;QACb,YAAY;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type Address, type Hex } from "viem";
|
|
2
|
+
import type { PreparedEip7702Setup, SubmitEip7702SetupInput } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* The canonical Nexus 1.3.3 initialization of a `nexus7702` account
|
|
5
|
+
* (encoding section 6.4): no validator, the version 3 core as the only
|
|
6
|
+
* executor, and no hook, fallback, or pre-validation hook.
|
|
7
|
+
*/
|
|
8
|
+
export declare function nexus133InitData(core: Address): Hex;
|
|
9
|
+
/** `keccak256(0x05 || rlp([chainId, address, nonce]))` for the reviewed delegate on Base Sepolia. */
|
|
10
|
+
export declare function eip7702AuthorizationHash(nonce: bigint | number | string): Hex;
|
|
11
|
+
/**
|
|
12
|
+
* Recompute a prepared setup without trusting the API: the delegate, chain,
|
|
13
|
+
* authorization hash, canonical initialization, and both call forms. Throws
|
|
14
|
+
* `prepared_setup_mismatch` on any difference.
|
|
15
|
+
*/
|
|
16
|
+
export declare function verifyPreparedEip7702Setup(prepared: PreparedEip7702Setup, expected?: {
|
|
17
|
+
account?: Address;
|
|
18
|
+
core?: Address;
|
|
19
|
+
}): void;
|
|
20
|
+
/**
|
|
21
|
+
* Signs an EIP-7702 authorization for a given chain, delegate, and nonce.
|
|
22
|
+
* viem local accounts and wallet clients that support EIP-7702 satisfy it.
|
|
23
|
+
*/
|
|
24
|
+
export interface Eip7702AuthorizationSigner {
|
|
25
|
+
signAuthorization(request: {
|
|
26
|
+
chainId: number;
|
|
27
|
+
address: Address;
|
|
28
|
+
nonce: number;
|
|
29
|
+
}): Promise<{
|
|
30
|
+
r: Hex;
|
|
31
|
+
s: Hex;
|
|
32
|
+
yParity?: number | undefined;
|
|
33
|
+
v?: bigint | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
/** Signs a raw 32-byte hash with no message prefix, returning 65-byte `r || s || v`. */
|
|
37
|
+
export interface RawHashSigner {
|
|
38
|
+
sign(request: {
|
|
39
|
+
hash: Hex;
|
|
40
|
+
}): Promise<Hex>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Verify a prepared setup, collect the owner's authorization (when the EOA is
|
|
44
|
+
* not yet delegated) and initialization signature, and check both recover to
|
|
45
|
+
* the account before returning the sponsored submission body. The SDK never
|
|
46
|
+
* receives the owner key.
|
|
47
|
+
*/
|
|
48
|
+
export declare function signPreparedEip7702Setup(signers: {
|
|
49
|
+
authorization?: Eip7702AuthorizationSigner;
|
|
50
|
+
initialization: RawHashSigner;
|
|
51
|
+
}, prepared: PreparedEip7702Setup, expected?: {
|
|
52
|
+
account?: Address;
|
|
53
|
+
core?: Address;
|
|
54
|
+
}): Promise<SubmitEip7702SetupInput>;
|
|
55
|
+
/**
|
|
56
|
+
* The setup for a wallet that sends type-4 transactions itself: it signs the
|
|
57
|
+
* authorization for `authorization.nonce` (the account nonce plus one, because
|
|
58
|
+
* the sender's nonce increments first) and sends `data` to its own address.
|
|
59
|
+
*/
|
|
60
|
+
export declare function selfSentEip7702Setup(prepared: PreparedEip7702Setup, expected?: {
|
|
61
|
+
account?: Address;
|
|
62
|
+
core?: Address;
|
|
63
|
+
}): {
|
|
64
|
+
to: Address;
|
|
65
|
+
data: Hex;
|
|
66
|
+
value: 0n;
|
|
67
|
+
authorization: null | {
|
|
68
|
+
chainId: number;
|
|
69
|
+
address: Address;
|
|
70
|
+
nonce: number;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=eip7702.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eip7702.d.ts","sourceRoot":"","sources":["../src/eip7702.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,OAAO,EACZ,KAAK,GAAG,EACT,MAAM,MAAM,CAAC;AAId,OAAO,KAAK,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAShF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,GAAG,CAgBnD;AAED,qGAAqG;AACrG,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,GAAG,CAS7E;AAKD;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,oBAAoB,EAC9B,QAAQ,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,IAAI,CAgDN;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,iBAAiB,CAAC,OAAO,EAAE;QACzB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,OAAO,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC;QACV,CAAC,EAAE,GAAG,CAAC;QACP,CAAC,EAAE,GAAG,CAAC;QACP,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KACxB,CAAC,CAAC;CACJ;AAED,wFAAwF;AACxF,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,GAAG,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CAC5C;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE;IACP,aAAa,CAAC,EAAE,0BAA0B,CAAC;IAC3C,cAAc,EAAE,aAAa,CAAC;CAC/B,EACD,QAAQ,EAAE,oBAAoB,EAC9B,QAAQ,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,OAAO,CAAC,uBAAuB,CAAC,CAsDlC;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,oBAAoB,EAC9B,QAAQ,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD;IACD,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,EAAE,CAAC;IACV,aAAa,EAAE,IAAI,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5E,CAcA"}
|
package/dist/eip7702.js
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { encodeAbiParameters, encodeFunctionData, getAddress, keccak256, parseAbi, recoverAddress, } from "viem";
|
|
2
|
+
import { hashAuthorization, recoverAuthorizationAddress } from "viem/utils";
|
|
3
|
+
import { BASE_SEPOLIA_CHAIN_ID } from "./account-dialects.js";
|
|
4
|
+
import { NEXUS_133_BOOTSTRAP, NEXUS_133_DELEGATE } from "./v3.js";
|
|
5
|
+
const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
6
|
+
const bootstrapAbi = parseAbi([
|
|
7
|
+
"function initNexus((address module,bytes data)[] validators,(address module,bytes data)[] executors,(address module,bytes data) hook,(address module,bytes data)[] fallbacks,(uint256 hookType,address module,bytes data)[] preValidationHooks)",
|
|
8
|
+
]);
|
|
9
|
+
const nexusAbi = parseAbi(["function initializeAccount(bytes initData)"]);
|
|
10
|
+
/**
|
|
11
|
+
* The canonical Nexus 1.3.3 initialization of a `nexus7702` account
|
|
12
|
+
* (encoding section 6.4): no validator, the version 3 core as the only
|
|
13
|
+
* executor, and no hook, fallback, or pre-validation hook.
|
|
14
|
+
*/
|
|
15
|
+
export function nexus133InitData(core) {
|
|
16
|
+
const bootstrapCall = encodeFunctionData({
|
|
17
|
+
abi: bootstrapAbi,
|
|
18
|
+
functionName: "initNexus",
|
|
19
|
+
args: [
|
|
20
|
+
[],
|
|
21
|
+
[{ module: getAddress(core), data: "0x" }],
|
|
22
|
+
{ module: ZERO_ADDRESS, data: "0x" },
|
|
23
|
+
[],
|
|
24
|
+
[],
|
|
25
|
+
],
|
|
26
|
+
});
|
|
27
|
+
return encodeAbiParameters([{ type: "address" }, { type: "bytes" }], [NEXUS_133_BOOTSTRAP, bootstrapCall]);
|
|
28
|
+
}
|
|
29
|
+
/** `keccak256(0x05 || rlp([chainId, address, nonce]))` for the reviewed delegate on Base Sepolia. */
|
|
30
|
+
export function eip7702AuthorizationHash(nonce) {
|
|
31
|
+
const value = BigInt(nonce);
|
|
32
|
+
if (value < 0n || value > BigInt(Number.MAX_SAFE_INTEGER))
|
|
33
|
+
throw new Error("invalid_authorization_nonce");
|
|
34
|
+
return hashAuthorization({
|
|
35
|
+
chainId: BASE_SEPOLIA_CHAIN_ID,
|
|
36
|
+
address: NEXUS_133_DELEGATE,
|
|
37
|
+
nonce: Number(value),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const eq = (a, b) => String(a).toLowerCase() === String(b).toLowerCase();
|
|
41
|
+
/**
|
|
42
|
+
* Recompute a prepared setup without trusting the API: the delegate, chain,
|
|
43
|
+
* authorization hash, canonical initialization, and both call forms. Throws
|
|
44
|
+
* `prepared_setup_mismatch` on any difference.
|
|
45
|
+
*/
|
|
46
|
+
export function verifyPreparedEip7702Setup(prepared, expected = {}) {
|
|
47
|
+
const fail = (what) => {
|
|
48
|
+
throw new Error(`prepared_setup_mismatch: ${what}`);
|
|
49
|
+
};
|
|
50
|
+
const account = getAddress(prepared.account);
|
|
51
|
+
const core = getAddress(prepared.core);
|
|
52
|
+
if (prepared.chainId !== BASE_SEPOLIA_CHAIN_ID)
|
|
53
|
+
fail("chain");
|
|
54
|
+
if (expected.account && !eq(expected.account, account))
|
|
55
|
+
fail("account");
|
|
56
|
+
if (expected.core && !eq(expected.core, core))
|
|
57
|
+
fail("core");
|
|
58
|
+
if (!eq(prepared.delegate, NEXUS_133_DELEGATE) ||
|
|
59
|
+
!eq(prepared.bootstrap, NEXUS_133_BOOTSTRAP))
|
|
60
|
+
fail("delegate");
|
|
61
|
+
const initData = nexus133InitData(core);
|
|
62
|
+
if (!eq(prepared.initData, initData) ||
|
|
63
|
+
!eq(prepared.initDataHash, keccak256(initData)))
|
|
64
|
+
fail("initialization");
|
|
65
|
+
if (!eq(prepared.relayedCall.to, account) ||
|
|
66
|
+
prepared.relayedCall.functionName !== "initializeAccount" ||
|
|
67
|
+
!eq(prepared.selfSentCall.to, account) ||
|
|
68
|
+
!eq(prepared.selfSentCall.data, encodeFunctionData({
|
|
69
|
+
abi: nexusAbi,
|
|
70
|
+
functionName: "initializeAccount",
|
|
71
|
+
args: [initData],
|
|
72
|
+
})))
|
|
73
|
+
fail("calls");
|
|
74
|
+
const authorization = prepared.authorization;
|
|
75
|
+
if (prepared.delegation === "none") {
|
|
76
|
+
if (!authorization)
|
|
77
|
+
fail("authorization missing");
|
|
78
|
+
const nonce = BigInt(authorization.nonce);
|
|
79
|
+
if (authorization.chainId !== BASE_SEPOLIA_CHAIN_ID ||
|
|
80
|
+
!eq(authorization.address, NEXUS_133_DELEGATE) ||
|
|
81
|
+
!eq(authorization.hash, eip7702AuthorizationHash(nonce)) ||
|
|
82
|
+
BigInt(authorization.selfSentNonce) !== nonce + 1n)
|
|
83
|
+
fail("authorization");
|
|
84
|
+
}
|
|
85
|
+
else if (prepared.delegation === "reviewed_uninitialized") {
|
|
86
|
+
if (authorization !== null)
|
|
87
|
+
fail("unexpected authorization");
|
|
88
|
+
}
|
|
89
|
+
else
|
|
90
|
+
fail("delegation state");
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Verify a prepared setup, collect the owner's authorization (when the EOA is
|
|
94
|
+
* not yet delegated) and initialization signature, and check both recover to
|
|
95
|
+
* the account before returning the sponsored submission body. The SDK never
|
|
96
|
+
* receives the owner key.
|
|
97
|
+
*/
|
|
98
|
+
export async function signPreparedEip7702Setup(signers, prepared, expected = {}) {
|
|
99
|
+
verifyPreparedEip7702Setup(prepared, expected);
|
|
100
|
+
const account = getAddress(prepared.account);
|
|
101
|
+
let authorization = null;
|
|
102
|
+
if (prepared.authorization) {
|
|
103
|
+
if (!signers.authorization)
|
|
104
|
+
throw new Error("eip7702_authorization_signer_required");
|
|
105
|
+
const nonce = Number(BigInt(prepared.authorization.nonce));
|
|
106
|
+
const signed = await signers.authorization.signAuthorization({
|
|
107
|
+
chainId: BASE_SEPOLIA_CHAIN_ID,
|
|
108
|
+
address: NEXUS_133_DELEGATE,
|
|
109
|
+
nonce,
|
|
110
|
+
});
|
|
111
|
+
const yParity = signed.yParity ??
|
|
112
|
+
(signed.v === 27n || signed.v === 0n
|
|
113
|
+
? 0
|
|
114
|
+
: signed.v === 28n || signed.v === 1n
|
|
115
|
+
? 1
|
|
116
|
+
: undefined);
|
|
117
|
+
if (yParity !== 0 && yParity !== 1)
|
|
118
|
+
throw new Error("invalid_eip7702_authorization");
|
|
119
|
+
const recovered = await recoverAuthorizationAddress({
|
|
120
|
+
authorization: {
|
|
121
|
+
chainId: BASE_SEPOLIA_CHAIN_ID,
|
|
122
|
+
address: NEXUS_133_DELEGATE,
|
|
123
|
+
nonce,
|
|
124
|
+
r: signed.r,
|
|
125
|
+
s: signed.s,
|
|
126
|
+
yParity,
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
if (!eq(recovered, account))
|
|
130
|
+
throw new Error("eip7702_authorization_signer_mismatch");
|
|
131
|
+
authorization = {
|
|
132
|
+
chainId: BASE_SEPOLIA_CHAIN_ID,
|
|
133
|
+
address: NEXUS_133_DELEGATE,
|
|
134
|
+
nonce: prepared.authorization.nonce,
|
|
135
|
+
yParity,
|
|
136
|
+
r: signed.r,
|
|
137
|
+
s: signed.s,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
const initSignature = await signers.initialization.sign({
|
|
141
|
+
hash: prepared.initDataHash,
|
|
142
|
+
});
|
|
143
|
+
if (!/^0x[0-9a-fA-F]{130}$/.test(initSignature))
|
|
144
|
+
throw new Error("invalid_initialization_signature");
|
|
145
|
+
const signer = await recoverAddress({
|
|
146
|
+
hash: prepared.initDataHash,
|
|
147
|
+
signature: initSignature,
|
|
148
|
+
});
|
|
149
|
+
if (!eq(signer, account))
|
|
150
|
+
throw new Error("initialization_signer_mismatch");
|
|
151
|
+
return { authorization, initSignature };
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* The setup for a wallet that sends type-4 transactions itself: it signs the
|
|
155
|
+
* authorization for `authorization.nonce` (the account nonce plus one, because
|
|
156
|
+
* the sender's nonce increments first) and sends `data` to its own address.
|
|
157
|
+
*/
|
|
158
|
+
export function selfSentEip7702Setup(prepared, expected = {}) {
|
|
159
|
+
verifyPreparedEip7702Setup(prepared, expected);
|
|
160
|
+
return {
|
|
161
|
+
to: getAddress(prepared.account),
|
|
162
|
+
data: prepared.selfSentCall.data,
|
|
163
|
+
value: 0n,
|
|
164
|
+
authorization: prepared.authorization
|
|
165
|
+
? {
|
|
166
|
+
chainId: BASE_SEPOLIA_CHAIN_ID,
|
|
167
|
+
address: NEXUS_133_DELEGATE,
|
|
168
|
+
nonce: Number(BigInt(prepared.authorization.selfSentNonce)),
|
|
169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,UAAU,oBAAoB,CAClC,QAA8B,EAC9B,WAAkD,EAAE;IAOpD,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/C,OAAO;QACL,EAAE,EAAE,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC;QAChC,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,IAAW;QACvC,KAAK,EAAE,EAAE;QACT,aAAa,EAAE,QAAQ,CAAC,aAAa;YACnC,CAAC,CAAC;gBACE,OAAO,EAAE,qBAAqB;gBAC9B,OAAO,EAAE,kBAAkB;gBAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;aAC5D;YACH,CAAC,CAAC,IAAI;KACT,CAAC;AACJ,CAAC"}
|
package/dist/gas-approval.d.ts
CHANGED
|
@@ -23,9 +23,13 @@ export interface OwnerGasPolicy {
|
|
|
23
23
|
projectId: Hex;
|
|
24
24
|
accountProfileId: Hex;
|
|
25
25
|
installEpoch: bigint;
|
|
26
|
-
/**
|
|
26
|
+
/** Formula version 2 supports native ETH only. */
|
|
27
27
|
feeAsset: Address;
|
|
28
|
+
/** The only address that may send an inline-settled action under this policy. */
|
|
29
|
+
submitter: Address;
|
|
30
|
+
/** The address the account reimburses. */
|
|
28
31
|
recipient: Address;
|
|
32
|
+
/** Signs revert claims; zero unless the revert bit is set. */
|
|
29
33
|
attester: Address;
|
|
30
34
|
maxPerAction: bigint;
|
|
31
35
|
maxTotal: bigint;
|
|
@@ -46,6 +50,7 @@ export interface CombinedGasApproval {
|
|
|
46
50
|
core: Address;
|
|
47
51
|
projectId: Hex;
|
|
48
52
|
agent: Address;
|
|
53
|
+
submitter: Address;
|
|
49
54
|
recipient: Address;
|
|
50
55
|
attester: Address;
|
|
51
56
|
feeAsset: Address;
|
|
@@ -67,9 +72,9 @@ export interface PreparedGasRevocation {
|
|
|
67
72
|
}
|
|
68
73
|
export declare function hashGasMandate(terms: GasMandateTerms, chainId: number, core: Address): Hex;
|
|
69
74
|
export declare function hashOwnerGasPolicy(policy: OwnerGasPolicy, chainId: number, core: Address): Hex;
|
|
70
|
-
/**
|
|
75
|
+
/** The combined owner commitment under the version 3 domain. */
|
|
71
76
|
export declare function hashCombinedGasApproval(mandateId: Hex, gasPolicyId: Hex, chainId: number, core: Address): Hex;
|
|
72
|
-
/**
|
|
77
|
+
/** The owner's gas-policy revocation under the version 3 domain. */
|
|
73
78
|
export declare function hashGasRevocation(gasPolicyId: Hex, nonce: bigint, deadline: number, chainId: number, core: Address): Hex;
|
|
74
79
|
/** Prepare one owner signature after the account installation has been verified. */
|
|
75
80
|
export declare function prepareCombinedGasApproval(client: Pick<PublicClient, "getChainId" | "getBytecode" | "getStorageAt" | "readContract">, family: AccountFamily, chainId: number, core: Address, terms: GasMandateTerms, mandatePolicy: Hex, gasPolicy: OwnerGasPolicy): Promise<CombinedGasApproval>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas-approval.d.ts","sourceRoot":"","sources":["../src/gas-approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAEd,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"gas-approval.d.ts","sourceRoot":"","sources":["../src/gas-approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAEd,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAkC/B,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,gBAAgB,EAAE,GAAG,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB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