@avaprotocol/sdk-js 0.6.12 → 0.7.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.
- package/README.md +52 -0
- package/dist/index.d.mts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +25 -40
- package/dist/index.mjs +26 -42
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -81,6 +81,58 @@ To ensure the SDK is functioning correctly, we have a comprehensive test suite.
|
|
|
81
81
|
|
|
82
82
|
This will execute all unit and integration tests. Make sure all tests pass before submitting a pull request or deploying changes.
|
|
83
83
|
|
|
84
|
+
## Version Management
|
|
85
|
+
|
|
86
|
+
This project uses [Changesets](https://github.com/changesets/changesets) to manage versions and changelogs. To contribute changes:
|
|
87
|
+
|
|
88
|
+
1. Make your changes to the codebase.
|
|
89
|
+
2. Run `npm run changeset` to create a new changeset.
|
|
90
|
+
3. Follow the prompts to describe your changes.
|
|
91
|
+
4. Commit the generated changeset file along with your changes.
|
|
92
|
+
|
|
93
|
+
To release a new version:
|
|
94
|
+
|
|
95
|
+
1. Run `npm run version` to update package versions and changelogs.
|
|
96
|
+
2. Review and commit the changes.
|
|
97
|
+
3. Run `npm run release` to publish the new version to npm.
|
|
98
|
+
|
|
99
|
+
For more detailed information on using Changesets, refer to the [Changesets documentation](https://github.com/changesets/changesets/blob/main/docs/intro-to-using-changesets.md).
|
|
100
|
+
|
|
101
|
+
## Release Process
|
|
102
|
+
|
|
103
|
+
This repository uses a two-step workflow process for creating new releases:
|
|
104
|
+
|
|
105
|
+
1. **Record changeset workflow**
|
|
106
|
+
- Go to the "Actions" tab in GitHub, and run the "Record Changeset" workflow
|
|
107
|
+
- Select the version bump type:
|
|
108
|
+
- `patch` for backwards-compatible bug fixes (0.0.x)
|
|
109
|
+
- `minor` for backwards-compatible features (0.x.0)
|
|
110
|
+
- `major` for breaking changes (x.0.0)
|
|
111
|
+
- Examine the Pull Request created by the workflow, and merge it if everything looks correct. This will record any commits before it as a major, minor, or patch.
|
|
112
|
+
|
|
113
|
+
2. **Create release workflow**
|
|
114
|
+
- Go to the "Actions" tab in GitHub and run the "Create Release" workflow. This will run `npx changeset version` to bump up version in `package.json` based on the recorded changeset files. It will also create a new GitHub Release if the new version is higher than the current version in `package.json`.
|
|
115
|
+
|
|
116
|
+
### NPM Publishing
|
|
117
|
+
|
|
118
|
+
The NPM publishing should be handled manually, since the test cases reference the dist folder and don’t require a new version on NPM. NPM publish on dev tag is only required for testing the new version in a web app.
|
|
119
|
+
1. Publish a dev version and test it in your local environment:
|
|
120
|
+
```bash
|
|
121
|
+
# Update version with dev tag in package.json
|
|
122
|
+
npm version prerelease --preid=dev
|
|
123
|
+
|
|
124
|
+
# Publish to npm with dev tag
|
|
125
|
+
npm publish --tag dev
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
2. Once tested, and a release is created using GitHub Actions, publish the production version to NPM:
|
|
129
|
+
```bash
|
|
130
|
+
# Publish to npm with latest tag
|
|
131
|
+
npm publish
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
> **Note**: Make sure to run these workflows in order. The Version Bump workflow must complete successfully before running the Create Release workflow.
|
|
135
|
+
|
|
84
136
|
### Utility Scripts
|
|
85
137
|
|
|
86
138
|
To generate the key request message for signing, you can run the following command:
|
package/dist/index.d.mts
CHANGED
|
@@ -1457,8 +1457,9 @@ declare class AggregatorClient extends grpc.Client implements IAggregatorClient
|
|
|
1457
1457
|
}
|
|
1458
1458
|
|
|
1459
1459
|
type Environment = "production" | "development" | "staging";
|
|
1460
|
+
declare const AUTH_KEY_HEADER = "authKey";
|
|
1460
1461
|
interface GetKeyResponse {
|
|
1461
|
-
|
|
1462
|
+
key: string;
|
|
1462
1463
|
}
|
|
1463
1464
|
interface ClientOption {
|
|
1464
1465
|
endpoint: string;
|
|
@@ -1492,8 +1493,10 @@ declare class BaseClient {
|
|
|
1492
1493
|
readonly rpcClient: AggregatorClient;
|
|
1493
1494
|
protected metadata: Metadata;
|
|
1494
1495
|
constructor(opts: ClientOption);
|
|
1495
|
-
|
|
1496
|
+
setAuthKey(key: string): void;
|
|
1497
|
+
getAuthKey(): string | undefined;
|
|
1496
1498
|
isAuthenticated(): boolean;
|
|
1499
|
+
authWithAPIKey(apiKey: string, expiredAtEpoch: number): Promise<GetKeyResponse>;
|
|
1497
1500
|
authWithSignature(address: string, signature: string, expiredAtEpoch: number): Promise<GetKeyResponse>;
|
|
1498
1501
|
protected _callRPC<TResponse, TRequest>(method: string, request: TRequest | any): Promise<TResponse>;
|
|
1499
1502
|
}
|
|
@@ -1511,4 +1514,4 @@ declare class Client extends BaseClient {
|
|
|
1511
1514
|
deleteTask(id: string): Promise<boolean>;
|
|
1512
1515
|
}
|
|
1513
1516
|
|
|
1514
|
-
export { type BalanceResp, type ClientOption, type CreateTaskResponse, type Environment, type GetAddressesResponse, type GetKeyResponse, type ListTasksResponse, type Task, type TransactionResp, Client as default, getKeyRequestMessage };
|
|
1517
|
+
export { AUTH_KEY_HEADER, type BalanceResp, type ClientOption, type CreateTaskResponse, type Environment, type GetAddressesResponse, type GetKeyResponse, type ListTasksResponse, type Task, type TransactionResp, Client as default, getKeyRequestMessage };
|
package/dist/index.d.ts
CHANGED
|
@@ -1457,8 +1457,9 @@ declare class AggregatorClient extends grpc.Client implements IAggregatorClient
|
|
|
1457
1457
|
}
|
|
1458
1458
|
|
|
1459
1459
|
type Environment = "production" | "development" | "staging";
|
|
1460
|
+
declare const AUTH_KEY_HEADER = "authKey";
|
|
1460
1461
|
interface GetKeyResponse {
|
|
1461
|
-
|
|
1462
|
+
key: string;
|
|
1462
1463
|
}
|
|
1463
1464
|
interface ClientOption {
|
|
1464
1465
|
endpoint: string;
|
|
@@ -1492,8 +1493,10 @@ declare class BaseClient {
|
|
|
1492
1493
|
readonly rpcClient: AggregatorClient;
|
|
1493
1494
|
protected metadata: Metadata;
|
|
1494
1495
|
constructor(opts: ClientOption);
|
|
1495
|
-
|
|
1496
|
+
setAuthKey(key: string): void;
|
|
1497
|
+
getAuthKey(): string | undefined;
|
|
1496
1498
|
isAuthenticated(): boolean;
|
|
1499
|
+
authWithAPIKey(apiKey: string, expiredAtEpoch: number): Promise<GetKeyResponse>;
|
|
1497
1500
|
authWithSignature(address: string, signature: string, expiredAtEpoch: number): Promise<GetKeyResponse>;
|
|
1498
1501
|
protected _callRPC<TResponse, TRequest>(method: string, request: TRequest | any): Promise<TResponse>;
|
|
1499
1502
|
}
|
|
@@ -1511,4 +1514,4 @@ declare class Client extends BaseClient {
|
|
|
1511
1514
|
deleteTask(id: string): Promise<boolean>;
|
|
1512
1515
|
}
|
|
1513
1516
|
|
|
1514
|
-
export { type BalanceResp, type ClientOption, type CreateTaskResponse, type Environment, type GetAddressesResponse, type GetKeyResponse, type ListTasksResponse, type Task, type TransactionResp, Client as default, getKeyRequestMessage };
|
|
1517
|
+
export { AUTH_KEY_HEADER, type BalanceResp, type ClientOption, type CreateTaskResponse, type Environment, type GetAddressesResponse, type GetKeyResponse, type ListTasksResponse, type Task, type TransactionResp, Client as default, getKeyRequestMessage };
|
package/dist/index.js
CHANGED
|
@@ -4182,6 +4182,7 @@ var init_avs_pb = __esm({
|
|
|
4182
4182
|
// src/index.ts
|
|
4183
4183
|
var src_exports = {};
|
|
4184
4184
|
__export(src_exports, {
|
|
4185
|
+
AUTH_KEY_HEADER: () => AUTH_KEY_HEADER,
|
|
4185
4186
|
default: () => Client,
|
|
4186
4187
|
getKeyRequestMessage: () => getKeyRequestMessage
|
|
4187
4188
|
});
|
|
@@ -4511,13 +4512,14 @@ var Task2 = class {
|
|
|
4511
4512
|
constructor(task) {
|
|
4512
4513
|
this.id = task.getId();
|
|
4513
4514
|
this.status = task.getStatus().toString();
|
|
4514
|
-
console.log("task.constructor:", task.toObject());
|
|
4515
4515
|
}
|
|
4516
4516
|
};
|
|
4517
4517
|
var task_default = Task2;
|
|
4518
4518
|
|
|
4519
|
+
// src/types.ts
|
|
4520
|
+
var AUTH_KEY_HEADER = "authKey";
|
|
4521
|
+
|
|
4519
4522
|
// src/index.ts
|
|
4520
|
-
var metadata = new grpc2.Metadata();
|
|
4521
4523
|
var BaseClient = class {
|
|
4522
4524
|
constructor(opts) {
|
|
4523
4525
|
this.endpoint = opts.endpoint;
|
|
@@ -4527,15 +4529,20 @@ var BaseClient = class {
|
|
|
4527
4529
|
);
|
|
4528
4530
|
this.metadata = new import_grpc_js.Metadata();
|
|
4529
4531
|
}
|
|
4530
|
-
setAuthKey(
|
|
4531
|
-
metadata.add(
|
|
4532
|
+
setAuthKey(key) {
|
|
4533
|
+
this.metadata.add(AUTH_KEY_HEADER, key);
|
|
4534
|
+
}
|
|
4535
|
+
getAuthKey() {
|
|
4536
|
+
const authKey = this.metadata.get(AUTH_KEY_HEADER);
|
|
4537
|
+
return authKey?.[0]?.toString();
|
|
4532
4538
|
}
|
|
4533
4539
|
isAuthenticated() {
|
|
4534
|
-
|
|
4540
|
+
const authKey = this.getAuthKey();
|
|
4541
|
+
if (!authKey) {
|
|
4535
4542
|
return false;
|
|
4536
4543
|
}
|
|
4537
4544
|
try {
|
|
4538
|
-
const [, payload] =
|
|
4545
|
+
const [, payload] = authKey.split(".");
|
|
4539
4546
|
const decodedPayload = JSON.parse(atob(payload));
|
|
4540
4547
|
const currentTimestamp = Math.floor(Date.now() / 1e3);
|
|
4541
4548
|
return decodedPayload.exp > currentTimestamp;
|
|
@@ -4544,34 +4551,17 @@ var BaseClient = class {
|
|
|
4544
4551
|
return false;
|
|
4545
4552
|
}
|
|
4546
4553
|
}
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
// const result: avsPb.KeyResp = await this._callRPC<
|
|
4557
|
-
// avsPb.KeyResp,
|
|
4558
|
-
// avsPb.GetKeyReq
|
|
4559
|
-
// >("getKey", {
|
|
4560
|
-
// owner: address,
|
|
4561
|
-
// expired_at: expirationTime,
|
|
4562
|
-
// signature: jwtToken,
|
|
4563
|
-
// });
|
|
4564
|
-
// this.jwtToken = result.getKey();
|
|
4565
|
-
// return { key: result.getKey() };
|
|
4566
|
-
// }
|
|
4554
|
+
async authWithAPIKey(apiKey, expiredAtEpoch) {
|
|
4555
|
+
const request = new GetKeyReq();
|
|
4556
|
+
request.setOwner("");
|
|
4557
|
+
request.setExpiredAt(expiredAtEpoch);
|
|
4558
|
+
request.setSignature(apiKey);
|
|
4559
|
+
const result = await this._callRPC("getKey", request);
|
|
4560
|
+
this.setAuthKey(result.getKey());
|
|
4561
|
+
return { key: result.getKey() };
|
|
4562
|
+
}
|
|
4567
4563
|
// This flow can be used where the signature is generate from outside, such as in front-end and pass in
|
|
4568
4564
|
async authWithSignature(address, signature, expiredAtEpoch) {
|
|
4569
|
-
console.log(
|
|
4570
|
-
"Authenticating with signature:",
|
|
4571
|
-
signature,
|
|
4572
|
-
"Expired at epoch:",
|
|
4573
|
-
expiredAtEpoch
|
|
4574
|
-
);
|
|
4575
4565
|
const request = new GetKeyReq();
|
|
4576
4566
|
request.setOwner(address);
|
|
4577
4567
|
request.setExpiredAt(expiredAtEpoch);
|
|
@@ -4581,13 +4571,13 @@ var BaseClient = class {
|
|
|
4581
4571
|
request
|
|
4582
4572
|
);
|
|
4583
4573
|
this.setAuthKey(result.getKey());
|
|
4584
|
-
return {
|
|
4574
|
+
return { key: result.getKey() };
|
|
4585
4575
|
}
|
|
4586
4576
|
_callRPC(method, request) {
|
|
4587
4577
|
return new Promise((resolve, reject) => {
|
|
4588
4578
|
this.rpcClient[method].bind(this.rpcClient)(
|
|
4589
4579
|
request,
|
|
4590
|
-
metadata,
|
|
4580
|
+
this.metadata,
|
|
4591
4581
|
(error, response) => {
|
|
4592
4582
|
if (error) reject(error);
|
|
4593
4583
|
else resolve(response);
|
|
@@ -4604,7 +4594,6 @@ var Client = class extends BaseClient {
|
|
|
4604
4594
|
const request = new AddressRequest();
|
|
4605
4595
|
request.setOwner(address);
|
|
4606
4596
|
const result = await this._callRPC("getSmartAccountAddress", request);
|
|
4607
|
-
console.log("getAddresses.result:", result);
|
|
4608
4597
|
return {
|
|
4609
4598
|
owner: address,
|
|
4610
4599
|
smart_account_address: result.getSmartAccountAddress()
|
|
@@ -4637,11 +4626,9 @@ var Client = class extends BaseClient {
|
|
|
4637
4626
|
import_ethers.ethers.parseUnits("12", 18)
|
|
4638
4627
|
]);
|
|
4639
4628
|
execution.setCallData(callData);
|
|
4640
|
-
console.log("execution:", execution.toObject());
|
|
4641
4629
|
action.setContractExecution(execution);
|
|
4642
4630
|
const request = new CreateTaskReq().setTrigger(trigger).setActionsList([action]).setExpiredAt(Math.floor(Date.now() / 1e3) + 1e6);
|
|
4643
4631
|
const result = await this._callRPC("createTask", request);
|
|
4644
|
-
console.log("createTask.result:", result.toObject());
|
|
4645
4632
|
return {
|
|
4646
4633
|
id: result.getId()
|
|
4647
4634
|
};
|
|
@@ -4649,12 +4636,10 @@ var Client = class extends BaseClient {
|
|
|
4649
4636
|
async listTasks(address) {
|
|
4650
4637
|
const request = new ListTasksReq();
|
|
4651
4638
|
const result = await this._callRPC("listTasks", request);
|
|
4652
|
-
console.log("listTasks.result:", result.toObject());
|
|
4653
4639
|
const tasks = import_lodash.default.map(
|
|
4654
4640
|
result.getTasksList(),
|
|
4655
4641
|
(obj) => new task_default(obj)
|
|
4656
4642
|
);
|
|
4657
|
-
console.log("listTasks.tasks:", tasks);
|
|
4658
4643
|
return {
|
|
4659
4644
|
tasks
|
|
4660
4645
|
};
|
|
@@ -4668,7 +4653,6 @@ var Client = class extends BaseClient {
|
|
|
4668
4653
|
"getTask",
|
|
4669
4654
|
request
|
|
4670
4655
|
);
|
|
4671
|
-
console.log("getTask.result:", result.toObject());
|
|
4672
4656
|
return result.toObject();
|
|
4673
4657
|
}
|
|
4674
4658
|
async cancelTask(id) {
|
|
@@ -4692,5 +4676,6 @@ var Client = class extends BaseClient {
|
|
|
4692
4676
|
};
|
|
4693
4677
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4694
4678
|
0 && (module.exports = {
|
|
4679
|
+
AUTH_KEY_HEADER,
|
|
4695
4680
|
getKeyRequestMessage
|
|
4696
4681
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -4178,7 +4178,7 @@ var init_avs_pb = __esm({
|
|
|
4178
4178
|
import _ from "lodash";
|
|
4179
4179
|
import { ethers } from "ethers";
|
|
4180
4180
|
import * as grpc2 from "@grpc/grpc-js";
|
|
4181
|
-
import { Metadata
|
|
4181
|
+
import { Metadata } from "@grpc/grpc-js";
|
|
4182
4182
|
|
|
4183
4183
|
// src/auth.ts
|
|
4184
4184
|
var getKeyRequestMessage = (address, expiredAt) => {
|
|
@@ -4500,13 +4500,14 @@ var Task2 = class {
|
|
|
4500
4500
|
constructor(task) {
|
|
4501
4501
|
this.id = task.getId();
|
|
4502
4502
|
this.status = task.getStatus().toString();
|
|
4503
|
-
console.log("task.constructor:", task.toObject());
|
|
4504
4503
|
}
|
|
4505
4504
|
};
|
|
4506
4505
|
var task_default = Task2;
|
|
4507
4506
|
|
|
4507
|
+
// src/types.ts
|
|
4508
|
+
var AUTH_KEY_HEADER = "authKey";
|
|
4509
|
+
|
|
4508
4510
|
// src/index.ts
|
|
4509
|
-
var metadata = new grpc2.Metadata();
|
|
4510
4511
|
var BaseClient = class {
|
|
4511
4512
|
constructor(opts) {
|
|
4512
4513
|
this.endpoint = opts.endpoint;
|
|
@@ -4514,17 +4515,22 @@ var BaseClient = class {
|
|
|
4514
4515
|
this.endpoint,
|
|
4515
4516
|
grpc2.credentials.createInsecure()
|
|
4516
4517
|
);
|
|
4517
|
-
this.metadata = new
|
|
4518
|
+
this.metadata = new Metadata();
|
|
4519
|
+
}
|
|
4520
|
+
setAuthKey(key) {
|
|
4521
|
+
this.metadata.add(AUTH_KEY_HEADER, key);
|
|
4518
4522
|
}
|
|
4519
|
-
|
|
4520
|
-
metadata.
|
|
4523
|
+
getAuthKey() {
|
|
4524
|
+
const authKey = this.metadata.get(AUTH_KEY_HEADER);
|
|
4525
|
+
return authKey?.[0]?.toString();
|
|
4521
4526
|
}
|
|
4522
4527
|
isAuthenticated() {
|
|
4523
|
-
|
|
4528
|
+
const authKey = this.getAuthKey();
|
|
4529
|
+
if (!authKey) {
|
|
4524
4530
|
return false;
|
|
4525
4531
|
}
|
|
4526
4532
|
try {
|
|
4527
|
-
const [, payload] =
|
|
4533
|
+
const [, payload] = authKey.split(".");
|
|
4528
4534
|
const decodedPayload = JSON.parse(atob(payload));
|
|
4529
4535
|
const currentTimestamp = Math.floor(Date.now() / 1e3);
|
|
4530
4536
|
return decodedPayload.exp > currentTimestamp;
|
|
@@ -4533,34 +4539,17 @@ var BaseClient = class {
|
|
|
4533
4539
|
return false;
|
|
4534
4540
|
}
|
|
4535
4541
|
}
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
// const result: avsPb.KeyResp = await this._callRPC<
|
|
4546
|
-
// avsPb.KeyResp,
|
|
4547
|
-
// avsPb.GetKeyReq
|
|
4548
|
-
// >("getKey", {
|
|
4549
|
-
// owner: address,
|
|
4550
|
-
// expired_at: expirationTime,
|
|
4551
|
-
// signature: jwtToken,
|
|
4552
|
-
// });
|
|
4553
|
-
// this.jwtToken = result.getKey();
|
|
4554
|
-
// return { key: result.getKey() };
|
|
4555
|
-
// }
|
|
4542
|
+
async authWithAPIKey(apiKey, expiredAtEpoch) {
|
|
4543
|
+
const request = new GetKeyReq();
|
|
4544
|
+
request.setOwner("");
|
|
4545
|
+
request.setExpiredAt(expiredAtEpoch);
|
|
4546
|
+
request.setSignature(apiKey);
|
|
4547
|
+
const result = await this._callRPC("getKey", request);
|
|
4548
|
+
this.setAuthKey(result.getKey());
|
|
4549
|
+
return { key: result.getKey() };
|
|
4550
|
+
}
|
|
4556
4551
|
// This flow can be used where the signature is generate from outside, such as in front-end and pass in
|
|
4557
4552
|
async authWithSignature(address, signature, expiredAtEpoch) {
|
|
4558
|
-
console.log(
|
|
4559
|
-
"Authenticating with signature:",
|
|
4560
|
-
signature,
|
|
4561
|
-
"Expired at epoch:",
|
|
4562
|
-
expiredAtEpoch
|
|
4563
|
-
);
|
|
4564
4553
|
const request = new GetKeyReq();
|
|
4565
4554
|
request.setOwner(address);
|
|
4566
4555
|
request.setExpiredAt(expiredAtEpoch);
|
|
@@ -4570,13 +4559,13 @@ var BaseClient = class {
|
|
|
4570
4559
|
request
|
|
4571
4560
|
);
|
|
4572
4561
|
this.setAuthKey(result.getKey());
|
|
4573
|
-
return {
|
|
4562
|
+
return { key: result.getKey() };
|
|
4574
4563
|
}
|
|
4575
4564
|
_callRPC(method, request) {
|
|
4576
4565
|
return new Promise((resolve, reject) => {
|
|
4577
4566
|
this.rpcClient[method].bind(this.rpcClient)(
|
|
4578
4567
|
request,
|
|
4579
|
-
metadata,
|
|
4568
|
+
this.metadata,
|
|
4580
4569
|
(error, response) => {
|
|
4581
4570
|
if (error) reject(error);
|
|
4582
4571
|
else resolve(response);
|
|
@@ -4593,7 +4582,6 @@ var Client = class extends BaseClient {
|
|
|
4593
4582
|
const request = new AddressRequest();
|
|
4594
4583
|
request.setOwner(address);
|
|
4595
4584
|
const result = await this._callRPC("getSmartAccountAddress", request);
|
|
4596
|
-
console.log("getAddresses.result:", result);
|
|
4597
4585
|
return {
|
|
4598
4586
|
owner: address,
|
|
4599
4587
|
smart_account_address: result.getSmartAccountAddress()
|
|
@@ -4626,11 +4614,9 @@ var Client = class extends BaseClient {
|
|
|
4626
4614
|
ethers.parseUnits("12", 18)
|
|
4627
4615
|
]);
|
|
4628
4616
|
execution.setCallData(callData);
|
|
4629
|
-
console.log("execution:", execution.toObject());
|
|
4630
4617
|
action.setContractExecution(execution);
|
|
4631
4618
|
const request = new CreateTaskReq().setTrigger(trigger).setActionsList([action]).setExpiredAt(Math.floor(Date.now() / 1e3) + 1e6);
|
|
4632
4619
|
const result = await this._callRPC("createTask", request);
|
|
4633
|
-
console.log("createTask.result:", result.toObject());
|
|
4634
4620
|
return {
|
|
4635
4621
|
id: result.getId()
|
|
4636
4622
|
};
|
|
@@ -4638,12 +4624,10 @@ var Client = class extends BaseClient {
|
|
|
4638
4624
|
async listTasks(address) {
|
|
4639
4625
|
const request = new ListTasksReq();
|
|
4640
4626
|
const result = await this._callRPC("listTasks", request);
|
|
4641
|
-
console.log("listTasks.result:", result.toObject());
|
|
4642
4627
|
const tasks = _.map(
|
|
4643
4628
|
result.getTasksList(),
|
|
4644
4629
|
(obj) => new task_default(obj)
|
|
4645
4630
|
);
|
|
4646
|
-
console.log("listTasks.tasks:", tasks);
|
|
4647
4631
|
return {
|
|
4648
4632
|
tasks
|
|
4649
4633
|
};
|
|
@@ -4657,7 +4641,6 @@ var Client = class extends BaseClient {
|
|
|
4657
4641
|
"getTask",
|
|
4658
4642
|
request
|
|
4659
4643
|
);
|
|
4660
|
-
console.log("getTask.result:", result.toObject());
|
|
4661
4644
|
return result.toObject();
|
|
4662
4645
|
}
|
|
4663
4646
|
async cancelTask(id) {
|
|
@@ -4680,6 +4663,7 @@ var Client = class extends BaseClient {
|
|
|
4680
4663
|
}
|
|
4681
4664
|
};
|
|
4682
4665
|
export {
|
|
4666
|
+
AUTH_KEY_HEADER,
|
|
4683
4667
|
Client as default,
|
|
4684
4668
|
getKeyRequestMessage
|
|
4685
4669
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avaprotocol/sdk-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "A JavaScript/TypeScript SDK designed to simplify integration with Ava Protocol's AVS",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
"gen-protoc": "grpc_tools_node_protoc --js_out=import_style=commonjs,binary:./grpc_codegen/ --grpc_out=grpc_js:./grpc_codegen/ --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts --ts_out=grpc_js:./grpc_codegen --proto_path=./grpc_codegen grpc_codegen/avs.proto",
|
|
27
27
|
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
28
28
|
"test": "jest --config jest.config.cjs",
|
|
29
|
-
"test:select": "npm run test -- --testNamePattern"
|
|
29
|
+
"test:select": "npm run test -- --testNamePattern",
|
|
30
|
+
"changeset": "changeset",
|
|
31
|
+
"version": "changeset version"
|
|
30
32
|
},
|
|
31
33
|
"dependencies": {
|
|
32
34
|
"@grpc/grpc-js": "^1.11.3",
|
|
@@ -40,6 +42,7 @@
|
|
|
40
42
|
"@babel/core": "^7.26.0",
|
|
41
43
|
"@babel/preset-env": "^7.26.0",
|
|
42
44
|
"@babel/preset-typescript": "^7.26.0",
|
|
45
|
+
"@changesets/cli": "^2.27.9",
|
|
43
46
|
"@jest/globals": "^29.7.0",
|
|
44
47
|
"@types/google-protobuf": "^3.15.12",
|
|
45
48
|
"@types/jest": "^29.5.13",
|