@agentbadge/circle-payments 0.1.6 → 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/dist/chains.d.ts CHANGED
@@ -14,6 +14,7 @@ export interface SupportedChain {
14
14
  }
15
15
  export declare const BASE_SEPOLIA: SupportedChain;
16
16
  export declare const ARC_TESTNET: SupportedChain;
17
+ export declare const ARC_MAINNET: SupportedChain;
17
18
  export declare const ARC_CONTRACTS: {
18
19
  readonly memo: "0x5294E9927c3306DcBaDb03fe70b92e01cCede505";
19
20
  readonly agenticCommerce: "0x0747EEf0706327138c69792bF28Cd525089e4583";
@@ -21,9 +22,22 @@ export declare const ARC_CONTRACTS: {
21
22
  readonly reputationRegistry: "0x8004B663056A597Dffe9eCcC1965A193B7388713";
22
23
  readonly validationRegistry: "0x8004Cb1BF31DAf7788923b405b754f57acEB4272";
23
24
  };
25
+ export declare const ARC_MAINNET_CONTRACTS: {
26
+ readonly memo: "0x5294E9927c3306DcBaDb03fe70b92e01cCede505";
27
+ readonly agenticCommerce: "0x680C35daCfaB41688E243c566632e92d266189bf";
28
+ readonly identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432";
29
+ readonly reputationRegistry: "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63";
30
+ readonly validationRegistry: "0x8004Cc8439f36fd5F9F049D9fF86523Df6dAAB58";
31
+ };
32
+ export declare const ARC_MAINNET_AGENTBADGE_CONTRACTS: {
33
+ readonly agentEventLog: "0x1bb6A87D18cbd4285b4d383F88f10a1Ed01B4700";
34
+ readonly agentPassportNFT: "0xd226824e66e6aac7104579840506e268886a8169";
35
+ readonly accessPassNFT: "0x68ca4d1a9ff24f86328f2fb3a30d81e503d367f5";
36
+ };
24
37
  export declare const CHAINS: {
25
38
  readonly [BASE_SEPOLIA.caip2]: SupportedChain;
26
39
  readonly [ARC_TESTNET.caip2]: SupportedChain;
40
+ readonly [ARC_MAINNET.caip2]: SupportedChain;
27
41
  };
28
42
  export declare function getChain(id: string | number): SupportedChain | undefined;
29
43
  export type PaymentSchemeId = "gateway-batch" | "exact" | "eip3009-client-broadcast";
package/dist/chains.js CHANGED
@@ -24,6 +24,18 @@ export const ARC_TESTNET = {
24
24
  explorerUrl: "https://explorer.testnet.arc.io",
25
25
  faucetUrl: "https://faucet.circle.com",
26
26
  };
27
+ export const ARC_MAINNET = {
28
+ caip2: "eip155:5042",
29
+ chainId: 5042,
30
+ name: "Arc",
31
+ usdc: "0x3600000000000000000000000000000000000000",
32
+ usdcDecimals: 6,
33
+ rpcUrl: process.env.ARC_MAINNET_RPC_URL ?? "https://rpc.mainnet.arc.io",
34
+ facilitatorUrl: "https://gateway-api.circle.com",
35
+ gatewayWallet: "0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE",
36
+ domain: 26,
37
+ explorerUrl: "https://explorer.arc.io",
38
+ };
27
39
  export const ARC_CONTRACTS = {
28
40
  memo: "0x5294E9927c3306DcBaDb03fe70b92e01cCede505",
29
41
  agenticCommerce: "0x0747EEf0706327138c69792bF28Cd525089e4583",
@@ -31,9 +43,22 @@ export const ARC_CONTRACTS = {
31
43
  reputationRegistry: "0x8004B663056A597Dffe9eCcC1965A193B7388713",
32
44
  validationRegistry: "0x8004Cb1BF31DAf7788923b405b754f57acEB4272",
33
45
  };
46
+ export const ARC_MAINNET_CONTRACTS = {
47
+ memo: "0x5294E9927c3306DcBaDb03fe70b92e01cCede505",
48
+ agenticCommerce: "0x680C35daCfaB41688E243c566632e92d266189bf",
49
+ identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
50
+ reputationRegistry: "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63",
51
+ validationRegistry: "0x8004Cc8439f36fd5F9F049D9fF86523Df6dAAB58",
52
+ };
53
+ export const ARC_MAINNET_AGENTBADGE_CONTRACTS = {
54
+ agentEventLog: "0x1bb6A87D18cbd4285b4d383F88f10a1Ed01B4700",
55
+ agentPassportNFT: "0xd226824e66e6aac7104579840506e268886a8169",
56
+ accessPassNFT: "0x68ca4d1a9ff24f86328f2fb3a30d81e503d367f5",
57
+ };
34
58
  export const CHAINS = {
35
59
  [BASE_SEPOLIA.caip2]: BASE_SEPOLIA,
36
60
  [ARC_TESTNET.caip2]: ARC_TESTNET,
61
+ [ARC_MAINNET.caip2]: ARC_MAINNET,
37
62
  };
38
63
  export function getChain(id) {
39
64
  const key = typeof id === "number" ? `eip155:${id}` : id;
@@ -177,6 +177,217 @@ export declare const ERC8183_ABI: readonly [{
177
177
  }];
178
178
  readonly anonymous: false;
179
179
  }];
180
+ export declare const ERC8183_ACP_ABI: readonly [{
181
+ readonly type: "function";
182
+ readonly name: "createJob";
183
+ readonly stateMutability: "nonpayable";
184
+ readonly inputs: readonly [{
185
+ readonly name: "provider";
186
+ readonly type: "address";
187
+ }, {
188
+ readonly name: "evaluator";
189
+ readonly type: "address";
190
+ }, {
191
+ readonly name: "expiredAt";
192
+ readonly type: "uint256";
193
+ }, {
194
+ readonly name: "description";
195
+ readonly type: "string";
196
+ }, {
197
+ readonly name: "hook";
198
+ readonly type: "address";
199
+ }];
200
+ readonly outputs: readonly [{
201
+ readonly name: "jobId";
202
+ readonly type: "uint256";
203
+ }];
204
+ }, {
205
+ readonly type: "function";
206
+ readonly name: "setProvider";
207
+ readonly stateMutability: "nonpayable";
208
+ readonly inputs: readonly [{
209
+ readonly name: "jobId";
210
+ readonly type: "uint256";
211
+ }, {
212
+ readonly name: "provider";
213
+ readonly type: "address";
214
+ }, {
215
+ readonly name: "optParams";
216
+ readonly type: "bytes";
217
+ }];
218
+ readonly outputs: readonly [];
219
+ }, {
220
+ readonly type: "function";
221
+ readonly name: "setBudget";
222
+ readonly stateMutability: "nonpayable";
223
+ readonly inputs: readonly [{
224
+ readonly name: "jobId";
225
+ readonly type: "uint256";
226
+ }, {
227
+ readonly name: "amount";
228
+ readonly type: "uint256";
229
+ }, {
230
+ readonly name: "optParams";
231
+ readonly type: "bytes";
232
+ }];
233
+ readonly outputs: readonly [];
234
+ }, {
235
+ readonly type: "function";
236
+ readonly name: "fund";
237
+ readonly stateMutability: "nonpayable";
238
+ readonly inputs: readonly [{
239
+ readonly name: "jobId";
240
+ readonly type: "uint256";
241
+ }, {
242
+ readonly name: "expectedBudget";
243
+ readonly type: "uint256";
244
+ }, {
245
+ readonly name: "optParams";
246
+ readonly type: "bytes";
247
+ }];
248
+ readonly outputs: readonly [];
249
+ }, {
250
+ readonly type: "function";
251
+ readonly name: "submit";
252
+ readonly stateMutability: "nonpayable";
253
+ readonly inputs: readonly [{
254
+ readonly name: "jobId";
255
+ readonly type: "uint256";
256
+ }, {
257
+ readonly name: "deliverable";
258
+ readonly type: "bytes";
259
+ }, {
260
+ readonly name: "optParams";
261
+ readonly type: "bytes";
262
+ }];
263
+ readonly outputs: readonly [];
264
+ }, {
265
+ readonly type: "function";
266
+ readonly name: "complete";
267
+ readonly stateMutability: "nonpayable";
268
+ readonly inputs: readonly [{
269
+ readonly name: "jobId";
270
+ readonly type: "uint256";
271
+ }, {
272
+ readonly name: "reason";
273
+ readonly type: "bytes";
274
+ }, {
275
+ readonly name: "optParams";
276
+ readonly type: "bytes";
277
+ }];
278
+ readonly outputs: readonly [];
279
+ }, {
280
+ readonly type: "function";
281
+ readonly name: "reject";
282
+ readonly stateMutability: "nonpayable";
283
+ readonly inputs: readonly [{
284
+ readonly name: "jobId";
285
+ readonly type: "uint256";
286
+ }, {
287
+ readonly name: "reason";
288
+ readonly type: "bytes";
289
+ }, {
290
+ readonly name: "optParams";
291
+ readonly type: "bytes";
292
+ }];
293
+ readonly outputs: readonly [];
294
+ }, {
295
+ readonly type: "function";
296
+ readonly name: "claimRefund";
297
+ readonly stateMutability: "nonpayable";
298
+ readonly inputs: readonly [{
299
+ readonly name: "jobId";
300
+ readonly type: "uint256";
301
+ }];
302
+ readonly outputs: readonly [];
303
+ }, {
304
+ readonly type: "function";
305
+ readonly name: "getJob";
306
+ readonly stateMutability: "view";
307
+ readonly inputs: readonly [{
308
+ readonly name: "jobId";
309
+ readonly type: "uint256";
310
+ }];
311
+ readonly outputs: readonly [{
312
+ readonly type: "tuple";
313
+ readonly components: readonly [{
314
+ readonly name: "client";
315
+ readonly type: "address";
316
+ }, {
317
+ readonly name: "provider";
318
+ readonly type: "address";
319
+ }, {
320
+ readonly name: "evaluator";
321
+ readonly type: "address";
322
+ }, {
323
+ readonly name: "hook";
324
+ readonly type: "address";
325
+ }, {
326
+ readonly name: "token";
327
+ readonly type: "address";
328
+ }, {
329
+ readonly name: "budget";
330
+ readonly type: "uint256";
331
+ }, {
332
+ readonly name: "expiredAt";
333
+ readonly type: "uint256";
334
+ }, {
335
+ readonly name: "status";
336
+ readonly type: "uint8";
337
+ }];
338
+ }];
339
+ }, {
340
+ readonly type: "function";
341
+ readonly name: "getDescription";
342
+ readonly stateMutability: "view";
343
+ readonly inputs: readonly [{
344
+ readonly name: "jobId";
345
+ readonly type: "uint256";
346
+ }];
347
+ readonly outputs: readonly [{
348
+ readonly name: "description";
349
+ readonly type: "string";
350
+ }];
351
+ }, {
352
+ readonly type: "function";
353
+ readonly name: "jobCount";
354
+ readonly stateMutability: "view";
355
+ readonly inputs: readonly [];
356
+ readonly outputs: readonly [{
357
+ readonly name: "count";
358
+ readonly type: "uint256";
359
+ }];
360
+ }, {
361
+ readonly type: "event";
362
+ readonly name: "JobCreated";
363
+ readonly inputs: readonly [{
364
+ readonly indexed: true;
365
+ readonly name: "jobId";
366
+ readonly type: "uint256";
367
+ }, {
368
+ readonly indexed: true;
369
+ readonly name: "client";
370
+ readonly type: "address";
371
+ }, {
372
+ readonly indexed: true;
373
+ readonly name: "evaluator";
374
+ readonly type: "address";
375
+ }, {
376
+ readonly indexed: false;
377
+ readonly name: "provider";
378
+ readonly type: "address";
379
+ }, {
380
+ readonly indexed: false;
381
+ readonly name: "hook";
382
+ readonly type: "address";
383
+ }, {
384
+ readonly indexed: false;
385
+ readonly name: "expiredAt";
386
+ readonly type: "uint256";
387
+ }];
388
+ readonly anonymous: false;
389
+ }];
390
+ export type Erc8183Variant = "circle" | "acp";
180
391
  export interface WriteClient {
181
392
  writeContract(args: {
182
393
  address: `0x${string}`;
@@ -217,6 +428,7 @@ export interface Erc8183Config {
217
428
  read: ReadClient;
218
429
  contract?: `0x${string}`;
219
430
  usdc: `0x${string}`;
431
+ variant?: Erc8183Variant;
220
432
  }
221
433
  export interface JobView {
222
434
  id: bigint;
@@ -228,6 +440,7 @@ export interface JobView {
228
440
  expiredAt: bigint;
229
441
  status: JobStatusName;
230
442
  hook: `0x${string}`;
443
+ token?: `0x${string}`;
231
444
  }
232
445
  export declare class Erc8183Error extends Error {
233
446
  readonly phase: "createJob" | "setBudget" | "fund" | "submit" | "complete" | "reject" | "claimRefund" | "getJob";
@@ -120,6 +120,142 @@ export const ERC8183_ABI = [
120
120
  anonymous: false,
121
121
  },
122
122
  ];
123
+ export const ERC8183_ACP_ABI = [
124
+ {
125
+ type: "function",
126
+ name: "createJob",
127
+ stateMutability: "nonpayable",
128
+ inputs: [
129
+ { name: "provider", type: "address" },
130
+ { name: "evaluator", type: "address" },
131
+ { name: "expiredAt", type: "uint256" },
132
+ { name: "description", type: "string" },
133
+ { name: "hook", type: "address" },
134
+ ],
135
+ outputs: [{ name: "jobId", type: "uint256" }],
136
+ },
137
+ {
138
+ type: "function",
139
+ name: "setProvider",
140
+ stateMutability: "nonpayable",
141
+ inputs: [
142
+ { name: "jobId", type: "uint256" },
143
+ { name: "provider", type: "address" },
144
+ { name: "optParams", type: "bytes" },
145
+ ],
146
+ outputs: [],
147
+ },
148
+ {
149
+ type: "function",
150
+ name: "setBudget",
151
+ stateMutability: "nonpayable",
152
+ inputs: [
153
+ { name: "jobId", type: "uint256" },
154
+ { name: "amount", type: "uint256" },
155
+ { name: "optParams", type: "bytes" },
156
+ ],
157
+ outputs: [],
158
+ },
159
+ {
160
+ type: "function",
161
+ name: "fund",
162
+ stateMutability: "nonpayable",
163
+ inputs: [
164
+ { name: "jobId", type: "uint256" },
165
+ { name: "expectedBudget", type: "uint256" },
166
+ { name: "optParams", type: "bytes" },
167
+ ],
168
+ outputs: [],
169
+ },
170
+ {
171
+ type: "function",
172
+ name: "submit",
173
+ stateMutability: "nonpayable",
174
+ inputs: [
175
+ { name: "jobId", type: "uint256" },
176
+ { name: "deliverable", type: "bytes" },
177
+ { name: "optParams", type: "bytes" },
178
+ ],
179
+ outputs: [],
180
+ },
181
+ {
182
+ type: "function",
183
+ name: "complete",
184
+ stateMutability: "nonpayable",
185
+ inputs: [
186
+ { name: "jobId", type: "uint256" },
187
+ { name: "reason", type: "bytes" },
188
+ { name: "optParams", type: "bytes" },
189
+ ],
190
+ outputs: [],
191
+ },
192
+ {
193
+ type: "function",
194
+ name: "reject",
195
+ stateMutability: "nonpayable",
196
+ inputs: [
197
+ { name: "jobId", type: "uint256" },
198
+ { name: "reason", type: "bytes" },
199
+ { name: "optParams", type: "bytes" },
200
+ ],
201
+ outputs: [],
202
+ },
203
+ {
204
+ type: "function",
205
+ name: "claimRefund",
206
+ stateMutability: "nonpayable",
207
+ inputs: [{ name: "jobId", type: "uint256" }],
208
+ outputs: [],
209
+ },
210
+ {
211
+ type: "function",
212
+ name: "getJob",
213
+ stateMutability: "view",
214
+ inputs: [{ name: "jobId", type: "uint256" }],
215
+ outputs: [
216
+ {
217
+ type: "tuple",
218
+ components: [
219
+ { name: "client", type: "address" },
220
+ { name: "provider", type: "address" },
221
+ { name: "evaluator", type: "address" },
222
+ { name: "hook", type: "address" },
223
+ { name: "token", type: "address" },
224
+ { name: "budget", type: "uint256" },
225
+ { name: "expiredAt", type: "uint256" },
226
+ { name: "status", type: "uint8" },
227
+ ],
228
+ },
229
+ ],
230
+ },
231
+ {
232
+ type: "function",
233
+ name: "getDescription",
234
+ stateMutability: "view",
235
+ inputs: [{ name: "jobId", type: "uint256" }],
236
+ outputs: [{ name: "description", type: "string" }],
237
+ },
238
+ {
239
+ type: "function",
240
+ name: "jobCount",
241
+ stateMutability: "view",
242
+ inputs: [],
243
+ outputs: [{ name: "count", type: "uint256" }],
244
+ },
245
+ {
246
+ type: "event",
247
+ name: "JobCreated",
248
+ inputs: [
249
+ { indexed: true, name: "jobId", type: "uint256" },
250
+ { indexed: true, name: "client", type: "address" },
251
+ { indexed: true, name: "evaluator", type: "address" },
252
+ { indexed: false, name: "provider", type: "address" },
253
+ { indexed: false, name: "hook", type: "address" },
254
+ { indexed: false, name: "expiredAt", type: "uint256" },
255
+ ],
256
+ anonymous: false,
257
+ },
258
+ ];
123
259
  const ERC20_APPROVE_ABI = parseAbi([
124
260
  "function approve(address spender, uint256 amount) returns (bool)",
125
261
  ]);
@@ -142,31 +278,35 @@ export class Erc8183Error extends Error {
142
278
  const EMPTY_PARAMS = "0x";
143
279
  function extractJobId(receipt) {
144
280
  for (const log of receipt.logs) {
145
- try {
146
- const decoded = decodeEventLog({
147
- abi: ERC8183_ABI,
148
- data: log.data,
149
- topics: log.topics,
150
- });
151
- if (decoded.eventName === "JobCreated") {
152
- return decoded.args.jobId;
281
+ for (const abi of [ERC8183_ABI, ERC8183_ACP_ABI]) {
282
+ try {
283
+ const decoded = decodeEventLog({
284
+ abi,
285
+ data: log.data,
286
+ topics: log.topics,
287
+ });
288
+ if (decoded.eventName === "JobCreated") {
289
+ return decoded.args.jobId;
290
+ }
291
+ }
292
+ catch {
293
+ continue;
153
294
  }
154
- }
155
- catch {
156
- continue;
157
295
  }
158
296
  }
159
297
  throw new Erc8183Error("JobCreated event not found in receipt", "createJob");
160
298
  }
161
299
  export function createErc8183(cfg) {
162
300
  const contract = cfg.contract ?? AGENTIC_COMMERCE_ARC_TESTNET;
301
+ const variant = cfg.variant ?? "circle";
302
+ const abi = variant === "acp" ? ERC8183_ACP_ABI : ERC8183_ABI;
163
303
  return {
164
304
  contract,
165
305
  async createJob(wallet, args) {
166
306
  try {
167
307
  const txHash = await wallet.writeContract({
168
308
  address: contract,
169
- abi: ERC8183_ABI,
309
+ abi,
170
310
  functionName: "createJob",
171
311
  args: [
172
312
  args.provider,
@@ -189,7 +329,7 @@ export function createErc8183(cfg) {
189
329
  try {
190
330
  return await wallet.writeContract({
191
331
  address: contract,
192
- abi: ERC8183_ABI,
332
+ abi,
193
333
  functionName: "setBudget",
194
334
  args: [args.jobId, args.amount, args.optParams ?? EMPTY_PARAMS],
195
335
  });
@@ -207,11 +347,14 @@ export function createErc8183(cfg) {
207
347
  args: [contract, args.amount],
208
348
  });
209
349
  await awaitReceipt(cfg.read, approveTx);
350
+ const fundArgs = variant === "acp"
351
+ ? [args.jobId, args.amount, args.optParams ?? EMPTY_PARAMS]
352
+ : [args.jobId, args.optParams ?? EMPTY_PARAMS];
210
353
  const fundTx = await wallet.writeContract({
211
354
  address: contract,
212
- abi: ERC8183_ABI,
355
+ abi,
213
356
  functionName: "fund",
214
- args: [args.jobId, args.optParams ?? EMPTY_PARAMS],
357
+ args: fundArgs,
215
358
  });
216
359
  return { approveTx, fundTx };
217
360
  }
@@ -223,7 +366,7 @@ export function createErc8183(cfg) {
223
366
  try {
224
367
  return await wallet.writeContract({
225
368
  address: contract,
226
- abi: ERC8183_ABI,
369
+ abi,
227
370
  functionName: "submit",
228
371
  args: [
229
372
  args.jobId,
@@ -240,7 +383,7 @@ export function createErc8183(cfg) {
240
383
  try {
241
384
  return await wallet.writeContract({
242
385
  address: contract,
243
- abi: ERC8183_ABI,
386
+ abi,
244
387
  functionName: "complete",
245
388
  args: [args.jobId, args.reason, args.optParams ?? EMPTY_PARAMS],
246
389
  });
@@ -253,7 +396,7 @@ export function createErc8183(cfg) {
253
396
  try {
254
397
  return await wallet.writeContract({
255
398
  address: contract,
256
- abi: ERC8183_ABI,
399
+ abi,
257
400
  functionName: "reject",
258
401
  args: [args.jobId, args.reason, args.optParams ?? EMPTY_PARAMS],
259
402
  });
@@ -266,7 +409,7 @@ export function createErc8183(cfg) {
266
409
  try {
267
410
  return await wallet.writeContract({
268
411
  address: contract,
269
- abi: ERC8183_ABI,
412
+ abi,
270
413
  functionName: "claimRefund",
271
414
  args: [jobId],
272
415
  });
@@ -277,9 +420,40 @@ export function createErc8183(cfg) {
277
420
  },
278
421
  async getJob(jobId) {
279
422
  try {
423
+ if (variant === "acp") {
424
+ const raw = (await cfg.read.readContract({
425
+ address: contract,
426
+ abi,
427
+ functionName: "getJob",
428
+ args: [jobId],
429
+ }));
430
+ let description = "";
431
+ try {
432
+ description = (await cfg.read.readContract({
433
+ address: contract,
434
+ abi,
435
+ functionName: "getDescription",
436
+ args: [jobId],
437
+ }));
438
+ }
439
+ catch {
440
+ }
441
+ return {
442
+ id: jobId,
443
+ client: raw.client,
444
+ provider: raw.provider,
445
+ evaluator: raw.evaluator,
446
+ description,
447
+ budget: raw.budget,
448
+ expiredAt: raw.expiredAt,
449
+ status: JOB_STATUS[raw.status] ?? "Open",
450
+ hook: raw.hook,
451
+ token: raw.token,
452
+ };
453
+ }
280
454
  const raw = (await cfg.read.readContract({
281
455
  address: contract,
282
- abi: ERC8183_ABI,
456
+ abi,
283
457
  functionName: "getJob",
284
458
  args: [jobId],
285
459
  }));
@@ -19,6 +19,15 @@ export declare const MEMO_ABI: readonly [{
19
19
  readonly type: "bytes";
20
20
  }];
21
21
  readonly outputs: readonly [];
22
+ }, {
23
+ readonly type: "event";
24
+ readonly name: "BeforeMemo";
25
+ readonly inputs: readonly [{
26
+ readonly indexed: true;
27
+ readonly name: "memoIndex";
28
+ readonly type: "uint256";
29
+ }];
30
+ readonly anonymous: false;
22
31
  }, {
23
32
  readonly type: "event";
24
33
  readonly name: "Memo";
@@ -96,5 +105,11 @@ export declare function createMemoClient(cfg: {
96
105
  data: Hex;
97
106
  }>;
98
107
  }): MemoEvent[];
108
+ parseBeforeMemoEvents(receipt: {
109
+ logs: Array<{
110
+ topics: Hex[];
111
+ data: Hex;
112
+ }>;
113
+ }): bigint[];
99
114
  };
100
115
  export type MemoClient = ReturnType<typeof createMemoClient>;
package/dist/memo/memo.js CHANGED
@@ -14,6 +14,14 @@ export const MEMO_ABI = [
14
14
  ],
15
15
  outputs: [],
16
16
  },
17
+ {
18
+ type: "event",
19
+ name: "BeforeMemo",
20
+ inputs: [
21
+ { indexed: true, name: "memoIndex", type: "uint256" },
22
+ ],
23
+ anonymous: false,
24
+ },
17
25
  {
18
26
  type: "event",
19
27
  name: "Memo",
@@ -102,5 +110,24 @@ export function createMemoClient(cfg) {
102
110
  }
103
111
  return out;
104
112
  },
113
+ parseBeforeMemoEvents(receipt) {
114
+ const out = [];
115
+ for (const log of receipt.logs) {
116
+ try {
117
+ const decoded = decodeEventLog({
118
+ abi: MEMO_ABI,
119
+ data: log.data,
120
+ topics: log.topics,
121
+ });
122
+ if (decoded.eventName === "BeforeMemo") {
123
+ out.push(decoded.args.memoIndex);
124
+ }
125
+ }
126
+ catch {
127
+ continue;
128
+ }
129
+ }
130
+ return out;
131
+ },
105
132
  };
106
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentbadge/circle-payments",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Circle Gateway nanopayments + x402 payment rails (Base Sepolia, Arc) for AgentBadge — trusted agent payments",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",