@avaprotocol/sdk-js 1.2.1-dev.4 → 1.2.1-dev.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/dist/index.d.mts +148 -47
- package/dist/index.d.ts +148 -47
- package/dist/index.js +328 -223
- package/dist/index.mjs +327 -223
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -610,10 +610,10 @@ declare class Execution$1 extends jspb.Message {
|
|
|
610
610
|
getError(): string;
|
|
611
611
|
setError(value: string): Execution$1;
|
|
612
612
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
613
|
+
hasTriggerMetadata(): boolean;
|
|
614
|
+
clearTriggerMetadata(): void;
|
|
615
|
+
getTriggerMetadata(): TriggerMetadata$1 | undefined;
|
|
616
|
+
setTriggerMetadata(value?: TriggerMetadata$1): Execution$1;
|
|
617
617
|
getResult(): string;
|
|
618
618
|
setResult(value: string): Execution$1;
|
|
619
619
|
clearStepsList(): void;
|
|
@@ -638,7 +638,7 @@ declare namespace Execution$1 {
|
|
|
638
638
|
endAt: number,
|
|
639
639
|
success: boolean,
|
|
640
640
|
error: string,
|
|
641
|
-
|
|
641
|
+
triggerMetadata?: TriggerMetadata$1.AsObject,
|
|
642
642
|
result: string,
|
|
643
643
|
stepsList: Array<Execution$1.Step.AsObject>,
|
|
644
644
|
}
|
|
@@ -1135,27 +1135,27 @@ declare namespace KeyResp {
|
|
|
1135
1135
|
}
|
|
1136
1136
|
}
|
|
1137
1137
|
|
|
1138
|
-
declare class
|
|
1138
|
+
declare class TriggerMetadata$1 extends jspb.Message {
|
|
1139
1139
|
getBlockNumber(): number;
|
|
1140
|
-
setBlockNumber(value: number):
|
|
1140
|
+
setBlockNumber(value: number): TriggerMetadata$1;
|
|
1141
1141
|
getLogIndex(): number;
|
|
1142
|
-
setLogIndex(value: number):
|
|
1142
|
+
setLogIndex(value: number): TriggerMetadata$1;
|
|
1143
1143
|
getTxHash(): string;
|
|
1144
|
-
setTxHash(value: string):
|
|
1144
|
+
setTxHash(value: string): TriggerMetadata$1;
|
|
1145
1145
|
getEpoch(): number;
|
|
1146
|
-
setEpoch(value: number):
|
|
1146
|
+
setEpoch(value: number): TriggerMetadata$1;
|
|
1147
1147
|
|
|
1148
1148
|
serializeBinary(): Uint8Array;
|
|
1149
|
-
toObject(includeInstance?: boolean):
|
|
1150
|
-
static toObject(includeInstance: boolean, msg:
|
|
1149
|
+
toObject(includeInstance?: boolean): TriggerMetadata$1.AsObject;
|
|
1150
|
+
static toObject(includeInstance: boolean, msg: TriggerMetadata$1): TriggerMetadata$1.AsObject;
|
|
1151
1151
|
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
1152
1152
|
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
1153
|
-
static serializeBinaryToWriter(message:
|
|
1154
|
-
static deserializeBinary(bytes: Uint8Array):
|
|
1155
|
-
static deserializeBinaryFromReader(message:
|
|
1153
|
+
static serializeBinaryToWriter(message: TriggerMetadata$1, writer: jspb.BinaryWriter): void;
|
|
1154
|
+
static deserializeBinary(bytes: Uint8Array): TriggerMetadata$1;
|
|
1155
|
+
static deserializeBinaryFromReader(message: TriggerMetadata$1, reader: jspb.BinaryReader): TriggerMetadata$1;
|
|
1156
1156
|
}
|
|
1157
1157
|
|
|
1158
|
-
declare namespace
|
|
1158
|
+
declare namespace TriggerMetadata$1 {
|
|
1159
1159
|
export type AsObject = {
|
|
1160
1160
|
blockNumber: number,
|
|
1161
1161
|
logIndex: number,
|
|
@@ -1217,12 +1217,12 @@ declare class UserTriggerTaskReq extends jspb.Message {
|
|
|
1217
1217
|
getTaskId(): string;
|
|
1218
1218
|
setTaskId(value: string): UserTriggerTaskReq;
|
|
1219
1219
|
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1220
|
+
hasTriggerMetadata(): boolean;
|
|
1221
|
+
clearTriggerMetadata(): void;
|
|
1222
|
+
getTriggerMetadata(): TriggerMetadata$1 | undefined;
|
|
1223
|
+
setTriggerMetadata(value?: TriggerMetadata$1): UserTriggerTaskReq;
|
|
1224
|
+
getIsBlocking(): boolean;
|
|
1225
|
+
setIsBlocking(value: boolean): UserTriggerTaskReq;
|
|
1226
1226
|
|
|
1227
1227
|
serializeBinary(): Uint8Array;
|
|
1228
1228
|
toObject(includeInstance?: boolean): UserTriggerTaskReq.AsObject;
|
|
@@ -1237,8 +1237,8 @@ declare class UserTriggerTaskReq extends jspb.Message {
|
|
|
1237
1237
|
declare namespace UserTriggerTaskReq {
|
|
1238
1238
|
export type AsObject = {
|
|
1239
1239
|
taskId: string,
|
|
1240
|
-
|
|
1241
|
-
|
|
1240
|
+
triggerMetadata?: TriggerMetadata$1.AsObject,
|
|
1241
|
+
isBlocking: boolean,
|
|
1242
1242
|
}
|
|
1243
1243
|
}
|
|
1244
1244
|
|
|
@@ -1438,7 +1438,7 @@ declare class Workflow implements WorkflowProps {
|
|
|
1438
1438
|
*/
|
|
1439
1439
|
constructor(props: WorkflowProps);
|
|
1440
1440
|
/**
|
|
1441
|
-
* Create an instance of Workflow from AVS
|
|
1441
|
+
* Create an instance of Workflow from AVS getWorkflow response
|
|
1442
1442
|
* @param res
|
|
1443
1443
|
* @returns
|
|
1444
1444
|
*/
|
|
@@ -1451,6 +1451,32 @@ declare class Workflow implements WorkflowProps {
|
|
|
1451
1451
|
toRequest(): CreateTaskReq;
|
|
1452
1452
|
}
|
|
1453
1453
|
|
|
1454
|
+
type TriggerMetadataProps = {
|
|
1455
|
+
type: TaskTrigger.TriggerTypeCase.FIXED_TIME;
|
|
1456
|
+
epoch: number;
|
|
1457
|
+
} | {
|
|
1458
|
+
type: TaskTrigger.TriggerTypeCase.CRON;
|
|
1459
|
+
epoch: number;
|
|
1460
|
+
} | {
|
|
1461
|
+
type: TaskTrigger.TriggerTypeCase.BLOCK;
|
|
1462
|
+
blockNumber: number;
|
|
1463
|
+
} | {
|
|
1464
|
+
type: TaskTrigger.TriggerTypeCase.EVENT;
|
|
1465
|
+
blockNumber: number;
|
|
1466
|
+
logIndex: number;
|
|
1467
|
+
txHash: string;
|
|
1468
|
+
};
|
|
1469
|
+
declare class TriggerMetadata {
|
|
1470
|
+
type: TriggerType;
|
|
1471
|
+
blockNumber?: number;
|
|
1472
|
+
epoch?: number;
|
|
1473
|
+
logIndex?: number;
|
|
1474
|
+
txHash?: string;
|
|
1475
|
+
constructor(props: TriggerMetadataProps);
|
|
1476
|
+
static fromResponse(data: TriggerMetadata$1 | undefined): TriggerMetadata | undefined;
|
|
1477
|
+
toRequest(): TriggerMetadata$1;
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1454
1480
|
type StepProps = Execution$1.Step.AsObject;
|
|
1455
1481
|
declare class Step implements StepProps {
|
|
1456
1482
|
nodeId: string;
|
|
@@ -1465,17 +1491,17 @@ declare class Step implements StepProps {
|
|
|
1465
1491
|
toRequest(): Execution$1.Step;
|
|
1466
1492
|
}
|
|
1467
1493
|
|
|
1468
|
-
type ExecutionProps = Omit<Execution$1.AsObject, "stepsList"> & {
|
|
1494
|
+
type ExecutionProps = Omit<Execution$1.AsObject, "stepsList" | "triggerMetadata"> & {
|
|
1469
1495
|
stepsList: Step[];
|
|
1496
|
+
triggerMetadata: TriggerMetadata | undefined;
|
|
1470
1497
|
};
|
|
1471
|
-
type TriggerMarkProps = TriggerMark.AsObject;
|
|
1472
1498
|
declare class Execution implements ExecutionProps {
|
|
1473
1499
|
id: string;
|
|
1474
1500
|
startAt: number;
|
|
1475
1501
|
endAt: number;
|
|
1476
1502
|
success: boolean;
|
|
1477
1503
|
error: string;
|
|
1478
|
-
|
|
1504
|
+
triggerMetadata: TriggerMetadata | undefined;
|
|
1479
1505
|
result: string;
|
|
1480
1506
|
stepsList: Step[];
|
|
1481
1507
|
constructor(props: ExecutionProps);
|
|
@@ -1608,7 +1634,7 @@ declare class TriggerFactory {
|
|
|
1608
1634
|
*/
|
|
1609
1635
|
static create(props: TriggerProps): Trigger;
|
|
1610
1636
|
/**
|
|
1611
|
-
* Create an instance of Trigger from AVS
|
|
1637
|
+
* Create an instance of Trigger from AVS getWorkflow or getWorkflows response
|
|
1612
1638
|
* @param trigger
|
|
1613
1639
|
* @returns
|
|
1614
1640
|
*/
|
|
@@ -1617,14 +1643,28 @@ declare class TriggerFactory {
|
|
|
1617
1643
|
|
|
1618
1644
|
type Environment = "production" | "development" | "staging";
|
|
1619
1645
|
declare const AUTH_KEY_HEADER = "authkey";
|
|
1646
|
+
declare const DEFAULT_LIMIT = 10;
|
|
1620
1647
|
interface RequestOptions {
|
|
1621
|
-
authKey
|
|
1648
|
+
authKey?: string;
|
|
1649
|
+
}
|
|
1650
|
+
interface GetExecutionsRequest extends RequestOptions {
|
|
1651
|
+
cursor?: string;
|
|
1652
|
+
limit?: number;
|
|
1653
|
+
}
|
|
1654
|
+
interface GetWorkflowsRequest extends RequestOptions {
|
|
1655
|
+
cursor?: string;
|
|
1656
|
+
limit?: number;
|
|
1622
1657
|
}
|
|
1623
1658
|
interface GetKeyResponse {
|
|
1624
1659
|
authKey: string;
|
|
1625
1660
|
}
|
|
1661
|
+
interface GetWalletRequest {
|
|
1662
|
+
salt: string;
|
|
1663
|
+
factoryAddress?: string;
|
|
1664
|
+
}
|
|
1626
1665
|
interface ClientOption {
|
|
1627
1666
|
endpoint: string;
|
|
1667
|
+
factoryAddress?: string;
|
|
1628
1668
|
}
|
|
1629
1669
|
type SmartWallet = SmartWallet$1.AsObject;
|
|
1630
1670
|
|
|
@@ -1632,36 +1672,84 @@ declare class BaseClient {
|
|
|
1632
1672
|
readonly endpoint: string;
|
|
1633
1673
|
readonly rpcClient: AggregatorClient;
|
|
1634
1674
|
protected metadata: Metadata;
|
|
1675
|
+
protected factoryAddress?: string;
|
|
1676
|
+
protected authKey?: string;
|
|
1635
1677
|
constructor(opts: ClientOption);
|
|
1678
|
+
/**
|
|
1679
|
+
* Check if the auth key is valid by decoding the JWT token and checking the expiration
|
|
1680
|
+
* @param key - The auth key
|
|
1681
|
+
* @returns {boolean} - Whether the auth key is valid
|
|
1682
|
+
*/
|
|
1636
1683
|
isAuthKeyValid(key: string): boolean;
|
|
1684
|
+
/**
|
|
1685
|
+
* The API key could retrieve a wallet’s authKey by skipping its signature verification
|
|
1686
|
+
* @param address - The address of the EOA wallet
|
|
1687
|
+
* @param apiKey - The API key
|
|
1688
|
+
* @param expiredAtEpoch - The expiration epoch
|
|
1689
|
+
* @returns {Promise<GetKeyResponse>} - The response from the auth call
|
|
1690
|
+
*/
|
|
1637
1691
|
authWithAPIKey(address: string, apiKey: string, expiredAtEpoch: number): Promise<GetKeyResponse>;
|
|
1692
|
+
/**
|
|
1693
|
+
* Getting an authKey from the server by verifying the signature of an EOA wallet
|
|
1694
|
+
* @param address - The address of the EOA wallet
|
|
1695
|
+
* @param signature - The signature of the EOA wallet
|
|
1696
|
+
* @param expiredAtEpoch - The expiration epoch
|
|
1697
|
+
* @returns {Promise<GetKeyResponse>} - The response from the auth call
|
|
1698
|
+
*/
|
|
1638
1699
|
authWithSignature(address: string, signature: string, expiredAtEpoch: number): Promise<GetKeyResponse>;
|
|
1639
|
-
|
|
1640
|
-
|
|
1700
|
+
/**
|
|
1701
|
+
* The client could choose to store the authKey and use it for all requests; setting it to undefined will unset the authKey
|
|
1702
|
+
* The authKey can be overridden at the request level by request options
|
|
1703
|
+
* @param authKey - The auth key
|
|
1704
|
+
*/
|
|
1705
|
+
setAuthKey(authKey: string | undefined): void;
|
|
1706
|
+
/**
|
|
1707
|
+
* Get the auth key if it’s set in the client
|
|
1708
|
+
* @returns {string | undefined} - The auth key
|
|
1709
|
+
*/
|
|
1710
|
+
getAuthKey(): string | undefined;
|
|
1711
|
+
/**
|
|
1712
|
+
* Set the factory address of smart wallets for the client
|
|
1713
|
+
* @param address - The factory address
|
|
1714
|
+
*/
|
|
1715
|
+
setFactoryAddress(address: string): void;
|
|
1716
|
+
/**
|
|
1717
|
+
* Get the factory address if it’s set in the client
|
|
1718
|
+
* @returns {string | undefined} - The factory address
|
|
1719
|
+
*/
|
|
1720
|
+
getFactoryAddress(): string | undefined;
|
|
1721
|
+
/**
|
|
1722
|
+
* Send a gRPC request with an auth key
|
|
1723
|
+
* @param method - The method name
|
|
1724
|
+
* @param request - The request message
|
|
1725
|
+
* @param options - The request options
|
|
1726
|
+
* @returns {Promise<TResponse>} - The response from the gRPC call
|
|
1727
|
+
*/
|
|
1728
|
+
protected sendGrpcRequest<TResponse, TRequest>(method: string, request: TRequest | any, options?: RequestOptions): Promise<TResponse>;
|
|
1641
1729
|
}
|
|
1642
1730
|
declare class Client extends BaseClient {
|
|
1643
1731
|
constructor(config: ClientOption);
|
|
1644
1732
|
/**
|
|
1645
|
-
* Get the list of smart wallets; new wallets can be added to the list by calling `
|
|
1733
|
+
* Get the list of smart wallets; new wallets can be added to the list by calling `getWallet`
|
|
1646
1734
|
* @param {RequestOptions} options - Request options
|
|
1647
1735
|
* @returns {Promise<SmartWallet[]>} - The list of SmartWallet objects
|
|
1648
1736
|
*/
|
|
1649
|
-
getWallets(options
|
|
1737
|
+
getWallets(options?: RequestOptions): Promise<SmartWallet[]>;
|
|
1650
1738
|
/**
|
|
1651
1739
|
* Add a new smart wallet address to the wallet list
|
|
1652
1740
|
* @param {string} salt - The salt for the wallet
|
|
1653
|
-
* @param {string} factoryAddress - Factory address for the wallet
|
|
1741
|
+
* @param {string} factoryAddress - Factory address for the wallet; if not provided, the address stored in the client will be used
|
|
1654
1742
|
* @param {RequestOptions} options - Request options
|
|
1655
1743
|
* @returns {Promise<SmartWallet>} - The added SmartWallet object
|
|
1656
1744
|
*/
|
|
1657
|
-
|
|
1745
|
+
getWallet({ salt, factoryAddress }: GetWalletRequest, options?: RequestOptions): Promise<SmartWallet>;
|
|
1658
1746
|
/**
|
|
1659
1747
|
* Submit a workflow to the AVS server; once the workflow is submitted, it cannot be modified
|
|
1660
1748
|
* @param {Workflow} workflow - Workflow object to submit
|
|
1661
1749
|
* @param {RequestOptions} options - Request options
|
|
1662
1750
|
* @returns {Promise<string>} - The Id of the submitted workflow
|
|
1663
1751
|
*/
|
|
1664
|
-
submitWorkflow(workflow: Workflow, options
|
|
1752
|
+
submitWorkflow(workflow: Workflow, options?: RequestOptions): Promise<string>;
|
|
1665
1753
|
createWorkflow(props: WorkflowProps): Workflow;
|
|
1666
1754
|
/**
|
|
1667
1755
|
* Get the list of workflows; new workflows can be created by calling `submitWorkflow`
|
|
@@ -1671,19 +1759,20 @@ declare class Client extends BaseClient {
|
|
|
1671
1759
|
* @param {RequestOptions} options - Request options
|
|
1672
1760
|
* @returns {Promise<{ cursor: string; result: Workflow[] }>} - The list of Workflow objects
|
|
1673
1761
|
*/
|
|
1674
|
-
getWorkflows(address: string,
|
|
1762
|
+
getWorkflows(address: string, options?: GetWorkflowsRequest): Promise<{
|
|
1675
1763
|
cursor: string;
|
|
1676
1764
|
result: Workflow[];
|
|
1677
1765
|
}>;
|
|
1678
1766
|
/**
|
|
1679
1767
|
* Get the list of executions for a workflow
|
|
1680
1768
|
* @param {string} workflowId - The Id of the workflow
|
|
1681
|
-
* @param {
|
|
1682
|
-
* @param {
|
|
1683
|
-
* @param {
|
|
1769
|
+
* @param {GetExecutionsRequest} options - Request options
|
|
1770
|
+
* @param {string} [options.cursor] - The cursor for pagination
|
|
1771
|
+
* @param {number} [options.limit] - The page limit of the response; default is 10
|
|
1772
|
+
* @param {string} [options.authKey] - The auth key for the request
|
|
1684
1773
|
* @returns {Promise<{ cursor: string; result: Execution[] }>} - The list of Executions
|
|
1685
1774
|
*/
|
|
1686
|
-
getExecutions(workflowId: string,
|
|
1775
|
+
getExecutions(workflowId: string, options?: GetExecutionsRequest): Promise<{
|
|
1687
1776
|
cursor: string;
|
|
1688
1777
|
result: Execution[];
|
|
1689
1778
|
}>;
|
|
@@ -1693,22 +1782,34 @@ declare class Client extends BaseClient {
|
|
|
1693
1782
|
* @param {RequestOptions} options - Request options
|
|
1694
1783
|
* @returns {Promise<Workflow>} - The Workflow object
|
|
1695
1784
|
*/
|
|
1696
|
-
getWorkflow(id: string, options
|
|
1697
|
-
|
|
1785
|
+
getWorkflow(id: string, options?: RequestOptions): Promise<Workflow>;
|
|
1786
|
+
/**
|
|
1787
|
+
* Manually trigger a workflow by its Id, and manual trigger data input
|
|
1788
|
+
* @param id - The Id of the workflow
|
|
1789
|
+
* @param triggerData - The data of the trigger
|
|
1790
|
+
* @param isBlocking - Whether the trigger is blocking
|
|
1791
|
+
* @param options - Request options
|
|
1792
|
+
* @returns {Promise<avs_pb.UserTriggerTaskResp>} - The response from the trigger workflow call
|
|
1793
|
+
*/
|
|
1794
|
+
triggerWorkflow({ id, data, isBlocking, }: {
|
|
1795
|
+
id: string;
|
|
1796
|
+
data: TriggerMetadataProps;
|
|
1797
|
+
isBlocking: boolean;
|
|
1798
|
+
}, options?: RequestOptions): Promise<UserTriggerTaskResp.AsObject>;
|
|
1698
1799
|
/**
|
|
1699
1800
|
* Cancel a workflow by its Id
|
|
1700
1801
|
* @param {string} id - The Id of the workflow
|
|
1701
1802
|
* @param {RequestOptions} options - Request options
|
|
1702
1803
|
* @returns {Promise<boolean>} - Whether the workflow was successfully canceled
|
|
1703
1804
|
*/
|
|
1704
|
-
cancelWorkflow(id: string, options
|
|
1805
|
+
cancelWorkflow(id: string, options?: RequestOptions): Promise<boolean>;
|
|
1705
1806
|
/**
|
|
1706
1807
|
* Delete a workflow by its Id
|
|
1707
1808
|
* @param {string} id - The Id of the workflow
|
|
1708
1809
|
* @param {RequestOptions} options - Request options
|
|
1709
1810
|
* @returns {Promise<boolean>} - Whether the workflow was successfully deleted
|
|
1710
1811
|
*/
|
|
1711
|
-
deleteWorkflow(id: string, options
|
|
1812
|
+
deleteWorkflow(id: string, options?: RequestOptions): Promise<boolean>;
|
|
1712
1813
|
}
|
|
1713
1814
|
|
|
1714
|
-
export { AUTH_KEY_HEADER, BlockTrigger, type BlockTriggerProps, BranchNode, type BranchNodeData, type BranchNodeProps, type ClientOption, ContractReadNode, type ContractReadNodeProps, ContractWriteNode, type ContractWriteNodeProps, CronTrigger, type CronTriggerProps, CustomCodeLangs, CustomCodeNode, type CustomCodeNodeProps, ETHTransferNode, type ETHTransferNodeProps, Edge, type EdgeProps, type Environment, EventTrigger, type EventTriggerProps, Execution, FixedTimeTrigger, type FixedTimeTriggerProps, type GetKeyResponse, GraphQLQueryNode, type GraphQLQueryNodeProps, Node, NodeFactory, type NodeProps, type NodeType, NodeTypes, type RequestOptions, RestAPINode, type RestAPINodeProps, type SmartWallet, Trigger, TriggerFactory, type TriggerProps, type TriggerType, TriggerTypes, Workflow, type WorkflowProps, type WorkflowStatus, WorkflowStatuses, Client as default, getKeyRequestMessage };
|
|
1815
|
+
export { AUTH_KEY_HEADER, BlockTrigger, type BlockTriggerProps, BranchNode, type BranchNodeData, type BranchNodeProps, type ClientOption, ContractReadNode, type ContractReadNodeProps, ContractWriteNode, type ContractWriteNodeProps, CronTrigger, type CronTriggerProps, CustomCodeLangs, CustomCodeNode, type CustomCodeNodeProps, DEFAULT_LIMIT, ETHTransferNode, type ETHTransferNodeProps, Edge, type EdgeProps, type Environment, EventTrigger, type EventTriggerProps, Execution, FixedTimeTrigger, type FixedTimeTriggerProps, type GetExecutionsRequest, type GetKeyResponse, type GetWalletRequest, type GetWorkflowsRequest, GraphQLQueryNode, type GraphQLQueryNodeProps, Node, NodeFactory, type NodeProps, type NodeType, NodeTypes, type RequestOptions, RestAPINode, type RestAPINodeProps, type SmartWallet, Trigger, TriggerFactory, type TriggerProps, type TriggerType, TriggerTypes, Workflow, type WorkflowProps, type WorkflowStatus, WorkflowStatuses, Client as default, getKeyRequestMessage };
|