@avaprotocol/sdk-js 2.17.0 → 4.0.0-dev.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 (140) hide show
  1. package/dist/index.d.ts +1 -370
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +737 -22356
  4. package/dist/index.mjs +699 -22386
  5. package/dist/v4/auth.d.ts +54 -0
  6. package/dist/v4/auth.d.ts.map +1 -0
  7. package/dist/v4/auth.js +70 -0
  8. package/dist/v4/builders/nodes.d.ts +103 -0
  9. package/dist/v4/builders/nodes.d.ts.map +1 -0
  10. package/dist/v4/builders/nodes.js +132 -0
  11. package/dist/v4/builders/triggers.d.ts +66 -0
  12. package/dist/v4/builders/triggers.d.ts.map +1 -0
  13. package/dist/v4/builders/triggers.js +74 -0
  14. package/dist/v4/chains.d.ts +16 -0
  15. package/dist/v4/chains.d.ts.map +1 -0
  16. package/dist/v4/chains.js +23 -0
  17. package/dist/v4/client.d.ts +60 -0
  18. package/dist/v4/client.d.ts.map +1 -0
  19. package/dist/v4/client.js +53 -0
  20. package/dist/v4/index.d.ts +18 -0
  21. package/dist/v4/index.d.ts.map +1 -0
  22. package/dist/v4/index.js +23 -0
  23. package/dist/v4/internal/errors.d.ts +36 -0
  24. package/dist/v4/internal/errors.d.ts.map +1 -0
  25. package/dist/v4/internal/errors.js +32 -0
  26. package/dist/v4/internal/transport.d.ts +64 -0
  27. package/dist/v4/internal/transport.d.ts.map +1 -0
  28. package/dist/v4/internal/transport.js +133 -0
  29. package/dist/v4/resources/auth.d.ts +39 -0
  30. package/dist/v4/resources/auth.d.ts.map +1 -0
  31. package/dist/v4/resources/auth.js +53 -0
  32. package/dist/v4/resources/executions.d.ts +68 -0
  33. package/dist/v4/resources/executions.d.ts.map +1 -0
  34. package/dist/v4/resources/executions.js +126 -0
  35. package/dist/v4/resources/health.d.ts +9 -0
  36. package/dist/v4/resources/health.d.ts.map +1 -0
  37. package/dist/v4/resources/health.js +9 -0
  38. package/dist/v4/resources/nodes.d.ts +9 -0
  39. package/dist/v4/resources/nodes.d.ts.map +1 -0
  40. package/dist/v4/resources/nodes.js +13 -0
  41. package/dist/v4/resources/operators.d.ts +9 -0
  42. package/dist/v4/resources/operators.d.ts.map +1 -0
  43. package/dist/v4/resources/operators.js +9 -0
  44. package/dist/v4/resources/secrets.d.ts +24 -0
  45. package/dist/v4/resources/secrets.d.ts.map +1 -0
  46. package/dist/v4/resources/secrets.js +28 -0
  47. package/dist/v4/resources/tokens.d.ts +16 -0
  48. package/dist/v4/resources/tokens.d.ts.map +1 -0
  49. package/dist/v4/resources/tokens.js +17 -0
  50. package/dist/v4/resources/triggers.d.ts +9 -0
  51. package/dist/v4/resources/triggers.d.ts.map +1 -0
  52. package/dist/v4/resources/triggers.js +13 -0
  53. package/dist/v4/resources/wallets.d.ts +25 -0
  54. package/dist/v4/resources/wallets.d.ts.map +1 -0
  55. package/dist/v4/resources/wallets.js +45 -0
  56. package/dist/v4/resources/workflows.d.ts +54 -0
  57. package/dist/v4/resources/workflows.d.ts.map +1 -0
  58. package/dist/v4/resources/workflows.js +81 -0
  59. package/package.json +4 -12
  60. package/dist/auth.d.ts +0 -2
  61. package/dist/auth.d.ts.map +0 -1
  62. package/dist/auth.js +0 -10
  63. package/dist/config.d.ts +0 -9
  64. package/dist/config.d.ts.map +0 -1
  65. package/dist/config.js +0 -19
  66. package/dist/models/edge.d.ts +0 -12
  67. package/dist/models/edge.d.ts.map +0 -1
  68. package/dist/models/edge.js +0 -19
  69. package/dist/models/execution.d.ts +0 -30
  70. package/dist/models/execution.d.ts.map +0 -1
  71. package/dist/models/execution.js +0 -100
  72. package/dist/models/node/balance.d.ts +0 -17
  73. package/dist/models/node/balance.d.ts.map +0 -1
  74. package/dist/models/node/balance.js +0 -78
  75. package/dist/models/node/branch.d.ts +0 -11
  76. package/dist/models/node/branch.d.ts.map +0 -1
  77. package/dist/models/node/branch.js +0 -63
  78. package/dist/models/node/contractRead.d.ts +0 -17
  79. package/dist/models/node/contractRead.d.ts.map +0 -1
  80. package/dist/models/node/contractRead.js +0 -91
  81. package/dist/models/node/contractWrite.d.ts +0 -17
  82. package/dist/models/node/contractWrite.d.ts.map +0 -1
  83. package/dist/models/node/contractWrite.js +0 -102
  84. package/dist/models/node/customCode.d.ts +0 -20
  85. package/dist/models/node/customCode.d.ts.map +0 -1
  86. package/dist/models/node/customCode.js +0 -74
  87. package/dist/models/node/ethTransfer.d.ts +0 -20
  88. package/dist/models/node/ethTransfer.d.ts.map +0 -1
  89. package/dist/models/node/ethTransfer.js +0 -58
  90. package/dist/models/node/factory.d.ts +0 -24
  91. package/dist/models/node/factory.d.ts.map +0 -1
  92. package/dist/models/node/factory.js +0 -108
  93. package/dist/models/node/filter.d.ts +0 -11
  94. package/dist/models/node/filter.d.ts.map +0 -1
  95. package/dist/models/node/filter.js +0 -57
  96. package/dist/models/node/graphqlQuery.d.ts +0 -21
  97. package/dist/models/node/graphqlQuery.d.ts.map +0 -1
  98. package/dist/models/node/graphqlQuery.js +0 -74
  99. package/dist/models/node/interface.d.ts +0 -20
  100. package/dist/models/node/interface.d.ts.map +0 -1
  101. package/dist/models/node/interface.js +0 -58
  102. package/dist/models/node/loop.d.ts +0 -15
  103. package/dist/models/node/loop.d.ts.map +0 -1
  104. package/dist/models/node/loop.js +0 -235
  105. package/dist/models/node/restApi.d.ts +0 -23
  106. package/dist/models/node/restApi.d.ts.map +0 -1
  107. package/dist/models/node/restApi.js +0 -84
  108. package/dist/models/secret.d.ts +0 -16
  109. package/dist/models/secret.d.ts.map +0 -1
  110. package/dist/models/secret.js +0 -28
  111. package/dist/models/step.d.ts +0 -33
  112. package/dist/models/step.d.ts.map +0 -1
  113. package/dist/models/step.js +0 -287
  114. package/dist/models/trigger/block.d.ts +0 -21
  115. package/dist/models/trigger/block.d.ts.map +0 -1
  116. package/dist/models/trigger/block.js +0 -81
  117. package/dist/models/trigger/cron.d.ts +0 -23
  118. package/dist/models/trigger/cron.d.ts.map +0 -1
  119. package/dist/models/trigger/cron.js +0 -77
  120. package/dist/models/trigger/event.d.ts +0 -22
  121. package/dist/models/trigger/event.d.ts.map +0 -1
  122. package/dist/models/trigger/event.js +0 -244
  123. package/dist/models/trigger/factory.d.ts +0 -27
  124. package/dist/models/trigger/factory.d.ts.map +0 -1
  125. package/dist/models/trigger/factory.js +0 -73
  126. package/dist/models/trigger/fixedTime.d.ts +0 -23
  127. package/dist/models/trigger/fixedTime.d.ts.map +0 -1
  128. package/dist/models/trigger/fixedTime.js +0 -69
  129. package/dist/models/trigger/interface.d.ts +0 -19
  130. package/dist/models/trigger/interface.d.ts.map +0 -1
  131. package/dist/models/trigger/interface.js +0 -35
  132. package/dist/models/trigger/manual.d.ts +0 -16
  133. package/dist/models/trigger/manual.d.ts.map +0 -1
  134. package/dist/models/trigger/manual.js +0 -117
  135. package/dist/models/workflow.d.ts +0 -53
  136. package/dist/models/workflow.d.ts.map +0 -1
  137. package/dist/models/workflow.js +0 -219
  138. package/dist/utils.d.ts +0 -82
  139. package/dist/utils.d.ts.map +0 -1
  140. package/dist/utils.js +0 -286
