@avaprotocol/sdk-js 2.6.4-dev.0 → 2.6.5
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 +16 -0
- package/dist/index.d.ts +349 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +480 -147
- package/dist/index.mjs +482 -148
- package/dist/models/node/contractWrite.d.ts.map +1 -1
- package/dist/models/node/contractWrite.js +2 -0
- package/dist/models/trigger/block.d.ts.map +1 -1
- package/dist/models/trigger/block.js +17 -1
- package/dist/models/trigger/cron.js +2 -2
- package/package.json +2 -2
|
@@ -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;
|
|
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"}
|
|
@@ -98,6 +98,7 @@ class ContractWriteNode extends Node {
|
|
|
98
98
|
success: result.success,
|
|
99
99
|
error: result.error || "",
|
|
100
100
|
value: result.value,
|
|
101
|
+
receipt: result.receipt || null, // Add receipt field
|
|
101
102
|
};
|
|
102
103
|
});
|
|
103
104
|
}
|
|
@@ -110,6 +111,7 @@ class ContractWriteNode extends Node {
|
|
|
110
111
|
success: jsData.success,
|
|
111
112
|
error: jsData.error || "",
|
|
112
113
|
value: jsData.value,
|
|
114
|
+
receipt: jsData.receipt || null, // Add receipt field
|
|
113
115
|
}];
|
|
114
116
|
}
|
|
115
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAEL,iBAAiB,EAEjB,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAC5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAOpC,SAAS,IAAI,MAAM,CAAC,WAAW;
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAEL,iBAAiB,EAEjB,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAC5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAOpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAwC/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAoB1D;;;OAGG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAY9D;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -16,7 +16,23 @@ class BlockTrigger extends Trigger {
|
|
|
16
16
|
const blockTrigger = new avs_pb.BlockTrigger();
|
|
17
17
|
const config = new avs_pb.BlockTrigger.Config();
|
|
18
18
|
const blockData = this.data;
|
|
19
|
-
|
|
19
|
+
// Validate trigger data exists
|
|
20
|
+
if (!blockData) {
|
|
21
|
+
throw new Error("Trigger data is missing for block");
|
|
22
|
+
}
|
|
23
|
+
// Validate interval is present and not null/undefined
|
|
24
|
+
if (blockData.interval === null || blockData.interval === undefined) {
|
|
25
|
+
throw new Error("Interval is required for block trigger");
|
|
26
|
+
}
|
|
27
|
+
// Validate interval is a positive integer
|
|
28
|
+
if (blockData.interval <= 0) {
|
|
29
|
+
throw new Error("Interval must be greater than 0");
|
|
30
|
+
}
|
|
31
|
+
// Validate interval is an integer (not decimal)
|
|
32
|
+
if (!Number.isInteger(blockData.interval)) {
|
|
33
|
+
throw new Error(`BlockTrigger interval must be an integer, got: ${blockData.interval}`);
|
|
34
|
+
}
|
|
35
|
+
config.setInterval(blockData.interval);
|
|
20
36
|
blockTrigger.setConfig(config);
|
|
21
37
|
trigger.setBlock(blockTrigger);
|
|
22
38
|
return trigger;
|
|
@@ -19,11 +19,11 @@ class CronTrigger extends Trigger {
|
|
|
19
19
|
const cronData = this.data;
|
|
20
20
|
// Validate schedules is present and not null/undefined
|
|
21
21
|
if (!cronData.schedules || !Array.isArray(cronData.schedules)) {
|
|
22
|
-
throw new Error("Schedules
|
|
22
|
+
throw new Error("Schedules are required for cron trigger");
|
|
23
23
|
}
|
|
24
24
|
// Validate schedules array is not empty
|
|
25
25
|
if (cronData.schedules.length === 0) {
|
|
26
|
-
throw new Error("
|
|
26
|
+
throw new Error("Schedules are required for cron trigger");
|
|
27
27
|
}
|
|
28
28
|
const config = new avs_pb.CronTrigger.Config();
|
|
29
29
|
config.setSchedulesList(cronData.schedules);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avaprotocol/sdk-js",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.5",
|
|
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.
|
|
34
|
+
"@avaprotocol/types": "^2.4.5",
|
|
35
35
|
"@grpc/grpc-js": "^1.11.3",
|
|
36
36
|
"@grpc/proto-loader": "^0.7.13",
|
|
37
37
|
"dotenv": "^16.4.5",
|