@avaprotocol/sdk-js 0.6.4 → 0.6.6
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/.env.example +7 -0
- package/dist/index.cjs +67 -90
- package/dist/index.d.cts +524 -89
- package/dist/index.d.ts +524 -89
- package/dist/index.js +71 -88
- package/grpc_codegen/avs.proto +297 -0
- package/grpc_codegen/avs.ts +3720 -0
- package/grpc_codegen/avs_grpc_pb.d.ts +665 -0
- package/grpc_codegen/avs_grpc_pb.js +349 -0
- package/grpc_codegen/avs_pb.d.ts +958 -0
- package/grpc_codegen/avs_pb.js +7545 -0
- package/jest.config.cjs +21 -0
- package/package.json +5 -8
- package/scripts/signMessage.js +27 -0
- package/src/__tests__/Client.e2e.test.ts +172 -0
- package/src/auth.js +7 -0
- package/src/auth.ts +3 -0
- package/src/config.js +22 -0
- package/src/config.ts +27 -0
- package/src/index.ts +131 -0
- package/src/rpc-client.ts +7 -0
- package/src/types.js +2 -0
- package/src/types.ts +47 -0
- package/tsconfig.json +20 -0
package/dist/index.js
CHANGED
|
@@ -11,6 +11,10 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
11
11
|
var __esm = (fn, res) => function __init() {
|
|
12
12
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
13
13
|
};
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
14
18
|
var __copyProps = (to, from, except, desc) => {
|
|
15
19
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
20
|
for (let key of __getOwnPropNames(from))
|
|
@@ -23,7 +27,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
23
27
|
|
|
24
28
|
// grpc_codegen/avs_pb.js
|
|
25
29
|
var avs_pb_exports = {};
|
|
26
|
-
|
|
30
|
+
__export(avs_pb_exports, {
|
|
31
|
+
CreateTaskReq: () => CreateTaskReq,
|
|
32
|
+
CreateTaskResp: () => CreateTaskResp,
|
|
33
|
+
GetKeyReq: () => GetKeyReq,
|
|
34
|
+
KeyResp: () => KeyResp,
|
|
35
|
+
Task: () => Task,
|
|
36
|
+
UpdateChecksReq: () => UpdateChecksReq,
|
|
37
|
+
UpdateChecksResp: () => UpdateChecksResp
|
|
38
|
+
});
|
|
39
|
+
var jspb, goog, global, google_protobuf_timestamp_pb, google_protobuf_wrappers_pb, Task, CreateTaskReq, CreateTaskResp, GetKeyReq, KeyResp, UpdateChecksReq, UpdateChecksResp;
|
|
27
40
|
var init_avs_pb = __esm({
|
|
28
41
|
"grpc_codegen/avs_pb.js"() {
|
|
29
42
|
"use strict";
|
|
@@ -4084,12 +4097,29 @@ var init_avs_pb = __esm({
|
|
|
4084
4097
|
JAVASCRIPT: 0
|
|
4085
4098
|
};
|
|
4086
4099
|
goog.object.extend(exports, proto.aggregator);
|
|
4100
|
+
({ Task, CreateTaskReq, CreateTaskResp, GetKeyReq, KeyResp, UpdateChecksReq, UpdateChecksResp } = proto.aggregator);
|
|
4087
4101
|
}
|
|
4088
4102
|
});
|
|
4089
4103
|
|
|
4090
4104
|
// src/index.ts
|
|
4091
4105
|
import * as grpc2 from "@grpc/grpc-js";
|
|
4092
|
-
|
|
4106
|
+
|
|
4107
|
+
// src/config.ts
|
|
4108
|
+
var DEFAULT_JWT_EXPIRATION = 24 * 60 * 60;
|
|
4109
|
+
var configs = {
|
|
4110
|
+
development: {
|
|
4111
|
+
AVS_RPC_URL: process.env.AVS_RPC_URL || "localhost:2206"
|
|
4112
|
+
},
|
|
4113
|
+
staging: {
|
|
4114
|
+
AVS_RPC_URL: "aggregator-holesky.avaprotocol.org:2206"
|
|
4115
|
+
},
|
|
4116
|
+
production: {
|
|
4117
|
+
AVS_RPC_URL: "aggregator.avaprotocol.org:2206"
|
|
4118
|
+
}
|
|
4119
|
+
};
|
|
4120
|
+
function getRpcEndpoint(env) {
|
|
4121
|
+
return configs[env].AVS_RPC_URL;
|
|
4122
|
+
}
|
|
4093
4123
|
|
|
4094
4124
|
// src/auth.ts
|
|
4095
4125
|
var getKeyRequestMessage = (address, expiredAt) => {
|
|
@@ -4272,7 +4302,7 @@ function serialize_google_protobuf_BoolValue(arg) {
|
|
|
4272
4302
|
function deserialize_google_protobuf_BoolValue(buffer_arg) {
|
|
4273
4303
|
return google_protobuf_wrappers_pb2.BoolValue.deserializeBinary(new Uint8Array(buffer_arg));
|
|
4274
4304
|
}
|
|
4275
|
-
var AggregatorService =
|
|
4305
|
+
var AggregatorService = {
|
|
4276
4306
|
// Auth
|
|
4277
4307
|
getKey: {
|
|
4278
4308
|
path: "/aggregator.Aggregator/GetKey",
|
|
@@ -4399,20 +4429,20 @@ var AggregatorService = exports.AggregatorService = {
|
|
|
4399
4429
|
responseDeserialize: deserialize_aggregator_UpdateChecksResp
|
|
4400
4430
|
}
|
|
4401
4431
|
};
|
|
4402
|
-
|
|
4432
|
+
var AggregatorClient = grpc.makeGenericClientConstructor(AggregatorService);
|
|
4403
4433
|
|
|
4404
4434
|
// src/index.ts
|
|
4405
4435
|
init_avs_pb();
|
|
4406
|
-
var
|
|
4436
|
+
var metadata = new grpc2.Metadata();
|
|
4407
4437
|
var BaseClient = class {
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
config.endpoint,
|
|
4438
|
+
constructor(opts) {
|
|
4439
|
+
this.env = opts.env || "production";
|
|
4440
|
+
this.rpcClient = new AggregatorClient(
|
|
4441
|
+
getRpcEndpoint(this.env),
|
|
4442
|
+
// TODO: switch to the TLS after we're able to update all the operator
|
|
4414
4443
|
grpc2.credentials.createInsecure()
|
|
4415
4444
|
);
|
|
4445
|
+
console.log("this.rpcClient:", this.rpcClient);
|
|
4416
4446
|
}
|
|
4417
4447
|
// async authWithJwtToken(
|
|
4418
4448
|
// address: string,
|
|
@@ -4420,21 +4450,21 @@ var BaseClient = class {
|
|
|
4420
4450
|
// expiredAt?: number
|
|
4421
4451
|
// ): Promise<KeyExchangeResp> {
|
|
4422
4452
|
// console.log("Authenticating with JWT token: ", jwtToken);
|
|
4453
|
+
// // Use the provided expiredAt or set it to 24 hours from now if not provided
|
|
4423
4454
|
// const expirationTime =
|
|
4424
4455
|
// expiredAt || Math.floor(Date.now() / 1000) + DEFAULT_JWT_EXPIRATION;
|
|
4425
|
-
// const
|
|
4426
|
-
//
|
|
4427
|
-
//
|
|
4428
|
-
//
|
|
4429
|
-
//
|
|
4430
|
-
//
|
|
4431
|
-
//
|
|
4432
|
-
//
|
|
4433
|
-
//
|
|
4434
|
-
//
|
|
4435
|
-
// console.log("response:", response.getKey());
|
|
4436
|
-
// return { key: response.getKey() };
|
|
4456
|
+
// const result: avsPb.KeyResp = await this._callRPC<
|
|
4457
|
+
// avsPb.KeyResp,
|
|
4458
|
+
// avsPb.GetKeyReq
|
|
4459
|
+
// >("getKey", {
|
|
4460
|
+
// owner: address,
|
|
4461
|
+
// expired_at: expirationTime,
|
|
4462
|
+
// signature: jwtToken,
|
|
4463
|
+
// });
|
|
4464
|
+
// this.authkey = result.getKey();
|
|
4465
|
+
// return { key: result.getKey() };
|
|
4437
4466
|
// }
|
|
4467
|
+
// This flow can be used where the signature is generate from outside, such as in front-end and pass in
|
|
4438
4468
|
async authWithSignature(address, signature, expiredAtEpoch) {
|
|
4439
4469
|
console.log(
|
|
4440
4470
|
"Authenticating with signature:",
|
|
@@ -4442,52 +4472,29 @@ var BaseClient = class {
|
|
|
4442
4472
|
"Expired at epoch:",
|
|
4443
4473
|
expiredAtEpoch
|
|
4444
4474
|
);
|
|
4445
|
-
const request = new (
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4475
|
+
const request = new GetKeyReq();
|
|
4476
|
+
request.setOwner(address);
|
|
4477
|
+
request.setExpiredAt(expiredAtEpoch);
|
|
4478
|
+
request.setSignature(signature);
|
|
4479
|
+
let result = await this._callRPC(
|
|
4480
|
+
"getKey",
|
|
4481
|
+
request
|
|
4482
|
+
);
|
|
4483
|
+
console.log("result:", result);
|
|
4484
|
+
this.authkey = result.getKey();
|
|
4485
|
+
return { key: result.getKey() };
|
|
4450
4486
|
}
|
|
4451
|
-
// protected async sendRequest<TResponse, TRequest extends object = {}>(
|
|
4452
|
-
// method: string,
|
|
4453
|
-
// request: TRequest = {} as TRequest,
|
|
4454
|
-
// metadata?: Metadata
|
|
4455
|
-
// ): Promise<TResponse> {
|
|
4456
|
-
// if (metadata === undefined) {
|
|
4457
|
-
// metadata = new grpc.Metadata();
|
|
4458
|
-
// }
|
|
4459
|
-
// if (!this.adminToken) {
|
|
4460
|
-
// throw new Error(
|
|
4461
|
-
// "Authentication required. Please call authWithJwtToken() or authWithSignature() before making requests."
|
|
4462
|
-
// );
|
|
4463
|
-
// }
|
|
4464
|
-
// metadata.add("adminToken", this.adminToken);
|
|
4465
|
-
// return this._callRPC<TResponse, TRequest>(
|
|
4466
|
-
// method as (
|
|
4467
|
-
// request: TRequest,
|
|
4468
|
-
// metadata: grpc.Metadata | undefined,
|
|
4469
|
-
// callback: (error: grpc.ServiceError | null, response: TResponse) => void
|
|
4470
|
-
// ),
|
|
4471
|
-
// request,
|
|
4472
|
-
// metadata
|
|
4473
|
-
// );
|
|
4474
|
-
// }
|
|
4475
4487
|
isAuthenticated() {
|
|
4476
|
-
return !!this.
|
|
4488
|
+
return !!this.authkey;
|
|
4477
4489
|
}
|
|
4478
|
-
_callRPC(
|
|
4490
|
+
_callRPC(method, request) {
|
|
4479
4491
|
return new Promise((resolve, reject) => {
|
|
4480
|
-
|
|
4481
|
-
method.call(
|
|
4482
|
-
this.rpcClient,
|
|
4492
|
+
this.rpcClient[method].bind(this.rpcClient)(
|
|
4483
4493
|
request,
|
|
4484
|
-
|
|
4494
|
+
metadata,
|
|
4485
4495
|
(error, response) => {
|
|
4486
|
-
if (error)
|
|
4487
|
-
|
|
4488
|
-
} else {
|
|
4489
|
-
resolve(response);
|
|
4490
|
-
}
|
|
4496
|
+
if (error) reject(error);
|
|
4497
|
+
else resolve(response);
|
|
4491
4498
|
}
|
|
4492
4499
|
);
|
|
4493
4500
|
});
|
|
@@ -4497,32 +4504,8 @@ var Client = class extends BaseClient {
|
|
|
4497
4504
|
constructor(config) {
|
|
4498
4505
|
super(config);
|
|
4499
4506
|
}
|
|
4500
|
-
async listTask() {
|
|
4501
|
-
console.log("Listing tasks");
|
|
4502
|
-
const request = new (void 0)();
|
|
4503
|
-
const response = await this._callRPC(
|
|
4504
|
-
"listTasks",
|
|
4505
|
-
request
|
|
4506
|
-
);
|
|
4507
|
-
console.log("response:", response);
|
|
4508
|
-
return response;
|
|
4509
|
-
}
|
|
4510
|
-
async getSmartWalletAddress(address) {
|
|
4511
|
-
const request = new (void 0)().setOwner(address);
|
|
4512
|
-
const response = await this._callRPC(
|
|
4513
|
-
"getSmartAccountAddress",
|
|
4514
|
-
request
|
|
4515
|
-
);
|
|
4516
|
-
return response;
|
|
4517
|
-
}
|
|
4518
|
-
async getTask(taskId) {
|
|
4519
|
-
const request = new (void 0)().setBytes(taskId);
|
|
4520
|
-
const response = await this._callRPC("getTask", request);
|
|
4521
|
-
return response;
|
|
4522
|
-
}
|
|
4523
4507
|
};
|
|
4524
4508
|
export {
|
|
4525
|
-
|
|
4526
|
-
Client,
|
|
4509
|
+
Client as default,
|
|
4527
4510
|
getKeyRequestMessage
|
|
4528
4511
|
};
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
package aggregator;
|
|
3
|
+
|
|
4
|
+
option go_package = "./avsproto";
|
|
5
|
+
|
|
6
|
+
import "google/protobuf/timestamp.proto";
|
|
7
|
+
import "google/protobuf/wrappers.proto";
|
|
8
|
+
|
|
9
|
+
message UUID {
|
|
10
|
+
string bytes = 1;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
message Checkin {
|
|
14
|
+
string id = 1;
|
|
15
|
+
string address = 2;
|
|
16
|
+
string signature = 3;
|
|
17
|
+
|
|
18
|
+
message Status {
|
|
19
|
+
int64 uptime = 1;
|
|
20
|
+
int64 queueDepth = 2;
|
|
21
|
+
google.protobuf.Timestamp last_heartbeat = 3;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Status status = 4;
|
|
25
|
+
|
|
26
|
+
string version = 5;
|
|
27
|
+
int32 metricsPort = 6;
|
|
28
|
+
string remoteIP = 7;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
message CheckinResp {
|
|
32
|
+
google.protobuf.Timestamp updated_at = 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
message SyncTasksReq {
|
|
36
|
+
string id = 1;
|
|
37
|
+
string address = 2;
|
|
38
|
+
string signature = 3;
|
|
39
|
+
int64 monotonic_clock = 4;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
enum TriggerType {
|
|
43
|
+
TimeTrigger = 0;
|
|
44
|
+
ContractQueryTrigger = 1;
|
|
45
|
+
ExpressionTrigger = 2;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
message TaskTrigger {
|
|
49
|
+
TriggerType trigger_type = 1;
|
|
50
|
+
|
|
51
|
+
TimeCondition schedule = 2;
|
|
52
|
+
ContractQueryCondition contract_query = 3;
|
|
53
|
+
ExpressionCondition expression = 4;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Simple timebase or cron syntax.
|
|
57
|
+
message TimeCondition {
|
|
58
|
+
repeated int64 fixed = 1;
|
|
59
|
+
string cron = 2;
|
|
60
|
+
}
|
|
61
|
+
// A contract method that return true/false
|
|
62
|
+
// Ideally to use when we already have an existing contract that perform the
|
|
63
|
+
// check.
|
|
64
|
+
// This method will be evaluate every block
|
|
65
|
+
message ContractQueryCondition {
|
|
66
|
+
string contract_address = 1;
|
|
67
|
+
string callmsg = 2;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// An arbitrary expression to express the condition.
|
|
71
|
+
// People can define condition example
|
|
72
|
+
// chainlinkPrice("address-of-eth-usd-pair") > 2644500 && queryContract("contractaddress", "callmsg")[2] < = 5
|
|
73
|
+
// By allow arbitrary expression, people can mix and match to create conplex
|
|
74
|
+
// condition that match their workload
|
|
75
|
+
//
|
|
76
|
+
// The function to be used need to be pre-defined on our task egnine runtime.
|
|
77
|
+
// When a new block is build, our engine will execute these check
|
|
78
|
+
//
|
|
79
|
+
// The expression language is re-present by https://expr-lang.org/
|
|
80
|
+
message ExpressionCondition {
|
|
81
|
+
string expression = 1;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
message SyncTasksResp {
|
|
85
|
+
string id = 1;
|
|
86
|
+
string checkType = 2;
|
|
87
|
+
|
|
88
|
+
TaskTrigger trigger = 3;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// TaskType represents what kind of work the task will perform
|
|
92
|
+
enum TaskType {
|
|
93
|
+
// Handle default/missing data
|
|
94
|
+
ETHTransferTask = 0;
|
|
95
|
+
|
|
96
|
+
// Generic contract execution which can be used for:
|
|
97
|
+
// ERC20 Transfer, NFT Transfer, auto reclaim, auto restaking etc
|
|
98
|
+
// When executing a contract we need at least 2 things:
|
|
99
|
+
// - target contract address
|
|
100
|
+
// - the message to send to that contract
|
|
101
|
+
ContractExecutionTask = 1;
|
|
102
|
+
|
|
103
|
+
GraphQLDataQueryTask = 2;
|
|
104
|
+
// Make call to a HTTP endpoint
|
|
105
|
+
HTTPAPICallTask = 3;
|
|
106
|
+
// CustomCode allow to run arbitraty JavaScript.
|
|
107
|
+
CustomCodeTask = 4;
|
|
108
|
+
BranchActionTask = 5;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// TaskStatus represents status of the task. The transition is as follow
|
|
112
|
+
enum TaskStatus {
|
|
113
|
+
Active = 0;
|
|
114
|
+
Completed = 1;
|
|
115
|
+
Failed = 2;
|
|
116
|
+
Canceled = 3;
|
|
117
|
+
Executing = 4;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
message ETHTransfer {
|
|
121
|
+
string destination = 1;
|
|
122
|
+
string amount = 2;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
message ContractExecution {
|
|
126
|
+
string contract_address = 1;
|
|
127
|
+
string call_data = 2;
|
|
128
|
+
|
|
129
|
+
string method = 3;
|
|
130
|
+
string encoded_params = 4;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
message GraphQLDataQuery {
|
|
134
|
+
// TODO: support graphql variable
|
|
135
|
+
string url = 1;
|
|
136
|
+
string query = 2;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
message HTTPAPICall {
|
|
140
|
+
string url = 1;
|
|
141
|
+
map<string, string> headers = 2;
|
|
142
|
+
string body = 3;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
enum CustomCodeType {
|
|
146
|
+
JavaScript = 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
message CustomCode {
|
|
150
|
+
CustomCodeType type = 1;
|
|
151
|
+
string body = 2;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
message ConditionJump {
|
|
155
|
+
string expression = 1;
|
|
156
|
+
string next = 2;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
message BranchAction {
|
|
160
|
+
ConditionJump If = 1;
|
|
161
|
+
repeated ConditionJump ElseIfs = 2;
|
|
162
|
+
ConditionJump Else = 3;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
message TaskAction {
|
|
166
|
+
TaskType task_type = 1;
|
|
167
|
+
|
|
168
|
+
string id = 2;
|
|
169
|
+
string name = 3;
|
|
170
|
+
|
|
171
|
+
// Next can be empty. In some kind of block, such as branching, the next is
|
|
172
|
+
// based on branching condition
|
|
173
|
+
repeated string next = 4;
|
|
174
|
+
|
|
175
|
+
// Transfer eth
|
|
176
|
+
ETHTransfer eth_transfer = 10;
|
|
177
|
+
// Run one ore more contracts. The call call also be batched with tool like
|
|
178
|
+
// multicall to wrap many calls
|
|
179
|
+
ContractExecution contract_execution = 11;
|
|
180
|
+
// Make call to a graphql endpoint
|
|
181
|
+
GraphQLDataQuery graphql_data_query = 12;
|
|
182
|
+
// Make call to a HTTP endpoint
|
|
183
|
+
HTTPAPICall http_data_query = 13;
|
|
184
|
+
// CustomCode allow to run arbitraty JavaScript.
|
|
185
|
+
CustomCode custom_code = 14;
|
|
186
|
+
BranchAction branch = 15;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
message Execution {
|
|
190
|
+
int64 epoch = 1;
|
|
191
|
+
string user_op_hash = 2;
|
|
192
|
+
string error = 3;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
message Task {
|
|
196
|
+
UUID id = 1;
|
|
197
|
+
string owner = 2;
|
|
198
|
+
string smart_account_address = 3;
|
|
199
|
+
TaskTrigger trigger = 4;
|
|
200
|
+
repeated TaskAction nodes = 5;
|
|
201
|
+
|
|
202
|
+
// task won't be check before this
|
|
203
|
+
int64 start_at = 6;
|
|
204
|
+
// task won't be run/check after this
|
|
205
|
+
int64 expired_at = 7;
|
|
206
|
+
// arbitrary data about this task
|
|
207
|
+
string memo = 8;
|
|
208
|
+
|
|
209
|
+
int64 completed_at = 9;
|
|
210
|
+
TaskStatus status = 10;
|
|
211
|
+
// repeatable means a task can continue to run even after the first execution
|
|
212
|
+
bool repeatable = 11;
|
|
213
|
+
repeated Execution executions = 12;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
message CreateTaskReq {
|
|
217
|
+
TaskTrigger trigger = 1;
|
|
218
|
+
repeated TaskAction actions = 2;
|
|
219
|
+
int64 start_at = 3;
|
|
220
|
+
int64 expired_at = 4;
|
|
221
|
+
string memo = 5;
|
|
222
|
+
// A repeatable task will continue to be run
|
|
223
|
+
bool repeatable = 6;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
message CreateTaskResp {
|
|
227
|
+
string id = 1;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
message NonceRequest {
|
|
231
|
+
string owner = 1;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
message NonceResp {
|
|
235
|
+
string nonce = 1;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
message AddressRequest {
|
|
239
|
+
string owner = 1;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
message AddressResp {
|
|
243
|
+
string smart_account_address = 1;
|
|
244
|
+
string nonce = 2;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
message ListTasksReq {}
|
|
248
|
+
|
|
249
|
+
message ListTasksResp {
|
|
250
|
+
message TaskItemResp {
|
|
251
|
+
string id = 1;
|
|
252
|
+
TaskStatus status = 2;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
repeated TaskItemResp tasks = 1;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
message GetKeyReq {
|
|
259
|
+
string owner = 1;
|
|
260
|
+
int64 expired_at = 2;
|
|
261
|
+
string signature = 3;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
message KeyResp {
|
|
265
|
+
string key=1;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
message UpdateChecksReq {
|
|
269
|
+
string address = 1;
|
|
270
|
+
string signature = 2;
|
|
271
|
+
repeated string id = 3;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
message UpdateChecksResp {
|
|
275
|
+
google.protobuf.Timestamp updated_at = 1;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
service Aggregator {
|
|
279
|
+
// Auth
|
|
280
|
+
rpc GetKey(GetKeyReq) returns (KeyResp) {};
|
|
281
|
+
|
|
282
|
+
// Smart Acccount
|
|
283
|
+
rpc GetNonce(NonceRequest) returns (NonceResp) {};
|
|
284
|
+
rpc GetSmartAccountAddress(AddressRequest) returns (AddressResp) {};
|
|
285
|
+
|
|
286
|
+
// Task Management
|
|
287
|
+
rpc CreateTask(CreateTaskReq) returns (CreateTaskResp) {};
|
|
288
|
+
rpc ListTasks(ListTasksReq) returns (ListTasksResp) {};
|
|
289
|
+
rpc GetTask(UUID) returns (Task) {};
|
|
290
|
+
rpc CancelTask(UUID) returns (google.protobuf.BoolValue) {};
|
|
291
|
+
rpc DeleteTask(UUID) returns (google.protobuf.BoolValue) {};
|
|
292
|
+
|
|
293
|
+
// Operator endpoint
|
|
294
|
+
rpc Ping(Checkin) returns (CheckinResp) {};
|
|
295
|
+
rpc SyncTasks(SyncTasksReq) returns (stream SyncTasksResp) {};
|
|
296
|
+
rpc UpdateChecks(UpdateChecksReq) returns (UpdateChecksResp) {};
|
|
297
|
+
}
|