@avaprotocol/sdk-js 2.17.0 → 4.0.0-dev.1

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 +842 -22377
  4. package/dist/index.mjs +806 -22409
  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 +106 -0
  9. package/dist/v4/builders/nodes.d.ts.map +1 -0
  10. package/dist/v4/builders/nodes.js +133 -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 +74 -0
  33. package/dist/v4/resources/executions.d.ts.map +1 -0
  34. package/dist/v4/resources/executions.js +132 -0
  35. package/dist/v4/resources/health.d.ts +19 -0
  36. package/dist/v4/resources/health.d.ts.map +1 -0
  37. package/dist/v4/resources/health.js +19 -0
  38. package/dist/v4/resources/nodes.d.ts +29 -0
  39. package/dist/v4/resources/nodes.d.ts.map +1 -0
  40. package/dist/v4/resources/nodes.js +33 -0
  41. package/dist/v4/resources/operators.d.ts +23 -0
  42. package/dist/v4/resources/operators.d.ts.map +1 -0
  43. package/dist/v4/resources/operators.js +23 -0
  44. package/dist/v4/resources/secrets.d.ts +34 -0
  45. package/dist/v4/resources/secrets.d.ts.map +1 -0
  46. package/dist/v4/resources/secrets.js +38 -0
  47. package/dist/v4/resources/tokens.d.ts +28 -0
  48. package/dist/v4/resources/tokens.d.ts.map +1 -0
  49. package/dist/v4/resources/tokens.js +29 -0
  50. package/dist/v4/resources/triggers.d.ts +29 -0
  51. package/dist/v4/resources/triggers.d.ts.map +1 -0
  52. package/dist/v4/resources/triggers.js +33 -0
  53. package/dist/v4/resources/wallets.d.ts +72 -0
  54. package/dist/v4/resources/wallets.d.ts.map +1 -0
  55. package/dist/v4/resources/wallets.js +92 -0
  56. package/dist/v4/resources/workflows.d.ts +64 -0
  57. package/dist/v4/resources/workflows.d.ts.map +1 -0
  58. package/dist/v4/resources/workflows.js +91 -0
  59. package/package.json +8 -11
  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,132 @@
