@capxul/sdk 1.2.3 → 2.0.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/README.md +2 -1
- package/dist/{InMemoryAuthCacheAdapter-Dr1sEd9y.mjs → InMemoryAuthCacheAdapter-Rc8tCtml.mjs} +9 -8
- package/dist/{create-capxul-client-BTnlLLag.mjs → create-capxul-client-N36cHqE2.mjs} +1659 -1063
- package/dist/{create-capxul-client-BxTtXho7.d.mts → create-capxul-client-klbklLYW.d.mts} +328 -688
- package/dist/index.d.mts +3 -4
- package/dist/index.mjs +6 -111
- package/dist/node/index.d.mts +2 -3
- package/dist/node/index.mjs +1 -3
- package/dist/{signer-DgWAmtmi.d.mts → signer-ZijoFiUs.d.mts} +15 -19
- package/dist/testing/index.d.mts +2 -3
- package/dist/testing/index.mjs +5 -143
- package/package.json +11 -9
- package/dist/InMemoryAuthCacheAdapter-Dr1sEd9y.mjs.map +0 -1
- package/dist/create-capxul-client-BTnlLLag.mjs.map +0 -1
- package/dist/create-capxul-client-BxTtXho7.d.mts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/node/index.d.mts.map +0 -1
- package/dist/node/index.mjs.map +0 -1
- package/dist/signer-DgWAmtmi.d.mts.map +0 -1
- package/dist/testing/index.d.mts.map +0 -1
- package/dist/testing/index.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -58,7 +58,8 @@ Public Profile reads include the durable `onboarded` flag and optional
|
|
|
58
58
|
The packed npm package exposes only:
|
|
59
59
|
|
|
60
60
|
- `@capxul/sdk` — the client factory, public method and value types, signers,
|
|
61
|
-
and
|
|
61
|
+
host observability helper, and immutable Base Sepolia Payment contract
|
|
62
|
+
identity.
|
|
62
63
|
- `@capxul/sdk/node` — Node-only signer and runtime helpers.
|
|
63
64
|
- `@capxul/sdk/testing` — the real identity runtime assembled over
|
|
64
65
|
deterministic in-memory ports, with OTP, advance-only clock, transition,
|
package/dist/{InMemoryAuthCacheAdapter-Dr1sEd9y.mjs → InMemoryAuthCacheAdapter-Rc8tCtml.mjs}
RENAMED
|
@@ -8,6 +8,7 @@ const CAPXUL_ERROR_CODES = [
|
|
|
8
8
|
"PLAYER_NOT_FOUND",
|
|
9
9
|
"ACCOUNT_NOT_FOUND",
|
|
10
10
|
"PROVIDER_ERROR",
|
|
11
|
+
"CAPABILITY_UNAVAILABLE",
|
|
11
12
|
"INVALID_INPUT",
|
|
12
13
|
"ENV_MISSING",
|
|
13
14
|
"NOT_IMPLEMENTED",
|
|
@@ -46,6 +47,7 @@ const EXPECTED_OPERATION_OUTCOMES = new Set([
|
|
|
46
47
|
"INSUFFICIENT_BALANCE",
|
|
47
48
|
"INVALID_RECIPIENT",
|
|
48
49
|
"ROLE_PERMISSION_DENIED",
|
|
50
|
+
"CAPABILITY_UNAVAILABLE",
|
|
49
51
|
"RATE_LIMITED",
|
|
50
52
|
"OTP_EXPIRED",
|
|
51
53
|
"WRONG_STATE",
|
|
@@ -103,6 +105,10 @@ const Errors = {
|
|
|
103
105
|
details
|
|
104
106
|
});
|
|
105
107
|
},
|
|
108
|
+
capabilityUnavailable: (provider, operation) => new CapxulError("CAPABILITY_UNAVAILABLE", "Provider capability is unavailable", { details: {
|
|
109
|
+
provider,
|
|
110
|
+
operation
|
|
111
|
+
} }),
|
|
106
112
|
invalidInput: (field, reason) => new CapxulError("INVALID_INPUT", `Invalid ${field}: ${reason}`, { details: {
|
|
107
113
|
field,
|
|
108
114
|
reason
|
|
@@ -227,6 +233,7 @@ function decodeConvexError(err) {
|
|
|
227
233
|
//#region ../types/src/index.ts
|
|
228
234
|
const EVM_ADDRESS_RE = /^0x[0-9a-f]{40}$/i;
|
|
229
235
|
const BYTES32_RE = /^0x[0-9a-f]{64}$/i;
|
|
236
|
+
const ZERO_BYTES32 = `0x${"0".repeat(64)}`;
|
|
230
237
|
const PUBLISHABLE_KEY_PATTERN = /^cap_pk_(test|live)_[0-9A-HJKMNP-TV-Z]{32}$/;
|
|
231
238
|
const SUPPORTED_CURRENCIES = [
|
|
232
239
|
{
|
|
@@ -260,8 +267,8 @@ Object.fromEntries(SUPPORTED_CURRENCIES.map((currency) => [currency.code, curren
|
|
|
260
267
|
const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
261
268
|
const COUNTRY_CODE_RE = /^[A-Z]{2}$/;
|
|
262
269
|
const ACCOUNT_ID_RE = /^account_[0-9A-Za-z]+$/;
|
|
263
|
-
const SUBACCOUNT_ID_RE = /^subaccount_[0-9A-Za-z]+$/;
|
|
264
270
|
const APP_ID_RE = /^app_[0-7][0-9A-HJKMNP-TV-Z]{25}$/;
|
|
271
|
+
const WEI_RE = /^[0-9]+$/;
|
|
265
272
|
Math.floor(Number.MAX_SAFE_INTEGER / 1e3);
|
|
266
273
|
function toAddress(raw) {
|
|
267
274
|
if (typeof raw !== "string" || !EVM_ADDRESS_RE.test(raw)) throw Errors.invalidInput("address", invalidValueReason("invalid EVM address format", raw));
|
|
@@ -278,10 +285,6 @@ function toAccountId(raw) {
|
|
|
278
285
|
if (typeof raw !== "string" || !ACCOUNT_ID_RE.test(raw)) throw Errors.invalidInput("accountId", invalidValueReason("must be account_ plus an alphanumeric id", raw));
|
|
279
286
|
return raw;
|
|
280
287
|
}
|
|
281
|
-
function toSubAccountId(raw) {
|
|
282
|
-
if (typeof raw !== "string" || !SUBACCOUNT_ID_RE.test(raw)) throw Errors.invalidInput("subAccountId", invalidValueReason("must be subaccount_ plus an alphanumeric id", raw));
|
|
283
|
-
return raw;
|
|
284
|
-
}
|
|
285
288
|
function toOrgId(raw) {
|
|
286
289
|
return toNonEmptyStringBrand(raw, "orgId");
|
|
287
290
|
}
|
|
@@ -472,6 +475,4 @@ Layer.effect(AuthCachePortTag, Effect.sync(() => new InMemoryAuthCacheAdapter())
|
|
|
472
475
|
cause
|
|
473
476
|
}))));
|
|
474
477
|
//#endregion
|
|
475
|
-
export {
|
|
476
|
-
|
|
477
|
-
//# sourceMappingURL=InMemoryAuthCacheAdapter-Dr1sEd9y.mjs.map
|
|
478
|
+
export { toSessionToken as A, toEpochMs as C, toOrgId as D, toKycTier as E, isCapxulError as F, CapxulError as M, EXPECTED_OPERATION_OUTCOMES as N, toPublishableKey as O, Errors as P, toEmail as S, toJwtToken as T, toAuthUserId as _, AuthCacheError as a, toCurrencyCode as b, BYTES32_RE as c, WEI_RE as d, ZERO_BYTES32 as f, toAppId as g, toAllowedOrigin as h, parseCachedJwt as i, decodeConvexError as j, toRoleKey as k, EVM_ADDRESS_RE as l, toAddress as m, BrowserAuthCacheAdapter as n, AuthCachePortTag as o, toAccountId as p, parseAuthSession as r, APP_ID_RE as s, InMemoryAuthCacheAdapter as t, SUPPORTED_CURRENCY_CODES as u, toChainId as v, toEpochSeconds as w, toDurationMs as x, toCountryCode as y };
|