@arcenpay/react 0.0.1 → 0.0.2
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/{basic-3OAVXLDO.mjs → basic-62X6SHFT.mjs} +7 -7
- package/dist/chains-SU7HOTC2.mjs +21 -0
- package/dist/chunk-GY2HMODH.mjs +94 -0
- package/dist/chunk-JFY4DVS7.mjs +1174 -0
- package/dist/{core-GECUTVXD.mjs → core-Y4UECIAE.mjs} +2 -2
- package/dist/index.d.mts +232 -4
- package/dist/index.d.ts +232 -4
- package/dist/index.js +1045 -175
- package/dist/index.mjs +89 -60
- package/dist/{src-TV3VFBF5.mjs → src-SAIIENMZ.mjs} +28 -28
- package/dist/{w3m-modal-LW2TBGRA.mjs → w3m-modal-T32JFEZB.mjs} +1 -1
- package/dist/zerodev.js +608 -35
- package/dist/zerodev.mjs +2 -1
- package/package.json +6 -2
- package/dist/chunk-LACDYDLO.mjs +0 -402
- /package/dist/{chunk-ZKNFAGRN.mjs → chunk-DK2DW6NJ.mjs} +0 -0
package/dist/index.js
CHANGED
|
@@ -34,6 +34,77 @@ var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__
|
|
|
34
34
|
));
|
|
35
35
|
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
|
|
36
36
|
|
|
37
|
+
// src/internal/sdk-core/chains.ts
|
|
38
|
+
function getBlockExplorerUrl(chainId, txHash) {
|
|
39
|
+
const chainMap = {
|
|
40
|
+
11155111: sepolia,
|
|
41
|
+
84532: baseSepolia,
|
|
42
|
+
8453: baseMainnet
|
|
43
|
+
};
|
|
44
|
+
const chain = chainMap[chainId];
|
|
45
|
+
if (!chain) return "";
|
|
46
|
+
const explorerUrl = chain.blockExplorers?.default?.url;
|
|
47
|
+
if (!explorerUrl) return "";
|
|
48
|
+
return `${explorerUrl}/tx/${txHash}`;
|
|
49
|
+
}
|
|
50
|
+
function getChain(chainId) {
|
|
51
|
+
const chainMap = {
|
|
52
|
+
11155111: sepolia,
|
|
53
|
+
84532: baseSepolia,
|
|
54
|
+
8453: baseMainnet
|
|
55
|
+
};
|
|
56
|
+
const chain = chainMap[chainId];
|
|
57
|
+
if (!chain) {
|
|
58
|
+
throw new Error(
|
|
59
|
+
`[getChain] Unsupported chainId: ${chainId}. Supported: ${Object.keys(chainMap).join(", ")}`
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
return chain;
|
|
63
|
+
}
|
|
64
|
+
var import_viem, sepolia, baseSepolia, baseMainnet, DEFAULT_CHAIN_ID;
|
|
65
|
+
var init_chains = __esm({
|
|
66
|
+
"src/internal/sdk-core/chains.ts"() {
|
|
67
|
+
"use strict";
|
|
68
|
+
import_viem = require("viem");
|
|
69
|
+
sepolia = (0, import_viem.defineChain)({
|
|
70
|
+
id: 11155111,
|
|
71
|
+
name: "Sepolia",
|
|
72
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
73
|
+
rpcUrls: {
|
|
74
|
+
default: { http: ["https://ethereum-sepolia-rpc.publicnode.com"] }
|
|
75
|
+
},
|
|
76
|
+
blockExplorers: {
|
|
77
|
+
default: { name: "Etherscan", url: "https://sepolia.etherscan.io" }
|
|
78
|
+
},
|
|
79
|
+
testnet: true
|
|
80
|
+
});
|
|
81
|
+
baseSepolia = (0, import_viem.defineChain)({
|
|
82
|
+
id: 84532,
|
|
83
|
+
name: "Base Sepolia",
|
|
84
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
85
|
+
rpcUrls: {
|
|
86
|
+
default: { http: ["https://sepolia.base.org"] }
|
|
87
|
+
},
|
|
88
|
+
blockExplorers: {
|
|
89
|
+
default: { name: "BaseScan", url: "https://sepolia.basescan.org" }
|
|
90
|
+
},
|
|
91
|
+
testnet: true
|
|
92
|
+
});
|
|
93
|
+
baseMainnet = (0, import_viem.defineChain)({
|
|
94
|
+
id: 8453,
|
|
95
|
+
name: "Base",
|
|
96
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
97
|
+
rpcUrls: {
|
|
98
|
+
default: { http: ["https://mainnet.base.org"] }
|
|
99
|
+
},
|
|
100
|
+
blockExplorers: {
|
|
101
|
+
default: { name: "BaseScan", url: "https://basescan.org" }
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
DEFAULT_CHAIN_ID = 84532;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
37
108
|
// ../../node_modules/@lit-protocol/lit-node-client/node_modules/tslib/tslib.es6.js
|
|
38
109
|
var tslib_es6_exports = {};
|
|
39
110
|
__export(tslib_es6_exports, {
|
|
@@ -74774,7 +74845,7 @@ var require_schemes = __commonJS({
|
|
|
74774
74845
|
urnComponent.nss = (uuidComponent.uuid || "").toLowerCase();
|
|
74775
74846
|
return urnComponent;
|
|
74776
74847
|
}
|
|
74777
|
-
var
|
|
74848
|
+
var http7 = (
|
|
74778
74849
|
/** @type {SchemeHandler} */
|
|
74779
74850
|
{
|
|
74780
74851
|
scheme: "http",
|
|
@@ -74787,7 +74858,7 @@ var require_schemes = __commonJS({
|
|
|
74787
74858
|
/** @type {SchemeHandler} */
|
|
74788
74859
|
{
|
|
74789
74860
|
scheme: "https",
|
|
74790
|
-
domainHost:
|
|
74861
|
+
domainHost: http7.domainHost,
|
|
74791
74862
|
parse: httpParse,
|
|
74792
74863
|
serialize: httpSerialize
|
|
74793
74864
|
}
|
|
@@ -74831,7 +74902,7 @@ var require_schemes = __commonJS({
|
|
|
74831
74902
|
var SCHEMES = (
|
|
74832
74903
|
/** @type {Record<SchemeName, SchemeHandler>} */
|
|
74833
74904
|
{
|
|
74834
|
-
http:
|
|
74905
|
+
http: http7,
|
|
74835
74906
|
https: https2,
|
|
74836
74907
|
ws: ws3,
|
|
74837
74908
|
wss,
|
|
@@ -78950,7 +79021,7 @@ var require_misc = __commonJS({
|
|
|
78950
79021
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
78951
79022
|
exports2.removeHexPrefix = exports2.hexPrefixed = exports2.defaultMintClaimCallback = exports2.genRandomPath = exports2.decimalPlaces = exports2.isBrowser = exports2.isNode = exports2.is = exports2.numberToHex = exports2.sortedObject = exports2.checkIfAuthSigRequiresChainParam = exports2.checkSchema = exports2.checkType = exports2.getVarType = exports2.logError = exports2.logErrorWithRequestId = exports2.logWithRequestId = exports2.log = exports2.getLoggerbyId = exports2.bootstrapLogManager = exports2.throwRemovedFunctionError = exports2.findMostCommonResponse = exports2.mostCommonString = exports2.printError = exports2.setMiscLitConfig = void 0;
|
|
78952
79023
|
exports2.isSupportedLitNetwork = isSupportedLitNetwork;
|
|
78953
|
-
exports2.getEnv =
|
|
79024
|
+
exports2.getEnv = getEnv2;
|
|
78954
79025
|
exports2.sendRequest = sendRequest;
|
|
78955
79026
|
exports2.normalizeAndStringify = normalizeAndStringify;
|
|
78956
79027
|
exports2.getIpAddress = getIpAddress;
|
|
@@ -79272,7 +79343,7 @@ var require_misc = __commonJS({
|
|
|
79272
79343
|
return str;
|
|
79273
79344
|
};
|
|
79274
79345
|
exports2.removeHexPrefix = removeHexPrefix;
|
|
79275
|
-
function
|
|
79346
|
+
function getEnv2({ nodeEnvVar = "DEBUG", urlQueryParam = "dev", urlQueryValue = "debug=true", defaultValue = false } = {}) {
|
|
79276
79347
|
if ((0, exports2.isNode)()) {
|
|
79277
79348
|
return process.env[nodeEnvVar] === "true";
|
|
79278
79349
|
} else if ((0, exports2.isBrowser)()) {
|
|
@@ -90562,7 +90633,7 @@ async function ir2(t6, e8, n12, r11, o13, i10) {
|
|
|
90562
90633
|
}
|
|
90563
90634
|
}
|
|
90564
90635
|
async function sr2(t6, e8, n12) {
|
|
90565
|
-
return (await (0,
|
|
90636
|
+
return (await (0, import_viem5.recoverAddress)({ hash: Ve2(e8), signature: n12 })).toLowerCase() === t6.toLowerCase();
|
|
90566
90637
|
}
|
|
90567
90638
|
async function cr2(t6, e8, n12, r11, o13, i10) {
|
|
90568
90639
|
const s9 = Ne2(r11);
|
|
@@ -92158,7 +92229,7 @@ function Ta() {
|
|
|
92158
92229
|
var t6;
|
|
92159
92230
|
return Tt2() && (0, import_window_getters.getDocument)() ? ((t6 = (0, import_window_getters.getDocument)()) == null ? void 0 : t6.visibilityState) === "visible" : true;
|
|
92160
92231
|
}
|
|
92161
|
-
var import_time2, import_window_getters, import_window_metadata,
|
|
92232
|
+
var import_time2, import_window_getters, import_window_metadata, import_viem5, ae, Zo2, Yo2, Go2, Tn2, Wo2, Xo, Rn2, _n2, Jo2, $n2, Y, jn2, le2, Wn2, _i, $i, Li, ji, _t2, Xn2, ke2, tr2, er2, nr2, Mi, Jt2, Di, Hi, qi, Ki, Fi, zi, rr2, or3, En2, Yi, Gi, Wi, Qi, ts, es, ar2, ns, rs, ur2, Me2, fr2, os, de2, lr2, dr2, De2, hr2, mt, gs, ys, Es, Nr2, xs, Ss, Os, As, ge2, Bs, Ur2, Tr2, F, Us, Rs, $s, Ls, Rr2, js, Cs, $r2, Lr2, ye2, Ge2, jr2, Vs, qs, Ks, wt2, bt2, Fs, Qt2, me2, we2, zs, Zs, ut2, Xe2, Je2, Qe2, kr2, Qs, tc, ec2, q, H2, At, nc, en2, Mr2, Dr2, ic, Zr2, ve2, sn2, Gr2, Ht2, an, un, yc, Xr2, mc, wc, fn, xc, Sc, Oc, lt2, dt2, K2, Qr2, to2, Tc, Rc, _c, ln, G2, qt2, xe2, Kt2, dn, Ft2, re, $c, eo2, oe, hn, so2, Jc, Qc, ta, fo2, ea, na, lo2, ra, oa, wo2, bo2, bn2, Ra;
|
|
92162
92233
|
var init_index_es3 = __esm({
|
|
92163
92234
|
"../../node_modules/@walletconnect/utils/dist/index.es.js"() {
|
|
92164
92235
|
"use strict";
|
|
@@ -92166,7 +92237,7 @@ var init_index_es3 = __esm({
|
|
|
92166
92237
|
import_time2 = __toESM(require_cjs());
|
|
92167
92238
|
import_window_getters = __toESM(require_cjs2());
|
|
92168
92239
|
import_window_metadata = __toESM(require_cjs3());
|
|
92169
|
-
|
|
92240
|
+
import_viem5 = require("viem");
|
|
92170
92241
|
init_esm2();
|
|
92171
92242
|
init_index_es();
|
|
92172
92243
|
init_src2();
|
|
@@ -98460,13 +98531,13 @@ var env_exports = {};
|
|
|
98460
98531
|
__export(env_exports, {
|
|
98461
98532
|
isNodeJs: () => isNodeJs
|
|
98462
98533
|
});
|
|
98463
|
-
var
|
|
98534
|
+
var import_environment3, isNodeJs;
|
|
98464
98535
|
var init_env = __esm({
|
|
98465
98536
|
"../../node_modules/@walletconnect/jsonrpc-utils/dist/esm/env.js"() {
|
|
98466
98537
|
"use strict";
|
|
98467
|
-
|
|
98538
|
+
import_environment3 = __toESM(require_cjs4());
|
|
98468
98539
|
__reExport(env_exports, __toESM(require_cjs4()));
|
|
98469
|
-
isNodeJs =
|
|
98540
|
+
isNodeJs = import_environment3.isNode;
|
|
98470
98541
|
}
|
|
98471
98542
|
});
|
|
98472
98543
|
|
|
@@ -100927,7 +100998,7 @@ var require_websocket = __commonJS({
|
|
|
100927
100998
|
"use strict";
|
|
100928
100999
|
var EventEmitter = require("events");
|
|
100929
101000
|
var https2 = require("https");
|
|
100930
|
-
var
|
|
101001
|
+
var http7 = require("http");
|
|
100931
101002
|
var net = require("net");
|
|
100932
101003
|
var tls = require("tls");
|
|
100933
101004
|
var { randomBytes: randomBytes2, createHash } = require("crypto");
|
|
@@ -101391,7 +101462,7 @@ var require_websocket = __commonJS({
|
|
|
101391
101462
|
const isSecure = parsedUrl.protocol === "wss:" || parsedUrl.protocol === "https:";
|
|
101392
101463
|
const defaultPort = isSecure ? 443 : 80;
|
|
101393
101464
|
const key2 = randomBytes2(16).toString("base64");
|
|
101394
|
-
const get2 = isSecure ? https2.get :
|
|
101465
|
+
const get2 = isSecure ? https2.get : http7.get;
|
|
101395
101466
|
let perMessageDeflate;
|
|
101396
101467
|
opts.createConnection = isSecure ? tlsConnect : netConnect;
|
|
101397
101468
|
opts.defaultPort = opts.defaultPort || defaultPort;
|
|
@@ -101808,7 +101879,7 @@ var require_websocket_server = __commonJS({
|
|
|
101808
101879
|
"../../node_modules/@walletconnect/jsonrpc-ws-connection/node_modules/ws/lib/websocket-server.js"(exports2, module2) {
|
|
101809
101880
|
"use strict";
|
|
101810
101881
|
var EventEmitter = require("events");
|
|
101811
|
-
var
|
|
101882
|
+
var http7 = require("http");
|
|
101812
101883
|
var https2 = require("https");
|
|
101813
101884
|
var net = require("net");
|
|
101814
101885
|
var tls = require("tls");
|
|
@@ -101867,8 +101938,8 @@ var require_websocket_server = __commonJS({
|
|
|
101867
101938
|
);
|
|
101868
101939
|
}
|
|
101869
101940
|
if (options.port != null) {
|
|
101870
|
-
this._server =
|
|
101871
|
-
const body =
|
|
101941
|
+
this._server = http7.createServer((req, res) => {
|
|
101942
|
+
const body = http7.STATUS_CODES[426];
|
|
101872
101943
|
res.writeHead(426, {
|
|
101873
101944
|
"Content-Length": body.length,
|
|
101874
101945
|
"Content-Type": "text/plain"
|
|
@@ -102091,7 +102162,7 @@ var require_websocket_server = __commonJS({
|
|
|
102091
102162
|
}
|
|
102092
102163
|
function abortHandshake(socket, code2, message, headers) {
|
|
102093
102164
|
if (socket.writable) {
|
|
102094
|
-
message = message ||
|
|
102165
|
+
message = message || http7.STATUS_CODES[code2];
|
|
102095
102166
|
headers = {
|
|
102096
102167
|
Connection: "close",
|
|
102097
102168
|
"Content-Type": "text/html",
|
|
@@ -102099,7 +102170,7 @@ var require_websocket_server = __commonJS({
|
|
|
102099
102170
|
...headers
|
|
102100
102171
|
};
|
|
102101
102172
|
socket.write(
|
|
102102
|
-
`HTTP/1.1 ${code2} ${
|
|
102173
|
+
`HTTP/1.1 ${code2} ${http7.STATUS_CODES[code2]}\r
|
|
102103
102174
|
` + Object.keys(headers).map((h14) => `${h14}: ${headers[h14]}`).join("\r\n") + "\r\n\r\n" + message
|
|
102104
102175
|
);
|
|
102105
102176
|
}
|
|
@@ -118325,11 +118396,11 @@ var init_PublicStateController = __esm({
|
|
|
118325
118396
|
});
|
|
118326
118397
|
|
|
118327
118398
|
// ../../node_modules/@reown/appkit-controllers/dist/esm/src/utils/ERC7811Util.js
|
|
118328
|
-
var
|
|
118399
|
+
var import_viem6, ERC7811Utils;
|
|
118329
118400
|
var init_ERC7811Util = __esm({
|
|
118330
118401
|
"../../node_modules/@reown/appkit-controllers/dist/esm/src/utils/ERC7811Util.js"() {
|
|
118331
118402
|
"use strict";
|
|
118332
|
-
|
|
118403
|
+
import_viem6 = require("viem");
|
|
118333
118404
|
ERC7811Utils = {
|
|
118334
118405
|
/**
|
|
118335
118406
|
* Creates a Balance object from an ERC7811 Asset object
|
|
@@ -118370,7 +118441,7 @@ var init_ERC7811Util = __esm({
|
|
|
118370
118441
|
* @returns Balance object
|
|
118371
118442
|
*/
|
|
118372
118443
|
convertHexToBalance({ hex, decimals }) {
|
|
118373
|
-
return (0,
|
|
118444
|
+
return (0, import_viem6.formatUnits)(BigInt(hex), decimals);
|
|
118374
118445
|
},
|
|
118375
118446
|
/**
|
|
118376
118447
|
* Converts an address to a CAIP-10 address
|
|
@@ -121312,7 +121383,7 @@ async function ir4(t6, e8, n12, r11, o13, i10) {
|
|
|
121312
121383
|
}
|
|
121313
121384
|
}
|
|
121314
121385
|
async function sr4(t6, e8, n12) {
|
|
121315
|
-
return (await (0,
|
|
121386
|
+
return (await (0, import_viem7.recoverAddress)({ hash: Ve5(e8), signature: n12 })).toLowerCase() === t6.toLowerCase();
|
|
121316
121387
|
}
|
|
121317
121388
|
async function cr4(t6, e8, n12, r11, o13, i10) {
|
|
121318
121389
|
const s9 = Ne4(r11);
|
|
@@ -122908,7 +122979,7 @@ function Ta2() {
|
|
|
122908
122979
|
var t6;
|
|
122909
122980
|
return Tt5() && (0, import_window_getters3.getDocument)() ? ((t6 = (0, import_window_getters3.getDocument)()) == null ? void 0 : t6.visibilityState) === "visible" : true;
|
|
122910
122981
|
}
|
|
122911
|
-
var import_time6, import_window_getters3, import_window_metadata2,
|
|
122982
|
+
var import_time6, import_window_getters3, import_window_metadata2, import_viem7, ae4, Zo3, Yo4, Go4, Tn4, Wo4, Xo3, Rn4, _n4, Jo4, $n4, Y4, jn4, le5, Wn4, _i3, $i3, Li3, ji3, _t5, Xn4, ke6, tr4, er4, nr4, Mi3, Jt5, Di3, Hi2, qi3, Ki3, Fi3, zi3, rr4, or5, En4, Yi2, Gi3, Wi2, Qi2, ts3, es3, ar4, ns2, rs2, ur4, Me6, fr4, os2, de5, lr4, dr4, De5, hr4, mt4, gs2, ys2, Es2, Nr4, xs3, Ss2, Os3, As3, ge5, Bs2, Ur4, Tr4, F4, Us2, Rs2, $s2, Ls3, Rr4, js2, Cs3, $r4, Lr4, ye5, Ge6, jr4, Vs3, qs4, Ks2, wt5, bt4, Fs2, Qt5, me5, we5, zs2, Zs3, ut5, Xe5, Je5, Qe5, kr4, Qs2, tc2, ec3, q3, H4, At3, nc2, en4, Mr4, Dr4, ic2, Zr4, ve4, sn4, Gr4, Ht4, an3, un3, yc2, Xr4, mc2, wc2, fn3, xc2, Sc2, Oc2, lt4, dt5, K5, Qr4, to4, Tc2, Rc2, _c2, ln3, G4, qt6, xe4, Kt5, dn3, Ft5, re4, $c2, eo4, oe3, hn3, so4, Jc2, Qc2, ta2, fo4, ea2, na2, lo4, ra2, oa2, wo4, bo4, bn4, Ra2;
|
|
122912
122983
|
var init_index_es17 = __esm({
|
|
122913
122984
|
"../../node_modules/@reown/appkit/node_modules/@walletconnect/utils/dist/index.es.js"() {
|
|
122914
122985
|
"use strict";
|
|
@@ -122916,7 +122987,7 @@ var init_index_es17 = __esm({
|
|
|
122916
122987
|
import_time6 = __toESM(require_cjs());
|
|
122917
122988
|
import_window_getters3 = __toESM(require_cjs2());
|
|
122918
122989
|
import_window_metadata2 = __toESM(require_cjs3());
|
|
122919
|
-
|
|
122990
|
+
import_viem7 = require("viem");
|
|
122920
122991
|
init_esm8();
|
|
122921
122992
|
init_index_es();
|
|
122922
122993
|
init_src2();
|
|
@@ -128574,11 +128645,11 @@ function getBlockchainApiRpcUrl(caipNetworkId, projectId) {
|
|
|
128574
128645
|
url.searchParams.set("projectId", projectId);
|
|
128575
128646
|
return url.toString();
|
|
128576
128647
|
}
|
|
128577
|
-
var
|
|
128648
|
+
var import_viem8, RPC_URL_HOST, WC_HTTP_RPC_SUPPORTED_CHAINS, CaipNetworksUtil;
|
|
128578
128649
|
var init_CaipNetworkUtil = __esm({
|
|
128579
128650
|
"../../node_modules/@reown/appkit-utils/dist/esm/src/CaipNetworkUtil.js"() {
|
|
128580
128651
|
"use strict";
|
|
128581
|
-
|
|
128652
|
+
import_viem8 = require("viem");
|
|
128582
128653
|
init_esm6();
|
|
128583
128654
|
init_exports();
|
|
128584
128655
|
init_PresetsUtil();
|
|
@@ -128704,10 +128775,10 @@ var init_CaipNetworkUtil = __esm({
|
|
|
128704
128775
|
getViemTransport(caipNetwork, projectId, customRpcUrls) {
|
|
128705
128776
|
const transports = [];
|
|
128706
128777
|
customRpcUrls?.forEach((rpcUrl) => {
|
|
128707
|
-
transports.push((0,
|
|
128778
|
+
transports.push((0, import_viem8.http)(rpcUrl.url, rpcUrl.config));
|
|
128708
128779
|
});
|
|
128709
128780
|
if (WC_HTTP_RPC_SUPPORTED_CHAINS.includes(caipNetwork.caipNetworkId)) {
|
|
128710
|
-
transports.push((0,
|
|
128781
|
+
transports.push((0, import_viem8.http)(getBlockchainApiRpcUrl(caipNetwork.caipNetworkId, projectId), {
|
|
128711
128782
|
fetchOptions: {
|
|
128712
128783
|
headers: {
|
|
128713
128784
|
"Content-Type": "text/plain"
|
|
@@ -128716,14 +128787,14 @@ var init_CaipNetworkUtil = __esm({
|
|
|
128716
128787
|
}));
|
|
128717
128788
|
}
|
|
128718
128789
|
caipNetwork?.rpcUrls?.default?.http?.forEach((rpcUrl) => {
|
|
128719
|
-
transports.push((0,
|
|
128790
|
+
transports.push((0, import_viem8.http)(rpcUrl));
|
|
128720
128791
|
});
|
|
128721
|
-
return (0,
|
|
128792
|
+
return (0, import_viem8.fallback)(transports);
|
|
128722
128793
|
},
|
|
128723
128794
|
extendWagmiTransports(caipNetwork, projectId, transport) {
|
|
128724
128795
|
if (WC_HTTP_RPC_SUPPORTED_CHAINS.includes(caipNetwork.caipNetworkId)) {
|
|
128725
128796
|
const reownRpcUrl = this.getDefaultRpcUrl(caipNetwork, caipNetwork.caipNetworkId, projectId);
|
|
128726
|
-
return (0,
|
|
128797
|
+
return (0, import_viem8.fallback)([transport, (0, import_viem8.http)(reownRpcUrl)]);
|
|
128727
128798
|
}
|
|
128728
128799
|
return transport;
|
|
128729
128800
|
},
|
|
@@ -131399,7 +131470,7 @@ var init_ConstantsUtil5 = __esm({
|
|
|
131399
131470
|
});
|
|
131400
131471
|
|
|
131401
131472
|
// ../../node_modules/@reown/appkit/dist/esm/src/networks/utils.js
|
|
131402
|
-
function
|
|
131473
|
+
function defineChain2(chain) {
|
|
131403
131474
|
return {
|
|
131404
131475
|
formatters: void 0,
|
|
131405
131476
|
fees: void 0,
|
|
@@ -131419,7 +131490,7 @@ var init_solana = __esm({
|
|
|
131419
131490
|
"../../node_modules/@reown/appkit/dist/esm/src/networks/solana/solana.js"() {
|
|
131420
131491
|
"use strict";
|
|
131421
131492
|
init_utils7();
|
|
131422
|
-
solana =
|
|
131493
|
+
solana = defineChain2({
|
|
131423
131494
|
id: "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
|
|
131424
131495
|
name: "Solana",
|
|
131425
131496
|
network: "solana-mainnet",
|
|
@@ -131442,7 +131513,7 @@ var init_solanaDevnet = __esm({
|
|
|
131442
131513
|
"../../node_modules/@reown/appkit/dist/esm/src/networks/solana/solanaDevnet.js"() {
|
|
131443
131514
|
"use strict";
|
|
131444
131515
|
init_utils7();
|
|
131445
|
-
solanaDevnet =
|
|
131516
|
+
solanaDevnet = defineChain2({
|
|
131446
131517
|
id: "EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
|
|
131447
131518
|
name: "Solana Devnet",
|
|
131448
131519
|
network: "solana-devnet",
|
|
@@ -131465,7 +131536,7 @@ var init_solanaTestnet = __esm({
|
|
|
131465
131536
|
"../../node_modules/@reown/appkit/dist/esm/src/networks/solana/solanaTestnet.js"() {
|
|
131466
131537
|
"use strict";
|
|
131467
131538
|
init_utils7();
|
|
131468
|
-
solanaTestnet =
|
|
131539
|
+
solanaTestnet = defineChain2({
|
|
131469
131540
|
id: "4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",
|
|
131470
131541
|
name: "Solana Testnet",
|
|
131471
131542
|
network: "solana-testnet",
|
|
@@ -131497,7 +131568,7 @@ var init_bitcoin = __esm({
|
|
|
131497
131568
|
"../../node_modules/@reown/appkit/dist/esm/src/networks/bitcoin.js"() {
|
|
131498
131569
|
"use strict";
|
|
131499
131570
|
init_utils7();
|
|
131500
|
-
bitcoin =
|
|
131571
|
+
bitcoin = defineChain2({
|
|
131501
131572
|
id: "000000000019d6689c085ae165831e93",
|
|
131502
131573
|
caipNetworkId: "bip122:000000000019d6689c085ae165831e93",
|
|
131503
131574
|
chainNamespace: "bip122",
|
|
@@ -131511,7 +131582,7 @@ var init_bitcoin = __esm({
|
|
|
131511
131582
|
default: { http: ["https://rpc.walletconnect.org/v1"] }
|
|
131512
131583
|
}
|
|
131513
131584
|
});
|
|
131514
|
-
bitcoinTestnet =
|
|
131585
|
+
bitcoinTestnet = defineChain2({
|
|
131515
131586
|
id: "000000000933ea01ad0ee984209779ba",
|
|
131516
131587
|
caipNetworkId: "bip122:000000000933ea01ad0ee984209779ba",
|
|
131517
131588
|
chainNamespace: "bip122",
|
|
@@ -131534,7 +131605,7 @@ var networks_exports = {};
|
|
|
131534
131605
|
__export(networks_exports, {
|
|
131535
131606
|
bitcoin: () => bitcoin,
|
|
131536
131607
|
bitcoinTestnet: () => bitcoinTestnet,
|
|
131537
|
-
defineChain: () =>
|
|
131608
|
+
defineChain: () => defineChain2,
|
|
131538
131609
|
solana: () => solana,
|
|
131539
131610
|
solanaDevnet: () => solanaDevnet,
|
|
131540
131611
|
solanaTestnet: () => solanaTestnet
|
|
@@ -132014,12 +132085,12 @@ var init_ChainAdapterBlueprint = __esm({
|
|
|
132014
132085
|
});
|
|
132015
132086
|
|
|
132016
132087
|
// ../../node_modules/@reown/appkit/dist/esm/src/universal-adapter/client.js
|
|
132017
|
-
var
|
|
132088
|
+
var import_viem9, UniversalAdapter;
|
|
132018
132089
|
var init_client = __esm({
|
|
132019
132090
|
"../../node_modules/@reown/appkit/dist/esm/src/universal-adapter/client.js"() {
|
|
132020
132091
|
"use strict";
|
|
132021
132092
|
init_esm8();
|
|
132022
|
-
|
|
132093
|
+
import_viem9 = require("viem");
|
|
132023
132094
|
init_esm6();
|
|
132024
132095
|
init_exports();
|
|
132025
132096
|
init_ChainAdapterBlueprint();
|
|
@@ -132163,7 +132234,7 @@ var init_client = __esm({
|
|
|
132163
132234
|
try {
|
|
132164
132235
|
await connector.provider?.request({
|
|
132165
132236
|
method: "wallet_switchEthereumChain",
|
|
132166
|
-
params: [{ chainId: (0,
|
|
132237
|
+
params: [{ chainId: (0, import_viem9.toHex)(caipNetwork.id) }]
|
|
132167
132238
|
});
|
|
132168
132239
|
} catch (switchError) {
|
|
132169
132240
|
if (switchError.code === WcConstantsUtil.ERROR_CODE_UNRECOGNIZED_CHAIN_ID || switchError.code === WcConstantsUtil.ERROR_INVALID_CHAIN_ID || switchError.code === WcConstantsUtil.ERROR_CODE_DEFAULT || switchError?.data?.originalError?.code === WcConstantsUtil.ERROR_CODE_UNRECOGNIZED_CHAIN_ID) {
|
|
@@ -132172,7 +132243,7 @@ var init_client = __esm({
|
|
|
132172
132243
|
method: "wallet_addEthereumChain",
|
|
132173
132244
|
params: [
|
|
132174
132245
|
{
|
|
132175
|
-
chainId: (0,
|
|
132246
|
+
chainId: (0, import_viem9.toHex)(caipNetwork.id),
|
|
132176
132247
|
rpcUrls: [caipNetwork?.rpcUrls["chainDefault"]?.http],
|
|
132177
132248
|
chainName: caipNetwork.name,
|
|
132178
132249
|
nativeCurrency: caipNetwork.nativeCurrency,
|
|
@@ -192201,7 +192272,7 @@ var require_websocket2 = __commonJS({
|
|
|
192201
192272
|
"use strict";
|
|
192202
192273
|
var EventEmitter = require("events");
|
|
192203
192274
|
var https2 = require("https");
|
|
192204
|
-
var
|
|
192275
|
+
var http7 = require("http");
|
|
192205
192276
|
var net = require("net");
|
|
192206
192277
|
var tls = require("tls");
|
|
192207
192278
|
var { randomBytes: randomBytes2, createHash } = require("crypto");
|
|
@@ -192731,7 +192802,7 @@ var require_websocket2 = __commonJS({
|
|
|
192731
192802
|
}
|
|
192732
192803
|
const defaultPort = isSecure ? 443 : 80;
|
|
192733
192804
|
const key2 = randomBytes2(16).toString("base64");
|
|
192734
|
-
const request = isSecure ? https2.request :
|
|
192805
|
+
const request = isSecure ? https2.request : http7.request;
|
|
192735
192806
|
const protocolSet = /* @__PURE__ */ new Set();
|
|
192736
192807
|
let perMessageDeflate;
|
|
192737
192808
|
opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect);
|
|
@@ -193201,7 +193272,7 @@ var require_websocket_server2 = __commonJS({
|
|
|
193201
193272
|
"../../node_modules/ws/lib/websocket-server.js"(exports2, module2) {
|
|
193202
193273
|
"use strict";
|
|
193203
193274
|
var EventEmitter = require("events");
|
|
193204
|
-
var
|
|
193275
|
+
var http7 = require("http");
|
|
193205
193276
|
var { Duplex } = require("stream");
|
|
193206
193277
|
var { createHash } = require("crypto");
|
|
193207
193278
|
var extension = require_extension2();
|
|
@@ -193272,8 +193343,8 @@ var require_websocket_server2 = __commonJS({
|
|
|
193272
193343
|
);
|
|
193273
193344
|
}
|
|
193274
193345
|
if (options.port != null) {
|
|
193275
|
-
this._server =
|
|
193276
|
-
const body =
|
|
193346
|
+
this._server = http7.createServer((req, res) => {
|
|
193347
|
+
const body = http7.STATUS_CODES[426];
|
|
193277
193348
|
res.writeHead(426, {
|
|
193278
193349
|
"Content-Length": body.length,
|
|
193279
193350
|
"Content-Type": "text/plain"
|
|
@@ -193558,7 +193629,7 @@ var require_websocket_server2 = __commonJS({
|
|
|
193558
193629
|
this.destroy();
|
|
193559
193630
|
}
|
|
193560
193631
|
function abortHandshake(socket, code2, message, headers) {
|
|
193561
|
-
message = message ||
|
|
193632
|
+
message = message || http7.STATUS_CODES[code2];
|
|
193562
193633
|
headers = {
|
|
193563
193634
|
Connection: "close",
|
|
193564
193635
|
"Content-Type": "text/html",
|
|
@@ -193567,7 +193638,7 @@ var require_websocket_server2 = __commonJS({
|
|
|
193567
193638
|
};
|
|
193568
193639
|
socket.once("finish", socket.destroy);
|
|
193569
193640
|
socket.end(
|
|
193570
|
-
`HTTP/1.1 ${code2} ${
|
|
193641
|
+
`HTTP/1.1 ${code2} ${http7.STATUS_CODES[code2]}\r
|
|
193571
193642
|
` + Object.keys(headers).map((h14) => `${h14}: ${headers[h14]}`).join("\r\n") + "\r\n\r\n" + message
|
|
193572
193643
|
);
|
|
193573
193644
|
}
|
|
@@ -270198,7 +270269,7 @@ var require_fetch_jwks = __commonJS({
|
|
|
270198
270269
|
"../../node_modules/@lit-protocol/contracts-sdk/node_modules/jose/dist/node/cjs/runtime/fetch_jwks.js"(exports2) {
|
|
270199
270270
|
"use strict";
|
|
270200
270271
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
270201
|
-
var
|
|
270272
|
+
var http7 = require("http");
|
|
270202
270273
|
var https2 = require("https");
|
|
270203
270274
|
var events_1 = require("events");
|
|
270204
270275
|
var errors_js_1 = require_errors4();
|
|
@@ -270210,7 +270281,7 @@ var require_fetch_jwks = __commonJS({
|
|
|
270210
270281
|
get2 = https2.get;
|
|
270211
270282
|
break;
|
|
270212
270283
|
case "http:":
|
|
270213
|
-
get2 =
|
|
270284
|
+
get2 = http7.get;
|
|
270214
270285
|
break;
|
|
270215
270286
|
default:
|
|
270216
270287
|
throw new TypeError("Unsupported URL protocol.");
|
|
@@ -286946,15 +287017,780 @@ module.exports = __toCommonJS(index_exports);
|
|
|
286946
287017
|
// src/providers/ArcenPayProvider.tsx
|
|
286947
287018
|
var import_react = require("react");
|
|
286948
287019
|
var import_wagmi = require("wagmi");
|
|
286949
|
-
var
|
|
287020
|
+
var import_chains5 = require("wagmi/chains");
|
|
286950
287021
|
var import_connectors = require("wagmi/connectors");
|
|
286951
287022
|
var import_react_query = require("@tanstack/react-query");
|
|
286952
|
-
|
|
287023
|
+
|
|
287024
|
+
// src/internal/sdk-core/index.ts
|
|
287025
|
+
init_chains();
|
|
287026
|
+
|
|
287027
|
+
// src/internal/sdk-core/addresses.ts
|
|
287028
|
+
var ADDRESSES = {
|
|
287029
|
+
// Ethereum Sepolia (Testnet) — Deployed 2026-03-19
|
|
287030
|
+
11155111: {
|
|
287031
|
+
subscriptionRegistry: "0xE206C519076535A9d24c852093860CFD780908C1",
|
|
287032
|
+
autopayModule: "0xc82417e378b23AD9Ae73229EF08a4BA7896a4351",
|
|
287033
|
+
planFactory: "0x4F97E0c2Ac053b735640fEb164a08Cb45ba83db1",
|
|
287034
|
+
feeCollector: "0xa8A0D3007e5680D387A50C1a1E2Eb0AD092ca396",
|
|
287035
|
+
sessionVault: "0xd68b9C0a34d61CC3b3F982A5EC6Cc5a5739e46D9",
|
|
287036
|
+
zkUsageVerifier: "0x1f75d66692416cE880d51Baf6CdcBeE98E5837c0",
|
|
287037
|
+
mirrorRegistry: "0xC187CD32d569ec0E84B9b378f8E63f3a74afac74"
|
|
287038
|
+
},
|
|
287039
|
+
// Base Sepolia (Testnet) — Deployed 2026-04-23
|
|
287040
|
+
84532: {
|
|
287041
|
+
subscriptionRegistry: "0xF9610c064FFD64255A1d509d17b2Af8733084e50",
|
|
287042
|
+
autopayModule: "0x69Ac04bFdC045A99A2D31bb141A74da354a94c19",
|
|
287043
|
+
planFactory: "0x66775Af13C63781AAd28203CC5d3E9eE5d5eB83d",
|
|
287044
|
+
feeCollector: "0x5F32fBfF19385A78c3F721007758E9924FAD4133",
|
|
287045
|
+
sessionVault: "0x96BcE2d49e3e4EddBBF3aa07354E66615BC2623c",
|
|
287046
|
+
zkUsageVerifier: "0x03290b6988F87925A4939d974895bC30981aA90D",
|
|
287047
|
+
mirrorRegistry: "0xe7E0dFfa82596ee6Ba1755bc25c29376a07236dE"
|
|
287048
|
+
},
|
|
287049
|
+
// Base Mainnet — set ARCENPAY_CONTRACT_8453_* env vars after audit + deployment
|
|
287050
|
+
8453: {
|
|
287051
|
+
subscriptionRegistry: "0x0000000000000000000000000000000000000000",
|
|
287052
|
+
autopayModule: "0x0000000000000000000000000000000000000000",
|
|
287053
|
+
planFactory: "0x0000000000000000000000000000000000000000",
|
|
287054
|
+
feeCollector: "0x0000000000000000000000000000000000000000",
|
|
287055
|
+
sessionVault: "0x0000000000000000000000000000000000000000",
|
|
287056
|
+
zkUsageVerifier: "0x0000000000000000000000000000000000000000",
|
|
287057
|
+
mirrorRegistry: "0x0000000000000000000000000000000000000000"
|
|
287058
|
+
}
|
|
287059
|
+
};
|
|
287060
|
+
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
287061
|
+
var CONTRACT_KEYS = [
|
|
287062
|
+
"subscriptionRegistry",
|
|
287063
|
+
"autopayModule",
|
|
287064
|
+
"planFactory",
|
|
287065
|
+
"feeCollector",
|
|
287066
|
+
"sessionVault",
|
|
287067
|
+
"zkUsageVerifier"
|
|
287068
|
+
];
|
|
287069
|
+
function applyEnvOverrides(chainId, base7) {
|
|
287070
|
+
if (typeof process === "undefined") return base7;
|
|
287071
|
+
const result = { ...base7 };
|
|
287072
|
+
for (const key2 of CONTRACT_KEYS) {
|
|
287073
|
+
const envKey = `ARCENPAY_CONTRACT_${chainId}_${key2}`;
|
|
287074
|
+
const legacyKey = `MEAP_CONTRACT_${chainId}_${key2}`;
|
|
287075
|
+
const override = process.env[envKey] ?? process.env[legacyKey];
|
|
287076
|
+
if (override && override.startsWith("0x")) {
|
|
287077
|
+
result[key2] = override;
|
|
287078
|
+
}
|
|
287079
|
+
}
|
|
287080
|
+
const mirrorOverride = process.env[`ARCENPAY_CONTRACT_${chainId}_mirrorRegistry`] ?? process.env[`MEAP_CONTRACT_${chainId}_mirrorRegistry`];
|
|
287081
|
+
if (mirrorOverride && mirrorOverride.startsWith("0x")) {
|
|
287082
|
+
result.mirrorRegistry = mirrorOverride;
|
|
287083
|
+
}
|
|
287084
|
+
const yieldOverride = process.env[`ARCENPAY_CONTRACT_${chainId}_yieldSessionVault`] ?? process.env[`MEAP_CONTRACT_${chainId}_yieldSessionVault`];
|
|
287085
|
+
if (yieldOverride && yieldOverride.startsWith("0x")) {
|
|
287086
|
+
result.yieldSessionVault = yieldOverride;
|
|
287087
|
+
}
|
|
287088
|
+
return result;
|
|
287089
|
+
}
|
|
287090
|
+
function getContractAddresses(chainId) {
|
|
287091
|
+
const base7 = ADDRESSES[chainId];
|
|
287092
|
+
if (!base7) {
|
|
287093
|
+
throw new Error(`No contract addresses configured for chain ${chainId}`);
|
|
287094
|
+
}
|
|
287095
|
+
const addresses = applyEnvOverrides(chainId, base7);
|
|
287096
|
+
if (typeof process !== "undefined" && process.env.NODE_ENV === "production") {
|
|
287097
|
+
const allZero = CONTRACT_KEYS.every(
|
|
287098
|
+
(k12) => addresses[k12] === ZERO_ADDRESS
|
|
287099
|
+
);
|
|
287100
|
+
if (allZero) {
|
|
287101
|
+
throw new Error(
|
|
287102
|
+
`[getContractAddresses] Chain ${chainId} has no deployed contracts. Set ARCENPAY_CONTRACT_${chainId}_<key> env vars or deploy contracts before using this chain in production.`
|
|
287103
|
+
);
|
|
287104
|
+
}
|
|
287105
|
+
}
|
|
287106
|
+
return addresses;
|
|
287107
|
+
}
|
|
287108
|
+
|
|
287109
|
+
// src/internal/sdk-core/environment.ts
|
|
287110
|
+
init_chains();
|
|
287111
|
+
var ZERO_ADDRESS2 = "0x0000000000000000000000000000000000000000";
|
|
287112
|
+
var REQUIRED_CONTRACT_KEYS = [
|
|
287113
|
+
"subscriptionRegistry",
|
|
287114
|
+
"autopayModule",
|
|
287115
|
+
"planFactory",
|
|
287116
|
+
"feeCollector",
|
|
287117
|
+
"sessionVault",
|
|
287118
|
+
"zkUsageVerifier"
|
|
287119
|
+
];
|
|
287120
|
+
var DEFAULT_SERVICES = {
|
|
287121
|
+
11155111: {
|
|
287122
|
+
rpcUrl: "https://ethereum-sepolia-rpc.publicnode.com"
|
|
287123
|
+
},
|
|
287124
|
+
84532: {
|
|
287125
|
+
rpcUrl: "https://sepolia.base.org"
|
|
287126
|
+
},
|
|
287127
|
+
8453: {
|
|
287128
|
+
rpcUrl: "https://mainnet.base.org"
|
|
287129
|
+
}
|
|
287130
|
+
};
|
|
287131
|
+
var LEGACY_RPC_ENV_KEYS = {
|
|
287132
|
+
11155111: ["SEPOLIA_RPC_URL"],
|
|
287133
|
+
84532: ["BASE_SEPOLIA_RPC_URL"],
|
|
287134
|
+
8453: ["BASE_MAINNET_RPC_URL"]
|
|
287135
|
+
};
|
|
287136
|
+
var SERVICE_ENV_KEYS = {
|
|
287137
|
+
rpcUrl: (chainId) => [
|
|
287138
|
+
`ARCENPAY_RPC_URL_${chainId}`,
|
|
287139
|
+
`MEAP_RPC_URL_${chainId}`,
|
|
287140
|
+
`RPC_URL_${chainId}`,
|
|
287141
|
+
`NEXT_PUBLIC_RPC_URL_${chainId}`,
|
|
287142
|
+
...LEGACY_RPC_ENV_KEYS[chainId] || [],
|
|
287143
|
+
"ARCENPAY_RPC_URL",
|
|
287144
|
+
"MEAP_RPC_URL",
|
|
287145
|
+
"RPC_URL",
|
|
287146
|
+
"NEXT_PUBLIC_RPC_URL"
|
|
287147
|
+
],
|
|
287148
|
+
subgraphUrl: (chainId) => [
|
|
287149
|
+
`ARCENPAY_SUBGRAPH_URL_${chainId}`,
|
|
287150
|
+
`MEAP_SUBGRAPH_URL_${chainId}`,
|
|
287151
|
+
`NEXT_PUBLIC_GRAPH_URL_${chainId}`,
|
|
287152
|
+
"ARCENPAY_SUBGRAPH_URL",
|
|
287153
|
+
"MEAP_SUBGRAPH_URL",
|
|
287154
|
+
"NEXT_PUBLIC_GRAPH_URL"
|
|
287155
|
+
],
|
|
287156
|
+
facilitatorUrl: (chainId) => [
|
|
287157
|
+
`ARCENPAY_FACILITATOR_URL_${chainId}`,
|
|
287158
|
+
`MEAP_FACILITATOR_URL_${chainId}`,
|
|
287159
|
+
`FACILITATOR_BASE_URL_${chainId}`,
|
|
287160
|
+
`FACILITATOR_URL_${chainId}`,
|
|
287161
|
+
`NEXT_PUBLIC_FACILITATOR_BASE_URL_${chainId}`,
|
|
287162
|
+
`NEXT_PUBLIC_FACILITATOR_URL_${chainId}`,
|
|
287163
|
+
"ARCENPAY_FACILITATOR_URL",
|
|
287164
|
+
"MEAP_FACILITATOR_URL",
|
|
287165
|
+
"FACILITATOR_BASE_URL",
|
|
287166
|
+
"FACILITATOR_URL",
|
|
287167
|
+
"NEXT_PUBLIC_FACILITATOR_BASE_URL",
|
|
287168
|
+
"NEXT_PUBLIC_FACILITATOR_URL"
|
|
287169
|
+
]
|
|
287170
|
+
};
|
|
287171
|
+
function getEnv(keys2) {
|
|
287172
|
+
if (typeof process === "undefined") return void 0;
|
|
287173
|
+
for (const key2 of keys2) {
|
|
287174
|
+
const value = process.env[key2]?.trim();
|
|
287175
|
+
if (value) return value;
|
|
287176
|
+
}
|
|
287177
|
+
return void 0;
|
|
287178
|
+
}
|
|
287179
|
+
function resolveServiceUrl(chainId, service, fallback2) {
|
|
287180
|
+
return getEnv(SERVICE_ENV_KEYS[service](chainId)) || fallback2 || "";
|
|
287181
|
+
}
|
|
287182
|
+
function isZeroAddress(value) {
|
|
287183
|
+
return (value || "").toLowerCase() === ZERO_ADDRESS2;
|
|
287184
|
+
}
|
|
287185
|
+
function getChainEnvironment(chainId) {
|
|
287186
|
+
const chain = getChain(chainId);
|
|
287187
|
+
const defaults = DEFAULT_SERVICES[chainId] || {
|
|
287188
|
+
rpcUrl: chain.rpcUrls.default.http[0] || ""
|
|
287189
|
+
};
|
|
287190
|
+
return {
|
|
287191
|
+
chainId,
|
|
287192
|
+
chainName: chain.name,
|
|
287193
|
+
isTestnet: Boolean(chain.testnet),
|
|
287194
|
+
contracts: getContractAddresses(chainId),
|
|
287195
|
+
services: {
|
|
287196
|
+
rpcUrl: resolveServiceUrl(chainId, "rpcUrl", defaults.rpcUrl),
|
|
287197
|
+
subgraphUrl: resolveServiceUrl(chainId, "subgraphUrl", defaults.subgraphUrl),
|
|
287198
|
+
facilitatorUrl: resolveServiceUrl(
|
|
287199
|
+
chainId,
|
|
287200
|
+
"facilitatorUrl",
|
|
287201
|
+
defaults.facilitatorUrl
|
|
287202
|
+
)
|
|
287203
|
+
}
|
|
287204
|
+
};
|
|
287205
|
+
}
|
|
287206
|
+
function isValidHttpUrl(url) {
|
|
287207
|
+
try {
|
|
287208
|
+
const parsed = new URL(url);
|
|
287209
|
+
return parsed.protocol === "http:" || parsed.protocol === "https:";
|
|
287210
|
+
} catch {
|
|
287211
|
+
return false;
|
|
287212
|
+
}
|
|
287213
|
+
}
|
|
287214
|
+
function validateChainEnvironment(chainId, options = {}) {
|
|
287215
|
+
const env = getChainEnvironment(chainId);
|
|
287216
|
+
const production = options.production ?? (typeof process !== "undefined" ? process.env.NODE_ENV === "production" : false);
|
|
287217
|
+
const requiredContracts = options.requiredContracts || REQUIRED_CONTRACT_KEYS;
|
|
287218
|
+
const requiredServices = options.requiredServices || ["rpcUrl"];
|
|
287219
|
+
const contractErrors = requiredContracts.filter((key2) => isZeroAddress(env.contracts[key2])).map((key2) => `${String(key2)} is zero-address`);
|
|
287220
|
+
if (production && contractErrors.length > 0) {
|
|
287221
|
+
throw new Error(
|
|
287222
|
+
`[validateChainEnvironment] Chain ${chainId} invalid contracts: ${contractErrors.join(", ")}`
|
|
287223
|
+
);
|
|
287224
|
+
}
|
|
287225
|
+
const serviceErrors = requiredServices.filter((key2) => !env.services[key2] || !isValidHttpUrl(env.services[key2] || "")).map((key2) => `${String(key2)} is missing or invalid`);
|
|
287226
|
+
if (serviceErrors.length > 0) {
|
|
287227
|
+
throw new Error(
|
|
287228
|
+
`[validateChainEnvironment] Chain ${chainId} invalid services: ${serviceErrors.join(", ")}`
|
|
287229
|
+
);
|
|
287230
|
+
}
|
|
287231
|
+
return { ok: true };
|
|
287232
|
+
}
|
|
287233
|
+
|
|
287234
|
+
// src/internal/sdk-core/runtime-profile.ts
|
|
287235
|
+
init_chains();
|
|
287236
|
+
|
|
287237
|
+
// src/internal/sdk-core/app-origin.ts
|
|
287238
|
+
var ARCENPAY_LOCAL_APP_URL = "http://localhost:3000";
|
|
287239
|
+
var ARCENPAY_PRODUCTION_APP_URL = "https://app.arcenpay.com";
|
|
287240
|
+
var DEFAULT_ENV_KEYS = [
|
|
287241
|
+
"ARCENPAY_BASE_URL",
|
|
287242
|
+
"NEXT_PUBLIC_ARCENPAY_BASE_URL"
|
|
287243
|
+
];
|
|
287244
|
+
function trimTrailingSlash(value) {
|
|
287245
|
+
return value.replace(/\/$/, "");
|
|
287246
|
+
}
|
|
287247
|
+
function getRuntimeEnv() {
|
|
287248
|
+
if (typeof process === "undefined") return void 0;
|
|
287249
|
+
return process.env;
|
|
287250
|
+
}
|
|
287251
|
+
function readEnvValue(env, keys2) {
|
|
287252
|
+
if (!env) return void 0;
|
|
287253
|
+
for (const key2 of keys2) {
|
|
287254
|
+
const value = env[key2]?.trim();
|
|
287255
|
+
if (value) return value;
|
|
287256
|
+
}
|
|
287257
|
+
return void 0;
|
|
287258
|
+
}
|
|
287259
|
+
function resolveArcenPayBaseUrl(options = {}) {
|
|
287260
|
+
if (options.explicit?.trim()) {
|
|
287261
|
+
return trimTrailingSlash(options.explicit.trim());
|
|
287262
|
+
}
|
|
287263
|
+
const env = options.env ?? getRuntimeEnv();
|
|
287264
|
+
const envOverride = readEnvValue(env, options.envKeys ?? DEFAULT_ENV_KEYS);
|
|
287265
|
+
if (envOverride) {
|
|
287266
|
+
return trimTrailingSlash(envOverride);
|
|
287267
|
+
}
|
|
287268
|
+
const localDevUrl = options.localDevUrl ?? ARCENPAY_LOCAL_APP_URL;
|
|
287269
|
+
const productionUrl = options.productionUrl ?? ARCENPAY_PRODUCTION_APP_URL;
|
|
287270
|
+
const nodeEnv = env?.NODE_ENV;
|
|
287271
|
+
if (nodeEnv && nodeEnv !== "production") {
|
|
287272
|
+
return localDevUrl;
|
|
287273
|
+
}
|
|
287274
|
+
return productionUrl;
|
|
287275
|
+
}
|
|
287276
|
+
|
|
287277
|
+
// src/internal/sdk-core/abis.ts
|
|
287278
|
+
var SubscriptionRegistryABI = [
|
|
287279
|
+
// Core functions
|
|
287280
|
+
{
|
|
287281
|
+
type: "function",
|
|
287282
|
+
name: "mint",
|
|
287283
|
+
inputs: [
|
|
287284
|
+
{ name: "to", type: "address" },
|
|
287285
|
+
{ name: "planId", type: "uint256" },
|
|
287286
|
+
{ name: "duration", type: "uint64" }
|
|
287287
|
+
],
|
|
287288
|
+
outputs: [{ name: "tokenId", type: "uint256" }],
|
|
287289
|
+
stateMutability: "nonpayable"
|
|
287290
|
+
},
|
|
287291
|
+
{
|
|
287292
|
+
type: "function",
|
|
287293
|
+
name: "renew",
|
|
287294
|
+
inputs: [
|
|
287295
|
+
{ name: "tokenId", type: "uint256" },
|
|
287296
|
+
{ name: "extension", type: "uint64" }
|
|
287297
|
+
],
|
|
287298
|
+
outputs: [],
|
|
287299
|
+
stateMutability: "nonpayable"
|
|
287300
|
+
},
|
|
287301
|
+
{
|
|
287302
|
+
type: "function",
|
|
287303
|
+
name: "cancel",
|
|
287304
|
+
inputs: [{ name: "tokenId", type: "uint256" }],
|
|
287305
|
+
outputs: [],
|
|
287306
|
+
stateMutability: "nonpayable"
|
|
287307
|
+
},
|
|
287308
|
+
{
|
|
287309
|
+
type: "function",
|
|
287310
|
+
name: "changePlan",
|
|
287311
|
+
inputs: [
|
|
287312
|
+
{ name: "tokenId", type: "uint256" },
|
|
287313
|
+
{ name: "newPlanId", type: "uint256" }
|
|
287314
|
+
],
|
|
287315
|
+
outputs: [],
|
|
287316
|
+
stateMutability: "nonpayable"
|
|
287317
|
+
},
|
|
287318
|
+
{
|
|
287319
|
+
type: "function",
|
|
287320
|
+
name: "isValid",
|
|
287321
|
+
inputs: [{ name: "tokenId", type: "uint256" }],
|
|
287322
|
+
outputs: [{ name: "", type: "bool" }],
|
|
287323
|
+
stateMutability: "view"
|
|
287324
|
+
},
|
|
287325
|
+
{
|
|
287326
|
+
type: "function",
|
|
287327
|
+
name: "expiresAt",
|
|
287328
|
+
inputs: [{ name: "tokenId", type: "uint256" }],
|
|
287329
|
+
outputs: [{ name: "", type: "uint64" }],
|
|
287330
|
+
stateMutability: "view"
|
|
287331
|
+
},
|
|
287332
|
+
{
|
|
287333
|
+
type: "function",
|
|
287334
|
+
name: "getPlanFeatures",
|
|
287335
|
+
inputs: [{ name: "tokenId", type: "uint256" }],
|
|
287336
|
+
outputs: [
|
|
287337
|
+
{ name: "planId", type: "uint256" },
|
|
287338
|
+
{ name: "planTier", type: "string" }
|
|
287339
|
+
],
|
|
287340
|
+
stateMutability: "view"
|
|
287341
|
+
},
|
|
287342
|
+
{
|
|
287343
|
+
type: "function",
|
|
287344
|
+
name: "getWalletSubscription",
|
|
287345
|
+
inputs: [{ name: "wallet", type: "address" }],
|
|
287346
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
287347
|
+
stateMutability: "view"
|
|
287348
|
+
},
|
|
287349
|
+
{
|
|
287350
|
+
type: "function",
|
|
287351
|
+
name: "importSubscription",
|
|
287352
|
+
inputs: [
|
|
287353
|
+
{ name: "to", type: "address" },
|
|
287354
|
+
{ name: "tokenId", type: "uint256" },
|
|
287355
|
+
{ name: "planId", type: "uint256" },
|
|
287356
|
+
{ name: "expiration", type: "uint64" }
|
|
287357
|
+
],
|
|
287358
|
+
outputs: [],
|
|
287359
|
+
stateMutability: "nonpayable"
|
|
287360
|
+
},
|
|
287361
|
+
{
|
|
287362
|
+
type: "function",
|
|
287363
|
+
name: "finalizeMigration",
|
|
287364
|
+
inputs: [],
|
|
287365
|
+
outputs: [],
|
|
287366
|
+
stateMutability: "nonpayable"
|
|
287367
|
+
},
|
|
287368
|
+
{
|
|
287369
|
+
type: "function",
|
|
287370
|
+
name: "hasActiveSubscription",
|
|
287371
|
+
inputs: [{ name: "wallet", type: "address" }],
|
|
287372
|
+
outputs: [{ name: "", type: "bool" }],
|
|
287373
|
+
stateMutability: "view"
|
|
287374
|
+
},
|
|
287375
|
+
{
|
|
287376
|
+
type: "function",
|
|
287377
|
+
name: "authorizedBillers",
|
|
287378
|
+
inputs: [{ name: "biller", type: "address" }],
|
|
287379
|
+
outputs: [{ name: "isAuthorized", type: "bool" }],
|
|
287380
|
+
stateMutability: "view"
|
|
287381
|
+
},
|
|
287382
|
+
{
|
|
287383
|
+
type: "function",
|
|
287384
|
+
name: "setCrossChainTransports",
|
|
287385
|
+
inputs: [
|
|
287386
|
+
{ name: "axelarTransport", type: "address" },
|
|
287387
|
+
{ name: "ccipTransport", type: "address" }
|
|
287388
|
+
],
|
|
287389
|
+
outputs: [],
|
|
287390
|
+
stateMutability: "nonpayable"
|
|
287391
|
+
},
|
|
287392
|
+
{
|
|
287393
|
+
type: "function",
|
|
287394
|
+
name: "dispatchCrossChainUpdate",
|
|
287395
|
+
inputs: [
|
|
287396
|
+
{ name: "tokenId", type: "uint256" },
|
|
287397
|
+
{ name: "destinationChainId", type: "uint256" },
|
|
287398
|
+
{ name: "refundAddress", type: "address" }
|
|
287399
|
+
],
|
|
287400
|
+
outputs: [
|
|
287401
|
+
{ name: "messageId", type: "bytes32" },
|
|
287402
|
+
{ name: "routeUsed", type: "uint8" }
|
|
287403
|
+
],
|
|
287404
|
+
stateMutability: "payable"
|
|
287405
|
+
},
|
|
287406
|
+
// Events
|
|
287407
|
+
{
|
|
287408
|
+
type: "event",
|
|
287409
|
+
name: "SubscriptionMinted",
|
|
287410
|
+
inputs: [
|
|
287411
|
+
{ name: "subscriber", type: "address", indexed: true },
|
|
287412
|
+
{ name: "tokenId", type: "uint256", indexed: true },
|
|
287413
|
+
{ name: "planId", type: "uint256", indexed: true },
|
|
287414
|
+
{ name: "expiration", type: "uint64", indexed: false }
|
|
287415
|
+
]
|
|
287416
|
+
},
|
|
287417
|
+
{
|
|
287418
|
+
type: "event",
|
|
287419
|
+
name: "SubscriptionRenewed",
|
|
287420
|
+
inputs: [
|
|
287421
|
+
{ name: "tokenId", type: "uint256", indexed: true },
|
|
287422
|
+
{ name: "newExpiration", type: "uint64", indexed: false },
|
|
287423
|
+
{ name: "amountPaid", type: "uint256", indexed: false }
|
|
287424
|
+
]
|
|
287425
|
+
},
|
|
287426
|
+
{
|
|
287427
|
+
type: "event",
|
|
287428
|
+
name: "SubscriptionCancelled",
|
|
287429
|
+
inputs: [{ name: "tokenId", type: "uint256", indexed: true }]
|
|
287430
|
+
},
|
|
287431
|
+
{
|
|
287432
|
+
type: "event",
|
|
287433
|
+
name: "SubscriptionPlanChanged",
|
|
287434
|
+
inputs: [
|
|
287435
|
+
{ name: "tokenId", type: "uint256", indexed: true },
|
|
287436
|
+
{ name: "previousPlanId", type: "uint256", indexed: true },
|
|
287437
|
+
{ name: "newPlanId", type: "uint256", indexed: true },
|
|
287438
|
+
{ name: "expiration", type: "uint64", indexed: false }
|
|
287439
|
+
]
|
|
287440
|
+
},
|
|
287441
|
+
{
|
|
287442
|
+
type: "event",
|
|
287443
|
+
name: "BillingSuccess",
|
|
287444
|
+
inputs: [
|
|
287445
|
+
{ name: "tokenId", type: "uint256", indexed: true },
|
|
287446
|
+
{ name: "planId", type: "uint256", indexed: true },
|
|
287447
|
+
{ name: "amount", type: "uint256", indexed: false },
|
|
287448
|
+
{ name: "timestamp", type: "uint256", indexed: false }
|
|
287449
|
+
]
|
|
287450
|
+
},
|
|
287451
|
+
{
|
|
287452
|
+
type: "event",
|
|
287453
|
+
name: "CrossChainDispatchRequested",
|
|
287454
|
+
inputs: [
|
|
287455
|
+
{ name: "tokenId", type: "uint256", indexed: true },
|
|
287456
|
+
{ name: "destinationChainId", type: "uint256", indexed: true },
|
|
287457
|
+
{ name: "route", type: "uint8", indexed: true },
|
|
287458
|
+
{ name: "messageId", type: "bytes32", indexed: false }
|
|
287459
|
+
]
|
|
287460
|
+
},
|
|
287461
|
+
{
|
|
287462
|
+
type: "event",
|
|
287463
|
+
name: "CrossChainFallbackTriggered",
|
|
287464
|
+
inputs: [
|
|
287465
|
+
{ name: "tokenId", type: "uint256", indexed: true },
|
|
287466
|
+
{ name: "destinationChainId", type: "uint256", indexed: true },
|
|
287467
|
+
{ name: "primaryError", type: "bytes", indexed: false }
|
|
287468
|
+
]
|
|
287469
|
+
},
|
|
287470
|
+
{
|
|
287471
|
+
type: "event",
|
|
287472
|
+
name: "SubscriptionImported",
|
|
287473
|
+
inputs: [
|
|
287474
|
+
{ name: "subscriber", type: "address", indexed: true },
|
|
287475
|
+
{ name: "tokenId", type: "uint256", indexed: true },
|
|
287476
|
+
{ name: "planId", type: "uint256", indexed: true },
|
|
287477
|
+
{ name: "expiration", type: "uint64", indexed: false }
|
|
287478
|
+
]
|
|
287479
|
+
},
|
|
287480
|
+
{
|
|
287481
|
+
type: "event",
|
|
287482
|
+
name: "RegistryMigrationFinalized",
|
|
287483
|
+
inputs: []
|
|
287484
|
+
},
|
|
287485
|
+
{
|
|
287486
|
+
type: "event",
|
|
287487
|
+
name: "Transfer",
|
|
287488
|
+
inputs: [
|
|
287489
|
+
{ name: "from", type: "address", indexed: true },
|
|
287490
|
+
{ name: "to", type: "address", indexed: true },
|
|
287491
|
+
{ name: "tokenId", type: "uint256", indexed: true }
|
|
287492
|
+
]
|
|
287493
|
+
}
|
|
287494
|
+
];
|
|
287495
|
+
var PlanFactoryABI = [
|
|
287496
|
+
{
|
|
287497
|
+
type: "function",
|
|
287498
|
+
name: "createPlan",
|
|
287499
|
+
inputs: [
|
|
287500
|
+
{ name: "name", type: "string" },
|
|
287501
|
+
{ name: "tier", type: "string" },
|
|
287502
|
+
{ name: "price", type: "uint256" },
|
|
287503
|
+
{ name: "billingInterval", type: "uint32" },
|
|
287504
|
+
{ name: "acceptedToken", type: "address" },
|
|
287505
|
+
{ name: "metadataURI", type: "string" }
|
|
287506
|
+
],
|
|
287507
|
+
outputs: [{ name: "planId", type: "uint256" }],
|
|
287508
|
+
stateMutability: "nonpayable"
|
|
287509
|
+
},
|
|
287510
|
+
{
|
|
287511
|
+
type: "function",
|
|
287512
|
+
name: "getPlan",
|
|
287513
|
+
inputs: [{ name: "planId", type: "uint256" }],
|
|
287514
|
+
outputs: [
|
|
287515
|
+
{
|
|
287516
|
+
name: "plan",
|
|
287517
|
+
type: "tuple",
|
|
287518
|
+
components: [
|
|
287519
|
+
{ name: "id", type: "uint256" },
|
|
287520
|
+
{ name: "provider", type: "address" },
|
|
287521
|
+
{ name: "name", type: "string" },
|
|
287522
|
+
{ name: "tier", type: "string" },
|
|
287523
|
+
{ name: "price", type: "uint256" },
|
|
287524
|
+
{ name: "billingInterval", type: "uint32" },
|
|
287525
|
+
{ name: "acceptedToken", type: "address" },
|
|
287526
|
+
{ name: "active", type: "bool" },
|
|
287527
|
+
{ name: "metadataURI", type: "string" }
|
|
287528
|
+
]
|
|
287529
|
+
}
|
|
287530
|
+
],
|
|
287531
|
+
stateMutability: "view"
|
|
287532
|
+
},
|
|
287533
|
+
{
|
|
287534
|
+
type: "function",
|
|
287535
|
+
name: "getProviderPlans",
|
|
287536
|
+
inputs: [{ name: "provider", type: "address" }],
|
|
287537
|
+
outputs: [{ name: "planIds", type: "uint256[]" }],
|
|
287538
|
+
stateMutability: "view"
|
|
287539
|
+
},
|
|
287540
|
+
{
|
|
287541
|
+
type: "function",
|
|
287542
|
+
name: "isProvider",
|
|
287543
|
+
inputs: [{ name: "provider", type: "address" }],
|
|
287544
|
+
outputs: [{ name: "", type: "bool" }],
|
|
287545
|
+
stateMutability: "view"
|
|
287546
|
+
},
|
|
287547
|
+
{
|
|
287548
|
+
type: "event",
|
|
287549
|
+
name: "PlanCreated",
|
|
287550
|
+
inputs: [
|
|
287551
|
+
{ name: "planId", type: "uint256", indexed: true },
|
|
287552
|
+
{ name: "provider", type: "address", indexed: true },
|
|
287553
|
+
{ name: "name", type: "string", indexed: false },
|
|
287554
|
+
{ name: "price", type: "uint256", indexed: false },
|
|
287555
|
+
{ name: "billingInterval", type: "uint32", indexed: false }
|
|
287556
|
+
]
|
|
287557
|
+
},
|
|
287558
|
+
{
|
|
287559
|
+
type: "function",
|
|
287560
|
+
name: "deactivatePlan",
|
|
287561
|
+
inputs: [{ name: "planId", type: "uint256" }],
|
|
287562
|
+
outputs: [],
|
|
287563
|
+
stateMutability: "nonpayable"
|
|
287564
|
+
},
|
|
287565
|
+
{
|
|
287566
|
+
type: "function",
|
|
287567
|
+
name: "updatePlan",
|
|
287568
|
+
inputs: [
|
|
287569
|
+
{ name: "planId", type: "uint256" },
|
|
287570
|
+
{ name: "price", type: "uint256" },
|
|
287571
|
+
{ name: "metadataURI", type: "string" }
|
|
287572
|
+
],
|
|
287573
|
+
outputs: [],
|
|
287574
|
+
stateMutability: "nonpayable"
|
|
287575
|
+
},
|
|
287576
|
+
{
|
|
287577
|
+
type: "event",
|
|
287578
|
+
name: "PlanDeactivated",
|
|
287579
|
+
inputs: [{ name: "planId", type: "uint256", indexed: true }]
|
|
287580
|
+
}
|
|
287581
|
+
];
|
|
287582
|
+
var ERC7579AutopayModuleABI = [
|
|
287583
|
+
{
|
|
287584
|
+
type: "function",
|
|
287585
|
+
name: "onInstall",
|
|
287586
|
+
inputs: [{ name: "data", type: "bytes" }],
|
|
287587
|
+
outputs: [],
|
|
287588
|
+
stateMutability: "nonpayable"
|
|
287589
|
+
},
|
|
287590
|
+
{
|
|
287591
|
+
type: "function",
|
|
287592
|
+
name: "onUninstall",
|
|
287593
|
+
inputs: [{ name: "data", type: "bytes" }],
|
|
287594
|
+
outputs: [],
|
|
287595
|
+
stateMutability: "nonpayable"
|
|
287596
|
+
},
|
|
287597
|
+
{
|
|
287598
|
+
type: "function",
|
|
287599
|
+
name: "execute",
|
|
287600
|
+
inputs: [
|
|
287601
|
+
{ name: "account", type: "address" },
|
|
287602
|
+
{ name: "amount", type: "uint256" }
|
|
287603
|
+
],
|
|
287604
|
+
outputs: [],
|
|
287605
|
+
stateMutability: "nonpayable"
|
|
287606
|
+
},
|
|
287607
|
+
{
|
|
287608
|
+
type: "function",
|
|
287609
|
+
name: "isInitialized",
|
|
287610
|
+
inputs: [{ name: "smartAccount", type: "address" }],
|
|
287611
|
+
outputs: [{ name: "", type: "bool" }],
|
|
287612
|
+
stateMutability: "view"
|
|
287613
|
+
},
|
|
287614
|
+
{
|
|
287615
|
+
type: "function",
|
|
287616
|
+
name: "getConfig",
|
|
287617
|
+
inputs: [{ name: "account", type: "address" }],
|
|
287618
|
+
outputs: [
|
|
287619
|
+
{
|
|
287620
|
+
name: "config",
|
|
287621
|
+
type: "tuple",
|
|
287622
|
+
components: [
|
|
287623
|
+
{ name: "merchant", type: "address" },
|
|
287624
|
+
{ name: "maxAmount", type: "uint256" },
|
|
287625
|
+
{ name: "token", type: "address" },
|
|
287626
|
+
{ name: "interval", type: "uint32" },
|
|
287627
|
+
{ name: "startTime", type: "uint64" },
|
|
287628
|
+
{ name: "planId", type: "uint256" },
|
|
287629
|
+
{ name: "maxTotalAmount", type: "uint256" }
|
|
287630
|
+
]
|
|
287631
|
+
}
|
|
287632
|
+
],
|
|
287633
|
+
stateMutability: "view"
|
|
287634
|
+
},
|
|
287635
|
+
{
|
|
287636
|
+
type: "function",
|
|
287637
|
+
name: "updateConfig",
|
|
287638
|
+
inputs: [
|
|
287639
|
+
{
|
|
287640
|
+
name: "config",
|
|
287641
|
+
type: "tuple",
|
|
287642
|
+
components: [
|
|
287643
|
+
{ name: "merchant", type: "address" },
|
|
287644
|
+
{ name: "maxAmount", type: "uint256" },
|
|
287645
|
+
{ name: "token", type: "address" },
|
|
287646
|
+
{ name: "interval", type: "uint32" },
|
|
287647
|
+
{ name: "startTime", type: "uint64" },
|
|
287648
|
+
{ name: "planId", type: "uint256" },
|
|
287649
|
+
{ name: "maxTotalAmount", type: "uint256" }
|
|
287650
|
+
]
|
|
287651
|
+
}
|
|
287652
|
+
],
|
|
287653
|
+
outputs: [],
|
|
287654
|
+
stateMutability: "nonpayable"
|
|
287655
|
+
},
|
|
287656
|
+
{
|
|
287657
|
+
type: "function",
|
|
287658
|
+
name: "canExecute",
|
|
287659
|
+
inputs: [{ name: "account", type: "address" }],
|
|
287660
|
+
outputs: [{ name: "", type: "bool" }],
|
|
287661
|
+
stateMutability: "view"
|
|
287662
|
+
},
|
|
287663
|
+
{
|
|
287664
|
+
type: "function",
|
|
287665
|
+
name: "lastPullTime",
|
|
287666
|
+
inputs: [{ name: "account", type: "address" }],
|
|
287667
|
+
outputs: [{ name: "", type: "uint64" }],
|
|
287668
|
+
stateMutability: "view"
|
|
287669
|
+
},
|
|
287670
|
+
{
|
|
287671
|
+
type: "function",
|
|
287672
|
+
name: "mirrorDestinationChainId",
|
|
287673
|
+
inputs: [{ name: "account", type: "address" }],
|
|
287674
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
287675
|
+
stateMutability: "view"
|
|
287676
|
+
},
|
|
287677
|
+
{
|
|
287678
|
+
type: "function",
|
|
287679
|
+
name: "isAccountPaused",
|
|
287680
|
+
inputs: [{ name: "account", type: "address" }],
|
|
287681
|
+
outputs: [{ name: "", type: "bool" }],
|
|
287682
|
+
stateMutability: "view"
|
|
287683
|
+
},
|
|
287684
|
+
{
|
|
287685
|
+
type: "function",
|
|
287686
|
+
name: "importAccountState",
|
|
287687
|
+
inputs: [
|
|
287688
|
+
{ name: "account", type: "address" },
|
|
287689
|
+
{
|
|
287690
|
+
name: "config",
|
|
287691
|
+
type: "tuple",
|
|
287692
|
+
components: [
|
|
287693
|
+
{ name: "merchant", type: "address" },
|
|
287694
|
+
{ name: "maxAmount", type: "uint256" },
|
|
287695
|
+
{ name: "token", type: "address" },
|
|
287696
|
+
{ name: "interval", type: "uint32" },
|
|
287697
|
+
{ name: "startTime", type: "uint64" },
|
|
287698
|
+
{ name: "planId", type: "uint256" },
|
|
287699
|
+
{ name: "maxTotalAmount", type: "uint256" }
|
|
287700
|
+
]
|
|
287701
|
+
},
|
|
287702
|
+
{ name: "lastPullTime_", type: "uint64" },
|
|
287703
|
+
{ name: "totalPulled_", type: "uint256" },
|
|
287704
|
+
{ name: "mirrorDestinationChainId_", type: "uint256" },
|
|
287705
|
+
{ name: "accountPaused_", type: "bool" }
|
|
287706
|
+
],
|
|
287707
|
+
outputs: [],
|
|
287708
|
+
stateMutability: "nonpayable"
|
|
287709
|
+
},
|
|
287710
|
+
{
|
|
287711
|
+
type: "function",
|
|
287712
|
+
name: "finalizeMigration",
|
|
287713
|
+
inputs: [],
|
|
287714
|
+
outputs: [],
|
|
287715
|
+
stateMutability: "nonpayable"
|
|
287716
|
+
},
|
|
287717
|
+
{
|
|
287718
|
+
type: "event",
|
|
287719
|
+
name: "AutopayConfigured",
|
|
287720
|
+
inputs: [
|
|
287721
|
+
{ name: "account", type: "address", indexed: true },
|
|
287722
|
+
{ name: "merchant", type: "address", indexed: true },
|
|
287723
|
+
{ name: "maxAmount", type: "uint256", indexed: false },
|
|
287724
|
+
{ name: "token", type: "address", indexed: false },
|
|
287725
|
+
{ name: "interval", type: "uint32", indexed: false }
|
|
287726
|
+
]
|
|
287727
|
+
},
|
|
287728
|
+
{
|
|
287729
|
+
type: "event",
|
|
287730
|
+
name: "AutopayConfigUpdated",
|
|
287731
|
+
inputs: [
|
|
287732
|
+
{ name: "account", type: "address", indexed: true },
|
|
287733
|
+
{ name: "previousPlanId", type: "uint256", indexed: true },
|
|
287734
|
+
{ name: "newPlanId", type: "uint256", indexed: true },
|
|
287735
|
+
{ name: "maxAmount", type: "uint256", indexed: false },
|
|
287736
|
+
{ name: "interval", type: "uint32", indexed: false }
|
|
287737
|
+
]
|
|
287738
|
+
},
|
|
287739
|
+
{
|
|
287740
|
+
type: "event",
|
|
287741
|
+
name: "PaymentExecuted",
|
|
287742
|
+
inputs: [
|
|
287743
|
+
{ name: "account", type: "address", indexed: true },
|
|
287744
|
+
{ name: "merchant", type: "address", indexed: true },
|
|
287745
|
+
{ name: "amount", type: "uint256", indexed: false },
|
|
287746
|
+
{ name: "timestamp", type: "uint256", indexed: false }
|
|
287747
|
+
]
|
|
287748
|
+
},
|
|
287749
|
+
{
|
|
287750
|
+
type: "event",
|
|
287751
|
+
name: "BillingExecuted",
|
|
287752
|
+
inputs: [
|
|
287753
|
+
{ name: "account", type: "address", indexed: true },
|
|
287754
|
+
{ name: "merchant", type: "address", indexed: true },
|
|
287755
|
+
{ name: "tokenId", type: "uint256", indexed: true },
|
|
287756
|
+
{ name: "planId", type: "uint256", indexed: false },
|
|
287757
|
+
{ name: "reason", type: "uint8", indexed: false },
|
|
287758
|
+
{ name: "grossAmount", type: "uint256", indexed: false },
|
|
287759
|
+
{ name: "merchantAmount", type: "uint256", indexed: false },
|
|
287760
|
+
{ name: "protocolFee", type: "uint256", indexed: false },
|
|
287761
|
+
{ name: "timestamp", type: "uint256", indexed: false }
|
|
287762
|
+
]
|
|
287763
|
+
},
|
|
287764
|
+
{
|
|
287765
|
+
type: "event",
|
|
287766
|
+
name: "AutopayRevoked",
|
|
287767
|
+
inputs: [{ name: "account", type: "address", indexed: true }]
|
|
287768
|
+
},
|
|
287769
|
+
{
|
|
287770
|
+
type: "event",
|
|
287771
|
+
name: "AccountStateImported",
|
|
287772
|
+
inputs: [
|
|
287773
|
+
{ name: "account", type: "address", indexed: true },
|
|
287774
|
+
{ name: "planId", type: "uint256", indexed: true },
|
|
287775
|
+
{ name: "lastPullTime", type: "uint64", indexed: false }
|
|
287776
|
+
]
|
|
287777
|
+
},
|
|
287778
|
+
{
|
|
287779
|
+
type: "event",
|
|
287780
|
+
name: "MigrationFinalized",
|
|
287781
|
+
inputs: []
|
|
287782
|
+
}
|
|
287783
|
+
];
|
|
287784
|
+
|
|
287785
|
+
// src/internal/sdk-core/accounts.ts
|
|
287786
|
+
var import_viem2 = require("viem");
|
|
287787
|
+
|
|
287788
|
+
// src/internal/sdk-core/index.ts
|
|
287789
|
+
init_chains();
|
|
286953
287790
|
|
|
286954
287791
|
// src/lib/api.ts
|
|
286955
|
-
var import_sdk = require("@arcenpay/sdk");
|
|
286956
287792
|
function resolveDashboardBaseUrl(explicit) {
|
|
286957
|
-
return
|
|
287793
|
+
return resolveArcenPayBaseUrl({ explicit });
|
|
286958
287794
|
}
|
|
286959
287795
|
function createPaymentLinkCheckoutUrl(slug, baseUrl4) {
|
|
286960
287796
|
const resolvedBaseUrl = resolveDashboardBaseUrl(baseUrl4);
|
|
@@ -286983,7 +287819,7 @@ function getChainId() {
|
|
|
286983
287819
|
}
|
|
286984
287820
|
}
|
|
286985
287821
|
}
|
|
286986
|
-
return
|
|
287822
|
+
return DEFAULT_CHAIN_ID;
|
|
286987
287823
|
}
|
|
286988
287824
|
function getWalletConnectProjectId() {
|
|
286989
287825
|
if (typeof process !== "undefined") {
|
|
@@ -287020,7 +287856,7 @@ function ArcenPayProvider(props) {
|
|
|
287020
287856
|
const global_ = typeof process !== "undefined" ? process.env.NEXT_PUBLIC_RPC_URL : void 0;
|
|
287021
287857
|
const manifestRpc = (() => {
|
|
287022
287858
|
try {
|
|
287023
|
-
return
|
|
287859
|
+
return getChainEnvironment(id2).services.rpcUrl;
|
|
287024
287860
|
} catch {
|
|
287025
287861
|
return "";
|
|
287026
287862
|
}
|
|
@@ -287029,12 +287865,12 @@ function ArcenPayProvider(props) {
|
|
|
287029
287865
|
return url ? (0, import_wagmi.http)(url) : (0, import_wagmi.http)();
|
|
287030
287866
|
};
|
|
287031
287867
|
return (0, import_wagmi.createConfig)({
|
|
287032
|
-
chains: [
|
|
287868
|
+
chains: [import_chains5.sepolia, import_chains5.baseSepolia, import_chains5.base],
|
|
287033
287869
|
connectors: projectId ? [(0, import_connectors.injected)(), (0, import_connectors.walletConnect)({ projectId })] : [(0, import_connectors.injected)()],
|
|
287034
287870
|
transports: {
|
|
287035
|
-
[
|
|
287036
|
-
[
|
|
287037
|
-
[
|
|
287871
|
+
[import_chains5.sepolia.id]: getRpcTransport(import_chains5.sepolia.id),
|
|
287872
|
+
[import_chains5.baseSepolia.id]: getRpcTransport(import_chains5.baseSepolia.id),
|
|
287873
|
+
[import_chains5.base.id]: getRpcTransport(import_chains5.base.id)
|
|
287038
287874
|
},
|
|
287039
287875
|
ssr: true
|
|
287040
287876
|
});
|
|
@@ -287118,12 +287954,12 @@ function ArcenPayProvider(props) {
|
|
|
287118
287954
|
}, [identify]);
|
|
287119
287955
|
const contextValue = (0, import_react.useMemo)(() => {
|
|
287120
287956
|
if (typeof process !== "undefined" && process.env.NODE_ENV === "production") {
|
|
287121
|
-
|
|
287957
|
+
validateChainEnvironment(chainId, {
|
|
287122
287958
|
production: true,
|
|
287123
287959
|
requiredServices: ["rpcUrl"]
|
|
287124
287960
|
});
|
|
287125
287961
|
}
|
|
287126
|
-
const manifest =
|
|
287962
|
+
const manifest = getChainEnvironment(chainId);
|
|
287127
287963
|
const contracts = manifest.contracts;
|
|
287128
287964
|
const network = {
|
|
287129
287965
|
chainId,
|
|
@@ -287164,18 +288000,16 @@ function useArcenPay() {
|
|
|
287164
288000
|
// src/components/ArcenEmbed.tsx
|
|
287165
288001
|
var import_react2 = require("react");
|
|
287166
288002
|
var import_react_dom = require("react-dom");
|
|
287167
|
-
var import_sdk5 = require("@arcenpay/sdk");
|
|
287168
288003
|
|
|
287169
288004
|
// src/lib/zerodev.ts
|
|
287170
288005
|
var import_sdk3 = require("@zerodev/sdk");
|
|
287171
288006
|
var import_ecdsa_validator = require("@zerodev/ecdsa-validator");
|
|
287172
|
-
var
|
|
287173
|
-
var
|
|
287174
|
-
var import_sdk4 = require("@arcenpay/sdk");
|
|
288007
|
+
var import_viem3 = require("viem");
|
|
288008
|
+
var import_chains6 = require("viem/chains");
|
|
287175
288009
|
var CHAIN_MAP = {
|
|
287176
|
-
11155111:
|
|
287177
|
-
84532:
|
|
287178
|
-
8453:
|
|
288010
|
+
11155111: import_chains6.sepolia,
|
|
288011
|
+
84532: import_chains6.baseSepolia,
|
|
288012
|
+
8453: import_chains6.base
|
|
287179
288013
|
};
|
|
287180
288014
|
var ENTRY_POINT = import_sdk3.constants.getEntryPoint("0.7");
|
|
287181
288015
|
var ENTRY_POINT_ADDRESS = ENTRY_POINT.address;
|
|
@@ -287219,16 +288053,16 @@ function isRecoverableSmartAccountFundingError(error) {
|
|
|
287219
288053
|
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");
|
|
287220
288054
|
}
|
|
287221
288055
|
async function createKernelExecutionContext(config) {
|
|
287222
|
-
const chain = CHAIN_MAP[config.chainId] ||
|
|
288056
|
+
const chain = CHAIN_MAP[config.chainId] || import_chains6.baseSepolia;
|
|
287223
288057
|
const { bundlerUrl, paymasterUrl, hasConfiguredUrls } = resolveZeroDevUrls({
|
|
287224
288058
|
projectId: config.projectId,
|
|
287225
288059
|
chainId: config.chainId,
|
|
287226
288060
|
bundlerUrl: config.bundlerUrl,
|
|
287227
288061
|
paymasterUrl: config.paymasterUrl
|
|
287228
288062
|
});
|
|
287229
|
-
const publicClient = (0,
|
|
288063
|
+
const publicClient = (0, import_viem3.createPublicClient)({
|
|
287230
288064
|
chain,
|
|
287231
|
-
transport: (0,
|
|
288065
|
+
transport: (0, import_viem3.http)()
|
|
287232
288066
|
});
|
|
287233
288067
|
const ecdsaValidator = await (0, import_ecdsa_validator.signerToEcdsaValidator)(publicClient, {
|
|
287234
288068
|
signer: config.walletClient,
|
|
@@ -287242,14 +288076,16 @@ async function createKernelExecutionContext(config) {
|
|
|
287242
288076
|
});
|
|
287243
288077
|
const paymasterClient = (0, import_sdk3.createZeroDevPaymasterClient)({
|
|
287244
288078
|
chain,
|
|
287245
|
-
transport: (0,
|
|
288079
|
+
transport: (0, import_viem3.http)(paymasterUrl)
|
|
287246
288080
|
});
|
|
287247
288081
|
const kernelClient = (0, import_sdk3.createKernelAccountClient)({
|
|
287248
288082
|
account: kernelAccount,
|
|
287249
288083
|
chain,
|
|
287250
|
-
bundlerTransport: (0,
|
|
288084
|
+
bundlerTransport: (0, import_viem3.http)(bundlerUrl),
|
|
287251
288085
|
middleware: {
|
|
287252
|
-
sponsorUserOperation: async ({
|
|
288086
|
+
sponsorUserOperation: async ({
|
|
288087
|
+
userOperation
|
|
288088
|
+
}) => {
|
|
287253
288089
|
return paymasterClient.sponsorUserOperation({
|
|
287254
288090
|
userOperation,
|
|
287255
288091
|
entryPoint: ENTRY_POINT_ADDRESS
|
|
@@ -287267,17 +288103,17 @@ async function createKernelExecutionContext(config) {
|
|
|
287267
288103
|
};
|
|
287268
288104
|
}
|
|
287269
288105
|
async function deploySmartAccount(config) {
|
|
287270
|
-
const chain = CHAIN_MAP[config.chainId] ||
|
|
287271
|
-
const contracts =
|
|
288106
|
+
const chain = CHAIN_MAP[config.chainId] || import_chains6.baseSepolia;
|
|
288107
|
+
const contracts = getContractAddresses(config.chainId);
|
|
287272
288108
|
const { bundlerUrl, paymasterUrl, hasConfiguredUrls } = resolveZeroDevUrls({
|
|
287273
288109
|
projectId: config.projectId,
|
|
287274
288110
|
chainId: config.chainId,
|
|
287275
288111
|
bundlerUrl: config.bundlerUrl,
|
|
287276
288112
|
paymasterUrl: config.paymasterUrl
|
|
287277
288113
|
});
|
|
287278
|
-
const publicClient = (0,
|
|
288114
|
+
const publicClient = (0, import_viem3.createPublicClient)({
|
|
287279
288115
|
chain,
|
|
287280
|
-
transport: (0,
|
|
288116
|
+
transport: (0, import_viem3.http)()
|
|
287281
288117
|
});
|
|
287282
288118
|
const ecdsaValidator = await (0, import_ecdsa_validator.signerToEcdsaValidator)(publicClient, {
|
|
287283
288119
|
signer: config.walletClient,
|
|
@@ -287296,14 +288132,16 @@ async function deploySmartAccount(config) {
|
|
|
287296
288132
|
const alreadyDeployed = !!code2 && code2 !== "0x";
|
|
287297
288133
|
const paymasterClient = (0, import_sdk3.createZeroDevPaymasterClient)({
|
|
287298
288134
|
chain,
|
|
287299
|
-
transport: (0,
|
|
288135
|
+
transport: (0, import_viem3.http)(paymasterUrl)
|
|
287300
288136
|
});
|
|
287301
288137
|
const kernelClient = (0, import_sdk3.createKernelAccountClient)({
|
|
287302
288138
|
account: kernelAccount,
|
|
287303
288139
|
chain,
|
|
287304
|
-
bundlerTransport: (0,
|
|
288140
|
+
bundlerTransport: (0, import_viem3.http)(bundlerUrl),
|
|
287305
288141
|
middleware: {
|
|
287306
|
-
sponsorUserOperation: async ({
|
|
288142
|
+
sponsorUserOperation: async ({
|
|
288143
|
+
userOperation
|
|
288144
|
+
}) => {
|
|
287307
288145
|
return paymasterClient.sponsorUserOperation({
|
|
287308
288146
|
userOperation,
|
|
287309
288147
|
entryPoint: ENTRY_POINT_ADDRESS
|
|
@@ -287316,7 +288154,7 @@ async function deploySmartAccount(config) {
|
|
|
287316
288154
|
try {
|
|
287317
288155
|
const initialized = await publicClient.readContract({
|
|
287318
288156
|
address: contracts.autopayModule,
|
|
287319
|
-
abi:
|
|
288157
|
+
abi: ERC7579AutopayModuleABI,
|
|
287320
288158
|
functionName: "isInitialized",
|
|
287321
288159
|
args: [smartAccountAddress]
|
|
287322
288160
|
});
|
|
@@ -287330,7 +288168,7 @@ async function deploySmartAccount(config) {
|
|
|
287330
288168
|
alreadyDeployed
|
|
287331
288169
|
};
|
|
287332
288170
|
}
|
|
287333
|
-
const installData = (0,
|
|
288171
|
+
const installData = (0, import_viem3.encodeFunctionData)({
|
|
287334
288172
|
abi: [
|
|
287335
288173
|
{
|
|
287336
288174
|
type: "function",
|
|
@@ -287380,7 +288218,10 @@ async function deploySmartAccount(config) {
|
|
|
287380
288218
|
normalizedError.message
|
|
287381
288219
|
);
|
|
287382
288220
|
} else {
|
|
287383
|
-
console.error(
|
|
288221
|
+
console.error(
|
|
288222
|
+
"[ZeroDev] Module installation failed:",
|
|
288223
|
+
normalizedError.message
|
|
288224
|
+
);
|
|
287384
288225
|
}
|
|
287385
288226
|
throw normalizedError;
|
|
287386
288227
|
}
|
|
@@ -287434,12 +288275,12 @@ async function sendSmartAccountTransaction(config) {
|
|
|
287434
288275
|
}
|
|
287435
288276
|
}
|
|
287436
288277
|
async function updateAutopayConfig(config) {
|
|
287437
|
-
const contracts =
|
|
288278
|
+
const contracts = getContractAddresses(config.chainId);
|
|
287438
288279
|
if (!contracts.autopayModule) {
|
|
287439
288280
|
throw new Error("Autopay module address is not configured for this chain.");
|
|
287440
288281
|
}
|
|
287441
|
-
const data = (0,
|
|
287442
|
-
abi:
|
|
288282
|
+
const data = (0, import_viem3.encodeFunctionData)({
|
|
288283
|
+
abi: ERC7579AutopayModuleABI,
|
|
287443
288284
|
functionName: "updateConfig",
|
|
287444
288285
|
args: [
|
|
287445
288286
|
{
|
|
@@ -287523,7 +288364,7 @@ function isCurrentBillingSelection(input) {
|
|
|
287523
288364
|
}
|
|
287524
288365
|
|
|
287525
288366
|
// src/components/ArcenEmbed.tsx
|
|
287526
|
-
var
|
|
288367
|
+
var import_viem4 = require("viem");
|
|
287527
288368
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
287528
288369
|
var AUTOPAY_START_TIME_BUFFER_SECONDS = 20;
|
|
287529
288370
|
function isEnvEnabled(value, defaultValue = true) {
|
|
@@ -287755,7 +288596,7 @@ var STABLECOIN_TO_ISO = {
|
|
|
287755
288596
|
EURC: "EUR",
|
|
287756
288597
|
EURT: "EUR"
|
|
287757
288598
|
};
|
|
287758
|
-
function
|
|
288599
|
+
function toISOCurrencyCode2(currency) {
|
|
287759
288600
|
if (!currency) return "USD";
|
|
287760
288601
|
return STABLECOIN_TO_ISO[currency.toUpperCase()] ?? currency.toUpperCase();
|
|
287761
288602
|
}
|
|
@@ -287765,7 +288606,7 @@ function formatMoney(amount, currency = "USD") {
|
|
|
287765
288606
|
try {
|
|
287766
288607
|
return new Intl.NumberFormat("en-US", {
|
|
287767
288608
|
style: "currency",
|
|
287768
|
-
currency:
|
|
288609
|
+
currency: toISOCurrencyCode2(currency),
|
|
287769
288610
|
minimumFractionDigits: 2,
|
|
287770
288611
|
maximumFractionDigits: 2
|
|
287771
288612
|
}).format(value);
|
|
@@ -288072,11 +288913,11 @@ async function requestWindowEthereumAccounts() {
|
|
|
288072
288913
|
}
|
|
288073
288914
|
function createBrowserWalletClient(params) {
|
|
288074
288915
|
const ethereum = getWindowEthereum();
|
|
288075
|
-
if (!ethereum || !params.account || !(0,
|
|
288076
|
-
return (0,
|
|
288916
|
+
if (!ethereum || !params.account || !(0, import_viem4.isAddress)(params.account)) return null;
|
|
288917
|
+
return (0, import_viem4.createWalletClient)({
|
|
288077
288918
|
account: params.account,
|
|
288078
|
-
chain:
|
|
288079
|
-
transport: (0,
|
|
288919
|
+
chain: getChain(params.chainId),
|
|
288920
|
+
transport: (0, import_viem4.custom)(ethereum)
|
|
288080
288921
|
});
|
|
288081
288922
|
}
|
|
288082
288923
|
async function getCurrentWalletChainId(walletClient) {
|
|
@@ -288099,7 +288940,7 @@ async function getCurrentWalletChainId(walletClient) {
|
|
|
288099
288940
|
async function ensureWalletOnTargetChain(walletClient, chainId) {
|
|
288100
288941
|
const currentChainId = await getCurrentWalletChainId(walletClient);
|
|
288101
288942
|
if (currentChainId === chainId) return;
|
|
288102
|
-
const targetChain =
|
|
288943
|
+
const targetChain = getChain(chainId);
|
|
288103
288944
|
const ethereum = getWindowEthereum();
|
|
288104
288945
|
const chainHex = `0x${chainId.toString(16)}`;
|
|
288105
288946
|
const addChain = async () => {
|
|
@@ -288164,20 +289005,20 @@ async function ensureWalletOnTargetChain(walletClient, chainId) {
|
|
|
288164
289005
|
}
|
|
288165
289006
|
}
|
|
288166
289007
|
async function readOnChainPlan(chainId, onChainPlanId) {
|
|
288167
|
-
const chain =
|
|
288168
|
-
const contracts =
|
|
288169
|
-
const publicClient = (0,
|
|
289008
|
+
const chain = getChain(chainId);
|
|
289009
|
+
const contracts = getContractAddresses(chainId);
|
|
289010
|
+
const publicClient = (0, import_viem4.createPublicClient)({ chain, transport: (0, import_viem4.http)() });
|
|
288170
289011
|
return await publicClient.readContract({
|
|
288171
289012
|
address: contracts.planFactory,
|
|
288172
|
-
abi:
|
|
289013
|
+
abi: PlanFactoryABI,
|
|
288173
289014
|
functionName: "getPlan",
|
|
288174
289015
|
args: [BigInt(onChainPlanId)]
|
|
288175
289016
|
});
|
|
288176
289017
|
}
|
|
288177
289018
|
async function readAutopayConfig(chainId, paymentAccount) {
|
|
288178
|
-
const chain =
|
|
288179
|
-
const contracts =
|
|
288180
|
-
const publicClient = (0,
|
|
289019
|
+
const chain = getChain(chainId);
|
|
289020
|
+
const contracts = getContractAddresses(chainId);
|
|
289021
|
+
const publicClient = (0, import_viem4.createPublicClient)({ chain, transport: (0, import_viem4.http)() });
|
|
288181
289022
|
return await publicClient.readContract({
|
|
288182
289023
|
address: contracts.autopayModule,
|
|
288183
289024
|
abi: [
|
|
@@ -288208,36 +289049,36 @@ async function readAutopayConfig(chainId, paymentAccount) {
|
|
|
288208
289049
|
});
|
|
288209
289050
|
}
|
|
288210
289051
|
async function readAutopayInitialized(chainId, paymentAccount) {
|
|
288211
|
-
const chain =
|
|
288212
|
-
const contracts =
|
|
288213
|
-
const publicClient = (0,
|
|
289052
|
+
const chain = getChain(chainId);
|
|
289053
|
+
const contracts = getContractAddresses(chainId);
|
|
289054
|
+
const publicClient = (0, import_viem4.createPublicClient)({ chain, transport: (0, import_viem4.http)() });
|
|
288214
289055
|
return await publicClient.readContract({
|
|
288215
289056
|
address: contracts.autopayModule,
|
|
288216
|
-
abi:
|
|
289057
|
+
abi: ERC7579AutopayModuleABI,
|
|
288217
289058
|
functionName: "isInitialized",
|
|
288218
289059
|
args: [paymentAccount]
|
|
288219
289060
|
});
|
|
288220
289061
|
}
|
|
288221
289062
|
async function readAutopayPaused(chainId, paymentAccount) {
|
|
288222
|
-
const chain =
|
|
288223
|
-
const contracts =
|
|
288224
|
-
const publicClient = (0,
|
|
289063
|
+
const chain = getChain(chainId);
|
|
289064
|
+
const contracts = getContractAddresses(chainId);
|
|
289065
|
+
const publicClient = (0, import_viem4.createPublicClient)({ chain, transport: (0, import_viem4.http)() });
|
|
288225
289066
|
return await publicClient.readContract({
|
|
288226
289067
|
address: contracts.autopayModule,
|
|
288227
|
-
abi:
|
|
289068
|
+
abi: ERC7579AutopayModuleABI,
|
|
288228
289069
|
functionName: "isAccountPaused",
|
|
288229
289070
|
args: [paymentAccount]
|
|
288230
289071
|
});
|
|
288231
289072
|
}
|
|
288232
289073
|
async function readChainTimestampSeconds(chainId) {
|
|
288233
|
-
const chain =
|
|
288234
|
-
const publicClient = (0,
|
|
289074
|
+
const chain = getChain(chainId);
|
|
289075
|
+
const publicClient = (0, import_viem4.createPublicClient)({ chain, transport: (0, import_viem4.http)() });
|
|
288235
289076
|
const latestBlock = await publicClient.getBlock({ blockTag: "latest" });
|
|
288236
289077
|
return latestBlock.timestamp;
|
|
288237
289078
|
}
|
|
288238
289079
|
function encodeAutopayInstallData(params) {
|
|
288239
|
-
return (0,
|
|
288240
|
-
(0,
|
|
289080
|
+
return (0, import_viem4.encodeAbiParameters)(
|
|
289081
|
+
(0, import_viem4.parseAbiParameters)(
|
|
288241
289082
|
"(address merchant,uint256 maxAmount,address token,uint32 interval,uint64 startTime,uint256 planId,uint256 maxTotalAmount)"
|
|
288242
289083
|
),
|
|
288243
289084
|
[
|
|
@@ -288255,13 +289096,13 @@ function encodeAutopayInstallData(params) {
|
|
|
288255
289096
|
}
|
|
288256
289097
|
async function submitWalletTransaction(params) {
|
|
288257
289098
|
await ensureWalletOnTargetChain(params.walletClient, params.chainId);
|
|
288258
|
-
const publicClient = (0,
|
|
288259
|
-
chain:
|
|
288260
|
-
transport: (0,
|
|
289099
|
+
const publicClient = (0, import_viem4.createPublicClient)({
|
|
289100
|
+
chain: getChain(params.chainId),
|
|
289101
|
+
transport: (0, import_viem4.http)()
|
|
288261
289102
|
});
|
|
288262
289103
|
const txHash = await params.walletClient.sendTransaction({
|
|
288263
289104
|
account: params.account,
|
|
288264
|
-
chain:
|
|
289105
|
+
chain: getChain(params.chainId),
|
|
288265
289106
|
to: params.to,
|
|
288266
289107
|
data: params.data,
|
|
288267
289108
|
value: params.value ?? 0n
|
|
@@ -291323,7 +292164,7 @@ function PaymentContent({
|
|
|
291323
292164
|
});
|
|
291324
292165
|
}
|
|
291325
292166
|
async function ensureBillingSmartAccount() {
|
|
291326
|
-
if (smartAccountAddress && (0,
|
|
292167
|
+
if (smartAccountAddress && (0, import_viem4.isAddress)(smartAccountAddress)) {
|
|
291327
292168
|
return smartAccountAddress;
|
|
291328
292169
|
}
|
|
291329
292170
|
if (!chainId || !resolvedWalletClient || !zeroDevProjectId || !finalAddress) {
|
|
@@ -291366,7 +292207,7 @@ function PaymentContent({
|
|
|
291366
292207
|
"The selected on-chain plan is missing billing metadata."
|
|
291367
292208
|
);
|
|
291368
292209
|
}
|
|
291369
|
-
const contracts =
|
|
292210
|
+
const contracts = getContractAddresses(paymentChainId);
|
|
291370
292211
|
const autopayAddress = contracts.autopayModule;
|
|
291371
292212
|
const tokenAddress = targetPlan.acceptedToken;
|
|
291372
292213
|
const chargeAmount = BigInt(targetPlan.price ?? 0n);
|
|
@@ -291426,8 +292267,8 @@ function PaymentContent({
|
|
|
291426
292267
|
let installError = null;
|
|
291427
292268
|
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
291428
292269
|
nextConfig = await buildNextConfig();
|
|
291429
|
-
const installData = (0,
|
|
291430
|
-
abi:
|
|
292270
|
+
const installData = (0, import_viem4.encodeFunctionData)({
|
|
292271
|
+
abi: ERC7579AutopayModuleABI,
|
|
291431
292272
|
functionName: "onInstall",
|
|
291432
292273
|
args: [encodeAutopayInstallData(nextConfig)]
|
|
291433
292274
|
});
|
|
@@ -291467,8 +292308,8 @@ function PaymentContent({
|
|
|
291467
292308
|
);
|
|
291468
292309
|
const configMatches = String(currentConfig.merchant ?? "").toLowerCase() === nextConfig.merchant.toLowerCase() && BigInt(currentConfig.maxAmount ?? 0n) === nextConfig.maxAmount && String(currentConfig.token ?? "").toLowerCase() === nextConfig.token.toLowerCase() && Number(currentConfig.interval ?? 0) === nextConfig.interval && BigInt(currentConfig.planId ?? 0n) === nextConfig.planId;
|
|
291469
292310
|
if (!configMatches) {
|
|
291470
|
-
const updateData = (0,
|
|
291471
|
-
abi:
|
|
292311
|
+
const updateData = (0, import_viem4.encodeFunctionData)({
|
|
292312
|
+
abi: ERC7579AutopayModuleABI,
|
|
291472
292313
|
functionName: "updateConfig",
|
|
291473
292314
|
args: [
|
|
291474
292315
|
{
|
|
@@ -291488,7 +292329,7 @@ function PaymentContent({
|
|
|
291488
292329
|
billingPaymentAccount
|
|
291489
292330
|
);
|
|
291490
292331
|
if (isPaused) {
|
|
291491
|
-
const unpauseData = (0,
|
|
292332
|
+
const unpauseData = (0, import_viem4.encodeFunctionData)({
|
|
291492
292333
|
abi: [
|
|
291493
292334
|
{
|
|
291494
292335
|
type: "function",
|
|
@@ -291509,7 +292350,7 @@ function PaymentContent({
|
|
|
291509
292350
|
}
|
|
291510
292351
|
}
|
|
291511
292352
|
await waitForAutopaySetupReadiness();
|
|
291512
|
-
const approveData = (0,
|
|
292353
|
+
const approveData = (0, import_viem4.encodeFunctionData)({
|
|
291513
292354
|
abi: [
|
|
291514
292355
|
{
|
|
291515
292356
|
type: "function",
|
|
@@ -291530,9 +292371,9 @@ function PaymentContent({
|
|
|
291530
292371
|
data: approveData,
|
|
291531
292372
|
smartAccountAddressOverride: billingPaymentAccount
|
|
291532
292373
|
});
|
|
291533
|
-
const allowanceCheckClient = (0,
|
|
291534
|
-
chain:
|
|
291535
|
-
transport: (0,
|
|
292374
|
+
const allowanceCheckClient = (0, import_viem4.createPublicClient)({
|
|
292375
|
+
chain: getChain(paymentChainId),
|
|
292376
|
+
transport: (0, import_viem4.http)()
|
|
291536
292377
|
});
|
|
291537
292378
|
const allowance = await allowanceCheckClient.readContract({
|
|
291538
292379
|
address: tokenAddress,
|
|
@@ -291760,7 +292601,7 @@ function PaymentContent({
|
|
|
291760
292601
|
preview?.amountDue ?? "0.000000"
|
|
291761
292602
|
);
|
|
291762
292603
|
if (amountDueAtomic > 0n) {
|
|
291763
|
-
const paymentTransferData = (0,
|
|
292604
|
+
const paymentTransferData = (0, import_viem4.encodeFunctionData)({
|
|
291764
292605
|
abi: [
|
|
291765
292606
|
{
|
|
291766
292607
|
type: "function",
|
|
@@ -292893,7 +293734,7 @@ function UnsubscribeContent({
|
|
|
292893
293734
|
setTxStatus("approving");
|
|
292894
293735
|
try {
|
|
292895
293736
|
await ensureWalletOnTargetChain(resolvedWalletClient, chainId);
|
|
292896
|
-
const contracts =
|
|
293737
|
+
const contracts = getContractAddresses(chainId);
|
|
292897
293738
|
const autopayAddress = contracts.autopayModule;
|
|
292898
293739
|
if (!autopayAddress) {
|
|
292899
293740
|
throw new Error("Autopay module is not configured for this chain.");
|
|
@@ -292908,7 +293749,7 @@ function UnsubscribeContent({
|
|
|
292908
293749
|
onConfirm({ intent: "scheduled" });
|
|
292909
293750
|
return;
|
|
292910
293751
|
}
|
|
292911
|
-
const pauseData = (0,
|
|
293752
|
+
const pauseData = (0, import_viem4.encodeFunctionData)({
|
|
292912
293753
|
abi: [
|
|
292913
293754
|
{
|
|
292914
293755
|
type: "function",
|
|
@@ -293511,7 +294352,7 @@ function SuccessContent({
|
|
|
293511
294352
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
293512
294353
|
"a",
|
|
293513
294354
|
{
|
|
293514
|
-
href: chainId ?
|
|
294355
|
+
href: chainId ? getBlockExplorerUrl(chainId, txHash) : "#",
|
|
293515
294356
|
target: "_blank",
|
|
293516
294357
|
rel: "noreferrer",
|
|
293517
294358
|
style: {
|
|
@@ -294289,7 +295130,6 @@ var import_react5 = require("react");
|
|
|
294289
295130
|
// src/hooks/useEntitlement.ts
|
|
294290
295131
|
var import_wagmi2 = require("wagmi");
|
|
294291
295132
|
var import_react4 = require("react");
|
|
294292
|
-
var import_sdk6 = require("@arcenpay/sdk");
|
|
294293
295133
|
|
|
294294
295134
|
// src/hooks/useCompanyEntitlements.ts
|
|
294295
295135
|
var import_react3 = require("react");
|
|
@@ -294336,7 +295176,9 @@ function useCompanyEntitlements(options = {}) {
|
|
|
294336
295176
|
});
|
|
294337
295177
|
if (!res.ok) {
|
|
294338
295178
|
const json2 = await res.json().catch(() => ({}));
|
|
294339
|
-
throw new Error(
|
|
295179
|
+
throw new Error(
|
|
295180
|
+
json2.error ?? `HTTP ${res.status}`
|
|
295181
|
+
);
|
|
294340
295182
|
}
|
|
294341
295183
|
const json = await res.json();
|
|
294342
295184
|
const list = Array.isArray(json) ? json : json.entitlements ?? [];
|
|
@@ -294395,7 +295237,7 @@ var EntitlementError = class extends Error {
|
|
|
294395
295237
|
function useEntitlement(walletAddress, featureKey) {
|
|
294396
295238
|
const ONCHAIN_STALE_AFTER_MS = 3e4;
|
|
294397
295239
|
const { network, config } = useArcenPay();
|
|
294398
|
-
const contracts =
|
|
295240
|
+
const contracts = getContractAddresses(network.chainId);
|
|
294399
295241
|
const registryAddress = contracts.subscriptionRegistry;
|
|
294400
295242
|
const lastBlockRefetchAt = (0, import_react4.useRef)(0);
|
|
294401
295243
|
const {
|
|
@@ -294408,7 +295250,9 @@ function useEntitlement(walletAddress, featureKey) {
|
|
|
294408
295250
|
skip: false
|
|
294409
295251
|
});
|
|
294410
295252
|
const [tablelandFeatures, setTablelandFeatures] = (0, import_react4.useState)({});
|
|
294411
|
-
const [tablelandUpdatedAt, setTablelandUpdatedAt] = (0, import_react4.useState)(
|
|
295253
|
+
const [tablelandUpdatedAt, setTablelandUpdatedAt] = (0, import_react4.useState)(
|
|
295254
|
+
null
|
|
295255
|
+
);
|
|
294412
295256
|
const [tablelandLoading, setTablelandLoading] = (0, import_react4.useState)(false);
|
|
294413
295257
|
const [tablelandError, setTablelandError] = (0, import_react4.useState)(null);
|
|
294414
295258
|
const walletInvalid = Boolean(walletAddress) && !/^0x[a-fA-F0-9]{40}$/.test(walletAddress || "");
|
|
@@ -294421,7 +295265,11 @@ function useEntitlement(walletAddress, featureKey) {
|
|
|
294421
295265
|
const providerUrl = config.tablelandConfig?.providerUrl;
|
|
294422
295266
|
if (!providerUrl) return null;
|
|
294423
295267
|
return `${providerUrl.replace(/\/$/, "")}/api/entitlements/${walletAddress.toLowerCase()}/flags`;
|
|
294424
|
-
}, [
|
|
295268
|
+
}, [
|
|
295269
|
+
config.tablelandConfig?.featureFlagsEndpoint,
|
|
295270
|
+
config.tablelandConfig?.providerUrl,
|
|
295271
|
+
walletAddress
|
|
295272
|
+
]);
|
|
294425
295273
|
const sequenceRef = (0, import_react4.useRef)(0);
|
|
294426
295274
|
const refetchTableland = (0, import_react4.useCallback)(async () => {
|
|
294427
295275
|
if (!tablelandFeatureFlagsUrl) {
|
|
@@ -294453,7 +295301,9 @@ function useEntitlement(walletAddress, featureKey) {
|
|
|
294453
295301
|
if (sequenceRef.current !== seq) return;
|
|
294454
295302
|
setTablelandFeatures({});
|
|
294455
295303
|
setTablelandUpdatedAt(null);
|
|
294456
|
-
setTablelandError(
|
|
295304
|
+
setTablelandError(
|
|
295305
|
+
err instanceof Error ? err : new Error("Feature flags fetch failed.")
|
|
295306
|
+
);
|
|
294457
295307
|
} finally {
|
|
294458
295308
|
if (sequenceRef.current === seq) {
|
|
294459
295309
|
setTablelandLoading(false);
|
|
@@ -294472,14 +295322,14 @@ function useEntitlement(walletAddress, featureKey) {
|
|
|
294472
295322
|
contracts: [
|
|
294473
295323
|
{
|
|
294474
295324
|
address: registryAddress,
|
|
294475
|
-
abi:
|
|
295325
|
+
abi: SubscriptionRegistryABI,
|
|
294476
295326
|
functionName: "getWalletSubscription",
|
|
294477
295327
|
args: [walletAddress],
|
|
294478
295328
|
chainId: network.chainId
|
|
294479
295329
|
},
|
|
294480
295330
|
{
|
|
294481
295331
|
address: registryAddress,
|
|
294482
|
-
abi:
|
|
295332
|
+
abi: SubscriptionRegistryABI,
|
|
294483
295333
|
functionName: "hasActiveSubscription",
|
|
294484
295334
|
args: [walletAddress],
|
|
294485
295335
|
chainId: network.chainId
|
|
@@ -294502,21 +295352,21 @@ function useEntitlement(walletAddress, featureKey) {
|
|
|
294502
295352
|
contracts: [
|
|
294503
295353
|
{
|
|
294504
295354
|
address: registryAddress,
|
|
294505
|
-
abi:
|
|
295355
|
+
abi: SubscriptionRegistryABI,
|
|
294506
295356
|
functionName: "isValid",
|
|
294507
295357
|
args: [tokenId],
|
|
294508
295358
|
chainId: network.chainId
|
|
294509
295359
|
},
|
|
294510
295360
|
{
|
|
294511
295361
|
address: registryAddress,
|
|
294512
|
-
abi:
|
|
295362
|
+
abi: SubscriptionRegistryABI,
|
|
294513
295363
|
functionName: "expiresAt",
|
|
294514
295364
|
args: [tokenId],
|
|
294515
295365
|
chainId: network.chainId
|
|
294516
295366
|
},
|
|
294517
295367
|
{
|
|
294518
295368
|
address: registryAddress,
|
|
294519
|
-
abi:
|
|
295369
|
+
abi: SubscriptionRegistryABI,
|
|
294520
295370
|
functionName: "getPlanFeatures",
|
|
294521
295371
|
args: [tokenId],
|
|
294522
295372
|
chainId: network.chainId
|
|
@@ -294557,7 +295407,7 @@ function useEntitlement(walletAddress, featureKey) {
|
|
|
294557
295407
|
}, [dashboardFeatures, tablelandFeatures, onChainTierFeatures, featureKey]);
|
|
294558
295408
|
(0, import_wagmi2.useWatchContractEvent)({
|
|
294559
295409
|
address: registryAddress,
|
|
294560
|
-
abi:
|
|
295410
|
+
abi: SubscriptionRegistryABI,
|
|
294561
295411
|
eventName: "SubscriptionMinted",
|
|
294562
295412
|
args: walletAddress ? { subscriber: walletAddress } : void 0,
|
|
294563
295413
|
onLogs: () => {
|
|
@@ -294570,7 +295420,7 @@ function useEntitlement(walletAddress, featureKey) {
|
|
|
294570
295420
|
});
|
|
294571
295421
|
(0, import_wagmi2.useWatchContractEvent)({
|
|
294572
295422
|
address: registryAddress,
|
|
294573
|
-
abi:
|
|
295423
|
+
abi: SubscriptionRegistryABI,
|
|
294574
295424
|
eventName: "SubscriptionRenewed",
|
|
294575
295425
|
args: hasToken ? { tokenId } : void 0,
|
|
294576
295426
|
onLogs: () => {
|
|
@@ -294582,7 +295432,7 @@ function useEntitlement(walletAddress, featureKey) {
|
|
|
294582
295432
|
});
|
|
294583
295433
|
(0, import_wagmi2.useWatchContractEvent)({
|
|
294584
295434
|
address: registryAddress,
|
|
294585
|
-
abi:
|
|
295435
|
+
abi: SubscriptionRegistryABI,
|
|
294586
295436
|
eventName: "SubscriptionCancelled",
|
|
294587
295437
|
args: hasToken ? { tokenId } : void 0,
|
|
294588
295438
|
onLogs: () => {
|
|
@@ -294595,7 +295445,7 @@ function useEntitlement(walletAddress, featureKey) {
|
|
|
294595
295445
|
});
|
|
294596
295446
|
(0, import_wagmi2.useWatchContractEvent)({
|
|
294597
295447
|
address: registryAddress,
|
|
294598
|
-
abi:
|
|
295448
|
+
abi: SubscriptionRegistryABI,
|
|
294599
295449
|
eventName: "Transfer",
|
|
294600
295450
|
args: walletAddress ? { to: walletAddress } : void 0,
|
|
294601
295451
|
onLogs: () => {
|
|
@@ -294608,7 +295458,7 @@ function useEntitlement(walletAddress, featureKey) {
|
|
|
294608
295458
|
});
|
|
294609
295459
|
(0, import_wagmi2.useWatchContractEvent)({
|
|
294610
295460
|
address: registryAddress,
|
|
294611
|
-
abi:
|
|
295461
|
+
abi: SubscriptionRegistryABI,
|
|
294612
295462
|
eventName: "Transfer",
|
|
294613
295463
|
args: walletAddress ? { from: walletAddress } : void 0,
|
|
294614
295464
|
onLogs: () => {
|
|
@@ -294637,7 +295487,13 @@ function useEntitlement(walletAddress, featureKey) {
|
|
|
294637
295487
|
if (hasToken) refetchSub();
|
|
294638
295488
|
void refetchTableland();
|
|
294639
295489
|
void refetchDashboardEntitlements();
|
|
294640
|
-
}, [
|
|
295490
|
+
}, [
|
|
295491
|
+
refetchTokenId,
|
|
295492
|
+
refetchSub,
|
|
295493
|
+
hasToken,
|
|
295494
|
+
refetchTableland,
|
|
295495
|
+
refetchDashboardEntitlements
|
|
295496
|
+
]);
|
|
294641
295497
|
const isLoading = tokenIdLoading || hasToken && subLoading || dashboardLoading || Boolean(tablelandFeatureFlagsUrl) && tablelandLoading;
|
|
294642
295498
|
const tokenError = tokenIdResult?.[0]?.error;
|
|
294643
295499
|
const subscriptionError = subscriptionData?.find((entry) => entry?.error)?.error;
|
|
@@ -294781,7 +295637,10 @@ function FeatureFlagGuard({
|
|
|
294781
295637
|
onDecryptionError
|
|
294782
295638
|
}) {
|
|
294783
295639
|
const { config } = useArcenPay();
|
|
294784
|
-
const { features, isSubscribed, isLoading } = useEntitlement(
|
|
295640
|
+
const { features, isSubscribed, isLoading } = useEntitlement(
|
|
295641
|
+
walletAddress,
|
|
295642
|
+
featureKey
|
|
295643
|
+
);
|
|
294785
295644
|
const [decrypting, setDecrypting] = (0, import_react5.useState)(false);
|
|
294786
295645
|
const [decryptPassed, setDecryptPassed] = (0, import_react5.useState)(false);
|
|
294787
295646
|
const [decryptError, setDecryptError] = (0, import_react5.useState)(null);
|
|
@@ -294851,7 +295710,9 @@ function FeatureFlagGuard({
|
|
|
294851
295710
|
sessionSigs = await client.getSessionSigs({
|
|
294852
295711
|
chain: "ethereum",
|
|
294853
295712
|
authNeededCallback: async (_params) => authSig,
|
|
294854
|
-
expiration: new Date(
|
|
295713
|
+
expiration: new Date(
|
|
295714
|
+
Date.now() + 24 * 60 * 60 * 1e3
|
|
295715
|
+
).toISOString(),
|
|
294855
295716
|
resourceAbilityRequests: []
|
|
294856
295717
|
});
|
|
294857
295718
|
cacheSessionSigs(sessionSigs);
|
|
@@ -294926,27 +295787,34 @@ function TemplateRenderer({
|
|
|
294926
295787
|
blocks,
|
|
294927
295788
|
className = ""
|
|
294928
295789
|
}) {
|
|
294929
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
294930
|
-
|
|
294931
|
-
|
|
294932
|
-
|
|
294933
|
-
|
|
294934
|
-
|
|
294935
|
-
|
|
294936
|
-
|
|
294937
|
-
|
|
294938
|
-
|
|
294939
|
-
|
|
294940
|
-
|
|
294941
|
-
|
|
294942
|
-
|
|
294943
|
-
|
|
294944
|
-
|
|
294945
|
-
|
|
294946
|
-
|
|
295790
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
295791
|
+
"div",
|
|
295792
|
+
{
|
|
295793
|
+
className: `arcenpay-template-renderer ${className}`,
|
|
295794
|
+
"data-template-name": name2,
|
|
295795
|
+
children: blocks.map((block, index) => {
|
|
295796
|
+
if (block.type === "heading") {
|
|
295797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { children: block.content }, `${block.type}-${index}`);
|
|
295798
|
+
}
|
|
295799
|
+
if (block.type === "text") {
|
|
295800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: block.content }, `${block.type}-${index}`);
|
|
295801
|
+
}
|
|
295802
|
+
if (block.type === "price") {
|
|
295803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { children: [
|
|
295804
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: block.amount }),
|
|
295805
|
+
block.interval ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: ` ${block.interval}` }) : null
|
|
295806
|
+
] }, `${block.type}-${index}`);
|
|
295807
|
+
}
|
|
295808
|
+
if (block.type === "feature-list") {
|
|
295809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { children: (block.items || []).map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { children: item }, item)) }, `${block.type}-${index}`);
|
|
295810
|
+
}
|
|
295811
|
+
if (block.type === "cta") {
|
|
295812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { href: block.href || "#", children: block.content || "Continue" }, `${block.type}-${index}`);
|
|
295813
|
+
}
|
|
295814
|
+
return null;
|
|
295815
|
+
})
|
|
294947
295816
|
}
|
|
294948
|
-
|
|
294949
|
-
}) });
|
|
295817
|
+
);
|
|
294950
295818
|
}
|
|
294951
295819
|
|
|
294952
295820
|
// src/hooks/useFlag.ts
|
|
@@ -295087,7 +295955,9 @@ function useTrack() {
|
|
|
295087
295955
|
const track = (0, import_react8.useCallback)(
|
|
295088
295956
|
async (name2, traits) => {
|
|
295089
295957
|
if (!session.token) {
|
|
295090
|
-
console.warn(
|
|
295958
|
+
console.warn(
|
|
295959
|
+
"[useTrack] Cannot track: no session. Call arcen.identify() first."
|
|
295960
|
+
);
|
|
295091
295961
|
return;
|
|
295092
295962
|
}
|
|
295093
295963
|
try {
|