@capxul/sdk 2.2.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{InMemoryAuthCacheAdapter-PycLJWeW.mjs → InMemoryAuthCacheAdapter-qMpBOGb3.mjs} +4 -1
- package/dist/{create-capxul-client-B8qMV-_e.mjs → create-capxul-client-DTQDSOvO.mjs} +123 -174
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +124 -20
- package/dist/node/index.d.mts +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/{observation-BwPo8qeo.d.mts → observation-Ci8gIQjm.d.mts} +100 -11
- package/dist/{signer-D4roBkcX.d.mts → signer-BejoR3bA.d.mts} +23 -1
- package/dist/testing/index.d.mts +1 -1
- package/dist/testing/index.mjs +2 -2
- package/package.json +4 -4
package/dist/{InMemoryAuthCacheAdapter-PycLJWeW.mjs → InMemoryAuthCacheAdapter-qMpBOGb3.mjs}
RENAMED
|
@@ -290,6 +290,9 @@ function toPartyId(raw) {
|
|
|
290
290
|
if (typeof raw !== "string" || !PARTY_ID_RE.test(raw)) throw Errors.invalidInput("partyId", invalidValueReason("must be party_ plus an alphanumeric id", raw));
|
|
291
291
|
return raw;
|
|
292
292
|
}
|
|
293
|
+
function toBudgetId(raw) {
|
|
294
|
+
return toNonEmptyStringBrand(raw, "budgetId");
|
|
295
|
+
}
|
|
293
296
|
function toOrgId(raw) {
|
|
294
297
|
return toNonEmptyStringBrand(raw, "orgId");
|
|
295
298
|
}
|
|
@@ -485,4 +488,4 @@ Layer.effect(AuthCachePortTag, Effect.sync(() => new InMemoryAuthCacheAdapter())
|
|
|
485
488
|
cause
|
|
486
489
|
}))));
|
|
487
490
|
//#endregion
|
|
488
|
-
export {
|
|
491
|
+
export { toPartyId as A, toDurationMs as C, toJwtToken as D, toEpochSeconds as E, CAPXUL_ERROR_CODES as F, CapxulError as I, EXPECTED_OPERATION_OUTCOMES as L, toRoleKey as M, toSessionToken as N, toKycTier as O, decodeConvexError as P, Errors as R, toCurrencyCode as S, toEpochMs as T, toAppId as _, AuthCacheError as a, toChainId as b, BYTES32_RE as c, WEI_RE as d, ZERO_BYTES32 as f, toAllowedOrigin as g, toAddress as h, parseCachedJwt as i, toPublishableKey as j, toOrgId as k, EVM_ADDRESS_RE as l, toAccountId as m, BrowserAuthCacheAdapter as n, AuthCachePortTag as o, currencySymbolFor as p, parseAuthSession as r, APP_ID_RE as s, InMemoryAuthCacheAdapter as t, SUPPORTED_CURRENCY_CODES as u, toAuthUserId as v, toEmail as w, toCountryCode as x, toBudgetId as y, isCapxulError as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as toPartyId, I as CapxulError, L as EXPECTED_OPERATION_OUTCOMES, M as toRoleKey, R as Errors, S as toCurrencyCode, b as toChainId, c as BYTES32_RE, d as WEI_RE, f as ZERO_BYTES32, h as toAddress, k as toOrgId, l as EVM_ADDRESS_RE$1, m as toAccountId, n as BrowserAuthCacheAdapter, s as APP_ID_RE, t as InMemoryAuthCacheAdapter, u as SUPPORTED_CURRENCY_CODES, v as toAuthUserId, w as toEmail, x as toCountryCode, y as toBudgetId, z as isCapxulError } from "./InMemoryAuthCacheAdapter-qMpBOGb3.mjs";
|
|
2
2
|
import { concat, encodeAbiParameters, encodeFunctionData, encodePacked, formatUnits, getContractAddress, keccak256, padHex, parseUnits, recoverAddress, stringToHex, toBytes, toEventSelector, toFunctionSelector, toFunctionSignature } from "viem";
|
|
3
3
|
import { Context, Data, Deferred, Effect, Exit, Fiber, Layer, Queue, Ref, Result, Schema, SchemaGetter, Scope } from "effect";
|
|
4
4
|
import { makeFunctionReference } from "convex/server";
|
|
@@ -14,6 +14,8 @@ const isRetryable = (failure) => {
|
|
|
14
14
|
return failure.code === "NETWORK_ERROR" || failure.code === "UNKNOWN";
|
|
15
15
|
};
|
|
16
16
|
const SIGNED_OUT = { phase: "signed_out" };
|
|
17
|
+
/** Where every client starts. `SessionRestored` / `SessionAbsent` settle it. */
|
|
18
|
+
const RESTORING = { phase: "restoring" };
|
|
17
19
|
const label = (state) => {
|
|
18
20
|
if (state.phase !== "authenticated") return state.phase;
|
|
19
21
|
if (state.account.at !== "claimed") return `authenticated:${state.account.at}`;
|
|
@@ -28,6 +30,8 @@ const EVENT_TAGS = [
|
|
|
28
30
|
"RestoreSession",
|
|
29
31
|
"ResumeOtpEntry",
|
|
30
32
|
"Reset",
|
|
33
|
+
"SessionRestored",
|
|
34
|
+
"SessionAbsent",
|
|
31
35
|
"EnsureAccount",
|
|
32
36
|
"ClaimAccount",
|
|
33
37
|
"RetryAccount",
|
|
@@ -62,6 +66,13 @@ const SESSION_EVENTS = [
|
|
|
62
66
|
"Reset"
|
|
63
67
|
];
|
|
64
68
|
const TRANSITION_TABLE = {
|
|
69
|
+
restoring: [
|
|
70
|
+
"SessionRestored",
|
|
71
|
+
"SessionAbsent",
|
|
72
|
+
"ReadSession",
|
|
73
|
+
"RequestOtp",
|
|
74
|
+
"Reset"
|
|
75
|
+
],
|
|
65
76
|
signed_out: [
|
|
66
77
|
"RequestOtp",
|
|
67
78
|
"ReadSession",
|
|
@@ -253,6 +264,8 @@ const transition = (state, event, config = DEFAULT_CONFIG) => {
|
|
|
253
264
|
requestedAt: state.resume.requestedAt
|
|
254
265
|
} };
|
|
255
266
|
case "Reset": return { next: SIGNED_OUT };
|
|
267
|
+
case "SessionRestored": return { next: authenticated(event.session, event.profileComplete, { at: "unknown" }) };
|
|
268
|
+
case "SessionAbsent": return { next: SIGNED_OUT };
|
|
256
269
|
case "EnsureAccount":
|
|
257
270
|
if (config.requirement === "none") return WRONG;
|
|
258
271
|
return state.phase === "authenticated" ? { next: withAccount(state, {
|
|
@@ -320,6 +333,7 @@ const isPrivate = (event) => PRIVATE_TAGS.has(event._tag);
|
|
|
320
333
|
* there is no org list in the state, only the ONE active lane.
|
|
321
334
|
*/
|
|
322
335
|
const destination = (state) => {
|
|
336
|
+
if (state.phase === "restoring") return null;
|
|
323
337
|
if (state.phase !== "authenticated") return { to: "home" };
|
|
324
338
|
if (!state.profileComplete) return { to: "selectUserType" };
|
|
325
339
|
if (state.account.at === "unknown") return null;
|
|
@@ -339,6 +353,33 @@ const destination = (state) => {
|
|
|
339
353
|
orgId: org.at === "creating" ? null : org.orgId
|
|
340
354
|
};
|
|
341
355
|
};
|
|
356
|
+
/**
|
|
357
|
+
* True while the machine has not settled enough to route or to gate on.
|
|
358
|
+
*
|
|
359
|
+
* NEGATIVE classification, deliberately: the SETTLED positions are the ones
|
|
360
|
+
* enumerated, and everything else waits. A phase or readiness variant added
|
|
361
|
+
* later therefore defaults to holding, never to redirecting a member who is in
|
|
362
|
+
* fact signed in. Terminal for the account lane is `claimed | failed`.
|
|
363
|
+
*
|
|
364
|
+
* The org lane's own settledness (`ready | failed`) is the route gate's
|
|
365
|
+
* question, not this one: every org lane sits under a CLAIMED account, and
|
|
366
|
+
* `destination()` already names a real screen for each of its positions.
|
|
367
|
+
*/
|
|
368
|
+
const isRestoring = (state) => {
|
|
369
|
+
switch (state.phase) {
|
|
370
|
+
case "signed_out":
|
|
371
|
+
case "otp_sending":
|
|
372
|
+
case "otp_pending":
|
|
373
|
+
case "otp_verifying":
|
|
374
|
+
case "signing_out":
|
|
375
|
+
case "faulted": return false;
|
|
376
|
+
case "authenticated": return state.account.at !== "claimed" && state.account.at !== "failed";
|
|
377
|
+
default: return true;
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
/** The claimed-account gate as one function. The inlined consumers move onto
|
|
381
|
+
* it in #1521; this ticket ships the selector they move onto. */
|
|
382
|
+
const isClaimed = (state) => state.phase === "authenticated" && state.account.at === "claimed";
|
|
342
383
|
//#endregion
|
|
343
384
|
//#region ../config/src/tokens.ts
|
|
344
385
|
/** `TestUSDC` ("USDX") — Base Sepolia, 6 decimals, open `mint`. (Canon §1.) */
|
|
@@ -1209,48 +1250,7 @@ const USDX_BASE_SEPOLIA_TOKEN = {
|
|
|
1209
1250
|
};
|
|
1210
1251
|
USDX_BASE_SEPOLIA_TOKEN.chainId;
|
|
1211
1252
|
USDX_BASE_SEPOLIA_TOKEN.chainId;
|
|
1212
|
-
|
|
1213
|
-
//#region ../config/src/role-dsl.ts
|
|
1214
|
-
const USD_DECIMALS = 6;
|
|
1215
|
-
const USD_SCALE = 10n ** BigInt(USD_DECIMALS);
|
|
1216
|
-
const USD_DISPLAY_RE = /^\d+(?:\.\d{1,6})?$/;
|
|
1217
|
-
const USD_BASE_UNIT_RE = /^\d+$/;
|
|
1218
|
-
const EXEC_TRANSACTION_WITH_ROLE = "zodiac.roles.execTransactionWithRole";
|
|
1219
|
-
const ASSIGN_ROLES = "zodiac.roles.assignRoles";
|
|
1220
|
-
const SCOPE_TARGET = "zodiac.roles.scopeTarget";
|
|
1221
|
-
const OWNER_ROLE_LABEL = "Owner";
|
|
1222
|
-
const FOUNDER_BUDGET_ROLE_LABEL = "Founder Budget";
|
|
1223
|
-
const FOUNDER_BUDGET_LIMIT = {
|
|
1224
|
-
currency: "USD",
|
|
1225
|
-
value: "1000000000000",
|
|
1226
|
-
decimals: 6
|
|
1227
|
-
};
|
|
1228
|
-
function usd(value) {
|
|
1229
|
-
return {
|
|
1230
|
-
currency: "USD",
|
|
1231
|
-
value: usdDisplayToBaseUnits(value),
|
|
1232
|
-
decimals: USD_DECIMALS
|
|
1233
|
-
};
|
|
1234
|
-
}
|
|
1235
|
-
function usdDisplayToBaseUnits(value) {
|
|
1236
|
-
if (value.trim() !== value || !USD_DISPLAY_RE.test(value)) throw Errors.invalidInput("role.spend", "USD caps must be unsigned decimal strings with at most 6 fractional digits");
|
|
1237
|
-
const parts = value.split(".");
|
|
1238
|
-
const whole = parts[0] ?? "0";
|
|
1239
|
-
const fraction = parts[1] ?? "";
|
|
1240
|
-
return (BigInt(whole) * USD_SCALE + BigInt(fraction.padEnd(USD_DECIMALS, "0"))).toString();
|
|
1241
|
-
}
|
|
1242
|
-
function normalizeOrgRoleMoney(money, field) {
|
|
1243
|
-
if (money.currency !== "USD" || money.decimals !== USD_DECIMALS || !USD_BASE_UNIT_RE.test(money.value)) throw Errors.invalidInput(field, `must be USD base units with ${USD_DECIMALS} decimals`);
|
|
1244
|
-
return money;
|
|
1245
|
-
}
|
|
1246
|
-
function normalizeOrgRoleSpendCap(spend) {
|
|
1247
|
-
if (spend === void 0) return void 0;
|
|
1248
|
-
return {
|
|
1249
|
-
...spend.perTx === void 0 ? {} : { perTx: normalizeOrgRoleMoney(spend.perTx, "roles.spend.perTx") },
|
|
1250
|
-
...spend.perDay === void 0 ? {} : { perDay: normalizeOrgRoleMoney(spend.perDay, "roles.spend.perDay") },
|
|
1251
|
-
...spend.toRecipients === void 0 ? {} : { toRecipients: spend.toRecipients }
|
|
1252
|
-
};
|
|
1253
|
-
}
|
|
1253
|
+
10n ** BigInt(6);
|
|
1254
1254
|
function normalizeOrgRoleLabel(label) {
|
|
1255
1255
|
const normalized = label.trim().replace(/\s+/g, " ");
|
|
1256
1256
|
if (normalized.length === 0) throw Errors.invalidInput("role.label", "must be a non-empty role label");
|
|
@@ -1259,84 +1259,6 @@ function normalizeOrgRoleLabel(label) {
|
|
|
1259
1259
|
function orgRoleKeyForLabel(label) {
|
|
1260
1260
|
return keccak256(toBytes(normalizeOrgRoleLabel(label).toLowerCase()));
|
|
1261
1261
|
}
|
|
1262
|
-
function soloOrgRoleTemplate() {
|
|
1263
|
-
return [{
|
|
1264
|
-
label: "Owner",
|
|
1265
|
-
canManageMembers: true,
|
|
1266
|
-
canManageRoles: true
|
|
1267
|
-
}, {
|
|
1268
|
-
label: FOUNDER_BUDGET_ROLE_LABEL,
|
|
1269
|
-
spend: {
|
|
1270
|
-
perTx: FOUNDER_BUDGET_LIMIT,
|
|
1271
|
-
perDay: FOUNDER_BUDGET_LIMIT,
|
|
1272
|
-
toRecipients: "anyone"
|
|
1273
|
-
}
|
|
1274
|
-
}];
|
|
1275
|
-
}
|
|
1276
|
-
function startupOrgRoleTemplate() {
|
|
1277
|
-
return [
|
|
1278
|
-
...soloOrgRoleTemplate(),
|
|
1279
|
-
{
|
|
1280
|
-
label: "Finance Manager",
|
|
1281
|
-
spend: {
|
|
1282
|
-
perTx: usd("25000"),
|
|
1283
|
-
perDay: usd("100000"),
|
|
1284
|
-
toRecipients: "anyone"
|
|
1285
|
-
}
|
|
1286
|
-
},
|
|
1287
|
-
{
|
|
1288
|
-
label: "Team Lead",
|
|
1289
|
-
spend: {
|
|
1290
|
-
perTx: usd("5000"),
|
|
1291
|
-
perDay: usd("15000"),
|
|
1292
|
-
toRecipients: "anyone"
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
];
|
|
1296
|
-
}
|
|
1297
|
-
function orgRoleTemplateDefinitions(template, customRoles = []) {
|
|
1298
|
-
switch (template) {
|
|
1299
|
-
case "Solo": return soloOrgRoleTemplate();
|
|
1300
|
-
case "Startup": return startupOrgRoleTemplate();
|
|
1301
|
-
case "Custom": return customRoles.length === 0 ? soloOrgRoleTemplate() : customRoles;
|
|
1302
|
-
default: return template;
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
function compileOrgRoleDefinitions(definitions) {
|
|
1306
|
-
if (definitions.length === 0) throw Errors.invalidInput("roles", "must include at least one role");
|
|
1307
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1308
|
-
const roles = definitions.map((definition) => {
|
|
1309
|
-
const label = normalizeOrgRoleLabel(definition.label);
|
|
1310
|
-
const roleKey = orgRoleKeyForLabel(label);
|
|
1311
|
-
if (seen.has(roleKey)) throw Errors.invalidInput("roles", `duplicate role label: ${label}`);
|
|
1312
|
-
seen.add(roleKey);
|
|
1313
|
-
const spend = normalizeOrgRoleSpendCap(definition.spend);
|
|
1314
|
-
const permissions = [];
|
|
1315
|
-
if (spend !== void 0 || label === OWNER_ROLE_LABEL) permissions.push(EXEC_TRANSACTION_WITH_ROLE);
|
|
1316
|
-
if (definition.canManageMembers === true) permissions.push(ASSIGN_ROLES);
|
|
1317
|
-
if (definition.canManageRoles === true) permissions.push(SCOPE_TARGET);
|
|
1318
|
-
return {
|
|
1319
|
-
label,
|
|
1320
|
-
roleKey,
|
|
1321
|
-
definition: {
|
|
1322
|
-
...definition,
|
|
1323
|
-
label,
|
|
1324
|
-
...spend === void 0 ? {} : { spend }
|
|
1325
|
-
},
|
|
1326
|
-
permissions,
|
|
1327
|
-
allowance: spend ?? null
|
|
1328
|
-
};
|
|
1329
|
-
});
|
|
1330
|
-
const manager = roles.find((role) => role.definition.canManageMembers === true);
|
|
1331
|
-
if (manager === void 0) throw Errors.invalidInput("roles.canManageMembers", "at least one role must compile to the on-chain member-management permission");
|
|
1332
|
-
return {
|
|
1333
|
-
roles,
|
|
1334
|
-
memberManagementRole: {
|
|
1335
|
-
roleKey: manager.roleKey,
|
|
1336
|
-
permission: ASSIGN_ROLES
|
|
1337
|
-
}
|
|
1338
|
-
};
|
|
1339
|
-
}
|
|
1340
1262
|
padHex(stringToHex("FM_DAILY"), {
|
|
1341
1263
|
size: 32,
|
|
1342
1264
|
dir: "right"
|
|
@@ -1440,21 +1362,39 @@ function resolveFailureMode(error, contextFailureMode) {
|
|
|
1440
1362
|
const EVM_ADDRESS_HEX = /^0x[0-9a-fA-F]{40}$/;
|
|
1441
1363
|
const ECDSA_SIGNATURE_HEX = /^0x[0-9a-fA-F]{130}$/;
|
|
1442
1364
|
const SAFE_OP_DIGEST_HEX = /^0x[0-9a-fA-F]{64}$/;
|
|
1443
|
-
/**
|
|
1444
|
-
|
|
1365
|
+
/**
|
|
1366
|
+
* The readiness store a signer reports when it runs no readiness cycle. It
|
|
1367
|
+
* fails CLOSED: a node key signer or an injected wallet never claims `ready`,
|
|
1368
|
+
* so a gate that reads this never opens on a guess.
|
|
1369
|
+
*/
|
|
1370
|
+
const UNOBSERVABLE_SIGNER_STATUS = {
|
|
1371
|
+
status: () => "unknown",
|
|
1372
|
+
subscribe: () => () => void 0
|
|
1373
|
+
};
|
|
1374
|
+
/**
|
|
1375
|
+
* Walk an error and its `cause` links once each. A self-referential chain
|
|
1376
|
+
* terminates. Both signer predicates read the chain, so they read it here.
|
|
1377
|
+
*/
|
|
1378
|
+
function* causeChain(cause) {
|
|
1445
1379
|
const seen = /* @__PURE__ */ new Set();
|
|
1446
|
-
let failureMode;
|
|
1447
1380
|
let current = cause;
|
|
1448
1381
|
while (typeof current === "object" && current !== null && !seen.has(current)) {
|
|
1449
1382
|
seen.add(current);
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1383
|
+
yield current;
|
|
1384
|
+
current = current.cause;
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
/** Fold a signer throw into the public error contract. */
|
|
1388
|
+
function signerFailure(source, operation, cause) {
|
|
1389
|
+
let failureMode;
|
|
1390
|
+
for (const link of causeChain(cause)) {
|
|
1391
|
+
if (link instanceof CapxulError && link.code === "SIGNER_REJECTED") return link;
|
|
1392
|
+
failureMode = getFailureMode(link) ?? failureMode;
|
|
1393
|
+
const error = link;
|
|
1453
1394
|
if (error.code === 4001 || error.error === "passkey_user_cancelled") return Errors.signerRejected({
|
|
1454
1395
|
source,
|
|
1455
1396
|
cause
|
|
1456
1397
|
});
|
|
1457
|
-
current = error.cause;
|
|
1458
1398
|
}
|
|
1459
1399
|
return Errors.providerError("signer", operation, cause, failureMode === void 0 ? void 0 : { failure_mode: failureMode });
|
|
1460
1400
|
}
|
|
@@ -2410,7 +2350,8 @@ const CAPXUL_FUNCTIONS = {
|
|
|
2410
2350
|
listMembersByOrgId: "org/queries:listMembersByOrgId",
|
|
2411
2351
|
listMine: "org/queries:listMine",
|
|
2412
2352
|
listRolesByOrgId: "org/queries:listRolesByOrgId",
|
|
2413
|
-
loadByOrgId: "org/queries:loadByOrgId"
|
|
2353
|
+
loadByOrgId: "org/queries:loadByOrgId",
|
|
2354
|
+
me: "org/queries:me"
|
|
2414
2355
|
},
|
|
2415
2356
|
"smartAccount/actions": {
|
|
2416
2357
|
claim: "smartAccount/actions:claim",
|
|
@@ -4708,11 +4649,14 @@ async function executePersonalPayment(deps, payment, signal, requestKey) {
|
|
|
4708
4649
|
function isAborted$1(signal) {
|
|
4709
4650
|
return signal?.aborted === true;
|
|
4710
4651
|
}
|
|
4652
|
+
function canonicalJson(value) {
|
|
4653
|
+
const canonical = JSON.stringify(value, (_key, item) => item !== null && typeof item === "object" && !Array.isArray(item) ? Object.fromEntries(Object.entries(item).sort(([left], [right]) => left.localeCompare(right))) : item);
|
|
4654
|
+
if (canonical === void 0) throw new TypeError("Payment intent must be JSON data");
|
|
4655
|
+
return canonical;
|
|
4656
|
+
}
|
|
4711
4657
|
/** Return one stable fingerprint for one JSON payment intent. */
|
|
4712
4658
|
async function fingerprintPaymentIntent(intent) {
|
|
4713
|
-
|
|
4714
|
-
if (canonical === void 0) throw new TypeError("Payment intent must be JSON data");
|
|
4715
|
-
return keccak256(toBytes(canonical));
|
|
4659
|
+
return keccak256(toBytes(canonicalJson(intent)));
|
|
4716
4660
|
}
|
|
4717
4661
|
async function executePrepared(deps, prepare, expectedRequest, signal) {
|
|
4718
4662
|
if (isAborted$1(signal)) return {
|
|
@@ -5574,7 +5518,7 @@ function mapOk(result, f) {
|
|
|
5574
5518
|
}
|
|
5575
5519
|
//#endregion
|
|
5576
5520
|
//#region package.json
|
|
5577
|
-
var version = "2.
|
|
5521
|
+
var version = "2.3.1";
|
|
5578
5522
|
//#endregion
|
|
5579
5523
|
//#region src/ports/auth-client.ts
|
|
5580
5524
|
var AuthClientError = class extends Data.TaggedError("AuthClientError") {};
|
|
@@ -6520,6 +6464,8 @@ const IDENTITY_SLOT = {
|
|
|
6520
6464
|
const IDENTITY_SLOT_BY_EVENT = {
|
|
6521
6465
|
ReadSession: IDENTITY_SLOT.session,
|
|
6522
6466
|
RestoreSession: IDENTITY_SLOT.session,
|
|
6467
|
+
SessionRestored: IDENTITY_SLOT.session,
|
|
6468
|
+
SessionAbsent: IDENTITY_SLOT.session,
|
|
6523
6469
|
SessionRead: IDENTITY_SLOT.session,
|
|
6524
6470
|
SessionReadFailed: IDENTITY_SLOT.session,
|
|
6525
6471
|
RequestOtp: IDENTITY_SLOT.auth,
|
|
@@ -6831,7 +6777,7 @@ const identitySpec = (input, sessionStore = { current: null }) => {
|
|
|
6831
6777
|
};
|
|
6832
6778
|
return {
|
|
6833
6779
|
machine: "identity",
|
|
6834
|
-
initial:
|
|
6780
|
+
initial: RESTORING,
|
|
6835
6781
|
label,
|
|
6836
6782
|
slot: identitySlot,
|
|
6837
6783
|
transition: (state, event) => transition(state, event, config),
|
|
@@ -6967,7 +6913,7 @@ const bootIdentityFlow = (input, options = {}) => Effect.gen(function* () {
|
|
|
6967
6913
|
sessionStore.current = null;
|
|
6968
6914
|
}) : Effect.void)),
|
|
6969
6915
|
restoreAuthSession: (session, controls) => actor.ask({
|
|
6970
|
-
_tag: "RestoreSession",
|
|
6916
|
+
_tag: actor.snapshot().phase === "restoring" ? "SessionRestored" : "RestoreSession",
|
|
6971
6917
|
session: modelSession(session),
|
|
6972
6918
|
profileComplete: false
|
|
6973
6919
|
}, controls).pipe(Effect.tap(() => Effect.sync(() => {
|
|
@@ -7005,13 +6951,13 @@ const ask = (actor, event, controls, wrongState) => actor.ask(event, controls).p
|
|
|
7005
6951
|
*/
|
|
7006
6952
|
const getSessionProgramWithOptions = (options) => Effect.gen(function* () {
|
|
7007
6953
|
const deps = yield* CapxulDepsTag;
|
|
7008
|
-
const cached = yield* deps.authCache.getSession.pipe(Effect.mapError((e) => Errors.providerError("auth-cache", "getSession", e)));
|
|
6954
|
+
const cached = yield* deps.authCache.getSession.pipe(Effect.mapError((e) => Errors.providerError("auth-cache", "getSession", e)), Effect.catch((failure) => deps.actor.snapshot().phase === "restoring" ? Effect.succeed(null) : Effect.fail(failure)));
|
|
7009
6955
|
const observed = deps.actor.snapshot();
|
|
7010
6956
|
const actorState = observed.phase;
|
|
7011
6957
|
if (observed.phase === "faulted") return yield* Effect.fail(publicIdentityFailure(observed.failure));
|
|
7012
6958
|
if (cached === null && (actorState === "otp_pending" || actorState === "otp_sending" || actorState === "otp_verifying")) return null;
|
|
7013
|
-
if (cached !== null && actorState
|
|
7014
|
-
if (cached !== null
|
|
6959
|
+
if (cached !== null && !(actorState === "signed_out" || actorState === "restoring")) return cached;
|
|
6960
|
+
if (cached !== null) {
|
|
7015
6961
|
yield* deps.actor.restoreAuthSession(cached, depsRequestOptions(deps, options)).pipe(Effect.mapError(actorError));
|
|
7016
6962
|
return cached;
|
|
7017
6963
|
}
|
|
@@ -7114,6 +7060,7 @@ const signInProgram = (input, options) => Effect.gen(function* () {
|
|
|
7114
7060
|
}, depsRequestOptions(deps, options), {
|
|
7115
7061
|
method: "signIn",
|
|
7116
7062
|
validStates: [
|
|
7063
|
+
"restoring",
|
|
7117
7064
|
"signed_out",
|
|
7118
7065
|
"otp_pending",
|
|
7119
7066
|
"faulted"
|
|
@@ -7137,7 +7084,7 @@ const signInProgram = (input, options) => Effect.gen(function* () {
|
|
|
7137
7084
|
const signOutProgramWithOptions = (options) => Effect.gen(function* () {
|
|
7138
7085
|
const deps = yield* CapxulDepsTag;
|
|
7139
7086
|
let phase = deps.actor.snapshot().phase;
|
|
7140
|
-
if (phase === "signed_out") {
|
|
7087
|
+
if (phase === "signed_out" || phase === "restoring") {
|
|
7141
7088
|
const cached = yield* deps.authCache.getSession.pipe(Effect.mapError((e) => Errors.providerError("auth-cache", "getSession", e)));
|
|
7142
7089
|
if (cached !== null) {
|
|
7143
7090
|
yield* deps.actor.restoreAuthSession(cached, depsRequestOptions(deps, options)).pipe(Effect.mapError(actorError));
|
|
@@ -7513,6 +7460,32 @@ function makeSystemMethods(deps) {
|
|
|
7513
7460
|
return { health: (nonce, options) => runIfActive(options?.signal, "system.health", () => deps.convexCall.query(healthQuery, { nonce })) };
|
|
7514
7461
|
}
|
|
7515
7462
|
//#endregion
|
|
7463
|
+
//#region src/contract/org.ts
|
|
7464
|
+
const orgReadContract = { me: makeFunctionReference(CAPXUL_FUNCTIONS["org/queries"].me) };
|
|
7465
|
+
//#endregion
|
|
7466
|
+
//#region src/surface/org-me.ts
|
|
7467
|
+
function toBudget(wire) {
|
|
7468
|
+
return {
|
|
7469
|
+
id: toBudgetId(wire.id),
|
|
7470
|
+
label: wire.label,
|
|
7471
|
+
limit: wire.limitRaw === null ? null : fromWei(wire.limitRaw, wire.decimals, wire.currency)
|
|
7472
|
+
};
|
|
7473
|
+
}
|
|
7474
|
+
function toOrgMe(wire) {
|
|
7475
|
+
return {
|
|
7476
|
+
role: wire.role === null ? null : { label: wire.role.label },
|
|
7477
|
+
capabilities: {
|
|
7478
|
+
canManagePeople: wire.capabilities.canManagePeople,
|
|
7479
|
+
canSpend: wire.capabilities.canSpend
|
|
7480
|
+
},
|
|
7481
|
+
budgets: wire.budgets.map(toBudget),
|
|
7482
|
+
observedAt: wire.observedAt
|
|
7483
|
+
};
|
|
7484
|
+
}
|
|
7485
|
+
function makeOrgMeMethod(deps, orgId) {
|
|
7486
|
+
return (options) => runIfActive(options?.signal, "org.me", () => Effect.map(deps.convexCall.query(orgReadContract.me, { orgId }), toOrgMe));
|
|
7487
|
+
}
|
|
7488
|
+
//#endregion
|
|
7516
7489
|
//#region src/contract/permission.ts
|
|
7517
7490
|
const permissionContract = { read: makeFunctionReference(CAPXUL_FUNCTIONS["permission/queries"].read) };
|
|
7518
7491
|
//#endregion
|
|
@@ -7551,7 +7524,7 @@ async function execute(deps, orgId, command, signal) {
|
|
|
7551
7524
|
} }));
|
|
7552
7525
|
if (!prepared.ok) return prepared;
|
|
7553
7526
|
const expectedSafe = deriveCapxulSafeAddress({ email: session.email });
|
|
7554
|
-
if (prepared.value.chainId !== deps.chainId || prepared.value.signerAddress.toLowerCase() !== signerAddress.toLowerCase() || prepared.value.userOpSenderSafe.toLowerCase() !== expectedSafe.toLowerCase() || prepared.value.operation !== command.operation || prepared.value.orgId !== orgId ||
|
|
7527
|
+
if (prepared.value.chainId !== deps.chainId || prepared.value.signerAddress.toLowerCase() !== signerAddress.toLowerCase() || prepared.value.userOpSenderSafe.toLowerCase() !== expectedSafe.toLowerCase() || prepared.value.operation !== command.operation || prepared.value.orgId !== orgId || canonicalJson(prepared.value.command) !== canonicalJson(command)) return {
|
|
7555
7528
|
ok: false,
|
|
7556
7529
|
error: Errors.invalidInput("permission", "prepared authority mismatch")
|
|
7557
7530
|
};
|
|
@@ -7870,38 +7843,6 @@ function hermeticOrgView(input) {
|
|
|
7870
7843
|
logoUrl: null
|
|
7871
7844
|
};
|
|
7872
7845
|
}
|
|
7873
|
-
function moneyFromConfig(input) {
|
|
7874
|
-
return {
|
|
7875
|
-
currency: toCurrencyCode(input.currency),
|
|
7876
|
-
value: input.value,
|
|
7877
|
-
decimals: input.decimals
|
|
7878
|
-
};
|
|
7879
|
-
}
|
|
7880
|
-
function recipientsFromConfig(toRecipients) {
|
|
7881
|
-
if (toRecipients === void 0 || toRecipients === "anyone") return toRecipients;
|
|
7882
|
-
return toRecipients.map((recipient) => toAddress(recipient));
|
|
7883
|
-
}
|
|
7884
|
-
function roleDefinitionFromConfig(definition) {
|
|
7885
|
-
const toRecipients = recipientsFromConfig(definition.spend?.toRecipients);
|
|
7886
|
-
return {
|
|
7887
|
-
label: definition.label,
|
|
7888
|
-
...definition.spend === void 0 ? {} : { spend: {
|
|
7889
|
-
...definition.spend.perTx === void 0 ? {} : { perTx: moneyFromConfig(definition.spend.perTx) },
|
|
7890
|
-
...definition.spend.perDay === void 0 ? {} : { perDay: moneyFromConfig(definition.spend.perDay) },
|
|
7891
|
-
...toRecipients === void 0 ? {} : { toRecipients }
|
|
7892
|
-
} },
|
|
7893
|
-
...definition.canManageMembers === void 0 ? {} : { canManageMembers: definition.canManageMembers },
|
|
7894
|
-
...definition.canManageRoles === void 0 ? {} : { canManageRoles: definition.canManageRoles }
|
|
7895
|
-
};
|
|
7896
|
-
}
|
|
7897
|
-
function startupRoleViews(orgId) {
|
|
7898
|
-
return compileOrgRoleDefinitions(orgRoleTemplateDefinitions("Startup")).roles.map((role) => ({
|
|
7899
|
-
orgId,
|
|
7900
|
-
label: role.label,
|
|
7901
|
-
roleKey: toRoleKey(role.roleKey),
|
|
7902
|
-
definition: roleDefinitionFromConfig(role.definition)
|
|
7903
|
-
}));
|
|
7904
|
-
}
|
|
7905
7846
|
function hermeticMember(input) {
|
|
7906
7847
|
return {
|
|
7907
7848
|
orgId: input.orgId,
|
|
@@ -8003,7 +7944,7 @@ function listRolesProgram(orgId) {
|
|
|
8003
7944
|
return Effect.gen(function* () {
|
|
8004
7945
|
const deps = yield* OrgDepsTag;
|
|
8005
7946
|
if (deps.orgPort !== void 0) return yield* deps.orgPort.listRoles({ orgId }).pipe(Effect.mapError((error) => error.publicError));
|
|
8006
|
-
return
|
|
7947
|
+
return [];
|
|
8007
7948
|
});
|
|
8008
7949
|
}
|
|
8009
7950
|
function listMembersProgram(orgId) {
|
|
@@ -8168,6 +8109,7 @@ function makeOrgMethods(deps) {
|
|
|
8168
8109
|
},
|
|
8169
8110
|
...convexCall === void 0 ? {} : { convexCall }
|
|
8170
8111
|
}),
|
|
8112
|
+
me: convexCall === void 0 ? orgMeUnavailable : makeOrgMeMethod({ convexCall }, String(orgId)),
|
|
8171
8113
|
async getLifecycle(options) {
|
|
8172
8114
|
if (options?.signal?.aborted) return {
|
|
8173
8115
|
ok: false,
|
|
@@ -8315,6 +8257,10 @@ function makeNotImplementedOrganizationPaymentsMethods() {
|
|
|
8315
8257
|
payBatch: organizationPaymentExecutionUnavailable
|
|
8316
8258
|
};
|
|
8317
8259
|
}
|
|
8260
|
+
const orgMeUnavailable = () => Promise.resolve({
|
|
8261
|
+
ok: false,
|
|
8262
|
+
error: Errors.notImplemented("org", "me")
|
|
8263
|
+
});
|
|
8318
8264
|
const permissionExecutionUnavailable = () => Promise.resolve({
|
|
8319
8265
|
ok: false,
|
|
8320
8266
|
error: Errors.notImplemented("permissions", "executionComposition")
|
|
@@ -8855,6 +8801,8 @@ const APPLIED_ACTION_BY_EVENT = {
|
|
|
8855
8801
|
RestoreSession: "none",
|
|
8856
8802
|
ResumeOtpEntry: "none",
|
|
8857
8803
|
Reset: "none",
|
|
8804
|
+
SessionRestored: "none",
|
|
8805
|
+
SessionAbsent: "none",
|
|
8858
8806
|
EnsureAccount: "none",
|
|
8859
8807
|
ClaimAccount: "none",
|
|
8860
8808
|
RetryAccount: "none",
|
|
@@ -9134,6 +9082,7 @@ function assembleCapxulClient(input) {
|
|
|
9134
9082
|
createOrg: orgMethods.createOrg,
|
|
9135
9083
|
orgs: orgMethods.orgs,
|
|
9136
9084
|
org: orgMethods.org,
|
|
9085
|
+
signer: input.signer?.statusStore ?? UNOBSERVABLE_SIGNER_STATUS,
|
|
9137
9086
|
_internal: {
|
|
9138
9087
|
identity: identityRuntime,
|
|
9139
9088
|
bootstrap: input.bootstrap,
|
|
@@ -9159,4 +9108,4 @@ function withHostObservation(actor, snapshot) {
|
|
|
9159
9108
|
};
|
|
9160
9109
|
}
|
|
9161
9110
|
//#endregion
|
|
9162
|
-
export { fingerprintPaymentIntent as A, formatTraceparent as B, ClockPortTag as C, AuthClientError as D, authClientPortFromPromiseAdapter as E, sanitizeObservationContext as F,
|
|
9111
|
+
export { fingerprintPaymentIntent as A, formatTraceparent as B, ClockPortTag as C, AuthClientError as D, authClientPortFromPromiseAdapter as E, sanitizeObservationContext as F, signerFailure as G, readInvocationObservation as H, CAPXUL_FUNCTIONS as I, BASE_SEPOLIA_CHAIN_ID as J, CAPXUL_PAYMENTS_V2_ADDRESS as K, BootstrapEnvelope as L, fromWei as M, OBSERVATION_CONTEXT_HEADER as N, AuthClientPortTag as O, encodeObservationContextHeader as P, isRestoring as Q, EngineeringTelemetryBootstrapPolicy as R, ClockError as S, bootstrapErrorFromCapxul as T, causeChain as U, copyInvocationObservation as V, injectedWalletSigner as W, destination as X, deriveCapxulSafeAddress as Y, isClaimed as Z, wireChainId as _, observeFailedResult as a, ConvexCallPortTag as b, captureExceptionSync as c, TelemetryPortTag as d, redactTelemetryEvent as f, accountReadErrorFromCapxul as g, AccountReadPortTag as h, observationContextProps as i, toWei as j, version as k, detectAuthCacheAdapter as l, smartAccountErrorFromCapxul as m, postHogProductTelemetry as n, postHogFailureObservation as o, SmartAccountPortTag as p, normalizeBindingEmail as q, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT as r, captureException as s, assembleCapxulClient as t, PostHogTelemetryLayer as u, IdentityPortTag as v, BootstrapPortTag as w, convexCallErrorFromCapxul as x, identityErrorFromCapxul as y, isSettingUpLifecycle as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as
|
|
1
|
+
import { $ as toAddress, C as Address, H as PartyId, J as RoleKey, N as CountryCode, O as AuthSession, S as AccountId, V as OrgId, a as SignerStatusStore, at as Errors, c as AccountProviderSource, ct as isCapxulError, d as eip1193AccountProvider, et as toCountryCode, f as localPrivateKeyAccountProvider, g as SmartAccount, h as Session, i as SignerStatus, it as CapxulErrorDetails, j as BudgetId, k as AuthUserId, l as AccountRequirement, m as Profile, n as CapxulSigner, nt as CapxulError, o as injectedWalletSigner, p as CapxulResult, r as Eip1193RequestProvider, rt as CapxulErrorCode, s as AccountProvider, st as FailureMode, t as CapxulDigestSigner, tt as CAPXUL_ERROR_CODES, u as Eip1193Provider, x as Account, z as Money } from "./signer-BejoR3bA.mjs";
|
|
2
|
+
import { $ as AccountMethods, $t as RecipientResolution, A as OrganizationAccount, An as isClaimed, At as FinancialOpsMethods, B as PermissionAssignInput, Bt as Payment, C as InviteMemberInput, Cn as Destination$1, Ct as DestinationAddInput, D as OrgScopedMethods, Dn as Readiness, Dt as DestinationRail, E as OrgMethods, En as OrgLane, Et as DestinationPayload, F as RoleView, Ft as OfframpQuote, G as PermissionReplaceInput, Gt as PaymentDocumentVerification, H as PermissionCreateInput, Ht as PaymentDocumentKind, I as OrganizationPaymentBatchInput, It as OfframpQuoteInput, J as Budget, Jt as PaymentStatus, K as PermissionRevokeInput, Kt as PaymentDocumentsMethods, L as OrganizationPaymentInput, Lt as OfframpStatus, M as ResendInviteTokenInput, Mn as IdentityTransition, Mt as MeMethods, N as RoleDefinition, Nn as InvocationControls, Nt as MeProfile, O as OrgTemplate, On as StateLabel, Ot as DestinationRemoveInput, P as RoleSpendCap, Pt as OfframpMethods, Q as AccountsMethods, Qt as PaymentsPayInput, R as OrganizationPaymentItemInput, Rt as Payee, S as DetectPendingOrgInvitationsResult, Sn as CAPXUL_PAYMENTS_V2_ADDRESS, St as Destination, T as MemberView, Tn as IdentityState, Tt as DestinationListInput, U as PermissionMethods, Ut as PaymentDocumentRef, V as PermissionChangeInput, Vt as PaymentDirection, W as PermissionOptions, Wt as PaymentDocumentRender, X as OrgMeMethod, Xt as PaymentType, Y as OrgMe, Yt as PaymentTiming, Z as OrgMeOptions, Zt as PaymentsMethods, _ as SystemHealth, _n as SubmittedPermissionExecution, _t as ActivityMethods, a as SdkFailureObservation, an as fingerprintPaymentIntent, at as ActorRequestsMethods, b as CurrentUserMethods, bt as ActorReference, c as PostHogObservabilityOptions, cn as isSettingUpLifecycle, ct as AddressBookLabelInput, d as CreateCapxulClientInput, dn as AuthMethods, dt as InboxItem, en as RecipientResolutionKind, et as ActorProfile, f as IdentityProfileDetails, fn as OrgLifecycle, ft as InboxMethods, g as SystemMethods, gn as Permission, gt as ActivityListParams, h as HoldingsMethods, hn as MovementAnnotation, ht as ActivityItem, i as ObservationDelivery, in as TargetsMethods, it as ActorRequestIssueInput, j as OrganizationAuditLogItem, jn as isRestoring, jt as HandlesMethods, k as OrgView, kn as destination, kt as DestinationsMethods, l as postHogObservability, ln as IdentityMethods, lt as AddressBookMethods, m as IdentityRuntimeSendResult, mn as CurrentHoldings, mt as ActivityDetail, n as ObservationAdapter, nn as ResolvedTarget, nt as ActorRelationshipMethods, o as HostObservability, on as AccountLifecycle, ot as AddressBookAddInput, p as IdentityRuntime, pn as OrgSetupStep, pt as ActivityAnnotationInput, q as PermissionReadResult, qt as PaymentMoney, r as ObservationContext, rn as TargetReference, rt as ActorRequest, s as PostHogObservabilityClient, sn as AccountSetupStep, st as AddressBookEntry, t as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, tn as Ref, tt as ActorProfileMethods, u as CapxulClient, un as SmartAccountMethods, ut as InboxApproveInput, v as MediaMethods, vt as ActivityPage, w as MemberStatus, wn as IdentityEvent, wt as DestinationKind, x as CreateOrgInput, xn as TelemetryPort, xt as DepositInstructions, y as CurrentUserContext, yt as ActivityReference, z as OrganizationPaymentsMethods, zt as PayeesMethods } from "./observation-Ci8gIQjm.mjs";
|
|
3
3
|
import { Hex } from "viem";
|
|
4
4
|
import { Context, Effect, Layer } from "effect";
|
|
5
5
|
import { FunctionReference } from "convex/server";
|
|
@@ -168,4 +168,4 @@ declare function captureException(telemetry: TelemetryPort, error: unknown, cont
|
|
|
168
168
|
*/
|
|
169
169
|
declare function captureExceptionSync(telemetry: TelemetryPort, error: unknown, context?: HandledErrorReportContext): void;
|
|
170
170
|
//#endregion
|
|
171
|
-
export { type Account, type AccountId, type AccountLifecycle, type AccountMethods, type AccountProvider, type AccountProviderSource, type AccountRequirement, type AccountSetupStep, type AccountsMethods, type ActivityAnnotationInput, type ActivityDetail, type ActivityItem, type ActivityListParams, type ActivityMethods, type ActivityPage, type ActivityReference, type ActorProfile, type ActorProfileMethods, type ActorReference, type ActorRelationshipMethods, type ActorRequest, type ActorRequestIssueInput, type ActorRequestsMethods, type Address, type AddressBookAddInput, type AddressBookEntry, type AddressBookLabelInput, type AddressBookMethods, type AuthMethods, type AuthSession, type AuthUserId, CAPXUL_ERROR_CODES, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, type CapxulClient, type CapxulClientInput, type CapxulDigestSigner, CapxulError, type CapxulErrorCode, type CapxulErrorDetails, type CapxulResult, type CapxulSigner, type CountryCode, type CreateCapxulClientInput, type CreateOrgInput, type CurrentHoldings, type CurrentUserContext, type CurrentUserMethods, type DepositInstructions, type Destination, type DestinationAddInput, type DestinationKind, type DestinationListInput, type DestinationPayload, type DestinationRail, type DestinationRemoveInput, type DestinationsMethods, type DetectPendingOrgInvitationsResult, type DevPrivateKeySignerInput, type Eip1193Provider, type Eip1193RequestProvider, Errors, type FinancialOpsMethods, type HandledErrorReportContext, type HandlesMethods, type HoldingsMethods, type HostObservability, type Destination$1 as IdentityDestination, type IdentityEvent, type IdentityMethods, type IdentityProfileDetails, type IdentityRuntime, type IdentityRuntimeSendResult, type IdentityState, type IdentityTransition, type InboxApproveInput, type InboxItem, type InboxMethods, type InviteMemberInput, type InvocationControls, type MeMethods, type MeProfile, type MediaMethods, type MemberStatus, type MemberView, type Money, type MoneyParseError, type MoneyParseErrorReason, type MovementAnnotation, type ObservationAdapter, type ObservationContext, type ObservationDelivery, type OfframpMethods, type OfframpQuote, type OfframpQuoteInput, type OfframpStatus, type OpenfortEmbeddedSignerInput, type OpenfortEmbeddedWalletApi, type OpenfortEmbeddedWalletPort, type OrgId, type OrgLane, type OrgLifecycle, type OrgMethods, type OrgScopedMethods, type OrgSetupStep, type OrgTemplate, type OrgView, type OrganizationAccount, type OrganizationAuditLogItem, type OrganizationPaymentBatchInput, type OrganizationPaymentInput, type OrganizationPaymentItemInput, type OrganizationPaymentsMethods, type PartyId, type Payee, type PayeesMethods, type Payment, type PaymentDirection, type PaymentDocumentKind, type PaymentDocumentRef, type PaymentDocumentRender, type PaymentDocumentVerification, type PaymentDocumentsMethods, type PaymentMoney, type PaymentStatus, type PaymentTiming, type PaymentType, type PaymentsMethods, type PaymentsPayInput, type Permission, type PermissionAssignInput, type PermissionChangeInput, type PermissionCreateInput, type PermissionMethods, type PermissionOptions, type PermissionReadResult, type PermissionReplaceInput, type PermissionRevokeInput, type PostHogObservabilityClient, type PostHogObservabilityOptions, type Profile, type Readiness, type RecipientResolution, type RecipientResolutionKind, type Ref, type ResendInviteTokenInput, type ResolvedTarget, type RoleDefinition, type RoleKey, type RoleSpendCap, type RoleView, type SdkFailureObservation, type Session, type SmartAccount, type SmartAccountMethods, type StateLabel, type SubmittedPermissionExecution, type SystemHealth, type SystemMethods, type TargetReference, type TargetsMethods, type TelemetryPort, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, fingerprintPaymentIntent, formatMoney, injectedWalletSigner, isCapxulError, isMoneyParseError, isSettingUpLifecycle, localPrivateKeyAccountProvider, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, parseMoney, postHogObservability, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress };
|
|
171
|
+
export { type Account, type AccountId, type AccountLifecycle, type AccountMethods, type AccountProvider, type AccountProviderSource, type AccountRequirement, type AccountSetupStep, type AccountsMethods, type ActivityAnnotationInput, type ActivityDetail, type ActivityItem, type ActivityListParams, type ActivityMethods, type ActivityPage, type ActivityReference, type ActorProfile, type ActorProfileMethods, type ActorReference, type ActorRelationshipMethods, type ActorRequest, type ActorRequestIssueInput, type ActorRequestsMethods, type Address, type AddressBookAddInput, type AddressBookEntry, type AddressBookLabelInput, type AddressBookMethods, type AuthMethods, type AuthSession, type AuthUserId, type Budget, type BudgetId, CAPXUL_ERROR_CODES, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, type CapxulClient, type CapxulClientInput, type CapxulDigestSigner, CapxulError, type CapxulErrorCode, type CapxulErrorDetails, type CapxulResult, type CapxulSigner, type CountryCode, type CreateCapxulClientInput, type CreateOrgInput, type CurrentHoldings, type CurrentUserContext, type CurrentUserMethods, type DepositInstructions, type Destination, type DestinationAddInput, type DestinationKind, type DestinationListInput, type DestinationPayload, type DestinationRail, type DestinationRemoveInput, type DestinationsMethods, type DetectPendingOrgInvitationsResult, type DevPrivateKeySignerInput, type Eip1193Provider, type Eip1193RequestProvider, Errors, type FinancialOpsMethods, type HandledErrorReportContext, type HandlesMethods, type HoldingsMethods, type HostObservability, type Destination$1 as IdentityDestination, type IdentityEvent, type IdentityMethods, type IdentityProfileDetails, type IdentityRuntime, type IdentityRuntimeSendResult, type IdentityState, type IdentityTransition, type InboxApproveInput, type InboxItem, type InboxMethods, type InviteMemberInput, type InvocationControls, type MeMethods, type MeProfile, type MediaMethods, type MemberStatus, type MemberView, type Money, type MoneyParseError, type MoneyParseErrorReason, type MovementAnnotation, type ObservationAdapter, type ObservationContext, type ObservationDelivery, type OfframpMethods, type OfframpQuote, type OfframpQuoteInput, type OfframpStatus, type OpenfortEmbeddedSignerInput, type OpenfortEmbeddedWalletApi, type OpenfortEmbeddedWalletPort, type OrgId, type OrgLane, type OrgLifecycle, type OrgMe, type OrgMeMethod, type OrgMeOptions, type OrgMethods, type OrgScopedMethods, type OrgSetupStep, type OrgTemplate, type OrgView, type OrganizationAccount, type OrganizationAuditLogItem, type OrganizationPaymentBatchInput, type OrganizationPaymentInput, type OrganizationPaymentItemInput, type OrganizationPaymentsMethods, type PartyId, type Payee, type PayeesMethods, type Payment, type PaymentDirection, type PaymentDocumentKind, type PaymentDocumentRef, type PaymentDocumentRender, type PaymentDocumentVerification, type PaymentDocumentsMethods, type PaymentMoney, type PaymentStatus, type PaymentTiming, type PaymentType, type PaymentsMethods, type PaymentsPayInput, type Permission, type PermissionAssignInput, type PermissionChangeInput, type PermissionCreateInput, type PermissionMethods, type PermissionOptions, type PermissionReadResult, type PermissionReplaceInput, type PermissionRevokeInput, type PostHogObservabilityClient, type PostHogObservabilityOptions, type Profile, type Readiness, type RecipientResolution, type RecipientResolutionKind, type Ref, type ResendInviteTokenInput, type ResolvedTarget, type RoleDefinition, type RoleKey, type RoleSpendCap, type RoleView, type SdkFailureObservation, type Session, type SignerStatus, type SignerStatusStore, type SmartAccount, type SmartAccountMethods, type StateLabel, type SubmittedPermissionExecution, type SystemHealth, type SystemMethods, type TargetReference, type TargetsMethods, type TelemetryPort, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, fingerprintPaymentIntent, formatMoney, injectedWalletSigner, isCapxulError, isClaimed, isMoneyParseError, isRestoring, isSettingUpLifecycle, localPrivateKeyAccountProvider, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, parseMoney, postHogObservability, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as fingerprintPaymentIntent, B as formatTraceparent, C as ClockPortTag, D as AuthClientError, E as authClientPortFromPromiseAdapter, F as sanitizeObservationContext, G as
|
|
2
|
-
import {
|
|
1
|
+
import { A as fingerprintPaymentIntent, B as formatTraceparent, C as ClockPortTag, D as AuthClientError, E as authClientPortFromPromiseAdapter, F as sanitizeObservationContext, G as signerFailure, H as readInvocationObservation, I as CAPXUL_FUNCTIONS, J as BASE_SEPOLIA_CHAIN_ID, K as CAPXUL_PAYMENTS_V2_ADDRESS, L as BootstrapEnvelope, M as fromWei, N as OBSERVATION_CONTEXT_HEADER, O as AuthClientPortTag, P as encodeObservationContextHeader, Q as isRestoring, R as EngineeringTelemetryBootstrapPolicy, S as ClockError, T as bootstrapErrorFromCapxul, U as causeChain, V as copyInvocationObservation, W as injectedWalletSigner, X as destination, Z as isClaimed, _ as wireChainId, a as observeFailedResult, b as ConvexCallPortTag, c as captureExceptionSync, d as TelemetryPortTag, g as accountReadErrorFromCapxul, h as AccountReadPortTag, i as observationContextProps, j as toWei, k as version, l as detectAuthCacheAdapter, m as smartAccountErrorFromCapxul, n as postHogProductTelemetry, o as postHogFailureObservation, p as SmartAccountPortTag, q as normalizeBindingEmail, r as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, s as captureException, t as assembleCapxulClient, u as PostHogTelemetryLayer, v as IdentityPortTag, w as BootstrapPortTag, x as convexCallErrorFromCapxul, y as identityErrorFromCapxul, z as isSettingUpLifecycle } from "./create-capxul-client-DTQDSOvO.mjs";
|
|
2
|
+
import { C as toDurationMs, D as toJwtToken, E as toEpochSeconds, F as CAPXUL_ERROR_CODES, I as CapxulError, M as toRoleKey, N as toSessionToken, O as toKycTier, P as decodeConvexError, R as Errors, S as toCurrencyCode, T as toEpochMs, b as toChainId, g as toAllowedOrigin, h as toAddress, j as toPublishableKey, k as toOrgId, m as toAccountId, o as AuthCachePortTag, p as currencySymbolFor, v as toAuthUserId, w as toEmail, x as toCountryCode, z as isCapxulError } from "./InMemoryAuthCacheAdapter-qMpBOGb3.mjs";
|
|
3
3
|
import { keccak256, recoverAddress, stringToHex } from "viem";
|
|
4
4
|
import { Cause, Context, Data, Effect, Exit, Layer, Result, SchemaIssue, SchemaParser, Scope, Tracer } from "effect";
|
|
5
5
|
import { getFunctionName, makeFunctionReference } from "convex/server";
|
|
@@ -1725,6 +1725,7 @@ function parseRoleDefinition(json) {
|
|
|
1725
1725
|
...raw.spend.perDay === void 0 ? {} : { perDay: parseRoleMoney(raw.spend.perDay, "perDay") },
|
|
1726
1726
|
...raw.spend.toRecipients === void 0 ? {} : { toRecipients: parseRoleRecipients(raw.spend.toRecipients) }
|
|
1727
1727
|
} },
|
|
1728
|
+
...typeof raw.canSpend === "boolean" ? { canSpend: raw.canSpend } : {},
|
|
1728
1729
|
...typeof raw.canManageMembers === "boolean" ? { canManageMembers: raw.canManageMembers } : {},
|
|
1729
1730
|
...typeof raw.canManageRoles === "boolean" ? { canManageRoles: raw.canManageRoles } : {}
|
|
1730
1731
|
};
|
|
@@ -2123,6 +2124,10 @@ var ConsoleDiagnosticAdapter = class {
|
|
|
2123
2124
|
function openfortProviderError(operation, cause) {
|
|
2124
2125
|
return cause instanceof CapxulError ? cause : Errors.providerError("openfort", operation, cause, { failure_mode: "unknown" });
|
|
2125
2126
|
}
|
|
2127
|
+
/** Build a named PROVIDER_ERROR. The assembled Core SDK boundary reports it. */
|
|
2128
|
+
function failOpenfort(operation, failure_mode, cause) {
|
|
2129
|
+
return Errors.providerError("openfort", operation, cause, { failure_mode });
|
|
2130
|
+
}
|
|
2126
2131
|
/**
|
|
2127
2132
|
* True when the browser cannot perform Web Crypto — sandboxed iframes, headless
|
|
2128
2133
|
* agent browsers, or non-HTTPS origins. OpenFort's embedded-wallet `configure`
|
|
@@ -2159,22 +2164,77 @@ function clearStaleOpenfortBrowserStorage(publishableKey) {
|
|
|
2159
2164
|
if (scope === void 0) return;
|
|
2160
2165
|
for (const key of OPENFORT_BROWSER_STORAGE_KEYS) localStorage.removeItem(`${scope}.${key}`);
|
|
2161
2166
|
}
|
|
2167
|
+
/**
|
|
2168
|
+
* The Openfort error code that names the stale-user class (#1435).
|
|
2169
|
+
* `getThirdPartyAuthToken` skips `authenticateThirdParty` while a `userId` sits
|
|
2170
|
+
* in scoped storage. A purged `userId` therefore pins every later call to a 401
|
|
2171
|
+
* that `extractApiError` reports as `USER_NOT_FOUND`.
|
|
2172
|
+
*
|
|
2173
|
+
* The set holds one member on purpose. Session-expiry codes (`SESSION_EXPIRED`,
|
|
2174
|
+
* `NOT_LOGGED_IN`, `INVALID_TOKEN`, `REFRESH_TOKEN_ERROR`) are a different
|
|
2175
|
+
* cause, and a bare 401 is a different cause again: `app-env-allowlist` is a
|
|
2176
|
+
* 401 by definition (`packages/errors/src/errors.ts:80-81`). Healing those and
|
|
2177
|
+
* tagging them `stale-openfort-cache` would delete the triage signal the tag
|
|
2178
|
+
* exists to carry.
|
|
2179
|
+
*/
|
|
2180
|
+
const STALE_USER_ERROR_CODES = new Set(["USER_NOT_FOUND"]);
|
|
2181
|
+
/**
|
|
2182
|
+
* The one predicate that opens the heal. It reads the Openfort error code and
|
|
2183
|
+
* never the message text (ADR-0023 R4). It walks the cause chain the way
|
|
2184
|
+
* `isTransportError` walks it in the Convex transport adapter.
|
|
2185
|
+
*
|
|
2186
|
+
* Known ceiling (#1435): a 401 that carries no recognized code is NOT healed.
|
|
2187
|
+
* `extractApiError` keeps the status only on `AuthenticationError`, so such a
|
|
2188
|
+
* payload is reachable. Add the code a live payload shows; do not add a message
|
|
2189
|
+
* match, because that trades one bug class for an ADR-0023 R4 violation.
|
|
2190
|
+
*/
|
|
2191
|
+
function isStaleUserSignal(cause) {
|
|
2192
|
+
for (const link of causeChain(cause)) {
|
|
2193
|
+
const error = link;
|
|
2194
|
+
if (typeof error.error === "string" && STALE_USER_ERROR_CODES.has(error.error) || typeof error.code === "string" && STALE_USER_ERROR_CODES.has(error.code)) return true;
|
|
2195
|
+
}
|
|
2196
|
+
return false;
|
|
2197
|
+
}
|
|
2162
2198
|
function createOpenfortBrowserSignerFromBootstrap(bootstrap, options = {}) {
|
|
2163
2199
|
const diagnostic = options.diagnostic;
|
|
2164
2200
|
const authBaseUrl = normalizeBetterAuthBaseUrl(bootstrap.authBaseUrl);
|
|
2201
|
+
let currentStatus = "unknown";
|
|
2202
|
+
const statusListeners = /* @__PURE__ */ new Set();
|
|
2203
|
+
function setStatus(next) {
|
|
2204
|
+
if (currentStatus === next) return;
|
|
2205
|
+
currentStatus = next;
|
|
2206
|
+
for (const listener of statusListeners) try {
|
|
2207
|
+
listener(next);
|
|
2208
|
+
} catch {
|
|
2209
|
+
statusListeners.delete(listener);
|
|
2210
|
+
diagnostic?.trace("openfort.signerStatusListener", {
|
|
2211
|
+
ok: false,
|
|
2212
|
+
failure_mode: "unknown"
|
|
2213
|
+
});
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
const statusStore = {
|
|
2217
|
+
status: () => currentStatus,
|
|
2218
|
+
subscribe: (listener) => {
|
|
2219
|
+
statusListeners.add(listener);
|
|
2220
|
+
return () => {
|
|
2221
|
+
statusListeners.delete(listener);
|
|
2222
|
+
};
|
|
2223
|
+
}
|
|
2224
|
+
};
|
|
2165
2225
|
/**
|
|
2166
2226
|
* Closes the black hole: when the browser has no Web Crypto, OpenFort's
|
|
2167
2227
|
* `configure` would resolve to no address and the failure would be reported
|
|
2168
|
-
* as `unknown`. Detect it before any network
|
|
2169
|
-
* `no-secure-context` on a PROVIDER_ERROR scoped to `configure
|
|
2170
|
-
*
|
|
2228
|
+
* as `unknown`. Detect it before any network or wallet work. Tag it
|
|
2229
|
+
* `no-secure-context` on a PROVIDER_ERROR scoped to `configure`. Add a
|
|
2230
|
+
* DiagnosticPort breadcrumb. The assembled Core SDK boundary reports it.
|
|
2171
2231
|
*/
|
|
2172
2232
|
function failNoSecureContext() {
|
|
2173
2233
|
diagnostic?.trace("openfort.configure", {
|
|
2174
2234
|
ok: false,
|
|
2175
2235
|
failure_mode: "no-secure-context"
|
|
2176
2236
|
});
|
|
2177
|
-
throw
|
|
2237
|
+
throw failOpenfort("configure", "no-secure-context", /* @__PURE__ */ new Error("Web Crypto unavailable: browser is not a secure context"));
|
|
2178
2238
|
}
|
|
2179
2239
|
function betterAuthSessionUrl() {
|
|
2180
2240
|
return `${authBaseUrl}/get-session`;
|
|
@@ -2225,6 +2285,39 @@ function createOpenfortBrowserSignerFromBootstrap(bootstrap, options = {}) {
|
|
|
2225
2285
|
getAccessToken: fetchBetterAuthAccessToken
|
|
2226
2286
|
}
|
|
2227
2287
|
});
|
|
2288
|
+
async function configureEmbeddedWallet(encryptionSession) {
|
|
2289
|
+
await openfort.embeddedWallet.configure({
|
|
2290
|
+
accountType: AccountTypeEnum.EOA,
|
|
2291
|
+
chainType: ChainTypeEnum.EVM,
|
|
2292
|
+
recoveryParams: {
|
|
2293
|
+
recoveryMethod: RecoveryMethod.AUTOMATIC,
|
|
2294
|
+
encryptionSession
|
|
2295
|
+
}
|
|
2296
|
+
});
|
|
2297
|
+
}
|
|
2298
|
+
/**
|
|
2299
|
+
* ONE heal cycle on the stale-user rejection (#1435). Clear the scoped
|
|
2300
|
+
* storage that pins the dead `userId`, run the existing configure path — it
|
|
2301
|
+
* re-runs third-party auth against the live Better Auth session now that no
|
|
2302
|
+
* `userId` is cached — and retry the read once. Exactly one cycle: a second
|
|
2303
|
+
* rejection is terminal and carries `failure_mode: "stale-openfort-cache"`.
|
|
2304
|
+
* The caller stays in `recovering` throughout; only the outcome moves it.
|
|
2305
|
+
*/
|
|
2306
|
+
async function healStaleOpenfortCache(encryptionSession) {
|
|
2307
|
+
try {
|
|
2308
|
+
clearStaleOpenfortBrowserStorage(bootstrap.openfortPublishableKey);
|
|
2309
|
+
diagnostic?.trace("openfort.storageCleared", { beforeConfigure: false });
|
|
2310
|
+
await configureEmbeddedWallet(encryptionSession);
|
|
2311
|
+
await openfort.embeddedWallet.get();
|
|
2312
|
+
} catch (cause) {
|
|
2313
|
+
diagnostic?.trace("openfort.staleCacheHeal", {
|
|
2314
|
+
ok: false,
|
|
2315
|
+
failure_mode: "stale-openfort-cache"
|
|
2316
|
+
});
|
|
2317
|
+
throw failOpenfort("get", "stale-openfort-cache", cause);
|
|
2318
|
+
}
|
|
2319
|
+
diagnostic?.trace("openfort.staleCacheHeal", { ok: true });
|
|
2320
|
+
}
|
|
2228
2321
|
let walletReadyPromise = null;
|
|
2229
2322
|
function startWalletReady() {
|
|
2230
2323
|
return (async () => {
|
|
@@ -2289,14 +2382,7 @@ function createOpenfortBrowserSignerFromBootstrap(bootstrap, options = {}) {
|
|
|
2289
2382
|
clearStaleOpenfortBrowserStorage(bootstrap.openfortPublishableKey);
|
|
2290
2383
|
diagnostic?.trace("openfort.storageCleared", { beforeConfigure: true });
|
|
2291
2384
|
try {
|
|
2292
|
-
await
|
|
2293
|
-
accountType: AccountTypeEnum.EOA,
|
|
2294
|
-
chainType: ChainTypeEnum.EVM,
|
|
2295
|
-
recoveryParams: {
|
|
2296
|
-
recoveryMethod: RecoveryMethod.AUTOMATIC,
|
|
2297
|
-
encryptionSession: encryptionBody.sessionId
|
|
2298
|
-
}
|
|
2299
|
-
});
|
|
2385
|
+
await configureEmbeddedWallet(encryptionBody.sessionId);
|
|
2300
2386
|
diagnostic?.trace("openfort.configure", { ok: true });
|
|
2301
2387
|
} catch (cause) {
|
|
2302
2388
|
diagnostic?.trace("openfort.configure", {
|
|
@@ -2310,20 +2396,36 @@ function createOpenfortBrowserSignerFromBootstrap(bootstrap, options = {}) {
|
|
|
2310
2396
|
await openfort.embeddedWallet.get();
|
|
2311
2397
|
diagnostic?.trace("openfort.get", { ok: true });
|
|
2312
2398
|
} catch (cause) {
|
|
2399
|
+
if (!isStaleUserSignal(cause)) {
|
|
2400
|
+
diagnostic?.trace("openfort.get", {
|
|
2401
|
+
ok: false,
|
|
2402
|
+
failure_mode: "unknown"
|
|
2403
|
+
});
|
|
2404
|
+
throw openfortProviderError("get", cause);
|
|
2405
|
+
}
|
|
2313
2406
|
diagnostic?.trace("openfort.get", {
|
|
2314
2407
|
ok: false,
|
|
2315
|
-
failure_mode: "
|
|
2408
|
+
failure_mode: "stale-openfort-cache"
|
|
2316
2409
|
});
|
|
2317
|
-
|
|
2410
|
+
await healStaleOpenfortCache(encryptionBody.sessionId);
|
|
2318
2411
|
}
|
|
2319
2412
|
})();
|
|
2320
2413
|
}
|
|
2321
2414
|
async function ensureOpenfortWalletReady() {
|
|
2322
|
-
|
|
2415
|
+
let joined = walletReadyPromise;
|
|
2416
|
+
if (joined === null) {
|
|
2417
|
+
joined = startWalletReady();
|
|
2418
|
+
walletReadyPromise = joined;
|
|
2419
|
+
setStatus("recovering");
|
|
2420
|
+
}
|
|
2323
2421
|
try {
|
|
2324
|
-
await
|
|
2422
|
+
await joined;
|
|
2423
|
+
if (walletReadyPromise === joined) setStatus("ready");
|
|
2325
2424
|
} catch (cause) {
|
|
2326
|
-
walletReadyPromise
|
|
2425
|
+
if (walletReadyPromise === joined) {
|
|
2426
|
+
walletReadyPromise = null;
|
|
2427
|
+
setStatus("unavailable");
|
|
2428
|
+
}
|
|
2327
2429
|
throw cause;
|
|
2328
2430
|
}
|
|
2329
2431
|
}
|
|
@@ -2333,6 +2435,7 @@ function createOpenfortBrowserSignerFromBootstrap(bootstrap, options = {}) {
|
|
|
2333
2435
|
});
|
|
2334
2436
|
return {
|
|
2335
2437
|
...signer,
|
|
2438
|
+
statusStore,
|
|
2336
2439
|
getAddress: async () => {
|
|
2337
2440
|
try {
|
|
2338
2441
|
const address = await signer.getAddress();
|
|
@@ -2350,6 +2453,7 @@ function createOpenfortBrowserSignerFromBootstrap(bootstrap, options = {}) {
|
|
|
2350
2453
|
walletReadyPromise = null;
|
|
2351
2454
|
clearStaleOpenfortBrowserStorage(bootstrap.openfortPublishableKey);
|
|
2352
2455
|
signer.resetAddressCache();
|
|
2456
|
+
setStatus("unknown");
|
|
2353
2457
|
}
|
|
2354
2458
|
};
|
|
2355
2459
|
}
|
|
@@ -2965,4 +3069,4 @@ async function createCapxulClient(input) {
|
|
|
2965
3069
|
return createCapxulClient$1(input);
|
|
2966
3070
|
}
|
|
2967
3071
|
//#endregion
|
|
2968
|
-
export { CAPXUL_ERROR_CODES, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, CapxulError, Errors, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, fingerprintPaymentIntent, formatMoney, injectedWalletSigner, isCapxulError, isMoneyParseError, isSettingUpLifecycle, localPrivateKeyAccountProvider, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, parseMoney, postHogObservability, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress };
|
|
3072
|
+
export { CAPXUL_ERROR_CODES, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, CapxulError, Errors, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, fingerprintPaymentIntent, formatMoney, injectedWalletSigner, isCapxulError, isClaimed, isMoneyParseError, isRestoring, isSettingUpLifecycle, localPrivateKeyAccountProvider, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, parseMoney, postHogObservability, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress };
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as AuthSession, _ as AuthCacheError, b as CachedJwt, n as CapxulSigner, v as AuthCachePort, y as AuthCachePortTag } from "../signer-BejoR3bA.mjs";
|
|
2
2
|
import { Hex } from "viem";
|
|
3
3
|
import { Effect, FileSystem, Layer, Path } from "effect";
|
|
4
4
|
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AuthCacheError, h as toAddress, i as parseCachedJwt, n as BrowserAuthCacheAdapter, o as AuthCachePortTag, r as parseAuthSession, t as InMemoryAuthCacheAdapter } from "../InMemoryAuthCacheAdapter-
|
|
1
|
+
import { a as AuthCacheError, h as toAddress, i as parseCachedJwt, n as BrowserAuthCacheAdapter, o as AuthCachePortTag, r as parseAuthSession, t as InMemoryAuthCacheAdapter } from "../InMemoryAuthCacheAdapter-qMpBOGb3.mjs";
|
|
2
2
|
import { Effect, FileSystem, Layer, Path } from "effect";
|
|
3
3
|
import { privateKeyToAccount } from "viem/accounts";
|
|
4
4
|
import * as os from "node:os";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as BlockNumber, B as MovementId, C as Address$1, D as AppId, E as AnonymousDistinctId, F as DocumentHash, G as PermissionId, H as PartyId, I as DurationMs, J as RoleKey, K as Profile, L as Email, M as ChainId, N as CountryCode, O as AuthSession, P as CurrencyCode, Q as WeiAmount, R as EpochMs, T as AllowedOrigin, U as PaymentCommandId, V as OrgId, W as PermissionAssignmentId, X as SmartAccount, Y as SessionToken, Z as TxHash, a as SignerStatusStore, b as CachedJwt, c as AccountProviderSource, g as SmartAccount$1, h as Session$1, it as CapxulErrorDetails, j as BudgetId, k as AuthUserId, l as AccountRequirement, m as Profile$1, n as CapxulSigner, nt as CapxulError, ot as Failure, p as CapxulResult, q as PublishableKey, rt as CapxulErrorCode, st as FailureMode, v as AuthCachePort, w as AllowanceKey, x as Account$1, z as Money } from "./signer-BejoR3bA.mjs";
|
|
2
2
|
import { Address, Hex } from "viem";
|
|
3
3
|
import { Context, Effect, Layer, Schema, Scope, Tracer } from "effect";
|
|
4
4
|
import { FunctionReference } from "convex/server";
|
|
@@ -127,7 +127,13 @@ type Readiness = {
|
|
|
127
127
|
readonly failure: Failure;
|
|
128
128
|
readonly retryable: boolean;
|
|
129
129
|
};
|
|
130
|
-
type IdentityState =
|
|
130
|
+
type IdentityState =
|
|
131
|
+
/** The INITIAL state: a session probe is in flight and the machine knows
|
|
132
|
+
* nothing yet. Distinct from `signed_out`, which is a settled answer. Without
|
|
133
|
+
* it every consumer read the restore window as a real sign-out. */
|
|
134
|
+
{
|
|
135
|
+
readonly phase: "restoring";
|
|
136
|
+
} | {
|
|
131
137
|
readonly phase: "signed_out";
|
|
132
138
|
} | {
|
|
133
139
|
readonly phase: "otp_sending";
|
|
@@ -159,7 +165,7 @@ type IdentityState = {
|
|
|
159
165
|
readonly requestedAt: number;
|
|
160
166
|
} | null;
|
|
161
167
|
};
|
|
162
|
-
declare const STATE_LABELS: readonly ["signed_out", "otp_sending", "otp_pending", "otp_verifying", "authenticated:unknown", "authenticated:deriving", "authenticated:counterfactual", "authenticated:claiming", "authenticated:failed", "authenticated:claimed", "authenticated:claimed:creating", "authenticated:claimed:loading", "authenticated:claimed:settingUp", "authenticated:claimed:ready", "authenticated:claimed:failed", "signing_out", "faulted"];
|
|
168
|
+
declare const STATE_LABELS: readonly ["restoring", "signed_out", "otp_sending", "otp_pending", "otp_verifying", "authenticated:unknown", "authenticated:deriving", "authenticated:counterfactual", "authenticated:claiming", "authenticated:failed", "authenticated:claimed", "authenticated:claimed:creating", "authenticated:claimed:loading", "authenticated:claimed:settingUp", "authenticated:claimed:ready", "authenticated:claimed:failed", "signing_out", "faulted"];
|
|
163
169
|
type StateLabel = (typeof STATE_LABELS)[number];
|
|
164
170
|
type IdentityEvent = {
|
|
165
171
|
readonly _tag: "RequestOtp";
|
|
@@ -182,6 +188,12 @@ type IdentityEvent = {
|
|
|
182
188
|
readonly now: number;
|
|
183
189
|
} | {
|
|
184
190
|
readonly _tag: "Reset";
|
|
191
|
+
} | {
|
|
192
|
+
readonly _tag: "SessionRestored";
|
|
193
|
+
readonly session: Session;
|
|
194
|
+
readonly profileComplete: boolean;
|
|
195
|
+
} | {
|
|
196
|
+
readonly _tag: "SessionAbsent";
|
|
185
197
|
} | {
|
|
186
198
|
readonly _tag: "EnsureAccount";
|
|
187
199
|
} | {
|
|
@@ -223,6 +235,22 @@ type Destination$1 = {
|
|
|
223
235
|
* there is no org list in the state, only the ONE active lane.
|
|
224
236
|
*/
|
|
225
237
|
declare const destination: (state: IdentityState) => Destination$1 | null;
|
|
238
|
+
/**
|
|
239
|
+
* True while the machine has not settled enough to route or to gate on.
|
|
240
|
+
*
|
|
241
|
+
* NEGATIVE classification, deliberately: the SETTLED positions are the ones
|
|
242
|
+
* enumerated, and everything else waits. A phase or readiness variant added
|
|
243
|
+
* later therefore defaults to holding, never to redirecting a member who is in
|
|
244
|
+
* fact signed in. Terminal for the account lane is `claimed | failed`.
|
|
245
|
+
*
|
|
246
|
+
* The org lane's own settledness (`ready | failed`) is the route gate's
|
|
247
|
+
* question, not this one: every org lane sits under a CLAIMED account, and
|
|
248
|
+
* `destination()` already names a real screen for each of its positions.
|
|
249
|
+
*/
|
|
250
|
+
declare const isRestoring: (state: IdentityState) => boolean;
|
|
251
|
+
/** The claimed-account gate as one function. The inlined consumers move onto
|
|
252
|
+
* it in #1521; this ticket ships the selector they move onto. */
|
|
253
|
+
declare const isClaimed: (state: IdentityState) => boolean;
|
|
226
254
|
//#endregion
|
|
227
255
|
//#region ../config/src/capxul-payments-v2.d.ts
|
|
228
256
|
/** Immutable CapxulPaymentsV2 deployment on Base Sepolia. */
|
|
@@ -774,7 +802,7 @@ interface IdentityPort {
|
|
|
774
802
|
type SafeDeploymentConfig = {
|
|
775
803
|
readonly chainId: ChainId;
|
|
776
804
|
readonly rpcUrl: string;
|
|
777
|
-
readonly
|
|
805
|
+
readonly bundlerRpcUrl: string;
|
|
778
806
|
readonly receiptTimeoutMs?: DurationMs;
|
|
779
807
|
};
|
|
780
808
|
/**
|
|
@@ -1871,6 +1899,47 @@ interface OrgPort {
|
|
|
1871
1899
|
detectAndAcceptPendingInvitations(input: DetectPendingOrgInvitationsInput): Effect.Effect<DetectPendingOrgInvitationsResult$1, OrgError, never>;
|
|
1872
1900
|
}
|
|
1873
1901
|
//#endregion
|
|
1902
|
+
//#region src/surface/org-me.d.ts
|
|
1903
|
+
/**
|
|
1904
|
+
* One spend authority the Member holds. `limit` is the cap the payment gate
|
|
1905
|
+
* enforces on a single payment — `null` means the Budget carries no cap. The
|
|
1906
|
+
* amount still available under the cap is not part of this read and is not
|
|
1907
|
+
* computable from it.
|
|
1908
|
+
*/
|
|
1909
|
+
interface Budget {
|
|
1910
|
+
readonly id: BudgetId;
|
|
1911
|
+
/** Display name, taken from the Role the grant was motivated by. */
|
|
1912
|
+
readonly label: string;
|
|
1913
|
+
readonly limit: Money | null;
|
|
1914
|
+
}
|
|
1915
|
+
/**
|
|
1916
|
+
* The caller's own standing in one Organization.
|
|
1917
|
+
*
|
|
1918
|
+
* `role` is `null` when the Role catalog cannot name the Member's Role — a
|
|
1919
|
+
* label-less owner is tolerated (ADR-0017), so consumers must render an
|
|
1920
|
+
* absent Role rather than invent one.
|
|
1921
|
+
*
|
|
1922
|
+
* `capabilities` are the two facts the backend actually enforces, and nothing
|
|
1923
|
+
* else: managing people, and spending. Payroll and invoice approval are both
|
|
1924
|
+
* spending, so both read `canSpend`.
|
|
1925
|
+
*/
|
|
1926
|
+
interface OrgMe {
|
|
1927
|
+
readonly role: {
|
|
1928
|
+
readonly label: string;
|
|
1929
|
+
} | null;
|
|
1930
|
+
readonly capabilities: {
|
|
1931
|
+
readonly canManagePeople: boolean;
|
|
1932
|
+
readonly canSpend: boolean;
|
|
1933
|
+
};
|
|
1934
|
+
/** Named Budgets this Member can spend from. `canSpend` is the authority fact. */
|
|
1935
|
+
readonly budgets: readonly Budget[];
|
|
1936
|
+
readonly observedAt: number;
|
|
1937
|
+
}
|
|
1938
|
+
type OrgMeOptions = {
|
|
1939
|
+
readonly signal?: AbortSignal;
|
|
1940
|
+
};
|
|
1941
|
+
type OrgMeMethod = (options?: OrgMeOptions) => Promise<CapxulResult<OrgMe>>;
|
|
1942
|
+
//#endregion
|
|
1874
1943
|
//#region src/contract/permission.d.ts
|
|
1875
1944
|
interface PermissionReadResult {
|
|
1876
1945
|
readonly permissions: readonly Permission[];
|
|
@@ -1991,11 +2060,14 @@ type RoleSpendCap = {
|
|
|
1991
2060
|
type RoleDefinition = {
|
|
1992
2061
|
readonly label: string;
|
|
1993
2062
|
readonly spend?: RoleSpendCap;
|
|
2063
|
+
readonly canSpend?: boolean;
|
|
1994
2064
|
readonly canManageMembers?: boolean;
|
|
1995
2065
|
readonly canManageRoles?: boolean;
|
|
1996
2066
|
};
|
|
1997
2067
|
/**
|
|
1998
|
-
* One role
|
|
2068
|
+
* One role a member can be invited into on an Organization — a role that
|
|
2069
|
+
* carries member-management authority. A Budget is granted, never offered as a
|
|
2070
|
+
* job title (ADR-0024 R5), so it never appears here.
|
|
1999
2071
|
* `roleKey` is the on-chain bytes32 role key derived from the label. `definition`
|
|
2000
2072
|
* is the full Role DSL entry.
|
|
2001
2073
|
*/
|
|
@@ -2005,21 +2077,22 @@ type RoleView = {
|
|
|
2005
2077
|
readonly roleKey: RoleKey;
|
|
2006
2078
|
readonly definition: RoleDefinition;
|
|
2007
2079
|
};
|
|
2008
|
-
/**
|
|
2009
|
-
|
|
2080
|
+
/**
|
|
2081
|
+
* The role template a new Organization is created from. Creation supports
|
|
2082
|
+
* exactly one shape — a single founding owner (ADR-0024 R8). Any other value
|
|
2083
|
+
* is REFUSED with `WRONG_STATE`.
|
|
2084
|
+
*/
|
|
2085
|
+
type OrgTemplate = "Solo";
|
|
2010
2086
|
/**
|
|
2011
2087
|
* Input to `capxul.createOrg`. `name` is the display name.
|
|
2012
2088
|
* `handle` is the globally unique normalized handle (`^[a-z0-9-]{3,32}$`).
|
|
2013
2089
|
* `template` seeds the initial role set. `country` is stored without validation.
|
|
2014
|
-
* For `template: "Custom"`, `roles` carries the authored
|
|
2015
|
-
* `RoleDefinition[]`.
|
|
2016
2090
|
*/
|
|
2017
2091
|
type CreateOrgInput = {
|
|
2018
2092
|
readonly name: string;
|
|
2019
2093
|
readonly handle: string;
|
|
2020
2094
|
readonly template: OrgTemplate;
|
|
2021
2095
|
readonly country?: string;
|
|
2022
|
-
readonly roles?: readonly RoleDefinition[];
|
|
2023
2096
|
};
|
|
2024
2097
|
/**
|
|
2025
2098
|
* Input to `org(orgId).invite`. Email is the universal entry point.
|
|
@@ -2040,6 +2113,12 @@ type DetectPendingOrgInvitationsResult = {
|
|
|
2040
2113
|
};
|
|
2041
2114
|
/** Organization methods for one `orgId`. */
|
|
2042
2115
|
interface OrgScopedMethods extends ActorRelationshipMethods {
|
|
2116
|
+
/**
|
|
2117
|
+
* The caller's own standing in this Organization — Role, the two enforced
|
|
2118
|
+
* capabilities, and the Budgets they can spend from. A caller who is not an
|
|
2119
|
+
* active Member is refused, not reported as a Member without capabilities.
|
|
2120
|
+
*/
|
|
2121
|
+
readonly me: OrgMeMethod;
|
|
2043
2122
|
/** Observe the durable, leak-safe lifecycle for this Organization only. */
|
|
2044
2123
|
getLifecycle(options?: {
|
|
2045
2124
|
readonly signal?: AbortSignal;
|
|
@@ -2288,6 +2367,16 @@ interface CapxulClient {
|
|
|
2288
2367
|
readonly createOrg: OrgMethods["createOrg"];
|
|
2289
2368
|
readonly orgs: OrgMethods["orgs"];
|
|
2290
2369
|
readonly org: OrgMethods["org"];
|
|
2370
|
+
/**
|
|
2371
|
+
* Observable signer readiness (ACCESS #1520 · C12). `status()` reads the
|
|
2372
|
+
* current `SignerStatus`. `subscribe` fires on every change and returns its
|
|
2373
|
+
* own unsubscribe. Only the Openfort browser signer runs a readiness cycle.
|
|
2374
|
+
* Every other signer reports `"unknown"`, so a gate that reads this fails
|
|
2375
|
+
* closed. This is an observation surface, not a domain method: it performs no
|
|
2376
|
+
* work and cannot fail, so it returns a value rather than a `CapxulResult`.
|
|
2377
|
+
* It is not a public React surface — the action part that needs it reads this.
|
|
2378
|
+
*/
|
|
2379
|
+
readonly signer: SignerStatusStore;
|
|
2291
2380
|
/**
|
|
2292
2381
|
* Internal identity integration runtime. It is consumed by
|
|
2293
2382
|
* `@capxul/sdk-react`, not exported as the actor substrate itself.
|
|
@@ -2441,4 +2530,4 @@ interface ObservationAdapter {
|
|
|
2441
2530
|
/** Stable PostHog event used for typed failures that are expected product outcomes. */
|
|
2442
2531
|
declare const CAPXUL_SDK_EXPECTED_OUTCOME_EVENT = "capxul_sdk_expected_outcome";
|
|
2443
2532
|
//#endregion
|
|
2444
|
-
export {
|
|
2533
|
+
export { AccountMethods as $, RecipientResolution as $t, OrganizationAccount as A, isClaimed as An, FinancialOpsMethods as At, PermissionAssignInput as B, Payment as Bt, InviteMemberInput as C, Destination$1 as Cn, DestinationAddInput as Ct, OrgScopedMethods as D, Readiness as Dn, DestinationRail as Dt, OrgMethods as E, OrgLane as En, DestinationPayload as Et, RoleView as F, OfframpQuote as Ft, PermissionReplaceInput as G, PaymentDocumentVerification as Gt, PermissionCreateInput as H, PaymentDocumentKind as Ht, OrganizationPaymentBatchInput as I, OfframpQuoteInput as It, Budget as J, PaymentStatus as Jt, PermissionRevokeInput as K, PaymentDocumentsMethods as Kt, OrganizationPaymentInput as L, OfframpStatus as Lt, ResendInviteTokenInput as M, IdentityTransition as Mn, MeMethods as Mt, RoleDefinition as N, InvocationControls as Nn, MeProfile as Nt, OrgTemplate as O, StateLabel as On, DestinationRemoveInput as Ot, RoleSpendCap as P, OfframpMethods as Pt, AccountsMethods as Q, PaymentsPayInput as Qt, OrganizationPaymentItemInput as R, Payee as Rt, DetectPendingOrgInvitationsResult as S, CAPXUL_PAYMENTS_V2_ADDRESS as Sn, Destination as St, MemberView as T, IdentityState as Tn, DestinationListInput as Tt, PermissionMethods as U, PaymentDocumentRef as Ut, PermissionChangeInput as V, PaymentDirection as Vt, PermissionOptions as W, PaymentDocumentRender as Wt, OrgMeMethod as X, PaymentType as Xt, OrgMe as Y, PaymentTiming as Yt, OrgMeOptions as Z, PaymentsMethods as Zt, SystemHealth as _, SubmittedPermissionExecution as _n, ActivityMethods as _t, SdkFailureObservation as a, fingerprintPaymentIntent as an, ActorRequestsMethods as at, CurrentUserMethods as b, TelemetryIdentifyInput as bn, ActorReference as bt, PostHogObservabilityOptions as c, isSettingUpLifecycle as cn, AddressBookLabelInput as ct, CreateCapxulClientInput as d, AuthMethods as dn, InboxItem as dt, RecipientResolutionKind as en, ActorProfile as et, IdentityProfileDetails as f, OrgLifecycle as fn, InboxMethods as ft, SystemMethods as g, Permission as gn, ActivityListParams as gt, HoldingsMethods as h, MovementAnnotation as hn, ActivityItem as ht, ObservationDelivery as i, TargetsMethods as in, ActorRequestIssueInput as it, OrganizationAuditLogItem as j, isRestoring as jn, HandlesMethods as jt, OrgView as k, destination as kn, DestinationsMethods as kt, postHogObservability as l, IdentityMethods as ln, AddressBookMethods as lt, IdentityRuntimeSendResult as m, CurrentHoldings as mn, ActivityDetail as mt, ObservationAdapter as n, ResolvedTarget as nn, ActorRelationshipMethods as nt, HostObservability as o, AccountLifecycle as on, AddressBookAddInput as ot, IdentityRuntime as p, OrgSetupStep as pn, ActivityAnnotationInput as pt, PermissionReadResult as q, PaymentMoney as qt, ObservationContext as r, TargetReference as rn, ActorRequest as rt, PostHogObservabilityClient as s, AccountSetupStep as sn, AddressBookEntry as st, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT as t, Ref$1 as tn, ActorProfileMethods as tt, CapxulClient as u, SmartAccountMethods as un, InboxApproveInput as ut, MediaMethods as v, TelemetryEvent as vn, ActivityPage as vt, MemberStatus as w, IdentityEvent as wn, DestinationKind as wt, CreateOrgInput as x, TelemetryPort as xn, DepositInstructions as xt, CurrentUserContext as y, TelemetryGroupInput as yn, ActivityReference as yt, OrganizationPaymentsMethods as z, PayeesMethods as zt };
|
|
@@ -195,6 +195,7 @@ type PartyId = Brand<string, "PartyId">;
|
|
|
195
195
|
type MovementId = Brand<string, "MovementId">;
|
|
196
196
|
type PermissionId = Brand<string, "PermissionId">;
|
|
197
197
|
type PermissionAssignmentId = Brand<string, "PermissionAssignmentId">;
|
|
198
|
+
type BudgetId = Brand<string, "BudgetId">;
|
|
198
199
|
type PaymentCommandId = Brand<string, "PaymentCommandId">;
|
|
199
200
|
type OrgId = Brand<string, "OrgId">;
|
|
200
201
|
type AppId = Brand<string, "AppId">;
|
|
@@ -368,6 +369,27 @@ interface CapxulSigner extends CapxulDigestSigner {
|
|
|
368
369
|
readonly source: AccountProviderSource;
|
|
369
370
|
/** Owner EOA address — the Safe's single owner. */
|
|
370
371
|
getAddress(): Promise<Address$1>;
|
|
372
|
+
/**
|
|
373
|
+
* Readiness this signer reports, when it runs a readiness cycle at all. Only
|
|
374
|
+
* the Openfort browser signer does. `assembleCapxulClient` reads it onto
|
|
375
|
+
* `client.signer`, and substitutes `UNOBSERVABLE_SIGNER_STATUS` when absent.
|
|
376
|
+
*/
|
|
377
|
+
readonly statusStore?: SignerStatusStore;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Observable signer readiness (ACCESS #1520 · C12). `unknown` means the
|
|
381
|
+
* wallet-ready cycle did not start. `recovering` means it is running; the
|
|
382
|
+
* stale-cache heal runs inside that phase. `ready` means the signer can sign.
|
|
383
|
+
* `unavailable` means the cycle failed. A failure is distinguishable from a
|
|
384
|
+
* cycle that never started. That is why there are four states.
|
|
385
|
+
*/
|
|
386
|
+
type SignerStatus = "unknown" | "recovering" | "ready" | "unavailable";
|
|
387
|
+
/** Subscribable readiness surface. Assembled onto `client.signer`. */
|
|
388
|
+
interface SignerStatusStore {
|
|
389
|
+
/** The current status. */
|
|
390
|
+
status(): SignerStatus;
|
|
391
|
+
/** Fires on every change. Returns its own unsubscribe. */
|
|
392
|
+
subscribe(listener: (status: SignerStatus) => void): () => void;
|
|
371
393
|
}
|
|
372
394
|
/** Minimal EIP-1193 surface an injected browser wallet exposes. */
|
|
373
395
|
interface Eip1193RequestProvider {
|
|
@@ -385,4 +407,4 @@ interface Eip1193RequestProvider {
|
|
|
385
407
|
*/
|
|
386
408
|
declare function injectedWalletSigner(provider: Eip1193RequestProvider): CapxulSigner;
|
|
387
409
|
//#endregion
|
|
388
|
-
export {
|
|
410
|
+
export { toAddress as $, BlockNumber as A, MovementId as B, Address$1 as C, AppId as D, AnonymousDistinctId as E, DocumentHash as F, PermissionId as G, PartyId as H, DurationMs as I, RoleKey as J, Profile$1 as K, Email as L, ChainId as M, CountryCode as N, AuthSession as O, CurrencyCode as P, WeiAmount as Q, EpochMs as R, AccountId as S, AllowedOrigin as T, PaymentCommandId as U, OrgId as V, PermissionAssignmentId as W, SmartAccount$1 as X, SessionToken as Y, TxHash as Z, AuthCacheError as _, SignerStatusStore as a, Errors as at, CachedJwt as b, AccountProviderSource as c, isCapxulError as ct, eip1193AccountProvider as d, toCountryCode as et, localPrivateKeyAccountProvider as f, SmartAccount as g, Session as h, SignerStatus as i, CapxulErrorDetails as it, BudgetId as j, AuthUserId as k, AccountRequirement as l, Profile as m, CapxulSigner as n, CapxulError as nt, injectedWalletSigner as o, Failure as ot, CapxulResult as p, PublishableKey as q, Eip1193RequestProvider as r, CapxulErrorCode as rt, AccountProvider as s, FailureMode as st, CapxulDigestSigner as t, CAPXUL_ERROR_CODES as tt, Eip1193Provider as u, AuthCachePort as v, AllowanceKey as w, Account$1 as x, AuthCachePortTag as y, Money as z };
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mn as IdentityTransition, bn as TelemetryIdentifyInput, n as ObservationAdapter, u as CapxulClient, vn as TelemetryEvent, yn as TelemetryGroupInput } from "../observation-Ci8gIQjm.mjs";
|
|
2
2
|
import { Effect, Layer } from "effect";
|
|
3
3
|
|
|
4
4
|
//#region src/testing/telemetry/RecordingTelemetryAdapter.d.ts
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as authClientPortFromPromiseAdapter,
|
|
2
|
-
import {
|
|
1
|
+
import { E as authClientPortFromPromiseAdapter, M as fromWei, T as bootstrapErrorFromCapxul, Y as deriveCapxulSafeAddress, _ as wireChainId, f as redactTelemetryEvent, g as accountReadErrorFromCapxul, j as toWei, m as smartAccountErrorFromCapxul, t as assembleCapxulClient, x as convexCallErrorFromCapxul, y as identityErrorFromCapxul } from "../create-capxul-client-DTQDSOvO.mjs";
|
|
2
|
+
import { C as toDurationMs, D as toJwtToken, E as toEpochSeconds, I as CapxulError, N as toSessionToken, O as toKycTier, R as Errors, T as toEpochMs, _ as toAppId, b as toChainId, g as toAllowedOrigin, h as toAddress, j as toPublishableKey, m as toAccountId, t as InMemoryAuthCacheAdapter, v as toAuthUserId, w as toEmail, x as toCountryCode } from "../InMemoryAuthCacheAdapter-qMpBOGb3.mjs";
|
|
3
3
|
import { keccak256 } from "viem";
|
|
4
4
|
import { Effect, Result, Semaphore } from "effect";
|
|
5
5
|
import { getFunctionName } from "convex/server";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capxul/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/Xelmar-tech/infrastructure.git",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"vitest": "npm:@voidzero-dev/vite-plus-test@0.1.23",
|
|
49
49
|
"@capxul/config": "0.2.0",
|
|
50
50
|
"@capxul/errors": "0.0.1",
|
|
51
|
-
"@capxul/types": "0.
|
|
52
|
-
"@capxul/wire": "0.
|
|
53
|
-
"@capxul/observability": "2.
|
|
51
|
+
"@capxul/types": "0.2.0",
|
|
52
|
+
"@capxul/wire": "0.4.0",
|
|
53
|
+
"@capxul/observability": "2.3.1",
|
|
54
54
|
"@capxul/typescript-config": "0.0.0"
|
|
55
55
|
},
|
|
56
56
|
"_permissionlessPinReason": "permissionless.toSafeSmartAccount is pinned to 0.3.4 for live Safe deployment E2E. Counterfactual address fixtures captured 2026-05-17 in packages/backend/convex/_shared/__tests__/counterfactual.test.ts and packages/config/tests/safe.test.ts must be re-verified before upgrading.",
|