arl-protocol-sdk 0.0.0-stage → 0.2.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.
Files changed (40) hide show
  1. package/README.md +79 -2
  2. package/package.json +32 -4
  3. package/protocol/src/canonical.d.ts +7 -0
  4. package/protocol/src/canonical.js +35 -0
  5. package/protocol/src/deployments.d.ts +17 -0
  6. package/protocol/src/deployments.js +24 -0
  7. package/protocol/src/evidence.d.ts +72 -0
  8. package/protocol/src/evidence.js +107 -0
  9. package/protocol/src/index.d.ts +14 -0
  10. package/protocol/src/index.js +9 -0
  11. package/protocol/src/policies.d.ts +5 -0
  12. package/protocol/src/policies.js +56 -0
  13. package/protocol/src/policy.d.ts +65 -0
  14. package/protocol/src/policy.js +202 -0
  15. package/protocol/src/prepare.d.ts +176 -0
  16. package/protocol/src/prepare.js +104 -0
  17. package/protocol/src/proof.d.ts +70 -0
  18. package/protocol/src/proof.js +239 -0
  19. package/protocol/src/reputation.d.ts +47 -0
  20. package/protocol/src/reputation.js +74 -0
  21. package/protocol/src/task.d.ts +121 -0
  22. package/protocol/src/task.js +322 -0
  23. package/sdk/src/abi.d.ts +358 -0
  24. package/sdk/src/abi.js +465 -0
  25. package/sdk/src/acquireArl.d.ts +34 -0
  26. package/sdk/src/acquireArl.js +126 -0
  27. package/sdk/src/escrowProvider.d.ts +73 -0
  28. package/sdk/src/escrowProvider.js +169 -0
  29. package/sdk/src/index.d.ts +9 -0
  30. package/sdk/src/index.js +10 -0
  31. package/sdk/src/jobs.d.ts +278 -0
  32. package/sdk/src/jobs.js +220 -0
  33. package/sdk/src/openTask.d.ts +23 -0
  34. package/sdk/src/openTask.js +116 -0
  35. package/sdk/src/payVerified.d.ts +45 -0
  36. package/sdk/src/payVerified.js +147 -0
  37. package/sdk/src/streaming.d.ts +80 -0
  38. package/sdk/src/streaming.js +229 -0
  39. package/sdk/src/verified.d.ts +229 -0
  40. package/sdk/src/verified.js +220 -0
