@arcenpay/react 0.0.1

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.
Files changed (101) hide show
  1. package/README.md +124 -0
  2. package/dist/add-LG363GP4.mjs +34 -0
  3. package/dist/all-wallets-UW4KSWDQ.mjs +25 -0
  4. package/dist/app-store-GOSERMQC.mjs +36 -0
  5. package/dist/apple-Y34SY63H.mjs +37 -0
  6. package/dist/arrow-bottom-YDRRJYRC.mjs +27 -0
  7. package/dist/arrow-bottom-circle-XSCE7Y52.mjs +30 -0
  8. package/dist/arrow-left-VMP4J3ME.mjs +27 -0
  9. package/dist/arrow-right-FSU7ZETV.mjs +27 -0
  10. package/dist/arrow-top-SQNMDYUF.mjs +27 -0
  11. package/dist/bank-DO6DNPBT.mjs +33 -0
  12. package/dist/basic-3OAVXLDO.mjs +10769 -0
  13. package/dist/browser-BI7YYLKK.mjs +33 -0
  14. package/dist/card-F2CIEB7K.mjs +33 -0
  15. package/dist/checkmark-YASK3T7D.mjs +30 -0
  16. package/dist/checkmark-bold-UJRS6R4T.mjs +27 -0
  17. package/dist/chevron-bottom-Z7YOJH7F.mjs +27 -0
  18. package/dist/chevron-left-YPDPGZVV.mjs +27 -0
  19. package/dist/chevron-right-4464VKIO.mjs +27 -0
  20. package/dist/chevron-top-6F4WXRKZ.mjs +27 -0
  21. package/dist/chrome-store-KH57RD54.mjs +80 -0
  22. package/dist/chunk-5MZNFSFK.mjs +1273 -0
  23. package/dist/chunk-ALKFEKMG.mjs +8108 -0
  24. package/dist/chunk-GUHCPHEG.mjs +768 -0
  25. package/dist/chunk-HPVNNTYF.mjs +7546 -0
  26. package/dist/chunk-LACDYDLO.mjs +402 -0
  27. package/dist/chunk-LGBIIGSV.mjs +39793 -0
  28. package/dist/chunk-M4NAIVF3.mjs +93283 -0
  29. package/dist/chunk-QILMZVJE.mjs +11957 -0
  30. package/dist/chunk-RKV353G3.mjs +272 -0
  31. package/dist/chunk-X2BMVUAF.mjs +50 -0
  32. package/dist/chunk-ZKNFAGRN.mjs +1414 -0
  33. package/dist/clock-WGC5S5SU.mjs +27 -0
  34. package/dist/close-HJ6ZBPVZ.mjs +27 -0
  35. package/dist/coinPlaceholder-UOKFKY4T.mjs +27 -0
  36. package/dist/compass-WAYDVX5E.mjs +27 -0
  37. package/dist/copy-OPJY4AKY.mjs +34 -0
  38. package/dist/core-GECUTVXD.mjs +10138 -0
  39. package/dist/cursor-PAYF2D2S.mjs +22 -0
  40. package/dist/cursor-transparent-T4M3KZJ2.mjs +31 -0
  41. package/dist/desktop-QSXXA65J.mjs +28 -0
  42. package/dist/disconnect-7NMPCP66.mjs +27 -0
  43. package/dist/discord-KRLKWIM5.mjs +36 -0
  44. package/dist/etherscan-TAXMMDC4.mjs +25 -0
  45. package/dist/exclamation-triangle-MW7PXM5B.mjs +23 -0
  46. package/dist/extension-LAAZQU7X.mjs +27 -0
  47. package/dist/external-link-IFBQ3MSI.mjs +27 -0
  48. package/dist/facebook-PAENGKOR.mjs +45 -0
  49. package/dist/farcaster-P47HCAAY.mjs +31 -0
  50. package/dist/filters-4HNPLZQV.mjs +27 -0
  51. package/dist/github-RO4C47BJ.mjs +37 -0
  52. package/dist/google-RIBTWZH2.mjs +37 -0
  53. package/dist/help-circle-PN7NOOY4.mjs +31 -0
  54. package/dist/id-JYBNXVYQ.mjs +31 -0
  55. package/dist/image-FUPENKKO.mjs +23 -0
  56. package/dist/index.d.mts +288 -0
  57. package/dist/index.d.ts +288 -0
  58. package/dist/index.js +295316 -0
  59. package/dist/index.mjs +7936 -0
  60. package/dist/info-34PNUQRI.mjs +22 -0
  61. package/dist/info-circle-M5CXNBEA.mjs +31 -0
  62. package/dist/lightbulb-CPZO66W6.mjs +22 -0
  63. package/dist/mail-RAF36J77.mjs +27 -0
  64. package/dist/mobile-ZLFYOCHK.mjs +28 -0
  65. package/dist/more-CIHKDQMO.mjs +30 -0
  66. package/dist/network-placeholder-QOMFBWMT.mjs +33 -0
  67. package/dist/nftPlaceholder-7TK2T2QP.mjs +27 -0
  68. package/dist/off-WWNLGDOR.mjs +27 -0
  69. package/dist/play-store-HLZSDCUP.mjs +51 -0
  70. package/dist/plus-SCLTSRAT.mjs +32 -0
  71. package/dist/qr-code-T7FWUJU6.mjs +25 -0
  72. package/dist/recycle-horizontal-WRR5I5MX.mjs +28 -0
  73. package/dist/refresh-6AQ524CD.mjs +27 -0
  74. package/dist/reown-logo-NJCCGFTU.mjs +31 -0
  75. package/dist/search-HXD6I5XQ.mjs +27 -0
  76. package/dist/send-3N2W3TJ6.mjs +34 -0
  77. package/dist/src-DKYFVWPL.mjs +7 -0
  78. package/dist/src-HMFDWVJP.mjs +5 -0
  79. package/dist/src-TV3VFBF5.mjs +98950 -0
  80. package/dist/swapHorizontal-KPYCPFL4.mjs +27 -0
  81. package/dist/swapHorizontalBold-WCO2BX6U.mjs +27 -0
  82. package/dist/swapHorizontalMedium-SCPLSG7N.mjs +35 -0
  83. package/dist/swapHorizontalRoundedBold-YX7IIFNL.mjs +27 -0
  84. package/dist/swapVertical-XS35BJ2R.mjs +27 -0
  85. package/dist/telegram-RIP72IGI.mjs +35 -0
  86. package/dist/three-dots-IPE2YG6Z.mjs +24 -0
  87. package/dist/twitch-5K6DAEPG.mjs +37 -0
  88. package/dist/twitterIcon-U3V7EFPB.mjs +25 -0
  89. package/dist/verify-JML7EMVO.mjs +27 -0
  90. package/dist/verify-filled-R5MYOEEJ.mjs +27 -0
  91. package/dist/w3m-modal-LW2TBGRA.mjs +2042 -0
  92. package/dist/wallet-AJFVN7JZ.mjs +27 -0
  93. package/dist/wallet-placeholder-4QSRXVF5.mjs +33 -0
  94. package/dist/walletconnect-G267PBVT.mjs +53 -0
  95. package/dist/warning-circle-2KJXNGLQ.mjs +31 -0
  96. package/dist/x-MTQL7KFF.mjs +31 -0
  97. package/dist/zerodev.d.mts +106 -0
  98. package/dist/zerodev.d.ts +106 -0
  99. package/dist/zerodev.js +420 -0
  100. package/dist/zerodev.mjs +17 -0
  101. package/package.json +78 -0
