@avaprotocol/sdk-js 1.6.7 → 1.6.8
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 +8 -0
- package/dist/index.d.ts +12 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +619 -511
- package/dist/index.mjs +628 -518
- package/dist/models/execution.d.ts +7 -9
- package/dist/models/execution.d.ts.map +1 -1
- package/dist/models/execution.js +17 -7
- package/dist/models/trigger/cron.d.ts +1 -0
- package/dist/models/trigger/cron.d.ts.map +1 -1
- package/dist/models/trigger/cron.js +9 -1
- package/dist/models/trigger/fixedTime.d.ts +1 -0
- package/dist/models/trigger/fixedTime.d.ts.map +1 -1
- package/dist/models/trigger/fixedTime.js +9 -1
- package/package.json +2 -2
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import
|
|
2
|
+
import { TriggerType } from "@avaprotocol/types";
|
|
3
3
|
import Step from "./step";
|
|
4
4
|
export type StepProps = avs_pb.Execution.Step.AsObject;
|
|
5
|
-
export type OutputDataProps = avs_pb.BlockTrigger.Output.AsObject | avs_pb.FixedTimeTrigger.Output.AsObject | avs_pb.CronTrigger.Output.AsObject | avs_pb.EventTrigger.Output.AsObject | avs_pb.EventTrigger.TransferLogOutput.AsObject | avs_pb.Evm.Log.AsObject | {
|
|
5
|
+
export type OutputDataProps = avs_pb.BlockTrigger.Output.AsObject | avs_pb.FixedTimeTrigger.Output.AsObject | avs_pb.CronTrigger.Output.AsObject | avs_pb.EventTrigger.Output.AsObject | avs_pb.EventTrigger.TransferLogOutput.AsObject | avs_pb.ManualTrigger.Output.AsObject | avs_pb.Evm.Log.AsObject | {
|
|
6
6
|
blockNumber: number;
|
|
7
7
|
} | {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
epoch: number;
|
|
11
|
-
scheduleMatched: string;
|
|
8
|
+
timestamp: number;
|
|
9
|
+
timestampIso: string;
|
|
12
10
|
} | undefined;
|
|
13
|
-
export type ExecutionProps = Omit<avs_pb.Execution.AsObject, "stepsList" | "
|
|
11
|
+
export type ExecutionProps = Omit<avs_pb.Execution.AsObject, "stepsList" | "blockTrigger" | "fixedTimeTrigger" | "cronTrigger" | "eventTrigger" | "manualTrigger" | "triggerType"> & {
|
|
14
12
|
stepsList: Step[];
|
|
15
|
-
triggerReason: TriggerReason | undefined;
|
|
16
13
|
triggerOutput: OutputDataProps;
|
|
14
|
+
triggerType: TriggerType;
|
|
17
15
|
};
|
|
18
16
|
declare class Execution implements ExecutionProps {
|
|
19
17
|
id: string;
|
|
@@ -22,8 +20,8 @@ declare class Execution implements ExecutionProps {
|
|
|
22
20
|
success: boolean;
|
|
23
21
|
error: string;
|
|
24
22
|
stepsList: Step[];
|
|
25
|
-
triggerReason: TriggerReason | undefined;
|
|
26
23
|
triggerName: string;
|
|
24
|
+
triggerType: TriggerType;
|
|
27
25
|
triggerOutput: OutputDataProps;
|
|
28
26
|
constructor(props: ExecutionProps);
|
|
29
27
|
static fromResponse(execution: avs_pb.Execution): Execution;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/models/execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,
|
|
1
|
+
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/models/execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAwB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,IAAI,MAAM,QAAQ,CAAC;AAE1B,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;AAEvD,MAAM,MAAM,eAAe,GACvB,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,GACnC,MAAM,CAAC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|
-
import
|
|
2
|
+
import { TriggerTypeConverter } from "@avaprotocol/types";
|
|
3
3
|
import Step from "./step";
|
|
4
4
|
class Execution {
|
|
5
5
|
constructor(props) {
|
|
@@ -10,7 +10,7 @@ class Execution {
|
|
|
10
10
|
this.error = props.error;
|
|
11
11
|
this.stepsList = props.stepsList;
|
|
12
12
|
this.triggerName = props.triggerName;
|
|
13
|
-
this.
|
|
13
|
+
this.triggerType = props.triggerType;
|
|
14
14
|
this.triggerOutput = props.triggerOutput;
|
|
15
15
|
}
|
|
16
16
|
static fromResponse(execution) {
|
|
@@ -24,13 +24,19 @@ class Execution {
|
|
|
24
24
|
break;
|
|
25
25
|
case avs_pb.Execution.OutputDataCase.FIXED_TIME_TRIGGER:
|
|
26
26
|
const fixedTimeOutput = execution.getFixedTimeTrigger()?.toObject();
|
|
27
|
-
//
|
|
28
|
-
triggerOutputData = fixedTimeOutput ? {
|
|
27
|
+
// Updated to use timestamp and timestampIso instead of epoch
|
|
28
|
+
triggerOutputData = fixedTimeOutput ? {
|
|
29
|
+
timestamp: fixedTimeOutput.timestamp,
|
|
30
|
+
timestampIso: fixedTimeOutput.timestampIso
|
|
31
|
+
} : undefined;
|
|
29
32
|
break;
|
|
30
33
|
case avs_pb.Execution.OutputDataCase.CRON_TRIGGER:
|
|
31
34
|
const cronOutput = execution.getCronTrigger()?.toObject();
|
|
32
|
-
//
|
|
33
|
-
triggerOutputData = cronOutput ? {
|
|
35
|
+
// Updated to use timestamp and timestampIso instead of epoch (removed scheduleMatched as it doesn't exist)
|
|
36
|
+
triggerOutputData = cronOutput ? {
|
|
37
|
+
timestamp: cronOutput.timestamp,
|
|
38
|
+
timestampIso: cronOutput.timestampIso
|
|
39
|
+
} : undefined;
|
|
34
40
|
break;
|
|
35
41
|
case avs_pb.Execution.OutputDataCase.EVENT_TRIGGER:
|
|
36
42
|
const eventTrigger = execution.getEventTrigger();
|
|
@@ -43,6 +49,10 @@ class Execution {
|
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
break;
|
|
52
|
+
case avs_pb.Execution.OutputDataCase.MANUAL_TRIGGER:
|
|
53
|
+
const manualOutput = execution.getManualTrigger()?.toObject();
|
|
54
|
+
triggerOutputData = manualOutput || undefined;
|
|
55
|
+
break;
|
|
46
56
|
case avs_pb.Execution.OutputDataCase.OUTPUT_DATA_NOT_SET:
|
|
47
57
|
triggerOutputData = undefined;
|
|
48
58
|
break;
|
|
@@ -54,7 +64,7 @@ class Execution {
|
|
|
54
64
|
success: execution.getSuccess(),
|
|
55
65
|
error: execution.getError(),
|
|
56
66
|
triggerName: execution.getTriggerName(),
|
|
57
|
-
|
|
67
|
+
triggerType: TriggerTypeConverter.fromProtobuf(execution.getTriggerType()), // Convert protobuf enum to SDK enum
|
|
58
68
|
triggerOutput: triggerOutputData,
|
|
59
69
|
stepsList: execution
|
|
60
70
|
.getStepsList()
|
|
@@ -16,6 +16,7 @@ declare class CronTrigger extends Trigger {
|
|
|
16
16
|
getOutput(): CronTriggerOutput | undefined;
|
|
17
17
|
/**
|
|
18
18
|
* Extract output data from RunTriggerResp for cron triggers
|
|
19
|
+
* Updated to handle timestamp and timestamp_iso instead of epoch
|
|
19
20
|
* @param outputData - The RunTriggerResp containing cron trigger output
|
|
20
21
|
* @returns Plain JavaScript object with cron trigger data
|
|
21
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/cron.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,EAAE,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAe,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGzF,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAE5E,cAAM,WAAY,SAAQ,OAAO;gBACnB,KAAK,EAAE,gBAAgB;IAInC,SAAS,IAAI,MAAM,CAAC,WAAW;IAmB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,WAAW;IAuBzD;;;;OAIG;IACH,SAAS,IAAI,iBAAiB,GAAG,SAAS;IAI1C
|
|
1
|
+
{"version":3,"file":"cron.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/cron.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,EAAE,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAe,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGzF,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAE5E,cAAM,WAAY,SAAQ,OAAO;gBACnB,KAAK,EAAE,gBAAgB;IAInC,SAAS,IAAI,MAAM,CAAC,WAAW;IAmB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,WAAW;IAuBzD;;;;OAIG;IACH,SAAS,IAAI,iBAAiB,GAAG,SAAS;IAI1C;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -47,12 +47,20 @@ class CronTrigger extends Trigger {
|
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Extract output data from RunTriggerResp for cron triggers
|
|
50
|
+
* Updated to handle timestamp and timestamp_iso instead of epoch
|
|
50
51
|
* @param outputData - The RunTriggerResp containing cron trigger output
|
|
51
52
|
* @returns Plain JavaScript object with cron trigger data
|
|
52
53
|
*/
|
|
53
54
|
static fromOutputData(outputData) {
|
|
54
55
|
const cronOutput = outputData.getCronTrigger();
|
|
55
|
-
|
|
56
|
+
if (!cronOutput)
|
|
57
|
+
return null;
|
|
58
|
+
const outputObj = cronOutput.toObject();
|
|
59
|
+
// The output now contains timestamp and timestampIso instead of epoch
|
|
60
|
+
return {
|
|
61
|
+
timestamp: outputObj.timestamp,
|
|
62
|
+
timestampIso: outputObj.timestampIso
|
|
63
|
+
};
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
66
|
export default CronTrigger;
|
|
@@ -16,6 +16,7 @@ declare class FixedTimeTrigger extends Trigger {
|
|
|
16
16
|
getOutput(): FixedTimeTriggerOutput | undefined;
|
|
17
17
|
/**
|
|
18
18
|
* Extract output data from RunTriggerResp for fixed time triggers
|
|
19
|
+
* Updated to handle timestamp and timestamp_iso instead of epoch
|
|
19
20
|
* @param outputData - The RunTriggerResp containing fixed time trigger output
|
|
20
21
|
* @returns Plain JavaScript object with fixed time trigger data
|
|
21
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixedTime.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/fixedTime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,EAAE,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAe,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGnG,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG;IACjD,IAAI,EAAE,wBAAwB,CAAC;CAChC,CAAC;AAEF,cAAM,gBAAiB,SAAQ,OAAO;gBACxB,KAAK,EAAE,qBAAqB;IAIxC,SAAS,IAAI,MAAM,CAAC,WAAW;IAmB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,gBAAgB;IAuB9D;;;;OAIG;IACH,SAAS,IAAI,sBAAsB,GAAG,SAAS;IAI/C
|
|
1
|
+
{"version":3,"file":"fixedTime.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/fixedTime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,EAAE,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAe,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGnG,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG;IACjD,IAAI,EAAE,wBAAwB,CAAC;CAChC,CAAC;AAEF,cAAM,gBAAiB,SAAQ,OAAO;gBACxB,KAAK,EAAE,qBAAqB;IAIxC,SAAS,IAAI,MAAM,CAAC,WAAW;IAmB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,gBAAgB;IAuB9D;;;;OAIG;IACH,SAAS,IAAI,sBAAsB,GAAG,SAAS;IAI/C;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -47,12 +47,20 @@ class FixedTimeTrigger extends Trigger {
|
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Extract output data from RunTriggerResp for fixed time triggers
|
|
50
|
+
* Updated to handle timestamp and timestamp_iso instead of epoch
|
|
50
51
|
* @param outputData - The RunTriggerResp containing fixed time trigger output
|
|
51
52
|
* @returns Plain JavaScript object with fixed time trigger data
|
|
52
53
|
*/
|
|
53
54
|
static fromOutputData(outputData) {
|
|
54
55
|
const fixedTimeOutput = outputData.getFixedTimeTrigger();
|
|
55
|
-
|
|
56
|
+
if (!fixedTimeOutput)
|
|
57
|
+
return null;
|
|
58
|
+
const outputObj = fixedTimeOutput.toObject();
|
|
59
|
+
// The output now contains timestamp and timestampIso instead of epoch
|
|
60
|
+
return {
|
|
61
|
+
timestamp: outputObj.timestamp,
|
|
62
|
+
timestampIso: outputObj.timestampIso
|
|
63
|
+
};
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
66
|
export default FixedTimeTrigger;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avaprotocol/sdk-js",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.8",
|
|
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",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"clean": "rm -rf node_modules dist tsconfig.tsbuildinfo"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@avaprotocol/types": "1.0.
|
|
33
|
+
"@avaprotocol/types": "1.0.8",
|
|
34
34
|
"@grpc/grpc-js": "^1.11.3",
|
|
35
35
|
"@grpc/proto-loader": "^0.7.13",
|
|
36
36
|
"dotenv": "^16.4.5",
|