@@ -0,0 +1,322 @@
1
+ // arl-task/1: the standard description of one agent-to-agent task (spec/arl-task/v0.1.0).
2
+ // A task names the work, how it is accepted, how it is paid and how it is verified. Its
3
+ // keccak256 over canonical JSON is the task hash. The bounds below mirror the deployed contracts
4
+ // (ARLJobs and ARLVerifiedEvaluator on Base Mainnet), so a task that parses can always be opened
5
+ // and configured on chain; nothing here changes what the contracts accept.
6
+ import { canonicalHash } from "./canonical.js";
7
+ export const TASK_VERSION = "arl-task/1";
8
+ export const WORKLOAD_CLASSES = ["reexec", "attested", "model-assisted", "review"];
9
+ export const TIERS = ["fallback", "reexecution", "attested"];
10
+ export const EVIDENCE_KINDS = [
11
+ "result-manifest",
12
+ "logs",
13
+ "artifact",
14
+ "attestation",
15
+ "model-verdict",
16
+ ];
17
+ export const TOKENS = ["ARL", "USDC"];
18
+ /** Bounds of the deployed contracts and of this spec. */
19
+ export const BOUNDS = {
20
+ /** ARLJobs.MIN_DURATION and MAX_DURATION, in hours (5 minutes rounds up to 1 hour). */
21
+ deadlineHours: [1, 8760],
22
+ /** ARLVerifiedEvaluator.MIN_VOTE_WINDOW / MAX_VOTE_WINDOW. */
23
+ voteWindowSeconds: [600, 604_800],
24
+ /** minChallengeWindow on Base Mainnet (86400) / MAX_CHALLENGE_WINDOW. */
25
+ challengeWindowSeconds: [86_400, 2_592_000],
26
+ /** ARLVerifiedEvaluator.MAX_COMMITTEE. */
27
+ committeeSize: [1, 7],
28
+ title: 120,
29
+ description: 4000,
30
+ acceptance: [1, 20],
31
+ rule: 500,
32
+ /** ARLJobs.MAX_DESCRIPTION, in UTF-8 bytes (the on-chain job description). */
33
+ onchainDescription: 1024,
34
+ };
35
+ export class TaskError extends Error {
36
+ name = "TaskError";
37
+ }
38
+ const HASH = /^0x[0-9a-f]{64}$/;
39
+ const DIGITS = /^(0|[1-9][0-9]*)$/;
40
+ const RULE_ID = /^[a-z0-9][a-z0-9-]{0,31}$/;
41
+ const MEDIA_TYPE = /^[a-z0-9][a-z0-9!#$&^_.+-]{0,62}\/[a-z0-9][a-z0-9!#$&^_.+-]{0,62}$/;
42
+ const POLICY = /^arl-policy\/1:[a-z0-9][a-z0-9-]{0,47}$/;
43
+ const URL_SCHEMES = ["https:", "ipfs:"];
44
+ const UINT256_MAX = (1n << 256n) - 1n;
45
+ function isRecord(v) {
46
+ return typeof v === "object" && v !== null && !Array.isArray(v);
47
+ }
48
+ function onlyKeys(v, allowed, what) {
49
+ for (const k of Object.keys(v)) {
50
+ if (!allowed.includes(k))
51
+ throw new TaskError(`${what}: unknown field ${k}`);
52
+ }
53
+ }
54
+ function text(v, max, what, allowEmpty = false) {
55
+ if (typeof v !== "string")
56
+ throw new TaskError(`${what} must be a string`);
57
+ if (!allowEmpty && v.trim().length === 0)
58
+ throw new TaskError(`${what} must not be empty`);
59
+ if (v.length > max)
60
+ throw new TaskError(`${what} must be at most ${max} characters`);
61
+ return v;
62
+ }
63
+ function int(v, [min, max], what) {
64
+ if (typeof v !== "number" || !Number.isSafeInteger(v) || v < min || v > max) {
65
+ throw new TaskError(`${what} must be an integer from ${min} to ${max}`);
66
+ }
67
+ return v;
68
+ }
69
+ function oneOf(v, values, what) {
70
+ if (typeof v !== "string" || !values.includes(v)) {
71
+ throw new TaskError(`${what} must be one of ${values.join(", ")}`);
72
+ }
73
+ return v;
74
+ }
75
+ function amount(v, what, positive) {
76
+ if (typeof v !== "string" || !DIGITS.test(v)) {
77
+ throw new TaskError(`${what} must be a decimal string of base units`);
78
+ }
79
+ const n = BigInt(v);
80
+ if (n > UINT256_MAX)
81
+ throw new TaskError(`${what} exceeds uint256`);
82
+ if (positive && n === 0n)
83
+ throw new TaskError(`${what} must be above zero`);
84
+ return v;
85
+ }
86
+ function url(v, what) {
87
+ const s = text(v, 2048, what);
88
+ let parsed;
89
+ try {
90
+ parsed = new URL(s);
91
+ }
92
+ catch {
93
+ throw new TaskError(`${what} is not a URL`);
94
+ }
95
+ if (!URL_SCHEMES.includes(parsed.protocol))
96
+ throw new TaskError(`${what} must be https or ipfs`);
97
+ return s;
98
+ }
99
+ function workload(v) {
100
+ if (!isRecord(v))
101
+ throw new TaskError("workload must be an object");
102
+ onlyKeys(v, ["class", "spec_uri", "spec_hash"], "workload");
103
+ const cls = oneOf(v.class, WORKLOAD_CLASSES, "workload.class");
104
+ const out = { class: cls };
105
+ if (v.spec_uri !== undefined)
106
+ out.spec_uri = url(v.spec_uri, "workload.spec_uri");
107
+ if (v.spec_hash !== undefined) {
108
+ if (typeof v.spec_hash !== "string" || !HASH.test(v.spec_hash)) {
109
+ throw new TaskError("workload.spec_hash must be 0x and 64 lowercase hex");
110
+ }
111
+ out.spec_hash = v.spec_hash;
112
+ }
113
+ if ((out.spec_uri === undefined) !== (out.spec_hash === undefined)) {
114
+ throw new TaskError("workload.spec_uri and workload.spec_hash go together");
115
+ }
116
+ if (cls === "reexec" && out.spec_hash === undefined) {
117
+ throw new TaskError("a reexec workload needs spec_uri and spec_hash (an arl-reexec/1 spec)");
118
+ }
119
+ return out;
120
+ }
121
+ function acceptance(v) {
122
+ if (!Array.isArray(v))
123
+ throw new TaskError("acceptance must be an array");
124
+ const [min, max] = BOUNDS.acceptance;
125
+ if (v.length < min || v.length > max) {
126
+ throw new TaskError(`acceptance must have ${min} to ${max} rules`);
127
+ }
128
+ const ids = new Set();
129
+ return v.map((r, i) => {
130
+ const what = `acceptance[${i}]`;
131
+ if (!isRecord(r))
132
+ throw new TaskError(`${what} must be an object`);
133
+ onlyKeys(r, ["id", "rule"], what);
134
+ if (typeof r.id !== "string" || !RULE_ID.test(r.id)) {
135
+ throw new TaskError(`${what}.id must be lowercase letters, digits and dashes`);
136
+ }
137
+ if (ids.has(r.id))
138
+ throw new TaskError(`${what}.id repeats ${r.id}`);
139
+ ids.add(r.id);
140
+ return { id: r.id, rule: text(r.rule, BOUNDS.rule, `${what}.rule`) };
141
+ });
142
+ }
143
+ function verification(v, cls) {
144
+ if (!isRecord(v))
145
+ throw new TaskError("verification must be an object");
146
+ onlyKeys(v, [
147
+ "policy",
148
+ "tier",
149
+ "committee_size",
150
+ "threshold",
151
+ "vote_window_seconds",
152
+ "challenge_window_seconds",
153
+ "bond_floor",
154
+ ], "verification");
155
+ if (typeof v.policy !== "string" || !POLICY.test(v.policy)) {
156
+ throw new TaskError("verification.policy must be arl-policy/1:<id>");
157
+ }
158
+ const tier = oneOf(v.tier, TIERS, "verification.tier");
159
+ const n = int(v.committee_size, BOUNDS.committeeSize, "verification.committee_size");
160
+ const t = int(v.threshold, [1, n], "verification.threshold");
161
+ // ARLVerifiedEvaluator._checkThreshold.
162
+ if (tier === "fallback") {
163
+ if (n !== 1 || t !== 1)
164
+ throw new TaskError("a fallback tier is exactly 1 of 1");
165
+ }
166
+ else if (t < 2 || 2 * t <= n) {
167
+ throw new TaskError("a checked tier needs a strict majority of at least 2");
168
+ }
169
+ if (cls === "reexec" && tier === "attested") {
170
+ throw new TaskError("a reexec workload uses the reexecution or fallback tier");
171
+ }
172
+ if (cls === "attested" && tier === "reexecution") {
173
+ throw new TaskError("an attested workload cannot be checked by re-execution");
174
+ }
175
+ return {
176
+ policy: v.policy,
177
+ tier,
178
+ committee_size: n,
179
+ threshold: t,
180
+ vote_window_seconds: int(v.vote_window_seconds, BOUNDS.voteWindowSeconds, "verification.vote_window_seconds"),
181
+ challenge_window_seconds: int(v.challenge_window_seconds, BOUNDS.challengeWindowSeconds, "verification.challenge_window_seconds"),
182
+ bond_floor: amount(v.bond_floor, "verification.bond_floor", true),
183
+ };
184
+ }
185
+ const TASK_KEYS = [
186
+ "version",
187
+ "title",
188
+ "description",
189
+ "workload",
190
+ "acceptance",
191
+ "deliverable",
192
+ "payment",
193
+ "verification",
194
+ "evidence",
195
+ ];
196
+ /** Validates an untrusted task document and returns it typed. Unknown fields are refused. */
197
+ export function parseTask(raw) {
198
+ if (!isRecord(raw))
199
+ throw new TaskError("task must be an object");
200
+ onlyKeys(raw, TASK_KEYS, "task");
201
+ if (raw.version !== TASK_VERSION)
202
+ throw new TaskError(`version must be ${TASK_VERSION}`);
203
+ const wl = workload(raw.workload);
204
+ if (!isRecord(raw.deliverable))
205
+ throw new TaskError("deliverable must be an object");
206
+ onlyKeys(raw.deliverable, ["media_type", "max_bytes"], "deliverable");
207
+ const mt = raw.deliverable.media_type;
208
+ if (typeof mt !== "string" || !MEDIA_TYPE.test(mt)) {
209
+ throw new TaskError("deliverable.media_type must be a lowercase media type");
210
+ }
211
+ const deliverable = { media_type: mt };
212
+ if (raw.deliverable.max_bytes !== undefined) {
213
+ deliverable.max_bytes = int(raw.deliverable.max_bytes, [1, Number.MAX_SAFE_INTEGER], "deliverable.max_bytes");
214
+ }
215
+ if (!isRecord(raw.payment))
216
+ throw new TaskError("payment must be an object");
217
+ onlyKeys(raw.payment, ["token", "budget", "deadline_hours"], "payment");
218
+ const payment = {
219
+ token: oneOf(raw.payment.token, TOKENS, "payment.token"),
220
+ budget: amount(raw.payment.budget, "payment.budget", true),
221
+ deadline_hours: int(raw.payment.deadline_hours, BOUNDS.deadlineHours, "payment.deadline_hours"),
222
+ };
223
+ const ver = verification(raw.verification, wl.class);
224
+ // ARLVerifiedEvaluator._checkWindows: the deadline must leave room for the vote window and two
225
+ // challenge windows.
226
+ const needed = ver.vote_window_seconds + 2 * ver.challenge_window_seconds;
227
+ if (payment.deadline_hours * 3600 < needed) {
228
+ throw new TaskError(`payment.deadline_hours must cover the vote window and two challenge windows (${Math.ceil(needed / 3600)} hours)`);
229
+ }
230
+ if (!Array.isArray(raw.evidence) || raw.evidence.length === 0) {
231
+ throw new TaskError("evidence must be a non-empty array");
232
+ }
233
+ const evidence = raw.evidence.map((e, i) => oneOf(e, EVIDENCE_KINDS, `evidence[${i}]`));
234
+ if (new Set(evidence).size !== evidence.length)
235
+ throw new TaskError("evidence repeats a kind");
236
+ if (wl.class === "reexec" && !evidence.includes("result-manifest")) {
237
+ throw new TaskError("a reexec workload requires result-manifest evidence");
238
+ }
239
+ if (wl.class === "attested" && !evidence.includes("attestation")) {
240
+ throw new TaskError("an attested workload requires attestation evidence");
241
+ }
242
+ if (wl.class === "model-assisted" && !evidence.includes("model-verdict")) {
243
+ throw new TaskError("a model-assisted workload requires model-verdict evidence");
244
+ }
245
+ return {
246
+ version: TASK_VERSION,
247
+ title: text(raw.title, BOUNDS.title, "title"),
248
+ description: text(raw.description, BOUNDS.description, "description", true),
249
+ workload: wl,
250
+ acceptance: acceptance(raw.acceptance),
251
+ deliverable,
252
+ payment,
253
+ verification: ver,
254
+ evidence,
255
+ };
256
+ }
257
+ /** keccak256 of the canonical task: the task hash. */
258
+ export function taskHash(task) {
259
+ return canonicalHash(task);
260
+ }
261
+ /**
262
+ * The value committed as `specHash` in `ARLVerifiedEvaluator.configure`: the workload spec hash
263
+ * for a reexec task (validators re-run that spec, unchanged from arl-reexec/1), otherwise the task
264
+ * hash.
265
+ */
266
+ export function committedSpecHash(task) {
267
+ return task.workload.class === "reexec" && task.workload.spec_hash !== undefined
268
+ ? task.workload.spec_hash
269
+ : taskHash(task);
270
+ }
271
+ /**
272
+ * The on-chain job description: `arl-task:<task hash>` followed by the task's URI, so anyone can
273
+ * fetch the task and check it against its hash. Must fit ARLJobs.MAX_DESCRIPTION.
274
+ */
275
+ export function jobDescription(task, taskUri) {
276
+ const s = `arl-task:${taskHash(task)} ${url(taskUri, "taskUri")}`;
277
+ if (new TextEncoder().encode(s).length > BOUNDS.onchainDescription) {
278
+ throw new TaskError("the task URI is too long for the on-chain description");
279
+ }
280
+ return s;
281
+ }
282
+ const TIER_INDEX = { fallback: 0, reexecution: 1, attested: 2 };
283
+ /**
284
+ * Maps a parsed task to the contract calls (pure: no chain access). `now` is the chain time in
285
+ * seconds. The committee is proposed by the client; it must not contain the client or provider.
286
+ */
287
+ export function onchainTerms(task, opts) {
288
+ const lower = (a) => a.toLowerCase();
289
+ if (opts.committee.length !== task.verification.committee_size) {
290
+ throw new TaskError("committee size differs from the task");
291
+ }
292
+ const seen = new Set();
293
+ for (const m of opts.committee) {
294
+ const k = lower(m);
295
+ if (k === lower(opts.client) || k === lower(opts.provider)) {
296
+ throw new TaskError("the committee must not contain the client or the provider");
297
+ }
298
+ if (seen.has(k))
299
+ throw new TaskError("the committee repeats a member");
300
+ seen.add(k);
301
+ }
302
+ return {
303
+ createJob: {
304
+ provider: opts.provider,
305
+ evaluator: opts.evaluator,
306
+ expiredAt: opts.now + BigInt(task.payment.deadline_hours) * 3600n,
307
+ description: jobDescription(task, opts.taskUri),
308
+ hook: "0x0000000000000000000000000000000000000000",
309
+ },
310
+ configure: {
311
+ tier: TIER_INDEX[task.verification.tier],
312
+ threshold: task.verification.threshold,
313
+ voteWindow: BigInt(task.verification.vote_window_seconds),
314
+ challengeWindow: BigInt(task.verification.challenge_window_seconds),
315
+ bond: BigInt(task.verification.bond_floor),
316
+ providerAgentId: opts.providerAgentId ?? 0n,
317
+ specHash: committedSpecHash(task),
318
+ committee: [...opts.committee],
319
+ },
320
+ budget: BigInt(task.payment.budget),
321
+ };
322
+ }
@@ -0,0 +1,358 @@
1
+ export declare const computePaymentAbi: readonly [{
2
+ readonly type: "constructor";
3
+ readonly inputs: readonly [{
4
+ readonly name: "paymentToken_";
5
+ readonly type: "address";
6
+ readonly internalType: "contract IERC20";
7
+ }];
8
+ readonly stateMutability: "nonpayable";
9
+ }, {
10
+ readonly type: "function";
11
+ readonly name: "MAX_DURATION";
12
+ readonly inputs: readonly [];
13
+ readonly outputs: readonly [{
14
+ readonly name: "";
15
+ readonly type: "uint40";
16
+ readonly internalType: "uint40";
17
+ }];
18
+ readonly stateMutability: "view";
19
+ }, {
20
+ readonly type: "function";
21
+ readonly name: "depositOf";
22
+ readonly inputs: readonly [{
23
+ readonly name: "streamId";
24
+ readonly type: "uint256";
25
+ readonly internalType: "uint256";
26
+ }];
27
+ readonly outputs: readonly [{
28
+ readonly name: "";
29
+ readonly type: "uint256";
30
+ readonly internalType: "uint256";
31
+ }];
32
+ readonly stateMutability: "view";
33
+ }, {
34
+ readonly type: "function";
35
+ readonly name: "getStream";
36
+ readonly inputs: readonly [{
37
+ readonly name: "streamId";
38
+ readonly type: "uint256";
39
+ readonly internalType: "uint256";
40
+ }];
41
+ readonly outputs: readonly [{
42
+ readonly name: "";
43
+ readonly type: "tuple";
44
+ readonly internalType: "struct ComputePayment.Stream";
45
+ readonly components: readonly [{
46
+ readonly name: "sender";
47
+ readonly type: "address";
48
+ readonly internalType: "address";
49
+ }, {
50
+ readonly name: "startTime";
51
+ readonly type: "uint40";
52
+ readonly internalType: "uint40";
53
+ }, {
54
+ readonly name: "endTime";
55
+ readonly type: "uint40";
56
+ readonly internalType: "uint40";
57
+ }, {
58
+ readonly name: "provider";
59
+ readonly type: "address";
60
+ readonly internalType: "address";
61
+ }, {
62
+ readonly name: "stopTime";
63
+ readonly type: "uint40";
64
+ readonly internalType: "uint40";
65
+ }, {
66
+ readonly name: "settled";
67
+ readonly type: "bool";
68
+ readonly internalType: "bool";
69
+ }, {
70
+ readonly name: "ratePerSecond";
71
+ readonly type: "uint128";
72
+ readonly internalType: "uint128";
73
+ }, {
74
+ readonly name: "withdrawn";
75
+ readonly type: "uint128";
76
+ readonly internalType: "uint128";
77
+ }];
78
+ }];
79
+ readonly stateMutability: "view";
80
+ }, {
81
+ readonly type: "function";
82
+ readonly name: "paymentToken";
83
+ readonly inputs: readonly [];
84
+ readonly outputs: readonly [{
85
+ readonly name: "";
86
+ readonly type: "address";
87
+ readonly internalType: "contract IERC20";
88
+ }];
89
+ readonly stateMutability: "view";
90
+ }, {
91
+ readonly type: "function";
92
+ readonly name: "refundableAmountOf";
93
+ readonly inputs: readonly [{
94
+ readonly name: "streamId";
95
+ readonly type: "uint256";
96
+ readonly internalType: "uint256";
97
+ }];
98
+ readonly outputs: readonly [{
99
+ readonly name: "";
100
+ readonly type: "uint256";
101
+ readonly internalType: "uint256";
102
+ }];
103
+ readonly stateMutability: "view";
104
+ }, {
105
+ readonly type: "function";
106
+ readonly name: "stopStream";
107
+ readonly inputs: readonly [{
108
+ readonly name: "streamId";
109
+ readonly type: "uint256";
110
+ readonly internalType: "uint256";
111
+ }];
112
+ readonly outputs: readonly [{
113
+ readonly name: "providerAmount";
114
+ readonly type: "uint256";
115
+ readonly internalType: "uint256";
116
+ }, {
117
+ readonly name: "refundAmount";
118
+ readonly type: "uint256";
119
+ readonly internalType: "uint256";
120
+ }];
121
+ readonly stateMutability: "nonpayable";
122
+ }, {
123
+ readonly type: "function";
124
+ readonly name: "streamCompute";
125
+ readonly inputs: readonly [{
126
+ readonly name: "provider";
127
+ readonly type: "address";
128
+ readonly internalType: "address";
129
+ }, {
130
+ readonly name: "ratePerSecond";
131
+ readonly type: "uint128";
132
+ readonly internalType: "uint128";
133
+ }, {
134
+ readonly name: "maxDuration";
135
+ readonly type: "uint40";
136
+ readonly internalType: "uint40";
137
+ }];
138
+ readonly outputs: readonly [{
139
+ readonly name: "streamId";
140
+ readonly type: "uint256";
141
+ readonly internalType: "uint256";
142
+ }];
143
+ readonly stateMutability: "nonpayable";
144
+ }, {
145
+ readonly type: "function";
146
+ readonly name: "streamCounter";
147
+ readonly inputs: readonly [];
148
+ readonly outputs: readonly [{
149
+ readonly name: "";
150
+ readonly type: "uint256";
151
+ readonly internalType: "uint256";
152
+ }];
153
+ readonly stateMutability: "view";
154
+ }, {
155
+ readonly type: "function";
156
+ readonly name: "streamedAmountOf";
157
+ readonly inputs: readonly [{
158
+ readonly name: "streamId";
159
+ readonly type: "uint256";
160
+ readonly internalType: "uint256";
161
+ }];
162
+ readonly outputs: readonly [{
163
+ readonly name: "";
164
+ readonly type: "uint256";
165
+ readonly internalType: "uint256";
166
+ }];
167
+ readonly stateMutability: "view";
168
+ }, {
169
+ readonly type: "function";
170
+ readonly name: "withdraw";
171
+ readonly inputs: readonly [{
172
+ readonly name: "streamId";
173
+ readonly type: "uint256";
174
+ readonly internalType: "uint256";
175
+ }];
176
+ readonly outputs: readonly [{
177
+ readonly name: "amount";
178
+ readonly type: "uint256";
179
+ readonly internalType: "uint256";
180
+ }];
181
+ readonly stateMutability: "nonpayable";
182
+ }, {
183
+ readonly type: "function";
184
+ readonly name: "withdrawableAmountOf";
185
+ readonly inputs: readonly [{
186
+ readonly name: "streamId";
187
+ readonly type: "uint256";
188
+ readonly internalType: "uint256";
189
+ }];
190
+ readonly outputs: readonly [{
191
+ readonly name: "";
192
+ readonly type: "uint256";
193
+ readonly internalType: "uint256";
194
+ }];
195
+ readonly stateMutability: "view";
196
+ }, {
197
+ readonly type: "event";
198
+ readonly name: "PaymentSettled";
199
+ readonly inputs: readonly [{
200
+ readonly name: "streamId";
201
+ readonly type: "uint256";
202
+ readonly indexed: true;
203
+ readonly internalType: "uint256";
204
+ }, {
205
+ readonly name: "provider";
206
+ readonly type: "address";
207
+ readonly indexed: true;
208
+ readonly internalType: "address";
209
+ }, {
210
+ readonly name: "providerAmount";
211
+ readonly type: "uint256";
212
+ readonly indexed: false;
213
+ readonly internalType: "uint256";
214
+ }, {
215
+ readonly name: "sender";
216
+ readonly type: "address";
217
+ readonly indexed: true;
218
+ readonly internalType: "address";
219
+ }, {
220
+ readonly name: "refundAmount";
221
+ readonly type: "uint256";
222
+ readonly indexed: false;
223
+ readonly internalType: "uint256";
224
+ }];
225
+ readonly anonymous: false;
226
+ }, {
227
+ readonly type: "event";
228
+ readonly name: "StreamStarted";
229
+ readonly inputs: readonly [{
230
+ readonly name: "streamId";
231
+ readonly type: "uint256";
232
+ readonly indexed: true;
233
+ readonly internalType: "uint256";
234
+ }, {
235
+ readonly name: "sender";
236
+ readonly type: "address";
237
+ readonly indexed: true;
238
+ readonly internalType: "address";
239
+ }, {
240
+ readonly name: "provider";
241
+ readonly type: "address";
242
+ readonly indexed: true;
243
+ readonly internalType: "address";
244
+ }, {
245
+ readonly name: "ratePerSecond";
246
+ readonly type: "uint256";
247
+ readonly indexed: false;
248
+ readonly internalType: "uint256";
249
+ }, {
250
+ readonly name: "startTime";
251
+ readonly type: "uint256";
252
+ readonly indexed: false;
253
+ readonly internalType: "uint256";
254
+ }, {
255
+ readonly name: "endTime";
256
+ readonly type: "uint256";
257
+ readonly indexed: false;
258
+ readonly internalType: "uint256";
259
+ }, {
260
+ readonly name: "deposit";
261
+ readonly type: "uint256";
262
+ readonly indexed: false;
263
+ readonly internalType: "uint256";
264
+ }];
265
+ readonly anonymous: false;
266
+ }, {
267
+ readonly type: "event";
268
+ readonly name: "StreamStopped";
269
+ readonly inputs: readonly [{
270
+ readonly name: "streamId";
271
+ readonly type: "uint256";
272
+ readonly indexed: true;
273
+ readonly internalType: "uint256";
274
+ }, {
275
+ readonly name: "stoppedBy";
276
+ readonly type: "address";
277
+ readonly indexed: true;
278
+ readonly internalType: "address";
279
+ }, {
280
+ readonly name: "stopTime";
281
+ readonly type: "uint256";
282
+ readonly indexed: false;
283
+ readonly internalType: "uint256";
284
+ }];
285
+ readonly anonymous: false;
286
+ }, {
287
+ readonly type: "event";
288
+ readonly name: "Withdrawn";
289
+ readonly inputs: readonly [{
290
+ readonly name: "streamId";
291
+ readonly type: "uint256";
292
+ readonly indexed: true;
293
+ readonly internalType: "uint256";
294
+ }, {
295
+ readonly name: "provider";
296
+ readonly type: "address";
297
+ readonly indexed: true;
298
+ readonly internalType: "address";
299
+ }, {
300
+ readonly name: "amount";
301
+ readonly type: "uint256";
302
+ readonly indexed: false;
303
+ readonly internalType: "uint256";
304
+ }];
305
+ readonly anonymous: false;
306
+ }, {
307
+ readonly type: "error";
308
+ readonly name: "AlreadySettled";
309
+ readonly inputs: readonly [];
310
+ }, {
311
+ readonly type: "error";
312
+ readonly name: "DepositTooLarge";
313
+ readonly inputs: readonly [];
314
+ }, {
315
+ readonly type: "error";
316
+ readonly name: "InvalidDuration";
317
+ readonly inputs: readonly [];
318
+ }, {
319
+ readonly type: "error";
320
+ readonly name: "InvalidProvider";
321
+ readonly inputs: readonly [];
322
+ }, {
323
+ readonly type: "error";
324
+ readonly name: "InvalidStream";
325
+ readonly inputs: readonly [];
326
+ }, {
327
+ readonly type: "error";
328
+ readonly name: "NothingToWithdraw";
329
+ readonly inputs: readonly [];
330
+ }, {
331
+ readonly type: "error";
332
+ readonly name: "ReentrancyGuardReentrantCall";
333
+ readonly inputs: readonly [];
334
+ }, {
335
+ readonly type: "error";
336
+ readonly name: "SafeERC20FailedOperation";
337
+ readonly inputs: readonly [{
338
+ readonly name: "token";
339
+ readonly type: "address";
340
+ readonly internalType: "address";
341
+ }];
342
+ }, {
343
+ readonly type: "error";
344
+ readonly name: "Unauthorized";
345
+ readonly inputs: readonly [];
346
+ }, {
347
+ readonly type: "error";
348
+ readonly name: "UnexpectedDeposit";
349
+ readonly inputs: readonly [];
350
+ }, {
351
+ readonly type: "error";
352
+ readonly name: "ZeroAddress";
353
+ readonly inputs: readonly [];
354
+ }, {
355
+ readonly type: "error";
356
+ readonly name: "ZeroRate";
357
+ readonly inputs: readonly [];
358
+ }];