@avaprotocol/sdk-js 2.6.10 → 2.6.11

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.6.11
4
+
5
+ ### Patch Changes
6
+
7
+ - 9261ba8: Update response of ContractWriteNode to fix metadata
8
+
3
9
  ## 2.6.10
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -3723,7 +3723,8 @@ var require_avs_pb = __commonJS({
3723
3723
  };
3724
3724
  proto.aggregator.ContractWriteNode.Output.toObject = function(includeInstance, msg) {
3725
3725
  var f, obj = {
3726
- data: (f = msg.getData()) && google_protobuf_struct_pb5.Value.toObject(includeInstance, f)
3726
+ data: (f = msg.getData()) && google_protobuf_struct_pb5.Value.toObject(includeInstance, f),
3727
+ metadata: (f = msg.getMetadata()) && google_protobuf_struct_pb5.Value.toObject(includeInstance, f)
3727
3728
  };
3728
3729
  if (includeInstance) {
3729
3730
  obj.$jspbMessageInstance = msg;
@@ -3748,6 +3749,11 @@ var require_avs_pb = __commonJS({
3748
3749
  reader.readMessage(value, google_protobuf_struct_pb5.Value.deserializeBinaryFromReader);
3749
3750
  msg.setData(value);
3750
3751
  break;
3752
+ case 2:
3753
+ var value = new google_protobuf_struct_pb5.Value();
3754
+ reader.readMessage(value, google_protobuf_struct_pb5.Value.deserializeBinaryFromReader);
3755
+ msg.setMetadata(value);
3756
+ break;
3751
3757
  default:
3752
3758
  reader.skipField();
3753
3759
  break;
@@ -3770,6 +3776,14 @@ var require_avs_pb = __commonJS({
3770
3776
  google_protobuf_struct_pb5.Value.serializeBinaryToWriter
3771
3777
  );
3772
3778
  }
3779
+ f = message.getMetadata();
3780
+ if (f != null) {
3781
+ writer.writeMessage(
3782
+ 2,
3783
+ f,
3784
+ google_protobuf_struct_pb5.Value.serializeBinaryToWriter
3785
+ );
3786
+ }
3773
3787
  };
3774
3788
  proto.aggregator.ContractWriteNode.Output.prototype.getData = function() {
3775
3789
  return (
@@ -3786,6 +3800,21 @@ var require_avs_pb = __commonJS({
3786
3800
  proto.aggregator.ContractWriteNode.Output.prototype.hasData = function() {
3787
3801
  return jspb.Message.getField(this, 1) != null;
3788
3802
  };
3803
+ proto.aggregator.ContractWriteNode.Output.prototype.getMetadata = function() {
3804
+ return (
3805
+ /** @type{?proto.google.protobuf.Value} */
3806
+ jspb.Message.getWrapperField(this, google_protobuf_struct_pb5.Value, 2)
3807
+ );
3808
+ };
3809
+ proto.aggregator.ContractWriteNode.Output.prototype.setMetadata = function(value) {
3810
+ return jspb.Message.setWrapperField(this, 2, value);
3811
+ };
3812
+ proto.aggregator.ContractWriteNode.Output.prototype.clearMetadata = function() {
3813
+ return this.setMetadata(void 0);
3814
+ };
3815
+ proto.aggregator.ContractWriteNode.Output.prototype.hasMetadata = function() {
3816
+ return jspb.Message.getField(this, 2) != null;
3817
+ };
3789
3818
  if (jspb.Message.GENERATE_TO_OBJECT) {
3790
3819
  proto.aggregator.ContractWriteNode.MethodResult.prototype.toObject = function(opt_includeInstance) {
3791
3820
  return proto.aggregator.ContractWriteNode.MethodResult.toObject(opt_includeInstance, this);
@@ -16512,34 +16541,8 @@ var ContractWriteNode2 = class _ContractWriteNode extends Node {
16512
16541
  static fromOutputData(outputData) {
16513
16542
  const contractWriteOutput = outputData.getContractWrite();
16514
16543
  if (!contractWriteOutput) return null;
16515
- const data = contractWriteOutput.getData();
16516
- if (!data) return null;
16517
- const jsData = convertProtobufValueToJs(data);
16518
- if (Array.isArray(jsData)) {
16519
- return jsData.map((result) => {
16520
- const methodName = result.method_name || result.methodName;
16521
- return {
16522
- methodName,
16523
- methodABI: result.method_abi || null,
16524
- success: result.success,
16525
- error: result.error || "",
16526
- value: result.value,
16527
- receipt: result.receipt || null
16528
- // Add receipt field
16529
- };
16530
- });
16531
- } else {
16532
- const methodName = jsData.method_name || jsData.methodName;
16533
- return [{
16534
- methodName,
16535
- methodABI: jsData.method_abi || null,
16536
- success: jsData.success,
16537
- error: jsData.error || "",
16538
- value: jsData.value,
16539
- receipt: jsData.receipt || null
16540
- // Add receipt field
16541
- }];
16542
- }
16544
+ const dataValue = contractWriteOutput.getData();
16545
+ return dataValue ? convertProtobufValueToJs(dataValue) : {};
16543
16546
  }
16544
16547
  };
16545
16548
  var contractWrite_default = ContractWriteNode2;
package/dist/index.mjs CHANGED
@@ -3723,7 +3723,8 @@ var require_avs_pb = __commonJS({
3723
3723
  };
3724
3724
  proto.aggregator.ContractWriteNode.Output.toObject = function(includeInstance, msg) {
3725
3725
  var f, obj = {
3726
- data: (f = msg.getData()) && google_protobuf_struct_pb5.Value.toObject(includeInstance, f)
3726
+ data: (f = msg.getData()) && google_protobuf_struct_pb5.Value.toObject(includeInstance, f),
3727
+ metadata: (f = msg.getMetadata()) && google_protobuf_struct_pb5.Value.toObject(includeInstance, f)
3727
3728
  };
3728
3729
  if (includeInstance) {
3729
3730
  obj.$jspbMessageInstance = msg;
@@ -3748,6 +3749,11 @@ var require_avs_pb = __commonJS({
3748
3749
  reader.readMessage(value, google_protobuf_struct_pb5.Value.deserializeBinaryFromReader);
3749
3750
  msg.setData(value);
3750
3751
  break;
3752
+ case 2:
3753
+ var value = new google_protobuf_struct_pb5.Value();
3754
+ reader.readMessage(value, google_protobuf_struct_pb5.Value.deserializeBinaryFromReader);
3755
+ msg.setMetadata(value);
3756
+ break;
3751
3757
  default:
3752
3758
  reader.skipField();
3753
3759
  break;
@@ -3770,6 +3776,14 @@ var require_avs_pb = __commonJS({
3770
3776
  google_protobuf_struct_pb5.Value.serializeBinaryToWriter
3771
3777
  );
3772
3778
  }
3779
+ f = message.getMetadata();
3780
+ if (f != null) {
3781
+ writer.writeMessage(
3782
+ 2,
3783
+ f,
3784
+ google_protobuf_struct_pb5.Value.serializeBinaryToWriter
3785
+ );
3786
+ }
3773
3787
  };
3774
3788
  proto.aggregator.ContractWriteNode.Output.prototype.getData = function() {
3775
3789
  return (
@@ -3786,6 +3800,21 @@ var require_avs_pb = __commonJS({
3786
3800
  proto.aggregator.ContractWriteNode.Output.prototype.hasData = function() {
3787
3801
  return jspb.Message.getField(this, 1) != null;
3788
3802
  };
3803
+ proto.aggregator.ContractWriteNode.Output.prototype.getMetadata = function() {
3804
+ return (
3805
+ /** @type{?proto.google.protobuf.Value} */
3806
+ jspb.Message.getWrapperField(this, google_protobuf_struct_pb5.Value, 2)
3807
+ );
3808
+ };
3809
+ proto.aggregator.ContractWriteNode.Output.prototype.setMetadata = function(value) {
3810
+ return jspb.Message.setWrapperField(this, 2, value);
3811
+ };
3812
+ proto.aggregator.ContractWriteNode.Output.prototype.clearMetadata = function() {
3813
+ return this.setMetadata(void 0);
3814
+ };
3815
+ proto.aggregator.ContractWriteNode.Output.prototype.hasMetadata = function() {
3816
+ return jspb.Message.getField(this, 2) != null;
3817
+ };
3789
3818
  if (jspb.Message.GENERATE_TO_OBJECT) {
3790
3819
  proto.aggregator.ContractWriteNode.MethodResult.prototype.toObject = function(opt_includeInstance) {
3791
3820
  return proto.aggregator.ContractWriteNode.MethodResult.toObject(opt_includeInstance, this);
@@ -16500,34 +16529,8 @@ var ContractWriteNode2 = class _ContractWriteNode extends Node {
16500
16529
  static fromOutputData(outputData) {
16501
16530
  const contractWriteOutput = outputData.getContractWrite();
16502
16531
  if (!contractWriteOutput) return null;
16503
- const data = contractWriteOutput.getData();
16504
- if (!data) return null;
16505
- const jsData = convertProtobufValueToJs(data);
16506
- if (Array.isArray(jsData)) {
16507
- return jsData.map((result) => {
16508
- const methodName = result.method_name || result.methodName;
16509
- return {
16510
- methodName,
16511
- methodABI: result.method_abi || null,
16512
- success: result.success,
16513
- error: result.error || "",
16514
- value: result.value,
16515
- receipt: result.receipt || null
16516
- // Add receipt field
16517
- };
16518
- });
16519
- } else {
16520
- const methodName = jsData.method_name || jsData.methodName;
16521
- return [{
16522
- methodName,
16523
- methodABI: jsData.method_abi || null,
16524
- success: jsData.success,
16525
- error: jsData.error || "",
16526
- value: jsData.value,
16527
- receipt: jsData.receipt || null
16528
- // Add receipt field
16529
- }];
16530
- }
16532
+ const dataValue = contractWriteOutput.getData();
16533
+ return dataValue ? convertProtobufValueToJs(dataValue) : {};
16531
16534
  }
16532
16535
  };
16533
16536
  var contractWrite_default = ContractWriteNode2;
@@ -0,0 +1,17 @@
1
+ import Node from "./interface";
2
+ import * as avs_pb from "@/grpc_codegen/avs_pb";
3
+ import { ContractWriteNodeData, ContractWriteNodeProps } from "@avaprotocol/types";
4
+ declare class ContractWriteNode extends Node {
5
+ constructor(props: ContractWriteNodeProps);
6
+ /**
7
+ * Create a protobuf ContractWriteNode from config data
8
+ * @param configData - The configuration data for the contract write node
9
+ * @returns Configured avs_pb.ContractWriteNode
10
+ */
11
+ static createProtobufNode(configData: ContractWriteNodeData): avs_pb.ContractWriteNode;
12
+ static fromResponse(raw: avs_pb.TaskNode): ContractWriteNode;
13
+ toRequest(): avs_pb.TaskNode;
14
+ static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): any;
15
+ }
16
+ export default ContractWriteNode;
17
+ //# sourceMappingURL=contractWrite.d.ts.map
@@ -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;AAEhD,OAAO,EAEL,qBAAqB,EACrB,sBAAsB,EAEvB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,iBAAkB,SAAQ,IAAI;gBACtB,KAAK,EAAE,sBAAsB;IAIzC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,qBAAqB,GAAG,MAAM,CAAC,iBAAiB;IAuCtF,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,iBAAiB;IA8B5D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAe5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,OAAO,EAAE,GAAG,IAAI;CAuClF;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;AAEhD,OAAO,EAEL,qBAAqB,EACrB,sBAAsB,EAEvB,MAAM,oBAAoB,CAAC;AAK5B,cAAM,iBAAkB,SAAQ,IAAI;gBACtB,KAAK,EAAE,sBAAsB;IAIzC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,qBAAqB,GAAG,MAAM,CAAC,iBAAiB;IAuCtF,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,iBAAiB;IA8B5D,SAAS,IAAI,MAAM,CAAC,QAAQ;IAe5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,GAAG;CAWrE;AAED,eAAe,iBAAiB,CAAC"}
@@ -81,39 +81,11 @@ class ContractWriteNode extends Node {
81
81
  const contractWriteOutput = outputData.getContractWrite();
82
82
  if (!contractWriteOutput)
83
83
  return null;
84
- // Use the new getData() method instead of the old resultsList
85
- const data = contractWriteOutput.getData();
86
- if (!data)
87
- return null;
88
- // Convert protobuf Value to JavaScript object
89
- const jsData = convertProtobufValueToJs(data);
90
- // Format response for consistency with ContractRead
91
- if (Array.isArray(jsData)) {
92
- return jsData.map((result) => {
93
- // ContractWrite already uses the consistent format with method_abi and value
94
- const methodName = result.method_name || result.methodName;
95
- return {
96
- methodName: methodName,
97
- methodABI: result.method_abi || null,
98
- success: result.success,
99
- error: result.error || "",
100
- value: result.value,
101
- receipt: result.receipt || null, // Add receipt field
102
- };
103
- });
104
- }
105
- else {
106
- // Single result - wrap in array for consistency
107
- const methodName = jsData.method_name || jsData.methodName;
108
- return [{
109
- methodName: methodName,
110
- methodABI: jsData.method_abi || null,
111
- success: jsData.success,
112
- error: jsData.error || "",
113
- value: jsData.value,
114
- receipt: jsData.receipt || null, // Add receipt field
115
- }];
116
- }
84
+ // NEW: Only return the data part (decoded events, like ContractRead)
85
+ // The metadata is handled at the protobuf response level by the client
86
+ const dataValue = contractWriteOutput.getData();
87
+ // Convert protobuf Value to JavaScript object (flattened decoded event data)
88
+ return dataValue ? convertProtobufValueToJs(dataValue) : {};
117
89
  }
118
90
  }
119
91
  export default ContractWriteNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avaprotocol/sdk-js",
3
- "version": "2.6.10",
3
+ "version": "2.6.11",
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",