@capxul/sdk 4.20.0-beta.5 → 4.20.0-beta.6

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 CHANGED
@@ -19,51 +19,44 @@ const client = created.value;
19
19
  Every public operation resolves a `Promise<CapxulResult<T>>`. Domain failures
20
20
  are values, not thrown exceptions.
21
21
 
22
- ## Money input and display
22
+ ## Asset amount input and display
23
23
 
24
- Use the public money helpers at form and display boundaries. They do not
25
- convert a money value to a JavaScript number.
24
+ Use the asset helpers at Payment form and display boundaries. They keep the
25
+ exact AssetId and do not convert a value to a JavaScript number.
26
26
 
27
27
  ```ts
28
- import { formatMoney, parseMoney } from "@capxul/sdk";
28
+ import { formatAssetAmount, parseAssetAmount, requireAsset, TOKENS } from "@capxul/sdk";
29
29
 
30
- const amount = parseMoney("1,000.25", {
31
- currency: account.available.currency,
32
- decimals: account.available.decimals,
33
- });
30
+ const amount = parseAssetAmount("1,000.25", requireAsset(TOKENS.BASE_SEPOLIA.CAPXUL_TEST_USDC));
34
31
 
35
32
  if ("kind" in amount) {
36
33
  console.error(amount.reason); // closed code — the app owns the sentence (ADR-0023)
37
34
  } else {
38
- console.log(formatMoney(amount)); // $1,000.25
39
- console.log(formatMoney(amount, { grammar: "code" })); // 1,000.25 USD
35
+ console.log(formatAssetAmount(amount)); // 1,000.25 USDC
40
36
  }
41
37
  ```
42
38
 
43
- `parseMoney` returns validation errors as values. `formatMoney` rejects a
44
- malformed `Money` record with `INVALID_INPUT`.
39
+ `parseAssetAmount` returns validation errors as values. Payment, request,
40
+ Budget, Payroll, and activity amounts require AssetAmount. Fiat Money remains
41
+ separate valuation data.
45
42
 
46
- ## The asset a screen shows
43
+ ## Value all asset positions
47
44
 
48
- `holdings.primary` picks the one asset a hero balance or a summary total
49
- should show. It returns the renderable holding with the largest available
50
- balance. A chain row that carries no `decimals`, no `symbol`, or a symbol that
51
- stands for no supported currency is skipped, because it cannot be rendered.
45
+ Use `holdings.current` for raw positions. Use `valueIn` to value exact asset
46
+ quantities in a display currency. A token symbol does not identify an asset.
47
+ Quantities from different assets cannot be compared as a headline balance.
52
48
 
53
49
  ```ts
54
- import { formatMoney, type Holding } from "@capxul/sdk";
55
-
56
- const result = await client.holdings.primary();
50
+ import { formatMoney, valueIn } from "@capxul/sdk";
57
51
 
58
- if (result.ok && result.value !== null) {
59
- const holding: Holding = result.value;
60
- console.log(holding.symbol); // "USDX" — the token symbol the chain reported
61
- console.log(formatMoney(holding.available, { grammar: "code" })); // e.g. "1,250.50 USD"
52
+ const valuation = valueIn(amounts, displayCurrency, rates);
53
+ if (valuation.total !== null) {
54
+ console.log(formatMoney(valuation.total));
62
55
  }
63
56
  ```
64
57
 
65
- `null` means no row is renderable. It is a value, not an error, so give the
66
- screen its own rule for showing nothing.
58
+ Keep `valuation.unrated` visible beside the known subtotal. A missing rate
59
+ does not mean a zero balance.
67
60
 
68
61
  ## Observability
69
62
 
@@ -105,6 +98,11 @@ The backend remains the authority for reserved names and global uniqueness.
105
98
  The method returns only after the client requirement reaches a ready Account.
106
99
  The React frontend does not use this journey yet.
107
100
 
101
+ A Node host that keeps login outside the browser can pass `openfortSignerFactory`.
102
+ The factory receives only the validated Openfort and auth bootstrap fields. Its
103
+ browser page can use `createOpenfortBrowserSigner` with host-owned access-token
104
+ and encryption-session callbacks. It does not need a second login or private SDK import.
105
+
108
106
  ## Published entry points
109
107
 
110
108
  The packed npm package exposes only:
@@ -173,3 +171,36 @@ operator secrets and prove only the path named by the command. See
173
171
  The browser production path owns its Openfort signer when no signer is supplied.
174
172
  Current integration recovery evidence and its published-package boundary are
