@capxul/sdk 0.2.0-alpha.4 → 0.2.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -308
- package/dist/InMemoryAuthCacheAdapter-BK-B_ERB.mjs +113 -0
- package/dist/InMemoryAuthCacheAdapter-BK-B_ERB.mjs.map +1 -0
- package/dist/index.d.mts +1263 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +4740 -0
- package/dist/index.mjs.map +1 -0
- package/dist/node/index.d.mts +55 -0
- package/dist/node/index.d.mts.map +1 -0
- package/dist/node/index.mjs +159 -0
- package/dist/node/index.mjs.map +1 -0
- package/dist/ports/safe-deployment.d.mts +2 -0
- package/dist/ports/safe-deployment.mjs +38 -0
- package/dist/ports/safe-deployment.mjs.map +1 -0
- package/dist/safe-deployment-Vni46k3t.d.mts +137 -0
- package/dist/safe-deployment-Vni46k3t.d.mts.map +1 -0
- package/dist/signer-oaYGfjDe.d.mts +142 -0
- package/dist/signer-oaYGfjDe.d.mts.map +1 -0
- package/package.json +37 -70
- package/CHANGELOG.md +0 -274
- package/LICENSE +0 -44
- package/dist/client-CbUeJoM9.d.ts +0 -1335
- package/dist/client-UEm2oZbZ.d.cts +0 -1335
- package/dist/client.cjs +0 -4042
- package/dist/client.d.cts +0 -6
- package/dist/client.d.ts +0 -6
- package/dist/client.js +0 -4040
- package/dist/errors-CwhCWGxm.d.ts +0 -70
- package/dist/errors-rqxuUhQP.d.cts +0 -70
- package/dist/errors.cjs +0 -35
- package/dist/errors.d.cts +0 -2
- package/dist/errors.d.ts +0 -2
- package/dist/errors.js +0 -31
- package/dist/index.cjs +0 -4273
- package/dist/index.d.cts +0 -461
- package/dist/index.d.ts +0 -461
- package/dist/index.js +0 -4234
- package/dist/next-action-CTGl8wpy.d.cts +0 -177
- package/dist/next-action-CTGl8wpy.d.ts +0 -177
- package/dist/types-BD4VAQb5.d.ts +0 -1205
- package/dist/types-HlwCIjgQ.d.cts +0 -1205
- package/dist/webhooks.cjs +0 -118
- package/dist/webhooks.d.cts +0 -33
- package/dist/webhooks.d.ts +0 -33
- package/dist/webhooks.js +0 -116
package/dist/types-BD4VAQb5.d.ts
DELETED
|
@@ -1,1205 +0,0 @@
|
|
|
1
|
-
import { Y as PublicId, A as AccountId$1, S as SafeId$1, d as OrganizationId$1, N as NextAction$1, c as KycProfileId$1, b as ExternalAccountId$1, O as OperationId$1, C as CorrelationId$1, f as SubAccountId$1, B as BalanceLedgerEntryId$1, a as ApiKeyId$1, h as TreasuryId$1, M as MemberId$1, P as PaymentId$1, g as TransferId$1, k as WithdrawalId$1, D as DocumentId$1, W as WebhookEndpointId$1, j as WebhookEventId$1, V as VirtualAccountId$1, i as VirtualCardId$1, K as KybProfileId$1 } from './next-action-CTGl8wpy.js';
|
|
2
|
-
|
|
3
|
-
type AccountId = string;
|
|
4
|
-
type OrganizationId = string;
|
|
5
|
-
type MemberId = string;
|
|
6
|
-
type SafeId = string;
|
|
7
|
-
type TreasuryId = string;
|
|
8
|
-
type KycProfileId = string;
|
|
9
|
-
type KybProfileId = string;
|
|
10
|
-
type ExternalAccountId = string;
|
|
11
|
-
type PaymentId = string;
|
|
12
|
-
type WithdrawalId = string;
|
|
13
|
-
type OperationId = string;
|
|
14
|
-
type CorrelationId = string;
|
|
15
|
-
type WebhookEndpointId = string;
|
|
16
|
-
type WebhookEventId = string;
|
|
17
|
-
type SubAccountId = string;
|
|
18
|
-
type VirtualAccountId = string;
|
|
19
|
-
type VirtualCardId = string;
|
|
20
|
-
type TransferId = string;
|
|
21
|
-
type DocumentId = string;
|
|
22
|
-
type BalanceLedgerEntryId = string;
|
|
23
|
-
type ApiKeyId = string;
|
|
24
|
-
/**
|
|
25
|
-
* Lowercased, shape-validated email address.
|
|
26
|
-
*/
|
|
27
|
-
type Email = string;
|
|
28
|
-
/**
|
|
29
|
-
* E.164 international phone number.
|
|
30
|
-
*/
|
|
31
|
-
type PhoneNumber = string;
|
|
32
|
-
/**
|
|
33
|
-
* 3–30 chars, letter-first, lowercased; globally unique handle.
|
|
34
|
-
*/
|
|
35
|
-
type Username = string;
|
|
36
|
-
/**
|
|
37
|
-
* ISO 8601 timestamp in UTC.
|
|
38
|
-
*/
|
|
39
|
-
type TimestampIso$1 = string;
|
|
40
|
-
/**
|
|
41
|
-
* Lowercased EVM address .
|
|
42
|
-
*/
|
|
43
|
-
type Address = string;
|
|
44
|
-
/**
|
|
45
|
-
* EVM transaction hash.
|
|
46
|
-
*/
|
|
47
|
-
type TxHash = string;
|
|
48
|
-
/**
|
|
49
|
-
* Non-negative EVM block number.
|
|
50
|
-
*/
|
|
51
|
-
type BlockNumber = number;
|
|
52
|
-
/**
|
|
53
|
-
* EVM chain ID (positive integer).
|
|
54
|
-
*/
|
|
55
|
-
type ChainId = number;
|
|
56
|
-
/**
|
|
57
|
-
* Non-negative integer string for token amounts (avoids JS float precision).
|
|
58
|
-
*/
|
|
59
|
-
type WeiAmount = string;
|
|
60
|
-
/**
|
|
61
|
-
* Mutually-exclusive-keys union (Stripe-style, no `kind` wrapper) for
|
|
62
|
-
* addressing a user by any of four identifiers: email, phone, username,
|
|
63
|
-
* or accountId. Exactly one field must be present.
|
|
64
|
-
*
|
|
65
|
-
*/
|
|
66
|
-
type UserIdentifier$1 = {
|
|
67
|
-
email: Email;
|
|
68
|
-
} | {
|
|
69
|
-
phone: PhoneNumber;
|
|
70
|
-
} | {
|
|
71
|
-
username: Username;
|
|
72
|
-
} | {
|
|
73
|
-
accountId: AccountId;
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* On-chain settlement detail. Present on the HTTP wire; the `@capxul/sdk`
|
|
77
|
-
* client strips by default — opt back in via `include: ["settlement"]`.
|
|
78
|
-
*
|
|
79
|
-
*/
|
|
80
|
-
type Settlement$1 = {
|
|
81
|
-
token: "USDC";
|
|
82
|
-
tokenAmount: WeiAmount;
|
|
83
|
-
contractAddress: Address;
|
|
84
|
-
chain: ChainId;
|
|
85
|
-
txHash?: TxHash;
|
|
86
|
-
blockNumber?: BlockNumber;
|
|
87
|
-
};
|
|
88
|
-
type Money$1 = {
|
|
89
|
-
value: string;
|
|
90
|
-
currency: string;
|
|
91
|
-
};
|
|
92
|
-
type OperationStatus$1 = "accepted" | "processing" | "action_required" | "submitted" | "succeeded" | "failed" | "canceled" | "indexed";
|
|
93
|
-
type OperationSummary$1 = {
|
|
94
|
-
id: OperationId;
|
|
95
|
-
status: OperationStatus$1;
|
|
96
|
-
correlationId: CorrelationId;
|
|
97
|
-
};
|
|
98
|
-
type NextAction = CompleteKycAction | CompleteKybAction | ApproveTransactionAction | SendFundsAction | FollowRedirectAction | ProvideOtpAction | FixDestinationAction | ContactSupportAction | ConfirmFxQuoteAction;
|
|
99
|
-
type CompleteKycAction = {
|
|
100
|
-
kind: "complete_kyc";
|
|
101
|
-
url?: string;
|
|
102
|
-
expiresAt?: string;
|
|
103
|
-
};
|
|
104
|
-
type CompleteKybAction = {
|
|
105
|
-
kind: "complete_kyb";
|
|
106
|
-
url?: string;
|
|
107
|
-
embedToken?: string;
|
|
108
|
-
expiresAt?: string;
|
|
109
|
-
};
|
|
110
|
-
type ApproveTransactionAction = {
|
|
111
|
-
kind: "approve_transaction";
|
|
112
|
-
intentId: string;
|
|
113
|
-
url?: string;
|
|
114
|
-
};
|
|
115
|
-
type SendFundsAction = {
|
|
116
|
-
kind: "send_funds";
|
|
117
|
-
amount: Money$1;
|
|
118
|
-
destination: {
|
|
119
|
-
[key: string]: unknown;
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
type FollowRedirectAction = {
|
|
123
|
-
kind: "follow_redirect";
|
|
124
|
-
url: string;
|
|
125
|
-
expiresAt?: string;
|
|
126
|
-
};
|
|
127
|
-
type ProvideOtpAction = {
|
|
128
|
-
kind: "provide_otp";
|
|
129
|
-
channel?: "email" | "sms" | "provider";
|
|
130
|
-
};
|
|
131
|
-
/**
|
|
132
|
-
* Recipient address needs attention. Enriched payload carries
|
|
133
|
-
* invitation metadata for `reason = recipient_not_yet_capxul_user`
|
|
134
|
-
* so the client UI can surface an "invite" CTA.
|
|
135
|
-
*
|
|
136
|
-
*/
|
|
137
|
-
type FixDestinationAction = {
|
|
138
|
-
kind: "fix_destination";
|
|
139
|
-
reason: "recipient_not_yet_capxul_user" | "recipient_unreachable_email" | "destination_kyc_blocked" | "invalid_format";
|
|
140
|
-
recipient?: {
|
|
141
|
-
email?: Email;
|
|
142
|
-
phone?: PhoneNumber;
|
|
143
|
-
username?: Username;
|
|
144
|
-
invitationSentAt?: TimestampIso$1;
|
|
145
|
-
invitationExpiresAt?: TimestampIso$1;
|
|
146
|
-
signupUrl?: string;
|
|
147
|
-
};
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Cross-currency transfer needs the caller to commit the quoted
|
|
151
|
-
* FX rate before processing begins. Quotes expire — on
|
|
152
|
-
* POST /v1/transfers/{id}/confirm the API returns
|
|
153
|
-
* QUOTE_EXPIRED (409) or QUOTE_NOT_FOUND (404).
|
|
154
|
-
*
|
|
155
|
-
*/
|
|
156
|
-
type ConfirmFxQuoteAction = {
|
|
157
|
-
kind: "confirm_fx_quote";
|
|
158
|
-
quoteId: string;
|
|
159
|
-
/**
|
|
160
|
-
* Decimal string (no floats).
|
|
161
|
-
*/
|
|
162
|
-
rate: string;
|
|
163
|
-
sourceAmount: Money$1;
|
|
164
|
-
creditAmount: Money$1;
|
|
165
|
-
fees?: Money$1;
|
|
166
|
-
expiresAt: TimestampIso$1;
|
|
167
|
-
};
|
|
168
|
-
type ContactSupportAction = {
|
|
169
|
-
kind: "contact_support";
|
|
170
|
-
reason: string;
|
|
171
|
-
};
|
|
172
|
-
type Account$1 = {
|
|
173
|
-
object: "account";
|
|
174
|
-
id: AccountId;
|
|
175
|
-
email: Email;
|
|
176
|
-
name?: string;
|
|
177
|
-
username?: Username;
|
|
178
|
-
phone?: PhoneNumber;
|
|
179
|
-
/**
|
|
180
|
-
* ISO 3166-1 alpha-2 country code. Self-lens only.
|
|
181
|
-
*/
|
|
182
|
-
countryCode?: string;
|
|
183
|
-
/**
|
|
184
|
-
* KYC tier for the account owner. Self-lens only; null until KYC starts.
|
|
185
|
-
*/
|
|
186
|
-
kycTier?: 0 | 1 | 2 | 3;
|
|
187
|
-
/**
|
|
188
|
-
* The personal Safe pointer for self-lens reads. Lens-
|
|
189
|
-
* conditional per Doc 02: omitted on co-member and
|
|
190
|
-
* service-key responses for other users' accounts;
|
|
191
|
-
* present on `capxul.me.get()` and on
|
|
192
|
-
* `capxul.accounts.retrieve(selfAccountId)`. The SDK's
|
|
193
|
-
* response parser trusts server-side lens filtering to
|
|
194
|
-
* either include or omit this field.
|
|
195
|
-
*
|
|
196
|
-
*/
|
|
197
|
-
primarySafeId?: string;
|
|
198
|
-
/**
|
|
199
|
-
* Self/admin visibility flag for email lookup consent.
|
|
200
|
-
*/
|
|
201
|
-
discoverableByEmail?: boolean;
|
|
202
|
-
/**
|
|
203
|
-
* Self/admin visibility flag for phone lookup consent.
|
|
204
|
-
*/
|
|
205
|
-
discoverableByPhone?: boolean;
|
|
206
|
-
createdAt: TimestampIso$1;
|
|
207
|
-
updatedAt: TimestampIso$1;
|
|
208
|
-
};
|
|
209
|
-
type Organization$1 = {
|
|
210
|
-
object: "organization";
|
|
211
|
-
id: OrganizationId;
|
|
212
|
-
status: string;
|
|
213
|
-
operation: OperationSummary$1;
|
|
214
|
-
};
|
|
215
|
-
type MembershipStatus$1 = "pending" | "active" | "revoked" | "expired";
|
|
216
|
-
type Member$1 = {
|
|
217
|
-
object: "member";
|
|
218
|
-
id: MemberId;
|
|
219
|
-
organizationId: OrganizationId;
|
|
220
|
-
authUserId: string;
|
|
221
|
-
email: string;
|
|
222
|
-
role: "owner" | "finance_manager" | "payments_operator" | "org_admin" | "viewer" | "accountant";
|
|
223
|
-
status: MembershipStatus$1;
|
|
224
|
-
invitedBy: string;
|
|
225
|
-
invitedAt: number;
|
|
226
|
-
expiresAt: number;
|
|
227
|
-
acceptedAt: number;
|
|
228
|
-
resentCount: number;
|
|
229
|
-
};
|
|
230
|
-
type Safe$1 = {
|
|
231
|
-
object: "safe";
|
|
232
|
-
id: SafeId;
|
|
233
|
-
owner: {
|
|
234
|
-
[key: string]: unknown;
|
|
235
|
-
};
|
|
236
|
-
status: "not_started" | "deploying" | "active" | "failed" | "action_required";
|
|
237
|
-
/**
|
|
238
|
-
* The on-chain Safe address (lowercased). Absent while
|
|
239
|
-
* `status` is `not_started` or `deploying`; present once
|
|
240
|
-
* `status` is `active`.
|
|
241
|
-
*
|
|
242
|
-
*/
|
|
243
|
-
address?: string;
|
|
244
|
-
/**
|
|
245
|
-
* The chain the Safe is deployed on. 84532 = Base Sepolia
|
|
246
|
-
* (v1 scope). Absent during pre-deploy statuses.
|
|
247
|
-
*
|
|
248
|
-
*/
|
|
249
|
-
chainId?: number;
|
|
250
|
-
/**
|
|
251
|
-
* In-flight operation (typically the deploy operation) during
|
|
252
|
-
* `deploying` status. Absent when the Safe has reached a
|
|
253
|
-
* terminal state.
|
|
254
|
-
*
|
|
255
|
-
*/
|
|
256
|
-
operation?: OperationSummary$1;
|
|
257
|
-
};
|
|
258
|
-
type Treasury$1 = {
|
|
259
|
-
object: "treasury";
|
|
260
|
-
id: TreasuryId;
|
|
261
|
-
organizationId: OrganizationId;
|
|
262
|
-
status: string;
|
|
263
|
-
};
|
|
264
|
-
type KycProfile$1 = {
|
|
265
|
-
object: "kyc_profile";
|
|
266
|
-
id: KycProfileId;
|
|
267
|
-
owner: {
|
|
268
|
-
[key: string]: unknown;
|
|
269
|
-
};
|
|
270
|
-
status: "not_started" | "pending" | "action_required" | "verified" | "rejected" | "expired";
|
|
271
|
-
nextAction?: NextAction;
|
|
272
|
-
};
|
|
273
|
-
type KybProfile$1 = {
|
|
274
|
-
object: "kyb_profile";
|
|
275
|
-
id: KybProfileId;
|
|
276
|
-
owner: {
|
|
277
|
-
type: "organization";
|
|
278
|
-
id: OrganizationId;
|
|
279
|
-
};
|
|
280
|
-
/**
|
|
281
|
-
* 6-value KYB state machine. Live-key gating fires on `approved`.
|
|
282
|
-
*/
|
|
283
|
-
status: "not_started" | "pending" | "action_required" | "approved" | "rejected" | "expired";
|
|
284
|
-
nextAction?: NextAction;
|
|
285
|
-
};
|
|
286
|
-
/**
|
|
287
|
-
* Withdrawal destination kind. `card_payout` covers
|
|
288
|
-
* Visa/Mastercard push-to-card rails.
|
|
289
|
-
*
|
|
290
|
-
*/
|
|
291
|
-
type ExternalAccountKind$1 = "bank" | "evm" | "solana" | "starknet" | "card_payout";
|
|
292
|
-
type ExternalAccount$1 = {
|
|
293
|
-
object: "external_account";
|
|
294
|
-
id: ExternalAccountId;
|
|
295
|
-
kind: ExternalAccountKind$1;
|
|
296
|
-
label?: string;
|
|
297
|
-
status: "pending_verification" | "active" | "revoked" | "failed";
|
|
298
|
-
address?: string;
|
|
299
|
-
iban?: string;
|
|
300
|
-
bic?: string;
|
|
301
|
-
accountHolder?: string;
|
|
302
|
-
network?: "visa" | "mastercard";
|
|
303
|
-
last4?: string;
|
|
304
|
-
createdAt?: TimestampIso$1;
|
|
305
|
-
/**
|
|
306
|
-
* Trust-chain operation summary from the most-recent
|
|
307
|
-
* observability-instrumented mutation that produced or
|
|
308
|
-
* modified this resource. Reflects the LATEST mutation,
|
|
309
|
-
* not the original create. See OperationSummary for
|
|
310
|
-
* shape (id, status, correlationId).
|
|
311
|
-
*
|
|
312
|
-
*/
|
|
313
|
-
operation: OperationSummary$1;
|
|
314
|
-
};
|
|
315
|
-
/**
|
|
316
|
-
* Sender or recipient on a Payment. Two-kind discriminator on
|
|
317
|
-
* resolution state: `capxul_user` (identifier resolved to an
|
|
318
|
-
* accountId) vs `pending_recipient` (identifier recognized but
|
|
319
|
-
* the user hasn't signed up yet — see `nextAction.kind =
|
|
320
|
-
* "fix_destination"`). Address fields mirror UserIdentifier.
|
|
321
|
-
*
|
|
322
|
-
*/
|
|
323
|
-
type PaymentParty$1 = {
|
|
324
|
-
kind: "capxul_user";
|
|
325
|
-
accountId: AccountId;
|
|
326
|
-
publicName?: string;
|
|
327
|
-
email?: Email;
|
|
328
|
-
phone?: PhoneNumber;
|
|
329
|
-
username?: Username;
|
|
330
|
-
} | {
|
|
331
|
-
kind: "pending_recipient";
|
|
332
|
-
email?: Email;
|
|
333
|
-
phone?: PhoneNumber;
|
|
334
|
-
username?: Username;
|
|
335
|
-
invitationSentAt?: TimestampIso$1;
|
|
336
|
-
invitationExpiresAt?: TimestampIso$1;
|
|
337
|
-
signupUrl?: string;
|
|
338
|
-
};
|
|
339
|
-
type Payment$1 = {
|
|
340
|
-
object: "payment";
|
|
341
|
-
id: PaymentId;
|
|
342
|
-
status: "processing" | "action_required" | "succeeded" | "failed" | "canceled";
|
|
343
|
-
amount?: Money$1;
|
|
344
|
-
reference?: string;
|
|
345
|
-
sender?: PaymentParty$1;
|
|
346
|
-
recipient?: PaymentParty$1;
|
|
347
|
-
operation: OperationSummary$1;
|
|
348
|
-
nextAction?: NextAction;
|
|
349
|
-
settlement?: Settlement$1;
|
|
350
|
-
/**
|
|
351
|
-
* Populated when `status` is `failed`. Absent on any non-failed
|
|
352
|
-
* status. Carries the machine-routable code + human message
|
|
353
|
-
* for UI display per sdk-surface.md §1a.
|
|
354
|
-
*
|
|
355
|
-
*/
|
|
356
|
-
error?: {
|
|
357
|
-
/**
|
|
358
|
-
* Value drawn from the `CapxulErrorCode` catalog — see
|
|
359
|
-
* `ErrorEnvelope.error.code` for the 34-value enum. The
|
|
360
|
-
* enum is deliberately inlined (not $ref'd) to avoid
|
|
361
|
-
* TS7056 in the generated schemas export; runtime values
|
|
362
|
-
* still match the canonical catalog one-for-one.
|
|
363
|
-
*
|
|
364
|
-
*/
|
|
365
|
-
code: string;
|
|
366
|
-
message: string;
|
|
367
|
-
};
|
|
368
|
-
createdAt?: TimestampIso$1;
|
|
369
|
-
};
|
|
370
|
-
type Withdrawal$1 = {
|
|
371
|
-
object: "withdrawal";
|
|
372
|
-
id: WithdrawalId;
|
|
373
|
-
status: "processing" | "action_required" | "succeeded" | "failed" | "canceled";
|
|
374
|
-
amount?: Money$1;
|
|
375
|
-
reference?: string;
|
|
376
|
-
source?: {
|
|
377
|
-
subAccountId?: SubAccountId;
|
|
378
|
-
};
|
|
379
|
-
destination?: {
|
|
380
|
-
externalAccountId?: ExternalAccountId;
|
|
381
|
-
};
|
|
382
|
-
operation: OperationSummary$1;
|
|
383
|
-
nextAction?: NextAction;
|
|
384
|
-
settlement?: Settlement$1;
|
|
385
|
-
/**
|
|
386
|
-
* Populated when `status` is `failed`. Absent on any non-failed
|
|
387
|
-
* status. Same shape as Payment.error per sdk-surface.md §1a.
|
|
388
|
-
*
|
|
389
|
-
*/
|
|
390
|
-
error?: {
|
|
391
|
-
/**
|
|
392
|
-
* Value drawn from the `CapxulErrorCode` catalog — see
|
|
393
|
-
* `ErrorEnvelope.error.code`. Inlined (not $ref'd) to
|
|
394
|
-
* avoid TS7056 in the generated schemas export.
|
|
395
|
-
*
|
|
396
|
-
*/
|
|
397
|
-
code: string;
|
|
398
|
-
message: string;
|
|
399
|
-
};
|
|
400
|
-
createdAt?: TimestampIso$1;
|
|
401
|
-
};
|
|
402
|
-
type Operation$1 = {
|
|
403
|
-
object: "operation";
|
|
404
|
-
id: OperationId;
|
|
405
|
-
correlationId: CorrelationId;
|
|
406
|
-
/**
|
|
407
|
-
* Public API remains open-ended for forward-compatible
|
|
408
|
-
* operation projection. Internal TypeScript emitters are
|
|
409
|
-
* compile-time checked against `OPERATION_KINDS` in
|
|
410
|
-
* `@repo/platform-kernel`; generated public clients keep this
|
|
411
|
-
* as `string` so new operation kinds can appear before a
|
|
412
|
-
* client regeneration.
|
|
413
|
-
*
|
|
414
|
-
*/
|
|
415
|
-
kind: string;
|
|
416
|
-
status: OperationStatus$1;
|
|
417
|
-
source: string;
|
|
418
|
-
actor: {
|
|
419
|
-
[key: string]: unknown;
|
|
420
|
-
};
|
|
421
|
-
subject?: {
|
|
422
|
-
[key: string]: unknown;
|
|
423
|
-
};
|
|
424
|
-
nextAction?: NextAction;
|
|
425
|
-
/**
|
|
426
|
-
* Present when the operation reached a terminal successful
|
|
427
|
-
* state (`succeeded` or `indexed`) AND produced a public
|
|
428
|
-
* resource. Absent for pre-terminal, failed, or canceled
|
|
429
|
-
* operations, or for operations that don't produce a resource
|
|
430
|
-
* (e.g. pure read operations). Locked by CANON.md §4.33.
|
|
431
|
-
*
|
|
432
|
-
*/
|
|
433
|
-
result?: {
|
|
434
|
-
/**
|
|
435
|
-
* Discriminator naming the kind of public resource
|
|
436
|
-
* produced by this operation. Union of the `object:
|
|
437
|
-
* const` values across every primitive declared in
|
|
438
|
-
* sdk-surface.md §1a. Inlined (not extracted as a
|
|
439
|
-
* reusable `PublicResource` schema) to avoid TS7056
|
|
440
|
-
* in the generated schemas export catalog.
|
|
441
|
-
*
|
|
442
|
-
*/
|
|
443
|
-
object: "account" | "organization" | "safe" | "treasury" | "kyc_profile" | "kyb_profile" | "external_account" | "payment" | "member" | "withdrawal" | "operation" | "webhook_endpoint" | "webhook_event" | "sub_account" | "virtual_account" | "virtual_card" | "transfer" | "document" | "balance_ledger_entry" | "api_key";
|
|
444
|
-
/**
|
|
445
|
-
* The public ID of the resource this operation produced.
|
|
446
|
-
* Prefix pattern matches `object` (e.g., `pay_01…` when
|
|
447
|
-
* `object = payment`, `txfr_…` when `object = transfer`).
|
|
448
|
-
*
|
|
449
|
-
*/
|
|
450
|
-
id: string;
|
|
451
|
-
};
|
|
452
|
-
/**
|
|
453
|
-
* Present when the operation reached a terminal failed state.
|
|
454
|
-
* Same shape as resource-level errors per sdk-surface.md §1a.
|
|
455
|
-
*
|
|
456
|
-
*/
|
|
457
|
-
error?: {
|
|
458
|
-
/**
|
|
459
|
-
* Value drawn from the `CapxulErrorCode` catalog — see
|
|
460
|
-
* `ErrorEnvelope.error.code`. Inlined (not $ref'd) to
|
|
461
|
-
* avoid TS7056 in the generated schemas export.
|
|
462
|
-
*
|
|
463
|
-
*/
|
|
464
|
-
code: string;
|
|
465
|
-
message: string;
|
|
466
|
-
};
|
|
467
|
-
createdAt: string;
|
|
468
|
-
updatedAt: string;
|
|
469
|
-
};
|
|
470
|
-
type BalanceLedgerEntry$1 = {
|
|
471
|
-
object: "balance_ledger_entry";
|
|
472
|
-
id: BalanceLedgerEntryId;
|
|
473
|
-
safeId: SafeId;
|
|
474
|
-
delta: Money$1;
|
|
475
|
-
runningBalance: Money$1;
|
|
476
|
-
originatedBy: {
|
|
477
|
-
type: "payment" | "withdrawal" | "transfer" | "document" | "external";
|
|
478
|
-
id?: string;
|
|
479
|
-
};
|
|
480
|
-
occurredAt: TimestampIso$1;
|
|
481
|
-
};
|
|
482
|
-
type CreateWebhookEndpointRequest = {
|
|
483
|
-
url: string;
|
|
484
|
-
eventTypes?: Array<string>;
|
|
485
|
-
};
|
|
486
|
-
type WebhookEndpoint$1 = {
|
|
487
|
-
object: "webhook_endpoint";
|
|
488
|
-
id: WebhookEndpointId;
|
|
489
|
-
url: string;
|
|
490
|
-
status: string;
|
|
491
|
-
};
|
|
492
|
-
type WebhookEvent$1 = {
|
|
493
|
-
object: "webhook_event";
|
|
494
|
-
id: WebhookEventId;
|
|
495
|
-
type: string;
|
|
496
|
-
createdAt: string;
|
|
497
|
-
operationId?: OperationId;
|
|
498
|
-
correlationId?: CorrelationId;
|
|
499
|
-
data: {
|
|
500
|
-
[key: string]: unknown;
|
|
501
|
-
};
|
|
502
|
-
};
|
|
503
|
-
/**
|
|
504
|
-
* Venmo-style minimal discoverability result.
|
|
505
|
-
* `exists` tells the caller whether the identifier resolves to a
|
|
506
|
-
* Capxul user. `accountId` + `publicName` present only when exists
|
|
507
|
-
* AND the user opted into discoverability for that identifier kind.
|
|
508
|
-
* `memberSince` is month-precision to resist timing enumeration.
|
|
509
|
-
*
|
|
510
|
-
*/
|
|
511
|
-
type AccountLookupResult$1 = {
|
|
512
|
-
email?: Email;
|
|
513
|
-
phone?: PhoneNumber;
|
|
514
|
-
username?: Username;
|
|
515
|
-
exists: boolean;
|
|
516
|
-
accountId?: AccountId;
|
|
517
|
-
publicName?: string;
|
|
518
|
-
/**
|
|
519
|
-
* Month-precision membership stamp, format YYYY-MM.
|
|
520
|
-
*/
|
|
521
|
-
memberSince?: string;
|
|
522
|
-
};
|
|
523
|
-
type SubAccountOwnerKind$1 = "account" | "organization";
|
|
524
|
-
/**
|
|
525
|
-
* Named partition under an account or organization. OFF-CHAIN
|
|
526
|
-
* accounting construct — no per-sub-account Safe deploy. Balance
|
|
527
|
-
* AGGREGATES across custody sources (parent Safe stablecoin pool,
|
|
528
|
-
* virtual-account fiat at providers, etc.).
|
|
529
|
-
*
|
|
530
|
-
*/
|
|
531
|
-
type SubAccount$1 = {
|
|
532
|
-
object: "sub_account";
|
|
533
|
-
id: SubAccountId;
|
|
534
|
-
parent: {
|
|
535
|
-
kind: SubAccountOwnerKind$1;
|
|
536
|
-
/**
|
|
537
|
-
* AccountId or OrganizationId matching `kind`.
|
|
538
|
-
*/
|
|
539
|
-
id: string;
|
|
540
|
-
};
|
|
541
|
-
name: string;
|
|
542
|
-
purpose?: string;
|
|
543
|
-
status: "active" | "archived";
|
|
544
|
-
balance: Money$1;
|
|
545
|
-
/**
|
|
546
|
-
* Per-custody-source balance breakdown. Present only when the
|
|
547
|
-
* caller opts in via `include: ["balancesByCustody"]`.
|
|
548
|
-
*
|
|
549
|
-
*/
|
|
550
|
-
balancesByCustody?: Array<{
|
|
551
|
-
source: "root" | "virtual_account";
|
|
552
|
-
amount: Money$1;
|
|
553
|
-
virtualAccountId?: VirtualAccountId;
|
|
554
|
-
}>;
|
|
555
|
-
createdAt: TimestampIso$1;
|
|
556
|
-
};
|
|
557
|
-
type VirtualAccountOwnerKind$1 = "account" | "sub_account" | "organization";
|
|
558
|
-
/**
|
|
559
|
-
* IBAN-bearing fiat receive rail. Funds physically held at an
|
|
560
|
-
* external provider (Bridge, Modern Treasury, etc.); provider is
|
|
561
|
-
* abstracted at the SDK level.
|
|
562
|
-
*
|
|
563
|
-
*/
|
|
564
|
-
type VirtualAccount$1 = {
|
|
565
|
-
object: "virtual_account";
|
|
566
|
-
id: VirtualAccountId;
|
|
567
|
-
owner: {
|
|
568
|
-
kind: VirtualAccountOwnerKind$1;
|
|
569
|
-
id: string;
|
|
570
|
-
};
|
|
571
|
-
/**
|
|
572
|
-
* International Bank Account Number (provider-issued).
|
|
573
|
-
*/
|
|
574
|
-
iban?: string;
|
|
575
|
-
bic?: string;
|
|
576
|
-
bankName?: string;
|
|
577
|
-
/**
|
|
578
|
-
* ISO 4217 three-letter currency code.
|
|
579
|
-
*/
|
|
580
|
-
currency: string;
|
|
581
|
-
status: "provisioning" | "active" | "frozen" | "closed";
|
|
582
|
-
balance: Money$1;
|
|
583
|
-
/**
|
|
584
|
-
* Opaque provider identifier (e.g. `bridge`, `modern_treasury`).
|
|
585
|
-
*/
|
|
586
|
-
provider: string;
|
|
587
|
-
createdAt: TimestampIso$1;
|
|
588
|
-
};
|
|
589
|
-
type CreateVirtualAccountRequest = {
|
|
590
|
-
ownerKind: VirtualAccountOwnerKind$1;
|
|
591
|
-
/**
|
|
592
|
-
* AccountId, SubAccountId, or OrganizationId matching `ownerKind`.
|
|
593
|
-
*/
|
|
594
|
-
ownerId: string;
|
|
595
|
-
/**
|
|
596
|
-
* ISO 4217 three-letter currency code.
|
|
597
|
-
*/
|
|
598
|
-
currency: string;
|
|
599
|
-
};
|
|
600
|
-
type VirtualCardOwnerKind$1 = "account" | "sub_account" | "organization";
|
|
601
|
-
type VirtualCardLimits$1 = {
|
|
602
|
-
dailyLimit?: Money$1;
|
|
603
|
-
monthlyLimit?: Money$1;
|
|
604
|
-
};
|
|
605
|
-
/**
|
|
606
|
-
* Issued card spending the owning sub-account's balance. Active /
|
|
607
|
-
* frozen / canceled lifecycle.
|
|
608
|
-
*
|
|
609
|
-
*/
|
|
610
|
-
type VirtualCard$1 = {
|
|
611
|
-
object: "virtual_card";
|
|
612
|
-
id: VirtualCardId;
|
|
613
|
-
owner: {
|
|
614
|
-
kind: VirtualCardOwnerKind$1;
|
|
615
|
-
id: string;
|
|
616
|
-
};
|
|
617
|
-
network: "visa" | "mastercard";
|
|
618
|
-
last4: string;
|
|
619
|
-
currency: string;
|
|
620
|
-
limits?: VirtualCardLimits$1;
|
|
621
|
-
status: "active" | "frozen" | "canceled";
|
|
622
|
-
createdAt: TimestampIso$1;
|
|
623
|
-
};
|
|
624
|
-
type CreateVirtualCardRequest = {
|
|
625
|
-
ownerKind: VirtualCardOwnerKind$1;
|
|
626
|
-
ownerId: string;
|
|
627
|
-
network?: "visa" | "mastercard";
|
|
628
|
-
currency?: string;
|
|
629
|
-
limits?: VirtualCardLimits$1;
|
|
630
|
-
};
|
|
631
|
-
/**
|
|
632
|
-
* Forward-only pagination. `cursor` absent when
|
|
633
|
-
* `hasMore: false`.
|
|
634
|
-
*
|
|
635
|
-
*/
|
|
636
|
-
type PageInfo$1 = {
|
|
637
|
-
hasMore: boolean;
|
|
638
|
-
cursor?: string;
|
|
639
|
-
};
|
|
640
|
-
/**
|
|
641
|
-
* Custody-source kind for transfer source/destination. `root` is
|
|
642
|
-
* the parent account/org's main Safe stablecoin pool and takes no
|
|
643
|
-
* `id`.
|
|
644
|
-
*
|
|
645
|
-
*/
|
|
646
|
-
type TransferCustody$1 = "root" | "sub_account" | "virtual_account";
|
|
647
|
-
type TransferEndpoint$1 = {
|
|
648
|
-
custody: TransferCustody$1;
|
|
649
|
-
/**
|
|
650
|
-
* SubAccountId or VirtualAccountId when `custody` is not `root`.
|
|
651
|
-
*/
|
|
652
|
-
id?: string;
|
|
653
|
-
};
|
|
654
|
-
type TransferOwner = {
|
|
655
|
-
kind: "account" | "organization";
|
|
656
|
-
id: string;
|
|
657
|
-
};
|
|
658
|
-
/**
|
|
659
|
-
* Foreign-exchange block. Present when `source` and `destination`
|
|
660
|
-
* currencies differ. Quote must be confirmed via POST
|
|
661
|
-
* /v1/transfers/{id}/confirm before processing begins (unless
|
|
662
|
-
* `autoConfirm` with `maxSlippageBps` is supplied at create time).
|
|
663
|
-
*
|
|
664
|
-
*/
|
|
665
|
-
type TransferFx$1 = {
|
|
666
|
-
/**
|
|
667
|
-
* Decimal string (no floats).
|
|
668
|
-
*/
|
|
669
|
-
rate: string;
|
|
670
|
-
quoteId: string;
|
|
671
|
-
expiresAt: TimestampIso$1;
|
|
672
|
-
fees?: Money$1;
|
|
673
|
-
};
|
|
674
|
-
/**
|
|
675
|
-
* Cross-custody internal move within a single owner (not a payment
|
|
676
|
-
* to another party; not a withdrawal out of Capxul). Status
|
|
677
|
-
* lifecycle: processing → succeeded | failed | canceled for
|
|
678
|
-
* same-currency; cross-currency inserts `action_required:
|
|
679
|
-
* confirm_fx_quote` before processing.
|
|
680
|
-
*
|
|
681
|
-
*/
|
|
682
|
-
type Transfer$1 = {
|
|
683
|
-
object: "transfer";
|
|
684
|
-
id: TransferId;
|
|
685
|
-
owner: TransferOwner;
|
|
686
|
-
source: TransferEndpoint$1;
|
|
687
|
-
destination: TransferEndpoint$1;
|
|
688
|
-
amount: Money$1;
|
|
689
|
-
debitAmount?: Money$1;
|
|
690
|
-
creditAmount?: Money$1;
|
|
691
|
-
fx?: TransferFx$1;
|
|
692
|
-
reference?: string;
|
|
693
|
-
status: "processing" | "action_required" | "succeeded" | "failed" | "canceled";
|
|
694
|
-
nextAction?: NextAction;
|
|
695
|
-
operation: OperationSummary$1;
|
|
696
|
-
settlement?: Settlement$1;
|
|
697
|
-
/**
|
|
698
|
-
* Populated when `status` is `failed`. Absent on any non-failed
|
|
699
|
-
* status. Same shape as Payment.error per sdk-surface.md §1a.
|
|
700
|
-
*
|
|
701
|
-
*/
|
|
702
|
-
error?: {
|
|
703
|
-
/**
|
|
704
|
-
* Value drawn from the `CapxulErrorCode` catalog — see
|
|
705
|
-
* `ErrorEnvelope.error.code`. Inlined (not $ref'd) to
|
|
706
|
-
* avoid TS7056 in the generated schemas export.
|
|
707
|
-
*
|
|
708
|
-
*/
|
|
709
|
-
code: string;
|
|
710
|
-
message: string;
|
|
711
|
-
};
|
|
712
|
-
createdAt: TimestampIso$1;
|
|
713
|
-
};
|
|
714
|
-
type DocumentOwner = {
|
|
715
|
-
kind: "account" | "organization";
|
|
716
|
-
id: string;
|
|
717
|
-
};
|
|
718
|
-
/**
|
|
719
|
-
* `type = invoice` — a request for payment addressed to a recipient.
|
|
720
|
-
* Subsumes the former top-level `invoice` primitive.
|
|
721
|
-
* Lifecycle: draft → open → paid → canceled | expired. The
|
|
722
|
-
* `fulfilledBy` link dereferences to the settling Payment when
|
|
723
|
-
* `status = paid` and the caller expands `include: ["fulfilledBy"]`.
|
|
724
|
-
*
|
|
725
|
-
*/
|
|
726
|
-
type InvoiceDocument$1 = {
|
|
727
|
-
object: "document";
|
|
728
|
-
id: DocumentId;
|
|
729
|
-
type: "invoice";
|
|
730
|
-
owner: DocumentOwner;
|
|
731
|
-
recipient: UserIdentifier$1;
|
|
732
|
-
amount: Money$1;
|
|
733
|
-
reference?: string;
|
|
734
|
-
lineItems: Array<InvoiceLineItem>;
|
|
735
|
-
/**
|
|
736
|
-
* Canonical private invoice payload hash committed on-chain as documentHash.
|
|
737
|
-
*/
|
|
738
|
-
invoiceHash: string;
|
|
739
|
-
dueAt?: TimestampIso$1;
|
|
740
|
-
status: "draft" | "open" | "paid" | "canceled" | "expired";
|
|
741
|
-
fulfilledBy?: PaymentId;
|
|
742
|
-
createdAt: TimestampIso$1;
|
|
743
|
-
};
|
|
744
|
-
type InvoiceLineItem = {
|
|
745
|
-
description: string;
|
|
746
|
-
quantity: number;
|
|
747
|
-
unitPrice: string;
|
|
748
|
-
currency: string;
|
|
749
|
-
taxRate?: string;
|
|
750
|
-
category?: string;
|
|
751
|
-
};
|
|
752
|
-
/**
|
|
753
|
-
* `type = payroll_run` — per-execution payroll artifact. Shape
|
|
754
|
-
* detail deferred (payroll schedule vs run
|
|
755
|
-
* field set lands in a follow-up design session). Current schema
|
|
756
|
-
* is the minimum required for the discriminator + ownership.
|
|
757
|
-
*
|
|
758
|
-
*/
|
|
759
|
-
type PayrollRunDocument$1 = {
|
|
760
|
-
object: "document";
|
|
761
|
-
id: DocumentId;
|
|
762
|
-
type: "payroll_run";
|
|
763
|
-
owner: DocumentOwner;
|
|
764
|
-
scheduleId?: DocumentId;
|
|
765
|
-
totalAmount?: Money$1;
|
|
766
|
-
status?: "draft" | "processing" | "completed" | "failed" | "canceled";
|
|
767
|
-
paymentIds?: Array<PaymentId>;
|
|
768
|
-
createdAt: TimestampIso$1;
|
|
769
|
-
};
|
|
770
|
-
/**
|
|
771
|
-
* `type = payroll_schedule` — recurring payroll metadata. Shape
|
|
772
|
-
* detail deferred
|
|
773
|
-
*
|
|
774
|
-
*/
|
|
775
|
-
type PayrollScheduleDocument$1 = {
|
|
776
|
-
object: "document";
|
|
777
|
-
id: DocumentId;
|
|
778
|
-
type: "payroll_schedule";
|
|
779
|
-
owner: DocumentOwner;
|
|
780
|
-
cadence?: "weekly" | "biweekly" | "semimonthly" | "monthly";
|
|
781
|
-
nextRunAt?: TimestampIso$1;
|
|
782
|
-
status?: "active" | "paused" | "canceled";
|
|
783
|
-
createdAt: TimestampIso$1;
|
|
784
|
-
};
|
|
785
|
-
/**
|
|
786
|
-
* `type = receipt` — customer-facing confirmation of a settled
|
|
787
|
-
* payment.
|
|
788
|
-
*
|
|
789
|
-
*/
|
|
790
|
-
type ReceiptDocument$1 = {
|
|
791
|
-
object: "document";
|
|
792
|
-
id: DocumentId;
|
|
793
|
-
type: "receipt";
|
|
794
|
-
owner: DocumentOwner;
|
|
795
|
-
for: PaymentId;
|
|
796
|
-
amount: Money$1;
|
|
797
|
-
issuedAt?: TimestampIso$1;
|
|
798
|
-
createdAt: TimestampIso$1;
|
|
799
|
-
};
|
|
800
|
-
/**
|
|
801
|
-
* `type = kyc_upload` — an uploaded KYC artifact (passport scan,
|
|
802
|
-
* utility bill, etc.) attached to a KYC profile.
|
|
803
|
-
*
|
|
804
|
-
*/
|
|
805
|
-
type KycUploadDocument$1 = {
|
|
806
|
-
object: "document";
|
|
807
|
-
id: DocumentId;
|
|
808
|
-
type: "kyc_upload";
|
|
809
|
-
owner: DocumentOwner;
|
|
810
|
-
kycProfileId?: KycProfileId;
|
|
811
|
-
storageId: string;
|
|
812
|
-
kind: "passport" | "driver_license" | "national_id" | "utility_bill" | "selfie" | "other";
|
|
813
|
-
status?: "uploaded" | "reviewing" | "approved" | "rejected";
|
|
814
|
-
createdAt: TimestampIso$1;
|
|
815
|
-
};
|
|
816
|
-
/**
|
|
817
|
-
* `type = bank_statement` — uploaded periodic bank statement.
|
|
818
|
-
*/
|
|
819
|
-
type BankStatementDocument$1 = {
|
|
820
|
-
object: "document";
|
|
821
|
-
id: DocumentId;
|
|
822
|
-
type: "bank_statement";
|
|
823
|
-
owner: DocumentOwner;
|
|
824
|
-
storageId: string;
|
|
825
|
-
periodStart?: TimestampIso$1;
|
|
826
|
-
periodEnd?: TimestampIso$1;
|
|
827
|
-
createdAt: TimestampIso$1;
|
|
828
|
-
};
|
|
829
|
-
/**
|
|
830
|
-
* `type = tax_form` — uploaded tax form (W2 / W9 / 1099 / etc.).
|
|
831
|
-
*/
|
|
832
|
-
type TaxFormDocument$1 = {
|
|
833
|
-
object: "document";
|
|
834
|
-
id: DocumentId;
|
|
835
|
-
type: "tax_form";
|
|
836
|
-
owner: DocumentOwner;
|
|
837
|
-
storageId: string;
|
|
838
|
-
kind: "w2" | "w9" | "1099-nec" | "1099-misc" | "other";
|
|
839
|
-
year: number;
|
|
840
|
-
createdAt: TimestampIso$1;
|
|
841
|
-
};
|
|
842
|
-
/**
|
|
843
|
-
* Unified artifact primitive with `type` discriminator. Subsumes
|
|
844
|
-
* the former top-level `invoice` and `org_payroll_entry` primitives
|
|
845
|
-
* dropped from the v1 catalog. Extending this union with new
|
|
846
|
-
* `type` values is additive.
|
|
847
|
-
*
|
|
848
|
-
*/
|
|
849
|
-
type Document$1 = InvoiceDocument$1 | PayrollRunDocument$1 | PayrollScheduleDocument$1 | ReceiptDocument$1 | KycUploadDocument$1 | BankStatementDocument$1 | TaxFormDocument$1;
|
|
850
|
-
/**
|
|
851
|
-
* Discriminated on `type`. Per-type fields are validated at runtime
|
|
852
|
-
* by Zod — unknown fields for a given type return INVALID_INPUT.
|
|
853
|
-
*
|
|
854
|
-
*/
|
|
855
|
-
type CreateDocumentRequest = {
|
|
856
|
-
type: "invoice";
|
|
857
|
-
recipient: UserIdentifier$1;
|
|
858
|
-
amount: Money$1;
|
|
859
|
-
reference?: string;
|
|
860
|
-
lineItems: Array<InvoiceLineItem>;
|
|
861
|
-
dueAt?: TimestampIso$1;
|
|
862
|
-
include?: Array<string>;
|
|
863
|
-
} | {
|
|
864
|
-
type: "payroll_schedule";
|
|
865
|
-
cadence?: "weekly" | "biweekly" | "semimonthly" | "monthly";
|
|
866
|
-
nextRunAt?: TimestampIso$1;
|
|
867
|
-
include?: Array<string>;
|
|
868
|
-
} | {
|
|
869
|
-
type: "receipt";
|
|
870
|
-
for: PaymentId;
|
|
871
|
-
include?: Array<string>;
|
|
872
|
-
} | {
|
|
873
|
-
type: "kyc_upload";
|
|
874
|
-
storageId: string;
|
|
875
|
-
kind: "passport" | "driver_license" | "national_id" | "utility_bill" | "selfie" | "other";
|
|
876
|
-
kycProfileId?: KycProfileId;
|
|
877
|
-
include?: Array<string>;
|
|
878
|
-
} | {
|
|
879
|
-
type: "bank_statement";
|
|
880
|
-
storageId: string;
|
|
881
|
-
periodStart?: TimestampIso$1;
|
|
882
|
-
periodEnd?: TimestampIso$1;
|
|
883
|
-
include?: Array<string>;
|
|
884
|
-
} | {
|
|
885
|
-
type: "tax_form";
|
|
886
|
-
storageId: string;
|
|
887
|
-
kind: "w2" | "w9" | "1099-nec" | "1099-misc" | "other";
|
|
888
|
-
year: number;
|
|
889
|
-
include?: Array<string>;
|
|
890
|
-
};
|
|
891
|
-
/**
|
|
892
|
-
* API-key scope vocabulary. `resource:read` +
|
|
893
|
-
* `resource:write` per public primitive, plus three special verbs
|
|
894
|
-
* where they meaningfully differ (`payments:refund`,
|
|
895
|
-
* `accounts:lookup`). 35-scope catalog total. Unknown scopes
|
|
896
|
-
* return INVALID_INPUT with details.field = "scopes" at mint time.
|
|
897
|
-
*
|
|
898
|
-
*/
|
|
899
|
-
type Scope$1 = "accounts:read" | "accounts:write" | "accounts:lookup" | "organizations:read" | "organizations:write" | "members:read" | "members:write" | "payments:read" | "payments:write" | "payments:refund" | "transfers:read" | "transfers:write" | "withdrawals:read" | "withdrawals:write" | "external_accounts:read" | "external_accounts:write" | "sub_accounts:read" | "sub_accounts:write" | "virtual_accounts:read" | "virtual_accounts:write" | "virtual_cards:read" | "virtual_cards:write" | "documents:read" | "documents:write" | "kyc_profiles:read" | "kyc_profiles:write" | "kyb_profiles:read" | "kyb_profiles:write" | "api_keys:read" | "api_keys:write" | "webhook_endpoints:read" | "webhook_endpoints:write" | "webhook_events:read" | "operations:read" | "balance_ledger:read" | "treasury:read";
|
|
900
|
-
type ApiKeyEnvironment$1 = "test" | "live";
|
|
901
|
-
type ApiKeyType$1 = "secret" | "publishable";
|
|
902
|
-
/**
|
|
903
|
-
* Mint a new api-key for the organization. `environment` + `type`
|
|
904
|
-
* select the prefix family (cap_test_, cap_live_, cap_pk_test_,
|
|
905
|
-
* cap_pk_live_ ,). `scopes` array is
|
|
906
|
-
* validated against the canonical catalog — unknown values
|
|
907
|
-
* return INVALID_INPUT.
|
|
908
|
-
*
|
|
909
|
-
*/
|
|
910
|
-
type CreateApiKeyRequest = {
|
|
911
|
-
label?: string;
|
|
912
|
-
environment: ApiKeyEnvironment$1;
|
|
913
|
-
type: ApiKeyType$1;
|
|
914
|
-
scopes: Array<Scope$1>;
|
|
915
|
-
};
|
|
916
|
-
/**
|
|
917
|
-
* Minted api-key resource. The plaintext `secret` is RETURNED
|
|
918
|
-
* ONCE in the create response; subsequent reads omit it and
|
|
919
|
-
* expose only `prefix` + `tail` (last 4 chars) for display.
|
|
920
|
-
*
|
|
921
|
-
*/
|
|
922
|
-
type ApiKey$1 = {
|
|
923
|
-
object: "api_key";
|
|
924
|
-
id: ApiKeyId;
|
|
925
|
-
label?: string;
|
|
926
|
-
environment: ApiKeyEnvironment$1;
|
|
927
|
-
type: ApiKeyType$1;
|
|
928
|
-
/**
|
|
929
|
-
* Public prefix (e.g. `cap_live_`, `cap_pk_test_`).
|
|
930
|
-
*/
|
|
931
|
-
prefix?: string;
|
|
932
|
-
/**
|
|
933
|
-
* Last 4 chars of the secret for display.
|
|
934
|
-
*/
|
|
935
|
-
tail?: string;
|
|
936
|
-
scopes: Array<Scope$1>;
|
|
937
|
-
status: "active" | "revoked";
|
|
938
|
-
/**
|
|
939
|
-
* Plaintext secret. Returned ONCE on the create response;
|
|
940
|
-
* subsequent retrievals omit this field.
|
|
941
|
-
*
|
|
942
|
-
*/
|
|
943
|
-
secret?: string;
|
|
944
|
-
createdAt: TimestampIso$1;
|
|
945
|
-
revokedAt?: TimestampIso$1;
|
|
946
|
-
};
|
|
947
|
-
|
|
948
|
-
/**
|
|
949
|
-
* SDK surface types.
|
|
950
|
-
*
|
|
951
|
-
* Derivation policy (post-codegen-relitigation, 2026-04-20):
|
|
952
|
-
* - Import wire types directly from `@repo/api-contract/gen/types` — the
|
|
953
|
-
* new generator (@hey-api/openapi-ts) emits faithful discriminated
|
|
954
|
-
* unions from OpenAPI `const:` and narrow string-literal enums, so
|
|
955
|
-
* the old `z.infer<typeof schemas.X>` round-trip through Zod (which
|
|
956
|
-
* stripped discriminants via `passthrough()`) is gone.
|
|
957
|
-
* - Rebrand the top-level `id` field on every resource to the kernel's
|
|
958
|
-
* branded ID type per `.claude/rules/typescript-style.md`.
|
|
959
|
-
* - Keep `WithStatus<>` so per-method narrowings are discriminated unions
|
|
960
|
-
* (one variant per status literal), which `Extract<T, { status: K }>`
|
|
961
|
-
* can narrow inside `matchStatus`.
|
|
962
|
-
* - Use `Override<>` ONLY where the OpenAPI source emits `additionalProperties`
|
|
963
|
-
* open shapes (`Safe.owner`, `Operation.actor`, `Operation.subject`) that
|
|
964
|
-
* need the SDK's canonical tagged-ref shape. Every other former
|
|
965
|
-
* `Override<>` site was redundant and has been deleted.
|
|
966
|
-
*/
|
|
967
|
-
|
|
968
|
-
type Rebrand<Wire, Id extends PublicId> = Wire & {
|
|
969
|
-
readonly id: Id;
|
|
970
|
-
};
|
|
971
|
-
/**
|
|
972
|
-
* Override-via-intersection helper. Kept for the few wire fields that
|
|
973
|
-
* OpenAPI emits as open-shape (`additionalProperties` → `{ [key:
|
|
974
|
-
* string]: unknown }`) where the SDK surface needs the canonical
|
|
975
|
-
* tagged-ref shape. `Safe.owner`, `Operation.actor`, `Operation.subject`
|
|
976
|
-
* are the current consumers.
|
|
977
|
-
*/
|
|
978
|
-
type Override<Wire, Fields> = Wire & Fields;
|
|
979
|
-
/**
|
|
980
|
-
* Distributes over the literal union `S` so the result is a discrim-
|
|
981
|
-
* inated union (one member per status value). `Extract<T, { status:
|
|
982
|
-
* "x" }>` narrows correctly against the output — without the
|
|
983
|
-
* distribution, a plain object with a union-typed `status` field is
|
|
984
|
-
* not a discriminated union and Extract returns `never`.
|
|
985
|
-
*
|
|
986
|
-
* When `S === "action_required"` the variant additionally requires
|
|
987
|
-
* `nextAction: NextAction` (not optional) per Rule D (CANON.md §4.40 +
|
|
988
|
-
* sdk-surface.md §3a): `action_required` is inline on mutation /
|
|
989
|
-
* snapshot responses and callers can safely route via `matchAction`.
|
|
990
|
-
*/
|
|
991
|
-
type WithStatus<T, S extends string> = S extends unknown ? T & {
|
|
992
|
-
readonly status: S;
|
|
993
|
-
} & (S extends "action_required" ? {
|
|
994
|
-
readonly nextAction: NextAction$1;
|
|
995
|
-
} : unknown) : never;
|
|
996
|
-
type Money = Money$1;
|
|
997
|
-
type Settlement = Settlement$1;
|
|
998
|
-
type TimestampIso = TimestampIso$1;
|
|
999
|
-
type UserIdentifier = UserIdentifier$1;
|
|
1000
|
-
/**
|
|
1001
|
-
* Tagged reference to the public resource a succeeded operation
|
|
1002
|
-
* produced (per sdk-surface.md §1b `operation`).
|
|
1003
|
-
*/
|
|
1004
|
-
type OperationResult = {
|
|
1005
|
-
readonly object: "account" | "organization" | "safe" | "treasury" | "kyc_profile" | "kyb_profile" | "external_account" | "payment" | "member" | "withdrawal" | "operation" | "webhook_endpoint" | "webhook_event" | "sub_account" | "virtual_account" | "virtual_card" | "transfer" | "document" | "balance_ledger_entry" | "api_key";
|
|
1006
|
-
readonly id: string;
|
|
1007
|
-
};
|
|
1008
|
-
/**
|
|
1009
|
-
* Terminal-state error sidecar on resources that can fail (Operation,
|
|
1010
|
-
* Payment, Withdrawal, Transfer).
|
|
1011
|
-
*/
|
|
1012
|
-
type ResourceError = {
|
|
1013
|
-
readonly code: string;
|
|
1014
|
-
readonly message: string;
|
|
1015
|
-
};
|
|
1016
|
-
|
|
1017
|
-
type OperationStatus = OperationStatus$1;
|
|
1018
|
-
type OperationSummary = Rebrand<OperationSummary$1, OperationId$1> & {
|
|
1019
|
-
readonly correlationId: CorrelationId$1;
|
|
1020
|
-
};
|
|
1021
|
-
/**
|
|
1022
|
-
* Full operation envelope.
|
|
1023
|
-
*
|
|
1024
|
-
* `actor` and `subject` are hand-overridden because OpenAPI emits
|
|
1025
|
-
* them as `additionalProperties` open-shape; SDK surface carries the
|
|
1026
|
-
* canonical tagged-ref shape.
|
|
1027
|
-
*
|
|
1028
|
-
* `nextAction` is re-asserted against the kernel's `NextAction` union
|
|
1029
|
-
* (9 kinds including `confirm_fx_quote` per §4.58) so callers get the
|
|
1030
|
-
* kernel-branded field types (e.g. `Email`, `PhoneNumber`, `Username`
|
|
1031
|
-
* on `fix_destination.recipient`). The wire carries the same 9 kinds
|
|
1032
|
-
* structurally; the kernel re-assertion preserves the SDK surface's
|
|
1033
|
-
* exhaustiveness contract against drift.
|
|
1034
|
-
*
|
|
1035
|
-
* `result` and `error` come through the generator faithfully, but
|
|
1036
|
-
* we re-type them to narrow the tagged-ref `object` field to the
|
|
1037
|
-
* closed `OperationResult["object"]` catalog.
|
|
1038
|
-
*/
|
|
1039
|
-
type Operation = Override<Rebrand<Operation$1, OperationId$1>, {
|
|
1040
|
-
readonly correlationId: CorrelationId$1;
|
|
1041
|
-
readonly actor: {
|
|
1042
|
-
readonly type: string;
|
|
1043
|
-
readonly id: string;
|
|
1044
|
-
};
|
|
1045
|
-
readonly subject?: {
|
|
1046
|
-
readonly type: string;
|
|
1047
|
-
readonly id: string;
|
|
1048
|
-
};
|
|
1049
|
-
readonly nextAction?: NextAction$1;
|
|
1050
|
-
readonly result?: OperationResult | null;
|
|
1051
|
-
readonly error?: ResourceError | null;
|
|
1052
|
-
}>;
|
|
1053
|
-
type Account = Omit<Rebrand<Account$1, AccountId$1>, "kycTier" | "primarySafeId"> & {
|
|
1054
|
-
readonly kycTier?: Account$1["kycTier"] | null;
|
|
1055
|
-
readonly primarySafeId?: SafeId$1 | null;
|
|
1056
|
-
};
|
|
1057
|
-
type AccountLookupResult = AccountLookupResult$1;
|
|
1058
|
-
/**
|
|
1059
|
-
* `owner` is hand-overridden: the OpenAPI source emits it as an
|
|
1060
|
-
* `additionalProperties` open object; SDK surface carries the canonical
|
|
1061
|
-
* tagged-ref shape.
|
|
1062
|
-
*/
|
|
1063
|
-
type Safe = Override<Rebrand<Safe$1, SafeId$1>, {
|
|
1064
|
-
readonly owner: {
|
|
1065
|
-
readonly type: "account";
|
|
1066
|
-
readonly id: AccountId$1;
|
|
1067
|
-
} | {
|
|
1068
|
-
readonly type: "organization";
|
|
1069
|
-
readonly id: OrganizationId$1;
|
|
1070
|
-
};
|
|
1071
|
-
}>;
|
|
1072
|
-
type Organization = Rebrand<Organization$1, OrganizationId$1>;
|
|
1073
|
-
type Treasury = Rebrand<Treasury$1, TreasuryId$1> & {
|
|
1074
|
-
readonly organizationId: OrganizationId$1;
|
|
1075
|
-
readonly safeId: SafeId$1;
|
|
1076
|
-
readonly totalBalance: Money;
|
|
1077
|
-
readonly positions: Array<{
|
|
1078
|
-
readonly symbol: string;
|
|
1079
|
-
readonly contractAddress: string;
|
|
1080
|
-
readonly amount: string;
|
|
1081
|
-
}>;
|
|
1082
|
-
readonly asOf: TimestampIso;
|
|
1083
|
-
};
|
|
1084
|
-
type KycStatus = KycProfile$1["status"];
|
|
1085
|
-
type KybStatus = KybProfile$1["status"];
|
|
1086
|
-
/**
|
|
1087
|
-
* Shared base type for identity profiles (KYC + KYB).
|
|
1088
|
-
*
|
|
1089
|
-
* Parameterized by status so per-resource discriminated unions
|
|
1090
|
-
* narrow correctly via `matchStatus`.
|
|
1091
|
-
*/
|
|
1092
|
-
type IdentityProfileBase<TStatus extends string> = {
|
|
1093
|
-
readonly object: string;
|
|
1094
|
-
readonly id: string;
|
|
1095
|
-
readonly owner: {
|
|
1096
|
-
readonly type: string;
|
|
1097
|
-
readonly id: string;
|
|
1098
|
-
};
|
|
1099
|
-
readonly status: TStatus;
|
|
1100
|
-
readonly nextAction?: NextAction$1;
|
|
1101
|
-
};
|
|
1102
|
-
type KycProfile = IdentityProfileBase<KycStatus> & {
|
|
1103
|
-
readonly object: "kyc_profile";
|
|
1104
|
-
readonly id: KycProfileId$1;
|
|
1105
|
-
readonly owner: {
|
|
1106
|
-
readonly type: "account";
|
|
1107
|
-
readonly id: AccountId$1;
|
|
1108
|
-
};
|
|
1109
|
-
};
|
|
1110
|
-
type KybProfile = IdentityProfileBase<KybStatus> & {
|
|
1111
|
-
readonly object: "kyb_profile";
|
|
1112
|
-
readonly id: KybProfileId$1;
|
|
1113
|
-
readonly owner: {
|
|
1114
|
-
readonly type: "organization";
|
|
1115
|
-
readonly id: OrganizationId$1;
|
|
1116
|
-
};
|
|
1117
|
-
};
|
|
1118
|
-
/**
|
|
1119
|
-
* Trust-chain operation summary is sourced from the wire's nested
|
|
1120
|
-
* `operation: OperationSummary` field (see resources.mdx §canonical
|
|
1121
|
-
* operation envelope). The wire surfaces `correlationId` as a plain
|
|
1122
|
-
* string; we override the nested field with the kernel-branded SDK
|
|
1123
|
-
* `OperationSummary` so callers get `CorrelationId` / `OperationId`
|
|
1124
|
-
* brands. Required at the resource boundary (matches Withdrawal /
|
|
1125
|
-
* Payment / Transfer / Organization).
|
|
1126
|
-
*/
|
|
1127
|
-
type ExternalAccount = Override<Rebrand<ExternalAccount$1, ExternalAccountId$1>, {
|
|
1128
|
-
readonly operation: OperationSummary;
|
|
1129
|
-
}>;
|
|
1130
|
-
type ExternalAccountKind = ExternalAccountKind$1;
|
|
1131
|
-
type PageInfo = PageInfo$1;
|
|
1132
|
-
type List<T> = {
|
|
1133
|
-
readonly object: "list";
|
|
1134
|
-
readonly data: readonly T[];
|
|
1135
|
-
readonly page: PageInfo;
|
|
1136
|
-
};
|
|
1137
|
-
type WirePaymentWithBrand = Rebrand<Payment$1, PaymentId$1>;
|
|
1138
|
-
type PaymentStatus = "processing" | "action_required" | "succeeded" | "failed" | "canceled";
|
|
1139
|
-
/**
|
|
1140
|
-
* Full `Payment` — discriminated union on status so `matchStatus`
|
|
1141
|
-
* narrows correctly.
|
|
1142
|
-
*/
|
|
1143
|
-
type Payment = WithStatus<WirePaymentWithBrand, PaymentStatus>;
|
|
1144
|
-
/**
|
|
1145
|
-
* Per-method narrowing for `payments.create`. Terminal states
|
|
1146
|
-
* (`succeeded`, `canceled`) arrive out-of-band per Rule D (CANON.md
|
|
1147
|
-
* §4.40 + sdk-surface.md §3a), so the synchronous return carries
|
|
1148
|
-
* only `processing | action_required | failed`.
|
|
1149
|
-
*/
|
|
1150
|
-
type CreatePaymentResult = WithStatus<WirePaymentWithBrand, "processing" | "action_required" | "failed">;
|
|
1151
|
-
type PaymentParty = PaymentParty$1;
|
|
1152
|
-
type WireWithdrawalWithBrand = Rebrand<Withdrawal$1, WithdrawalId$1>;
|
|
1153
|
-
/**
|
|
1154
|
-
* Canon-aligned superset (resources.mdx §withdrawal lifecycle note).
|
|
1155
|
-
* Wider than `OperationStatus` because `submitted → completed` is a
|
|
1156
|
-
* withdrawal-specific transition driven by external reconciliation
|
|
1157
|
-
* the operation envelope cannot witness directly. Slice 1 of
|
|
1158
|
-
* Withdrawals v1 (#440) widened this from `PaymentStatus` to match
|
|
1159
|
-
* canon.
|
|
1160
|
-
*/
|
|
1161
|
-
type WithdrawalStatus = "draft" | "action_required" | "processing" | "submitted" | "completed" | "failed" | "canceled";
|
|
1162
|
-
type Withdrawal = WithStatus<WireWithdrawalWithBrand, WithdrawalStatus>;
|
|
1163
|
-
type CreateWithdrawalResult = WithStatus<WireWithdrawalWithBrand, "processing" | "action_required" | "failed">;
|
|
1164
|
-
type WireTransferWithBrand = Rebrand<Transfer$1, TransferId$1>;
|
|
1165
|
-
type TransferStatus = PaymentStatus;
|
|
1166
|
-
type Transfer = WithStatus<WireTransferWithBrand, TransferStatus>;
|
|
1167
|
-
type CreateTransferResult = WithStatus<WireTransferWithBrand, "processing" | "action_required" | "failed">;
|
|
1168
|
-
type TransferEndpoint = TransferEndpoint$1;
|
|
1169
|
-
type TransferCustody = TransferCustody$1;
|
|
1170
|
-
type TransferFx = TransferFx$1;
|
|
1171
|
-
type Document = Document$1 & {
|
|
1172
|
-
readonly id: DocumentId$1;
|
|
1173
|
-
};
|
|
1174
|
-
type InvoiceDocument = InvoiceDocument$1;
|
|
1175
|
-
type PayrollRunDocument = PayrollRunDocument$1;
|
|
1176
|
-
type PayrollScheduleDocument = PayrollScheduleDocument$1;
|
|
1177
|
-
type ReceiptDocument = ReceiptDocument$1;
|
|
1178
|
-
type KycUploadDocument = KycUploadDocument$1;
|
|
1179
|
-
type BankStatementDocument = BankStatementDocument$1;
|
|
1180
|
-
type TaxFormDocument = TaxFormDocument$1;
|
|
1181
|
-
type SubAccount = Rebrand<SubAccount$1, SubAccountId$1>;
|
|
1182
|
-
type SubAccountOwnerKind = SubAccountOwnerKind$1;
|
|
1183
|
-
type VirtualAccount = Rebrand<VirtualAccount$1, VirtualAccountId$1>;
|
|
1184
|
-
type VirtualAccountOwnerKind = VirtualAccountOwnerKind$1;
|
|
1185
|
-
type VirtualCard = Rebrand<VirtualCard$1, VirtualCardId$1>;
|
|
1186
|
-
type VirtualCardOwnerKind = VirtualCardOwnerKind$1;
|
|
1187
|
-
type VirtualCardLimits = VirtualCardLimits$1;
|
|
1188
|
-
type WebhookEndpoint = Rebrand<WebhookEndpoint$1, WebhookEndpointId$1>;
|
|
1189
|
-
type WebhookEvent = Rebrand<WebhookEvent$1, WebhookEventId$1>;
|
|
1190
|
-
type ApiKey = Rebrand<ApiKey$1, ApiKeyId$1>;
|
|
1191
|
-
type ApiKeyEnvironment = ApiKeyEnvironment$1;
|
|
1192
|
-
type ApiKeyType = ApiKeyType$1;
|
|
1193
|
-
type Scope = Scope$1;
|
|
1194
|
-
type Member = Rebrand<Omit<Member$1, "authUserId" | "acceptedAt"> & {
|
|
1195
|
-
readonly authUserId: string | null;
|
|
1196
|
-
readonly acceptedAt: number | null;
|
|
1197
|
-
}, MemberId$1>;
|
|
1198
|
-
type MembershipStatus = MembershipStatus$1;
|
|
1199
|
-
type MemberInviteResponse = {
|
|
1200
|
-
readonly member: Member;
|
|
1201
|
-
readonly inviteToken: string;
|
|
1202
|
-
};
|
|
1203
|
-
type BalanceLedgerEntry = Rebrand<BalanceLedgerEntry$1, BalanceLedgerEntryId$1>;
|
|
1204
|
-
|
|
1205
|
-
export type { VirtualCardLimits as $, Account as A, BalanceLedgerEntry as B, CreatePaymentResult as C, Document as D, ExternalAccount as E, SubAccount as F, SubAccountOwnerKind as G, TimestampIso as H, IdentityProfileBase as I, Transfer as J, KybProfile as K, List as L, Member as M, TransferCustody as N, Operation as O, PageInfo as P, TransferEndpoint as Q, ReceiptDocument as R, Safe as S, TaxFormDocument as T, TransferFx as U, TransferStatus as V, Treasury as W, UserIdentifier as X, VirtualAccount as Y, VirtualAccountOwnerKind as Z, VirtualCard as _, AccountLookupResult as a, VirtualCardOwnerKind as a0, WebhookEndpoint as a1, WebhookEvent as a2, Withdrawal as a3, WithdrawalStatus as a4, CreateApiKeyRequest as a5, CreateDocumentRequest as a6, CreateWebhookEndpointRequest as a7, CreateVirtualAccountRequest as a8, CreateVirtualCardRequest as a9, ApiKey as b, ApiKeyEnvironment as c, ApiKeyType as d, BankStatementDocument as e, CreateTransferResult as f, CreateWithdrawalResult as g, ExternalAccountKind as h, InvoiceDocument as i, KybStatus as j, KycProfile as k, KycStatus as l, KycUploadDocument as m, MemberInviteResponse as n, MembershipStatus as o, Money as p, OperationStatus as q, OperationSummary as r, Organization as s, Payment as t, PaymentParty as u, PaymentStatus as v, PayrollRunDocument as w, PayrollScheduleDocument as x, Scope as y, Settlement as z };
|