@avaprotocol/sdk-js 2.3.16 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/index.js +237 -21
- package/dist/index.mjs +237 -21
- package/dist/models/node/contractWrite.js +1 -1
- package/dist/models/trigger/event.d.ts.map +1 -1
- package/dist/models/trigger/event.js +39 -1
- package/dist/models/workflow.d.ts.map +1 -1
- package/dist/models/workflow.js +2 -19
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @avaprotocol/sdk-js
|
|
2
2
|
|
|
3
|
+
## 2.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 60181d0: Added EventCondition, and unified contractAbi to string type
|
|
8
|
+
|
|
9
|
+
## 2.3.17
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 0dfcf69: Added EventCondition, and unified contractAbi to string type
|
|
14
|
+
- Updated dependencies [0dfcf69]
|
|
15
|
+
- @avaprotocol/types@2.2.13
|
|
16
|
+
|
|
17
|
+
## 2.3.16
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 27551e0: Added EventCondition to EventTrigger
|
|
22
|
+
- Updated dependencies [27551e0]
|
|
23
|
+
- @avaprotocol/types@2.2.12
|
|
24
|
+
|
|
3
25
|
## 2.3.15
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -93,6 +93,7 @@ var require_avs_pb = __commonJS({
|
|
|
93
93
|
goog.exportSymbol("proto.aggregator.ETHTransferNode.Config", null, global);
|
|
94
94
|
goog.exportSymbol("proto.aggregator.ETHTransferNode.Output", null, global);
|
|
95
95
|
goog.exportSymbol("proto.aggregator.Error", null, global);
|
|
96
|
+
goog.exportSymbol("proto.aggregator.EventCondition", null, global);
|
|
96
97
|
goog.exportSymbol("proto.aggregator.EventTrigger", null, global);
|
|
97
98
|
goog.exportSymbol("proto.aggregator.EventTrigger.Config", null, global);
|
|
98
99
|
goog.exportSymbol("proto.aggregator.EventTrigger.Output", null, global);
|
|
@@ -935,6 +936,13 @@ var require_avs_pb = __commonJS({
|
|
|
935
936
|
if (goog.DEBUG && !COMPILED) {
|
|
936
937
|
proto.aggregator.SimulateTaskReq.displayName = "proto.aggregator.SimulateTaskReq";
|
|
937
938
|
}
|
|
939
|
+
proto.aggregator.EventCondition = function(opt_data) {
|
|
940
|
+
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
|
941
|
+
};
|
|
942
|
+
goog.inherits(proto.aggregator.EventCondition, jspb.Message);
|
|
943
|
+
if (goog.DEBUG && !COMPILED) {
|
|
944
|
+
proto.aggregator.EventCondition.displayName = "proto.aggregator.EventCondition";
|
|
945
|
+
}
|
|
938
946
|
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
939
947
|
proto.aggregator.TokenMetadata.prototype.toObject = function(opt_includeInstance) {
|
|
940
948
|
return proto.aggregator.TokenMetadata.toObject(opt_includeInstance, this);
|
|
@@ -2270,7 +2278,7 @@ var require_avs_pb = __commonJS({
|
|
|
2270
2278
|
);
|
|
2271
2279
|
}
|
|
2272
2280
|
};
|
|
2273
|
-
proto.aggregator.EventTrigger.Query.repeatedFields_ = [1, 2];
|
|
2281
|
+
proto.aggregator.EventTrigger.Query.repeatedFields_ = [1, 2, 5];
|
|
2274
2282
|
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
2275
2283
|
proto.aggregator.EventTrigger.Query.prototype.toObject = function(opt_includeInstance) {
|
|
2276
2284
|
return proto.aggregator.EventTrigger.Query.toObject(opt_includeInstance, this);
|
|
@@ -2283,7 +2291,13 @@ var require_avs_pb = __commonJS({
|
|
|
2283
2291
|
proto.aggregator.EventTrigger.Topics.toObject,
|
|
2284
2292
|
includeInstance
|
|
2285
2293
|
),
|
|
2286
|
-
maxEventsPerBlock: jspb.Message.getFieldWithDefault(msg, 3, 0)
|
|
2294
|
+
maxEventsPerBlock: jspb.Message.getFieldWithDefault(msg, 3, 0),
|
|
2295
|
+
contractAbi: jspb.Message.getFieldWithDefault(msg, 4, ""),
|
|
2296
|
+
conditionsList: jspb.Message.toObjectList(
|
|
2297
|
+
msg.getConditionsList(),
|
|
2298
|
+
proto.aggregator.EventCondition.toObject,
|
|
2299
|
+
includeInstance
|
|
2300
|
+
)
|
|
2287
2301
|
};
|
|
2288
2302
|
if (includeInstance) {
|
|
2289
2303
|
obj.$jspbMessageInstance = msg;
|
|
@@ -2322,6 +2336,18 @@ var require_avs_pb = __commonJS({
|
|
|
2322
2336
|
);
|
|
2323
2337
|
msg.setMaxEventsPerBlock(value);
|
|
2324
2338
|
break;
|
|
2339
|
+
case 4:
|
|
2340
|
+
var value = (
|
|
2341
|
+
/** @type {string} */
|
|
2342
|
+
reader.readString()
|
|
2343
|
+
);
|
|
2344
|
+
msg.setContractAbi(value);
|
|
2345
|
+
break;
|
|
2346
|
+
case 5:
|
|
2347
|
+
var value = new proto.aggregator.EventCondition();
|
|
2348
|
+
reader.readMessage(value, proto.aggregator.EventCondition.deserializeBinaryFromReader);
|
|
2349
|
+
msg.addConditions(value);
|
|
2350
|
+
break;
|
|
2325
2351
|
default:
|
|
2326
2352
|
reader.skipField();
|
|
2327
2353
|
break;
|
|
@@ -2359,6 +2385,21 @@ var require_avs_pb = __commonJS({
|
|
|
2359
2385
|
f
|
|
2360
2386
|
);
|
|
2361
2387
|
}
|
|
2388
|
+
f = message.getContractAbi();
|
|
2389
|
+
if (f.length > 0) {
|
|
2390
|
+
writer.writeString(
|
|
2391
|
+
4,
|
|
2392
|
+
f
|
|
2393
|
+
);
|
|
2394
|
+
}
|
|
2395
|
+
f = message.getConditionsList();
|
|
2396
|
+
if (f.length > 0) {
|
|
2397
|
+
writer.writeRepeatedMessage(
|
|
2398
|
+
5,
|
|
2399
|
+
f,
|
|
2400
|
+
proto.aggregator.EventCondition.serializeBinaryToWriter
|
|
2401
|
+
);
|
|
2402
|
+
}
|
|
2362
2403
|
};
|
|
2363
2404
|
proto.aggregator.EventTrigger.Query.prototype.getAddressesList = function() {
|
|
2364
2405
|
return (
|
|
@@ -2405,6 +2446,30 @@ var require_avs_pb = __commonJS({
|
|
|
2405
2446
|
proto.aggregator.EventTrigger.Query.prototype.hasMaxEventsPerBlock = function() {
|
|
2406
2447
|
return jspb.Message.getField(this, 3) != null;
|
|
2407
2448
|
};
|
|
2449
|
+
proto.aggregator.EventTrigger.Query.prototype.getContractAbi = function() {
|
|
2450
|
+
return (
|
|
2451
|
+
/** @type {string} */
|
|
2452
|
+
jspb.Message.getFieldWithDefault(this, 4, "")
|
|
2453
|
+
);
|
|
2454
|
+
};
|
|
2455
|
+
proto.aggregator.EventTrigger.Query.prototype.setContractAbi = function(value) {
|
|
2456
|
+
return jspb.Message.setProto3StringField(this, 4, value);
|
|
2457
|
+
};
|
|
2458
|
+
proto.aggregator.EventTrigger.Query.prototype.getConditionsList = function() {
|
|
2459
|
+
return (
|
|
2460
|
+
/** @type{!Array<!proto.aggregator.EventCondition>} */
|
|
2461
|
+
jspb.Message.getRepeatedWrapperField(this, proto.aggregator.EventCondition, 5)
|
|
2462
|
+
);
|
|
2463
|
+
};
|
|
2464
|
+
proto.aggregator.EventTrigger.Query.prototype.setConditionsList = function(value) {
|
|
2465
|
+
return jspb.Message.setRepeatedWrapperField(this, 5, value);
|
|
2466
|
+
};
|
|
2467
|
+
proto.aggregator.EventTrigger.Query.prototype.addConditions = function(opt_value, opt_index) {
|
|
2468
|
+
return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.aggregator.EventCondition, opt_index);
|
|
2469
|
+
};
|
|
2470
|
+
proto.aggregator.EventTrigger.Query.prototype.clearConditionsList = function() {
|
|
2471
|
+
return this.setConditionsList([]);
|
|
2472
|
+
};
|
|
2408
2473
|
proto.aggregator.EventTrigger.Topics.repeatedFields_ = [1];
|
|
2409
2474
|
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
2410
2475
|
proto.aggregator.EventTrigger.Topics.prototype.toObject = function(opt_includeInstance) {
|
|
@@ -15802,6 +15867,142 @@ var require_avs_pb = __commonJS({
|
|
|
15802
15867
|
this.getInputVariablesMap().clear();
|
|
15803
15868
|
return this;
|
|
15804
15869
|
};
|
|
15870
|
+
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
15871
|
+
proto.aggregator.EventCondition.prototype.toObject = function(opt_includeInstance) {
|
|
15872
|
+
return proto.aggregator.EventCondition.toObject(opt_includeInstance, this);
|
|
15873
|
+
};
|
|
15874
|
+
proto.aggregator.EventCondition.toObject = function(includeInstance, msg) {
|
|
15875
|
+
var f, obj = {
|
|
15876
|
+
fieldName: jspb.Message.getFieldWithDefault(msg, 1, ""),
|
|
15877
|
+
operator: jspb.Message.getFieldWithDefault(msg, 2, ""),
|
|
15878
|
+
value: jspb.Message.getFieldWithDefault(msg, 3, ""),
|
|
15879
|
+
fieldType: jspb.Message.getFieldWithDefault(msg, 4, "")
|
|
15880
|
+
};
|
|
15881
|
+
if (includeInstance) {
|
|
15882
|
+
obj.$jspbMessageInstance = msg;
|
|
15883
|
+
}
|
|
15884
|
+
return obj;
|
|
15885
|
+
};
|
|
15886
|
+
}
|
|
15887
|
+
proto.aggregator.EventCondition.deserializeBinary = function(bytes) {
|
|
15888
|
+
var reader = new jspb.BinaryReader(bytes);
|
|
15889
|
+
var msg = new proto.aggregator.EventCondition();
|
|
15890
|
+
return proto.aggregator.EventCondition.deserializeBinaryFromReader(msg, reader);
|
|
15891
|
+
};
|
|
15892
|
+
proto.aggregator.EventCondition.deserializeBinaryFromReader = function(msg, reader) {
|
|
15893
|
+
while (reader.nextField()) {
|
|
15894
|
+
if (reader.isEndGroup()) {
|
|
15895
|
+
break;
|
|
15896
|
+
}
|
|
15897
|
+
var field = reader.getFieldNumber();
|
|
15898
|
+
switch (field) {
|
|
15899
|
+
case 1:
|
|
15900
|
+
var value = (
|
|
15901
|
+
/** @type {string} */
|
|
15902
|
+
reader.readString()
|
|
15903
|
+
);
|
|
15904
|
+
msg.setFieldName(value);
|
|
15905
|
+
break;
|
|
15906
|
+
case 2:
|
|
15907
|
+
var value = (
|
|
15908
|
+
/** @type {string} */
|
|
15909
|
+
reader.readString()
|
|
15910
|
+
);
|
|
15911
|
+
msg.setOperator(value);
|
|
15912
|
+
break;
|
|
15913
|
+
case 3:
|
|
15914
|
+
var value = (
|
|
15915
|
+
/** @type {string} */
|
|
15916
|
+
reader.readString()
|
|
15917
|
+
);
|
|
15918
|
+
msg.setValue(value);
|
|
15919
|
+
break;
|
|
15920
|
+
case 4:
|
|
15921
|
+
var value = (
|
|
15922
|
+
/** @type {string} */
|
|
15923
|
+
reader.readString()
|
|
15924
|
+
);
|
|
15925
|
+
msg.setFieldType(value);
|
|
15926
|
+
break;
|
|
15927
|
+
default:
|
|
15928
|
+
reader.skipField();
|
|
15929
|
+
break;
|
|
15930
|
+
}
|
|
15931
|
+
}
|
|
15932
|
+
return msg;
|
|
15933
|
+
};
|
|
15934
|
+
proto.aggregator.EventCondition.prototype.serializeBinary = function() {
|
|
15935
|
+
var writer = new jspb.BinaryWriter();
|
|
15936
|
+
proto.aggregator.EventCondition.serializeBinaryToWriter(this, writer);
|
|
15937
|
+
return writer.getResultBuffer();
|
|
15938
|
+
};
|
|
15939
|
+
proto.aggregator.EventCondition.serializeBinaryToWriter = function(message, writer) {
|
|
15940
|
+
var f = void 0;
|
|
15941
|
+
f = message.getFieldName();
|
|
15942
|
+
if (f.length > 0) {
|
|
15943
|
+
writer.writeString(
|
|
15944
|
+
1,
|
|
15945
|
+
f
|
|
15946
|
+
);
|
|
15947
|
+
}
|
|
15948
|
+
f = message.getOperator();
|
|
15949
|
+
if (f.length > 0) {
|
|
15950
|
+
writer.writeString(
|
|
15951
|
+
2,
|
|
15952
|
+
f
|
|
15953
|
+
);
|
|
15954
|
+
}
|
|
15955
|
+
f = message.getValue();
|
|
15956
|
+
if (f.length > 0) {
|
|
15957
|
+
writer.writeString(
|
|
15958
|
+
3,
|
|
15959
|
+
f
|
|
15960
|
+
);
|
|
15961
|
+
}
|
|
15962
|
+
f = message.getFieldType();
|
|
15963
|
+
if (f.length > 0) {
|
|
15964
|
+
writer.writeString(
|
|
15965
|
+
4,
|
|
15966
|
+
f
|
|
15967
|
+
);
|
|
15968
|
+
}
|
|
15969
|
+
};
|
|
15970
|
+
proto.aggregator.EventCondition.prototype.getFieldName = function() {
|
|
15971
|
+
return (
|
|
15972
|
+
/** @type {string} */
|
|
15973
|
+
jspb.Message.getFieldWithDefault(this, 1, "")
|
|
15974
|
+
);
|
|
15975
|
+
};
|
|
15976
|
+
proto.aggregator.EventCondition.prototype.setFieldName = function(value) {
|
|
15977
|
+
return jspb.Message.setProto3StringField(this, 1, value);
|
|
15978
|
+
};
|
|
15979
|
+
proto.aggregator.EventCondition.prototype.getOperator = function() {
|
|
15980
|
+
return (
|
|
15981
|
+
/** @type {string} */
|
|
15982
|
+
jspb.Message.getFieldWithDefault(this, 2, "")
|
|
15983
|
+
);
|
|
15984
|
+
};
|
|
15985
|
+
proto.aggregator.EventCondition.prototype.setOperator = function(value) {
|
|
15986
|
+
return jspb.Message.setProto3StringField(this, 2, value);
|
|
15987
|
+
};
|
|
15988
|
+
proto.aggregator.EventCondition.prototype.getValue = function() {
|
|
15989
|
+
return (
|
|
15990
|
+
/** @type {string} */
|
|
15991
|
+
jspb.Message.getFieldWithDefault(this, 3, "")
|
|
15992
|
+
);
|
|
15993
|
+
};
|
|
15994
|
+
proto.aggregator.EventCondition.prototype.setValue = function(value) {
|
|
15995
|
+
return jspb.Message.setProto3StringField(this, 3, value);
|
|
15996
|
+
};
|
|
15997
|
+
proto.aggregator.EventCondition.prototype.getFieldType = function() {
|
|
15998
|
+
return (
|
|
15999
|
+
/** @type {string} */
|
|
16000
|
+
jspb.Message.getFieldWithDefault(this, 4, "")
|
|
16001
|
+
);
|
|
16002
|
+
};
|
|
16003
|
+
proto.aggregator.EventCondition.prototype.setFieldType = function(value) {
|
|
16004
|
+
return jspb.Message.setProto3StringField(this, 4, value);
|
|
16005
|
+
};
|
|
15805
16006
|
proto.aggregator.TriggerType = {
|
|
15806
16007
|
TRIGGER_TYPE_UNSPECIFIED: 0,
|
|
15807
16008
|
TRIGGER_TYPE_MANUAL: 1,
|
|
@@ -17032,6 +17233,20 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
|
|
|
17032
17233
|
if (queryData.maxEventsPerBlock !== void 0) {
|
|
17033
17234
|
query.setMaxEventsPerBlock(queryData.maxEventsPerBlock);
|
|
17034
17235
|
}
|
|
17236
|
+
if (queryData.contractAbi) {
|
|
17237
|
+
query.setContractAbi(queryData.contractAbi);
|
|
17238
|
+
}
|
|
17239
|
+
if (queryData.conditions && queryData.conditions.length > 0) {
|
|
17240
|
+
const conditionMessages = queryData.conditions.map((conditionData) => {
|
|
17241
|
+
const condition = new avs_pb4.EventCondition();
|
|
17242
|
+
condition.setFieldName(conditionData.fieldName);
|
|
17243
|
+
condition.setOperator(conditionData.operator);
|
|
17244
|
+
condition.setValue(conditionData.value);
|
|
17245
|
+
condition.setFieldType(conditionData.fieldType);
|
|
17246
|
+
return condition;
|
|
17247
|
+
});
|
|
17248
|
+
query.setConditionsList(conditionMessages);
|
|
17249
|
+
}
|
|
17035
17250
|
return query;
|
|
17036
17251
|
});
|
|
17037
17252
|
config.setQueriesList(queryMessages);
|
|
@@ -17072,6 +17287,25 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
|
|
|
17072
17287
|
if (maxEvents && maxEvents > 0) {
|
|
17073
17288
|
queryData.maxEventsPerBlock = maxEvents;
|
|
17074
17289
|
}
|
|
17290
|
+
const contractAbi = query.getContractAbi();
|
|
17291
|
+
if (contractAbi) {
|
|
17292
|
+
queryData.contractAbi = contractAbi;
|
|
17293
|
+
}
|
|
17294
|
+
const conditions = [];
|
|
17295
|
+
if (query.getConditionsList && query.getConditionsList().length > 0) {
|
|
17296
|
+
query.getConditionsList().forEach((condition) => {
|
|
17297
|
+
const conditionData = {
|
|
17298
|
+
fieldName: condition.getFieldName(),
|
|
17299
|
+
operator: condition.getOperator(),
|
|
17300
|
+
value: condition.getValue(),
|
|
17301
|
+
fieldType: condition.getFieldType()
|
|
17302
|
+
};
|
|
17303
|
+
conditions.push(conditionData);
|
|
17304
|
+
});
|
|
17305
|
+
}
|
|
17306
|
+
if (conditions.length > 0) {
|
|
17307
|
+
queryData.conditions = conditions;
|
|
17308
|
+
}
|
|
17075
17309
|
queries.push(queryData);
|
|
17076
17310
|
});
|
|
17077
17311
|
}
|
|
@@ -18225,48 +18459,34 @@ var Workflow = class _Workflow {
|
|
|
18225
18459
|
}
|
|
18226
18460
|
toRequest() {
|
|
18227
18461
|
const request = new avs_pb19.CreateTaskReq();
|
|
18228
|
-
console.log("\u{1F50D} Workflow.toRequest() - Starting serialization...");
|
|
18229
|
-
console.log("\u{1F4CA} Input data:");
|
|
18230
|
-
console.log(" - nodes count:", this.nodes?.length || 0);
|
|
18231
|
-
console.log(" - edges count:", this.edges?.length || 0);
|
|
18232
18462
|
request.setSmartWalletAddress(this.smartWalletAddress);
|
|
18233
18463
|
request.setTrigger(this.trigger.toRequest());
|
|
18234
18464
|
try {
|
|
18235
|
-
let nodeCount = 0;
|
|
18236
18465
|
import_lodash3.default.map(this.nodes, (node, index) => {
|
|
18237
18466
|
try {
|
|
18238
|
-
console.log(`\u{1F527} Serializing node ${index}: ${node.name} (${node.type})`);
|
|
18239
18467
|
const nodeRequest = node.toRequest();
|
|
18240
18468
|
request.addNodes(nodeRequest);
|
|
18241
|
-
nodeCount++;
|
|
18242
|
-
console.log(`\u2705 Node ${index} serialized successfully`);
|
|
18243
18469
|
} catch (nodeError) {
|
|
18244
18470
|
console.error(`\u{1F6A8} Node ${index} (${node.name}) serialization failed:`, nodeError);
|
|
18245
18471
|
const errorMessage = nodeError instanceof Error ? nodeError.message : String(nodeError);
|
|
18246
18472
|
throw new Error(`Node serialization failed: ${node.name} - ${errorMessage}`);
|
|
18247
18473
|
}
|
|
18248
18474
|
});
|
|
18249
|
-
console.log(`\u{1F4CA} Successfully serialized ${nodeCount} nodes`);
|
|
18250
18475
|
} catch (nodesError) {
|
|
18251
18476
|
console.error("\u{1F6A8} Nodes serialization failed:", nodesError);
|
|
18252
18477
|
throw nodesError;
|
|
18253
18478
|
}
|
|
18254
18479
|
try {
|
|
18255
|
-
let edgeCount = 0;
|
|
18256
18480
|
import_lodash3.default.map(this.edges, (edge, index) => {
|
|
18257
18481
|
try {
|
|
18258
|
-
console.log(`\u{1F517} Serializing edge ${index}: ${edge.source} -> ${edge.target}`);
|
|
18259
18482
|
const edgeRequest = edge.toRequest();
|
|
18260
18483
|
request.addEdges(edgeRequest);
|
|
18261
|
-
edgeCount++;
|
|
18262
|
-
console.log(`\u2705 Edge ${index} serialized successfully`);
|
|
18263
18484
|
} catch (edgeError) {
|
|
18264
18485
|
console.error(`\u{1F6A8} Edge ${index} serialization failed:`, edgeError);
|
|
18265
18486
|
const errorMessage = edgeError instanceof Error ? edgeError.message : String(edgeError);
|
|
18266
18487
|
throw new Error(`Edge serialization failed: ${edge.id} - ${errorMessage}`);
|
|
18267
18488
|
}
|
|
18268
18489
|
});
|
|
18269
|
-
console.log(`\u{1F4CA} Successfully serialized ${edgeCount} edges`);
|
|
18270
18490
|
} catch (edgesError) {
|
|
18271
18491
|
console.error("\u{1F6A8} Edges serialization failed:", edgesError);
|
|
18272
18492
|
throw edgesError;
|
|
@@ -18277,11 +18497,7 @@ var Workflow = class _Workflow {
|
|
|
18277
18497
|
if (this.name) {
|
|
18278
18498
|
request.setName(this.name);
|
|
18279
18499
|
}
|
|
18280
|
-
console.log(
|
|
18281
|
-
console.log(" - nodes in request:", request.getNodesList().length);
|
|
18282
|
-
console.log(" - edges in request:", request.getEdgesList().length);
|
|
18283
|
-
console.log(" - trigger set:", !!request.getTrigger());
|
|
18284
|
-
console.log("\u{1F50D} Workflow.toRequest() - Serialization complete");
|
|
18500
|
+
console.log(`\u{1F4E4} Workflow serialization: ${this.nodes.length} nodes, ${this.edges.length} edges -> protobuf: ${request.getNodesList().length} nodes, ${request.getEdgesList().length} edges`);
|
|
18285
18501
|
return request;
|
|
18286
18502
|
}
|
|
18287
18503
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -93,6 +93,7 @@ var require_avs_pb = __commonJS({
|
|
|
93
93
|
goog.exportSymbol("proto.aggregator.ETHTransferNode.Config", null, global);
|
|
94
94
|
goog.exportSymbol("proto.aggregator.ETHTransferNode.Output", null, global);
|
|
95
95
|
goog.exportSymbol("proto.aggregator.Error", null, global);
|
|
96
|
+
goog.exportSymbol("proto.aggregator.EventCondition", null, global);
|
|
96
97
|
goog.exportSymbol("proto.aggregator.EventTrigger", null, global);
|
|
97
98
|
goog.exportSymbol("proto.aggregator.EventTrigger.Config", null, global);
|
|
98
99
|
goog.exportSymbol("proto.aggregator.EventTrigger.Output", null, global);
|
|
@@ -935,6 +936,13 @@ var require_avs_pb = __commonJS({
|
|
|
935
936
|
if (goog.DEBUG && !COMPILED) {
|
|
936
937
|
proto.aggregator.SimulateTaskReq.displayName = "proto.aggregator.SimulateTaskReq";
|
|
937
938
|
}
|
|
939
|
+
proto.aggregator.EventCondition = function(opt_data) {
|
|
940
|
+
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
|
941
|
+
};
|
|
942
|
+
goog.inherits(proto.aggregator.EventCondition, jspb.Message);
|
|
943
|
+
if (goog.DEBUG && !COMPILED) {
|
|
944
|
+
proto.aggregator.EventCondition.displayName = "proto.aggregator.EventCondition";
|
|
945
|
+
}
|
|
938
946
|
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
939
947
|
proto.aggregator.TokenMetadata.prototype.toObject = function(opt_includeInstance) {
|
|
940
948
|
return proto.aggregator.TokenMetadata.toObject(opt_includeInstance, this);
|
|
@@ -2270,7 +2278,7 @@ var require_avs_pb = __commonJS({
|
|
|
2270
2278
|
);
|
|
2271
2279
|
}
|
|
2272
2280
|
};
|
|
2273
|
-
proto.aggregator.EventTrigger.Query.repeatedFields_ = [1, 2];
|
|
2281
|
+
proto.aggregator.EventTrigger.Query.repeatedFields_ = [1, 2, 5];
|
|
2274
2282
|
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
2275
2283
|
proto.aggregator.EventTrigger.Query.prototype.toObject = function(opt_includeInstance) {
|
|
2276
2284
|
return proto.aggregator.EventTrigger.Query.toObject(opt_includeInstance, this);
|
|
@@ -2283,7 +2291,13 @@ var require_avs_pb = __commonJS({
|
|
|
2283
2291
|
proto.aggregator.EventTrigger.Topics.toObject,
|
|
2284
2292
|
includeInstance
|
|
2285
2293
|
),
|
|
2286
|
-
maxEventsPerBlock: jspb.Message.getFieldWithDefault(msg, 3, 0)
|
|
2294
|
+
maxEventsPerBlock: jspb.Message.getFieldWithDefault(msg, 3, 0),
|
|
2295
|
+
contractAbi: jspb.Message.getFieldWithDefault(msg, 4, ""),
|
|
2296
|
+
conditionsList: jspb.Message.toObjectList(
|
|
2297
|
+
msg.getConditionsList(),
|
|
2298
|
+
proto.aggregator.EventCondition.toObject,
|
|
2299
|
+
includeInstance
|
|
2300
|
+
)
|
|
2287
2301
|
};
|
|
2288
2302
|
if (includeInstance) {
|
|
2289
2303
|
obj.$jspbMessageInstance = msg;
|
|
@@ -2322,6 +2336,18 @@ var require_avs_pb = __commonJS({
|
|
|
2322
2336
|
);
|
|
2323
2337
|
msg.setMaxEventsPerBlock(value);
|
|
2324
2338
|
break;
|
|
2339
|
+
case 4:
|
|
2340
|
+
var value = (
|
|
2341
|
+
/** @type {string} */
|
|
2342
|
+
reader.readString()
|
|
2343
|
+
);
|
|
2344
|
+
msg.setContractAbi(value);
|
|
2345
|
+
break;
|
|
2346
|
+
case 5:
|
|
2347
|
+
var value = new proto.aggregator.EventCondition();
|
|
2348
|
+
reader.readMessage(value, proto.aggregator.EventCondition.deserializeBinaryFromReader);
|
|
2349
|
+
msg.addConditions(value);
|
|
2350
|
+
break;
|
|
2325
2351
|
default:
|
|
2326
2352
|
reader.skipField();
|
|
2327
2353
|
break;
|
|
@@ -2359,6 +2385,21 @@ var require_avs_pb = __commonJS({
|
|
|
2359
2385
|
f
|
|
2360
2386
|
);
|
|
2361
2387
|
}
|
|
2388
|
+
f = message.getContractAbi();
|
|
2389
|
+
if (f.length > 0) {
|
|
2390
|
+
writer.writeString(
|
|
2391
|
+
4,
|
|
2392
|
+
f
|
|
2393
|
+
);
|
|
2394
|
+
}
|
|
2395
|
+
f = message.getConditionsList();
|
|
2396
|
+
if (f.length > 0) {
|
|
2397
|
+
writer.writeRepeatedMessage(
|
|
2398
|
+
5,
|
|
2399
|
+
f,
|
|
2400
|
+
proto.aggregator.EventCondition.serializeBinaryToWriter
|
|
2401
|
+
);
|
|
2402
|
+
}
|
|
2362
2403
|
};
|
|
2363
2404
|
proto.aggregator.EventTrigger.Query.prototype.getAddressesList = function() {
|
|
2364
2405
|
return (
|
|
@@ -2405,6 +2446,30 @@ var require_avs_pb = __commonJS({
|
|
|
2405
2446
|
proto.aggregator.EventTrigger.Query.prototype.hasMaxEventsPerBlock = function() {
|
|
2406
2447
|
return jspb.Message.getField(this, 3) != null;
|
|
2407
2448
|
};
|
|
2449
|
+
proto.aggregator.EventTrigger.Query.prototype.getContractAbi = function() {
|
|
2450
|
+
return (
|
|
2451
|
+
/** @type {string} */
|
|
2452
|
+
jspb.Message.getFieldWithDefault(this, 4, "")
|
|
2453
|
+
);
|
|
2454
|
+
};
|
|
2455
|
+
proto.aggregator.EventTrigger.Query.prototype.setContractAbi = function(value) {
|
|
2456
|
+
return jspb.Message.setProto3StringField(this, 4, value);
|
|
2457
|
+
};
|
|
2458
|
+
proto.aggregator.EventTrigger.Query.prototype.getConditionsList = function() {
|
|
2459
|
+
return (
|
|
2460
|
+
/** @type{!Array<!proto.aggregator.EventCondition>} */
|
|
2461
|
+
jspb.Message.getRepeatedWrapperField(this, proto.aggregator.EventCondition, 5)
|
|
2462
|
+
);
|
|
2463
|
+
};
|
|
2464
|
+
proto.aggregator.EventTrigger.Query.prototype.setConditionsList = function(value) {
|
|
2465
|
+
return jspb.Message.setRepeatedWrapperField(this, 5, value);
|
|
2466
|
+
};
|
|
2467
|
+
proto.aggregator.EventTrigger.Query.prototype.addConditions = function(opt_value, opt_index) {
|
|
2468
|
+
return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.aggregator.EventCondition, opt_index);
|
|
2469
|
+
};
|
|
2470
|
+
proto.aggregator.EventTrigger.Query.prototype.clearConditionsList = function() {
|
|
2471
|
+
return this.setConditionsList([]);
|
|
2472
|
+
};
|
|
2408
2473
|
proto.aggregator.EventTrigger.Topics.repeatedFields_ = [1];
|
|
2409
2474
|
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
2410
2475
|
proto.aggregator.EventTrigger.Topics.prototype.toObject = function(opt_includeInstance) {
|
|
@@ -15802,6 +15867,142 @@ var require_avs_pb = __commonJS({
|
|
|
15802
15867
|
this.getInputVariablesMap().clear();
|
|
15803
15868
|
return this;
|
|
15804
15869
|
};
|
|
15870
|
+
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
15871
|
+
proto.aggregator.EventCondition.prototype.toObject = function(opt_includeInstance) {
|
|
15872
|
+
return proto.aggregator.EventCondition.toObject(opt_includeInstance, this);
|
|
15873
|
+
};
|
|
15874
|
+
proto.aggregator.EventCondition.toObject = function(includeInstance, msg) {
|
|
15875
|
+
var f, obj = {
|
|
15876
|
+
fieldName: jspb.Message.getFieldWithDefault(msg, 1, ""),
|
|
15877
|
+
operator: jspb.Message.getFieldWithDefault(msg, 2, ""),
|
|
15878
|
+
value: jspb.Message.getFieldWithDefault(msg, 3, ""),
|
|
15879
|
+
fieldType: jspb.Message.getFieldWithDefault(msg, 4, "")
|
|
15880
|
+
};
|
|
15881
|
+
if (includeInstance) {
|
|
15882
|
+
obj.$jspbMessageInstance = msg;
|
|
15883
|
+
}
|
|
15884
|
+
return obj;
|
|
15885
|
+
};
|
|
15886
|
+
}
|
|
15887
|
+
proto.aggregator.EventCondition.deserializeBinary = function(bytes) {
|
|
15888
|
+
var reader = new jspb.BinaryReader(bytes);
|
|
15889
|
+
var msg = new proto.aggregator.EventCondition();
|
|
15890
|
+
return proto.aggregator.EventCondition.deserializeBinaryFromReader(msg, reader);
|
|
15891
|
+
};
|
|
15892
|
+
proto.aggregator.EventCondition.deserializeBinaryFromReader = function(msg, reader) {
|
|
15893
|
+
while (reader.nextField()) {
|
|
15894
|
+
if (reader.isEndGroup()) {
|
|
15895
|
+
break;
|
|
15896
|
+
}
|
|
15897
|
+
var field = reader.getFieldNumber();
|
|
15898
|
+
switch (field) {
|
|
15899
|
+
case 1:
|
|
15900
|
+
var value = (
|
|
15901
|
+
/** @type {string} */
|
|
15902
|
+
reader.readString()
|
|
15903
|
+
);
|
|
15904
|
+
msg.setFieldName(value);
|
|
15905
|
+
break;
|
|
15906
|
+
case 2:
|
|
15907
|
+
var value = (
|
|
15908
|
+
/** @type {string} */
|
|
15909
|
+
reader.readString()
|
|
15910
|
+
);
|
|
15911
|
+
msg.setOperator(value);
|
|
15912
|
+
break;
|
|
15913
|
+
case 3:
|
|
15914
|
+
var value = (
|
|
15915
|
+
/** @type {string} */
|
|
15916
|
+
reader.readString()
|
|
15917
|
+
);
|
|
15918
|
+
msg.setValue(value);
|
|
15919
|
+
break;
|
|
15920
|
+
case 4:
|
|
15921
|
+
var value = (
|
|
15922
|
+
/** @type {string} */
|
|
15923
|
+
reader.readString()
|
|
15924
|
+
);
|
|
15925
|
+
msg.setFieldType(value);
|
|
15926
|
+
break;
|
|
15927
|
+
default:
|
|
15928
|
+
reader.skipField();
|
|
15929
|
+
break;
|
|
15930
|
+
}
|
|
15931
|
+
}
|
|
15932
|
+
return msg;
|
|
15933
|
+
};
|
|
15934
|
+
proto.aggregator.EventCondition.prototype.serializeBinary = function() {
|
|
15935
|
+
var writer = new jspb.BinaryWriter();
|
|
15936
|
+
proto.aggregator.EventCondition.serializeBinaryToWriter(this, writer);
|
|
15937
|
+
return writer.getResultBuffer();
|
|
15938
|
+
};
|
|
15939
|
+
proto.aggregator.EventCondition.serializeBinaryToWriter = function(message, writer) {
|
|
15940
|
+
var f = void 0;
|
|
15941
|
+
f = message.getFieldName();
|
|
15942
|
+
if (f.length > 0) {
|
|
15943
|
+
writer.writeString(
|
|
15944
|
+
1,
|
|
15945
|
+
f
|
|
15946
|
+
);
|
|
15947
|
+
}
|
|
15948
|
+
f = message.getOperator();
|
|
15949
|
+
if (f.length > 0) {
|
|
15950
|
+
writer.writeString(
|
|
15951
|
+
2,
|
|
15952
|
+
f
|
|
15953
|
+
);
|
|
15954
|
+
}
|
|
15955
|
+
f = message.getValue();
|
|
15956
|
+
if (f.length > 0) {
|
|
15957
|
+
writer.writeString(
|
|
15958
|
+
3,
|
|
15959
|
+
f
|
|
15960
|
+
);
|
|
15961
|
+
}
|
|
15962
|
+
f = message.getFieldType();
|
|
15963
|
+
if (f.length > 0) {
|
|
15964
|
+
writer.writeString(
|
|
15965
|
+
4,
|
|
15966
|
+
f
|
|
15967
|
+
);
|
|
15968
|
+
}
|
|
15969
|
+
};
|
|
15970
|
+
proto.aggregator.EventCondition.prototype.getFieldName = function() {
|
|
15971
|
+
return (
|
|
15972
|
+
/** @type {string} */
|
|
15973
|
+
jspb.Message.getFieldWithDefault(this, 1, "")
|
|
15974
|
+
);
|
|
15975
|
+
};
|
|
15976
|
+
proto.aggregator.EventCondition.prototype.setFieldName = function(value) {
|
|
15977
|
+
return jspb.Message.setProto3StringField(this, 1, value);
|
|
15978
|
+
};
|
|
15979
|
+
proto.aggregator.EventCondition.prototype.getOperator = function() {
|
|
15980
|
+
return (
|
|
15981
|
+
/** @type {string} */
|
|
15982
|
+
jspb.Message.getFieldWithDefault(this, 2, "")
|
|
15983
|
+
);
|
|
15984
|
+
};
|
|
15985
|
+
proto.aggregator.EventCondition.prototype.setOperator = function(value) {
|
|
15986
|
+
return jspb.Message.setProto3StringField(this, 2, value);
|
|
15987
|
+
};
|
|
15988
|
+
proto.aggregator.EventCondition.prototype.getValue = function() {
|
|
15989
|
+
return (
|
|
15990
|
+
/** @type {string} */
|
|
15991
|
+
jspb.Message.getFieldWithDefault(this, 3, "")
|
|
15992
|
+
);
|
|
15993
|
+
};
|
|
15994
|
+
proto.aggregator.EventCondition.prototype.setValue = function(value) {
|
|
15995
|
+
return jspb.Message.setProto3StringField(this, 3, value);
|
|
15996
|
+
};
|
|
15997
|
+
proto.aggregator.EventCondition.prototype.getFieldType = function() {
|
|
15998
|
+
return (
|
|
15999
|
+
/** @type {string} */
|
|
16000
|
+
jspb.Message.getFieldWithDefault(this, 4, "")
|
|
16001
|
+
);
|
|
16002
|
+
};
|
|
16003
|
+
proto.aggregator.EventCondition.prototype.setFieldType = function(value) {
|
|
16004
|
+
return jspb.Message.setProto3StringField(this, 4, value);
|
|
16005
|
+
};
|
|
15805
16006
|
proto.aggregator.TriggerType = {
|
|
15806
16007
|
TRIGGER_TYPE_UNSPECIFIED: 0,
|
|
15807
16008
|
TRIGGER_TYPE_MANUAL: 1,
|
|
@@ -17009,6 +17210,20 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
|
|
|
17009
17210
|
if (queryData.maxEventsPerBlock !== void 0) {
|
|
17010
17211
|
query.setMaxEventsPerBlock(queryData.maxEventsPerBlock);
|
|
17011
17212
|
}
|
|
17213
|
+
if (queryData.contractAbi) {
|
|
17214
|
+
query.setContractAbi(queryData.contractAbi);
|
|
17215
|
+
}
|
|
17216
|
+
if (queryData.conditions && queryData.conditions.length > 0) {
|
|
17217
|
+
const conditionMessages = queryData.conditions.map((conditionData) => {
|
|
17218
|
+
const condition = new avs_pb4.EventCondition();
|
|
17219
|
+
condition.setFieldName(conditionData.fieldName);
|
|
17220
|
+
condition.setOperator(conditionData.operator);
|
|
17221
|
+
condition.setValue(conditionData.value);
|
|
17222
|
+
condition.setFieldType(conditionData.fieldType);
|
|
17223
|
+
return condition;
|
|
17224
|
+
});
|
|
17225
|
+
query.setConditionsList(conditionMessages);
|
|
17226
|
+
}
|
|
17012
17227
|
return query;
|
|
17013
17228
|
});
|
|
17014
17229
|
config.setQueriesList(queryMessages);
|
|
@@ -17049,6 +17264,25 @@ var EventTrigger2 = class _EventTrigger extends Trigger {
|
|
|
17049
17264
|
if (maxEvents && maxEvents > 0) {
|
|
17050
17265
|
queryData.maxEventsPerBlock = maxEvents;
|
|
17051
17266
|
}
|
|
17267
|
+
const contractAbi = query.getContractAbi();
|
|
17268
|
+
if (contractAbi) {
|
|
17269
|
+
queryData.contractAbi = contractAbi;
|
|
17270
|
+
}
|
|
17271
|
+
const conditions = [];
|
|
17272
|
+
if (query.getConditionsList && query.getConditionsList().length > 0) {
|
|
17273
|
+
query.getConditionsList().forEach((condition) => {
|
|
17274
|
+
const conditionData = {
|
|
17275
|
+
fieldName: condition.getFieldName(),
|
|
17276
|
+
operator: condition.getOperator(),
|
|
17277
|
+
value: condition.getValue(),
|
|
17278
|
+
fieldType: condition.getFieldType()
|
|
17279
|
+
};
|
|
17280
|
+
conditions.push(conditionData);
|
|
17281
|
+
});
|
|
17282
|
+
}
|
|
17283
|
+
if (conditions.length > 0) {
|
|
17284
|
+
queryData.conditions = conditions;
|
|
17285
|
+
}
|
|
17052
17286
|
queries.push(queryData);
|
|
17053
17287
|
});
|
|
17054
17288
|
}
|
|
@@ -18212,48 +18446,34 @@ var Workflow = class _Workflow {
|
|
|
18212
18446
|
}
|
|
18213
18447
|
toRequest() {
|
|
18214
18448
|
const request = new avs_pb19.CreateTaskReq();
|
|
18215
|
-
console.log("\u{1F50D} Workflow.toRequest() - Starting serialization...");
|
|
18216
|
-
console.log("\u{1F4CA} Input data:");
|
|
18217
|
-
console.log(" - nodes count:", this.nodes?.length || 0);
|
|
18218
|
-
console.log(" - edges count:", this.edges?.length || 0);
|
|
18219
18449
|
request.setSmartWalletAddress(this.smartWalletAddress);
|
|
18220
18450
|
request.setTrigger(this.trigger.toRequest());
|
|
18221
18451
|
try {
|
|
18222
|
-
let nodeCount = 0;
|
|
18223
18452
|
_3.map(this.nodes, (node, index) => {
|
|
18224
18453
|
try {
|
|
18225
|
-
console.log(`\u{1F527} Serializing node ${index}: ${node.name} (${node.type})`);
|
|
18226
18454
|
const nodeRequest = node.toRequest();
|
|
18227
18455
|
request.addNodes(nodeRequest);
|
|
18228
|
-
nodeCount++;
|
|
18229
|
-
console.log(`\u2705 Node ${index} serialized successfully`);
|
|
18230
18456
|
} catch (nodeError) {
|
|
18231
18457
|
console.error(`\u{1F6A8} Node ${index} (${node.name}) serialization failed:`, nodeError);
|
|
18232
18458
|
const errorMessage = nodeError instanceof Error ? nodeError.message : String(nodeError);
|
|
18233
18459
|
throw new Error(`Node serialization failed: ${node.name} - ${errorMessage}`);
|
|
18234
18460
|
}
|
|
18235
18461
|
});
|
|
18236
|
-
console.log(`\u{1F4CA} Successfully serialized ${nodeCount} nodes`);
|
|
18237
18462
|
} catch (nodesError) {
|
|
18238
18463
|
console.error("\u{1F6A8} Nodes serialization failed:", nodesError);
|
|
18239
18464
|
throw nodesError;
|
|
18240
18465
|
}
|
|
18241
18466
|
try {
|
|
18242
|
-
let edgeCount = 0;
|
|
18243
18467
|
_3.map(this.edges, (edge, index) => {
|
|
18244
18468
|
try {
|
|
18245
|
-
console.log(`\u{1F517} Serializing edge ${index}: ${edge.source} -> ${edge.target}`);
|
|
18246
18469
|
const edgeRequest = edge.toRequest();
|
|
18247
18470
|
request.addEdges(edgeRequest);
|
|
18248
|
-
edgeCount++;
|
|
18249
|
-
console.log(`\u2705 Edge ${index} serialized successfully`);
|
|
18250
18471
|
} catch (edgeError) {
|
|
18251
18472
|
console.error(`\u{1F6A8} Edge ${index} serialization failed:`, edgeError);
|
|
18252
18473
|
const errorMessage = edgeError instanceof Error ? edgeError.message : String(edgeError);
|
|
18253
18474
|
throw new Error(`Edge serialization failed: ${edge.id} - ${errorMessage}`);
|
|
18254
18475
|
}
|
|
18255
18476
|
});
|
|
18256
|
-
console.log(`\u{1F4CA} Successfully serialized ${edgeCount} edges`);
|
|
18257
18477
|
} catch (edgesError) {
|
|
18258
18478
|
console.error("\u{1F6A8} Edges serialization failed:", edgesError);
|
|
18259
18479
|
throw edgesError;
|
|
@@ -18264,11 +18484,7 @@ var Workflow = class _Workflow {
|
|
|
18264
18484
|
if (this.name) {
|
|
18265
18485
|
request.setName(this.name);
|
|
18266
18486
|
}
|
|
18267
|
-
console.log(
|
|
18268
|
-
console.log(" - nodes in request:", request.getNodesList().length);
|
|
18269
|
-
console.log(" - edges in request:", request.getEdgesList().length);
|
|
18270
|
-
console.log(" - trigger set:", !!request.getTrigger());
|
|
18271
|
-
console.log("\u{1F50D} Workflow.toRequest() - Serialization complete");
|
|
18487
|
+
console.log(`\u{1F4E4} Workflow serialization: ${this.nodes.length} nodes, ${this.edges.length} edges -> protobuf: ${request.getNodesList().length} nodes, ${request.getEdgesList().length} edges`);
|
|
18272
18488
|
return request;
|
|
18273
18489
|
}
|
|
18274
18490
|
/**
|
|
@@ -43,7 +43,7 @@ class ContractWriteNode extends Node {
|
|
|
43
43
|
config.setContractAddress(this.data.contractAddress);
|
|
44
44
|
config.setCallData(this.data.callData);
|
|
45
45
|
config.setContractAbi(this.data.contractAbi);
|
|
46
|
-
// Handle method calls array
|
|
46
|
+
// Handle method calls array
|
|
47
47
|
const methodCalls = this.data.methodCalls || [];
|
|
48
48
|
methodCalls.forEach((methodCall) => {
|
|
49
49
|
const methodCallMsg = new avs_pb.ContractWriteNode.MethodCall();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/event.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/event.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAGlB,MAAM,oBAAoB,CAAC;AA8C5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAqF/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAwF1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -85,6 +85,22 @@ class EventTrigger extends Trigger {
|
|
|
85
85
|
if (queryData.maxEventsPerBlock !== undefined) {
|
|
86
86
|
query.setMaxEventsPerBlock(queryData.maxEventsPerBlock);
|
|
87
87
|
}
|
|
88
|
+
// Set contractAbi if provided
|
|
89
|
+
if (queryData.contractAbi) {
|
|
90
|
+
query.setContractAbi(queryData.contractAbi);
|
|
91
|
+
}
|
|
92
|
+
// Set conditions if provided
|
|
93
|
+
if (queryData.conditions && queryData.conditions.length > 0) {
|
|
94
|
+
const conditionMessages = queryData.conditions.map((conditionData) => {
|
|
95
|
+
const condition = new avs_pb.EventCondition();
|
|
96
|
+
condition.setFieldName(conditionData.fieldName);
|
|
97
|
+
condition.setOperator(conditionData.operator);
|
|
98
|
+
condition.setValue(conditionData.value);
|
|
99
|
+
condition.setFieldType(conditionData.fieldType);
|
|
100
|
+
return condition;
|
|
101
|
+
});
|
|
102
|
+
query.setConditionsList(conditionMessages);
|
|
103
|
+
}
|
|
88
104
|
return query;
|
|
89
105
|
});
|
|
90
106
|
config.setQueriesList(queryMessages);
|
|
@@ -122,7 +138,7 @@ class EventTrigger extends Trigger {
|
|
|
122
138
|
// Don't convert empty strings back to null - preserve the original values
|
|
123
139
|
// The backend may legitimately use empty strings, and we shouldn't assume
|
|
124
140
|
// they were originally null values from the client
|
|
125
|
-
values: topics.getValuesList() || []
|
|
141
|
+
values: topics.getValuesList() || [],
|
|
126
142
|
}));
|
|
127
143
|
}
|
|
128
144
|
// Extract maxEventsPerBlock
|
|
@@ -130,6 +146,28 @@ class EventTrigger extends Trigger {
|
|
|
130
146
|
if (maxEvents && maxEvents > 0) {
|
|
131
147
|
queryData.maxEventsPerBlock = maxEvents;
|
|
132
148
|
}
|
|
149
|
+
// Extract contractAbi
|
|
150
|
+
const contractAbi = query.getContractAbi();
|
|
151
|
+
if (contractAbi) {
|
|
152
|
+
queryData.contractAbi = contractAbi;
|
|
153
|
+
}
|
|
154
|
+
// Extract conditions
|
|
155
|
+
const conditions = [];
|
|
156
|
+
if (query.getConditionsList &&
|
|
157
|
+
query.getConditionsList().length > 0) {
|
|
158
|
+
query.getConditionsList().forEach((condition) => {
|
|
159
|
+
const conditionData = {
|
|
160
|
+
fieldName: condition.getFieldName(),
|
|
161
|
+
operator: condition.getOperator(),
|
|
162
|
+
value: condition.getValue(),
|
|
163
|
+
fieldType: condition.getFieldType(),
|
|
164
|
+
};
|
|
165
|
+
conditions.push(conditionData);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
if (conditions.length > 0) {
|
|
169
|
+
queryData.conditions = conditions;
|
|
170
|
+
}
|
|
133
171
|
queries.push(queryData);
|
|
134
172
|
});
|
|
135
173
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/models/workflow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAG1C,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnE,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,CAAC,UAAU,GACxB,cAAc,CAUhB;AAED,cAAM,QAAS,YAAW,aAAa;IACrC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IAGrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;gBACS,KAAK,EAAE,aAAa;IAuBhC;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,GAAG,QAAQ;IAkC/C;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,GAAG,QAAQ;IAyBnD,SAAS,IAAI,MAAM,CAAC,aAAa;
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/models/workflow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAG1C,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnE,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,CAAC,UAAU,GACxB,cAAc,CAUhB;AAED,cAAM,QAAS,YAAW,aAAa;IACrC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IAGrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;gBACS,KAAK,EAAE,aAAa;IAuBhC;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,GAAG,QAAQ;IAkC/C;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,GAAG,QAAQ;IAyBnD,SAAS,IAAI,MAAM,CAAC,aAAa;IAyDjC;;;OAGG;IACH,MAAM,IAAI,aAAa;CAkBxB;AAED,eAAe,QAAQ,CAAC"}
|
package/dist/models/workflow.js
CHANGED
|
@@ -99,23 +99,15 @@ class Workflow {
|
|
|
99
99
|
}
|
|
100
100
|
toRequest() {
|
|
101
101
|
const request = new avs_pb.CreateTaskReq();
|
|
102
|
-
console.log("🔍 Workflow.toRequest() - Starting serialization...");
|
|
103
|
-
console.log("📊 Input data:");
|
|
104
|
-
console.log(" - nodes count:", this.nodes?.length || 0);
|
|
105
|
-
console.log(" - edges count:", this.edges?.length || 0);
|
|
106
102
|
// TODO: add client side validation for each field
|
|
107
103
|
request.setSmartWalletAddress(this.smartWalletAddress);
|
|
108
104
|
request.setTrigger(this.trigger.toRequest());
|
|
109
105
|
// Add error handling for node serialization
|
|
110
106
|
try {
|
|
111
|
-
let nodeCount = 0;
|
|
112
107
|
_.map(this.nodes, (node, index) => {
|
|
113
108
|
try {
|
|
114
|
-
console.log(`🔧 Serializing node ${index}: ${node.name} (${node.type})`);
|
|
115
109
|
const nodeRequest = node.toRequest();
|
|
116
110
|
request.addNodes(nodeRequest);
|
|
117
|
-
nodeCount++;
|
|
118
|
-
console.log(`✅ Node ${index} serialized successfully`);
|
|
119
111
|
}
|
|
120
112
|
catch (nodeError) {
|
|
121
113
|
console.error(`🚨 Node ${index} (${node.name}) serialization failed:`, nodeError);
|
|
@@ -123,7 +115,6 @@ class Workflow {
|
|
|
123
115
|
throw new Error(`Node serialization failed: ${node.name} - ${errorMessage}`);
|
|
124
116
|
}
|
|
125
117
|
});
|
|
126
|
-
console.log(`📊 Successfully serialized ${nodeCount} nodes`);
|
|
127
118
|
}
|
|
128
119
|
catch (nodesError) {
|
|
129
120
|
console.error('🚨 Nodes serialization failed:', nodesError);
|
|
@@ -131,14 +122,10 @@ class Workflow {
|
|
|
131
122
|
}
|
|
132
123
|
// Add error handling for edge serialization
|
|
133
124
|
try {
|
|
134
|
-
let edgeCount = 0;
|
|
135
125
|
_.map(this.edges, (edge, index) => {
|
|
136
126
|
try {
|
|
137
|
-
console.log(`🔗 Serializing edge ${index}: ${edge.source} -> ${edge.target}`);
|
|
138
127
|
const edgeRequest = edge.toRequest();
|
|
139
128
|
request.addEdges(edgeRequest);
|
|
140
|
-
edgeCount++;
|
|
141
|
-
console.log(`✅ Edge ${index} serialized successfully`);
|
|
142
129
|
}
|
|
143
130
|
catch (edgeError) {
|
|
144
131
|
console.error(`🚨 Edge ${index} serialization failed:`, edgeError);
|
|
@@ -146,7 +133,6 @@ class Workflow {
|
|
|
146
133
|
throw new Error(`Edge serialization failed: ${edge.id} - ${errorMessage}`);
|
|
147
134
|
}
|
|
148
135
|
});
|
|
149
|
-
console.log(`📊 Successfully serialized ${edgeCount} edges`);
|
|
150
136
|
}
|
|
151
137
|
catch (edgesError) {
|
|
152
138
|
console.error('🚨 Edges serialization failed:', edgesError);
|
|
@@ -159,11 +145,8 @@ class Workflow {
|
|
|
159
145
|
if (this.name) {
|
|
160
146
|
request.setName(this.name);
|
|
161
147
|
}
|
|
162
|
-
|
|
163
|
-
console.log(
|
|
164
|
-
console.log(" - edges in request:", request.getEdgesList().length);
|
|
165
|
-
console.log(" - trigger set:", !!request.getTrigger());
|
|
166
|
-
console.log("🔍 Workflow.toRequest() - Serialization complete");
|
|
148
|
+
// Log final summary for debugging (only errors and counts)
|
|
149
|
+
console.log(`📤 Workflow serialization: ${this.nodes.length} nodes, ${this.edges.length} edges -> protobuf: ${request.getNodesList().length} nodes, ${request.getEdgesList().length} edges`);
|
|
167
150
|
return request;
|
|
168
151
|
}
|
|
169
152
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avaprotocol/sdk-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "A JavaScript/TypeScript SDK designed to simplify integration with Ava Protocol's AVS",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"prepare": "node ../../scripts/prepare-package.js"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@avaprotocol/types": "^2.2.
|
|
34
|
+
"@avaprotocol/types": "^2.2.13",
|
|
35
35
|
"@grpc/grpc-js": "^1.11.3",
|
|
36
36
|
"@grpc/proto-loader": "^0.7.13",
|
|
37
37
|
"dotenv": "^16.4.5",
|