175
173
  tracked in the [#870 receipt](../../docs/receipts/issue-870-openfort-signer-recovery-RECEIPT-2026-07-19.md).
174
+
175
+ ### Node session storage
176
+
177
+ A Node host can pass `nodeSessionStorage: { load, save }` to
178
+ `createCapxulClient`. Both methods return promises. `load` returns an opaque
179
+ BetterAuth credential or `null`; `save` receives the credential or `null` on
180
+ logout. Store it with owner-only access and isolate it by application and
181
+ environment. Do not print it or use a cached `AuthSession` as backend authority.
182
+ The SDK validates the credential and expiry with BetterAuth on process restart.
183
+ With durable storage, each adapter serializes session reads, OTP verification,
184
+ sign-out, and Convex token reads. A delayed response cannot clear or rotate a
185
+ credential from a later operation on that adapter. Cancellation while queued
186
+ returns immediately and prevents that operation from reaching the provider.
187
+ Hosts that share storage across clients or processes must fence writes, for
188
+ example with an atomic compare-and-set; the adapter cannot order other clients.
189
+
190
+ For separate OTP request and verification processes, retain the email and
191
+ original request timestamp. After `auth.getSession()` confirms signed-out state,
192
+ call `auth.resumeOtp({ email, requestedAt })`, then `auth.verifyOtp({ email,
193
+ code })`. Resume restores pending input only. It does not send another OTP or
194
+ authenticate the caller. Keep OTP values out of arguments, logs, and stored data.
195
+
196
+ ### Existing financial documents
197
+
198
+ Use `paymentDocuments.verify({ documentHash, contentHash })` to verify stored
199
+ content. Use `paymentDocuments.render` with the same pair for safe semantic HTML.
200
+ Call `paymentDocuments.get` only for a deliberate download. Its `bytesBase64`
201
+ contains the exact stored bytes. Do not log document results or error payloads.
202
+ Get references from Payment or Movement activity detail. References include
203
+ kind, format, and role. A hash is not permission to read a document.
204
+ Reads check current Payment participants or current Movement actor access.
205
+ Missing and unauthorized pairs return the same refusal. These methods do not
206
+ create documents or add Payment links.
@@ -1,4 +1,4 @@
1
- import { concat, encodeAbiParameters, encodeFunctionData, encodePacked, getContractAddress, keccak256, padHex, stringToHex, toBytes, toEventSelector, toFunctionSelector, toFunctionSignature } from "viem";
1
+ import { concat, encodeAbiParameters, encodeFunctionData, encodePacked, getContractAddress, keccak256, padHex, toBytes, toEventSelector, toFunctionSelector, toFunctionSignature } from "viem";
2
2
  import { Context, Data, Effect, Layer, Result } from "effect";
3
3
  //#region ../errors/src/secret-material.ts
4
4
  const CREDENTIAL_FIELDS = /* @__PURE__ */ new Set([
@@ -807,8 +807,10 @@ const Errors = {
807
807
  * enumerates the states the method accepts.
808
808
  */
809
809
  wrongState: (details) => new CapxulError("WRONG_STATE", `${details.method} called from state '${details.currentState}'; valid states: ${details.validStates.join(", ")}`, { details: {
810
- ...details,
811
- validStates: [...details.validStates]
810
+ method: details.method,
811
+ currentState: details.currentState,
812
+ validStates: [...details.validStates],
813
+ ...details.organizationId === void 0 ? {} : { organizationId: details.organizationId }
812
814
  } })
813
815
  };
814
816
  //#endregion
@@ -941,6 +943,12 @@ function toHandle(raw) {
941
943
  if (typeof raw !== "string" || !HANDLE_RE.test(raw)) throw Errors.invalidInput("handle", invalidValueReason("must be 3-30 characters of a-z, 0-9, underscore, or hyphen", raw));
942
944
  return raw;
943
945
  }
946
+ function toPermissionId(raw) {
947
+ return toNonEmptyStringBrand(raw, "permissionId");
948
+ }
949
+ function toPermissionAssignmentId(raw) {
950
+ return toNonEmptyStringBrand(raw, "permissionAssignmentId");
951
+ }
944
952
  function toBudgetId(raw) {
945
953
  return toNonEmptyStringBrand(raw, "budgetId");
946
954
  }
@@ -1061,33 +1069,11 @@ function invalidValueReason(prefix, raw) {
1061
1069
  }
1062
1070
  //#endregion
1063
1071
  //#region ../config/src/tokens.ts
1064
- /** `TestUSDC` ("USDX") — Base Sepolia, 6 decimals, open `mint`. (Canon §1.) */
1065
- const USDX_ADDRESS_BASE_SEPOLIA = "0xf09fcbb6df9f8f918e58f9c8ab15a76ade862b77";
1066
- const USDX_DEPLOYMENT_START_BLOCK = 39860173;
1067
- /**
1068
- * The ERC-20 `symbol()` the deployed `TestUSDC` contract returns
1069
- * (`packages/contracts/src/TestUSDC.sol:10`). It travels with the address and
1070
- * the decimals so a holdings row can never carry one token's address with
1071
- * another token's display symbol. This is the display symbol, not the
1072
- * currency: see `USDX_CURRENCY` below.
1073
- */
1074
- const USDX_SYMBOL = "USDX";
1075
1072
  const SYNTHETIC_TEST_ASSET_SOURCE = "synthetic-test-liquidity";
1076
- const USDX_ASSET = {
1077
- assetId: assetIdFor(84532, USDX_ADDRESS_BASE_SEPOLIA),
1078
- chainId: toChainId(84532),
1079
- symbol: USDX_SYMBOL,
1080
- peg: toCurrencyCode("USD"),
1081
- tokenAddress: USDX_ADDRESS_BASE_SEPOLIA,
1082
- deploymentStartBlock: USDX_DEPLOYMENT_START_BLOCK,
1083
- decimals: 6,
1084
- source: "legacy"
1085
- };
1086
- ({ ...USDX_ASSET }), USDX_ASSET.peg;
1087
1073
  /**
1088
1074
  * The candidate tier: five owned test assets, every field read back from Base
1089
- * Sepolia after the deployment that created it (chain 84532, blocks
1090
- * 46,465,978–46,465,982). Real contracts, authored liquidity, no settlement
1075
+ * Sepolia after the deployment that created it (chain 84532, block
1076
+ * 46,690,061). Real contracts, authored liquidity, no settlement
1091
1077
  * admission — so rollback is removing consumers, never relabelling a
1092
1078
  * deployed address or deleting its history.
1093
1079
  *
@@ -1096,84 +1082,95 @@ const USDX_ASSET = {
1096
1082
  * address returning the same symbol, which is why the resolvers below key on
1097
1083
  * `assetId`, or on chain plus address, and never on a symbol.
1098
1084
  */
1099
- const SYNTHETIC_TEST_ASSETS = [
1100
- {
1101
- assetId: assetIdFor(84532, "0xb3d8566fb90f7df939f4bc08a09b19047117f549"),
1085
+ const SYNTHETIC_TEST_ASSET_FIXTURES = {
1086
+ usdc: {
1087
+ assetId: assetIdFor(84532, "0x06ba8b863ca77490b0e7008427562bdbfcff730e"),
1102
1088
  chainId: toChainId(84532),
1103
- tokenAddress: "0xb3d8566fb90f7df939f4bc08a09b19047117f549",
1089
+ tokenAddress: "0x06ba8b863ca77490b0e7008427562bdbfcff730e",
1104
1090
  symbol: "USDC",
1105
1091
  decimals: 6,
1106
1092
  peg: toCurrencyCode("USD"),
1107
- deploymentStartBlock: 46465978,
1108
- deploymentTransaction: "0xa7fb8bb9d1fd1cc5fe2fc42fa4cdccace7742efae8ea99f091a283e5709343de",
1093
+ deploymentStartBlock: 46690061,
1094
+ deploymentTransaction: "0x2661b7af5f62b9e31c707a59746cda65b90ba4448852317ac1968162fb94ff52",
1109
1095
  source: SYNTHETIC_TEST_ASSET_SOURCE
1110
1096
  },
1111
- {
1112
- assetId: assetIdFor(84532, "0x7ddcfb6aaffb9908c4c2db308b784c269eec8a01"),
1097
+ usdt: {
1098
+ assetId: assetIdFor(84532, "0xcb5f361ae070e75d573941b8cd54995fa3876d75"),
1113
1099
  chainId: toChainId(84532),
1114
- tokenAddress: "0x7ddcfb6aaffb9908c4c2db308b784c269eec8a01",
1100
+ tokenAddress: "0xcb5f361ae070e75d573941b8cd54995fa3876d75",
1115
1101
  symbol: "USDT",
1116
1102
  decimals: 6,
1117
1103
  peg: toCurrencyCode("USD"),
1118
- deploymentStartBlock: 46465979,
1119
- deploymentTransaction: "0xa17ad76fe8b24cdf1fbcff245c3eb022444710cf9fa7b5ee59818be654f4ae10",
1104
+ deploymentStartBlock: 46690061,
1105
+ deploymentTransaction: "0x98e5303f97974a31eddb61ad030072d900ce7283ce8080bfe0b9e5ea6f297749",
1120
1106
  source: SYNTHETIC_TEST_ASSET_SOURCE
1121
1107
  },
1122
- {
1123
- assetId: assetIdFor(84532, "0x1d93d525f73453fe18eebf044e8a3954bfe3721e"),
1108
+ weth: {
1109
+ assetId: assetIdFor(84532, "0x85b7bd39ce3df9a85135e1e307225dd435f67e47"),
1124
1110
  chainId: toChainId(84532),
1125
- tokenAddress: "0x1d93d525f73453fe18eebf044e8a3954bfe3721e",
1111
+ tokenAddress: "0x85b7bd39ce3df9a85135e1e307225dd435f67e47",
1126
1112
  symbol: "WETH",
1127
1113
  decimals: 18,
1128
1114
  peg: null,
1129
- deploymentStartBlock: 46465980,
1130
- deploymentTransaction: "0xcb9b2d024686fac93ec1243ccf02d3567fd531da46176115660cba2ba644b09d",
1115
+ deploymentStartBlock: 46690061,
1116
+ deploymentTransaction: "0x48dfacc01c15adc34f6c629aec5c9ff7bb84176d448017da0d0d4fdaf8b5a68a",
1131
1117
  source: SYNTHETIC_TEST_ASSET_SOURCE
1132
1118
  },
1133
- {
1134
- assetId: assetIdFor(84532, "0x8fe52c70aa9f7b6d74d8bb26eca33d87413cb624"),
1119
+ wbtc: {
1120
+ assetId: assetIdFor(84532, "0xcf433a81f507dcc88c2c404650ffafb40750b451"),
1135
1121
  chainId: toChainId(84532),
1136
- tokenAddress: "0x8fe52c70aa9f7b6d74d8bb26eca33d87413cb624",
1122
+ tokenAddress: "0xcf433a81f507dcc88c2c404650ffafb40750b451",
1137
1123
  symbol: "WBTC",
1138
1124
  decimals: 8,
1139
1125
  peg: null,
1140
- deploymentStartBlock: 46465981,
1141
- deploymentTransaction: "0x728ba7b430ffd141f83d0ed5ce429d050049d7b097c936fd11e9c572d1243854",
1126
+ deploymentStartBlock: 46690061,
1127
+ deploymentTransaction: "0xa975fcda0a67509742243bbfc386032d2e0d6ca78404c255fae2e4ffae1c7f4d",
1142
1128
  source: SYNTHETIC_TEST_ASSET_SOURCE
1143
1129
  },
1144
- {
1145
- assetId: assetIdFor(84532, "0x5865fe9787ac214feb5facaebaec06969ac0a9a3"),
1130
+ cngn: {
1131
+ assetId: assetIdFor(84532, "0xda515a7267e190710f0003f951c62bcfd70d6b2a"),
1146
1132
  chainId: toChainId(84532),
1147
- tokenAddress: "0x5865fe9787ac214feb5facaebaec06969ac0a9a3",
1133
+ tokenAddress: "0xda515a7267e190710f0003f951c62bcfd70d6b2a",
1148
1134
  symbol: "cNGN",
1149
1135
  decimals: 6,
1150
1136
  peg: toCurrencyCode("NGN"),
1151
- deploymentStartBlock: 46465982,
1152
- deploymentTransaction: "0xcedf254bcef57fc64189261a5ab1161bc4fde370e470933f627c4d8ddb5a2e26",
1137
+ deploymentStartBlock: 46690061,
1138
+ deploymentTransaction: "0x6f6b0302448c7cd7db5c118a8250e548c6e72821df373e5a27550e5cdfa635a1",
1153
1139
  source: SYNTHETIC_TEST_ASSET_SOURCE
1154
1140
  }
1141
+ };
1142
+ const SYNTHETIC_TEST_ASSETS = [
1143
+ SYNTHETIC_TEST_ASSET_FIXTURES.usdc,
1144
+ SYNTHETIC_TEST_ASSET_FIXTURES.usdt,
1145
+ SYNTHETIC_TEST_ASSET_FIXTURES.weth,
1146
+ SYNTHETIC_TEST_ASSET_FIXTURES.wbtc,
1147
+ SYNTHETIC_TEST_ASSET_FIXTURES.cngn
1155
1148
  ];
1156
1149
  toChainId(84532);
1157
1150
  /**
1158
1151
  * The settlement tier: the owned test assets admitted to the exact-transfer
1159
- * path and to the treasury reads. USDC, USDT and WETH are equal assets. There
1160
- * is no default token and no successor to USDX; USDX survives only in
1161
- * `LEGACY_MONEY_ASSETS` and is not a current treasury row.
1152
+ * path and to the treasury reads. USDC, USDT and WETH are equal assets.
1153
+ * There is no default token.
1162
1154
  */
1163
- const SETTLEMENT_ASSET_SYMBOLS = [
1164
- "USDC",
1165
- "USDT",
1166
- "WETH"
1167
- ];
1168
- const CONFIGURED_MONEY_ASSETS = SYNTHETIC_TEST_ASSETS.filter((asset) => SETTLEMENT_ASSET_SYMBOLS.includes(asset.symbol));
1155
+ const SETTLEMENT_ASSETS_BASE_SEPOLIA = Object.freeze({
1156
+ CAPXUL_TEST_USDC: SYNTHETIC_TEST_ASSET_FIXTURES.usdc,
1157
+ CAPXUL_TEST_USDT: SYNTHETIC_TEST_ASSET_FIXTURES.usdt,
1158
+ CAPXUL_TEST_WETH: SYNTHETIC_TEST_ASSET_FIXTURES.weth
1159
+ });
1160
+ const CONFIGURED_MONEY_ASSETS = Object.freeze(Object.values(SETTLEMENT_ASSETS_BASE_SEPOLIA));
1161
+ /** Public AssetIds for the admitted Base Sepolia test assets. */
1162
+ const TOKENS = Object.freeze({ BASE_SEPOLIA: Object.freeze({
1163
+ CAPXUL_TEST_USDC: SETTLEMENT_ASSETS_BASE_SEPOLIA.CAPXUL_TEST_USDC.assetId,
1164
+ CAPXUL_TEST_USDT: SETTLEMENT_ASSETS_BASE_SEPOLIA.CAPXUL_TEST_USDT.assetId,
1165
+ CAPXUL_TEST_WETH: SETTLEMENT_ASSETS_BASE_SEPOLIA.CAPXUL_TEST_WETH.assetId
1166
+ }) });
1169
1167
  /**
1170
1168
  * Every known asset in ONE identity space. The tiers above declare admission;
1171
1169
  * this is the only list an identity resolves against, so an asset is never
1172
1170
  * two different things depending on which list a caller happened to read.
1173
1171
  */
1174
- const MONEY_ASSET_REGISTRY = [USDX_ASSET, ...SYNTHETIC_TEST_ASSETS];
1172
+ const MONEY_ASSET_REGISTRY = [...SYNTHETIC_TEST_ASSETS];
1175
1173
  CONFIGURED_MONEY_ASSETS.map((asset) => asset.tokenAddress.toLowerCase());
1176
- USDX_ADDRESS_BASE_SEPOLIA.toLowerCase();
1177
1174
  /** The registry row for `assetId` across every tier, or `null`. */
1178
1175
  function configuredMoneyAssetById(assetId) {
1179
1176
  const canonical = toAssetId(assetId);
@@ -1226,7 +1223,7 @@ function normalizeSafeSaltEmail(email) {
1226
1223
  * `keccak256(namespace + ":" + normalizeSafeSaltEmail(email))`.
1227
1224
  *
1228
1225
  * Namespace defaults to `CAPXUL_SAFE_SALT_NAMESPACE`
1229
- * (`"capxul:staging:email:v1"`) — the current Capxul scheme. Pass a
1226
+ * (`"capxul:staging:email:v2"`) — the current Capxul scheme. Pass a
1230
1227
  * different namespace only for pinned pre-v2 artifacts
1231
1228
  * (`CAPXUL_SAFE_SALT_NAMESPACE_V1`, faucet Safe) or when bumping the scheme.
1232
1229
  *
@@ -1235,7 +1232,7 @@ function normalizeSafeSaltEmail(email) {
1235
1232
  * @returns The Capxul-namespaced salt nonce as a `bigint`
1236
1233
  */
1237
1234
  function computeCapxulSafeSaltNonce(input) {
1238
- const namespace = input.namespace ?? "capxul:staging:email:v1";
1235
+ const namespace = input.namespace ?? "capxul:staging:email:v2";
1239
1236
  const normalizedEmail = normalizeSafeSaltEmail(input.email);
1240
1237
  return BigInt(keccak256(toBytes(`${namespace}:${normalizedEmail}`)));
1241
1238
  }
@@ -1411,6 +1408,17 @@ function normalizeBindingEmail(email) {
1411
1408
  return normalizeSafeSaltEmail(email);
1412
1409
  }
1413
1410
  //#endregion
1411
+ //#region ../config/src/role-dsl.ts
1412
+ const ADMIN_ROLE_LABEL = "Admin";
1413
+ function normalizeOrgRoleLabel(label) {
1414
+ const normalized = label.trim().replace(/\s+/g, " ");
1415
+ if (normalized.length === 0) throw Errors.invalidInput("role.label", "must be a non-empty role label");
1416
+ return normalized;
1417
+ }
1418
+ function orgRoleKeyForLabel(label) {
1419
+ return keccak256(toBytes(normalizeOrgRoleLabel(label).toLowerCase()));
1420
+ }
1421
+ //#endregion
1414
1422
  //#region ../config/src/capxul-payments-v2.ts
1415
1423
  /** The exact compiled CapxulPaymentsV2 ABI. */
1416
1424
  const CAPXUL_PAYMENTS_V2_ABI = [
@@ -2056,38 +2064,6 @@ const CAPXUL_PAYMENTS_V2_ABI = [
2056
2064
  ];
2057
2065
  /** Immutable CapxulPaymentsV2 deployment on Base Sepolia. */
2058
2066
  const CAPXUL_PAYMENTS_V2_ADDRESS = "0x7a5c25aB7ce91d7a475B71cd1ec33E230291f8a4";
2059
- //#endregion
2060
- //#region ../config/src/route.ts
2061
- /** USDX on Base Sepolia — the only settlement token in v1. */
2062
- const USDX_BASE_SEPOLIA_TOKEN = {
2063
- chainId: BASE_SEPOLIA_CHAIN_ID,
2064
- address: USDX_ADDRESS_BASE_SEPOLIA,
2065
- decimals: 6
2066
- };
2067
- USDX_BASE_SEPOLIA_TOKEN.chainId;
2068
- USDX_BASE_SEPOLIA_TOKEN.chainId;
2069
- 10n ** BigInt(6);
2070
- /**
2071
- * The bootstrap manage role. It administers people and roles, cannot spend,
2072
- * and is not a signer of the Organization Safe; "Owner" implied the latter,
2073
- * so the label is Admin (ruled 2026-09-06).
2074
- */
2075
- const ADMIN_ROLE_LABEL = "Admin";
2076
- function normalizeOrgRoleLabel(label) {
2077
- const normalized = label.trim().replace(/\s+/g, " ");
2078
- if (normalized.length === 0) throw Errors.invalidInput("role.label", "must be a non-empty role label");
2079
- return normalized;
2080
- }
2081
- function orgRoleKeyForLabel(label) {
2082
- return keccak256(toBytes(normalizeOrgRoleLabel(label).toLowerCase()));
2083
- }
2084
- padHex(stringToHex("FM_DAILY"), {
2085
- size: 32,
2086
- dir: "right"
2087
- }), padHex(stringToHex("TL_DAILY"), {
2088
- size: 32,
2089
- dir: "right"
2090
- });
2091
2067
  padHex(concat([MULTI_SEND_CALL_ONLY, "0x8d80ff0a"]), {
2092
2068
  dir: "right",
2093
2069
  size: 32
@@ -2100,9 +2076,9 @@ function paymentsV2Signature(name) {
2100
2076
  paymentsV2Signature("send");
2101
2077
  paymentsV2Signature("sendBatch");
2102
2078
  paymentsV2Signature("createCommitment");
2103
- paymentsV2Signature("cancel");
2104
- paymentsV2Signature("redirect");
2105
- new Map([
2079
+ //#endregion
2080
+ //#region ../config/src/org-bootstrap.ts
2081
+ const ROLE_AUTHORITY_EVENT_BY_FUNCTION_SELECTOR = new Map([
2106
2082
  ["assignRoles(address,bytes32[],bool[])", "AssignRoles(address,bytes32[],bool[])"],
2107
2083
  ["allowTarget(bytes32,address,uint8)", "AllowTarget(bytes32,address,uint8)"],
2108
2084
  ["scopeTarget(bytes32,address)", "ScopeTarget(bytes32,address)"],
@@ -2112,6 +2088,8 @@ new Map([
2112
2088
  ["revokeFunction(bytes32,address,bytes4)", "RevokeFunction(bytes32,address,bytes4)"],
2113
2089
  ["setAllowance(bytes32,uint128,uint128,uint128,uint64,uint64)", "SetAllowance(bytes32,uint128,uint128,uint128,uint64,uint64)"]
2114
2090
  ].map(([functionSignature, eventSignature]) => [toFunctionSelector(functionSignature), toEventSelector(eventSignature)]));
2091
+ toEventSelector("AssignRoles(address,bytes32[],bool[])");
2092
+ new Set([...ROLE_AUTHORITY_EVENT_BY_FUNCTION_SELECTOR.values()].map((topic) => topic.toLowerCase()));
2115
2093
  //#endregion
2116
2094
  //#region src/ports/auth-client.ts
2117
2095
  var AuthClientError = class extends Data.TaggedError("AuthClientError") {};
@@ -2489,4 +2467,4 @@ function readExchange(body) {
2489
2467
  };
2490
2468
  }
2491
2469
  //#endregion
2492
- export { toOrgId as $, EVM_ADDRESS_RE as A, redactUrlSecrets as At, toAssetId as B, APP_ID_RE as C, failureFingerprint as Ct, CLIENT_REQUEST_ID_RE as D, containsSensitiveMaterial as Dt, CLIENT_GRANT_ID_RE as E, revertSummaryText as Et, currencySymbolFor as F, toCurrencyCode as G, toBudgetId as H, toAccountId as I, toEpochMs as J, toDurationMs as K, toAddress as L, WEI_RE as M, ZERO_BYTES32 as N, COUNTRY_CODE_RE as O, isCredentialField as Ot, assetIdFor as P, toKycTier as Q, toAllowedOrigin as R, ACCOUNT_ID_RE as S, decodeChainCause as St, BYTES32_RE as T, isFailureMode as Tt, toChainId as U, toAuthUserId as V, toCountryCode as W, toHandle as X, toEpochSeconds as Y, toJwtToken as Z, normalizeBindingEmail as _, CHAIN_UPSTREAMS as _t, parseAuthSession as a, toSessionToken as at, CONFIGURED_MONEY_ASSETS as b, chainCauseProperties as bt, AuthCachePortTag as c, toWeiAmount as ct, authClientPortFromPromiseAdapter as d, decodeConvexError as dt, toPartyId as et, AuthClientError as f, CAPXUL_ERROR_CODES as ft, CAPXUL_PAYMENTS_V2_ADDRESS as g, isCapxulError as gt, orgRoleKeyForLabel as h, Errors as ht, BrowserAuthCacheAdapter as i, toRoleKey as it, SUPPORTED_CURRENCY_CODES as j, EMAIL_RE as k, redactSecrets as kt, SystemClockLayer as l, validateHandle as lt, ADMIN_ROLE_LABEL as m, EXPECTED_OPERATION_OUTCOMES as mt, readClockNow as n, toPayrollRunId as nt, parseCachedJwt as o, toTesterKind as ot, AuthClientPortTag as p, CapxulError as pt, toEmail as q, InMemoryAuthCacheAdapter as r, toPublishableKey as rt, AuthCacheError as s, toTxHash as st, oauthBearerAuthClient as t, toPayrollGroupId as tt, ClockPortTag as u, HANDLE_RE as ut, BASE_SEPOLIA_CHAIN_ID as v, FAILURE_MODES as vt, ASSET_ID_RE as w, isChainUpstream as wt, configuredMoneyAssetById as x, chainEvidenceLabel as xt, deriveCapxulSafeAddress as y, boundedResponseHeaders as yt, toAppId as z };
2470
+ export { toJwtToken as $, COUNTRY_CODE_RE as A, revertSummaryText as At, toAllowedOrigin as B, configuredMoneyAssetById as C, boundedResponseHeaders as Ct, BYTES32_RE as D, failureFingerprint as Dt, ASSET_ID_RE as E, decodeChainCause as Et, ZERO_BYTES32 as F, toChainId as G, toAssetId as H, assetIdFor as I, toDurationMs as J, toCountryCode as K, currencySymbolFor as L, EVM_ADDRESS_RE as M, isCredentialField as Mt, SUPPORTED_CURRENCY_CODES as N, redactSecrets as Nt, CLIENT_GRANT_ID_RE as O, isChainUpstream as Ot, WEI_RE as P, redactUrlSecrets as Pt, toHandle as Q, toAccountId as R, TOKENS as S, FAILURE_MODES as St, APP_ID_RE as T, chainEvidenceLabel as Tt, toAuthUserId as U, toAppId as V, toBudgetId as W, toEpochMs as X, toEmail as Y, toEpochSeconds as Z, normalizeBindingEmail as _, CapxulError as _t, parseAuthSession as a, toPermissionAssignmentId as at, CONFIGURED_MONEY_ASSETS as b, isCapxulError as bt, AuthCachePortTag as c, toRoleKey as ct, authClientPortFromPromiseAdapter as d, toTxHash as dt, toKycTier as et, AuthClientError as f, toWeiAmount as ft, orgRoleKeyForLabel as g, CAPXUL_ERROR_CODES as gt, ADMIN_ROLE_LABEL as h, decodeConvexError as ht, BrowserAuthCacheAdapter as i, toPayrollRunId as it, EMAIL_RE as j, containsSensitiveMaterial as jt, CLIENT_REQUEST_ID_RE as k, isFailureMode as kt, SystemClockLayer as l, toSessionToken as lt, CAPXUL_PAYMENTS_V2_ADDRESS as m, HANDLE_RE as mt, readClockNow as n, toPartyId as nt, parseCachedJwt as o, toPermissionId as ot, AuthClientPortTag as p, validateHandle as pt, toCurrencyCode as q, InMemoryAuthCacheAdapter as r, toPayrollGroupId as rt, AuthCacheError as s, toPublishableKey as st, oauthBearerAuthClient as t, toOrgId as tt, ClockPortTag as u, toTesterKind as ut, BASE_SEPOLIA_CHAIN_ID as v, EXPECTED_OPERATION_OUTCOMES as vt, ACCOUNT_ID_RE as w, chainCauseProperties as wt, SYNTHETIC_TEST_ASSET_FIXTURES as x, CHAIN_UPSTREAMS as xt, deriveCapxulSafeAddress as y, Errors as yt, toAddress as z };
@@ -254,6 +254,7 @@ declare const Errors: {
254
254
  readonly method: string;
255
255
  readonly currentState: string;
256
256
  readonly validStates: readonly string[];
257
+ readonly organizationId?: string;
257
258
  }) => CapxulError;
258
259
  };
259
260
  //#endregion
@@ -311,9 +312,9 @@ type Money = {
311
312
  type Account$1 = {
312
313
  readonly id: AccountId;
313
314
  readonly balances: readonly AccountPosition[];
314
- /** Fiat valuation of `balances`. Never a token quantity. */
315
- readonly balance: Money;
316
- readonly available: Money;
315
+ /** Fiat valuation of `balances`. `null` means at least one position has no rate. */
316
+ readonly balance: Money | null;
317
+ readonly available: Money | null;
317
318
  };
318
319
  /**
319
320
  * One asset position on an Account. `asset` is the identity; `symbol` and
@@ -391,8 +392,10 @@ declare const SUPPORTED_CURRENCIES: readonly [{
391
392
  }];
392
393
  type SupportedCurrencyCode = (typeof SUPPORTED_CURRENCIES)[number]["code"];
393
394
  declare function toAddress(raw: unknown): Address$1;
395
+ declare function toAccountId(raw: unknown): AccountId;
394
396
  declare function toPartyId(raw: unknown): PartyId;
395
397
  declare function toHandle(raw: unknown): Handle;
398
+ declare function toOrgId(raw: unknown): OrgId;
396
399
  declare function toCountryCode(raw: unknown): CountryCode;
397
400
  //#endregion
398
401
  //#region ../config/src/capxul-payments-v2.d.ts
@@ -642,4 +645,4 @@ interface OAuthBearerAuthClientInput {
642
645
  */
643
646
  declare function oauthBearerAuthClient(input: OAuthBearerAuthClientInput): AuthClientPort;
644
647
  //#endregion
645
- export { OrgId as $, Address$1 as A, RevertSummary as At, BudgetId as B, AuthCachePort as C, Failure as Ct, Account$1 as D, ChainUpstream as Dt, CAPXUL_PAYMENTS_V2_ADDRESS as E, ChainCause as Et, AssetAmount as F, CurrencyCode as G, ClientGrantId as H, AssetId as I, EVM_ADDRESS_RE as J, DocumentHash as K, AuthSession as L, AllowedOrigin as M, AnonymousDistinctId as N, AccountId as O, FAILURE_MODES as Ot, AppId as P, Money as Q, AuthUserId as R, AuthCacheError as S, Errors as St, CachedJwt as T, CHAIN_UPSTREAMS as Tt, ClientRequestId as U, ChainId as V, CountryCode as W, EpochMs as X, Email as Y, Handle as Z, Session as _, toPartyId as _t, Eip1193RequestProvider as a, PermissionId as at, AuthClientPort as b, CapxulErrorCode as bt, injectedWalletSigner as c, RoleKey as ct, AccountRequirement as d, TesterKind as dt, PartyId as et, Eip1193Provider as f, TxHash as ft, Profile as g, toHandle as gt, CapxulResult as h, toCountryCode as ht, CapxulSigner as i, PermissionAssignmentId as it, AllowanceKey as j, AccountPosition as k, FailureMode as kt, AccountProvider as l, SessionToken as lt, localPrivateKeyAccountProvider as m, toAddress as mt, oauthBearerAuthClient as n, PayrollGroupId as nt, SignerStatus as o, Profile$1 as ot, eip1193AccountProvider as p, WeiAmount as pt, DurationMs as q, CapxulDigestSigner as r, PayrollRunId as rt, SignerStatusStore as s, PublishableKey as st, OAuthBearerAuthClientInput as t, PaymentCommandId as tt, AccountProviderSource as u, SmartAccount$1 as ut, SmartAccount as v, CAPXUL_ERROR_CODES as vt, AuthCachePortTag as w, isCapxulError as wt, CanSendOtpStatus as x, CapxulErrorDetails as xt, ClockPort as y, CapxulError as yt, BlockNumber as z };
648
+ export { OrgId as $, Address$1 as A, FAILURE_MODES as At, BudgetId as B, AuthCachePort as C, CapxulErrorDetails as Ct, Account$1 as D, CHAIN_UPSTREAMS as Dt, CAPXUL_PAYMENTS_V2_ADDRESS as E, isCapxulError as Et, AssetAmount as F, CurrencyCode as G, ClientGrantId as H, AssetId as I, EVM_ADDRESS_RE as J, DocumentHash as K, AuthSession as L, AllowedOrigin as M, RevertSummary as Mt, AnonymousDistinctId as N, AccountId as O, ChainCause as Ot, AppId as P, Money as Q, AuthUserId as R, AuthCacheError as S, CapxulErrorCode as St, CachedJwt as T, Failure as Tt, ClientRequestId as U, ChainId as V, CountryCode as W, EpochMs as X, Email as Y, Handle as Z, Session as _, toHandle as _t, Eip1193RequestProvider as a, PermissionId as at, AuthClientPort as b, CAPXUL_ERROR_CODES as bt, injectedWalletSigner as c, RoleKey as ct, AccountRequirement as d, TesterKind as dt, PartyId as et, Eip1193Provider as f, TxHash as ft, Profile as g, toCountryCode as gt, CapxulResult as h, toAddress as ht, CapxulSigner as i, PermissionAssignmentId as it, AllowanceKey as j, FailureMode as jt, AccountPosition as k, ChainUpstream as kt, AccountProvider as l, SessionToken as lt, localPrivateKeyAccountProvider as m, toAccountId as mt, oauthBearerAuthClient as n, PayrollGroupId as nt, SignerStatus as o, Profile$1 as ot, eip1193AccountProvider as p, WeiAmount as pt, DurationMs as q, CapxulDigestSigner as r, PayrollRunId as rt, SignerStatusStore as s, PublishableKey as st, OAuthBearerAuthClientInput as t, PaymentCommandId as tt, AccountProviderSource as u, SmartAccount$1 as ut, SmartAccount as v, toOrgId as vt, AuthCachePortTag as w, Errors as wt, CanSendOtpStatus as x, CapxulError as xt, ClockPort as y, toPartyId as yt, BlockNumber as z };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as OrgId, A as Address, At as RevertSummary, B as BudgetId, D as Account, Dt as ChainUpstream, E as CAPXUL_PAYMENTS_V2_ADDRESS, Et as ChainCause, F as AssetAmount, G as CurrencyCode, I as AssetId, J as EVM_ADDRESS_RE, L as AuthSession, O as AccountId, Ot as FAILURE_MODES, Q as Money, R as AuthUserId, St as Errors, Tt as CHAIN_UPSTREAMS, V as ChainId, W as CountryCode, Z as Handle, _ as Session, _t as toPartyId, a as Eip1193RequestProvider, bt as CapxulErrorCode, c as injectedWalletSigner, ct as RoleKey, d as AccountRequirement, dt as TesterKind, et as PartyId, f as Eip1193Provider, g as Profile, gt as toHandle, h as CapxulResult, ht as toCountryCode, i as CapxulSigner, kt as FailureMode, l as AccountProvider, m as localPrivateKeyAccountProvider, mt as toAddress, nt as PayrollGroupId, o as SignerStatus, p as eip1193AccountProvider, r as CapxulDigestSigner, rt as PayrollRunId, s as SignerStatusStore, u as AccountProviderSource, v as SmartAccount, vt as CAPXUL_ERROR_CODES, wt as isCapxulError, xt as CapxulErrorDetails, yt as CapxulError } from "./OAuthBearerAuthClient-BAxoi3SD.mjs";
2
- import { $ as OrganizationPaymentBatchInput, $n as PAYMENT_DIRECTIONS, $t as Destination, A as OrgScopedMethods, An as Ref, At as AddressBookAddInput, B as AuthorizeRunOptions, Bn as SmartAccountMethods, Bt as ActivityFilter, C as CurrentUserMethods, Cn as PaymentMoney, Ct as AccountMethods, D as MemberStatus, Dn as PaymentsMethods, Dt as ActorRequest, E as InviteMemberInput, En as PaymentType, Et as ActorRelationshipMethods, F as ResendInviteTokenInput, Fn as AccountLifecycle, Ft as InboxItem, G as PayrollGroupsMethods, Gn as OrgSetupStep, Gt as ActivityPage, H as PayrollGroup, Hn as AccountSetupPolicy, Ht as ActivityKind, I as RoleDefinition, In as AccountSetupStep, It as InboxMethods, J as PayrollRun, Jn as ActorRef, Jt as ActivitySummary, K as PayrollMethods, Kn as PayoutAddress, Kt as ActivityRange, L as RoleSpendCap, Ln as isSettingUpLifecycle, Lt as ActivityAnnotation, M as OrgView, Mn as TargetReference, Mt as AddressBookLabelInput, N as OrganizationAccount, Nn as TargetsMethods, Nt as AddressBookMethods, O as MemberView, On as PaymentsPayInput, Ot as ActorRequestIssueInput, P as OrganizationAuditLogItem, Pn as fingerprintPaymentIntent, Pt as InboxApproveInput, Q as PayrollTermsUnit, Qn as InboxStatus, Qt as DepositInstructions, R as RoleView, Rn as CompleteProfileInput, Rt as ActivityAnnotationInput, S as CurrentUserContext, Sn as PaymentDocumentsMethods, St as ReadyAccountLifecycle, T as DetectPendingOrgInvitationsResult, Tn as PaymentTiming, Tt as ActorProfileMethods, U as PayrollGroupInput, Un as ClientRequests, Ut as ActivityListParams, V as PayrollEngagementTerms, Vn as AuthMethods, Vt as ActivityItem, W as PayrollGroupMember, Wn as OrgLifecycle, Wt as ActivityMethods, X as PayrollRunStatus, Xn as Permission, Xt as ActivitySummaryTotal, Y as PayrollRunItemInput, Yn as CurrentHoldings, Yt as ActivitySummaryParams, Z as PayrollRuns, Zn as SubmittedPermissionExecution, Zt as ActorReference, _ as HoldingsMethods, _n as PaymentDirection, _r as InvocationControls, _t as OnboardingMethods, a as ObservationContext, an as DestinationRemoveInput, at as PermissionCreateInput, b as SystemHealth, bn as PaymentDocumentRender, bt as PersonOnboarding, c as HostObservability, cn as MeMethods, cr as IdentityEvent, ct as PermissionReplaceInput, d as postHogObservability, dn as OfframpMethods, dr as Readiness, dt as Budget, en as DestinationAddInput, er as PAYMENT_STATUSES, et as OrganizationPaymentInput, f as CapxulClient, fn as OfframpQuote, fr as StateLabel, ft as OrgMe, g as IdentityRuntimeSendResult, gn as PaymentActivityEvidence, gr as IdentityTransition, gt as CompletedPersonProfile, h as IdentityRuntime, hn as Payment, hr as isRestoring, ht as AccountsMethods, i as ObservationAdapter, in as DestinationRail, it as PermissionChangeInput, j as OrgTemplate, jn as ResolvedTarget, jt as AddressBookEntry, k as OrgMethods, kn as RecipientResolution, kt as ActorRequestsMethods, l as PostHogObservabilityClient, ln as MeProfile, lr as IdentityState, lt as PermissionRevokeInput, m as IdentityProfileDetails, mn as OfframpStatus, mr as isClaimed, mt as OrgMeOptions, nn as DestinationListInput, nr as RequestStatus, nt as OrganizationPaymentsMethods, o as ObservationDelivery, on as DestinationsMethods, or as TelemetryPort, ot as PermissionMethods, p as CreateCapxulClientInput, pn as OfframpQuoteInput, pr as destination, pt as OrgMeMethod, q as PayrollOptions, qn as ClientRequestView, qt as ActivityReference, r as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, rn as DestinationPayload, rt as PermissionAssignInput, s as SdkFailureObservation, sn as FinancialOpsMethods, sr as Destination$1, st as PermissionOptions, t as CapxulClientInput, tn as DestinationKind, tr as PaymentStatus$1, tt as OrganizationPaymentItemInput, u as PostHogObservabilityOptions, un as MovementActivityEvidence, ur as OrgLane, ut as PermissionReadResult, v as Holding, vn as PaymentDocumentKind, vt as OrganizationOnboarding, w as CreateOrgInput, wn as PaymentStatus, wt as ActorProfile, x as MediaMethods, xn as PaymentDocumentVerification, xt as PersonOnboardingInput, y as SystemMethods, yn as PaymentDocumentRef, yt as OrganizationOnboardingInput, z as AuthorizeRunInput, zn as IdentityMethods, zt as ActivityDetail } from "./production-DAhaxUik.mjs";
1
+ import { $ as OrgId, A as Address, At as FAILURE_MODES, B as BudgetId, Ct as CapxulErrorDetails, D as Account, Dt as CHAIN_UPSTREAMS, E as CAPXUL_PAYMENTS_V2_ADDRESS, Et as isCapxulError, F as AssetAmount, G as CurrencyCode, I as AssetId, J as EVM_ADDRESS_RE, L as AuthSession, Mt as RevertSummary, O as AccountId, Ot as ChainCause, Q as Money, R as AuthUserId, St as CapxulErrorCode, V as ChainId, W as CountryCode, Z as Handle, _ as Session, _t as toHandle, a as Eip1193RequestProvider, bt as CAPXUL_ERROR_CODES, c as injectedWalletSigner, ct as RoleKey, d as AccountRequirement, dt as TesterKind, et as PartyId, f as Eip1193Provider, g as Profile, gt as toCountryCode, h as CapxulResult, ht as toAddress, i as CapxulSigner, jt as FailureMode, kt as ChainUpstream, l as AccountProvider, m as localPrivateKeyAccountProvider, mt as toAccountId, nt as PayrollGroupId, o as SignerStatus, p as eip1193AccountProvider, r as CapxulDigestSigner, rt as PayrollRunId, s as SignerStatusStore, u as AccountProviderSource, v as SmartAccount, vt as toOrgId, wt as Errors, xt as CapxulError, yt as toPartyId } from "./OAuthBearerAuthClient-B7Nbepmu.mjs";
2
+ import { $ as PayrollRun, $n as CurrentPolicy, $t as ActivityRange, A as InviteMemberInput, An as PaymentTiming, At as AccountMethods, B as OrganizationAuditLogItem, Bn as AccountLifecycle, Bt as AddressBookMethods, C as SystemHealth, Cn as PaymentActivityEvidence, Cr as StateLabel, Ct as OrganizationOnboarding, D as AssignmentProjection, Dn as PaymentDocumentsMethods, Dr as IdentityTransition, Dt as PersonOnboarding, E as CurrentUserMethods, En as PaymentDocumentRef, Er as isRestoring, Et as OrganizationOnboardingState, F as OrgScopedMethods, Fn as Ref, Ft as ActorRequestIssueInput, G as AuthorizeRunOptions, Gn as SmartAccountMethods, Gt as ActivityAnnotationInput, H as RoleDefinition, Hn as isSettingUpLifecycle, Ht as InboxItem, I as OrgTemplate, In as ResolvedTarget, It as ActorRequestsMethods, J as PayrollGroupInput, Jn as ClientRequests, Jt as ActivityItem, K as PayrollEngagementTerms, Kn as AuthMethods, Kt as ActivityDetail, L as OrgView, Ln as TargetReference, Lt as AddressBookAddInput, M as MemberStatus, Mn as PaymentsMethods, Mt as ActorProfileMethods, N as MemberView, Nn as PaymentsPayInput, Nt as ActorRelationshipMethods, O as CreateOrgInput, On as PaymentMoney, Or as InvocationControls, Ot as PersonOnboardingInput, P as OrgMethods, Pn as RecipientResolution, Pt as ActorRequest, Q as PayrollOptions, Qn as AuthorityRef, Qt as ActivityPage, R as OrganizationAccess, Rn as TargetsMethods, Rt as AddressBookEntry, S as SystemMethods, Sn as Payment, Sr as Readiness, St as OnboardingMethods, T as CurrentUserContext, Tn as PaymentDocumentKind, Tr as isClaimed, Tt as OrganizationOnboardingOptions, U as RoleView, Un as CompleteProfileInput, Ut as InboxMethods, V as ResendInviteTokenInput, Vn as AccountSetupStep, Vt as InboxApproveInput, W as AuthorizeRunInput, Wn as IdentityMethods, Wt as ActivityAnnotation, X as PayrollGroupsMethods, Xn as OrgSetupStep, Xt as ActivityListParams, Y as PayrollGroupMember, Yn as OrgLifecycle, Yt as ActivityKind, Z as PayrollMethods, Zn as PayoutAddress, Zt as ActivityMethods, _ as CreateCapxulClientInput, _n as MovementActivityEvidence, _r as TelemetryPort, _t as OrgMe, a as ObservationContext, an as DepositInstructions, ar as ActorRef, at as OrganizationPaymentInput, b as IdentityRuntimeSendResult, bn as OfframpQuoteInput, br as IdentityState, bt as AccountsMethods, c as HostObservability, cn as DestinationKind, cr as SubmittedPermissionExecution, ct as PermissionAssignInput, d as postHogObservability, dn as DestinationRail, dr as PAYMENT_STATUSES, dt as PermissionMethods, en as ActivityReference, er as ClientRequestView, et as PayrollRunItemInput, f as OpenfortBrowserAuth, fn as DestinationRemoveInput, fr as PaymentStatus$1, ft as PermissionOptions, g as CapxulClient, gn as MeProfile, gt as Budget, h as createOpenfortBrowserSigner, hn as MeMethods, ht as PermissionReadResult, i as ObservationAdapter, in as ActorReference, ir as PaymentDocumentVerification, it as OrganizationPaymentBatchInput, j as MemberIdentityProjection, jn as PaymentType, jt as ActorProfile, k as DetectPendingOrgInvitationsResult, kn as PaymentStatus, kt as ReadyAccountLifecycle, l as PostHogObservabilityClient, ln as DestinationListInput, lr as InboxStatus, lt as PermissionChangeInput, m as OpenfortBrowserSignerBootstrap, mn as FinancialOpsMethods, mt as PermissionRevokeInput, nn as ActivitySummaryParams, nr as PaymentDocumentReadRef, nt as PayrollRuns, o as ObservationDelivery, on as Destination, or as CurrentHoldings, ot as OrganizationPaymentItemInput, p as OpenfortBrowserSigner, pn as DestinationsMethods, pr as RequestStatus, pt as PermissionReplaceInput, q as PayrollGroup, qn as AccountSetupPolicy, qt as ActivityFilter, r as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, rn as ActivitySummaryTotal, rr as PaymentDocumentRender, rt as PayrollTermsUnit, s as SdkFailureObservation, sn as DestinationAddInput, sr as Permission, st as OrganizationPaymentsMethods, t as CapxulClientInput, tn as ActivitySummary, tr as PaymentDocumentDownload, tt as PayrollRunStatus, u as PostHogObservabilityOptions, un as DestinationPayload, ur as PAYMENT_DIRECTIONS, ut as PermissionCreateInput, v as IdentityProfileDetails, vn as OfframpMethods, vr as Destination$1, vt as OrgMeMethod, w as MediaMethods, wn as PaymentDirection, wr as destination, wt as OrganizationOnboardingInput, x as HoldingsMethods, xn as OfframpStatus, xr as OrgLane, xt as CompletedPersonProfile, y as IdentityRuntime, yn as OfframpQuote, yr as IdentityEvent, yt as OrgMeOptions, z as OrganizationAccount, zn as fingerprintPaymentIntent, zt as AddressBookLabelInput } from "./production-pLe7MsUo.mjs";
3
3
  import { Hex } from "viem";
4
4
  import { Effect, Layer } from "effect";
5
5
  //#region ../errors/src/index.d.ts
@@ -10,12 +10,11 @@ declare const HANDLE_RE: RegExp;
10
10
  /**
11
11
  * Where a registry row's liquidity comes from. `synthetic-test-liquidity`
12
12
  * marks an owned fixture whose balances and rates are authored inputs, never
13
- * market or provider data. `legacy` marks the preserved USDX rail, which the
14
- * live write path still settles until the named-asset writer replaces it.
13
+ * market or provider data.
15
14
  * Admission — which rows a treasury read returns — is `CONFIGURED_MONEY_ASSETS`,
16
15
  * not this field; an owned fixture is a settlement asset.
17
16
  */
18
- type AssetSource = "synthetic-test-liquidity" | "legacy";
17
+ type AssetSource = "synthetic-test-liquidity";
19
18
  /** Canonical metadata. A missing peg does not imply a missing market price. */
20
19
  interface AssetMetadata {
21
20
  readonly assetId: AssetId;
@@ -27,6 +26,14 @@ interface AssetMetadata {
27
26
  readonly deploymentStartBlock: number;
28
27
  readonly source: AssetSource;
29
28
  }
29
+ /** Public AssetIds for the admitted Base Sepolia test assets. */
30
+ declare const TOKENS: Readonly<{
31
+ BASE_SEPOLIA: Readonly<{
32
+ CAPXUL_TEST_USDC: AssetId;
33
+ CAPXUL_TEST_USDT: AssetId;
34
+ CAPXUL_TEST_WETH: AssetId;
35
+ }>;
36
+ }>;
30
37
  //#endregion
31
38
  //#region ../observability/src/operations.d.ts
32
39
  declare const CAPXUL_OPERATIONS: {
@@ -157,7 +164,6 @@ declare const CAPXUL_OPERATIONS: {
157
164
  };
158
165
  readonly holdings: {
159
166
  readonly current: "holdings.current";
160
- readonly primary: "holdings.primary";
161
167
  };
162
168
  readonly indexer: {
163
169
  readonly reconcile: "indexer.reconcile";
@@ -359,6 +365,7 @@ declare const CAPXUL_OPERATIONS: {
359
365
  readonly submitExecution: "payments.submitExecution";
360
366
  };
361
367
  readonly paymentDocuments: {
368
+ readonly get: "paymentDocuments.get";
362
369
  readonly render: "paymentDocuments.render";
363
370
  readonly verify: "paymentDocuments.verify";
364
371
  };
@@ -515,10 +522,13 @@ declare function isMoneyParseError(value: AssetAmount | Money | MoneyParseError)
515
522
  declare function parseMoney(input: string, asset: Pick<Money, "currency" | "decimals">): Money | MoneyParseError;
516
523
  //#endregion
517
524
  //#region src/domain/money/asset-amount.d.ts
525
+ /** Exact scaling. This rejects excess precision instead of rounding it. */
526
+ declare function toRaw(amount: AssetAmount, asset: AssetMetadata): bigint;
518
527
  declare function parseAssetAmount(input: string, asset: AssetMetadata): AssetAmount | MoneyParseError;
519
528
  /** Display the full quantity. Only fiat formatting rounds for display. */
520
529
  declare function formatAssetAmount(amount: AssetAmount): string;
521
530
  declare function assetSymbolFor(asset: AssetId): string;
531
+ declare function requireAsset(id: AssetId): AssetMetadata;
522
532
  //#endregion
523
533
  //#region src/domain/money/valuation.d.ts
524
534
  interface Rate {
@@ -528,14 +538,21 @@ interface Rate {
528
538
  }
529
539
  /** Fiat balances use their currency directly, never an invented token identity. */
530
540
  type RateSource = (source: AssetMetadata | CurrencyCode, into: CurrencyCode) => Rate | null;
531
- declare const PEG_RATES: RateSource;
532
541
  interface Valuation<T extends AssetAmount | Money = AssetAmount | Money> {
533
542
  readonly total: Money | null;
534
543
  readonly counted: readonly T[];
535
544
  readonly unrated: readonly T[];
536
545
  }
537
546
  /** Sum exact fixed-point values. Missing rates never contribute zero. */
538
- declare function valueIn<T extends AssetAmount | Money>(amounts: readonly T[], displayCurrency: CurrencyCode, rates?: RateSource): Valuation<T>;
547
+ declare function valueIn<T extends AssetAmount | Money>(amounts: readonly T[], displayCurrency: CurrencyCode, rates: RateSource): Valuation<T>;
548
+ /** Value all Activity buckets. Compute net before display rounding. */
549
+ declare function valueActivitySummary(totals: readonly ActivitySummaryTotal[], displayCurrency?: CurrencyCode, rates?: RateSource): {
550
+ moneyIn: Money | null;
551
+ moneyOut: Money | null;
552
+ pending: Money | null;
553
+ net: Money | null;
554
+ unrated: ActivitySummaryTotal[];
555
+ };
539
556
  //#endregion
540
557
  //#region src/domain/money/account-positions.d.ts
541
558
  /**
@@ -683,4 +700,4 @@ declare function captureException(telemetry: TelemetryPort, error: unknown, cont
683
700
  */
684
701
  declare function captureExceptionSync(telemetry: TelemetryPort, error: unknown, context?: HandledErrorReportContext): void;
685
702
  //#endregion
686
- export { type Account, type AccountId, type AccountLifecycle, type AccountMethods, type AccountProvider, type AccountProviderSource, type AccountRequirement, type AccountSetupPolicy, type AccountSetupStep, type AccountsMethods, type ActivityAnnotation, type ActivityAnnotationInput, type ActivityDetail, type ActivityFilter, type ActivityItem, type ActivityKind, type ActivityListParams, type ActivityMethods, type ActivityPage, type ActivityPhase, type ActivityRange, type ActivityReference, type ActivitySummary, type ActivitySummaryParams, type ActivitySummaryTotal, type ActorProfile, type ActorProfileMethods, type ActorRef, type ActorReference, type ActorRelationshipMethods, type ActorRequest, type ActorRequestIssueInput, type ActorRequestsMethods, type Address, type AddressBookAddInput, type AddressBookEntry, type AddressBookLabelInput, type AddressBookMethods, type AssetAmount, type AssetId, type AssetMetadata, type AuthMethods, type AuthSession, type AuthUserId, type AuthorizeRunInput, type AuthorizeRunOptions, type Budget, type BudgetId, CAPXUL_ERROR_CODES, CAPXUL_OPERATIONS, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, CHAIN_UPSTREAMS, type CapxulClient, type CapxulClientInput, type CapxulDigestSigner, CapxulError, type CapxulErrorCode, type CapxulErrorDetails, type CapxulOperation, type CapxulResult, type CapxulSigner, type ChainCause, type ChainUpstream, type ClientRequestView, type ClientRequests, type CompleteProfileInput, type CompletedPersonProfile, 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, EVM_ADDRESS_RE, type Eip1193Provider, type Eip1193RequestProvider, Errors, FAILURE_MODES, type FailureMode, type FinancialOpsMethods, HANDLE_RE, type Handle, type HandledErrorReportContext, type Holding, 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 MovementActivityEvidence, type NormalizedCapxulOperation, type ObservationAdapter, type ObservationContext, type ObservationDelivery, type OfframpMethods, type OfframpQuote, type OfframpQuoteInput, type OfframpStatus, type OnboardingMethods, 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 OrganizationOnboarding, type OrganizationOnboardingInput, type OrganizationPaymentBatchInput, type OrganizationPaymentInput, type OrganizationPaymentItemInput, type OrganizationPaymentsMethods, PAYMENT_DIRECTIONS, PAYMENT_STATUSES, PEG_RATES, type PartyId, type Payment, type PaymentActivityEvidence, 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 PayoutAddress, type PayrollEngagementTerms, type PayrollGroup, type PayrollGroupId, type PayrollGroupInput, type PayrollGroupMember, type PayrollGroupsMethods, type PayrollMethods, type PayrollOptions, type PayrollRun, type PayrollRunId, type PayrollRunItemInput, type PayrollRunStatus, type PayrollRuns, type PayrollTermsUnit, type Permission, type PermissionAssignInput, type PermissionChangeInput, type PermissionCreateInput, type PermissionMethods, type PermissionOptions, type PermissionReadResult, type PermissionReplaceInput, type PermissionRevokeInput, type PersonOnboarding, type PersonOnboardingInput, type PostHogObservabilityClient, type PostHogObservabilityOptions, type Profile, type Rate, type RateSource, type Readiness, type ReadyAccountLifecycle, type RecipientResolution, type Ref, type ResendInviteTokenInput, type ResolvedTarget, type RevertSummary, 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, type TesterKind, type Valuation, assetSymbolFor, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, fingerprintPaymentIntent, formatAssetAmount, formatMoney, inboxPhase, injectedWalletSigner, isCapxulError, isCapxulOperation, isClaimed, isMoneyParseError, isRestoring, isSettingUpLifecycle, localPrivateKeyAccountProvider, normalizeCapxulOperation, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, parseAssetAmount, parseMoney, paymentPhase, positionPeg, postHogObservability, requestPhase, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress, toHandle, toPartyId, valueIn };
703
+ export { type Account, type AccountId, type AccountLifecycle, type AccountMethods, type AccountProvider, type AccountProviderSource, type AccountRequirement, type AccountSetupPolicy, type AccountSetupStep, type AccountsMethods, type ActivityAnnotation, type ActivityAnnotationInput, type ActivityDetail, type ActivityFilter, type ActivityItem, type ActivityKind, type ActivityListParams, type ActivityMethods, type ActivityPage, type ActivityPhase, type ActivityRange, type ActivityReference, type ActivitySummary, type ActivitySummaryParams, type ActivitySummaryTotal, type ActorProfile, type ActorProfileMethods, type ActorRef, type ActorReference, type ActorRelationshipMethods, type ActorRequest, type ActorRequestIssueInput, type ActorRequestsMethods, type Address, type AddressBookAddInput, type AddressBookEntry, type AddressBookLabelInput, type AddressBookMethods, type AssetAmount, type AssetId, type AssetMetadata, type AssignmentProjection, type AuthMethods, type AuthSession, type AuthUserId, type AuthorityRef, type AuthorizeRunInput, type AuthorizeRunOptions, type Budget, type BudgetId, CAPXUL_ERROR_CODES, CAPXUL_OPERATIONS, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, CHAIN_UPSTREAMS, type CapxulClient, type CapxulClientInput, type CapxulDigestSigner, CapxulError, type CapxulErrorCode, type CapxulErrorDetails, type CapxulOperation, type CapxulResult, type CapxulSigner, type ChainCause, type ChainUpstream, type ClientRequestView, type ClientRequests, type CompleteProfileInput, type CompletedPersonProfile, type CountryCode, type CreateCapxulClientInput, type CreateOrgInput, type CurrentHoldings, type CurrentPolicy, 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, EVM_ADDRESS_RE, type Eip1193Provider, type Eip1193RequestProvider, Errors, FAILURE_MODES, type FailureMode, type FinancialOpsMethods, HANDLE_RE, type Handle, type HandledErrorReportContext, 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 MemberIdentityProjection, type MemberStatus, type MemberView, type Money, type MoneyParseError, type MoneyParseErrorReason, type MovementActivityEvidence, type NormalizedCapxulOperation, type ObservationAdapter, type ObservationContext, type ObservationDelivery, type OfframpMethods, type OfframpQuote, type OfframpQuoteInput, type OfframpStatus, type OnboardingMethods, type OpenfortBrowserAuth, type OpenfortBrowserSigner, type OpenfortBrowserSignerBootstrap, 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 OrganizationAccess, type OrganizationAccount, type OrganizationAuditLogItem, type OrganizationOnboarding, type OrganizationOnboardingInput, type OrganizationOnboardingOptions, type OrganizationOnboardingState, type OrganizationPaymentBatchInput, type OrganizationPaymentInput, type OrganizationPaymentItemInput, type OrganizationPaymentsMethods, PAYMENT_DIRECTIONS, PAYMENT_STATUSES, type PartyId, type Payment, type PaymentActivityEvidence, type PaymentDirection, type PaymentDocumentDownload, type PaymentDocumentKind, type PaymentDocumentReadRef, type PaymentDocumentRef, type PaymentDocumentRender, type PaymentDocumentVerification, type PaymentDocumentsMethods, type PaymentMoney, type PaymentStatus, type PaymentTiming, type PaymentType, type PaymentsMethods, type PaymentsPayInput, type PayoutAddress, type PayrollEngagementTerms, type PayrollGroup, type PayrollGroupId, type PayrollGroupInput, type PayrollGroupMember, type PayrollGroupsMethods, type PayrollMethods, type PayrollOptions, type PayrollRun, type PayrollRunId, type PayrollRunItemInput, type PayrollRunStatus, type PayrollRuns, type PayrollTermsUnit, type Permission, type PermissionAssignInput, type PermissionChangeInput, type PermissionCreateInput, type PermissionMethods, type PermissionOptions, type PermissionReadResult, type PermissionReplaceInput, type PermissionRevokeInput, type PersonOnboarding, type PersonOnboardingInput, type PostHogObservabilityClient, type PostHogObservabilityOptions, type Profile, type Rate, type RateSource, type Readiness, type ReadyAccountLifecycle, type RecipientResolution, type Ref, type ResendInviteTokenInput, type ResolvedTarget, type RevertSummary, type RoleDefinition, type RoleKey, type RoleView, type SdkFailureObservation, type Session, type SignerStatus, type SignerStatusStore, type SmartAccount, type SmartAccountMethods, type StateLabel, type SubmittedPermissionExecution, type SystemHealth, type SystemMethods, TOKENS, type TargetReference, type TargetsMethods, type TelemetryPort, type TesterKind, type Valuation, assetSymbolFor, captureException, captureExceptionSync, createCapxulClient, createOpenfortBrowserSigner, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, fingerprintPaymentIntent, formatAssetAmount, formatMoney, inboxPhase, injectedWalletSigner, isCapxulError, isCapxulOperation, isClaimed, isMoneyParseError, isRestoring, isSettingUpLifecycle, localPrivateKeyAccountProvider, normalizeCapxulOperation, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, parseAssetAmount, parseMoney, paymentPhase, positionPeg, postHogObservability, requestPhase, requireAsset, destination as resolveIdentityDestination, toAccountId, toCountryCode, toAddress as toEvmAddress, toHandle, toOrgId, toPartyId, toRaw, valueActivitySummary, valueIn };