@chainlink/cre-sdk 1.15.0 → 1.17.0-alpha.1
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/README.md +2 -62
- 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/capabilities/blockchain/evm/v1alpha/client_pb.js +1 -1
- package/dist/generated/capabilities/blockchain/solana/v1alpha/client_pb.d.ts +2885 -15
- package/dist/generated/capabilities/blockchain/solana/v1alpha/client_pb.js +459 -7
- package/dist/generated/capabilities/networking/http/v1alpha/client_pb.js +1 -1
- package/dist/generated/sdk/v1alpha/sdk_pb.d.ts +505 -0
- package/dist/generated/sdk/v1alpha/sdk_pb.js +121 -15
- package/dist/generated/tools/generator/v1alpha/cre_metadata_pb.d.ts +30 -1
- package/dist/generated/tools/generator/v1alpha/cre_metadata_pb.js +20 -2
- 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 +14 -0
- package/dist/generated-sdk/capabilities/blockchain/evm/v1alpha/client_sdk_gen.js +95 -0
- package/dist/generated-sdk/capabilities/blockchain/solana/v1alpha/client_sdk_gen.d.ts +69 -2
- package/dist/generated-sdk/capabilities/blockchain/solana/v1alpha/client_sdk_gen.js +403 -1
- 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 +11 -1
- 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 +28 -1
- package/dist/sdk/impl/runtime-impl.js +52 -1
- package/dist/sdk/runtime.d.ts +23 -1
- package/dist/sdk/tee-constraints.d.ts +68 -0
- package/dist/sdk/tee-constraints.js +59 -0
- package/dist/sdk/test/evm-contract-mock.js +58 -60
- 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/capabilities/blockchain/solana/v1alpha/solana_mock_gen.d.ts +19 -1
- package/dist/sdk/test/generated/capabilities/blockchain/solana/v1alpha/solana_mock_gen.js +141 -1
- package/dist/sdk/test/generated/index.d.ts +1 -0
- package/dist/sdk/test/generated/index.js +1 -0
- package/dist/sdk/test/index.d.ts +0 -1
- package/dist/sdk/test/index.js +0 -1
- 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/{evm/evm-helpers.d.ts → blockchain-helpers.d.ts} +6 -7
- package/dist/sdk/utils/capabilities/blockchain/{evm/evm-helpers.js → blockchain-helpers.js} +8 -6
- package/dist/sdk/utils/hex-utils.d.ts +0 -6
- package/dist/sdk/utils/hex-utils.js +0 -8
- package/dist/sdk/utils/index.d.ts +1 -3
- package/dist/sdk/utils/index.js +1 -2
- 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/restrictions/test.ts +41 -0
- package/dist/workflows/standard_tests/tee_runtime/test.ts +29 -0
- package/package.json +3 -6
- package/scripts/src/generate-sdks.ts +6 -0
- package/dist/sdk/test/contract-mock-core.d.ts +0 -16
- package/dist/sdk/test/contract-mock-core.js +0 -21
- package/dist/sdk/test/solana-contract-mock.d.ts +0 -54
- package/dist/sdk/test/solana-contract-mock.js +0 -63
- package/dist/sdk/utils/capabilities/blockchain/report-helpers.d.ts +0 -19
- package/dist/sdk/utils/capabilities/blockchain/report-helpers.js +0 -16
- package/dist/sdk/utils/capabilities/blockchain/solana/solana-helpers.d.ts +0 -101
- package/dist/sdk/utils/capabilities/blockchain/solana/solana-helpers.js +0 -100
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Any } from '@bufbuild/protobuf/wkt';
|
|
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';
|
|
2
4
|
import type { Runtime } from '../../../../../sdk';
|
|
3
5
|
import { Report } from '../../../../../sdk/report';
|
|
4
|
-
import type {
|
|
6
|
+
import type { Trigger } from '../../../../../sdk/utils/triggers/trigger-interface';
|
|
7
|
+
import type { CapabilityInput, NoExcess } from '../../../../../sdk/utils/types/no-excess';
|
|
5
8
|
export type WriteCreReportRequest = {
|
|
6
9
|
remainingAccounts: AccountMeta[];
|
|
7
10
|
receiver: Uint8Array;
|
|
@@ -37,7 +40,71 @@ export declare class ClientCapability {
|
|
|
37
40
|
readonly 'solana-mainnet': 124615329519749607n;
|
|
38
41
|
};
|
|
39
42
|
constructor(ChainSelector: bigint);
|
|
43
|
+
getAccountInfoWithOpts<TInput>(runtime: Runtime<unknown>, input: CapabilityInput<TInput, GetAccountInfoWithOptsRequest, GetAccountInfoWithOptsRequestJson>): {
|
|
44
|
+
result: () => GetAccountInfoWithOptsReply;
|
|
45
|
+
};
|
|
46
|
+
getBalance<TInput>(runtime: Runtime<unknown>, input: CapabilityInput<TInput, GetBalanceRequest, GetBalanceRequestJson>): {
|
|
47
|
+
result: () => GetBalanceReply;
|
|
48
|
+
};
|
|
49
|
+
getBlock<TInput>(runtime: Runtime<unknown>, input: CapabilityInput<TInput, GetBlockRequest, GetBlockRequestJson>): {
|
|
50
|
+
result: () => GetBlockReply;
|
|
51
|
+
};
|
|
52
|
+
getFeeForMessage<TInput>(runtime: Runtime<unknown>, input: CapabilityInput<TInput, GetFeeForMessageRequest, GetFeeForMessageRequestJson>): {
|
|
53
|
+
result: () => GetFeeForMessageReply;
|
|
54
|
+
};
|
|
55
|
+
getMultipleAccountsWithOpts<TInput>(runtime: Runtime<unknown>, input: CapabilityInput<TInput, GetMultipleAccountsWithOptsRequest, GetMultipleAccountsWithOptsRequestJson>): {
|
|
56
|
+
result: () => GetMultipleAccountsWithOptsReply;
|
|
57
|
+
};
|
|
58
|
+
getProgramAccounts<TInput>(runtime: Runtime<unknown>, input: CapabilityInput<TInput, GetProgramAccountsRequest, GetProgramAccountsRequestJson>): {
|
|
59
|
+
result: () => GetProgramAccountsReply;
|
|
60
|
+
};
|
|
61
|
+
getSignatureStatuses<TInput>(runtime: Runtime<unknown>, input: CapabilityInput<TInput, GetSignatureStatusesRequest, GetSignatureStatusesRequestJson>): {
|
|
62
|
+
result: () => GetSignatureStatusesReply;
|
|
63
|
+
};
|
|
64
|
+
getSlotHeight<TInput>(runtime: Runtime<unknown>, input: CapabilityInput<TInput, GetSlotHeightRequest, GetSlotHeightRequestJson>): {
|
|
65
|
+
result: () => GetSlotHeightReply;
|
|
66
|
+
};
|
|
67
|
+
getTransaction<TInput>(runtime: Runtime<unknown>, input: CapabilityInput<TInput, GetTransactionRequest, GetTransactionRequestJson>): {
|
|
68
|
+
result: () => GetTransactionReply;
|
|
69
|
+
};
|
|
70
|
+
logTrigger<TConfig extends FilterLogTriggerRequestJson>(config: NoExcess<TConfig, FilterLogTriggerRequestJson>): ClientLogTrigger;
|
|
40
71
|
writeReport<TInput>(runtime: Runtime<unknown>, input: CapabilityInput<TInput, WriteCreReportRequest, WriteCreReportRequestJson>): {
|
|
41
72
|
result: () => WriteReportReply;
|
|
42
73
|
};
|
|
43
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Trigger implementation for LogTrigger
|
|
77
|
+
*/
|
|
78
|
+
declare class ClientLogTrigger implements Trigger<Log, Log> {
|
|
79
|
+
private readonly _capabilityId;
|
|
80
|
+
private readonly _method;
|
|
81
|
+
private readonly ChainSelector;
|
|
82
|
+
readonly config: FilterLogTriggerRequest;
|
|
83
|
+
constructor(config: FilterLogTriggerRequest | FilterLogTriggerRequestJson, _capabilityId: string, _method: string, ChainSelector: bigint);
|
|
84
|
+
capabilityId(): string;
|
|
85
|
+
method(): string;
|
|
86
|
+
outputSchema(): import("@bufbuild/protobuf/codegenv2").GenMessage<Log, {
|
|
87
|
+
jsonType: import("../../../../../generated/capabilities/blockchain/solana/v1alpha/client_pb").LogJson;
|
|
88
|
+
}>;
|
|
89
|
+
configAsAny(): Any;
|
|
90
|
+
/**
|
|
91
|
+
* Transform the raw trigger output - override this method if needed
|
|
92
|
+
* Default implementation returns the raw output unchanged
|
|
93
|
+
*/
|
|
94
|
+
adapt(rawOutput: Log): Log;
|
|
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
|
+
}
|
|
110
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { create, fromJson } from '@bufbuild/protobuf';
|
|
2
|
-
import {
|
|
2
|
+
import { AnySchema, anyPack } from '@bufbuild/protobuf/wkt';
|
|
3
|
+
import { AccountMetaSchema, ComputeConfigSchema, FilterLogTriggerRequestSchema, GetAccountInfoWithOptsReplySchema, GetAccountInfoWithOptsRequestSchema, GetBalanceReplySchema, GetBalanceRequestSchema, GetBlockReplySchema, GetBlockRequestSchema, GetFeeForMessageReplySchema, GetFeeForMessageRequestSchema, GetMultipleAccountsWithOptsReplySchema, GetMultipleAccountsWithOptsRequestSchema, GetProgramAccountsReplySchema, GetProgramAccountsRequestSchema, GetSignatureStatusesReplySchema, GetSignatureStatusesRequestSchema, GetSlotHeightReplySchema, GetSlotHeightRequestSchema, GetTransactionReplySchema, GetTransactionRequestSchema, LogSchema, WriteReportReplySchema, WriteReportRequestSchema, } from '../../../../../generated/capabilities/blockchain/solana/v1alpha/client_pb';
|
|
3
4
|
import { ReportResponseSchema, } from '../../../../../generated/sdk/v1alpha/sdk_pb';
|
|
4
5
|
import { Report } from '../../../../../sdk/report';
|
|
5
6
|
import { hexToBytes } from '../../../../../sdk/utils/hex-utils';
|
|
@@ -52,6 +53,254 @@ export class ClientCapability {
|
|
|
52
53
|
constructor(ChainSelector) {
|
|
53
54
|
this.ChainSelector = ChainSelector;
|
|
54
55
|
}
|
|
56
|
+
getAccountInfoWithOpts(runtime, input) {
|
|
57
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
58
|
+
let payload;
|
|
59
|
+
if (input.$typeName) {
|
|
60
|
+
// It's the original protobuf type
|
|
61
|
+
payload = input;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
// It's regular JSON, convert using fromJson
|
|
65
|
+
payload = fromJson(GetAccountInfoWithOptsRequestSchema, input);
|
|
66
|
+
}
|
|
67
|
+
// Include all labels in capability ID for routing when specified
|
|
68
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
69
|
+
const capabilityResponse = runtime.callCapability({
|
|
70
|
+
capabilityId,
|
|
71
|
+
method: 'GetAccountInfoWithOpts',
|
|
72
|
+
payload,
|
|
73
|
+
inputSchema: GetAccountInfoWithOptsRequestSchema,
|
|
74
|
+
outputSchema: GetAccountInfoWithOptsReplySchema,
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
result: () => {
|
|
78
|
+
const result = capabilityResponse.result();
|
|
79
|
+
return result;
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
getBalance(runtime, input) {
|
|
84
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
85
|
+
let payload;
|
|
86
|
+
if (input.$typeName) {
|
|
87
|
+
// It's the original protobuf type
|
|
88
|
+
payload = input;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// It's regular JSON, convert using fromJson
|
|
92
|
+
payload = fromJson(GetBalanceRequestSchema, input);
|
|
93
|
+
}
|
|
94
|
+
// Include all labels in capability ID for routing when specified
|
|
95
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
96
|
+
const capabilityResponse = runtime.callCapability({
|
|
97
|
+
capabilityId,
|
|
98
|
+
method: 'GetBalance',
|
|
99
|
+
payload,
|
|
100
|
+
inputSchema: GetBalanceRequestSchema,
|
|
101
|
+
outputSchema: GetBalanceReplySchema,
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
result: () => {
|
|
105
|
+
const result = capabilityResponse.result();
|
|
106
|
+
return result;
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
getBlock(runtime, input) {
|
|
111
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
112
|
+
let payload;
|
|
113
|
+
if (input.$typeName) {
|
|
114
|
+
// It's the original protobuf type
|
|
115
|
+
payload = input;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
// It's regular JSON, convert using fromJson
|
|
119
|
+
payload = fromJson(GetBlockRequestSchema, input);
|
|
120
|
+
}
|
|
121
|
+
// Include all labels in capability ID for routing when specified
|
|
122
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
123
|
+
const capabilityResponse = runtime.callCapability({
|
|
124
|
+
capabilityId,
|
|
125
|
+
method: 'GetBlock',
|
|
126
|
+
payload,
|
|
127
|
+
inputSchema: GetBlockRequestSchema,
|
|
128
|
+
outputSchema: GetBlockReplySchema,
|
|
129
|
+
});
|
|
130
|
+
return {
|
|
131
|
+
result: () => {
|
|
132
|
+
const result = capabilityResponse.result();
|
|
133
|
+
return result;
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
getFeeForMessage(runtime, input) {
|
|
138
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
139
|
+
let payload;
|
|
140
|
+
if (input.$typeName) {
|
|
141
|
+
// It's the original protobuf type
|
|
142
|
+
payload = input;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
// It's regular JSON, convert using fromJson
|
|
146
|
+
payload = fromJson(GetFeeForMessageRequestSchema, input);
|
|
147
|
+
}
|
|
148
|
+
// Include all labels in capability ID for routing when specified
|
|
149
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
150
|
+
const capabilityResponse = runtime.callCapability({
|
|
151
|
+
capabilityId,
|
|
152
|
+
method: 'GetFeeForMessage',
|
|
153
|
+
payload,
|
|
154
|
+
inputSchema: GetFeeForMessageRequestSchema,
|
|
155
|
+
outputSchema: GetFeeForMessageReplySchema,
|
|
156
|
+
});
|
|
157
|
+
return {
|
|
158
|
+
result: () => {
|
|
159
|
+
const result = capabilityResponse.result();
|
|
160
|
+
return result;
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
getMultipleAccountsWithOpts(runtime, input) {
|
|
165
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
166
|
+
let payload;
|
|
167
|
+
if (input.$typeName) {
|
|
168
|
+
// It's the original protobuf type
|
|
169
|
+
payload = input;
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
// It's regular JSON, convert using fromJson
|
|
173
|
+
payload = fromJson(GetMultipleAccountsWithOptsRequestSchema, input);
|
|
174
|
+
}
|
|
175
|
+
// Include all labels in capability ID for routing when specified
|
|
176
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
177
|
+
const capabilityResponse = runtime.callCapability({
|
|
178
|
+
capabilityId,
|
|
179
|
+
method: 'GetMultipleAccountsWithOpts',
|
|
180
|
+
payload,
|
|
181
|
+
inputSchema: GetMultipleAccountsWithOptsRequestSchema,
|
|
182
|
+
outputSchema: GetMultipleAccountsWithOptsReplySchema,
|
|
183
|
+
});
|
|
184
|
+
return {
|
|
185
|
+
result: () => {
|
|
186
|
+
const result = capabilityResponse.result();
|
|
187
|
+
return result;
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
getProgramAccounts(runtime, input) {
|
|
192
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
193
|
+
let payload;
|
|
194
|
+
if (input.$typeName) {
|
|
195
|
+
// It's the original protobuf type
|
|
196
|
+
payload = input;
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
// It's regular JSON, convert using fromJson
|
|
200
|
+
payload = fromJson(GetProgramAccountsRequestSchema, input);
|
|
201
|
+
}
|
|
202
|
+
// Include all labels in capability ID for routing when specified
|
|
203
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
204
|
+
const capabilityResponse = runtime.callCapability({
|
|
205
|
+
capabilityId,
|
|
206
|
+
method: 'GetProgramAccounts',
|
|
207
|
+
payload,
|
|
208
|
+
inputSchema: GetProgramAccountsRequestSchema,
|
|
209
|
+
outputSchema: GetProgramAccountsReplySchema,
|
|
210
|
+
});
|
|
211
|
+
return {
|
|
212
|
+
result: () => {
|
|
213
|
+
const result = capabilityResponse.result();
|
|
214
|
+
return result;
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
getSignatureStatuses(runtime, input) {
|
|
219
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
220
|
+
let payload;
|
|
221
|
+
if (input.$typeName) {
|
|
222
|
+
// It's the original protobuf type
|
|
223
|
+
payload = input;
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
// It's regular JSON, convert using fromJson
|
|
227
|
+
payload = fromJson(GetSignatureStatusesRequestSchema, input);
|
|
228
|
+
}
|
|
229
|
+
// Include all labels in capability ID for routing when specified
|
|
230
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
231
|
+
const capabilityResponse = runtime.callCapability({
|
|
232
|
+
capabilityId,
|
|
233
|
+
method: 'GetSignatureStatuses',
|
|
234
|
+
payload,
|
|
235
|
+
inputSchema: GetSignatureStatusesRequestSchema,
|
|
236
|
+
outputSchema: GetSignatureStatusesReplySchema,
|
|
237
|
+
});
|
|
238
|
+
return {
|
|
239
|
+
result: () => {
|
|
240
|
+
const result = capabilityResponse.result();
|
|
241
|
+
return result;
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
getSlotHeight(runtime, input) {
|
|
246
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
247
|
+
let payload;
|
|
248
|
+
if (input.$typeName) {
|
|
249
|
+
// It's the original protobuf type
|
|
250
|
+
payload = input;
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
// It's regular JSON, convert using fromJson
|
|
254
|
+
payload = fromJson(GetSlotHeightRequestSchema, input);
|
|
255
|
+
}
|
|
256
|
+
// Include all labels in capability ID for routing when specified
|
|
257
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
258
|
+
const capabilityResponse = runtime.callCapability({
|
|
259
|
+
capabilityId,
|
|
260
|
+
method: 'GetSlotHeight',
|
|
261
|
+
payload,
|
|
262
|
+
inputSchema: GetSlotHeightRequestSchema,
|
|
263
|
+
outputSchema: GetSlotHeightReplySchema,
|
|
264
|
+
});
|
|
265
|
+
return {
|
|
266
|
+
result: () => {
|
|
267
|
+
const result = capabilityResponse.result();
|
|
268
|
+
return result;
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
getTransaction(runtime, input) {
|
|
273
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
274
|
+
let payload;
|
|
275
|
+
if (input.$typeName) {
|
|
276
|
+
// It's the original protobuf type
|
|
277
|
+
payload = input;
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
// It's regular JSON, convert using fromJson
|
|
281
|
+
payload = fromJson(GetTransactionRequestSchema, input);
|
|
282
|
+
}
|
|
283
|
+
// Include all labels in capability ID for routing when specified
|
|
284
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
285
|
+
const capabilityResponse = runtime.callCapability({
|
|
286
|
+
capabilityId,
|
|
287
|
+
method: 'GetTransaction',
|
|
288
|
+
payload,
|
|
289
|
+
inputSchema: GetTransactionRequestSchema,
|
|
290
|
+
outputSchema: GetTransactionReplySchema,
|
|
291
|
+
});
|
|
292
|
+
return {
|
|
293
|
+
result: () => {
|
|
294
|
+
const result = capabilityResponse.result();
|
|
295
|
+
return result;
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
logTrigger(config) {
|
|
300
|
+
// Include all labels in capability ID for routing when specified
|
|
301
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
302
|
+
return new ClientLogTrigger(config, capabilityId, 'LogTrigger', this.ChainSelector);
|
|
303
|
+
}
|
|
55
304
|
writeReport(runtime, input) {
|
|
56
305
|
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
57
306
|
let payload;
|
|
@@ -81,3 +330,156 @@ export class ClientCapability {
|
|
|
81
330
|
};
|
|
82
331
|
}
|
|
83
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* Trigger implementation for LogTrigger
|
|
335
|
+
*/
|
|
336
|
+
class ClientLogTrigger {
|
|
337
|
+
_capabilityId;
|
|
338
|
+
_method;
|
|
339
|
+
ChainSelector;
|
|
340
|
+
config;
|
|
341
|
+
constructor(config, _capabilityId, _method, ChainSelector) {
|
|
342
|
+
this._capabilityId = _capabilityId;
|
|
343
|
+
this._method = _method;
|
|
344
|
+
this.ChainSelector = ChainSelector;
|
|
345
|
+
// biome-ignore lint/suspicious/noExplicitAny: Needed for runtime type checking of protocol buffer messages
|
|
346
|
+
this.config = config.$typeName
|
|
347
|
+
? config
|
|
348
|
+
: fromJson(FilterLogTriggerRequestSchema, config);
|
|
349
|
+
}
|
|
350
|
+
capabilityId() {
|
|
351
|
+
return this._capabilityId;
|
|
352
|
+
}
|
|
353
|
+
method() {
|
|
354
|
+
return this._method;
|
|
355
|
+
}
|
|
356
|
+
outputSchema() {
|
|
357
|
+
return LogSchema;
|
|
358
|
+
}
|
|
359
|
+
configAsAny() {
|
|
360
|
+
return anyPack(FilterLogTriggerRequestSchema, this.config);
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Transform the raw trigger output - override this method if needed
|
|
364
|
+
* Default implementation returns the raw output unchanged
|
|
365
|
+
*/
|
|
366
|
+
adapt(rawOutput) {
|
|
367
|
+
return rawOutput;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
export class ClientRestrictor {
|
|
371
|
+
ChainSelector;
|
|
372
|
+
constructor(ChainSelector) {
|
|
373
|
+
this.ChainSelector = ChainSelector;
|
|
374
|
+
}
|
|
375
|
+
limitGetAccountInfoWithOpts(maxCalls) {
|
|
376
|
+
// Include all labels in capability ID for routing when specified
|
|
377
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
378
|
+
return {
|
|
379
|
+
method: {
|
|
380
|
+
id: capabilityId,
|
|
381
|
+
method: 'GetAccountInfoWithOpts',
|
|
382
|
+
maxCalls,
|
|
383
|
+
},
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
limitGetBalance(maxCalls) {
|
|
387
|
+
// Include all labels in capability ID for routing when specified
|
|
388
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
389
|
+
return {
|
|
390
|
+
method: {
|
|
391
|
+
id: capabilityId,
|
|
392
|
+
method: 'GetBalance',
|
|
393
|
+
maxCalls,
|
|
394
|
+
},
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
limitGetBlock(maxCalls) {
|
|
398
|
+
// Include all labels in capability ID for routing when specified
|
|
399
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
400
|
+
return {
|
|
401
|
+
method: {
|
|
402
|
+
id: capabilityId,
|
|
403
|
+
method: 'GetBlock',
|
|
404
|
+
maxCalls,
|
|
405
|
+
},
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
limitGetFeeForMessage(maxCalls) {
|
|
409
|
+
// Include all labels in capability ID for routing when specified
|
|
410
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
411
|
+
return {
|
|
412
|
+
method: {
|
|
413
|
+
id: capabilityId,
|
|
414
|
+
method: 'GetFeeForMessage',
|
|
415
|
+
maxCalls,
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
limitGetMultipleAccountsWithOpts(maxCalls) {
|
|
420
|
+
// Include all labels in capability ID for routing when specified
|
|
421
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
422
|
+
return {
|
|
423
|
+
method: {
|
|
424
|
+
id: capabilityId,
|
|
425
|
+
method: 'GetMultipleAccountsWithOpts',
|
|
426
|
+
maxCalls,
|
|
427
|
+
},
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
limitGetProgramAccounts(maxCalls) {
|
|
431
|
+
// Include all labels in capability ID for routing when specified
|
|
432
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
433
|
+
return {
|
|
434
|
+
method: {
|
|
435
|
+
id: capabilityId,
|
|
436
|
+
method: 'GetProgramAccounts',
|
|
437
|
+
maxCalls,
|
|
438
|
+
},
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
limitGetSignatureStatuses(maxCalls) {
|
|
442
|
+
// Include all labels in capability ID for routing when specified
|
|
443
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
444
|
+
return {
|
|
445
|
+
method: {
|
|
446
|
+
id: capabilityId,
|
|
447
|
+
method: 'GetSignatureStatuses',
|
|
448
|
+
maxCalls,
|
|
449
|
+
},
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
limitGetSlotHeight(maxCalls) {
|
|
453
|
+
// Include all labels in capability ID for routing when specified
|
|
454
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
455
|
+
return {
|
|
456
|
+
method: {
|
|
457
|
+
id: capabilityId,
|
|
458
|
+
method: 'GetSlotHeight',
|
|
459
|
+
maxCalls,
|
|
460
|
+
},
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
limitGetTransaction(maxCalls) {
|
|
464
|
+
// Include all labels in capability ID for routing when specified
|
|
465
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
466
|
+
return {
|
|
467
|
+
method: {
|
|
468
|
+
id: capabilityId,
|
|
469
|
+
method: 'GetTransaction',
|
|
470
|
+
maxCalls,
|
|
471
|
+
},
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
limitWriteReport(maxCalls) {
|
|
475
|
+
// Include all labels in capability ID for routing when specified
|
|
476
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
477
|
+
return {
|
|
478
|
+
method: {
|
|
479
|
+
id: capabilityId,
|
|
480
|
+
method: 'WriteReport',
|
|
481
|
+
maxCalls,
|
|
482
|
+
},
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReportRequest, type ReportRequestJson, type SimpleConsensusInputs, type SimpleConsensusInputsJson } from '../../../../../generated/sdk/v1alpha/sdk_pb';
|
|
1
|
+
import { type CapabilityRestrictionJson, type ReportRequest, type ReportRequestJson, type SimpleConsensusInputs, type SimpleConsensusInputsJson } from '../../../../../generated/sdk/v1alpha/sdk_pb';
|
|
2
2
|
import { type Value } from '../../../../../generated/values/v1/values_pb';
|
|
3
3
|
import type { Runtime } from '../../../../../sdk';
|
|
4
4
|
import { Report } from '../../../../../sdk/report';
|
|
@@ -22,3 +22,7 @@ export declare class ConsensusCapability {
|
|
|
22
22
|
result: () => Report;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
+
export declare class ConsensusRestrictor {
|
|
26
|
+
limitSimple(maxCalls: number): CapabilityRestrictionJson;
|
|
27
|
+
limitReport(maxCalls: number): CapabilityRestrictionJson;
|
|
28
|
+
}
|
|
@@ -68,3 +68,25 @@ export class ConsensusCapability {
|
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
+
export class ConsensusRestrictor {
|
|
72
|
+
limitSimple(maxCalls) {
|
|
73
|
+
const capabilityId = ConsensusCapability.CAPABILITY_ID;
|
|
74
|
+
return {
|
|
75
|
+
method: {
|
|
76
|
+
id: capabilityId,
|
|
77
|
+
method: 'Simple',
|
|
78
|
+
maxCalls,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
limitReport(maxCalls) {
|
|
83
|
+
const capabilityId = ConsensusCapability.CAPABILITY_ID;
|
|
84
|
+
return {
|
|
85
|
+
method: {
|
|
86
|
+
id: capabilityId,
|
|
87
|
+
method: 'Report',
|
|
88
|
+
maxCalls,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
package/dist/generated-sdk/capabilities/networking/confidentialhttp/v1alpha/client_sdk_gen.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ConfidentialHTTPRequest, type ConfidentialHTTPRequestJson, type HTTPResponse } from '../../../../../generated/capabilities/networking/confidentialhttp/v1alpha/client_pb';
|
|
2
|
+
import type { CapabilityRestrictionJson } from '../../../../../generated/sdk/v1alpha/sdk_pb';
|
|
2
3
|
import type { Runtime } from '../../../../../sdk';
|
|
3
4
|
import type { CapabilityInput } from '../../../../../sdk/utils/types/no-excess';
|
|
4
5
|
/**
|
|
@@ -17,3 +18,6 @@ export declare class ClientCapability {
|
|
|
17
18
|
result: () => HTTPResponse;
|
|
18
19
|
};
|
|
19
20
|
}
|
|
21
|
+
export declare class ClientRestrictor {
|
|
22
|
+
limitSendRequest(maxCalls: number): CapabilityRestrictionJson;
|
|
23
|
+
}
|
package/dist/generated-sdk/capabilities/networking/confidentialhttp/v1alpha/client_sdk_gen.js
CHANGED
|
@@ -41,3 +41,15 @@ export class ClientCapability {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
export class ClientRestrictor {
|
|
45
|
+
limitSendRequest(maxCalls) {
|
|
46
|
+
const capabilityId = ClientCapability.CAPABILITY_ID;
|
|
47
|
+
return {
|
|
48
|
+
method: {
|
|
49
|
+
id: capabilityId,
|
|
50
|
+
method: 'SendRequest',
|
|
51
|
+
maxCalls,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Request, type RequestJson, type Response } from '../../../../../generated/capabilities/networking/http/v1alpha/client_pb';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CapabilityRestrictionJson } from '../../../../../generated/sdk/v1alpha/sdk_pb';
|
|
3
|
+
import type { NodeRuntime, Runtime, TeeRuntime } from '../../../../../sdk';
|
|
3
4
|
import type { ConsensusAggregation, PrimitiveTypes, UnwrapOptions } from '../../../../../sdk/utils';
|
|
4
5
|
import type { CapabilityInput } from '../../../../../sdk/utils/types/no-excess';
|
|
5
6
|
export declare class SendRequester {
|
|
@@ -22,12 +23,21 @@ export declare class ClientCapability {
|
|
|
22
23
|
static readonly CAPABILITY_ID = "http-actions@1.0.0-alpha";
|
|
23
24
|
static readonly CAPABILITY_NAME = "http-actions";
|
|
24
25
|
static readonly CAPABILITY_VERSION = "1.0.0-alpha";
|
|
26
|
+
sendRequest<TInput>(runtime: TeeRuntime<unknown>, input: CapabilityInput<TInput, Request, RequestJson>): {
|
|
27
|
+
result: () => Response;
|
|
28
|
+
};
|
|
25
29
|
sendRequest<TInput>(runtime: NodeRuntime<unknown>, input: CapabilityInput<TInput, Request, RequestJson>): {
|
|
26
30
|
result: () => Response;
|
|
27
31
|
};
|
|
32
|
+
sendRequest<TInput>(runtime: NodeRuntime<unknown> | TeeRuntime<unknown>, input: CapabilityInput<TInput, Request, RequestJson>): {
|
|
33
|
+
result: () => Response;
|
|
34
|
+
};
|
|
28
35
|
sendRequest<TArgs extends unknown[], TOutput>(runtime: Runtime<unknown>, fn: (sendRequester: SendRequester, ...args: TArgs) => TOutput, consensusAggregation: ConsensusAggregation<TOutput, true>, unwrapOptions?: TOutput extends PrimitiveTypes ? never : UnwrapOptions<TOutput>): (...args: TArgs) => {
|
|
29
36
|
result: () => TOutput;
|
|
30
37
|
};
|
|
31
38
|
private sendRequestCallHelper;
|
|
32
39
|
private sendRequestSugarHelper;
|
|
33
40
|
}
|
|
41
|
+
export declare class ClientRestrictor {
|
|
42
|
+
limitSendRequest(maxCalls: number): CapabilityRestrictionJson;
|
|
43
|
+
}
|
|
@@ -68,3 +68,15 @@ export class ClientCapability {
|
|
|
68
68
|
return runtime.runInNodeMode(wrappedFn, consensusAggregation, unwrapOptions);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
+
export class ClientRestrictor {
|
|
72
|
+
limitSendRequest(maxCalls) {
|
|
73
|
+
const capabilityId = ClientCapability.CAPABILITY_ID;
|
|
74
|
+
return {
|
|
75
|
+
method: {
|
|
76
|
+
id: capabilityId,
|
|
77
|
+
method: 'SendRequest',
|
|
78
|
+
maxCalls,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|