@avaprotocol/sdk-js 2.6.8 → 2.6.10

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,19 @@
1
1
  # @avaprotocol/sdk-js
2
2
 
3
+ ## 2.6.10
4
+
5
+ ### Patch Changes
6
+
7
+ - c0afaa3: Fix BranchNode runNodeImmediately response format
8
+
9
+ ## 2.6.9
10
+
11
+ ### Patch Changes
12
+
13
+ - 83af57c: Updated MethodCallType type definitions
14
+ - Updated dependencies [83af57c]
15
+ - @avaprotocol/types@2.4.9
16
+
3
17
  ## 2.6.8
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -16026,7 +16026,9 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
16026
16026
  }
16027
16027
  const abiValueList = queryData.contractAbi.map((item) => {
16028
16028
  const value = new google_protobuf_struct_pb.Value();
16029
- value.setStructValue(google_protobuf_struct_pb.Struct.fromJavaScript(item));
16029
+ value.setStructValue(
16030
+ google_protobuf_struct_pb.Struct.fromJavaScript(item)
16031
+ );
16030
16032
  return value;
16031
16033
  });
16032
16034
  query.setContractAbiList(abiValueList);
@@ -16047,7 +16049,10 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
16047
16049
  (methodCallData) => {
16048
16050
  const methodCall = new avs_pb4.EventTrigger.MethodCall();
16049
16051
  methodCall.setMethodName(methodCallData.methodName);
16050
- methodCall.setCallData(methodCallData.callData);
16052
+ methodCall.setMethodParamsList(methodCallData.methodParams);
16053
+ if (methodCallData.callData) {
16054
+ methodCall.setCallData(methodCallData.callData);
16055
+ }
16051
16056
  if (methodCallData.applyToFields && methodCallData.applyToFields.length > 0) {
16052
16057
  methodCall.setApplyToFieldsList(methodCallData.applyToFields);
16053
16058
  }
@@ -16646,7 +16651,14 @@ var GraphQLQueryNode2 = class _GraphQLQueryNode extends Node {
16646
16651
  }
16647
16652
  static fromOutputData(outputData) {
16648
16653
  const graphqlOutput = outputData.getGraphql();
16649
- return graphqlOutput?.toObject() || null;
16654
+ if (!graphqlOutput) {
16655
+ return null;
16656
+ }
16657
+ const rawData = graphqlOutput.getData();
16658
+ if (rawData) {
16659
+ return convertProtobufValueToJs(rawData);
16660
+ }
16661
+ return null;
16650
16662
  }
16651
16663
  };
16652
16664
  var graphqlQuery_default = GraphQLQueryNode2;
