@avaprotocol/sdk-js 2.11.0 → 2.12.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 +14 -0
- package/dist/index.js +74 -5
- package/dist/index.mjs +86 -15
- package/dist/models/execution.d.ts +2 -1
- package/dist/models/execution.d.ts.map +1 -1
- package/dist/models/execution.js +8 -1
- package/dist/models/trigger/event.d.ts.map +1 -1
- package/dist/models/trigger/event.js +13 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @avaprotocol/sdk-js
|
|
2
2
|
|
|
3
|
+
## 2.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3c9a303: add automationFee to Execution model for getExecution/getExecutions responses
|
|
8
|
+
|
|
9
|
+
## 2.11.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- ee62aee: fix: added cooldownSeconds to EventTrigger
|
|
14
|
+
- Updated dependencies [ee62aee]
|
|
15
|
+
- @avaprotocol/types@2.9.1
|
|
16
|
+
|
|
3
17
|
## 2.11.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -2474,7 +2474,8 @@ var require_avs_pb = __commonJS({
|
|
|
2474
2474
|
msg.getQueriesList(),
|
|
2475
2475
|
proto.aggregator.EventTrigger.Query.toObject,
|
|
2476
2476
|
includeInstance
|
|
2477
|
-
)
|
|
2477
|
+
),
|
|
2478
|
+
cooldownSeconds: jspb.Message.getFieldWithDefault(msg, 2, 0)
|
|
2478
2479
|
};
|
|
2479
2480
|
if (includeInstance) {
|
|
2480
2481
|
obj.$jspbMessageInstance = msg;
|
|
@@ -2499,6 +2500,13 @@ var require_avs_pb = __commonJS({
|
|
|
2499
2500
|
reader.readMessage(value, proto.aggregator.EventTrigger.Query.deserializeBinaryFromReader);
|
|
2500
2501
|
msg.addQueries(value);
|
|
2501
2502
|
break;
|
|
2503
|
+
case 2:
|
|
2504
|
+
var value = (
|
|
2505
|
+
/** @type {number} */
|
|
2506
|
+
reader.readUint32()
|
|
2507
|
+
);
|
|
2508
|
+
msg.setCooldownSeconds(value);
|
|
2509
|
+
break;
|
|
2502
2510
|
default:
|
|
2503
2511
|
reader.skipField();
|
|
2504
2512
|
break;
|
|
@@ -2521,6 +2529,14 @@ var require_avs_pb = __commonJS({
|
|
|
2521
2529
|
proto.aggregator.EventTrigger.Query.serializeBinaryToWriter
|
|
2522
2530
|
);
|
|
2523
2531
|
}
|
|
2532
|
+
f = /** @type {number} */
|
|
2533
|
+
jspb.Message.getField(message, 2);
|
|
2534
|
+
if (f != null) {
|
|
2535
|
+
writer.writeUint32(
|
|
2536
|
+
2,
|
|
2537
|
+
f
|
|
2538
|
+
);
|
|
2539
|
+
}
|
|
2524
2540
|
};
|
|
2525
2541
|
proto.aggregator.EventTrigger.Config.prototype.getQueriesList = function() {
|
|
2526
2542
|
return (
|
|
@@ -2537,6 +2553,21 @@ var require_avs_pb = __commonJS({
|
|
|
2537
2553
|
proto.aggregator.EventTrigger.Config.prototype.clearQueriesList = function() {
|
|
2538
2554
|
return this.setQueriesList([]);
|
|
2539
2555
|
};
|
|
2556
|
+
proto.aggregator.EventTrigger.Config.prototype.getCooldownSeconds = function() {
|
|
2557
|
+
return (
|
|
2558
|
+
/** @type {number} */
|
|
2559
|
+
jspb.Message.getFieldWithDefault(this, 2, 0)
|
|
2560
|
+
);
|
|
2561
|
+
};
|
|
2562
|
+
proto.aggregator.EventTrigger.Config.prototype.setCooldownSeconds = function(value) {
|
|
2563
|
+
return jspb.Message.setField(this, 2, value);
|
|
2564
|
+
};
|
|
2565
|
+
proto.aggregator.EventTrigger.Config.prototype.clearCooldownSeconds = function() {
|
|
2566
|
+
return jspb.Message.setField(this, 2, void 0);
|
|
2567
|
+
};
|
|
2568
|
+
proto.aggregator.EventTrigger.Config.prototype.hasCooldownSeconds = function() {
|
|
2569
|
+
return jspb.Message.getField(this, 2) != null;
|
|
2570
|
+
};
|
|
2540
2571
|
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
2541
2572
|
proto.aggregator.EventTrigger.Output.prototype.toObject = function(opt_includeInstance) {
|
|
2542
2573
|
return proto.aggregator.EventTrigger.Output.toObject(opt_includeInstance, this);
|
|
@@ -7531,6 +7562,7 @@ var require_avs_pb = __commonJS({
|
|
|
7531
7562
|
error: jspb.Message.getFieldWithDefault(msg, 5, ""),
|
|
7532
7563
|
index: jspb.Message.getFieldWithDefault(msg, 6, 0),
|
|
7533
7564
|
totalGasCost: jspb.Message.getFieldWithDefault(msg, 7, ""),
|
|
7565
|
+
automationFee: (f = msg.getAutomationFee()) && proto.aggregator.FeeAmount.toObject(includeInstance, f),
|
|
7534
7566
|
stepsList: jspb.Message.toObjectList(
|
|
7535
7567
|
msg.getStepsList(),
|
|
7536
7568
|
proto.aggregator.Execution.Step.toObject,
|
|
@@ -7604,6 +7636,11 @@ var require_avs_pb = __commonJS({
|
|
|
7604
7636
|
);
|
|
7605
7637
|
msg.setTotalGasCost(value);
|
|
7606
7638
|
break;
|
|
7639
|
+
case 9:
|
|
7640
|
+
var value = new proto.aggregator.FeeAmount();
|
|
7641
|
+
reader.readMessage(value, proto.aggregator.FeeAmount.deserializeBinaryFromReader);
|
|
7642
|
+
msg.setAutomationFee(value);
|
|
7643
|
+
break;
|
|
7607
7644
|
case 8:
|
|
7608
7645
|
var value = new proto.aggregator.Execution.Step();
|
|
7609
7646
|
reader.readMessage(value, proto.aggregator.Execution.Step.deserializeBinaryFromReader);
|
|
@@ -7672,6 +7709,14 @@ var require_avs_pb = __commonJS({
|
|
|
7672
7709
|
f
|
|
7673
7710
|
);
|
|
7674
7711
|
}
|
|
7712
|
+
f = message.getAutomationFee();
|
|
7713
|
+
if (f != null) {
|
|
7714
|
+
writer.writeMessage(
|
|
7715
|
+
9,
|
|
7716
|
+
f,
|
|
7717
|
+
proto.aggregator.FeeAmount.serializeBinaryToWriter
|
|
7718
|
+
);
|
|
7719
|
+
}
|
|
7675
7720
|
f = message.getStepsList();
|
|
7676
7721
|
if (f.length > 0) {
|
|
7677
7722
|
writer.writeRepeatedMessage(
|
|
@@ -8650,6 +8695,21 @@ var require_avs_pb = __commonJS({
|
|
|
8650
8695
|
proto.aggregator.Execution.prototype.setTotalGasCost = function(value) {
|
|
8651
8696
|
return jspb.Message.setProto3StringField(this, 7, value);
|
|
8652
8697
|
};
|
|
8698
|
+
proto.aggregator.Execution.prototype.getAutomationFee = function() {
|
|
8699
|
+
return (
|
|
8700
|
+
/** @type{?proto.aggregator.FeeAmount} */
|
|
8701
|
+
jspb.Message.getWrapperField(this, proto.aggregator.FeeAmount, 9)
|
|
8702
|
+
);
|
|
8703
|
+
};
|
|
8704
|
+
proto.aggregator.Execution.prototype.setAutomationFee = function(value) {
|
|
8705
|
+
return jspb.Message.setWrapperField(this, 9, value);
|
|
8706
|
+
};
|
|
8707
|
+
proto.aggregator.Execution.prototype.clearAutomationFee = function() {
|
|
8708
|
+
return this.setAutomationFee(void 0);
|
|
8709
|
+
};
|
|
8710
|
+
proto.aggregator.Execution.prototype.hasAutomationFee = function() {
|
|
8711
|
+
return jspb.Message.getField(this, 9) != null;
|
|
8712
|
+
};
|
|
8653
8713
|
proto.aggregator.Execution.prototype.getStepsList = function() {
|
|
8654
8714
|
return (
|
|
8655
8715
|
/** @type{!Array<!proto.aggregator.Execution.Step>} */
|
|
@@ -19290,6 +19350,9 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
|
|
|
19290
19350
|
return query;
|
|
19291
19351
|
});
|
|
19292
19352
|
config.setQueriesList(queryMessages);
|
|
19353
|
+
if (dataConfig.cooldownSeconds !== void 0) {
|
|
19354
|
+
config.setCooldownSeconds(dataConfig.cooldownSeconds);
|
|
19355
|
+
}
|
|
19293
19356
|
trigger.setConfig(config);
|
|
19294
19357
|
request.setEvent(trigger);
|
|
19295
19358
|
return request;
|
|
@@ -19314,9 +19377,7 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
|
|
|
19314
19377
|
queryData.addresses = query.getAddressesList();
|
|
19315
19378
|
}
|
|
19316
19379
|
if (query.getTopicsList && query.getTopicsList().length > 0) {
|
|
19317
|
-
queryData.topics = query.getTopicsList().map(
|
|
19318
|
-
(topic) => topic === "" ? null : topic
|
|
19319
|
-
);
|
|
19380
|
+
queryData.topics = query.getTopicsList().map((topic) => topic === "" ? null : topic);
|
|
19320
19381
|
}
|
|
19321
19382
|
const maxEvents = query.getMaxEventsPerBlock();
|
|
19322
19383
|
if (maxEvents && maxEvents > 0) {
|
|
@@ -19347,6 +19408,9 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
|
|
|
19347
19408
|
});
|
|
19348
19409
|
}
|
|
19349
19410
|
data = { queries };
|
|
19411
|
+
if (config.hasCooldownSeconds()) {
|
|
19412
|
+
data.cooldownSeconds = config.getCooldownSeconds();
|
|
19413
|
+
}
|
|
19350
19414
|
}
|
|
19351
19415
|
}
|
|
19352
19416
|
return new _EventTrigger({
|
|
@@ -21031,6 +21095,7 @@ var Execution2 = class _Execution {
|
|
|
21031
21095
|
this.index = props.index;
|
|
21032
21096
|
this.steps = props.steps.map((s) => new step_default(s));
|
|
21033
21097
|
this.totalGasCost = props.totalGasCost;
|
|
21098
|
+
this.automationFee = props.automationFee;
|
|
21034
21099
|
}
|
|
21035
21100
|
/**
|
|
21036
21101
|
* Convert Execution instance to plain object (ExecutionProps)
|
|
@@ -21045,10 +21110,13 @@ var Execution2 = class _Execution {
|
|
|
21045
21110
|
error: this.error,
|
|
21046
21111
|
index: this.index,
|
|
21047
21112
|
steps: this.steps.map((step) => step.toJson()),
|
|
21048
|
-
...this.totalGasCost && { totalGasCost: this.totalGasCost }
|
|
21113
|
+
...this.totalGasCost && { totalGasCost: this.totalGasCost },
|
|
21114
|
+
...this.automationFee && { automationFee: this.automationFee }
|
|
21049
21115
|
};
|
|
21050
21116
|
}
|
|
21051
21117
|
static fromResponse(execution) {
|
|
21118
|
+
const automationFeePb = execution.getAutomationFee();
|
|
21119
|
+
const automationFee = automationFeePb ? automationFeePb.toObject() : void 0;
|
|
21052
21120
|
return new _Execution({
|
|
21053
21121
|
id: execution.getId(),
|
|
21054
21122
|
startAt: execution.getStartAt(),
|
|
@@ -21057,6 +21125,7 @@ var Execution2 = class _Execution {
|
|
|
21057
21125
|
error: execution.getError(),
|
|
21058
21126
|
index: execution.getIndex(),
|
|
21059
21127
|
totalGasCost: execution.getTotalGasCost() || void 0,
|
|
21128
|
+
automationFee,
|
|
21060
21129
|
steps: execution.getStepsList().map((step) => step_default.fromResponse(step))
|
|
21061
21130
|
});
|
|
21062
21131
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2474,7 +2474,8 @@ var require_avs_pb = __commonJS({
|
|
|
2474
2474
|
msg.getQueriesList(),
|
|
2475
2475
|
proto.aggregator.EventTrigger.Query.toObject,
|
|
2476
2476
|
includeInstance
|
|
2477
|
-
)
|
|
2477
|
+
),
|
|
2478
|
+
cooldownSeconds: jspb.Message.getFieldWithDefault(msg, 2, 0)
|
|
2478
2479
|
};
|
|
2479
2480
|
if (includeInstance) {
|
|
2480
2481
|
obj.$jspbMessageInstance = msg;
|
|
@@ -2499,6 +2500,13 @@ var require_avs_pb = __commonJS({
|
|
|
2499
2500
|
reader.readMessage(value, proto.aggregator.EventTrigger.Query.deserializeBinaryFromReader);
|
|
2500
2501
|
msg.addQueries(value);
|
|
2501
2502
|
break;
|
|
2503
|
+
case 2:
|
|
2504
|
+
var value = (
|
|
2505
|
+
/** @type {number} */
|
|
2506
|
+
reader.readUint32()
|
|
2507
|
+
);
|
|
2508
|
+
msg.setCooldownSeconds(value);
|
|
2509
|
+
break;
|
|
2502
2510
|
default:
|
|
2503
2511
|
reader.skipField();
|
|
2504
2512
|
break;
|
|
@@ -2521,6 +2529,14 @@ var require_avs_pb = __commonJS({
|
|
|
2521
2529
|
proto.aggregator.EventTrigger.Query.serializeBinaryToWriter
|
|
2522
2530
|
);
|
|
2523
2531
|
}
|
|
2532
|
+
f = /** @type {number} */
|
|
2533
|
+
jspb.Message.getField(message, 2);
|
|
2534
|
+
if (f != null) {
|
|
2535
|
+
writer.writeUint32(
|
|
2536
|
+
2,
|
|
2537
|
+
f
|
|
2538
|
+
);
|
|
2539
|
+
}
|
|
2524
2540
|
};
|
|
2525
2541
|
proto.aggregator.EventTrigger.Config.prototype.getQueriesList = function() {
|
|
2526
2542
|
return (
|
|
@@ -2537,6 +2553,21 @@ var require_avs_pb = __commonJS({
|
|
|
2537
2553
|
proto.aggregator.EventTrigger.Config.prototype.clearQueriesList = function() {
|
|
2538
2554
|
return this.setQueriesList([]);
|
|
2539
2555
|
};
|
|
2556
|
+
proto.aggregator.EventTrigger.Config.prototype.getCooldownSeconds = function() {
|
|
2557
|
+
return (
|
|
2558
|
+
/** @type {number} */
|
|
2559
|
+
jspb.Message.getFieldWithDefault(this, 2, 0)
|
|
2560
|
+
);
|
|
2561
|
+
};
|
|
2562
|
+
proto.aggregator.EventTrigger.Config.prototype.setCooldownSeconds = function(value) {
|
|
2563
|
+
return jspb.Message.setField(this, 2, value);
|
|
2564
|
+
};
|
|
2565
|
+
proto.aggregator.EventTrigger.Config.prototype.clearCooldownSeconds = function() {
|
|
2566
|
+
return jspb.Message.setField(this, 2, void 0);
|
|
2567
|
+
};
|
|
2568
|
+
proto.aggregator.EventTrigger.Config.prototype.hasCooldownSeconds = function() {
|
|
2569
|
+
return jspb.Message.getField(this, 2) != null;
|
|
2570
|
+
};
|
|
2540
2571
|
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
2541
2572
|
proto.aggregator.EventTrigger.Output.prototype.toObject = function(opt_includeInstance) {
|
|
2542
2573
|
return proto.aggregator.EventTrigger.Output.toObject(opt_includeInstance, this);
|
|
@@ -7531,6 +7562,7 @@ var require_avs_pb = __commonJS({
|
|
|
7531
7562
|
error: jspb.Message.getFieldWithDefault(msg, 5, ""),
|
|
7532
7563
|
index: jspb.Message.getFieldWithDefault(msg, 6, 0),
|
|
7533
7564
|
totalGasCost: jspb.Message.getFieldWithDefault(msg, 7, ""),
|
|
7565
|
+
automationFee: (f = msg.getAutomationFee()) && proto.aggregator.FeeAmount.toObject(includeInstance, f),
|
|
7534
7566
|
stepsList: jspb.Message.toObjectList(
|
|
7535
7567
|
msg.getStepsList(),
|
|
7536
7568
|
proto.aggregator.Execution.Step.toObject,
|
|
@@ -7604,6 +7636,11 @@ var require_avs_pb = __commonJS({
|
|
|
7604
7636
|
);
|
|
7605
7637
|
msg.setTotalGasCost(value);
|
|
7606
7638
|
break;
|
|
7639
|
+
case 9:
|
|
7640
|
+
var value = new proto.aggregator.FeeAmount();
|
|
7641
|
+
reader.readMessage(value, proto.aggregator.FeeAmount.deserializeBinaryFromReader);
|
|
7642
|
+
msg.setAutomationFee(value);
|
|
7643
|
+
break;
|
|
7607
7644
|
case 8:
|
|
7608
7645
|
var value = new proto.aggregator.Execution.Step();
|
|
7609
7646
|
reader.readMessage(value, proto.aggregator.Execution.Step.deserializeBinaryFromReader);
|
|
@@ -7672,6 +7709,14 @@ var require_avs_pb = __commonJS({
|
|
|
7672
7709
|
f
|
|
7673
7710
|
);
|
|
7674
7711
|
}
|
|
7712
|
+
f = message.getAutomationFee();
|
|
7713
|
+
if (f != null) {
|
|
7714
|
+
writer.writeMessage(
|
|
7715
|
+
9,
|
|
7716
|
+
f,
|
|
7717
|
+
proto.aggregator.FeeAmount.serializeBinaryToWriter
|
|
7718
|
+
);
|
|
7719
|
+
}
|
|
7675
7720
|
f = message.getStepsList();
|
|
7676
7721
|
if (f.length > 0) {
|
|
7677
7722
|
writer.writeRepeatedMessage(
|
|
@@ -8650,6 +8695,21 @@ var require_avs_pb = __commonJS({
|
|
|
8650
8695
|
proto.aggregator.Execution.prototype.setTotalGasCost = function(value) {
|
|
8651
8696
|
return jspb.Message.setProto3StringField(this, 7, value);
|
|
8652
8697
|
};
|
|
8698
|
+
proto.aggregator.Execution.prototype.getAutomationFee = function() {
|
|
8699
|
+
return (
|
|
8700
|
+
/** @type{?proto.aggregator.FeeAmount} */
|
|
8701
|
+
jspb.Message.getWrapperField(this, proto.aggregator.FeeAmount, 9)
|
|
8702
|
+
);
|
|
8703
|
+
};
|
|
8704
|
+
proto.aggregator.Execution.prototype.setAutomationFee = function(value) {
|
|
8705
|
+
return jspb.Message.setWrapperField(this, 9, value);
|
|
8706
|
+
};
|
|
8707
|
+
proto.aggregator.Execution.prototype.clearAutomationFee = function() {
|
|
8708
|
+
return this.setAutomationFee(void 0);
|
|
8709
|
+
};
|
|
8710
|
+
proto.aggregator.Execution.prototype.hasAutomationFee = function() {
|
|
8711
|
+
return jspb.Message.getField(this, 9) != null;
|
|
8712
|
+
};
|
|
8653
8713
|
proto.aggregator.Execution.prototype.getStepsList = function() {
|
|
8654
8714
|
return (
|
|
8655
8715
|
/** @type{!Array<!proto.aggregator.Execution.Step>} */
|
|
@@ -19269,6 +19329,9 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
|
|
|
19269
19329
|
return query;
|
|
19270
19330
|
});
|
|
19271
19331
|
config.setQueriesList(queryMessages);
|
|
19332
|
+
if (dataConfig.cooldownSeconds !== void 0) {
|
|
19333
|
+
config.setCooldownSeconds(dataConfig.cooldownSeconds);
|
|
19334
|
+
}
|
|
19272
19335
|
trigger.setConfig(config);
|
|
19273
19336
|
request.setEvent(trigger);
|
|
19274
19337
|
return request;
|
|
@@ -19293,9 +19356,7 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
|
|
|
19293
19356
|
queryData.addresses = query.getAddressesList();
|
|
19294
19357
|
}
|
|
19295
19358
|
if (query.getTopicsList && query.getTopicsList().length > 0) {
|
|
19296
|
-
queryData.topics = query.getTopicsList().map(
|
|
19297
|
-
(topic) => topic === "" ? null : topic
|
|
19298
|
-
);
|
|
19359
|
+
queryData.topics = query.getTopicsList().map((topic) => topic === "" ? null : topic);
|
|
19299
19360
|
}
|
|
19300
19361
|
const maxEvents = query.getMaxEventsPerBlock();
|
|
19301
19362
|
if (maxEvents && maxEvents > 0) {
|
|
@@ -19326,6 +19387,9 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
|
|
|
19326
19387
|
});
|
|
19327
19388
|
}
|
|
19328
19389
|
data = { queries };
|
|
19390
|
+
if (config.hasCooldownSeconds()) {
|
|
19391
|
+
data.cooldownSeconds = config.getCooldownSeconds();
|
|
19392
|
+
}
|
|
19329
19393
|
}
|
|
19330
19394
|
}
|
|
19331
19395
|
return new _EventTrigger({
|
|
@@ -20800,7 +20864,9 @@ var workflow_default = Workflow;
|
|
|
20800
20864
|
|
|
20801
20865
|
// src/models/execution.ts
|
|
20802
20866
|
var avs_pb22 = __toESM(require_avs_pb());
|
|
20803
|
-
import {
|
|
20867
|
+
import {
|
|
20868
|
+
ExecutionStatus as ExecutionStatus2
|
|
20869
|
+
} from "@avaprotocol/types";
|
|
20804
20870
|
|
|
20805
20871
|
// src/models/step.ts
|
|
20806
20872
|
var avs_pb21 = __toESM(require_avs_pb());
|
|
@@ -21042,6 +21108,7 @@ var Execution2 = class _Execution {
|
|
|
21042
21108
|
this.index = props.index;
|
|
21043
21109
|
this.steps = props.steps.map((s) => new step_default(s));
|
|
21044
21110
|
this.totalGasCost = props.totalGasCost;
|
|
21111
|
+
this.automationFee = props.automationFee;
|
|
21045
21112
|
}
|
|
21046
21113
|
/**
|
|
21047
21114
|
* Convert Execution instance to plain object (ExecutionProps)
|
|
@@ -21056,10 +21123,13 @@ var Execution2 = class _Execution {
|
|
|
21056
21123
|
error: this.error,
|
|
21057
21124
|
index: this.index,
|
|
21058
21125
|
steps: this.steps.map((step) => step.toJson()),
|
|
21059
|
-
...this.totalGasCost && { totalGasCost: this.totalGasCost }
|
|
21126
|
+
...this.totalGasCost && { totalGasCost: this.totalGasCost },
|
|
21127
|
+
...this.automationFee && { automationFee: this.automationFee }
|
|
21060
21128
|
};
|
|
21061
21129
|
}
|
|
21062
21130
|
static fromResponse(execution) {
|
|
21131
|
+
const automationFeePb = execution.getAutomationFee();
|
|
21132
|
+
const automationFee = automationFeePb ? automationFeePb.toObject() : void 0;
|
|
21063
21133
|
return new _Execution({
|
|
21064
21134
|
id: execution.getId(),
|
|
21065
21135
|
startAt: execution.getStartAt(),
|
|
@@ -21068,6 +21138,7 @@ var Execution2 = class _Execution {
|
|
|
21068
21138
|
error: execution.getError(),
|
|
21069
21139
|
index: execution.getIndex(),
|
|
21070
21140
|
totalGasCost: execution.getTotalGasCost() || void 0,
|
|
21141
|
+
automationFee,
|
|
21071
21142
|
steps: execution.getStepsList().map((step) => step_default.fromResponse(step))
|
|
21072
21143
|
});
|
|
21073
21144
|
}
|
|
@@ -21108,8 +21179,8 @@ var secret_default = Secret;
|
|
|
21108
21179
|
// src/index.ts
|
|
21109
21180
|
var import_avs_pb = __toESM(require_avs_pb());
|
|
21110
21181
|
import {
|
|
21111
|
-
TriggerType as
|
|
21112
|
-
TriggerTypeConverter
|
|
21182
|
+
TriggerType as TriggerType13,
|
|
21183
|
+
TriggerTypeConverter,
|
|
21113
21184
|
AUTH_KEY_HEADER,
|
|
21114
21185
|
DEFAULT_LIMIT,
|
|
21115
21186
|
ErrorCode,
|
|
@@ -21695,7 +21766,7 @@ var Client = class extends BaseClient {
|
|
|
21695
21766
|
}, options) {
|
|
21696
21767
|
const request = new avs_pb24.TriggerTaskReq();
|
|
21697
21768
|
request.setTaskId(id);
|
|
21698
|
-
request.setTriggerType(
|
|
21769
|
+
request.setTriggerType(TriggerTypeConverter.toProtobuf(triggerData.type));
|
|
21699
21770
|
request.setIsBlocking(isBlocking);
|
|
21700
21771
|
if (triggerData.inputVariables) {
|
|
21701
21772
|
const triggerInputMap = request.getTriggerInputMap();
|
|
@@ -21704,7 +21775,7 @@ var Client = class extends BaseClient {
|
|
|
21704
21775
|
}
|
|
21705
21776
|
}
|
|
21706
21777
|
switch (triggerData.type) {
|
|
21707
|
-
case
|
|
21778
|
+
case TriggerType13.FixedTime: {
|
|
21708
21779
|
const fixedTimeData = triggerData;
|
|
21709
21780
|
const fixedTimeOutput = new avs_pb24.FixedTimeTrigger.Output();
|
|
21710
21781
|
const triggerOutputData = {
|
|
@@ -21716,7 +21787,7 @@ var Client = class extends BaseClient {
|
|
|
21716
21787
|
request.setFixedTimeTrigger(fixedTimeOutput);
|
|
21717
21788
|
break;
|
|
21718
21789
|
}
|
|
21719
|
-
case
|
|
21790
|
+
case TriggerType13.Cron: {
|
|
21720
21791
|
const cronData = triggerData;
|
|
21721
21792
|
const cronOutput = new avs_pb24.CronTrigger.Output();
|
|
21722
21793
|
const triggerOutputData = {
|
|
@@ -21728,7 +21799,7 @@ var Client = class extends BaseClient {
|
|
|
21728
21799
|
request.setCronTrigger(cronOutput);
|
|
21729
21800
|
break;
|
|
21730
21801
|
}
|
|
21731
|
-
case
|
|
21802
|
+
case TriggerType13.Block: {
|
|
21732
21803
|
const blockData = triggerData;
|
|
21733
21804
|
const blockOutput = new avs_pb24.BlockTrigger.Output();
|
|
21734
21805
|
const triggerOutputData = {
|
|
@@ -21745,7 +21816,7 @@ var Client = class extends BaseClient {
|
|
|
21745
21816
|
request.setBlockTrigger(blockOutput);
|
|
21746
21817
|
break;
|
|
21747
21818
|
}
|
|
21748
|
-
case
|
|
21819
|
+
case TriggerType13.Event: {
|
|
21749
21820
|
const eventData = triggerData;
|
|
21750
21821
|
const eventOutput = new avs_pb24.EventTrigger.Output();
|
|
21751
21822
|
if (eventData.data) {
|
|
@@ -21755,7 +21826,7 @@ var Client = class extends BaseClient {
|
|
|
21755
21826
|
request.setEventTrigger(eventOutput);
|
|
21756
21827
|
break;
|
|
21757
21828
|
}
|
|
21758
|
-
case
|
|
21829
|
+
case TriggerType13.Manual: {
|
|
21759
21830
|
const manualData = triggerData;
|
|
21760
21831
|
const manualOutput = new avs_pb24.ManualTrigger.Output();
|
|
21761
21832
|
if (manualData.data) {
|
|
@@ -21765,7 +21836,7 @@ var Client = class extends BaseClient {
|
|
|
21765
21836
|
request.setManualTrigger(manualOutput);
|
|
21766
21837
|
break;
|
|
21767
21838
|
}
|
|
21768
|
-
case
|
|
21839
|
+
case TriggerType13.Unspecified:
|
|
21769
21840
|
break;
|
|
21770
21841
|
default:
|
|
21771
21842
|
throw new Error(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import { ExecutionProps, ExecutionStatus } from "@avaprotocol/types";
|
|
2
|
+
import { ExecutionProps, ExecutionStatus, type FeeAmount } from "@avaprotocol/types";
|
|
3
3
|
import Step from "./step";
|
|
4
4
|
declare class Execution implements ExecutionProps {
|
|
5
5
|
id: string;
|
|
@@ -10,6 +10,7 @@ declare class Execution implements ExecutionProps {
|
|
|
10
10
|
index: number;
|
|
11
11
|
steps: Step[];
|
|
12
12
|
totalGasCost?: string;
|
|
13
|
+
automationFee?: FeeAmount;
|
|
13
14
|
constructor(props: ExecutionProps);
|
|
14
15
|
/**
|
|
15
16
|
* Convert Execution instance to plain object (ExecutionProps)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/models/execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,
|
|
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,SAAS,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,IAAI,MAAM,QAAQ,CAAC;AAuB1B,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,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,SAAS,CAAC;gBAEd,KAAK,EAAE,cAAc;IAajC;;;OAGG;IACH,MAAM,IAAI,cAAc;IAcxB,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,GAAG,SAAS;CAsB5D;AAED,eAAe,SAAS,CAAC"}
|
package/dist/models/execution.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import { ExecutionStatus } from "@avaprotocol/types";
|
|
2
|
+
import { ExecutionStatus, } from "@avaprotocol/types";
|
|
3
3
|
import Step from "./step";
|
|
4
4
|
/**
|
|
5
5
|
* Convert protobuf ExecutionStatus to types ExecutionStatus
|
|
@@ -29,6 +29,7 @@ class Execution {
|
|
|
29
29
|
this.index = props.index;
|
|
30
30
|
this.steps = props.steps.map(s => new Step(s));
|
|
31
31
|
this.totalGasCost = props.totalGasCost;
|
|
32
|
+
this.automationFee = props.automationFee;
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
34
35
|
* Convert Execution instance to plain object (ExecutionProps)
|
|
@@ -44,9 +45,14 @@ class Execution {
|
|
|
44
45
|
index: this.index,
|
|
45
46
|
steps: this.steps.map(step => step.toJson()),
|
|
46
47
|
...(this.totalGasCost && { totalGasCost: this.totalGasCost }),
|
|
48
|
+
...(this.automationFee && { automationFee: this.automationFee }),
|
|
47
49
|
};
|
|
48
50
|
}
|
|
49
51
|
static fromResponse(execution) {
|
|
52
|
+
const automationFeePb = execution.getAutomationFee();
|
|
53
|
+
const automationFee = automationFeePb
|
|
54
|
+
? automationFeePb.toObject()
|
|
55
|
+
: undefined;
|
|
50
56
|
return new Execution({
|
|
51
57
|
id: execution.getId(),
|
|
52
58
|
startAt: execution.getStartAt(),
|
|
@@ -55,6 +61,7 @@ class Execution {
|
|
|
55
61
|
error: execution.getError(),
|
|
56
62
|
index: execution.getIndex(),
|
|
57
63
|
totalGasCost: execution.getTotalGasCost() || undefined,
|
|
64
|
+
automationFee,
|
|
58
65
|
steps: execution
|
|
59
66
|
.getStepsList()
|
|
60
67
|
.map((step) => Step.fromResponse(step)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/event.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAIlB,MAAM,oBAAoB,CAAC;AA0C5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/event.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAIlB,MAAM,oBAAoB,CAAC;AA0C5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAqH/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IA0F1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CA0B9D;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -123,6 +123,10 @@ class EventTrigger extends Trigger {
|
|
|
123
123
|
return query;
|
|
124
124
|
});
|
|
125
125
|
config.setQueriesList(queryMessages);
|
|
126
|
+
// Set cooldownSeconds if provided
|
|
127
|
+
if (dataConfig.cooldownSeconds !== undefined) {
|
|
128
|
+
config.setCooldownSeconds(dataConfig.cooldownSeconds);
|
|
129
|
+
}
|
|
126
130
|
trigger.setConfig(config);
|
|
127
131
|
request.setEvent(trigger);
|
|
128
132
|
return request;
|
|
@@ -150,7 +154,9 @@ class EventTrigger extends Trigger {
|
|
|
150
154
|
if (query.getTopicsList && query.getTopicsList().length > 0) {
|
|
151
155
|
// Convert empty strings back to null for JavaScript compatibility
|
|
152
156
|
// Empty strings represent wildcards in the protobuf representation
|
|
153
|
-
queryData.topics = query
|
|
157
|
+
queryData.topics = query
|
|
158
|
+
.getTopicsList()
|
|
159
|
+
.map((topic) => (topic === "" ? null : topic));
|
|
154
160
|
}
|
|
155
161
|
// Extract maxEventsPerBlock
|
|
156
162
|
const maxEvents = query.getMaxEventsPerBlock();
|
|
@@ -182,7 +188,13 @@ class EventTrigger extends Trigger {
|
|
|
182
188
|
queries.push(queryData);
|
|
183
189
|
});
|
|
184
190
|
}
|
|
191
|
+
// Extract cooldownSeconds if present
|
|
192
|
+
// Use hasCooldownSeconds() to check if field was set, since getCooldownSeconds()
|
|
193
|
+
// returns 0 (default uint32 value) when field is not set
|
|
185
194
|
data = { queries: queries };
|
|
195
|
+
if (config.hasCooldownSeconds()) {
|
|
196
|
+
data.cooldownSeconds = config.getCooldownSeconds();
|
|
197
|
+
}
|
|
186
198
|
}
|
|
187
199
|
}
|
|
188
200
|
return new EventTrigger({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avaprotocol/sdk-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
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",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"prepare": "node ../../scripts/prepare-package.js"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@avaprotocol/types": "2.9.
|
|
34
|
+
"@avaprotocol/types": "2.9.1",
|
|
35
35
|
"@grpc/grpc-js": "^1.11.3",
|
|
36
36
|
"@grpc/proto-loader": "^0.7.13",
|
|
37
37
|
"dotenv": "^16.4.5",
|