@avaprotocol/sdk-js 2.3.13 → 2.3.14

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,11 @@
1
1
  # @avaprotocol/sdk-js
2
2
 
3
+ ## 2.3.14
4
+
5
+ ### Patch Changes
6
+
7
+ - ba5ec8f: Fix input is not correctly entered into eventTrigger issue
8
+
3
9
  ## 2.3.13
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -16625,6 +16625,41 @@ var avs_pb7 = __toESM(require_avs_pb());
16625
16625
  // src/models/trigger/block.ts
16626
16626
  var avs_pb2 = __toESM(require_avs_pb());
16627
16627
 
16628
+ // src/models/trigger/interface.ts
16629
+ var Trigger = class {
16630
+ /**
16631
+ * Create an instance of Trigger from user inputs
16632
+ * @param props
16633
+ */
16634
+ constructor(props) {
16635
+ this.id = props.id;
16636
+ this.name = props.name;
16637
+ this.type = props.type;
16638
+ this.data = props.data;
16639
+ this.output = props.output;
16640
+ this.input = props.input;
16641
+ }
16642
+ toRequest() {
16643
+ throw new Error("Method not implemented.");
16644
+ }
16645
+ getOutput() {
16646
+ return this.output;
16647
+ }
16648
+ toJson() {
16649
+ return {
16650
+ id: this.id,
16651
+ name: this.name,
16652
+ type: this.type,
16653
+ data: this.data,
16654
+ output: this.output,
16655
+ input: this.input
16656
+ };
16657
+ }
16658
+ };
16659
+
16660
+ // src/models/trigger/block.ts
16661
+ var import_types2 = require("@avaprotocol/types");
16662
+
16628
16663
  // src/utils.ts
16629
16664
  var import_struct_pb = require("google-protobuf/google/protobuf/struct_pb");
16630
16665
  var import_types = require("@avaprotocol/types");
@@ -16790,40 +16825,7 @@ function extractInputFromProtobuf(inputValue) {
16790
16825
  return void 0;
16791
16826
  }
16792
16827
 
16793
- // src/models/trigger/interface.ts
16794
- var Trigger = class {
16795
- /**
16796
- * Create an instance of Trigger from user inputs
16797
- * @param props
16798
- */
16799
- constructor(props) {
16800
- this.id = props.id;
16801
- this.name = props.name;
16802
- this.type = props.type;
16803
- this.data = props.data;
16804
- this.output = props.output;
16805
- this.input = props.input ? extractInputFromProtobuf(props.input) : void 0;
16806
- }
16807
- toRequest() {
16808
- throw new Error("Method not implemented.");
16809
- }
16810
- getOutput() {
16811
- return this.output;
16812
- }
16813
- toJson() {
16814
- return {
16815
- id: this.id,
16816
- name: this.name,
16817
- type: this.type,
16818
- data: this.data,
16819
- output: this.output,
16820
- input: this.input
16821
- };
16822
- }
16823
- };
16824
-
16825
16828
  // src/models/trigger/block.ts
16826
- var import_types2 = require("@avaprotocol/types");
16827
16829
  var BlockTrigger2 = class _BlockTrigger extends Trigger {
16828
16830
  constructor(props) {
16829
16831
  super({ ...props, type: import_types2.TriggerType.Block, data: props.data });
@@ -17034,12 +17036,17 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
17034
17036
  });
17035
17037
  config.setQueriesList(queryMessages);
17036
17038
  trigger.setConfig(config);
17039
+ const inputValue = convertInputToProtobuf(this.input);
17040
+ if (inputValue) {
17041
+ trigger.setInput(inputValue);
17042
+ }
17037
17043
  request.setEvent(trigger);
17038
17044
  return request;
17039
17045
  }
17040
17046
  static fromResponse(raw) {
17041
17047
  const obj = raw.toObject();
17042
17048
  let data = { queries: [] };
17049
+ let input = void 0;
17043
17050
  if (raw.getEvent() && raw.getEvent().hasConfig()) {
17044
17051
  const config = raw.getEvent().getConfig();
17045
17052
  if (config) {
@@ -17070,11 +17077,15 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
17070
17077
  }
17071
17078
  data = { queries };
17072
17079
  }
17080
+ if (raw.getEvent().hasInput()) {
17081
+ input = extractInputFromProtobuf(raw.getEvent().getInput());
17082
+ }
17073
17083
  }
17074
17084
  return new _EventTrigger({
17075
17085
  ...obj,
17076
17086
  type: import_types4.TriggerType.Event,
17077
- data
17087
+ data,
17088
+ input
17078
17089
  });
17079
17090
  }
