@mnd8t/sdk 0.1.1 → 0.1.2
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 +5 -4
- package/dist/client.d.ts +1 -1
- package/dist/types.d.ts +7 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -23,17 +23,18 @@ const mandate = new MandateClient({
|
|
|
23
23
|
baseUrl: process.env.MANDATE_API_URL!, // your workspace URL, from the dashboard
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
const decision = await mandate.decisions.
|
|
26
|
+
const decision = await mandate.decisions.authorize({
|
|
27
27
|
agent_external_id: "procurement_agent_12",
|
|
28
|
-
|
|
29
|
-
policy_currency: "GBP",
|
|
30
|
-
asset: "USDC",
|
|
28
|
+
amount: { asset: "USDC", asset_amount_minor: 675_000_000 },
|
|
29
|
+
valuation: { policy_amount_minor: 50_000, policy_currency: "GBP", source: "CUSTOMER_SYSTEM" },
|
|
31
30
|
counterparty_external_id: "supplier_acme_cloud",
|
|
32
31
|
purpose: "cloud_infrastructure",
|
|
33
32
|
});
|
|
34
33
|
|
|
35
34
|
if (decision.effective_decision === "APPROVE") {
|
|
36
35
|
// Execute with your own credentials, then confirm.
|
|
36
|
+
} else if (decision.effective_decision === "ESCALATE") {
|
|
37
|
+
console.log("send this to a human:", decision.approval?.approval_url);
|
|
37
38
|
}
|
|
38
39
|
```
|
|
39
40
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Agent, AuthorizeRequest, AuthorizeResponse, ConfirmRequest, Counterparty, CounterpartyAuthorityStatus, CreateAgentRequest, CreateCounterpartyRequest, CreateMandateRequest, EvidenceReceiptEnvelope, Mandate, PublishMandateOptions, PublishResult } from "./types.js";
|
|
2
2
|
export interface MandateClientOptions {
|
|
3
3
|
apiKey: string;
|
|
4
|
-
/**
|
|
4
|
+
/** Your workspace URL. Defaults to http://localhost:4000, what `pnpm dev` serves. */
|
|
5
5
|
baseUrl?: string;
|
|
6
6
|
/** Request timeout in milliseconds (default 15000). */
|
|
7
7
|
timeoutMs?: number;
|
package/dist/types.d.ts
CHANGED
|
@@ -169,7 +169,13 @@ export interface AuthorizeRequest {
|
|
|
169
169
|
amount_minor?: number;
|
|
170
170
|
policy_amount_minor?: number;
|
|
171
171
|
policy_currency?: string;
|
|
172
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Deprecated: prefer `amount.asset`. Optional, matching the API, which
|
|
174
|
+
* declares it `.optional()` and reads the asset from `amount` when both the
|
|
175
|
+
* flat fields and `amount` are absent. It was typed as required here, which
|
|
176
|
+
* made the documented request shape fail to typecheck.
|
|
177
|
+
*/
|
|
178
|
+
asset?: string;
|
|
173
179
|
counterparty_external_id?: string;
|
|
174
180
|
destination?: string;
|
|
175
181
|
purpose?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mnd8t/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "TypeScript SDK for the Mandate Gateway authority API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc -p tsconfig.build.json",
|
|
38
38
|
"typecheck": "tsc --noEmit",
|
|
39
|
-
"test": "vitest run"
|
|
39
|
+
"test": "vitest run && node ../../scripts/check-readme-compiles.mjs"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^22.10.5",
|