@avaprotocol/sdk-js 1.3.4-dev.3 → 1.3.4

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/dist/index.d.mts CHANGED
@@ -3,9 +3,7 @@ import { Metadata } from '@grpc/grpc-js';
3
3
  import * as jspb from 'google-protobuf';
4
4
  import * as google_protobuf_timestamp_pb from 'google-protobuf/google/protobuf/timestamp_pb';
5
5
  import * as google_protobuf_wrappers_pb from 'google-protobuf/google/protobuf/wrappers_pb';
6
- import { NodeType } from '@avaprotocol/types';
7
-
8
- declare const getKeyRequestMessage: (chainId: number, address: string, issuedAt: string, expiredAt: string) => string;
6
+ import { NodeType, GetKeyRequestApiKey, GetKeyResponse, GetKeyRequestSignature } from '@avaprotocol/types';
9
7
 
10
8
  // package: aggregator
11
9
  // file: avs.proto
@@ -97,6 +95,10 @@ declare namespace BlockCondition {
97
95
  }
98
96
 
99
97
  declare class EventCondition extends jspb.Message {
98
+ clearMatcherList(): void;
99
+ getMatcherList(): Array<EventCondition.Matcher>;
100
+ setMatcherList(value: Array<EventCondition.Matcher>): EventCondition;
101
+ addMatcher(value?: EventCondition.Matcher, index?: number): EventCondition.Matcher;
100
102
  getExpression(): string;
101
103
  setExpression(value: string): EventCondition;
102
104
 
@@ -112,6 +114,7 @@ declare class EventCondition extends jspb.Message {
112
114
 
113
115
  declare namespace EventCondition {
114
116
  export type AsObject = {
117
+ matcherList: Array<EventCondition.Matcher.AsObject>,
115
118
  expression: string,
116
119
  }
117
120
 
@@ -238,8 +241,6 @@ declare class ContractWriteNode$1 extends jspb.Message {
238
241
  setCallData(value: string): ContractWriteNode$1;
239
242
  getContractAbi(): string;
240
243
  setContractAbi(value: string): ContractWriteNode$1;
241
- getMethod(): string;
242
- setMethod(value: string): ContractWriteNode$1;
243
244
 
244
245
  serializeBinary(): Uint8Array;
245
246
  toObject(includeInstance?: boolean): ContractWriteNode$1.AsObject;
@@ -256,7 +257,6 @@ declare namespace ContractWriteNode$1 {
256
257
  contractAddress: string,
257
258
  callData: string,
258
259
  contractAbi: string,
259
- method: string,
260
260
  }
261
261
  }
262
262
 
@@ -267,8 +267,6 @@ declare class ContractReadNode$1 extends jspb.Message {
267
267
  setCallData(value: string): ContractReadNode$1;
268
268
  getContractAbi(): string;
269
269
  setContractAbi(value: string): ContractReadNode$1;
270
- getMethod(): string;
271
- setMethod(value: string): ContractReadNode$1;
272
270
 
273
271
  serializeBinary(): Uint8Array;
274
272
  toObject(includeInstance?: boolean): ContractReadNode$1.AsObject;
@@ -285,7 +283,6 @@ declare namespace ContractReadNode$1 {
285
283
  contractAddress: string,
286
284
  callData: string,
287
285
  contractAbi: string,
288
- method: string,
289
286
  }
290
287
  }
291
288
 
@@ -1667,7 +1664,6 @@ declare class Node implements NodeProps {
1667
1664
  data: NodeData;
1668
1665
  constructor(props: NodeProps);
1669
1666
  toRequest(): TaskNode;
1670
- toJson(): Record<string, any>;
1671
1667
  }
1672
1668
 
1673
1669
  type EdgeProps = TaskEdge.AsObject;
@@ -1678,7 +1674,6 @@ declare class Edge implements EdgeProps {
1678
1674
  constructor(edge: EdgeProps);
1679
1675
  static fromResponse(edge: TaskEdge): Edge;
1680
1676
  toRequest(): TaskEdge;
1681
- toJson(): Record<string, any>;
1682
1677
  }
1683
1678
 
1684
1679
  type Environment = "production" | "development" | "staging";
@@ -1695,9 +1690,6 @@ interface GetWorkflowsRequest extends RequestOptions {
1695
1690
  cursor?: string;
1696
1691
  limit?: number;
1697
1692
  }
1698
- interface GetKeyResponse {
1699
- authKey: string;
1700
- }
1701
1693
  interface GetWalletRequest {
1702
1694
  salt: string;
1703
1695
  factoryAddress?: string;
@@ -1743,7 +1735,7 @@ interface DeleteSecretRequest {
1743
1735
  orgId: string;
1744
1736
  }
1745
1737
 
1746
- type TriggerData = FixedTimeCondition.AsObject | CronCondition.AsObject | BlockCondition.AsObject | EventCondition.AsObject;
1738
+ type TriggerData = FixedTimeCondition.AsObject | CronCondition.AsObject | BlockCondition.AsObject | EventCondition.AsObject | null;
1747
1739
  type TriggerProps = Omit<TaskTrigger.AsObject, "manual" | "fixedTime" | "cron" | "block" | "event"> & {
1748
1740
  type: TriggerType;
1749
1741
  data: TriggerData;
@@ -1759,7 +1751,6 @@ declare class Trigger implements TriggerProps {
1759
1751
  */
1760
1752
  constructor(props: TriggerProps);
1761
1753
  toRequest(): TaskTrigger;
1762
- toJson(): Record<string, any>;
1763
1754
  }
1764
1755
 
1765
1756
  type WorkflowProps = Omit<Task.AsObject, "id" | "owner" | "completedAt" | "status" | "executionsList" | "name" | "trigger" | "nodesList" | "edgesList" | "totalExecution" | "lastRanAt"> & {
@@ -1977,7 +1968,13 @@ declare class CronTrigger extends Trigger {
1977
1968
  static fromResponse(raw: TaskTrigger): CronTrigger;
1978
1969
  }
1979
1970
 
1980
- type EventTriggerDataType = Pick<EventCondition.AsObject, "expression">;
1971
+ interface EventMatcher {
1972
+ type: string;
1973
+ value: string[];
1974
+ }
1975
+ type EventTriggerDataType = EventCondition.AsObject & {
1976
+ matcher?: EventMatcher[];
1977
+ };
1981
1978
  type EventTriggerProps = TriggerProps & {
1982
1979
  data: EventTriggerDataType;
1983
1980
  };
@@ -2037,32 +2034,24 @@ declare class BaseClient {
2037
2034
  isAuthKeyValid(key: string): boolean;
2038
2035
  /**
2039
2036
  * The API key could retrieve a wallet’s authKey by skipping its signature verification
2037
+ * @param chainId - The chain id
2040
2038
  * @param address - The address of the EOA wallet
2039
+ * @param issuedAt - The issued at timestamp
2040
+ * @param expiredAt - The expiration timestamp
2041
2041
  * @param apiKey - The API key
2042
- * @param expiredAtEpoch - The expiration epoch
2043
2042
  * @returns {Promise<GetKeyResponse>} - The response from the auth call
2044
2043
  */
2045
- authWithAPIKey({ chainId, address, issuedAt, expiredAt, apiKey, }: {
2046
- chainId: number;
2047
- address: string;
2048
- issuedAt: Date;
2049
- expiredAt: Date;
2050
- apiKey: string;
2051
- }): Promise<GetKeyResponse>;
2044
+ authWithAPIKey({ chainId, address, issuedAt, expiredAt, apiKey, }: GetKeyRequestApiKey): Promise<GetKeyResponse>;
2052
2045
  /**
2053
2046
  * Getting an authKey from the server by verifying the signature of an EOA wallet
2047
+ * @param chainId - The chain id
2054
2048
  * @param address - The address of the EOA wallet
2049
+ * @param issuedAt - The issued at timestamp
2050
+ * @param expiredAt - The expiration timestamp
2055
2051
  * @param signature - The signature of the EOA wallet
2056
- * @param expiredAtEpoch - The expiration epoch
2057
2052
  * @returns {Promise<GetKeyResponse>} - The response from the auth call
2058
2053
  */
2059
- authWithSignature({ chainId, address, issuedAt, expiredAt, signature, }: {
2060
- chainId: number;
2061
- address: string;
2062
- issuedAt: Date;
2063
- expiredAt: Date;
2064
- signature: string;
2065
- }): Promise<GetKeyResponse>;
2054
+ authWithSignature({ chainId, address, issuedAt, expiredAt, signature, }: GetKeyRequestSignature): Promise<GetKeyResponse>;
2066
2055
  /**
2067
2056
  * The client could choose to store the authKey and use it for all requests; setting it to undefined will unset the authKey
2068
2057
  * The authKey can be overridden at the request level by request options
@@ -2203,4 +2192,4 @@ declare class Client extends BaseClient {
2203
2192
  updateSecret(secret: Secret, options?: RequestOptions): Promise<boolean>;
2204
2193
  }
2205
2194
 
2206
- export { AUTH_KEY_HEADER, BlockTrigger, type BlockTriggerDataType, type BlockTriggerProps, BranchNode, type BranchNodeData, type BranchNodeProps, type ClientOption, ContractReadNode, type ContractReadNodeData, type ContractReadNodeProps, ContractWriteNode, type ContractWriteNodeData, type ContractWriteNodeProps, CronTrigger, type CronTriggerDataType, type CronTriggerProps, CustomCodeLangs, CustomCodeNode, type CustomCodeNodeData, type CustomCodeNodeProps, DEFAULT_LIMIT, type DeleteSecretRequest, ETHTransferNode, type ETHTransferNodeData, type ETHTransferNodeProps, Edge, type EdgeProps, type Environment, EventTrigger, type EventTriggerDataType, type EventTriggerProps, Execution, ExecutionStatus, FilterNode, type FilterNodeData, type FilterNodeProps, FixedTimeTrigger, type FixedTimeTriggerDataType, type FixedTimeTriggerProps, type GetExecutionsRequest, type GetKeyResponse, type GetWalletRequest, type GetWorkflowsRequest, GraphQLQueryNode, type GraphQLQueryNodeData, type GraphQLQueryNodeProps, type ListSecretRequest, type ListSecretResponse, Node, NodeFactory, type NodeProps, type RequestOptions, RestAPINode, type RestAPINodeData, type RestAPINodeProps, Secret, type SmartWallet, Trigger, TriggerFactory, type TriggerProps, TriggerType, Workflow, type WorkflowProps, WorkflowStatus, Client as default, getKeyRequestMessage };
2195
+ export { AUTH_KEY_HEADER, BlockTrigger, type BlockTriggerDataType, type BlockTriggerProps, BranchNode, type BranchNodeData, type BranchNodeProps, type ClientOption, ContractReadNode, type ContractReadNodeData, type ContractReadNodeProps, ContractWriteNode, type ContractWriteNodeData, type ContractWriteNodeProps, CronTrigger, type CronTriggerDataType, type CronTriggerProps, CustomCodeLangs, CustomCodeNode, type CustomCodeNodeData, type CustomCodeNodeProps, DEFAULT_LIMIT, type DeleteSecretRequest, ETHTransferNode, type ETHTransferNodeData, type ETHTransferNodeProps, Edge, type EdgeProps, type Environment, EventTrigger, type EventTriggerDataType, type EventTriggerProps, Execution, ExecutionStatus, FilterNode, type FilterNodeData, type FilterNodeProps, FixedTimeTrigger, type FixedTimeTriggerDataType, type FixedTimeTriggerProps, type GetExecutionsRequest, type GetWalletRequest, type GetWorkflowsRequest, GraphQLQueryNode, type GraphQLQueryNodeData, type GraphQLQueryNodeProps, type ListSecretRequest, type ListSecretResponse, Node, NodeFactory, type NodeProps, type RequestOptions, RestAPINode, type RestAPINodeData, type RestAPINodeProps, Secret, type SmartWallet, Trigger, TriggerFactory, type TriggerProps, TriggerType, Workflow, type WorkflowProps, WorkflowStatus, Client as default };
package/dist/index.d.ts CHANGED
@@ -3,9 +3,7 @@ import { Metadata } from '@grpc/grpc-js';
3
3
  import * as jspb from 'google-protobuf';
4
4
  import * as google_protobuf_timestamp_pb from 'google-protobuf/google/protobuf/timestamp_pb';
5
5
  import * as google_protobuf_wrappers_pb from 'google-protobuf/google/protobuf/wrappers_pb';
6
- import { NodeType } from '@avaprotocol/types';
7
-
8
- declare const getKeyRequestMessage: (chainId: number, address: string, issuedAt: string, expiredAt: string) => string;
6
+ import { NodeType, GetKeyRequestApiKey, GetKeyResponse, GetKeyRequestSignature } from '@avaprotocol/types';
9
7
 
10
8
  // package: aggregator
11
9
  // file: avs.proto
@@ -97,6 +95,10 @@ declare namespace BlockCondition {
97
95
  }
98
96
 
99
97
  declare class EventCondition extends jspb.Message {
98
+ clearMatcherList(): void;
99
+ getMatcherList(): Array<EventCondition.Matcher>;
100
+ setMatcherList(value: Array<EventCondition.Matcher>): EventCondition;
101
+ addMatcher(value?: EventCondition.Matcher, index?: number): EventCondition.Matcher;
100
102
  getExpression(): string;
101
103
  setExpression(value: string): EventCondition;
102
104
 
@@ -112,6 +114,7 @@ declare class EventCondition extends jspb.Message {
112
114
 
113
115
  declare namespace EventCondition {
114
116
  export type AsObject = {
117
+ matcherList: Array<EventCondition.Matcher.AsObject>,
115
118
  expression: string,
116
119
  }
117
120
 
@@ -238,8 +241,6 @@ declare class ContractWriteNode$1 extends jspb.Message {
238
241
  setCallData(value: string): ContractWriteNode$1;
239
242
  getContractAbi(): string;
240
243
  setContractAbi(value: string): ContractWriteNode$1;
241
- getMethod(): string;
242
- setMethod(value: string): ContractWriteNode$1;
243
244
 
244
245
  serializeBinary(): Uint8Array;
245
246
  toObject(includeInstance?: boolean): ContractWriteNode$1.AsObject;
@@ -256,7 +257,6 @@ declare namespace ContractWriteNode$1 {
256
257
  contractAddress: string,
257
258
  callData: string,
258
259
  contractAbi: string,
259
- method: string,
260
260
  }
261
261
  }
262
262
 
@@ -267,8 +267,6 @@ declare class ContractReadNode$1 extends jspb.Message {
267
267
  setCallData(value: string): ContractReadNode$1;
268
268
  getContractAbi(): string;
269
269
  setContractAbi(value: string): ContractReadNode$1;
270
- getMethod(): string;
271
- setMethod(value: string): ContractReadNode$1;
272
270
 
273
271
  serializeBinary(): Uint8Array;
274
272
  toObject(includeInstance?: boolean): ContractReadNode$1.AsObject;
@@ -285,7 +283,6 @@ declare namespace ContractReadNode$1 {
285
283
  contractAddress: string,
286
284
  callData: string,
287
285
  contractAbi: string,
288
- method: string,
289
286
  }
290
287
  }
291
288
 
@@ -1667,7 +1664,6 @@ declare class Node implements NodeProps {
1667
1664
  data: NodeData;
1668
1665
  constructor(props: NodeProps);
1669
1666
  toRequest(): TaskNode;
1670
- toJson(): Record<string, any>;
1671
1667
  }
1672
1668
 
1673
1669
  type EdgeProps = TaskEdge.AsObject;
@@ -1678,7 +1674,6 @@ declare class Edge implements EdgeProps {
1678
1674
  constructor(edge: EdgeProps);
1679
1675
  static fromResponse(edge: TaskEdge): Edge;
1680
1676
  toRequest(): TaskEdge;
1681
- toJson(): Record<string, any>;
1682
1677
  }
1683
1678
 
1684
1679
  type Environment = "production" | "development" | "staging";
@@ -1695,9 +1690,6 @@ interface GetWorkflowsRequest extends RequestOptions {
1695
1690
  cursor?: string;
1696
1691
  limit?: number;
1697
1692
  }
1698
- interface GetKeyResponse {
1699
- authKey: string;
1700
- }
1701
1693
  interface GetWalletRequest {
1702
1694
  salt: string;
1703
1695
  factoryAddress?: string;
@@ -1743,7 +1735,7 @@ interface DeleteSecretRequest {
1743
1735
  orgId: string;
1744
1736
  }
1745
1737
 
1746
- type TriggerData = FixedTimeCondition.AsObject | CronCondition.AsObject | BlockCondition.AsObject | EventCondition.AsObject;
1738
+ type TriggerData = FixedTimeCondition.AsObject | CronCondition.AsObject | BlockCondition.AsObject | EventCondition.AsObject | null;
1747
1739
  type TriggerProps = Omit<TaskTrigger.AsObject, "manual" | "fixedTime" | "cron" | "block" | "event"> & {
1748
1740
  type: TriggerType;
1749
1741
  data: TriggerData;
@@ -1759,7 +1751,6 @@ declare class Trigger implements TriggerProps {
1759
1751
  */
1760
1752
  constructor(props: TriggerProps);
1761
1753
  toRequest(): TaskTrigger;
1762
- toJson(): Record<string, any>;
1763
1754
  }
1764
1755
 
1765
1756
  type WorkflowProps = Omit<Task.AsObject, "id" | "owner" | "completedAt" | "status" | "executionsList" | "name" | "trigger" | "nodesList" | "edgesList" | "totalExecution" | "lastRanAt"> & {
@@ -1977,7 +1968,13 @@ declare class CronTrigger extends Trigger {
1977
1968
  static fromResponse(raw: TaskTrigger): CronTrigger;
1978
1969
  }
1979
1970
 
1980
- type EventTriggerDataType = Pick<EventCondition.AsObject, "expression">;
1971
+ interface EventMatcher {
1972
+ type: string;
1973
+ value: string[];
1974
+ }
1975
+ type EventTriggerDataType = EventCondition.AsObject & {
1976
+ matcher?: EventMatcher[];
1977
+ };
1981
1978
  type EventTriggerProps = TriggerProps & {
1982
1979
  data: EventTriggerDataType;
1983
1980
  };
@@ -2037,32 +2034,24 @@ declare class BaseClient {
2037
2034
  isAuthKeyValid(key: string): boolean;
2038
2035
  /**
2039
2036
  * The API key could retrieve a wallet’s authKey by skipping its signature verification
2037
+ * @param chainId - The chain id
2040
2038
  * @param address - The address of the EOA wallet
2039
+ * @param issuedAt - The issued at timestamp
2040
+ * @param expiredAt - The expiration timestamp
2041
2041
  * @param apiKey - The API key
2042
- * @param expiredAtEpoch - The expiration epoch
2043
2042
  * @returns {Promise<GetKeyResponse>} - The response from the auth call
2044
2043
  */
2045
- authWithAPIKey({ chainId, address, issuedAt, expiredAt, apiKey, }: {
2046
- chainId: number;
2047
- address: string;
2048
- issuedAt: Date;
2049
- expiredAt: Date;
2050
- apiKey: string;
2051
- }): Promise<GetKeyResponse>;
2044
+ authWithAPIKey({ chainId, address, issuedAt, expiredAt, apiKey, }: GetKeyRequestApiKey): Promise<GetKeyResponse>;
2052
2045
  /**
2053
2046
  * Getting an authKey from the server by verifying the signature of an EOA wallet
2047
+ * @param chainId - The chain id
2054
2048
  * @param address - The address of the EOA wallet
2049
+ * @param issuedAt - The issued at timestamp
2050
+ * @param expiredAt - The expiration timestamp
2055
2051
  * @param signature - The signature of the EOA wallet
2056
- * @param expiredAtEpoch - The expiration epoch
2057
2052
  * @returns {Promise<GetKeyResponse>} - The response from the auth call
2058
2053
  */
2059
- authWithSignature({ chainId, address, issuedAt, expiredAt, signature, }: {
2060
- chainId: number;
2061
- address: string;
2062
- issuedAt: Date;
2063
- expiredAt: Date;
2064
- signature: string;
2065
- }): Promise<GetKeyResponse>;
2054
+ authWithSignature({ chainId, address, issuedAt, expiredAt, signature, }: GetKeyRequestSignature): Promise<GetKeyResponse>;
2066
2055
  /**
2067
2056
  * The client could choose to store the authKey and use it for all requests; setting it to undefined will unset the authKey
2068
2057
  * The authKey can be overridden at the request level by request options
@@ -2203,4 +2192,4 @@ declare class Client extends BaseClient {
2203
2192
  updateSecret(secret: Secret, options?: RequestOptions): Promise<boolean>;
2204
2193
  }
2205
2194
 
2206
- export { AUTH_KEY_HEADER, BlockTrigger, type BlockTriggerDataType, type BlockTriggerProps, BranchNode, type BranchNodeData, type BranchNodeProps, type ClientOption, ContractReadNode, type ContractReadNodeData, type ContractReadNodeProps, ContractWriteNode, type ContractWriteNodeData, type ContractWriteNodeProps, CronTrigger, type CronTriggerDataType, type CronTriggerProps, CustomCodeLangs, CustomCodeNode, type CustomCodeNodeData, type CustomCodeNodeProps, DEFAULT_LIMIT, type DeleteSecretRequest, ETHTransferNode, type ETHTransferNodeData, type ETHTransferNodeProps, Edge, type EdgeProps, type Environment, EventTrigger, type EventTriggerDataType, type EventTriggerProps, Execution, ExecutionStatus, FilterNode, type FilterNodeData, type FilterNodeProps, FixedTimeTrigger, type FixedTimeTriggerDataType, type FixedTimeTriggerProps, type GetExecutionsRequest, type GetKeyResponse, type GetWalletRequest, type GetWorkflowsRequest, GraphQLQueryNode, type GraphQLQueryNodeData, type GraphQLQueryNodeProps, type ListSecretRequest, type ListSecretResponse, Node, NodeFactory, type NodeProps, type RequestOptions, RestAPINode, type RestAPINodeData, type RestAPINodeProps, Secret, type SmartWallet, Trigger, TriggerFactory, type TriggerProps, TriggerType, Workflow, type WorkflowProps, WorkflowStatus, Client as default, getKeyRequestMessage };
2195
+ export { AUTH_KEY_HEADER, BlockTrigger, type BlockTriggerDataType, type BlockTriggerProps, BranchNode, type BranchNodeData, type BranchNodeProps, type ClientOption, ContractReadNode, type ContractReadNodeData, type ContractReadNodeProps, ContractWriteNode, type ContractWriteNodeData, type ContractWriteNodeProps, CronTrigger, type CronTriggerDataType, type CronTriggerProps, CustomCodeLangs, CustomCodeNode, type CustomCodeNodeData, type CustomCodeNodeProps, DEFAULT_LIMIT, type DeleteSecretRequest, ETHTransferNode, type ETHTransferNodeData, type ETHTransferNodeProps, Edge, type EdgeProps, type Environment, EventTrigger, type EventTriggerDataType, type EventTriggerProps, Execution, ExecutionStatus, FilterNode, type FilterNodeData, type FilterNodeProps, FixedTimeTrigger, type FixedTimeTriggerDataType, type FixedTimeTriggerProps, type GetExecutionsRequest, type GetWalletRequest, type GetWorkflowsRequest, GraphQLQueryNode, type GraphQLQueryNodeData, type GraphQLQueryNodeProps, type ListSecretRequest, type ListSecretResponse, Node, NodeFactory, type NodeProps, type RequestOptions, RestAPINode, type RestAPINodeData, type RestAPINodeProps, Secret, type SmartWallet, Trigger, TriggerFactory, type TriggerProps, TriggerType, Workflow, type WorkflowProps, WorkflowStatus, Client as default };
package/dist/index.js CHANGED
@@ -140,7 +140,7 @@ var require_avs_pb = __commonJS({
140
140
  proto.aggregator.BlockCondition.displayName = "proto.aggregator.BlockCondition";
141
141
  }
142
142
  proto.aggregator.EventCondition = function(opt_data) {
143
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
143
+ jspb.Message.initialize(this, opt_data, 0, -1, proto.aggregator.EventCondition.repeatedFields_, null);
144
144
  };
145
145
  goog.inherits(proto.aggregator.EventCondition, jspb.Message);
146
146
  if (goog.DEBUG && !COMPILED) {
@@ -719,13 +719,19 @@ var require_avs_pb = __commonJS({
719
719
  proto.aggregator.BlockCondition.prototype.setInterval = function(value) {
720
720
  return jspb.Message.setProto3IntField(this, 1, value);
721
721
  };
722
+ proto.aggregator.EventCondition.repeatedFields_ = [1];
722
723
  if (jspb.Message.GENERATE_TO_OBJECT) {
723
724
  proto.aggregator.EventCondition.prototype.toObject = function(opt_includeInstance) {
724
725
  return proto.aggregator.EventCondition.toObject(opt_includeInstance, this);
725
726
  };
726
727
  proto.aggregator.EventCondition.toObject = function(includeInstance, msg) {
727
728
  var f, obj = {
728
- expression: jspb.Message.getFieldWithDefault(msg, 1, "")
729
+ matcherList: jspb.Message.toObjectList(
730
+ msg.getMatcherList(),
731
+ proto.aggregator.EventCondition.Matcher.toObject,
732
+ includeInstance
733
+ ),
734
+ expression: jspb.Message.getFieldWithDefault(msg, 2, "")
729
735
  };
730
736
  if (includeInstance) {
731
737
  obj.$jspbMessageInstance = msg;
@@ -746,6 +752,11 @@ var require_avs_pb = __commonJS({
746
752
  var field = reader.getFieldNumber();
747
753
  switch (field) {
748
754
  case 1:
755
+ var value = new proto.aggregator.EventCondition.Matcher();
756
+ reader.readMessage(value, proto.aggregator.EventCondition.Matcher.deserializeBinaryFromReader);
757
+ msg.addMatcher(value);
758
+ break;
759
+ case 2:
749
760
  var value = (
750
761
  /** @type {string} */
751
762
  reader.readString()
@@ -766,10 +777,18 @@ var require_avs_pb = __commonJS({
766
777
  };
767
778
  proto.aggregator.EventCondition.serializeBinaryToWriter = function(message, writer) {
768
779
  var f = void 0;
780
+ f = message.getMatcherList();
781
+ if (f.length > 0) {
782
+ writer.writeRepeatedMessage(
783
+ 1,
784
+ f,
785
+ proto.aggregator.EventCondition.Matcher.serializeBinaryToWriter
786
+ );
787
+ }
769
788
  f = message.getExpression();
770
789
  if (f.length > 0) {
771
790
  writer.writeString(
772
- 1,
791
+ 2,
773
792
  f
774
793
  );
775
794
  }
@@ -869,14 +888,29 @@ var require_avs_pb = __commonJS({
869
888
  proto.aggregator.EventCondition.Matcher.prototype.clearValueList = function() {
870
889
  return this.setValueList([]);
871
890
  };
891
+ proto.aggregator.EventCondition.prototype.getMatcherList = function() {
892
+ return (
893
+ /** @type{!Array<!proto.aggregator.EventCondition.Matcher>} */
894
+ jspb.Message.getRepeatedWrapperField(this, proto.aggregator.EventCondition.Matcher, 1)
895
+ );
896
+ };
897
+ proto.aggregator.EventCondition.prototype.setMatcherList = function(value) {
898
+ return jspb.Message.setRepeatedWrapperField(this, 1, value);
899
+ };
900
+ proto.aggregator.EventCondition.prototype.addMatcher = function(opt_value, opt_index) {
901
+ return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.aggregator.EventCondition.Matcher, opt_index);
902
+ };
903
+ proto.aggregator.EventCondition.prototype.clearMatcherList = function() {
904
+ return this.setMatcherList([]);
905
+ };
872
906
  proto.aggregator.EventCondition.prototype.getExpression = function() {
873
907
  return (
874
908
  /** @type {string} */
875
- jspb.Message.getFieldWithDefault(this, 1, "")
909
+ jspb.Message.getFieldWithDefault(this, 2, "")
876
910
  );
877
911
  };
878
912
  proto.aggregator.EventCondition.prototype.setExpression = function(value) {
879
- return jspb.Message.setProto3StringField(this, 1, value);
913
+ return jspb.Message.setProto3StringField(this, 2, value);
880
914
  };
881
915
  proto.aggregator.TaskTrigger.oneofGroups_ = [[2, 3, 4, 5, 6]];
882
916
  proto.aggregator.TaskTrigger.TriggerTypeCase = {
@@ -1224,8 +1258,7 @@ var require_avs_pb = __commonJS({
1224
1258
  var f, obj = {
1225
1259
  contractAddress: jspb.Message.getFieldWithDefault(msg, 1, ""),
1226
1260
  callData: jspb.Message.getFieldWithDefault(msg, 2, ""),
1227
- contractAbi: jspb.Message.getFieldWithDefault(msg, 3, ""),
1228
- method: jspb.Message.getFieldWithDefault(msg, 4, "")
1261
+ contractAbi: jspb.Message.getFieldWithDefault(msg, 3, "")
1229
1262
  };
1230
1263
  if (includeInstance) {
1231
1264
  obj.$jspbMessageInstance = msg;
@@ -1266,13 +1299,6 @@ var require_avs_pb = __commonJS({
1266
1299
  );
1267
1300
  msg.setContractAbi(value);
1268
1301
  break;
1269
- case 4:
1270
- var value = (
1271
- /** @type {string} */
1272
- reader.readString()
1273
- );
1274
- msg.setMethod(value);
1275
- break;
1276
1302
  default:
1277
1303
  reader.skipField();
1278
1304
  break;
@@ -1308,13 +1334,6 @@ var require_avs_pb = __commonJS({
1308
1334
  f
1309
1335
  );
1310
1336
  }
1311
- f = message.getMethod();
1312
- if (f.length > 0) {
1313
- writer.writeString(
1314
- 4,
1315
- f
1316
- );
1317
- }
1318
1337
  };
1319
1338
  proto.aggregator.ContractWriteNode.prototype.getContractAddress = function() {
1320
1339
  return (
@@ -1343,15 +1362,6 @@ var require_avs_pb = __commonJS({
1343
1362
  proto.aggregator.ContractWriteNode.prototype.setContractAbi = function(value) {
1344
1363
  return jspb.Message.setProto3StringField(this, 3, value);
1345
1364
  };
1346
- proto.aggregator.ContractWriteNode.prototype.getMethod = function() {
1347
- return (
1348
- /** @type {string} */
1349
- jspb.Message.getFieldWithDefault(this, 4, "")
1350
- );
1351
- };
1352
- proto.aggregator.ContractWriteNode.prototype.setMethod = function(value) {
1353
- return jspb.Message.setProto3StringField(this, 4, value);
1354
- };
1355
1365
  if (jspb.Message.GENERATE_TO_OBJECT) {
1356
1366
  proto.aggregator.ContractReadNode.prototype.toObject = function(opt_includeInstance) {
1357
1367
  return proto.aggregator.ContractReadNode.toObject(opt_includeInstance, this);
@@ -1360,8 +1370,7 @@ var require_avs_pb = __commonJS({
1360
1370
  var f, obj = {
1361
1371
  contractAddress: jspb.Message.getFieldWithDefault(msg, 1, ""),
1362
1372
  callData: jspb.Message.getFieldWithDefault(msg, 2, ""),
1363
- contractAbi: jspb.Message.getFieldWithDefault(msg, 3, ""),
1364
- method: jspb.Message.getFieldWithDefault(msg, 4, "")
1373
+ contractAbi: jspb.Message.getFieldWithDefault(msg, 3, "")
1365
1374
  };
1366
1375
  if (includeInstance) {
1367
1376
  obj.$jspbMessageInstance = msg;
@@ -1402,13 +1411,6 @@ var require_avs_pb = __commonJS({
1402
1411
  );
1403
1412
  msg.setContractAbi(value);
1404
1413
  break;
1405
- case 4:
1406
- var value = (
1407
- /** @type {string} */
1408
- reader.readString()
1409
- );
1410
- msg.setMethod(value);
1411
- break;
1412
1414
  default:
1413
1415
  reader.skipField();
1414
1416
  break;
@@ -1444,13 +1446,6 @@ var require_avs_pb = __commonJS({
1444
1446
  f
1445
1447
  );
1446
1448
  }
1447
- f = message.getMethod();
1448
- if (f.length > 0) {
1449
- writer.writeString(
1450
- 4,
1451
- f
1452
- );
1453
- }
1454
1449
  };
1455
1450
  proto.aggregator.ContractReadNode.prototype.getContractAddress = function() {
1456
1451
  return (
@@ -1479,15 +1474,6 @@ var require_avs_pb = __commonJS({
1479
1474
  proto.aggregator.ContractReadNode.prototype.setContractAbi = function(value) {
1480
1475
  return jspb.Message.setProto3StringField(this, 3, value);
1481
1476
  };
1482
- proto.aggregator.ContractReadNode.prototype.getMethod = function() {
1483
- return (
1484
- /** @type {string} */
1485
- jspb.Message.getFieldWithDefault(this, 4, "")
1486
- );
1487
- };
1488
- proto.aggregator.ContractReadNode.prototype.setMethod = function(value) {
1489
- return jspb.Message.setProto3StringField(this, 4, value);
1490
- };
1491
1477
  if (jspb.Message.GENERATE_TO_OBJECT) {
1492
1478
  proto.aggregator.GraphQLQueryNode.prototype.toObject = function(opt_includeInstance) {
1493
1479
  return proto.aggregator.GraphQLQueryNode.toObject(opt_includeInstance, this);
@@ -7380,32 +7366,17 @@ __export(index_exports, {
7380
7366
  TriggerType: () => TriggerType,
7381
7367
  Workflow: () => workflow_default,
7382
7368
  WorkflowStatus: () => WorkflowStatus,
7383
- default: () => Client,
7384
- getKeyRequestMessage: () => getKeyRequestMessage
7369
+ default: () => Client
7385
7370
  });
7386
7371
  module.exports = __toCommonJS(index_exports);
7387
- var import_lodash3 = __toESM(require("lodash"));
7372
+ var import_lodash4 = __toESM(require("lodash"));
7388
7373
  var import_grpc_js = require("@grpc/grpc-js");
7389
-
7390
- // src/auth.ts
7391
- var getKeyRequestMessage = (chainId, address, issuedAt, expiredAt) => {
7392
- return `Please sign the below text for ownership verification.
7393
-
7394
- URI: https://app.avaprotocol.org
7395
- Chain ID: ${chainId}
7396
- Version: 1
7397
- Issued At: ${issuedAt}
7398
- Expire At: ${expiredAt}
7399
- Wallet: ${address}`;
7400
- };
7401
-
7402
- // src/index.ts
7403
7374
  var import_avs_grpc_pb = __toESM(require_avs_grpc_pb());
7404
7375
  var avs_pb21 = __toESM(require_avs_pb());
7405
7376
  var import_timestamp_pb = require("google-protobuf/google/protobuf/timestamp_pb");
7406
7377
 
7407
7378
  // src/models/workflow.ts
7408
- var import_lodash2 = __toESM(require("lodash"));
7379
+ var import_lodash3 = __toESM(require("lodash"));
7409
7380
  var avs_pb16 = __toESM(require_avs_pb());
7410
7381
 
7411
7382
  // src/models/edge.ts
@@ -7426,13 +7397,6 @@ var Edge = class _Edge {
7426
7397
  edge.setTarget(this.target);
7427
7398
  return edge;
7428
7399
  }
7429
- toJson() {
7430
- return {
7431
- id: this.id,
7432
- source: this.source,
7433
- target: this.target
7434
- };
7435
- }
7436
7400
  };
7437
7401
  var edge_default = Edge;
7438
7402
 
@@ -7454,14 +7418,6 @@ var Trigger = class {
7454
7418
  toRequest() {
7455
7419
  throw new Error("Method not implemented.");
7456
7420
  }
7457
- toJson() {
7458
- return {
7459
- id: this.id,
7460
- name: this.name,
7461
- type: this.type,
7462
- data: this.data
7463
- };
7464
- }
7465
7421
  };
7466
7422
  var interface_default = Trigger;
7467
7423
 
@@ -7571,17 +7527,42 @@ var EventTrigger = class _EventTrigger extends interface_default {
7571
7527
  throw new Error(`Trigger data is missing for ${this.type}`);
7572
7528
  }
7573
7529
  const condition = new avs_pb5.EventCondition();
7574
- condition.setExpression(this.data.expression);
7530
+ const expression = this.data.expression;
7531
+ const matcher = this.data.matcher;
7532
+ if (expression && expression != "") {
7533
+ condition.setExpression(expression);
7534
+ }
7535
+ if (matcher && matcher.length >= 1) {
7536
+ condition.setMatcherList(matcher.map((element) => {
7537
+ const m = new avs_pb5.EventCondition.Matcher();
7538
+ m.setType(element["type"]);
7539
+ m.setValueList(element["value"]);
7540
+ return m;
7541
+ }));
7542
+ }
7575
7543
  request.setEvent(condition);
7544
+ console.log("EventTrigger.toRequest.request:", request.toObject());
7576
7545
  return request;
7577
7546
  }
7578
7547
  static fromResponse(raw) {
7579
7548
  const obj = raw.toObject();
7580
7549
  console.log("EventTrigger.fromResponse.obj:", obj);
7550
+ let data = {};
7551
+ if (raw.getEvent().getExpression()) {
7552
+ data.expression = raw.getEvent().getExpression();
7553
+ }
7554
+ if (raw.getEvent().getMatcherList()) {
7555
+ data.matcher = raw.getEvent().getMatcherList().map((item) => {
7556
+ return {
7557
+ type: item.getType(),
7558
+ value: item.getValueList()
7559
+ };
7560
+ });
7561
+ }
7581
7562
  return new _EventTrigger({
7582
7563
  ...obj,
7583
7564
  type: "event" /* Event */,
7584
- data: raw.getEvent().toObject()
7565
+ data
7585
7566
  });
7586
7567
  }
7587
7568
  };
@@ -7666,11 +7647,12 @@ var TriggerFactory = class {
7666
7647
  var factory_default = TriggerFactory;
7667
7648
 
7668
7649
  // src/models/node/factory.ts
7669
- var import_lodash = __toESM(require("lodash"));
7650
+ var import_lodash2 = __toESM(require("lodash"));
7670
7651
 
7671
7652
  // src/models/node/interface.ts
7672
7653
  var avs_pb7 = __toESM(require_avs_pb());
7673
7654
  var import_types6 = require("@avaprotocol/types");
7655
+ var import_lodash = __toESM(require("lodash"));
7674
7656
  var Node = class {
7675
7657
  constructor(props) {
7676
7658
  this.id = props.id;
@@ -7679,15 +7661,13 @@ var Node = class {
7679
7661
  this.data = props.data;
7680
7662
  }
7681
7663
  toRequest() {
7682
- throw new Error("Method not implemented.");
7683
- }
7684
- toJson() {
7685
- return {
7686
- id: this.id,
7687
- name: this.name,
7688
- type: this.type,
7689
- data: this.data
7690
- };
7664
+ const request = new avs_pb7.TaskNode();
7665
+ const raw = request.serializeBinary();
7666
+ const parsed = avs_pb7.TaskNode.deserializeBinary(raw);
7667
+ if (!import_lodash.default.isEqual(request, parsed)) {
7668
+ throw new Error("Invalid request object");
7669
+ }
7670
+ return request;
7691
7671
  }
7692
7672
  };
7693
7673
  var interface_default2 = Node;
@@ -7717,7 +7697,6 @@ var ContractWriteNode2 = class _ContractWriteNode extends interface_default2 {
7717
7697
  );
7718
7698
  nodeData.setCallData(this.data.callData);
7719
7699
  nodeData.setContractAbi(this.data.contractAbi);
7720
- nodeData.setMethod(this.data.method);
7721
7700
  request.setContractWrite(nodeData);
7722
7701
  return request;
7723
7702
  }
@@ -7849,7 +7828,6 @@ var ContractReadNode2 = class _ContractReadNode extends interface_default2 {
7849
7828
  );
7850
7829
  nodeData.setCallData(this.data.callData);
7851
7830
  nodeData.setContractAbi(this.data.contractAbi);
7852
- nodeData.setMethod(this.data.method);
7853
7831
  request.setContractRead(nodeData);
7854
7832
  return request;
7855
7833
  }
@@ -7973,7 +7951,7 @@ var NodeFactory = class {
7973
7951
  }
7974
7952
  }
7975
7953
  static createNodes(props) {
7976
- return import_lodash.default.map(props, (node) => this.create(node));
7954
+ return import_lodash2.default.map(props, (node) => this.create(node));
7977
7955
  }
7978
7956
  static fromResponse(raw) {
7979
7957
  switch (true) {
@@ -8045,11 +8023,11 @@ var Workflow = class _Workflow {
8045
8023
  if (!trigger) {
8046
8024
  throw new Error("Trigger is undefined in fromResponse()");
8047
8025
  }
8048
- const nodes = import_lodash2.default.map(
8026
+ const nodes = import_lodash3.default.map(
8049
8027
  obj.getNodesList(),
8050
8028
  (node) => factory_default2.fromResponse(node)
8051
8029
  );
8052
- const edges = import_lodash2.default.map(obj.getEdgesList(), (edge) => edge_default.fromResponse(edge));
8030
+ const edges = import_lodash3.default.map(obj.getEdgesList(), (edge) => edge_default.fromResponse(edge));
8053
8031
  const workflow = new _Workflow({
8054
8032
  id: obj.getId(),
8055
8033
  owner: obj.getOwner(),
@@ -8098,8 +8076,8 @@ var Workflow = class _Workflow {
8098
8076
  const request = new avs_pb16.CreateTaskReq();
8099
8077
  request.setSmartWalletAddress(this.smartWalletAddress);
8100
8078
  request.setTrigger(this.trigger.toRequest());
8101
- import_lodash2.default.map(this.nodes, (node) => request.addNodes(node.toRequest()));
8102
- import_lodash2.default.map(this.edges, (edge) => request.addEdges(edge.toRequest()));
8079
+ import_lodash3.default.map(this.nodes, (node) => request.addNodes(node.toRequest()));
8080
+ import_lodash3.default.map(this.edges, (edge) => request.addEdges(edge.toRequest()));
8103
8081
  request.setStartAt(this.startAt);
8104
8082
  request.setExpiredAt(this.expiredAt);
8105
8083
  request.setMaxExecution(this.maxExecution);
@@ -8335,9 +8313,11 @@ var BaseClient = class {
8335
8313
  }
8336
8314
  /**
8337
8315
  * The API key could retrieve a wallet’s authKey by skipping its signature verification
8316
+ * @param chainId - The chain id
8338
8317
  * @param address - The address of the EOA wallet
8318
+ * @param issuedAt - The issued at timestamp
8319
+ * @param expiredAt - The expiration timestamp
8339
8320
  * @param apiKey - The API key
8340
- * @param expiredAtEpoch - The expiration epoch
8341
8321
  * @returns {Promise<GetKeyResponse>} - The response from the auth call
8342
8322
  */
8343
8323
  async authWithAPIKey({
@@ -8360,9 +8340,11 @@ var BaseClient = class {
8360
8340
  }
8361
8341
  /**
8362
8342
  * Getting an authKey from the server by verifying the signature of an EOA wallet
8343
+ * @param chainId - The chain id
8363
8344
  * @param address - The address of the EOA wallet
8345
+ * @param issuedAt - The issued at timestamp
8346
+ * @param expiredAt - The expiration timestamp
8364
8347
  * @param signature - The signature of the EOA wallet
8365
- * @param expiredAtEpoch - The expiration epoch
8366
8348
  * @returns {Promise<GetKeyResponse>} - The response from the auth call
8367
8349
  */
8368
8350
  async authWithSignature({
@@ -8423,7 +8405,7 @@ var BaseClient = class {
8423
8405
  * @returns {Promise<TResponse>} - The response from the gRPC call
8424
8406
  */
8425
8407
  sendGrpcRequest(method, request, options) {
8426
- const metadata = import_lodash3.default.cloneDeep(this.metadata);
8408
+ const metadata = import_lodash4.default.cloneDeep(this.metadata);
8427
8409
  if (options?.authKey) {
8428
8410
  metadata.set(AUTH_KEY_HEADER, options.authKey);
8429
8411
  } else if (this.authKey) {
@@ -8703,6 +8685,5 @@ var Client = class extends BaseClient {
8703
8685
  TriggerFactory,
8704
8686
  TriggerType,
8705
8687
  Workflow,
8706
- WorkflowStatus,
8707
- getKeyRequestMessage
8688
+ WorkflowStatus
8708
8689
  });
package/dist/index.mjs CHANGED
@@ -140,7 +140,7 @@ var require_avs_pb = __commonJS({
140
140
  proto.aggregator.BlockCondition.displayName = "proto.aggregator.BlockCondition";
141
141
  }
142
142
  proto.aggregator.EventCondition = function(opt_data) {
143
- jspb.Message.initialize(this, opt_data, 0, -1, null, null);
143
+ jspb.Message.initialize(this, opt_data, 0, -1, proto.aggregator.EventCondition.repeatedFields_, null);
144
144
  };
145
145
  goog.inherits(proto.aggregator.EventCondition, jspb.Message);
146
146
  if (goog.DEBUG && !COMPILED) {
@@ -719,13 +719,19 @@ var require_avs_pb = __commonJS({
719
719
  proto.aggregator.BlockCondition.prototype.setInterval = function(value) {
720
720
  return jspb.Message.setProto3IntField(this, 1, value);
721
721
  };
722
+ proto.aggregator.EventCondition.repeatedFields_ = [1];
722
723
  if (jspb.Message.GENERATE_TO_OBJECT) {
723
724
  proto.aggregator.EventCondition.prototype.toObject = function(opt_includeInstance) {
724
725
  return proto.aggregator.EventCondition.toObject(opt_includeInstance, this);
725
726
  };
726
727
  proto.aggregator.EventCondition.toObject = function(includeInstance, msg) {
727
728
  var f, obj = {
728
- expression: jspb.Message.getFieldWithDefault(msg, 1, "")
729
+ matcherList: jspb.Message.toObjectList(
730
+ msg.getMatcherList(),
731
+ proto.aggregator.EventCondition.Matcher.toObject,
732
+ includeInstance
733
+ ),
734
+ expression: jspb.Message.getFieldWithDefault(msg, 2, "")
729
735
  };
730
736
  if (includeInstance) {
731
737
  obj.$jspbMessageInstance = msg;
@@ -746,6 +752,11 @@ var require_avs_pb = __commonJS({
746
752
  var field = reader.getFieldNumber();
747
753
  switch (field) {
748
754
  case 1:
755
+ var value = new proto.aggregator.EventCondition.Matcher();
756
+ reader.readMessage(value, proto.aggregator.EventCondition.Matcher.deserializeBinaryFromReader);
757
+ msg.addMatcher(value);
758
+ break;
759
+ case 2:
749
760
  var value = (
750
761
  /** @type {string} */
751
762
  reader.readString()
@@ -766,10 +777,18 @@ var require_avs_pb = __commonJS({
766
777
  };
767
778
  proto.aggregator.EventCondition.serializeBinaryToWriter = function(message, writer) {
768
779
  var f = void 0;
780
+ f = message.getMatcherList();
781
+ if (f.length > 0) {
782
+ writer.writeRepeatedMessage(
783
+ 1,
784
+ f,
785
+ proto.aggregator.EventCondition.Matcher.serializeBinaryToWriter
786
+ );
787
+ }
769
788
  f = message.getExpression();
770
789
  if (f.length > 0) {
771
790
  writer.writeString(
772
- 1,
791
+ 2,
773
792
  f
774
793
  );
775
794
  }
@@ -869,14 +888,29 @@ var require_avs_pb = __commonJS({
869
888
  proto.aggregator.EventCondition.Matcher.prototype.clearValueList = function() {
870
889
  return this.setValueList([]);
871
890
  };
891
+ proto.aggregator.EventCondition.prototype.getMatcherList = function() {
892
+ return (
893
+ /** @type{!Array<!proto.aggregator.EventCondition.Matcher>} */
894
+ jspb.Message.getRepeatedWrapperField(this, proto.aggregator.EventCondition.Matcher, 1)
895
+ );
896
+ };
897
+ proto.aggregator.EventCondition.prototype.setMatcherList = function(value) {
898
+ return jspb.Message.setRepeatedWrapperField(this, 1, value);
899
+ };
900
+ proto.aggregator.EventCondition.prototype.addMatcher = function(opt_value, opt_index) {
901
+ return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.aggregator.EventCondition.Matcher, opt_index);
902
+ };
903
+ proto.aggregator.EventCondition.prototype.clearMatcherList = function() {
904
+ return this.setMatcherList([]);
905
+ };
872
906
  proto.aggregator.EventCondition.prototype.getExpression = function() {
873
907
  return (
874
908
  /** @type {string} */
875
- jspb.Message.getFieldWithDefault(this, 1, "")
909
+ jspb.Message.getFieldWithDefault(this, 2, "")
876
910
  );
877
911
  };
878
912
  proto.aggregator.EventCondition.prototype.setExpression = function(value) {
879
- return jspb.Message.setProto3StringField(this, 1, value);
913
+ return jspb.Message.setProto3StringField(this, 2, value);
880
914
  };
881
915
  proto.aggregator.TaskTrigger.oneofGroups_ = [[2, 3, 4, 5, 6]];
882
916
  proto.aggregator.TaskTrigger.TriggerTypeCase = {
@@ -1224,8 +1258,7 @@ var require_avs_pb = __commonJS({
1224
1258
  var f, obj = {
1225
1259
  contractAddress: jspb.Message.getFieldWithDefault(msg, 1, ""),
1226
1260
  callData: jspb.Message.getFieldWithDefault(msg, 2, ""),
1227
- contractAbi: jspb.Message.getFieldWithDefault(msg, 3, ""),
1228
- method: jspb.Message.getFieldWithDefault(msg, 4, "")
1261
+ contractAbi: jspb.Message.getFieldWithDefault(msg, 3, "")
1229
1262
  };
1230
1263
  if (includeInstance) {
1231
1264
  obj.$jspbMessageInstance = msg;
@@ -1266,13 +1299,6 @@ var require_avs_pb = __commonJS({
1266
1299
  );
1267
1300
  msg.setContractAbi(value);
1268
1301
  break;
1269
- case 4:
1270
- var value = (
1271
- /** @type {string} */
1272
- reader.readString()
1273
- );
1274
- msg.setMethod(value);
1275
- break;
1276
1302
  default:
1277
1303
  reader.skipField();
1278
1304
  break;
@@ -1308,13 +1334,6 @@ var require_avs_pb = __commonJS({
1308
1334
  f
1309
1335
  );
1310
1336
  }
1311
- f = message.getMethod();
1312
- if (f.length > 0) {
1313
- writer.writeString(
1314
- 4,
1315
- f
1316
- );
1317
- }
1318
1337
  };
1319
1338
  proto.aggregator.ContractWriteNode.prototype.getContractAddress = function() {
1320
1339
  return (
@@ -1343,15 +1362,6 @@ var require_avs_pb = __commonJS({
1343
1362
  proto.aggregator.ContractWriteNode.prototype.setContractAbi = function(value) {
1344
1363
  return jspb.Message.setProto3StringField(this, 3, value);
1345
1364
  };
1346
- proto.aggregator.ContractWriteNode.prototype.getMethod = function() {
1347
- return (
1348
- /** @type {string} */
1349
- jspb.Message.getFieldWithDefault(this, 4, "")
1350
- );
1351
- };
1352
- proto.aggregator.ContractWriteNode.prototype.setMethod = function(value) {
1353
- return jspb.Message.setProto3StringField(this, 4, value);
1354
- };
1355
1365
  if (jspb.Message.GENERATE_TO_OBJECT) {
1356
1366
  proto.aggregator.ContractReadNode.prototype.toObject = function(opt_includeInstance) {
1357
1367
  return proto.aggregator.ContractReadNode.toObject(opt_includeInstance, this);
@@ -1360,8 +1370,7 @@ var require_avs_pb = __commonJS({
1360
1370
  var f, obj = {
1361
1371
  contractAddress: jspb.Message.getFieldWithDefault(msg, 1, ""),
1362
1372
  callData: jspb.Message.getFieldWithDefault(msg, 2, ""),
1363
- contractAbi: jspb.Message.getFieldWithDefault(msg, 3, ""),
1364
- method: jspb.Message.getFieldWithDefault(msg, 4, "")
1373
+ contractAbi: jspb.Message.getFieldWithDefault(msg, 3, "")
1365
1374
  };
1366
1375
  if (includeInstance) {
1367
1376
  obj.$jspbMessageInstance = msg;
@@ -1402,13 +1411,6 @@ var require_avs_pb = __commonJS({
1402
1411
  );
1403
1412
  msg.setContractAbi(value);
1404
1413
  break;
1405
- case 4:
1406
- var value = (
1407
- /** @type {string} */
1408
- reader.readString()
1409
- );
1410
- msg.setMethod(value);
1411
- break;
1412
1414
  default:
1413
1415
  reader.skipField();
1414
1416
  break;
@@ -1444,13 +1446,6 @@ var require_avs_pb = __commonJS({
1444
1446
  f
1445
1447
  );
1446
1448
  }
1447
- f = message.getMethod();
1448
- if (f.length > 0) {
1449
- writer.writeString(
1450
- 4,
1451
- f
1452
- );
1453
- }
1454
1449
  };
1455
1450
  proto.aggregator.ContractReadNode.prototype.getContractAddress = function() {
1456
1451
  return (
@@ -1479,15 +1474,6 @@ var require_avs_pb = __commonJS({
1479
1474
  proto.aggregator.ContractReadNode.prototype.setContractAbi = function(value) {
1480
1475
  return jspb.Message.setProto3StringField(this, 3, value);
1481
1476
  };
1482
- proto.aggregator.ContractReadNode.prototype.getMethod = function() {
1483
- return (
1484
- /** @type {string} */
1485
- jspb.Message.getFieldWithDefault(this, 4, "")
1486
- );
1487
- };
1488
- proto.aggregator.ContractReadNode.prototype.setMethod = function(value) {
1489
- return jspb.Message.setProto3StringField(this, 4, value);
1490
- };
1491
1477
  if (jspb.Message.GENERATE_TO_OBJECT) {
1492
1478
  proto.aggregator.GraphQLQueryNode.prototype.toObject = function(opt_includeInstance) {
1493
1479
  return proto.aggregator.GraphQLQueryNode.toObject(opt_includeInstance, this);
@@ -7351,30 +7337,16 @@ var require_avs_grpc_pb = __commonJS({
7351
7337
  }
7352
7338
  });
7353
7339
 
7354
- // src/index.ts
7355
- import _3 from "lodash";
7356
- import { credentials, Metadata } from "@grpc/grpc-js";
7357
-
7358
- // src/auth.ts
7359
- var getKeyRequestMessage = (chainId, address, issuedAt, expiredAt) => {
7360
- return `Please sign the below text for ownership verification.
7361
-
7362
- URI: https://app.avaprotocol.org
7363
- Chain ID: ${chainId}
7364
- Version: 1
7365
- Issued At: ${issuedAt}
7366
- Expire At: ${expiredAt}
7367
- Wallet: ${address}`;
7368
- };
7369
-
7370
7340
  // src/index.ts
7371
7341
  var import_avs_grpc_pb = __toESM(require_avs_grpc_pb());
7372
7342
  var avs_pb21 = __toESM(require_avs_pb());
7343
+ import _4 from "lodash";
7344
+ import { credentials, Metadata } from "@grpc/grpc-js";
7373
7345
  import { Timestamp } from "google-protobuf/google/protobuf/timestamp_pb";
7374
7346
 
7375
7347
  // src/models/workflow.ts
7376
7348
  var avs_pb16 = __toESM(require_avs_pb());
7377
- import _2 from "lodash";
7349
+ import _3 from "lodash";
7378
7350
 
7379
7351
  // src/models/edge.ts
7380
7352
  var avs_pb = __toESM(require_avs_pb());
@@ -7394,13 +7366,6 @@ var Edge = class _Edge {
7394
7366
  edge.setTarget(this.target);
7395
7367
  return edge;
7396
7368
  }
7397
- toJson() {
7398
- return {
7399
- id: this.id,
7400
- source: this.source,
7401
- target: this.target
7402
- };
7403
- }
7404
7369
  };
7405
7370
  var edge_default = Edge;
7406
7371
 
@@ -7422,14 +7387,6 @@ var Trigger = class {
7422
7387
  toRequest() {
7423
7388
  throw new Error("Method not implemented.");
7424
7389
  }
7425
- toJson() {
7426
- return {
7427
- id: this.id,
7428
- name: this.name,
7429
- type: this.type,
7430
- data: this.data
7431
- };
7432
- }
7433
7390
  };
7434
7391
  var interface_default = Trigger;
7435
7392
 
@@ -7539,17 +7496,42 @@ var EventTrigger = class _EventTrigger extends interface_default {
7539
7496
  throw new Error(`Trigger data is missing for ${this.type}`);
7540
7497
  }
7541
7498
  const condition = new avs_pb5.EventCondition();
7542
- condition.setExpression(this.data.expression);
7499
+ const expression = this.data.expression;
7500
+ const matcher = this.data.matcher;
7501
+ if (expression && expression != "") {
7502
+ condition.setExpression(expression);
7503
+ }
7504
+ if (matcher && matcher.length >= 1) {
7505
+ condition.setMatcherList(matcher.map((element) => {
7506
+ const m = new avs_pb5.EventCondition.Matcher();
7507
+ m.setType(element["type"]);
7508
+ m.setValueList(element["value"]);
7509
+ return m;
7510
+ }));
7511
+ }
7543
7512
  request.setEvent(condition);
7513
+ console.log("EventTrigger.toRequest.request:", request.toObject());
7544
7514
  return request;
7545
7515
  }
7546
7516
  static fromResponse(raw) {
7547
7517
  const obj = raw.toObject();
7548
7518
  console.log("EventTrigger.fromResponse.obj:", obj);
7519
+ let data = {};
7520
+ if (raw.getEvent().getExpression()) {
7521
+ data.expression = raw.getEvent().getExpression();
7522
+ }
7523
+ if (raw.getEvent().getMatcherList()) {
7524
+ data.matcher = raw.getEvent().getMatcherList().map((item) => {
7525
+ return {
7526
+ type: item.getType(),
7527
+ value: item.getValueList()
7528
+ };
7529
+ });
7530
+ }
7549
7531
  return new _EventTrigger({
7550
7532
  ...obj,
7551
7533
  type: "event" /* Event */,
7552
- data: raw.getEvent().toObject()
7534
+ data
7553
7535
  });
7554
7536
  }
7555
7537
  };
@@ -7634,11 +7616,12 @@ var TriggerFactory = class {
7634
7616
  var factory_default = TriggerFactory;
7635
7617
 
7636
7618
  // src/models/node/factory.ts
7637
- import _ from "lodash";
7619
+ import _2 from "lodash";
7638
7620
 
7639
7621
  // src/models/node/interface.ts
7640
7622
  var avs_pb7 = __toESM(require_avs_pb());
7641
7623
  import { NodeType } from "@avaprotocol/types";
7624
+ import _ from "lodash";
7642
7625
  var Node = class {
7643
7626
  constructor(props) {
7644
7627
  this.id = props.id;
@@ -7647,15 +7630,13 @@ var Node = class {
7647
7630
  this.data = props.data;
7648
7631
  }
7649
7632
  toRequest() {
7650
- throw new Error("Method not implemented.");
7651
- }
7652
- toJson() {
7653
- return {
7654
- id: this.id,
7655
- name: this.name,
7656
- type: this.type,
7657
- data: this.data
7658
- };
7633
+ const request = new avs_pb7.TaskNode();
7634
+ const raw = request.serializeBinary();
7635
+ const parsed = avs_pb7.TaskNode.deserializeBinary(raw);
7636
+ if (!_.isEqual(request, parsed)) {
7637
+ throw new Error("Invalid request object");
7638
+ }
7639
+ return request;
7659
7640
  }
7660
7641
  };
7661
7642
  var interface_default2 = Node;
@@ -7685,7 +7666,6 @@ var ContractWriteNode2 = class _ContractWriteNode extends interface_default2 {
7685
7666
  );
7686
7667
  nodeData.setCallData(this.data.callData);
7687
7668
  nodeData.setContractAbi(this.data.contractAbi);
7688
- nodeData.setMethod(this.data.method);
7689
7669
  request.setContractWrite(nodeData);
7690
7670
  return request;
7691
7671
  }
@@ -7817,7 +7797,6 @@ var ContractReadNode2 = class _ContractReadNode extends interface_default2 {
7817
7797
  );
7818
7798
  nodeData.setCallData(this.data.callData);
7819
7799
  nodeData.setContractAbi(this.data.contractAbi);
7820
- nodeData.setMethod(this.data.method);
7821
7800
  request.setContractRead(nodeData);
7822
7801
  return request;
7823
7802
  }
@@ -7941,7 +7920,7 @@ var NodeFactory = class {
7941
7920
  }
7942
7921
  }
7943
7922
  static createNodes(props) {
7944
- return _.map(props, (node) => this.create(node));
7923
+ return _2.map(props, (node) => this.create(node));
7945
7924
  }
7946
7925
  static fromResponse(raw) {
7947
7926
  switch (true) {
@@ -8013,11 +7992,11 @@ var Workflow = class _Workflow {
8013
7992
  if (!trigger) {
8014
7993
  throw new Error("Trigger is undefined in fromResponse()");
8015
7994
  }
8016
- const nodes = _2.map(
7995
+ const nodes = _3.map(
8017
7996
  obj.getNodesList(),
8018
7997
  (node) => factory_default2.fromResponse(node)
8019
7998
  );
8020
- const edges = _2.map(obj.getEdgesList(), (edge) => edge_default.fromResponse(edge));
7999
+ const edges = _3.map(obj.getEdgesList(), (edge) => edge_default.fromResponse(edge));
8021
8000
  const workflow = new _Workflow({
8022
8001
  id: obj.getId(),
8023
8002
  owner: obj.getOwner(),
@@ -8066,8 +8045,8 @@ var Workflow = class _Workflow {
8066
8045
  const request = new avs_pb16.CreateTaskReq();
8067
8046
  request.setSmartWalletAddress(this.smartWalletAddress);
8068
8047
  request.setTrigger(this.trigger.toRequest());
8069
- _2.map(this.nodes, (node) => request.addNodes(node.toRequest()));
8070
- _2.map(this.edges, (edge) => request.addEdges(edge.toRequest()));
8048
+ _3.map(this.nodes, (node) => request.addNodes(node.toRequest()));
8049
+ _3.map(this.edges, (edge) => request.addEdges(edge.toRequest()));
8071
8050
  request.setStartAt(this.startAt);
8072
8051
  request.setExpiredAt(this.expiredAt);
8073
8052
  request.setMaxExecution(this.maxExecution);
@@ -8303,9 +8282,11 @@ var BaseClient = class {
8303
8282
  }
8304
8283
  /**
8305
8284
  * The API key could retrieve a wallet’s authKey by skipping its signature verification
8285
+ * @param chainId - The chain id
8306
8286
  * @param address - The address of the EOA wallet
8287
+ * @param issuedAt - The issued at timestamp
8288
+ * @param expiredAt - The expiration timestamp
8307
8289
  * @param apiKey - The API key
8308
- * @param expiredAtEpoch - The expiration epoch
8309
8290
  * @returns {Promise<GetKeyResponse>} - The response from the auth call
8310
8291
  */
8311
8292
  async authWithAPIKey({
@@ -8328,9 +8309,11 @@ var BaseClient = class {
8328
8309
  }
8329
8310
  /**
8330
8311
  * Getting an authKey from the server by verifying the signature of an EOA wallet
8312
+ * @param chainId - The chain id
8331
8313
  * @param address - The address of the EOA wallet
8314
+ * @param issuedAt - The issued at timestamp
8315
+ * @param expiredAt - The expiration timestamp
8332
8316
  * @param signature - The signature of the EOA wallet
8333
- * @param expiredAtEpoch - The expiration epoch
8334
8317
  * @returns {Promise<GetKeyResponse>} - The response from the auth call
8335
8318
  */
8336
8319
  async authWithSignature({
@@ -8391,7 +8374,7 @@ var BaseClient = class {
8391
8374
  * @returns {Promise<TResponse>} - The response from the gRPC call
8392
8375
  */
8393
8376
  sendGrpcRequest(method, request, options) {
8394
- const metadata = _3.cloneDeep(this.metadata);
8377
+ const metadata = _4.cloneDeep(this.metadata);
8395
8378
  if (options?.authKey) {
8396
8379
  metadata.set(AUTH_KEY_HEADER, options.authKey);
8397
8380
  } else if (this.authKey) {
@@ -8671,6 +8654,5 @@ export {
8671
8654
  TriggerType,
8672
8655
  workflow_default as Workflow,
8673
8656
  WorkflowStatus,
8674
- Client as default,
8675
- getKeyRequestMessage
8657
+ Client as default
8676
8658
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avaprotocol/sdk-js",
3
- "version": "1.3.4-dev.3",
3
+ "version": "1.3.4",
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",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "scripts": {
26
26
  "build": "tsup src/index.ts --format cjs,esm --dts",
27
- "clean": "rm -rf dist"
27
+ "clean": "rm -rf node_modules dist tsconfig.tsbuildinfo"
28
28
  },
29
29
  "dependencies": {
30
30
  "@avaprotocol/types": "workspace:*",
@@ -37,10 +37,6 @@
37
37
  "lodash": "^4.17.21"
38
38
  },
39
39
  "devDependencies": {
40
- "@types/google-protobuf": "^3.15.12",
41
- "@types/lodash": "^4.17.12",
42
- "globals": "^15.13.0",
43
- "tsup": "^8.0.2",
44
- "typescript": "^5.4.2"
40
+ "@types/google-protobuf": "^3.15.12"
45
41
  }
46
42
  }