17080
17091
  /**
@@ -17123,12 +17134,17 @@ var FixedTimeTrigger2 = class _FixedTimeTrigger extends Trigger {
17123
17134
  const config = new avs_pb5.FixedTimeTrigger.Config();
17124
17135
  config.setEpochsList(this.data.epochsList || []);
17125
17136
  trigger.setConfig(config);
17137
+ const inputValue = convertInputToProtobuf(this.input);
17138
+ if (inputValue) {
17139
+ trigger.setInput(inputValue);
17140
+ }
17126
17141
  request.setFixedTime(trigger);
17127
17142
  return request;
17128
17143
  }
17129
17144
  static fromResponse(raw) {
17130
17145
  const obj = raw.toObject();
17131
17146
  let data = { epochsList: [] };
17147
+ let input = void 0;
17132
17148
  if (raw.getFixedTime() && raw.getFixedTime().hasConfig()) {
17133
17149
  const config = raw.getFixedTime().getConfig();
17134
17150
  if (config) {
@@ -17136,11 +17152,15 @@ var FixedTimeTrigger2 = class _FixedTimeTrigger extends Trigger {
17136
17152
  epochsList: config.getEpochsList() || []
17137
17153
  };
17138
17154
  }
17155
+ if (raw.getFixedTime().hasInput()) {
17156
+ input = extractInputFromProtobuf(raw.getFixedTime().getInput());
17157
+ }
17139
17158
  }
17140
17159
  return new _FixedTimeTrigger({
17141
17160
  ...obj,
17142
17161
  type: import_types5.TriggerType.FixedTime,
17143
- data
17162
+ data,
17163
+ input
17144
17164
  });
17145
17165
  }
17146
17166
  /**
@@ -17330,7 +17350,7 @@ var Node = class {
17330
17350
  this.name = props.name;
17331
17351
  this.type = props.type;
17332
17352
  this.data = props.data;
17333
- this.input = props.input ? extractInputFromProtobuf(props.input) : void 0;
17353
+ this.input = props.input;
17334
17354
  }
17335
17355
  toRequest() {
17336
17356
  const request = new avs_pb8.TaskNode();
@@ -17373,7 +17393,10 @@ var ContractWriteNode2 = class _ContractWriteNode extends Node {
17373
17393
  methodName: call.methodName
17374
17394
  })) || []
17375
17395
  };
17376
- const input = extractInputFromProtobuf(raw.getContractWrite()?.getInput());
17396
+ let input = void 0;
17397
+ if (raw.hasInput()) {
17398
+ input = extractInputFromProtobuf(raw.getInput());
17399
+ }
17377
17400
  return new _ContractWriteNode({
17378
17401
  ...obj,
17379
17402
  type: import_types9.NodeType.ContractWrite,
@@ -17402,7 +17425,7 @@ var ContractWriteNode2 = class _ContractWriteNode extends Node {
17402
17425
  node.setConfig(config);
17403
17426
  const inputValue = convertInputToProtobuf(this.input);
17404
17427
  if (inputValue) {
17405
- node.setInput(inputValue);
17428
+ request.setInput(inputValue);
17406
17429
  }
17407
17430
  request.setContractWrite(node);
17408
17431
  return request;
@@ -17477,7 +17500,10 @@ var CustomCodeNode2 = class _CustomCodeNode extends Node {
17477
17500
  lang: rawConfig.lang,
17478
17501
  source: rawConfig.source
17479
17502
  };
17480
- const input = extractInputFromProtobuf(raw.getCustomCode()?.getInput());
17503
+ let input = void 0;
17504
+ if (raw.hasInput()) {
17505
+ input = extractInputFromProtobuf(raw.getInput());
17506
+ }
17481
17507
  return new _CustomCodeNode({
17482
17508
  ...obj,
17483
17509
  type: import_types10.NodeType.CustomCode,
@@ -17496,7 +17522,7 @@ var CustomCodeNode2 = class _CustomCodeNode extends Node {
17496
17522
  node.setConfig(config);
17497
17523
  const inputValue = convertInputToProtobuf(this.input);
17498
17524
  if (inputValue) {
17499
- node.setInput(inputValue);
17525
+ request.setInput(inputValue);
17500
17526
  }
17501
17527
  request.setCustomCode(node);
17502
17528
  return request;
@@ -17644,7 +17670,10 @@ var ContractReadNode2 = class _ContractReadNode extends Node {
17644
17670
  methodName: call.methodName
17645
17671
  })) || []
17646
17672
  };
17647
- const input = extractInputFromProtobuf(raw.getContractRead()?.getInput());
17673
+ let input = void 0;
17674
+ if (raw.hasInput()) {
17675
+ input = extractInputFromProtobuf(raw.getInput());
17676
+ }
17648
17677
  return new _ContractReadNode({
17649
17678
  ...obj,
17650
17679
  type: import_types13.NodeType.ContractRead,
@@ -17672,7 +17701,7 @@ var ContractReadNode2 = class _ContractReadNode extends Node {
17672
17701
  node.setConfig(config);
17673
17702
  const inputValue = convertInputToProtobuf(this.input);
17674
17703
  if (inputValue) {
17675
- node.setInput(inputValue);
17704
+ request.setInput(inputValue);
17676
17705
  }
17677
17706
  request.setContractRead(node);
17678
17707
  return request;
@@ -17863,7 +17892,10 @@ var LoopNode2 = class _LoopNode extends Node {
17863
17892
  contractWrite: loopNodeData.contractWrite,
17864
17893
  graphqlDataQuery: loopNodeData.graphqlDataQuery
17865
17894
  };
17866
- const input = extractInputFromProtobuf(raw.getLoop()?.getInput());
17895
+ let input = void 0;
17896
+ if (raw.hasInput()) {
17897
+ input = extractInputFromProtobuf(raw.getInput());
17898
+ }
17867
17899
  return new _LoopNode({
17868
17900
  ...obj,
17869
17901
  type: import_types17.NodeType.Loop,
@@ -17884,7 +17916,7 @@ var LoopNode2 = class _LoopNode extends Node {
17884
17916
  loopNode.setConfig(config);
17885
17917
  const inputValue = convertInputToProtobuf(this.input);
17886
17918
  if (inputValue) {
17887
- loopNode.setInput(inputValue);
17919
+ node.setInput(inputValue);
17888
17920
  }
17889
17921
  if (data.ethTransfer) {
17890
17922
  const ethTransfer = new avs_pb17.ETHTransferNode();
package/dist/index.mjs CHANGED
@@ -16596,6 +16596,41 @@ var avs_pb7 = __toESM(require_avs_pb());
16596
16596
  // src/models/trigger/block.ts
16597
16597
  var avs_pb2 = __toESM(require_avs_pb());
16598
16598
 
16599
+ // src/models/trigger/interface.ts
16600
+ var Trigger = class {
16601
+ /**
16602
+ * Create an instance of Trigger from user inputs
16603
+ * @param props
16604
+ */
16605
+ constructor(props) {
16606
+ this.id = props.id;
16607
+ this.name = props.name;
16608
+ this.type = props.type;
16609
+ this.data = props.data;
16610
+ this.output = props.output;
16611
+ this.input = props.input;
16612
+ }
16613
+ toRequest() {
16614
+ throw new Error("Method not implemented.");
16615
+ }
16616
+ getOutput() {
16617
+ return this.output;
16618
+ }
16619
+ toJson() {
16620
+ return {
16621
+ id: this.id,
16622
+ name: this.name,
16623
+ type: this.type,
16624
+ data: this.data,
16625
+ output: this.output,
16626
+ input: this.input
16627
+ };
16628
+ }
16629
+ };
16630
+
16631
+ // src/models/trigger/block.ts
16632
+ import { TriggerType as TriggerType3 } from "@avaprotocol/types";
16633
+
16599
16634
  // src/utils.ts
