@avaprotocol/sdk-js 2.16.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.
- package/CHANGELOG.md +37 -0
- package/README.md +11 -1
- package/dist/index.d.ts +1 -370
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +854 -22403
- package/dist/index.mjs +817 -22436
- package/dist/v4/auth.d.ts +79 -0
- package/dist/v4/auth.d.ts.map +1 -0
- package/dist/v4/auth.js +92 -0
- package/dist/v4/builders/nodes.d.ts +106 -0
- package/dist/v4/builders/nodes.d.ts.map +1 -0
- package/dist/v4/builders/nodes.js +133 -0
- package/dist/v4/builders/triggers.d.ts +66 -0
- package/dist/v4/builders/triggers.d.ts.map +1 -0
- package/dist/v4/builders/triggers.js +74 -0
- package/dist/v4/chains.d.ts +19 -0
- package/dist/v4/chains.d.ts.map +1 -0
- package/dist/v4/chains.js +22 -0
- package/dist/v4/client.d.ts +60 -0
- package/dist/v4/client.d.ts.map +1 -0
- package/dist/v4/client.js +53 -0
- package/dist/v4/index.d.ts +19 -0
- package/dist/v4/index.d.ts.map +1 -0
- package/dist/v4/index.js +24 -0
- package/dist/v4/internal/errors.d.ts +36 -0
- package/dist/v4/internal/errors.d.ts.map +1 -0
- package/dist/v4/internal/errors.js +32 -0
- package/dist/v4/internal/transport.d.ts +64 -0
- package/dist/v4/internal/transport.d.ts.map +1 -0
- package/dist/v4/internal/transport.js +133 -0
- package/dist/v4/protocols/index.d.ts +2 -0
- package/dist/v4/protocols/index.d.ts.map +1 -0
- package/dist/v4/protocols/index.js +13 -0
- package/dist/v4/resources/auth.d.ts +45 -0
- package/dist/v4/resources/auth.d.ts.map +1 -0
- package/dist/v4/resources/auth.js +59 -0
- package/dist/v4/resources/executions.d.ts +74 -0
- package/dist/v4/resources/executions.d.ts.map +1 -0
- package/dist/v4/resources/executions.js +132 -0
- package/dist/v4/resources/health.d.ts +19 -0
- package/dist/v4/resources/health.d.ts.map +1 -0
- package/dist/v4/resources/health.js +19 -0
- package/dist/v4/resources/nodes.d.ts +29 -0
- package/dist/v4/resources/nodes.d.ts.map +1 -0
- package/dist/v4/resources/nodes.js +33 -0
- package/dist/v4/resources/operators.d.ts +23 -0
- package/dist/v4/resources/operators.d.ts.map +1 -0
- package/dist/v4/resources/operators.js +23 -0
- package/dist/v4/resources/secrets.d.ts +34 -0
- package/dist/v4/resources/secrets.d.ts.map +1 -0
- package/dist/v4/resources/secrets.js +38 -0
- package/dist/v4/resources/tokens.d.ts +28 -0
- package/dist/v4/resources/tokens.d.ts.map +1 -0
- package/dist/v4/resources/tokens.js +29 -0
- package/dist/v4/resources/triggers.d.ts +29 -0
- package/dist/v4/resources/triggers.d.ts.map +1 -0
- package/dist/v4/resources/triggers.js +33 -0
- package/dist/v4/resources/wallets.d.ts +72 -0
- package/dist/v4/resources/wallets.d.ts.map +1 -0
- package/dist/v4/resources/wallets.js +92 -0
- package/dist/v4/resources/workflows.d.ts +64 -0
- package/dist/v4/resources/workflows.d.ts.map +1 -0
- package/dist/v4/resources/workflows.js +91 -0
- package/package.json +9 -11
- package/dist/auth.d.ts +0 -2
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js +0 -10
- package/dist/config.d.ts +0 -9
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -19
- package/dist/models/edge.d.ts +0 -12
- package/dist/models/edge.d.ts.map +0 -1
- package/dist/models/edge.js +0 -19
- package/dist/models/execution.d.ts +0 -20
- package/dist/models/execution.d.ts.map +0 -1
- package/dist/models/execution.js +0 -97
- package/dist/models/node/balance.d.ts +0 -17
- package/dist/models/node/balance.d.ts.map +0 -1
- package/dist/models/node/balance.js +0 -78
- package/dist/models/node/branch.d.ts +0 -11
- package/dist/models/node/branch.d.ts.map +0 -1
- package/dist/models/node/branch.js +0 -63
- package/dist/models/node/contractRead.d.ts +0 -17
- package/dist/models/node/contractRead.d.ts.map +0 -1
- package/dist/models/node/contractRead.js +0 -91
- package/dist/models/node/contractWrite.d.ts +0 -17
- package/dist/models/node/contractWrite.d.ts.map +0 -1
- package/dist/models/node/contractWrite.js +0 -102
- package/dist/models/node/customCode.d.ts +0 -20
- package/dist/models/node/customCode.d.ts.map +0 -1
- package/dist/models/node/customCode.js +0 -74
- package/dist/models/node/ethTransfer.d.ts +0 -20
- package/dist/models/node/ethTransfer.d.ts.map +0 -1
- package/dist/models/node/ethTransfer.js +0 -58
- package/dist/models/node/factory.d.ts +0 -24
- package/dist/models/node/factory.d.ts.map +0 -1
- package/dist/models/node/factory.js +0 -108
- package/dist/models/node/filter.d.ts +0 -11
- package/dist/models/node/filter.d.ts.map +0 -1
- package/dist/models/node/filter.js +0 -57
- package/dist/models/node/graphqlQuery.d.ts +0 -21
- package/dist/models/node/graphqlQuery.d.ts.map +0 -1
- package/dist/models/node/graphqlQuery.js +0 -74
- package/dist/models/node/interface.d.ts +0 -20
- package/dist/models/node/interface.d.ts.map +0 -1
- package/dist/models/node/interface.js +0 -58
- package/dist/models/node/loop.d.ts +0 -15
- package/dist/models/node/loop.d.ts.map +0 -1
- package/dist/models/node/loop.js +0 -235
- package/dist/models/node/restApi.d.ts +0 -23
- package/dist/models/node/restApi.d.ts.map +0 -1
- package/dist/models/node/restApi.js +0 -84
- package/dist/models/secret.d.ts +0 -16
- package/dist/models/secret.d.ts.map +0 -1
- package/dist/models/secret.js +0 -28
- package/dist/models/step.d.ts +0 -33
- package/dist/models/step.d.ts.map +0 -1
- package/dist/models/step.js +0 -287
- package/dist/models/trigger/block.d.ts +0 -21
- package/dist/models/trigger/block.d.ts.map +0 -1
- package/dist/models/trigger/block.js +0 -81
- package/dist/models/trigger/cron.d.ts +0 -23
- package/dist/models/trigger/cron.d.ts.map +0 -1
- package/dist/models/trigger/cron.js +0 -77
- package/dist/models/trigger/event.d.ts +0 -22
- package/dist/models/trigger/event.d.ts.map +0 -1
- package/dist/models/trigger/event.js +0 -244
- package/dist/models/trigger/factory.d.ts +0 -27
- package/dist/models/trigger/factory.d.ts.map +0 -1
- package/dist/models/trigger/factory.js +0 -73
- package/dist/models/trigger/fixedTime.d.ts +0 -23
- package/dist/models/trigger/fixedTime.d.ts.map +0 -1
- package/dist/models/trigger/fixedTime.js +0 -69
- package/dist/models/trigger/interface.d.ts +0 -19
- package/dist/models/trigger/interface.d.ts.map +0 -1
- package/dist/models/trigger/interface.js +0 -35
- package/dist/models/trigger/manual.d.ts +0 -16
- package/dist/models/trigger/manual.d.ts.map +0 -1
- package/dist/models/trigger/manual.js +0 -117
- package/dist/models/workflow.d.ts +0 -53
- package/dist/models/workflow.d.ts.map +0 -1
- package/dist/models/workflow.js +0 -219
- package/dist/utils.d.ts +0 -82
- package/dist/utils.d.ts.map +0 -1
- 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;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;;;;;;;;;GASG;AACH,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,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": "
|
|
4
|
-
"description": "
|
|
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/
|
|
35
|
-
"@
|
|
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
|
-
"
|
|
41
|
+
"typedoc": "^0.28.19",
|
|
42
|
+
"typedoc-plugin-markdown": "^4.11.0"
|
|
45
43
|
}
|
|
46
44
|
}
|
package/dist/auth.d.ts
DELETED
package/dist/auth.d.ts.map
DELETED
|
@@ -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
|
package/dist/config.d.ts.map
DELETED
|
@@ -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 };
|
package/dist/models/edge.d.ts
DELETED
|
@@ -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"}
|
package/dist/models/edge.js
DELETED
|
@@ -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,20 +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
|
-
declare class Execution implements ExecutionProps {
|
|
5
|
-
id: string;
|
|
6
|
-
startAt: number;
|
|
7
|
-
endAt: number;
|
|
8
|
-
status: ExecutionStatus;
|
|
9
|
-
error: string;
|
|
10
|
-
index: number;
|
|
11
|
-
steps: Step[];
|
|
12
|
-
executionFee?: Fee;
|
|
13
|
-
cogs: NodeCOGS[];
|
|
14
|
-
valueFee?: ValueFee;
|
|
15
|
-
constructor(props: ExecutionProps);
|
|
16
|
-
toJson(): ExecutionProps;
|
|
17
|
-
static fromResponse(execution: avs_pb.Execution): Execution;
|
|
18
|
-
}
|
|
19
|
-
export default Execution;
|
|
20
|
-
//# 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,MAAM,uBAAuB,CAAC;AAChD,OAAO,EACL,cAAc,EAEd,eAAe,EACf,KAAK,GAAG,EAER,KAAK,QAAQ,EACb,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,IAAI,MAAM,QAAQ,CAAC;AAwD1B,cAAM,SAAU,YAAW,cAAc;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;gBAER,KAAK,EAAE,cAAc;IAajC,MAAM,IAAI,cAAc;IAexB,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,GAAG,SAAS;CAgB5D;AAED,eAAe,SAAS,CAAC"}
|
package/dist/models/execution.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import { ExecutionStatus, } from "@avaprotocol/types";
|
|
3
|
-
import Step from "./step";
|
|
4
|
-
/**
|
|
5
|
-
* Convert protobuf ExecutionStatus to types ExecutionStatus
|
|
6
|
-
*/
|
|
7
|
-
function convertProtobufExecutionStatusToTypes(protobufStatus) {
|
|
8
|
-
switch (protobufStatus) {
|
|
9
|
-
case avs_pb.ExecutionStatus.EXECUTION_STATUS_PENDING:
|
|
10
|
-
return ExecutionStatus.Pending;
|
|
11
|
-
case avs_pb.ExecutionStatus.EXECUTION_STATUS_SUCCESS:
|
|
12
|
-
return ExecutionStatus.Success;
|
|
13
|
-
case avs_pb.ExecutionStatus.EXECUTION_STATUS_FAILED:
|
|
14
|
-
return ExecutionStatus.Failed;
|
|
15
|
-
case avs_pb.ExecutionStatus.EXECUTION_STATUS_PARTIAL_SUCCESS:
|
|
16
|
-
return ExecutionStatus.PartialSuccess;
|
|
17
|
-
case avs_pb.ExecutionStatus.EXECUTION_STATUS_UNSPECIFIED:
|
|
18
|
-
default:
|
|
19
|
-
return ExecutionStatus.Unspecified;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function convertFee(feePb) {
|
|
23
|
-
if (!feePb)
|
|
24
|
-
return undefined;
|
|
25
|
-
return {
|
|
26
|
-
amount: feePb.getAmount(),
|
|
27
|
-
unit: feePb.getUnit(),
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function convertNodeCOGS(cogsPb) {
|
|
31
|
-
return {
|
|
32
|
-
nodeId: cogsPb.getNodeId(),
|
|
33
|
-
costType: cogsPb.getCostType(),
|
|
34
|
-
fee: convertFee(cogsPb.getFee()) || { amount: "0", unit: "WEI" },
|
|
35
|
-
gasUnits: cogsPb.getGasUnits() || undefined,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function convertExecutionTier(tier) {
|
|
39
|
-
return avs_pb.ExecutionTier[tier] ?? tier.toString();
|
|
40
|
-
}
|
|
41
|
-
function convertValueFee(valuePb) {
|
|
42
|
-
if (!valuePb)
|
|
43
|
-
return undefined;
|
|
44
|
-
return {
|
|
45
|
-
fee: convertFee(valuePb.getFee()) || { amount: "0", unit: "PERCENTAGE" },
|
|
46
|
-
tier: convertExecutionTier(valuePb.getTier()),
|
|
47
|
-
valueBase: valuePb.getValueBase() || undefined,
|
|
48
|
-
classificationMethod: valuePb.getClassificationMethod(),
|
|
49
|
-
confidence: valuePb.getConfidence(),
|
|
50
|
-
reason: valuePb.getReason(),
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
class Execution {
|
|
54
|
-
constructor(props) {
|
|
55
|
-
this.id = props.id;
|
|
56
|
-
this.startAt = props.startAt;
|
|
57
|
-
this.endAt = props.endAt;
|
|
58
|
-
this.status = props.status;
|
|
59
|
-
this.error = props.error;
|
|
60
|
-
this.index = props.index;
|
|
61
|
-
this.steps = props.steps.map(s => new Step(s));
|
|
62
|
-
this.executionFee = props.executionFee;
|
|
63
|
-
this.cogs = props.cogs || [];
|
|
64
|
-
this.valueFee = props.valueFee;
|
|
65
|
-
}
|
|
66
|
-
toJson() {
|
|
67
|
-
return {
|
|
68
|
-
id: this.id,
|
|
69
|
-
startAt: this.startAt,
|
|
70
|
-
endAt: this.endAt,
|
|
71
|
-
status: this.status,
|
|
72
|
-
error: this.error,
|
|
73
|
-
index: this.index,
|
|
74
|
-
steps: this.steps.map(step => step.toJson()),
|
|
75
|
-
...(this.executionFee && { executionFee: this.executionFee }),
|
|
76
|
-
cogs: this.cogs,
|
|
77
|
-
...(this.valueFee && { valueFee: this.valueFee }),
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
static fromResponse(execution) {
|
|
81
|
-
return new Execution({
|
|
82
|
-
id: execution.getId(),
|
|
83
|
-
startAt: execution.getStartAt(),
|
|
84
|
-
endAt: execution.getEndAt(),
|
|
85
|
-
status: convertProtobufExecutionStatusToTypes(execution.getStatus()),
|
|
86
|
-
error: execution.getError(),
|
|
87
|
-
index: execution.getIndex(),
|
|
88
|
-
executionFee: convertFee(execution.getExecutionFee()),
|
|
89
|
-
cogs: execution.getCogsList().map(convertNodeCOGS),
|
|
90
|
-
valueFee: convertValueFee(execution.getValueFee()),
|
|
91
|
-
steps: execution
|
|
92
|
-
.getStepsList()
|
|
93
|
-
.map((step) => Step.fromResponse(step)),
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
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"}
|