@@ -0,0 +1,126 @@
1
+ export class ExecutionsResource {
2
+ constructor(transport) {
3
+ this.transport = transport;
4
+ }
5
+ /** GET /executions */
6
+ list(params) {
7
+ return this.transport.request({
8
+ path: "/executions",
9
+ query: params,
10
+ });
11
+ }
12
+ /** GET /workflows/{id}/executions — convenience nested form. */
13
+ listForWorkflow(workflowId, params) {
14
+ return this.transport.request({
15
+ path: `/workflows/${encodeURIComponent(workflowId)}/executions`,
16
+ query: params,
17
+ });
18
+ }
19
+ /** GET /executions/{id}?workflowId=... */
20
+ retrieve(id, params) {
21
+ return this.transport.request({
22
+ path: `/executions/${encodeURIComponent(id)}`,
23
+ query: { workflowId: params.workflowId },
24
+ });
25
+ }
26
+ /** GET /executions/{id}:getStatus?workflowId=... */
27
+ getStatus(id, params) {
28
+ return this.transport.request({
29
+ path: `/executions/${encodeURIComponent(id)}:getStatus`,
30
+ query: { workflowId: params.workflowId },
31
+ });
32
+ }
33
+ /** GET /executions:count */
34
+ count(params) {
35
+ return this.transport.request({
36
+ path: "/executions:count",
37
+ query: params,
38
+ });
39
+ }
40
+ /** GET /executions:stats */
41
+ stats(params) {
42
+ return this.transport.request({
43
+ path: "/executions:stats",
44
+ query: params,
45
+ });
46
+ }
47
+ /**
48
+ * GET /executions/{id}:stream — yields one `ExecutionStatusSummary`
49
+ * per status change. The stream closes on terminal status, when
50
+ * `signal` aborts, or when the connection drops. Implementation
51
+ * uses fetch streaming + a minimal SSE parser so it works in Node
52
+ * 20+ and browsers without an external EventSource polyfill.
53
+ */
54
+ async *stream(id, params) {
55
+ const response = await this.transport.stream({
56
+ path: `/executions/${encodeURIComponent(id)}:stream`,
57
+ query: { workflowId: params.workflowId, interval: params.interval },
58
+ headers: { Accept: "text/event-stream" },
59
+ signal: params.signal,
60
+ // SSE streams are long-lived — disable the default per-request
61
+ // timeout so we don't kill the stream after 30s. The caller's
62
+ // signal is the right cancellation channel.
63
+ timeoutMs: 0,
64
+ });
65
+ if (!response.body) {
66
+ throw new Error("SSE response has no body");
67
+ }
68
+ const reader = response.body.getReader();
69
+ const decoder = new TextDecoder();
70
+ let buffer = "";
71
+ try {
72
+ while (true) {
73
+ const { value, done } = await reader.read();
74
+ if (done)
75
+ return;
76
+ buffer += decoder.decode(value, { stream: true });
77
+ // SSE frames are separated by a blank line.
78
+ let idx = buffer.indexOf("\n\n");
79
+ while (idx !== -1) {
80
+ const frame = buffer.slice(0, idx);
81
+ buffer = buffer.slice(idx + 2);
82
+ const data = parseSSEData(frame);
83
+ if (data !== null) {
84
+ yield JSON.parse(data);
85
+ }
86
+ idx = buffer.indexOf("\n\n");
87
+ }
88
+ }
89
+ }
90
+ finally {
91
+ reader.releaseLock();
92
+ }
93
+ }
94
+ /**
95
+ * Poll-and-wait helper — yields the final ExecutionStatusSummary
96
+ * once the execution reaches a terminal status. Use `stream()`
97
+ * when you want every intermediate status update.
98
+ */
99
+ async waitForTerminal(id, params) {
100
+ let last;
101
+ for await (const event of this.stream(id, params)) {
102
+ last = event;
103
+ if (event.status === "success" || event.status === "failed" || event.status === "error") {
104
+ return event;
105
+ }
106
+ }
107
+ if (!last) {
108
+ throw new Error(`execution ${id} stream ended without a status event`);
109
+ }
110
+ return last;
111
+ }
112
+ }
113
+ /**
114
+ * Extract the `data:` payload from one SSE frame. Returns null when
115
+ * the frame is a heartbeat / comment / lacks a data line.
116
+ */
117
+ function parseSSEData(frame) {
118
+ const lines = frame.split("\n");
119
+ const data = [];
120
+ for (const line of lines) {
121
+ if (line.startsWith("data:")) {
122
+ data.push(line.slice(5).trimStart());
123
+ }
124
+ }
125
+ return data.length === 0 ? null : data.join("\n");
126
+ }
@@ -0,0 +1,9 @@
1
+ import type { v4 } from "@avaprotocol/types";
2
+ import { Transport } from "../internal/transport";
3
+ /** `client.health.check()` — liveness probe; no auth required. */
4
+ export declare class HealthResource {
5
+ private readonly transport;
6
+ constructor(transport: Transport);
7
+ check(): Promise<v4.HealthStatus>;
8
+ }
9
+ //# sourceMappingURL=health.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../src/v4/resources/health.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,kEAAkE;AAClE,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEjD,KAAK,IAAI,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC;CAGlC"}
@@ -0,0 +1,9 @@
1
+ /** `client.health.check()` — liveness probe; no auth required. */
2
+ export class HealthResource {
3
+ constructor(transport) {
4
+ this.transport = transport;
5
+ }
6
+ check() {
7
+ return this.transport.request({ path: "/health" });
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ import type { v4 } from "@avaprotocol/types";
2
+ import { Transport } from "../internal/transport";
3
+ export declare class NodesResource {
4
+ private readonly transport;
5
+ constructor(transport: Transport);
6
+ /** POST /nodes:run — execute a single node against inline input. */
7
+ run(req: v4.RunNodeRequest): Promise<v4.RunNodeResponse>;
8
+ }
9
+ //# sourceMappingURL=nodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../../src/v4/resources/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEjD,oEAAoE;IACpE,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,cAAc,GAAG,OAAO,CAAC,EAAE,CAAC,eAAe,CAAC;CAOzD"}
@@ -0,0 +1,13 @@
1
+ export class NodesResource {
2
+ constructor(transport) {
3
+ this.transport = transport;
4
+ }
5
+ /** POST /nodes:run — execute a single node against inline input. */
6
+ run(req) {
7
+ return this.transport.request({
8
+ path: "/nodes:run",
9
+ method: "POST",
10
+ body: req,
11
+ });
12
+ }
13
+ }
@@ -0,0 +1,9 @@
1
+ import type { v4 } from "@avaprotocol/types";
2
+ import { Transport } from "../internal/transport";
3
+ export declare class OperatorsResource {
4
+ private readonly transport;
5
+ constructor(transport: Transport);
6
+ /** GET /operators — connected operators + capabilities. */
7
+ list(): Promise<v4.OperatorList>;
8
+ }
9
+ //# sourceMappingURL=operators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operators.d.ts","sourceRoot":"","sources":["../../../src/v4/resources/operators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEjD,2DAA2D;IAC3D,IAAI,IAAI,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC;CAGjC"}
@@ -0,0 +1,9 @@
1
+ export class OperatorsResource {
2
+ constructor(transport) {
3
+ this.transport = transport;
4
+ }
5
+ /** GET /operators — connected operators + capabilities. */
6
+ list() {
7
+ return this.transport.request({ path: "/operators" });
8
+ }
9
+ }
@@ -0,0 +1,24 @@
1
+ import type { v4 } from "@avaprotocol/types";
2
+ import { Transport } from "../internal/transport";
3
+ export interface ListSecretsParams {
4
+ workflowId?: string;
5
+ orgId?: string;
6
+ before?: string;
7
+ after?: string;
8
+ limit?: number;
9
+ }
10
+ export interface DeleteSecretParams {
11
+ workflowId?: string;
12
+ orgId?: string;
13
+ }
14
+ export declare class SecretsResource {
15
+ private readonly transport;
16
+ constructor(transport: Transport);
17
+ /** GET /secrets — metadata only; values are write-only. */
18
+ list(params?: ListSecretsParams): Promise<v4.SecretList>;
19
+ /** PUT /secrets/{name} — idempotent create-or-replace. */
20
+ put(name: string, body: v4.PutSecretRequest): Promise<void>;
21
+ /** DELETE /secrets/{name} */
22
+ delete(name: string, params?: DeleteSecretParams): Promise<void>;
23
+ }
24
+ //# sourceMappingURL=secrets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../../src/v4/resources/secrets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEjD,2DAA2D;IAC3D,IAAI,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC;IAOxD,0DAA0D;IAC1D,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ3D,6BAA6B;IAC7B,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CAOjE"}
@@ -0,0 +1,28 @@
1
+ export class SecretsResource {
2
+ constructor(transport) {
3
+ this.transport = transport;
4
+ }
5
+ /** GET /secrets — metadata only; values are write-only. */
6
+ list(params) {
7
+ return this.transport.request({
8
+ path: "/secrets",
9
+ query: params,
10
+ });
11
+ }
12
+ /** PUT /secrets/{name} — idempotent create-or-replace. */
13
+ put(name, body) {
14
+ return this.transport.request({
15
+ path: `/secrets/${encodeURIComponent(name)}`,
16
+ method: "PUT",
17
+ body,
18
+ });
19
+ }
20
+ /** DELETE /secrets/{name} */
21
+ delete(name, params) {
22
+ return this.transport.request({
23
+ path: `/secrets/${encodeURIComponent(name)}`,
24
+ method: "DELETE",
25
+ query: params,
26
+ });
27
+ }
28
+ }
@@ -0,0 +1,16 @@
1
+ import type { v4 } from "@avaprotocol/types";
2
+ import { Transport } from "../internal/transport";
3
+ export declare class TokensResource {
4
+ private readonly transport;
5
+ constructor(transport: Transport);
6
+ /**
7
+ * GET /tokens/{address} — returns `{ found: false }` (not 404)
8
+ * when the token is not in the aggregator's whitelist and the
9
+ * on-chain fallback fails. Partial info (the address) is still
10
+ * useful to callers.
11
+ */
12
+ retrieve(address: string, opts?: {
13
+ chainId?: number;
14
+ }): Promise<v4.TokenMetadataResponse>;
15
+ }
16
+ //# sourceMappingURL=tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/v4/resources/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEjD;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,EAAE,CAAC,qBAAqB,CAAC;CAM1F"}
@@ -0,0 +1,17 @@
1
+ export class TokensResource {
2
+ constructor(transport) {
3
+ this.transport = transport;
4
+ }
5
+ /**
6
+ * GET /tokens/{address} — returns `{ found: false }` (not 404)
7
+ * when the token is not in the aggregator's whitelist and the
8
+ * on-chain fallback fails. Partial info (the address) is still
9
+ * useful to callers.
10
+ */
11
+ retrieve(address, opts) {
12
+ return this.transport.request({
13
+ path: `/tokens/${encodeURIComponent(address)}`,
14
+ query: opts,
15
+ });
16
+ }
17
+ }
@@ -0,0 +1,9 @@
1
+ import type { v4 } from "@avaprotocol/types";
2
+ import { Transport } from "../internal/transport";
3
+ export declare class TriggersResource {
4
+ private readonly transport;
5
+ constructor(transport: Transport);
6
+ /** POST /triggers:run — evaluate a trigger config against inline input. */
7
+ run(req: v4.RunTriggerRequest): Promise<v4.RunTriggerResponse>;
8
+ }
9
+ //# sourceMappingURL=triggers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../../src/v4/resources/triggers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEjD,2EAA2E;IAC3E,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,iBAAiB,GAAG,OAAO,CAAC,EAAE,CAAC,kBAAkB,CAAC;CAO/D"}
@@ -0,0 +1,13 @@
1
+ export class TriggersResource {
2
+ constructor(transport) {
3
+ this.transport = transport;
4
+ }
5
+ /** POST /triggers:run — evaluate a trigger config against inline input. */
6
+ run(req) {
7
+ return this.transport.request({
8
+ path: "/triggers:run",
9
+ method: "POST",
10
+ body: req,
11
+ });
12
+ }
13
+ }
@@ -0,0 +1,25 @@
1
+ import type { v4 } from "@avaprotocol/types";
2
+ import { Transport } from "../internal/transport";
3
+ export declare class WalletsResource {
4
+ private readonly transport;
5
+ constructor(transport: Transport);
6
+ /** GET /wallets */
7
+ list(): Promise<v4.WalletList>;
8
+ /**
9
+ * POST /wallets — idempotent "ensure exists". Derives the CREATE2
10
+ * address from (owner, salt, factory) and persists the record.
11
+ */
12
+ create(req: v4.CreateWalletRequest): Promise<v4.Wallet>;
13
+ /**
14
+ * PATCH /wallets/{address} — partial update. Today the only
15
+ * mutable field is `isHidden`.
16
+ */
17
+ update(address: string, body: {
18
+ isHidden?: boolean;
19
+ }): Promise<v4.Wallet>;
20
+ /** POST /wallets/{address}:withdraw — UserOp-driven withdraw. */
21
+ withdraw(address: string, req: v4.WithdrawRequest): Promise<v4.WithdrawResponse>;
22
+ /** GET /wallets/{address}:getNonce */
23
+ getNonce(address: string): Promise<v4.NonceResponse>;
24
+ }
25
+ //# sourceMappingURL=wallets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../../../src/v4/resources/wallets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEjD,mBAAmB;IACnB,IAAI,IAAI,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC;IAI9B;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,mBAAmB,GAAG,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC;IAQvD;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC;IAQzE,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,eAAe,GAAG,OAAO,CAAC,EAAE,CAAC,gBAAgB,CAAC;IAQhF,sCAAsC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC,aAAa,CAAC;CAKrD"}
@@ -0,0 +1,45 @@
1
+ export class WalletsResource {
2
+ constructor(transport) {
3
+ this.transport = transport;
4
+ }
5
+ /** GET /wallets */
6
+ list() {
7
+ return this.transport.request({ path: "/wallets" });
8
+ }
9
+ /**
10
+ * POST /wallets — idempotent "ensure exists". Derives the CREATE2
11
+ * address from (owner, salt, factory) and persists the record.
12
+ */
13
+ create(req) {
14
+ return this.transport.request({
15
+ path: "/wallets",
16
+ method: "POST",
17
+ body: req,
18
+ });
19
+ }
20
+ /**
21
+ * PATCH /wallets/{address} — partial update. Today the only
22
+ * mutable field is `isHidden`.
23
+ */
24
+ update(address, body) {
25
+ return this.transport.request({
26
+ path: `/wallets/${encodeURIComponent(address)}`,
27
+ method: "PATCH",
28
+ body,
29
+ });
30
+ }
31
+ /** POST /wallets/{address}:withdraw — UserOp-driven withdraw. */
32
+ withdraw(address, req) {
33
+ return this.transport.request({
34
+ path: `/wallets/${encodeURIComponent(address)}:withdraw`,
35
+ method: "POST",
36
+ body: req,
37
+ });
38
+ }
39
+ /** GET /wallets/{address}:getNonce */
40
+ getNonce(address) {
41
+ return this.transport.request({
42
+ path: `/wallets/${encodeURIComponent(address)}:getNonce`,
43
+ });
44
+ }
45
+ }
@@ -0,0 +1,54 @@
1
+ import type { v4 } from "@avaprotocol/types";
2
+ import { Transport } from "../internal/transport";
3
+ /**
4
+ * `client.workflows.*` — REST counterpart to the v3 createWorkflow /
5
+ * getWorkflow / etc. methods. Resource-grouped (Stripe style); the
6
+ * verbs come from the HTTP method, not the resource name.
7
+ *
8
+ * Custom actions follow Google AIP-136 colon-suffix convention:
9
+ * pause(id) -> POST /workflows/{id}:pause
10
+ * simulate(req) -> POST /workflows:simulate
11
+ */
12
+ export interface ListWorkflowsParams {
13
+ /** Filter by smart wallet address. Repeat to OR multiple addresses. */
14
+ smartWalletAddress?: string[];
15
+ /** Filter by status. Repeat to OR multiple statuses. */
16
+ status?: v4.WorkflowStatus[];
17
+ chainId?: number;
18
+ before?: string;
19
+ after?: string;
20
+ limit?: number;
21
+ }
22
+ export interface CountWorkflowsParams {
23
+ smartWalletAddress?: string[];
24
+ status?: v4.WorkflowStatus[];
25
+ chainId?: number;
26
+ }
27
+ export declare class WorkflowsResource {
28
+ private readonly transport;
29
+ constructor(transport: Transport);
30
+ /** POST /workflows */
31
+ create(req: v4.CreateWorkflowRequest): Promise<v4.Workflow>;
32
+ /** GET /workflows */
33
+ list(params?: ListWorkflowsParams): Promise<v4.WorkflowList>;
34
+ /** GET /workflows/{id} */
35
+ retrieve(id: string): Promise<v4.Workflow>;
36
+ /**
37
+ * DELETE /workflows/{id} — cancel is the public verb in v4
38
+ * (Stripe convention) even though the engine removes the record.
39
+ */
40
+ cancel(id: string): Promise<void>;
41
+ /** POST /workflows/{id}:pause */
42
+ pause(id: string): Promise<v4.Workflow>;
43
+ /** POST /workflows/{id}:resume */
44
+ resume(id: string): Promise<v4.Workflow>;
45
+ /** POST /workflows/{id}:trigger */
46
+ trigger(id: string, req: v4.TriggerWorkflowRequest): Promise<v4.TriggerWorkflowResponse>;
47
+ /** POST /workflows:simulate — runs without persisting. */
48
+ simulate(req: v4.SimulateWorkflowRequest): Promise<v4.Execution>;
49
+ /** POST /workflows:estimateFees */
50
+ estimateFees(req: v4.EstimateFeesRequest): Promise<v4.EstimateFeesResponse>;
51
+ /** GET /workflows:count */
52
+ count(params?: CountWorkflowsParams): Promise<v4.WorkflowCount>;
53
+ }
54
+ //# sourceMappingURL=workflows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../../src/v4/resources/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAClC,uEAAuE;IACvE,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,wDAAwD;IACxD,MAAM,CAAC,EAAE,EAAE,CAAC,cAAc,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,MAAM,CAAC,EAAE,EAAE,CAAC,cAAc,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEjD,sBAAsB;IACtB,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,qBAAqB,GAAG,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC;IAQ3D,qBAAqB;IACrB,IAAI,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC;IAO5D,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC;IAM1C;;;OAGG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOjC,iCAAiC;IACjC,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC;IAOvC,kCAAkC;IAClC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC;IAOxC,mCAAmC;IACnC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,sBAAsB,GAAG,OAAO,CAAC,EAAE,CAAC,uBAAuB,CAAC;IAQxF,0DAA0D;IAC1D,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,uBAAuB,GAAG,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC;IAQhE,mCAAmC;IACnC,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,mBAAmB,GAAG,OAAO,CAAC,EAAE,CAAC,oBAAoB,CAAC;IAQ3E,2BAA2B;IAC3B,KAAK,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,EAAE,CAAC,aAAa,CAAC;CAMhE"}
@@ -0,0 +1,81 @@
1
+ export class WorkflowsResource {
2
+ constructor(transport) {
3
+ this.transport = transport;
4
+ }
5
+ /** POST /workflows */
6
+ create(req) {
7
+ return this.transport.request({
8
+ path: "/workflows",
9
+ method: "POST",
10
+ body: req,
11
+ });
12
+ }
13
+ /** GET /workflows */
14
+ list(params) {
15
+ return this.transport.request({
16
+ path: "/workflows",
17
+ query: params,
18
+ });
19
+ }
20
+ /** GET /workflows/{id} */
21
+ retrieve(id) {
22
+ return this.transport.request({
23
+ path: `/workflows/${encodeURIComponent(id)}`,
24
+ });
25
+ }
26
+ /**
27
+ * DELETE /workflows/{id} — cancel is the public verb in v4
28
+ * (Stripe convention) even though the engine removes the record.
29
+ */
30
+ cancel(id) {
31
+ return this.transport.request({
32
+ path: `/workflows/${encodeURIComponent(id)}`,
33
+ method: "DELETE",
34
+ });
35
+ }
36
+ /** POST /workflows/{id}:pause */
37
+ pause(id) {
38
+ return this.transport.request({
39
+ path: `/workflows/${encodeURIComponent(id)}:pause`,
40
+ method: "POST",
41
+ });
42
+ }
43
+ /** POST /workflows/{id}:resume */
44
+ resume(id) {
45
+ return this.transport.request({
46
+ path: `/workflows/${encodeURIComponent(id)}:resume`,
47
+ method: "POST",
48
+ });
49
+ }
50
+ /** POST /workflows/{id}:trigger */
51
+ trigger(id, req) {
52
+ return this.transport.request({
53
+ path: `/workflows/${encodeURIComponent(id)}:trigger`,
54
+ method: "POST",
55
+ body: req,
56
+ });
57
+ }
58
+ /** POST /workflows:simulate — runs without persisting. */
59
+ simulate(req) {
60
+ return this.transport.request({
61
+ path: "/workflows:simulate",
62
+ method: "POST",
63
+ body: req,
64
+ });
65
+ }
66
+ /** POST /workflows:estimateFees */
67
+ estimateFees(req) {
68
+ return this.transport.request({
69
+ path: "/workflows:estimateFees",
70
+ method: "POST",
71
+ body: req,
72
+ });
73
+ }
74
+ /** GET /workflows:count */
75
+ count(params) {
76
+ return this.transport.request({
77
+ path: "/workflows:count",
78
+ query: params,
79
+ });
80
+ }
81
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@avaprotocol/sdk-js",
3
- "version": "2.17.0",
4
- "description": "A JavaScript/TypeScript SDK designed to simplify integration with Ava Protocol's AVS",
3
+ "version": "4.0.0-dev.0",
4
+ "description": "TypeScript SDK for Ava Protocol's AVS REST API (v4). Resource-grouped sub-clients, fetch transport, EIP-191 auth.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
@@ -31,16 +31,8 @@
31
31
  "prepare": "node ../../scripts/prepare-package.js"
32
32
  },
33
33
  "dependencies": {
34
- "@avaprotocol/types": "2.13.0",
35
- "@grpc/grpc-js": "^1.11.3",
36
- "@grpc/proto-loader": "^0.7.13",
34
+ "@avaprotocol/types": "4.0.0-dev.0",
37
35
  "dotenv": "^16.4.5",
38
- "ethers": "^6.13.2",
39
- "google-protobuf": "3.19.4",
40
- "id128": "^1.6.6",
41
- "lodash": "^4.17.21"
42
- },
43
- "devDependencies": {
44
- "@types/google-protobuf": "^3.15.12"
36
+ "ethers": "^6.13.2"
45
37
  }
46
38
  }
package/dist/auth.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const getKeyRequestMessage: (chainId: number, address: string, issuedAt: Date, expiredAt: Date) => string;
2
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,EAAE,SAAS,MAAM,EAAE,UAAU,IAAI,EAAE,WAAW,IAAI,KAAG,MAUxG,CAAA"}
package/dist/auth.js DELETED
@@ -1,10 +0,0 @@
1
- export const getKeyRequestMessage = (chainId, address, issuedAt, expiredAt) => {
2
- return `Please sign the below text for ownership verification.
3
-
4
- URI: https://app.avaprotocol.org
5
- Chain ID: ${chainId}
6
- Version: 1
7
- Issued At: ${issuedAt.toISOString()}
8
- Expire At: ${expiredAt.toISOString()}
9
- Wallet: ${address}`;
10
- };
package/dist/config.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { Environment } from "@avaprotocol/types";
2
- export declare const DEFAULT_JWT_EXPIRATION: number;
3
- interface Config {
4
- AVS_RPC_URL: string;
5
- }
6
- declare const configs: Record<Environment, Config>;
7
- export declare function getRpcEndpoint(env: Environment): string;
8
- export { configs };
9
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,eAAO,MAAM,sBAAsB,QAAe,CAAC;AACnD,UAAU,MAAM;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAGD,QAAA,MAAM,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAUxC,CAAC;AAGF,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,MAAM,CAEvD;AAGD,OAAO,EAAE,OAAO,EAAE,CAAC"}
package/dist/config.js DELETED
@@ -1,19 +0,0 @@
1
- export const DEFAULT_JWT_EXPIRATION = 24 * 60 * 60; // 24 hours
2
- // Define the configs object with typed keys
3
- const configs = {
4
- development: {
5
- AVS_RPC_URL: process.env.AVS_RPC_URL || "localhost:2206",
6
- },
7
- staging: {
8
- AVS_RPC_URL: "aggregator-holesky.avaprotocol.org:2206",
9
- },
10
- production: {
11
- AVS_RPC_URL: "aggregator.avaprotocol.org:2206",
12
- },
13
- };
14
- // Function to get RPC endpoint with improved type safety
15
- export function getRpcEndpoint(env) {
16
- return configs[env].AVS_RPC_URL;
17
- }
18
- // Export the configs only
19
- export { configs };
@@ -1,12 +0,0 @@
1
- import * as avs_pb from "@/grpc_codegen/avs_pb";
2
- import { EdgeProps } from "@avaprotocol/types";
3
- declare class Edge implements EdgeProps {
4
- id: string;
5
- source: string;
6
- target: string;
7
- constructor(edge: EdgeProps);
8
- static fromResponse(edge: avs_pb.TaskEdge): Edge;
9
- toRequest(): avs_pb.TaskEdge;
10
- }
11
- export default Edge;
12
- //# sourceMappingURL=edge.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../src/models/edge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,cAAM,IAAK,YAAW,SAAS;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;gBAEH,IAAI,EAAE,SAAS;IAM3B,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,GAAG,IAAI;IAIhD,SAAS,IAAI,MAAM,CAAC,QAAQ;CAQ7B;AAED,eAAe,IAAI,CAAC"}