Skip to content

Commit

Permalink
fix autotask & action conditions names (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
MCarlomagno authored Jan 17, 2024
1 parent a495f48 commit 96198bf
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
8 changes: 4 additions & 4 deletions examples/create-monitor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ async function main() {
// optional
txCondition: 'gasPrice > 0',
// optional
autotaskCondition: '3dcfee82-f5bd-43e3-8480-0676e5c28964',
actionCondition: '3dcfee82-f5bd-43e3-8480-0676e5c28964',
// optional
autotaskTrigger: undefined,
actionTrigger: undefined,
// optional
alertThreshold: {
amount: 2,
Expand Down Expand Up @@ -79,9 +79,9 @@ async function main() {
// optional
paused: false,
// optional
autotaskCondition: '3dcfee82-f5bd-43e3-8480-0676e5c28964',
actionCondition: '3dcfee82-f5bd-43e3-8480-0676e5c28964',
// optional
autotaskTrigger: undefined,
actionTrigger: undefined,
// optional
alertThreshold: {
amount: 2,
Expand Down
4 changes: 2 additions & 2 deletions examples/update-monitor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ async function main() {
// optional
txCondition: 'gasPrice > 0',
// optional
autotaskCondition: '3dcfee82-f5bd-43e3-8480-0676e5c28964',
actionCondition: '3dcfee82-f5bd-43e3-8480-0676e5c28964',
// optional
autotaskTrigger: undefined,
actionTrigger: undefined,
// optional
alertThreshold: {
amount: 2,
Expand Down
2 changes: 1 addition & 1 deletion packages/action/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function tailLogsFor(client: ActionClient, actionId: string) {
console.log(`\n${runDetails.decodedLogs}`);
} else if (status === 'throttled') {
console.warn(
`\nThis autotask run was canceled since the hourly run capacity for your account has been exceeded. Contact us at [email protected] for additional capacity.`,
`\nThis action run was canceled since the hourly run capacity for your account has been exceeded. Contact us at [email protected] for additional capacity.`,
);
}
}
Expand Down
24 changes: 12 additions & 12 deletions packages/monitor/src/api/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ describe('MonitorClient', () => {
{
abi,
addresses: addresses,
autotaskCondition: undefined,
actionCondition: undefined,
conditions: [
{
eventConditions,
Expand All @@ -224,7 +224,7 @@ describe('MonitorClient', () => {
alertThreshold: undefined,
blockWatcherId: 'i-am-the-watcher',
notifyConfig: {
autotaskId: undefined,
actionId: undefined,
notifications: [],
timeoutMs: 0,
},
Expand All @@ -245,14 +245,14 @@ describe('MonitorClient', () => {
network,
alertThreshold: undefined,
notifyConfig: {
autotaskId: undefined,
actionId: undefined,
notifications: [],
timeoutMs: 0,
},
fortaRule: {
addresses: addresses,
agentIDs: undefined,
autotaskCondition: undefined,
actionCondition: undefined,
conditions: fortaConditions,
},
};
Expand All @@ -272,14 +272,14 @@ describe('MonitorClient', () => {
privateFortaNodeId: '0x123',
alertThreshold: undefined,
notifyConfig: {
autotaskId: undefined,
actionId: undefined,
notifications: [],
timeoutMs: 0,
},
fortaRule: {
addresses: addresses,
agentIDs: undefined,
autotaskCondition: undefined,
actionCondition: undefined,
conditions: fortaConditions,
},
};
Expand Down Expand Up @@ -323,7 +323,7 @@ describe('MonitorClient', () => {
{
abi,
addresses: addresses,
autotaskCondition: undefined,
actionCondition: undefined,
conditions: [
{
eventConditions,
Expand All @@ -341,7 +341,7 @@ describe('MonitorClient', () => {
alertThreshold: undefined,
blockWatcherId: 'i-am-the-watcher',
notifyConfig: {
autotaskId: undefined,
actionId: undefined,
notifications: [],
timeoutMs: 0,
},
Expand Down Expand Up @@ -378,14 +378,14 @@ describe('MonitorClient', () => {
network,
alertThreshold: undefined,
notifyConfig: {
autotaskId: undefined,
actionId: undefined,
notifications: [],
timeoutMs: 0,
},
fortaRule: {
addresses: addresses,
agentIDs: undefined,
autotaskCondition: undefined,
actionCondition: undefined,
conditions: fortaConditions,
},
};
Expand All @@ -410,14 +410,14 @@ describe('MonitorClient', () => {
{
abi: oldBlockMonitor.addressRules[0].abi,
addresses: oldBlockMonitor.addressRules[0].addresses,
autotaskCondition: undefined,
actionCondition: undefined,
conditions: [],
},
],
blockWatcherId: oldBlockMonitor.blockWatcherId,
network: oldBlockMonitor.network,
notifyConfig: {
autotaskId: undefined,
actionId: undefined,
notifications: [],
timeoutMs: 0,
},
Expand Down
14 changes: 7 additions & 7 deletions packages/monitor/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class MonitorClient extends BaseApiClient {
addresses: monitor.addresses,
agentIDs: monitor.agentIDs,
conditions: monitor.fortaConditions,
autotaskCondition: monitor.autotaskCondition ? { autotaskId: monitor.autotaskCondition } : undefined,
actionCondition: monitor.actionCondition ? { actionId: monitor.actionCondition } : undefined,
},
privateFortaNodeId: monitor.privateFortaNodeId,
network: monitor.network,
Expand Down Expand Up @@ -261,7 +261,7 @@ export class MonitorClient extends BaseApiClient {
addressRules: [
{
conditions: getConditionSets(conditions.txExpression, conditions.events, conditions.functions),
autotaskCondition: monitor.autotaskCondition ? { autotaskId: monitor.autotaskCondition } : undefined,
actionCondition: monitor.actionCondition ? { actionId: monitor.actionCondition } : undefined,
addresses: monitor.addresses,
abi: this.normaliseABI(monitor.abi),
},
Expand Down Expand Up @@ -305,7 +305,7 @@ export class MonitorClient extends BaseApiClient {
notifyConfig: {
notifications: notificationChannels,
notificationCategoryId: _.isEmpty(notificationChannels) ? monitor.notificationCategoryId : undefined,
autotaskId: monitor.autotaskTrigger ? monitor.autotaskTrigger : undefined,
actionId: monitor.actionTrigger ? monitor.actionTrigger : undefined,
timeoutMs: monitor.alertTimeoutMs ? monitor.alertTimeoutMs : 0,
messageBody: monitor.alertMessageBody ? monitor.alertMessageBody : undefined,
messageSubject: monitor.alertMessageSubject ? monitor.alertMessageSubject : undefined,
Expand Down Expand Up @@ -340,8 +340,8 @@ export class MonitorClient extends BaseApiClient {
paused: monitor.paused,
skipABIValidation: monitor.skipABIValidation,
alertThreshold: monitor.alertThreshold,
autotaskCondition: rule.autotaskCondition?.autotaskId,
autotaskTrigger: monitor.notifyConfig?.autotaskId,
actionCondition: rule.actionCondition?.actionId,
actionTrigger: monitor.notifyConfig?.actionId,
alertTimeoutMs: monitor.notifyConfig?.timeoutMs,
alertMessageSubject: monitor.notifyConfig?.messageSubject,
alertMessageBody: monitor.notifyConfig?.messageBody,
Expand All @@ -358,8 +358,8 @@ export class MonitorClient extends BaseApiClient {
name: monitor.name,
paused: monitor.paused,
alertThreshold: monitor.alertThreshold,
autotaskCondition: monitor.fortaRule.autotaskCondition?.autotaskId,
autotaskTrigger: monitor.notifyConfig?.autotaskId,
actionCondition: monitor.fortaRule.actionCondition?.actionId,
actionTrigger: monitor.notifyConfig?.actionId,
alertTimeoutMs: monitor.notifyConfig?.timeoutMs,
alertMessageSubject: monitor.notifyConfig?.messageSubject,
alertMessageBody: monitor.notifyConfig?.messageBody,
Expand Down
14 changes: 7 additions & 7 deletions packages/monitor/src/models/monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export interface ExternalBaseCreateMonitorRequest {
abi?: string;
paused?: boolean;
alertThreshold?: Threshold;
autotaskCondition?: string;
autotaskTrigger?: string;
actionCondition?: string;
actionTrigger?: string;
alertTimeoutMs?: number;
alertMessageBody?: string;
alertMessageSubject?: string;
Expand Down Expand Up @@ -114,7 +114,7 @@ export interface FortaRule {
// agentIDs should be a list of Bot IDs
agentIDs?: string[];
conditions: FortaConditionSet;
autotaskCondition?: AutotaskCondition;
actionCondition?: ActionCondition;
}
export interface FortaConditionSet {
alertIDs?: string[];
Expand All @@ -132,7 +132,7 @@ export type MonitorRiskCategory = 'NONE' | 'GOVERNANCE' | 'ACCESS-CONTROL' | 'SU
export type Address = string;
export interface AddressRule {
conditions: ConditionSet[];
autotaskCondition?: AutotaskCondition;
actionCondition?: ActionCondition;
addresses: Address[];
abi?: string;
}
Expand All @@ -153,8 +153,8 @@ export interface FunctionCondition {
functionSignature: string;
expression?: string | null;
}
export interface AutotaskCondition {
autotaskId: string;
export interface ActionCondition {
actionId: string;
}
export interface Threshold {
amount: number;
Expand All @@ -163,7 +163,7 @@ export interface Threshold {
export interface Notifications {
notifications: NotificationReference[];
notificationCategoryId?: string;
autotaskId?: string;
actionId?: string;
messageBody?: string;
messageSubject?: string;
timeoutMs: number;
Expand Down

0 comments on commit 96198bf

Please sign in to comment.