@avaprotocol/sdk-js 1.3.2 → 1.3.3

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/dist/index.mjs CHANGED
@@ -53,6 +53,8 @@ var require_avs_pb = __commonJS({
53
53
  }.call(null);
54
54
  var google_protobuf_wrappers_pb = __require("google-protobuf/google/protobuf/wrappers_pb.js");
55
55
  goog.object.extend(proto, google_protobuf_wrappers_pb);
56
+ var google_protobuf_timestamp_pb = __require("google-protobuf/google/protobuf/timestamp_pb.js");
57
+ goog.object.extend(proto, google_protobuf_timestamp_pb);
56
58
  goog.exportSymbol("proto.aggregator.BlockCondition", null, global);
57
59
  goog.exportSymbol("proto.aggregator.BranchNode", null, global);
58
60
  goog.exportSymbol("proto.aggregator.Condition", null, global);
@@ -66,6 +68,7 @@ var require_avs_pb = __commonJS({
66
68
  goog.exportSymbol("proto.aggregator.ETHTransferNode", null, global);
67
69
  goog.exportSymbol("proto.aggregator.Error", null, global);
68
70
  goog.exportSymbol("proto.aggregator.EventCondition", null, global);
71
+ goog.exportSymbol("proto.aggregator.EventCondition.Matcher", null, global);
69
72
  goog.exportSymbol("proto.aggregator.Execution", null, global);
70
73
  goog.exportSymbol("proto.aggregator.Execution.Step", null, global);
71
74
  goog.exportSymbol("proto.aggregator.ExecutionReq", null, global);
@@ -132,12 +135,19 @@ var require_avs_pb = __commonJS({
132
135
  proto.aggregator.BlockCondition.displayName = "proto.aggregator.BlockCondition";
133
136
  }
134
137
  proto.aggregator.EventCondition = function(opt_data) {
135
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
138
+ jspb.Message.initialize(this, opt_data, 0, -1, proto.aggregator.EventCondition.repeatedFields_, null);
136
139
  };
137
140
  goog.inherits(proto.aggregator.EventCondition, jspb.Message);
138
141
  if (goog.DEBUG && !COMPILED) {
139
142
  proto.aggregator.EventCondition.displayName = "proto.aggregator.EventCondition";
140
143
  }
144
+ proto.aggregator.EventCondition.Matcher = function(opt_data) {
145
+ jspb.Message.initialize(this, opt_data, 0, -1, proto.aggregator.EventCondition.Matcher.repeatedFields_, null);
146
+ };
147
+ goog.inherits(proto.aggregator.EventCondition.Matcher, jspb.Message);
148
+ if (goog.DEBUG && !COMPILED) {
149
+ proto.aggregator.EventCondition.Matcher.displayName = "proto.aggregator.EventCondition.Matcher";
150
+ }
141
151
  proto.aggregator.TaskTrigger = function(opt_data) {
142
152
  jspb.Message.initialize(this, opt_data, 0, -1, null, proto.aggregator.TaskTrigger.oneofGroups_);
143
153
  };
@@ -669,13 +679,19 @@ var require_avs_pb = __commonJS({
669
679
  proto.aggregator.BlockCondition.prototype.setInterval = function(value) {
670
680
  return jspb.Message.setProto3IntField(this, 1, value);
671
681
  };
682
+ proto.aggregator.EventCondition.repeatedFields_ = [1];
672
683
  if (jspb.Message.GENERATE_TO_OBJECT) {
673
684
  proto.aggregator.EventCondition.prototype.toObject = function(opt_includeInstance) {
674
685
  return proto.aggregator.EventCondition.toObject(opt_includeInstance, this);
675
686
  };
676
687
  proto.aggregator.EventCondition.toObject = function(includeInstance, msg) {
677
688
  var f, obj = {
678
- expression: jspb.Message.getFieldWithDefault(msg, 1, "")
689
+ matcherList: jspb.Message.toObjectList(
690
+ msg.getMatcherList(),
691
+ proto.aggregator.EventCondition.Matcher.toObject,
692
+ includeInstance
693
+ ),
694
+ expression: jspb.Message.getFieldWithDefault(msg, 2, "")
679
695
  };
680
696
  if (includeInstance) {
681
697
  obj.$jspbMessageInstance = msg;
@@ -696,6 +712,11 @@ var require_avs_pb = __commonJS({
696
712
  var field = reader.getFieldNumber();
697
713
  switch (field) {
698
714
  case 1:
715
+ var value = new proto.aggregator.EventCondition.Matcher();
716
+ reader.readMessage(value, proto.aggregator.EventCondition.Matcher.deserializeBinaryFromReader);
717
+ msg.addMatcher(value);
718
+ break;
719
+ case 2:
699
720
  var value = (
700
721
  /** @type {string} */
701
722
  reader.readString()
@@ -716,23 +737,141 @@ var require_avs_pb = __commonJS({
716
737
  };
717
738
  proto.aggregator.EventCondition.serializeBinaryToWriter = function(message, writer) {
718
739
  var f = void 0;
740
+ f = message.getMatcherList();
741
+ if (f.length > 0) {
742
+ writer.writeRepeatedMessage(
743
+ 1,
744
+ f,
745
+ proto.aggregator.EventCondition.Matcher.serializeBinaryToWriter
746
+ );
747
+ }
719
748
  f = message.getExpression();
749
+ if (f.length > 0) {
750
+ writer.writeString(
751
+ 2,
752
+ f
753
+ );
754
+ }
755
+ };
756
+ proto.aggregator.EventCondition.Matcher.repeatedFields_ = [2];
757
+ if (jspb.Message.GENERATE_TO_OBJECT) {
758
+ proto.aggregator.EventCondition.Matcher.prototype.toObject = function(opt_includeInstance) {
759
+ return proto.aggregator.EventCondition.Matcher.toObject(opt_includeInstance, this);
760
+ };
761
+ proto.aggregator.EventCondition.Matcher.toObject = function(includeInstance, msg) {
762
+ var f, obj = {
763
+ type: jspb.Message.getFieldWithDefault(msg, 1, ""),
764
+ valueList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? void 0 : f
765
+ };
766
+ if (includeInstance) {
767
+ obj.$jspbMessageInstance = msg;
768
+ }
769
+ return obj;
770
+ };
771
+ }
772
+ proto.aggregator.EventCondition.Matcher.deserializeBinary = function(bytes) {
773
+ var reader = new jspb.BinaryReader(bytes);
774
+ var msg = new proto.aggregator.EventCondition.Matcher();
775
+ return proto.aggregator.EventCondition.Matcher.deserializeBinaryFromReader(msg, reader);
776
+ };
777
+ proto.aggregator.EventCondition.Matcher.deserializeBinaryFromReader = function(msg, reader) {
778
+ while (reader.nextField()) {
779
+ if (reader.isEndGroup()) {
780
+ break;
781
+ }
782
+ var field = reader.getFieldNumber();
783
+ switch (field) {
784
+ case 1:
785
+ var value = (
786
+ /** @type {string} */
787
+ reader.readString()
788
+ );
789
+ msg.setType(value);
790
+ break;
791
+ case 2:
792
+ var value = (
793
+ /** @type {string} */
794
+ reader.readString()
795
+ );
796
+ msg.addValue(value);
797
+ break;
798
+ default:
799
+ reader.skipField();
800
+ break;
801
+ }
802
+ }
803
+ return msg;
804
+ };
805
+ proto.aggregator.EventCondition.Matcher.prototype.serializeBinary = function() {
806
+ var writer = new jspb.BinaryWriter();
807
+ proto.aggregator.EventCondition.Matcher.serializeBinaryToWriter(this, writer);
808
+ return writer.getResultBuffer();
809
+ };
810
+ proto.aggregator.EventCondition.Matcher.serializeBinaryToWriter = function(message, writer) {
811
+ var f = void 0;
812
+ f = message.getType();
720
813
  if (f.length > 0) {
721
814
  writer.writeString(
722
815
  1,
723
816
  f
724
817
  );
725
818
  }
819
+ f = message.getValueList();
820
+ if (f.length > 0) {
821
+ writer.writeRepeatedString(
822
+ 2,
823
+ f
824
+ );
825
+ }
726
826
  };
727
- proto.aggregator.EventCondition.prototype.getExpression = function() {
827
+ proto.aggregator.EventCondition.Matcher.prototype.getType = function() {
728
828
  return (
729
829
  /** @type {string} */
730
830
  jspb.Message.getFieldWithDefault(this, 1, "")
731
831
  );
732
832
  };
733
- proto.aggregator.EventCondition.prototype.setExpression = function(value) {
833
+ proto.aggregator.EventCondition.Matcher.prototype.setType = function(value) {
734
834
  return jspb.Message.setProto3StringField(this, 1, value);
735
835
  };
836
+ proto.aggregator.EventCondition.Matcher.prototype.getValueList = function() {
837
+ return (
838
+ /** @type {!Array<string>} */
839
+ jspb.Message.getRepeatedField(this, 2)
840
+ );
841
+ };
842
+ proto.aggregator.EventCondition.Matcher.prototype.setValueList = function(value) {
843
+ return jspb.Message.setField(this, 2, value || []);
844
+ };
845
+ proto.aggregator.EventCondition.Matcher.prototype.addValue = function(value, opt_index) {
846
+ return jspb.Message.addToRepeatedField(this, 2, value, opt_index);
847
+ };
848
+ proto.aggregator.EventCondition.Matcher.prototype.clearValueList = function() {
849
+ return this.setValueList([]);
850
+ };
851
+ proto.aggregator.EventCondition.prototype.getMatcherList = function() {
852
+ return (
853
+ /** @type{!Array<!proto.aggregator.EventCondition.Matcher>} */
854
+ jspb.Message.getRepeatedWrapperField(this, proto.aggregator.EventCondition.Matcher, 1)
855
+ );
856
+ };
857
+ proto.aggregator.EventCondition.prototype.setMatcherList = function(value) {
858
+ return jspb.Message.setRepeatedWrapperField(this, 1, value);
859
+ };
860
+ proto.aggregator.EventCondition.prototype.addMatcher = function(opt_value, opt_index) {
861
+ return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.aggregator.EventCondition.Matcher, opt_index);
862
+ };
863
+ proto.aggregator.EventCondition.prototype.clearMatcherList = function() {
864
+ return this.setMatcherList([]);
865
+ };
866
+ proto.aggregator.EventCondition.prototype.getExpression = function() {
867
+ return (
868
+ /** @type {string} */
869
+ jspb.Message.getFieldWithDefault(this, 2, "")
870
+ );
871
+ };
872
+ proto.aggregator.EventCondition.prototype.setExpression = function(value) {
873
+ return jspb.Message.setProto3StringField(this, 2, value);
874
+ };
736
875
  proto.aggregator.TaskTrigger.oneofGroups_ = [[2, 3, 4, 5, 6]];
737
876
  proto.aggregator.TaskTrigger.TriggerTypeCase = {
738
877
  TRIGGER_TYPE_NOT_SET: 0,
@@ -759,7 +898,8 @@ var require_avs_pb = __commonJS({
759
898
  fixedTime: (f = msg.getFixedTime()) && proto.aggregator.FixedTimeCondition.toObject(includeInstance, f),
760
899
  cron: (f = msg.getCron()) && proto.aggregator.CronCondition.toObject(includeInstance, f),
761
900
  block: (f = msg.getBlock()) && proto.aggregator.BlockCondition.toObject(includeInstance, f),
762
- event: (f = msg.getEvent()) && proto.aggregator.EventCondition.toObject(includeInstance, f)
901
+ event: (f = msg.getEvent()) && proto.aggregator.EventCondition.toObject(includeInstance, f),
902
+ id: jspb.Message.getFieldWithDefault(msg, 7, "")
763
903
  };
764
904
  if (includeInstance) {
765
905
  obj.$jspbMessageInstance = msg;
@@ -813,6 +953,13 @@ var require_avs_pb = __commonJS({
813
953
  reader.readMessage(value, proto.aggregator.EventCondition.deserializeBinaryFromReader);
814
954
  msg.setEvent(value);
815
955
  break;
956
+ case 7:
957
+ var value = (
958
+ /** @type {string} */
959
+ reader.readString()
960
+ );
961
+ msg.setId(value);
962
+ break;
816
963
  default:
817
964
  reader.skipField();
818
965
  break;
@@ -874,6 +1021,13 @@ var require_avs_pb = __commonJS({
874
1021
  proto.aggregator.EventCondition.serializeBinaryToWriter
875
1022
  );
876
1023
  }
1024
+ f = message.getId();
1025
+ if (f.length > 0) {
1026
+ writer.writeString(
1027
+ 7,
1028
+ f
1029
+ );
1030
+ }
877
1031
  };
878
1032
  proto.aggregator.TaskTrigger.prototype.getName = function() {
879
1033
  return (
@@ -959,6 +1113,15 @@ var require_avs_pb = __commonJS({
959
1113
  proto.aggregator.TaskTrigger.prototype.hasEvent = function() {
960
1114
  return jspb.Message.getField(this, 6) != null;
961
1115
  };
1116
+ proto.aggregator.TaskTrigger.prototype.getId = function() {
1117
+ return (
1118
+ /** @type {string} */
1119
+ jspb.Message.getFieldWithDefault(this, 7, "")
1120
+ );
1121
+ };
1122
+ proto.aggregator.TaskTrigger.prototype.setId = function(value) {
1123
+ return jspb.Message.setProto3StringField(this, 7, value);
1124
+ };
962
1125
  if (jspb.Message.GENERATE_TO_OBJECT) {
963
1126
  proto.aggregator.ETHTransferNode.prototype.toObject = function(opt_includeInstance) {
964
1127
  return proto.aggregator.ETHTransferNode.toObject(opt_includeInstance, this);
@@ -1827,7 +1990,8 @@ var require_avs_pb = __commonJS({
1827
1990
  };
1828
1991
  proto.aggregator.FilterNode.toObject = function(includeInstance, msg) {
1829
1992
  var f, obj = {
1830
- expression: jspb.Message.getFieldWithDefault(msg, 1, "")
1993
+ expression: jspb.Message.getFieldWithDefault(msg, 1, ""),
1994
+ input: jspb.Message.getFieldWithDefault(msg, 2, "")
1831
1995
  };
1832
1996
  if (includeInstance) {
1833
1997
  obj.$jspbMessageInstance = msg;
@@ -1854,6 +2018,13 @@ var require_avs_pb = __commonJS({
1854
2018
  );
1855
2019
  msg.setExpression(value);
1856
2020
  break;
2021
+ case 2:
2022
+ var value = (
2023
+ /** @type {string} */
2024
+ reader.readString()
2025
+ );
2026
+ msg.setInput(value);
2027
+ break;
1857
2028
  default:
1858
2029
  reader.skipField();
1859
2030
  break;
@@ -1875,6 +2046,13 @@ var require_avs_pb = __commonJS({
1875
2046
  f
1876
2047
  );
1877
2048
  }
2049
+ f = message.getInput();
2050
+ if (f.length > 0) {
2051
+ writer.writeString(
2052
+ 2,
2053
+ f
2054
+ );
2055
+ }
1878
2056
  };
1879
2057
  proto.aggregator.FilterNode.prototype.getExpression = function() {
1880
2058
  return (
@@ -1885,6 +2063,15 @@ var require_avs_pb = __commonJS({
1885
2063
  proto.aggregator.FilterNode.prototype.setExpression = function(value) {
1886
2064
  return jspb.Message.setProto3StringField(this, 1, value);
1887
2065
  };
2066
+ proto.aggregator.FilterNode.prototype.getInput = function() {
2067
+ return (
2068
+ /** @type {string} */
2069
+ jspb.Message.getFieldWithDefault(this, 2, "")
2070
+ );
2071
+ };
2072
+ proto.aggregator.FilterNode.prototype.setInput = function(value) {
2073
+ return jspb.Message.setProto3StringField(this, 2, value);
2074
+ };
1888
2075
  proto.aggregator.LoopNode.oneofGroups_ = [[10, 11, 12, 13, 14, 15]];
1889
2076
  proto.aggregator.LoopNode.RunnerCase = {
1890
2077
  RUNNER_NOT_SET: 0,
@@ -5218,8 +5405,10 @@ var require_avs_pb = __commonJS({
5218
5405
  proto.aggregator.GetKeyReq.toObject = function(includeInstance, msg) {
5219
5406
  var f, obj = {
5220
5407
  owner: jspb.Message.getFieldWithDefault(msg, 1, ""),
5221
- expiredAt: jspb.Message.getFieldWithDefault(msg, 2, 0),
5222
- signature: jspb.Message.getFieldWithDefault(msg, 3, "")
5408
+ chainId: jspb.Message.getFieldWithDefault(msg, 2, 0),
5409
+ issuedAt: (f = msg.getIssuedAt()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f),
5410
+ expiredAt: (f = msg.getExpiredAt()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f),
5411
+ signature: jspb.Message.getFieldWithDefault(msg, 5, "")
5223
5412
  };
5224
5413
  if (includeInstance) {
5225
5414
  obj.$jspbMessageInstance = msg;
@@ -5251,9 +5440,19 @@ var require_avs_pb = __commonJS({
5251
5440
  /** @type {number} */
5252
5441
  reader.readInt64()
5253
5442
  );
5254
- msg.setExpiredAt(value);
5443
+ msg.setChainId(value);
5255
5444
  break;
5256
5445
  case 3:
5446
+ var value = new google_protobuf_timestamp_pb.Timestamp();
5447
+ reader.readMessage(value, google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader);
5448
+ msg.setIssuedAt(value);
5449
+ break;
5450
+ case 4:
5451
+ var value = new google_protobuf_timestamp_pb.Timestamp();
5452
+ reader.readMessage(value, google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader);
5453
+ msg.setExpiredAt(value);
5454
+ break;
5455
+ case 5:
5257
5456
  var value = (
5258
5457
  /** @type {string} */
5259
5458
  reader.readString()
@@ -5281,17 +5480,33 @@ var require_avs_pb = __commonJS({
5281
5480
  f
5282
5481
  );
5283
5482
  }
5284
- f = message.getExpiredAt();
5483
+ f = message.getChainId();
5285
5484
  if (f !== 0) {
5286
5485
  writer.writeInt64(
5287
5486
  2,
5288
5487
  f
5289
5488
  );
5290
5489
  }
5490
+ f = message.getIssuedAt();
5491
+ if (f != null) {
5492
+ writer.writeMessage(
5493
+ 3,
5494
+ f,
5495
+ google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter
5496
+ );
5497
+ }
5498
+ f = message.getExpiredAt();
5499
+ if (f != null) {
5500
+ writer.writeMessage(
5501
+ 4,
5502
+ f,
5503
+ google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter
5504
+ );
5505
+ }
5291
5506
  f = message.getSignature();
5292
5507
  if (f.length > 0) {
5293
5508
  writer.writeString(
5294
- 3,
5509
+ 5,
5295
5510
  f
5296
5511
  );
5297
5512
  }
@@ -5305,23 +5520,53 @@ var require_avs_pb = __commonJS({
5305
5520
  proto.aggregator.GetKeyReq.prototype.setOwner = function(value) {
5306
5521
  return jspb.Message.setProto3StringField(this, 1, value);
5307
5522
  };
5308
- proto.aggregator.GetKeyReq.prototype.getExpiredAt = function() {
5523
+ proto.aggregator.GetKeyReq.prototype.getChainId = function() {
5309
5524
  return (
5310
5525
  /** @type {number} */
5311
5526
  jspb.Message.getFieldWithDefault(this, 2, 0)
5312
5527
  );
5313
5528
  };
5314
- proto.aggregator.GetKeyReq.prototype.setExpiredAt = function(value) {
5529
+ proto.aggregator.GetKeyReq.prototype.setChainId = function(value) {
5315
5530
  return jspb.Message.setProto3IntField(this, 2, value);
5316
5531
  };
5532
+ proto.aggregator.GetKeyReq.prototype.getIssuedAt = function() {
5533
+ return (
5534
+ /** @type{?proto.google.protobuf.Timestamp} */
5535
+ jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 3)
5536
+ );
5537
+ };
5538
+ proto.aggregator.GetKeyReq.prototype.setIssuedAt = function(value) {
5539
+ return jspb.Message.setWrapperField(this, 3, value);
5540
+ };
5541
+ proto.aggregator.GetKeyReq.prototype.clearIssuedAt = function() {
5542
+ return this.setIssuedAt(void 0);
5543
+ };
5544
+ proto.aggregator.GetKeyReq.prototype.hasIssuedAt = function() {
5545
+ return jspb.Message.getField(this, 3) != null;
5546
+ };
5547
+ proto.aggregator.GetKeyReq.prototype.getExpiredAt = function() {
5548
+ return (
5549
+ /** @type{?proto.google.protobuf.Timestamp} */
5550
+ jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 4)
5551
+ );
5552
+ };
5553
+ proto.aggregator.GetKeyReq.prototype.setExpiredAt = function(value) {
5554
+ return jspb.Message.setWrapperField(this, 4, value);
5555
+ };
5556
+ proto.aggregator.GetKeyReq.prototype.clearExpiredAt = function() {
5557
+ return this.setExpiredAt(void 0);
5558
+ };
5559
+ proto.aggregator.GetKeyReq.prototype.hasExpiredAt = function() {
5560
+ return jspb.Message.getField(this, 4) != null;
5561
+ };
5317
5562
  proto.aggregator.GetKeyReq.prototype.getSignature = function() {
5318
5563
  return (
5319
5564
  /** @type {string} */
5320
- jspb.Message.getFieldWithDefault(this, 3, "")
5565
+ jspb.Message.getFieldWithDefault(this, 5, "")
5321
5566
  );
5322
5567
  };
5323
5568
  proto.aggregator.GetKeyReq.prototype.setSignature = function(value) {
5324
- return jspb.Message.setProto3StringField(this, 3, value);
5569
+ return jspb.Message.setProto3StringField(this, 5, value);
5325
5570
  };
5326
5571
  if (jspb.Message.GENERATE_TO_OBJECT) {
5327
5572
  proto.aggregator.KeyResp.prototype.toObject = function(opt_includeInstance) {
@@ -5996,6 +6241,7 @@ var require_avs_grpc_pb = __commonJS({
5996
6241
  var grpc2 = __require("@grpc/grpc-js");
5997
6242
  var avs_pb20 = require_avs_pb();
5998
6243
  var google_protobuf_wrappers_pb = __require("google-protobuf/google/protobuf/wrappers_pb.js");
6244
+ var google_protobuf_timestamp_pb = __require("google-protobuf/google/protobuf/timestamp_pb.js");
5999
6245
  function serialize_aggregator_CreateTaskReq(arg) {
6000
6246
  if (!(arg instanceof avs_pb20.CreateTaskReq)) {
6001
6247
  throw new Error("Expected argument of type aggregator.CreateTaskReq");
@@ -6352,13 +6598,21 @@ import * as grpc from "@grpc/grpc-js";
6352
6598
  import { Metadata } from "@grpc/grpc-js";
6353
6599
 
6354
6600
  // src/auth.ts
6355
- var getKeyRequestMessage = (address, expiredAt) => {
6356
- return `key request for ${address} expired at ${expiredAt}`;
6601
+ var getKeyRequestMessage = (chainId, address, issuedAt, expiredAt) => {
6602
+ return `Please sign the below text for ownership verification.
6603
+
6604
+ URI: https://app.avaprotocol.org
6605
+ Chain ID: ${chainId}
6606
+ Version: 1
6607
+ Issued At: ${issuedAt.toISOString()}
6608
+ Expire At: ${expiredAt.toISOString()}
6609
+ Wallet: ${address}`;
6357
6610
  };
6358
6611
 
6359
6612
  // src/index.ts
6360
6613
  var import_avs_grpc_pb = __toESM(require_avs_grpc_pb());
6361
6614
  var avs_pb19 = __toESM(require_avs_pb());
6615
+ import { Timestamp } from "google-protobuf/google/protobuf/timestamp_pb";
6362
6616
 
6363
6617
  // src/models/workflow.ts
6364
6618
  var avs_pb15 = __toESM(require_avs_pb());
@@ -6395,6 +6649,7 @@ var Trigger = class {
6395
6649
  * @param props
6396
6650
  */
6397
6651
  constructor(props) {
6652
+ this.id = props.id;
6398
6653
  this.name = props.name;
6399
6654
  this.type = props.type;
6400
6655
  this.data = props.data;
@@ -6436,6 +6691,7 @@ var BlockTrigger = class _BlockTrigger extends interface_default {
6436
6691
  toRequest() {
6437
6692
  const request = new avs_pb3.TaskTrigger();
6438
6693
  request.setName(this.name);
6694
+ request.setId(this.id);
6439
6695
  if (!this.data) {
6440
6696
  throw new Error(`Trigger data is missing for ${this.type}`);
6441
6697
  }
@@ -6469,6 +6725,7 @@ var CronTrigger = class _CronTrigger extends interface_default {
6469
6725
  toRequest() {
6470
6726
  const request = new avs_pb4.TaskTrigger();
6471
6727
  request.setName(this.name);
6728
+ request.setId(this.id);
6472
6729
  if (!this.data) {
6473
6730
  throw new Error(`Trigger data is missing for ${this.type}`);
6474
6731
  }
@@ -6504,11 +6761,25 @@ var EventTrigger = class _EventTrigger extends interface_default {
6504
6761
  toRequest() {
6505
6762
  const request = new avs_pb5.TaskTrigger();
6506
6763
  request.setName(this.name);
6764
+ request.setId(this.id);
6507
6765
  if (!this.data) {
6508
6766
  throw new Error(`Trigger data is missing for ${this.type}`);
6509
6767
  }
6510
6768
  const condition = new avs_pb5.EventCondition();
6511
- condition.setExpression(this.data.expression);
6769
+ const expression = this.data.expression;
6770
+ const matcher = this.data.matcher;
6771
+ if (expression && expression != "") {
6772
+ condition.setExpression(expression);
6773
+ }
6774
+ if (matcher && matcher.length >= 1) {
6775
+ console.log("hit here", matcher);
6776
+ condition.setMatcherList(matcher.map((element) => {
6777
+ const m = new avs_pb5.EventCondition.Matcher();
6778
+ m.setType(element["type"]);
6779
+ m.setValueList(element["value"]);
6780
+ return m;
6781
+ }));
6782
+ }
6512
6783
  request.setEvent(condition);
6513
6784
  console.log("EventTrigger.toRequest.request:", request.toObject());
6514
6785
  return request;
@@ -6516,10 +6787,22 @@ var EventTrigger = class _EventTrigger extends interface_default {
6516
6787
  static fromResponse(raw) {
6517
6788
  const obj = raw.toObject();
6518
6789
  console.log("EventTrigger.fromResponse.obj:", obj);
6790
+ let data = {};
6791
+ if (raw.getEvent().getExpression()) {
6792
+ data.expression = raw.getEvent().getExpression();
6793
+ }
6794
+ if (raw.getEvent().getMatcherList()) {
6795
+ data.matcher = raw.getEvent().getMatcherList().map((item) => {
6796
+ return {
6797
+ type: item.getType(),
6798
+ value: item.getValueList()
6799
+ };
6800
+ });
6801
+ }
6519
6802
  return new _EventTrigger({
6520
6803
  ...obj,
6521
6804
  type: "event" /* Event */,
6522
- data: raw.getEvent().toObject()
6805
+ data
6523
6806
  });
6524
6807
  }
6525
6808
  };
@@ -6539,6 +6822,7 @@ var FixedTimeTrigger = class _FixedTimeTrigger extends interface_default {
6539
6822
  toRequest() {
6540
6823
  const request = new avs_pb6.TaskTrigger();
6541
6824
  request.setName(this.name);
6825
+ request.setId(this.id);
6542
6826
  if (!this.data) {
6543
6827
  throw new Error(`Trigger data is missing for ${this.type}`);
6544
6828
  }
@@ -7223,10 +7507,20 @@ var BaseClient = class {
7223
7507
  * @param expiredAtEpoch - The expiration epoch
7224
7508
  * @returns {Promise<GetKeyResponse>} - The response from the auth call
7225
7509
  */
7226
- async authWithAPIKey(address, apiKey, expiredAtEpoch) {
7510
+ async authWithAPIKey({
7511
+ chainId,
7512
+ address,
7513
+ issuedAt,
7514
+ expiredAt,
7515
+ apiKey
7516
+ }) {
7227
7517
  const request = new avs_pb19.GetKeyReq();
7518
+ request.setChainId(chainId);
7228
7519
  request.setOwner(address);
7229
- request.setExpiredAt(expiredAtEpoch);
7520
+ const issueTs = Timestamp.fromDate(issuedAt);
7521
+ const expiredTs = Timestamp.fromDate(expiredAt);
7522
+ request.setIssuedAt(issueTs);
7523
+ request.setExpiredAt(expiredTs);
7230
7524
  request.setSignature(apiKey);
7231
7525
  const result = await this.sendGrpcRequest("getKey", request);
7232
7526
  return { authKey: result.getKey() };
@@ -7238,10 +7532,20 @@ var BaseClient = class {
7238
7532
  * @param expiredAtEpoch - The expiration epoch
7239
7533
  * @returns {Promise<GetKeyResponse>} - The response from the auth call
7240
7534
  */
7241
- async authWithSignature(address, signature, expiredAtEpoch) {
7535
+ async authWithSignature({
7536
+ chainId,
7537
+ address,
7538
+ issuedAt,
7539
+ expiredAt,
7540
+ signature
7541
+ }) {
7242
7542
  const request = new avs_pb19.GetKeyReq();
7543
+ request.setChainId(chainId);
7243
7544
  request.setOwner(address);
7244
- request.setExpiredAt(expiredAtEpoch);
7545
+ const issueTs = Timestamp.fromDate(issuedAt);
7546
+ const expiredTs = Timestamp.fromDate(expiredAt);
7547
+ request.setIssuedAt(issueTs);
7548
+ request.setExpiredAt(expiredTs);
7245
7549
  request.setSignature(signature);
7246
7550
  const result = await this.sendGrpcRequest(
7247
7551
  "getKey",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avaprotocol/sdk-js",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
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",