@avaprotocol/sdk-js 2.17.0 → 3.0.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 (145) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +11 -1
  3. package/dist/index.d.ts +1 -370
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +856 -22369
  6. package/dist/index.mjs +820 -22402
  7. package/dist/v4/auth.d.ts +79 -0
  8. package/dist/v4/auth.d.ts.map +1 -0
  9. package/dist/v4/auth.js +92 -0
  10. package/dist/v4/builders/nodes.d.ts +106 -0
  11. package/dist/v4/builders/nodes.d.ts.map +1 -0
  12. package/dist/v4/builders/nodes.js +133 -0
  13. package/dist/v4/builders/triggers.d.ts +66 -0
  14. package/dist/v4/builders/triggers.d.ts.map +1 -0
  15. package/dist/v4/builders/triggers.js +74 -0
  16. package/dist/v4/chains.d.ts +19 -0
  17. package/dist/v4/chains.d.ts.map +1 -0
  18. package/dist/v4/chains.js +22 -0
  19. package/dist/v4/client.d.ts +60 -0
  20. package/dist/v4/client.d.ts.map +1 -0
  21. package/dist/v4/client.js +53 -0
  22. package/dist/v4/index.d.ts +19 -0
  23. package/dist/v4/index.d.ts.map +1 -0
  24. package/dist/v4/index.js +24 -0
  25. package/dist/v4/internal/errors.d.ts +36 -0
  26. package/dist/v4/internal/errors.d.ts.map +1 -0
  27. package/dist/v4/internal/errors.js +32 -0
  28. package/dist/v4/internal/transport.d.ts +64 -0
  29. package/dist/v4/internal/transport.d.ts.map +1 -0
  30. package/dist/v4/internal/transport.js +133 -0
  31. package/dist/v4/protocols/index.d.ts +2 -0
  32. package/dist/v4/protocols/index.d.ts.map +1 -0
  33. package/dist/v4/protocols/index.js +13 -0
  34. package/dist/v4/resources/auth.d.ts +45 -0
  35. package/dist/v4/resources/auth.d.ts.map +1 -0
  36. package/dist/v4/resources/auth.js +59 -0
  37. package/dist/v4/resources/executions.d.ts +74 -0
  38. package/dist/v4/resources/executions.d.ts.map +1 -0
  39. package/dist/v4/resources/executions.js +132 -0
  40. package/dist/v4/resources/health.d.ts +19 -0
  41. package/dist/v4/resources/health.d.ts.map +1 -0
  42. package/dist/v4/resources/health.js +19 -0
  43. package/dist/v4/resources/nodes.d.ts +29 -0
  44. package/dist/v4/resources/nodes.d.ts.map +1 -0
  45. package/dist/v4/resources/nodes.js +33 -0
  46. package/dist/v4/resources/operators.d.ts +23 -0
  47. package/dist/v4/resources/operators.d.ts.map +1 -0
  48. package/dist/v4/resources/operators.js +23 -0
  49. package/dist/v4/resources/secrets.d.ts +34 -0
  50. package/dist/v4/resources/secrets.d.ts.map +1 -0
  51. package/dist/v4/resources/secrets.js +38 -0
  52. package/dist/v4/resources/tokens.d.ts +28 -0
  53. package/dist/v4/resources/tokens.d.ts.map +1 -0
  54. package/dist/v4/resources/tokens.js +29 -0
  55. package/dist/v4/resources/triggers.d.ts +29 -0
  56. package/dist/v4/resources/triggers.d.ts.map +1 -0
  57. package/dist/v4/resources/triggers.js +33 -0
  58. package/dist/v4/resources/wallets.d.ts +72 -0
  59. package/dist/v4/resources/wallets.d.ts.map +1 -0
  60. package/dist/v4/resources/wallets.js +92 -0
  61. package/dist/v4/resources/workflows.d.ts +64 -0
  62. package/dist/v4/resources/workflows.d.ts.map +1 -0
  63. package/dist/v4/resources/workflows.js +91 -0
  64. package/package.json +9 -11
  65. package/dist/auth.d.ts +0 -2
  66. package/dist/auth.d.ts.map +0 -1
  67. package/dist/auth.js +0 -10
  68. package/dist/config.d.ts +0 -9
  69. package/dist/config.d.ts.map +0 -1
  70. package/dist/config.js +0 -19
  71. package/dist/models/edge.d.ts +0 -12
  72. package/dist/models/edge.d.ts.map +0 -1
  73. package/dist/models/edge.js +0 -19
  74. package/dist/models/execution.d.ts +0 -30
  75. package/dist/models/execution.d.ts.map +0 -1
  76. package/dist/models/execution.js +0 -100
  77. package/dist/models/node/balance.d.ts +0 -17
  78. package/dist/models/node/balance.d.ts.map +0 -1
  79. package/dist/models/node/balance.js +0 -78
  80. package/dist/models/node/branch.d.ts +0 -11
  81. package/dist/models/node/branch.d.ts.map +0 -1
  82. package/dist/models/node/branch.js +0 -63
  83. package/dist/models/node/contractRead.d.ts +0 -17
  84. package/dist/models/node/contractRead.d.ts.map +0 -1
  85. package/dist/models/node/contractRead.js +0 -91
  86. package/dist/models/node/contractWrite.d.ts +0 -17
  87. package/dist/models/node/contractWrite.d.ts.map +0 -1
  88. package/dist/models/node/contractWrite.js +0 -102
  89. package/dist/models/node/customCode.d.ts +0 -20
  90. package/dist/models/node/customCode.d.ts.map +0 -1
  91. package/dist/models/node/customCode.js +0 -74
  92. package/dist/models/node/ethTransfer.d.ts +0 -20
  93. package/dist/models/node/ethTransfer.d.ts.map +0 -1
  94. package/dist/models/node/ethTransfer.js +0 -58
  95. package/dist/models/node/factory.d.ts +0 -24
  96. package/dist/models/node/factory.d.ts.map +0 -1
  97. package/dist/models/node/factory.js +0 -108
  98. package/dist/models/node/filter.d.ts +0 -11
  99. package/dist/models/node/filter.d.ts.map +0 -1
  100. package/dist/models/node/filter.js +0 -57
  101. package/dist/models/node/graphqlQuery.d.ts +0 -21
  102. package/dist/models/node/graphqlQuery.d.ts.map +0 -1
  103. package/dist/models/node/graphqlQuery.js +0 -74
  104. package/dist/models/node/interface.d.ts +0 -20
  105. package/dist/models/node/interface.d.ts.map +0 -1
  106. package/dist/models/node/interface.js +0 -58
  107. package/dist/models/node/loop.d.ts +0 -15
  108. package/dist/models/node/loop.d.ts.map +0 -1
  109. package/dist/models/node/loop.js +0 -235
  110. package/dist/models/node/restApi.d.ts +0 -23
  111. package/dist/models/node/restApi.d.ts.map +0 -1
  112. package/dist/models/node/restApi.js +0 -84
  113. package/dist/models/secret.d.ts +0 -16
  114. package/dist/models/secret.d.ts.map +0 -1
  115. package/dist/models/secret.js +0 -28
  116. package/dist/models/step.d.ts +0 -33
  117. package/dist/models/step.d.ts.map +0 -1
  118. package/dist/models/step.js +0 -287
  119. package/dist/models/trigger/block.d.ts +0 -21
  120. package/dist/models/trigger/block.d.ts.map +0 -1
  121. package/dist/models/trigger/block.js +0 -81
  122. package/dist/models/trigger/cron.d.ts +0 -23
  123. package/dist/models/trigger/cron.d.ts.map +0 -1
  124. package/dist/models/trigger/cron.js +0 -77
  125. package/dist/models/trigger/event.d.ts +0 -22
  126. package/dist/models/trigger/event.d.ts.map +0 -1
  127. package/dist/models/trigger/event.js +0 -244
  128. package/dist/models/trigger/factory.d.ts +0 -27
  129. package/dist/models/trigger/factory.d.ts.map +0 -1
  130. package/dist/models/trigger/factory.js +0 -73
  131. package/dist/models/trigger/fixedTime.d.ts +0 -23
  132. package/dist/models/trigger/fixedTime.d.ts.map +0 -1
  133. package/dist/models/trigger/fixedTime.js +0 -69
  134. package/dist/models/trigger/interface.d.ts +0 -19
  135. package/dist/models/trigger/interface.d.ts.map +0 -1
  136. package/dist/models/trigger/interface.js +0 -35
  137. package/dist/models/trigger/manual.d.ts +0 -16
  138. package/dist/models/trigger/manual.d.ts.map +0 -1
  139. package/dist/models/trigger/manual.js +0 -117
  140. package/dist/models/workflow.d.ts +0 -53
  141. package/dist/models/workflow.d.ts.map +0 -1
  142. package/dist/models/workflow.js +0 -219
  143. package/dist/utils.d.ts +0 -82
  144. package/dist/utils.d.ts.map +0 -1
  145. package/dist/utils.js +0 -286
