@avaprotocol/sdk-js 0.6.11 → 0.6.12
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 +18 -16
- package/dist/index.d.mts +52 -37
- package/dist/index.d.ts +52 -37
- package/dist/index.js +556 -366
- package/dist/index.mjs +556 -366
- package/package.json +9 -5
package/README.md
CHANGED
|
@@ -38,44 +38,46 @@ import { AvaSDK } from "ava-sdk-js";
|
|
|
38
38
|
In the case of `.proto` files at https://github.com/AvaProtocol/EigenLayer-AVS/blob/main/protobuf/avs.proto changes, the gRPC types needs to be regenerated.Before regenerating the types from the protocol buffers, ensure that `grpc_tools_node_protoc` is installed globally on your system. You can install it using npm:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
npm install
|
|
41
|
+
npm install # install grpc-tools, etc. as dev dependencies
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
Then, run the following command to regenerate the types:
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
+
# download the latest .proto file from https://github.com/AvaProtocol/EigenLayer-AVS
|
|
48
|
+
npm run proto-download
|
|
49
|
+
|
|
50
|
+
# Generate the TypeScript types and gRPC code based on the downloaded .proto file
|
|
47
51
|
npm run gen-protoc
|
|
48
52
|
```
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
> Important: the last line of the `grpc_codegen/avs_pb.js` needs to be manually added after the `gen-protoc` command. These type definitions must be exported; otherwise they will be undefined in the SDK. For example: `export const { Task, CreateTaskReq, CreateTaskResp, GetKeyReq, KeyResp, UpdateChecksReq, UpdateChecksResp, AddressResp, AddressRequest } = proto.aggregator;`
|
|
51
55
|
|
|
52
56
|
### Running Tests
|
|
53
57
|
|
|
54
58
|
To ensure the SDK is functioning correctly, we have a comprehensive test suite. Follow these steps to run the tests:
|
|
55
59
|
|
|
56
|
-
1. Make sure all dependencies are installed
|
|
60
|
+
1. Make sure all dependencies are installed, and build the project. Tests are run against the files in the `/dist` folder
|
|
57
61
|
```bash
|
|
58
62
|
npm install
|
|
63
|
+
npm run build
|
|
59
64
|
```
|
|
65
|
+
2. Before running the e2e tests, make sure to configure the required environment variables in your `.env.test` file, based on the `.env.example` file.
|
|
66
|
+
|
|
67
|
+
3. Run the test command. This will test the SDK against test server, configured in `.env.test`.
|
|
60
68
|
|
|
61
|
-
2. Run the test command. This will test the SDK against mockup responses.
|
|
62
69
|
```bash
|
|
70
|
+
# Run all tests
|
|
63
71
|
npm test
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
3. To test the SDK against the live AVS on Ethereum Mainnet, you can run the following command:
|
|
67
|
-
```bash
|
|
68
|
-
npm run test:e2e
|
|
69
|
-
```
|
|
70
72
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
TEST_JWT_TOKEN=your_TEST_JWT_TOKEN_here
|
|
75
|
-
TEST_OWNER=your_test_owner_here
|
|
73
|
+
# or, run a specific test
|
|
74
|
+
npm run test:select -- <authWithSignature>
|
|
76
75
|
```
|
|
77
76
|
|
|
78
|
-
|
|
77
|
+
4. In order to individually test `cancelTask` or `deleteTask`, `createTask` test needs to run first.
|
|
78
|
+
```bash
|
|
79
|
+
npm run test:select -- "createTask|cancelTask"
|
|
80
|
+
```
|
|
79
81
|
|
|
80
82
|
This will execute all unit and integration tests. Make sure all tests pass before submitting a pull request or deploying changes.
|
|
81
83
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as grpc from '@grpc/grpc-js';
|
|
2
|
+
import { Metadata } from '@grpc/grpc-js';
|
|
2
3
|
import * as jspb from 'google-protobuf';
|
|
3
4
|
import * as google_protobuf_timestamp_pb from 'google-protobuf/google/protobuf/timestamp_pb';
|
|
4
5
|
import * as google_protobuf_wrappers_pb from 'google-protobuf/google/protobuf/wrappers_pb';
|
|
@@ -565,53 +566,53 @@ declare namespace Execution {
|
|
|
565
566
|
}
|
|
566
567
|
}
|
|
567
568
|
|
|
568
|
-
declare class Task extends jspb.Message {
|
|
569
|
+
declare class Task$1 extends jspb.Message {
|
|
569
570
|
|
|
570
571
|
hasId(): boolean;
|
|
571
572
|
clearId(): void;
|
|
572
573
|
getId(): UUID | undefined;
|
|
573
|
-
setId(value?: UUID): Task;
|
|
574
|
+
setId(value?: UUID): Task$1;
|
|
574
575
|
getOwner(): string;
|
|
575
|
-
setOwner(value: string): Task;
|
|
576
|
+
setOwner(value: string): Task$1;
|
|
576
577
|
getSmartAccountAddress(): string;
|
|
577
|
-
setSmartAccountAddress(value: string): Task;
|
|
578
|
+
setSmartAccountAddress(value: string): Task$1;
|
|
578
579
|
|
|
579
580
|
hasTrigger(): boolean;
|
|
580
581
|
clearTrigger(): void;
|
|
581
582
|
getTrigger(): TaskTrigger | undefined;
|
|
582
|
-
setTrigger(value?: TaskTrigger): Task;
|
|
583
|
+
setTrigger(value?: TaskTrigger): Task$1;
|
|
583
584
|
clearNodesList(): void;
|
|
584
585
|
getNodesList(): Array<TaskAction>;
|
|
585
|
-
setNodesList(value: Array<TaskAction>): Task;
|
|
586
|
+
setNodesList(value: Array<TaskAction>): Task$1;
|
|
586
587
|
addNodes(value?: TaskAction, index?: number): TaskAction;
|
|
587
588
|
getStartAt(): number;
|
|
588
|
-
setStartAt(value: number): Task;
|
|
589
|
+
setStartAt(value: number): Task$1;
|
|
589
590
|
getExpiredAt(): number;
|
|
590
|
-
setExpiredAt(value: number): Task;
|
|
591
|
+
setExpiredAt(value: number): Task$1;
|
|
591
592
|
getMemo(): string;
|
|
592
|
-
setMemo(value: string): Task;
|
|
593
|
+
setMemo(value: string): Task$1;
|
|
593
594
|
getCompletedAt(): number;
|
|
594
|
-
setCompletedAt(value: number): Task;
|
|
595
|
+
setCompletedAt(value: number): Task$1;
|
|
595
596
|
getStatus(): TaskStatus;
|
|
596
|
-
setStatus(value: TaskStatus): Task;
|
|
597
|
+
setStatus(value: TaskStatus): Task$1;
|
|
597
598
|
getRepeatable(): boolean;
|
|
598
|
-
setRepeatable(value: boolean): Task;
|
|
599
|
+
setRepeatable(value: boolean): Task$1;
|
|
599
600
|
clearExecutionsList(): void;
|
|
600
601
|
getExecutionsList(): Array<Execution>;
|
|
601
|
-
setExecutionsList(value: Array<Execution>): Task;
|
|
602
|
+
setExecutionsList(value: Array<Execution>): Task$1;
|
|
602
603
|
addExecutions(value?: Execution, index?: number): Execution;
|
|
603
604
|
|
|
604
605
|
serializeBinary(): Uint8Array;
|
|
605
|
-
toObject(includeInstance?: boolean): Task.AsObject;
|
|
606
|
-
static toObject(includeInstance: boolean, msg: Task): Task.AsObject;
|
|
606
|
+
toObject(includeInstance?: boolean): Task$1.AsObject;
|
|
607
|
+
static toObject(includeInstance: boolean, msg: Task$1): Task$1.AsObject;
|
|
607
608
|
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
608
609
|
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
609
|
-
static serializeBinaryToWriter(message: Task, writer: jspb.BinaryWriter): void;
|
|
610
|
-
static deserializeBinary(bytes: Uint8Array): Task;
|
|
611
|
-
static deserializeBinaryFromReader(message: Task, reader: jspb.BinaryReader): Task;
|
|
610
|
+
static serializeBinaryToWriter(message: Task$1, writer: jspb.BinaryWriter): void;
|
|
611
|
+
static deserializeBinary(bytes: Uint8Array): Task$1;
|
|
612
|
+
static deserializeBinaryFromReader(message: Task$1, reader: jspb.BinaryReader): Task$1;
|
|
612
613
|
}
|
|
613
614
|
|
|
614
|
-
declare namespace Task {
|
|
615
|
+
declare namespace Task$1 {
|
|
615
616
|
export type AsObject = {
|
|
616
617
|
id?: UUID.AsObject,
|
|
617
618
|
owner: string,
|
|
@@ -1087,18 +1088,18 @@ interface IAggregatorClient {
|
|
|
1087
1088
|
): grpc.ClientUnaryCall;
|
|
1088
1089
|
getTask(
|
|
1089
1090
|
request: UUID,
|
|
1090
|
-
callback: (error: grpc.ServiceError | null, response: Task) => void
|
|
1091
|
+
callback: (error: grpc.ServiceError | null, response: Task$1) => void
|
|
1091
1092
|
): grpc.ClientUnaryCall;
|
|
1092
1093
|
getTask(
|
|
1093
1094
|
request: UUID,
|
|
1094
1095
|
metadata: grpc.Metadata,
|
|
1095
|
-
callback: (error: grpc.ServiceError | null, response: Task) => void
|
|
1096
|
+
callback: (error: grpc.ServiceError | null, response: Task$1) => void
|
|
1096
1097
|
): grpc.ClientUnaryCall;
|
|
1097
1098
|
getTask(
|
|
1098
1099
|
request: UUID,
|
|
1099
1100
|
metadata: grpc.Metadata,
|
|
1100
1101
|
options: Partial<grpc.CallOptions>,
|
|
1101
|
-
callback: (error: grpc.ServiceError | null, response: Task) => void
|
|
1102
|
+
callback: (error: grpc.ServiceError | null, response: Task$1) => void
|
|
1102
1103
|
): grpc.ClientUnaryCall;
|
|
1103
1104
|
cancelTask(
|
|
1104
1105
|
request: UUID,
|
|
@@ -1335,18 +1336,18 @@ declare class AggregatorClient extends grpc.Client implements IAggregatorClient
|
|
|
1335
1336
|
): grpc.ClientUnaryCall;
|
|
1336
1337
|
public getTask(
|
|
1337
1338
|
request: UUID,
|
|
1338
|
-
callback: (error: grpc.ServiceError | null, response: Task) => void
|
|
1339
|
+
callback: (error: grpc.ServiceError | null, response: Task$1) => void
|
|
1339
1340
|
): grpc.ClientUnaryCall;
|
|
1340
1341
|
public getTask(
|
|
1341
1342
|
request: UUID,
|
|
1342
1343
|
metadata: grpc.Metadata,
|
|
1343
|
-
callback: (error: grpc.ServiceError | null, response: Task) => void
|
|
1344
|
+
callback: (error: grpc.ServiceError | null, response: Task$1) => void
|
|
1344
1345
|
): grpc.ClientUnaryCall;
|
|
1345
1346
|
public getTask(
|
|
1346
1347
|
request: UUID,
|
|
1347
1348
|
metadata: grpc.Metadata,
|
|
1348
1349
|
options: Partial<grpc.CallOptions>,
|
|
1349
|
-
callback: (error: grpc.ServiceError | null, response: Task) => void
|
|
1350
|
+
callback: (error: grpc.ServiceError | null, response: Task$1) => void
|
|
1350
1351
|
): grpc.ClientUnaryCall;
|
|
1351
1352
|
public cancelTask(
|
|
1352
1353
|
request: UUID,
|
|
@@ -1456,24 +1457,27 @@ declare class AggregatorClient extends grpc.Client implements IAggregatorClient
|
|
|
1456
1457
|
}
|
|
1457
1458
|
|
|
1458
1459
|
type Environment = "production" | "development" | "staging";
|
|
1459
|
-
interface
|
|
1460
|
-
|
|
1460
|
+
interface GetKeyResponse {
|
|
1461
|
+
jwtToken: string;
|
|
1461
1462
|
}
|
|
1462
1463
|
interface ClientOption {
|
|
1463
1464
|
endpoint: string;
|
|
1464
1465
|
jwtApiKey?: string;
|
|
1465
1466
|
}
|
|
1466
|
-
interface
|
|
1467
|
+
interface Task {
|
|
1467
1468
|
id: string;
|
|
1468
1469
|
status: string;
|
|
1469
1470
|
result?: any;
|
|
1470
1471
|
error?: string;
|
|
1471
1472
|
}
|
|
1472
|
-
interface
|
|
1473
|
-
|
|
1473
|
+
interface CreateTaskResponse {
|
|
1474
|
+
id: string;
|
|
1475
|
+
}
|
|
1476
|
+
interface ListTasksResponse {
|
|
1477
|
+
tasks: Task[];
|
|
1474
1478
|
}
|
|
1475
|
-
interface
|
|
1476
|
-
|
|
1479
|
+
interface GetAddressesResponse {
|
|
1480
|
+
owner: string;
|
|
1477
1481
|
smart_account_address: string;
|
|
1478
1482
|
}
|
|
1479
1483
|
interface TransactionResp {
|
|
@@ -1486,14 +1490,25 @@ interface BalanceResp {
|
|
|
1486
1490
|
declare class BaseClient {
|
|
1487
1491
|
readonly endpoint: string;
|
|
1488
1492
|
readonly rpcClient: AggregatorClient;
|
|
1489
|
-
protected
|
|
1493
|
+
protected metadata: Metadata;
|
|
1490
1494
|
constructor(opts: ClientOption);
|
|
1491
|
-
|
|
1495
|
+
private setAuthKey;
|
|
1492
1496
|
isAuthenticated(): boolean;
|
|
1497
|
+
authWithSignature(address: string, signature: string, expiredAtEpoch: number): Promise<GetKeyResponse>;
|
|
1493
1498
|
protected _callRPC<TResponse, TRequest>(method: string, request: TRequest | any): Promise<TResponse>;
|
|
1494
1499
|
}
|
|
1495
1500
|
declare class Client extends BaseClient {
|
|
1496
1501
|
constructor(config: ClientOption);
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1502
|
+
getAddresses(address: string): Promise<GetAddressesResponse>;
|
|
1503
|
+
createTask({ address, oracleContract, tokenContract, }: {
|
|
1504
|
+
address: string;
|
|
1505
|
+
tokenContract: string;
|
|
1506
|
+
oracleContract: string;
|
|
1507
|
+
}): Promise<CreateTaskResponse>;
|
|
1508
|
+
listTasks(address: string): Promise<ListTasksResponse>;
|
|
1509
|
+
getTask(id: string): Promise<object>;
|
|
1510
|
+
cancelTask(id: string): Promise<boolean>;
|
|
1511
|
+
deleteTask(id: string): Promise<boolean>;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
export { 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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as grpc from '@grpc/grpc-js';
|
|
2
|
+
import { Metadata } from '@grpc/grpc-js';
|
|
2
3
|
import * as jspb from 'google-protobuf';
|
|
3
4
|
import * as google_protobuf_timestamp_pb from 'google-protobuf/google/protobuf/timestamp_pb';
|
|
4
5
|
import * as google_protobuf_wrappers_pb from 'google-protobuf/google/protobuf/wrappers_pb';
|
|
@@ -565,53 +566,53 @@ declare namespace Execution {
|
|
|
565
566
|
}
|
|
566
567
|
}
|
|
567
568
|
|
|
568
|
-
declare class Task extends jspb.Message {
|
|
569
|
+
declare class Task$1 extends jspb.Message {
|
|
569
570
|
|
|
570
571
|
hasId(): boolean;
|
|
571
572
|
clearId(): void;
|
|
572
573
|
getId(): UUID | undefined;
|
|
573
|
-
setId(value?: UUID): Task;
|
|
574
|
+
setId(value?: UUID): Task$1;
|
|
574
575
|
getOwner(): string;
|
|
575
|
-
setOwner(value: string): Task;
|
|
576
|
+
setOwner(value: string): Task$1;
|
|
576
577
|
getSmartAccountAddress(): string;
|
|
577
|
-
setSmartAccountAddress(value: string): Task;
|
|
578
|
+
setSmartAccountAddress(value: string): Task$1;
|
|
578
579
|
|
|
579
580
|
hasTrigger(): boolean;
|
|
580
581
|
clearTrigger(): void;
|
|
581
582
|
getTrigger(): TaskTrigger | undefined;
|
|
582
|
-
setTrigger(value?: TaskTrigger): Task;
|
|
583
|
+
setTrigger(value?: TaskTrigger): Task$1;
|
|
583
584
|
clearNodesList(): void;
|
|
584
585
|
getNodesList(): Array<TaskAction>;
|
|
585
|
-
setNodesList(value: Array<TaskAction>): Task;
|
|
586
|
+
setNodesList(value: Array<TaskAction>): Task$1;
|
|
586
587
|
addNodes(value?: TaskAction, index?: number): TaskAction;
|
|
587
588
|
getStartAt(): number;
|
|
588
|
-
setStartAt(value: number): Task;
|
|
589
|
+
setStartAt(value: number): Task$1;
|
|
589
590
|
getExpiredAt(): number;
|
|
590
|
-
setExpiredAt(value: number): Task;
|
|
591
|
+
setExpiredAt(value: number): Task$1;
|
|
591
592
|
getMemo(): string;
|
|
592
|
-
setMemo(value: string): Task;
|
|
593
|
+
setMemo(value: string): Task$1;
|
|
593
594
|
getCompletedAt(): number;
|
|
594
|
-
setCompletedAt(value: number): Task;
|
|
595
|
+
setCompletedAt(value: number): Task$1;
|
|
595
596
|
getStatus(): TaskStatus;
|
|
596
|
-
setStatus(value: TaskStatus): Task;
|
|
597
|
+
setStatus(value: TaskStatus): Task$1;
|
|
597
598
|
getRepeatable(): boolean;
|
|
598
|
-
setRepeatable(value: boolean): Task;
|
|
599
|
+
setRepeatable(value: boolean): Task$1;
|
|
599
600
|
clearExecutionsList(): void;
|
|
600
601
|
getExecutionsList(): Array<Execution>;
|
|
601
|
-
setExecutionsList(value: Array<Execution>): Task;
|
|
602
|
+
setExecutionsList(value: Array<Execution>): Task$1;
|
|
602
603
|
addExecutions(value?: Execution, index?: number): Execution;
|
|
603
604
|
|
|
604
605
|
serializeBinary(): Uint8Array;
|
|
605
|
-
toObject(includeInstance?: boolean): Task.AsObject;
|
|
606
|
-
static toObject(includeInstance: boolean, msg: Task): Task.AsObject;
|
|
606
|
+
toObject(includeInstance?: boolean): Task$1.AsObject;
|
|
607
|
+
static toObject(includeInstance: boolean, msg: Task$1): Task$1.AsObject;
|
|
607
608
|
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
608
609
|
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
609
|
-
static serializeBinaryToWriter(message: Task, writer: jspb.BinaryWriter): void;
|
|
610
|
-
static deserializeBinary(bytes: Uint8Array): Task;
|
|
611
|
-
static deserializeBinaryFromReader(message: Task, reader: jspb.BinaryReader): Task;
|
|
610
|
+
static serializeBinaryToWriter(message: Task$1, writer: jspb.BinaryWriter): void;
|
|
611
|
+
static deserializeBinary(bytes: Uint8Array): Task$1;
|
|
612
|
+
static deserializeBinaryFromReader(message: Task$1, reader: jspb.BinaryReader): Task$1;
|
|
612
613
|
}
|
|
613
614
|
|
|
614
|
-
declare namespace Task {
|
|
615
|
+
declare namespace Task$1 {
|
|
615
616
|
export type AsObject = {
|
|
616
617
|
id?: UUID.AsObject,
|
|
617
618
|
owner: string,
|
|
@@ -1087,18 +1088,18 @@ interface IAggregatorClient {
|
|
|
1087
1088
|
): grpc.ClientUnaryCall;
|
|
1088
1089
|
getTask(
|
|
1089
1090
|
request: UUID,
|
|
1090
|
-
callback: (error: grpc.ServiceError | null, response: Task) => void
|
|
1091
|
+
callback: (error: grpc.ServiceError | null, response: Task$1) => void
|
|
1091
1092
|
): grpc.ClientUnaryCall;
|
|
1092
1093
|
getTask(
|
|
1093
1094
|
request: UUID,
|
|
1094
1095
|
metadata: grpc.Metadata,
|
|
1095
|
-
callback: (error: grpc.ServiceError | null, response: Task) => void
|
|
1096
|
+
callback: (error: grpc.ServiceError | null, response: Task$1) => void
|
|
1096
1097
|
): grpc.ClientUnaryCall;
|
|
1097
1098
|
getTask(
|
|
1098
1099
|
request: UUID,
|
|
1099
1100
|
metadata: grpc.Metadata,
|
|
1100
1101
|
options: Partial<grpc.CallOptions>,
|
|
1101
|
-
callback: (error: grpc.ServiceError | null, response: Task) => void
|
|
1102
|
+
callback: (error: grpc.ServiceError | null, response: Task$1) => void
|
|
1102
1103
|
): grpc.ClientUnaryCall;
|
|
1103
1104
|
cancelTask(
|
|
1104
1105
|
request: UUID,
|
|
@@ -1335,18 +1336,18 @@ declare class AggregatorClient extends grpc.Client implements IAggregatorClient
|
|
|
1335
1336
|
): grpc.ClientUnaryCall;
|
|
1336
1337
|
public getTask(
|
|
1337
1338
|
request: UUID,
|
|
1338
|
-
callback: (error: grpc.ServiceError | null, response: Task) => void
|
|
1339
|
+
callback: (error: grpc.ServiceError | null, response: Task$1) => void
|
|
1339
1340
|
): grpc.ClientUnaryCall;
|
|
1340
1341
|
public getTask(
|
|
1341
1342
|
request: UUID,
|
|
1342
1343
|
metadata: grpc.Metadata,
|
|
1343
|
-
callback: (error: grpc.ServiceError | null, response: Task) => void
|
|
1344
|
+
callback: (error: grpc.ServiceError | null, response: Task$1) => void
|
|
1344
1345
|
): grpc.ClientUnaryCall;
|
|
1345
1346
|
public getTask(
|
|
1346
1347
|
request: UUID,
|
|
1347
1348
|
metadata: grpc.Metadata,
|
|
1348
1349
|
options: Partial<grpc.CallOptions>,
|
|
1349
|
-
callback: (error: grpc.ServiceError | null, response: Task) => void
|
|
1350
|
+
callback: (error: grpc.ServiceError | null, response: Task$1) => void
|
|
1350
1351
|
): grpc.ClientUnaryCall;
|
|
1351
1352
|
public cancelTask(
|
|
1352
1353
|
request: UUID,
|
|
@@ -1456,24 +1457,27 @@ declare class AggregatorClient extends grpc.Client implements IAggregatorClient
|
|
|
1456
1457
|
}
|
|
1457
1458
|
|
|
1458
1459
|
type Environment = "production" | "development" | "staging";
|
|
1459
|
-
interface
|
|
1460
|
-
|
|
1460
|
+
interface GetKeyResponse {
|
|
1461
|
+
jwtToken: string;
|
|
1461
1462
|
}
|
|
1462
1463
|
interface ClientOption {
|
|
1463
1464
|
endpoint: string;
|
|
1464
1465
|
jwtApiKey?: string;
|
|
1465
1466
|
}
|
|
1466
|
-
interface
|
|
1467
|
+
interface Task {
|
|
1467
1468
|
id: string;
|
|
1468
1469
|
status: string;
|
|
1469
1470
|
result?: any;
|
|
1470
1471
|
error?: string;
|
|
1471
1472
|
}
|
|
1472
|
-
interface
|
|
1473
|
-
|
|
1473
|
+
interface CreateTaskResponse {
|
|
1474
|
+
id: string;
|
|
1475
|
+
}
|
|
1476
|
+
interface ListTasksResponse {
|
|
1477
|
+
tasks: Task[];
|
|
1474
1478
|
}
|
|
1475
|
-
interface
|
|
1476
|
-
|
|
1479
|
+
interface GetAddressesResponse {
|
|
1480
|
+
owner: string;
|
|
1477
1481
|
smart_account_address: string;
|
|
1478
1482
|
}
|
|
1479
1483
|
interface TransactionResp {
|
|
@@ -1486,14 +1490,25 @@ interface BalanceResp {
|
|
|
1486
1490
|
declare class BaseClient {
|
|
1487
1491
|
readonly endpoint: string;
|
|
1488
1492
|
readonly rpcClient: AggregatorClient;
|
|
1489
|
-
protected
|
|
1493
|
+
protected metadata: Metadata;
|
|
1490
1494
|
constructor(opts: ClientOption);
|
|
1491
|
-
|
|
1495
|
+
private setAuthKey;
|
|
1492
1496
|
isAuthenticated(): boolean;
|
|
1497
|
+
authWithSignature(address: string, signature: string, expiredAtEpoch: number): Promise<GetKeyResponse>;
|
|
1493
1498
|
protected _callRPC<TResponse, TRequest>(method: string, request: TRequest | any): Promise<TResponse>;
|
|
1494
1499
|
}
|
|
1495
1500
|
declare class Client extends BaseClient {
|
|
1496
1501
|
constructor(config: ClientOption);
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1502
|
+
getAddresses(address: string): Promise<GetAddressesResponse>;
|
|
1503
|
+
createTask({ address, oracleContract, tokenContract, }: {
|
|
1504
|
+
address: string;
|
|
1505
|
+
tokenContract: string;
|
|
1506
|
+
oracleContract: string;
|
|
1507
|
+
}): Promise<CreateTaskResponse>;
|
|
1508
|
+
listTasks(address: string): Promise<ListTasksResponse>;
|
|
1509
|
+
getTask(id: string): Promise<object>;
|
|
1510
|
+
cancelTask(id: string): Promise<boolean>;
|
|
1511
|
+
deleteTask(id: string): Promise<boolean>;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
export { type BalanceResp, type ClientOption, type CreateTaskResponse, type Environment, type GetAddressesResponse, type GetKeyResponse, type ListTasksResponse, type Task, type TransactionResp, Client as default, getKeyRequestMessage };
|