1
+ /**
2
+ * `client.executions.*` — read-only access to past workflow runs and
3
+ * a live SSE stream for in-flight ones. Workflow executions are
4
+ * created by the operator when a trigger fires (or by `workflows.trigger`
5
+ * for manual runs); this resource never creates them, only reads.
6
+ */
7
+ export class ExecutionsResource {
8
+ constructor(transport) {
9
+ this.transport = transport;
10
+ }
11
+ /** GET /executions */
12
+ list(params) {
13
+ return this.transport.request({
14
+ path: "/executions",
15
+ query: params,
16
+ });
17
+ }
18
+ /** GET /workflows/{id}/executions — convenience nested form. */
19
+ listForWorkflow(workflowId, params) {
20
+ return this.transport.request({
21
+ path: `/workflows/${encodeURIComponent(workflowId)}/executions`,
22
+ query: params,
23
+ });
24
+ }
25
+ /** GET /executions/{id}?workflowId=... */
26
+ retrieve(id, params) {
27
+ return this.transport.request({
28
+ path: `/executions/${encodeURIComponent(id)}`,
29
+ query: { workflowId: params.workflowId },
30
+ });
31
+ }
32
+ /** GET /executions/{id}:getStatus?workflowId=... */
33
+ getStatus(id, params) {
34
+ return this.transport.request({
35
+ path: `/executions/${encodeURIComponent(id)}:getStatus`,
36
+ query: { workflowId: params.workflowId },
37
+ });
38
+ }
39
+ /** GET /executions:count */
40
+ count(params) {
41
+ return this.transport.request({
42
+ path: "/executions:count",
43
+ query: params,
44
+ });
45
+ }
46
+ /** GET /executions:stats */
47
+ stats(params) {
48
+ return this.transport.request({
49
+ path: "/executions:stats",
50
+ query: params,
51
+ });
52
+ }
53
+ /**
54
+ * GET /executions/{id}:stream — yields one `ExecutionStatusSummary`
55
+ * per status change. The stream closes on terminal status, when
56
+ * `signal` aborts, or when the connection drops. Implementation
57
+ * uses fetch streaming + a minimal SSE parser so it works in Node
58
+ * 20+ and browsers without an external EventSource polyfill.
59
+ */
60
+ async *stream(id, params) {
61
+ const response = await this.transport.stream({
62
+ path: `/executions/${encodeURIComponent(id)}:stream`,
63
+ query: { workflowId: params.workflowId, interval: params.interval },
64
+ headers: { Accept: "text/event-stream" },
65
+ signal: params.signal,
66
+ // SSE streams are long-lived — disable the default per-request
67
+ // timeout so we don't kill the stream after 30s. The caller's
68
+ // signal is the right cancellation channel.
69
+ timeoutMs: 0,
70
+ });
71
+ if (!response.body) {
72
+ throw new Error("SSE response has no body");
73
+ }
74
+ const reader = response.body.getReader();
75
+ const decoder = new TextDecoder();
76
+ let buffer = "";
77
+ try {
78
+ while (true) {
79
+ const { value, done } = await reader.read();
80
+ if (done)
81
+ return;
82
+ buffer += decoder.decode(value, { stream: true });
83
+ // SSE frames are separated by a blank line.
84
+ let idx = buffer.indexOf("\n\n");
85
+ while (idx !== -1) {
86
+ const frame = buffer.slice(0, idx);
87
+ buffer = buffer.slice(idx + 2);
88
+ const data = parseSSEData(frame);
89
+ if (data !== null) {
90
+ yield JSON.parse(data);
91
+ }
92
+ idx = buffer.indexOf("\n\n");
93
+ }
94
+ }
95
+ }
96
+ finally {
97
+ reader.releaseLock();
98
+ }
99
+ }
100
+ /**
101
+ * Poll-and-wait helper — yields the final ExecutionStatusSummary
102
+ * once the execution reaches a terminal status. Use `stream()`
103
+ * when you want every intermediate status update.
104
+ */
105
+ async waitForTerminal(id, params) {
106
+ let last;
107
+ for await (const event of this.stream(id, params)) {
108
+ last = event;
109
+ if (event.status === "success" || event.status === "failed" || event.status === "error") {
110
+ return event;
111
+ }
112
+ }
113
+ if (!last) {
114
+ throw new Error(`execution ${id} stream ended without a status event`);
115
+ }
116
+ return last;
117
+ }
118
+ }
119
+ /**
120
+ * Extract the `data:` payload from one SSE frame. Returns null when
121
+ * the frame is a heartbeat / comment / lacks a data line.
122
+ */
123
+ function parseSSEData(frame) {
124
+ const lines = frame.split("\n");
125
+ const data = [];
126
+ for (const line of lines) {
127
+ if (line.startsWith("data:")) {
128
+ data.push(line.slice(5).trimStart());
129
+ }
130
+ }
131
+ return data.length === 0 ? null : data.join("\n");
132
+ }
@@ -0,0 +1,19 @@
1
+ import type { v4 } from "@avaprotocol/types";
2
+ import { Transport } from "../internal/transport";
3
+ /**
4
+ * `client.health.*` — gateway liveness + version probes.
5
+ *
6
+ * Anonymous (no Bearer token required) — safe to call from
7
+ * unauthenticated browser code or external monitors.
8
+ */
9
+ export declare class HealthResource {
10
+ private readonly transport;
11
+ constructor(transport: Transport);
12
+ /**
13
+ * GET /health — returns `{ status, chainId, version }` when the
14
+ * gateway is up. Use for liveness checks; do not rely on it for
15
+ * deep readiness (it doesn't probe worker connectivity).
16
+ */
17
+ check(): Promise<v4.HealthStatus>;
18
+ }
19
+ //# 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;;;;;GAKG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEjD;;;;OAIG;IACH,KAAK,IAAI,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC;CAGlC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `client.health.*` — gateway liveness + version probes.
3
+ *
4
+ * Anonymous (no Bearer token required) — safe to call from
5
+ * unauthenticated browser code or external monitors.
6
+ */
7
+ export class HealthResource {
8
+ constructor(transport) {
9
+ this.transport = transport;
10
+ }
11
+ /**
12
+ * GET /health — returns `{ status, chainId, version }` when the
13
+ * gateway is up. Use for liveness checks; do not rely on it for
14
+ * deep readiness (it doesn't probe worker connectivity).
15
+ */
16
+ check() {
17
+ return this.transport.request({ path: "/health" });
18
+ }
19
+ }
@@ -0,0 +1,29 @@
1
+ import type { v4 } from "@avaprotocol/types";
2
+ import { Transport } from "../internal/transport";
3
+ /**
4
+ * `client.nodes.*` — execute a single node definition in isolation,
5
+ * without persisting a workflow. Used by the Studio UI's per-node
6
+ * "Run once" affordance and by SDK test suites that exercise a node
7
+ * shape against a live gateway.
8
+ */
9
+ export declare class NodesResource {
10
+ private readonly transport;
11
+ constructor(transport: Transport);
12
+ /**
13
+ * POST /nodes:run — execute one node against inline `inputVariables`.
14
+ *
15
+ * The request shape mirrors a single entry from `workflows.simulate`:
16
+ * a complete node definition + the variables the node would have seen
17
+ * inside a workflow. The gateway runs the node in-process (no worker
18
+ * delegation, no persistence) and returns the raw output keyed by
19
+ * node type — `{ success, output: { <nodeType>: {...} } }`.
20
+ *
21
+ * Chain context: the gateway resolves the target chain in this order:
22
+ * `body.chainId` → `inputVariables.settings.chain_id` → the JWT's
23
+ * `aud` claim → the gateway's default chain. Specify `chainId`
24
+ * explicitly when calling a contract that lives on a non-default
25
+ * chain (e.g. a sepolia oracle when the gateway defaults to mainnet).
26
+ */
27
+ run(req: v4.RunNodeRequest): Promise<v4.RunNodeResponse>;
28
+ }
29
+ //# 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;;;;;GAKG;AACH,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEjD;;;;;;;;;;;;;;OAcG;IACH,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,cAAc,GAAG,OAAO,CAAC,EAAE,CAAC,eAAe,CAAC;CAOzD"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * `client.nodes.*` — execute a single node definition in isolation,
3
+ * without persisting a workflow. Used by the Studio UI's per-node
4
+ * "Run once" affordance and by SDK test suites that exercise a node
5
+ * shape against a live gateway.
6
+ */
7
+ export class NodesResource {
8
+ constructor(transport) {
9
+ this.transport = transport;
10
+ }
11
+ /**
12
+ * POST /nodes:run — execute one node against inline `inputVariables`.
13
+ *
14
+ * The request shape mirrors a single entry from `workflows.simulate`:
15
+ * a complete node definition + the variables the node would have seen
16
+ * inside a workflow. The gateway runs the node in-process (no worker
17
+ * delegation, no persistence) and returns the raw output keyed by
18
+ * node type — `{ success, output: { <nodeType>: {...} } }`.
19
+ *
20
+ * Chain context: the gateway resolves the target chain in this order:
21
+ * `body.chainId` → `inputVariables.settings.chain_id` → the JWT's
22
+ * `aud` claim → the gateway's default chain. Specify `chainId`
23
+ * explicitly when calling a contract that lives on a non-default
24
+ * chain (e.g. a sepolia oracle when the gateway defaults to mainnet).
25
+ */
26
+ run(req) {
27
+ return this.transport.request({
28
+ path: "/nodes:run",
29
+ method: "POST",
30
+ body: req,
31
+ });
32
+ }
33
+ }
@@ -0,0 +1,23 @@
1
+ import type { v4 } from "@avaprotocol/types";
2
+ import { Transport } from "../internal/transport";
3
+ /**
4
+ * `client.operators.*` — read-only view of the operator pool the
5
+ * gateway is currently dispatching to. Used by dashboards and the
6
+ * Studio sidebar's network-health widget; not part of the workflow
7
+ * lifecycle.
8
+ */
9
+ export declare class OperatorsResource {
10
+ private readonly transport;
11
+ constructor(transport: Transport);
12
+ /**
13
+ * GET /operators — every operator currently connected to the
14
+ * gateway, plus their advertised capabilities (block / time /
15
+ * event monitoring) and the timestamp of their last heartbeat.
16
+ *
17
+ * An empty array means no operators are connected — workflows will
18
+ * still accept, but won't execute until at least one operator
19
+ * comes online.
20
+ */
21
+ list(): Promise<v4.OperatorList>;
22
+ }
23
+ //# 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;;;;;GAKG;AACH,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEjD;;;;;;;;OAQG;IACH,IAAI,IAAI,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC;CAGjC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * `client.operators.*` — read-only view of the operator pool the
3
+ * gateway is currently dispatching to. Used by dashboards and the
4
+ * Studio sidebar's network-health widget; not part of the workflow
5
+ * lifecycle.
6
+ */
7
+ export class OperatorsResource {
8
+ constructor(transport) {
9
+ this.transport = transport;
10
+ }
11
+ /**
12
+ * GET /operators — every operator currently connected to the
13
+ * gateway, plus their advertised capabilities (block / time /
14
+ * event monitoring) and the timestamp of their last heartbeat.
15
+ *
16
+ * An empty array means no operators are connected — workflows will
17
+ * still accept, but won't execute until at least one operator
18
+ * comes online.
19
+ */
20
+ list() {
21
+ return this.transport.request({ path: "/operators" });
22
+ }
23
+ }
@@ -0,0 +1,34 @@
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
+ /**
15
+ * `client.secrets.*` — write-only secret store, scoped to the
16
+ * authenticated user. Values are referenced from workflow nodes via
17
+ * `{{secrets.NAME}}` template variables and are decrypted server-side
18
+ * at execution time; the SDK never receives the plaintext value back.
19
+ *
20
+ * `put` is a single idempotent endpoint replacing v3's create + update
21
+ * split — sending the same name twice rotates the value silently
22
+ * rather than erroring.
23
+ */
24
+ export declare class SecretsResource {
25
+ private readonly transport;
26
+ constructor(transport: Transport);
27
+ /** GET /secrets — metadata only; values are write-only. */
28
+ list(params?: ListSecretsParams): Promise<v4.SecretList>;
29
+ /** PUT /secrets/{name} — idempotent create-or-replace. */
30
+ put(name: string, body: v4.PutSecretRequest): Promise<void>;
31
+ /** DELETE /secrets/{name} */
32
+ delete(name: string, params?: DeleteSecretParams): Promise<void>;
33
+ }
34
+ //# 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;;;;;;;;;GASG;AACH,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,38 @@
1
+ /**
2
+ * `client.secrets.*` — write-only secret store, scoped to the
3
+ * authenticated user. Values are referenced from workflow nodes via
4
+ * `{{secrets.NAME}}` template variables and are decrypted server-side
5
+ * at execution time; the SDK never receives the plaintext value back.
6
+ *
7
+ * `put` is a single idempotent endpoint replacing v3's create + update
8
+ * split — sending the same name twice rotates the value silently
9
+ * rather than erroring.
10
+ */
11
+ export class SecretsResource {
12
+ constructor(transport) {
13
+ this.transport = transport;
14
+ }
15
+ /** GET /secrets — metadata only; values are write-only. */
16
+ list(params) {
17
+ return this.transport.request({
18
+ path: "/secrets",
19
+ query: params,
20
+ });
21
+ }
22
+ /** PUT /secrets/{name} — idempotent create-or-replace. */
23
+ put(name, body) {
24
+ return this.transport.request({
25
+ path: `/secrets/${encodeURIComponent(name)}`,
26
+ method: "PUT",
27
+ body,
28
+ });
29
+ }
30
+ /** DELETE /secrets/{name} */
31
+ delete(name, params) {
32
+ return this.transport.request({
33
+ path: `/secrets/${encodeURIComponent(name)}`,
34
+ method: "DELETE",
35
+ query: params,
36
+ });
37
+ }
38
+ }
@@ -0,0 +1,28 @@
1
+ import type { v4 } from "@avaprotocol/types";
2
+ import { Transport } from "../internal/transport";
3
+ /**
4
+ * `client.tokens.*` — ERC-20 metadata resolution backed by the
5
+ * aggregator's curated whitelist plus an on-chain `name/symbol/decimals`
6
+ * fallback. Used by the Studio token-picker, transfer-preview UI, and
7
+ * the notification cost-line renderer.
8
+ */
9
+ export declare class TokensResource {
10
+ private readonly transport;
11
+ constructor(transport: Transport);
12
+ /**
13
+ * GET /tokens/{address} — resolve a token by contract address.
14
+ *
15
+ * Returns `{ found: false, address }` (not 404) when the token
16
+ * isn't on the whitelist and the on-chain probe also fails — the
17
+ * partial response keeps the caller's UI from breaking on
18
+ * unrecognized tokens.
19
+ *
20
+ * `opts.chainId` picks which chain's whitelist + RPC to consult.
21
+ * Omit it to fall back to the JWT's `aud` chain (the gateway's
22
+ * default chain context for the authenticated user).
23
+ */
24
+ retrieve(address: string, opts?: {
25
+ chainId?: number;
26
+ }): Promise<v4.TokenMetadataResponse>;
27
+ }
28
+ //# 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;;;;;GAKG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEjD;;;;;;;;;;;OAWG;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,29 @@
1
+ /**
2
+ * `client.tokens.*` — ERC-20 metadata resolution backed by the
3
+ * aggregator's curated whitelist plus an on-chain `name/symbol/decimals`
4
+ * fallback. Used by the Studio token-picker, transfer-preview UI, and
5
+ * the notification cost-line renderer.
6
+ */
7
+ export class TokensResource {
8
+ constructor(transport) {
9
+ this.transport = transport;
10
+ }
11
+ /**
12
+ * GET /tokens/{address} — resolve a token by contract address.
13
+ *
14
+ * Returns `{ found: false, address }` (not 404) when the token
15
+ * isn't on the whitelist and the on-chain probe also fails — the
16
+ * partial response keeps the caller's UI from breaking on
17
+ * unrecognized tokens.
18
+ *
19
+ * `opts.chainId` picks which chain's whitelist + RPC to consult.
20
+ * Omit it to fall back to the JWT's `aud` chain (the gateway's
21
+ * default chain context for the authenticated user).
22
+ */
23
+ retrieve(address, opts) {
24
+ return this.transport.request({
25
+ path: `/tokens/${encodeURIComponent(address)}`,
26
+ query: opts,
27
+ });
28
+ }
29
+ }
@@ -0,0 +1,29 @@
1
+ import type { v4 } from "@avaprotocol/types";
2
+ import { Transport } from "../internal/transport";
3
+ /**
4
+ * `client.triggers.*` — evaluate a trigger config in isolation,
5
+ * mirroring the per-node `nodes.run` shape. Use when designing or
6
+ * debugging a trigger before wiring it into a full workflow — e.g.
7
+ * confirming that an `eventTrigger` topic filter matches a known
8
+ * historical event, or that a cron expression parses.
9
+ */
10
+ export declare class TriggersResource {
11
+ private readonly transport;
12
+ constructor(transport: Transport);
13
+ /**
14
+ * POST /triggers:run — evaluate a trigger config against inline
15
+ * input and return the same shape an executor would see.
16
+ *
17
+ * For event triggers, the gateway uses Tenderly to simulate a
18
+ * matching event log against the request's `addresses` + `topics`
19
+ * filter, then returns the decoded log under `output.data` and
20
+ * the raw log under `output.metadata`.
21
+ *
22
+ * For time-based triggers (cron, fixedTime, block), the response
23
+ * carries the next scheduled fire time / block height.
24
+ *
25
+ * No workflow record is created and no execution is persisted.
26
+ */
27
+ run(req: v4.RunTriggerRequest): Promise<v4.RunTriggerResponse>;
28
+ }
29
+ //# 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;;;;;;GAMG;AACH,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEjD;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,iBAAiB,GAAG,OAAO,CAAC,EAAE,CAAC,kBAAkB,CAAC;CAO/D"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * `client.triggers.*` — evaluate a trigger config in isolation,
3
+ * mirroring the per-node `nodes.run` shape. Use when designing or
4
+ * debugging a trigger before wiring it into a full workflow — e.g.
5
+ * confirming that an `eventTrigger` topic filter matches a known
6
+ * historical event, or that a cron expression parses.
7
+ */
8
+ export class TriggersResource {
9
+ constructor(transport) {
10
+ this.transport = transport;
11
+ }
12
+ /**
13
+ * POST /triggers:run — evaluate a trigger config against inline
14
+ * input and return the same shape an executor would see.
15
+ *
16
+ * For event triggers, the gateway uses Tenderly to simulate a
17
+ * matching event log against the request's `addresses` + `topics`
18
+ * filter, then returns the decoded log under `output.data` and
19
+ * the raw log under `output.metadata`.
20
+ *
21
+ * For time-based triggers (cron, fixedTime, block), the response
22
+ * carries the next scheduled fire time / block height.
23
+ *
24
+ * No workflow record is created and no execution is persisted.
25
+ */
26
+ run(req) {
27
+ return this.transport.request({
28
+ path: "/triggers:run",
29
+ method: "POST",
30
+ body: req,
31
+ });
32
+ }
33
+ }
@@ -0,0 +1,72 @@
1
+ import type { v4 } from "@avaprotocol/types";
2
+ import { Transport } from "../internal/transport";
3
+ /**
4
+ * `client.wallets.*` — smart-wallet CRUD plus the UserOp-driven
5
+ * withdraw action. A "wallet" here is an ERC-6900 / ERC-4337 smart
6
+ * account derived deterministically from `(owner, factory, salt)` —
7
+ * the SDK never creates an EOA, it ensures-and-registers smart
8
+ * accounts owned by the authenticated user's EOA.
9
+ *
10
+ * All endpoints require auth and operate on wallets owned by the
11
+ * JWT's subject EOA.
12
+ */
13
+ export declare class WalletsResource {
14
+ private readonly transport;
15
+ constructor(transport: Transport);
16
+ /**
17
+ * GET /wallets — every smart wallet owned by the authenticated
18
+ * EOA on the JWT's audience chain.
19
+ *
20
+ * Hidden wallets (`isHidden=true`) are excluded by default. The
21
+ * response is an envelope `{ data: Wallet[] }`, not a bare array.
22
+ */
23
+ list(): Promise<v4.WalletList>;
24
+ /**
25
+ * POST /wallets — idempotent "ensure exists". Derives the CREATE2
26
+ * address from `(owner, salt, factory)` and persists the record;
27
+ * calling twice with the same triple returns the same address.
28
+ *
29
+ * The on-chain account is **not** deployed by this call — deployment
30
+ * happens lazily as part of the first UserOp (workflow execution or
31
+ * `withdraw`) via the `initCode` field, so the smart wallet costs
32
+ * zero gas until it's first used.
33
+ *
34
+ * Per-owner cap is enforced by `max_wallets_per_owner` in the
35
+ * aggregator config; the call returns 429 `WALLETS_LIMIT_REACHED`
36
+ * when exceeded.
37
+ */
38
+ create(req: v4.CreateWalletRequest): Promise<v4.Wallet>;
39
+ /**
40
+ * PATCH /wallets/{address} — partial update. The only mutable
41
+ * field today is `isHidden`, used by the Studio UI's hide/unhide
42
+ * wallet action. Keyed by **address**, not salt — callers that
43
+ * still think in salts must look up the address first via
44
+ * `create({ salt })`.
45
+ */
46
+ update(address: string, body: {
47
+ isHidden?: boolean;
48
+ }): Promise<v4.Wallet>;
49
+ /**
50
+ * POST /wallets/{address}:withdraw — transfer ETH or an ERC-20 out
51
+ * of the smart wallet via a UserOp through the bundler + paymaster.
52
+ *
53
+ * Per-chain config (bundler URL, paymaster address, RPC) is resolved
54
+ * by the gateway from the JWT's `aud` claim or `body.chainId`.
55
+ * The response's `status` is one of `pending | confirmed | failed`:
56
+ * `confirmed` means the bundler returned a receipt synchronously,
57
+ * `pending` means it accepted the UserOp but the receipt hasn't
58
+ * landed yet, `failed` means the bundler rejected the op or it
59
+ * reverted before inclusion.
60
+ */
61
+ withdraw(address: string, req: v4.WithdrawRequest): Promise<v4.WithdrawResponse>;
62
+ /**
63
+ * GET /wallets/{address}:getNonce — current AA nonce for the wallet.
64
+ *
65
+ * Used when an external signer needs to assemble a UserOp outside
66
+ * the SDK's bundler path. Most callers don't need this directly —
67
+ * `workflows.simulate` and `wallets.withdraw` handle nonce sourcing
68
+ * internally.
69
+ */
70
+ getNonce(address: string): Promise<v4.NonceResponse>;
71
+ }
72
+ //# 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;;;;;;;;;GASG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEjD;;;;;;OAMG;IACH,IAAI,IAAI,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC;IAI9B;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,mBAAmB,GAAG,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC;IAQvD;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC;IAQzE;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,eAAe,GAAG,OAAO,CAAC,EAAE,CAAC,gBAAgB,CAAC;IAQhF;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC,aAAa,CAAC;CAKrD"}