@xkova/sdk 0.1.0-alpha.1 → 0.1.0-alpha.10
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 +324 -32
- package/dist/abi.d.ts +40 -0
- package/dist/abi.js +25 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +62 -3
- package/dist/generated/types.d.ts +8629 -5182
- package/dist/held-approval.d.ts +41 -0
- package/dist/held-approval.js +33 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/member-action-intents.js +2 -2
- package/dist/member-bff.d.ts +60 -21
- package/dist/member-bff.js +81 -79
- package/dist/member-resources.d.ts +67 -1
- package/dist/member-resources.js +9 -5
- package/dist/request-signing.js +6 -0
- package/dist/resources/account-holders.d.ts +131 -1
- package/dist/resources/account-holders.js +44 -9
- package/dist/resources/branding.d.ts +10 -0
- package/dist/resources/branding.js +2 -0
- package/dist/resources/contacts.d.ts +2 -2
- package/dist/resources/contacts.js +3 -3
- package/dist/resources/escrows.d.ts +3 -0
- package/dist/resources/payment-requests.d.ts +4 -0
- package/dist/resources/payments.d.ts +13 -0
- package/dist/resources/payments.js +7 -0
- package/dist/resources/ramps.d.ts +73 -64
- package/dist/resources/ramps.js +2 -2
- package/dist/resources/rwa.d.ts +9 -9
- package/dist/resources/tenant.d.ts +15 -0
- package/dist/resources/tenant.js +6 -1
- package/dist/resources/tokenization.d.ts +30 -11
- package/dist/resources/tokenization.js +10 -10
- package/dist/resources/treasury.d.ts +404 -0
- package/dist/resources/treasury.js +115 -0
- package/dist/resources/wallets.d.ts +2 -0
- package/dist/resources/webhooks.d.ts +1 -1
- package/dist/resources/webhooks.js +2 -2
- package/dist/resources/workflows.d.ts +7 -6
- package/dist/resources/workflows.js +87 -24
- package/dist/resources/workforce-wallets.d.ts +34 -0
- package/dist/resources/workforce-wallets.js +19 -0
- package/dist/url.d.ts +1 -0
- package/dist/url.js +4 -0
- package/dist/webhook.js +1 -1
- package/dist/workforce-bff.d.ts +202 -0
- package/dist/workforce-bff.js +462 -0
- package/examples/postgres-checkpoint-store.mjs +116 -0
- package/examples/postgres-checkpoints.sql +9 -0
- package/llms.txt +29 -9
- package/package.json +8 -3
package/llms.txt
CHANGED
|
@@ -5,12 +5,13 @@ Use this package on a Node.js 22+ server. Read the installed declarations before
|
|
|
5
5
|
## Read first
|
|
6
6
|
|
|
7
7
|
- [Package guide](README.md): installation, production signing, Hosted Auth, member sessions, durable stores, cancellation, errors, webhooks, and proof verification.
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
8
|
+
- `dist/client.d.ts`: exact resource properties and client options for this installed release.
|
|
9
|
+
- `dist/generated/types.d.ts`: exact request bodies, responses, parameters, and operation IDs. Import types through @xkova/sdk/types.
|
|
10
|
+
- `dist/member-bff.d.ts`: authorization, session persistence, refresh, logout, action reviews, and human authorization.
|
|
11
|
+
- `dist/member-resources.d.ts`: typed resources bound to the exact authenticated member.
|
|
12
|
+
- `dist/workforce-bff.d.ts`: confidential workforce sessions, durable callback recovery, exact action reviews and fresh provider proof. Use @xkova/sdk/workforce-bff, separately from member login and Console operators.
|
|
12
13
|
- [Quickstart](https://docs.xkova.com/getting-started.html): sandbox access and first authenticated call.
|
|
13
|
-
- [Customer OpenAPI](https://
|
|
14
|
+
- [Customer OpenAPI](https://github.com/XKOVA/typescript-sdk/blob/main/schema/customer-api.json): machine-readable contract for the public SDK source. For an installed release, use its generated declarations.
|
|
14
15
|
- [SDK guide](https://docs.xkova.com/sdk-overview.html): client and resource examples.
|
|
15
16
|
- [Workflow guide](https://docs.xkova.com/sdk-workflows.html): supported workflow helpers.
|
|
16
17
|
- [Member integration](https://docs.xkova.com/embedded-member.html): browser, BFF, identity, and signing boundaries.
|
|
@@ -22,7 +23,7 @@ Use this package on a Node.js 22+ server. Read the installed declarations before
|
|
|
22
23
|
1. Server business integration: create XKOVAClient.forTenant({ baseUrl, apiKey }). Use https://sandbox-api.xkova.com for sandbox and https://api.xkova.com for production. The API key binds the workspace and mode.
|
|
23
24
|
2. Member application: use XKOVAMemberBffClient from @xkova/sdk/member-bff in your BFF. Resolve confidential sessions to request-scoped resources with resolveResources(). The browser sends only its application cookie and CSRF proof to your BFF.
|
|
24
25
|
3. Browser companion: optionally install @xkova/browser. It calls your same-origin routes; it does not create those routes or install a session store.
|
|
25
|
-
4.
|
|
26
|
+
4. Customer staff application: use XKOVAWorkforceBffClient from @xkova/sdk/workforce-bff, an explicitly registered dedicated principal and immutable admitted provider subjects. Resolve each authenticated person per request. API-key attribution, email, groups and member credentials cannot create staff authority.
|
|
26
27
|
|
|
27
28
|
## Find a capability
|
|
28
29
|
|
|
@@ -41,6 +42,7 @@ Each namespace below is a property of XKOVAClient. Read its declaration under di
|
|
|
41
42
|
| Transaction history | transactions |
|
|
42
43
|
| Fee schedules and platform fees | feeSchedules |
|
|
43
44
|
| Customer tokens, deployment, minting, supply, access | tokenization |
|
|
45
|
+
| Tenant treasury vaults, proposals, owner signatures, quorum and transfer status | treasury |
|
|
44
46
|
| Real-world assets, cap tables, distributions, corporate actions, provenance | rwa |
|
|
45
47
|
| Gateway registration and conformance | integrationGateways |
|
|
46
48
|
| Branding and sending-domain configuration | branding |
|
|
@@ -49,6 +51,7 @@ Each namespace below is a property of XKOVAClient. Read its declaration under di
|
|
|
49
51
|
| Webhook subscriptions and delivery operations | webhooks |
|
|
50
52
|
| Token deployment/mint polling and off-ramp initiation | workflows |
|
|
51
53
|
| Session exchange, durable review recovery, fresh human authorization | @xkova/sdk/member-bff |
|
|
54
|
+
| Institution workforce login, scoped sessions and exact action proofs | @xkova/sdk/workforce-bff |
|
|
52
55
|
| Verify webhook signatures over raw body bytes | @xkova/sdk/webhook |
|
|
53
56
|
| Offline RWA transparency proofs | @xkova/sdk/rwa-verify |
|
|
54
57
|
| Customer contract ABIs | @xkova/sdk/abi |
|
|
@@ -58,9 +61,10 @@ API availability does not grant permission. Product entitlement, selected API-ke
|
|
|
58
61
|
## Requests and results
|
|
59
62
|
|
|
60
63
|
- Start with the README's sandbox read example. Validate required environment variables on the server; never emit their values into logs, generated files, browser bundles, or prompts.
|
|
61
|
-
- Use exported package entry points and typed resource methods. Do not import dist files as runtime subpaths,
|
|
64
|
+
- Use exported package entry points and typed resource methods. Do not import dist files as runtime subpaths, fabricate request fields, or suppress type errors with any.
|
|
62
65
|
- Production writes require the bearer key plus an active asymmetric requestSigner credential. Its async callback signs through your key provider. The SDK supplies RFC 9421 signatures and RFC 9530 digests. Production reads use bearer authentication.
|
|
63
66
|
- Generate one idempotency key before a logical mutation and persist it. Reuse it only with the identical request. The SDK does not automatically retry writes. A timeout or disconnect can leave the outcome unknown; reconcile the existing resource before starting another operation.
|
|
67
|
+
- Treasury methods preserve API roles, governance holds, independent owner signatures and Safe quorum. An API key is not an authenticated staff session or a wallet signer. Use isHeldApproval before reading an entity from a governed mutation; approval does not itself produce a signature or prove settlement.
|
|
64
68
|
- Use decimal strings for monetary values according to the request type. Preserve asset and chain identity throughout a flow. Do not perform monetary calculations with JavaScript floating-point numbers.
|
|
65
69
|
- Read pagination and response types. Use paginateCursor or collectCursor where applicable; bound collection sizes and polling. Propagate AbortSignal and request deadlines.
|
|
66
70
|
- Handle XKOVAApiError with its code, status, correlationId, and retryAfter. Handle XKOVAUploadError for the object-storage stage. Do not expose transport headers, provider proofs, or signed URLs in user errors or logs.
|
|
@@ -75,10 +79,26 @@ API availability does not grant permission. Product entitlement, selected API-ke
|
|
|
75
79
|
- Reuse one createMemberActionReference() from @xkova/browser for a durable review. Save the draft before setup detours. Expired or missing reviews require checking activity and an explicit new review.
|
|
76
80
|
- Setup readiness is advisory. beginMemberAction() and completeMemberAction() obtain fresh approval for the exact resource. Browser code must not receive provider wallet credentials or internal signing capabilities. Completion of authorization is distinct from execution and settlement.
|
|
77
81
|
|
|
78
|
-
##
|
|
82
|
+
## Payment recovery
|
|
79
83
|
|
|
80
|
-
|
|
84
|
+
Use resolved.resources.payments.recovery(paymentId) to read the current
|
|
85
|
+
member's payment and available actions. Only the sender can continue or cancel.
|
|
86
|
+
On explicit cancellation, call cancelForMember(paymentId) after BFF session,
|
|
87
|
+
Origin and CSRF checks. The principal needs payment.read and payment.cancel.
|
|
88
|
+
Cancellation sends no value and does not require a passkey.
|
|
89
|
+
|
|
90
|
+
Continue only when can_continue is true. Begin a fresh member action for the
|
|
91
|
+
same payment resourceId with action sign, then complete the registered proof
|
|
92
|
+
ceremony. Never create another payment, change its fees or deadline, or reuse
|
|
93
|
+
an expired signing credential. A new session for the same member can recover
|
|
94
|
+
the payment without its original draft. Expired approvals remain cancellable;
|
|
95
|
+
accepted signatures close cancellation. Keep cancelled payments in history.
|
|
96
|
+
After a conflict or uncertain cancellation, re-read state before another action.
|
|
81
97
|
|
|
82
98
|
## Before handing off code
|
|
83
99
|
|
|
84
100
|
List the Console setup and stores the application needs. Test denied access, uncertain writes, pagination, cancellation, and terminal outcomes. Report a missing method or setup requirement explicitly. Do not invent methods, suppress type errors, or bypass authorization to make an example run.
|
|
101
|
+
|
|
102
|
+
## Product opt-in
|
|
103
|
+
|
|
104
|
+
Use resolveResources().self.productEnrollment(product) to read acceptance and credit status. After explicit consent, call self.acceptProductEnrollment(product, { terms_version, sandbox_credit? }). The BFF chooses the product, terms, amount, and token. Reads do not enroll members. Acceptance needs no Idempotency-Key header; reuse the same product and parameters when retrying. Sandbox credits are dUSDC only and issued once per workspace/member/product; the workspace daily budget is 1000 dUSDC. Poll opening until active. Treat requires_review as unresolved delivery, never as permission to request a second product credit.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xkova/sdk",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0-alpha.10",
|
|
4
|
+
"description": "TypeScript SDK for the XKOVA API.",
|
|
5
5
|
"homepage": "https://docs.xkova.com",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
"types": "./dist/member-bff.d.ts",
|
|
32
32
|
"default": "./dist/member-bff.js"
|
|
33
33
|
},
|
|
34
|
+
"./workforce-bff": {
|
|
35
|
+
"types": "./dist/workforce-bff.d.ts",
|
|
36
|
+
"default": "./dist/workforce-bff.js"
|
|
37
|
+
},
|
|
34
38
|
"./webhook": {
|
|
35
39
|
"types": "./dist/webhook.d.ts",
|
|
36
40
|
"default": "./dist/webhook.js"
|
|
@@ -46,7 +50,8 @@
|
|
|
46
50
|
},
|
|
47
51
|
"files": [
|
|
48
52
|
"dist",
|
|
49
|
-
"llms.txt"
|
|
53
|
+
"llms.txt",
|
|
54
|
+
"examples"
|
|
50
55
|
],
|
|
51
56
|
"dependencies": {
|
|
52
57
|
"viem": "^2.21.0"
|