@vapi-network/core 0.8.0 → 0.9.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 +14 -1
- package/dist/agent-link.d.ts.map +1 -1
- package/dist/agent-link.js +6 -1
- package/dist/agent-link.js.map +1 -1
- package/dist/agent-profile.d.ts +4 -0
- package/dist/agent-profile.d.ts.map +1 -1
- package/dist/api-key.js +47 -0
- package/dist/api-key.js.map +1 -1
- package/dist/backup.d.ts +2 -0
- package/dist/backup.d.ts.map +1 -1
- package/dist/backup.js +65 -0
- package/dist/backup.js.map +1 -1
- package/dist/cloud-backup.js +71 -1
- package/dist/cloud-backup.js.map +1 -1
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/docs.d.ts +40 -0
- package/dist/docs.d.ts.map +1 -0
- package/dist/funding-policy.d.ts +29 -0
- package/dist/funding-policy.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +718 -35
- package/dist/index.js.map +3 -3
- package/dist/router-client.js +230 -33
- package/dist/router-client.js.map +2 -2
- package/dist/secrets.js +29 -1
- package/dist/secrets.js.map +1 -1
- package/dist/spend-policy.d.ts +41 -7
- package/dist/spend-policy.d.ts.map +1 -1
- package/dist/support-report.d.ts +1 -1
- package/dist/tasks/actions.d.ts +152 -0
- package/dist/tasks/actions.d.ts.map +1 -0
- package/dist/tasks/canonical-json.d.ts +6 -0
- package/dist/tasks/canonical-json.d.ts.map +1 -0
- package/dist/tasks/chain-error.d.ts +6 -0
- package/dist/tasks/chain-error.d.ts.map +1 -0
- package/dist/tasks/chain-port.d.ts +88 -0
- package/dist/tasks/chain-port.d.ts.map +1 -0
- package/dist/tasks/chain-verification.d.ts +36 -0
- package/dist/tasks/chain-verification.d.ts.map +1 -0
- package/dist/tasks/chain.d.ts +22 -0
- package/dist/tasks/chain.d.ts.map +1 -0
- package/dist/tasks/client.d.ts +76 -0
- package/dist/tasks/client.d.ts.map +1 -0
- package/dist/tasks/delivery-manifest.d.ts +24 -0
- package/dist/tasks/delivery-manifest.d.ts.map +1 -0
- package/dist/tasks/dispute-fee.d.ts +4 -0
- package/dist/tasks/dispute-fee.d.ts.map +1 -0
- package/dist/tasks/index.d.ts +22 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/money.d.ts +17 -0
- package/dist/tasks/money.d.ts.map +1 -0
- package/dist/tasks/operation-support.d.ts +127 -0
- package/dist/tasks/operation-support.d.ts.map +1 -0
- package/dist/tasks/operations.d.ts +722 -0
- package/dist/tasks/operations.d.ts.map +1 -0
- package/dist/tasks/pending-transactions.d.ts +52 -0
- package/dist/tasks/pending-transactions.d.ts.map +1 -0
- package/dist/tasks/plan-guard.d.ts +326 -0
- package/dist/tasks/plan-guard.d.ts.map +1 -0
- package/dist/tasks/rpc.d.ts +8 -0
- package/dist/tasks/rpc.d.ts.map +1 -0
- package/dist/tasks/scope-bindings.d.ts +20 -0
- package/dist/tasks/scope-bindings.d.ts.map +1 -0
- package/dist/tasks/scope-terms.d.ts +75 -0
- package/dist/tasks/scope-terms.d.ts.map +1 -0
- package/dist/tasks/trusted-deployments.d.ts +14 -0
- package/dist/tasks/trusted-deployments.d.ts.map +1 -0
- package/dist/tasks/types.d.ts +4439 -0
- package/dist/tasks/types.d.ts.map +1 -0
- package/dist/tasks/verbs.d.ts +4 -0
- package/dist/tasks/verbs.d.ts.map +1 -0
- package/dist/tasks.js +43906 -0
- package/dist/tasks.js.map +6 -0
- package/dist/transfer.d.ts.map +1 -1
- package/package.json +5 -1
package/dist/spend-policy.d.ts
CHANGED
|
@@ -6,31 +6,65 @@ declare const ledgerSchema: z.ZodObject<{
|
|
|
6
6
|
spentAtomic: z.ZodString;
|
|
7
7
|
}, z.core.$strip>;
|
|
8
8
|
export type SpendLedger = z.infer<typeof ledgerSchema>;
|
|
9
|
+
export type SpendKind = "payment" | "escrow-funding" | "dispute-fee";
|
|
9
10
|
export type SpendLedgerRow = SpendLedger & {
|
|
10
11
|
wallet: WalletName;
|
|
11
12
|
};
|
|
12
13
|
export declare class SpendCapError extends Error {
|
|
13
|
-
readonly code: "per_call_cap_exceeded" | "per_day_cap_exceeded";
|
|
14
|
-
constructor(code: "per_call_cap_exceeded" | "per_day_cap_exceeded", message: string);
|
|
14
|
+
readonly code: "per_call_cap_exceeded" | "per_task_cap_exceeded" | "per_day_cap_exceeded";
|
|
15
|
+
constructor(code: "per_call_cap_exceeded" | "per_task_cap_exceeded" | "per_day_cap_exceeded", message: string);
|
|
15
16
|
}
|
|
16
17
|
export declare function utcDateKey(now?: Date): string;
|
|
17
18
|
/** Today's spend for one wallet. Other wallets and older days read as zero. */
|
|
18
19
|
export declare function readSpendLedger(path?: string, now?: Date, wallet?: WalletName): Promise<SpendLedger>;
|
|
20
|
+
/** Read-only funding headroom; never creates directories, writes, or takes a lock. */
|
|
21
|
+
export declare function escrowFundingDayRemainingAtomic(input: {
|
|
22
|
+
caps: SpendCaps;
|
|
23
|
+
ledgerPath: string;
|
|
24
|
+
now: Date;
|
|
25
|
+
wallet: WalletName;
|
|
26
|
+
reservationId?: string;
|
|
27
|
+
}): Promise<bigint>;
|
|
28
|
+
/** Read-only task spend across all stored days, excluding a reservation being retried. */
|
|
29
|
+
export declare function taskReservedAtomic(input: {
|
|
30
|
+
ledgerPath: string;
|
|
31
|
+
wallet: WalletName;
|
|
32
|
+
taskKey: string;
|
|
33
|
+
now: Date;
|
|
34
|
+
excludeReservationId?: string;
|
|
35
|
+
}): Promise<bigint>;
|
|
19
36
|
/** Today's spend of every wallet that has spent today. */
|
|
20
37
|
export declare function readSpendLedgerRows(path?: string, now?: Date): Promise<SpendLedgerRow[]>;
|
|
21
38
|
/**
|
|
22
|
-
* Reserves one payment against the caps of one wallet.
|
|
23
|
-
* per wallet, so an agent wallet cannot spend the
|
|
39
|
+
* Reserves one payment or escrow funding against the caps of one wallet.
|
|
40
|
+
* Per-day totals are kept per wallet, so an agent wallet cannot spend the
|
|
41
|
+
* owner's daily allowance.
|
|
42
|
+
* Task-linked calls without a reservation id return a generated id for rollback.
|
|
24
43
|
*/
|
|
25
44
|
export declare function reserveSpend(amountAtomic: bigint, caps: SpendCaps, options?: {
|
|
26
45
|
ledgerPath?: string;
|
|
27
46
|
now?: Date;
|
|
28
47
|
wallet?: WalletName;
|
|
29
48
|
reservationId?: string;
|
|
30
|
-
|
|
49
|
+
kind?: SpendKind;
|
|
50
|
+
taskKey?: string;
|
|
51
|
+
maxPerTaskAtomic?: bigint;
|
|
52
|
+
reuseExistingEscrowReservation?: boolean;
|
|
53
|
+
resumeEscrowReservation?: {
|
|
54
|
+
id: string;
|
|
55
|
+
wallet: WalletName;
|
|
56
|
+
amountAtomic: string;
|
|
57
|
+
date: string;
|
|
58
|
+
exposed?: boolean;
|
|
59
|
+
invalidated?: boolean;
|
|
60
|
+
};
|
|
61
|
+
}): Promise<SpendLedger & {
|
|
62
|
+
reservationReused?: boolean;
|
|
63
|
+
reservationId?: string;
|
|
64
|
+
}>;
|
|
31
65
|
/**
|
|
32
|
-
* Releases
|
|
33
|
-
*
|
|
66
|
+
* Releases an identified reservation on its original UTC day, including task
|
|
67
|
+
* accounting. Unidentified releases only affect today's daily budget.
|
|
34
68
|
*/
|
|
35
69
|
export declare function releaseSpend(amountAtomic: bigint, options: {
|
|
36
70
|
reservedOn: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spend-policy.d.ts","sourceRoot":"","sources":["../src/spend-policy.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAyC,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE1F,QAAA,MAAM,YAAY;;;iBAGhB,CAAC;
|
|
1
|
+
{"version":3,"file":"spend-policy.d.ts","sourceRoot":"","sources":["../src/spend-policy.ts"],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ACA,OAAO,CAAC,WAAW,CAAC,CAsDtB"}
|
package/dist/support-report.d.ts
CHANGED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import { type SpendCaps } from "../config.js";
|
|
3
|
+
import { type ReleaseDecision } from "../funding-policy.js";
|
|
4
|
+
import type { WalletName } from "../wallet-name.js";
|
|
5
|
+
import { type TasksChain, type TasksChainResult } from "./chain-port.js";
|
|
6
|
+
import type { TasksClient } from "./client.js";
|
|
7
|
+
import type { PendingTransactions } from "./pending-transactions.js";
|
|
8
|
+
import { type FrozenDeliveryManifest } from "./delivery-manifest.js";
|
|
9
|
+
import { type TaskMoney } from "./money.js";
|
|
10
|
+
import { type ScopeBindings } from "./scope-bindings.js";
|
|
11
|
+
import { type SignScopeResponse, type UploadFileInput } from "./types.js";
|
|
12
|
+
/** A milestone ID selects a tranche within this order; no implicit selection across tranches. */
|
|
13
|
+
export type TaskTarget = {
|
|
14
|
+
orderId: string;
|
|
15
|
+
escrowId?: string;
|
|
16
|
+
counterparty?: string;
|
|
17
|
+
};
|
|
18
|
+
export type TaskActionInput = TaskTarget & {
|
|
19
|
+
client: TasksClient;
|
|
20
|
+
chain: TasksChain;
|
|
21
|
+
/** Retain one UUID across transport retries; reconcile an existing funding reservation separately. */
|
|
22
|
+
idempotencyKey?: () => string;
|
|
23
|
+
};
|
|
24
|
+
export type FundingSummary = {
|
|
25
|
+
money: TaskMoney;
|
|
26
|
+
dayRemainingUsd: number;
|
|
27
|
+
};
|
|
28
|
+
/** Without approval, an amount above the threshold returns approval_needed. */
|
|
29
|
+
export type TaskFundingApproval = {
|
|
30
|
+
granted: true;
|
|
31
|
+
} | {
|
|
32
|
+
granted: false;
|
|
33
|
+
} | {
|
|
34
|
+
ask: (summary: FundingSummary) => Promise<boolean>;
|
|
35
|
+
};
|
|
36
|
+
export type FundTaskInput = TaskActionInput & {
|
|
37
|
+
pending?: PendingTransactions;
|
|
38
|
+
policy: {
|
|
39
|
+
maxPerTaskUsd: number;
|
|
40
|
+
approveAboveUsd: number;
|
|
41
|
+
};
|
|
42
|
+
caps: SpendCaps;
|
|
43
|
+
wallet: WalletName;
|
|
44
|
+
ledgerPath: string;
|
|
45
|
+
now: () => Date;
|
|
46
|
+
approval?: TaskFundingApproval;
|
|
47
|
+
};
|
|
48
|
+
export type FundTaskOutcome = {
|
|
49
|
+
outcome: "refused";
|
|
50
|
+
reason: "policy.perTask" | "policy.perDay";
|
|
51
|
+
money: TaskMoney;
|
|
52
|
+
} | {
|
|
53
|
+
outcome: "approval_needed";
|
|
54
|
+
money: TaskMoney;
|
|
55
|
+
} | {
|
|
56
|
+
outcome: "declined";
|
|
57
|
+
money: TaskMoney;
|
|
58
|
+
} | {
|
|
59
|
+
outcome: "done";
|
|
60
|
+
money: TaskMoney;
|
|
61
|
+
result: TasksChainResult;
|
|
62
|
+
};
|
|
63
|
+
export declare function fundTask(input: FundTaskInput): Promise<FundTaskOutcome>;
|
|
64
|
+
export type TaskDeliveryFile = ({
|
|
65
|
+
path: string;
|
|
66
|
+
name?: never;
|
|
67
|
+
} | {
|
|
68
|
+
name: string;
|
|
69
|
+
path?: never;
|
|
70
|
+
}) & {
|
|
71
|
+
bytes: Uint8Array;
|
|
72
|
+
contentType: UploadFileInput["contentType"];
|
|
73
|
+
};
|
|
74
|
+
export type PrepareDeliveryInput = TaskTarget & {
|
|
75
|
+
client: TasksClient;
|
|
76
|
+
pending?: PendingTransactions;
|
|
77
|
+
files: TaskDeliveryFile[];
|
|
78
|
+
note: string;
|
|
79
|
+
};
|
|
80
|
+
export type PreparedTaskDelivery = {
|
|
81
|
+
orderId: string;
|
|
82
|
+
escrowId: string;
|
|
83
|
+
manifest: FrozenDeliveryManifest;
|
|
84
|
+
note: string;
|
|
85
|
+
};
|
|
86
|
+
export declare function prepareDelivery(input: PrepareDeliveryInput): Promise<PreparedTaskDelivery>;
|
|
87
|
+
export type DeliverTaskInput = PrepareDeliveryInput & Pick<TaskActionInput, "chain" | "idempotencyKey">;
|
|
88
|
+
export type DeliverTaskResult = PreparedTaskDelivery & {
|
|
89
|
+
manifestHash: `0x${string}`;
|
|
90
|
+
result: TasksChainResult;
|
|
91
|
+
};
|
|
92
|
+
export declare function deliverTask(input: DeliverTaskInput): Promise<DeliverTaskResult>;
|
|
93
|
+
export type TaskMoneyResult = {
|
|
94
|
+
money: TaskMoney;
|
|
95
|
+
result: TasksChainResult;
|
|
96
|
+
};
|
|
97
|
+
export declare function releaseTask(input: TaskActionInput): Promise<TaskMoneyResult>;
|
|
98
|
+
export declare function refundTask(input: TaskActionInput): Promise<TaskMoneyResult>;
|
|
99
|
+
export type DisputeTaskInput = FundTaskInput & {
|
|
100
|
+
evidenceHash: string;
|
|
101
|
+
};
|
|
102
|
+
export type DisputeTaskResult = FundTaskOutcome & {
|
|
103
|
+
disputeFee: {
|
|
104
|
+
baseUnits: string;
|
|
105
|
+
usd: string;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
export declare function disputeTask(input: DisputeTaskInput): Promise<DisputeTaskResult>;
|
|
109
|
+
export declare function counterEvidenceTask(input: DisputeTaskInput): Promise<DisputeTaskResult>;
|
|
110
|
+
export declare function resolveUnmatchedTask(input: TaskActionInput): Promise<TaskMoneyResult>;
|
|
111
|
+
export declare function autoReleaseDecision(input: {
|
|
112
|
+
amountUsd: number;
|
|
113
|
+
autoReleaseBelowUsd: number;
|
|
114
|
+
}): ReleaseDecision;
|
|
115
|
+
export type SignScopeActionInput = {
|
|
116
|
+
client: TasksClient;
|
|
117
|
+
chain: TasksChain;
|
|
118
|
+
orderId: string;
|
|
119
|
+
role: "poster" | "worker";
|
|
120
|
+
counterparty?: string;
|
|
121
|
+
bindings?: ScopeBindings;
|
|
122
|
+
onTerms?: (terms: SignedScopeTerms) => Promise<void> | void;
|
|
123
|
+
/** Local EIP-191 signer, invoked only after validating the current scope. */
|
|
124
|
+
signMessage?: (message: string) => Promise<`0x${string}`>;
|
|
125
|
+
idempotencyKey?: () => string;
|
|
126
|
+
};
|
|
127
|
+
export type SignedScopeTerms = {
|
|
128
|
+
role: "client" | "provider";
|
|
129
|
+
self: Address;
|
|
130
|
+
direction: "you fund escrow for the worker" | "you deliver work to the poster";
|
|
131
|
+
counterparty: Address;
|
|
132
|
+
amountBaseUnits: string;
|
|
133
|
+
asset: string;
|
|
134
|
+
network: `eip155:${number}`;
|
|
135
|
+
deadline: string;
|
|
136
|
+
deliverables: string[];
|
|
137
|
+
title: string;
|
|
138
|
+
};
|
|
139
|
+
export type SignScopeAcceptance = SignScopeResponse & {
|
|
140
|
+
terms: SignedScopeTerms;
|
|
141
|
+
};
|
|
142
|
+
export type SignScopeActionResult = SignScopeAcceptance & {
|
|
143
|
+
escrowCreation: TasksChainResult | null;
|
|
144
|
+
};
|
|
145
|
+
/** The acceptance response arrived; inspect it before retrying a follow-up separately. */
|
|
146
|
+
export declare class TasksScopeCreationError extends Error {
|
|
147
|
+
readonly acceptance: SignScopeAcceptance;
|
|
148
|
+
readonly broadcast: boolean;
|
|
149
|
+
constructor(acceptance: SignScopeAcceptance, cause: unknown);
|
|
150
|
+
}
|
|
151
|
+
export declare function signScope(input: SignScopeActionInput): Promise<SignScopeActionResult>;
|
|
152
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/tasks/actions.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,OAAO,EAEb,MAAM,MAAM,CAAC;AAGd,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAgC,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAQ1F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAA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,QAAQ,CAAC,UAAU,EAAE,mBAAmB;IAH1C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;gBAGjB,UAAU,EAAE,mBAAmB,EACxC,KAAK,EAAE,OAAO;CAMjB;AAED,wBAAsB,SAAS,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA6R3F"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
2
|
+
[key: string]: JsonValue;
|
|
3
|
+
};
|
|
4
|
+
export declare function canonicalizeJson(value: unknown): JsonValue;
|
|
5
|
+
export declare function canonicalJson(value: unknown): string;
|
|
6
|
+
//# sourceMappingURL=canonical-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-json.d.ts","sourceRoot":"","sources":["../../src/tasks/canonical-json.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACnB,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEhF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAyB1D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEpD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TasksChainError } from "./chain-port.js";
|
|
2
|
+
/** Local diagnostics may cross the CLI/MCP boundary. RPC/server errors never retain their original cause. */
|
|
3
|
+
export declare class TasksValidationError extends Error {
|
|
4
|
+
}
|
|
5
|
+
export declare function safeTasksChainError(cause: unknown, broadcast: boolean, authorizationExposed: boolean, txHash?: `0x${string}`): TasksChainError;
|
|
6
|
+
//# sourceMappingURL=chain-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain-error.d.ts","sourceRoot":"","sources":["../../src/tasks/chain-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,6GAA6G;AAC7G,qBAAa,oBAAqB,SAAQ,KAAK;CAAG;AAElD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,OAAO,EAClB,oBAAoB,EAAE,OAAO,EAC7B,MAAM,CAAC,EAAE,KAAK,MAAM,EAAE,GACrB,eAAe,CA2CjB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { ScopeBinding } from "./scope-bindings.js";
|
|
3
|
+
import type { FrozenDeliveryManifest } from "./delivery-manifest.js";
|
|
4
|
+
import type { CreateEscrowResponse, GetOrderResponse } from "./types.js";
|
|
5
|
+
export type TaskMilestone = Extract<GetOrderResponse["workOrder"], {
|
|
6
|
+
version: "work-order-view-v1";
|
|
7
|
+
}>["milestones"][number];
|
|
8
|
+
export type TasksChainResult = {
|
|
9
|
+
txHash: `0x${string}`;
|
|
10
|
+
operation: CreateEscrowResponse["operation"];
|
|
11
|
+
milestone: Pick<TaskMilestone, "id" | "workOrderId" | "state" | "escrowState" | "resolution">;
|
|
12
|
+
};
|
|
13
|
+
export type TasksEscrowOperation = {
|
|
14
|
+
escrowId: string;
|
|
15
|
+
idempotencyKey: string;
|
|
16
|
+
/** Avoid listing private orders when the caller already knows the parent. */
|
|
17
|
+
orderId?: string;
|
|
18
|
+
counterparty?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The adapter owns local signing, server preparation, exact plan broadcast, transaction
|
|
22
|
+
* recording, receipt waiting, and reconciliation. escrowId is the milestone ID,
|
|
23
|
+
* not the clone address. Use the supplied key to prepare one logical operation.
|
|
24
|
+
* Derive stable keys for subsequent requests from that key, the operation and step.
|
|
25
|
+
* A resolved result contains reconciled state, never a simulated transaction.
|
|
26
|
+
* The adapter validates the active signer against the authenticated party,
|
|
27
|
+
* plan.from, and operation.expectedActor, and checks the frozen funding amount.
|
|
28
|
+
*/
|
|
29
|
+
export interface TasksChain {
|
|
30
|
+
readonly available: boolean;
|
|
31
|
+
readonly signingAddress?: Address;
|
|
32
|
+
/** Resolve the trusted local wallet identity without signing. */
|
|
33
|
+
getSigningAddress?(): Promise<Address>;
|
|
34
|
+
bindScope?(binding: ScopeBinding): Promise<void>;
|
|
35
|
+
createEscrow(input: {
|
|
36
|
+
orderId: string;
|
|
37
|
+
idempotencyKey: string;
|
|
38
|
+
counterparty?: string;
|
|
39
|
+
}): Promise<TasksChainResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Sign EIP-3009 ReceiveWithAuthorization locally BEFORE preparing funding.
|
|
42
|
+
* Once the authorization may have left the machine, failures must retain the
|
|
43
|
+
* spend reservation even if no transaction was broadcast. Only a typed error
|
|
44
|
+
* with broadcast:false and authorizationExposed:false permits rollback.
|
|
45
|
+
*/
|
|
46
|
+
fund(input: TasksEscrowOperation & {
|
|
47
|
+
grossBaseUnits: bigint;
|
|
48
|
+
}): Promise<TasksChainResult>;
|
|
49
|
+
/** Prepare with manifest file IDs and exact note; verify the server's hash before broadcasting. */
|
|
50
|
+
deliver(input: TasksEscrowOperation & {
|
|
51
|
+
manifest: FrozenDeliveryManifest;
|
|
52
|
+
note: string;
|
|
53
|
+
}): Promise<TasksChainResult>;
|
|
54
|
+
release(input: TasksEscrowOperation): Promise<TasksChainResult>;
|
|
55
|
+
refund(input: TasksEscrowOperation): Promise<TasksChainResult>;
|
|
56
|
+
disputeFee(input: TasksEscrowOperation): Promise<bigint>;
|
|
57
|
+
dispute(input: TasksEscrowOperation & {
|
|
58
|
+
evidenceHash: `0x${string}`;
|
|
59
|
+
feeBaseUnits?: bigint;
|
|
60
|
+
beforeSign?: () => Promise<void>;
|
|
61
|
+
}): Promise<TasksChainResult>;
|
|
62
|
+
counterEvidence(input: TasksEscrowOperation & {
|
|
63
|
+
evidenceHash: `0x${string}`;
|
|
64
|
+
feeBaseUnits?: bigint;
|
|
65
|
+
beforeSign?: () => Promise<void>;
|
|
66
|
+
}): Promise<TasksChainResult>;
|
|
67
|
+
resolveUnmatched(input: TasksEscrowOperation): Promise<TasksChainResult>;
|
|
68
|
+
/** EIP-191 personal_sign over canonicalJson(scope.signingPayload), passed as a string. */
|
|
69
|
+
signScopeMessage(message: string): Promise<`0x${string}`>;
|
|
70
|
+
}
|
|
71
|
+
/** Adapters must mark ambiguous submission and all post-broadcast failures true. */
|
|
72
|
+
export declare class TasksChainError extends Error {
|
|
73
|
+
readonly broadcast: boolean;
|
|
74
|
+
/** False only when the adapter proves no redeemable funding authorization left the machine. */
|
|
75
|
+
readonly authorizationExposed: boolean;
|
|
76
|
+
readonly transactionHash?: `0x${string}`;
|
|
77
|
+
constructor(message: string, broadcast: boolean, options?: ErrorOptions & {
|
|
78
|
+
authorizationExposed?: boolean;
|
|
79
|
+
transactionHash?: `0x${string}`;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export declare class TasksChainUnavailableError extends TasksChainError {
|
|
83
|
+
readonly manifestHash?: `0x${string}` | undefined;
|
|
84
|
+
readonly code = "chain_unavailable";
|
|
85
|
+
constructor(manifestHash?: `0x${string}` | undefined);
|
|
86
|
+
}
|
|
87
|
+
export declare const missingTasksChain: TasksChain;
|
|
88
|
+
//# sourceMappingURL=chain-port.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain-port.d.ts","sourceRoot":"","sources":["../../src/tasks/chain-port.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEzE,MAAM,MAAM,aAAa,GAAG,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E,OAAO,EAC3B,OAAO,CAAC,EAAE,YAAY,GAAG;QAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC;QAAC,eAAe,CAAC,EAAE,KAAK,MAAM,EAAE,CAAA;KAAE;CAQ/F;AAED,qBAAa,0BAA2B,SAAQ,eAAe;IAGjD,QAAQ,CAAC,YAAY,CAAC,EAAE,KAAK,MAAM,EAAE;IAFjD,QAAQ,CAAC,IAAI,uBAAuB;gBAEf,YAAY,CAAC,EAAE,KAAK,MAAM,EAAE,YAAA;CAMlD;AAMD,eAAO,MAAM,iBAAiB,EAAE,UAY/B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type Address, type PublicClient } from "viem";
|
|
2
|
+
import { TasksValidationError } from "./chain-error.js";
|
|
3
|
+
import { type TaskMilestone } from "./chain-port.js";
|
|
4
|
+
import type { TasksClient } from "./client.js";
|
|
5
|
+
import { type PlanExpectation } from "./plan-guard.js";
|
|
6
|
+
import type { ScopeBindings } from "./scope-bindings.js";
|
|
7
|
+
import { type TasksDurationOverrides } from "./trusted-deployments.js";
|
|
8
|
+
import type { DeploymentResponse } from "./types.js";
|
|
9
|
+
type Deployment = Extract<DeploymentResponse, {
|
|
10
|
+
configured: true;
|
|
11
|
+
}>;
|
|
12
|
+
export type EscrowVerb = "createEscrow" | "fund" | "deliver" | "release" | "refund" | "dispute" | "counter-evidence" | "resolve-unmatched";
|
|
13
|
+
export type VerifiedContext = PlanExpectation & {
|
|
14
|
+
parties: readonly [Address, Address];
|
|
15
|
+
verb: EscrowVerb;
|
|
16
|
+
offerDeadline?: bigint;
|
|
17
|
+
seller: Address;
|
|
18
|
+
workDurationSeconds: number;
|
|
19
|
+
reviewWindowSeconds: number;
|
|
20
|
+
disputeFee?: bigint;
|
|
21
|
+
nowSeconds?: bigint;
|
|
22
|
+
};
|
|
23
|
+
export declare class TasksPartiesNotBoundError extends TasksValidationError {
|
|
24
|
+
constructor();
|
|
25
|
+
}
|
|
26
|
+
export declare function verifyDeployment(ready: Deployment, rpc: PublicClient, overrides?: Record<string, string>): Promise<Deployment>;
|
|
27
|
+
export declare function verifyScope(client: TasksClient, signer: Address, selected: TaskMilestone, ready: Deployment, verb: EscrowVerb, steps: readonly string[], options?: {
|
|
28
|
+
bindings?: ScopeBindings;
|
|
29
|
+
counterparty?: Address;
|
|
30
|
+
now?: () => Date;
|
|
31
|
+
trustedDurations?: TasksDurationOverrides;
|
|
32
|
+
}): Promise<VerifiedContext>;
|
|
33
|
+
/** Immutable identity is checked even on resumes; live-state eligibility is checked only for a new signature. */
|
|
34
|
+
export declare function verifyClone(rpc: PublicClient, expected: VerifiedContext, checkState: boolean): Promise<void>;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=chain-verification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain-verification.d.ts","sourceRoot":"","sources":["../../src/tasks/chain-verification.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,OAAO,EAEZ,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,KAAK,UAAU,GAAG,OAAO,CAAC,kBAAkB,EAAE;IAAE,UAAU,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AACpE,MAAM,MAAM,UAAU,GAClB,cAAc,GACd,MAAM,GACN,SAAS,GACT,SAAS,GACT,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|
+
import { type TasksChain } from "./chain-port.js";
|
|
3
|
+
import type { ScopeBindings } from "./scope-bindings.js";
|
|
4
|
+
import type { TasksDurationOverrides } from "./trusted-deployments.js";
|
|
5
|
+
import { type TasksClient } from "./client.js";
|
|
6
|
+
import type { PendingTransactions } from "./pending-transactions.js";
|
|
7
|
+
export type TasksChainOptions = {
|
|
8
|
+
client: TasksClient;
|
|
9
|
+
account: LocalAccount;
|
|
10
|
+
rpcFor: (chainId: number) => PublicClient;
|
|
11
|
+
pending: PendingTransactions;
|
|
12
|
+
now?: () => Date;
|
|
13
|
+
sleep?: (milliseconds: number) => Promise<void>;
|
|
14
|
+
randomBytes?: (size: number) => Uint8Array;
|
|
15
|
+
confirmations?: number;
|
|
16
|
+
trustedFactories?: Record<string, string>;
|
|
17
|
+
trustedDurations?: TasksDurationOverrides;
|
|
18
|
+
bindings?: ScopeBindings;
|
|
19
|
+
};
|
|
20
|
+
/** Local signing with durable recovery, using the console's HTTP operation protocol. */
|
|
21
|
+
export declare function createTasksChain(options: TasksChainOptions): TasksChain;
|
|
22
|
+
//# sourceMappingURL=chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../src/tasks/chain.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,YAAY,EACjB,KAAK,YAAY,EAGlB,MAAM,MAAM,CAAC;AAGd,OAAO,EAGL,KAAK,UAAU,EAGhB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEvE,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAIjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAerE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,YAAY,CAAC;IAC1C,OAAO,EAAE,mBAAmB,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,UAAU,CAAC;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,gBAAgB,CAAC,EAAE,sBAAsB,CAAC;IAC1C,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,CAAC;AAcF,wFAAwF;AACxF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,UAAU,CA20BvE"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tasksResponseSchemas } from "./types.js";
|
|
3
|
+
import type { AcceptProposalInput, BoardQuery, CounterEvidenceEscrowInput, ConfigureWebhookInput, CreateOrderInput, CreateUploadInput, DeliverEscrowInput, DisputeEscrowInput, EventsQuery, FeedQuery, FinalizeUploadResponse, FundEscrowInput, ListMessagesQuery, ListOrdersQuery, OperationMutationInput, OperationStepInput, ProposeInput, ProposeScopeInput, SendMessageInput, SignScopeInput, SubmitInput, UploadFileInput } from "./types.js";
|
|
4
|
+
export type TasksClientOptions = {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
token?: string;
|
|
7
|
+
fetch?: typeof fetch;
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
};
|
|
10
|
+
export type TasksRequestOptions = {
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
};
|
|
13
|
+
/** Retain the same key when retrying the same mutation. The client never retries automatically. */
|
|
14
|
+
export type TasksMutationOptions = TasksRequestOptions & {
|
|
15
|
+
idempotencyKey: string;
|
|
16
|
+
};
|
|
17
|
+
export declare class TasksClientError extends Error {
|
|
18
|
+
readonly code: "invalid_input" | "http" | "invalid_response" | "network" | "timeout";
|
|
19
|
+
readonly status?: number | undefined;
|
|
20
|
+
readonly serverCode?: string | undefined;
|
|
21
|
+
/** Raw Retry-After header; only hinted HTTP 409 responses are retryable. */
|
|
22
|
+
readonly retryAfter?: string | undefined;
|
|
23
|
+
constructor(code: "invalid_input" | "http" | "invalid_response" | "network" | "timeout", message: string, status?: number | undefined, serverCode?: string | undefined,
|
|
24
|
+
/** Raw Retry-After header; only hinted HTTP 409 responses are retryable. */
|
|
25
|
+
retryAfter?: string | undefined);
|
|
26
|
+
}
|
|
27
|
+
/** HTTP transport for Tasks; OAuth reads use tasks:read and writes use tasks:write.
|
|
28
|
+
* Signing happens outside this client.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createTasksClient(options: TasksClientOptions): TasksClient;
|
|
31
|
+
type TaskResponse<Method extends keyof typeof tasksResponseSchemas> = z.infer<(typeof tasksResponseSchemas)[Method]>;
|
|
32
|
+
export type TasksClient = {
|
|
33
|
+
/** Public scope is anonymous; the server defaults to private scope.
|
|
34
|
+
*/
|
|
35
|
+
listOrders(input?: ListOrdersQuery, call?: TasksRequestOptions): Promise<TaskResponse<"listOrders">>;
|
|
36
|
+
/** Anonymous reads return the public projection; private reads accept scoped OAuth or a session.
|
|
37
|
+
*/
|
|
38
|
+
getOrder(id: string, call?: TasksRequestOptions): Promise<TaskResponse<"getOrder">>;
|
|
39
|
+
createOrder(input: CreateOrderInput, call: TasksMutationOptions): Promise<TaskResponse<"createOrder">>;
|
|
40
|
+
propose(id: string, input: ProposeInput, call: TasksMutationOptions): Promise<TaskResponse<"propose">>;
|
|
41
|
+
submit(id: string, input: SubmitInput, call: TasksMutationOptions): Promise<TaskResponse<"submit">>;
|
|
42
|
+
events(id: string, input?: EventsQuery, call?: TasksRequestOptions): Promise<TaskResponse<"events">>;
|
|
43
|
+
board(input?: BoardQuery, call?: TasksRequestOptions): Promise<TaskResponse<"board">>;
|
|
44
|
+
feed(input?: FeedQuery, call?: TasksRequestOptions): Promise<TaskResponse<"feed">>;
|
|
45
|
+
publicTask(id: string, call?: TasksRequestOptions): Promise<TaskResponse<"publicTask">>;
|
|
46
|
+
receipt(escrow: string, call?: TasksRequestOptions): Promise<TaskResponse<"receipt">>;
|
|
47
|
+
earn(call?: TasksRequestOptions): Promise<TaskResponse<"earn">>;
|
|
48
|
+
acceptProposal(id: string, input: AcceptProposalInput, call: TasksMutationOptions): Promise<TaskResponse<"acceptProposal">>;
|
|
49
|
+
getScopes(id: string, call?: TasksRequestOptions): Promise<TaskResponse<"getScopes">>;
|
|
50
|
+
proposeScope(id: string, input: ProposeScopeInput, call: TasksMutationOptions): Promise<TaskResponse<"proposeScope">>;
|
|
51
|
+
signScope(scopeId: string, input: SignScopeInput, call: TasksMutationOptions): Promise<TaskResponse<"signScope">>;
|
|
52
|
+
listMessages(id: string, input?: ListMessagesQuery, call?: TasksRequestOptions): Promise<TaskResponse<"listMessages">>;
|
|
53
|
+
sendMessage(id: string, input: SendMessageInput, call: TasksMutationOptions): Promise<TaskResponse<"sendMessage">>;
|
|
54
|
+
createEscrow(id: string, call: TasksMutationOptions): Promise<TaskResponse<"createEscrow">>;
|
|
55
|
+
fundEscrow(id: string, input: FundEscrowInput, call: TasksMutationOptions): Promise<TaskResponse<"fundEscrow">>;
|
|
56
|
+
deliverEscrow(id: string, input: DeliverEscrowInput, call: TasksMutationOptions): Promise<TaskResponse<"deliverEscrow">>;
|
|
57
|
+
releaseEscrow(id: string, call: TasksMutationOptions): Promise<TaskResponse<"releaseEscrow">>;
|
|
58
|
+
refundEscrow(id: string, call: TasksMutationOptions): Promise<TaskResponse<"refundEscrow">>;
|
|
59
|
+
disputeEscrow(id: string, input: DisputeEscrowInput, call: TasksMutationOptions): Promise<TaskResponse<"disputeEscrow">>;
|
|
60
|
+
counterEvidenceEscrow(id: string, input: CounterEvidenceEscrowInput, call: TasksMutationOptions): Promise<TaskResponse<"counterEvidenceEscrow">>;
|
|
61
|
+
resolveUnmatchedEscrow(id: string, call: TasksMutationOptions): Promise<TaskResponse<"resolveUnmatchedEscrow">>;
|
|
62
|
+
chainState(id: string, call?: TasksRequestOptions): Promise<TaskResponse<"chainState">>;
|
|
63
|
+
createUpload(input: CreateUploadInput, call?: TasksRequestOptions): Promise<TaskResponse<"createUpload">>;
|
|
64
|
+
finalizeUpload(id: string, call?: TasksRequestOptions): Promise<TaskResponse<"finalizeUpload">>;
|
|
65
|
+
uploadFile(input: UploadFileInput, call?: TasksRequestOptions): Promise<FinalizeUploadResponse>;
|
|
66
|
+
deployment(call?: TasksRequestOptions): Promise<TaskResponse<"deployment">>;
|
|
67
|
+
recordTransaction(id: string, input: OperationMutationInput, call: TasksMutationOptions): Promise<TaskResponse<"recordTransaction">>;
|
|
68
|
+
reconcileOperation(id: string, input: OperationMutationInput, call: TasksMutationOptions): Promise<TaskResponse<"reconcileOperation">>;
|
|
69
|
+
recoverOperation(id: string, input: OperationStepInput, call: TasksMutationOptions): Promise<TaskResponse<"recoverOperation">>;
|
|
70
|
+
abandonOperation(id: string, input: OperationStepInput, call: TasksMutationOptions): Promise<TaskResponse<"abandonOperation">>;
|
|
71
|
+
finalizeEscrow(id: string, call: TasksMutationOptions): Promise<TaskResponse<"finalizeEscrow">>;
|
|
72
|
+
finalizeOrder(id: string, call: TasksMutationOptions): Promise<TaskResponse<"finalizeOrder">>;
|
|
73
|
+
configureWebhook(id: string, input: ConfigureWebhookInput, call?: TasksRequestOptions): Promise<TaskResponse<"configureWebhook">>;
|
|
74
|
+
};
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/tasks/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MA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,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC;IAC9F,gBAAgB,CACd,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,qBAAqB,EAC5B,IAAI,CAAC,EAAE,mBAAmB,GACzB,OAAO,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC;CAC9C,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const deliveryManifestSchema: z.ZodObject<{
|
|
3
|
+
files: z.ZodArray<z.ZodObject<{
|
|
4
|
+
fileId: z.ZodUUID;
|
|
5
|
+
fileName: z.ZodString;
|
|
6
|
+
sha256: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
7
|
+
sizeBytes: z.ZodNumber;
|
|
8
|
+
}, z.core.$strict>>;
|
|
9
|
+
noteSha256: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
export type DeliveryManifest = z.infer<typeof deliveryManifestSchema>;
|
|
12
|
+
export type FrozenDeliveryManifest = {
|
|
13
|
+
manifest: DeliveryManifest;
|
|
14
|
+
manifestHash: `0x${string}`;
|
|
15
|
+
};
|
|
16
|
+
export declare function freezeDeliveryManifest(input: unknown): FrozenDeliveryManifest;
|
|
17
|
+
export declare function sha256Hex(bytes: Uint8Array): Promise<string>;
|
|
18
|
+
export declare function prepareDeliveryManifest(files: Array<{
|
|
19
|
+
fileId: string;
|
|
20
|
+
fileName: string;
|
|
21
|
+
sha256: string;
|
|
22
|
+
sizeBytes: number;
|
|
23
|
+
}>, note: string): Promise<FrozenDeliveryManifest>;
|
|
24
|
+
//# sourceMappingURL=delivery-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery-manifest.d.ts","sourceRoot":"","sources":["../../src/tasks/delivery-manifest.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,sBAAsB;;;;;;;;kBAsB/B,CAAC;AAEL,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,YAAY,EAAE,KAAK,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB,CAU7E;AAED,wBAAsB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAElE;AAED,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,KAAK,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,EACrF,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,sBAAsB,CAAC,CAMjC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function disputeFeeBaseUnits(amount: bigint): bigint;
|
|
2
|
+
/** Separate durable reservation identities for funding and the two fee actions. */
|
|
3
|
+
export declare function taskFeeReservationKey(milestoneId: string, action: string): string;
|
|
4
|
+
//# sourceMappingURL=dispute-fee.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispute-fee.d.ts","sourceRoot":"","sources":["../../src/tasks/dispute-fee.ts"],"names":[],"mappings":"AAGA,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAI1D;AAED,mFAAmF;AACnF,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CASjF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export * from "./canonical-json.js";
|
|
2
|
+
export * from "./scope-terms.js";
|
|
3
|
+
export * from "./scope-bindings.js";
|
|
4
|
+
export * from "./delivery-manifest.js";
|
|
5
|
+
export * from "./verbs.js";
|
|
6
|
+
export * from "./chain-port.js";
|
|
7
|
+
export * from "./chain.js";
|
|
8
|
+
export * from "./rpc.js";
|
|
9
|
+
export * from "./pending-transactions.js";
|
|
10
|
+
export * from "./money.js";
|
|
11
|
+
export * from "./actions.js";
|
|
12
|
+
export * from "./operations.js";
|
|
13
|
+
export * from "./operation-support.js";
|
|
14
|
+
export { createTasksClient, TasksClientError } from "./client.js";
|
|
15
|
+
export type { TasksClient, TasksClientOptions, TasksRequestOptions, TasksMutationOptions, } from "./client.js";
|
|
16
|
+
export { boardNumbersSchema, boardQuerySchema, boardResponseSchema, earnResponseSchema, eventsQuerySchema, eventsResponseSchema, operationMutationInputSchema, operationStepInputSchema, configureWebhookInputSchema, createOrderInputSchema, feedQuerySchema, feedResponseSchema, feedRowSchema, partyBadgeSchema, publicReceiptSchema, publicTaskCardSchema, publicTaskDetailSchema, submissionProofSchema, submitInputSchema, } from "./types.js";
|
|
17
|
+
export type * from "./types.js";
|
|
18
|
+
export * from "./trusted-deployments.js";
|
|
19
|
+
export { safeTasksChainError } from "./chain-error.js";
|
|
20
|
+
export { TasksPartiesNotBoundError } from "./chain-verification.js";
|
|
21
|
+
export * from "./dispute-fee.js";
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tasks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EACV,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,4BAA4B,EAC5B,wBAAwB,EACxB,2BAA2B,EAC3B,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,mBAAmB,YAAY,CAAC;AAEhC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type TaskMoneyAmount = {
|
|
2
|
+
usd: string;
|
|
3
|
+
baseUnits: string;
|
|
4
|
+
};
|
|
5
|
+
export type TaskMoney = {
|
|
6
|
+
gross: TaskMoneyAmount;
|
|
7
|
+
fee: TaskMoneyAmount | null;
|
|
8
|
+
net: TaskMoneyAmount | null;
|
|
9
|
+
feeBp: number | null;
|
|
10
|
+
line: string;
|
|
11
|
+
};
|
|
12
|
+
/** Exact USDC decimal strings with at least two decimal places; no cent rounding. */
|
|
13
|
+
export declare function formatBaseUnitsUsd(baseUnits: bigint | string): string;
|
|
14
|
+
export declare function parseUsdToBaseUnits(text: string): bigint;
|
|
15
|
+
export declare function parseFeeBp(deploymentOrReadiness: unknown): number | null;
|
|
16
|
+
export declare function taskMoney(grossBaseUnits: bigint | string, feeBp: number | null): TaskMoney;
|
|
17
|
+
//# sourceMappingURL=money.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"money.d.ts","sourceRoot":"","sources":["../../src/tasks/money.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,eAAe,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AACjE,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,eAAe,CAAC;IACvB,GAAG,EAAE,eAAe,GAAG,IAAI,CAAC;IAC5B,GAAG,EAAE,eAAe,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,qFAAqF;AACrF,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAGrE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQxD;AAED,wBAAgB,UAAU,CAAC,qBAAqB,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAYxE;AAED,wBAAgB,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAkB1F"}
|