@chainlink/cre-sdk 1.17.0-alpha.2 → 1.17.0-alpha.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/generated/capabilities/blockchain/aptos/v1alpha/client_pb.d.ts +1035 -0
- package/dist/generated/capabilities/blockchain/aptos/v1alpha/client_pb.js +290 -0
- package/dist/generated/sdk/v1alpha/sdk_pb.d.ts +6 -2
- package/dist/generated/sdk/v1alpha/sdk_pb.js +5 -1
- package/dist/generated/workflows/v2/cre_info_pb.d.ts +123 -0
- package/dist/generated/workflows/v2/cre_info_pb.js +17 -0
- package/dist/generated/workflows/v2/workflow_key_pb.d.ts +55 -0
- package/dist/generated/workflows/v2/workflow_key_pb.js +17 -0
- package/dist/generated/workflows/v2/workflow_user_metric_pb.d.ts +118 -0
- package/dist/generated/workflows/v2/workflow_user_metric_pb.js +41 -0
- package/dist/generated-sdk/capabilities/blockchain/aptos/v1alpha/client_sdk_gen.d.ts +63 -0
- package/dist/generated-sdk/capabilities/blockchain/aptos/v1alpha/client_sdk_gen.js +247 -0
- package/dist/generated-sdk/capabilities/blockchain/evm/v1alpha/client_sdk_gen.d.ts +13 -0
- package/dist/generated-sdk/capabilities/blockchain/evm/v1alpha/client_sdk_gen.js +94 -0
- package/dist/generated-sdk/capabilities/blockchain/solana/v1alpha/client_sdk_gen.d.ts +15 -0
- package/dist/generated-sdk/capabilities/blockchain/solana/v1alpha/client_sdk_gen.js +116 -0
- package/dist/generated-sdk/capabilities/internal/consensus/v1alpha/consensus_sdk_gen.d.ts +5 -1
- package/dist/generated-sdk/capabilities/internal/consensus/v1alpha/consensus_sdk_gen.js +22 -0
- package/dist/generated-sdk/capabilities/networking/confidentialhttp/v1alpha/client_sdk_gen.d.ts +4 -0
- package/dist/generated-sdk/capabilities/networking/confidentialhttp/v1alpha/client_sdk_gen.js +12 -0
- package/dist/generated-sdk/capabilities/networking/http/v1alpha/client_sdk_gen.d.ts +12 -2
- package/dist/generated-sdk/capabilities/networking/http/v1alpha/client_sdk_gen.js +12 -0
- package/dist/generated-sdk/capabilities/networking/http/v1alpha/http_sdk_gen.d.ts +2 -0
- package/dist/generated-sdk/capabilities/networking/http/v1alpha/http_sdk_gen.js +2 -0
- package/dist/generated-sdk/capabilities/scheduler/cron/v1/cron_sdk_gen.d.ts +2 -0
- package/dist/generated-sdk/capabilities/scheduler/cron/v1/cron_sdk_gen.js +2 -0
- package/dist/sdk/cre/index.d.ts +30 -15
- package/dist/sdk/cre/index.js +29 -14
- package/dist/sdk/impl/runtime-impl.d.ts +29 -2
- package/dist/sdk/impl/runtime-impl.js +55 -6
- package/dist/sdk/runtime.d.ts +24 -2
- package/dist/sdk/tee-constraints.d.ts +68 -0
- package/dist/sdk/tee-constraints.js +59 -0
- package/dist/sdk/test/generated/capabilities/blockchain/aptos/v1alpha/aptos_mock_gen.d.ts +25 -0
- package/dist/sdk/test/generated/capabilities/blockchain/aptos/v1alpha/aptos_mock_gen.js +111 -0
- package/dist/sdk/test/generated/index.d.ts +1 -0
- package/dist/sdk/test/generated/index.js +1 -0
- package/dist/sdk/testutils/index.d.ts +1 -1
- package/dist/sdk/testutils/index.js +1 -1
- package/dist/sdk/testutils/test-runtime.d.ts +17 -4
- package/dist/sdk/testutils/test-runtime.js +31 -5
- package/dist/sdk/testutils/test-writer.d.ts +7 -1
- package/dist/sdk/testutils/test-writer.js +13 -1
- package/dist/sdk/types/global.d.ts +8 -0
- package/dist/sdk/utils/capabilities/blockchain/solana/solana-helpers.js +1 -1
- package/dist/sdk/utils/values/consensus_aggregators.d.ts +16 -8
- package/dist/sdk/utils/values/consensus_aggregators.js +20 -3
- package/dist/sdk/utils/values/serializer_types.d.ts +1 -1
- package/dist/sdk/wasm/host-bindings.d.ts +4 -0
- package/dist/sdk/wasm/host-bindings.js +4 -0
- package/dist/sdk/wasm/runner.d.ts +10 -4
- package/dist/sdk/wasm/runner.js +86 -13
- package/dist/sdk/wasm/runtime.d.ts +4 -1
- package/dist/sdk/wasm/runtime.js +9 -1
- package/dist/sdk/workflow.d.ts +16 -7
- package/dist/sdk/workflow.js +10 -2
- package/dist/workflows/standard_tests/frequency_list/test.ts +75 -0
- package/dist/workflows/standard_tests/restrictions/test.ts +41 -0
- package/dist/workflows/standard_tests/tee_runtime/test.ts +29 -0
- package/package.json +3 -2
- package/scripts/src/generate-sdks.ts +6 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { Message } from '@bufbuild/protobuf';
|
|
2
|
+
import type { GenEnum, GenFile, GenMessage } from '@bufbuild/protobuf/codegenv2';
|
|
3
|
+
import type { CreInfo, CreInfoJson } from './cre_info_pb';
|
|
4
|
+
import type { WorkflowKey, WorkflowKeyJson } from './workflow_key_pb';
|
|
5
|
+
/**
|
|
6
|
+
* Describes the file workflows/v2/workflow_user_metric.proto.
|
|
7
|
+
*/
|
|
8
|
+
export declare const file_workflows_v2_workflow_user_metric: GenFile;
|
|
9
|
+
/**
|
|
10
|
+
* @generated from message workflows.v2.WorkflowUserMetric
|
|
11
|
+
*/
|
|
12
|
+
export type WorkflowUserMetric = Message<'workflows.v2.WorkflowUserMetric'> & {
|
|
13
|
+
/**
|
|
14
|
+
* @generated from field: workflows.v2.CreInfo creInfo = 1;
|
|
15
|
+
*/
|
|
16
|
+
creInfo?: CreInfo;
|
|
17
|
+
/**
|
|
18
|
+
* @generated from field: workflows.v2.WorkflowKey workflow = 2;
|
|
19
|
+
*/
|
|
20
|
+
workflow?: WorkflowKey;
|
|
21
|
+
/**
|
|
22
|
+
* @generated from field: string workflowExecutionID = 3;
|
|
23
|
+
*/
|
|
24
|
+
workflowExecutionID: string;
|
|
25
|
+
/**
|
|
26
|
+
* @generated from field: string timestamp = 4;
|
|
27
|
+
*/
|
|
28
|
+
timestamp: string;
|
|
29
|
+
/**
|
|
30
|
+
* @generated from field: string name = 5;
|
|
31
|
+
*/
|
|
32
|
+
name: string;
|
|
33
|
+
/**
|
|
34
|
+
* @generated from field: double value = 6;
|
|
35
|
+
*/
|
|
36
|
+
value: number;
|
|
37
|
+
/**
|
|
38
|
+
* @generated from field: workflows.v2.UserMetricType type = 7;
|
|
39
|
+
*/
|
|
40
|
+
type: UserMetricType;
|
|
41
|
+
/**
|
|
42
|
+
* @generated from field: map<string, string> labels = 8;
|
|
43
|
+
*/
|
|
44
|
+
labels: {
|
|
45
|
+
[key: string]: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* @generated from message workflows.v2.WorkflowUserMetric
|
|
50
|
+
*/
|
|
51
|
+
export type WorkflowUserMetricJson = {
|
|
52
|
+
/**
|
|
53
|
+
* @generated from field: workflows.v2.CreInfo creInfo = 1;
|
|
54
|
+
*/
|
|
55
|
+
creInfo?: CreInfoJson;
|
|
56
|
+
/**
|
|
57
|
+
* @generated from field: workflows.v2.WorkflowKey workflow = 2;
|
|
58
|
+
*/
|
|
59
|
+
workflow?: WorkflowKeyJson;
|
|
60
|
+
/**
|
|
61
|
+
* @generated from field: string workflowExecutionID = 3;
|
|
62
|
+
*/
|
|
63
|
+
workflowExecutionID?: string;
|
|
64
|
+
/**
|
|
65
|
+
* @generated from field: string timestamp = 4;
|
|
66
|
+
*/
|
|
67
|
+
timestamp?: string;
|
|
68
|
+
/**
|
|
69
|
+
* @generated from field: string name = 5;
|
|
70
|
+
*/
|
|
71
|
+
name?: string;
|
|
72
|
+
/**
|
|
73
|
+
* @generated from field: double value = 6;
|
|
74
|
+
*/
|
|
75
|
+
value?: number | 'NaN' | 'Infinity' | '-Infinity';
|
|
76
|
+
/**
|
|
77
|
+
* @generated from field: workflows.v2.UserMetricType type = 7;
|
|
78
|
+
*/
|
|
79
|
+
type?: UserMetricTypeJson;
|
|
80
|
+
/**
|
|
81
|
+
* @generated from field: map<string, string> labels = 8;
|
|
82
|
+
*/
|
|
83
|
+
labels?: {
|
|
84
|
+
[key: string]: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Describes the message workflows.v2.WorkflowUserMetric.
|
|
89
|
+
* Use `create(WorkflowUserMetricSchema)` to create a new message.
|
|
90
|
+
*/
|
|
91
|
+
export declare const WorkflowUserMetricSchema: GenMessage<WorkflowUserMetric, {
|
|
92
|
+
jsonType: WorkflowUserMetricJson;
|
|
93
|
+
}>;
|
|
94
|
+
/**
|
|
95
|
+
* @generated from enum workflows.v2.UserMetricType
|
|
96
|
+
*/
|
|
97
|
+
export declare enum UserMetricType {
|
|
98
|
+
/**
|
|
99
|
+
* @generated from enum value: USER_METRIC_TYPE_UNSPECIFIED = 0;
|
|
100
|
+
*/
|
|
101
|
+
UNSPECIFIED = 0,
|
|
102
|
+
/**
|
|
103
|
+
* @generated from enum value: USER_METRIC_TYPE_COUNTER = 1;
|
|
104
|
+
*/
|
|
105
|
+
COUNTER = 1,
|
|
106
|
+
/**
|
|
107
|
+
* @generated from enum value: USER_METRIC_TYPE_GAUGE = 2;
|
|
108
|
+
*/
|
|
109
|
+
GAUGE = 2
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* @generated from enum workflows.v2.UserMetricType
|
|
113
|
+
*/
|
|
114
|
+
export type UserMetricTypeJson = 'USER_METRIC_TYPE_UNSPECIFIED' | 'USER_METRIC_TYPE_COUNTER' | 'USER_METRIC_TYPE_GAUGE';
|
|
115
|
+
/**
|
|
116
|
+
* Describes the enum workflows.v2.UserMetricType.
|
|
117
|
+
*/
|
|
118
|
+
export declare const UserMetricTypeSchema: GenEnum<UserMetricType, UserMetricTypeJson>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// @generated by protoc-gen-es v2.6.3 with parameter "target=ts,import_extension=none,json_types=true,keep_empty_files=false"
|
|
2
|
+
// @generated from file workflows/v2/workflow_user_metric.proto (package workflows.v2, syntax proto3)
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
import { enumDesc, fileDesc, messageDesc } from '@bufbuild/protobuf/codegenv2';
|
|
5
|
+
import { file_workflows_v2_cre_info } from './cre_info_pb';
|
|
6
|
+
import { file_workflows_v2_workflow_key } from './workflow_key_pb';
|
|
7
|
+
/**
|
|
8
|
+
* Describes the file workflows/v2/workflow_user_metric.proto.
|
|
9
|
+
*/
|
|
10
|
+
export const file_workflows_v2_workflow_user_metric =
|
|
11
|
+
/*@__PURE__*/
|
|
12
|
+
fileDesc('Cid3b3JrZmxvd3MvdjIvd29ya2Zsb3dfdXNlcl9tZXRyaWMucHJvdG8SDHdvcmtmbG93cy52MiLPAgoSV29ya2Zsb3dVc2VyTWV0cmljEiYKB2NyZUluZm8YASABKAsyFS53b3JrZmxvd3MudjIuQ3JlSW5mbxIrCgh3b3JrZmxvdxgCIAEoCzIZLndvcmtmbG93cy52Mi5Xb3JrZmxvd0tleRIbChN3b3JrZmxvd0V4ZWN1dGlvbklEGAMgASgJEhEKCXRpbWVzdGFtcBgEIAEoCRIMCgRuYW1lGAUgASgJEg0KBXZhbHVlGAYgASgBEioKBHR5cGUYByABKA4yHC53b3JrZmxvd3MudjIuVXNlck1ldHJpY1R5cGUSPAoGbGFiZWxzGAggAygLMiwud29ya2Zsb3dzLnYyLldvcmtmbG93VXNlck1ldHJpYy5MYWJlbHNFbnRyeRotCgtMYWJlbHNFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBKmwKDlVzZXJNZXRyaWNUeXBlEiAKHFVTRVJfTUVUUklDX1RZUEVfVU5TUEVDSUZJRUQQABIcChhVU0VSX01FVFJJQ19UWVBFX0NPVU5URVIQARIaChZVU0VSX01FVFJJQ19UWVBFX0dBVUdFEAJCugEKEGNvbS53b3JrZmxvd3MudjJCF1dvcmtmbG93VXNlck1ldHJpY1Byb3RvUAFaPGdpdGh1Yi5jb20vc21hcnRjb250cmFjdGtpdC9jaGFpbmxpbmstcHJvdG9zL3dvcmtmbG93cy9nby92MqICA1dYWKoCDFdvcmtmbG93cy5WMsoCDFdvcmtmbG93c1xWMuICGFdvcmtmbG93c1xWMlxHUEJNZXRhZGF0YeoCDVdvcmtmbG93czo6VjJiBnByb3RvMw', [file_workflows_v2_cre_info, file_workflows_v2_workflow_key]);
|
|
13
|
+
/**
|
|
14
|
+
* Describes the message workflows.v2.WorkflowUserMetric.
|
|
15
|
+
* Use `create(WorkflowUserMetricSchema)` to create a new message.
|
|
16
|
+
*/
|
|
17
|
+
export const WorkflowUserMetricSchema = /*@__PURE__*/ messageDesc(file_workflows_v2_workflow_user_metric, 0);
|
|
18
|
+
/**
|
|
19
|
+
* @generated from enum workflows.v2.UserMetricType
|
|
20
|
+
*/
|
|
21
|
+
export var UserMetricType;
|
|
22
|
+
(function (UserMetricType) {
|
|
23
|
+
/**
|
|
24
|
+
* @generated from enum value: USER_METRIC_TYPE_UNSPECIFIED = 0;
|
|
25
|
+
*/
|
|
26
|
+
UserMetricType[UserMetricType["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
27
|
+
/**
|
|
28
|
+
* @generated from enum value: USER_METRIC_TYPE_COUNTER = 1;
|
|
29
|
+
*/
|
|
30
|
+
UserMetricType[UserMetricType["COUNTER"] = 1] = "COUNTER";
|
|
31
|
+
/**
|
|
32
|
+
* @generated from enum value: USER_METRIC_TYPE_GAUGE = 2;
|
|
33
|
+
*/
|
|
34
|
+
UserMetricType[UserMetricType["GAUGE"] = 2] = "GAUGE";
|
|
35
|
+
})(UserMetricType || (UserMetricType = {}));
|
|
36
|
+
/**
|
|
37
|
+
* Describes the enum workflows.v2.UserMetricType.
|
|
38
|
+
*/
|
|
39
|
+
export const UserMetricTypeSchema =
|
|
40
|
+
/*@__PURE__*/
|
|
41
|
+
enumDesc(file_workflows_v2_workflow_user_metric, 0);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type AccountAPTBalanceReply, type AccountAPTBalanceRequest, type AccountAPTBalanceRequestJson, type AccountTransactionsReply, type AccountTransactionsRequest, type AccountTransactionsRequestJson, type GasConfig, type GasConfigJson, type TransactionByHashReply, type TransactionByHashRequest, type TransactionByHashRequestJson, type ViewReply, type ViewRequest, type ViewRequestJson, type WriteReportReply, type WriteReportRequest } from '../../../../../generated/capabilities/blockchain/aptos/v1alpha/client_pb';
|
|
2
|
+
import { type CapabilityRestrictionJson } from '../../../../../generated/sdk/v1alpha/sdk_pb';
|
|
3
|
+
import type { Runtime } from '../../../../../sdk';
|
|
4
|
+
import { Report } from '../../../../../sdk/report';
|
|
5
|
+
import type { CapabilityInput } from '../../../../../sdk/utils/types/no-excess';
|
|
6
|
+
export type WriteCreReportRequest = {
|
|
7
|
+
receiver: Uint8Array;
|
|
8
|
+
gasConfig?: GasConfig;
|
|
9
|
+
report?: Report;
|
|
10
|
+
$report: true;
|
|
11
|
+
};
|
|
12
|
+
export type WriteCreReportRequestJson = {
|
|
13
|
+
receiver: string;
|
|
14
|
+
gasConfig?: GasConfigJson;
|
|
15
|
+
report?: Report;
|
|
16
|
+
};
|
|
17
|
+
export declare function x_generatedCodeOnly_wrap_WriteCreReportRequest(input: WriteReportRequest): WriteCreReportRequest;
|
|
18
|
+
export declare function createWriteCreReportRequest(input: WriteCreReportRequestJson): WriteCreReportRequest;
|
|
19
|
+
export declare function x_generatedCodeOnly_unwrap_WriteCreReportRequest(input: WriteCreReportRequest): WriteReportRequest;
|
|
20
|
+
/**
|
|
21
|
+
* Client Capability
|
|
22
|
+
*
|
|
23
|
+
* Capability ID: aptos@1.0.0
|
|
24
|
+
* Capability Name: aptos
|
|
25
|
+
* Capability Version: 1.0.0
|
|
26
|
+
*/
|
|
27
|
+
export declare class ClientCapability {
|
|
28
|
+
private readonly ChainSelector;
|
|
29
|
+
/** The capability ID for this service */
|
|
30
|
+
static readonly CAPABILITY_ID = "aptos@1.0.0";
|
|
31
|
+
static readonly CAPABILITY_NAME = "aptos";
|
|
32
|
+
static readonly CAPABILITY_VERSION = "1.0.0";
|
|
33
|
+
/** Available ChainSelector values */
|
|
34
|
+
static readonly SUPPORTED_CHAIN_SELECTORS: {
|
|
35
|
+
readonly 'aptos-mainnet': 4741433654826277614n;
|
|
36
|
+
readonly 'aptos-testnet': 743186221051783445n;
|
|
37
|
+
};
|
|
38
|
+
constructor(ChainSelector: bigint);
|
|
39
|
+
accountAPTBalance<TInput>(runtime: Runtime<unknown>, input: CapabilityInput<TInput, AccountAPTBalanceRequest, AccountAPTBalanceRequestJson>): {
|
|
40
|
+
result: () => AccountAPTBalanceReply;
|
|
41
|
+
};
|
|
42
|
+
view<TInput>(runtime: Runtime<unknown>, input: CapabilityInput<TInput, ViewRequest, ViewRequestJson>): {
|
|
43
|
+
result: () => ViewReply;
|
|
44
|
+
};
|
|
45
|
+
transactionByHash<TInput>(runtime: Runtime<unknown>, input: CapabilityInput<TInput, TransactionByHashRequest, TransactionByHashRequestJson>): {
|
|
46
|
+
result: () => TransactionByHashReply;
|
|
47
|
+
};
|
|
48
|
+
accountTransactions<TInput>(runtime: Runtime<unknown>, input: CapabilityInput<TInput, AccountTransactionsRequest, AccountTransactionsRequestJson>): {
|
|
49
|
+
result: () => AccountTransactionsReply;
|
|
50
|
+
};
|
|
51
|
+
writeReport<TInput>(runtime: Runtime<unknown>, input: CapabilityInput<TInput, WriteCreReportRequest, WriteCreReportRequestJson>): {
|
|
52
|
+
result: () => WriteReportReply;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export declare class ClientRestrictor {
|
|
56
|
+
private readonly ChainSelector;
|
|
57
|
+
constructor(ChainSelector: bigint);
|
|
58
|
+
limitAccountAPTBalance(maxCalls: number): CapabilityRestrictionJson;
|
|
59
|
+
limitView(maxCalls: number): CapabilityRestrictionJson;
|
|
60
|
+
limitTransactionByHash(maxCalls: number): CapabilityRestrictionJson;
|
|
61
|
+
limitAccountTransactions(maxCalls: number): CapabilityRestrictionJson;
|
|
62
|
+
limitWriteReport(maxCalls: number): CapabilityRestrictionJson;
|
|
63
|
+
}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { create, fromJson } from '@bufbuild/protobuf';
|
|
2
|
+
import { AccountAPTBalanceReplySchema, AccountAPTBalanceRequestSchema, AccountTransactionsReplySchema, AccountTransactionsRequestSchema, GasConfigSchema, TransactionByHashReplySchema, TransactionByHashRequestSchema, ViewReplySchema, ViewRequestSchema, WriteReportReplySchema, WriteReportRequestSchema, } from '../../../../../generated/capabilities/blockchain/aptos/v1alpha/client_pb';
|
|
3
|
+
import { ReportResponseSchema, } from '../../../../../generated/sdk/v1alpha/sdk_pb';
|
|
4
|
+
import { Report } from '../../../../../sdk/report';
|
|
5
|
+
import { hexToBytes } from '../../../../../sdk/utils/hex-utils';
|
|
6
|
+
export function x_generatedCodeOnly_wrap_WriteCreReportRequest(input) {
|
|
7
|
+
return {
|
|
8
|
+
receiver: input.receiver,
|
|
9
|
+
gasConfig: input.gasConfig,
|
|
10
|
+
report: input.report !== undefined ? new Report(input.report) : undefined,
|
|
11
|
+
$report: true,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function createWriteCreReportRequest(input) {
|
|
15
|
+
return {
|
|
16
|
+
receiver: hexToBytes(input.receiver),
|
|
17
|
+
gasConfig: input.gasConfig !== undefined ? fromJson(GasConfigSchema, input.gasConfig) : undefined,
|
|
18
|
+
report: input.report,
|
|
19
|
+
$report: true,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function x_generatedCodeOnly_unwrap_WriteCreReportRequest(input) {
|
|
23
|
+
return create(WriteReportRequestSchema, {
|
|
24
|
+
receiver: input.receiver,
|
|
25
|
+
gasConfig: input.gasConfig,
|
|
26
|
+
report: input.report !== undefined ? input.report.x_generatedCodeOnly_unwrap() : undefined,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Client Capability
|
|
31
|
+
*
|
|
32
|
+
* Capability ID: aptos@1.0.0
|
|
33
|
+
* Capability Name: aptos
|
|
34
|
+
* Capability Version: 1.0.0
|
|
35
|
+
*/
|
|
36
|
+
export class ClientCapability {
|
|
37
|
+
ChainSelector;
|
|
38
|
+
/** The capability ID for this service */
|
|
39
|
+
static CAPABILITY_ID = 'aptos@1.0.0';
|
|
40
|
+
static CAPABILITY_NAME = 'aptos';
|
|
41
|
+
static CAPABILITY_VERSION = '1.0.0';
|
|
42
|
+
/** Available ChainSelector values */
|
|
43
|
+
static SUPPORTED_CHAIN_SELECTORS = {
|
|
44
|
+
'aptos-mainnet': 4741433654826277614n,
|
|
45
|
+
'aptos-testnet': 743186221051783445n,
|
|
46
|
+
};
|
|
47
|
+
constructor(ChainSelector) {
|
|
48
|
+
this.ChainSelector = ChainSelector;
|
|
49
|
+
}
|
|
50
|
+
accountAPTBalance(runtime, input) {
|
|
51
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
52
|
+
let payload;
|
|
53
|
+
if (input.$typeName) {
|
|
54
|
+
// It's the original protobuf type
|
|
55
|
+
payload = input;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// It's regular JSON, convert using fromJson
|
|
59
|
+
payload = fromJson(AccountAPTBalanceRequestSchema, input);
|
|
60
|
+
}
|
|
61
|
+
// Include all labels in capability ID for routing when specified
|
|
62
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
63
|
+
const capabilityResponse = runtime.callCapability({
|
|
64
|
+
capabilityId,
|
|
65
|
+
method: 'AccountAPTBalance',
|
|
66
|
+
payload,
|
|
67
|
+
inputSchema: AccountAPTBalanceRequestSchema,
|
|
68
|
+
outputSchema: AccountAPTBalanceReplySchema,
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
result: () => {
|
|
72
|
+
const result = capabilityResponse.result();
|
|
73
|
+
return result;
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
view(runtime, input) {
|
|
78
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
79
|
+
let payload;
|
|
80
|
+
if (input.$typeName) {
|
|
81
|
+
// It's the original protobuf type
|
|
82
|
+
payload = input;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// It's regular JSON, convert using fromJson
|
|
86
|
+
payload = fromJson(ViewRequestSchema, input);
|
|
87
|
+
}
|
|
88
|
+
// Include all labels in capability ID for routing when specified
|
|
89
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
90
|
+
const capabilityResponse = runtime.callCapability({
|
|
91
|
+
capabilityId,
|
|
92
|
+
method: 'View',
|
|
93
|
+
payload,
|
|
94
|
+
inputSchema: ViewRequestSchema,
|
|
95
|
+
outputSchema: ViewReplySchema,
|
|
96
|
+
});
|
|
97
|
+
return {
|
|
98
|
+
result: () => {
|
|
99
|
+
const result = capabilityResponse.result();
|
|
100
|
+
return result;
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
transactionByHash(runtime, input) {
|
|
105
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
106
|
+
let payload;
|
|
107
|
+
if (input.$typeName) {
|
|
108
|
+
// It's the original protobuf type
|
|
109
|
+
payload = input;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
// It's regular JSON, convert using fromJson
|
|
113
|
+
payload = fromJson(TransactionByHashRequestSchema, input);
|
|
114
|
+
}
|
|
115
|
+
// Include all labels in capability ID for routing when specified
|
|
116
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
117
|
+
const capabilityResponse = runtime.callCapability({
|
|
118
|
+
capabilityId,
|
|
119
|
+
method: 'TransactionByHash',
|
|
120
|
+
payload,
|
|
121
|
+
inputSchema: TransactionByHashRequestSchema,
|
|
122
|
+
outputSchema: TransactionByHashReplySchema,
|
|
123
|
+
});
|
|
124
|
+
return {
|
|
125
|
+
result: () => {
|
|
126
|
+
const result = capabilityResponse.result();
|
|
127
|
+
return result;
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
accountTransactions(runtime, input) {
|
|
132
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
133
|
+
let payload;
|
|
134
|
+
if (input.$typeName) {
|
|
135
|
+
// It's the original protobuf type
|
|
136
|
+
payload = input;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
// It's regular JSON, convert using fromJson
|
|
140
|
+
payload = fromJson(AccountTransactionsRequestSchema, input);
|
|
141
|
+
}
|
|
142
|
+
// Include all labels in capability ID for routing when specified
|
|
143
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
144
|
+
const capabilityResponse = runtime.callCapability({
|
|
145
|
+
capabilityId,
|
|
146
|
+
method: 'AccountTransactions',
|
|
147
|
+
payload,
|
|
148
|
+
inputSchema: AccountTransactionsRequestSchema,
|
|
149
|
+
outputSchema: AccountTransactionsReplySchema,
|
|
150
|
+
});
|
|
151
|
+
return {
|
|
152
|
+
result: () => {
|
|
153
|
+
const result = capabilityResponse.result();
|
|
154
|
+
return result;
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
writeReport(runtime, input) {
|
|
159
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
160
|
+
let payload;
|
|
161
|
+
// Check if it's a wrapped type by looking for the $report property
|
|
162
|
+
if (input.$report) {
|
|
163
|
+
// It's a wrapped type, unwrap it
|
|
164
|
+
payload = x_generatedCodeOnly_unwrap_WriteCreReportRequest(input);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
// It's wrapped JSON, convert using create function
|
|
168
|
+
payload = x_generatedCodeOnly_unwrap_WriteCreReportRequest(createWriteCreReportRequest(input));
|
|
169
|
+
}
|
|
170
|
+
// Include all labels in capability ID for routing when specified
|
|
171
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
172
|
+
const capabilityResponse = runtime.callCapability({
|
|
173
|
+
capabilityId,
|
|
174
|
+
method: 'WriteReport',
|
|
175
|
+
payload,
|
|
176
|
+
inputSchema: WriteReportRequestSchema,
|
|
177
|
+
outputSchema: WriteReportReplySchema,
|
|
178
|
+
});
|
|
179
|
+
return {
|
|
180
|
+
result: () => {
|
|
181
|
+
const result = capabilityResponse.result();
|
|
182
|
+
return result;
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
export class ClientRestrictor {
|
|
188
|
+
ChainSelector;
|
|
189
|
+
constructor(ChainSelector) {
|
|
190
|
+
this.ChainSelector = ChainSelector;
|
|
191
|
+
}
|
|
192
|
+
limitAccountAPTBalance(maxCalls) {
|
|
193
|
+
// Include all labels in capability ID for routing when specified
|
|
194
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
195
|
+
return {
|
|
196
|
+
method: {
|
|
197
|
+
id: capabilityId,
|
|
198
|
+
method: 'AccountAPTBalance',
|
|
199
|
+
maxCalls,
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
limitView(maxCalls) {
|
|
204
|
+
// Include all labels in capability ID for routing when specified
|
|
205
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
206
|
+
return {
|
|
207
|
+
method: {
|
|
208
|
+
id: capabilityId,
|
|
209
|
+
method: 'View',
|
|
210
|
+
maxCalls,
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
limitTransactionByHash(maxCalls) {
|
|
215
|
+
// Include all labels in capability ID for routing when specified
|
|
216
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
217
|
+
return {
|
|
218
|
+
method: {
|
|
219
|
+
id: capabilityId,
|
|
220
|
+
method: 'TransactionByHash',
|
|
221
|
+
maxCalls,
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
limitAccountTransactions(maxCalls) {
|
|
226
|
+
// Include all labels in capability ID for routing when specified
|
|
227
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
228
|
+
return {
|
|
229
|
+
method: {
|
|
230
|
+
id: capabilityId,
|
|
231
|
+
method: 'AccountTransactions',
|
|
232
|
+
maxCalls,
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
limitWriteReport(maxCalls) {
|
|
237
|
+
// Include all labels in capability ID for routing when specified
|
|
238
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
239
|
+
return {
|
|
240
|
+
method: {
|
|
241
|
+
id: capabilityId,
|
|
242
|
+
method: 'WriteReport',
|
|
243
|
+
maxCalls,
|
|
244
|
+
},
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Any } from '@bufbuild/protobuf/wkt';
|
|
2
2
|
import { type BalanceAtReply, type BalanceAtRequest, type BalanceAtRequestJson, type CallContractReply, type CallContractRequest, type CallContractRequestJson, type EstimateGasReply, type EstimateGasRequest, type EstimateGasRequestJson, type FilterLogsReply, type FilterLogsRequest, type FilterLogsRequestJson, type FilterLogTriggerRequest, type FilterLogTriggerRequestJson, type GasConfig, type GasConfigJson, type GetTransactionByHashReply, type GetTransactionByHashRequest, type GetTransactionByHashRequestJson, type GetTransactionReceiptReply, type GetTransactionReceiptRequest, type GetTransactionReceiptRequestJson, type HeaderByNumberReply, type HeaderByNumberRequest, type HeaderByNumberRequestJson, type Log, type WriteReportReply, type WriteReportRequest } from '../../../../../generated/capabilities/blockchain/evm/v1alpha/client_pb';
|
|
3
|
+
import { type CapabilityRestrictionJson } from '../../../../../generated/sdk/v1alpha/sdk_pb';
|
|
3
4
|
import type { Runtime } from '../../../../../sdk';
|
|
4
5
|
import { Report } from '../../../../../sdk/report';
|
|
5
6
|
import type { Trigger } from '../../../../../sdk/utils/triggers/trigger-interface';
|
|
@@ -139,4 +140,16 @@ declare class ClientLogTrigger implements Trigger<Log, Log> {
|
|
|
139
140
|
*/
|
|
140
141
|
adapt(rawOutput: Log): Log;
|
|
141
142
|
}
|
|
143
|
+
export declare class ClientRestrictor {
|
|
144
|
+
private readonly ChainSelector;
|
|
145
|
+
constructor(ChainSelector: bigint);
|
|
146
|
+
limitCallContract(maxCalls: number): CapabilityRestrictionJson;
|
|
147
|
+
limitFilterLogs(maxCalls: number): CapabilityRestrictionJson;
|
|
148
|
+
limitBalanceAt(maxCalls: number): CapabilityRestrictionJson;
|
|
149
|
+
limitEstimateGas(maxCalls: number): CapabilityRestrictionJson;
|
|
150
|
+
limitGetTransactionByHash(maxCalls: number): CapabilityRestrictionJson;
|
|
151
|
+
limitGetTransactionReceipt(maxCalls: number): CapabilityRestrictionJson;
|
|
152
|
+
limitHeaderByNumber(maxCalls: number): CapabilityRestrictionJson;
|
|
153
|
+
limitWriteReport(maxCalls: number): CapabilityRestrictionJson;
|
|
154
|
+
}
|
|
142
155
|
export {};
|
|
@@ -363,3 +363,97 @@ class ClientLogTrigger {
|
|
|
363
363
|
return rawOutput;
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
|
+
export class ClientRestrictor {
|
|
367
|
+
ChainSelector;
|
|
368
|
+
constructor(ChainSelector) {
|
|
369
|
+
this.ChainSelector = ChainSelector;
|
|
370
|
+
}
|
|
371
|
+
limitCallContract(maxCalls) {
|
|
372
|
+
// Include all labels in capability ID for routing when specified
|
|
373
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
374
|
+
return {
|
|
375
|
+
method: {
|
|
376
|
+
id: capabilityId,
|
|
377
|
+
method: 'CallContract',
|
|
378
|
+
maxCalls,
|
|
379
|
+
},
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
limitFilterLogs(maxCalls) {
|
|
383
|
+
// Include all labels in capability ID for routing when specified
|
|
384
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
385
|
+
return {
|
|
386
|
+
method: {
|
|
387
|
+
id: capabilityId,
|
|
388
|
+
method: 'FilterLogs',
|
|
389
|
+
maxCalls,
|
|
390
|
+
},
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
limitBalanceAt(maxCalls) {
|
|
394
|
+
// Include all labels in capability ID for routing when specified
|
|
395
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
396
|
+
return {
|
|
397
|
+
method: {
|
|
398
|
+
id: capabilityId,
|
|
399
|
+
method: 'BalanceAt',
|
|
400
|
+
maxCalls,
|
|
401
|
+
},
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
limitEstimateGas(maxCalls) {
|
|
405
|
+
// Include all labels in capability ID for routing when specified
|
|
406
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
407
|
+
return {
|
|
408
|
+
method: {
|
|
409
|
+
id: capabilityId,
|
|
410
|
+
method: 'EstimateGas',
|
|
411
|
+
maxCalls,
|
|
412
|
+
},
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
limitGetTransactionByHash(maxCalls) {
|
|
416
|
+
// Include all labels in capability ID for routing when specified
|
|
417
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
418
|
+
return {
|
|
419
|
+
method: {
|
|
420
|
+
id: capabilityId,
|
|
421
|
+
method: 'GetTransactionByHash',
|
|
422
|
+
maxCalls,
|
|
423
|
+
},
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
limitGetTransactionReceipt(maxCalls) {
|
|
427
|
+
// Include all labels in capability ID for routing when specified
|
|
428
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
429
|
+
return {
|
|
430
|
+
method: {
|
|
431
|
+
id: capabilityId,
|
|
432
|
+
method: 'GetTransactionReceipt',
|
|
433
|
+
maxCalls,
|
|
434
|
+
},
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
limitHeaderByNumber(maxCalls) {
|
|
438
|
+
// Include all labels in capability ID for routing when specified
|
|
439
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
440
|
+
return {
|
|
441
|
+
method: {
|
|
442
|
+
id: capabilityId,
|
|
443
|
+
method: 'HeaderByNumber',
|
|
444
|
+
maxCalls,
|
|
445
|
+
},
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
limitWriteReport(maxCalls) {
|
|
449
|
+
// Include all labels in capability ID for routing when specified
|
|
450
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
451
|
+
return {
|
|
452
|
+
method: {
|
|
453
|
+
id: capabilityId,
|
|
454
|
+
method: 'WriteReport',
|
|
455
|
+
maxCalls,
|
|
456
|
+
},
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Any } from '@bufbuild/protobuf/wkt';
|
|
2
2
|
import { type AccountMeta, type AccountMetaJson, type ComputeConfig, type ComputeConfigJson, type FilterLogTriggerRequest, type FilterLogTriggerRequestJson, type GetAccountInfoWithOptsReply, type GetAccountInfoWithOptsRequest, type GetAccountInfoWithOptsRequestJson, type GetBalanceReply, type GetBalanceRequest, type GetBalanceRequestJson, type GetBlockReply, type GetBlockRequest, type GetBlockRequestJson, type GetFeeForMessageReply, type GetFeeForMessageRequest, type GetFeeForMessageRequestJson, type GetMultipleAccountsWithOptsReply, type GetMultipleAccountsWithOptsRequest, type GetMultipleAccountsWithOptsRequestJson, type GetProgramAccountsReply, type GetProgramAccountsRequest, type GetProgramAccountsRequestJson, type GetSignatureStatusesReply, type GetSignatureStatusesRequest, type GetSignatureStatusesRequestJson, type GetSlotHeightReply, type GetSlotHeightRequest, type GetSlotHeightRequestJson, type GetTransactionReply, type GetTransactionRequest, type GetTransactionRequestJson, type Log, type WriteReportReply, type WriteReportRequest } from '../../../../../generated/capabilities/blockchain/solana/v1alpha/client_pb';
|
|
3
|
+
import { type CapabilityRestrictionJson } from '../../../../../generated/sdk/v1alpha/sdk_pb';
|
|
3
4
|
import type { Runtime } from '../../../../../sdk';
|
|
4
5
|
import { Report } from '../../../../../sdk/report';
|
|
5
6
|
import type { Trigger } from '../../../../../sdk/utils/triggers/trigger-interface';
|
|
@@ -92,4 +93,18 @@ declare class ClientLogTrigger implements Trigger<Log, Log> {
|
|
|
92
93
|
*/
|
|
93
94
|
adapt(rawOutput: Log): Log;
|
|
94
95
|
}
|
|
96
|
+
export declare class ClientRestrictor {
|
|
97
|
+
private readonly ChainSelector;
|
|
98
|
+
constructor(ChainSelector: bigint);
|
|
99
|
+
limitGetAccountInfoWithOpts(maxCalls: number): CapabilityRestrictionJson;
|
|
100
|
+
limitGetBalance(maxCalls: number): CapabilityRestrictionJson;
|
|
101
|
+
limitGetBlock(maxCalls: number): CapabilityRestrictionJson;
|
|
102
|
+
limitGetFeeForMessage(maxCalls: number): CapabilityRestrictionJson;
|
|
103
|
+
limitGetMultipleAccountsWithOpts(maxCalls: number): CapabilityRestrictionJson;
|
|
104
|
+
limitGetProgramAccounts(maxCalls: number): CapabilityRestrictionJson;
|
|
105
|
+
limitGetSignatureStatuses(maxCalls: number): CapabilityRestrictionJson;
|
|
106
|
+
limitGetSlotHeight(maxCalls: number): CapabilityRestrictionJson;
|
|
107
|
+
limitGetTransaction(maxCalls: number): CapabilityRestrictionJson;
|
|
108
|
+
limitWriteReport(maxCalls: number): CapabilityRestrictionJson;
|
|
109
|
+
}
|
|
95
110
|
export {};
|