@daski/pay 0.1.2 → 0.3.0
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 +35 -80
- package/dist/bin/daski.js +34 -12
- package/dist/bin/daski.js.map +1 -1
- package/dist/commands/approval.d.ts +52 -0
- package/dist/commands/approval.d.ts.map +1 -0
- package/dist/commands/approval.js +59 -0
- package/dist/commands/approval.js.map +1 -0
- package/dist/commands/buy.d.ts +4 -4
- package/dist/commands/buy.d.ts.map +1 -1
- package/dist/commands/buy.js +50 -67
- package/dist/commands/buy.js.map +1 -1
- package/dist/commands/confirmation.d.ts +29 -0
- package/dist/commands/confirmation.d.ts.map +1 -0
- package/dist/commands/confirmation.js +123 -0
- package/dist/commands/confirmation.js.map +1 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +27 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/order.d.ts +24 -2
- package/dist/commands/order.d.ts.map +1 -1
- package/dist/commands/order.js +68 -14
- package/dist/commands/order.js.map +1 -1
- package/dist/commands/signPayment.d.ts +1 -0
- package/dist/commands/signPayment.d.ts.map +1 -1
- package/dist/commands/signPayment.js +9 -4
- package/dist/commands/signPayment.js.map +1 -1
- package/dist/commands/wallet.d.ts.map +1 -1
- package/dist/commands/wallet.js +5 -17
- package/dist/commands/wallet.js.map +1 -1
- package/dist/config.d.ts +15 -11
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +59 -33
- package/dist/config.js.map +1 -1
- package/dist/context.js +2 -2
- package/dist/context.js.map +1 -1
- package/dist/gateway/client.d.ts +20 -0
- package/dist/gateway/client.d.ts.map +1 -1
- package/dist/gateway/client.js +55 -0
- package/dist/gateway/client.js.map +1 -1
- package/dist/gateway/purchase.d.ts +53 -5
- package/dist/gateway/purchase.d.ts.map +1 -1
- package/dist/gateway/purchase.js +131 -67
- package/dist/gateway/purchase.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/store/orders.d.ts +16 -1
- package/dist/store/orders.d.ts.map +1 -1
- package/dist/store/orders.js +7 -1
- package/dist/store/orders.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { runBuy, type BuyOptions } from "./commands/buy.js";
|
|
9
9
|
export { runDoctor, type DoctorIssue, type DoctorOptions, type DoctorReport } from "./commands/doctor.js";
|
|
10
|
-
export { orderArtifact, orderCancel, orderConfirm, orderInput, orderStatus, type OrderArtifactOptions, type OrderInputOptions, type OrderOptions, } from "./commands/order.js";
|
|
10
|
+
export { orderArtifact, orderCancel, orderConfirm, orderInput, orderStatus, orderReconcile, type OrderArtifactOptions, type OrderInputOptions, type OrderOptions, } from "./commands/order.js";
|
|
11
11
|
export { runSignPayment, type SignPaymentOptions } from "./commands/signPayment.js";
|
|
12
12
|
export { createWallet, walletAddress, walletBalance, type WalletOptions } from "./commands/wallet.js";
|
|
13
13
|
export { CliError, type CliErrorOptions } from "./cli/errors.js";
|
|
14
14
|
export { redactText, redactValue } from "./cli/redact.js";
|
|
15
|
-
export { applyCapOverrides, atomicUsdc, ensureConfig, loadConfig, permissionWarnings, type DaskiConfig, type LoadedConfig, type ProfileConfig, type SignerKind, } from "./config.js";
|
|
15
|
+
export { applyCapOverrides, atomicUsdc, configureBudgets, ensureConfig, loadConfig, permissionWarnings, type DaskiConfig, type LoadedConfig, type ProfileConfig, type SignerKind, } from "./config.js";
|
|
16
16
|
export { createContext, type CommandContext, type ContextOptions } from "./context.js";
|
|
17
17
|
export { Catalog, CATALOG_TTL_SECONDS, type OutcomeSummary } from "./gateway/catalog.js";
|
|
18
18
|
export { GatewayClient, readiness, type GatewayCallLog, type PaymentChallenge, type PaymentRequirement, type PaymentSubmission, } from "./gateway/client.js";
|
|
19
19
|
export { callAuthorizedLifecycleTool, callWalletQuery } from "./gateway/lifecycle.js";
|
|
20
|
-
export { authorizePayment, listPayerOrders, newIntentId, reconcileAmbiguousPurchase, recordIntent, requestChallenge, submitPayment, type AuthorizedPayment, type ChallengeResult, type ReconcileOutcome, } from "./gateway/purchase.js";
|
|
20
|
+
export { authorizePayment, listPayerOrders, newIntentId, reconcileAmbiguousPurchase, reconcileByIdentifier, recordIntent, requestChallenge, submitPayment, type AuthorizedPayment, type ChallengeResult, type ReconcileOutcome, } from "./gateway/purchase.js";
|
|
21
21
|
export { createSigner, type SignerSelection } from "./signers/index.js";
|
|
22
22
|
export { runSignerSelfTest, selfTestVector, type SignerSelfTestResult } from "./signers/selfTest.js";
|
|
23
23
|
export { activeReadCapability, authorizedTotalAtomic, findByIntent, findOrder, listOrders, updateOrder, upsertOrder, type OrderRecord, type OrderState, } from "./store/orders.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC1G,OAAO,EACL,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC1G,OAAO,EACL,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAA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AoB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACrG,OAAO,EACL,oBAAoB,EAAE,qBAAqB,EAAE,YAAY,EAAE,SAAS,EACpE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,GACxE,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { runBuy } from "./commands/buy.js";
|
|
9
9
|
export { runDoctor } from "./commands/doctor.js";
|
|
10
|
-
export { orderArtifact, orderCancel, orderConfirm, orderInput, orderStatus, } from "./commands/order.js";
|
|
10
|
+
export { orderArtifact, orderCancel, orderConfirm, orderInput, orderStatus, orderReconcile, } from "./commands/order.js";
|
|
11
11
|
export { runSignPayment } from "./commands/signPayment.js";
|
|
12
12
|
export { createWallet, walletAddress, walletBalance } from "./commands/wallet.js";
|
|
13
13
|
export { CliError } from "./cli/errors.js";
|
|
14
14
|
export { redactText, redactValue } from "./cli/redact.js";
|
|
15
|
-
export { applyCapOverrides, atomicUsdc, ensureConfig, loadConfig, permissionWarnings, } from "./config.js";
|
|
15
|
+
export { applyCapOverrides, atomicUsdc, configureBudgets, ensureConfig, loadConfig, permissionWarnings, } from "./config.js";
|
|
16
16
|
export { createContext } from "./context.js";
|
|
17
17
|
export { Catalog, CATALOG_TTL_SECONDS } from "./gateway/catalog.js";
|
|
18
18
|
export { GatewayClient, readiness, } from "./gateway/client.js";
|
|
19
19
|
export { callAuthorizedLifecycleTool, callWalletQuery } from "./gateway/lifecycle.js";
|
|
20
|
-
export { authorizePayment, listPayerOrders, newIntentId, reconcileAmbiguousPurchase, recordIntent, requestChallenge, submitPayment, } from "./gateway/purchase.js";
|
|
20
|
+
export { authorizePayment, listPayerOrders, newIntentId, reconcileAmbiguousPurchase, reconcileByIdentifier, recordIntent, requestChallenge, submitPayment, } from "./gateway/purchase.js";
|
|
21
21
|
export { createSigner } from "./signers/index.js";
|
|
22
22
|
export { runSignerSelfTest, selfTestVector } from "./signers/selfTest.js";
|
|
23
23
|
export { activeReadCapability, authorizedTotalAtomic, findByIntent, findOrder, listOrders, updateOrder, upsertOrder, } from "./store/orders.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAmB,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAA2D,MAAM,sBAAsB,CAAC;AAC1G,OAAO,EACL,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAmB,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAA2D,MAAM,sBAAsB,CAAC;AAC1G,OAAO,EACL,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,GAElF,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAA2B,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAsB,MAAM,sBAAsB,CAAC;AAEtG,OAAO,EAAE,QAAQ,EAAwB,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EACL,iBAAiB,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,kBAAkB,GAE9F,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAA4C,MAAM,cAAc,CAAC;AAEvF,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAuB,MAAM,sBAAsB,CAAC;AACzF,OAAO,EACL,aAAa,EAAE,SAAS,GAEzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EACL,gBAAgB,EAAE,eAAe,EAAE,WAAW,EAAE,0BAA0B,EAAE,qBAAqB,EACjG,YAAY,EAAE,gBAAgB,EAAE,aAAa,GAE9C,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAwB,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAA6B,MAAM,uBAAuB,CAAC;AACrG,OAAO,EACL,oBAAoB,EAAE,qBAAqB,EAAE,YAAY,EAAE,SAAS,EACpE,UAAU,EAAE,WAAW,EAAE,WAAW,GACrC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAoC,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/store/orders.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export type OrderState = "INTENT_RECORDED" | "AUTHORIZED" | "SUBMITTED" | "FULFILLED" | "INPUT_REQUIRED" | "PROVIDER_FAILED" | "CANCELED" | "PENDING_RECONCILIATION"
|
|
1
|
+
export type OrderState = "INTENT_RECORDED" | "AUTHORIZED" | "SUBMITTED" | "FULFILLED" | "INPUT_REQUIRED" | "PROVIDER_FAILED" | "CANCELED" | "PENDING_RECONCILIATION"
|
|
2
|
+
/** The gateway said the authorization did not settle; nothing was charged. */
|
|
3
|
+
| "NOT_SETTLED";
|
|
2
4
|
/** A stored read capability, when the gateway issues one (spec 01 §8). */
|
|
3
5
|
export interface ReadCapability {
|
|
4
6
|
token: string;
|
|
@@ -16,10 +18,21 @@ export interface OrderRecord {
|
|
|
16
18
|
payer: string;
|
|
17
19
|
/** Atomic USDC. */
|
|
18
20
|
amount: string;
|
|
21
|
+
/** Approved business terms, used to distinguish repeat purchases. */
|
|
22
|
+
approvalTermsHash?: string | undefined;
|
|
19
23
|
state: OrderState;
|
|
20
24
|
/** The recomputed authorization nonce; identifies the order on-chain. */
|
|
21
25
|
authorizationNonce?: string | undefined;
|
|
22
26
|
readCapability?: ReadCapability | undefined;
|
|
27
|
+
/** A review submission retained for retries while sponsorship is pending. */
|
|
28
|
+
confirmationSubmission?: {
|
|
29
|
+
action: "confirmation" | "revoke-confirmation";
|
|
30
|
+
request: {
|
|
31
|
+
phase: "submit";
|
|
32
|
+
preparationId: string;
|
|
33
|
+
signature: string;
|
|
34
|
+
};
|
|
35
|
+
} | undefined;
|
|
23
36
|
createdAt: string;
|
|
24
37
|
updatedAt: string;
|
|
25
38
|
/** The request body, kept so an interrupted purchase can be replayed byte-identically. */
|
|
@@ -32,6 +45,8 @@ export declare function findByIntent(intentId: string): OrderRecord | undefined;
|
|
|
32
45
|
/** Inserts or updates by intent id. The intent id is the stable key. */
|
|
33
46
|
export declare function upsertOrder(record: OrderRecord): OrderRecord;
|
|
34
47
|
export declare function updateOrder(intentId: string, changes: Partial<Omit<OrderRecord, "intentId" | "createdAt">>): OrderRecord | undefined;
|
|
48
|
+
/** True when the record consumed no session budget and its identifier may be signed for again. */
|
|
49
|
+
export declare function isUnspent(record: OrderRecord): boolean;
|
|
35
50
|
/** Total atomic USDC authorized for a profile: the §4.1.5 session running total. */
|
|
36
51
|
export declare function authorizedTotalAtomic(profile: string): bigint;
|
|
37
52
|
/** A stored capability that is still usable, or undefined. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders.d.ts","sourceRoot":"","sources":["../../src/store/orders.ts"],"names":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G,SAAS,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAC/C;AA0BD,wBAAgB,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,EAAE,CAG1D;AAED,4EAA4E;AAC5E,wBAAgB,SAAS,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAI3F;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAEtE;AAED,wEAAwE;AACxE,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAa5D;AAED,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,WAAW,CAAC,CAAC,GAC5D,WAAW,GAAG,SAAS,CAYzB;AAKD,kGAAkG;AAClG,wBAAgB,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAEtD;AAED,oFAAoF;AACpF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAI7D;AAED,8DAA8D;AAC9D,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,WAAW,EACnB,UAAU,SAAiC,GAC1C,cAAc,GAAG,SAAS,CAM5B"}
|
package/dist/store/orders.js
CHANGED
|
@@ -73,10 +73,16 @@ export function updateOrder(intentId, changes) {
|
|
|
73
73
|
write(file);
|
|
74
74
|
return merged;
|
|
75
75
|
}
|
|
76
|
+
/** States under which no USDC was authorized, or the gateway says none settled. */
|
|
77
|
+
const UNSPENT_STATES = new Set(["INTENT_RECORDED", "NOT_SETTLED"]);
|
|
78
|
+
/** True when the record consumed no session budget and its identifier may be signed for again. */
|
|
79
|
+
export function isUnspent(record) {
|
|
80
|
+
return UNSPENT_STATES.has(record.state);
|
|
81
|
+
}
|
|
76
82
|
/** Total atomic USDC authorized for a profile: the §4.1.5 session running total. */
|
|
77
83
|
export function authorizedTotalAtomic(profile) {
|
|
78
84
|
return listOrders(profile)
|
|
79
|
-
.filter((order) => order
|
|
85
|
+
.filter((order) => !isUnspent(order))
|
|
80
86
|
.reduce((total, order) => total + BigInt(order.amount), 0n);
|
|
81
87
|
}
|
|
82
88
|
/** A stored capability that is still usable, or undefined. */
|
package/dist/store/orders.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders.js","sourceRoot":"","sources":["../../src/store/orders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"orders.js","sourceRoot":"","sources":["../../src/store/orders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAsDzC,SAAS,IAAI;IACX,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,EAAE,MAAM,CAAC,CAAc,CAAC;QAC3E,IAAI,MAAM,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QACpF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
4
4
|
"description": "The Daski buyer bridge CLI. Server proposes, the bridge validates and recomputes, the wallet signs, the gateway never sees the key.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"prepublishOnly": "npm run build"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@daski/x402-scheme": "0.
|
|
47
|
+
"@daski/x402-scheme": "0.3.0",
|
|
48
48
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
49
49
|
"@x402/core": "2.24.0",
|
|
50
50
|
"viem": "2.21.55"
|