@@ -16742,25 +16754,23 @@ var ContractReadNode2 = class _ContractReadNode extends Node {
16742
16754
  config.setContractAddress(configData.contractAddress);
16743
16755
  const abiValueList = configData.contractAbi.map((item) => {
16744
16756
  const value = new google_protobuf_struct_pb3.Value();
16745
- value.setStructValue(google_protobuf_struct_pb3.Struct.fromJavaScript(item));
16757
+ value.setStructValue(
16758
+ google_protobuf_struct_pb3.Struct.fromJavaScript(item)
16759
+ );
16746
16760
  return value;
16747
16761
  });
16748
16762
  config.setContractAbiList(abiValueList);
16749
16763
  const methodCalls = configData.methodCalls || [];
16750
16764
  methodCalls.forEach((methodCall) => {
16751
16765
  const methodCallMsg = new avs_pb13.ContractReadNode.MethodCall();
16766
+ methodCallMsg.setMethodName(methodCall.methodName);
16767
+ methodCallMsg.setMethodParamsList(methodCall.methodParams);
16752
16768
  if (methodCall.callData) {
16753
16769
  methodCallMsg.setCallData(methodCall.callData);
16754
16770
  }
16755
- if (methodCall.methodName) {
16756
- methodCallMsg.setMethodName(methodCall.methodName);
16757
- }
16758
16771
  if (methodCall.applyToFields) {
16759
16772
  methodCallMsg.setApplyToFieldsList(methodCall.applyToFields);
16760
16773
  }
16761
- if (methodCall.methodParams) {
16762
- methodCallMsg.setMethodParamsList(methodCall.methodParams);
16763
- }
16764
16774
  config.addMethodCalls(methodCallMsg);
16765
16775
  });
16766
16776
  node.setConfig(config);
@@ -16773,9 +16783,7 @@ var ContractReadNode2 = class _ContractReadNode extends Node {
16773
16783
  const protobufData = config.toObject();
16774
16784
  const data = {
16775
16785
  contractAddress: protobufData.contractAddress,
16776
- contractAbi: config.getContractAbiList().map(
16777
- (value) => convertProtobufValueToJs(value)
16778
- ),
16786
+ contractAbi: config.getContractAbiList().map((value) => convertProtobufValueToJs(value)),
16779
16787
  methodCalls: protobufData.methodCallsList?.map((call) => ({
16780
16788
  methodName: call.methodName,
16781
16789
  applyToFields: call.applyToFieldsList || [],
@@ -16851,7 +16859,14 @@ var ETHTransferNode2 = class _ETHTransferNode extends Node {
16851
16859
  }
16852
16860
  static fromOutputData(outputData) {
16853
16861
  const ethTransferOutput = outputData.getEthTransfer();
16854
- return ethTransferOutput?.toObject() || null;
16862
+ if (!ethTransferOutput) {
16863
+ return null;
16864
+ }
16865
+ const rawData = ethTransferOutput.getData();
16866
+ if (rawData) {
16867
+ return convertProtobufValueToJs(rawData);
16868
+ }
16869
+ return null;
16855
16870
  }
16856
16871
  };
16857
16872
  var ethTransfer_default = ETHTransferNode2;
@@ -16903,7 +16918,14 @@ var BranchNode2 = class _BranchNode extends Node {
16903
16918
  }
16904
16919
  static fromOutputData(outputData) {
16905
16920
  const branchOutput = outputData.getBranch();
16906
- return branchOutput?.toObject() || null;
16921
+ if (!branchOutput) {
16922
+ return null;
16923
+ }
16924
+ const rawData = branchOutput.getData();
16925
+ if (rawData) {
16926
+ return convertProtobufValueToJs(rawData);
16927
+ }
16928
+ return null;
16907
16929
  }
16908
16930
  // TODO: do we need a getConditionId() to avoid exporting BranchNodeData?
16909
16931
  };
@@ -17153,11 +17175,11 @@ var LoopNode2 = class _LoopNode extends Node {
17153
17175
  }
17154
17176
  const customCodeOutput = outputData.getCustomCode();
17155
17177
  if (customCodeOutput) {
17156
- const result = customCodeOutput.toObject();
17157
- if (result && typeof result === "object" && Object.keys(result).length === 1 && "data" in result) {
17158
- return result.data;
17178
+ const rawData = customCodeOutput.getData();
17179
+ if (rawData) {
17180
+ return convertProtobufValueToJs(rawData);
17159
17181
  }
17160
- return result;
17182
+ return null;
17161
17183
  }
17162
17184
  return null;
17163
17185
  }
package/dist/index.mjs CHANGED
@@ -16006,7 +16006,9 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
16006
16006
  }
16007
16007
  const abiValueList = queryData.contractAbi.map((item) => {
16008
16008
  const value = new google_protobuf_struct_pb.Value();
16009
- value.setStructValue(google_protobuf_struct_pb.Struct.fromJavaScript(item));
16009
+ value.setStructValue(
16010
+ google_protobuf_struct_pb.Struct.fromJavaScript(item)
16011
+ );
16010
16012
  return value;
16011
16013
  });
16012
16014
  query.setContractAbiList(abiValueList);
@@ -16027,7 +16029,10 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
16027
16029
  (methodCallData) => {
16028
16030
  const methodCall = new avs_pb4.EventTrigger.MethodCall();
16029
16031
  methodCall.setMethodName(methodCallData.methodName);
16030
- methodCall.setCallData(methodCallData.callData);
16032
+ methodCall.setMethodParamsList(methodCallData.methodParams);
16033
+ if (methodCallData.callData) {
16034
+ methodCall.setCallData(methodCallData.callData);
16035
+ }
16031
16036
  if (methodCallData.applyToFields && methodCallData.applyToFields.length > 0) {
16032
16037
  methodCall.setApplyToFieldsList(methodCallData.applyToFields);
16033
16038
  }
@@ -16638,7 +16643,14 @@ var GraphQLQueryNode2 = class _GraphQLQueryNode extends Node {
16638
16643
  }
16639
16644
  static fromOutputData(outputData) {
16640
16645
  const graphqlOutput = outputData.getGraphql();
16641
- return graphqlOutput?.toObject() || null;
16646
+ if (!graphqlOutput) {
16647
+ return null;
16648
+ }
16649
+ const rawData = graphqlOutput.getData();
16650
+ if (rawData) {
16651
+ return convertProtobufValueToJs(rawData);
16652
+ }
16653
+ return null;
16642
16654
  }
16643
16655
  };
16644
16656
  var graphqlQuery_default = GraphQLQueryNode2;
@@ -16738,25 +16750,23 @@ var ContractReadNode2 = class _ContractReadNode extends Node {
16738
16750
  config.setContractAddress(configData.contractAddress);
16739
16751
  const abiValueList = configData.contractAbi.map((item) => {
16740
16752
  const value = new google_protobuf_struct_pb3.Value();
16741
- value.setStructValue(google_protobuf_struct_pb3.Struct.fromJavaScript(item));
16753
+ value.setStructValue(
16754
+ google_protobuf_struct_pb3.Struct.fromJavaScript(item)
16755
+ );
16742
16756
  return value;
16743
16757
  });
16744
16758
  config.setContractAbiList(abiValueList);
16745
16759
  const methodCalls = configData.methodCalls || [];
16746
16760
  methodCalls.forEach((methodCall) => {
16747
16761
  const methodCallMsg = new avs_pb13.ContractReadNode.MethodCall();
16762
+ methodCallMsg.setMethodName(methodCall.methodName);
16763
+ methodCallMsg.setMethodParamsList(methodCall.methodParams);
16748
16764
  if (methodCall.callData) {
16749
16765
  methodCallMsg.setCallData(methodCall.callData);
16750
16766
  }
16751
- if (methodCall.methodName) {
16752
- methodCallMsg.setMethodName(methodCall.methodName);
16753
- }
16754
16767
  if (methodCall.applyToFields) {
16755
16768
  methodCallMsg.setApplyToFieldsList(methodCall.applyToFields);
16756
16769
  }
16757
- if (methodCall.methodParams) {
16758
- methodCallMsg.setMethodParamsList(methodCall.methodParams);
16759
- }
16760
16770
  config.addMethodCalls(methodCallMsg);
16761
16771
  });
16762
16772
  node.setConfig(config);
@@ -16769,9 +16779,7 @@ var ContractReadNode2 = class _ContractReadNode extends Node {
16769
16779
  const protobufData = config.toObject();
16770
16780
  const data = {
16771
16781
  contractAddress: protobufData.contractAddress,
16772
- contractAbi: config.getContractAbiList().map(
16773
- (value) => convertProtobufValueToJs(value)
16774
- ),
16782
+ contractAbi: config.getContractAbiList().map((value) => convertProtobufValueToJs(value)),
16775
16783
  methodCalls: protobufData.methodCallsList?.map((call) => ({
16776
16784
  methodName: call.methodName,
16777
16785
  applyToFields: call.applyToFieldsList || [],
@@ -16849,7 +16857,14 @@ var ETHTransferNode2 = class _ETHTransferNode extends Node {
16849
16857
  }
16850
16858
  static fromOutputData(outputData) {
16851
16859
  const ethTransferOutput = outputData.getEthTransfer();
16852
- return ethTransferOutput?.toObject() || null;
16860
+ if (!ethTransferOutput) {
16861
+ return null;
16862
+ }
16863
+ const rawData = ethTransferOutput.getData();
16864
+ if (rawData) {
16865
+ return convertProtobufValueToJs(rawData);
16866
+ }
16867
+ return null;
16853
16868
  }
16854
16869
  };
16855
16870
  var ethTransfer_default = ETHTransferNode2;
@@ -16903,7 +16918,14 @@ var BranchNode2 = class _BranchNode extends Node {
16903
16918
  }
16904
16919
  static fromOutputData(outputData) {
16905
16920
  const branchOutput = outputData.getBranch();
16906
- return branchOutput?.toObject() || null;
16921
+ if (!branchOutput) {
16922
+ return null;
16923
+ }
16924
+ const rawData = branchOutput.getData();
16925
+ if (rawData) {
16926
+ return convertProtobufValueToJs(rawData);
16927
+ }
16928
+ return null;
16907
16929
  }
16908
16930
  // TODO: do we need a getConditionId() to avoid exporting BranchNodeData?
16909
16931
  };
@@ -17158,11 +17180,11 @@ var LoopNode2 = class _LoopNode extends Node {
17158
17180
  }
17159
17181
  const customCodeOutput = outputData.getCustomCode();
17160
17182
  if (customCodeOutput) {
17161
- const result = customCodeOutput.toObject();
17162
- if (result && typeof result === "object" && Object.keys(result).length === 1 && "data" in result) {
17163
- return result.data;
17183
+ const rawData = customCodeOutput.getData();
17184
+ if (rawData) {
17185
+ return convertProtobufValueToJs(rawData);
17164
17186
  }
17165
- return result;
17187
+ return null;
17166
17188
  }
17167
17189
  return null;
17168
17190
  }
@@ -1 +1 @@
1
- {"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../../src/models/node/branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAKhD,cAAM,UAAW,SAAQ,IAAI;gBACf,KAAK,EAAE,eAAe;IAIlC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,UAAU;IAsBrD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAiC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAMrE;AACD,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../../src/models/node/branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAKhD,cAAM,UAAW,SAAQ,IAAI;gBACf,KAAK,EAAE,eAAe;IAIlC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,UAAU;IAsBrD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAiC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAgBrE;AACD,eAAe,UAAU,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { NodeType, } from "@avaprotocol/types";
2
2
  import Node from "./interface";
3
3
  import * as avs_pb from "@/grpc_codegen/avs_pb";
4
+ import { convertProtobufValueToJs } from "../../utils";
4
5
  // Required props for constructor: id, name, type and data: { conditions }
5
6
  class BranchNode extends Node {
6
7
  constructor(props) {
@@ -47,7 +48,15 @@ class BranchNode extends Node {
47
48
  }
48
49
  static fromOutputData(outputData) {
49
50
  const branchOutput = outputData.getBranch();
50
- return branchOutput?.toObject() || null;
51
+ if (!branchOutput) {
52
+ return null;
53
+ }
54
+ // Use convertProtobufValueToJs to get clean JavaScript objects
55
+ const rawData = branchOutput.getData();
56
+ if (rawData) {
57
+ return convertProtobufValueToJs(rawData);
58
+ }
59
+ return null;
51
60
  }
52
61
  }
53
62
  export default BranchNode;
@@ -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;AAEhD,OAAO,EAEL,oBAAoB,EACpB,qBAAqB,EAEtB,MAAM,oBAAoB,CAAC;AAO5B,cAAM,gBAAiB,SAAQ,IAAI;gBACrB,KAAK,EAAE,qBAAqB;IAIxC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,oBAAoB,GAAG,MAAM,CAAC,gBAAgB;IAuCpF,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IA8B3D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAe5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,OAAO,GAAG,IAAI;CAUhF;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;AAEhD,OAAO,EAEL,oBAAoB,EACpB,qBAAqB,EAEtB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,gBAAiB,SAAQ,IAAI;gBACrB,KAAK,EAAE,qBAAqB;IAIxC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CACvB,UAAU,EAAE,oBAAoB,GAC/B,MAAM,CAAC,gBAAgB;IAuC1B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IA8B3D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAe5B,MAAM,CAAC,cAAc,CACnB,UAAU,EAAE,MAAM,CAAC,qBAAqB,GACvC,OAAO,GAAG,IAAI;CAUlB;AAED,eAAe,gBAAgB,CAAC"}
@@ -2,7 +2,7 @@ import Node from "./interface";
2
2
  import * as avs_pb from "@/grpc_codegen/avs_pb";
3
3
  import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb";
4
4
  import { NodeType, } from "@avaprotocol/types";
5
- import { convertProtobufValueToJs, } from "../../utils";
5
+ import { convertProtobufValueToJs } from "../../utils";
6
6
  // Required props for constructor: id, name, type and data
7
7
  class ContractReadNode extends Node {
8
8
  constructor(props) {
@@ -18,7 +18,7 @@ class ContractReadNode extends Node {
18
18
  const config = new avs_pb.ContractReadNode.Config();
19
19
  config.setContractAddress(configData.contractAddress);
20
20
  // Convert array to protobuf Value list
21
- const abiValueList = configData.contractAbi.map(item => {
21
+ const abiValueList = configData.contractAbi.map((item) => {
22
22
  const value = new google_protobuf_struct_pb.Value();
23
23
  value.setStructValue(google_protobuf_struct_pb.Struct.fromJavaScript(item));
24
24
  return value;
@@ -28,19 +28,16 @@ class ContractReadNode extends Node {
28
28
  const methodCalls = configData.methodCalls || [];
29
29
  methodCalls.forEach((methodCall) => {
30
30
  const methodCallMsg = new avs_pb.ContractReadNode.MethodCall();
31
- // Set callData only if provided (now optional)
31
+ methodCallMsg.setMethodName(methodCall.methodName);
32
+ methodCallMsg.setMethodParamsList(methodCall.methodParams);
33
+ // Optional: Set callData if provided
32
34
  if (methodCall.callData) {
33
35
  methodCallMsg.setCallData(methodCall.callData);
34
36
  }
35
- if (methodCall.methodName) {
36
- methodCallMsg.setMethodName(methodCall.methodName);
37
- }
37
+ // Optional: Set applyToFields if provided
38
38
  if (methodCall.applyToFields) {
39
39
  methodCallMsg.setApplyToFieldsList(methodCall.applyToFields);
40
40
  }
41
- if (methodCall.methodParams) {
42
- methodCallMsg.setMethodParamsList(methodCall.methodParams);
43
- }
44
41
  config.addMethodCalls(methodCallMsg);
45
42
  });
46
43
  node.setConfig(config);
@@ -55,7 +52,9 @@ class ContractReadNode extends Node {
55
52
  // Convert protobuf data to our custom interface
56
53
  const data = {
57
54
  contractAddress: protobufData.contractAddress,
58
- contractAbi: config.getContractAbiList().map(value => convertProtobufValueToJs(value)),
55
+ contractAbi: config
56
+ .getContractAbiList()
57
+ .map((value) => convertProtobufValueToJs(value)),
59
58
  methodCalls: protobufData.methodCallsList?.map((call) => ({
60
59
  methodName: call.methodName,
61
60
  applyToFields: call.applyToFieldsList || [],
@@ -1 +1 @@
1
- {"version":3,"file":"ethTransfer.d.ts","sourceRoot":"","sources":["../../../src/models/node/ethTransfer.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAGL,oBAAoB,EAErB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,eAAgB,SAAQ,IAAI;gBACpB,KAAK,EAAE,oBAAoB;IAIvC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE;QACpC,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,MAAM,CAAC,eAAe;IAW1B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,eAAe;IAgB1D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAe5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAIrE;AAED,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ethTransfer.d.ts","sourceRoot":"","sources":["../../../src/models/node/ethTransfer.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAGL,oBAAoB,EAErB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,eAAgB,SAAQ,IAAI;gBACpB,KAAK,EAAE,oBAAoB;IAIvC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE;QACpC,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,MAAM,CAAC,eAAe;IAW1B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,eAAe;IAgB1D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAe5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAcrE;AAED,eAAe,eAAe,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import Node from "./interface";
2
2
  import * as avs_pb from "@/grpc_codegen/avs_pb";
3
3
  import { NodeType, } from "@avaprotocol/types";
4
+ import { convertProtobufValueToJs } from "../../utils";
4
5
  // Required props for constructor: id, name, type and data: { destination, amount }
5
6
  class ETHTransferNode extends Node {
6
7
  constructor(props) {
@@ -42,7 +43,15 @@ class ETHTransferNode extends Node {
42
43
  }
43
44
  static fromOutputData(outputData) {
44
45
  const ethTransferOutput = outputData.getEthTransfer();
45
- return ethTransferOutput?.toObject() || null;
46
+ if (!ethTransferOutput) {
47
+ return null;
48
+ }
49
+ // Use convertProtobufValueToJs to get clean JavaScript objects
50
+ const rawData = ethTransferOutput.getData();
51
+ if (rawData) {
52
+ return convertProtobufValueToJs(rawData);
53
+ }
54
+ return null;
46
55
  }
47
56
  }
48
57
  export default ETHTransferNode;
@@ -1 +1 @@
1
- {"version":3,"file":"graphqlQuery.d.ts","sourceRoot":"","sources":["../../../src/models/node/graphqlQuery.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAGL,qBAAqB,EAEtB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,gBAAiB,SAAQ,IAAI;gBACrB,KAAK,EAAE,qBAAqB;IAQxC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE;QACpC,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;KACxC,GAAG,MAAM,CAAC,gBAAgB;IAkB3B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IAc3D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAe5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAIrE;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"graphqlQuery.d.ts","sourceRoot":"","sources":["../../../src/models/node/graphqlQuery.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAGL,qBAAqB,EAEtB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,gBAAiB,SAAQ,IAAI;gBACrB,KAAK,EAAE,qBAAqB;IAQxC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE;QACpC,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;KACxC,GAAG,MAAM,CAAC,gBAAgB;IAkB3B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IAc3D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAe5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAcrE;AAED,eAAe,gBAAgB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import Node from "./interface";
2
2
  import * as avs_pb from "@/grpc_codegen/avs_pb";
3
3
  import { NodeType, } from "@avaprotocol/types";
4
+ import { convertProtobufValueToJs } from "../../utils";
4
5
  // Required props for constructor: id, name, type and data: { url, query, variablesMap }
5
6
  class GraphQLQueryNode extends Node {
6
7
  constructor(props) {
@@ -51,7 +52,15 @@ class GraphQLQueryNode extends Node {
51
52
  }
52
53
  static fromOutputData(outputData) {
53
54
  const graphqlOutput = outputData.getGraphql();
54
- return graphqlOutput?.toObject() || null;
55
+ if (!graphqlOutput) {
56
+ return null;
57
+ }
58
+ // Use convertProtobufValueToJs to get clean JavaScript objects
59
+ const rawData = graphqlOutput.getData();
60
+ if (rawData) {
61
+ return convertProtobufValueToJs(rawData);
62
+ }
63
+ return null;
55
64
  }
56
65
  }
57
66
  export default GraphQLQueryNode;
@@ -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;AAO/B,OAAO,EAGL,aAAa,EAId,MAAM,oBAAoB,CAAC;AAG5B,cAAM,QAAS,SAAQ,IAAI;gBACb,KAAK,EAAE,aAAa;IAIhC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,QAAQ;IA8BnD,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAsBxC,OAAO,CAAC,MAAM,CAAC,4BAA4B;IAe3C,OAAO,CAAC,0BAA0B;IA4BlC,SAAS,IAAI,MAAM,CAAC,QAAQ;IA8B5B,OAAO,CAAC,mBAAmB;IA+G3B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,OAAO;CAwCzE;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;AAO/B,OAAO,EAGL,aAAa,EAId,MAAM,oBAAoB,CAAC;AAG5B,cAAM,QAAS,SAAQ,IAAI;gBACb,KAAK,EAAE,aAAa;IAIhC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,QAAQ;IA8BnD,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAsBxC,OAAO,CAAC,MAAM,CAAC,4BAA4B;IAe3C,OAAO,CAAC,0BAA0B;IA4BlC,SAAS,IAAI,MAAM,CAAC,QAAQ;IA8B5B,OAAO,CAAC,mBAAmB;IA+G3B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,OAAO;CAkCzE;AAED,eAAe,QAAQ,CAAC"}
@@ -213,15 +213,12 @@ class LoopNode extends Node {
213
213
  // Fallback: For immediate execution, data might come as CustomCode format
214
214
  const customCodeOutput = outputData.getCustomCode();
215
215
  if (customCodeOutput) {
216
- const result = customCodeOutput.toObject();
217
- // Handle nested data structure
218
- if (result &&
219
- typeof result === "object" &&
220
- Object.keys(result).length === 1 &&
221
- "data" in result) {
222
- return result.data;
216
+ // Use convertProtobufValueToJs to get clean JavaScript objects
217
+ const rawData = customCodeOutput.getData();
218
+ if (rawData) {
219
+ return convertProtobufValueToJs(rawData);
223
220
  }
224
- return result;
221
+ return null;
225
222
  }
226
223
  return null;
227
224
  }
@@ -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;AAkD5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IA6G/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;CA0B9D;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;AAEhD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAIlB,MAAM,oBAAoB,CAAC;AA8C5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAsH/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAoF1D;;;;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"}
@@ -2,7 +2,7 @@ import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb";
3
3
  import Trigger from "./interface";
4
4
  import { TriggerType, } from "@avaprotocol/types";
5
- import { convertProtobufValueToJs, } from "../../utils";
5
+ import { convertProtobufValueToJs } from "../../utils";
6
6
  // Ref: https://github.com/AvaProtocol/EigenLayer-AVS/issues/94
7
7
  // The trigger is an array of Condition, which can be topics, dateRage, etc.
8
8
  // We imply or operator among all conditions.
@@ -90,10 +90,10 @@ class EventTrigger extends Trigger {
90
90
  if (queryData.contractAbi) {
91
91
  // Strictly require array format (no string support)
92
92
  if (!Array.isArray(queryData.contractAbi)) {
93
- throw new Error('contractAbi must be an array of ABI elements');
93
+ throw new Error("contractAbi must be an array of ABI elements");
94
94
  }
95
95
  // Convert array to protobuf Value list
96
- const abiValueList = queryData.contractAbi.map(item => {
96
+ const abiValueList = queryData.contractAbi.map((item) => {
97
97
  const value = new google_protobuf_struct_pb.Value();
98
98
  value.setStructValue(google_protobuf_struct_pb.Struct.fromJavaScript(item));
99
99
  return value;
@@ -117,7 +117,12 @@ class EventTrigger extends Trigger {
117
117
  const methodCallMessages = queryData.methodCalls.map((methodCallData) => {
118
118
  const methodCall = new avs_pb.EventTrigger.MethodCall();
119
119
  methodCall.setMethodName(methodCallData.methodName);
120
- methodCall.setCallData(methodCallData.callData);
120
+ methodCall.setMethodParamsList(methodCallData.methodParams);
121
+ // Optional: Set callData if provided
122
+ if (methodCallData.callData) {
123
+ methodCall.setCallData(methodCallData.callData);
124
+ }
125
+ // Optional: Set applyToFields if provided
121
126
  if (methodCallData.applyToFields &&
122
127
  methodCallData.applyToFields.length > 0) {
123
128
  methodCall.setApplyToFieldsList(methodCallData.applyToFields);
@@ -169,7 +174,7 @@ class EventTrigger extends Trigger {
169
174
  // Extract contractAbi
170
175
  const contractAbi = query.getContractAbiList();
171
176
  if (contractAbi && contractAbi.length > 0) {
172
- queryData.contractAbi = contractAbi.map(value => convertProtobufValueToJs(value));
177
+ queryData.contractAbi = contractAbi.map((value) => convertProtobufValueToJs(value));
173
178
  }
174
179
  // Extract conditions
175
180
  const conditions = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avaprotocol/sdk-js",
3
- "version": "2.6.8",
3
+ "version": "2.6.10",
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.4.8",
34
+ "@avaprotocol/types": "^2.4.9",
35
35
  "@grpc/grpc-js": "^1.11.3",
36
36
  "@grpc/proto-loader": "^0.7.13",
37
37
  "dotenv": "^16.4.5",