16600
16635
  import {
16601
16636
  Value as ProtobufValue,
@@ -16765,40 +16800,7 @@ function extractInputFromProtobuf(inputValue) {
16765
16800
  return void 0;
16766
16801
  }
16767
16802
 
16768
- // src/models/trigger/interface.ts
16769
- var Trigger = class {
16770
- /**
16771
- * Create an instance of Trigger from user inputs
16772
- * @param props
16773
- */
16774
- constructor(props) {
16775
- this.id = props.id;
16776
- this.name = props.name;
16777
- this.type = props.type;
16778
- this.data = props.data;
16779
- this.output = props.output;
16780
- this.input = props.input ? extractInputFromProtobuf(props.input) : void 0;
16781
- }
16782
- toRequest() {
16783
- throw new Error("Method not implemented.");
16784
- }
16785
- getOutput() {
16786
- return this.output;
16787
- }
16788
- toJson() {
16789
- return {
16790
- id: this.id,
16791
- name: this.name,
16792
- type: this.type,
16793
- data: this.data,
16794
- output: this.output,
16795
- input: this.input
16796
- };
16797
- }
16798
- };
16799
-
16800
16803
  // src/models/trigger/block.ts
16801
- import { TriggerType as TriggerType3 } from "@avaprotocol/types";
16802
16804
  var BlockTrigger2 = class _BlockTrigger extends Trigger {
16803
16805
  constructor(props) {
16804
16806
  super({ ...props, type: TriggerType3.Block, data: props.data });
@@ -17011,12 +17013,17 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
17011
17013
  });
17012
17014
  config.setQueriesList(queryMessages);
17013
17015
  trigger.setConfig(config);
17016
+ const inputValue = convertInputToProtobuf(this.input);
17017
+ if (inputValue) {
17018
+ trigger.setInput(inputValue);
17019
+ }
17014
17020
  request.setEvent(trigger);
17015
17021
  return request;
17016
17022
  }