@@ -0,0 +1,420 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/zerodev.ts
21
+ var zerodev_exports = {};
22
+ __export(zerodev_exports, {
23
+ cancelSubscription: () => cancelSubscription,
24
+ deploySmartAccount: () => deploySmartAccount,
25
+ isRecoverableSmartAccountFundingError: () => isRecoverableSmartAccountFundingError,
26
+ revokeAutopayModule: () => revokeAutopayModule,
27
+ sendSmartAccountTransaction: () => sendSmartAccountTransaction,
28
+ updateAutopayConfig: () => updateAutopayConfig
29
+ });
30
+ module.exports = __toCommonJS(zerodev_exports);
31
+
32
+ // src/lib/zerodev.ts
33
+ var import_sdk = require("@zerodev/sdk");
34
+ var import_ecdsa_validator = require("@zerodev/ecdsa-validator");
35
+ var import_viem = require("viem");
36
+ var import_chains = require("viem/chains");
37
+ var import_sdk2 = require("@arcenpay/sdk");
38
+ var CHAIN_MAP = {
39
+ 11155111: import_chains.sepolia,
40
+ 84532: import_chains.baseSepolia,
41
+ 8453: import_chains.base
42
+ };
43
+ var ENTRY_POINT = import_sdk.constants.getEntryPoint("0.7");
44
+ var ENTRY_POINT_ADDRESS = ENTRY_POINT.address;
45
+ var KERNEL_VERSION = import_sdk.constants.KERNEL_V3_1;
46
+ function getZeroDevChainLabel(chainId) {
47
+ if (chainId === 84532) return "Base Sepolia";
48
+ if (chainId === 8453) return "Base";
49
+ if (chainId === 11155111) return "Sepolia";
50
+ return `Chain ${chainId}`;
51
+ }
52
+ function resolveZeroDevUrls(params) {
53
+ const specificUnified = process.env[`NEXT_PUBLIC_ZERODEV_RPC_${params.chainId}`];
54
+ const specificBundler = process.env[`NEXT_PUBLIC_ZERODEV_BUNDLER_RPC_${params.chainId}`];
55
+ const specificPaymaster = process.env[`NEXT_PUBLIC_ZERODEV_PAYMASTER_RPC_${params.chainId}`];
56
+ const genericUnified = process.env.NEXT_PUBLIC_ZERODEV_RPC;
57
+ const genericBundler = process.env.NEXT_PUBLIC_ZERODEV_BUNDLER_RPC;
58
+ const genericPaymaster = process.env.NEXT_PUBLIC_ZERODEV_PAYMASTER_RPC;
59
+ const defaultUnifiedV3 = `https://rpc.zerodev.app/api/v3/${params.projectId}/chain/${params.chainId}`;
60
+ const hasConfiguredUrls = !!(params.bundlerUrl || params.paymasterUrl || specificUnified || specificBundler || specificPaymaster || genericUnified || genericBundler || genericPaymaster);
61
+ return {
62
+ bundlerUrl: params.bundlerUrl || specificUnified || specificBundler || genericUnified || genericBundler || defaultUnifiedV3 || `https://rpc.zerodev.app/api/v2/bundler/${params.projectId}`,
63
+ paymasterUrl: params.paymasterUrl || specificUnified || specificPaymaster || genericUnified || genericPaymaster || defaultUnifiedV3 || `https://rpc.zerodev.app/api/v2/paymaster/${params.projectId}`,
64
+ hasConfiguredUrls
65
+ };
66
+ }
67
+ function normalizeZeroDevError(error, params) {
68
+ const message = error instanceof Error ? error.message : String(error ?? "");
69
+ const chainLabel = getZeroDevChainLabel(params.chainId);
70
+ const usingDefaultUrls = !params.hasConfiguredUrls;
71
+ if (message.includes("ChainId not found")) {
72
+ const nextStep = usingDefaultUrls ? `Enable ${chainLabel} for ZeroDev project ${params.projectId}, or set NEXT_PUBLIC_ZERODEV_BUNDLER_RPC_${params.chainId} and NEXT_PUBLIC_ZERODEV_PAYMASTER_RPC_${params.chainId} to chain-specific endpoints.` : `The configured ZeroDev endpoint does not recognize ${chainLabel} for project ${params.projectId}. Verify the project supports chain ${params.chainId} or replace the override URLs. Bundler URL: ${params.bundlerUrl ?? "n/a"}. Paymaster URL: ${params.paymasterUrl ?? "n/a"}.`;
73
+ return new Error(
74
+ `ZeroDev project ${params.projectId} is not configured for ${chainLabel} (chain ${params.chainId}). ${nextStep}`
75
+ );
76
+ }
77
+ return error instanceof Error ? error : new Error(message);
78
+ }
79
+ function isRecoverableSmartAccountFundingError(error) {
80
+ const message = error instanceof Error ? error.message : String(error ?? "");
81
+ const lower = message.toLowerCase();
82
+ return lower.includes("smart account does not have sufficient funds") || lower.includes("sufficient funds to execute the user operation") || lower.includes("insufficient funds") || lower.includes("user operation") && lower.includes("paymaster");
83
+ }
84
+ async function createKernelExecutionContext(config) {
85
+ const chain = CHAIN_MAP[config.chainId] || import_chains.baseSepolia;
86
+ const { bundlerUrl, paymasterUrl, hasConfiguredUrls } = resolveZeroDevUrls({
87
+ projectId: config.projectId,
88
+ chainId: config.chainId,
89
+ bundlerUrl: config.bundlerUrl,
90
+ paymasterUrl: config.paymasterUrl
91
+ });
92
+ const publicClient = (0, import_viem.createPublicClient)({
93
+ chain,
94
+ transport: (0, import_viem.http)()
95
+ });
96
+ const ecdsaValidator = await (0, import_ecdsa_validator.signerToEcdsaValidator)(publicClient, {
97
+ signer: config.walletClient,
98
+ entryPoint: ENTRY_POINT,
99
+ kernelVersion: KERNEL_VERSION
100
+ });
101
+ const kernelAccount = await (0, import_sdk.createKernelAccount)(publicClient, {
102
+ plugins: { sudo: ecdsaValidator },
103
+ entryPoint: ENTRY_POINT,
104
+ kernelVersion: KERNEL_VERSION
105
+ });
106
+ const paymasterClient = (0, import_sdk.createZeroDevPaymasterClient)({
107
+ chain,
108
+ transport: (0, import_viem.http)(paymasterUrl)
109
+ });
110
+ const kernelClient = (0, import_sdk.createKernelAccountClient)({
111
+ account: kernelAccount,
112
+ chain,
113
+ bundlerTransport: (0, import_viem.http)(bundlerUrl),
114
+ middleware: {
115
+ sponsorUserOperation: async ({ userOperation }) => {
116
+ return paymasterClient.sponsorUserOperation({
117
+ userOperation,
118
+ entryPoint: ENTRY_POINT_ADDRESS
119
+ });
120
+ }
121
+ }
122
+ });
123
+ return {
124
+ publicClient,
125
+ kernelAccount,
126
+ kernelClient,
127
+ bundlerUrl,
128
+ paymasterUrl,
129
+ hasConfiguredUrls
130
+ };
131
+ }
132
+ async function deploySmartAccount(config) {
133
+ const chain = CHAIN_MAP[config.chainId] || import_chains.baseSepolia;
134
+ const contracts = (0, import_sdk2.getContractAddresses)(config.chainId);
135
+ const { bundlerUrl, paymasterUrl, hasConfiguredUrls } = resolveZeroDevUrls({
136
+ projectId: config.projectId,
137
+ chainId: config.chainId,
138
+ bundlerUrl: config.bundlerUrl,
139
+ paymasterUrl: config.paymasterUrl
140
+ });
141
+ const publicClient = (0, import_viem.createPublicClient)({
142
+ chain,
143
+ transport: (0, import_viem.http)()
144
+ });
145
+ const ecdsaValidator = await (0, import_ecdsa_validator.signerToEcdsaValidator)(publicClient, {
146
+ signer: config.walletClient,
147
+ entryPoint: ENTRY_POINT,
148
+ kernelVersion: KERNEL_VERSION
149
+ });
150
+ const kernelAccount = await (0, import_sdk.createKernelAccount)(publicClient, {
151
+ plugins: {
152
+ sudo: ecdsaValidator
153
+ },
154
+ entryPoint: ENTRY_POINT,
155
+ kernelVersion: KERNEL_VERSION
156
+ });
157
+ const smartAccountAddress = kernelAccount.address;
158
+ const code = await publicClient.getCode({ address: smartAccountAddress });
159
+ const alreadyDeployed = !!code && code !== "0x";
160
+ const paymasterClient = (0, import_sdk.createZeroDevPaymasterClient)({
161
+ chain,
162
+ transport: (0, import_viem.http)(paymasterUrl)
163
+ });
164
+ const kernelClient = (0, import_sdk.createKernelAccountClient)({
165
+ account: kernelAccount,
166
+ chain,
167
+ bundlerTransport: (0, import_viem.http)(bundlerUrl),
168
+ middleware: {
169
+ sponsorUserOperation: async ({ userOperation }) => {
170
+ return paymasterClient.sponsorUserOperation({
171
+ userOperation,
172
+ entryPoint: ENTRY_POINT_ADDRESS
173
+ });
174
+ }
175
+ }
176
+ });
177
+ let installTxHash;
178
+ if (contracts.autopayModule) {
179
+ try {
180
+ const initialized = await publicClient.readContract({
181
+ address: contracts.autopayModule,
182
+ abi: import_sdk2.ERC7579AutopayModuleABI,
183
+ functionName: "isInitialized",
184
+ args: [smartAccountAddress]
185
+ });
186
+ if (initialized) {
187
+ console.log(
188
+ `[ZeroDev] AutopayModule already initialized for ${smartAccountAddress}`
189
+ );
190
+ return {
191
+ smartAccountAddress,
192
+ installTxHash,
193
+ alreadyDeployed
194
+ };
195
+ }
196
+ const installData = (0, import_viem.encodeFunctionData)({
197
+ abi: [
198
+ {
199
+ type: "function",
200
+ name: "installModule",
201
+ inputs: [
202
+ { name: "moduleType", type: "uint256" },
203
+ { name: "module", type: "address" },
204
+ { name: "initData", type: "bytes" }
205
+ ],
206
+ outputs: [],
207
+ stateMutability: "nonpayable"
208
+ }
209
+ ],
210
+ functionName: "installModule",
211
+ args: [
212
+ 2n,
213
+ // Module type 2 = Executor
214
+ contracts.autopayModule,
215
+ "0x"
216
+ // Empty init data
217
+ ]
218
+ });
219
+ installTxHash = await kernelClient.sendTransaction({
220
+ to: smartAccountAddress,
221
+ data: installData,
222
+ value: 0n
223
+ });
224
+ console.log(
225
+ `[ZeroDev] AutopayModule installed on ${smartAccountAddress} \u2014 tx: ${installTxHash}`
226
+ );
227
+ } catch (err) {
228
+ if (err?.message?.includes("already installed") || err?.message?.includes("AlreadyInitialized")) {
229
+ console.log(
230
+ `[ZeroDev] AutopayModule already installed on ${smartAccountAddress}`
231
+ );
232
+ } else {
233
+ const normalizedError = normalizeZeroDevError(err, {
234
+ projectId: config.projectId,
235
+ chainId: config.chainId,
236
+ bundlerUrl,
237
+ paymasterUrl,
238
+ hasConfiguredUrls
239
+ });
240
+ if (isRecoverableSmartAccountFundingError(normalizedError)) {
241
+ console.warn(
242
+ "[ZeroDev] Module installation needs prefund or sponsorship; callers may fall back to the connected wallet:",
243
+ normalizedError.message
244
+ );
245
+ } else {
246
+ console.error("[ZeroDev] Module installation failed:", normalizedError.message);
247
+ }
248
+ throw normalizedError;
249
+ }
250
+ }
251
+ }
252
+ return {
253
+ smartAccountAddress,
254
+ installTxHash,
255
+ alreadyDeployed
256
+ };
257
+ }
258
+ async function revokeAutopayModule(config) {
259
+ const chain = CHAIN_MAP[config.chainId] || import_chains.baseSepolia;
260
+ const contracts = (0, import_sdk2.getContractAddresses)(config.chainId);
261
+ if (!contracts.autopayModule) {
262
+ throw new Error("Autopay module address not configured for this chain.");
263
+ }
264
+ const { bundlerUrl, paymasterUrl, hasConfiguredUrls } = resolveZeroDevUrls({
265
+ projectId: config.projectId,
266
+ chainId: config.chainId,
267
+ bundlerUrl: config.bundlerUrl,
268
+ paymasterUrl: config.paymasterUrl
269
+ });
270
+ const publicClient = (0, import_viem.createPublicClient)({
271
+ chain,
272
+ transport: (0, import_viem.http)()
273
+ });
274
+ const initialized = await publicClient.readContract({
275
+ address: contracts.autopayModule,
276
+ abi: import_sdk2.ERC7579AutopayModuleABI,
277
+ functionName: "isInitialized",
278
+ args: [config.smartAccountAddress]
279
+ });
280
+ if (!initialized) {
281
+ return { alreadyRevoked: true };
282
+ }
283
+ const { kernelAccount, kernelClient } = await createKernelExecutionContext({
284
+ projectId: config.projectId,
285
+ chainId: config.chainId,
286
+ walletClient: config.walletClient,
287
+ bundlerUrl,
288
+ paymasterUrl
289
+ });
290
+ if (kernelAccount.address.toLowerCase() !== config.smartAccountAddress.toLowerCase()) {
291
+ throw new Error(
292
+ `Kernel account mismatch. Expected ${config.smartAccountAddress}, got ${kernelAccount.address}.`
293
+ );
294
+ }
295
+ const revokeData = (0, import_viem.encodeFunctionData)({
296
+ abi: import_sdk2.ERC7579AutopayModuleABI,
297
+ functionName: "onUninstall",
298
+ args: ["0x"]
299
+ });
300
+ try {
301
+ const txHash = await kernelClient.sendTransaction({
302
+ to: contracts.autopayModule,
303
+ data: revokeData,
304
+ value: 0n
305
+ });
306
+ return { txHash, alreadyRevoked: false };
307
+ } catch (error) {
308
+ throw normalizeZeroDevError(error, {
309
+ projectId: config.projectId,
310
+ chainId: config.chainId,
311
+ bundlerUrl,
312
+ paymasterUrl,
313
+ hasConfiguredUrls
314
+ });
315
+ }
316
+ }
317
+ async function sendSmartAccountTransaction(config) {
318
+ const {
319
+ publicClient,
320
+ kernelAccount,
321
+ kernelClient,
322
+ bundlerUrl,
323
+ paymasterUrl,
324
+ hasConfiguredUrls
325
+ } = await createKernelExecutionContext({
326
+ projectId: config.projectId,
327
+ chainId: config.chainId,
328
+ walletClient: config.walletClient,
329
+ bundlerUrl: config.bundlerUrl,
330
+ paymasterUrl: config.paymasterUrl
331
+ });
332
+ if (config.smartAccountAddress && kernelAccount.address.toLowerCase() !== config.smartAccountAddress.toLowerCase()) {
333
+ throw new Error(
334
+ `Kernel account mismatch. Expected ${config.smartAccountAddress}, got ${kernelAccount.address}.`
335
+ );
336
+ }
337
+ try {
338
+ const txHash = await kernelClient.sendTransaction({
339
+ to: config.to,
340
+ data: config.data,
341
+ value: config.value ?? 0n
342
+ });
343
+ await publicClient.waitForTransactionReceipt({ hash: txHash });
344
+ return {
345
+ smartAccountAddress: kernelAccount.address,
346
+ txHash
347
+ };
348
+ } catch (error) {
349
+ throw normalizeZeroDevError(error, {
350
+ projectId: config.projectId,
351
+ chainId: config.chainId,
352
+ bundlerUrl,
353
+ paymasterUrl,
354
+ hasConfiguredUrls
355
+ });
356
+ }
357
+ }
358
+ async function updateAutopayConfig(config) {
359
+ const contracts = (0, import_sdk2.getContractAddresses)(config.chainId);
360
+ if (!contracts.autopayModule) {
361
+ throw new Error("Autopay module address is not configured for this chain.");
362
+ }
363
+ const data = (0, import_viem.encodeFunctionData)({
364
+ abi: import_sdk2.ERC7579AutopayModuleABI,
365
+ functionName: "updateConfig",
366
+ args: [
367
+ {
368
+ merchant: config.merchant,
369
+ maxAmount: config.maxAmount,
370
+ token: config.token,
371
+ interval: config.interval,
372
+ startTime: config.startTime,
373
+ planId: config.planId,
374
+ maxTotalAmount: config.maxTotalAmount ?? 0n
375
+ }
376
+ ]
377
+ });
378
+ return sendSmartAccountTransaction({
379
+ projectId: config.projectId,
380
+ chainId: config.chainId,
381
+ walletClient: config.walletClient,
382
+ smartAccountAddress: config.smartAccountAddress,
383
+ to: contracts.autopayModule,
384
+ data,
385
+ bundlerUrl: config.bundlerUrl,
386
+ paymasterUrl: config.paymasterUrl
387
+ });
388
+ }
389
+ async function cancelSubscription(config) {
390
+ const contracts = (0, import_sdk2.getContractAddresses)(config.chainId);
391
+ if (!contracts.subscriptionRegistry) {
392
+ throw new Error(
393
+ "Subscription registry address is not configured for this chain."
394
+ );
395
+ }
396
+ const data = (0, import_viem.encodeFunctionData)({
397
+ abi: import_sdk2.SubscriptionRegistryABI,
398
+ functionName: "cancelSubscription",
399
+ args: [config.tokenId]
400
+ });
401
+ return sendSmartAccountTransaction({
402
+ projectId: config.projectId,
403
+ chainId: config.chainId,
404
+ walletClient: config.walletClient,
405
+ smartAccountAddress: config.smartAccountAddress,
406
+ to: contracts.subscriptionRegistry,
407
+ data,
408
+ bundlerUrl: config.bundlerUrl,
409
+ paymasterUrl: config.paymasterUrl
410
+ });
411
+ }
412
+ // Annotate the CommonJS export names for ESM import in node:
413
+ 0 && (module.exports = {
414
+ cancelSubscription,
415
+ deploySmartAccount,
416
+ isRecoverableSmartAccountFundingError,
417
+ revokeAutopayModule,
418
+ sendSmartAccountTransaction,
419
+ updateAutopayConfig
420
+ });
@@ -0,0 +1,17 @@
1
+ import {
2
+ cancelSubscription,
3
+ deploySmartAccount,
4
+ isRecoverableSmartAccountFundingError,
5
+ revokeAutopayModule,
6
+ sendSmartAccountTransaction,
7
+ updateAutopayConfig
8
+ } from "./chunk-LACDYDLO.mjs";
9
+ import "./chunk-X2BMVUAF.mjs";
10
+ export {
11
+ cancelSubscription,
12
+ deploySmartAccount,
13
+ isRecoverableSmartAccountFundingError,
14
+ revokeAutopayModule,
15
+ sendSmartAccountTransaction,
16
+ updateAutopayConfig
17
+ };
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@arcenpay/react",
3
+ "version": "0.0.1",
4
+ "description": "ArcenPay SDK — React components for Web3 subscription billing",
5
+ "license": "UNLICENSED",
6
+ "homepage": "https://app.arcenpay.com",
7
+ "keywords": [
8
+ "arcenpay",
9
+ "react",
10
+ "web3",
11
+ "subscriptions",
12
+ "billing",
13
+ "wagmi"
14
+ ],
15
+ "main": "./dist/index.js",
16
+ "module": "./dist/index.mjs",
17
+ "types": "./dist/index.d.ts",
18
+ "typings": "./dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.mjs",
23
+ "require": "./dist/index.js",
24
+ "default": "./dist/index.mjs"
25
+ },
26
+ "./zerodev": {
27
+ "types": "./dist/zerodev.d.ts",
28
+ "import": "./dist/zerodev.mjs",
29
+ "require": "./dist/zerodev.js",
30
+ "default": "./dist/zerodev.mjs"
31
+ }
32
+ },
33
+ "files": [
34
+ "dist"
35
+ ],
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "scripts": {
40
+ "build": "tsup src/index.ts src/zerodev.ts --clean --format cjs,esm --dts --dts-resolve --external react --external @zerodev/sdk --external @zerodev/ecdsa-validator",
41
+ "dev": "tsup src/index.ts src/zerodev.ts --clean --format cjs,esm --dts --external react --external @zerodev/sdk --external @zerodev/ecdsa-validator --watch",
42
+ "test": "vitest run",
43
+ "typecheck": "tsc --noEmit --skipLibCheck",
44
+ "clean": "rm -rf dist"
45
+ },
46
+ "peerDependencies": {
47
+ "react": "^18.0.0 || ^19.0.0",
48
+ "react-dom": "^18.0.0 || ^19.0.0",
49
+ "@zerodev/sdk": "^5.0.0",
50
+ "@zerodev/ecdsa-validator": "^5.0.0"
51
+ },
52
+ "peerDependenciesMeta": {
53
+ "@zerodev/sdk": {
54
+ "optional": true
55
+ },
56
+ "@zerodev/ecdsa-validator": {
57
+ "optional": true
58
+ }
59
+ },
60
+ "dependencies": {
61
+ "@arcenpay/sdk": "0.0.1",
62
+ "@tanstack/react-query": "^5.62.0",
63
+ "viem": "^2.21.0",
64
+ "wagmi": "^2.14.0"
65
+ },
66
+ "devDependencies": {
67
+ "@types/react": "^19.0.0",
68
+ "@types/react-dom": "^19.0.0",
69
+ "@zerodev/ecdsa-validator": "^5.4.9",
70
+ "@zerodev/sdk": "^5.5.7",
71
+ "react": "^19.0.0",
72
+ "tsup": "^8.3.0",
73
+ "typescript": "^5.7.0"
74
+ },
75
+ "engines": {
76
+ "node": ">=20.0.0"
77
+ }
78
+ }