@@ -0,0 +1,92 @@
1
+ /**
2
+ * `client.wallets.*` — smart-wallet CRUD plus the UserOp-driven
3
+ * withdraw action. A "wallet" here is an ERC-6900 / ERC-4337 smart
4
+ * account derived deterministically from `(owner, factory, salt)` —
5
+ * the SDK never creates an EOA, it ensures-and-registers smart
6
+ * accounts owned by the authenticated user's EOA.
7
+ *
8
+ * All endpoints require auth and operate on wallets owned by the
9
+ * JWT's subject EOA.
10
+ */
11
+ export class WalletsResource {
12
+ constructor(transport) {
13
+ this.transport = transport;
14
+ }
15
+ /**
16
+ * GET /wallets — every smart wallet owned by the authenticated
17
+ * EOA on the JWT's audience chain.
18
+ *
19
+ * Hidden wallets (`isHidden=true`) are excluded by default. The
20
+ * response is an envelope `{ data: Wallet[] }`, not a bare array.
21
+ */
22
+ list() {
23
+ return this.transport.request({ path: "/wallets" });
24
+ }
25
+ /**
26
+ * POST /wallets — idempotent "ensure exists". Derives the CREATE2
27
+ * address from `(owner, salt, factory)` and persists the record;
28
+ * calling twice with the same triple returns the same address.
29
+ *
30
+ * The on-chain account is **not** deployed by this call — deployment
31
+ * happens lazily as part of the first UserOp (workflow execution or
32
+ * `withdraw`) via the `initCode` field, so the smart wallet costs
33
+ * zero gas until it's first used.
34
+ *
35
+ * Per-owner cap is enforced by `max_wallets_per_owner` in the
36
+ * aggregator config; the call returns 429 `WALLETS_LIMIT_REACHED`
37
+ * when exceeded.
38
+ */
39
+ create(req) {
40
+ return this.transport.request({
41
+ path: "/wallets",
42
+ method: "POST",
43
+ body: req,
44
+ });
45
+ }
46
+ /**
47
+ * PATCH /wallets/{address} — partial update. The only mutable
48
+ * field today is `isHidden`, used by the Studio UI's hide/unhide
49
+ * wallet action. Keyed by **address**, not salt — callers that
50
+ * still think in salts must look up the address first via
51
+ * `create({ salt })`.
52
+ */
53
+ update(address, body) {
54
+ return this.transport.request({
55
+ path: `/wallets/${encodeURIComponent(address)}`,
56
+ method: "PATCH",
57
+ body,
58
+ });
59
+ }
60
+ /**
61
+ * POST /wallets/{address}:withdraw — transfer ETH or an ERC-20 out
62
+ * of the smart wallet via a UserOp through the bundler + paymaster.
63
+ *
64
+ * Per-chain config (bundler URL, paymaster address, RPC) is resolved
65
+ * by the gateway from the JWT's `aud` claim or `body.chainId`.
66
+ * The response's `status` is one of `pending | confirmed | failed`:
67
+ * `confirmed` means the bundler returned a receipt synchronously,
68
+ * `pending` means it accepted the UserOp but the receipt hasn't
69
+ * landed yet, `failed` means the bundler rejected the op or it
70
+ * reverted before inclusion.
71
+ */
72
+ withdraw(address, req) {
73
+ return this.transport.request({
74
+ path: `/wallets/${encodeURIComponent(address)}:withdraw`,
75
+ method: "POST",
76
+ body: req,
77
+ });
78
+ }
79
+ /**
80
+ * GET /wallets/{address}:getNonce — current AA nonce for the wallet.
81
+ *
82
+ * Used when an external signer needs to assemble a UserOp outside
83
+ * the SDK's bundler path. Most callers don't need this directly —
84
+ * `workflows.simulate` and `wallets.withdraw` handle nonce sourcing
85
+ * internally.
86
+ */
87
+ getNonce(address) {
88
+ return this.transport.request({
89
+ path: `/wallets/${encodeURIComponent(address)}:getNonce`,
90
+ });
91
+ }
92
+ }
@@ -0,0 +1,64 @@
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
+ /**
28
+ * `client.workflows.*` — the primary surface for creating and
29
+ * controlling automations. A "workflow" is one trigger + a DAG of
30
+ * nodes that fires when the trigger condition matches. This resource
31
+ * covers the full lifecycle: create, list, retrieve, pause / resume,
32
+ * cancel, manual trigger, dry-run simulation, and fee estimation.
33
+ *
34
+ * Executions produced by these workflows are read via
35
+ * [`ExecutionsResource`](ExecutionsResource.mdx).
36
+ */
37
+ export declare class WorkflowsResource {
38
+ private readonly transport;
39
+ constructor(transport: Transport);
40
+ /** POST /workflows */
41
+ create(req: v4.CreateWorkflowRequest): Promise<v4.Workflow>;
42
+ /** GET /workflows */
43
+ list(params?: ListWorkflowsParams): Promise<v4.WorkflowList>;
44
+ /** GET /workflows/{id} */
45
+ retrieve(id: string): Promise<v4.Workflow>;
46
+ /**
47
+ * DELETE /workflows/{id} — cancel is the public verb in v4
48
+ * (Stripe convention) even though the engine removes the record.
49
+ */
50
+ cancel(id: string): Promise<void>;
51
+ /** POST /workflows/{id}:pause */
52
+ pause(id: string): Promise<v4.Workflow>;
53
+ /** POST /workflows/{id}:resume */
54
+ resume(id: string): Promise<v4.Workflow>;
55
+ /** POST /workflows/{id}:trigger */
56
+ trigger(id: string, req: v4.TriggerWorkflowRequest): Promise<v4.TriggerWorkflowResponse>;
57
+ /** POST /workflows:simulate — runs without persisting. */
58
+ simulate(req: v4.SimulateWorkflowRequest): Promise<v4.Execution>;
59
+ /** POST /workflows:estimateFees */
60
+ estimateFees(req: v4.EstimateFeesRequest): Promise<v4.EstimateFeesResponse>;
61
+ /** GET /workflows:count */
62
+ count(params?: CountWorkflowsParams): Promise<v4.WorkflowCount>;
63
+ }
64
+ //# 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;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AC3B,KAAK,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,EAAE,CAAC,aAAa,CAAC;CAMhE"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * `client.workflows.*` — the primary surface for creating and
3
+ * controlling automations. A "workflow" is one trigger + a DAG of
4
+ * nodes that fires when the trigger condition matches. This resource
5
+ * covers the full lifecycle: create, list, retrieve, pause / resume,
6
+ * cancel, manual trigger, dry-run simulation, and fee estimation.
7
+ *
8
+ * Executions produced by these workflows are read via
9
+ * [`ExecutionsResource`](ExecutionsResource.mdx).
10
+ */
11
+ export class WorkflowsResource {
12
+ constructor(transport) {
13
+ this.transport = transport;
14
+ }
15
+ /** POST /workflows */
16
+ create(req) {
17
+ return this.transport.request({
18
+ path: "/workflows",
19
+ method: "POST",
20
+ body: req,
21
+ });
22
+ }
23
+ /** GET /workflows */
24
+ list(params) {
25
+ return this.transport.request({
26
+ path: "/workflows",
27
+ query: params,
28
+ });
29
+ }
30
+ /** GET /workflows/{id} */
31
+ retrieve(id) {
32
+ return this.transport.request({
33
+ path: `/workflows/${encodeURIComponent(id)}`,
34
+ });
35
+ }
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) {
41
+ return this.transport.request({
42
+ path: `/workflows/${encodeURIComponent(id)}`,
43
+ method: "DELETE",
44
+ });
45
+ }
46
+ /** POST /workflows/{id}:pause */
47
+ pause(id) {
48
+ return this.transport.request({
49
+ path: `/workflows/${encodeURIComponent(id)}:pause`,
50
+ method: "POST",
51
+ });
52
+ }
53
+ /** POST /workflows/{id}:resume */
54
+ resume(id) {
55
+ return this.transport.request({
56
+ path: `/workflows/${encodeURIComponent(id)}:resume`,
57
+ method: "POST",
58
+ });
59
+ }
60
+ /** POST /workflows/{id}:trigger */
61
+ trigger(id, req) {
62
+ return this.transport.request({
63
+ path: `/workflows/${encodeURIComponent(id)}:trigger`,
64
+ method: "POST",
65
+ body: req,
66
+ });
67
+ }
68
+ /** POST /workflows:simulate — runs without persisting. */
69
+ simulate(req) {
70
+ return this.transport.request({
71
+ path: "/workflows:simulate",
72
+ method: "POST",
73
+ body: req,
74
+ });
75
+ }
76
+ /** POST /workflows:estimateFees */
77
+ estimateFees(req) {
78
+ return this.transport.request({
79
+ path: "/workflows:estimateFees",
80
+ method: "POST",
81
+ body: req,
82
+ });
83
+ }
84
+ /** GET /workflows:count */
85
+ count(params) {
86
+ return this.transport.request({
87
+ path: "/workflows:count",
88
+ query: params,
89
+ });
90
+ }
91
+ }
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": "3.0.0",
4
+ "description": "TypeScript SDK for Ava Protocol's AVS REST API. 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": [
@@ -27,20 +27,18 @@
27
27
  "build:declarations": "tsc -b tsconfig.json",
28
28
  "build:js": "tsup src/index.ts --format cjs,esm",
29
29
  "build": "yarn build:declarations && yarn build:js",
30
- "clean": "rm -rf node_modules dist tsconfig.tsbuildinfo",
30
+ "clean": "rm -rf node_modules dist tsconfig.tsbuildinfo docs-api",
31
+ "docs": "typedoc && node scripts/flatten-docs.js",
31
32
  "prepare": "node ../../scripts/prepare-package.js"
32
33
  },
