@goodwidget/ai-credits-widget 0.1.5 → 0.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/README.md +1 -1
- package/dist/chunk-635NKGPL.js +6815 -0
- package/dist/chunk-635NKGPL.js.map +1 -0
- package/dist/{chunk-YIXMIOVW.js → chunk-QNDSSO77.js} +1 -1
- package/dist/element.cjs +3481 -1262
- package/dist/element.cjs.map +1 -1
- package/dist/element.js +1 -1
- package/dist/index.cjs +3500 -1261
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -4
- package/dist/index.d.ts +42 -4
- package/dist/index.js +22 -2
- package/dist/mocked/index.cjs +3539 -1298
- package/dist/mocked/index.cjs.map +1 -1
- package/dist/mocked/index.d.cts +13 -5
- package/dist/mocked/index.d.ts +13 -5
- package/dist/mocked/index.js +46 -24
- package/dist/mocked/index.js.map +1 -1
- package/dist/register.cjs +3589 -1324
- package/dist/register.cjs.map +1 -1
- package/dist/{widgetRuntimeContract-BPILUGC4.d.cts → widgetRuntimeContract-Bcb5Ej6O.d.cts} +142 -29
- package/dist/{widgetRuntimeContract-BPILUGC4.d.ts → widgetRuntimeContract-Bcb5Ej6O.d.ts} +142 -29
- package/package.json +6 -1
- package/dist/chunk-5ABKU4SW.js +0 -4518
- package/dist/chunk-5ABKU4SW.js.map +0 -1
- /package/dist/{chunk-YIXMIOVW.js.map → chunk-QNDSSO77.js.map} +0 -0
package/dist/mocked/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { g as AiCreditsWidgetProps, c as AiCreditsBackendClient, s as DiscountConfig, z as AccountCreditResponse,
|
|
2
|
+
import { g as AiCreditsWidgetProps, c as AiCreditsBackendClient, s as DiscountConfig, z as AccountCreditResponse, B as CreditHistoryQuery, F as CreditHistoryResponse, T as TransactionsResponse, e as AccountRef, H as CeloEventsRecordResponse, I as SettlementResult, J as ChannelOperationResponse, W as WithdrawPrincipalRequest, K as WithdrawPrincipalResponse, O as OperatorConsentResponse, L as OperatorRevokeResponse, d as AiCreditsChainClient, j as AiCreditsQuote, S as SignerOperatorStatus, M as OperatorConsentPayloadResponse } from '../widgetRuntimeContract-Bcb5Ej6O.cjs';
|
|
3
3
|
import 'viem';
|
|
4
4
|
import '@goodwidget/ui';
|
|
5
5
|
|
|
@@ -27,8 +27,15 @@ declare class MockAiCreditsBackendClient implements AiCreditsBackendClient {
|
|
|
27
27
|
notifyPayment(txHash: string): Promise<CeloEventsRecordResponse>;
|
|
28
28
|
waitForSettlement(ref: AccountRef): Promise<SettlementResult>;
|
|
29
29
|
closeChannel(channelId: string): Promise<ChannelOperationResponse>;
|
|
30
|
-
withdrawCredits(
|
|
31
|
-
submitOperatorConsent(
|
|
30
|
+
withdrawCredits(signer: string, body: WithdrawPrincipalRequest): Promise<WithdrawPrincipalResponse>;
|
|
31
|
+
submitOperatorConsent(signer: string, {}: {
|
|
32
|
+
nonce: string;
|
|
33
|
+
signature: string;
|
|
34
|
+
}): Promise<OperatorConsentResponse>;
|
|
35
|
+
revokeOperatorConsent(signer: string, {}: {
|
|
36
|
+
nonce: string;
|
|
37
|
+
signature: string;
|
|
38
|
+
}): Promise<OperatorRevokeResponse>;
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
declare class MockAiCreditsChainClient implements AiCreditsChainClient {
|
|
@@ -43,9 +50,10 @@ declare class MockAiCreditsChainClient implements AiCreditsChainClient {
|
|
|
43
50
|
isGoodIdVerified(): Promise<boolean>;
|
|
44
51
|
fetchGdUsdPerToken(): Promise<number>;
|
|
45
52
|
buildQuote(depositG: string, streamG: string): Promise<AiCreditsQuote>;
|
|
46
|
-
|
|
47
|
-
buildOperatorConsentPayload(ref: AccountRef, operatorStatus?:
|
|
53
|
+
getSignerOperatorStatus(ref: AccountRef): Promise<SignerOperatorStatus>;
|
|
54
|
+
buildOperatorConsentPayload(ref: AccountRef, operatorStatus?: SignerOperatorStatus): Promise<OperatorConsentPayloadResponse>;
|
|
48
55
|
getWithdrawableUsd(): Promise<string>;
|
|
56
|
+
getSignerAuthNonce(): Promise<bigint>;
|
|
49
57
|
}
|
|
50
58
|
|
|
51
59
|
export { MockAiCreditsBackendClient, MockAiCreditsChainClient, MockAiCreditsWidget };
|
package/dist/mocked/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { g as AiCreditsWidgetProps, c as AiCreditsBackendClient, s as DiscountConfig, z as AccountCreditResponse,
|
|
2
|
+
import { g as AiCreditsWidgetProps, c as AiCreditsBackendClient, s as DiscountConfig, z as AccountCreditResponse, B as CreditHistoryQuery, F as CreditHistoryResponse, T as TransactionsResponse, e as AccountRef, H as CeloEventsRecordResponse, I as SettlementResult, J as ChannelOperationResponse, W as WithdrawPrincipalRequest, K as WithdrawPrincipalResponse, O as OperatorConsentResponse, L as OperatorRevokeResponse, d as AiCreditsChainClient, j as AiCreditsQuote, S as SignerOperatorStatus, M as OperatorConsentPayloadResponse } from '../widgetRuntimeContract-Bcb5Ej6O.js';
|
|
3
3
|
import 'viem';
|
|
4
4
|
import '@goodwidget/ui';
|
|
5
5
|
|
|
@@ -27,8 +27,15 @@ declare class MockAiCreditsBackendClient implements AiCreditsBackendClient {
|
|
|
27
27
|
notifyPayment(txHash: string): Promise<CeloEventsRecordResponse>;
|
|
28
28
|
waitForSettlement(ref: AccountRef): Promise<SettlementResult>;
|
|
29
29
|
closeChannel(channelId: string): Promise<ChannelOperationResponse>;
|
|
30
|
-
withdrawCredits(
|
|
31
|
-
submitOperatorConsent(
|
|
30
|
+
withdrawCredits(signer: string, body: WithdrawPrincipalRequest): Promise<WithdrawPrincipalResponse>;
|
|
31
|
+
submitOperatorConsent(signer: string, {}: {
|
|
32
|
+
nonce: string;
|
|
33
|
+
signature: string;
|
|
34
|
+
}): Promise<OperatorConsentResponse>;
|
|
35
|
+
revokeOperatorConsent(signer: string, {}: {
|
|
36
|
+
nonce: string;
|
|
37
|
+
signature: string;
|
|
38
|
+
}): Promise<OperatorRevokeResponse>;
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
declare class MockAiCreditsChainClient implements AiCreditsChainClient {
|
|
@@ -43,9 +50,10 @@ declare class MockAiCreditsChainClient implements AiCreditsChainClient {
|
|
|
43
50
|
isGoodIdVerified(): Promise<boolean>;
|
|
44
51
|
fetchGdUsdPerToken(): Promise<number>;
|
|
45
52
|
buildQuote(depositG: string, streamG: string): Promise<AiCreditsQuote>;
|
|
46
|
-
|
|
47
|
-
buildOperatorConsentPayload(ref: AccountRef, operatorStatus?:
|
|
53
|
+
getSignerOperatorStatus(ref: AccountRef): Promise<SignerOperatorStatus>;
|
|
54
|
+
buildOperatorConsentPayload(ref: AccountRef, operatorStatus?: SignerOperatorStatus): Promise<OperatorConsentPayloadResponse>;
|
|
48
55
|
getWithdrawableUsd(): Promise<string>;
|
|
56
|
+
getSignerAuthNonce(): Promise<bigint>;
|
|
49
57
|
}
|
|
50
58
|
|
|
51
59
|
export { MockAiCreditsBackendClient, MockAiCreditsChainClient, MockAiCreditsWidget };
|
package/dist/mocked/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-QNDSSO77.js";
|
|
2
2
|
import {
|
|
3
3
|
ANTSEED_DEPOSITS_BASE_ADDRESS,
|
|
4
4
|
AiCreditsWidget,
|
|
@@ -7,18 +7,26 @@ import {
|
|
|
7
7
|
buildQuoteAmounts,
|
|
8
8
|
buildSetOperatorPayload,
|
|
9
9
|
totalCreditUsdFromProfile
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-635NKGPL.js";
|
|
11
11
|
|
|
12
12
|
// src/mocked/AiCreditsMockWidget.tsx
|
|
13
13
|
import { useMemo } from "react";
|
|
14
14
|
|
|
15
15
|
// src/mocked/chainClient.ts
|
|
16
|
-
var
|
|
16
|
+
var mockOperatorAcceptedSigners = /* @__PURE__ */ new Set();
|
|
17
|
+
var mockOperatorRevokedSigners = /* @__PURE__ */ new Set();
|
|
17
18
|
function normalizeAddress(address) {
|
|
18
19
|
return address.toLowerCase();
|
|
19
20
|
}
|
|
20
|
-
function markMockOperatorConsent(
|
|
21
|
-
|
|
21
|
+
function markMockOperatorConsent(signer) {
|
|
22
|
+
const normalized = normalizeAddress(signer);
|
|
23
|
+
mockOperatorRevokedSigners.delete(normalized);
|
|
24
|
+
mockOperatorAcceptedSigners.add(normalized);
|
|
25
|
+
}
|
|
26
|
+
function clearMockOperatorConsent(signer) {
|
|
27
|
+
const normalized = normalizeAddress(signer);
|
|
28
|
+
mockOperatorAcceptedSigners.delete(normalized);
|
|
29
|
+
mockOperatorRevokedSigners.add(normalized);
|
|
22
30
|
}
|
|
23
31
|
var MockAiCreditsChainClient = class {
|
|
24
32
|
operatorAccepted;
|
|
@@ -38,15 +46,15 @@ var MockAiCreditsChainClient = class {
|
|
|
38
46
|
async buildQuote(depositG, streamG) {
|
|
39
47
|
return buildQuoteAmounts(depositG, streamG);
|
|
40
48
|
}
|
|
41
|
-
async
|
|
49
|
+
async getSignerOperatorStatus(ref) {
|
|
42
50
|
const payer = normalizeAddress(ref.payer);
|
|
43
|
-
const
|
|
51
|
+
const signer = normalizeAddress(ref.signer);
|
|
44
52
|
const operatorAddress = "0x0000000000000000000000000000000000000004";
|
|
45
|
-
const operatorAccepted = this.operatorAccepted ||
|
|
53
|
+
const operatorAccepted = !mockOperatorRevokedSigners.has(signer) && (this.operatorAccepted || mockOperatorAcceptedSigners.has(signer));
|
|
46
54
|
return {
|
|
47
55
|
enabled: true,
|
|
48
56
|
account: payer,
|
|
49
|
-
|
|
57
|
+
signerAddress: signer,
|
|
50
58
|
operatorAddress,
|
|
51
59
|
currentOperator: operatorAccepted ? operatorAddress : "0x0000000000000000000000000000000000000000",
|
|
52
60
|
operatorAccepted,
|
|
@@ -54,18 +62,18 @@ var MockAiCreditsChainClient = class {
|
|
|
54
62
|
};
|
|
55
63
|
}
|
|
56
64
|
async buildOperatorConsentPayload(ref, operatorStatus) {
|
|
57
|
-
const status = operatorStatus ?? await this.
|
|
65
|
+
const status = operatorStatus ?? await this.getSignerOperatorStatus(ref);
|
|
58
66
|
if (!status.enabled || !status.operatorAddress) {
|
|
59
67
|
return {
|
|
60
68
|
enabled: false,
|
|
61
69
|
account: normalizeAddress(ref.payer),
|
|
62
|
-
|
|
70
|
+
signerAddress: normalizeAddress(ref.signer)
|
|
63
71
|
};
|
|
64
72
|
}
|
|
65
73
|
return {
|
|
66
74
|
enabled: true,
|
|
67
75
|
account: normalizeAddress(ref.payer),
|
|
68
|
-
|
|
76
|
+
signerAddress: normalizeAddress(ref.signer),
|
|
69
77
|
typedData: buildSetOperatorPayload(
|
|
70
78
|
BASE_CHAIN_ID,
|
|
71
79
|
ANTSEED_DEPOSITS_BASE_ADDRESS,
|
|
@@ -78,6 +86,9 @@ var MockAiCreditsChainClient = class {
|
|
|
78
86
|
async getWithdrawableUsd() {
|
|
79
87
|
return "0";
|
|
80
88
|
}
|
|
89
|
+
async getSignerAuthNonce() {
|
|
90
|
+
return 0n;
|
|
91
|
+
}
|
|
81
92
|
};
|
|
82
93
|
|
|
83
94
|
// src/mocked/backendClient.ts
|
|
@@ -133,7 +144,7 @@ function createDemoHistory(account) {
|
|
|
133
144
|
logIndex: 0,
|
|
134
145
|
createdAt: "2026-06-25T14:30:00.000Z",
|
|
135
146
|
streamUpdateMonth: "2026-06",
|
|
136
|
-
|
|
147
|
+
signerAddress: normalized
|
|
137
148
|
},
|
|
138
149
|
{
|
|
139
150
|
id: "demo-stream-update-1",
|
|
@@ -149,7 +160,7 @@ function createDemoHistory(account) {
|
|
|
149
160
|
logIndex: 0,
|
|
150
161
|
createdAt: "2026-06-24T12:00:00.000Z",
|
|
151
162
|
streamUpdateMonth: "2026-06",
|
|
152
|
-
|
|
163
|
+
signerAddress: normalized
|
|
153
164
|
},
|
|
154
165
|
{
|
|
155
166
|
id: "demo-stream-request-1",
|
|
@@ -165,7 +176,7 @@ function createDemoHistory(account) {
|
|
|
165
176
|
logIndex: 0,
|
|
166
177
|
createdAt: "2026-06-23T09:15:00.000Z",
|
|
167
178
|
streamUpdateMonth: "2026-06",
|
|
168
|
-
|
|
179
|
+
signerAddress: normalized
|
|
169
180
|
},
|
|
170
181
|
{
|
|
171
182
|
id: "demo-stream-cron-1",
|
|
@@ -179,7 +190,7 @@ function createDemoHistory(account) {
|
|
|
179
190
|
fundingStatus: "funded",
|
|
180
191
|
createdAt: "2026-06-22T08:00:00.000Z",
|
|
181
192
|
streamUpdateMonth: "2026-06",
|
|
182
|
-
|
|
193
|
+
signerAddress: normalized
|
|
183
194
|
}
|
|
184
195
|
];
|
|
185
196
|
}
|
|
@@ -248,7 +259,7 @@ var MockAiCreditsBackendClient = class {
|
|
|
248
259
|
return { account: history.account, transactions: history.items };
|
|
249
260
|
}
|
|
250
261
|
prepareSettlement(ref, creditUsd) {
|
|
251
|
-
this.activeRef = { payer: normalizeAddress2(ref.payer),
|
|
262
|
+
this.activeRef = { payer: normalizeAddress2(ref.payer), signer: normalizeAddress2(ref.signer) };
|
|
252
263
|
this.lastCreditUsd = creditUsd;
|
|
253
264
|
}
|
|
254
265
|
async notifyPayment(txHash) {
|
|
@@ -270,7 +281,7 @@ var MockAiCreditsBackendClient = class {
|
|
|
270
281
|
logIndex: 0,
|
|
271
282
|
createdAt: now,
|
|
272
283
|
streamUpdateMonth: now.slice(0, 7),
|
|
273
|
-
|
|
284
|
+
signerAddress: ref.signer
|
|
274
285
|
};
|
|
275
286
|
const state = this.getState(ref.payer);
|
|
276
287
|
if (!state.transactions.find((item) => item.id === entry.id)) state.transactions.unshift(entry);
|
|
@@ -291,15 +302,26 @@ var MockAiCreditsBackendClient = class {
|
|
|
291
302
|
await sleep(MOCK_DELAY_MS);
|
|
292
303
|
return { channelId, action: "close", bridge: { enabled: true, txHash: "0xmock" } };
|
|
293
304
|
}
|
|
294
|
-
async withdrawCredits(
|
|
305
|
+
async withdrawCredits(signer, body) {
|
|
306
|
+
await sleep(MOCK_DELAY_MS);
|
|
307
|
+
return { account: signer, amountUsd: body.amount, bridge: { enabled: true, txHash: "0xmock" } };
|
|
308
|
+
}
|
|
309
|
+
async submitOperatorConsent(signer, {}) {
|
|
295
310
|
await sleep(MOCK_DELAY_MS);
|
|
296
|
-
|
|
311
|
+
const normalizedSigner = normalizeAddress2(signer);
|
|
312
|
+
markMockOperatorConsent(normalizedSigner);
|
|
313
|
+
return {
|
|
314
|
+
signer: normalizedSigner,
|
|
315
|
+
bridge: { enabled: true, txHash: "0xmock" }
|
|
316
|
+
};
|
|
297
317
|
}
|
|
298
|
-
async
|
|
318
|
+
async revokeOperatorConsent(signer, {}) {
|
|
299
319
|
await sleep(MOCK_DELAY_MS);
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
320
|
+
clearMockOperatorConsent(normalizeAddress2(signer));
|
|
321
|
+
return {
|
|
322
|
+
signer: normalizeAddress2(signer),
|
|
323
|
+
bridge: { enabled: true, txHash: "0xmock" }
|
|
324
|
+
};
|
|
303
325
|
}
|
|
304
326
|
};
|
|
305
327
|
|
package/dist/mocked/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mocked/AiCreditsMockWidget.tsx","../../src/mocked/chainClient.ts","../../src/mocked/backendClient.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { AiCreditsWidget, type AiCreditsWidgetProps } from '..'\nimport { MockAiCreditsBackendClient } from './backendClient'\nimport { MockAiCreditsChainClient } from './chainClient'\n\nexport function MockAiCreditsWidget(props: Omit<AiCreditsWidgetProps, 'adapterOptions' | 'environment'>) {\n const backendClient = useMemo(() => new MockAiCreditsBackendClient(), [])\n const chainClient = useMemo(() => new MockAiCreditsChainClient(), [])\n\n return (\n <AiCreditsWidget\n {...props}\n environment=\"development\"\n adapterOptions={{\n backendClient,\n chainClient,\n skipVaultPaymentValidation: true,\n prepareSettlement: (ref, creditUsd) => backendClient.prepareSettlement(ref, creditUsd),\n }}\n />\n )\n}\n","import type { AccountRef } from '../backendTypes'\nimport { BASE_CHAIN_ID, type AiCreditsChainClient } from '../chainClient'\nimport { ANTSEED_DEPOSITS_BASE_ADDRESS, buildSetOperatorPayload } from '../operatorConsent'\nimport { buildQuoteAmounts } from '../quoteMath'\nimport type { BuyerOperatorStatus, OperatorConsentPayloadResponse } from '../operatorConsent'\nimport type { AiCreditsQuote } from '../widgetRuntimeContract'\n\nconst mockOperatorAcceptedBuyers = new Set<string>()\n\nfunction normalizeAddress(address: string): string {\n return address.toLowerCase()\n}\n\nexport function markMockOperatorConsent(buyer: string): void {\n mockOperatorAcceptedBuyers.add(normalizeAddress(buyer))\n}\n\nexport class MockAiCreditsChainClient implements AiCreditsChainClient {\n private operatorAccepted: boolean\n private readonly gdUsdPerToken: number\n private readonly goodIdVerified: boolean\n\n constructor(\n options: { operatorAccepted?: boolean; gdUsdPerToken?: number; goodIdVerified?: boolean } = {},\n ) {\n this.operatorAccepted = options.operatorAccepted ?? false\n this.gdUsdPerToken = options.gdUsdPerToken ?? 0.0015\n this.goodIdVerified = options.goodIdVerified ?? false\n }\n\n async isGoodIdVerified(): Promise<boolean> {\n return this.goodIdVerified\n }\n\n async fetchGdUsdPerToken(): Promise<number> {\n return this.gdUsdPerToken\n }\n\n async buildQuote(depositG: string, streamG: string): Promise<AiCreditsQuote> {\n return buildQuoteAmounts(depositG, streamG)\n }\n\n async getBuyerOperatorStatus(ref: AccountRef): Promise<BuyerOperatorStatus> {\n const payer = normalizeAddress(ref.payer)\n const buyer = normalizeAddress(ref.buyer)\n const operatorAddress = '0x0000000000000000000000000000000000000004'\n const operatorAccepted = this.operatorAccepted || mockOperatorAcceptedBuyers.has(buyer)\n return {\n enabled: true,\n account: payer,\n buyerAddress: buyer,\n operatorAddress,\n currentOperator: operatorAccepted ? operatorAddress : '0x0000000000000000000000000000000000000000',\n operatorAccepted,\n consentNonce: '0',\n }\n }\n\n async buildOperatorConsentPayload(\n ref: AccountRef,\n operatorStatus?: BuyerOperatorStatus,\n ): Promise<OperatorConsentPayloadResponse> {\n const status = operatorStatus ?? (await this.getBuyerOperatorStatus(ref))\n if (!status.enabled || !status.operatorAddress) {\n return {\n enabled: false,\n account: normalizeAddress(ref.payer),\n buyerAddress: normalizeAddress(ref.buyer),\n }\n }\n return {\n enabled: true,\n account: normalizeAddress(ref.payer),\n buyerAddress: normalizeAddress(ref.buyer),\n typedData: buildSetOperatorPayload(\n BASE_CHAIN_ID,\n ANTSEED_DEPOSITS_BASE_ADDRESS,\n status.operatorAddress,\n BigInt(status.consentNonce),\n { name: 'AntseedDeposits', version: '1' },\n ),\n }\n }\n\n async getWithdrawableUsd(): Promise<string> {\n return '0'\n }\n}\n","import type {\n AccountCreditResponse,\n AccountRef,\n CeloEventsRecordResponse,\n ChannelOperationResponse,\n CreditHistoryQuery,\n CreditHistoryResponse,\n DiscountConfig,\n GdCreditEntry,\n OperatorConsentResponse,\n SettlementResult,\n TransactionsResponse,\n UserCreditProfile,\n WithdrawPrincipalRequest,\n WithdrawPrincipalResponse,\n} from '../backendClient'\nimport { DEFAULT_DISCOUNT_CONFIG, totalCreditUsdFromProfile } from '../backendClient'\nimport type { AiCreditsBackendClient } from '../backendClient'\nimport { markMockOperatorConsent } from './chainClient'\n\nconst MOCK_DELAY_MS = 600\nconst DEFAULT_HISTORY_LIMIT = 20\nconst MAX_HISTORY_LIMIT = 100\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\nfunction normalizeAddress(address: string): string {\n return address.toLowerCase()\n}\n\nfunction paginateGdCredits(\n entries: GdCreditEntry[],\n options: CreditHistoryQuery = {},\n): CreditHistoryResponse {\n let result = [...entries].sort((a, b) => {\n const byCreated = b.createdAt.localeCompare(a.createdAt)\n return byCreated !== 0 ? byCreated : b.id.localeCompare(a.id)\n })\n if (options.source) result = result.filter((entry) => entry.source === options.source)\n if (options.fundingStatus) result = result.filter((entry) => entry.fundingStatus === options.fundingStatus)\n if (options.from) {\n const fromMs = Date.parse(options.from)\n result = result.filter((entry) => Date.parse(entry.createdAt) >= fromMs)\n }\n if (options.to) {\n const toMs = Date.parse(options.to)\n result = result.filter((entry) => Date.parse(entry.createdAt) <= toMs)\n }\n const limit = options.limit === undefined\n ? DEFAULT_HISTORY_LIMIT\n : Math.min(Math.max(1, Math.floor(options.limit)), MAX_HISTORY_LIMIT)\n const offset = Math.max(0, Math.floor(options.offset ?? 0))\n return {\n account: '',\n items: result.slice(offset, offset + limit),\n total: result.length,\n limit,\n offset,\n hasMore: offset + limit < result.length,\n }\n}\n\nfunction createDemoHistory(account: string): GdCreditEntry[] {\n const normalized = normalizeAddress(account)\n return [\n {\n id: 'demo-deposit-1', account: normalized, rootAccount: normalized, source: 'deposit',\n gdAmountWei: '440000000000000000000', totalCreditUsd: '6600', principalUsd: '6000',\n bonusUsd: '600', fundingStatus: 'funded', txHash: '0xdemo01', logIndex: 0,\n createdAt: '2026-06-25T14:30:00.000Z', streamUpdateMonth: '2026-06', buyerAddress: normalized,\n },\n {\n id: 'demo-stream-update-1', account: normalized, rootAccount: normalized, source: 'streamUpdate',\n gdAmountWei: '10000000000000000000', totalCreditUsd: '0', principalUsd: '0',\n bonusUsd: '0', fundingStatus: 'funded', txHash: '0xdemo02', logIndex: 0,\n createdAt: '2026-06-24T12:00:00.000Z', streamUpdateMonth: '2026-06', buyerAddress: normalized,\n },\n {\n id: 'demo-stream-request-1', account: normalized, rootAccount: normalized, source: 'streamRequest',\n gdAmountWei: '8000000000000000000', totalCreditUsd: '1200', principalUsd: '1000',\n bonusUsd: '200', fundingStatus: 'pending', txHash: '0xdemo03', logIndex: 0,\n createdAt: '2026-06-23T09:15:00.000Z', streamUpdateMonth: '2026-06', buyerAddress: normalized,\n },\n {\n id: 'demo-stream-cron-1', account: normalized, rootAccount: normalized, source: 'streamCron',\n gdAmountWei: '5000000000000000000', totalCreditUsd: '900', principalUsd: '750',\n bonusUsd: '150', fundingStatus: 'funded', createdAt: '2026-06-22T08:00:00.000Z',\n streamUpdateMonth: '2026-06', buyerAddress: normalized,\n },\n ]\n}\n\nexport class MockAiCreditsBackendClient implements AiCreditsBackendClient {\n private activeRef: AccountRef | null = null\n private lastCreditUsd = 0n\n private readonly accountStates = new Map<string, {\n principalUsd: bigint\n bonusUsd: bigint\n transactions: GdCreditEntry[]\n rootAccount: string\n }>()\n\n private getState(payer: string) {\n const key = normalizeAddress(payer)\n if (!this.accountStates.has(key)) {\n this.accountStates.set(key, {\n principalUsd: 0n, bonusUsd: 0n, transactions: createDemoHistory(key), rootAccount: key,\n })\n }\n return this.accountStates.get(key)!\n }\n\n async getDiscountConfig(): Promise<DiscountConfig> {\n await sleep(MOCK_DELAY_MS)\n return { ...DEFAULT_DISCOUNT_CONFIG }\n }\n\n private buildProfile(payer: string): UserCreditProfile {\n const state = this.getState(payer)\n const now = new Date().toISOString()\n const outstanding = state.transactions\n .filter((entry) => entry.fundingStatus === 'pending' || entry.fundingStatus === 'failed')\n .reduce((sum, entry) => sum + BigInt(entry.totalCreditUsd), 0n)\n return {\n account: normalizeAddress(payer), rootAccount: state.rootAccount, createdAt: now, updatedAt: now,\n totalGdDepositedWei: '0', totalPrincipalUsd: state.principalUsd.toString(),\n totalBonusUsd: state.bonusUsd.toString(), totalGDStreamedWei: '0',\n totalOutstandingFundingUsd: outstanding.toString(), streamFlowRateWeiPerSecond: '0',\n }\n }\n\n async getAccountCredit(payer: string): Promise<AccountCreditResponse> {\n await sleep(MOCK_DELAY_MS)\n const profile = this.buildProfile(payer)\n return { account: profile.account, profile }\n }\n\n async getCreditHistory(payer: string, options: CreditHistoryQuery = {}): Promise<CreditHistoryResponse> {\n await sleep(MOCK_DELAY_MS)\n return { ...paginateGdCredits(this.getState(payer).transactions, options), account: normalizeAddress(payer) }\n }\n\n async getOutstanding(payer: string): Promise<{ outstandingFundingUsd: string; count: number }> {\n await sleep(MOCK_DELAY_MS)\n const pending = this.getState(payer).transactions.filter(\n (entry) => entry.fundingStatus === 'pending' || entry.fundingStatus === 'failed',\n )\n return {\n outstandingFundingUsd: pending.reduce((sum, entry) => sum + BigInt(entry.totalCreditUsd || '0'), 0n).toString(),\n count: pending.length,\n }\n }\n\n async getTransactions(payer: string, options: { status?: 'pending' | 'funded' | 'failed'; limit?: number; cursor?: string } = {}): Promise<TransactionsResponse> {\n const history = await this.getCreditHistory(payer, {\n fundingStatus: options.status, limit: options.limit, offset: options.cursor ? Number(options.cursor) || 0 : 0,\n })\n return { account: history.account, transactions: history.items }\n }\n\n prepareSettlement(ref: AccountRef, creditUsd: bigint): void {\n this.activeRef = { payer: normalizeAddress(ref.payer), buyer: normalizeAddress(ref.buyer) }\n this.lastCreditUsd = creditUsd\n }\n\n async notifyPayment(txHash: string): Promise<CeloEventsRecordResponse> {\n await sleep(MOCK_DELAY_MS)\n const ref = this.activeRef\n if (!ref) return { txHash, events: [] }\n const now = new Date().toISOString()\n const entry: GdCreditEntry = {\n id: `${txHash}:0`, account: ref.payer, rootAccount: ref.payer, source: 'deposit',\n gdAmountWei: '0', totalCreditUsd: this.lastCreditUsd.toString(), principalUsd: this.lastCreditUsd.toString(),\n bonusUsd: '0', fundingStatus: 'pending', txHash, logIndex: 0, createdAt: now,\n streamUpdateMonth: now.slice(0, 7), buyerAddress: ref.buyer,\n }\n const state = this.getState(ref.payer)\n if (!state.transactions.find((item) => item.id === entry.id)) state.transactions.unshift(entry)\n return { txHash, events: [entry] }\n }\n\n async waitForSettlement(ref: AccountRef): Promise<SettlementResult> {\n await sleep(MOCK_DELAY_MS)\n const state = this.getState(ref.payer)\n for (const entry of state.transactions) {\n if (entry.fundingStatus !== 'pending') continue\n entry.fundingStatus = 'funded'\n state.principalUsd += BigInt(entry.principalUsd)\n state.bonusUsd += BigInt(entry.bonusUsd)\n }\n return { totalCreditUsd: totalCreditUsdFromProfile(this.buildProfile(ref.payer)) }\n }\n\n async closeChannel(channelId: string): Promise<ChannelOperationResponse> {\n await sleep(MOCK_DELAY_MS)\n return { channelId, action: 'close', bridge: { enabled: true, txHash: '0xmock' } }\n }\n\n async withdrawCredits(buyer: string, body: WithdrawPrincipalRequest): Promise<WithdrawPrincipalResponse> {\n await sleep(MOCK_DELAY_MS)\n return { account: buyer, amountUsd: body.amount, bridge: { enabled: true, txHash: '0xmock' } }\n }\n\n async submitOperatorConsent(buyer: string): Promise<OperatorConsentResponse> {\n await sleep(MOCK_DELAY_MS)\n const normalizedBuyer = normalizeAddress(buyer)\n markMockOperatorConsent(normalizedBuyer)\n return { buyer: normalizedBuyer, bridge: { enabled: true, txHash: '0xmock' } }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,eAAe;;;ACOxB,IAAM,6BAA6B,oBAAI,IAAY;AAEnD,SAAS,iBAAiB,SAAyB;AACjD,SAAO,QAAQ,YAAY;AAC7B;AAEO,SAAS,wBAAwB,OAAqB;AAC3D,6BAA2B,IAAI,iBAAiB,KAAK,CAAC;AACxD;AAEO,IAAM,2BAAN,MAA+D;AAAA,EAC5D;AAAA,EACS;AAAA,EACA;AAAA,EAEjB,YACE,UAA4F,CAAC,GAC7F;AACA,SAAK,mBAAmB,QAAQ,oBAAoB;AACpD,SAAK,gBAAgB,QAAQ,iBAAiB;AAC9C,SAAK,iBAAiB,QAAQ,kBAAkB;AAAA,EAClD;AAAA,EAEA,MAAM,mBAAqC;AACzC,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,qBAAsC;AAC1C,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,WAAW,UAAkB,SAA0C;AAC3E,WAAO,kBAAkB,UAAU,OAAO;AAAA,EAC5C;AAAA,EAEA,MAAM,uBAAuB,KAA+C;AAC1E,UAAM,QAAQ,iBAAiB,IAAI,KAAK;AACxC,UAAM,QAAQ,iBAAiB,IAAI,KAAK;AACxC,UAAM,kBAAkB;AACxB,UAAM,mBAAmB,KAAK,oBAAoB,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AA,QACd;AAAA,QACA;AAAA,QACA,4BAA4B;AAAA,QAC5B,mBAAmB,CAAC,KAAK,cAAc,cAAc,kBAAkB,KAAK,SAAS;AAAA,MACvF;AAAA;AAAA,EACF;AAEJ;","names":["normalizeAddress"]}
|
|
1
|
+
{"version":3,"sources":["../../src/mocked/AiCreditsMockWidget.tsx","../../src/mocked/chainClient.ts","../../src/mocked/backendClient.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport { AiCreditsWidget, type AiCreditsWidgetProps } from '..'\nimport { MockAiCreditsBackendClient } from './backendClient'\nimport { MockAiCreditsChainClient } from './chainClient'\n\nexport function MockAiCreditsWidget(props: Omit<AiCreditsWidgetProps, 'adapterOptions' | 'environment'>) {\n const backendClient = useMemo(() => new MockAiCreditsBackendClient(), [])\n const chainClient = useMemo(() => new MockAiCreditsChainClient(), [])\n\n return (\n <AiCreditsWidget\n {...props}\n environment=\"development\"\n adapterOptions={{\n backendClient,\n chainClient,\n skipVaultPaymentValidation: true,\n prepareSettlement: (ref, creditUsd) => backendClient.prepareSettlement(ref, creditUsd),\n }}\n />\n )\n}\n","import type { AccountRef } from '../backendTypes'\nimport { BASE_CHAIN_ID, type AiCreditsChainClient } from '../chainClient'\nimport { ANTSEED_DEPOSITS_BASE_ADDRESS, buildSetOperatorPayload } from '../operatorConsent'\nimport { buildQuoteAmounts } from '../quoteMath'\nimport type { SignerOperatorStatus, OperatorConsentPayloadResponse } from '../operatorConsent'\nimport type { AiCreditsQuote } from '../widgetRuntimeContract'\n\nconst mockOperatorAcceptedSigners = new Set<string>()\n// Revocation has to outrank the constructor's `operatorAccepted`, otherwise a mock seeded\n// as consented could never report the withdrawal and waitForOperatorRevoke would spin.\nconst mockOperatorRevokedSigners = new Set<string>()\n\nfunction normalizeAddress(address: string): string {\n return address.toLowerCase()\n}\n\nexport function markMockOperatorConsent(signer: string): void {\n const normalized = normalizeAddress(signer)\n mockOperatorRevokedSigners.delete(normalized)\n mockOperatorAcceptedSigners.add(normalized)\n}\n\nexport function clearMockOperatorConsent(signer: string): void {\n const normalized = normalizeAddress(signer)\n mockOperatorAcceptedSigners.delete(normalized)\n mockOperatorRevokedSigners.add(normalized)\n}\n\nexport class MockAiCreditsChainClient implements AiCreditsChainClient {\n private operatorAccepted: boolean\n private readonly gdUsdPerToken: number\n private readonly goodIdVerified: boolean\n\n constructor(\n options: { operatorAccepted?: boolean; gdUsdPerToken?: number; goodIdVerified?: boolean } = {},\n ) {\n this.operatorAccepted = options.operatorAccepted ?? false\n this.gdUsdPerToken = options.gdUsdPerToken ?? 0.0015\n this.goodIdVerified = options.goodIdVerified ?? false\n }\n\n async isGoodIdVerified(): Promise<boolean> {\n return this.goodIdVerified\n }\n\n async fetchGdUsdPerToken(): Promise<number> {\n return this.gdUsdPerToken\n }\n\n async buildQuote(depositG: string, streamG: string): Promise<AiCreditsQuote> {\n return buildQuoteAmounts(depositG, streamG)\n }\n\n async getSignerOperatorStatus(ref: AccountRef): Promise<SignerOperatorStatus> {\n const payer = normalizeAddress(ref.payer)\n const signer = normalizeAddress(ref.signer)\n const operatorAddress = '0x0000000000000000000000000000000000000004'\n const operatorAccepted =\n !mockOperatorRevokedSigners.has(signer) &&\n (this.operatorAccepted || mockOperatorAcceptedSigners.has(signer))\n return {\n enabled: true,\n account: payer,\n signerAddress: signer,\n operatorAddress,\n currentOperator: operatorAccepted ? operatorAddress : '0x0000000000000000000000000000000000000000',\n operatorAccepted,\n consentNonce: '0',\n }\n }\n\n async buildOperatorConsentPayload(\n ref: AccountRef,\n operatorStatus?: SignerOperatorStatus,\n ): Promise<OperatorConsentPayloadResponse> {\n const status = operatorStatus ?? (await this.getSignerOperatorStatus(ref))\n if (!status.enabled || !status.operatorAddress) {\n return {\n enabled: false,\n account: normalizeAddress(ref.payer),\n signerAddress: normalizeAddress(ref.signer),\n }\n }\n return {\n enabled: true,\n account: normalizeAddress(ref.payer),\n signerAddress: normalizeAddress(ref.signer),\n typedData: buildSetOperatorPayload(\n BASE_CHAIN_ID,\n ANTSEED_DEPOSITS_BASE_ADDRESS,\n status.operatorAddress,\n BigInt(status.consentNonce),\n { name: 'AntseedDeposits', version: '1' },\n ),\n }\n }\n\n async getWithdrawableUsd(): Promise<string> {\n return '0'\n }\n\n async getSignerAuthNonce(): Promise<bigint> {\n return 0n\n }\n}\n","import type {\n AccountCreditResponse,\n AccountRef,\n CeloEventsRecordResponse,\n ChannelOperationResponse,\n CreditHistoryQuery,\n CreditHistoryResponse,\n DiscountConfig,\n GdCreditEntry,\n OperatorConsentResponse,\n OperatorRevokeResponse,\n SettlementResult,\n TransactionsResponse,\n UserCreditProfile,\n WithdrawPrincipalRequest,\n WithdrawPrincipalResponse,\n} from '../backendClient'\nimport { DEFAULT_DISCOUNT_CONFIG, totalCreditUsdFromProfile } from '../backendClient'\nimport type { AiCreditsBackendClient } from '../backendClient'\nimport { clearMockOperatorConsent, markMockOperatorConsent } from './chainClient'\n\nconst MOCK_DELAY_MS = 600\nconst DEFAULT_HISTORY_LIMIT = 20\nconst MAX_HISTORY_LIMIT = 100\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\nfunction normalizeAddress(address: string): string {\n return address.toLowerCase()\n}\n\nfunction paginateGdCredits(\n entries: GdCreditEntry[],\n options: CreditHistoryQuery = {},\n): CreditHistoryResponse {\n let result = [...entries].sort((a, b) => {\n const byCreated = b.createdAt.localeCompare(a.createdAt)\n return byCreated !== 0 ? byCreated : b.id.localeCompare(a.id)\n })\n if (options.source) result = result.filter((entry) => entry.source === options.source)\n if (options.fundingStatus) result = result.filter((entry) => entry.fundingStatus === options.fundingStatus)\n if (options.from) {\n const fromMs = Date.parse(options.from)\n result = result.filter((entry) => Date.parse(entry.createdAt) >= fromMs)\n }\n if (options.to) {\n const toMs = Date.parse(options.to)\n result = result.filter((entry) => Date.parse(entry.createdAt) <= toMs)\n }\n const limit = options.limit === undefined\n ? DEFAULT_HISTORY_LIMIT\n : Math.min(Math.max(1, Math.floor(options.limit)), MAX_HISTORY_LIMIT)\n const offset = Math.max(0, Math.floor(options.offset ?? 0))\n return {\n account: '',\n items: result.slice(offset, offset + limit),\n total: result.length,\n limit,\n offset,\n hasMore: offset + limit < result.length,\n }\n}\n\nfunction createDemoHistory(account: string): GdCreditEntry[] {\n const normalized = normalizeAddress(account)\n return [\n {\n id: 'demo-deposit-1', account: normalized, rootAccount: normalized, source: 'deposit',\n gdAmountWei: '440000000000000000000', totalCreditUsd: '6600', principalUsd: '6000',\n bonusUsd: '600', fundingStatus: 'funded', txHash: '0xdemo01', logIndex: 0,\n createdAt: '2026-06-25T14:30:00.000Z', streamUpdateMonth: '2026-06', signerAddress: normalized,\n },\n {\n id: 'demo-stream-update-1', account: normalized, rootAccount: normalized, source: 'streamUpdate',\n gdAmountWei: '10000000000000000000', totalCreditUsd: '0', principalUsd: '0',\n bonusUsd: '0', fundingStatus: 'funded', txHash: '0xdemo02', logIndex: 0,\n createdAt: '2026-06-24T12:00:00.000Z', streamUpdateMonth: '2026-06', signerAddress: normalized,\n },\n {\n id: 'demo-stream-request-1', account: normalized, rootAccount: normalized, source: 'streamRequest',\n gdAmountWei: '8000000000000000000', totalCreditUsd: '1200', principalUsd: '1000',\n bonusUsd: '200', fundingStatus: 'pending', txHash: '0xdemo03', logIndex: 0,\n createdAt: '2026-06-23T09:15:00.000Z', streamUpdateMonth: '2026-06', signerAddress: normalized,\n },\n {\n id: 'demo-stream-cron-1', account: normalized, rootAccount: normalized, source: 'streamCron',\n gdAmountWei: '5000000000000000000', totalCreditUsd: '900', principalUsd: '750',\n bonusUsd: '150', fundingStatus: 'funded', createdAt: '2026-06-22T08:00:00.000Z',\n streamUpdateMonth: '2026-06', signerAddress: normalized,\n },\n ]\n}\n\nexport class MockAiCreditsBackendClient implements AiCreditsBackendClient {\n private activeRef: AccountRef | null = null\n private lastCreditUsd = 0n\n private readonly accountStates = new Map<string, {\n principalUsd: bigint\n bonusUsd: bigint\n transactions: GdCreditEntry[]\n rootAccount: string\n }>()\n\n private getState(payer: string) {\n const key = normalizeAddress(payer)\n if (!this.accountStates.has(key)) {\n this.accountStates.set(key, {\n principalUsd: 0n,\n bonusUsd: 0n,\n transactions: createDemoHistory(key),\n rootAccount: key,\n })\n }\n return this.accountStates.get(key)!\n }\n\n async getDiscountConfig(): Promise<DiscountConfig> {\n await sleep(MOCK_DELAY_MS)\n return { ...DEFAULT_DISCOUNT_CONFIG }\n }\n\n private buildProfile(payer: string): UserCreditProfile {\n const state = this.getState(payer)\n const now = new Date().toISOString()\n const outstanding = state.transactions\n .filter((entry) => entry.fundingStatus === 'pending' || entry.fundingStatus === 'failed')\n .reduce((sum, entry) => sum + BigInt(entry.totalCreditUsd), 0n)\n return {\n account: normalizeAddress(payer),\n rootAccount: state.rootAccount,\n createdAt: now,\n updatedAt: now,\n totalGdDepositedWei: '0',\n totalPrincipalUsd: state.principalUsd.toString(),\n totalBonusUsd: state.bonusUsd.toString(),\n totalGDStreamedWei: '0',\n totalOutstandingFundingUsd: outstanding.toString(),\n streamFlowRateWeiPerSecond: '0',\n }\n }\n\n async getAccountCredit(payer: string): Promise<AccountCreditResponse> {\n await sleep(MOCK_DELAY_MS)\n const profile = this.buildProfile(payer)\n return { account: profile.account, profile }\n }\n\n async getCreditHistory(payer: string, options: CreditHistoryQuery = {}): Promise<CreditHistoryResponse> {\n await sleep(MOCK_DELAY_MS)\n return { ...paginateGdCredits(this.getState(payer).transactions, options), account: normalizeAddress(payer) }\n }\n\n async getOutstanding(payer: string): Promise<{ outstandingFundingUsd: string; count: number }> {\n await sleep(MOCK_DELAY_MS)\n const pending = this.getState(payer).transactions.filter(\n (entry) => entry.fundingStatus === 'pending' || entry.fundingStatus === 'failed',\n )\n return {\n outstandingFundingUsd: pending.reduce((sum, entry) => sum + BigInt(entry.totalCreditUsd || '0'), 0n).toString(),\n count: pending.length,\n }\n }\n\n async getTransactions(payer: string, options: { status?: 'pending' | 'funded' | 'failed'; limit?: number; cursor?: string } = {}): Promise<TransactionsResponse> {\n const history = await this.getCreditHistory(payer, {\n fundingStatus: options.status, limit: options.limit, offset: options.cursor ? Number(options.cursor) || 0 : 0,\n })\n return { account: history.account, transactions: history.items }\n }\n\n prepareSettlement(ref: AccountRef, creditUsd: bigint): void {\n this.activeRef = { payer: normalizeAddress(ref.payer), signer: normalizeAddress(ref.signer) }\n this.lastCreditUsd = creditUsd\n }\n\n async notifyPayment(txHash: string): Promise<CeloEventsRecordResponse> {\n await sleep(MOCK_DELAY_MS)\n const ref = this.activeRef\n if (!ref) return { txHash, events: [] }\n const now = new Date().toISOString()\n const entry: GdCreditEntry = {\n id: `${txHash}:0`, account: ref.payer, rootAccount: ref.payer, source: 'deposit',\n gdAmountWei: '0', totalCreditUsd: this.lastCreditUsd.toString(), principalUsd: this.lastCreditUsd.toString(),\n bonusUsd: '0', fundingStatus: 'pending', txHash, logIndex: 0, createdAt: now,\n streamUpdateMonth: now.slice(0, 7), signerAddress: ref.signer,\n }\n const state = this.getState(ref.payer)\n if (!state.transactions.find((item) => item.id === entry.id)) state.transactions.unshift(entry)\n return { txHash, events: [entry] }\n }\n\n async waitForSettlement(ref: AccountRef): Promise<SettlementResult> {\n await sleep(MOCK_DELAY_MS)\n const state = this.getState(ref.payer)\n for (const entry of state.transactions) {\n if (entry.fundingStatus !== 'pending') continue\n entry.fundingStatus = 'funded'\n state.principalUsd += BigInt(entry.principalUsd)\n state.bonusUsd += BigInt(entry.bonusUsd)\n }\n return { totalCreditUsd: totalCreditUsdFromProfile(this.buildProfile(ref.payer)) }\n }\n\n async closeChannel(channelId: string): Promise<ChannelOperationResponse> {\n await sleep(MOCK_DELAY_MS)\n return { channelId, action: 'close', bridge: { enabled: true, txHash: '0xmock' } }\n }\n\n async withdrawCredits(signer: string, body: WithdrawPrincipalRequest): Promise<WithdrawPrincipalResponse> {\n await sleep(MOCK_DELAY_MS)\n return { account: signer, amountUsd: body.amount, bridge: { enabled: true, txHash: '0xmock' } }\n }\n\n async submitOperatorConsent(\n signer: string,\n {}: { nonce: string; signature: string },\n ): Promise<OperatorConsentResponse> {\n await sleep(MOCK_DELAY_MS)\n const normalizedSigner = normalizeAddress(signer)\n markMockOperatorConsent(normalizedSigner)\n return {\n signer: normalizedSigner,\n bridge: { enabled: true, txHash: '0xmock' },\n }\n }\n\n async revokeOperatorConsent(\n signer: string,\n {}: { nonce: string; signature: string },\n ): Promise<OperatorRevokeResponse> {\n await sleep(MOCK_DELAY_MS)\n // Mirrors submitOperatorConsent: the chain mock is what waitForOperatorRevoke polls.\n clearMockOperatorConsent(normalizeAddress(signer))\n return {\n signer: normalizeAddress(signer),\n bridge: { enabled: true, txHash: '0xmock' },\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,eAAe;;;ACOxB,IAAM,8BAA8B,oBAAI,IAAY;AAGpD,IAAM,6BAA6B,oBAAI,IAAY;AAEnD,SAAS,iBAAiB,SAAyB;AACjD,SAAO,QAAQ,YAAY;AAC7B;AAEO,SAAS,wBAAwB,QAAsB;AAC5D,QAAM,aAAa,iBAAiB,MAAM;AAC1C,6BAA2B,OAAO,UAAU;AAC5C,8BAA4B,IAAI,UAAU;AAC5C;AAEO,SAAS,yBAAyB,QAAsB;AAC7D,QAAM,aAAa,iBAAiB,MAAM;AAC1C,8BAA4B,OAAO,UAAU;AAC7C,6BAA2B,IAAI,UAAU;AAC3C;AAEO,IAAM,2BAAN,MAA+D;AAAA,EAC5D;AAAA,EACS;AAAA,EACA;AAAA,EAEjB,YACE,UAA4F,CAAC,GAC7F;AACA,SAAK,mBAAmB,QAAQ,oBAAoB;AACpD,SAAK,gBAAgB,QAAQ,iBAAiB;AAC9C,SAAK,iBAAiB,QAAQ,kBAAkB;AAAA,EAClD;AAAA,EAEA,MAAM,mBAAqC;AACzC,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,qBAAsC;AAC1C,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,WAAW,UAAkB,SAA0C;AAC3E,WAAO,kBAAkB,UAAU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