@capxul/sdk 4.20.0-beta.31 → 4.20.0-beta.32

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.
@@ -634,6 +634,9 @@ function decodeUrlComponent(text) {
634
634
  return text;
635
635
  }
636
636
  }
637
+ function isCoinbaseRpcPath(hostname, segments) {
638
+ return hostname === "api.developer.coinbase.com" && decodeUrlComponent(segments[1] ?? "") === "rpc" && decodeUrlComponent(segments[2] ?? "") === "v1";
639
+ }
637
640
  /** Preserve URL diagnostics while removing credentials from their declared components. */
638
641
  function redactUrlSecrets(value, source) {
639
642
  try {
@@ -651,9 +654,10 @@ function redactUrlSecrets(value, source) {
651
654
  const provider = source === "alchemy" || source === "infura" || /(?:^|\.)(?:alchemy\.com|alchemyapi\.io|infura\.io)$/iu.test(url.hostname);
652
655
  const rawPath = absolute || protocolRelative ? url.pathname : value.split(/[?#]/u)[0] ?? "";
653
656
  const segments = rawPath.split("/");
657
+ const coinbaseRpc = isCoinbaseRpcPath(url.hostname, segments);
654
658
  let path = segments.map((segment, index) => {
655
659
  const decoded = decodeUrlComponent(segment);
656
- const masked = provider && /^v[23]$/u.test(decodeUrlComponent(segments[index - 1] ?? "")) && decoded.length > 0 ? "[REDACTED]" : maskText(decoded);
660
+ const masked = (provider && /^v[23]$/u.test(decodeUrlComponent(segments[index - 1] ?? "")) || coinbaseRpc && index === 4) && decoded.length > 0 ? "[REDACTED]" : maskText(decoded);
657
661
  changed ||= masked !== decoded;
658
662
  return masked === decoded ? segment : encodeURIComponent(masked);
659
663
  }).join("/");
@@ -2690,6 +2694,8 @@ function isEvmAddress(raw) {
2690
2694
  const ASSET_ID_RE = /^eip155:([1-9][0-9]*)\/erc20:(0x[0-9a-f]{40})$/;
2691
2695
  const CURRENCY_SYMBOLS = {
2692
2696
  USD: "$",
2697
+ EUR: "€",
2698
+ GBP: "£",
2693
2699
  NGN: "NGN",
2694
2700
  GHS: "GHS",
2695
2701
  KES: "KSh",
@@ -2701,6 +2707,16 @@ const CURRENCY_SYMBOLS = {
2701
2707
  symbol: CURRENCY_SYMBOLS.USD,
2702
2708
  name: "US Dollar"
2703
2709
  },
2710
+ {
2711
+ code: "EUR",
2712
+ symbol: CURRENCY_SYMBOLS.EUR,
2713
+ name: "Euro"
2714
+ },
2715
+ {
2716
+ code: "GBP",
2717
+ symbol: CURRENCY_SYMBOLS.GBP,
2718
+ name: "British Pound"
2719
+ },
2704
2720
  {
2705
2721
  code: "NGN",
2706
2722
  symbol: CURRENCY_SYMBOLS.NGN,
@@ -2797,6 +2813,13 @@ const AssetAmountSchema = Schema.Struct({
2797
2813
  currency: Schema.optional(Schema.Never),
2798
2814
  decimals: Schema.optional(Schema.Never)
2799
2815
  });
2816
+ /** Fiat value. Currency never selects or aliases an asset. */
2817
+ const MoneySchema = Schema.Struct({
2818
+ currency: CurrencyCodeSchema$1,
2819
+ value: DecimalStringSchema,
2820
+ decimals: Schema.Finite.check(Schema.makeFilter((value) => Number.isSafeInteger(value) && value >= 0 && value <= 255, { message: "must be an integer between 0 and 255" })),
2821
+ asset: Schema.optional(Schema.Never)
2822
+ });
2800
2823
  //#endregion
2801
2824
  //#region ../protocol/src/primitives/brand-schema.ts
2802
2825
  const lowercasedString = Schema.String.pipe(Schema.decodeTo(Schema.String, {
@@ -2873,6 +2896,46 @@ function decodedBase64Size(value) {
2873
2896
  }
2874
2897
  const CanonicalBase64Schema = Schema.String.check(Schema.makeFilter((value) => value.length > 0 && CANONICAL_BASE64_RE.test(value) && decodedBase64Size(value) <= 131072, { message: "must be canonical padded RFC 4648 base64 of at most 128 KiB" }));
2875
2898
  //#endregion
2899
+ //#region ../protocol/src/documents/money-invoice-schema.ts
2900
+ const SIGNATURE_RE$1 = /^0x[0-9a-f]{130}$/;
2901
+ const FiatAmountV3Schema = Schema.Struct({
2902
+ denomination: Schema.Literal(0),
2903
+ currency: CurrencyCodeSchema$1,
2904
+ asset: Schema.Literal(""),
2905
+ minorUnits: Uint256StringSchema$1,
2906
+ decimals: Uint8V3Schema
2907
+ });
2908
+ const MoneyInvoiceEnvelopeV5Schema = Schema.Struct({
2909
+ protocol: Schema.Literal("capxul.payment-document"),
2910
+ version: Schema.Literal(5),
2911
+ domain: Schema.Struct({
2912
+ name: Schema.Literal("CapxulFinancialDocument"),
2913
+ version: Schema.Literal("5"),
2914
+ chainId: ChainIdSchema$1,
2915
+ salt: Schema.Literal("0x7b0fd8a8c3880e03dc03661ad8d3bad2f865203f70562ac8cc01527168b464a3")
2916
+ }),
2917
+ primaryType: Schema.Literal("Invoice"),
2918
+ message: Schema.Struct({
2919
+ kind: Schema.Literal(1),
2920
+ originId: CanonicalBytes32V3Schema,
2921
+ issuedAt: Uint64V3Schema,
2922
+ invoiceNumber: ReferenceV3Schema,
2923
+ payerRef: AssertionV3Schema,
2924
+ payeeRef: AssertionV3Schema,
2925
+ amount: FiatAmountV3Schema,
2926
+ receivingAccountId: ReferenceV3Schema,
2927
+ target: CanonicalAddressV3Schema,
2928
+ dueAt: Uint64V3Schema,
2929
+ lineItemsHash: CanonicalBytes32V3Schema,
2930
+ note: NoteV3Schema,
2931
+ discountMinor: Uint256StringSchema$1
2932
+ }),
2933
+ signature: Schema.optional(Schema.Struct({
2934
+ signer: CanonicalAddressV3Schema,
2935
+ value: Schema.String.pipe(Schema.refine((value) => SIGNATURE_RE$1.test(value)))
2936
+ }))
2937
+ });
2938
+ //#endregion
2876
2939
  //#region ../protocol/src/documents/schema.ts
2877
2940
  const SIGNATURE_RE = /^0x[0-9a-f]{130}$/;
2878
2941
  const PaymentDocumentDomainV3Schema = Schema.Struct({
@@ -2886,13 +2949,7 @@ const ExactAssetV3Schema = Schema.Struct({
2886
2949
  minorUnits: Uint256StringSchema$1,
2887
2950
  decimals: Uint8V3Schema
2888
2951
  });
2889
- const ReceiptAmountV3Schema = Schema.Union([Schema.Struct({
2890
- denomination: Schema.Literal(0),
2891
- currency: CurrencyCodeSchema$1,
2892
- asset: Schema.Literal(""),
2893
- minorUnits: Uint256StringSchema$1,
2894
- decimals: Uint8V3Schema
2895
- }), Schema.Struct({
2952
+ const ReceiptAmountV3Schema = Schema.Union([FiatAmountV3Schema, Schema.Struct({
2896
2953
  denomination: Schema.Literal(1),
2897
2954
  currency: Schema.Literal(""),
2898
2955
  asset: AssetIdSchema,
@@ -3010,7 +3067,11 @@ const InvoiceEnvelopeV4Schema = Schema.Struct({
3010
3067
  }),
3011
3068
  signature: Schema.optional(SignatureV3Schema)
3012
3069
  });
3013
- const SupportedPaymentDocumentEnvelopeSchema = Schema.Union([PaymentDocumentEnvelopeV3Schema, InvoiceEnvelopeV4Schema]);
3070
+ const SupportedPaymentDocumentEnvelopeSchema = Schema.Union([
3071
+ PaymentDocumentEnvelopeV3Schema,
3072
+ InvoiceEnvelopeV4Schema,
3073
+ MoneyInvoiceEnvelopeV5Schema
3074
+ ]);
3014
3075
  //#endregion
3015
3076
  //#region ../protocol/src/documents/read-schema.ts
3016
3077
  const DocumentRefV3Schema = Schema.Struct({
@@ -3025,6 +3086,7 @@ const DocumentRefV3Schema = Schema.Struct({
3025
3086
  format: Schema.Literals([
3026
3087
  "envelope-v3",
3027
3088
  "envelope-v4",
3089
+ "envelope-v5",
3028
3090
  "artifact"
3029
3091
  ]),
3030
3092
  role: Schema.Literals([
@@ -3034,6 +3096,13 @@ const DocumentRefV3Schema = Schema.Struct({
3034
3096
  ]),
3035
3097
  issuedAt: Schema.NullOr(Uint64V3Schema)
3036
3098
  });
3099
+ function paymentDocumentEnvelopeFormat(envelope) {
3100
+ switch (envelope.version) {
3101
+ case 3: return "envelope-v3";
3102
+ case 4: return "envelope-v4";
3103
+ case 5: return "envelope-v5";
3104
+ }
3105
+ }
3037
3106
  const PaymentDocumentReadRefSchema = Schema.Struct({
3038
3107
  documentHash: CanonicalBytes32V3Schema,
3039
3108
  contentHash: CanonicalBytes32V3Schema
@@ -3139,22 +3208,32 @@ const OrganizationActorRefSchema = Schema.Struct({
3139
3208
  orgId: nonEmpty("orgId")
3140
3209
  });
3141
3210
  const ActorRefSchema = Schema.Union([AccountActorRefSchema, OrganizationActorRefSchema]);
3211
+ const PartyAccountRefSchema$1 = Schema.Struct({
3212
+ kind: Schema.Literal("party_account"),
3213
+ partyAccountId: nonEmpty("partyAccountId")
3214
+ });
3142
3215
  const hasActorBoundPermission = (actor, orgId, permissionId) => actor.kind === "organization" ? orgId === actor.orgId && permissionId !== void 0 : orgId === void 0 && permissionId === void 0;
3143
- const ActorOrDestinationRefSchema = Schema.Union([ActorRefSchema, Schema.Struct({
3144
- kind: Schema.Literal("destination"),
3145
- destinationId: nonEmpty("destinationId")
3146
- })]);
3216
+ const ActorOrDestinationRefSchema = Schema.Union([
3217
+ ActorRefSchema,
3218
+ Schema.Struct({
3219
+ kind: Schema.Literal("destination"),
3220
+ destinationId: nonEmpty("destinationId")
3221
+ }),
3222
+ PartyAccountRefSchema$1
3223
+ ]);
3147
3224
  const RecipientObservationSchema = Schema.Struct({
3148
3225
  recipient_locator_kind: Schema.Literals([
3149
3226
  "handle",
3150
3227
  "email",
3151
3228
  "party",
3152
- "address"
3229
+ "address",
3230
+ "party_account"
3153
3231
  ]),
3154
3232
  recipient_resolution_status: Schema.Literals([
3155
3233
  "known_party",
3156
3234
  "new_email",
3157
- "external_address"
3235
+ "external_address",
3236
+ "bank_account"
3158
3237
  ]),
3159
3238
  recipient_is_capxul_account: Schema.Boolean,
3160
3239
  recipient_party_id: Schema.optional(Schema.String),
@@ -3165,6 +3244,7 @@ const RecipientObservationSchema = Schema.Struct({
3165
3244
  ])),
3166
3245
  recipient_handle: Schema.optional(Schema.String),
3167
3246
  recipient_address: AddressSchema$1,
3247
+ party_account_id: Schema.optional(Schema.String),
3168
3248
  external_address_acknowledged: Schema.Boolean
3169
3249
  });
3170
3250
  //#endregion
@@ -3340,7 +3420,7 @@ const PartySchema = Schema.Struct({
3340
3420
  status: Schema.Literals(["provisional", "claimed"]),
3341
3421
  displayName: Schema.NullOr(Schema.String),
3342
3422
  handle: Schema.NullOr(Schema.String),
3343
- safeAddress: Schema.String
3423
+ safeAddress: Schema.optionalKey(Schema.String)
3344
3424
  });
3345
3425
  //#endregion
3346
3426
  //#region ../protocol/src/time/schema.ts
@@ -3358,6 +3438,7 @@ const DurationMsSchema$1 = Schema.Finite.pipe(Schema.refine((n) => Number.isSafe
3358
3438
  const PAYMENT_STATUSES = [
3359
3439
  "pending",
3360
3440
  "settling",
3441
+ "in_transit",
3361
3442
  "unresolved",
3362
3443
  "scheduled",
3363
3444
  "streaming",
@@ -3426,14 +3507,22 @@ const PAYMENT_TYPE_FOR_DOCUMENT_KIND = {
3426
3507
  function paymentTypeForDocumentKind(kind) {
3427
3508
  return PAYMENT_TYPE_FOR_DOCUMENT_KIND[kind];
3428
3509
  }
3429
- const PaymentRecipient = Schema.Union([Schema.Struct({
3430
- kind: Schema.Literal("party"),
3431
- partyId: PartyIdSchema,
3432
- label: Schema.String
3433
- }), Schema.Struct({
3434
- kind: Schema.Literal("external_address"),
3435
- label: Schema.String
3436
- })]);
3510
+ const PaymentRecipient = Schema.Union([
3511
+ Schema.Struct({
3512
+ kind: Schema.Literal("party"),
3513
+ partyId: PartyIdSchema,
3514
+ label: Schema.String
3515
+ }),
3516
+ Schema.Struct({
3517
+ kind: Schema.Literal("external_address"),
3518
+ label: Schema.String
3519
+ }),
3520
+ Schema.Struct({
3521
+ kind: Schema.Literal("party_account"),
3522
+ partyAccountId: Schema.String,
3523
+ label: Schema.String
3524
+ })
3525
+ ]);
3437
3526
  /** When a Payment's money is released: now, at one time, or streamed over a window. */
3438
3527
  const PaymentTiming = Schema.Union([
3439
3528
  Schema.Struct({ kind: Schema.Literal("instant") }),
@@ -3465,7 +3554,8 @@ const PaymentRef = Schema.Union([
3465
3554
  Schema.Struct({
3466
3555
  kind: Schema.Literal("party"),
3467
3556
  partyId: PartyIdSchema
3468
- })
3557
+ }),
3558
+ PartyAccountRefSchema$1
3469
3559
  ]);
3470
3560
  /** One Payment as a participant reads it. */
3471
3561
  const Payment = Schema.Struct({
@@ -3494,9 +3584,27 @@ const Payment = Schema.Struct({
3494
3584
  retryRequired: Schema.Boolean,
3495
3585
  notSent: Schema.optionalKey(Schema.Literal(true))
3496
3586
  })),
3587
+ requestedOutput: Schema.optionalKey(MoneySchema),
3588
+ outputExact: Schema.optionalKey(Schema.Boolean),
3589
+ recipientOnCapxul: Schema.optionalKey(Schema.Boolean),
3590
+ recipientWarning: Schema.optionalKey(Schema.Boolean),
3591
+ legs: Schema.optionalKey(Schema.Array(Schema.Struct({
3592
+ kind: Schema.Literals(["funding", "delivery"]),
3593
+ state: Schema.Literals([
3594
+ "pending",
3595
+ "done",
3596
+ "failed",
3597
+ "refunded"
3598
+ ])
3599
+ }))),
3600
+ links: Schema.optionalKey(Schema.Struct({
3601
+ quoteId: Schema.String,
3602
+ railOperationId: Schema.String,
3603
+ refundMovementId: Schema.optionalKey(Schema.String)
3604
+ })),
3497
3605
  createdAt: EpochMsSchema$1,
3498
3606
  updatedAt: EpochMsSchema$1
3499
- }).pipe(Schema.check(Schema.makeFilter((payment) => payment.documents.every((document) => document.role !== "instruction" || document.kind === "memo" || paymentTypeForDocumentKind(document.kind) === payment.paymentType), { message: "document kind must map to paymentType" })));
3607
+ }).pipe(Schema.check(Schema.makeFilter((payment) => payment.documents.every((document) => document.role !== "instruction" || document.kind === "memo" || paymentTypeForDocumentKind(document.kind) === payment.paymentType), { message: "document kind must map to paymentType" }), Schema.makeFilter((payment) => payment.recipient.kind === "party_account" ? payment.requestedOutput !== void 0 && payment.outputExact !== void 0 && payment.recipientOnCapxul !== void 0 && payment.recipientWarning !== void 0 && payment.links !== void 0 && payment.legs?.length === 2 && payment.legs[0]?.kind === "funding" && payment.legs[1]?.kind === "delivery" : payment.requestedOutput === void 0 && payment.outputExact === void 0 && payment.recipientOnCapxul === void 0 && payment.recipientWarning === void 0 && payment.links === void 0 && payment.legs === void 0, { message: "Bank payout Payments require their quote, output and two rail legs" })));
3500
3608
  //#endregion
3501
3609
  //#region ../protocol/src/payments/model.ts
3502
3610
  function toPaymentId(raw) {
@@ -3577,7 +3685,11 @@ const ActivityItemSchema = Schema.Union([Schema.Struct({
3577
3685
  }), Schema.Struct({
3578
3686
  kind: Schema.Literal("movement"),
3579
3687
  id: Schema.String,
3580
- classification: Schema.Literals(["deposit", "movement_only_outflow"]),
3688
+ classification: Schema.Literals([
3689
+ "deposit",
3690
+ "refund",
3691
+ "movement_only_outflow"
3692
+ ]),
3581
3693
  amount: Amount,
3582
3694
  direction: Direction,
3583
3695
  counterpartyLabel: Schema.String,
@@ -3737,7 +3849,7 @@ const ActivityOverlaySchema = Schema.Struct({
3737
3849
  * cursor, limit or window, a scope the caller does not take part in, or a
3738
3850
  * signed-in user whose Account is not ready.
3739
3851
  */
3740
- const READ = [
3852
+ const READ$1 = [
3741
3853
  "NOT_AUTHENTICATED",
3742
3854
  "INVALID_INPUT",
3743
3855
  ...DEFECTS
@@ -3754,7 +3866,7 @@ const items = {
3754
3866
  filter: Schema.optionalKey(ActivityFilterSchema)
3755
3867
  }),
3756
3868
  output: ActivityPageSchema,
3757
- errors: READ
3869
+ errors: READ$1
3758
3870
  }),
3759
3871
  /** Per-asset totals and the row count over one window of the actor's activity. */
3760
3872
  summary: Operation.query("activity.items.summary", {
@@ -3763,7 +3875,7 @@ const items = {
3763
3875
  window: Schema.optionalKey(ActivityRangeSchema)
3764
3876
  }),
3765
3877
  output: ActivitySummarySchema,
3766
- errors: READ
3878
+ errors: READ$1
3767
3879
  }),
3768
3880
  /** One row's exact detail and the reader's annotation; null when the caller cannot read it. */
3769
3881
  get: Operation.query("activity.items.get", {
@@ -3772,7 +3884,7 @@ const items = {
3772
3884
  actor: Schema.optionalKey(ActivityGetActorSchema)
3773
3885
  }),
3774
3886
  output: Schema.NullOr(ActivityDetailSchema),
3775
- errors: READ
3887
+ errors: READ$1
3776
3888
  })
3777
3889
  };
3778
3890
  const annotations = {
@@ -3791,7 +3903,7 @@ save: Operation.mutation("activity.annotations.save", {
3791
3903
  output: ActivityAnnotationSchema,
3792
3904
  /** An Organization's annotation also needs the caller's exact Account, Safe and command authority. */
3793
3905
  errors: [
3794
- ...READ,
3906
+ ...READ$1,
3795
3907
  "ROLE_PERMISSION_DENIED",
3796
3908
  "ACCOUNT_NOT_FOUND",
3797
3909
  "SMART_ACCOUNT_MISSING"
@@ -3806,7 +3918,7 @@ get: Operation.query("activity.overlays.get", {
3806
3918
  settlementIds: Schema.optionalKey(Schema.Array(Schema.String))
3807
3919
  }),
3808
3920
  output: ActivityOverlaySchema,
3809
- errors: READ
3921
+ errors: READ$1
3810
3922
  }) };
3811
3923
  /** A document read: no session, or a pair the caller may not read or that fails its integrity. */
3812
3924
  const DOCUMENT = [
@@ -3835,6 +3947,272 @@ const documents = {
3835
3947
  })
3836
3948
  };
3837
3949
  //#endregion
3950
+ //#region ../protocol/src/parties/verification-schema.ts
3951
+ const VERIFICATION_DOCUMENT_FIELDS = [
3952
+ "id_front",
3953
+ "id_back",
3954
+ "proof_of_address",
3955
+ "business_formation",
3956
+ "ownership_information",
3957
+ "proof_of_nature_of_business",
3958
+ "evidence_of_good_standing",
3959
+ "flow_of_funds",
3960
+ "proof_of_signatory_authority"
3961
+ ];
3962
+ const VerificationStateSchema = Schema.Literals([
3963
+ "not_started",
3964
+ "in_progress",
3965
+ "submitted",
3966
+ "needs_more",
3967
+ "liveness_needed",
3968
+ "under_review",
3969
+ "approved",
3970
+ "rejected",
3971
+ "restricted"
3972
+ ]);
3973
+ const VerificationQuestionSchema = Schema.Struct({
3974
+ id: Schema.String,
3975
+ label: Schema.String,
3976
+ type: Schema.Literals([
3977
+ "text",
3978
+ "date",
3979
+ "choice",
3980
+ "boolean",
3981
+ "file"
3982
+ ]),
3983
+ secret: Schema.Boolean,
3984
+ multiple: Schema.optionalKey(Schema.Boolean),
3985
+ when: Schema.optionalKey(Schema.Struct({
3986
+ field: Schema.String,
3987
+ equals: Schema.Union([Schema.String, Schema.Boolean])
3988
+ })),
3989
+ choices: Schema.optionalKey(Schema.Array(Schema.Struct({
3990
+ value: Schema.String,
3991
+ label: Schema.String
3992
+ }))),
3993
+ help: Schema.optionalKey(Schema.String)
3994
+ });
3995
+ const VerificationCurrencySchema = Schema.Struct({
3996
+ currency: Schema.Literals([
3997
+ "usd",
3998
+ "eur",
3999
+ "gbp"
4000
+ ]),
4001
+ status: Schema.Literals([
4002
+ "pending",
4003
+ "approved",
4004
+ "needs_more",
4005
+ "rejected",
4006
+ "restricted"
4007
+ ])
4008
+ });
4009
+ const Common = {
4010
+ invitationId: Schema.optionalKey(Schema.String),
4011
+ businessStatus: Schema.optionalKey(Schema.Literals([
4012
+ "waiting_people",
4013
+ "in_review",
4014
+ "approved",
4015
+ "rejected",
4016
+ "restricted"
4017
+ ])),
4018
+ subjectKind: Schema.optionalKey(Schema.Literals([
4019
+ "person",
4020
+ "business",
4021
+ "business_person"
4022
+ ])),
4023
+ organization: Schema.optionalKey(Schema.Struct({
4024
+ id: Schema.String,
4025
+ name: Schema.String
4026
+ })),
4027
+ journeyId: Schema.String,
4028
+ currencies: Schema.Array(VerificationCurrencySchema),
4029
+ next: Schema.Struct({ argv: Schema.Array(Schema.String) })
4030
+ };
4031
+ const VerificationStatusSchema = Schema.Union([
4032
+ Schema.Struct({
4033
+ status: Schema.Literal("not_started"),
4034
+ ...Common
4035
+ }),
4036
+ Schema.Struct({
4037
+ status: Schema.Literal("waiting_people"),
4038
+ missingRoles: Schema.Array(Schema.Literals(["control", "signer"])),
4039
+ people: Schema.Array(Schema.Struct({
4040
+ invitationId: Schema.String,
4041
+ name: Schema.String,
4042
+ email: Schema.String,
4043
+ self: Schema.Boolean,
4044
+ status: Schema.Literals([
4045
+ "invited",
4046
+ "submitted",
4047
+ "needs_more"
4048
+ ]),
4049
+ delivery: Schema.Literals([
4050
+ "pending",
4051
+ "sent",
4052
+ "failed"
4053
+ ])
4054
+ })),
4055
+ ...Common
4056
+ }),
4057
+ Schema.Struct({
4058
+ status: Schema.Literal("needs_person"),
4059
+ action: Schema.Literals(["accept_terms", "liveness_check"]),
4060
+ url: Schema.String,
4061
+ ...Common
4062
+ }),
4063
+ Schema.Struct({
4064
+ status: Schema.Literal("needs_answers"),
4065
+ questions: Schema.Array(VerificationQuestionSchema),
4066
+ completed: Schema.Array(Schema.Literals([
4067
+ "personal_details",
4068
+ "address",
4069
+ "id"
4070
+ ])),
4071
+ issues: Schema.Array(Schema.Struct({
4072
+ fieldId: Schema.String,
4073
+ message: Schema.String
4074
+ })),
4075
+ alternative: Schema.optionalKey(Schema.Struct({
4076
+ action: Schema.Literal("liveness_check"),
4077
+ url: Schema.String
4078
+ })),
4079
+ ...Common
4080
+ }),
4081
+ Schema.Struct({
4082
+ status: Schema.Literals([
4083
+ "in_review",
4084
+ "approved",
4085
+ "rejected",
4086
+ "restricted"
4087
+ ]),
4088
+ ...Common
4089
+ })
4090
+ ]);
4091
+ //#endregion
4092
+ //#region ../protocol/src/banking/schema.ts
4093
+ const BankCurrencySchema = Schema.Literals([
4094
+ "usd",
4095
+ "eur",
4096
+ "gbp"
4097
+ ]);
4098
+ const SettlementTokenSchema = Schema.Literals(["usdc", "eurc"]);
4099
+ const BankDetailsStateSchema = Schema.Literals([
4100
+ "requested",
4101
+ "active",
4102
+ "deactivated",
4103
+ "closed",
4104
+ "failed"
4105
+ ]);
4106
+ const optionalText$1 = Schema.optionalKey(Schema.String);
4107
+ /** List values are masked. Only an explicit single-currency read reveals these fields. */
4108
+ const BankDetailsFieldsSchema = Schema.Struct({
4109
+ routingNumber: optionalText$1,
4110
+ accountNumber: optionalText$1,
4111
+ iban: optionalText$1,
4112
+ bic: optionalText$1,
4113
+ sortCode: optionalText$1
4114
+ });
4115
+ const BankDetailsSchema = Schema.Struct({
4116
+ receivingAccountId: Schema.String,
4117
+ currency: BankCurrencySchema,
4118
+ state: BankDetailsStateSchema,
4119
+ visibility: Schema.Literals(["masked", "full"]),
4120
+ bankName: optionalText$1,
4121
+ accountHolder: optionalText$1,
4122
+ bankAddress: optionalText$1,
4123
+ paymentRails: Schema.Array(Schema.String),
4124
+ fields: BankDetailsFieldsSchema,
4125
+ destination: Schema.Struct({
4126
+ chainId: Schema.Finite,
4127
+ token: SettlementTokenSchema,
4128
+ address: Schema.String
4129
+ }),
4130
+ developerFeePercent: optionalText$1,
4131
+ minimumDeposit: optionalText$1,
4132
+ notice: optionalText$1
4133
+ });
4134
+ const BankDetailsOverviewSchema = Schema.Struct({
4135
+ accounts: Schema.Array(BankDetailsSchema),
4136
+ verification: Schema.Array(VerificationCurrencySchema)
4137
+ });
4138
+ /** Gross bank money and the net token credit are separate amounts. */
4139
+ const BankDepositSchema = Schema.Struct({
4140
+ bankDepositId: Schema.String,
4141
+ receivingAccountId: Schema.String,
4142
+ currency: BankCurrencySchema,
4143
+ amount: Schema.String,
4144
+ receivedAt: EpochMsSchema$1,
4145
+ sender: optionalText$1,
4146
+ reference: optionalText$1,
4147
+ status: Schema.Literals([
4148
+ "processing",
4149
+ "arriving",
4150
+ "credited",
4151
+ "returned",
4152
+ "below_minimum"
4153
+ ]),
4154
+ refundState: Schema.optionalKey(Schema.Literals([
4155
+ "in_flight",
4156
+ "done",
4157
+ "failed"
4158
+ ])),
4159
+ credit: Schema.optionalKey(Schema.Struct({
4160
+ amount: AssetAmountSchema,
4161
+ symbol: Schema.Literals(["USDC", "EURC"]),
4162
+ chainId: Schema.Finite,
4163
+ transactionHash: Schema.String,
4164
+ movementId: Schema.String
4165
+ })),
4166
+ match: Schema.optionalKey(Schema.Union([Schema.Struct({
4167
+ kind: Schema.Literal("request"),
4168
+ requestId: Schema.String,
4169
+ reference: Schema.String,
4170
+ how: Schema.Literals(["reference", "manual"])
4171
+ }), Schema.Struct({ kind: Schema.Literal("not_request") })]))
4172
+ });
4173
+ const BankDepositsPageSchema = pageOf(BankDepositSchema);
4174
+ const BankDepositCandidatesPageSchema = pageOf(Schema.Struct({
4175
+ requestId: Schema.String,
4176
+ reference: Schema.String,
4177
+ amount: Schema.Union([AssetAmountSchema, MoneySchema]),
4178
+ dueAt: EpochMsSchema$1,
4179
+ payerPartyId: optionalText$1,
4180
+ payerLabel: optionalText$1
4181
+ }));
4182
+ //#endregion
4183
+ //#region ../protocol/src/payments/payout-schema.ts
4184
+ const PartyAccountRefSchema = Schema.Struct({
4185
+ kind: Schema.Literal("party_account"),
4186
+ partyAccountId: nonEmpty("partyAccountId")
4187
+ });
4188
+ const PaymentQuoteInputSchema = Schema.Struct({
4189
+ actor: Schema.optionalKey(ActorScopeSchema),
4190
+ to: PartyAccountRefSchema,
4191
+ amount: Schema.Union([MoneySchema, AssetAmountSchema]),
4192
+ asset: Schema.optionalKey(AssetIdSchema),
4193
+ requestKey: nonEmpty("requestKey")
4194
+ });
4195
+ const PaymentQuoteSchema = Schema.Struct({
4196
+ quoteId: nonEmpty("quoteId"),
4197
+ partyAccountId: nonEmpty("partyAccountId"),
4198
+ requestedOutput: MoneySchema,
4199
+ outputExact: Schema.Boolean,
4200
+ funding: AssetAmountSchema,
4201
+ expiresAt: Schema.Finite,
4202
+ recipient: Schema.Struct({
4203
+ label: Schema.String,
4204
+ bankName: Schema.optionalKey(Schema.String),
4205
+ last4: Schema.String,
4206
+ currency: BankCurrencySchema,
4207
+ onCapxul: Schema.Boolean
4208
+ }),
4209
+ rate: Schema.optionalKey(DecimalStringSchema),
4210
+ warnings: Schema.Array(Schema.Struct({
4211
+ code: Schema.Literal("RECIPIENT_ON_CAPXUL"),
4212
+ message: Schema.String
4213
+ }))
4214
+ });
4215
+ //#endregion
3838
4216
  //#region ../protocol/src/permissions/value-schema.ts
3839
4217
  const PermissionIdSchema = nonEmpty("permissionId").pipe(Schema.refine((value) => value.length > 0));
3840
4218
  const PermissionAssignmentIdSchema = nonEmpty("permissionAssignmentId").pipe(Schema.refine((value) => value.length > 0));
@@ -3876,6 +4254,7 @@ const MovementSchema = Schema.Struct({
3876
4254
  const MovementClassificationSchema = Schema.Literals([
3877
4255
  "protocol_settlement",
3878
4256
  "deposit",
4257
+ "refund",
3879
4258
  "movement_only_outflow"
3880
4259
  ]);
3881
4260
  const MovementAttributionSchema = Schema.Struct({
@@ -4275,7 +4654,16 @@ const PaymentLedgerRecordSchema = Schema.Union([Schema.Struct({
4275
4654
  settlementLogIndex: Schema.optional(LogIndexSchema),
4276
4655
  settledBlockNumber: Schema.optional(BlockNumberSchema$1),
4277
4656
  settledBlockHash: Schema.optional(Bytes32Schema),
4278
- settledEventLogIndex: Schema.optional(LogIndexSchema)
4657
+ settledEventLogIndex: Schema.optional(LogIndexSchema),
4658
+ quoteId: Schema.optional(nonEmpty("quoteId")),
4659
+ railOperationId: Schema.optional(nonEmpty("railOperationId")),
4660
+ payoutRecipientLabel: Schema.optional(Schema.String),
4661
+ payoutRecipientOnCapxul: Schema.optional(Schema.Boolean),
4662
+ payoutWarnRecipientOnCapxul: Schema.optional(Schema.Boolean),
4663
+ payoutOwnerPartyId: Schema.optional(Schema.String),
4664
+ requestedOutput: Schema.optional(MoneySchema),
4665
+ payoutOutputExact: Schema.optional(Schema.Boolean),
4666
+ refundMovementId: Schema.optional(MovementIdSchema)
4279
4667
  }), Schema.Struct({
4280
4668
  ...PaymentLedgerBaseSchema.fields,
4281
4669
  ledgerKind: Schema.Literal("Deposit"),
@@ -4284,7 +4672,7 @@ const PaymentLedgerRecordSchema = Schema.Union([Schema.Struct({
4284
4672
  documentHash: Schema.optional(Schema.Never),
4285
4673
  permissionId: Schema.optional(Schema.Never),
4286
4674
  purposeKind: Schema.optional(Schema.Never)
4287
- })]).pipe(Schema.refine((record) => record.ledgerKind === "Deposit" || hasActorBoundPermission(record.actor, record.actor.kind === "organization" ? record.actor.orgId : void 0, record.permissionId), { message: "Organization Payment and Payout records require permissionId; personal records forbid it" }));
4675
+ })]).pipe(Schema.refine((record) => record.ledgerKind === "Deposit" || hasActorBoundPermission(record.actor, record.actor.kind === "organization" ? record.actor.orgId : void 0, record.permissionId) && (record.recipient.kind === "party_account" ? record.ledgerKind === "Payout" && record.quoteId !== void 0 && record.railOperationId !== void 0 && record.payoutRecipientLabel !== void 0 && record.payoutRecipientOnCapxul !== void 0 && record.payoutWarnRecipientOnCapxul !== void 0 && record.payoutOwnerPartyId !== void 0 && record.requestedOutput !== void 0 && record.payoutOutputExact !== void 0 : record.quoteId === void 0 && record.railOperationId === void 0), { message: "Organization Payment and Payout records require permissionId; personal records forbid it" }));
4288
4676
  const PaymentCoreErrorSchema = Schema.Union([
4289
4677
  Schema.Struct({
4290
4678
  code: Schema.Literal("INVALID_TRANSITION"),
@@ -4335,8 +4723,16 @@ const ProtocolBirthInputSchema = Schema.Struct({
4335
4723
  documentHash: NonzeroDocumentHashSchema,
4336
4724
  documentContentHash: NonzeroDocumentHashSchema,
4337
4725
  release: ReleaseTermsSchema,
4726
+ quoteId: Schema.optional(nonEmpty("quoteId")),
4727
+ railOperationId: Schema.optional(nonEmpty("railOperationId")),
4728
+ payoutRecipientLabel: Schema.optional(Schema.String),
4729
+ payoutRecipientOnCapxul: Schema.optional(Schema.Boolean),
4730
+ payoutWarnRecipientOnCapxul: Schema.optional(Schema.Boolean),
4731
+ payoutOwnerPartyId: Schema.optional(Schema.String),
4732
+ requestedOutput: Schema.optional(MoneySchema),
4733
+ payoutOutputExact: Schema.optional(Schema.Boolean),
4338
4734
  lineage: Schema.optional(PaymentCommandLineageSchema)
4339
- }).pipe(Schema.refine((birth) => hasActorBoundPermission(birth.actor, birth.actor.kind === "organization" ? birth.actor.orgId : void 0, birth.permissionId), { message: "Organization Payment and Payout births require permissionId; personal births forbid it" }));
4735
+ }).pipe(Schema.refine((birth) => hasActorBoundPermission(birth.actor, birth.actor.kind === "organization" ? birth.actor.orgId : void 0, birth.permissionId) && (birth.recipient.kind === "party_account" ? birth.ledgerKind === "Payout" && birth.release.kind === "instant" && birth.quoteId !== void 0 && birth.railOperationId !== void 0 && birth.payoutRecipientLabel !== void 0 && birth.payoutRecipientOnCapxul !== void 0 && birth.payoutWarnRecipientOnCapxul !== void 0 && birth.payoutOwnerPartyId !== void 0 && birth.requestedOutput !== void 0 && birth.payoutOutputExact !== void 0 : birth.quoteId === void 0 && birth.railOperationId === void 0), { message: "Organization Payment and Payout births require permissionId; personal births forbid it" }));
4340
4736
  const ApplyVerifiedEvidenceCommandSchema = Schema.Struct({
4341
4737
  kind: Schema.Literal("apply_verified_evidence"),
4342
4738
  paymentId: PaymentIdSchema,
@@ -4361,7 +4757,11 @@ Schema.Union([
4361
4757
  paymentIds: Schema.Array(PaymentIdSchema),
4362
4758
  userOpHash: Bytes32Schema
4363
4759
  }),
4364
- ApplyVerifiedEvidenceCommandSchema
4760
+ ApplyVerifiedEvidenceCommandSchema,
4761
+ Schema.Struct({
4762
+ kind: Schema.Literal("apply_rail_delivery"),
4763
+ paymentId: PaymentIdSchema
4764
+ })
4365
4765
  ]);
4366
4766
  Schema.Union([
4367
4767
  Schema.Struct({
@@ -4437,12 +4837,11 @@ function paymentDocumentOptionsPayloadSize(options) {
4437
4837
  }
4438
4838
  const PaymentDocumentOptionsSchema = PaymentDocumentOptionsFieldsSchema.check(Schema.makeFilter((options) => paymentDocumentOptionsPayloadSize(options) <= 524288));
4439
4839
  const PaymentDocumentOptionsBatchSchema = Schema.Array(PaymentDocumentOptionsSchema).check(Schema.makeFilter((options) => options.length <= 100 && options.reduce((total, itemOptions) => total + paymentDocumentOptionsPayloadSize(itemOptions), 0) <= 524288));
4440
- //#endregion
4441
- //#region ../protocol/src/payments/schema/commands.ts
4442
4840
  const PaymentBirthItemSchema = Schema.Union([Schema.Struct({
4443
4841
  operation: Schema.Literal("send"),
4444
4842
  recipient: ActorOrDestinationRefSchema,
4445
4843
  amount: AssetAmountSchema,
4844
+ quoteId: Schema.optional(nonEmpty("quoteId")),
4446
4845
  purposeKind: PaymentPurposeKindSchema,
4447
4846
  document: Schema.optional(PaymentInstructionInputSchema),
4448
4847
  supportingReceipts: Schema.optional(Schema.Array(SupportingReceiptInputSchema)),
@@ -4462,12 +4861,13 @@ const PaymentBirthItemSchema = Schema.Union([Schema.Struct({
4462
4861
  operation: Schema.Literal("create_commitment"),
4463
4862
  recipient: ActorOrDestinationRefSchema,
4464
4863
  amount: AssetAmountSchema,
4864
+ quoteId: Schema.optional(nonEmpty("quoteId")),
4465
4865
  release: ReleaseTermsSchema.pipe(Schema.refine((release) => release.kind === "scheduled" || release.kind === "stream", { message: "Commitment release must be scheduled or stream" })),
4466
4866
  purposeKind: PaymentPurposeKindSchema,
4467
4867
  document: Schema.optional(PaymentInstructionInputSchema),
4468
4868
  supportingReceipts: Schema.optional(Schema.Array(SupportingReceiptInputSchema)),
4469
4869
  payroll: Schema.optional(Schema.Never)
4470
- })]);
4870
+ })]).pipe(Schema.refine((item) => item.recipient.kind === "party_account" ? item.operation === "send" && item.quoteId !== void 0 : item.quoteId === void 0, { message: "Bank payouts require an instant send with its accepted quote" }));
4471
4871
  const PaymentBirthCommandSchema = Schema.Struct({
4472
4872
  kind: Schema.Literal("birth"),
4473
4873
  requestKey: nonEmpty("requestKey"),
@@ -4584,6 +4984,7 @@ const PaymentExecutionIntentSchema = Schema.Struct({
4584
4984
  to: PaymentRef,
4585
4985
  externalAddressAcknowledged: Schema.optional(Schema.Literal(true)),
4586
4986
  amount: AssetAmountSchema,
4987
+ quoteId: Schema.optional(nonEmpty("quoteId")),
4587
4988
  paymentType: Schema.optional(Schema.Literals([
4588
4989
  "unspecified",
4589
4990
  "invoice",
@@ -4591,7 +4992,7 @@ const PaymentExecutionIntentSchema = Schema.Struct({
4591
4992
  "reimbursement"
4592
4993
  ])),
4593
4994
  timing: Schema.optional(PaymentTiming)
4594
- }).check(Schema.makeFilter((value) => Schema.is(PaymentDocumentOptionsSchema)(value)));
4995
+ }).check(Schema.makeFilter((value) => Schema.is(PaymentDocumentOptionsSchema)(value) && (value.to.kind === "party_account" ? value.quoteId !== void 0 && (value.timing === void 0 || value.timing.kind === "instant") : value.quoteId === void 0)));
4595
4996
  const PreparePaymentExecutionInputSchema = Schema.Struct({
4596
4997
  requestKey: nonEmpty("requestKey"),
4597
4998
  signerAddress: AddressSchema$1,
@@ -4660,6 +5061,7 @@ const SubmittedPaymentCommandExecutionSchema = Schema.Struct({
4660
5061
  userOpHash: Bytes32Schema,
4661
5062
  payments: Schema.Array(Payment)
4662
5063
  });
5064
+ const RedirectPaymentRef = PaymentRef.pipe(Schema.refine((recipient) => recipient.kind !== "party_account", { message: "Bank payout recipients cannot receive commitment redirects" }));
4663
5065
  const PaymentLifecycleExecutionIntentSchema = Schema.Union([
4664
5066
  Schema.Struct({
4665
5067
  kind: Schema.Literal("retry"),
@@ -4676,7 +5078,7 @@ const PaymentLifecycleExecutionIntentSchema = Schema.Union([
4676
5078
  Schema.Struct({
4677
5079
  kind: Schema.Literal("redirect"),
4678
5080
  paymentId: PaymentIdSchema,
4679
- recipient: PaymentRef
5081
+ recipient: RedirectPaymentRef
4680
5082
  })
4681
5083
  ]);
4682
5084
  const PreparePaymentLifecycleExecutionInputSchema = Schema.Struct({
@@ -4703,6 +5105,7 @@ const OrganizationPaymentExecutionItemSchema = Schema.Struct({
4703
5105
  to: PaymentRef,
4704
5106
  externalAddressAcknowledged: Schema.optional(Schema.Literal(true)),
4705
5107
  amount: AssetAmountSchema,
5108
+ quoteId: Schema.optional(nonEmpty("quoteId")),
4706
5109
  paymentType: Schema.optional(Schema.Literals([
4707
5110
  "unspecified",
4708
5111
  "invoice",
@@ -4711,7 +5114,7 @@ const OrganizationPaymentExecutionItemSchema = Schema.Struct({
4711
5114
  ])),
4712
5115
  /** When the recipient gets it: instant (the default), or held until a date or over a period. */
4713
5116
  timing: Schema.optional(PaymentTiming)
4714
- }).check(Schema.makeFilter((value) => Schema.is(PaymentDocumentOptionsSchema)(value)));
5117
+ }).check(Schema.makeFilter((value) => Schema.is(PaymentDocumentOptionsSchema)(value) && (value.to.kind === "party_account" ? value.quoteId !== void 0 && (value.timing === void 0 || value.timing.kind === "instant") : value.quoteId === void 0)));
4715
5118
  const PrepareOrganizationPaymentExecutionInputSchema = Schema.Struct({
4716
5119
  orgId: nonEmpty("orgId"),
4717
5120
  permissionId: PermissionIdSchema,
@@ -4873,7 +5276,11 @@ const ApprovalSummarySchema = Schema.Struct({
4873
5276
  to: Schema.Struct({ label: Schema.String }),
4874
5277
  /** The total, when every item moves one asset; null when nothing moves (a Permission change). */
4875
5278
  amount: Schema.NullOr(AssetAmountSchema),
4876
- network: ApprovalNetworkSchema
5279
+ network: ApprovalNetworkSchema,
5280
+ warnings: Schema.optional(Schema.Array(Schema.Struct({
5281
+ code: Schema.Literal("RECIPIENT_ON_CAPXUL"),
5282
+ message: Schema.String
5283
+ })))
4877
5284
  });
4878
5285
  /** The exact operation the signature covers: the digest is the one thing the key signs. */
4879
5286
  const ApprovalOperationSchema = Schema.Struct({
@@ -5260,6 +5667,95 @@ const keys = {
5260
5667
  })
5261
5668
  };
5262
5669
  //#endregion
5670
+ //#region ../protocol/src/banking/operations.ts
5671
+ const actor$3 = Schema.optionalKey(ActorScopeSchema);
5672
+ const target = {
5673
+ actor: actor$3,
5674
+ currency: BankCurrencySchema
5675
+ };
5676
+ const errors = [
5677
+ "NOT_AUTHENTICATED",
5678
+ "INVALID_INPUT",
5679
+ "ROLE_PERMISSION_DENIED",
5680
+ "ACCOUNT_NOT_FOUND",
5681
+ "SMART_ACCOUNT_MISSING",
5682
+ "PROVIDER_ERROR",
5683
+ ...DEFECTS
5684
+ ];
5685
+ const writeErrors = [...errors, "WRONG_STATE"];
5686
+ const bankDetails = {
5687
+ list: Operation.query("banking.bankDetails.list", {
5688
+ input: Schema.Struct({ actor: actor$3 }),
5689
+ output: BankDetailsOverviewSchema,
5690
+ errors
5691
+ }),
5692
+ get: Operation.query("banking.bankDetails.get", {
5693
+ input: Schema.Struct(target),
5694
+ output: Schema.NullOr(BankDetailsSchema),
5695
+ errors
5696
+ }),
5697
+ open: Operation.action("banking.bankDetails.open", {
5698
+ input: Schema.Struct(target),
5699
+ output: BankDetailsSchema,
5700
+ errors: writeErrors
5701
+ }),
5702
+ settle: Operation.action("banking.bankDetails.settle", {
5703
+ input: Schema.Struct({
5704
+ ...target,
5705
+ token: SettlementTokenSchema
5706
+ }),
5707
+ output: BankDetailsSchema,
5708
+ errors: writeErrors
5709
+ }),
5710
+ deactivate: Operation.action("banking.bankDetails.deactivate", {
5711
+ input: Schema.Struct(target),
5712
+ output: BankDetailsSchema,
5713
+ errors: writeErrors
5714
+ }),
5715
+ reactivate: Operation.action("banking.bankDetails.reactivate", {
5716
+ input: Schema.Struct(target),
5717
+ output: BankDetailsSchema,
5718
+ errors: writeErrors
5719
+ })
5720
+ };
5721
+ const deposits = {
5722
+ list: Operation.query("banking.deposits.list", {
5723
+ input: Schema.Struct({
5724
+ actor: actor$3,
5725
+ cursor: Schema.optionalKey(Schema.String),
5726
+ unmatched: Schema.optionalKey(Schema.Boolean)
5727
+ }),
5728
+ output: BankDepositsPageSchema,
5729
+ errors
5730
+ }),
5731
+ get: Operation.query("banking.deposits.get", {
5732
+ input: Schema.Struct({
5733
+ actor: actor$3,
5734
+ bankDepositId: Schema.String
5735
+ }),
5736
+ output: Schema.NullOr(BankDepositSchema),
5737
+ errors
5738
+ }),
5739
+ candidates: Operation.query("banking.deposits.candidates", {
5740
+ input: Schema.Struct({
5741
+ actor: actor$3,
5742
+ bankDepositId: Schema.String,
5743
+ cursor: Schema.optionalKey(Schema.String)
5744
+ }),
5745
+ output: BankDepositCandidatesPageSchema,
5746
+ errors
5747
+ }),
5748
+ match: Operation.mutation("banking.deposits.match", {
5749
+ input: Schema.Struct({
5750
+ actor: actor$3,
5751
+ bankDepositId: Schema.String,
5752
+ requestId: Schema.NullOr(Schema.String)
5753
+ }),
5754
+ output: BankDepositSchema,
5755
+ errors: writeErrors
5756
+ })
5757
+ };
5758
+ //#endregion
5263
5759
  //#region ../protocol/src/documents/operations.ts
5264
5760
  /** Every call: no session, or input that does not decode. */
5265
5761
  const CALL$8 = ["NOT_AUTHENTICATED", "INVALID_INPUT"];
@@ -6896,6 +7392,159 @@ const setups = {
6896
7392
  })
6897
7393
  };
6898
7394
  //#endregion
7395
+ //#region ../protocol/src/parties/accounts-schema.ts
7396
+ const BankAccountOwnerTypeSchema = Schema.Literals(["individual", "business"]);
7397
+ const text$1 = Schema.String;
7398
+ const optionalText = Schema.optionalKey(text$1);
7399
+ const holder = {
7400
+ holderName: text$1,
7401
+ bankName: optionalText
7402
+ };
7403
+ const owner = {
7404
+ ownerType: Schema.optionalKey(BankAccountOwnerTypeSchema),
7405
+ firstName: optionalText,
7406
+ lastName: optionalText,
7407
+ businessName: optionalText
7408
+ };
7409
+ const BankBeneficiaryAddressSchema = Schema.Struct({
7410
+ streetLine1: text$1,
7411
+ streetLine2: optionalText,
7412
+ city: text$1,
7413
+ state: optionalText,
7414
+ postalCode: optionalText,
7415
+ country: text$1
7416
+ });
7417
+ const iban = {
7418
+ ...holder,
7419
+ currency: Schema.Literal("eur"),
7420
+ iban: text$1,
7421
+ bic: optionalText
7422
+ };
7423
+ Schema.Union([
7424
+ Schema.Struct({
7425
+ ...holder,
7426
+ currency: Schema.Literal("usd"),
7427
+ accountNumber: text$1,
7428
+ routingNumber: text$1,
7429
+ accountType: Schema.Literals(["checking", "savings"]),
7430
+ address: BankBeneficiaryAddressSchema
7431
+ }),
7432
+ Schema.Struct({
7433
+ ...holder,
7434
+ ...owner,
7435
+ currency: Schema.Literal("gbp"),
7436
+ sortCode: text$1,
7437
+ accountNumber: text$1
7438
+ }),
7439
+ Schema.Struct({
7440
+ ...iban,
7441
+ ownerType: Schema.Literal("individual"),
7442
+ firstName: text$1,
7443
+ lastName: text$1
7444
+ }),
7445
+ Schema.Struct({
7446
+ ...iban,
7447
+ ownerType: Schema.Literal("business"),
7448
+ businessName: text$1
7449
+ })
7450
+ ]);
7451
+ const BankAccountFilterSchema = Schema.Union([Schema.Struct({ kind: Schema.Literal("self") }), Schema.Struct({
7452
+ kind: Schema.Literal("contact"),
7453
+ ref: RecipientLocatorSchema
7454
+ })]);
7455
+ const BankAccountTargetSchema = Schema.Union([BankAccountFilterSchema, Schema.Struct({
7456
+ kind: Schema.Literal("new"),
7457
+ name: text$1,
7458
+ email: optionalText
7459
+ })]);
7460
+ const BankAccountSchema = Schema.Struct({
7461
+ partyAccountId: text$1,
7462
+ ownerPartyId: text$1,
7463
+ ownerScope: Schema.Literals(["self", "contact"]),
7464
+ currency: BankCurrencySchema,
7465
+ holderName: text$1,
7466
+ bankName: optionalText,
7467
+ last4: text$1,
7468
+ state: Schema.Literals([
7469
+ "saved",
7470
+ "active",
7471
+ "inactive"
7472
+ ]),
7473
+ recipient: Schema.Struct({
7474
+ ref: RecipientLocatorSchema,
7475
+ label: text$1,
7476
+ onCapxul: Schema.Boolean
7477
+ })
7478
+ });
7479
+ const BankAccountFieldSchema = Schema.Struct({
7480
+ id: text$1,
7481
+ label: text$1,
7482
+ required: Schema.Boolean,
7483
+ choices: Schema.optionalKey(Schema.Array(Schema.Struct({
7484
+ value: text$1,
7485
+ label: text$1
7486
+ }))),
7487
+ minLength: Schema.optionalKey(nonNegativeInteger("minLength")),
7488
+ maxLength: Schema.optionalKey(nonNegativeInteger("maxLength")),
7489
+ pattern: optionalText
7490
+ });
7491
+ const BankAccountRequirementsSchema = Schema.Struct({
7492
+ currency: BankCurrencySchema,
7493
+ fields: Schema.Array(BankAccountFieldSchema)
7494
+ });
7495
+ //#endregion
7496
+ //#region ../protocol/src/parties/accounts-operations.ts
7497
+ const actor$2 = Schema.optionalKey(ActorScopeSchema);
7498
+ const READ = [
7499
+ "NOT_AUTHENTICATED",
7500
+ "INVALID_INPUT",
7501
+ "ROLE_PERMISSION_DENIED",
7502
+ ...DEFECTS
7503
+ ];
7504
+ const WRITE = [
7505
+ ...READ,
7506
+ "SMART_ACCOUNT_MISSING",
7507
+ "ACCOUNT_NOT_FOUND"
7508
+ ];
7509
+ const accounts = {
7510
+ requirements: Operation.query("parties.accounts.requirements", {
7511
+ input: Schema.Struct({
7512
+ actor: actor$2,
7513
+ currency: BankCurrencySchema,
7514
+ ownerType: Schema.optionalKey(BankAccountOwnerTypeSchema),
7515
+ country: Schema.optionalKey(Schema.String)
7516
+ }),
7517
+ output: BankAccountRequirementsSchema,
7518
+ errors: READ
7519
+ }),
7520
+ add: Operation.mutation("parties.accounts.add", {
7521
+ input: Schema.Struct({
7522
+ actor: actor$2,
7523
+ target: BankAccountTargetSchema,
7524
+ details: Schema.Unknown,
7525
+ requestKey: Schema.String
7526
+ }),
7527
+ output: BankAccountSchema,
7528
+ errors: [...WRITE, "PROVIDER_ERROR"]
7529
+ }),
7530
+ list: Operation.query("parties.accounts.list", {
7531
+ input: Schema.Struct({
7532
+ actor: actor$2,
7533
+ target: Schema.optionalKey(BankAccountFilterSchema)
7534
+ }),
7535
+ output: pageOf(BankAccountSchema),
7536
+ errors: READ
7537
+ }),
7538
+ remove: Operation.mutation("parties.accounts.remove", {
7539
+ input: Schema.Struct({
7540
+ actor: actor$2,
7541
+ partyAccountId: Schema.String
7542
+ }),
7543
+ output: Schema.Struct({ partyAccountId: Schema.String }),
7544
+ errors: WRITE
7545
+ })
7546
+ };
7547
+ //#endregion
6899
7548
  //#region ../protocol/src/parties/operations.ts
6900
7549
  /** Every call: no session, or input that does not decode or validate. */
6901
7550
  const CALL$5 = ["NOT_AUTHENTICATED", "INVALID_INPUT"];
@@ -6908,6 +7557,62 @@ const ADMIN$2 = [
6908
7557
  "ACCOUNT_NOT_FOUND"
6909
7558
  ];
6910
7559
  const actor$1 = Schema.optionalKey(ActorScopeSchema);
7560
+ const VERIFICATION_ERRORS = [
7561
+ ...CALL$5,
7562
+ ...DEFECTS,
7563
+ ...MEMBER$1,
7564
+ "WRONG_STATE",
7565
+ "PROVIDER_ERROR"
7566
+ ];
7567
+ const verificationTarget = {
7568
+ orgId: Schema.optionalKey(Schema.String),
7569
+ invitationId: Schema.optionalKey(Schema.String)
7570
+ };
7571
+ /** Person and business verification. Bridge owns the requirements and the decision. */
7572
+ const verifications$1 = {
7573
+ invite: Operation.action("parties.verifications.invite", {
7574
+ input: Schema.Struct({
7575
+ orgId: Schema.String,
7576
+ people: Schema.Unknown
7577
+ }),
7578
+ output: VerificationStatusSchema,
7579
+ errors: VERIFICATION_ERRORS
7580
+ }),
7581
+ start: Operation.action("parties.verifications.start", {
7582
+ input: Schema.Struct({
7583
+ ...verificationTarget,
7584
+ surface: Schema.optionalKey(Schema.Literals([
7585
+ "web",
7586
+ "cli",
7587
+ "agent",
7588
+ "sdk",
7589
+ "unspecified"
7590
+ ]))
7591
+ }),
7592
+ output: VerificationStatusSchema,
7593
+ errors: VERIFICATION_ERRORS
7594
+ }),
7595
+ status: Operation.action("parties.verifications.status", {
7596
+ input: Schema.Struct(verificationTarget),
7597
+ output: VerificationStatusSchema,
7598
+ errors: VERIFICATION_ERRORS
7599
+ }),
7600
+ answer: Operation.action("parties.verifications.answer", {
7601
+ input: Schema.Struct({
7602
+ ...verificationTarget,
7603
+ answers: Schema.Unknown,
7604
+ surface: Schema.optionalKey(Schema.Literals([
7605
+ "web",
7606
+ "cli",
7607
+ "agent",
7608
+ "sdk",
7609
+ "unspecified"
7610
+ ]))
7611
+ }),
7612
+ output: VerificationStatusSchema,
7613
+ errors: VERIFICATION_ERRORS
7614
+ })
7615
+ };
6911
7616
  const OneContact = Schema.Struct({
6912
7617
  actor: actor$1,
6913
7618
  partyId: Schema.String
@@ -7173,38 +7878,52 @@ const PreparedOfferCheckoutExecutionSchema = Schema.Struct({
7173
7878
  //#endregion
7174
7879
  //#region ../protocol/src/requests/checkout-schema.ts
7175
7880
  /** Link holders receive payment terms, not the private Invoice document. */
7176
- const InvoiceCheckoutSummarySchema = Schema.Struct({
7881
+ const InvoiceCheckoutStatusSchema = Schema.Literals([
7882
+ "sent",
7883
+ "pending_settlement",
7884
+ "paid",
7885
+ "cancelled",
7886
+ "declined",
7887
+ "expired",
7888
+ "unavailable"
7889
+ ]);
7890
+ const InvoiceCheckoutCommonSchema = Schema.Struct({
7177
7891
  documentKind: Schema.optional(Schema.Literals(["memo", "invoice"])),
7178
7892
  linkToken: boundedText(128),
7179
7893
  issuerLabel: boundedText(256),
7180
7894
  dueAt: InvoiceDraftSchema.fields.dueAt,
7895
+ documentHash: Bytes32Schema,
7896
+ status: InvoiceCheckoutStatusSchema
7897
+ });
7898
+ const AssetInvoiceCheckoutSummarySchema = Schema.Struct({
7899
+ ...InvoiceCheckoutCommonSchema.fields,
7181
7900
  amount: AssetAmountSchema,
7182
7901
  chainId: ChainIdSchema$1,
7183
7902
  tokenAddress: AddressSchema$1,
7184
7903
  rawAmount: Schema.String,
7185
7904
  recipientSafe: SafeAddressSchema,
7186
7905
  contractAddress: AddressSchema$1,
7187
- settlementId: Bytes32Schema,
7188
- documentHash: Bytes32Schema,
7189
- status: Schema.Literals([
7190
- "sent",
7191
- "pending_settlement",
7192
- "paid",
7193
- "cancelled",
7194
- "declined",
7195
- "expired",
7196
- "unavailable"
7197
- ])
7906
+ settlementId: Bytes32Schema
7907
+ });
7908
+ const MoneyInvoiceCheckoutSummarySchema = Schema.Struct({
7909
+ ...InvoiceCheckoutCommonSchema.fields,
7910
+ documentKind: Schema.Literal("invoice"),
7911
+ amount: MoneySchema,
7912
+ bankPayment: Schema.Struct({
7913
+ receivingAccountId: Schema.String,
7914
+ currency: MoneySchema.fields.currency
7915
+ })
7198
7916
  });
7917
+ const InvoiceCheckoutSummarySchema = Schema.Union([AssetInvoiceCheckoutSummarySchema, MoneyInvoiceCheckoutSummarySchema]);
7199
7918
  const InvoiceCheckoutPreparationSchema = Schema.Struct({
7200
- invoice: InvoiceCheckoutSummarySchema,
7919
+ invoice: AssetInvoiceCheckoutSummarySchema,
7201
7920
  sourceWallet: AddressSchema$1,
7202
7921
  allowance: OfferCheckoutPreparationSchema.fields.allowance,
7203
7922
  approval: CheckoutTransactionSchema,
7204
7923
  payment: CheckoutTransactionSchema
7205
7924
  });
7206
7925
  const InvoiceCheckoutStateSchema = Schema.Struct({
7207
- invoice: InvoiceCheckoutSummarySchema,
7926
+ invoice: AssetInvoiceCheckoutSummarySchema,
7208
7927
  verification: CheckoutStateSchema.fields.verification,
7209
7928
  receipt: Schema.NullOr(CheckoutReceiptSchema),
7210
7929
  latePayment: Schema.Boolean
@@ -7234,22 +7953,27 @@ const PrepareInvoiceCheckoutExecutionInputSchema = Schema.Struct({
7234
7953
  const { checkout: _offerSnapshotField, ...registeredCheckoutExecutionFields } = PreparedOfferCheckoutExecutionSchema.fields;
7235
7954
  const PreparedInvoiceCheckoutExecutionSchema = Schema.Struct({
7236
7955
  ...registeredCheckoutExecutionFields,
7237
- invoice: InvoiceCheckoutSummarySchema
7956
+ invoice: AssetInvoiceCheckoutSummarySchema
7238
7957
  });
7239
7958
  /** Generic request checkout uses the same fixed obligation and receipt contract. */
7240
- const RequestCheckoutSummarySchema = Schema.Struct({
7241
- ...InvoiceCheckoutSummarySchema.fields,
7959
+ const AssetRequestCheckoutSummarySchema = Schema.Struct({
7960
+ ...AssetInvoiceCheckoutSummarySchema.fields,
7242
7961
  documentKind: Schema.Literals(["memo", "invoice"])
7243
7962
  });
7963
+ const MoneyRequestCheckoutSummarySchema = Schema.Struct({
7964
+ ...MoneyInvoiceCheckoutSummarySchema.fields,
7965
+ documentKind: Schema.Literal("invoice")
7966
+ });
7967
+ const RequestCheckoutSummarySchema = Schema.Union([AssetRequestCheckoutSummarySchema, MoneyRequestCheckoutSummarySchema]);
7244
7968
  const RequestCheckoutPreparationSchema = Schema.Struct({
7245
- request: RequestCheckoutSummarySchema,
7969
+ request: AssetRequestCheckoutSummarySchema,
7246
7970
  sourceWallet: InvoiceCheckoutPreparationSchema.fields.sourceWallet,
7247
7971
  allowance: InvoiceCheckoutPreparationSchema.fields.allowance,
7248
7972
  approval: InvoiceCheckoutPreparationSchema.fields.approval,
7249
7973
  payment: InvoiceCheckoutPreparationSchema.fields.payment
7250
7974
  });
7251
7975
  const RequestCheckoutStateSchema = Schema.Struct({
7252
- request: RequestCheckoutSummarySchema,
7976
+ request: AssetRequestCheckoutSummarySchema,
7253
7977
  verification: InvoiceCheckoutStateSchema.fields.verification,
7254
7978
  receipt: InvoiceCheckoutStateSchema.fields.receipt,
7255
7979
  latePayment: InvoiceCheckoutStateSchema.fields.latePayment
@@ -7272,7 +7996,7 @@ const RequestCheckoutReconciliationSchema = Schema.Union([
7272
7996
  ]);
7273
7997
  const PreparedRequestCheckoutExecutionSchema = Schema.Struct({
7274
7998
  ...registeredCheckoutExecutionFields,
7275
- request: RequestCheckoutSummarySchema
7999
+ request: AssetRequestCheckoutSummarySchema
7276
8000
  });
7277
8001
  //#endregion
7278
8002
  //#region ../protocol/src/payments/witness-schema.ts
@@ -7304,6 +8028,24 @@ const SendWitnessSchema = Schema.Struct({
7304
8028
  attempts: Schema.Array(SendAttemptSchema)
7305
8029
  });
7306
8030
  //#endregion
8031
+ //#region ../protocol/src/payments/payout-operations.ts
8032
+ const quotes = { quote: Operation.action("payments.quotes.quote", {
8033
+ input: PaymentQuoteInputSchema,
8034
+ output: PaymentQuoteSchema,
8035
+ errors: [
8036
+ "NOT_AUTHENTICATED",
8037
+ "INVALID_INPUT",
8038
+ "ROLE_PERMISSION_DENIED",
8039
+ "ACCOUNT_NOT_FOUND",
8040
+ "SMART_ACCOUNT_MISSING",
8041
+ "VERIFICATION_REQUIRED",
8042
+ "INSUFFICIENT_BALANCE",
8043
+ "WRONG_STATE",
8044
+ "PROVIDER_ERROR",
8045
+ ...DEFECTS
8046
+ ]
8047
+ }) };
8048
+ //#endregion
7307
8049
  //#region ../protocol/src/payments/operations.ts
7308
8050
  const OrgId$2 = Schema.NonEmptyString;
7309
8051
  /** Every call: no session, or input that does not decode or validate. */
@@ -8481,7 +9223,8 @@ const RequestPartySchema = Schema.Struct({
8481
9223
  const RequestViewSchema = Schema.Struct({
8482
9224
  id: Schema.String,
8483
9225
  status: Schema.Literals(REQUEST_STATUSES),
8484
- amount: AssetAmountSchema,
9226
+ amount: Schema.Union([AssetAmountSchema, MoneySchema]),
9227
+ receivingAccountId: Schema.optionalKey(Schema.String),
8485
9228
  reference: Schema.String,
8486
9229
  memo: Schema.NullOr(Schema.String),
8487
9230
  /** The bearer link a payer follows to the checkout. */
@@ -8490,6 +9233,7 @@ const RequestViewSchema = Schema.Struct({
8490
9233
  entitlementGranted: Schema.Boolean,
8491
9234
  /** The Payment an approval prepared for this request. */
8492
9235
  settledPaymentId: Schema.NullOr(Schema.String),
9236
+ settledDepositRef: Schema.optionalKey(Schema.String),
8493
9237
  documents: Schema.Array(DocumentRefV3Schema),
8494
9238
  expiresAt: Schema.NullOr(EpochMsSchema$1),
8495
9239
  createdAt: EpochMsSchema$1,
@@ -8504,16 +9248,25 @@ const RequestViewSchema = Schema.Struct({
8504
9248
  addressedToViewer: Schema.optionalKey(Schema.Boolean)
8505
9249
  });
8506
9250
  /** Ask a payer for money: a basic request, or one carrying an Invoice. */
8507
- const IssueRequestInputSchema = Schema.Struct({
9251
+ const IssueRequestCommonSchema = Schema.Struct({
8508
9252
  actor: RequestActorSchema,
8509
- amount: AssetAmountSchema,
8510
9253
  reference: Schema.String,
8511
9254
  /** Absent for a link anyone holding it may pay. */
8512
9255
  payer: Schema.optionalKey(RecipientLocatorSchema),
8513
9256
  memo: Schema.optionalKey(Schema.String),
8514
- invoice: Schema.optionalKey(InvoiceDraftSchema),
8515
9257
  expiresAt: Schema.optionalKey(Schema.Finite)
8516
9258
  });
9259
+ const IssueRequestInputSchema = Schema.Union([Schema.Struct({
9260
+ ...IssueRequestCommonSchema.fields,
9261
+ amount: AssetAmountSchema,
9262
+ invoice: Schema.optionalKey(InvoiceDraftSchema),
9263
+ receivingAccountId: Schema.optional(Schema.Never)
9264
+ }), Schema.Struct({
9265
+ ...IssueRequestCommonSchema.fields,
9266
+ amount: MoneySchema,
9267
+ invoice: InvoiceDraftSchema,
9268
+ receivingAccountId: Schema.String
9269
+ })]);
8517
9270
  //#endregion
8518
9271
  //#region ../protocol/src/requests/operations.ts
8519
9272
  const actor = RequestActorSchema;
@@ -8947,6 +9700,10 @@ const checkouts = {
8947
9700
  //#endregion
8948
9701
  //#region ../protocol/src/operations.ts
8949
9702
  const OPERATIONS = [
9703
+ ...Object.values(accounts),
9704
+ ...Object.values(quotes),
9705
+ ...Object.values(bankDetails),
9706
+ ...Object.values(deposits),
8950
9707
  ...Object.values(sessions),
8951
9708
  ...Object.values(items),
8952
9709
  ...Object.values(annotations),
@@ -8973,6 +9730,7 @@ const OPERATIONS = [
8973
9730
  ...Object.values(treasuries),
8974
9731
  ...Object.values(setups),
8975
9732
  ...Object.values(contacts),
9733
+ ...Object.values(verifications$1),
8976
9734
  ...Object.values(destinations),
8977
9735
  ...Object.values(recipients),
8978
9736
  ...Object.values(records),
@@ -9054,9 +9812,11 @@ const PEOPLE_OPERATIONS = {
9054
9812
  read: "accounts.read",
9055
9813
  /** The writes an approval's actions run: the recorded signature, and the scheduled lapse. */
9056
9814
  approvals: {
9815
+ consumeApproved: "accounts.approvals.consumeApproved",
9057
9816
  expire: "accounts.approvals.expire",
9058
9817
  recordApproval: "accounts.approvals.recordApproval",
9059
- recordExpiry: "accounts.approvals.recordExpiry"
9818
+ recordExpiry: "accounts.approvals.recordExpiry",
9819
+ sendApproved: "accounts.approvals.sendApproved"
9060
9820
  },
9061
9821
  balances: { readBinding: "accounts.balances.readBinding" },
9062
9822
  claims: {
@@ -9309,9 +10069,38 @@ const ORGANIZATION_OPERATIONS = {
9309
10069
  load: "organizations.treasuries.load" }
9310
10070
  },
9311
10071
  /** Parties' internal functions; its public rows join from `OPERATIONS`. */
9312
- parties: { contacts: {
9313
- /** Posts `contact_relationship_changed` after a contact write commits. */
9314
- emitRelationshipChanged: "parties.contacts.emitRelationshipChanged" } }
10072
+ parties: {
10073
+ accounts: {
10074
+ register: "parties.accounts.register",
10075
+ prepare: "parties.accounts.prepare",
10076
+ finalize: "parties.accounts.finalize"
10077
+ },
10078
+ verificationSubmit: {
10079
+ send: "parties.verificationSubmit.send",
10080
+ person: "parties.verificationSubmit.person"
10081
+ },
10082
+ verifications: {
10083
+ begin: "parties.verifications.begin",
10084
+ invitePeople: "parties.verifications.invitePeople",
10085
+ loadPeople: "parties.verifications.loadPeople",
10086
+ loadPerson: "parties.verifications.loadPerson",
10087
+ recordPerson: "parties.verifications.recordPerson",
10088
+ recordOwnershipAttestation: "parties.verifications.recordOwnershipAttestation",
10089
+ recordBusinessContact: "parties.verifications.recordBusinessContact",
10090
+ recordBusinessContactRejected: "parties.verifications.recordBusinessContactRejected",
10091
+ deliverPersonInvite: "parties.verifications.deliverPersonInvite",
10092
+ load: "parties.verifications.load",
10093
+ recordSnapshot: "parties.verifications.recordSnapshot",
10094
+ recordPrefill: "parties.verifications.recordPrefill",
10095
+ upload: "parties.verifications.upload",
10096
+ recordDocument: "parties.verifications.recordDocument",
10097
+ loadDocument: "parties.verifications.loadDocument",
10098
+ deleteDocument: "parties.verifications.deleteDocument"
10099
+ },
10100
+ contacts: {
10101
+ /** Posts `contact_relationship_changed` after a contact write commits. */
10102
+ emitRelationshipChanged: "parties.contacts.emitRelationshipChanged" }
10103
+ }
9315
10104
  };
9316
10105
  //#endregion
9317
10106
  //#region ../observability/src/operations/money.ts
@@ -9334,10 +10123,6 @@ emitSaved: "activity.annotations.emitSaved" },
9334
10123
  faucetSafe: { deploy: "FaucetSafe.deploy" },
9335
10124
  financialOps: { createPayee: "financialOps.createPayee" },
9336
10125
  holdings: { current: "holdings.current" },
9337
- offramp: {
9338
- quote: "offramp.quote",
9339
- status: "offramp.status"
9340
- },
9341
10126
  organizationPayments: {
9342
10127
  pay: "organizationPayments.pay",
9343
10128
  payBatch: "organizationPayments.payBatch",
@@ -9520,6 +10305,12 @@ loadBudgetLeft: "permissions.authorities.loadBudgetLeft" },
9520
10305
  //#endregion
9521
10306
  //#region ../observability/src/operations/platform.ts
9522
10307
  const PLATFORM_OPERATIONS = {
10308
+ /** Native Convex deployment requests, before application telemetry can run. */
10309
+ deployments: { convex: {
10310
+ evaluatePush: "deployments.convex.evaluatePush",
10311
+ startPush: "deployments.convex.startPush",
10312
+ finishPush: "deployments.convex.finishPush"
10313
+ } },
9523
10314
  /** Applications' internal functions and HTTP endpoints; its public rows join from `OPERATIONS`. */
9524
10315
  applications: {
9525
10316
  bootstraps: {
@@ -9554,11 +10345,7 @@ const PLATFORM_OPERATIONS = {
9554
10345
  /** The scan's read of its saved checkpoint. */
9555
10346
  loadCheckpoint: "indexing.movements.loadCheckpoint",
9556
10347
  /** The scan's transaction: one window's Movements and its checkpoint. */
9557
- applyWindow: "indexing.movements.applyWindow",
9558
- /** Whether a queued `deposit_settled` still describes an included Movement. */
9559
- isDepositTelemetryCurrent: "indexing.movements.isDepositTelemetryCurrent",
9560
- /** Posts `deposit_settled` after a Deposit materializes. */
9561
- emitDepositSettled: "indexing.movements.emitDepositSettled"
10348
+ applyWindow: "indexing.movements.applyWindow"
9562
10349
  },
9563
10350
  drifts: {
9564
10351
  /** The minute cron: compare Convex outcomes to Ponder facts and correct drift. */
@@ -9636,12 +10423,54 @@ const PLATFORM_OPERATIONS = {
9636
10423
  }
9637
10424
  };
9638
10425
  //#endregion
10426
+ //#region ../observability/src/operations/banking.ts
10427
+ const BANKING_OPERATIONS = { banking: {
10428
+ payouts: {
10429
+ funding: "banking.payouts.funding",
10430
+ prepare: "banking.payouts.prepare",
10431
+ finalize: "banking.payouts.finalize",
10432
+ load: "banking.payouts.load",
10433
+ record: "banking.payouts.record",
10434
+ reconcile: "banking.payouts.reconcile"
10435
+ },
10436
+ deposits: {
10437
+ record: "banking.deposits.record",
10438
+ load: "banking.deposits.load",
10439
+ claimMint: "banking.deposits.claimMint",
10440
+ recordMint: "banking.deposits.recordMint",
10441
+ credit: "banking.deposits.credit",
10442
+ confirm: "banking.deposits.confirm",
10443
+ reconcile: "banking.deposits.reconcile",
10444
+ autoMatch: "banking.deposits.autoMatch"
10445
+ },
10446
+ bankDetails: {
10447
+ prepare: "banking.bankDetails.prepare",
10448
+ finalize: "banking.bankDetails.finalize",
10449
+ load: "banking.bankDetails.load",
10450
+ applyLifecycle: "banking.bankDetails.applyLifecycle"
10451
+ },
10452
+ webhooks: {
10453
+ receive: "banking.webhooks.receive",
10454
+ insert: "banking.webhooks.insert",
10455
+ process: "banking.webhooks.process",
10456
+ load: "banking.webhooks.load",
10457
+ record: "banking.webhooks.record"
10458
+ },
10459
+ reconcile: {
10460
+ catchUp: "banking.reconcile.catchUp",
10461
+ cursor: "banking.reconcile.cursor",
10462
+ advance: "banking.reconcile.advance",
10463
+ recover: "banking.reconcile.recover"
10464
+ }
10465
+ } };
10466
+ //#endregion
9639
10467
  //#region ../observability/src/operations.ts
9640
10468
  const CAPXUL_OPERATIONS = withRows({
9641
10469
  ...PEOPLE_OPERATIONS,
9642
10470
  ...ORGANIZATION_OPERATIONS,
9643
10471
  ...MONEY_OPERATIONS,
9644
- ...PLATFORM_OPERATIONS
10472
+ ...PLATFORM_OPERATIONS,
10473
+ ...BANKING_OPERATIONS
9645
10474
  });
9646
10475
  /** The named tree, with every operation row added under its own name. */
9647
10476
  function withRows(named) {
@@ -9849,6 +10678,8 @@ const UiStepProps = {
9849
10678
  * `invoice_issued` carries `issuer_scope_kind`; neither is repeated here.
9850
10679
  */
9851
10680
  const JourneyVariantProps = {
10681
+ /** Whose bank verification Bridge decides. */
10682
+ subject_kind: Schema.Literals(["person", "business"]),
9852
10683
  /** How a person came to Get started: by themselves, an invite, money that waited, or an invoice. */
9853
10684
  entry_path: Schema.optional(Schema.Literals([
9854
10685
  "signup",
@@ -9856,11 +10687,13 @@ const JourneyVariantProps = {
9856
10687
  "claim",
9857
10688
  "invoice"
9858
10689
  ])),
9859
- /** Where the person acted. `agent` is an AI agent driving the CLI. */
10690
+ /** Caller surface. An undeclared historical caller remains `unspecified`. */
9860
10691
  surface: Schema.optional(Schema.Literals([
9861
10692
  "web",
9862
10693
  "cli",
9863
- "agent"
10694
+ "agent",
10695
+ "sdk",
10696
+ "unspecified"
9864
10697
  ])),
9865
10698
  /** Who pays: a person from their own account, or an Organization from a Budget. */
9866
10699
  payer_kind: Schema.optional(Schema.Literals(["person", "organization"])),
@@ -9875,6 +10708,116 @@ const JourneyVariantProps = {
9875
10708
  ]))
9876
10709
  };
9877
10710
  //#endregion
10711
+ //#region ../observability/src/events/banking.ts
10712
+ const PayoutTelemetryProps = {
10713
+ recipient_kind: Schema.optional(Schema.Literals([
10714
+ "capxul",
10715
+ "wallet",
10716
+ "bank"
10717
+ ])),
10718
+ rail: Schema.optional(Schema.Literals(["direct", "bridge"])),
10719
+ recipient_on_capxul: Schema.optional(Schema.Boolean),
10720
+ party_account_id: OptionalString,
10721
+ quote_id: OptionalString,
10722
+ rail_operation_id: OptionalString
10723
+ };
10724
+ Schema.Struct({
10725
+ name: Schema.Literal("bank_details_issued"),
10726
+ props: Schema.Struct({
10727
+ ...TelemetryEnvelopeProps,
10728
+ receiving_account_id: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9_.:-]*$/u)),
10729
+ currency: Schema.Literals([
10730
+ "usd",
10731
+ "eur",
10732
+ "gbp"
10733
+ ]),
10734
+ bank_rail: Schema.Literals([
10735
+ "ach",
10736
+ "wire",
10737
+ "sepa",
10738
+ "faster_payments"
10739
+ ]),
10740
+ funding_source: Schema.Literal("bank"),
10741
+ rail: Schema.Literal("bridge"),
10742
+ release: Schema.optional(Schema.String.check(Schema.isPattern(/^[0-9a-f]{40}$/u)))
10743
+ })
10744
+ });
10745
+ const DepositProps = {
10746
+ ...TelemetryEnvelopeProps,
10747
+ bank_deposit_id: Schema.String,
10748
+ receiving_account_id: Schema.String,
10749
+ currency: Schema.Literals([
10750
+ "usd",
10751
+ "eur",
10752
+ "gbp"
10753
+ ]),
10754
+ bank_rail: Schema.Literals([
10755
+ "ach",
10756
+ "wire",
10757
+ "sepa",
10758
+ "faster_payments"
10759
+ ]),
10760
+ rail: Schema.Literal("bridge"),
10761
+ release: Schema.optional(Schema.String.check(Schema.isPattern(/^[0-9a-f]{40}$/u)))
10762
+ };
10763
+ Schema.Struct({
10764
+ name: Schema.Literal("bank_deposit_credited"),
10765
+ props: Schema.Struct({
10766
+ ...DepositProps,
10767
+ funding_source: Schema.Literal("bank"),
10768
+ chain_movement_id: Schema.String
10769
+ })
10770
+ });
10771
+ Schema.Struct({
10772
+ name: Schema.Literal("bank_deposit_returned"),
10773
+ props: Schema.Struct({
10774
+ ...DepositProps,
10775
+ funding_source: Schema.Literal("bank")
10776
+ })
10777
+ });
10778
+ Schema.Struct({
10779
+ name: Schema.Literal("bank_deposit_matched"),
10780
+ props: Schema.Struct({
10781
+ ...DepositProps,
10782
+ request_id: Schema.String,
10783
+ pay_path: Schema.Literal("bank"),
10784
+ issuer_scope_kind: Schema.Literals(["account", "organization"]),
10785
+ match_kind: Schema.Literals(["reference", "manual"])
10786
+ })
10787
+ });
10788
+ Schema.Struct({
10789
+ name: Schema.Literal("banking_webhook_received"),
10790
+ props: Schema.Struct({
10791
+ ...TelemetryEnvelopeProps,
10792
+ release: Schema.optional(Schema.String),
10793
+ signature_result: Schema.Literals([
10794
+ "valid",
10795
+ "missing",
10796
+ "malformed",
10797
+ "stale",
10798
+ "invalid"
10799
+ ]),
10800
+ outcome: Schema.Literals([
10801
+ "inserted",
10802
+ "duplicate",
10803
+ "rejected",
10804
+ "failed"
10805
+ ]),
10806
+ bridge_event_id: Schema.optional(Schema.String),
10807
+ bridge_event_type: Schema.optional(Schema.String),
10808
+ duration_ms: Schema.Finite
10809
+ })
10810
+ });
10811
+ Schema.Struct({
10812
+ name: Schema.Literal("banking_reconcile_completed"),
10813
+ props: Schema.Struct({
10814
+ ...TelemetryEnvelopeProps,
10815
+ release: Schema.optional(Schema.String),
10816
+ recovered: Schema.Finite,
10817
+ has_more: Schema.Boolean
10818
+ })
10819
+ });
10820
+ //#endregion
9878
10821
  //#region ../observability/src/events/money.ts
9879
10822
  /**
9880
10823
  * R08 (#1966): which Safe was read, on which chain, of which token. `currency`
@@ -9936,12 +10879,14 @@ const RecipientLocatorKindSchema = Schema.Literals([
9936
10879
  "handle",
9937
10880
  "email",
9938
10881
  "address",
9939
- "party"
10882
+ "party",
10883
+ "party_account"
9940
10884
  ]);
9941
10885
  const RecipientResolutionStatusSchema = Schema.Literals([
9942
10886
  "known_party",
9943
10887
  "new_email",
9944
- "external_address"
10888
+ "external_address",
10889
+ "bank_account"
9945
10890
  ]);
9946
10891
  const RecipientPartyKindSchema = Schema.Literals([
9947
10892
  "person",
@@ -9949,6 +10894,7 @@ const RecipientPartyKindSchema = Schema.Literals([
9949
10894
  "unresolved"
9950
10895
  ]);
9951
10896
  const RecipientTelemetryProps = {
10897
+ ...PayoutTelemetryProps,
9952
10898
  recipient_locator_kind: Schema.optional(RecipientLocatorKindSchema),
9953
10899
  recipient_resolution_status: Schema.optional(RecipientResolutionStatusSchema),
9954
10900
  recipient_party_id: OptionalString,
@@ -10900,6 +11846,18 @@ const CLI_COMMAND_NAMES = [
10900
11846
  "account.retry",
10901
11847
  "balance",
10902
11848
  "address",
11849
+ "verify",
11850
+ "verify.start",
11851
+ "verify.status",
11852
+ "bank",
11853
+ "bank.details",
11854
+ "bank.accounts",
11855
+ "bank.accounts.add",
11856
+ "bank.accounts.remove",
11857
+ "bank.pay",
11858
+ "bank.deposits",
11859
+ "bank.match",
11860
+ "bank.settle",
10903
11861
  "payment",
10904
11862
  "payment.send",
10905
11863
  "payment.list",
@@ -10926,6 +11884,8 @@ const CLI_COMMAND_NAMES = [
10926
11884
  "offer.deactivate",
10927
11885
  "contact",
10928
11886
  "contact.add",
11887
+ "contact.bank",
11888
+ "contact.bank.add",
10929
11889
  "contact.list",
10930
11890
  "contact.get",
10931
11891
  "contact.label",
@@ -11004,6 +11964,8 @@ const CLI_CAPABILITIES = [
11004
11964
  "diagnostics",
11005
11965
  "collection",
11006
11966
  "authentication",
11967
+ "verification",
11968
+ "banking",
11007
11969
  "account",
11008
11970
  "organization",
11009
11971
  "contacts",
@@ -11227,6 +12189,52 @@ Schema.Struct({
11227
12189
  props: MemberActivationFailedProps
11228
12190
  });
11229
12191
  //#endregion
12192
+ //#region ../observability/src/events/verification.ts
12193
+ const Identifier = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9_.:-]*$/u));
12194
+ const FieldId = Schema.String.check(Schema.isPattern(/^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)*$/u));
12195
+ /** Journey: get_verified. Private answers and provider URLs are never properties. */
12196
+ const VerificationProps = Schema.Struct({
12197
+ ...TelemetryEnvelopeProps,
12198
+ verification_id: Identifier,
12199
+ invitation_id: Schema.optional(Identifier),
12200
+ party_id: Identifier,
12201
+ subject_kind: JourneyVariantProps.subject_kind,
12202
+ surface: JourneyVariantProps.surface,
12203
+ rail: Schema.Literal("bridge"),
12204
+ verification_state: VerificationStateSchema,
12205
+ missing_field_ids: Schema.optional(Schema.Array(FieldId)),
12206
+ release: Schema.optional(Schema.String.check(Schema.isPattern(/^[0-9a-f]{40}$/u)))
12207
+ });
12208
+ Schema.Struct({
12209
+ name: Schema.Literal("verification_started"),
12210
+ props: VerificationProps
12211
+ }), Schema.Struct({
12212
+ name: Schema.Literal("verification_terms_accepted"),
12213
+ props: VerificationProps
12214
+ }), Schema.Struct({
12215
+ name: Schema.Literal("verification_submitted"),
12216
+ props: VerificationProps
12217
+ }), Schema.Struct({
12218
+ name: Schema.Literal("verification_person_invited"),
12219
+ props: Schema.Struct({
12220
+ ...VerificationProps.fields,
12221
+ subject_kind: Schema.Literal("business"),
12222
+ invitation_id: Identifier
12223
+ })
12224
+ }), Schema.Struct({
12225
+ name: Schema.Literal("verification_liveness_requested"),
12226
+ props: VerificationProps
12227
+ }), Schema.Struct({
12228
+ name: Schema.Literal("verification_information_requested"),
12229
+ props: VerificationProps
12230
+ }), Schema.Struct({
12231
+ name: Schema.Literal("verification_approved"),
12232
+ props: VerificationProps
12233
+ }), Schema.Struct({
12234
+ name: Schema.Literal("verification_rejected"),
12235
+ props: VerificationProps
12236
+ });
12237
+ //#endregion
11230
12238
  //#region ../observability/src/telemetry/redaction.ts
11231
12239
  function redactTelemetryEvent(event, options = {}) {
11232
12240
  const props = redactTelemetryProps(event.name, event.props, options);
@@ -12694,7 +13702,7 @@ function mapAccountLifecycle(input) {
12694
13702
  }
12695
13703
  //#endregion
12696
13704
  //#region package.json
12697
- var version = "4.20.0-beta.31";
13705
+ var version = "4.20.0-beta.32";
12698
13706
  //#endregion
12699
13707
  //#region src/observability/telemetry/exception-projection.ts
12700
13708
  /** Fixed fallback for failures that have no safe message. */
@@ -13512,6 +14520,19 @@ function admitted(row, error) {
13512
14520
  });
13513
14521
  }
13514
14522
  //#endregion
14523
+ //#region src/payments/bank-evidence.ts
14524
+ /** Bank recipients keep their chosen account identity beside the exact funding address. */
14525
+ function bankTargetsMatch(evidence) {
14526
+ const request = evidence.request;
14527
+ if (!("items" in request)) return true;
14528
+ return request.items.every((source, index) => {
14529
+ if (!("to" in source) || source.to.kind !== "party_account") return true;
14530
+ const observation = evidence.recipientObservations[index];
14531
+ const item = evidence.preparedCommand?.items[index];
14532
+ return source.quoteId !== void 0 && item?.operation === "send" && observation?.recipient_locator_kind === "party_account" && observation.recipient_resolution_status === "bank_account" && observation.party_account_id === source.to.partyAccountId && observation.recipient_address.toLowerCase() === item.recipientSafe.toLowerCase();
14533
+ });
14534
+ }
14535
+ //#endregion
13515
14536
  //#region ../protocol/src/evm/safe-contracts.ts
13516
14537
  const BASE_SEPOLIA_CHAIN_ID = 84532;
13517
14538
  const SAFE_PROXY_FACTORY = "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67";
@@ -14138,6 +15159,144 @@ function supportedEnvelopeOf(input) {
14138
15159
  function envelopeV3Of(input) {
14139
15160
  return SchemaParser.decodeUnknownSync(PaymentDocumentEnvelopeV3Schema, { onExcessProperty: "error" })(input);
14140
15161
  }
15162
+ //#endregion
15163
+ //#region ../protocol/src/documents/money-invoice-hash.ts
15164
+ const MONEY_INVOICE_V5_EIP712_TYPES = {
15165
+ EIP712Domain: [
15166
+ {
15167
+ name: "name",
15168
+ type: "string"
15169
+ },
15170
+ {
15171
+ name: "version",
15172
+ type: "string"
15173
+ },
15174
+ {
15175
+ name: "chainId",
15176
+ type: "uint256"
15177
+ },
15178
+ {
15179
+ name: "salt",
15180
+ type: "bytes32"
15181
+ }
15182
+ ],
15183
+ ReceiptAmountV3: [
15184
+ {
15185
+ name: "denomination",
15186
+ type: "uint8"
15187
+ },
15188
+ {
15189
+ name: "currency",
15190
+ type: "string"
15191
+ },
15192
+ {
15193
+ name: "asset",
15194
+ type: "string"
15195
+ },
15196
+ {
15197
+ name: "minorUnits",
15198
+ type: "uint256"
15199
+ },
15200
+ {
15201
+ name: "decimals",
15202
+ type: "uint8"
15203
+ }
15204
+ ],
15205
+ Invoice: [
15206
+ {
15207
+ name: "kind",
15208
+ type: "uint8"
15209
+ },
15210
+ {
15211
+ name: "originId",
15212
+ type: "bytes32"
15213
+ },
15214
+ {
15215
+ name: "issuedAt",
15216
+ type: "uint64"
15217
+ },
15218
+ {
15219
+ name: "invoiceNumber",
15220
+ type: "string"
15221
+ },
15222
+ {
15223
+ name: "payerRef",
15224
+ type: "string"
15225
+ },
15226
+ {
15227
+ name: "payeeRef",
15228
+ type: "string"
15229
+ },
15230
+ {
15231
+ name: "amount",
15232
+ type: "ReceiptAmountV3"
15233
+ },
15234
+ {
15235
+ name: "receivingAccountId",
15236
+ type: "string"
15237
+ },
15238
+ {
15239
+ name: "target",
15240
+ type: "address"
15241
+ },
15242
+ {
15243
+ name: "dueAt",
15244
+ type: "uint64"
15245
+ },
15246
+ {
15247
+ name: "lineItemsHash",
15248
+ type: "bytes32"
15249
+ },
15250
+ {
15251
+ name: "note",
15252
+ type: "string"
15253
+ },
15254
+ {
15255
+ name: "discountMinor",
15256
+ type: "uint256"
15257
+ }
15258
+ ]
15259
+ };
15260
+ function message(envelope) {
15261
+ return {
15262
+ ...envelope.message,
15263
+ originId: toLowerBytes32(envelope.message.originId, "originId"),
15264
+ issuedAt: BigInt(envelope.message.issuedAt),
15265
+ amount: {
15266
+ ...envelope.message.amount,
15267
+ minorUnits: BigInt(envelope.message.amount.minorUnits)
15268
+ },
15269
+ target: toLowerAddress(envelope.message.target, "target"),
15270
+ dueAt: BigInt(envelope.message.dueAt),
15271
+ lineItemsHash: toLowerBytes32(envelope.message.lineItemsHash, "lineItemsHash"),
15272
+ discountMinor: BigInt(envelope.message.discountMinor)
15273
+ };
15274
+ }
15275
+ function domain(envelope) {
15276
+ return {
15277
+ ...envelope.domain,
15278
+ chainId: BigInt(envelope.domain.chainId),
15279
+ salt: toLowerBytes32(envelope.domain.salt, "domain.salt")
15280
+ };
15281
+ }
15282
+ function hashMoneyInvoiceV5(envelope) {
15283
+ return hashTypedData({
15284
+ domain: domain(envelope),
15285
+ primaryType: envelope.primaryType,
15286
+ types: MONEY_INVOICE_V5_EIP712_TYPES,
15287
+ message: message(envelope)
15288
+ });
15289
+ }
15290
+ async function verifyMoneyInvoiceV5Signature(envelope) {
15291
+ if (envelope.signature === void 0) return false;
15292
+ return (await recoverTypedDataAddress({
15293
+ domain: domain(envelope),
15294
+ primaryType: envelope.primaryType,
15295
+ types: MONEY_INVOICE_V5_EIP712_TYPES,
15296
+ message: message(envelope),
15297
+ signature: envelope.signature.value
15298
+ })).toLowerCase() === envelope.signature.signer;
15299
+ }
14141
15300
  /** Version 3 field order is fixed by the accepted Documents contract. */
14142
15301
  const PAYMENT_DOCUMENT_V3_EIP712_TYPES = {
14143
15302
  EIP712Domain: [
@@ -14395,30 +15554,45 @@ const INVOICE_V4_EIP712_TYPES = {
14395
15554
  function invoiceV4Message(envelope) {
14396
15555
  return {
14397
15556
  ...envelope.message,
15557
+ originId: toLowerBytes32(envelope.message.originId, "originId"),
15558
+ issuedAt: BigInt(envelope.message.issuedAt),
14398
15559
  amount: exactAssetV3Message(envelope.message.amount),
15560
+ target: toLowerAddress(envelope.message.target, "target"),
15561
+ dueAt: BigInt(envelope.message.dueAt),
15562
+ lineItemsHash: toLowerBytes32(envelope.message.lineItemsHash, "lineItemsHash"),
14399
15563
  discountMinor: BigInt(envelope.message.discountMinor)
14400
15564
  };
14401
15565
  }
15566
+ function invoiceV4Domain(envelope) {
15567
+ return {
15568
+ ...envelope.domain,
15569
+ chainId: BigInt(envelope.domain.chainId),
15570
+ salt: toLowerBytes32(envelope.domain.salt, "domain.salt")
15571
+ };
15572
+ }
14402
15573
  function hashSupportedPaymentDocument(input) {
14403
15574
  const envelope = supportedEnvelopeOf(input);
14404
- if (envelope.version === 3) return hashPaymentDocumentV3(envelope);
14405
- const types = INVOICE_V4_EIP712_TYPES;
14406
- return hashTypedData({
14407
- domain: envelope.domain,
14408
- primaryType: envelope.primaryType,
14409
- types,
14410
- message: invoiceV4Message(envelope)
14411
- });
15575
+ switch (envelope.version) {
15576
+ case 3: return hashPaymentDocumentV3(envelope);
15577
+ case 4: return hashTypedData({
15578
+ domain: invoiceV4Domain(envelope),
15579
+ primaryType: envelope.primaryType,
15580
+ types: INVOICE_V4_EIP712_TYPES,
15581
+ message: invoiceV4Message(envelope)
15582
+ });
15583
+ case 5: return hashMoneyInvoiceV5(envelope);
15584
+ default: return absurd(envelope);
15585
+ }
14412
15586
  }
14413
15587
  async function verifySupportedPaymentDocumentSignature(input) {
14414
15588
  const envelope = supportedEnvelopeOf(input);
14415
- if (envelope.version === 3) return verifyPaymentDocumentSignatureV3(envelope);
14416
15589
  if (envelope.signature === void 0) return false;
14417
- const types = INVOICE_V4_EIP712_TYPES;
15590
+ if (envelope.version === 3) return verifyPaymentDocumentSignatureV3(envelope);
15591
+ if (envelope.version === 5) return verifyMoneyInvoiceV5Signature(envelope);
14418
15592
  return (await recoverTypedDataAddress({
14419
- domain: envelope.domain,
15593
+ domain: invoiceV4Domain(envelope),
14420
15594
  primaryType: envelope.primaryType,
14421
- types,
15595
+ types: INVOICE_V4_EIP712_TYPES,
14422
15596
  message: invoiceV4Message(envelope),
14423
15597
  signature: envelope.signature.value
14424
15598
  })).toLowerCase() === envelope.signature.signer;
@@ -14494,12 +15668,13 @@ function requestRetryInstruction(input) {
14494
15668
  const bytes = decodeCanonicalBase64V3(document.bytesBase64);
14495
15669
  const envelope = decodeSupportedPaymentDocumentEnvelope(bytes);
14496
15670
  if (envelope.primaryType !== "Memo" && envelope.primaryType !== "Invoice") return void 0;
15671
+ if (envelope.version === 5) return void 0;
14497
15672
  return {
14498
15673
  documentHash: hashSupportedPaymentDocument(envelope),
14499
15674
  contentHash: hashPaymentDocumentContentV3(bytes),
14500
15675
  role: "instruction",
14501
15676
  kind: envelope.primaryType === "Memo" ? "memo" : "invoice",
14502
- format: envelope.version === 4 ? "envelope-v4" : "envelope-v3",
15677
+ format: paymentDocumentEnvelopeFormat(envelope),
14503
15678
  issuedAt: envelope.message.issuedAt
14504
15679
  };
14505
15680
  }
@@ -14552,14 +15727,12 @@ function retryBirthContext(evidence) {
14552
15727
  };
14553
15728
  }
14554
15729
  //#endregion
14555
- //#region ../protocol/src/evm/assets.ts
15730
+ //#region ../protocol/src/evm/test-assets.ts
14556
15731
  const SYNTHETIC_TEST_ASSET_SOURCE = "synthetic-test-liquidity";
14557
15732
  /**
14558
- * The candidate tier: five owned test assets, every field read back from Base
14559
- * Sepolia after the deployment that created it (chain 84532, block
14560
- * 46,690,061). Real contracts, authored liquidity, no settlement
14561
- * admission — so rollback is removing consumers, never relabelling a
14562
- * deployed address or deleting its history.
15733
+ * Owned test assets, with metadata read from each creation receipt and contract.
15734
+ * Settlement admission lives in assets.ts. The fixed test exchange uses the
15735
+ * original five assets; bank EURC has its own deployment.
14563
15736
  *
14564
15737
  * `symbol` is the display string the owned contract returns. A
14565
15738
  * provider-supported USDC would be a different contract at a different
@@ -14621,32 +15794,46 @@ const SYNTHETIC_TEST_ASSET_FIXTURES = {
14621
15794
  deploymentStartBlock: 46690061,
14622
15795
  deploymentTransaction: "0x6f6b0302448c7cd7db5c118a8250e548c6e72821df373e5a27550e5cdfa635a1",
14623
15796
  source: SYNTHETIC_TEST_ASSET_SOURCE
15797
+ },
15798
+ eurc: {
15799
+ assetId: assetIdFor(84532, "0x15055b4ed1d248c169b92705757cd9c3d985ad5f"),
15800
+ chainId: toChainId(84532),
15801
+ tokenAddress: "0x15055b4ed1d248c169b92705757cd9c3d985ad5f",
15802
+ symbol: "EURC",
15803
+ decimals: 6,
15804
+ peg: toCurrencyCode("EUR"),
15805
+ deploymentStartBlock: 47893251,
15806
+ deploymentTransaction: "0x4e0ab412d980a672336487afd10da007d51f34f17876b19b13732c8125be90ca",
15807
+ source: SYNTHETIC_TEST_ASSET_SOURCE
14624
15808
  }
14625
15809
  };
14626
- const SYNTHETIC_TEST_ASSETS = [
15810
+ /** EURC is minted for bank deposits and has no admission to the fixed test exchange. */
15811
+ const SYNTHETIC_TEST_ASSETS = [...[
14627
15812
  SYNTHETIC_TEST_ASSET_FIXTURES.usdc,
14628
15813
  SYNTHETIC_TEST_ASSET_FIXTURES.usdt,
14629
15814
  SYNTHETIC_TEST_ASSET_FIXTURES.weth,
14630
15815
  SYNTHETIC_TEST_ASSET_FIXTURES.wbtc,
14631
15816
  SYNTHETIC_TEST_ASSET_FIXTURES.cngn
14632
- ];
15817
+ ], SYNTHETIC_TEST_ASSET_FIXTURES.eurc];
14633
15818
  toChainId(84532);
14634
15819
  /**
14635
15820
  * The settlement tier: the owned test assets admitted to the exact-transfer
14636
- * path and to the treasury reads. USDC, USDT and WETH are equal assets.
15821
+ * path and to the treasury reads. USDC, USDT, WETH and EURC are admitted assets.
14637
15822
  * There is no default token.
14638
15823
  */
14639
15824
  const SETTLEMENT_ASSETS_BASE_SEPOLIA = Object.freeze({
14640
15825
  CAPXUL_TEST_USDC: SYNTHETIC_TEST_ASSET_FIXTURES.usdc,
14641
15826
  CAPXUL_TEST_USDT: SYNTHETIC_TEST_ASSET_FIXTURES.usdt,
14642
- CAPXUL_TEST_WETH: SYNTHETIC_TEST_ASSET_FIXTURES.weth
15827
+ CAPXUL_TEST_WETH: SYNTHETIC_TEST_ASSET_FIXTURES.weth,
15828
+ CAPXUL_TEST_EURC: SYNTHETIC_TEST_ASSET_FIXTURES.eurc
14643
15829
  });
14644
15830
  const CONFIGURED_MONEY_ASSETS = Object.freeze(Object.values(SETTLEMENT_ASSETS_BASE_SEPOLIA));
14645
15831
  /** Public AssetIds for the admitted Base Sepolia test assets. */
14646
15832
  const TOKENS = Object.freeze({ BASE_SEPOLIA: Object.freeze({
14647
15833
  CAPXUL_TEST_USDC: SETTLEMENT_ASSETS_BASE_SEPOLIA.CAPXUL_TEST_USDC.assetId,
14648
15834
  CAPXUL_TEST_USDT: SETTLEMENT_ASSETS_BASE_SEPOLIA.CAPXUL_TEST_USDT.assetId,
14649
- CAPXUL_TEST_WETH: SETTLEMENT_ASSETS_BASE_SEPOLIA.CAPXUL_TEST_WETH.assetId
15835
+ CAPXUL_TEST_WETH: SETTLEMENT_ASSETS_BASE_SEPOLIA.CAPXUL_TEST_WETH.assetId,
15836
+ CAPXUL_TEST_EURC: SETTLEMENT_ASSETS_BASE_SEPOLIA.CAPXUL_TEST_EURC.assetId
14650
15837
  }) });
14651
15838
  /**
14652
15839
  * Every known asset in ONE identity space. The tiers above declare admission;
@@ -14714,8 +15901,12 @@ function sameAmount(left, right) {
14714
15901
  }
14715
15902
  function verifySupportedPaymentDocumentContext(input, context) {
14716
15903
  const envelope = supportedEnvelopeOf(input);
14717
- if (envelope.version === 3) return verifyPaymentDocumentContextV3(envelope, context);
14718
- return envelope.domain.chainId === context.chainId && envelope.message.originId === context.originId && envelope.message.target === context.target && sameAmount(envelope.message.amount, context.amount);
15904
+ switch (envelope.version) {
15905
+ case 3: return verifyPaymentDocumentContextV3(envelope, context);
15906
+ case 4: return envelope.domain.chainId === context.chainId && envelope.message.originId === context.originId && envelope.message.target === context.target && sameAmount(envelope.message.amount, context.amount);
15907
+ case 5: return false;
15908
+ default: return absurd(envelope);
15909
+ }
14719
15910
  }
14720
15911
  function verifyPaymentDocumentContextV3(envelopeInput, context) {
14721
15912
  const envelope = envelopeV3Of(envelopeInput);
@@ -14754,7 +15945,7 @@ function validateInvoiceLineItems(input) {
14754
15945
  const derivedHash = hashLineItemsV3(items);
14755
15946
  const totalMinor = lineItemsTotalMinorV3(items);
14756
15947
  const hashMatches = derivedHash === envelope.message.lineItemsHash;
14757
- const discountMinor = envelope.version === 4 ? BigInt(envelope.message.discountMinor) : 0n;
15948
+ const discountMinor = envelope.version === 3 ? 0n : BigInt(envelope.message.discountMinor);
14758
15949
  const totalMatches = items.length === 0 ? discountMinor === 0n : discountMinor <= totalMinor && totalMinor - discountMinor === BigInt(envelope.message.amount.minorUnits);
14759
15950
  return {
14760
15951
  ok: hashMatches && totalMatches,
@@ -14764,8 +15955,8 @@ function validateInvoiceLineItems(input) {
14764
15955
  }
14765
15956
  /** Compare generated Invoice content with the confirmed draft before signing. */
14766
15957
  function invoiceDraftMatchesEnvelope(envelope, draft) {
14767
- if (envelope.primaryType !== "Invoice" || envelope.version !== invoiceDraftVersion(draft)) return false;
14768
- return envelope.message.invoiceNumber === draft.invoiceNumber && envelope.message.payerRef === draft.payerRef && envelope.message.payeeRef === draft.payeeRef && envelope.message.dueAt === draft.dueAt && envelope.message.lineItemsHash === hashLineItemsV3(draft.lineItems) && (envelope.version !== 4 || envelope.message.note === (draft.note ?? "") && envelope.message.discountMinor === (draft.discountMinor ?? "0"));
15958
+ if (envelope.primaryType !== "Invoice" || envelope.version !== 5 && envelope.version !== invoiceDraftVersion(draft)) return false;
15959
+ return envelope.message.invoiceNumber === draft.invoiceNumber && envelope.message.payerRef === draft.payerRef && envelope.message.payeeRef === draft.payeeRef && envelope.message.dueAt === draft.dueAt && envelope.message.lineItemsHash === hashLineItemsV3(draft.lineItems) && (envelope.version === 3 || envelope.message.note === (draft.note ?? "") && envelope.message.discountMinor === (draft.discountMinor ?? "0"));
14769
15960
  }
14770
15961
  function hashAdjustmentsV3(input) {
14771
15962
  const adjustments = SchemaParser.decodeUnknownSync(adjustmentsV3Schema, { onExcessProperty: "error" })(input);
@@ -14801,6 +15992,7 @@ async function receiptLinksMatch(source, links) {
14801
15992
  }
14802
15993
  async function documentContextMatches(input, command, item, bundle, ref, exact) {
14803
15994
  const envelope = bundle.envelope;
15995
+ if (envelope.version === 5) return false;
14804
15996
  const request = input.evidence.request;
14805
15997
  const confirmedInstruction = "kind" in request && request.kind === "payment_request" ? request.confirmation.instruction : requestRetryInstruction(input);
14806
15998
  const originId = confirmedInstruction === void 0 ? hashDocumentOriginIdV3({
@@ -14821,7 +16013,7 @@ async function documentContextMatches(input, command, item, bundle, ref, exact)
14821
16013
  minorUnits: exact.minorUnits,
14822
16014
  decimals: exact.decimals
14823
16015
  }
14824
- }) && hashSupportedPaymentDocument(envelope) === item.documentHash && ref.documentHash === item.documentHash && ref.role === "instruction" && ref.format === (envelope.version === 4 ? "envelope-v4" : "envelope-v3") && ref.issuedAt === envelope.message.issuedAt && (envelope.signature === void 0 || await verifySupportedPaymentDocumentSignature(envelope));
16016
+ }) && hashSupportedPaymentDocument(envelope) === item.documentHash && ref.documentHash === item.documentHash && ref.role === "instruction" && ref.format === paymentDocumentEnvelopeFormat(envelope) && ref.issuedAt === envelope.message.issuedAt && (envelope.signature === void 0 || await verifySupportedPaymentDocumentSignature(envelope));
14825
16017
  }
14826
16018
  function payslipContentMatches(source, bundle, ref) {
14827
16019
  const envelope = bundle.envelope;
@@ -16167,7 +17359,7 @@ async function verifiedPreparedCommand(evidence, sessionEmail, signerAddress, ch
16167
17359
  const permissionId = "kind" in evidence.request && evidence.request.kind === "payment_request" ? evidence.request.confirmation.permissionId : "items" in evidence.request ? evidence.request.permissionId : evidence.request.kind === "retry" && evidence.sourceCommand?.kind === "birth" ? evidence.sourceCommand.permissionId : void 0;
16168
17360
  if ("kind" in evidence.request && evidence.request.kind === "offer_checkout") return checkout !== void 0 && "checkoutId" in checkout && verifiesOfferCheckoutBirthEvidence(evidence, checkout, chainId) && verifiesMoneyOperation(evidence, expectedSafe, chainId, evidence.request.permissionId);
16169
17361
  if ("kind" in evidence.request && evidence.request.kind === "invoice_checkout") return checkout !== void 0 && "linkToken" in checkout && sourceWallet !== void 0 && verifiesInvoiceCheckoutBirthEvidence(evidence, checkout, chainId, sourceWallet) && verifiesMoneyOperation(evidence, expectedSafe, chainId, evidence.request.permissionId);
16170
- return verifiesMoneyOperation(evidence, expectedSafe, chainId, permissionId) && await verifiesMoneyBirthEvidence(evidence);
17362
+ return bankTargetsMatch(evidence) && verifiesMoneyOperation(evidence, expectedSafe, chainId, permissionId) && await verifiesMoneyBirthEvidence(evidence);
16171
17363
  }
16172
17364
  //#endregion
16173
17365
  //#region src/money/parse.ts
@@ -16315,7 +17507,11 @@ function emitPaymentInitiated(telemetry, input, runPromise) {
16315
17507
  payment_lifecycle_id: `payment_lifecycle_${input.paymentId}`,
16316
17508
  ...input.commandId === void 0 ? {} : { command_id: input.commandId },
16317
17509
  ...input.executionId === void 0 ? {} : { execution_id: input.executionId },
16318
- ...input.recipient
17510
+ ...input.recipient,
17511
+ ...input.recipient.recipient_locator_kind === "party_account" ? {
17512
+ recipient_kind: "bank",
17513
+ rail: "bridge"
17514
+ } : {}
16319
17515
  }
16320
17516
  }, runPromise);
16321
17517
  }
@@ -16505,7 +17701,7 @@ function plannedCommitmentMatches(prepared) {
16505
17701
  function recipientMatches(prepared, target) {
16506
17702
  const { to, externalAddressAcknowledged } = prepared.payment;
16507
17703
  const observation = prepared.recipientObservation;
16508
- return observation.recipient_locator_kind === to.kind && observation.recipient_address.toLowerCase() === target && observation.external_address_acknowledged === (externalAddressAcknowledged === true) && (to.kind !== "address" || to.address.toLowerCase() === target) && (to.kind !== "party" || observation.recipient_party_id === to.partyId) && (to.kind !== "handle" || observation.recipient_handle?.toLowerCase() === to.handle.toLowerCase());
17704
+ return observation.recipient_locator_kind === to.kind && observation.recipient_address.toLowerCase() === target && observation.external_address_acknowledged === (externalAddressAcknowledged === true) && (to.kind !== "party_account" || observation.recipient_resolution_status === "bank_account" && observation.party_account_id === to.partyAccountId && prepared.payment.quoteId !== void 0) && (to.kind !== "address" || to.address.toLowerCase() === target) && (to.kind !== "party" || observation.recipient_party_id === to.partyId) && (to.kind !== "handle" || observation.recipient_handle?.toLowerCase() === to.handle.toLowerCase());
16509
17705
  }
16510
17706
  function itemMatches(prepared, amount) {
16511
17707
  const { item, payment } = prepared;
@@ -16570,6 +17766,7 @@ function verifiesPersonalOperation(prepared, expectedSafe, chainId) {
16570
17766
  async function documentReferenceMatches(prepared, amount) {
16571
17767
  const { item, documentBundle: bundle, instructionDocument: ref } = prepared;
16572
17768
  const envelope = bundle.envelope;
17769
+ if (envelope.version === 5) return false;
16573
17770
  if (item.operation !== "send" && item.operation !== "create_commitment") return false;
16574
17771
  return bundle.originId === hashDocumentOriginIdV3({
16575
17772
  chainId: prepared.chainId,
@@ -16583,7 +17780,7 @@ async function documentReferenceMatches(prepared, amount) {
16583
17780
  source: prepared.userOpSenderSafe.toLowerCase(),
16584
17781
  target: item.recipientSafe.toLowerCase(),
16585
17782
  amount
16586
- }) && hashSupportedPaymentDocument(envelope) === item.documentHash && ref.documentHash === item.documentHash && ref.role === "instruction" && ref.format === (envelope.version === 4 ? "envelope-v4" : "envelope-v3") && ref.issuedAt === envelope.message.issuedAt && bundle.adjustments === void 0 && (envelope.signature === void 0 || await verifySupportedPaymentDocumentSignature(envelope));
17783
+ }) && hashSupportedPaymentDocument(envelope) === item.documentHash && ref.documentHash === item.documentHash && ref.role === "instruction" && ref.format === paymentDocumentEnvelopeFormat(envelope) && ref.issuedAt === envelope.message.issuedAt && bundle.adjustments === void 0 && (envelope.signature === void 0 || await verifySupportedPaymentDocumentSignature(envelope));
16587
17784
  }
16588
17785
  function generatedDraftMatches(prepared) {
16589
17786
  const { envelope, lineItems } = prepared.documentBundle;
@@ -16941,6 +18138,21 @@ function executeOrganizationPayment(deps, input, signal, onPreparedClosed, contr
16941
18138
  })).pipe(Effect.mapError((publicError) => ({ publicError })))), controls), deps.runPromise), matchesIntent(input), true, onPreparedClosed, signal, controls, onPrepared);
16942
18139
  }
16943
18140
  //#endregion
18141
+ //#region src/payments/quotes.ts
18142
+ /** The immutable method scope owns the payer. The backend returns exact funding instructions. */
18143
+ function makePaymentQuote(deps, actor = { kind: "account" }) {
18144
+ return (input, options) => {
18145
+ const controls = deps.invocationControls?.(options) ?? options;
18146
+ return runCapxulEffect(callOperation(deps.convexCall, quotes.quote, copyInvocationObservation(controls, {
18147
+ ...input,
18148
+ actor
18149
+ })).pipe(Effect.tap(() => Effect.annotateCurrentSpan({
18150
+ party_account_id: input.to.partyAccountId,
18151
+ ...actor.kind === "org" ? { verified_organization_id: actor.orgId } : {}
18152
+ }))), controls, quotes.quote.name, deps.runPromise);
18153
+ };
18154
+ }
18155
+ //#endregion
16944
18156
  //#region src/parties/backend-refs.ts
16945
18157
  function nonEmptyRefValue(value, field) {
16946
18158
  const trimmed = value.trim();
@@ -17001,14 +18213,184 @@ function backendRef(locator) {
17001
18213
  }
17002
18214
  }
17003
18215
  //#endregion
17004
- //#region src/parties/recipients.ts
17005
- function makeTargetsMethods(deps) {
17006
- return { resolve: (reference, options) => {
17007
- const controls = deps.invocationControls?.(options) ?? options;
17008
- return runPortEffect(projectReply(Effect.suspend(() => {
17009
- const recipient = normalizeTargetForBackend(reference, "reference");
17010
- return recipient.ok ? callOperation(deps.convexCall, recipients.resolve, copyInvocationObservation(controls, { recipient: recipient.value })).pipe(Effect.mapError((publicError) => ({ publicError }))) : Effect.fail({ publicError: recipient.error });
17011
- }), resolvedTargetFromResolution), controls, recipients.resolve.name, deps.runPromise);
18216
+ //#region src/parties/verification-target.ts
18217
+ const verificationTargetInput = (target) => target.kind === "organization" ? { orgId: target.orgId } : target.kind === "invitation" ? { invitationId: target.invitationId } : {};
18218
+ /** Refuse a decoded response that identifies a different immutable scope. */
18219
+ const validateVerificationTarget = (target, status) => {
18220
+ return (target.kind === "personal" ? status.invitationId === void 0 && status.organization === void 0 && status.subjectKind !== "business" && status.subjectKind !== "business_person" : target.kind === "organization" ? status.invitationId === void 0 && status.subjectKind !== "person" && status.subjectKind !== "business_person" && (status.organization?.id === target.orgId || status.status === "not_started" && status.organization === void 0) : status.invitationId === target.invitationId && status.subjectKind !== "business") ? Effect.succeed(status) : Effect.fail(Errors.providerError("verification", "validateResponseScope", "Verification response scope does not match."));
18221
+ };
18222
+ //#endregion
18223
+ //#region src/parties/verifications.ts
18224
+ const documentReply = Schema.Struct({ documentId: Schema.NonEmptyString });
18225
+ const documentFields = new Set(VERIFICATION_DOCUMENT_FIELDS);
18226
+ const uploadFailure = () => Errors.providerError("verification", "uploadDocument", "The verification document could not be uploaded.");
18227
+ function makeVerificationMethods(deps, selectedTarget) {
18228
+ const target = selectedTarget ?? { kind: "personal" };
18229
+ let journeyId;
18230
+ let actorId;
18231
+ const context = (options) => {
18232
+ const resolved = deps.invocationControls?.(options) ?? options;
18233
+ const snapshot = readInvocationObservation(resolved) ?? { active: true };
18234
+ if (actorId !== snapshot.actorId) journeyId = void 0;
18235
+ actorId = snapshot.actorId;
18236
+ journeyId = options?.journey_id ?? journeyId ?? snapshot.context?.journeyId ?? `verification_${crypto.randomUUID()}`;
18237
+ const controls = {
18238
+ ...resolved,
18239
+ journey_id: journeyId,
18240
+ correlation_id: resolved?.correlation_id ?? snapshot.context?.correlationId ?? crypto.randomUUID()
18241
+ };
18242
+ const captured = snapshot.active ? withCapturedAttemptContext(snapshot.context, controls) : void 0;
18243
+ return attachInvocationObservation(controls, {
18244
+ ...snapshot,
18245
+ ...captured === void 0 ? {} : { context: captured }
18246
+ });
18247
+ };
18248
+ const remember = (status) => {
18249
+ if (status.journeyId !== "") journeyId = status.journeyId;
18250
+ return status;
18251
+ };
18252
+ const upload = (field, blob, options) => Effect.gen(function* () {
18253
+ if (!documentFields.has(field) || !(blob instanceof Blob) || blob.size === 0) return yield* Effect.fail(Errors.invalidInput("files", "Provide a supported verification document."));
18254
+ const jwt = yield* deps.authClient.getConvexJwt(options).pipe(Effect.mapError(toPublicError$1));
18255
+ return yield* Effect.tryPromise({
18256
+ try: async (signal) => {
18257
+ const response = await (deps.fetch ?? globalThis.fetch)(new URL("/parties/verifications/documents", deps.siteBaseUrl), {
18258
+ method: "POST",
18259
+ headers: {
18260
+ Authorization: `Bearer ${jwt.token}`,
18261
+ "Content-Type": blob.type || "application/octet-stream",
18262
+ "X-Capxul-Document-Field": field
18263
+ },
18264
+ body: blob,
18265
+ signal,
18266
+ redirect: "error"
18267
+ });
18268
+ if (!response.ok) throw uploadFailure();
18269
+ return await response.json();
18270
+ },
18271
+ catch: uploadFailure
18272
+ }).pipe(Effect.flatMap(Schema.decodeUnknownEffect(documentReply)), Effect.mapError(uploadFailure), Effect.map((reply) => reply.documentId));
18273
+ });
18274
+ const submit = (input, options) => {
18275
+ const controls = context(options);
18276
+ const hasAnswers = input?.answers !== void 0 || input?.files !== void 0;
18277
+ const people = input?.people;
18278
+ const row = people !== void 0 ? verifications$1.invite : hasAnswers ? verifications$1.answer : verifications$1.start;
18279
+ return runCapxulEffect(Effect.gen(function* () {
18280
+ if (people !== void 0 && target.kind !== "organization") return yield* Effect.fail(Errors.invalidInput("people", "People require an Organization verification scope."));
18281
+ let status;
18282
+ if (!hasAnswers) status = yield* callOperation(deps.convexCall, verifications$1.start, copyInvocationObservation(controls, {
18283
+ ...verificationTargetInput(target),
18284
+ surface: input?.surface ?? "sdk"
18285
+ }));
18286
+ else {
18287
+ const answers = { ...input?.answers };
18288
+ for (const [field, blob] of Object.entries(input?.files ?? {})) answers[field] = yield* upload(field, blob, controls);
18289
+ status = yield* callOperation(deps.convexCall, verifications$1.answer, copyInvocationObservation(controls, {
18290
+ ...verificationTargetInput(target),
18291
+ answers,
18292
+ surface: input?.surface ?? "sdk"
18293
+ }));
18294
+ }
18295
+ if (people !== void 0 && target.kind === "organization") status = yield* callOperation(deps.convexCall, verifications$1.invite, copyInvocationObservation(controls, {
18296
+ orgId: target.orgId,
18297
+ people
18298
+ }));
18299
+ return yield* validateVerificationTarget(target, status);
18300
+ }).pipe(Effect.map(remember)), controls, row.name, deps.runPromise);
18301
+ };
18302
+ const scoped = {
18303
+ start: submit,
18304
+ status: (options) => {
18305
+ const controls = context(options);
18306
+ return runCapxulEffect(callOperation(deps.convexCall, verifications$1.status, copyInvocationObservation(controls, verificationTargetInput(target))).pipe(Effect.flatMap((status) => validateVerificationTarget(target, status)), Effect.map(remember)), controls, verifications$1.status.name, deps.runPromise);
18307
+ }
18308
+ };
18309
+ return selectedTarget === void 0 ? {
18310
+ ...scoped,
18311
+ forInvitation: (invitationId) => makeVerificationMethods(deps, {
18312
+ kind: "invitation",
18313
+ invitationId
18314
+ })
18315
+ } : scoped;
18316
+ }
18317
+ //#endregion
18318
+ //#region src/parties/relationship-calls.ts
18319
+ function relationshipCalls(deps, convexCall) {
18320
+ const actor = deps.actor.kind === "account" ? { kind: "account" } : {
18321
+ kind: "org",
18322
+ orgId: deps.actor.orgId
18323
+ };
18324
+ const observeContactScope = Effect.annotateCurrentSpan({
18325
+ scope_kind: actor.kind === "org" ? "organization" : "account",
18326
+ ...actor.kind === "org" ? { verified_organization_id: actor.orgId } : {}
18327
+ });
18328
+ /** One observed call of one contacts row, its reply projected inside the call, under the row's name. */
18329
+ const book = (row, args, options, project) => {
18330
+ const controls = deps.invocationControls?.(options) ?? options;
18331
+ return runPortEffect(projectReply(callOperation(convexCall, row, copyInvocationObservation(controls, args)).pipe(Effect.mapError((publicError) => ({ publicError }))), project).pipe(Effect.tap(() => observeContactScope)), controls, row.name, deps.runPromise);
18332
+ };
18333
+ /** As `book`, for a projection that refuses the reply as a value. */
18334
+ const bookChecked = (row, args, options, check) => {
18335
+ const controls = deps.invocationControls?.(options) ?? options;
18336
+ return runPortEffect(callOperation(convexCall, row, copyInvocationObservation(controls, args)).pipe(Effect.mapError((publicError) => ({ publicError })), Effect.flatMap((output) => {
18337
+ const checked = check(output);
18338
+ return checked.ok ? Effect.succeed(checked.value) : Effect.fail({ publicError: checked.error });
18339
+ }), Effect.tap(() => observeContactScope)), controls, row.name, deps.runPromise);
18340
+ };
18341
+ return {
18342
+ deps,
18343
+ actor,
18344
+ convexCall,
18345
+ observeContactScope,
18346
+ book,
18347
+ bookChecked
18348
+ };
18349
+ }
18350
+ function missingConvexCall(operation) {
18351
+ return Promise.resolve({
18352
+ ok: false,
18353
+ error: Errors.providerError("convex", operation, "ConvexCallPort is required")
18354
+ });
18355
+ }
18356
+ //#endregion
18357
+ //#region src/parties/accounts.ts
18358
+ /** The actor is captured once. Private input is admitted by the backend's field rules. */
18359
+ function makeBankAccountMethods({ actor, book }) {
18360
+ return {
18361
+ requirements: (input, options) => book(accounts.requirements, {
18362
+ ...input,
18363
+ actor
18364
+ }, options, (value) => value),
18365
+ add: (input, options) => book(accounts.add, {
18366
+ ...input,
18367
+ actor
18368
+ }, options, (value) => value),
18369
+ list: (input, options) => book(accounts.list, {
18370
+ ...input,
18371
+ actor
18372
+ }, options, (value) => value),
18373
+ remove: (input, options) => book(accounts.remove, {
18374
+ ...input,
18375
+ actor
18376
+ }, options, (value) => value)
18377
+ };
18378
+ }
18379
+ const unavailableBankAccountMethods = () => ({
18380
+ requirements: () => missingConvexCall(accounts.requirements.name),
18381
+ add: () => missingConvexCall(accounts.add.name),
18382
+ list: () => missingConvexCall(accounts.list.name),
18383
+ remove: () => missingConvexCall(accounts.remove.name)
18384
+ });
18385
+ //#endregion
18386
+ //#region src/parties/recipients.ts
18387
+ function makeTargetsMethods(deps) {
18388
+ return { resolve: (reference, options) => {
18389
+ const controls = deps.invocationControls?.(options) ?? options;
18390
+ return runPortEffect(projectReply(Effect.suspend(() => {
18391
+ const recipient = normalizeTargetForBackend(reference, "reference");
18392
+ return recipient.ok ? callOperation(deps.convexCall, recipients.resolve, copyInvocationObservation(controls, { recipient: recipient.value })).pipe(Effect.mapError((publicError) => ({ publicError }))) : Effect.fail({ publicError: recipient.error });
18393
+ }), resolvedTargetFromResolution), controls, recipients.resolve.name, deps.runPromise);
17012
18394
  } };
17013
18395
  }
17014
18396
  /** A locator as the backend returned it, its address and Party id proved, not asserted. */
@@ -17129,6 +18511,10 @@ async function payObligationRegistered(deps, input, options, generic) {
17129
18511
  error: Errors.invalidInput(generic ? "request" : "invoice", generic ? "Request is unavailable" : "Invoice is unavailable")
17130
18512
  };
17131
18513
  const snapshot = frozen.value;
18514
+ if ("bankPayment" in snapshot) return {
18515
+ ok: false,
18516
+ error: Errors.invalidInput("invoice", "Pay this Invoice by bank transfer.")
18517
+ };
17132
18518
  const { sourceWallet: _sourceWallet, ...wireInput } = input;
17133
18519
  const request = {
17134
18520
  kind: "invoice_checkout",
@@ -17401,6 +18787,8 @@ function mapInboxItem(item) {
17401
18787
  status: mapInboxStatus(item.status),
17402
18788
  documents: item.documents ?? [],
17403
18789
  ...item.issuerSafe === void 0 ? {} : { issuerSafe: item.issuerSafe },
18790
+ ...item.receivingAccountId === void 0 ? {} : { receivingAccountId: item.receivingAccountId },
18791
+ ...item.settledDepositRef === void 0 ? {} : { settledDepositRef: item.settledDepositRef },
17404
18792
  ...item.settledPaymentId == null ? {} : { paymentId: toPaymentId(item.settledPaymentId) }
17405
18793
  };
17406
18794
  }
@@ -17451,6 +18839,7 @@ function makeOfferMethods(deps) {
17451
18839
  }
17452
18840
  //#endregion
17453
18841
  //#region src/requests/receivables.ts
18842
+ const isMoneyRequestIssue = (input) => "currency" in input.amount;
17454
18843
  function makeActorRequestsMethods(calls) {
17455
18844
  const { actor, deps, book } = calls;
17456
18845
  return {
@@ -17460,15 +18849,24 @@ function makeActorRequestsMethods(calls) {
17460
18849
  const controls = deps.invocationControls?.(options) ?? options;
17461
18850
  return runCapxulEffect(Effect.fail(payer.error), controls, receivables.issue.name, deps.runPromise);
17462
18851
  }
17463
- return book(receivables.issue, {
18852
+ const common = {
17464
18853
  actor,
17465
18854
  payer: payer.value,
17466
- amount: input.amount,
17467
18855
  reference: input.reference,
17468
18856
  ...input.memo === void 0 ? {} : { memo: input.memo },
17469
- ...input.invoice === void 0 ? {} : { invoice: input.invoice },
17470
18857
  ...input.expiresAt === void 0 ? {} : { expiresAt: input.expiresAt }
17471
- }, options, (request) => mapActorRequest(request, input.payer));
18858
+ };
18859
+ const issueArgs = isMoneyRequestIssue(input) ? {
18860
+ ...common,
18861
+ amount: input.amount,
18862
+ invoice: input.invoice,
18863
+ receivingAccountId: input.receivingAccountId
18864
+ } : {
18865
+ ...common,
18866
+ amount: input.amount,
18867
+ ...input.invoice === void 0 ? {} : { invoice: input.invoice }
18868
+ };
18869
+ return book(receivables.issue, issueArgs, options, (request) => mapActorRequest(request, input.payer));
17472
18870
  },
17473
18871
  list: (options) => book(receivables.listCurrent, { actor }, options, (requests) => mapPage(requests, (request) => mapActorRequest(request))),
17474
18872
  get: (requestId, options) => book(receivables.getCurrent, {
@@ -17507,49 +18905,12 @@ function mapActorRequest(request, payer) {
17507
18905
  ...request.settledPaymentId == null ? {} : { paymentId: toPaymentId(request.settledPaymentId) },
17508
18906
  ...typeof request.addressedToViewer === "boolean" ? { addressedToViewer: request.addressedToViewer } : {},
17509
18907
  ...request.issuerSafe === void 0 ? {} : { issuerSafe: request.issuerSafe },
18908
+ ...request.receivingAccountId === void 0 ? {} : { receivingAccountId: request.receivingAccountId },
18909
+ ...request.settledDepositRef === void 0 ? {} : { settledDepositRef: request.settledDepositRef },
17510
18910
  linkToken: request.linkToken
17511
18911
  };
17512
18912
  }
17513
18913
  //#endregion
17514
- //#region src/parties/relationship-calls.ts
17515
- function relationshipCalls(deps, convexCall) {
17516
- const actor = deps.actor.kind === "account" ? { kind: "account" } : {
17517
- kind: "org",
17518
- orgId: deps.actor.orgId
17519
- };
17520
- const observeContactScope = Effect.annotateCurrentSpan({
17521
- scope_kind: actor.kind === "org" ? "organization" : "account",
17522
- ...actor.kind === "org" ? { verified_organization_id: actor.orgId } : {}
17523
- });
17524
- /** One observed call of one contacts row, its reply projected inside the call, under the row's name. */
17525
- const book = (row, args, options, project) => {
17526
- const controls = deps.invocationControls?.(options) ?? options;
17527
- return runPortEffect(projectReply(callOperation(convexCall, row, copyInvocationObservation(controls, args)).pipe(Effect.mapError((publicError) => ({ publicError }))), project).pipe(Effect.tap(() => observeContactScope)), controls, row.name, deps.runPromise);
17528
- };
17529
- /** As `book`, for a projection that refuses the reply as a value. */
17530
- const bookChecked = (row, args, options, check) => {
17531
- const controls = deps.invocationControls?.(options) ?? options;
17532
- return runPortEffect(callOperation(convexCall, row, copyInvocationObservation(controls, args)).pipe(Effect.mapError((publicError) => ({ publicError })), Effect.flatMap((output) => {
17533
- const checked = check(output);
17534
- return checked.ok ? Effect.succeed(checked.value) : Effect.fail({ publicError: checked.error });
17535
- }), Effect.tap(() => observeContactScope)), controls, row.name, deps.runPromise);
17536
- };
17537
- return {
17538
- deps,
17539
- actor,
17540
- convexCall,
17541
- observeContactScope,
17542
- book,
17543
- bookChecked
17544
- };
17545
- }
17546
- function missingConvexCall(operation) {
17547
- return Promise.resolve({
17548
- ok: false,
17549
- error: Errors.providerError("convex", operation, "ConvexCallPort is required")
17550
- });
17551
- }
17552
- //#endregion
17553
18914
  //#region src/parties/contacts.ts
17554
18915
  function makeAddressBookMethods(calls) {
17555
18916
  const { actor, deps, book } = calls;
@@ -17621,6 +18982,7 @@ function makeActorRelationshipMethods(deps) {
17621
18982
  if (convexCall === void 0) return {
17622
18983
  offers,
17623
18984
  addressBook: unavailableAddressBookMethods(),
18985
+ bankAccounts: unavailableBankAccountMethods(),
17624
18986
  requests: unavailableActorRequestsMethods(),
17625
18987
  inbox: unavailableInboxMethods(),
17626
18988
  profile
@@ -17629,6 +18991,7 @@ function makeActorRelationshipMethods(deps) {
17629
18991
  return {
17630
18992
  offers,
17631
18993
  addressBook: makeAddressBookMethods(calls),
18994
+ bankAccounts: makeBankAccountMethods(calls),
17632
18995
  requests: makeActorRequestsMethods(calls),
17633
18996
  inbox: makeInboxMethods(calls),
17634
18997
  profile
@@ -17833,12 +19196,16 @@ function paymentExecutionIntent(input) {
17833
19196
  ok: false,
17834
19197
  error: Errors.notImplemented("payments", "pay.organizationActor")
17835
19198
  };
17836
- const to = normalizeTargetForBackend(input.to, "to");
17837
- if (!to.ok) return to;
17838
19199
  try {
19200
+ const to = input.to?.kind === "party_account" ? {
19201
+ ok: true,
19202
+ value: input.to
19203
+ } : normalizeTargetForBackend(input.to, "to");
19204
+ if (!to.ok) return to;
17839
19205
  const decoded = Schema.decodeResult(PaymentExecutionIntentSchema, { onExcessProperty: "error" })({
17840
19206
  to: to.value,
17841
19207
  amount: input.amount,
19208
+ ...input.quoteId === void 0 ? {} : { quoteId: input.quoteId },
17842
19209
  ...input.externalAddressAcknowledged === void 0 ? {} : { externalAddressAcknowledged: input.externalAddressAcknowledged },
17843
19210
  ...input.paymentType === void 0 ? {} : { paymentType: input.paymentType },
17844
19211
  ...input.document === void 0 ? {} : { document: input.document },
@@ -17852,10 +19219,10 @@ function paymentExecutionIntent(input) {
17852
19219
  ok: false,
17853
19220
  error: invalidPaymentField(decoded.failure.issue, "invalid personal payment input")
17854
19221
  };
17855
- } catch {
19222
+ } catch (cause) {
17856
19223
  return {
17857
19224
  ok: false,
17858
- error: Errors.invalidInput("payment", "invalid personal payment input")
19225
+ error: cause instanceof CapxulError ? cause : Errors.invalidInput("payment", "invalid personal payment input")
17859
19226
  };
17860
19227
  }
17861
19228
  }
@@ -18379,6 +19746,7 @@ function makePaymentsMethods(deps) {
18379
19746
  const pay = makePersonalPay(deps);
18380
19747
  const { runLifecycle, retryPayment } = makeLifecycleRunners(deps);
18381
19748
  return {
19749
+ quote: makePaymentQuote(deps),
18382
19750
  subscribe: (paymentId, listener, options) => subscribePersonalPayment({
18383
19751
  actor: deps.actor,
18384
19752
  convexCall: deps.convexCall,
@@ -18418,32 +19786,6 @@ function makePaymentsMethods(deps) {
18418
19786
  };
18419
19787
  }
18420
19788
  //#endregion
18421
- //#region src/payments/offramp.ts
18422
- function makeOfframpMethods() {
18423
- return {
18424
- quote: (input, options) => {
18425
- if (options?.signal?.aborted) return Promise.resolve({
18426
- ok: false,
18427
- error: Errors.cancelled({ operation: CAPXUL_OPERATIONS.offramp.quote })
18428
- });
18429
- return Promise.resolve({
18430
- ok: false,
18431
- error: Errors.notImplemented("offramp", "quote")
18432
- });
18433
- },
18434
- status: (offrampId, options) => {
18435
- if (options?.signal?.aborted) return Promise.resolve({
18436
- ok: false,
18437
- error: Errors.cancelled({ operation: CAPXUL_OPERATIONS.offramp.status })
18438
- });
18439
- return Promise.resolve({
18440
- ok: false,
18441
- error: Errors.notImplemented("offramp", "status")
18442
- });
18443
- }
18444
- };
18445
- }
18446
- //#endregion
18447
19789
  //#region src/payments/organization-payment-requests.ts
18448
19790
  const organizationPaymentIntentSchema = Schema.Struct({
18449
19791
  orgId: PrepareOrganizationPaymentExecutionInputSchema.fields.orgId,
@@ -18729,6 +20071,10 @@ function makeOrganizationPaymentsMethods(deps, orgId) {
18729
20071
  }), observationOnlyControls(controls), operation, deps.runPromise);
18730
20072
  return {
18731
20073
  ...makeOrganizationPaymentReadMethods(deps, orgId),
20074
+ quote: makePaymentQuote(deps, {
20075
+ kind: "org",
20076
+ orgId
20077
+ }),
18732
20078
  retry: (paymentId, options) => {
18733
20079
  const controls = deps.invocationControls?.(options) ?? options;
18734
20080
  return runCapxulEffect(Effect.gen(function* () {
@@ -18808,21 +20154,6 @@ function makeOrganizationPaymentsMethods(deps, orgId) {
18808
20154
  };
18809
20155
  }
18810
20156
  //#endregion
18811
- //#region src/observability/telemetry/emit-once.ts
18812
- /**
18813
- * A product event that could not be built or emitted never reaches the caller
18814
- * as a failure, and is never lost silently: the drop is logged by event name.
18815
- */
18816
- function logDroppedEvent(eventName) {
18817
- return (effect) => effect.pipe(Effect.catchCause((cause) => {
18818
- const reason = Cause.squash(cause);
18819
- return Effect.logWarning("product.telemetry.emit.dropped").pipe(Effect.annotateLogs({
18820
- product_event: eventName,
18821
- reason: reason instanceof Error ? reason.message : String(reason)
18822
- }), Effect.ignoreCause);
18823
- }));
18824
- }
18825
- //#endregion
18826
20157
  //#region src/accounts/events.ts
18827
20158
  async function emitProvisioningTelemetry(telemetry, smartAccount, runPromise) {
18828
20159
  if (telemetry === void 0) return;
@@ -18872,50 +20203,16 @@ function emitAccountBalanceFailed(telemetry, error, runPromise) {
18872
20203
  }
18873
20204
  }, runPromise);
18874
20205
  }
18875
- /** A successful authorized instruction read, not an incoming transfer. */
18876
- function emitDepositInitiated(telemetry, instructions, source, verifiedOrganizationId) {
18877
- return Effect.gen(function* () {
18878
- const organizationId = safeEngineeringIdentifier(verifiedOrganizationId);
18879
- const fields = {
18880
- scope_kind: organizationId === void 0 ? "account" : "organization",
18881
- account_kind: organizationId === void 0 ? "personalSafe" : "orgTreasury",
18882
- ...Number.isSafeInteger(instructions.chainId) && instructions.chainId > 0 ? { chain_id: instructions.chainId } : {},
18883
- ...instructions.network === "base-sepolia" ? { network: instructions.network } : {},
18884
- ...organizationId === void 0 ? {} : { verified_organization_id: organizationId }
18885
- };
18886
- yield* Effect.annotateCurrentSpan(fields);
18887
- if (telemetry === void 0) return;
18888
- const span = yield* Effect.currentSpan;
18889
- const snapshot = readInvocationObservation(source);
18890
- const { organizationId: _hint, ...context } = snapshot?.context ?? {};
18891
- const event = {
18892
- name: "deposit_initiated",
18893
- props: {
18894
- scope_kind: fields.scope_kind,
18895
- account_kind: fields.account_kind,
18896
- ...fields.chain_id === void 0 ? {} : { chain_id: fields.chain_id },
18897
- ...fields.network === void 0 ? {} : { network: fields.network },
18898
- $groups: organizationId === void 0 ? {} : { organization: organizationId },
18899
- ...safeEngineeringIdentifier(snapshot?.actorId) === void 0 ? {} : {
18900
- actor_id: snapshot.actorId,
18901
- actor_kind: "authenticated",
18902
- distinct_id: snapshot.actorId
18903
- },
18904
- trace_id: span.traceId,
18905
- span_id: span.spanId,
18906
- ...organizationId === void 0 ? {} : { organization_id: organizationId }
18907
- }
18908
- };
18909
- yield* telemetry.emit(snapshot === void 0 ? event : attachInvocationObservation(event, {
18910
- active: snapshot.active,
18911
- ...snapshot?.actorId === void 0 ? {} : { actorId: snapshot.actorId },
18912
- context: {
18913
- ...context,
18914
- ...organizationId === void 0 ? {} : { organizationId },
18915
- traceparent: `00-${span.traceId}-${span.spanId}-01`
18916
- }
18917
- }));
18918
- }).pipe(logDroppedEvent("deposit_initiated"));
20206
+ /** Keep instruction-read facts on the operation span without a product event. */
20207
+ function annotateDepositInstructions(instructions, verifiedOrganizationId) {
20208
+ const organizationId = safeEngineeringIdentifier(verifiedOrganizationId);
20209
+ return Effect.annotateCurrentSpan({
20210
+ scope_kind: organizationId === void 0 ? "account" : "organization",
20211
+ account_kind: organizationId === void 0 ? "personalSafe" : "orgTreasury",
20212
+ ...Number.isSafeInteger(instructions.chainId) && instructions.chainId > 0 ? { chain_id: instructions.chainId } : {},
20213
+ ...instructions.network === "base-sepolia" ? { network: instructions.network } : {},
20214
+ ...organizationId === void 0 ? {} : { verified_organization_id: organizationId }
20215
+ });
18919
20216
  }
18920
20217
  //#endregion
18921
20218
  //#region src/accounts/account-phases.ts
@@ -19464,8 +20761,104 @@ function makeAccountMethods(deps) {
19464
20761
  };
19465
20762
  }
19466
20763
  //#endregion
20764
+ //#region src/accounts/organization-approvals.ts
20765
+ /** The Organization Payment prepared for `signerAddress` and checked, before any approval. */
20766
+ async function prepareVerifiedOrganizationPayment(deps, input, signerAddress, signal) {
20767
+ const { organizationId, permissionId, requestKey, lineage, ...item } = input;
20768
+ const intent = organizationPaymentIntent(organizationId, {
20769
+ permissionId,
20770
+ items: [item],
20771
+ ...lineage === void 0 ? {} : { lineage },
20772
+ ...requestKey === void 0 ? {} : { requestKey }
20773
+ }, true);
20774
+ if (!intent.ok) return intent;
20775
+ const session = deps.actor?.authSession() ?? null;
20776
+ if (session === null || deps.chainId === void 0) return {
20777
+ ok: false,
20778
+ error: Errors.notAuthenticated()
20779
+ };
20780
+ const expected = {
20781
+ ...intent.value,
20782
+ requestKey: requestKey ?? `pay_${crypto.randomUUID()}`
20783
+ };
20784
+ const prepared = await runIfActive(signal, CAPXUL_OPERATIONS.organizationPayments.prepareExecution, () => callOperation(deps.convexCall, commands$1.prepareOrganization, {
20785
+ ...expected,
20786
+ signerAddress
20787
+ }).pipe(Effect.mapError((publicError) => ({ publicError }))), deps.runPromise);
20788
+ if (!prepared.ok) return prepared;
20789
+ const evidence = prepared.value;
20790
+ if (!(await matchesIntent(expected)(evidence.request, evidence) && await verifiedPreparedCommand(evidence, session.email, signerAddress, deps.chainId))) return abandonPrepared(deps, evidence.executionId, "prepared_mismatch", {
20791
+ ok: false,
20792
+ error: Errors.invalidInput("execution", "prepared Organization Payment mismatch")
20793
+ });
20794
+ await emitPreparedInitiation(deps, evidence);
20795
+ return {
20796
+ ok: true,
20797
+ value: evidence
20798
+ };
20799
+ }
20800
+ /** One fresh Payment read: the caller's own, or one in the Organization's scope. */
20801
+ const readPayment = (deps, paymentId, organizationId, signal) => organizationId === void 0 ? runIfActive(signal, records.get.name, () => callOperation(deps.convexCall, records.get, { paymentId }, { fresh: true }).pipe(Effect.map((payment) => ({ payment })), Effect.mapError((publicError) => ({ publicError }))), deps.runPromise) : runIfActive(signal, records.getForOrganization.name, () => callOperation(deps.convexCall, records.getForOrganization, {
20802
+ orgId: organizationId,
20803
+ paymentId
20804
+ }, { fresh: true }).pipe(Effect.mapError((publicError) => ({ publicError }))), deps.runPromise);
20805
+ /**
20806
+ * The Payments an approval carries, as they stand. A personal read names only
20807
+ * the caller's own Account's Payments, so an Organization's is read with its
20808
+ * `organizationId`; one that cannot be read is refused, never taken as ended.
20809
+ */
20810
+ async function readApprovalPayments(deps, paymentIds, organizationId, signal) {
20811
+ const reads = await Promise.all(paymentIds.map((paymentId) => readPayment(deps, paymentId, organizationId, signal)));
20812
+ const payments = [];
20813
+ for (const [index, read] of reads.entries()) {
20814
+ if (!read.ok) return read;
20815
+ const { orgId, payment } = read.value;
20816
+ if (payment === null && organizationId === void 0) return {
20817
+ ok: false,
20818
+ error: Errors.invalidInput("organizationId", "this approval pays from an Organization: wait with its organizationId")
20819
+ };
20820
+ if (payment === null || payment.id !== paymentIds[index] || orgId !== organizationId) return {
20821
+ ok: false,
20822
+ error: Errors.invalidInput("paymentId", "the approval's Payments are not this scope's")
20823
+ };
20824
+ payments.push(normalizePaymentTiming(payment));
20825
+ }
20826
+ return {
20827
+ ok: true,
20828
+ value: payments
20829
+ };
20830
+ }
20831
+ //#endregion
20832
+ //#region src/accounts/bank-approvals.ts
20833
+ /** Read the immutable Payment behind a bank approval before handing it to the person. */
20834
+ async function checkedBankApproval(deps, input, opened) {
20835
+ if (!opened.ok || input.to.kind !== "party_account") return opened;
20836
+ const approval = opened.value;
20837
+ const read = await readApprovalPayments(deps, approval.operation.paymentIds, "organizationId" in input ? input.organizationId : void 0, void 0);
20838
+ if (!read.ok) return read;
20839
+ const [payment] = read.value;
20840
+ let amountMatches = false;
20841
+ try {
20842
+ const funding = toExactAssetAmount(input.amount, CONFIGURED_MONEY_ASSETS);
20843
+ const described = approval.summary.amount === null ? null : toExactAssetAmount(approval.summary.amount, CONFIGURED_MONEY_ASSETS);
20844
+ const stored = payment === void 0 ? null : toExactAssetAmount(payment.amount, CONFIGURED_MONEY_ASSETS);
20845
+ amountMatches = described?.asset === funding.asset && described.minorUnits === funding.minorUnits && stored?.asset === funding.asset && stored.minorUnits === funding.minorUnits;
20846
+ } catch {
20847
+ amountMatches = false;
20848
+ }
20849
+ if (approval.kind === "bank_payout" && read.value.length === 1 && payment?.recipient.kind === "party_account" && payment.recipient.partyAccountId === input.to.partyAccountId && payment.links?.quoteId === input.quoteId && input.quoteId !== void 0 && amountMatches && (payment.recipientWarning !== true || approval.summary.warnings?.some(({ code }) => code === "RECIPIENT_ON_CAPXUL"))) return opened;
20850
+ return abandonPrepared(deps, approval.operation.executionId, "prepared_mismatch", {
20851
+ ok: false,
20852
+ error: Errors.invalidInput("approval", "The bank approval does not match its quoted Payment.")
20853
+ });
20854
+ }
20855
+ //#endregion
19467
20856
  //#region src/accounts/approval-rules.ts
19468
- const IN_FLIGHT = /* @__PURE__ */ new Set(["pending", "settling"]);
20857
+ const IN_FLIGHT = /* @__PURE__ */ new Set([
20858
+ "pending",
20859
+ "settling",
20860
+ "in_transit"
20861
+ ]);
19469
20862
  /** A Payment the chain has not decided yet. */
19470
20863
  function inFlight(payment) {
19471
20864
  return IN_FLIGHT.has(payment.status);
@@ -19632,9 +21025,10 @@ function toPayrollGroup(wire) {
19632
21025
  }))
19633
21026
  };
19634
21027
  }
21028
+ const PayrollWalletItemSchema = PayrollRunItemInputSchema.pipe(Schema.refine((item) => item.to.kind !== "party_account", { message: "Payroll cannot target saved bank accounts" }));
19635
21029
  function validateRunItems(input) {
19636
21030
  for (const [index, item] of input.items.entries()) {
19637
- if (Schema.decodeResult(PayrollRunItemInputSchema, { onExcessProperty: "error" })(item)._tag === "Failure") return Errors.invalidInput(`items.${index}`, "invalid Payroll item");
21031
+ if (Schema.decodeResult(PayrollWalletItemSchema, { onExcessProperty: "error" })(item)._tag === "Failure") return Errors.invalidInput(`items.${index}`, "invalid Payroll item");
19638
21032
  try {
19639
21033
  const exact = toExactAssetAmount(item.amount, CONFIGURED_MONEY_ASSETS);
19640
21034
  const net = BigInt(item.net);
@@ -19651,7 +21045,7 @@ const RunInputSchema = Schema.Struct({
19651
21045
  permissionId: AuthorizePayrollRunExecutionInputSchema.fields.permissionId,
19652
21046
  asset: AuthorizePayrollRunExecutionInputSchema.fields.asset,
19653
21047
  period: AuthorizePayrollRunExecutionInputSchema.fields.period,
19654
- items: AuthorizePayrollRunExecutionInputSchema.fields.items,
21048
+ items: Schema.Array(PayrollWalletItemSchema),
19655
21049
  requestKey: Schema.optional(AuthorizePayrollRunExecutionInputSchema.fields.requestKey)
19656
21050
  });
19657
21051
  /** Decode caller input before session or signer work. Keep routing outside the input. */
@@ -20055,72 +21449,6 @@ async function prepareVerifiedPayrollRun(deps, input, signerAddress, signal) {
20055
21449
  }, authorized.value.run), authorized.value.replay.kind !== "accepted");
20056
21450
  }
20057
21451
  //#endregion
20058
- //#region src/accounts/organization-approvals.ts
20059
- /** The Organization Payment prepared for `signerAddress` and checked, before any approval. */
20060
- async function prepareVerifiedOrganizationPayment(deps, input, signerAddress, signal) {
20061
- const { organizationId, permissionId, requestKey, lineage, ...item } = input;
20062
- const intent = organizationPaymentIntent(organizationId, {
20063
- permissionId,
20064
- items: [item],
20065
- ...lineage === void 0 ? {} : { lineage },
20066
- ...requestKey === void 0 ? {} : { requestKey }
20067
- }, true);
20068
- if (!intent.ok) return intent;
20069
- const session = deps.actor?.authSession() ?? null;
20070
- if (session === null || deps.chainId === void 0) return {
20071
- ok: false,
20072
- error: Errors.notAuthenticated()
20073
- };
20074
- const expected = {
20075
- ...intent.value,
20076
- requestKey: requestKey ?? `pay_${crypto.randomUUID()}`
20077
- };
20078
- const prepared = await runIfActive(signal, CAPXUL_OPERATIONS.organizationPayments.prepareExecution, () => callOperation(deps.convexCall, commands$1.prepareOrganization, {
20079
- ...expected,
20080
- signerAddress
20081
- }).pipe(Effect.mapError((publicError) => ({ publicError }))), deps.runPromise);
20082
- if (!prepared.ok) return prepared;
20083
- const evidence = prepared.value;
20084
- return await matchesIntent(expected)(evidence.request, evidence) && await verifiedPreparedCommand(evidence, session.email, signerAddress, deps.chainId) ? {
20085
- ok: true,
20086
- value: evidence
20087
- } : abandonPrepared(deps, evidence.executionId, "prepared_mismatch", {
20088
- ok: false,
20089
- error: Errors.invalidInput("execution", "prepared Organization Payment mismatch")
20090
- });
20091
- }
20092
- /** One fresh Payment read: the caller's own, or one in the Organization's scope. */
20093
- const readPayment = (deps, paymentId, organizationId, signal) => organizationId === void 0 ? runIfActive(signal, records.get.name, () => callOperation(deps.convexCall, records.get, { paymentId }, { fresh: true }).pipe(Effect.map((payment) => ({ payment })), Effect.mapError((publicError) => ({ publicError }))), deps.runPromise) : runIfActive(signal, records.getForOrganization.name, () => callOperation(deps.convexCall, records.getForOrganization, {
20094
- orgId: organizationId,
20095
- paymentId
20096
- }, { fresh: true }).pipe(Effect.mapError((publicError) => ({ publicError }))), deps.runPromise);
20097
- /**
20098
- * The Payments an approval carries, as they stand. A personal read names only
20099
- * the caller's own Account's Payments, so an Organization's is read with its
20100
- * `organizationId`; one that cannot be read is refused, never taken as ended.
20101
- */
20102
- async function readApprovalPayments(deps, paymentIds, organizationId, signal) {
20103
- const reads = await Promise.all(paymentIds.map((paymentId) => readPayment(deps, paymentId, organizationId, signal)));
20104
- const payments = [];
20105
- for (const [index, read] of reads.entries()) {
20106
- if (!read.ok) return read;
20107
- const { orgId, payment } = read.value;
20108
- if (payment === null && organizationId === void 0) return {
20109
- ok: false,
20110
- error: Errors.invalidInput("organizationId", "this approval pays from an Organization: wait with its organizationId")
20111
- };
20112
- if (payment === null || payment.id !== paymentIds[index] || orgId !== organizationId) return {
20113
- ok: false,
20114
- error: Errors.invalidInput("paymentId", "the approval's Payments are not this scope's")
20115
- };
20116
- payments.push(normalizePaymentTiming(payment));
20117
- }
20118
- return {
20119
- ok: true,
20120
- value: payments
20121
- };
20122
- }
20123
- //#endregion
20124
21452
  //#region src/accounts/approvals.ts
20125
21453
  /** A Permission write or an invitation, rather than a Payment. */
20126
21454
  const isPermissionChange = (input) => "permission" in input || "invite" in input;
@@ -20167,20 +21495,24 @@ function makeApprovalsMethods(deps) {
20167
21495
  if (!prepared.ok) return prepared;
20168
21496
  const { executionId } = prepared.value;
20169
21497
  const opened = await call(approvals.request.name, approvals.request, { executionId });
21498
+ if (opened.ok && opened.value.operation.executionId !== executionId) return abandonPrepared(deps, executionId, "prepared_mismatch", {
21499
+ ok: false,
21500
+ error: Errors.invalidInput("approval", "The approval names another prepared execution.")
21501
+ });
20170
21502
  return opened.ok ? opened : abandonPrepared(deps, executionId, "cancelled", opened);
20171
21503
  };
20172
21504
  const prepare = async (input, options) => {
20173
21505
  const signal = options?.signal;
20174
21506
  if (isCommandApproval(input)) return openApproval(signal, (signerAddress) => prepareVerifiedCommand(deps, input, signerAddress, signal));
20175
21507
  if (isPermissionChange(input)) return openApproval(signal, async (signerAddress) => {
20176
- const { prepareVerifiedPermissionChange } = await import("./permission-approvals-BLI_uadD.mjs");
21508
+ const { prepareVerifiedPermissionChange } = await import("./permission-approvals-Cpm4W-Rr.mjs");
20177
21509
  return prepareVerifiedPermissionChange(deps, input, signerAddress, signal);
20178
21510
  });
20179
- if ("organizationId" in input) return openApproval(signal, (signerAddress) => prepareVerifiedOrganizationPayment(deps, input, signerAddress, signal));
21511
+ if ("organizationId" in input) return checkedBankApproval(deps, input, await openApproval(signal, (signerAddress) => prepareVerifiedOrganizationPayment(deps, input, signerAddress, signal)));
20180
21512
  const intent = paymentExecutionIntent(input);
20181
21513
  if (!intent.ok) return intent;
20182
21514
  const { actor, chainId } = deps;
20183
- return openApproval(signal, async (signerAddress) => {
21515
+ return checkedBankApproval(deps, input, await openApproval(signal, async (signerAddress) => {
20184
21516
  if (actor === void 0 || chainId === void 0) return {
20185
21517
  ok: false,
20186
21518
  error: Errors.notImplemented("approvals", "prepareComposition")
@@ -20193,7 +21525,7 @@ function makeApprovalsMethods(deps) {
20193
21525
  }, intent.value, signerAddress, input.requestKey ?? `pay_${crypto.randomUUID()}`, signal);
20194
21526
  if (prepared.ok) await emitPreparedPaymentInitiated(deps, prepared.value);
20195
21527
  return prepared;
20196
- });
21528
+ }));
20197
21529
  };
20198
21530
  const approve = async (approvalId) => {
20199
21531
  const { signer } = deps;
@@ -20655,7 +21987,7 @@ function headlineValuation(balances, displayCurrency, rates = MONEY_READ_RATES)
20655
21987
  const valuation = valueIn(balances.map((position) => ({
20656
21988
  asset: position.asset,
20657
21989
  value: pick(position)
20658
- })), displayCurrency, rates);
21990
+ })).filter((amount) => toRaw(amount, requireAsset(amount.asset)) !== 0n), displayCurrency, rates);
20659
21991
  if (valuation.unrated.length > 0) return null;
20660
21992
  return valuation.total ?? {
20661
21993
  currency: displayCurrency,
@@ -22264,6 +23596,7 @@ function paymentPhase(status) {
22264
23596
  switch (status) {
22265
23597
  case "pending":
22266
23598
  case "settling":
23599
+ case "in_transit":
22267
23600
  case "scheduled":
22268
23601
  case "streaming": return PENDING;
22269
23602
  case "pending_claim": return AWAITING_ACTOR;
@@ -22318,7 +23651,7 @@ function makeMeMethods(deps) {
22318
23651
  })), Effect.mapError((publicError) => ({ publicError }))), deps.runPromise),
22319
23652
  depositInstructions: (options) => {
22320
23653
  const controls = deps.invocationControls?.(options) ?? options;
22321
- return runPortEffect(callOperation(deps.convexCall, summaries.depositInstructions, copyInvocationObservation(controls, {})).pipe(Effect.mapError((publicError) => ({ publicError })), Effect.tap((instructions) => emitDepositInitiated(deps.telemetry, instructions, controls))), controls, summaries.depositInstructions.name, deps.runPromise);
23654
+ return runPortEffect(callOperation(deps.convexCall, summaries.depositInstructions, copyInvocationObservation(controls, {})).pipe(Effect.mapError((publicError) => ({ publicError })), Effect.tap(annotateDepositInstructions)), controls, summaries.depositInstructions.name, deps.runPromise);
22322
23655
  }
22323
23656
  };
22324
23657
  }
@@ -23224,4 +24557,4 @@ function executeIdentityProductObservation(telemetry, record, state) {
23224
24557
  return ignoreTransportFailure(() => invocationTelemetry.emit(mapped), "emit", mapped.name).pipe(Effect.andThen(ignoreTransportFailure(after, mapped.name === "auth_signed_out" ? "reset" : "identify", mapped.name)));
23225
24558
  }
23226
24559
  //#endregion
23227
- export { formatAssetAmount as $, InvitationViewSchema as $n, ActorFailure as $r, version as $t, registerProductTelemetryInvocation as A, toEpochMs as Ai, details as An, EVM_ADDRESS_RE$1 as Ar, safe4337ExecuteUserOpCallData as At, makeOrganizationPaymentsMethods as B, isFailureMode as Bi, FixedOfferDraftSchema as Bn, runIdentityFacade as Br, failureEvidenceProps as Bt, AccountReadPortTag as C, detectAuthCacheAdapter as Ci, CLI_INVOCATION_KINDS as Cn, toPermissionId as Cr, SEND_BATCH_SIGNATURE as Ct, convexCallErrorFromCapxul as D, parseAuthSession as Di, isCapxulOperation as Dn, toAssetId as Dr, TOKENS as Dt, ConvexCallPortTag as E, BrowserAuthCacheAdapter as Ei, CAPXUL_OPERATIONS as En, currencySymbolFor as Er, CONFIGURED_MONEY_ASSETS as Et, decodePayrollRunInput as F, toSessionToken as Fi, replacements as Fn, absurd as Fr, SAFE_SENTINEL_OWNERS as Ft, makeActorRelationshipMethods as G, treasuries as Gn, withVerifiedOrganizationScope as Gr, observationContextProps as Gt, makePaymentsMethods as H, readField as Hi, members as Hn, sessionFromActor as Hr, postHogFailureObservation as Ht, toPayrollGroupId as I, Errors as Ii, PreparedPermissionExecutionSchema as In, reference as Ir, callOperation as It, makeTargetsMethods as J, ORGANIZATION_SETUP_REASONS as Jn, runIfActive as Jr, SDK_VERSION as Jt, makeCheckoutMethods as K, workspaces as Kn, awaitCapxulResult as Kr, withCapturedAttemptContext as Kt, makeAccountMethods as L, CapxulError as Li, PermissionCommandViewSchema as Ln, makeAuthMethods as Lr, asCapxulError as Lt, makeApprovalsMethods as M, toAuthUserId as Mi, authorities as Mn, toAddress as Mr, buildSafeMultiSendExecTransactionCall as Mt, makePayrollMethods as N, toEmail as Ni, commands as Nn, toChainId as Nr, BASE_SEPOLIA_CHAIN_ID as Nt, retryIdempotentRead as O, parseCachedJwt as Oi, normalizeCapxulOperation as On, toCurrencyCode as Or, deriveCapxulSafeAddress as Ot, makeUnavailablePayrollMethods as P, toJwtToken as Pi, configurations as Pn, toWeiAmount as Pr, MULTI_SEND_CALL_ONLY as Pt, assetSymbolFor as Q, toOrgId as Qn, EXPECTED_OPERATION_OUTCOMES as Qr, safeExceptionLabel as Qt, emitDepositInitiated as R, isCapxulError as Ri, PayrollGroupIdSchema as Rn, askIdentity as Rr, toPublicError$1 as Rt, valueIn as S, AuthClientPortTag as Si, CLI_COMMAND_NAMES as Sn, toPermissionAssignmentId as Sr, SAFE_ENABLE_MODULE_ABI as St, TelemetryPortTag as T, InMemoryAuthCacheAdapter as Ti, stampTelemetryEnvelope as Tn, ChainIdSchema$1 as Tr, CAPXUL_PAYMENTS_V2_ADDRESS as Tt, waitForPaymentSubmission as U, AuthCacheError as Ui, roles as Un, observationOnlyControls as Ur, observeFailedResult as Ut, makeOfframpMethods as V, isRecord as Vi, invitations as Vn, runPortEffect as Vr, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT as Vt, makeDestinationsMethods as W, AuthCachePortTag as Wi, setups as Wn, runCapxulEffect as Wr, observeSdkClient as Wt, abandonPrepared as X, CHAIN_UPSTREAMS as Xn, formatTraceparent as Xr, normalizeExceptionOperation as Xt, subscribeFreshQuery as Y, ORGANIZATION_SETUP_STATUSES as Yn, toCapxulResult as Yr, normalizeExceptionErrorKind as Yt, assetAmountFromRaw as Z, decodeChainCause as Zn, CAPXUL_ERROR_CODES as Zr, projectSdkException as Zt, accountFromAccountPositions as _, toAllowedOrigin as _i, toPartyId as _n, PAYMENT_DIRECTIONS as _r, ROLES_EXEC_TRANSACTION_WITH_ROLE_ABI as _t, paymentPhase as a, ClockPortTag as ai, isSignerNotReadySignal as an, ORG_BUDGET_ACTIONS as ar, canonicalJson as at, MONEY_READ_RATES as b, authClientPortFromPromiseAdapter as bi, redactTelemetryProps as bn, EpochMsSchema$1 as br, ROLES_SET_UP_ABI as bt, makePaymentDocumentsMethods as c, BetterAuthBrowserLayer as ci, signerFailure as cn, AppIdSchema$1 as cr, ZODIAC_MODULE_PROXY_FACTORY as ct, SmartAccountPortTag as d, copyInvocationObservation as di, makeClientRequestMethods as dn, PaymentDocumentOptionsSchema as dr, MODULE_PROXY_FACTORY_ABI as dt, carryInvocationParentSpan as ei, isSettingUpLifecycle as en, hashPermissionReplacementPreview as er, parseAssetAmount as et, smartAccountErrorFromCapxul as f, readInvocationObservation as fi, toCountryCode as fn, isBytes32 as fr, MULTI_SEND_SELECTOR as ft, ConvexAccountLayer as g, isCredentialField as gi, toHandle as gn, toLowerHex as gr, ROLES_ASSIGN_ROLES_ABI as gt, makeAccountsMethods as h, redactUrlSecrets as hi, HANDLE_RE as hn, toLowerBytes32 as hr, PARAMETER_TYPE as ht, inboxPhase as i, ClockError as ii, isEcdsaSignatureHex as in, MONTHLY_REFILL_PERIOD_SECONDS as ir, parseMoney as it, wireChainId as j, toEpochSeconds as ji, onboardings as jn, isEvmAddress as jr, safe4337MultiSendUserOpCallData as jt, bindProductTelemetryInvocation as k, toDurationMs as ki, OPERATIONS as kn, toExactAssetAmount as kr, normalizeSafeSaltEmail as kt, makeSmartAccountMethods as l, observationRequestHeaders as li, resolveFailureMode as ln, images as lr, resolveOrgPermissionIdentity as lt, PonderIndexerAdapter as m, redactSecrets as mi, toTesterKind as mn, toLowerAddress as mr, OWNER_COMMITMENT_SIGNATURES as mt, bootIdentityFlow as n, oauthBearerAuthClient as ni, causeChain as nn, keepRefillOnChange as nr, toRaw as nt, requestPhase as o, readClockNow as oi, openfortSignerNotReadyCode as on, roleKeyForPermission as or, fingerprintPaymentIntent as ot, makeHoldingsMethods as p, sanitizeObservationContext as pi, toKycTier as pn, toExactHex as pr, OPERATOR as pt, isCheckoutSettlementConsumed as q, OrganizationSetupSchema as qn, defectAsCapxulError as qr, EXCEPTION_MESSAGE as qt, makeMeMethods as r, SystemClockLayer as ri, injectedWalletSigner as rn, CurrentPolicySchema as rr, isMoneyParseError as rt, makeActivityMethods as s, BetterAuthNodeLayer as si, recoverRawDigestSigner as sn, diagnostics as sr, moneySafeOpDigest as st, executeIdentityProductObservation as t, withInvocationParentSpan as ti, UNOBSERVABLE_SIGNER_STATUS as tn, decodePermissionIntent as tr, requireAsset as tt, ConvexSmartAccountLayer as u, attachInvocationObservation as ui, makeCurrentUserMethods as un, toAccountId as ur, CREATE_COMMITMENT_SIGNATURE as ut, accountPositionsFromWire as v, toAppId as vi, validateHandle as vn, PAYMENT_STATUSES as vr, ROLES_SET_ALLOWANCE_ABI as vt, accountReadErrorFromCapxul as w, globalLocalStorage as wi, EXCEPTION_EVENT_NAME as wn, toRoleKey as wr, SEND_SIGNATURE as wt, valueActivitySummary as x, AuthClientError as xi, CLI_CAPABILITIES as xn, toBudgetId as xr, ROLE_MANAGEMENT_SIGNATURES as xt, positionPeg as y, toPublishableKey as yi, redactTelemetryEvent as yn, DurationMsSchema$1 as yr, ROLES_SET_TRANSACTION_UNWRAPPER_ABI as yt, logDroppedEvent as z, FAILURE_MODES$1 as zi, PayrollGroupInputSchema as zn, publicIdentityFailure as zr, failureDetail as zt };
24560
+ export { parseAssetAmount as $, hashPermissionReplacementPreview as $n, EXPECTED_OPERATION_OUTCOMES as $r, isSettingUpLifecycle as $t, registerProductTelemetryInvocation as A, toDurationMs as Ai, onboardings as An, toExactAssetAmount as Ar, safe4337MultiSendUserOpCallData as At, makePaymentsMethods as B, FAILURE_MODES$1 as Bi, invitations as Bn, publicIdentityFailure as Br, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT as Bt, AccountReadPortTag as C, AuthClientPortTag as Ci, EXCEPTION_EVENT_NAME as Cn, toPermissionAssignmentId as Cr, SEND_SIGNATURE as Ct, convexCallErrorFromCapxul as D, BrowserAuthCacheAdapter as Di, normalizeCapxulOperation as Dn, currencySymbolFor as Dr, deriveCapxulSafeAddress as Dt, ConvexCallPortTag as E, InMemoryAuthCacheAdapter as Ei, isCapxulOperation as En, ChainIdSchema$1 as Er, TOKENS as Et, decodePayrollRunInput as F, toJwtToken as Fi, PreparedPermissionExecutionSchema as Fn, toWeiAmount as Fr, callOperation as Ft, isCheckoutSettlementConsumed as G, AuthCachePortTag as Gi, workspaces as Gn, runCapxulEffect as Gr, withCapturedAttemptContext as Gt, makeDestinationsMethods as H, isRecord as Hi, roles as Hn, runPortEffect as Hr, observeFailedResult as Ht, toPayrollGroupId as I, toSessionToken as Ii, PermissionCommandViewSchema as In, absurd as Ir, asCapxulError as It, subscribeFreshQuery as J, ORGANIZATION_SETUP_STATUSES as Jn, defectAsCapxulError as Jr, normalizeExceptionErrorKind as Jt, makeTargetsMethods as K, OrganizationSetupSchema as Kn, withVerifiedOrganizationScope as Kr, EXCEPTION_MESSAGE as Kt, makeAccountMethods as L, Errors as Li, PayrollGroupIdSchema as Ln, reference as Lr, toPublicError$1 as Lt, makeApprovalsMethods as M, toEpochSeconds as Mi, commands as Mn, isEvmAddress as Mr, BASE_SEPOLIA_CHAIN_ID as Mt, makePayrollMethods as N, toAuthUserId as Ni, configurations as Nn, toAddress as Nr, MULTI_SEND_CALL_ONLY as Nt, retryIdempotentRead as O, parseAuthSession as Oi, OPERATIONS as On, toAssetId as Or, normalizeSafeSaltEmail as Ot, makeUnavailablePayrollMethods as P, toEmail as Pi, replacements as Pn, toChainId as Pr, SAFE_SENTINEL_OWNERS as Pt, formatAssetAmount as Q, InvitationViewSchema as Qn, CAPXUL_ERROR_CODES as Qr, version as Qt, annotateDepositInstructions as R, CapxulError as Ri, PayrollGroupInputSchema as Rn, makeAuthMethods as Rr, failureDetail as Rt, valueIn as S, AuthClientError as Si, CLI_INVOCATION_KINDS as Sn, toBudgetId as Sr, SEND_BATCH_SIGNATURE as St, TelemetryPortTag as T, globalLocalStorage as Ti, CAPXUL_OPERATIONS as Tn, toRoleKey as Tr, CONFIGURED_MONEY_ASSETS as Tt, makeActorRelationshipMethods as U, readField as Ui, setups as Un, sessionFromActor as Ur, observeSdkClient as Ut, waitForPaymentSubmission as V, isFailureMode as Vi, members as Vn, runIdentityFacade as Vr, postHogFailureObservation as Vt, makeCheckoutMethods as W, AuthCacheError as Wi, treasuries as Wn, observationOnlyControls as Wr, observationContextProps as Wt, assetAmountFromRaw as X, decodeChainCause as Xn, toCapxulResult as Xr, projectSdkException as Xt, abandonPrepared as Y, CHAIN_UPSTREAMS as Yn, runIfActive as Yr, normalizeExceptionOperation as Yt, assetSymbolFor as Z, toOrgId as Zn, formatTraceparent as Zr, safeExceptionLabel as Zt, accountFromAccountPositions as _, isCredentialField as _i, validateHandle as _n, toLowerHex as _r, ROLES_SET_ALLOWANCE_ABI as _t, paymentPhase as a, ClockError as ai, openfortSignerNotReadyCode as an, roleKeyForPermission as ar, fingerprintPaymentIntent as at, MONEY_READ_RATES as b, toPublishableKey as bi, CLI_CAPABILITIES as bn, DurationMsSchema$1 as br, ROLE_MANAGEMENT_SIGNATURES as bt, makePaymentDocumentsMethods as c, BetterAuthNodeLayer as ci, resolveFailureMode as cn, images as cr, resolveOrgPermissionIdentity as ct, SmartAccountPortTag as d, attachInvocationObservation as di, toCountryCode as dn, toAccountId as dr, MULTI_SEND_SELECTOR as dt, ActorFailure as ei, UNOBSERVABLE_SIGNER_STATUS as en, decodePermissionIntent as er, requireAsset as et, smartAccountErrorFromCapxul as f, copyInvocationObservation as fi, toKycTier as fn, PaymentDocumentOptionsSchema as fr, OPERATOR as ft, ConvexAccountLayer as g, redactUrlSecrets as gi, toPartyId as gn, toLowerBytes32 as gr, ROLES_EXEC_TRANSACTION_WITH_ROLE_ABI as gt, makeAccountsMethods as h, redactSecrets as hi, toHandle as hn, toLowerAddress as hr, ROLES_ASSIGN_ROLES_ABI as ht, inboxPhase as i, SystemClockLayer as ii, isSignerNotReadySignal as in, ORG_BUDGET_ACTIONS as ir, canonicalJson as it, wireChainId as j, toEpochMs as ji, authorities as jn, EVM_ADDRESS_RE$1 as jr, buildSafeMultiSendExecTransactionCall as jt, bindProductTelemetryInvocation as k, parseCachedJwt as ki, details as kn, toCurrencyCode as kr, safe4337ExecuteUserOpCallData as kt, makeSmartAccountMethods as l, BetterAuthBrowserLayer as li, makeCurrentUserMethods as ln, bankDetails as lr, CREATE_COMMITMENT_SIGNATURE as lt, PonderIndexerAdapter as m, sanitizeObservationContext as mi, HANDLE_RE as mn, toExactHex as mr, PARAMETER_TYPE as mt, bootIdentityFlow as n, withInvocationParentSpan as ni, injectedWalletSigner as nn, CurrentPolicySchema as nr, isMoneyParseError as nt, requestPhase as o, ClockPortTag as oi, recoverRawDigestSigner as on, diagnostics as or, moneySafeOpDigest as ot, makeHoldingsMethods as p, readInvocationObservation as pi, toTesterKind as pn, isBytes32 as pr, OWNER_COMMITMENT_SIGNATURES as pt, makeVerificationMethods as q, ORGANIZATION_SETUP_REASONS as qn, awaitCapxulResult as qr, SDK_VERSION as qt, makeMeMethods as r, oauthBearerAuthClient as ri, isEcdsaSignatureHex as rn, MONTHLY_REFILL_PERIOD_SECONDS as rr, parseMoney as rt, makeActivityMethods as s, readClockNow as si, signerFailure as sn, AppIdSchema$1 as sr, ZODIAC_MODULE_PROXY_FACTORY as st, executeIdentityProductObservation as t, carryInvocationParentSpan as ti, causeChain as tn, keepRefillOnChange as tr, toRaw as tt, ConvexSmartAccountLayer as u, observationRequestHeaders as ui, makeClientRequestMethods as un, deposits as ur, MODULE_PROXY_FACTORY_ABI as ut, accountPositionsFromWire as v, toAllowedOrigin as vi, redactTelemetryEvent as vn, PAYMENT_DIRECTIONS as vr, ROLES_SET_TRANSACTION_UNWRAPPER_ABI as vt, accountReadErrorFromCapxul as w, detectAuthCacheAdapter as wi, stampTelemetryEnvelope as wn, toPermissionId as wr, CAPXUL_PAYMENTS_V2_ADDRESS as wt, valueActivitySummary as x, authClientPortFromPromiseAdapter as xi, CLI_COMMAND_NAMES as xn, EpochMsSchema$1 as xr, SAFE_ENABLE_MODULE_ABI as xt, positionPeg as y, toAppId as yi, redactTelemetryProps as yn, PAYMENT_STATUSES as yr, ROLES_SET_UP_ABI as yt, makeOrganizationPaymentsMethods as z, isCapxulError as zi, FixedOfferDraftSchema as zn, askIdentity as zr, failureEvidenceProps as zt };