@capxul/sdk 2.6.1 → 2.8.0
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-VZBv1fOH.mjs → InMemoryAuthCacheAdapter-FptQ2p7C.mjs} +63 -2
- package/dist/{create-capxul-client-C_MxJ8mV.mjs → create-capxul-client-YSN2yN8m.mjs} +70 -29
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +13 -12
- package/dist/node/index.d.mts +1 -2
- package/dist/node/index.mjs +1 -1
- package/dist/{observation-Desw1A8U.d.mts → observation-YhuU8yQX.d.mts} +43 -27
- package/dist/{signer-tokSaxrJ.d.mts → signer-xGhV5Q7i.d.mts} +50 -6
- package/dist/testing/index.d.mts +1 -2
- package/dist/testing/index.mjs +18 -17
- package/package.json +10 -9
package/dist/{InMemoryAuthCacheAdapter-VZBv1fOH.mjs → InMemoryAuthCacheAdapter-FptQ2p7C.mjs}
RENAMED
|
@@ -121,6 +121,58 @@ function chainCauseProperties(chain) {
|
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
|
+
* Safe (safe-contracts v1.4.1) revert codes. The contracts revert with these
|
|
125
|
+
* short strings to save gas; the sentence lives in the Safe docs
|
|
126
|
+
* (`docs/error_codes.md`). Every Safe on the Capxul rail is this version.
|
|
127
|
+
*/
|
|
128
|
+
const SAFE_REVERT_REASONS = {
|
|
129
|
+
GS000: "could not finish initialization",
|
|
130
|
+
GS001: "threshold needs to be defined",
|
|
131
|
+
GS010: "not enough gas to execute Safe transaction",
|
|
132
|
+
GS011: "could not pay gas costs with ether",
|
|
133
|
+
GS012: "could not pay gas costs with token",
|
|
134
|
+
GS013: "Safe transaction failed when gasPrice and safeTxGas were 0",
|
|
135
|
+
GS020: "signatures data too short",
|
|
136
|
+
GS021: "invalid contract signature location: inside static part",
|
|
137
|
+
GS022: "invalid contract signature location: length not present",
|
|
138
|
+
GS023: "invalid contract signature location: data not complete",
|
|
139
|
+
GS024: "invalid contract signature provided",
|
|
140
|
+
GS025: "hash has not been approved",
|
|
141
|
+
GS026: "invalid owner provided",
|
|
142
|
+
GS030: "only owners can approve a hash",
|
|
143
|
+
GS031: "method can only be called from this contract",
|
|
144
|
+
GS100: "modules have already been initialized",
|
|
145
|
+
GS101: "invalid module address provided",
|
|
146
|
+
GS102: "module has already been added",
|
|
147
|
+
GS103: "invalid prevModule, module pair provided",
|
|
148
|
+
GS104: "method can only be called from an enabled module",
|
|
149
|
+
GS105: "invalid starting point for fetching paginated modules",
|
|
150
|
+
GS106: "invalid page size for fetching paginated modules",
|
|
151
|
+
GS200: "owners have already been set up",
|
|
152
|
+
GS201: "threshold cannot exceed owner count",
|
|
153
|
+
GS202: "threshold needs to be greater than 0",
|
|
154
|
+
GS203: "invalid owner address provided",
|
|
155
|
+
GS204: "address is already an owner",
|
|
156
|
+
GS205: "invalid prevOwner, owner pair provided",
|
|
157
|
+
GS300: "guard does not implement IERC165",
|
|
158
|
+
GS400: "fallback handler cannot be set to self"
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* `Error(GS205: invalid prevOwner, owner pair provided)`, or the bare selector
|
|
162
|
+
* when the name is unknown. Safe codes travel only as the `message` of an
|
|
163
|
+
* `Error(string)` revert, so only that argument is expanded from
|
|
164
|
+
* {@link SAFE_REVERT_REASONS}; every other argument reads `name=value`, even
|
|
165
|
+
* when a custom error's field happens to hold a `GS` string.
|
|
166
|
+
*/
|
|
167
|
+
function revertSummaryText(revert) {
|
|
168
|
+
if (revert.name === null) return revert.selector === "0x" ? "empty revert" : `unknown selector ${revert.selector}`;
|
|
169
|
+
const args = Object.entries(revert.args).map(([name, value]) => {
|
|
170
|
+
const reason = revert.name === "Error" && name === "message" ? SAFE_REVERT_REASONS[value] : void 0;
|
|
171
|
+
return reason === void 0 ? `${name}=${value}` : `${value}: ${reason}`;
|
|
172
|
+
}).join(", ");
|
|
173
|
+
return `${revert.name}(${args})`;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
124
176
|
* The error-tracking fingerprint for a failure: the code, the one-word cause,
|
|
125
177
|
* and the operation. PostHog groups `$exception` rows by this value, so one
|
|
126
178
|
* issue is one cause at one operation instead of every provider failure in
|
|
@@ -138,6 +190,7 @@ const CAPXUL_ERROR_CODES = [
|
|
|
138
190
|
"SMART_ACCOUNT_MISSING",
|
|
139
191
|
"PLAYER_NOT_FOUND",
|
|
140
192
|
"ACCOUNT_NOT_FOUND",
|
|
193
|
+
"ACCOUNT_CLAIMED_BY_OTHER_SIGNER",
|
|
141
194
|
"PROVIDER_ERROR",
|
|
142
195
|
"CAPABILITY_UNAVAILABLE",
|
|
143
196
|
"INVALID_INPUT",
|
|
@@ -168,7 +221,7 @@ const CAPXUL_ERROR_CODES = [
|
|
|
168
221
|
* code rename forces this set to move with it) stops the two sides of the wire
|
|
169
222
|
* from drifting and silently splitting one outcome across two streams.
|
|
170
223
|
*/
|
|
171
|
-
const EXPECTED_OPERATION_OUTCOMES = new Set([
|
|
224
|
+
const EXPECTED_OPERATION_OUTCOMES = /* @__PURE__ */ new Set([
|
|
172
225
|
"INVALID_INPUT",
|
|
173
226
|
"NOT_AUTHENTICATED",
|
|
174
227
|
"SMART_ACCOUNT_MISSING",
|
|
@@ -237,6 +290,14 @@ const Errors = {
|
|
|
237
290
|
smartAccountMissing: (authUserId) => new CapxulError("SMART_ACCOUNT_MISSING", "Smart account not provisioned", { details: { authUserId } }),
|
|
238
291
|
playerNotFound: (playerId) => new CapxulError("PLAYER_NOT_FOUND", playerId ? `Openfort player ${playerId} not found` : "Openfort player not found", playerId === void 0 ? void 0 : { details: { playerId } }),
|
|
239
292
|
accountNotFound: (accountId) => new CapxulError("ACCOUNT_NOT_FOUND", accountId ? `Openfort account ${accountId} not found` : "Openfort account not found", accountId === void 0 ? void 0 : { details: { accountId } }),
|
|
293
|
+
/**
|
|
294
|
+
* The Safe at this email's address is deployed and its owner is neither the
|
|
295
|
+
* Capxul bootstrap owner nor the caller's signer. The claim
|
|
296
|
+
* `swapOwner(bootstrap → signer)` cannot succeed: only the on-chain owner
|
|
297
|
+
* can hand the account over. Read from `getOwners()` before any
|
|
298
|
+
* UserOperation is built (2026-09-02), so no simulation and no retry.
|
|
299
|
+
*/
|
|
300
|
+
accountClaimedByOtherSigner: (details) => new CapxulError("ACCOUNT_CLAIMED_BY_OTHER_SIGNER", "This account is already owned by a different signer.", { details }),
|
|
240
301
|
providerError: (provider, operation, cause, opts) => {
|
|
241
302
|
const details = {
|
|
242
303
|
...opts?.details,
|
|
@@ -648,4 +709,4 @@ Layer.effect(AuthCachePortTag, Effect.sync(() => new InMemoryAuthCacheAdapter())
|
|
|
648
709
|
cause
|
|
649
710
|
}))));
|
|
650
711
|
//#endregion
|
|
651
|
-
export { toPartyId as A, Errors as B, toDurationMs as C, toJwtToken as D, toEpochSeconds as E, toSessionToken as F, failureFingerprint as G, CHAIN_UPSTREAMS as H, decodeConvexError as I, isFailureMode as K, CAPXUL_ERROR_CODES as L, toPayrollRunId as M, toPublishableKey as N, toKycTier as O, toRoleKey as P, CapxulError as R, toCurrencyCode as S, toEpochMs as T, FAILURE_MODES as U, isCapxulError as V, chainCauseProperties as W, 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, toPayrollGroupId 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, EXPECTED_OPERATION_OUTCOMES as z };
|
|
712
|
+
export { toPartyId as A, Errors as B, toDurationMs as C, toJwtToken as D, toEpochSeconds as E, toSessionToken as F, failureFingerprint as G, CHAIN_UPSTREAMS as H, decodeConvexError as I, isFailureMode as K, CAPXUL_ERROR_CODES as L, toPayrollRunId as M, toPublishableKey as N, toKycTier as O, toRoleKey as P, CapxulError as R, toCurrencyCode as S, toEpochMs as T, FAILURE_MODES as U, isCapxulError as V, chainCauseProperties as W, 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, toPayrollGroupId as j, toOrgId as k, EVM_ADDRESS_RE as l, toAccountId as m, BrowserAuthCacheAdapter as n, AuthCachePortTag as o, currencySymbolFor as p, revertSummaryText as q, 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, EXPECTED_OPERATION_OUTCOMES as z };
|
|
@@ -1,15 +1,31 @@
|
|
|
1
|
-
import { A as toPartyId, B as Errors, G as failureFingerprint, H as CHAIN_UPSTREAMS, K as isFailureMode, M as toPayrollRunId, P as toRoleKey, R as CapxulError, S as toCurrencyCode, U as FAILURE_MODES$1, V as isCapxulError, W as chainCauseProperties, b as toChainId, c as BYTES32_RE, d as WEI_RE, f as ZERO_BYTES32, h as toAddress, j as toPayrollGroupId, 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 EXPECTED_OPERATION_OUTCOMES } from "./InMemoryAuthCacheAdapter-
|
|
1
|
+
import { A as toPartyId, B as Errors, G as failureFingerprint, H as CHAIN_UPSTREAMS, K as isFailureMode, M as toPayrollRunId, P as toRoleKey, R as CapxulError, S as toCurrencyCode, U as FAILURE_MODES$1, V as isCapxulError, W as chainCauseProperties, b as toChainId, c as BYTES32_RE, d as WEI_RE, f as ZERO_BYTES32, h as toAddress, j as toPayrollGroupId, k as toOrgId, l as EVM_ADDRESS_RE$1, m as toAccountId, n as BrowserAuthCacheAdapter, q as revertSummaryText, 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 EXPECTED_OPERATION_OUTCOMES } from "./InMemoryAuthCacheAdapter-FptQ2p7C.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, Duration, Effect, Exit, Fiber, Layer, Queue, Ref, Result, Schema, SchemaGetter, Scope } from "effect";
|
|
4
4
|
import { makeFunctionReference } from "convex/server";
|
|
5
5
|
//#region src/domain/identity/model.ts
|
|
6
6
|
const WRONG = { refused: "WRONG_STATE" };
|
|
7
7
|
/** org-lifecycle.ts:173-184, lifted verbatim. */
|
|
8
|
+
/**
|
|
9
|
+
* Causes that do not change on a retry: the same request reverts, is refused,
|
|
10
|
+
* or fails the same pre-flight again. A retry re-enters the same lane and
|
|
11
|
+
* fails the same way (the GS205 loop of 2026-09-02).
|
|
12
|
+
*/
|
|
13
|
+
const DEFINITIVE_PROVIDER_MODES = /* @__PURE__ */ new Set([
|
|
14
|
+
"auth-origin-mismatch",
|
|
15
|
+
"app-env-allowlist",
|
|
16
|
+
"no-secure-context",
|
|
17
|
+
"revert",
|
|
18
|
+
"insufficient-balance",
|
|
19
|
+
"insufficient-allowance",
|
|
20
|
+
"rejected",
|
|
21
|
+
"unauthorized"
|
|
22
|
+
]);
|
|
8
23
|
const isRetryable = (failure) => {
|
|
9
24
|
if (failure.code === "CANCELLED" || failure.code === "SIGNER_REJECTED") return true;
|
|
10
25
|
if (failure.code === "PROVIDER_ERROR") {
|
|
11
|
-
const
|
|
12
|
-
|
|
26
|
+
const chainRetryable = failure.error?.chain?.retryable;
|
|
27
|
+
if (chainRetryable !== void 0) return chainRetryable;
|
|
28
|
+
return !DEFINITIVE_PROVIDER_MODES.has(failure.mode);
|
|
13
29
|
}
|
|
14
30
|
return failure.code === "NETWORK_ERROR" || failure.code === "UNKNOWN";
|
|
15
31
|
};
|
|
@@ -512,22 +528,24 @@ function buildCapxulSafeInitializer(owner) {
|
|
|
512
528
|
functionName: "enableModules",
|
|
513
529
|
args: [[SAFE_4337_MODULE]]
|
|
514
530
|
});
|
|
531
|
+
const enableModulesByteLen = BigInt((enableModulesCall.length - 2) / 2);
|
|
532
|
+
const multiSendPayload = encodePacked([
|
|
533
|
+
"uint8",
|
|
534
|
+
"address",
|
|
535
|
+
"uint256",
|
|
536
|
+
"uint256",
|
|
537
|
+
"bytes"
|
|
538
|
+
], [
|
|
539
|
+
1,
|
|
540
|
+
SAFE_MODULE_SETUP,
|
|
541
|
+
0n,
|
|
542
|
+
enableModulesByteLen,
|
|
543
|
+
enableModulesCall
|
|
544
|
+
]);
|
|
515
545
|
const setupData = encodeFunctionData({
|
|
516
546
|
abi: multiSendAbi,
|
|
517
547
|
functionName: "multiSend",
|
|
518
|
-
args: [
|
|
519
|
-
"uint8",
|
|
520
|
-
"address",
|
|
521
|
-
"uint256",
|
|
522
|
-
"uint256",
|
|
523
|
-
"bytes"
|
|
524
|
-
], [
|
|
525
|
-
1,
|
|
526
|
-
SAFE_MODULE_SETUP,
|
|
527
|
-
0n,
|
|
528
|
-
BigInt((enableModulesCall.length - 2) / 2),
|
|
529
|
-
enableModulesCall
|
|
530
|
-
])]
|
|
548
|
+
args: [multiSendPayload]
|
|
531
549
|
});
|
|
532
550
|
return encodeFunctionData({
|
|
533
551
|
abi: safeSetupAbi,
|
|
@@ -597,11 +615,13 @@ function deriveCapxulSafeAddressForOwner(input) {
|
|
|
597
615
|
email: input.email,
|
|
598
616
|
namespace: input.namespace
|
|
599
617
|
});
|
|
618
|
+
const salt = keccak256(encodePacked(["bytes32", "uint256"], [keccak256(initializer), saltNonce]));
|
|
619
|
+
const deploymentCode = concat([SAFE_PROXY_CREATION_CODE, encodeAbiParameters([{ type: "uint256" }], [BigInt(SAFE_L2_SINGLETON)])]);
|
|
600
620
|
return getContractAddress({
|
|
601
621
|
opcode: "CREATE2",
|
|
602
622
|
from: SAFE_PROXY_FACTORY,
|
|
603
|
-
salt
|
|
604
|
-
bytecodeHash: keccak256(
|
|
623
|
+
salt,
|
|
624
|
+
bytecodeHash: keccak256(deploymentCode)
|
|
605
625
|
}).toLowerCase();
|
|
606
626
|
}
|
|
607
627
|
/**
|
|
@@ -3387,10 +3407,11 @@ const boot = (spec, options = {}) => Effect.gen(function* () {
|
|
|
3387
3407
|
const outcome = spec.transition(state, event);
|
|
3388
3408
|
if ("refused" in outcome) return Effect.succeed(state);
|
|
3389
3409
|
return Ref.set(cell, outcome.next).pipe(Effect.tap(() => {
|
|
3390
|
-
|
|
3410
|
+
const record = applied(state, outcome.next, event, cursor.slot, cursor.epoch, {
|
|
3391
3411
|
invocation: cursor.invocation,
|
|
3392
3412
|
startedAt: cursor.startedAt
|
|
3393
|
-
})
|
|
3413
|
+
});
|
|
3414
|
+
return emit(record).pipe(Effect.andThen(Effect.sync(() => {
|
|
3394
3415
|
notify(outcome.next);
|
|
3395
3416
|
})));
|
|
3396
3417
|
}), Effect.as(outcome.next));
|
|
@@ -4490,7 +4511,7 @@ const moneyExecutionContract = {
|
|
|
4490
4511
|
};
|
|
4491
4512
|
//#endregion
|
|
4492
4513
|
//#region package.json
|
|
4493
|
-
var version = "2.
|
|
4514
|
+
var version = "2.8.0";
|
|
4494
4515
|
//#endregion
|
|
4495
4516
|
//#region src/telemetry/stack-frame-parser.ts
|
|
4496
4517
|
/**
|
|
@@ -4883,7 +4904,7 @@ function postHogExceptionProperties(failure, properties) {
|
|
|
4883
4904
|
$exception_level: "error",
|
|
4884
4905
|
$exception_fingerprint: failureFingerprint(failure.errorKind, isFailureMode(mode) ? mode : void 0, failure.operation),
|
|
4885
4906
|
$issue_name: issueName(failure, isFailureMode(mode) ? mode : void 0),
|
|
4886
|
-
$issue_description: failure
|
|
4907
|
+
$issue_description: issueDescription(failure, message),
|
|
4887
4908
|
$exception_list: [{
|
|
4888
4909
|
type: failure.errorKind,
|
|
4889
4910
|
value: message,
|
|
@@ -4907,6 +4928,22 @@ function postHogExceptionProperties(failure, properties) {
|
|
|
4907
4928
|
}]
|
|
4908
4929
|
};
|
|
4909
4930
|
}
|
|
4931
|
+
/**
|
|
4932
|
+
* The decoded revert leads the description: the provider's own message masks
|
|
4933
|
+
* the raw revert data (`reason: [REDACTED]`), and the name plus arguments
|
|
4934
|
+
* (`Error(message=GS205)`) is what tells one revert from another.
|
|
4935
|
+
*/
|
|
4936
|
+
function issueDescription(failure, message) {
|
|
4937
|
+
const detail = failure.detail;
|
|
4938
|
+
const providerMessage = detail?.chain_provider_message;
|
|
4939
|
+
if (detail?.chain_revert_name === void 0) return providerMessage ?? message;
|
|
4940
|
+
const revert = revertSummaryText({
|
|
4941
|
+
name: detail.chain_revert_name === "unknown" ? null : detail.chain_revert_name,
|
|
4942
|
+
selector: detail.chain_revert_selector ?? "0x",
|
|
4943
|
+
args: detail.chain_revert_args ?? {}
|
|
4944
|
+
});
|
|
4945
|
+
return providerMessage === void 0 ? revert : `${revert}; ${providerMessage}`;
|
|
4946
|
+
}
|
|
4910
4947
|
function issueName(failure, mode) {
|
|
4911
4948
|
const upstream = failure.detail?.chain_upstream;
|
|
4912
4949
|
const method = failure.detail?.chain_method;
|
|
@@ -5045,12 +5082,13 @@ function sanitizeChainDetail(source, detail) {
|
|
|
5045
5082
|
for (const key of [
|
|
5046
5083
|
"chain_upstream",
|
|
5047
5084
|
"chain_method",
|
|
5048
|
-
"chain_revert_name"
|
|
5049
|
-
"chain_revert_selector"
|
|
5085
|
+
"chain_revert_name"
|
|
5050
5086
|
]) {
|
|
5051
5087
|
const value = source[key];
|
|
5052
5088
|
if (typeof value === "string" && ENUMERATED_DETAIL_RE.test(value)) detail[key] = value;
|
|
5053
5089
|
}
|
|
5090
|
+
const selector = source.chain_revert_selector;
|
|
5091
|
+
if (typeof selector === "string" && REVERT_SELECTOR_RE.test(selector)) detail.chain_revert_selector = selector;
|
|
5054
5092
|
if (typeof source.chain_retryable === "boolean") detail.chain_retryable = source.chain_retryable;
|
|
5055
5093
|
const chainHttpStatus = source.chain_http_status;
|
|
5056
5094
|
if (typeof chainHttpStatus === "number" && Number.isInteger(chainHttpStatus) && chainHttpStatus >= 100 && chainHttpStatus <= 599) detail.chain_http_status = chainHttpStatus;
|
|
@@ -5076,6 +5114,8 @@ function sanitizeFailureDetail(input) {
|
|
|
5076
5114
|
}
|
|
5077
5115
|
/** Enumerated codes only (`convex`, `no-secure-context`, `bootstrap-encode`); free text fails. */
|
|
5078
5116
|
const ENUMERATED_DETAIL_RE = /^[A-Za-z][A-Za-z0-9_.-]{0,63}$/u;
|
|
5117
|
+
/** A four-byte revert selector, or the bare `0x` of an empty revert. */
|
|
5118
|
+
const REVERT_SELECTOR_RE = /^0x(?:[0-9a-fA-F]{8})?$/u;
|
|
5079
5119
|
function normalizeSdkVersion(value) {
|
|
5080
5120
|
return typeof value === "string" && /^[A-Za-z0-9][A-Za-z0-9.+_-]{0,127}$/u.test(value) ? value : "unknown";
|
|
5081
5121
|
}
|
|
@@ -5388,7 +5428,7 @@ const paymentAttemptReleases = /* @__PURE__ */ new Set();
|
|
|
5388
5428
|
let paymentAttemptPagehideInstalled = false;
|
|
5389
5429
|
function randomPaymentRequestKey() {
|
|
5390
5430
|
try {
|
|
5391
|
-
return `pay_${Array.from(crypto.getRandomValues(new Uint8Array(16)), (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
|
|
5431
|
+
return `pay_${Array.from(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16)), (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
|
|
5392
5432
|
} catch (cause) {
|
|
5393
5433
|
throw Errors.providerError("sdk", "paymentRequestKey", cause);
|
|
5394
5434
|
}
|
|
@@ -5594,7 +5634,8 @@ function makeFinancialOpsMethods(deps) {
|
|
|
5594
5634
|
};
|
|
5595
5635
|
let requestKey;
|
|
5596
5636
|
try {
|
|
5597
|
-
|
|
5637
|
+
const actorId = deps.actor.authSession()?.authUserId ?? "signed-out";
|
|
5638
|
+
requestKey = await paymentRequestKeyLifecycle(`personal-pay:${requestKeyScope}:${actorId}`, input, input.requestKey);
|
|
5598
5639
|
} catch (cause) {
|
|
5599
5640
|
return {
|
|
5600
5641
|
ok: false,
|
|
@@ -7048,7 +7089,7 @@ const SHA256_K = [
|
|
|
7048
7089
|
function sha256Hex(input) {
|
|
7049
7090
|
const padded = padSha256Message(new TextEncoder().encode(input));
|
|
7050
7091
|
const view = new DataView(padded.buffer, padded.byteOffset, padded.byteLength);
|
|
7051
|
-
const words = new Uint32Array(64);
|
|
7092
|
+
const words = /* @__PURE__ */ new Uint32Array(64);
|
|
7052
7093
|
let h0 = SHA256_INITIAL_HASH[0];
|
|
7053
7094
|
let h1 = SHA256_INITIAL_HASH[1];
|
|
7054
7095
|
let h2 = SHA256_INITIAL_HASH[2];
|
|
@@ -7852,7 +7893,7 @@ function clearAuthCacheEffect(authCache) {
|
|
|
7852
7893
|
return authCache.clearSession.pipe(Effect.mapError((cause) => Errors.providerError("auth-cache", "clearSession", cause)), Effect.andThen(authCache.clearJwt.pipe(Effect.mapError((cause) => Errors.providerError("auth-cache", "clearJwt", cause)))));
|
|
7853
7894
|
}
|
|
7854
7895
|
function cryptoRandomId() {
|
|
7855
|
-
const bytes = new Uint8Array(8);
|
|
7896
|
+
const bytes = /* @__PURE__ */ new Uint8Array(8);
|
|
7856
7897
|
if (typeof globalThis.crypto !== "undefined" && typeof globalThis.crypto.getRandomValues === "function") globalThis.crypto.getRandomValues(bytes);
|
|
7857
7898
|
else for (let i = 0; i < bytes.length; i++) bytes[i] = Math.floor(Math.random() * 256);
|
|
7858
7899
|
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
@@ -9301,7 +9342,7 @@ const organizationPaymentExecutionUnavailable = () => Promise.resolve({
|
|
|
9301
9342
|
const holdingsContract = { current: makeFunctionReference(CAPXUL_FUNCTIONS["holdings/actions"].current) };
|
|
9302
9343
|
//#endregion
|
|
9303
9344
|
//#region src/domain/money/primary-holding.ts
|
|
9304
|
-
const CURRENCY_BY_TOKEN_SYMBOL = new Map([["USDX", toCurrencyCode("USD")]]);
|
|
9345
|
+
const CURRENCY_BY_TOKEN_SYMBOL = /* @__PURE__ */ new Map([["USDX", toCurrencyCode("USD")]]);
|
|
9305
9346
|
/**
|
|
9306
9347
|
* The designated display asset: the payable row holding the most money, or
|
|
9307
9348
|
* `null` when no row is payable.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { B as OrgId, C as Address, N as CountryCode, O as AuthSession, S as AccountId, U as PayrollGroupId, V as PartyId, W as PayrollRunId, Y as RoleKey, a as SignerStatusStore, at as CapxulErrorDetails, c as AccountProviderSource, ct as isCapxulError, d as eip1193AccountProvider, dt as ChainUpstream, et as toAddress, f as localPrivateKeyAccountProvider, ft as FAILURE_MODES, g as SmartAccount, h as Session, i as SignerStatus, it as CapxulErrorCode, j as BudgetId, k as AuthUserId, l as AccountRequirement, lt as CHAIN_UPSTREAMS, m as Profile, mt as RevertSummary, n as CapxulSigner, nt as CAPXUL_ERROR_CODES, o as injectedWalletSigner, ot as Errors, p as CapxulResult, pt as FailureMode, r as Eip1193RequestProvider, rt as CapxulError, s as AccountProvider, t as CapxulDigestSigner, tt as toCountryCode, u as Eip1193Provider, ut as ChainCause, x as Account, z as Money } from "./signer-
|
|
2
|
-
import { $ as OrganizationPaymentsMethods, $n as IdentityState, $t as MeMethods, A as OrgView, An as AccountSetupStep, At as ActivityFilter, B as PayrollGroupInput, Bn as SubmittedPermissionExecution, Bt as ActivitySummaryTotal, C as DetectPendingOrgInvitationsResult, Cn as RecipientResolutionKind, Ct as AddressBookMethods, D as OrgMethods, Dn as TargetsMethods, Dt as ActivityAnnotation, E as MemberView, En as TargetReference, Et as InboxMethods, F as RoleSpendCap, Fn as OrgLifecycle, Ft as ActivityPage, G as PayrollRun, Gn as RequestStatus, Gt as DestinationKind, H as PayrollGroupsMethods, Hn as PAYMENT_DIRECTIONS, Ht as DepositInstructions, I as RoleView, In as OrgSetupStep, It as ActivityRange, J as PayrollRuns, Jt as DestinationRail, K as PayrollRunItemInput, Kn as CAPXUL_PAYMENTS_V2_ADDRESS, Kt as DestinationListInput, L as AuthorizeRunInput, Ln as ActorRef, Lt as ActivityReference, M as OrganizationAuditLogItem, Mn as IdentityMethods, Mt as ActivityKind, N as ResendInviteTokenInput, Nn as SmartAccountMethods, Nt as ActivityListParams, O as OrgScopedMethods, On as fingerprintPaymentIntent, Ot as ActivityAnnotationInput, P as RoleDefinition, Pn as AuthMethods, Pt as ActivityMethods, Q as OrganizationPaymentItemInput, Qn as IdentityEvent, Qt as HandlesMethods, R as PayrollEngagementTerms, Rn as CurrentHoldings, Rt as ActivitySummary, S as CreateOrgInput, Sn as RecipientResolution, St as AddressBookLabelInput, T as MemberStatus, Tn as ResolvedTarget, Tt as InboxItem, U as PayrollMethods, Un as PAYMENT_STATUSES, Ut as Destination, V as PayrollGroupMember, Vn as InboxStatus, Vt as ActorReference, W as PayrollOptions, Wn as PaymentStatus$1, Wt as DestinationAddInput, X as OrganizationPaymentBatchInput, Xn as TelemetryPort, Xt as DestinationsMethods, Y as PayrollTermsUnit, Yt as DestinationRemoveInput, Z as OrganizationPaymentInput, Zn as Destination$1, Zt as FinancialOpsMethods, _ as SystemMethods, _n as PaymentStatus, _t as ActorRequest, a as SdkFailureObservation, an as OfframpStatus, ar as isRestoring, at as PermissionReplaceInput, b as CurrentUserContext, bn as PaymentsMethods, bt as AddressBookAddInput, c as PostHogObservabilityOptions, cn as Payment, ct as Budget, d as CreateCapxulClientInput, dn as PaymentDocumentKind, dt as OrgMeOptions, en as MeProfile, er as OrgLane, et as PermissionAssignInput, f as IdentityProfileDetails, fn as PaymentDocumentRef, ft as AccountsMethods, g as Holding, gn as PaymentMoney, gt as ActorRelationshipMethods, h as HoldingsMethods, hn as PaymentDocumentsMethods, ht as ActorProfileMethods, i as ObservationDelivery, in as OfframpQuoteInput, ir as isClaimed, it as PermissionOptions, j as OrganizationAccount, jn as isSettingUpLifecycle, jt as ActivityItem, k as OrgTemplate, kn as AccountLifecycle, kt as ActivityDetail, l as postHogObservability, ln as PaymentActivityEvidence, lt as OrgMe, m as IdentityRuntimeSendResult, mn as PaymentDocumentVerification, mt as ActorProfile, n as ObservationAdapter, nn as OfframpMethods, nr as StateLabel, nt as PermissionCreateInput, o as HostObservability, on as Payee, or as IdentityTransition, ot as PermissionRevokeInput, p as IdentityRuntime, pn as PaymentDocumentRender, pt as AccountMethods, q as PayrollRunStatus, qt as DestinationPayload, r as ObservationContext, rn as OfframpQuote, rr as destination, rt as PermissionMethods, s as PostHogObservabilityClient, sn as PayeesMethods, sr as InvocationControls, st as PermissionReadResult, t as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, tn as MovementActivityEvidence, tr as Readiness, tt as PermissionChangeInput, u as CapxulClient, un as PaymentDirection, ut as OrgMeMethod, v as SystemHealth, vn as PaymentTiming, vt as ActorRequestIssueInput, w as InviteMemberInput, wn as Ref, wt as InboxApproveInput, x as CurrentUserMethods, xn as PaymentsPayInput, xt as AddressBookEntry, y as MediaMethods, yn as PaymentType, yt as ActorRequestsMethods, z as PayrollGroup, zn as Permission, zt as ActivitySummaryParams } from "./observation-
|
|
1
|
+
import { B as OrgId, C as Address, N as CountryCode, O as AuthSession, S as AccountId, U as PayrollGroupId, V as PartyId, W as PayrollRunId, Y as RoleKey, a as SignerStatusStore, at as CapxulErrorDetails, c as AccountProviderSource, ct as isCapxulError, d as eip1193AccountProvider, dt as ChainUpstream, et as toAddress, f as localPrivateKeyAccountProvider, ft as FAILURE_MODES, g as SmartAccount, h as Session, i as SignerStatus, it as CapxulErrorCode, j as BudgetId, k as AuthUserId, l as AccountRequirement, lt as CHAIN_UPSTREAMS, m as Profile, mt as RevertSummary, n as CapxulSigner, nt as CAPXUL_ERROR_CODES, o as injectedWalletSigner, ot as Errors, p as CapxulResult, pt as FailureMode, r as Eip1193RequestProvider, rt as CapxulError, s as AccountProvider, t as CapxulDigestSigner, tt as toCountryCode, u as Eip1193Provider, ut as ChainCause, x as Account, z as Money } from "./signer-xGhV5Q7i.mjs";
|
|
2
|
+
import { $ as OrganizationPaymentsMethods, $n as IdentityState, $t as MeMethods, A as OrgView, An as AccountSetupStep, At as ActivityFilter, B as PayrollGroupInput, Bn as SubmittedPermissionExecution, Bt as ActivitySummaryTotal, C as DetectPendingOrgInvitationsResult, Cn as RecipientResolutionKind, Ct as AddressBookMethods, D as OrgMethods, Dn as TargetsMethods, Dt as ActivityAnnotation, E as MemberView, En as TargetReference, Et as InboxMethods, F as RoleSpendCap, Fn as OrgLifecycle, Ft as ActivityPage, G as PayrollRun, Gn as RequestStatus, Gt as DestinationKind, H as PayrollGroupsMethods, Hn as PAYMENT_DIRECTIONS, Ht as DepositInstructions, I as RoleView, In as OrgSetupStep, It as ActivityRange, J as PayrollRuns, Jt as DestinationRail, K as PayrollRunItemInput, Kn as CAPXUL_PAYMENTS_V2_ADDRESS, Kt as DestinationListInput, L as AuthorizeRunInput, Ln as ActorRef, Lt as ActivityReference, M as OrganizationAuditLogItem, Mn as IdentityMethods, Mt as ActivityKind, N as ResendInviteTokenInput, Nn as SmartAccountMethods, Nt as ActivityListParams, O as OrgScopedMethods, On as fingerprintPaymentIntent, Ot as ActivityAnnotationInput, P as RoleDefinition, Pn as AuthMethods, Pt as ActivityMethods, Q as OrganizationPaymentItemInput, Qn as IdentityEvent, Qt as HandlesMethods, R as PayrollEngagementTerms, Rn as CurrentHoldings, Rt as ActivitySummary, S as CreateOrgInput, Sn as RecipientResolution, St as AddressBookLabelInput, T as MemberStatus, Tn as ResolvedTarget, Tt as InboxItem, U as PayrollMethods, Un as PAYMENT_STATUSES, Ut as Destination, V as PayrollGroupMember, Vn as InboxStatus, Vt as ActorReference, W as PayrollOptions, Wn as PaymentStatus$1, Wt as DestinationAddInput, X as OrganizationPaymentBatchInput, Xn as TelemetryPort, Xt as DestinationsMethods, Y as PayrollTermsUnit, Yt as DestinationRemoveInput, Z as OrganizationPaymentInput, Zn as Destination$1, Zt as FinancialOpsMethods, _ as SystemMethods, _n as PaymentStatus, _t as ActorRequest, a as SdkFailureObservation, an as OfframpStatus, ar as isRestoring, at as PermissionReplaceInput, b as CurrentUserContext, bn as PaymentsMethods, bt as AddressBookAddInput, c as PostHogObservabilityOptions, cn as Payment, ct as Budget, d as CreateCapxulClientInput, dn as PaymentDocumentKind, dt as OrgMeOptions, en as MeProfile, er as OrgLane, et as PermissionAssignInput, f as IdentityProfileDetails, fn as PaymentDocumentRef, ft as AccountsMethods, g as Holding, gn as PaymentMoney, gt as ActorRelationshipMethods, h as HoldingsMethods, hn as PaymentDocumentsMethods, ht as ActorProfileMethods, i as ObservationDelivery, in as OfframpQuoteInput, ir as isClaimed, it as PermissionOptions, j as OrganizationAccount, jn as isSettingUpLifecycle, jt as ActivityItem, k as OrgTemplate, kn as AccountLifecycle, kt as ActivityDetail, l as postHogObservability, ln as PaymentActivityEvidence, lt as OrgMe, m as IdentityRuntimeSendResult, mn as PaymentDocumentVerification, mt as ActorProfile, n as ObservationAdapter, nn as OfframpMethods, nr as StateLabel, nt as PermissionCreateInput, o as HostObservability, on as Payee, or as IdentityTransition, ot as PermissionRevokeInput, p as IdentityRuntime, pn as PaymentDocumentRender, pt as AccountMethods, q as PayrollRunStatus, qt as DestinationPayload, r as ObservationContext, rn as OfframpQuote, rr as destination, rt as PermissionMethods, s as PostHogObservabilityClient, sn as PayeesMethods, sr as InvocationControls, st as PermissionReadResult, t as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, tn as MovementActivityEvidence, tr as Readiness, tt as PermissionChangeInput, u as CapxulClient, un as PaymentDirection, ut as OrgMeMethod, v as SystemHealth, vn as PaymentTiming, vt as ActorRequestIssueInput, w as InviteMemberInput, wn as Ref, wt as InboxApproveInput, x as CurrentUserMethods, xn as PaymentsPayInput, xt as AddressBookEntry, y as MediaMethods, yn as PaymentType, yt as ActorRequestsMethods, z as PayrollGroup, zn as Permission, zt as ActivitySummaryParams } from "./observation-YhuU8yQX.mjs";
|
|
3
3
|
import { Hex } from "viem";
|
|
4
4
|
import { Context, Effect, Layer } from "effect";
|
|
5
5
|
import { FunctionReference } from "convex/server";
|
|
6
|
-
|
|
7
6
|
//#region src/domain/activity/phase.d.ts
|
|
8
7
|
interface ActivityPhase {
|
|
9
8
|
/** The row is in a final state. No subsequent status change occurs. */
|
|
@@ -127,7 +126,8 @@ declare function openfortEmbeddedSignerFromWallet(input: {
|
|
|
127
126
|
* and verifies recovery before the backend submits.
|
|
128
127
|
*/
|
|
129
128
|
type OpenfortEmbeddedSigner = CapxulSigner & {
|
|
130
|
-
/** Drop cached `getAddress()` so the next read hits the embedded wallet again. */
|
|
129
|
+
/** Drop cached `getAddress()` so the next read hits the embedded wallet again. */
|
|
130
|
+
readonly resetAddressCache: () => void;
|
|
131
131
|
};
|
|
132
132
|
declare function openfortEmbeddedSigner(input: OpenfortEmbeddedSignerInput): OpenfortEmbeddedSigner;
|
|
133
133
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as postHogFailureObservation, B as injectedWalletSigner, C as fingerprintPaymentIntent, D as failureEvidenceProps, E as failureDetail, F as isSettingUpLifecycle, G as PAYMENT_DIRECTIONS, H as OBSERVATION_CONTEXT_HEADER, I as formatTraceparent, J as BootstrapEnvelope, K as PAYMENT_STATUSES, L as copyInvocationObservation, M as captureExceptionSync, N as version, O as observationContextProps, P as fromWei, Q as BASE_SEPOLIA_CHAIN_ID, R as readInvocationObservation, S as AuthClientPortTag, T as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, U as encodeObservationContextHeader, V as signerFailure, W as sanitizeObservationContext, X as CAPXUL_PAYMENTS_V2_ADDRESS, Y as EngineeringTelemetryBootstrapPolicy, Z as normalizeBindingEmail, _ as ClockPortTag, a as TelemetryPortTag, b as authClientPortFromPromiseAdapter, c as smartAccountErrorFromCapxul, d as wireChainId, et as destination, f as IdentityPortTag, g as ClockError, h as convexCallErrorFromCapxul, i as PostHogTelemetryLayer, j as captureException, k as observeFailedResult, l as AccountReadPortTag, m as ConvexCallPortTag, n as postHogProductTelemetry, nt as isRestoring, p as identityErrorFromCapxul, q as CAPXUL_FUNCTIONS, r as detectAuthCacheAdapter, s as SmartAccountPortTag, t as assembleCapxulClient, tt as isClaimed, u as accountReadErrorFromCapxul, v as BootstrapPortTag, w as toWei, x as AuthClientError, y as bootstrapErrorFromCapxul, z as causeChain } from "./create-capxul-client-
|
|
2
|
-
import { B as Errors, C as toDurationMs, D as toJwtToken, E as toEpochSeconds, F as toSessionToken, H as CHAIN_UPSTREAMS, I as decodeConvexError, L as CAPXUL_ERROR_CODES, N as toPublishableKey, O as toKycTier, P as toRoleKey, R as CapxulError, S as toCurrencyCode, T as toEpochMs, U as FAILURE_MODES, V as isCapxulError, b as toChainId, g as toAllowedOrigin, h as toAddress, k as toOrgId, m as toAccountId, o as AuthCachePortTag, p as currencySymbolFor, v as toAuthUserId, w as toEmail, x as toCountryCode } from "./InMemoryAuthCacheAdapter-
|
|
1
|
+
import { A as postHogFailureObservation, B as injectedWalletSigner, C as fingerprintPaymentIntent, D as failureEvidenceProps, E as failureDetail, F as isSettingUpLifecycle, G as PAYMENT_DIRECTIONS, H as OBSERVATION_CONTEXT_HEADER, I as formatTraceparent, J as BootstrapEnvelope, K as PAYMENT_STATUSES, L as copyInvocationObservation, M as captureExceptionSync, N as version, O as observationContextProps, P as fromWei, Q as BASE_SEPOLIA_CHAIN_ID, R as readInvocationObservation, S as AuthClientPortTag, T as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, U as encodeObservationContextHeader, V as signerFailure, W as sanitizeObservationContext, X as CAPXUL_PAYMENTS_V2_ADDRESS, Y as EngineeringTelemetryBootstrapPolicy, Z as normalizeBindingEmail, _ as ClockPortTag, a as TelemetryPortTag, b as authClientPortFromPromiseAdapter, c as smartAccountErrorFromCapxul, d as wireChainId, et as destination, f as IdentityPortTag, g as ClockError, h as convexCallErrorFromCapxul, i as PostHogTelemetryLayer, j as captureException, k as observeFailedResult, l as AccountReadPortTag, m as ConvexCallPortTag, n as postHogProductTelemetry, nt as isRestoring, p as identityErrorFromCapxul, q as CAPXUL_FUNCTIONS, r as detectAuthCacheAdapter, s as SmartAccountPortTag, t as assembleCapxulClient, tt as isClaimed, u as accountReadErrorFromCapxul, v as BootstrapPortTag, w as toWei, x as AuthClientError, y as bootstrapErrorFromCapxul, z as causeChain } from "./create-capxul-client-YSN2yN8m.mjs";
|
|
2
|
+
import { B as Errors, C as toDurationMs, D as toJwtToken, E as toEpochSeconds, F as toSessionToken, H as CHAIN_UPSTREAMS, I as decodeConvexError, L as CAPXUL_ERROR_CODES, N as toPublishableKey, O as toKycTier, P as toRoleKey, R as CapxulError, S as toCurrencyCode, T as toEpochMs, U as FAILURE_MODES, V as isCapxulError, b as toChainId, g as toAllowedOrigin, h as toAddress, k as toOrgId, m as toAccountId, o as AuthCachePortTag, p as currencySymbolFor, v as toAuthUserId, w as toEmail, x as toCountryCode } from "./InMemoryAuthCacheAdapter-FptQ2p7C.mjs";
|
|
3
3
|
import { keccak256, recoverAddress, stringToHex } from "viem";
|
|
4
4
|
import { Cause, Context, Data, Duration, Effect, Exit, Layer, Result, Schedule, SchemaIssue, SchemaParser, Scope, Tracer } from "effect";
|
|
5
5
|
import { getFunctionName, makeFunctionReference } from "convex/server";
|
|
@@ -445,7 +445,7 @@ const postHogOtlpEndpoints = (host) => {
|
|
|
445
445
|
};
|
|
446
446
|
};
|
|
447
447
|
const ENGINEERING_CAPXUL_ENV_SET = new Set(ENGINEERING_CAPXUL_ENVS);
|
|
448
|
-
const ENGINEERING_PRODUCERS = new Set(["browser", "server"]);
|
|
448
|
+
const ENGINEERING_PRODUCERS = /* @__PURE__ */ new Set(["browser", "server"]);
|
|
449
449
|
const PUBLIC_POSTHOG_AUTHORIZATION = /^Bearer phc_[A-Za-z0-9_-]{1,191}$/u;
|
|
450
450
|
const SAFE_RESOURCE_VALUE = /^[A-Za-z0-9][A-Za-z0-9._+@/-]{0,127}$/u;
|
|
451
451
|
const validateEngineeringTelemetryConfig = (config) => {
|
|
@@ -566,7 +566,7 @@ function authSessionFromBetterAuth$1(token, user) {
|
|
|
566
566
|
authUserId: toAuthUserId(user.id),
|
|
567
567
|
email: toEmail(user.email),
|
|
568
568
|
token: toSessionToken(token),
|
|
569
|
-
expiresAt: toEpochMs(Date.now() +
|
|
569
|
+
expiresAt: toEpochMs(Date.now() + 6048e5)
|
|
570
570
|
};
|
|
571
571
|
}
|
|
572
572
|
async function safeJson$1(res) {
|
|
@@ -957,7 +957,7 @@ function authSessionFromBetterAuth(token, user) {
|
|
|
957
957
|
authUserId: toAuthUserId(user.id),
|
|
958
958
|
email: toEmail(user.email),
|
|
959
959
|
token: toSessionToken(token),
|
|
960
|
-
expiresAt: toEpochMs(Date.now() +
|
|
960
|
+
expiresAt: toEpochMs(Date.now() + 6048e5)
|
|
961
961
|
};
|
|
962
962
|
}
|
|
963
963
|
async function safeJson(res) {
|
|
@@ -1271,7 +1271,7 @@ const DEFAULT_RETRY = {
|
|
|
1271
1271
|
baseDelayMs: 400
|
|
1272
1272
|
};
|
|
1273
1273
|
/** Request-side statuses a proxy or backend returns while momentarily unable to serve. */
|
|
1274
|
-
const TRANSIENT_HTTP_STATUSES = new Set([
|
|
1274
|
+
const TRANSIENT_HTTP_STATUSES = /* @__PURE__ */ new Set([
|
|
1275
1275
|
408,
|
|
1276
1276
|
425,
|
|
1277
1277
|
429
|
|
@@ -1421,7 +1421,7 @@ function SystemClockLayer() {
|
|
|
1421
1421
|
//#endregion
|
|
1422
1422
|
//#region src/adapters/convex-call/ConvexCallAdapter.ts
|
|
1423
1423
|
/** Exact floor-first allowlist; every additional handler must migrate its validator first. */
|
|
1424
|
-
const OBSERVED_CONVEX_ACTIONS = new Set([
|
|
1424
|
+
const OBSERVED_CONVEX_ACTIONS = /* @__PURE__ */ new Set([
|
|
1425
1425
|
"smartAccount/actions:claim",
|
|
1426
1426
|
"org/actions:prepareFounderAccount",
|
|
1427
1427
|
"org/actions:prepareBootstrap",
|
|
@@ -1429,12 +1429,12 @@ const OBSERVED_CONVEX_ACTIONS = new Set([
|
|
|
1429
1429
|
"org/actions:resumeBootstrapSubmission",
|
|
1430
1430
|
"org/actions:confirmBootstrap"
|
|
1431
1431
|
]);
|
|
1432
|
-
const OBSERVED_CONVEX_QUERIES = new Set([
|
|
1432
|
+
const OBSERVED_CONVEX_QUERIES = /* @__PURE__ */ new Set([
|
|
1433
1433
|
"identity/queries:loadByAuthUserId",
|
|
1434
1434
|
"smartAccount/queries:loadByAuthUserId",
|
|
1435
1435
|
"org/lifecycle:load"
|
|
1436
1436
|
]);
|
|
1437
|
-
const OBSERVED_CONVEX_MUTATIONS = new Set([
|
|
1437
|
+
const OBSERVED_CONVEX_MUTATIONS = /* @__PURE__ */ new Set([
|
|
1438
1438
|
"identity/mutations:create",
|
|
1439
1439
|
"identity/mutations:update",
|
|
1440
1440
|
"identity/mutations:completeOnboarding",
|
|
@@ -1558,7 +1558,7 @@ function mapToCapxulError(operation, err) {
|
|
|
1558
1558
|
function mapToConvexCallError(operation, err) {
|
|
1559
1559
|
return convexCallErrorFromCapxul(operation, mapToCapxulError(operation, err));
|
|
1560
1560
|
}
|
|
1561
|
-
const TRANSPORT_ERROR_CODES = new Set([
|
|
1561
|
+
const TRANSPORT_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
1562
1562
|
"EAI_AGAIN",
|
|
1563
1563
|
"ECONNREFUSED",
|
|
1564
1564
|
"ECONNRESET",
|
|
@@ -2308,7 +2308,7 @@ function clearStaleOpenfortBrowserStorage(publishableKey) {
|
|
|
2308
2308
|
* tagging them `stale-openfort-cache` would delete the triage signal the tag
|
|
2309
2309
|
* exists to carry.
|
|
2310
2310
|
*/
|
|
2311
|
-
const STALE_USER_ERROR_CODES = new Set(["USER_NOT_FOUND"]);
|
|
2311
|
+
const STALE_USER_ERROR_CODES = /* @__PURE__ */ new Set(["USER_NOT_FOUND"]);
|
|
2312
2312
|
/**
|
|
2313
2313
|
* The one predicate that opens the heal. It reads the Openfort error code and
|
|
2314
2314
|
* never the message text (ADR-0023 R4). It walks the cause chain the way
|
|
@@ -2606,7 +2606,8 @@ function postHogObservability(client, options = {}) {
|
|
|
2606
2606
|
if (client === null || client === void 0) return inactive;
|
|
2607
2607
|
try {
|
|
2608
2608
|
if (!(typeof options.enabled === "function" ? options.enabled() : options.enabled ?? true)) return inactive;
|
|
2609
|
-
const
|
|
2609
|
+
const rawContext = typeof options.context === "function" ? options.context() : options.context;
|
|
2610
|
+
const sanitized = sanitizeObservationContext(rawContext);
|
|
2610
2611
|
const context = sanitized === void 0 ? void 0 : Object.freeze({ ...sanitized });
|
|
2611
2612
|
return Object.freeze({
|
|
2612
2613
|
active: true,
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { O as AuthSession, _ as AuthCacheError, b as CachedJwt, n as CapxulSigner, v as AuthCachePort, y as AuthCachePortTag } from "../signer-
|
|
1
|
+
import { O as AuthSession, _ as AuthCacheError, b as CachedJwt, n as CapxulSigner, v as AuthCachePort, y as AuthCachePortTag } from "../signer-xGhV5Q7i.mjs";
|
|
2
2
|
import { Hex } from "viem";
|
|
3
3
|
import { Effect, FileSystem, Layer, Path } from "effect";
|
|
4
|
-
|
|
5
4
|
//#region src/adapters/auth-cache/FileSystemAuthCacheAdapter.d.ts
|
|
6
5
|
type FileSystemRuntime = FileSystem.FileSystem | Path.Path;
|
|
7
6
|
declare class FileSystemAuthCacheAdapter implements AuthCachePort {
|
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-FptQ2p7C.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,8 +1,7 @@
|
|
|
1
|
-
import { $ as WeiAmount, A as BlockNumber, B as OrgId, C as Address$1, D as AppId, E as AnonymousDistinctId, F as DocumentHash, G as PermissionAssignmentId, H as PaymentCommandId, I as DurationMs, J as PublishableKey, K as PermissionId, L as Email, M as ChainId, N as CountryCode, O as AuthSession, P as CurrencyCode, Q as TxHash, R as EpochMs, T as AllowedOrigin, U as PayrollGroupId, V as PartyId, W as PayrollRunId, X as SessionToken, Y as RoleKey, Z as SmartAccount, a as SignerStatusStore, at as CapxulErrorDetails, b as CachedJwt, c as AccountProviderSource, g as SmartAccount$1, h as Session$1, it as CapxulErrorCode, j as BudgetId, k as AuthUserId, l as AccountRequirement, m as Profile$1, n as CapxulSigner, p as CapxulResult, pt as FailureMode, q as Profile, rt as CapxulError, st as Failure, v as AuthCachePort, w as AllowanceKey, x as Account$1, z as Money } from "./signer-
|
|
1
|
+
import { $ as WeiAmount, A as BlockNumber, B as OrgId, C as Address$1, D as AppId, E as AnonymousDistinctId, F as DocumentHash, G as PermissionAssignmentId, H as PaymentCommandId, I as DurationMs, J as PublishableKey, K as PermissionId, L as Email, M as ChainId, N as CountryCode, O as AuthSession, P as CurrencyCode, Q as TxHash, R as EpochMs, T as AllowedOrigin, U as PayrollGroupId, V as PartyId, W as PayrollRunId, X as SessionToken, Y as RoleKey, Z as SmartAccount, a as SignerStatusStore, at as CapxulErrorDetails, b as CachedJwt, c as AccountProviderSource, g as SmartAccount$1, h as Session$1, it as CapxulErrorCode, j as BudgetId, k as AuthUserId, l as AccountRequirement, m as Profile$1, n as CapxulSigner, p as CapxulResult, pt as FailureMode, q as Profile, rt as CapxulError, st as Failure, v as AuthCachePort, w as AllowanceKey, x as Account$1, z as Money } from "./signer-xGhV5Q7i.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";
|
|
5
|
-
|
|
6
5
|
//#region src/domain/machine/shell.d.ts
|
|
7
6
|
declare const INVOCATION_PARENT_SPAN: unique symbol;
|
|
8
7
|
interface InvocationControls {
|
|
@@ -38,7 +37,8 @@ type IdentityTransition = (RecordBase & {
|
|
|
38
37
|
readonly outcome: "failed" | "cancelled";
|
|
39
38
|
readonly state: string;
|
|
40
39
|
readonly error_code: CapxulErrorCode;
|
|
41
|
-
readonly refusal_code?: never;
|
|
40
|
+
readonly refusal_code?: never;
|
|
41
|
+
/** The typed failure behind `error_code`, with its `CapxulError` when the port gave one. */
|
|
42
42
|
readonly failure?: Failure;
|
|
43
43
|
});
|
|
44
44
|
declare class ActorFailure<Reason extends CapxulErrorCode> extends Error {
|
|
@@ -337,7 +337,7 @@ type VerifyOtpInput = {
|
|
|
337
337
|
type GetConvexJwtOptions = AuthClientOperationOptions & {
|
|
338
338
|
readonly forceRefresh?: boolean;
|
|
339
339
|
};
|
|
340
|
-
declare const AuthClientError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
340
|
+
declare const AuthClientError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
341
341
|
readonly _tag: "AuthClientError";
|
|
342
342
|
} & Readonly<A>;
|
|
343
343
|
declare class AuthClientError extends AuthClientError_base<{
|
|
@@ -366,7 +366,7 @@ interface ClockPort {
|
|
|
366
366
|
readonly now: Effect.Effect<EpochMs, ClockError>;
|
|
367
367
|
readonly sleep: (duration: DurationMs) => Effect.Effect<void, ClockError>;
|
|
368
368
|
}
|
|
369
|
-
declare const ClockError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
369
|
+
declare const ClockError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
370
370
|
readonly _tag: "ClockError";
|
|
371
371
|
} & Readonly<A>;
|
|
372
372
|
declare class ClockError extends ClockError_base<{
|
|
@@ -668,7 +668,7 @@ type BootstrapResolution = {
|
|
|
668
668
|
readonly engineeringTelemetry?: EngineeringTelemetryBootstrapPolicyV1;
|
|
669
669
|
};
|
|
670
670
|
type BootstrapErrorKind = "notAuthenticated" | "network" | "provider" | "malformedBody" | "invalidInput" | "rateLimited";
|
|
671
|
-
declare const BootstrapError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
671
|
+
declare const BootstrapError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
672
672
|
readonly _tag: "BootstrapError";
|
|
673
673
|
} & Readonly<A>;
|
|
674
674
|
declare class BootstrapError extends BootstrapError_base<{
|
|
@@ -719,7 +719,7 @@ type Snapshot<T, E = CapxulError> = {
|
|
|
719
719
|
readonly status: "error";
|
|
720
720
|
readonly error: E;
|
|
721
721
|
};
|
|
722
|
-
declare const ConvexCallError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
722
|
+
declare const ConvexCallError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
723
723
|
readonly _tag: "ConvexCallError";
|
|
724
724
|
} & Readonly<A>;
|
|
725
725
|
declare class ConvexCallError extends ConvexCallError_base<{
|
|
@@ -767,10 +767,11 @@ type CompleteOnboardingIdentityInput = {
|
|
|
767
767
|
readonly email: Email;
|
|
768
768
|
readonly displayName: string;
|
|
769
769
|
readonly country: CountryCode;
|
|
770
|
-
readonly withdrawalAddress?: Address$1;
|
|
770
|
+
readonly withdrawalAddress?: Address$1;
|
|
771
|
+
/** #1062: optional globally-unique handle — store-when-present, backend-normalized. */
|
|
771
772
|
readonly username?: string;
|
|
772
773
|
};
|
|
773
|
-
declare const IdentityError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
774
|
+
declare const IdentityError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
774
775
|
readonly _tag: "IdentityError";
|
|
775
776
|
} & Readonly<A>;
|
|
776
777
|
declare class IdentityError extends IdentityError_base<{
|
|
@@ -826,7 +827,8 @@ type SafeDeploymentEvidence = {
|
|
|
826
827
|
};
|
|
827
828
|
type ProvisionInput = {
|
|
828
829
|
readonly authUserId: AuthUserId;
|
|
829
|
-
readonly chainId: ChainId;
|
|
830
|
+
readonly chainId: ChainId;
|
|
831
|
+
/** Verified session email. The backend reads the same value from BetterAuth. */
|
|
830
832
|
readonly email: Email;
|
|
831
833
|
};
|
|
832
834
|
/**
|
|
@@ -860,7 +862,7 @@ type ClaimInput = {
|
|
|
860
862
|
readonly chainId: ChainId;
|
|
861
863
|
readonly signerAddress: Address$1;
|
|
862
864
|
};
|
|
863
|
-
declare const SmartAccountError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
865
|
+
declare const SmartAccountError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
864
866
|
readonly _tag: "SmartAccountError";
|
|
865
867
|
} & Readonly<A>;
|
|
866
868
|
declare class SmartAccountError extends SmartAccountError_base<{
|
|
@@ -905,7 +907,7 @@ type FundFromFaucetInput = {
|
|
|
905
907
|
type FundFromFaucetResult = {
|
|
906
908
|
readonly txHash: string;
|
|
907
909
|
};
|
|
908
|
-
declare const AccountReadError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
910
|
+
declare const AccountReadError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
909
911
|
readonly _tag: "AccountReadError";
|
|
910
912
|
} & Readonly<A>;
|
|
911
913
|
declare class AccountReadError extends AccountReadError_base<{
|
|
@@ -967,14 +969,17 @@ type OrgLifecycle = {
|
|
|
967
969
|
type StartOrResumeOrganizationInput = {
|
|
968
970
|
readonly name: string;
|
|
969
971
|
readonly handle: string;
|
|
970
|
-
readonly country: string;
|
|
972
|
+
readonly country: string;
|
|
973
|
+
/** #1064: optional onboarding-collected description + size bucket. */
|
|
971
974
|
readonly bio?: string;
|
|
972
|
-
readonly size?: string;
|
|
975
|
+
readonly size?: string;
|
|
976
|
+
/** @internal Safe trace/correlation carriage owned by the identity flow. */
|
|
973
977
|
readonly observationContext?: WireObservationContext;
|
|
974
978
|
};
|
|
975
979
|
type OrganizationSetupStepInput = {
|
|
976
980
|
readonly orgId: OrgId;
|
|
977
|
-
readonly signal?: AbortSignal;
|
|
981
|
+
readonly signal?: AbortSignal;
|
|
982
|
+
/** @internal Safe trace/correlation carriage owned by the identity flow. */
|
|
978
983
|
readonly observationContext?: WireObservationContext;
|
|
979
984
|
/**
|
|
980
985
|
* @internal #1655: milliseconds the identity flow waited before this
|
|
@@ -986,7 +991,8 @@ type OrganizationSetupStepInput = {
|
|
|
986
991
|
type RecordOrganizationSetupFailureInput = {
|
|
987
992
|
readonly orgId: OrgId;
|
|
988
993
|
readonly error: CapxulError;
|
|
989
|
-
readonly retryable: boolean;
|
|
994
|
+
readonly retryable: boolean;
|
|
995
|
+
/** @internal Safe trace/correlation carriage owned by the identity flow. */
|
|
990
996
|
readonly observationContext?: WireObservationContext;
|
|
991
997
|
};
|
|
992
998
|
/**
|
|
@@ -1432,7 +1438,8 @@ type ActivityItem = {
|
|
|
1432
1438
|
readonly kind: "payment";
|
|
1433
1439
|
readonly id: string;
|
|
1434
1440
|
readonly ledgerKind: "Payment" | "Payout" | "Deposit";
|
|
1435
|
-
readonly status: PaymentStatus;
|
|
1441
|
+
readonly status: PaymentStatus;
|
|
1442
|
+
/** What the payment is FOR. On the list row so a title needs no second read. */
|
|
1436
1443
|
readonly paymentType: PaymentType;
|
|
1437
1444
|
readonly amount: PaymentMoney;
|
|
1438
1445
|
readonly direction: PaymentDirection;
|
|
@@ -1448,7 +1455,8 @@ type ActivityItem = {
|
|
|
1448
1455
|
readonly id: string;
|
|
1449
1456
|
readonly classification: "movement_only_outflow";
|
|
1450
1457
|
readonly amount: PaymentMoney;
|
|
1451
|
-
readonly direction: PaymentDirection;
|
|
1458
|
+
readonly direction: PaymentDirection;
|
|
1459
|
+
/** Short-form counterparty address today. */
|
|
1452
1460
|
readonly counterpartyLabel: string;
|
|
1453
1461
|
readonly receipt: {
|
|
1454
1462
|
readonly chainId: number;
|
|
@@ -1948,7 +1956,7 @@ type DetectPendingOrgInvitationsInput = Record<never, never>;
|
|
|
1948
1956
|
type DetectPendingOrgInvitationsResult$1 = {
|
|
1949
1957
|
readonly matched: readonly OrgId[];
|
|
1950
1958
|
};
|
|
1951
|
-
declare const OrgError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
1959
|
+
declare const OrgError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
1952
1960
|
readonly _tag: "OrgError";
|
|
1953
1961
|
} & Readonly<A>;
|
|
1954
1962
|
declare class OrgError extends OrgError_base<{
|
|
@@ -2215,11 +2223,15 @@ type OrgView = {
|
|
|
2215
2223
|
readonly id: OrgId;
|
|
2216
2224
|
readonly name: string;
|
|
2217
2225
|
readonly handle: string;
|
|
2218
|
-
readonly safeAddress: Address$1;
|
|
2219
|
-
|
|
2220
|
-
readonly
|
|
2226
|
+
readonly safeAddress: Address$1;
|
|
2227
|
+
/** The viewing member's own role label within this org. */
|
|
2228
|
+
readonly role: string;
|
|
2229
|
+
/** The Organization treasury Account. */
|
|
2230
|
+
readonly treasury: Account$1;
|
|
2231
|
+
/** #1064: onboarding-collected description + size bucket; null when unset. */
|
|
2221
2232
|
readonly bio: string | null;
|
|
2222
|
-
readonly size: string | null;
|
|
2233
|
+
readonly size: string | null;
|
|
2234
|
+
/** #1061 / ADR-0014: logo serving URL resolved at read time; null when unset. */
|
|
2223
2235
|
readonly logoUrl: string | null;
|
|
2224
2236
|
};
|
|
2225
2237
|
interface OrganizationAccount {
|
|
@@ -2245,8 +2257,10 @@ interface OrganizationAuditLogItem {
|
|
|
2245
2257
|
type MemberView = {
|
|
2246
2258
|
readonly orgId: OrgId;
|
|
2247
2259
|
readonly email: Email;
|
|
2248
|
-
readonly name: string | null;
|
|
2249
|
-
|
|
2260
|
+
readonly name: string | null;
|
|
2261
|
+
/** Member identity key. `null` until the invitee provisions a Safe. */
|
|
2262
|
+
readonly personalSafeAddress: Address$1 | null;
|
|
2263
|
+
/** The member role label maps to the on-chain `roleKey`. */
|
|
2250
2264
|
readonly role: string;
|
|
2251
2265
|
readonly roleKey: RoleKey | null;
|
|
2252
2266
|
readonly status: MemberStatus;
|
|
@@ -2628,8 +2642,10 @@ interface CapxulClient {
|
|
|
2628
2642
|
* Dev-only faucet bundle (production-surface-policy.md). `fund` lives here,
|
|
2629
2643
|
* NOT on the public `client.accounts` surface.
|
|
2630
2644
|
*/
|
|
2631
|
-
readonly accounts: AccountsFaucetMethods;
|
|
2632
|
-
|
|
2645
|
+
readonly accounts: AccountsFaucetMethods;
|
|
2646
|
+
/** Quarantined Reference-harness evidence; never a product Organization method. */
|
|
2647
|
+
readonly organizationSetup: OrganizationSetupProofMethods;
|
|
2648
|
+
/** Product telemetry projection for internal composition and test harnesses. */
|
|
2633
2649
|
readonly telemetry?: TelemetryPort;
|
|
2634
2650
|
readonly close?: () => Promise<void>;
|
|
2635
2651
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Account, Hex } from "viem";
|
|
2
2
|
import { Context, Effect } from "effect";
|
|
3
|
-
|
|
4
3
|
//#region ../errors/src/chain-cause.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Why an operation failed — the one flat vocabulary. The first four are the
|
|
@@ -9,7 +8,33 @@ import { Context, Effect } from "effect";
|
|
|
9
8
|
* (the SDK's `$exception` projection, the observability schema) and the type
|
|
10
9
|
* can never drift apart.
|
|
11
10
|
*/
|
|
12
|
-
declare const FAILURE_MODES: readonly [
|
|
11
|
+
declare const FAILURE_MODES: readonly [
|
|
12
|
+
/** OTP cookies live on `localhost:PORT` but OpenFort hits the Convex host. */
|
|
13
|
+
"auth-origin-mismatch",
|
|
14
|
+
/** An old `userId` in scoped storage makes the SDK skip re-auth → 401. */
|
|
15
|
+
"stale-openfort-cache",
|
|
16
|
+
/** The selected app/deployment origin is not allowlisted → 401. */
|
|
17
|
+
"app-env-allowlist",
|
|
18
|
+
/** Sandboxed/headless browser with no Web Crypto. */
|
|
19
|
+
"no-secure-context",
|
|
20
|
+
/** One upstream answered HTTP 429 or JSON-RPC -32005. Retryable. */
|
|
21
|
+
"rate-limited",
|
|
22
|
+
/** No answer inside the budget. Retryable. */
|
|
23
|
+
"timeout",
|
|
24
|
+
/** HTTP 5xx, a connection failure, or a malformed envelope. Retryable. */
|
|
25
|
+
"upstream-down",
|
|
26
|
+
/** Simulation or execution reverted; `chain.revert` names it when decodable. */
|
|
27
|
+
"revert",
|
|
28
|
+
/** A balance pre-flight shortfall or a decoded `ERC20InsufficientBalance`. */
|
|
29
|
+
"insufficient-balance",
|
|
30
|
+
/** A decoded `ERC20InsufficientAllowance`. */
|
|
31
|
+
"insufficient-allowance",
|
|
32
|
+
/** The bundler's validation refused the operation (AA2x/AA3x); its text is carried. */
|
|
33
|
+
"rejected",
|
|
34
|
+
/** The gateway refused the token. */
|
|
35
|
+
"unauthorized",
|
|
36
|
+
/** No cause could be determined. */
|
|
37
|
+
"unknown"];
|
|
13
38
|
type FailureMode = (typeof FAILURE_MODES)[number];
|
|
14
39
|
/** Who answered. `alto` is the bundler; `gateway` is the AA gateway's own logic. */
|
|
15
40
|
declare const CHAIN_UPSTREAMS: readonly ["alchemy", "infura", "public", "alto", "gateway"];
|
|
@@ -38,7 +63,7 @@ type ChainCause = {
|
|
|
38
63
|
};
|
|
39
64
|
//#endregion
|
|
40
65
|
//#region ../errors/src/errors.d.ts
|
|
41
|
-
declare const CAPXUL_ERROR_CODES: readonly ["NOT_AUTHENTICATED", "EMAIL_DELIVERY_FAILED", "PROFILE_NOT_FOUND", "SMART_ACCOUNT_MISSING", "PLAYER_NOT_FOUND", "ACCOUNT_NOT_FOUND", "PROVIDER_ERROR", "CAPABILITY_UNAVAILABLE", "INVALID_INPUT", "ENV_MISSING", "NOT_IMPLEMENTED", "VERIFICATION_REQUIRED", "INSUFFICIENT_BALANCE", "INVALID_RECIPIENT", "ROLE_PERMISSION_DENIED", "TRANSACTION_FAILED", "RATE_LIMITED", "NETWORK_ERROR", "UNKNOWN", "OTP_EXPIRED", "SIGNER_REJECTED", "CANCELLED", "WRONG_STATE", "STALE_EPOCH", "SUPERSEDED", "WORK_DIED", "ACTOR_STOPPED"];
|
|
66
|
+
declare const CAPXUL_ERROR_CODES: readonly ["NOT_AUTHENTICATED", "EMAIL_DELIVERY_FAILED", "PROFILE_NOT_FOUND", "SMART_ACCOUNT_MISSING", "PLAYER_NOT_FOUND", "ACCOUNT_NOT_FOUND", "ACCOUNT_CLAIMED_BY_OTHER_SIGNER", "PROVIDER_ERROR", "CAPABILITY_UNAVAILABLE", "INVALID_INPUT", "ENV_MISSING", "NOT_IMPLEMENTED", "VERIFICATION_REQUIRED", "INSUFFICIENT_BALANCE", "INVALID_RECIPIENT", "ROLE_PERMISSION_DENIED", "TRANSACTION_FAILED", "RATE_LIMITED", "NETWORK_ERROR", "UNKNOWN", "OTP_EXPIRED", "SIGNER_REJECTED", "CANCELLED", "WRONG_STATE", "STALE_EPOCH", "SUPERSEDED", "WORK_DIED", "ACTOR_STOPPED"];
|
|
42
67
|
type CapxulErrorCode = (typeof CAPXUL_ERROR_CODES)[number];
|
|
43
68
|
/**
|
|
44
69
|
* The one failure representation carried by domain state, actor work, and
|
|
@@ -88,10 +113,29 @@ declare const Errors: {
|
|
|
88
113
|
readonly smartAccountMissing: (authUserId: string) => CapxulError;
|
|
89
114
|
readonly playerNotFound: (playerId?: string) => CapxulError;
|
|
90
115
|
readonly accountNotFound: (accountId?: string) => CapxulError;
|
|
116
|
+
/**
|
|
117
|
+
* The Safe at this email's address is deployed and its owner is neither the
|
|
118
|
+
* Capxul bootstrap owner nor the caller's signer. The claim
|
|
119
|
+
* `swapOwner(bootstrap → signer)` cannot succeed: only the on-chain owner
|
|
120
|
+
* can hand the account over. Read from `getOwners()` before any
|
|
121
|
+
* UserOperation is built (2026-09-02), so no simulation and no retry.
|
|
122
|
+
*/
|
|
123
|
+
readonly accountClaimedByOtherSigner: (details: {
|
|
124
|
+
readonly safeAddress: string;
|
|
125
|
+
readonly onChainOwner: string;
|
|
126
|
+
/** A bounded sample of the `getOwners()` answer, for a Safe that is not single-owner. */
|
|
127
|
+
readonly owners?: readonly string[];
|
|
128
|
+
/** The full size of that answer, when the sample is shorter. */
|
|
129
|
+
readonly ownerCount?: number;
|
|
130
|
+
readonly expectedOwner: string;
|
|
131
|
+
readonly signerAddress: string;
|
|
132
|
+
}) => CapxulError;
|
|
91
133
|
readonly providerError: (provider: string, operation: string, cause: unknown, opts?: {
|
|
92
134
|
readonly failure_mode?: FailureMode;
|
|
93
|
-
readonly httpStatus?: number;
|
|
94
|
-
|
|
135
|
+
readonly httpStatus?: number;
|
|
136
|
+
/** Extra evidence for the operator (response body, edge error code). */
|
|
137
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
138
|
+
/** The structured chain-path cause; sets `mode` and `details.failure_mode` too. */
|
|
95
139
|
readonly chain?: ChainCause;
|
|
96
140
|
}) => CapxulError;
|
|
97
141
|
readonly capabilityUnavailable: (provider: string, operation: string) => CapxulError;
|
|
@@ -310,7 +354,7 @@ interface CachedJwt {
|
|
|
310
354
|
readonly token: JwtToken;
|
|
311
355
|
readonly expEpochSeconds: EpochSeconds;
|
|
312
356
|
}
|
|
313
|
-
declare const AuthCacheError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
357
|
+
declare const AuthCacheError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
314
358
|
readonly _tag: "AuthCacheError";
|
|
315
359
|
} & Readonly<A>;
|
|
316
360
|
declare class AuthCacheError extends AuthCacheError_base<{
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Jn as TelemetryGroupInput, Yn as TelemetryIdentifyInput, n as ObservationAdapter, or as IdentityTransition, qn as TelemetryEvent, u as CapxulClient } from "../observation-
|
|
1
|
+
import { Jn as TelemetryGroupInput, Yn as TelemetryIdentifyInput, n as ObservationAdapter, or as IdentityTransition, qn as TelemetryEvent, u as CapxulClient } from "../observation-YhuU8yQX.mjs";
|
|
2
2
|
import { Effect, Layer } from "effect";
|
|
3
|
-
|
|
4
3
|
//#region src/testing/telemetry/RecordingTelemetryAdapter.d.ts
|
|
5
4
|
type RecordingTelemetryOperation = {
|
|
6
5
|
readonly type: "emit";
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as deriveCapxulSafeAddress, P as fromWei, b as authClientPortFromPromiseAdapter, c as smartAccountErrorFromCapxul, d as wireChainId, h as convexCallErrorFromCapxul, o as redactTelemetryEvent, p as identityErrorFromCapxul, t as assembleCapxulClient, u as accountReadErrorFromCapxul, w as toWei, y as bootstrapErrorFromCapxul } from "../create-capxul-client-
|
|
2
|
-
import { B as Errors, C as toDurationMs, D as toJwtToken, E as toEpochSeconds, F as toSessionToken, N as toPublishableKey, O as toKycTier, R as CapxulError, T as toEpochMs, _ as toAppId, b as toChainId, g as toAllowedOrigin, h as toAddress, m as toAccountId, t as InMemoryAuthCacheAdapter, v as toAuthUserId, w as toEmail, x as toCountryCode } from "../InMemoryAuthCacheAdapter-
|
|
1
|
+
import { $ as deriveCapxulSafeAddress, P as fromWei, b as authClientPortFromPromiseAdapter, c as smartAccountErrorFromCapxul, d as wireChainId, h as convexCallErrorFromCapxul, o as redactTelemetryEvent, p as identityErrorFromCapxul, t as assembleCapxulClient, u as accountReadErrorFromCapxul, w as toWei, y as bootstrapErrorFromCapxul } from "../create-capxul-client-YSN2yN8m.mjs";
|
|
2
|
+
import { B as Errors, C as toDurationMs, D as toJwtToken, E as toEpochSeconds, F as toSessionToken, N as toPublishableKey, O as toKycTier, R as CapxulError, T as toEpochMs, _ as toAppId, b as toChainId, g as toAllowedOrigin, h as toAddress, m as toAccountId, t as InMemoryAuthCacheAdapter, v as toAuthUserId, w as toEmail, x as toCountryCode } from "../InMemoryAuthCacheAdapter-FptQ2p7C.mjs";
|
|
3
3
|
import { keccak256 } from "viem";
|
|
4
4
|
import { Effect, Result, Semaphore } from "effect";
|
|
5
5
|
import { getFunctionName } from "convex/server";
|
|
@@ -155,9 +155,9 @@ var ManualClockUnderTest = class {
|
|
|
155
155
|
};
|
|
156
156
|
//#endregion
|
|
157
157
|
//#region src/testing/auth-client/InMemoryAuthClientAdapter.ts
|
|
158
|
-
const DEFAULT_OTP_TTL_MS = toDurationMs(
|
|
159
|
-
const DEFAULT_SESSION_TTL_MS = toDurationMs(
|
|
160
|
-
const DEFAULT_JWT_TTL_MS = toDurationMs(
|
|
158
|
+
const DEFAULT_OTP_TTL_MS = toDurationMs(3e5);
|
|
159
|
+
const DEFAULT_SESSION_TTL_MS = toDurationMs(864e5);
|
|
160
|
+
const DEFAULT_JWT_TTL_MS = toDurationMs(9e5);
|
|
161
161
|
/**
|
|
162
162
|
* Hermetic OTP + session state machine implementing `AuthClientPort`. Wires
|
|
163
163
|
* through `AuthCachePort` for persistence (clause A11) and `ClockPort`
|
|
@@ -608,7 +608,7 @@ function cloneProfileOrNull(profile) {
|
|
|
608
608
|
}
|
|
609
609
|
//#endregion
|
|
610
610
|
//#region src/testing/smart-account/smart-account-derivation.ts
|
|
611
|
-
const SUPPORTED_CHAIN_IDS = new Set([84532, 8453]);
|
|
611
|
+
const SUPPORTED_CHAIN_IDS = /* @__PURE__ */ new Set([84532, 8453]);
|
|
612
612
|
toAddress("0xa6b71e26c5e0845f74c812102ca7114b6a896ab2");
|
|
613
613
|
keccak256("0x");
|
|
614
614
|
function isSupportedSmartAccountChain(chainId) {
|
|
@@ -870,18 +870,19 @@ function createCapxulTestClient(options = {}) {
|
|
|
870
870
|
});
|
|
871
871
|
const identity = new InMemoryIdentityAdapter({ clock });
|
|
872
872
|
const telemetry = new RecordingTelemetryAdapter();
|
|
873
|
+
const ports = {
|
|
874
|
+
authClient: authClientPortFromPromiseAdapter(authClient),
|
|
875
|
+
authCache,
|
|
876
|
+
identity,
|
|
877
|
+
smartAccount: new InMemorySmartAccountAdapter({ clock }),
|
|
878
|
+
accountRead: new InMemoryAccountReadAdapter({ rawBalance: "0" }),
|
|
879
|
+
bootstrap: new BootstrapStubAdapter({ script: { resolutions: /* @__PURE__ */ new Map([[`${toPublishableKey("cap_pk_test_0123456789ABCDEFGHJKMNPQRSTVWXYZ")}::${toAllowedOrigin("https://example.test")}`, TEST_BOOTSTRAP]]) } }),
|
|
880
|
+
clock,
|
|
881
|
+
telemetry,
|
|
882
|
+
convexCall: new ConvexCallStubAdapter({ script: {} })
|
|
883
|
+
};
|
|
873
884
|
const client = assembleCapxulClient({
|
|
874
|
-
ports
|
|
875
|
-
authClient: authClientPortFromPromiseAdapter(authClient),
|
|
876
|
-
authCache,
|
|
877
|
-
identity,
|
|
878
|
-
smartAccount: new InMemorySmartAccountAdapter({ clock }),
|
|
879
|
-
accountRead: new InMemoryAccountReadAdapter({ rawBalance: "0" }),
|
|
880
|
-
bootstrap: new BootstrapStubAdapter({ script: { resolutions: new Map([[`${toPublishableKey("cap_pk_test_0123456789ABCDEFGHJKMNPQRSTVWXYZ")}::${toAllowedOrigin("https://example.test")}`, TEST_BOOTSTRAP]]) } }),
|
|
881
|
-
clock,
|
|
882
|
-
telemetry,
|
|
883
|
-
convexCall: new ConvexCallStubAdapter({ script: {} })
|
|
884
|
-
},
|
|
885
|
+
ports,
|
|
885
886
|
bootstrap: TEST_BOOTSTRAP,
|
|
886
887
|
authCache,
|
|
887
888
|
requirement: options.requirement ?? "none",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capxul/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/Xelmar-tech/infrastructure.git",
|
|
@@ -39,24 +39,25 @@
|
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@effect/vitest": "4.0.0-beta.105",
|
|
41
41
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
42
|
-
"@vitest/coverage-v8": "4.1.
|
|
42
|
+
"@vitest/coverage-v8": "4.1.11",
|
|
43
43
|
"fast-check": "^3.23.2",
|
|
44
44
|
"permissionless": "0.3.4",
|
|
45
45
|
"posthog-js": "^1.418.10",
|
|
46
46
|
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
47
|
-
"vite
|
|
48
|
-
"
|
|
49
|
-
"
|
|
47
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.3.0",
|
|
48
|
+
"vite-plus": "0.3.0",
|
|
49
|
+
"vitest": "4.1.11",
|
|
50
|
+
"@capxul/types": "0.2.1",
|
|
50
51
|
"@capxul/errors": "0.0.2",
|
|
51
|
-
"@capxul/typescript-config": "0.0.0",
|
|
52
52
|
"@capxul/wire": "0.5.1",
|
|
53
|
-
"@capxul/
|
|
54
|
-
"@capxul/
|
|
53
|
+
"@capxul/typescript-config": "0.0.0",
|
|
54
|
+
"@capxul/observability": "2.8.0",
|
|
55
|
+
"@capxul/config": "0.2.1"
|
|
55
56
|
},
|
|
56
57
|
"_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.",
|
|
57
58
|
"scripts": {
|
|
58
59
|
"check-types": "vp exec ../../node_modules/@typescript/native/bin/tsc -p tsconfig.json --noEmit",
|
|
59
|
-
"lint": "vp
|
|
60
|
+
"lint": "vp lint -c ../../.oxlintrc.json . --deny-warnings",
|
|
60
61
|
"build": "vp pack",
|
|
61
62
|
"_vp-tasks-allowed": "vp-allowed: `test` + `test:coverage` are vp tasks in vite.config.ts so vitest self-writes don't bust cache (#205). `test:coverage:full` keeps the script form because it composes 5 reporters at invocation time.",
|
|
62
63
|
"test:coverage:full": "CAPXUL_FAST_CHECK_NUM_RUNS=50 vp test run --coverage --coverage.reporter=text --coverage.reporter=json-summary --coverage.reporter=json --coverage.reporter=html --coverage.reporter=clover",
|