@avaprotocol/sdk-js 2.3.17 → 2.4.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 CHANGED
@@ -1,5 +1,27 @@
1
1
  # @avaprotocol/sdk-js
2
2
 
3
+ ## 2.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 60181d0: Added EventCondition, and unified contractAbi to string type
8
+
9
+ ## 2.3.17
10
+
11
+ ### Patch Changes
12
+
13
+ - 0dfcf69: Added EventCondition, and unified contractAbi to string type
14
+ - Updated dependencies [0dfcf69]
15
+ - @avaprotocol/types@2.2.13
16
+
17
+ ## 2.3.16
18
+
19
+ ### Patch Changes
20
+
21
+ - 27551e0: Added EventCondition to EventTrigger
22
+ - Updated dependencies [27551e0]
23
+ - @avaprotocol/types@2.2.12
24
+
3
25
  ## 2.3.15
4
26
 
5
27
  ### Patch Changes
package/dist/index.js CHANGED
@@ -93,6 +93,7 @@ var require_avs_pb = __commonJS({
93
93
  goog.exportSymbol("proto.aggregator.ETHTransferNode.Config", null, global);
94
94
  goog.exportSymbol("proto.aggregator.ETHTransferNode.Output", null, global);
95
95
  goog.exportSymbol("proto.aggregator.Error", null, global);
96
+ goog.exportSymbol("proto.aggregator.EventCondition", null, global);
96
97
  goog.exportSymbol("proto.aggregator.EventTrigger", null, global);
97
98
  goog.exportSymbol("proto.aggregator.EventTrigger.Config", null, global);
98
99
  goog.exportSymbol("proto.aggregator.EventTrigger.Output", null, global);
@@ -935,6 +936,13 @@ var require_avs_pb = __commonJS({
935
936
  if (goog.DEBUG && !COMPILED) {
936
937
  proto.aggregator.SimulateTaskReq.displayName = "proto.aggregator.SimulateTaskReq";
937
938
  }
939
+ proto.aggregator.EventCondition = function(opt_data) {
940
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
941
+ };
942
+ goog.inherits(proto.aggregator.EventCondition, jspb.Message);
943
+ if (goog.DEBUG && !COMPILED) {
944
+ proto.aggregator.EventCondition.displayName = "proto.aggregator.EventCondition";
945
+ }
938
946
  if (jspb.Message.GENERATE_TO_OBJECT) {
939
947
  proto.aggregator.TokenMetadata.prototype.toObject = function(opt_includeInstance) {
940
948
  return proto.aggregator.TokenMetadata.toObject(opt_includeInstance, this);
@@ -2270,7 +2278,7 @@ var require_avs_pb = __commonJS({
2270
2278
  );
2271
2279
  }
2272
2280
  };
2273
- proto.aggregator.EventTrigger.Query.repeatedFields_ = [1, 2];
2281
+ proto.aggregator.EventTrigger.Query.repeatedFields_ = [1, 2, 5];
2274
2282
  if (jspb.Message.GENERATE_TO_OBJECT) {
2275
2283
  proto.aggregator.EventTrigger.Query.prototype.toObject = function(opt_includeInstance) {
2276
2284
  return proto.aggregator.EventTrigger.Query.toObject(opt_includeInstance, this);
@@ -2283,7 +2291,13 @@ var require_avs_pb = __commonJS({
2283
2291
  proto.aggregator.EventTrigger.Topics.toObject,
2284
2292
  includeInstance
2285
2293
  ),
2286
- maxEventsPerBlock: jspb.Message.getFieldWithDefault(msg, 3, 0)
2294
+ maxEventsPerBlock: jspb.Message.getFieldWithDefault(msg, 3, 0),
2295
+ contractAbi: jspb.Message.getFieldWithDefault(msg, 4, ""),
2296
+ conditionsList: jspb.Message.toObjectList(
2297
+ msg.getConditionsList(),
2298
+ proto.aggregator.EventCondition.toObject,
2299
+ includeInstance
2300
+ )
2287
2301
  };
2288
2302
  if (includeInstance) {
2289
2303
  obj.$jspbMessageInstance = msg;
@@ -2322,6 +2336,18 @@ var require_avs_pb = __commonJS({
2322
2336
  );
2323
2337
  msg.setMaxEventsPerBlock(value);
2324
2338
  break;
2339
+ case 4:
2340
+ var value = (
2341
+ /** @type {string} */
2342
+ reader.readString()
2343
+ );
2344
+ msg.setContractAbi(value);
2345
+ break;
2346
+ case 5:
2347
+ var value = new proto.aggregator.EventCondition();
2348
+ reader.readMessage(value, proto.aggregator.EventCondition.deserializeBinaryFromReader);
2349
+ msg.addConditions(value);
2350
+ break;
2325
2351
  default:
2326
2352
  reader.skipField();
2327
2353
  break;
@@ -2359,6 +2385,21 @@ var require_avs_pb = __commonJS({
2359
2385
  f
2360
2386
  );
2361
2387
  }
2388
+ f = message.getContractAbi();
2389
+ if (f.length > 0) {
2390
+ writer.writeString(
2391
+ 4,
2392
+ f
2393
+ );
2394
+ }
2395
+ f = message.getConditionsList();
2396
+ if (f.length > 0) {
2397
+ writer.writeRepeatedMessage(
2398
+ 5,
2399
+ f,
2400
+ proto.aggregator.EventCondition.serializeBinaryToWriter
2401
+ );
2402
+ }
2362
2403
  };
2363
2404
  proto.aggregator.EventTrigger.Query.prototype.getAddressesList = function() {
2364
2405
  return (
@@ -2405,6 +2446,30 @@ var require_avs_pb = __commonJS({
2405
2446
  proto.aggregator.EventTrigger.Query.prototype.hasMaxEventsPerBlock = function() {
2406
2447
  return jspb.Message.getField(this, 3) != null;
2407
2448
  };
2449
+ proto.aggregator.EventTrigger.Query.prototype.getContractAbi = function() {
2450
+ return (
2451
+ /** @type {string} */
2452
+ jspb.Message.getFieldWithDefault(this, 4, "")
2453
+ );
2454
+ };
2455
+ proto.aggregator.EventTrigger.Query.prototype.setContractAbi = function(value) {
2456
+ return jspb.Message.setProto3StringField(this, 4, value);
2457
+ };
2458
+ proto.aggregator.EventTrigger.Query.prototype.getConditionsList = function() {
2459
+ return (
2460
+ /** @type{!Array<!proto.aggregator.EventCondition>} */
2461
+ jspb.Message.getRepeatedWrapperField(this, proto.aggregator.EventCondition, 5)
2462
+ );
2463
+ };
2464
+ proto.aggregator.EventTrigger.Query.prototype.setConditionsList = function(value) {
2465
+ return jspb.Message.setRepeatedWrapperField(this, 5, value);
2466
+ };
2467
+ proto.aggregator.EventTrigger.Query.prototype.addConditions = function(opt_value, opt_index) {
2468
+ return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.aggregator.EventCondition, opt_index);
2469
+ };
2470
+ proto.aggregator.EventTrigger.Query.prototype.clearConditionsList = function() {
2471
+ return this.setConditionsList([]);
2472
+ };
2408
2473
  proto.aggregator.EventTrigger.Topics.repeatedFields_ = [1];
2409
2474
  if (jspb.Message.GENERATE_TO_OBJECT) {
2410
2475
  proto.aggregator.EventTrigger.Topics.prototype.toObject = function(opt_includeInstance) {
@@ -15802,6 +15867,142 @@ var require_avs_pb = __commonJS({
15802
15867
  this.getInputVariablesMap().clear();
15803
15868
  return this;
15804
15869
  };
15870
+ if (jspb.Message.GENERATE_TO_OBJECT) {
15871
+ proto.aggregator.EventCondition.prototype.toObject = function(opt_includeInstance) {
15872
+ return proto.aggregator.EventCondition.toObject(opt_includeInstance, this);
15873
+ };
15874
+ proto.aggregator.EventCondition.toObject = function(includeInstance, msg) {
15875
+ var f, obj = {
15876
+ fieldName: jspb.Message.getFieldWithDefault(msg, 1, ""),
15877
+ operator: jspb.Message.getFieldWithDefault(msg, 2, ""),
15878
+ value: jspb.Message.getFieldWithDefault(msg, 3, ""),
15879
+ fieldType: jspb.Message.getFieldWithDefault(msg, 4, "")
15880
+ };
15881
+ if (includeInstance) {
15882
+ obj.$jspbMessageInstance = msg;
15883
+ }
15884
+ return obj;
15885
+ };
15886
+ }
15887
+ proto.aggregator.EventCondition.deserializeBinary = function(bytes) {
15888
+ var reader = new jspb.BinaryReader(bytes);
15889
+ var msg = new proto.aggregator.EventCondition();
15890
+ return proto.aggregator.EventCondition.deserializeBinaryFromReader(msg, reader);
15891
+ };
15892
+ proto.aggregator.EventCondition.deserializeBinaryFromReader = function(msg, reader) {
15893
+ while (reader.nextField()) {
15894
+ if (reader.isEndGroup()) {
15895
+ break;
15896
+ }
15897
+ var field = reader.getFieldNumber();
15898
+ switch (field) {
15899
+ case 1:
15900
+ var value = (
15901
+ /** @type {string} */
15902
+ reader.readString()
15903
+ );
15904
+ msg.setFieldName(value);
15905
+ break;
15906
+ case 2:
15907
+ var value = (
15908
+ /** @type {string} */
15909
+ reader.readString()
15910
+ );
15911
+ msg.setOperator(value);
15912
+ break;
15913
+ case 3:
15914
+ var value = (
15915
+ /** @type {string} */
15916
+ reader.readString()
15917
+ );
15918
+ msg.setValue(value);
15919
+ break;
15920
+ case 4:
15921
+ var value = (
15922
+ /** @type {string} */
15923
+ reader.readString()
15924
+ );
15925
+ msg.setFieldType(value);
15926
+ break;
15927
+ default:
15928
+ reader.skipField();
15929
+ break;
15930
+ }
15931
+ }
15932
+ return msg;
15933
+ };
15934
+ proto.aggregator.EventCondition.prototype.serializeBinary = function() {
15935
+ var writer = new jspb.BinaryWriter();
15936
+ proto.aggregator.EventCondition.serializeBinaryToWriter(this, writer);
15937
+ return writer.getResultBuffer();
15938
+ };
15939
+ proto.aggregator.EventCondition.serializeBinaryToWriter = function(message, writer) {
15940
+ var f = void 0;
15941
+ f = message.getFieldName();
15942
+ if (f.length > 0) {
15943
+ writer.writeString(
15944
+ 1,
15945
+ f
15946
+ );
15947
+ }
15948
+ f = message.getOperator();
15949
+ if (f.length > 0) {
15950
+ writer.writeString(
15951
+ 2,
15952
+ f
15953
+ );
15954
+ }
15955
+ f = message.getValue();
15956
+ if (f.length > 0) {
15957
+ writer.writeString(
15958
+ 3,
15959
+ f
15960
+ );
15961
+ }
15962
+ f = message.getFieldType();
15963
+ if (f.length > 0) {
15964
+ writer.writeString(
15965
+ 4,
15966
+ f
15967
+ );
15968
+ }
15969
+ };
15970
+ proto.aggregator.EventCondition.prototype.getFieldName = function() {
15971
+ return (
15972
+ /** @type {string} */
15973
+ jspb.Message.getFieldWithDefault(this, 1, "")
15974
+ );
15975
+ };
15976
+ proto.aggregator.EventCondition.prototype.setFieldName = function(value) {
15977
+ return jspb.Message.setProto3StringField(this, 1, value);
15978
+ };
15979
+ proto.aggregator.EventCondition.prototype.getOperator = function() {
15980
+ return (
15981
+ /** @type {string} */
15982
+ jspb.Message.getFieldWithDefault(this, 2, "")
15983
+ );
15984
+ };
15985
+ proto.aggregator.EventCondition.prototype.setOperator = function(value) {
15986
+ return jspb.Message.setProto3StringField(this, 2, value);
15987
+ };
15988
+ proto.aggregator.EventCondition.prototype.getValue = function() {
15989
+ return (
15990
+ /** @type {string} */
15991
+ jspb.Message.getFieldWithDefault(this, 3, "")
15992
+ );
15993
+ };
15994
+ proto.aggregator.EventCondition.prototype.setValue = function(value) {
15995
+ return jspb.Message.setProto3StringField(this, 3, value);
15996
+ };
15997
+ proto.aggregator.EventCondition.prototype.getFieldType = function() {
15998
+ return (
15999
+ /** @type {string} */
16000
+ jspb.Message.getFieldWithDefault(this, 4, "")
16001
+ );
16002
+ };
16003
+ proto.aggregator.EventCondition.prototype.setFieldType = function(value) {
16004
+ return jspb.Message.setProto3StringField(this, 4, value);
16005
+ };
15805
16006
  proto.aggregator.TriggerType = {
15806
16007
  TRIGGER_TYPE_UNSPECIFIED: 0,
15807
16008
  TRIGGER_TYPE_MANUAL: 1,
@@ -17032,6 +17233,20 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
17032
17233
  if (queryData.maxEventsPerBlock !== void 0) {
17033
17234
  query.setMaxEventsPerBlock(queryData.maxEventsPerBlock);
17034
17235
  }
17236
+ if (queryData.contractAbi) {
17237
+ query.setContractAbi(queryData.contractAbi);
17238
+ }
17239
+ if (queryData.conditions && queryData.conditions.length > 0) {
17240
+ const conditionMessages = queryData.conditions.map((conditionData) => {
17241
+ const condition = new avs_pb4.EventCondition();
17242
+ condition.setFieldName(conditionData.fieldName);
17243
+ condition.setOperator(conditionData.operator);
17244
+ condition.setValue(conditionData.value);
17245
+ condition.setFieldType(conditionData.fieldType);
17246
+ return condition;
17247
+ });
17248
+ query.setConditionsList(conditionMessages);
17249
+ }
17035
17250
  return query;
17036
17251
  });
17037
17252
  config.setQueriesList(queryMessages);
@@ -17072,6 +17287,25 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
17072
17287
  if (maxEvents && maxEvents > 0) {
17073
17288
  queryData.maxEventsPerBlock = maxEvents;
17074
17289
  }
17290
+ const contractAbi = query.getContractAbi();
17291
+ if (contractAbi) {
17292
+ queryData.contractAbi = contractAbi;
17293
+ }
17294
+ const conditions = [];
17295
+ if (query.getConditionsList && query.getConditionsList().length > 0) {
17296
+ query.getConditionsList().forEach((condition) => {
17297
+ const conditionData = {
17298
+ fieldName: condition.getFieldName(),
17299
+ operator: condition.getOperator(),
17300
+ value: condition.getValue(),
17301
+ fieldType: condition.getFieldType()
17302
+ };
17303
+ conditions.push(conditionData);
17304
+ });
17305
+ }
17306
+ if (conditions.length > 0) {
17307
+ queryData.conditions = conditions;
17308
+ }
17075
17309
  queries.push(queryData);
17076
17310
  });
17077
17311
  }
package/dist/index.mjs CHANGED
@@ -93,6 +93,7 @@ var require_avs_pb = __commonJS({
93
93
  goog.exportSymbol("proto.aggregator.ETHTransferNode.Config", null, global);
94
94
  goog.exportSymbol("proto.aggregator.ETHTransferNode.Output", null, global);
95
95
  goog.exportSymbol("proto.aggregator.Error", null, global);
96
+ goog.exportSymbol("proto.aggregator.EventCondition", null, global);
96
97
  goog.exportSymbol("proto.aggregator.EventTrigger", null, global);
97
98
  goog.exportSymbol("proto.aggregator.EventTrigger.Config", null, global);
98
99
  goog.exportSymbol("proto.aggregator.EventTrigger.Output", null, global);
@@ -935,6 +936,13 @@ var require_avs_pb = __commonJS({
935
936
  if (goog.DEBUG && !COMPILED) {
936
937
  proto.aggregator.SimulateTaskReq.displayName = "proto.aggregator.SimulateTaskReq";
937
938
  }
939
+ proto.aggregator.EventCondition = function(opt_data) {
940
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
941
+ };
942
+ goog.inherits(proto.aggregator.EventCondition, jspb.Message);
943
+ if (goog.DEBUG && !COMPILED) {
944
+ proto.aggregator.EventCondition.displayName = "proto.aggregator.EventCondition";
945
+ }
938
946
  if (jspb.Message.GENERATE_TO_OBJECT) {
939
947
  proto.aggregator.TokenMetadata.prototype.toObject = function(opt_includeInstance) {
940
948
  return proto.aggregator.TokenMetadata.toObject(opt_includeInstance, this);
@@ -2270,7 +2278,7 @@ var require_avs_pb = __commonJS({
2270
2278
  );
2271
2279
  }
2272
2280
  };
2273
- proto.aggregator.EventTrigger.Query.repeatedFields_ = [1, 2];
2281
+ proto.aggregator.EventTrigger.Query.repeatedFields_ = [1, 2, 5];
2274
2282
  if (jspb.Message.GENERATE_TO_OBJECT) {
2275
2283
  proto.aggregator.EventTrigger.Query.prototype.toObject = function(opt_includeInstance) {
2276
2284
  return proto.aggregator.EventTrigger.Query.toObject(opt_includeInstance, this);
@@ -2283,7 +2291,13 @@ var require_avs_pb = __commonJS({
2283
2291
  proto.aggregator.EventTrigger.Topics.toObject,
2284
2292
  includeInstance
2285
2293
  ),
2286
- maxEventsPerBlock: jspb.Message.getFieldWithDefault(msg, 3, 0)
2294
+ maxEventsPerBlock: jspb.Message.getFieldWithDefault(msg, 3, 0),
2295
+ contractAbi: jspb.Message.getFieldWithDefault(msg, 4, ""),
2296
+ conditionsList: jspb.Message.toObjectList(
2297
+ msg.getConditionsList(),
2298
+ proto.aggregator.EventCondition.toObject,
2299
+ includeInstance
2300
+ )
2287
2301
  };
2288
2302
  if (includeInstance) {
2289
2303
  obj.$jspbMessageInstance = msg;
@@ -2322,6 +2336,18 @@ var require_avs_pb = __commonJS({
2322
2336
  );
2323
2337
  msg.setMaxEventsPerBlock(value);
2324
2338
  break;
2339
+ case 4:
2340
+ var value = (
2341
+ /** @type {string} */
2342
+ reader.readString()
2343
+ );
2344
+ msg.setContractAbi(value);
2345
+ break;
2346
+ case 5:
2347
+ var value = new proto.aggregator.EventCondition();
2348
+ reader.readMessage(value, proto.aggregator.EventCondition.deserializeBinaryFromReader);
2349
+ msg.addConditions(value);
2350
+ break;
2325
2351
  default:
2326
2352
  reader.skipField();
2327
2353
  break;
@@ -2359,6 +2385,21 @@ var require_avs_pb = __commonJS({
2359
2385
  f
2360
2386
  );
2361
2387
  }
2388
+ f = message.getContractAbi();
2389
+ if (f.length > 0) {
2390
+ writer.writeString(
2391
+ 4,
2392
+ f
2393
+ );
2394
+ }
2395
+ f = message.getConditionsList();
2396
+ if (f.length > 0) {
2397
+ writer.writeRepeatedMessage(
2398
+ 5,
2399
+ f,
2400
+ proto.aggregator.EventCondition.serializeBinaryToWriter
2401
+ );
2402
+ }
2362
2403
  };
2363
2404
  proto.aggregator.EventTrigger.Query.prototype.getAddressesList = function() {
2364
2405
  return (
@@ -2405,6 +2446,30 @@ var require_avs_pb = __commonJS({
2405
2446
  proto.aggregator.EventTrigger.Query.prototype.hasMaxEventsPerBlock = function() {
2406
2447
  return jspb.Message.getField(this, 3) != null;
2407
2448
  };
2449
+ proto.aggregator.EventTrigger.Query.prototype.getContractAbi = function() {
2450
+ return (
2451
+ /** @type {string} */
2452
+ jspb.Message.getFieldWithDefault(this, 4, "")
2453
+ );
2454
+ };
2455
+ proto.aggregator.EventTrigger.Query.prototype.setContractAbi = function(value) {
2456
+ return jspb.Message.setProto3StringField(this, 4, value);
2457
+ };
2458
+ proto.aggregator.EventTrigger.Query.prototype.getConditionsList = function() {
2459
+ return (
2460
+ /** @type{!Array<!proto.aggregator.EventCondition>} */
2461
+ jspb.Message.getRepeatedWrapperField(this, proto.aggregator.EventCondition, 5)
2462
+ );
2463
+ };
2464
+ proto.aggregator.EventTrigger.Query.prototype.setConditionsList = function(value) {
2465
+ return jspb.Message.setRepeatedWrapperField(this, 5, value);
2466
+ };
2467
+ proto.aggregator.EventTrigger.Query.prototype.addConditions = function(opt_value, opt_index) {
2468
+ return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.aggregator.EventCondition, opt_index);
2469
+ };
2470
+ proto.aggregator.EventTrigger.Query.prototype.clearConditionsList = function() {
2471
+ return this.setConditionsList([]);
2472
+ };
2408
2473
  proto.aggregator.EventTrigger.Topics.repeatedFields_ = [1];
2409
2474
  if (jspb.Message.GENERATE_TO_OBJECT) {
2410
2475
  proto.aggregator.EventTrigger.Topics.prototype.toObject = function(opt_includeInstance) {
@@ -15802,6 +15867,142 @@ var require_avs_pb = __commonJS({
15802
15867
  this.getInputVariablesMap().clear();
15803
15868
  return this;
15804
15869
  };
15870
+ if (jspb.Message.GENERATE_TO_OBJECT) {
15871
+ proto.aggregator.EventCondition.prototype.toObject = function(opt_includeInstance) {
15872
+ return proto.aggregator.EventCondition.toObject(opt_includeInstance, this);
15873
+ };
15874
+ proto.aggregator.EventCondition.toObject = function(includeInstance, msg) {
15875
+ var f, obj = {
15876
+ fieldName: jspb.Message.getFieldWithDefault(msg, 1, ""),
15877
+ operator: jspb.Message.getFieldWithDefault(msg, 2, ""),
15878
+ value: jspb.Message.getFieldWithDefault(msg, 3, ""),
15879
+ fieldType: jspb.Message.getFieldWithDefault(msg, 4, "")
15880
+ };
15881
+ if (includeInstance) {
15882
+ obj.$jspbMessageInstance = msg;
15883
+ }
15884
+ return obj;
15885
+ };
15886
+ }
15887
+ proto.aggregator.EventCondition.deserializeBinary = function(bytes) {
15888
+ var reader = new jspb.BinaryReader(bytes);
15889
+ var msg = new proto.aggregator.EventCondition();
15890
+ return proto.aggregator.EventCondition.deserializeBinaryFromReader(msg, reader);
15891
+ };
15892
+ proto.aggregator.EventCondition.deserializeBinaryFromReader = function(msg, reader) {
15893
+ while (reader.nextField()) {
15894
+ if (reader.isEndGroup()) {
15895
+ break;
15896
+ }
15897
+ var field = reader.getFieldNumber();
15898
+ switch (field) {
15899
+ case 1:
15900
+ var value = (
15901
+ /** @type {string} */
15902
+ reader.readString()
15903
+ );
15904
+ msg.setFieldName(value);
15905
+ break;
15906
+ case 2:
15907
+ var value = (
15908
+ /** @type {string} */
15909
+ reader.readString()
15910
+ );
15911
+ msg.setOperator(value);
15912
+ break;
15913
+ case 3:
15914
+ var value = (
15915
+ /** @type {string} */
15916
+ reader.readString()
15917
+ );
15918
+ msg.setValue(value);
15919
+ break;
15920
+ case 4:
15921
+ var value = (
15922
+ /** @type {string} */
15923
+ reader.readString()
15924
+ );
15925
+ msg.setFieldType(value);
15926
+ break;
15927
+ default:
15928
+ reader.skipField();
15929
+ break;
15930
+ }
15931
+ }
15932
+ return msg;
15933
+ };
15934
+ proto.aggregator.EventCondition.prototype.serializeBinary = function() {
15935
+ var writer = new jspb.BinaryWriter();
15936
+ proto.aggregator.EventCondition.serializeBinaryToWriter(this, writer);
15937
+ return writer.getResultBuffer();
15938
+ };
15939
+ proto.aggregator.EventCondition.serializeBinaryToWriter = function(message, writer) {
15940
+ var f = void 0;
15941
+ f = message.getFieldName();
15942
+ if (f.length > 0) {
15943
+ writer.writeString(
15944
+ 1,
15945
+ f
15946
+ );
15947
+ }
15948
+ f = message.getOperator();
15949
+ if (f.length > 0) {
15950
+ writer.writeString(
15951
+ 2,
15952
+ f
15953
+ );
15954
+ }
15955
+ f = message.getValue();
15956
+ if (f.length > 0) {
15957
+ writer.writeString(
15958
+ 3,
15959
+ f
15960
+ );
15961
+ }
15962
+ f = message.getFieldType();
15963
+ if (f.length > 0) {
15964
+ writer.writeString(
15965
+ 4,
15966
+ f
15967
+ );
15968
+ }
15969
+ };
15970
+ proto.aggregator.EventCondition.prototype.getFieldName = function() {
15971
+ return (
15972
+ /** @type {string} */
15973
+ jspb.Message.getFieldWithDefault(this, 1, "")
15974
+ );
15975
+ };
15976
+ proto.aggregator.EventCondition.prototype.setFieldName = function(value) {
15977
+ return jspb.Message.setProto3StringField(this, 1, value);
15978
+ };
15979
+ proto.aggregator.EventCondition.prototype.getOperator = function() {
15980
+ return (
15981
+ /** @type {string} */
15982
+ jspb.Message.getFieldWithDefault(this, 2, "")
15983
+ );
15984
+ };
15985
+ proto.aggregator.EventCondition.prototype.setOperator = function(value) {
15986
+ return jspb.Message.setProto3StringField(this, 2, value);
15987
+ };
15988
+ proto.aggregator.EventCondition.prototype.getValue = function() {
15989
+ return (
15990
+ /** @type {string} */
15991
+ jspb.Message.getFieldWithDefault(this, 3, "")
15992
+ );
15993
+ };
15994
+ proto.aggregator.EventCondition.prototype.setValue = function(value) {
15995
+ return jspb.Message.setProto3StringField(this, 3, value);
15996
+ };
15997
+ proto.aggregator.EventCondition.prototype.getFieldType = function() {
15998
+ return (
15999
+ /** @type {string} */
16000
+ jspb.Message.getFieldWithDefault(this, 4, "")
16001
+ );
16002
+ };
16003
+ proto.aggregator.EventCondition.prototype.setFieldType = function(value) {
16004
+ return jspb.Message.setProto3StringField(this, 4, value);
16005
+ };
15805
16006
  proto.aggregator.TriggerType = {
15806
16007
  TRIGGER_TYPE_UNSPECIFIED: 0,
15807
16008
  TRIGGER_TYPE_MANUAL: 1,
@@ -17009,6 +17210,20 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
17009
17210
  if (queryData.maxEventsPerBlock !== void 0) {
17010
17211
  query.setMaxEventsPerBlock(queryData.maxEventsPerBlock);
17011
17212
  }
17213
+ if (queryData.contractAbi) {
17214
+ query.setContractAbi(queryData.contractAbi);
17215
+ }
17216
+ if (queryData.conditions && queryData.conditions.length > 0) {
17217
+ const conditionMessages = queryData.conditions.map((conditionData) => {
17218
+ const condition = new avs_pb4.EventCondition();
17219
+ condition.setFieldName(conditionData.fieldName);
17220
+ condition.setOperator(conditionData.operator);
17221
+ condition.setValue(conditionData.value);
17222
+ condition.setFieldType(conditionData.fieldType);
17223
+ return condition;
17224
+ });
17225
+ query.setConditionsList(conditionMessages);
17226
+ }
17012
17227
  return query;
17013
17228
  });
17014
17229
  config.setQueriesList(queryMessages);
@@ -17049,6 +17264,25 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
17049
17264
  if (maxEvents && maxEvents > 0) {
17050
17265
  queryData.maxEventsPerBlock = maxEvents;
17051
17266
  }
17267
+ const contractAbi = query.getContractAbi();
17268
+ if (contractAbi) {
17269
+ queryData.contractAbi = contractAbi;
17270
+ }
17271
+ const conditions = [];
17272
+ if (query.getConditionsList && query.getConditionsList().length > 0) {
17273
+ query.getConditionsList().forEach((condition) => {
17274
+ const conditionData = {
17275
+ fieldName: condition.getFieldName(),
17276
+ operator: condition.getOperator(),
17277
+ value: condition.getValue(),
17278
+ fieldType: condition.getFieldType()
17279
+ };
17280
+ conditions.push(conditionData);
17281
+ });
17282
+ }
17283
+ if (conditions.length > 0) {
17284
+ queryData.conditions = conditions;
17285
+ }
17052
17286
  queries.push(queryData);
17053
17287
  });
17054
17288
  }
@@ -43,7 +43,7 @@ class ContractWriteNode extends Node {
43
43
  config.setContractAddress(this.data.contractAddress);
44
44
  config.setCallData(this.data.callData);
45
45
  config.setContractAbi(this.data.contractAbi);
46
- // Handle method calls array if present
46
+ // Handle method calls array
47
47
  const methodCalls = this.data.methodCalls || [];
48
48
  methodCalls.forEach((methodCall) => {
49
49
  const methodCallMsg = new avs_pb.ContractWriteNode.MethodCall();
@@ -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;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAElB,MAAM,oBAAoB,CAAC;AA8C5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAmE/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IA8D1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/event.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAGlB,MAAM,oBAAoB,CAAC;AA8C5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAqF/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAwF1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,YAAY,CAAC"}
@@ -85,6 +85,22 @@ class EventTrigger extends Trigger {
85
85
  if (queryData.maxEventsPerBlock !== undefined) {
86
86
  query.setMaxEventsPerBlock(queryData.maxEventsPerBlock);
87
87
  }
88
+ // Set contractAbi if provided
89
+ if (queryData.contractAbi) {
90
+ query.setContractAbi(queryData.contractAbi);
91
+ }
92
+ // Set conditions if provided
93
+ if (queryData.conditions && queryData.conditions.length > 0) {
94
+ const conditionMessages = queryData.conditions.map((conditionData) => {
95
+ const condition = new avs_pb.EventCondition();
96
+ condition.setFieldName(conditionData.fieldName);
97
+ condition.setOperator(conditionData.operator);
98
+ condition.setValue(conditionData.value);
99
+ condition.setFieldType(conditionData.fieldType);
100
+ return condition;
101
+ });
102
+ query.setConditionsList(conditionMessages);
103
+ }
88
104
  return query;
89
105
  });
90
106
  config.setQueriesList(queryMessages);
@@ -122,7 +138,7 @@ class EventTrigger extends Trigger {
122
138
  // Don't convert empty strings back to null - preserve the original values
123
139
  // The backend may legitimately use empty strings, and we shouldn't assume
124
140
  // they were originally null values from the client
125
- values: topics.getValuesList() || []
141
+ values: topics.getValuesList() || [],
126
142
  }));
127
143
  }
128
144
  // Extract maxEventsPerBlock
@@ -130,6 +146,28 @@ class EventTrigger extends Trigger {
130
146
  if (maxEvents && maxEvents > 0) {
131
147
  queryData.maxEventsPerBlock = maxEvents;
132
148
  }
149
+ // Extract contractAbi
150
+ const contractAbi = query.getContractAbi();
151
+ if (contractAbi) {
152
+ queryData.contractAbi = contractAbi;
153
+ }
154
+ // Extract conditions
155
+ const conditions = [];
156
+ if (query.getConditionsList &&
157
+ query.getConditionsList().length > 0) {
158
+ query.getConditionsList().forEach((condition) => {
159
+ const conditionData = {
160
+ fieldName: condition.getFieldName(),
161
+ operator: condition.getOperator(),
162
+ value: condition.getValue(),
163
+ fieldType: condition.getFieldType(),
164
+ };
165
+ conditions.push(conditionData);
166
+ });
167
+ }
168
+ if (conditions.length > 0) {
169
+ queryData.conditions = conditions;
170
+ }
133
171
  queries.push(queryData);
134
172
  });
135
173
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avaprotocol/sdk-js",
3
- "version": "2.3.17",
3
+ "version": "2.4.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.2.11",
34
+ "@avaprotocol/types": "^2.2.13",
35
35
  "@grpc/grpc-js": "^1.11.3",
36
36
  "@grpc/proto-loader": "^0.7.13",
37
37
  "dotenv": "^16.4.5",