33
34
  "dependencies": {
34
- "@avaprotocol/types": "2.13.0",
35
- "@grpc/grpc-js": "^1.11.3",
36
- "@grpc/proto-loader": "^0.7.13",
35
+ "@avaprotocol/protocols": "^0.2.0",
36
+ "@avaprotocol/types": "^3.0.0",
37
37
  "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"
38
+ "ethers": "^6.13.2"
42
39
  },
43
40
  "devDependencies": {
44
- "@types/google-protobuf": "^3.15.12"
41
+ "typedoc": "^0.28.19",
42
+ "typedoc-plugin-markdown": "^4.11.0"
45
43
  }
46
44
  }
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"}
@@ -1,19 +0,0 @@
1
- import * as avs_pb from "@/grpc_codegen/avs_pb";
2
- class Edge {
3
- constructor(edge) {
4
- this.id = edge.id;
5
- this.source = edge.source;
6
- this.target = edge.target;
7
- }
8
- static fromResponse(edge) {
9
- return new Edge(edge.toObject());
10
- }
11
- toRequest() {
12
- const edge = new avs_pb.TaskEdge();
13
- edge.setId(this.id);
14
- edge.setSource(this.source);
15
- edge.setTarget(this.target);
16
- return edge;
17
- }
18
- }
19
- export default Edge;
@@ -1,30 +0,0 @@
1
- import * as avs_pb from "@/grpc_codegen/avs_pb";
2
- import { ExecutionProps, ExecutionStatus, type Fee, type NodeCOGS, type ValueFee } from "@avaprotocol/types";
3
- import Step from "./step";
4
- /**
5
- * Convert the numeric protobuf ExecutionStatus to the string-based
6
- * @avaprotocol/types enum. Legacy value 4 (retired PARTIAL_SUCCESS) maps
7
- * to Failed so older aggregator responses still deserialize cleanly.
8
- */
9
- export declare function convertProtobufExecutionStatus(protobufStatus: avs_pb.ExecutionStatus): ExecutionStatus;
10
- export declare function convertFee(feePb: avs_pb.Fee | undefined): Fee | undefined;
11
- export declare function convertNodeCOGS(cogsPb: avs_pb.NodeCOGS): NodeCOGS;
12
- export declare function convertExecutionTier(tier: number): string;
13
- export declare function convertValueFee(valuePb: avs_pb.ValueFee | undefined): ValueFee | undefined;
14
- declare class Execution implements ExecutionProps {
15
- id: string;
16
- startAt: number;
17
- endAt: number;
18
- status: ExecutionStatus;
19
- error: string;
20
- index: number;
21
- steps: Step[];
22
- executionFee?: Fee;
23
- cogs: NodeCOGS[];
24
- valueFee?: ValueFee;
25
- constructor(props: ExecutionProps);
26
- toJson(): ExecutionProps;
27
- static fromResponse(execution: avs_pb.Execution): Execution;
28
- }
29
- export default Execution;
30
- //# sourceMappingURL=execution.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/models/execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM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ert the numeric protobuf ExecutionStatus to the string-based
6
- * @avaprotocol/types enum. Legacy value 4 (retired PARTIAL_SUCCESS) maps
7
- * to Failed so older aggregator responses still deserialize cleanly.
8
- */
9
- export function convertProtobufExecutionStatus(protobufStatus) {
10
- switch (protobufStatus) {
11
- case avs_pb.ExecutionStatus.EXECUTION_STATUS_PENDING:
12
- return ExecutionStatus.Pending;
13
- case avs_pb.ExecutionStatus.EXECUTION_STATUS_SUCCESS:
14
- return ExecutionStatus.Success;
15
- case avs_pb.ExecutionStatus.EXECUTION_STATUS_FAILED:
16
- case 4: // legacy PARTIAL_SUCCESS — treat as Failed
17
- return ExecutionStatus.Failed;
18
- case avs_pb.ExecutionStatus.EXECUTION_STATUS_ERROR:
19
- return ExecutionStatus.Error;
20
- case avs_pb.ExecutionStatus.EXECUTION_STATUS_UNSPECIFIED:
21
- default:
22
- return ExecutionStatus.Unspecified;
23
- }
24
- }
25
- export function convertFee(feePb) {
26
- if (!feePb)
27
- return undefined;
28
- return {
29
- amount: feePb.getAmount(),
30
- unit: feePb.getUnit(),
31
- };
32
- }
33
- export function convertNodeCOGS(cogsPb) {
34
- return {
35
- nodeId: cogsPb.getNodeId(),
36
- costType: cogsPb.getCostType(),
37
- fee: convertFee(cogsPb.getFee()) || { amount: "0", unit: "WEI" },
38
- gasUnits: cogsPb.getGasUnits() || undefined,
39
- };
40
- }
41
- export function convertExecutionTier(tier) {
42
- return avs_pb.ExecutionTier[tier] ?? tier.toString();
43
- }
44
- export function convertValueFee(valuePb) {
45
- if (!valuePb)
46
- return undefined;
47
- return {
48
- fee: convertFee(valuePb.getFee()) || { amount: "0", unit: "PERCENTAGE" },
49
- tier: convertExecutionTier(valuePb.getTier()),
50
- valueBase: valuePb.getValueBase() || undefined,
51
- classificationMethod: valuePb.getClassificationMethod(),
52
- confidence: valuePb.getConfidence(),
53
- reason: valuePb.getReason(),
54
- };
55
- }
56
- class Execution {
57
- constructor(props) {
58
- this.id = props.id;
59
- this.startAt = props.startAt;
60
- this.endAt = props.endAt;
61
- this.status = props.status;
62
- this.error = props.error;
63
- this.index = props.index;
64
- this.steps = props.steps.map(s => new Step(s));
65
- this.executionFee = props.executionFee;
66
- this.cogs = props.cogs || [];
67
- this.valueFee = props.valueFee;
68
- }
69
- toJson() {
70
- return {
71
- id: this.id,
72
- startAt: this.startAt,
73
- endAt: this.endAt,
74
- status: this.status,
75
- error: this.error,
76
- index: this.index,
77
- steps: this.steps.map(step => step.toJson()),
78
- ...(this.executionFee && { executionFee: this.executionFee }),
79
- cogs: this.cogs,
80
- ...(this.valueFee && { valueFee: this.valueFee }),
81
- };
82
- }
83
- static fromResponse(execution) {
84
- return new Execution({
85
- id: execution.getId(),
86
- startAt: execution.getStartAt(),
87
- endAt: execution.getEndAt(),
88
- status: convertProtobufExecutionStatus(execution.getStatus()),
89
- error: execution.getError(),
90
- index: execution.getIndex(),
91
- executionFee: convertFee(execution.getExecutionFee()),
92
- cogs: execution.getCogsList().map(convertNodeCOGS),
93
- valueFee: convertValueFee(execution.getValueFee()),
94
- steps: execution
95
- .getStepsList()
96
- .map((step) => Step.fromResponse(step)),
97
- });
98
- }
99
- }
100
- export default Execution;
@@ -1,17 +0,0 @@
1
- import Node from "./interface";
2
- import * as avs_pb from "@/grpc_codegen/avs_pb";
3
- import { BalanceNodeData, BalanceNodeProps } from "@avaprotocol/types";
4
- declare class BalanceNode extends Node {
5
- constructor(props: BalanceNodeProps);
6
- /**
7
- * Create a protobuf BalanceNode from config data
8
- * @param configData - The configuration data for the balance node
9
- * @returns Configured avs_pb.BalanceNode
10
- */
11
- static createProtobufNode(configData: BalanceNodeData): avs_pb.BalanceNode;
12
- static fromResponse(raw: avs_pb.TaskNode): BalanceNode;
13
- toRequest(): avs_pb.TaskNode;
14
- static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): unknown | null;
15
- }
16
- export default BalanceNode;
17
- //# sourceMappingURL=balance.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../../src/models/node/balance.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAEL,eAAe,EACf,gBAAgB,EAEjB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,WAAY,SAAQ,IAAI;gBAChB,KAAK,EAAE,gBAAgB;IAInC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,eAAe,GAAG,MAAM,CAAC,WAAW;IA+B1E,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,WAAW;IAwBtD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAc5B,MAAM,CAAC,cAAc,CACnB,UAAU,EAAE,MAAM,CAAC,qBAAqB,GACvC,OAAO,GAAG,IAAI;CAWlB;AAED,eAAe,WAAW,CAAC"}
@@ -1,78 +0,0 @@
1
- import Node from "./interface";
2
- import * as avs_pb from "@/grpc_codegen/avs_pb";
3
- import { NodeType, } from "@avaprotocol/types";
4
- import { convertProtobufValueToJs } from "../../utils";
5
- // Required props for constructor: id, name, type and data
6
- class BalanceNode extends Node {
7
- constructor(props) {
8
- super({ ...props, type: NodeType.Balance, data: props.data });
9
- }
10
- /**
11
- * Create a protobuf BalanceNode from config data
12
- * @param configData - The configuration data for the balance node
13
- * @returns Configured avs_pb.BalanceNode
14
- */
15
- static createProtobufNode(configData) {
16
- const node = new avs_pb.BalanceNode();
17
- const config = new avs_pb.BalanceNode.Config();
18
- config.setAddress(configData.address);
19
- config.setChain(configData.chain);
20
- if (configData.includeSpam !== undefined) {
21
- config.setIncludeSpam(configData.includeSpam);
22
- }
23
- if (configData.includeZeroBalances !== undefined) {
24
- config.setIncludeZeroBalances(configData.includeZeroBalances);
25
- }
26
- if (configData.minUsdValue !== undefined) {
27
- // Convert dollars to cents for protobuf (validation happens on backend)
28
- config.setMinUsdValueCents(Math.round(configData.minUsdValue * 100));
29
- }
30
- if (configData.tokenAddresses !== undefined &&
31
- configData.tokenAddresses.length > 0) {
32
- config.setTokenAddressesList(configData.tokenAddresses);
33
- }
34
- node.setConfig(config);
35
- return node;
36
- }
37
- static fromResponse(raw) {
38
- // Convert the raw object to BalanceNodeProps, which should keep name and id
39
- const obj = raw.toObject();
40
- const balanceNode = raw.getBalance();
41
- const config = balanceNode.getConfig();
42
- const protobufData = config.toObject();
43
- // Convert protobuf data to our custom interface
44
- const data = {
45
- address: protobufData.address,
46
- chain: protobufData.chain,
47
- includeSpam: protobufData.includeSpam,
48
- includeZeroBalances: protobufData.includeZeroBalances,
49
- minUsdValue: protobufData.minUsdValueCents / 100,
50
- tokenAddresses: protobufData.tokenAddressesList,
51
- };
52
- return new BalanceNode({
53
- ...obj,
54
- type: NodeType.Balance,
55
- data: data,
56
- });
57
- }
58
- toRequest() {
59
- const request = new avs_pb.TaskNode();
60
- request.setId(this.id);
61
- request.setName(this.name);
62
- request.setType(avs_pb.NodeType.NODE_TYPE_BALANCE);
63
- const node = BalanceNode.createProtobufNode(this.data);
64
- request.setBalance(node);
65
- return request;
66
- }
67
- static fromOutputData(outputData) {
68
- const balanceOutput = outputData.getBalance();
69
- if (!balanceOutput)
70
- return null;
71
- // Get the data from the data field (array of token balances)
72
- const dataValue = balanceOutput.getData();
73
- const balanceData = dataValue ? convertProtobufValueToJs(dataValue) : [];
74
- // Return the array directly without wrapping
75
- return balanceData;
76
- }
77
- }
78
- export default BalanceNode;
@@ -1,11 +0,0 @@
1
- import { BranchNodeProps } from "@avaprotocol/types";
2
- import Node from "./interface";
3
- import * as avs_pb from "@/grpc_codegen/avs_pb";
4
- declare class BranchNode extends Node {
5
- constructor(props: BranchNodeProps);
6
- static fromResponse(raw: avs_pb.TaskNode): BranchNode;
7
- toRequest(): avs_pb.TaskNode;
8
- static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
9
- }
10
- export default BranchNode;
11
- //# sourceMappingURL=branch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../../src/models/node/branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAKhD,cAAM,UAAW,SAAQ,IAAI;gBACf,KAAK,EAAE,eAAe;IAIlC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,UAAU;IAsBrD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAkC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAgBrE;AACD,eAAe,UAAU,CAAC"}