17017
17023
  static fromResponse(raw) {
17018
17024
  const obj = raw.toObject();
17019
17025
  let data = { queries: [] };
17026
+ let input = void 0;
17020
17027
  if (raw.getEvent() && raw.getEvent().hasConfig()) {
17021
17028
  const config = raw.getEvent().getConfig();
17022
17029
  if (config) {
@@ -17047,11 +17054,15 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
17047
17054
  }
17048
17055
  data = { queries };
17049
17056
  }
17057
+ if (raw.getEvent().hasInput()) {
17058
+ input = extractInputFromProtobuf(raw.getEvent().getInput());
17059
+ }
17050
17060
  }
17051
17061
  return new _EventTrigger({
17052
17062
  ...obj,
17053
17063
  type: TriggerType7.Event,
17054
- data
17064
+ data,
17065
+ input
17055
17066
  });
17056
17067
  }
17057
17068
  /**
@@ -17100,12 +17111,17 @@ var FixedTimeTrigger2 = class _FixedTimeTrigger extends Trigger {
17100
17111
  const config = new avs_pb5.FixedTimeTrigger.Config();
17101
17112
  config.setEpochsList(this.data.epochsList || []);
17102
17113
  trigger.setConfig(config);
17114
+ const inputValue = convertInputToProtobuf(this.input);
17115
+ if (inputValue) {
17116
+ trigger.setInput(inputValue);
17117
+ }
17103
17118
  request.setFixedTime(trigger);
17104
17119
  return request;
17105
17120
  }
17106
17121
  static fromResponse(raw) {
17107
17122
  const obj = raw.toObject();
17108
17123
  let data = { epochsList: [] };
17124
+ let input = void 0;
17109
17125
  if (raw.getFixedTime() && raw.getFixedTime().hasConfig()) {
17110
17126
  const config = raw.getFixedTime().getConfig();
17111
17127
  if (config) {
@@ -17113,11 +17129,15 @@ var FixedTimeTrigger2 = class _FixedTimeTrigger extends Trigger {
17113
17129
  epochsList: config.getEpochsList() || []
17114
17130
  };
17115
17131
  }
17132
+ if (raw.getFixedTime().hasInput()) {
17133
+ input = extractInputFromProtobuf(raw.getFixedTime().getInput());
17134
+ }
17116
17135
  }
17117
17136
  return new _FixedTimeTrigger({
17118
17137
  ...obj,
17119
17138
  type: TriggerType9.FixedTime,
17120
- data
17139
+ data,
17140
+ input
17121
17141
  });
17122
17142
  }
17123
17143
  /**
@@ -17309,7 +17329,7 @@ var Node = class {
17309
17329
  this.name = props.name;
17310
17330
  this.type = props.type;
17311
17331
  this.data = props.data;
17312
- this.input = props.input ? extractInputFromProtobuf(props.input) : void 0;
17332
+ this.input = props.input;
17313
17333
  }
17314
17334
  toRequest() {
17315
17335
  const request = new avs_pb8.TaskNode();
@@ -17352,7 +17372,10 @@ var ContractWriteNode2 = class _ContractWriteNode extends Node {
17352
17372
  methodName: call.methodName
17353
17373
  })) || []
17354
17374
  };
17355
- const input = extractInputFromProtobuf(raw.getContractWrite()?.getInput());
17375
+ let input = void 0;
17376
+ if (raw.hasInput()) {
17377
+ input = extractInputFromProtobuf(raw.getInput());
17378
+ }
17356
17379
  return new _ContractWriteNode({
17357
17380
  ...obj,
17358
17381
  type: NodeType3.ContractWrite,
@@ -17381,7 +17404,7 @@ var ContractWriteNode2 = class _ContractWriteNode extends Node {
17381
17404
  node.setConfig(config);
17382
17405
  const inputValue = convertInputToProtobuf(this.input);
17383
17406
  if (inputValue) {
17384
- node.setInput(inputValue);
17407
+ request.setInput(inputValue);
17385
17408
  }
17386
17409
  request.setContractWrite(node);
17387
17410
  return request;
@@ -17458,7 +17481,10 @@ var CustomCodeNode2 = class _CustomCodeNode extends Node {
17458
17481
  lang: rawConfig.lang,
17459
17482
  source: rawConfig.source
17460
17483
  };
17461
- const input = extractInputFromProtobuf(raw.getCustomCode()?.getInput());
17484
+ let input = void 0;
17485
+ if (raw.hasInput()) {
17486
+ input = extractInputFromProtobuf(raw.getInput());
17487
+ }
17462
17488
  return new _CustomCodeNode({
17463
17489
  ...obj,
17464
17490
  type: NodeType4.CustomCode,
@@ -17477,7 +17503,7 @@ var CustomCodeNode2 = class _CustomCodeNode extends Node {
17477
17503
  node.setConfig(config);
17478
17504
  const inputValue = convertInputToProtobuf(this.input);
17479
17505
  if (inputValue) {
17480
- node.setInput(inputValue);
17506
+ request.setInput(inputValue);
17481
17507
  }
17482
17508
  request.setCustomCode(node);
17483
17509
  return request;
@@ -17627,7 +17653,10 @@ var ContractReadNode2 = class _ContractReadNode extends Node {
17627
17653
  methodName: call.methodName
17628
17654
  })) || []
17629
17655
  };
17630
- const input = extractInputFromProtobuf(raw.getContractRead()?.getInput());
17656
+ let input = void 0;
17657
+ if (raw.hasInput()) {
17658
+ input = extractInputFromProtobuf(raw.getInput());
17659
+ }
17631
17660
  return new _ContractReadNode({
17632
17661
  ...obj,
17633
17662
  type: NodeType7.ContractRead,
@@ -17655,7 +17684,7 @@ var ContractReadNode2 = class _ContractReadNode extends Node {
17655
17684
  node.setConfig(config);
17656
17685
  const inputValue = convertInputToProtobuf(this.input);
17657
17686
  if (inputValue) {
17658
- node.setInput(inputValue);
17687
+ request.setInput(inputValue);
17659
17688
  }
17660
17689
  request.setContractRead(node);
17661
17690
  return request;
@@ -17848,7 +17877,10 @@ var LoopNode2 = class _LoopNode extends Node {
17848
17877
  contractWrite: loopNodeData.contractWrite,
17849
17878
  graphqlDataQuery: loopNodeData.graphqlDataQuery
17850
17879
  };
17851
- const input = extractInputFromProtobuf(raw.getLoop()?.getInput());
17880
+ let input = void 0;
17881
+ if (raw.hasInput()) {
17882
+ input = extractInputFromProtobuf(raw.getInput());
17883
+ }
17852
17884
  return new _LoopNode({
17853
17885
  ...obj,
17854
17886
  type: NodeType11.Loop,
@@ -17869,7 +17901,7 @@ var LoopNode2 = class _LoopNode extends Node {
17869
17901
  loopNode.setConfig(config);
17870
17902
  const inputValue = convertInputToProtobuf(this.input);
17871
17903
  if (inputValue) {
17872
- loopNode.setInput(inputValue);
17904
+ node.setInput(inputValue);
17873
17905
  }
17874
17906
  if (data.ethTransfer) {
17875
17907
  const ethTransfer = new avs_pb17.ETHTransferNode();
@@ -1 +1 @@
1
- {"version":3,"file":"contractRead.d.ts","sourceRoot":"","sources":["../../../src/models/node/contractRead.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAkC,qBAAqB,EAAa,MAAM,oBAAoB,CAAC;AAMtG,cAAM,gBAAiB,SAAQ,IAAI;gBACrB,KAAK,EAAE,qBAAqB;IAIxC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IA0B3D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAoC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAmBrE;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"contractRead.d.ts","sourceRoot":"","sources":["../../../src/models/node/contractRead.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAkC,qBAAqB,EAAa,MAAM,oBAAoB,CAAC;AAMtG,cAAM,gBAAiB,SAAQ,IAAI;gBACrB,KAAK,EAAE,qBAAqB;IAIxC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IA8B3D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAqC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAmBrE;AAED,eAAe,gBAAgB,CAAC"}
@@ -20,8 +20,12 @@ class ContractReadNode extends Node {
20
20
  methodName: call.methodName,
21
21
  })) || [],
22
22
  };
23
- // Extract input data if present
24
- const input = extractInputFromProtobuf(raw.getContractRead()?.getInput());
23
+ // Extract input data from top-level TaskNode.input field (not nested ContractReadNode.input)
24
+ // This matches where we set it in toRequest() and where the Go backend looks for it
25
+ let input = undefined;
26
+ if (raw.hasInput()) {
27
+ input = extractInputFromProtobuf(raw.getInput());
28
+ }
25
29
  return new ContractReadNode({
26
30
  ...obj,
27
31
  type: NodeType.ContractRead,
@@ -48,10 +52,11 @@ class ContractReadNode extends Node {
48
52
  config.addMethodCalls(methodCallMsg);
49
53
  });
50
54
  node.setConfig(config);
51
- // Set input data if provided
55
+ // Set input data on the top-level TaskNode, not the nested ContractReadNode
56
+ // This matches where the Go backend's ExtractNodeInputData() looks for it
52
57
  const inputValue = convertInputToProtobuf(this.input);
53
58
  if (inputValue) {
54
- node.setInput(inputValue);
59
+ request.setInput(inputValue);
55
60
  }
56
61
  request.setContractRead(node);
57
62
  return request;
@@ -1 +1 @@
1
- {"version":3,"file":"contractWrite.d.ts","sourceRoot":"","sources":["../../../src/models/node/contractWrite.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAmC,sBAAsB,EAAa,MAAM,oBAAoB,CAAC;AAMxG,cAAM,iBAAkB,SAAQ,IAAI;gBACtB,KAAK,EAAE,sBAAsB;IAIzC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,iBAAiB;IA2B5D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAqC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAyDrE;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"contractWrite.d.ts","sourceRoot":"","sources":["../../../src/models/node/contractWrite.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAmC,sBAAsB,EAAa,MAAM,oBAAoB,CAAC;AAMxG,cAAM,iBAAkB,SAAQ,IAAI;gBACtB,KAAK,EAAE,sBAAsB;IAIzC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,iBAAiB;IA+B5D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAsC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAyDrE;AAED,eAAe,iBAAiB,CAAC"}
@@ -21,8 +21,12 @@ class ContractWriteNode extends Node {
21
21
  methodName: call.methodName,
22
22
  })) || [],
23
23
  };
24
- // Extract input data if present
25
- const input = extractInputFromProtobuf(raw.getContractWrite()?.getInput());
24
+ // Extract input data from top-level TaskNode.input field (not nested ContractWriteNode.input)
25
+ // This matches where we set it in toRequest() and where the Go backend looks for it
26
+ let input = undefined;
27
+ if (raw.hasInput()) {
28
+ input = extractInputFromProtobuf(raw.getInput());
29
+ }
26
30
  return new ContractWriteNode({
27
31
  ...obj,
28
32
  type: NodeType.ContractWrite,
@@ -50,10 +54,11 @@ class ContractWriteNode extends Node {
50
54
  config.addMethodCalls(methodCallMsg);
51
55
  });
52
56
  node.setConfig(config);
53
- // Set input data if provided
57
+ // Set input data on the top-level TaskNode, not the nested ContractWriteNode
58
+ // This matches where the Go backend's ExtractNodeInputData() looks for it
54
59
  const inputValue = convertInputToProtobuf(this.input);
55
60
  if (inputValue) {
56
- node.setInput(inputValue);
61
+ request.setInput(inputValue);
57
62
  }
58
63
  request.setContractWrite(node);
59
64
  return request;
@@ -1 +1 @@
1
- {"version":3,"file":"customCode.d.ts","sourceRoot":"","sources":["../../../src/models/node/customCode.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAIL,mBAAmB,EAEpB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,cAAe,SAAQ,IAAI;gBACnB,KAAK,EAAE,mBAAmB;IAItC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,cAAc;IAuBzD,SAAS,IAAI,MAAM,CAAC,QAAQ;IA2B5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAkBrE;AAED,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"customCode.d.ts","sourceRoot":"","sources":["../../../src/models/node/customCode.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAIL,mBAAmB,EAEpB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,cAAe,SAAQ,IAAI;gBACnB,KAAK,EAAE,mBAAmB;IAItC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,cAAc;IA2BzD,SAAS,IAAI,MAAM,CAAC,QAAQ;IA4B5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAkBrE;AAED,eAAe,cAAc,CAAC"}
@@ -16,8 +16,12 @@ class CustomCodeNode extends Node {
16
16
  lang: rawConfig.lang,
17
17
  source: rawConfig.source,
18
18
  };
19
- // Extract input data if present
20
- const input = extractInputFromProtobuf(raw.getCustomCode()?.getInput());
19
+ // Extract input data from top-level TaskNode.input field (not nested CustomCodeNode.input)
20
+ // This matches where we set it in toRequest() and where the Go backend looks for it
21
+ let input = undefined;
22
+ if (raw.hasInput()) {
23
+ input = extractInputFromProtobuf(raw.getInput());
24
+ }
21
25
  return new CustomCodeNode({
22
26
  ...obj,
23
27
  type: NodeType.CustomCode,
@@ -35,10 +39,11 @@ class CustomCodeNode extends Node {
35
39
  config.setLang(this.data.lang);
36
40
  config.setSource(this.data.source);
37
41
  node.setConfig(config);
38
- // Set input data if provided
42
+ // Set input data on the top-level TaskNode, not the nested CustomCodeNode
43
+ // This matches where the Go backend's ExtractNodeInputData() looks for it
39
44
  const inputValue = convertInputToProtobuf(this.input);
40
45
  if (inputValue) {
41
- node.setInput(inputValue);
46
+ request.setInput(inputValue);
42
47
  }
43
48
  request.setCustomCode(node);
44
49
  return request;
@@ -1,7 +1,6 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import { NodeType, NodeTypeGoConverter } from "@avaprotocol/types";
3
3
  import _ from "lodash";
4
- import { extractInputFromProtobuf } from "../../utils";
5
4
  // Function to convert TaskStatus to string
6
5
  export function covertNodeTypeToString(status) {
7
6
  const conversionMap = {
@@ -38,8 +37,8 @@ export default class Node {
38
37
  this.name = props.name;
39
38
  this.type = props.type;
40
39
  this.data = props.data;
41
- // Convert from protobuf AsObject to JavaScript object if needed
42
- this.input = props.input ? extractInputFromProtobuf(props.input) : undefined;
40
+ // Direct assignment - no protobuf conversion needed for user input
41
+ this.input = props.input;
43
42
  }
44
43
  toRequest() {
45
44
  const request = new avs_pb.TaskNode();
@@ -1 +1 @@
1
- {"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../../../src/models/node/loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,EAGL,aAAa,EAEd,MAAM,oBAAoB,CAAC;AAI5B,cAAM,QAAS,SAAQ,IAAI;gBACb,KAAK,EAAE,aAAa;IAIhC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,QAAQ;IAmCnD,SAAS,IAAI,MAAM,CAAC,QAAQ;IA6I5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAuCrE;AAED,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../../../src/models/node/loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,EAGL,aAAa,EAEd,MAAM,oBAAoB,CAAC;AAI5B,cAAM,QAAS,SAAQ,IAAI;gBACb,KAAK,EAAE,aAAa;IAIhC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,QAAQ;IAuCnD,SAAS,IAAI,MAAM,CAAC,QAAQ;IA8I5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAuCrE;AAED,eAAe,QAAQ,CAAC"}
@@ -27,8 +27,12 @@ class LoopNode extends Node {
27
27
  contractWrite: loopNodeData.contractWrite,
28
28
  graphqlDataQuery: loopNodeData.graphqlDataQuery,
29
29
  };
30
- // Extract input data if present
31
- const input = extractInputFromProtobuf(raw.getLoop()?.getInput());
30
+ // Extract input data from top-level TaskNode.input field (not nested LoopNode.input)
31
+ // This matches where we set it in toRequest() and where the Go backend looks for it
32
+ let input = undefined;
33
+ if (raw.hasInput()) {
34
+ input = extractInputFromProtobuf(raw.getInput());
35
+ }
32
36
  return new LoopNode({
33
37
  ...obj,
34
38
  type: NodeType.Loop,
@@ -48,10 +52,11 @@ class LoopNode extends Node {
48
52
  config.setIterVal(data.iterVal || "");
49
53
  config.setIterKey(data.iterKey || "");
50
54
  loopNode.setConfig(config);
51
- // Set input data if provided
55
+ // Set input data on the top-level TaskNode, not the nested LoopNode
56
+ // This matches where the Go backend's ExtractNodeInputData() looks for it
52
57
  const inputValue = convertInputToProtobuf(this.input);
53
58
  if (inputValue) {
54
- loopNode.setInput(inputValue);
59
+ node.setInput(inputValue);
55
60
  }
56
61
  // Handle nested nodes - these still use the nested structure within LoopNodeData
57
62
  if (data.ethTransfer) {
@@ -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,EAGlB,MAAM,oBAAoB,CAAC;AA8C5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IA4D/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAuD1D;;;;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,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,6 +1,7 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import Trigger from "./interface";
3
3
  import { TriggerType, } from "@avaprotocol/types";
4
+ import { convertInputToProtobuf, extractInputFromProtobuf } from "../../utils";
4
5
  // Ref: https://github.com/AvaProtocol/EigenLayer-AVS/issues/94
5
6
  // The trigger is an array of Condition, which can be topics, dateRage, etc.
6
7
  // We imply or operator among all conditions.
@@ -88,6 +89,11 @@ class EventTrigger extends Trigger {
88
89
  });
89
90
  config.setQueriesList(queryMessages);
90
91
  trigger.setConfig(config);
92
+ // Convert input field to protobuf format and set on EventTrigger
93
+ const inputValue = convertInputToProtobuf(this.input);
94
+ if (inputValue) {
95
+ trigger.setInput(inputValue);
96
+ }
91
97
  request.setEvent(trigger);
92
98
  return request;
93
99
  }
@@ -95,6 +101,7 @@ class EventTrigger extends Trigger {
95
101
  // Convert the raw object to TriggerProps, which should keep name and id
96
102
  const obj = raw.toObject();
97
103
  let data = { queries: [] };
104
+ let input = undefined;
98
105
  if (raw.getEvent() && raw.getEvent().hasConfig()) {
99
106
  const config = raw.getEvent().getConfig();
100
107
  if (config) {
@@ -128,11 +135,16 @@ class EventTrigger extends Trigger {
128
135
  }
129
136
  data = { queries: queries };
130
137
  }
138
+ // Extract input data if present
139
+ if (raw.getEvent().hasInput()) {
140
+ input = extractInputFromProtobuf(raw.getEvent().getInput());
141
+ }
131
142
  }
132
143
  return new EventTrigger({
133
144
  ...obj,
134
145
  type: TriggerType.Event,
135
146
  data: data,
147
+ input: input,
136
148
  });
137
149
  }
138
150
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"fixedTime.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/fixedTime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAAyC,sBAAsB,EAAE,qBAAqB,EAA+B,MAAM,oBAAoB,CAAC;AAMvJ,cAAM,gBAAiB,SAAQ,OAAO;gBACxB,KAAK,EAAE,qBAAqB;IAIxC,SAAS,IAAI,MAAM,CAAC,WAAW;IAoB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,gBAAgB;IAuB9D;;;;OAIG;IACH,SAAS,IAAI,sBAAsB,GAAG,SAAS;IAI/C;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"fixedTime.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/fixedTime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAAyC,sBAAsB,EAAE,qBAAqB,EAA+B,MAAM,oBAAoB,CAAC;AAMvJ,cAAM,gBAAiB,SAAQ,OAAO;gBACxB,KAAK,EAAE,qBAAqB;IAIxC,SAAS,IAAI,MAAM,CAAC,WAAW;IA0B/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,gBAAgB;IA8B9D;;;;OAIG;IACH,SAAS,IAAI,sBAAsB,GAAG,SAAS;IAI/C;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,gBAAgB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import Trigger from "./interface";
3
3
  import { TriggerType } from "@avaprotocol/types";
4
+ import { convertInputToProtobuf, extractInputFromProtobuf } from "../../utils";
4
5
  // Required props for constructor: id, name, type and data: { epochsList }
5
6
  class FixedTimeTrigger extends Trigger {
6
7
  constructor(props) {
@@ -18,6 +19,11 @@ class FixedTimeTrigger extends Trigger {
18
19
  const config = new avs_pb.FixedTimeTrigger.Config();
19
20
  config.setEpochsList(this.data.epochsList || []);
20
21
  trigger.setConfig(config);
22
+ // Convert input field to protobuf format and set on FixedTimeTrigger
23
+ const inputValue = convertInputToProtobuf(this.input);
24
+ if (inputValue) {
25
+ trigger.setInput(inputValue);
26
+ }
21
27
  request.setFixedTime(trigger);
22
28
  return request;
23
29
  }
@@ -25,6 +31,7 @@ class FixedTimeTrigger extends Trigger {
25
31
  // Convert the raw object to TriggerProps, which should keep name and id
26
32
  const obj = raw.toObject();
27
33
  let data = { epochsList: [] };
34
+ let input = undefined;
28
35
  if (raw.getFixedTime() && raw.getFixedTime().hasConfig()) {
29
36
  const config = raw.getFixedTime().getConfig();
30
37
  if (config) {
@@ -32,11 +39,16 @@ class FixedTimeTrigger extends Trigger {
32
39
  epochsList: config.getEpochsList() || []
33
40
  };
34
41
  }
42
+ // Extract input data if present
43
+ if (raw.getFixedTime().hasInput()) {
44
+ input = extractInputFromProtobuf(raw.getFixedTime().getInput());
45
+ }
35
46
  }
36
47
  return new FixedTimeTrigger({
37
48
  ...obj,
38
49
  type: TriggerType.FixedTime,
39
50
  data: data,
51
+ input: input,
40
52
  });
41
53
  }
42
54
  /**
@@ -1,4 +1,3 @@
1
- import { extractInputFromProtobuf } from "../../utils";
2
1
  export default class Trigger {
3
2
  /**
4
3
  * Create an instance of Trigger from user inputs
@@ -10,7 +9,7 @@ export default class Trigger {
10
9
  this.type = props.type;
11
10
  this.data = props.data;
12
11
  this.output = props.output;
13
- this.input = props.input ? extractInputFromProtobuf(props.input) : undefined;
12
+ this.input = props.input;
14
13
  }
15
14
  toRequest() {
16
15
  throw new Error("Method not implemented.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avaprotocol/sdk-js",
3
- "version": "2.3.13",
3
+ "version": "2.3.14",
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",