@capxul/sdk 4.0.1 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -440,12 +440,14 @@ const CAPXUL_OPERATIONS = {
440
440
  },
441
441
  activity: {
442
442
  annotate: "activity.annotate",
443
+ emitAnnotationSaved: "activity.emitAnnotationSaved",
443
444
  get: "activity.get",
444
445
  list: "activity.list",
445
446
  summary: "activity.summary"
446
447
  },
447
448
  addressBook: {
448
449
  add: "addressBook.add",
450
+ emitRelationshipChanged: "addressBook.emitRelationshipChanged",
449
451
  get: "addressBook.get",
450
452
  hide: "addressBook.hide",
451
453
  label: "addressBook.label",
@@ -1304,7 +1306,20 @@ const QuickPayExternalAddressAcknowledgedProps = Schema.Struct({
1304
1306
  external_address_acknowledged: Schema.Literal(true),
1305
1307
  organization_id: OptionalOrgId
1306
1308
  });
1307
- const DepositInitiatedProps = Schema.Struct({ ...TelemetryEnvelopeProps });
1309
+ const DepositInitiatedProps = Schema.Struct({
1310
+ ...TelemetryEnvelopeProps,
1311
+ scope_kind: Schema.optional(Schema.Literals(["account", "organization"])),
1312
+ account_kind: Schema.optional(Schema.Literals(["personalSafe", "orgTreasury"])),
1313
+ chain_id: Schema.optional(Schema.Number),
1314
+ network: Schema.optional(Schema.Literal("base-sepolia")),
1315
+ organization_id: OptionalOrgId,
1316
+ $groups: Schema.optional(Schema.Struct({ organization: OptionalOrgId })),
1317
+ actor_id: OptionalString,
1318
+ actor_kind: Schema.optional(Schema.Literal("authenticated")),
1319
+ distinct_id: OptionalString,
1320
+ trace_id: OptionalString,
1321
+ span_id: OptionalString
1322
+ });
1308
1323
  const DepositSettledProps = Schema.Struct({
1309
1324
  ...TelemetryEnvelopeProps,
1310
1325
  chain_id: Schema.Number,
@@ -1542,6 +1557,148 @@ Schema.Struct({
1542
1557
  name: Schema.Literal("movement_scan_incident"),
1543
1558
  props: MovementScanIncidentProps
1544
1559
  });
1560
+ const ActivityReferenceProps = {
1561
+ reference_kind: Schema.Literals(["payment", "movement"]),
1562
+ reference_id: Schema.String
1563
+ };
1564
+ const ActivityFilterProps = {
1565
+ filter_kind: Schema.optional(Schema.Literals([
1566
+ "all",
1567
+ "payment",
1568
+ "movement"
1569
+ ])),
1570
+ filter_direction: Schema.optional(Schema.Literals([
1571
+ "all",
1572
+ "in",
1573
+ "out",
1574
+ "self"
1575
+ ])),
1576
+ filter_status: Schema.optional(Schema.Array(Schema.Literals([
1577
+ "pending",
1578
+ "settling",
1579
+ "pending_claim",
1580
+ "scheduled",
1581
+ "streaming",
1582
+ "settled",
1583
+ "cancelled",
1584
+ "failed"
1585
+ ])))
1586
+ };
1587
+ const ActivityActionProps = {
1588
+ ...TelemetryEnvelopeProps,
1589
+ scope_kind: Schema.Literals(["account", "organization"]),
1590
+ reason_code: Schema.optional(Schema.Literals(CAPXUL_ERROR_CODES))
1591
+ };
1592
+ Schema.Struct({
1593
+ name: Schema.Literal("contact_relationship_changed"),
1594
+ props: Schema.Struct({
1595
+ ...TelemetryEnvelopeProps,
1596
+ change: Schema.Literals([
1597
+ "added",
1598
+ "renamed",
1599
+ "hidden",
1600
+ "restored"
1601
+ ]),
1602
+ scope_kind: Schema.Literals(["account", "organization"]),
1603
+ scope_id: Schema.String,
1604
+ owner_party_id: Schema.String,
1605
+ party_id: Schema.String,
1606
+ hidden: Schema.Boolean,
1607
+ occurred_at: Schema.Number,
1608
+ operation: Schema.Literals([
1609
+ CAPXUL_OPERATIONS.addressBook.add,
1610
+ CAPXUL_OPERATIONS.addressBook.label,
1611
+ CAPXUL_OPERATIONS.addressBook.hide,
1612
+ CAPXUL_OPERATIONS.addressBook.unhide
1613
+ ])
1614
+ })
1615
+ });
1616
+ const ContactActionProps = {
1617
+ ...TelemetryEnvelopeProps,
1618
+ scope_kind: Schema.Literals(["account", "organization"]),
1619
+ party_id: OptionalString,
1620
+ reason_code: Schema.optional(Schema.Literals(CAPXUL_ERROR_CODES))
1621
+ };
1622
+ Schema.Struct({
1623
+ name: Schema.Literal("ui_contact_action_completed"),
1624
+ props: Schema.Union([
1625
+ Schema.Struct({
1626
+ ...ContactActionProps,
1627
+ action: Schema.Literal("add"),
1628
+ outcome: Schema.Literals(["opened", "cancelled"])
1629
+ }),
1630
+ Schema.Struct({
1631
+ ...ContactActionProps,
1632
+ action: Schema.Literal("refusal"),
1633
+ outcome: Schema.Literal("displayed")
1634
+ }),
1635
+ Schema.Struct({
1636
+ ...ContactActionProps,
1637
+ action: Schema.Literal("retry"),
1638
+ outcome: Schema.Literal("requested")
1639
+ })
1640
+ ])
1641
+ });
1642
+ Schema.Struct({
1643
+ name: Schema.Literal("activity_annotation_saved"),
1644
+ props: Schema.Struct({
1645
+ ...TelemetryEnvelopeProps,
1646
+ ...ActivityReferenceProps,
1647
+ scope_kind: Schema.Literals(["account", "organization"]),
1648
+ scope_id: Schema.String,
1649
+ occurred_at: Schema.Number
1650
+ })
1651
+ });
1652
+ Schema.Struct({
1653
+ name: Schema.Literal("ui_activity_action_completed"),
1654
+ props: Schema.Union([
1655
+ Schema.Struct({
1656
+ ...ActivityActionProps,
1657
+ ...ActivityFilterProps,
1658
+ action: Schema.Literal("filter"),
1659
+ outcome: Schema.Literal("committed")
1660
+ }),
1661
+ Schema.Struct({
1662
+ ...ActivityActionProps,
1663
+ action: Schema.Literal("refusal"),
1664
+ outcome: Schema.Literal("displayed")
1665
+ }),
1666
+ Schema.Struct({
1667
+ ...ActivityActionProps,
1668
+ action: Schema.Literal("retry"),
1669
+ outcome: Schema.Literal("requested")
1670
+ }),
1671
+ Schema.Struct({
1672
+ ...ActivityActionProps,
1673
+ ...ActivityReferenceProps,
1674
+ action: Schema.Literal("detail"),
1675
+ outcome: Schema.Literals(["opened", "failed"])
1676
+ }),
1677
+ Schema.Struct({
1678
+ ...ActivityActionProps,
1679
+ ...ActivityReferenceProps,
1680
+ action: Schema.Literal("receipt"),
1681
+ outcome: Schema.Literals([
1682
+ "document_rendered",
1683
+ "explorer_opened",
1684
+ "popup_blocked",
1685
+ "failed"
1686
+ ])
1687
+ }),
1688
+ Schema.Struct({
1689
+ ...ActivityActionProps,
1690
+ ...ActivityFilterProps,
1691
+ action: Schema.Literal("export"),
1692
+ outcome: Schema.Literals([
1693
+ "completed",
1694
+ "partial",
1695
+ "failed"
1696
+ ]),
1697
+ row_count: Schema.optional(Schema.Number),
1698
+ truncated: Schema.optional(Schema.Boolean)
1699
+ })
1700
+ ])
1701
+ });
1545
1702
  function redactTelemetryEvent(event, options = {}) {
1546
1703
  const props = redactTelemetryProps(event.name, event.props, options);
1547
1704
  return props === void 0 ? { name: event.name } : {
@@ -4181,6 +4338,23 @@ function observationOnlyControls(controls) {
4181
4338
  const { signal: _signal, timeoutMs: _timeoutMs, deadlineMs: _deadlineMs, ...observation } = controls ?? {};
4182
4339
  return copyInvocationObservation(controls, observation);
4183
4340
  }
4341
+ /** Project only SDK-owned facts. A caller Organization hint is not authority. */
4342
+ function verifiedOperationFields(attributes) {
4343
+ const domain = {};
4344
+ const organizationId = attributes.get("verified_organization_id");
4345
+ if (typeof organizationId === "string" && safeEngineeringIdentifier(organizationId) !== void 0) domain.organization_id = organizationId;
4346
+ for (const [key, allowed] of [
4347
+ ["scope_kind", ["account", "organization"]],
4348
+ ["account_kind", ["personalSafe", "orgTreasury"]],
4349
+ ["network", ["base-sepolia"]]
4350
+ ]) {
4351
+ const value = attributes.get(key);
4352
+ if (typeof value === "string" && allowed.some((candidate) => candidate === value)) domain[key] = value;
4353
+ }
4354
+ const chainId = attributes.get("chain_id");
4355
+ if (typeof chainId === "number" && Number.isSafeInteger(chainId) && chainId > 0) domain.chain_id = chainId;
4356
+ return domain;
4357
+ }
4184
4358
  /** Observe a public Effect that already uses the canonical CapxulError channel. */
4185
4359
  async function runCapxulEffect(effect, controls, operation = CAPXUL_OPERATIONS.runtime.port, runPromise = Effect.runPromise) {
4186
4360
  const invocation = readInvocationObservation(controls);
@@ -4209,8 +4383,10 @@ async function runCapxulEffect(effect, controls, operation = CAPXUL_OPERATIONS.r
4209
4383
  const error = Exit.isFailure(exit) ? Cause.squash(exit.cause) : void 0;
4210
4384
  const failure = error instanceof CapxulError ? error : void 0;
4211
4385
  const outcome = Exit.isSuccess(exit) ? "succeeded" : failure?.code === "CANCELLED" ? "cancelled" : failure !== void 0 && EXPECTED_OPERATION_OUTCOMES.has(failure.code) ? "refused" : "failed";
4386
+ const span = yield* Effect.currentSpan.pipe(Effect.orDie);
4212
4387
  const completion = {
4213
4388
  ...fields,
4389
+ ...verifiedOperationFields(span.attributes),
4214
4390
  duration_ms,
4215
4391
  outcome,
4216
4392
  ...failure === void 0 ? {} : { failure_code: failure.code },
@@ -5043,7 +5219,7 @@ const moneyExecutionContract = {
5043
5219
  };
5044
5220
  //#endregion
5045
5221
  //#region package.json
5046
- var version = "4.0.1";
5222
+ var version = "4.1.1";
5047
5223
  //#endregion
5048
5224
  //#region src/telemetry/exception-projection.ts
5049
5225
  /** Fixed fallback for failures that have no safe message. */
@@ -5754,11 +5930,50 @@ function emitAccountBalanceFailed(telemetry, error) {
5754
5930
  }
5755
5931
  });
5756
5932
  }
5757
- function emitDepositInitiated(telemetry) {
5758
- return emitMoneyTelemetry(telemetry, {
5759
- name: "deposit_initiated",
5760
- props: {}
5761
- });
5933
+ /** A successful authorized instruction read, not an incoming transfer. */
5934
+ function emitDepositInitiated(telemetry, instructions, source, verifiedOrganizationId) {
5935
+ return Effect.gen(function* () {
5936
+ const organizationId = safeEngineeringIdentifier(verifiedOrganizationId);
5937
+ const fields = {
5938
+ scope_kind: organizationId === void 0 ? "account" : "organization",
5939
+ account_kind: organizationId === void 0 ? "personalSafe" : "orgTreasury",
5940
+ ...Number.isSafeInteger(instructions.chainId) && instructions.chainId > 0 ? { chain_id: instructions.chainId } : {},
5941
+ ...instructions.network === "base-sepolia" ? { network: instructions.network } : {},
5942
+ ...organizationId === void 0 ? {} : { verified_organization_id: organizationId }
5943
+ };
5944
+ yield* Effect.annotateCurrentSpan(fields);
5945
+ if (telemetry === void 0) return;
5946
+ const span = yield* Effect.currentSpan;
5947
+ const snapshot = readInvocationObservation(source);
5948
+ const { organizationId: _hint, ...context } = snapshot?.context ?? {};
5949
+ const event = {
5950
+ name: "deposit_initiated",
5951
+ props: {
5952
+ scope_kind: fields.scope_kind,
5953
+ account_kind: fields.account_kind,
5954
+ ...fields.chain_id === void 0 ? {} : { chain_id: fields.chain_id },
5955
+ ...fields.network === void 0 ? {} : { network: fields.network },
5956
+ $groups: organizationId === void 0 ? {} : { organization: organizationId },
5957
+ ...safeEngineeringIdentifier(snapshot?.actorId) === void 0 ? {} : {
5958
+ actor_id: snapshot.actorId,
5959
+ actor_kind: "authenticated",
5960
+ distinct_id: snapshot.actorId
5961
+ },
5962
+ trace_id: span.traceId,
5963
+ span_id: span.spanId,
5964
+ ...organizationId === void 0 ? {} : { organization_id: organizationId }
5965
+ }
5966
+ };
5967
+ yield* telemetry.emit(snapshot === void 0 ? event : attachInvocationObservation(event, {
5968
+ active: snapshot.active,
5969
+ ...snapshot?.actorId === void 0 ? {} : { actorId: snapshot.actorId },
5970
+ context: {
5971
+ ...context,
5972
+ ...organizationId === void 0 ? {} : { organizationId },
5973
+ traceparent: `00-${span.traceId}-${span.spanId}-01`
5974
+ }
5975
+ }));
5976
+ }).pipe(Effect.catchCause(() => Effect.void));
5762
5977
  }
5763
5978
  function emitPaymentInitiated(telemetry, input) {
5764
5979
  return emitMoneyTelemetry(telemetry, {
@@ -6374,7 +6589,10 @@ function makeFinancialOpsMethods(deps) {
6374
6589
  return {
6375
6590
  me: {
6376
6591
  get: (options) => runIfActive(options?.signal, CAPXUL_OPERATIONS.me.get, () => deps.convexCall.query(fns.me, {})),
6377
- depositInstructions: (options) => runIfActive(options?.signal, CAPXUL_OPERATIONS.me.depositInstructions, () => deps.convexCall.query(fns.depositInstructions, {}).pipe(Effect.tap(() => Effect.promise(() => emitDepositInitiated(deps.telemetry)))))
6592
+ depositInstructions: (options) => {
6593
+ const controls = deps.invocationControls?.(options) ?? options;
6594
+ return runPortEffect(Effect.suspend(() => deps.convexCall.query(fns.depositInstructions, copyInvocationObservation(controls, {}))).pipe(Effect.tap((instructions) => emitDepositInitiated(deps.telemetry, instructions, controls))), controls, CAPXUL_OPERATIONS.me.depositInstructions, deps.runPromise);
6595
+ }
6378
6596
  },
6379
6597
  targets: { resolve: async (reference, options) => {
6380
6598
  const recipient = normalizeTargetForBackend(reference, "reference");
@@ -6382,43 +6600,57 @@ function makeFinancialOpsMethods(deps) {
6382
6600
  return mapOk(await runIfActive(options?.signal, CAPXUL_OPERATIONS.recipient.resolve, () => deps.convexCall.query(fns.resolveRecipient, { recipient: recipient.value })), resolvedTargetFromResolution);
6383
6601
  } },
6384
6602
  destinations: {
6385
- add: async (input, options) => {
6386
- const scope = normalizeDestinationInputScope(input, "target");
6387
- if (!scope.ok) return {
6388
- ok: false,
6389
- error: scope.error
6390
- };
6391
- const scopeValue = scope.value;
6392
- if (scopeValue === void 0) return {
6393
- ok: false,
6394
- error: Errors.invalidInput("target", DESTINATION_SCOPE_MESSAGE)
6603
+ add: (input, options) => {
6604
+ const controls = deps.invocationControls?.(options) ?? options;
6605
+ const actor = actorReferenceToBackend(input.actor);
6606
+ const verifiedScope = {
6607
+ scope_kind: actor?.kind === "org" ? "organization" : "account",
6608
+ ...actor?.kind === "org" ? { verified_organization_id: actor.orgId } : {}
6395
6609
  };
6396
- const backendActor = actorReferenceToBackend(input.actor);
6397
- return mapOk(await runIfActive(options?.signal, CAPXUL_OPERATIONS.destinations.add, () => deps.convexCall.mutation(fns.addDestination, {
6398
- ...backendActor === void 0 ? {} : { actor: backendActor },
6399
- ...isSelfTarget(scopeValue) ? { self: true } : { ref: scopeValue },
6400
- kind: destinationKindToBackend(input.kind),
6401
- ...input.label === void 0 ? {} : { label: input.label },
6402
- payload: input.payload
6403
- })), destinationFromBackend);
6610
+ return runPortEffect(Effect.suspend(() => {
6611
+ const scope = normalizeDestinationInputScope(input, "target");
6612
+ if (!scope.ok) return Effect.fail({ publicError: scope.error });
6613
+ const scopeValue = scope.value;
6614
+ if (scopeValue === void 0) return Effect.fail({ publicError: Errors.invalidInput("target", DESTINATION_SCOPE_MESSAGE) });
6615
+ return deps.convexCall.mutation(fns.addDestination, copyInvocationObservation(controls, {
6616
+ ...actor === void 0 ? {} : { actor },
6617
+ ...isSelfTarget(scopeValue) ? { self: true } : { ref: scopeValue },
6618
+ kind: destinationKindToBackend(input.kind),
6619
+ ...input.label === void 0 ? {} : { label: input.label },
6620
+ payload: input.payload
6621
+ })).pipe(Effect.map(destinationFromBackend), Effect.tap(() => Effect.annotateCurrentSpan(verifiedScope)));
6622
+ }), controls, CAPXUL_OPERATIONS.destinations.add, deps.runPromise);
6404
6623
  },
6405
- list: async (input, options) => {
6406
- const scope = normalizeDestinationInputScope(input, "target");
6407
- if (!scope.ok) return {
6408
- ok: false,
6409
- error: scope.error
6624
+ list: (input, options) => {
6625
+ const controls = deps.invocationControls?.(options) ?? options;
6626
+ const actor = actorReferenceToBackend(input.actor);
6627
+ const verifiedScope = {
6628
+ scope_kind: actor?.kind === "org" ? "organization" : "account",
6629
+ ...actor?.kind === "org" ? { verified_organization_id: actor.orgId } : {}
6410
6630
  };
6411
- const scopeValue = scope.value;
6412
- return mapOk(await runIfActive(options?.signal, CAPXUL_OPERATIONS.destinations.list, () => deps.convexCall.query(fns.listDestinations, {
6413
- ...input.actor === void 0 ? {} : { actor: actorReferenceToBackend(input.actor) },
6414
- ...scopeValue !== void 0 && isSelfTarget(scopeValue) ? { self: true } : {},
6415
- ...scopeValue !== void 0 && !isSelfTarget(scopeValue) ? { ref: scopeValue } : {}
6416
- })), (destinations) => destinations.map(destinationFromBackend).filter((destination) => input.kind === void 0 || destination.kind === input.kind));
6631
+ return runPortEffect(Effect.suspend(() => {
6632
+ const scope = normalizeDestinationInputScope(input, "target");
6633
+ if (!scope.ok) return Effect.fail({ publicError: scope.error });
6634
+ const scopeValue = scope.value;
6635
+ return deps.convexCall.query(fns.listDestinations, copyInvocationObservation(controls, {
6636
+ ...actor === void 0 ? {} : { actor },
6637
+ ...scopeValue !== void 0 && isSelfTarget(scopeValue) ? { self: true } : {},
6638
+ ...scopeValue !== void 0 && !isSelfTarget(scopeValue) ? { ref: scopeValue } : {}
6639
+ })).pipe(Effect.map((destinations) => destinations.map(destinationFromBackend).filter((destination) => input.kind === void 0 || destination.kind === input.kind)), Effect.tap(() => Effect.annotateCurrentSpan(verifiedScope)));
6640
+ }), controls, CAPXUL_OPERATIONS.destinations.list, deps.runPromise);
6417
6641
  },
6418
- remove: (input, options) => runIfActive(options?.signal, CAPXUL_OPERATIONS.destinations.remove, () => deps.convexCall.mutation(fns.removeDestination, {
6419
- ...input.actor === void 0 ? {} : { actor: actorReferenceToBackend(input.actor) },
6420
- destinationId: input.destinationId
6421
- }))
6642
+ remove: (input, options) => {
6643
+ const controls = deps.invocationControls?.(options) ?? options;
6644
+ const actor = actorReferenceToBackend(input.actor);
6645
+ const verifiedScope = {
6646
+ scope_kind: actor?.kind === "org" ? "organization" : "account",
6647
+ ...actor?.kind === "org" ? { verified_organization_id: actor.orgId } : {}
6648
+ };
6649
+ return runPortEffect(Effect.suspend(() => deps.convexCall.mutation(fns.removeDestination, copyInvocationObservation(controls, {
6650
+ ...actor === void 0 ? {} : { actor },
6651
+ destinationId: input.destinationId
6652
+ })).pipe(Effect.tap(() => Effect.annotateCurrentSpan(verifiedScope)))), controls, CAPXUL_OPERATIONS.destinations.remove, deps.runPromise);
6653
+ }
6422
6654
  },
6423
6655
  payments: {
6424
6656
  pay,
@@ -9026,7 +9258,7 @@ function readOrgDepositInstructionsProgram(orgId) {
9026
9258
  const deps = yield* OrgDepsTag;
9027
9259
  const org = findOrgById(yield* listOrgsProgram(), orgId);
9028
9260
  if (org === void 0) return yield* Effect.fail(orgNotFound(orgId));
9029
- return {
9261
+ const instructions = {
9030
9262
  accountKind: "orgTreasury",
9031
9263
  chainId: Number(deps.chainId ?? 84532),
9032
9264
  network: "base-sepolia",
@@ -9034,6 +9266,8 @@ function readOrgDepositInstructionsProgram(orgId) {
9034
9266
  address: String(org.safeAddress).toLowerCase(),
9035
9267
  label: "Capxul org treasury"
9036
9268
  };
9269
+ yield* emitDepositInitiated(deps.telemetry, instructions, deps.invocationSource, String(org.id));
9270
+ return instructions;
9037
9271
  });
9038
9272
  }
9039
9273
  function listRolesProgram(orgId) {
@@ -9268,12 +9502,12 @@ function makeOrgMethods(deps) {
9268
9502
  });
9269
9503
  return toCapxulResult(readOrgProfileProgram(orgId), layer);
9270
9504
  },
9271
- depositInstructions(_options) {
9272
- if (_options?.signal?.aborted) return Promise.resolve({
9273
- ok: false,
9274
- error: Errors.cancelled({ operation: CAPXUL_OPERATIONS.org.profile.depositInstructions })
9275
- });
9276
- return toCapxulResult(readOrgDepositInstructionsProgram(orgId), layer);
9505
+ depositInstructions(options) {
9506
+ const controls = deps.invocationControls?.(options) ?? options;
9507
+ return runCapxulEffect(readOrgDepositInstructionsProgram(orgId).pipe(Effect.provide(orgDepsLayer({
9508
+ ...orgDeps,
9509
+ ...controls === void 0 ? {} : { invocationSource: controls }
9510
+ }))), controls, CAPXUL_OPERATIONS.org.profile.depositInstructions, deps.runPromise);
9277
9511
  }
9278
9512
  },
9279
9513
  treasury(options) {
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { B as EVM_ADDRESS_RE, Ct as RevertSummary, E as Address, G as OrgId, I as CountryCode, J as PayrollGroupId, K as PartyId, M as AuthUserId, P as BudgetId, St as FailureMode, T as AccountId, U as Handle, W as Money, Y as PayrollRunId, _t as isCapxulError, a as SignerStatusStore, bt as ChainUpstream, c as AccountProviderSource, ct as toHandle, d as eip1193AccountProvider, dt as CAPXUL_ERROR_CODES, et as RoleKey, f as localPrivateKeyAccountProvider, ft as CapxulError, g as SmartAccount, h as Session, ht as Errors, i as SignerStatus, j as AuthSession, l as AccountRequirement, lt as toPartyId, m as Profile, mt as CapxulErrorDetails, n as CapxulSigner, o as injectedWalletSigner, ot as toAddress, p as CapxulResult, pt as CapxulErrorCode, r as Eip1193RequestProvider, rt as TesterKind, s as AccountProvider, st as toCountryCode, t as CapxulDigestSigner, u as Eip1193Provider, ut as CAPXUL_PAYMENTS_V2_ADDRESS, vt as CHAIN_UPSTREAMS, w as Account, xt as FAILURE_MODES, yt as ChainCause } from "./signer-C0hZ6Kiy.mjs";
2
- import { $ as OrganizationPaymentsMethods, $n as TelemetryPort, $t as DestinationListInput, A as OrgView, An as TargetsMethods, At as AddressBookMethods, B as PayrollGroupInput, Bn as OrgSetupStep, Bt as ActivityListParams, C as DetectPendingOrgInvitationsResult, Cn as PaymentType, Ct as ActorRelationshipMethods, D as OrgMethods, Dn as Ref, Dt as AddressBookAddInput, E as MemberView, En as RecipientResolution, Et as ActorRequestsMethods, F as RoleSpendCap, Fn as CompleteProfileInput, Ft as ActivityAnnotationInput, G as PayrollRun, Gn as InboxStatus, Gt as ActivitySummary, H as PayrollGroupsMethods, Hn as CurrentHoldings, Ht as ActivityPage, I as RoleView, In as IdentityMethods, It as ActivityDetail, J as PayrollRuns, Jn as PaymentStatus$1, Jt as ActorReference, K as PayrollRunItemInput, Kn as PAYMENT_DIRECTIONS, Kt as ActivitySummaryParams, L as AuthorizeRunInput, Ln as SmartAccountMethods, Lt as ActivityFilter, M as OrganizationAuditLogItem, Mn as AccountLifecycle, Mt as InboxItem, N as ResendInviteTokenInput, Nn as AccountSetupStep, Nt as InboxMethods, O as OrgScopedMethods, On as ResolvedTarget, Ot as AddressBookEntry, P as RoleDefinition, Pn as isSettingUpLifecycle, Pt as ActivityAnnotation, Q as OrganizationPaymentItemInput, Qt as DestinationKind, R as PayrollEngagementTerms, Rn as AuthMethods, Rt as ActivityItem, S as CreateOrgInput, Sn as PaymentTiming, St as ActorProfileMethods, T as MemberStatus, Tn as PaymentsPayInput, Tt as ActorRequestIssueInput, U as PayrollMethods, Un as Permission, Ut as ActivityRange, V as PayrollGroupMember, Vn as ActorRef, Vt as ActivityMethods, W as PayrollOptions, Wn as SubmittedPermissionExecution, Wt as ActivityReference, X as OrganizationPaymentBatchInput, Xt as Destination, Y as PayrollTermsUnit, Yn as RequestStatus, Yt as DepositInstructions, Z as OrganizationPaymentInput, Zt as DestinationAddInput, _ as SystemMethods, _n as PaymentDocumentRender, _t as PersonOnboarding, a as SdkFailureObservation, an as MeMethods, ar as StateLabel, at as PermissionReplaceInput, b as CurrentUserContext, bn as PaymentMoney, bt as AccountMethods, c as PostHogObservabilityOptions, cn as OfframpMethods, cr as isRestoring, ct as Budget, d as CreateCapxulClientInput, dn as OfframpStatus, dt as OrgMeOptions, en as DestinationPayload, er as Destination$1, et as PermissionAssignInput, f as IdentityProfileDetails, fn as Payment, ft as AccountsMethods, g as Holding, gn as PaymentDocumentRef, gt as OrganizationOnboardingInput, h as HoldingsMethods, hn as PaymentDocumentKind, ht as OrganizationOnboarding, i as ObservationDelivery, in as FinancialOpsMethods, ir as Readiness, it as PermissionOptions, j as OrganizationAccount, jn as fingerprintPaymentIntent, jt as InboxApproveInput, k as OrgTemplate, kn as TargetReference, kt as AddressBookLabelInput, l as postHogObservability, ln as OfframpQuote, lr as IdentityTransition, lt as OrgMe, m as IdentityRuntimeSendResult, mn as PaymentDirection, mt as OnboardingMethods, n as ObservationAdapter, nn as DestinationRemoveInput, nr as IdentityState, nt as PermissionCreateInput, o as HostObservability, on as MeProfile, or as destination, ot as PermissionRevokeInput, p as IdentityRuntime, pn as PaymentActivityEvidence, pt as CompletedPersonProfile, q as PayrollRunStatus, qn as PAYMENT_STATUSES, qt as ActivitySummaryTotal, r as ObservationContext, rn as DestinationsMethods, rr as OrgLane, rt as PermissionMethods, s as PostHogObservabilityClient, sn as MovementActivityEvidence, sr as isClaimed, st as PermissionReadResult, t as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, tn as DestinationRail, tr as IdentityEvent, tt as PermissionChangeInput, u as CapxulClient, un as OfframpQuoteInput, ur as InvocationControls, ut as OrgMeMethod, v as SystemHealth, vn as PaymentDocumentVerification, vt as PersonOnboardingInput, w as InviteMemberInput, wn as PaymentsMethods, wt as ActorRequest, x as CurrentUserMethods, xn as PaymentStatus, xt as ActorProfile, y as MediaMethods, yn as PaymentDocumentsMethods, yt as ReadyAccountLifecycle, z as PayrollGroup, zn as OrgLifecycle, zt as ActivityKind } from "./observation-DtzTdv20.mjs";
2
+ import { $ as OrganizationPaymentsMethods, $n as TelemetryPort, $t as DestinationListInput, A as OrgView, An as TargetsMethods, At as AddressBookMethods, B as PayrollGroupInput, Bn as OrgSetupStep, Bt as ActivityListParams, C as DetectPendingOrgInvitationsResult, Cn as PaymentType, Ct as ActorRelationshipMethods, D as OrgMethods, Dn as Ref, Dt as AddressBookAddInput, E as MemberView, En as RecipientResolution, Et as ActorRequestsMethods, F as RoleSpendCap, Fn as CompleteProfileInput, Ft as ActivityAnnotationInput, G as PayrollRun, Gn as InboxStatus, Gt as ActivitySummary, H as PayrollGroupsMethods, Hn as CurrentHoldings, Ht as ActivityPage, I as RoleView, In as IdentityMethods, It as ActivityDetail, J as PayrollRuns, Jn as PaymentStatus$1, Jt as ActorReference, K as PayrollRunItemInput, Kn as PAYMENT_DIRECTIONS, Kt as ActivitySummaryParams, L as AuthorizeRunInput, Ln as SmartAccountMethods, Lt as ActivityFilter, M as OrganizationAuditLogItem, Mn as AccountLifecycle, Mt as InboxItem, N as ResendInviteTokenInput, Nn as AccountSetupStep, Nt as InboxMethods, O as OrgScopedMethods, On as ResolvedTarget, Ot as AddressBookEntry, P as RoleDefinition, Pn as isSettingUpLifecycle, Pt as ActivityAnnotation, Q as OrganizationPaymentItemInput, Qt as DestinationKind, R as PayrollEngagementTerms, Rn as AuthMethods, Rt as ActivityItem, S as CreateOrgInput, Sn as PaymentTiming, St as ActorProfileMethods, T as MemberStatus, Tn as PaymentsPayInput, Tt as ActorRequestIssueInput, U as PayrollMethods, Un as Permission, Ut as ActivityRange, V as PayrollGroupMember, Vn as ActorRef, Vt as ActivityMethods, W as PayrollOptions, Wn as SubmittedPermissionExecution, Wt as ActivityReference, X as OrganizationPaymentBatchInput, Xt as Destination, Y as PayrollTermsUnit, Yn as RequestStatus, Yt as DepositInstructions, Z as OrganizationPaymentInput, Zt as DestinationAddInput, _ as SystemMethods, _n as PaymentDocumentRender, _t as PersonOnboarding, a as SdkFailureObservation, an as MeMethods, ar as StateLabel, at as PermissionReplaceInput, b as CurrentUserContext, bn as PaymentMoney, bt as AccountMethods, c as PostHogObservabilityOptions, cn as OfframpMethods, cr as isRestoring, ct as Budget, d as CreateCapxulClientInput, dn as OfframpStatus, dt as OrgMeOptions, en as DestinationPayload, er as Destination$1, et as PermissionAssignInput, f as IdentityProfileDetails, fn as Payment, ft as AccountsMethods, g as Holding, gn as PaymentDocumentRef, gt as OrganizationOnboardingInput, h as HoldingsMethods, hn as PaymentDocumentKind, ht as OrganizationOnboarding, i as ObservationDelivery, in as FinancialOpsMethods, ir as Readiness, it as PermissionOptions, j as OrganizationAccount, jn as fingerprintPaymentIntent, jt as InboxApproveInput, k as OrgTemplate, kn as TargetReference, kt as AddressBookLabelInput, l as postHogObservability, ln as OfframpQuote, lr as IdentityTransition, lt as OrgMe, m as IdentityRuntimeSendResult, mn as PaymentDirection, mt as OnboardingMethods, n as ObservationAdapter, nn as DestinationRemoveInput, nr as IdentityState, nt as PermissionCreateInput, o as HostObservability, on as MeProfile, or as destination, ot as PermissionRevokeInput, p as IdentityRuntime, pn as PaymentActivityEvidence, pt as CompletedPersonProfile, q as PayrollRunStatus, qn as PAYMENT_STATUSES, qt as ActivitySummaryTotal, r as ObservationContext, rn as DestinationsMethods, rr as OrgLane, rt as PermissionMethods, s as PostHogObservabilityClient, sn as MovementActivityEvidence, sr as isClaimed, st as PermissionReadResult, t as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, tn as DestinationRail, tr as IdentityEvent, tt as PermissionChangeInput, u as CapxulClient, un as OfframpQuoteInput, ur as InvocationControls, ut as OrgMeMethod, v as SystemHealth, vn as PaymentDocumentVerification, vt as PersonOnboardingInput, w as InviteMemberInput, wn as PaymentsMethods, wt as ActorRequest, x as CurrentUserMethods, xn as PaymentStatus, xt as ActorProfile, y as MediaMethods, yn as PaymentDocumentsMethods, yt as ReadyAccountLifecycle, z as PayrollGroup, zn as OrgLifecycle, zt as ActivityKind } from "./observation-Bcmb-GIA.mjs";
3
3
  import "./OAuthBearerAuthClient-D-DLYlKj.mjs";
4
4
  import { Context, Effect, Layer } from "effect";
5
5
  import { Hex } from "viem";
@@ -47,12 +47,14 @@ declare const CAPXUL_OPERATIONS: {
47
47
  };
48
48
  readonly activity: {
49
49
  readonly annotate: "activity.annotate";
50
+ readonly emitAnnotationSaved: "activity.emitAnnotationSaved";
50
51
  readonly get: "activity.get";
51
52
  readonly list: "activity.list";
52
53
  readonly summary: "activity.summary";
53
54
  };
54
55
  readonly addressBook: {
55
56
  readonly add: "addressBook.add";
57
+ readonly emitRelationshipChanged: "addressBook.emitRelationshipChanged";
56
58
  readonly get: "addressBook.get";
57
59
  readonly hide: "addressBook.hide";
58
60
  readonly label: "addressBook.label";
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as stampTelemetryEnvelope, A as safeExceptionLabel, B as resolveFailureMode, C as observeFailedResult, D as normalizeExceptionErrorKind, E as SDK_VERSION$1, F as causeChain, G as sanitizeObservationContext, H as readInvocationObservation, I as injectedWalletSigner, J as CAPXUL_FUNCTIONS, K as PAYMENT_DIRECTIONS, L as isSignerNotReadySignal, M as fromWei, N as isSettingUpLifecycle, O as normalizeExceptionOperation, P as formatTraceparent, Q as redactTelemetryProps, R as openfortSignerNotReadyCode, S as observationContextProps, T as EXCEPTION_MESSAGE, U as OBSERVATION_CONTEXT_HEADER, V as copyInvocationObservation, W as encodeObservationContextHeader, X as EngineeringTelemetryBootstrapPolicy, Y as BootstrapEnvelope, _ as fingerprintPaymentIntent, a as AccountReadPortTag, at as isRestoring, b as failureDetail, c as retryIdempotentRead, d as IdentityPortTag, et as CAPXUL_OPERATIONS, f as identityErrorFromCapxul, g as bootstrapErrorFromCapxul, h as BootstrapPortTag, i as smartAccountErrorFromCapxul, it as isClaimed, j as version, k as projectSdkException, l as PRODUCT_INVOCATION, m as convexCallErrorFromCapxul, n as detectAuthCacheAdapter, nt as normalizeCapxulOperation, o as accountReadErrorFromCapxul, p as ConvexCallPortTag, q as PAYMENT_STATUSES, r as SmartAccountPortTag, rt as destination, s as TelemetryPortTag, t as assembleCapxulClient, tt as isCapxulOperation, u as wireChainId, v as toWei, w as postHogFailureObservation, x as failureEvidenceProps, y as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, z as signerFailure } from "./create-capxul-client-5Bk0PS0R.mjs";
1
+ import { $ as stampTelemetryEnvelope, A as safeExceptionLabel, B as resolveFailureMode, C as observeFailedResult, D as normalizeExceptionErrorKind, E as SDK_VERSION$1, F as causeChain, G as sanitizeObservationContext, H as readInvocationObservation, I as injectedWalletSigner, J as CAPXUL_FUNCTIONS, K as PAYMENT_DIRECTIONS, L as isSignerNotReadySignal, M as fromWei, N as isSettingUpLifecycle, O as normalizeExceptionOperation, P as formatTraceparent, Q as redactTelemetryProps, R as openfortSignerNotReadyCode, S as observationContextProps, T as EXCEPTION_MESSAGE, U as OBSERVATION_CONTEXT_HEADER, V as copyInvocationObservation, W as encodeObservationContextHeader, X as EngineeringTelemetryBootstrapPolicy, Y as BootstrapEnvelope, _ as fingerprintPaymentIntent, a as AccountReadPortTag, at as isRestoring, b as failureDetail, c as retryIdempotentRead, d as IdentityPortTag, et as CAPXUL_OPERATIONS, f as identityErrorFromCapxul, g as bootstrapErrorFromCapxul, h as BootstrapPortTag, i as smartAccountErrorFromCapxul, it as isClaimed, j as version, k as projectSdkException, l as PRODUCT_INVOCATION, m as convexCallErrorFromCapxul, n as detectAuthCacheAdapter, nt as normalizeCapxulOperation, o as accountReadErrorFromCapxul, p as ConvexCallPortTag, q as PAYMENT_STATUSES, r as SmartAccountPortTag, rt as destination, s as TelemetryPortTag, t as assembleCapxulClient, tt as isCapxulOperation, u as wireChainId, v as toWei, w as postHogFailureObservation, x as failureEvidenceProps, y as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, z as signerFailure } from "./create-capxul-client-QHfE4dEP.mjs";
2
2
  import { $ as CapxulError, A as toAuthUserId, B as toJwtToken, D as toAddress, E as toAccountId, F as toDurationMs, H as toOrgId, I as toEmail, J as toSessionToken, K as toPublishableKey, L as toEpochMs, M as toChainId, N as toCountryCode, O as toAllowedOrigin, P as toCurrencyCode, Q as CAPXUL_ERROR_CODES, R as toEpochSeconds, T as currencySymbolFor, U as toPartyId, V as toKycTier, X as HANDLE_RE, Y as toTesterKind, Z as decodeConvexError, d as AuthClientError, f as AuthClientPortTag, g as BASE_SEPOLIA_CHAIN_ID, h as normalizeBindingEmail, it as FAILURE_MODES, l as ClockPortTag, m as CAPXUL_PAYMENTS_V2_ADDRESS, nt as isCapxulError, q as toRoleKey, rt as CHAIN_UPSTREAMS, s as AuthCachePortTag, tt as Errors, u as authClientPortFromPromiseAdapter, x as EVM_ADDRESS_RE, z as toHandle } from "./clock-C2AUlq1V.mjs";
3
3
  import { n as SystemClockLayer } from "./OAuthBearerAuthClient-BHvDR8_0.mjs";
4
4
  import { Cause, Context, Data, Duration, Effect, Exit, Layer, Result, Schedule, SchemaIssue, SchemaParser, Scope, Tracer } from "effect";
@@ -1615,6 +1615,8 @@ const OBSERVED_CONVEX_QUERIES = /* @__PURE__ */ new Set([
1615
1615
  "movement/activity:list",
1616
1616
  "movement/activity:summary",
1617
1617
  "movement/activity:get",
1618
+ "financialOps/queries:depositInstructions",
1619
+ "financialOps/destinations:list",
1618
1620
  "financialOps/queries:verifyPaymentDocument",
1619
1621
  "financialOps/queries:renderStoredDocument",
1620
1622
  "financialOps/addressBook:list",
@@ -1632,6 +1634,8 @@ const OBSERVED_CONVEX_QUERIES = /* @__PURE__ */ new Set([
1632
1634
  ]);
1633
1635
  const OBSERVED_CONVEX_MUTATIONS = /* @__PURE__ */ new Set([
1634
1636
  "movement/activity:annotate",
1637
+ "financialOps/destinations:add",
1638
+ "financialOps/destinations:remove",
1635
1639
  "financialOps/addressBook:add",
1636
1640
  "financialOps/addressBook:hide",
1637
1641
  "financialOps/addressBook:unhide",
@@ -279,7 +279,7 @@ interface TelemetryPort {
279
279
  }
280
280
  //#endregion
281
281
  //#region ../observability/src/index.d.ts
282
- declare const TELEMETRY_EVENT_NAMES: readonly ["auth_otp_requested", "auth_otp_delivered", "auth_otp_expired", "auth_verified", "auth_failed", "auth_signed_out", "onboarding_intent_selected", "onboarding_profile_submitted", "onboarding_organization_submitted", "onboarding_dashboard_reached", "provisioning_safe_created", "provisioning_safe_confirmed", "bootstrap_resolved", "bootstrap_failed", "member_activation_started", "member_activation_ready", "member_activation_failed", "organization_creation_started", "organization_creation_ready", "organization_creation_failed", "chain_upstream_fallback", "bundler_error", "receipt_pending", "operation_retried", "account_balance_read", "account_balance_failed", "faucet_requested", "faucet_confirmed", "faucet_failed", "org_create_started", "org_safe_created", "org_safe_confirmed", "org_roles_seeded", "org_created", "org_create_failed", "org_invite_sent", "org_invite_accepted", "org_invite_expired", "payment_initiated", "payment_settled", "payment_failed", "payment_verification_retry", "payment_lifecycle_transition", "quick_pay_external_address_acknowledged", "deposit_initiated", "deposit_settled", "permission_mirror_verification", "movement_scan_window", "movement_scan_checkpoint", "movement_scan_incident"];
282
+ declare const TELEMETRY_EVENT_NAMES: readonly ["auth_otp_requested", "auth_otp_delivered", "auth_otp_expired", "auth_verified", "auth_failed", "auth_signed_out", "onboarding_intent_selected", "onboarding_profile_submitted", "onboarding_organization_submitted", "onboarding_dashboard_reached", "provisioning_safe_created", "provisioning_safe_confirmed", "bootstrap_resolved", "bootstrap_failed", "member_activation_started", "member_activation_ready", "member_activation_failed", "organization_creation_started", "organization_creation_ready", "organization_creation_failed", "chain_upstream_fallback", "bundler_error", "receipt_pending", "operation_retried", "account_balance_read", "account_balance_failed", "faucet_requested", "faucet_confirmed", "faucet_failed", "org_create_started", "org_safe_created", "org_safe_confirmed", "org_roles_seeded", "org_created", "org_create_failed", "org_invite_sent", "org_invite_accepted", "org_invite_expired", "payment_initiated", "payment_settled", "payment_failed", "payment_verification_retry", "payment_lifecycle_transition", "quick_pay_external_address_acknowledged", "deposit_initiated", "deposit_settled", "permission_mirror_verification", "movement_scan_window", "movement_scan_checkpoint", "movement_scan_incident", "activity_annotation_saved", "ui_activity_action_completed", "contact_relationship_changed", "ui_contact_action_completed"];
283
283
  type TelemetryEventName = (typeof TELEMETRY_EVENT_NAMES)[number];
284
284
  type TelemetryProps = Record<string, unknown>;
285
285
  type TelemetryEvent = {
@@ -1,4 +1,4 @@
1
- import { Qn as TelemetryIdentifyInput, Xn as TelemetryEvent, Zn as TelemetryGroupInput, lr as IdentityTransition, n as ObservationAdapter, u as CapxulClient } from "../observation-DtzTdv20.mjs";
1
+ import { Qn as TelemetryIdentifyInput, Xn as TelemetryEvent, Zn as TelemetryGroupInput, lr as IdentityTransition, n as ObservationAdapter, u as CapxulClient } from "../observation-Bcmb-GIA.mjs";
2
2
  import { Effect, Layer } from "effect";
3
3
  //#region src/testing/telemetry/RecordingTelemetryAdapter.d.ts
4
4
  type RecordingTelemetryOperation = {
@@ -1,4 +1,4 @@
1
- import { M as fromWei, Z as redactTelemetryEvent, f as identityErrorFromCapxul, g as bootstrapErrorFromCapxul, i as smartAccountErrorFromCapxul, m as convexCallErrorFromCapxul, o as accountReadErrorFromCapxul, t as assembleCapxulClient, u as wireChainId, v as toWei } from "../create-capxul-client-5Bk0PS0R.mjs";
1
+ import { M as fromWei, Z as redactTelemetryEvent, f as identityErrorFromCapxul, g as bootstrapErrorFromCapxul, i as smartAccountErrorFromCapxul, m as convexCallErrorFromCapxul, o as accountReadErrorFromCapxul, t as assembleCapxulClient, u as wireChainId, v as toWei } from "../create-capxul-client-QHfE4dEP.mjs";
2
2
  import { $ as CapxulError, A as toAuthUserId, B as toJwtToken, D as toAddress, E as toAccountId, F as toDurationMs, I as toEmail, J as toSessionToken, K as toPublishableKey, L as toEpochMs, M as toChainId, N as toCountryCode, O as toAllowedOrigin, R as toEpochSeconds, V as toKycTier, _ as deriveCapxulSafeAddress, k as toAppId, n as InMemoryAuthCacheAdapter, t as readClockNow, tt as Errors, u as authClientPortFromPromiseAdapter, v as validateHandle, z as toHandle } from "../clock-C2AUlq1V.mjs";
3
3
  import { Effect, Result, Semaphore } from "effect";
4
4
  import { keccak256 } from "viem";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/sdk",
3
- "version": "4.0.1",
3
+ "version": "4.1.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Xelmar-tech/infrastructure.git",
@@ -49,10 +49,10 @@
49
49
  "vitest": "4.1.11",
50
50
  "@capxul/config": "0.3.0",
51
51
  "@capxul/errors": "0.3.0",
52
- "@capxul/typescript-config": "0.0.0",
53
- "@capxul/wire": "0.7.0",
54
52
  "@capxul/types": "0.3.0",
55
- "@capxul/observability": "4.0.1"
53
+ "@capxul/observability": "4.1.1",
54
+ "@capxul/wire": "0.7.0",
55
+ "@capxul/typescript-config": "0.0.0"
56
56
  },
57
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.",
58
58
  "scripts": {