@chainlink/cre-sdk 1.6.0-alpha.1 → 1.6.0-alpha.3
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 +1023 -0
- package/dist/generated/capabilities/blockchain/aptos/v1alpha/client_pb.js +290 -0
- package/dist/generated/capabilities/blockchain/solana/v1alpha/client_pb.d.ts +2904 -0
- package/dist/generated/capabilities/blockchain/solana/v1alpha/client_pb.js +506 -0
- package/dist/generated/chain-selectors/mainnet/evm/ab-mainnet.d.ts +3 -0
- package/dist/generated/chain-selectors/mainnet/evm/ab-mainnet.js +12 -0
- package/dist/generated/chain-selectors/mainnet/evm/adi-mainnet.d.ts +3 -0
- package/dist/generated/chain-selectors/mainnet/evm/adi-mainnet.js +12 -0
- package/dist/generated/chain-selectors/mainnet/evm/edge-mainnet.d.ts +3 -0
- package/dist/generated/chain-selectors/mainnet/evm/edge-mainnet.js +12 -0
- package/dist/generated/chain-selectors/mainnet/evm/everclear-mainnet.d.ts +3 -0
- package/dist/generated/chain-selectors/mainnet/evm/everclear-mainnet.js +12 -0
- package/dist/generated/chain-selectors/mainnet/evm/gate-chain-mainnet.d.ts +3 -0
- package/dist/generated/chain-selectors/mainnet/evm/gate-chain-mainnet.js +12 -0
- package/dist/generated/chain-selectors/mainnet/evm/gate-layer-mainnet.d.ts +3 -0
- package/dist/generated/chain-selectors/mainnet/evm/gate-layer-mainnet.js +12 -0
- package/dist/generated/chain-selectors/mainnet/evm/jovay-mainnet.d.ts +3 -0
- package/dist/generated/chain-selectors/mainnet/evm/jovay-mainnet.js +12 -0
- package/dist/generated/chain-selectors/mainnet/evm/megaeth-mainnet.d.ts +3 -0
- package/dist/generated/chain-selectors/mainnet/evm/megaeth-mainnet.js +12 -0
- package/dist/generated/chain-selectors/mainnet/evm/pharos-mainnet.d.ts +3 -0
- package/dist/generated/chain-selectors/mainnet/evm/pharos-mainnet.js +12 -0
- package/dist/generated/chain-selectors/mainnet/evm/stable-mainnet.d.ts +3 -0
- package/dist/generated/chain-selectors/mainnet/evm/stable-mainnet.js +12 -0
- package/dist/generated/chain-selectors/mainnet/evm/tempo-mainnet.d.ts +3 -0
- package/dist/generated/chain-selectors/mainnet/evm/tempo-mainnet.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/0g-testnet-galileo-1.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/0g-testnet-galileo-1.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/ab-testnet.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/ab-testnet.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/adi-testnet.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/adi-testnet.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/arc-testnet.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/arc-testnet.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/celo-sepolia.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/celo-sepolia.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/dogeos-testnet-chikyu.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/dogeos-testnet-chikyu.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/edge-testnet.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/edge-testnet.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/ethereum-testnet-hoodi-morph.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/ethereum-testnet-hoodi-morph.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/ethereum-testnet-hoodi-taiko-1.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/ethereum-testnet-hoodi-taiko-1.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/ethereum-testnet-hoodi-taiko.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/ethereum-testnet-hoodi-taiko.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/ethereum-testnet-hoodi.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/ethereum-testnet-hoodi.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/ethereum-testnet-sepolia-ronin-1.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/ethereum-testnet-sepolia-ronin-1.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/everclear-testnet-sepolia.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/everclear-testnet-sepolia.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/gate-chain-testnet-meteora.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/gate-chain-testnet-meteora.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/gate-layer-testnet.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/gate-layer-testnet.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/megaeth-testnet-2.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/megaeth-testnet-2.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/pharos-atlantic-testnet.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/pharos-atlantic-testnet.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/robinhood-testnet.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/robinhood-testnet.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/sonic-testnet.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/sonic-testnet.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/stable-testnet.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/stable-testnet.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/tempo-testnet-moderato.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/tempo-testnet-moderato.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/tempo-testnet.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/tempo-testnet.js +12 -0
- package/dist/generated/chain-selectors/testnet/evm/xlayer-testnet.d.ts +3 -0
- package/dist/generated/chain-selectors/testnet/evm/xlayer-testnet.js +12 -0
- package/dist/generated/networks.d.ts +2 -2
- package/dist/generated/networks.js +238 -0
- package/dist/generated-sdk/capabilities/blockchain/aptos/v1alpha/client_sdk_gen.d.ts +52 -0
- package/dist/generated-sdk/capabilities/blockchain/aptos/v1alpha/client_sdk_gen.js +186 -0
- package/dist/generated-sdk/capabilities/blockchain/solana/v1alpha/client_sdk_gen.d.ts +92 -0
- package/dist/generated-sdk/capabilities/blockchain/solana/v1alpha/client_sdk_gen.js +343 -0
- package/dist/sdk/cre/index.d.ts +6 -0
- package/dist/sdk/cre/index.js +8 -0
- package/dist/sdk/don-info.d.ts +10 -0
- package/dist/sdk/don-info.js +9 -0
- package/dist/sdk/errors.d.ts +24 -1
- package/dist/sdk/errors.js +46 -1
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.js +2 -0
- package/dist/sdk/report-internals.d.ts +6 -0
- package/dist/sdk/report-internals.js +3 -0
- package/dist/sdk/report.d.ts +38 -0
- package/dist/sdk/report.js +474 -2
- 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 +33 -0
- package/dist/sdk/test/generated/capabilities/blockchain/solana/v1alpha/solana_mock_gen.js +178 -0
- package/dist/sdk/test/generated/index.d.ts +2 -0
- package/dist/sdk/test/generated/index.js +2 -0
- package/dist/sdk/testutils/test-runtime.js +4 -0
- package/package.json +3 -3
- package/scripts/run.ts +1 -0
- package/scripts/src/check-determinism.test.ts +64 -0
- package/scripts/src/check-determinism.ts +32 -0
- package/scripts/src/compile-to-js.ts +7 -0
- package/scripts/src/generate-chain-selectors.ts +9 -27
- package/scripts/src/generate-sdks.ts +12 -0
- package/scripts/src/validate-shared.ts +400 -0
- package/scripts/src/validate-workflow-determinism.test.ts +409 -0
- package/scripts/src/validate-workflow-determinism.ts +545 -0
- package/scripts/src/validate-workflow-runtime-compat.ts +25 -377
|
@@ -0,0 +1,52 @@
|
|
|
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 { Runtime } from '../../../../../sdk';
|
|
3
|
+
import { Report } from '../../../../../sdk/report';
|
|
4
|
+
export type WriteCreReportRequest = {
|
|
5
|
+
receiver: Uint8Array;
|
|
6
|
+
gasConfig?: GasConfig;
|
|
7
|
+
report?: Report;
|
|
8
|
+
$report: true;
|
|
9
|
+
};
|
|
10
|
+
export type WriteCreReportRequestJson = {
|
|
11
|
+
receiver: string;
|
|
12
|
+
gasConfig?: GasConfigJson;
|
|
13
|
+
report?: Report;
|
|
14
|
+
};
|
|
15
|
+
export declare function x_generatedCodeOnly_wrap_WriteCreReportRequest(input: WriteReportRequest): WriteCreReportRequest;
|
|
16
|
+
export declare function createWriteCreReportRequest(input: WriteCreReportRequestJson): WriteCreReportRequest;
|
|
17
|
+
export declare function x_generatedCodeOnly_unwrap_WriteCreReportRequest(input: WriteCreReportRequest): WriteReportRequest;
|
|
18
|
+
/**
|
|
19
|
+
* Client Capability
|
|
20
|
+
*
|
|
21
|
+
* Capability ID: aptos@1.0.0
|
|
22
|
+
* Capability Name: aptos
|
|
23
|
+
* Capability Version: 1.0.0
|
|
24
|
+
*/
|
|
25
|
+
export declare class ClientCapability {
|
|
26
|
+
private readonly ChainSelector;
|
|
27
|
+
/** The capability ID for this service */
|
|
28
|
+
static readonly CAPABILITY_ID = "aptos@1.0.0";
|
|
29
|
+
static readonly CAPABILITY_NAME = "aptos";
|
|
30
|
+
static readonly CAPABILITY_VERSION = "1.0.0";
|
|
31
|
+
/** Available ChainSelector values */
|
|
32
|
+
static readonly SUPPORTED_CHAIN_SELECTORS: {
|
|
33
|
+
readonly 'aptos-mainnet': 4741433654826277614n;
|
|
34
|
+
readonly 'aptos-testnet': 743186221051783445n;
|
|
35
|
+
};
|
|
36
|
+
constructor(ChainSelector: bigint);
|
|
37
|
+
accountAPTBalance(runtime: Runtime<unknown>, input: AccountAPTBalanceRequest | AccountAPTBalanceRequestJson): {
|
|
38
|
+
result: () => AccountAPTBalanceReply;
|
|
39
|
+
};
|
|
40
|
+
view(runtime: Runtime<unknown>, input: ViewRequest | ViewRequestJson): {
|
|
41
|
+
result: () => ViewReply;
|
|
42
|
+
};
|
|
43
|
+
transactionByHash(runtime: Runtime<unknown>, input: TransactionByHashRequest | TransactionByHashRequestJson): {
|
|
44
|
+
result: () => TransactionByHashReply;
|
|
45
|
+
};
|
|
46
|
+
accountTransactions(runtime: Runtime<unknown>, input: AccountTransactionsRequest | AccountTransactionsRequestJson): {
|
|
47
|
+
result: () => AccountTransactionsReply;
|
|
48
|
+
};
|
|
49
|
+
writeReport(runtime: Runtime<unknown>, input: WriteCreReportRequest | WriteCreReportRequestJson): {
|
|
50
|
+
result: () => WriteReportReply;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
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 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 { Runtime } from '../../../../../sdk';
|
|
4
|
+
import { Report } from '../../../../../sdk/report';
|
|
5
|
+
import type { Trigger } from '../../../../../sdk/utils/triggers/trigger-interface';
|
|
6
|
+
export type WriteCreReportRequest = {
|
|
7
|
+
remainingAccounts: AccountMeta[];
|
|
8
|
+
receiver: Uint8Array;
|
|
9
|
+
computeConfig?: ComputeConfig;
|
|
10
|
+
report?: Report;
|
|
11
|
+
$report: true;
|
|
12
|
+
};
|
|
13
|
+
export type WriteCreReportRequestJson = {
|
|
14
|
+
remainingAccounts: AccountMetaJson[];
|
|
15
|
+
receiver: string;
|
|
16
|
+
computeConfig?: ComputeConfigJson;
|
|
17
|
+
report?: Report;
|
|
18
|
+
};
|
|
19
|
+
export declare function x_generatedCodeOnly_wrap_WriteCreReportRequest(input: WriteReportRequest): WriteCreReportRequest;
|
|
20
|
+
export declare function createWriteCreReportRequest(input: WriteCreReportRequestJson): WriteCreReportRequest;
|
|
21
|
+
export declare function x_generatedCodeOnly_unwrap_WriteCreReportRequest(input: WriteCreReportRequest): WriteReportRequest;
|
|
22
|
+
/**
|
|
23
|
+
* Client Capability
|
|
24
|
+
*
|
|
25
|
+
* Capability ID: solana@1.0.0
|
|
26
|
+
* Capability Name: solana
|
|
27
|
+
* Capability Version: 1.0.0
|
|
28
|
+
*/
|
|
29
|
+
export declare class ClientCapability {
|
|
30
|
+
private readonly ChainSelector;
|
|
31
|
+
/** The capability ID for this service */
|
|
32
|
+
static readonly CAPABILITY_ID = "solana@1.0.0";
|
|
33
|
+
static readonly CAPABILITY_NAME = "solana";
|
|
34
|
+
static readonly CAPABILITY_VERSION = "1.0.0";
|
|
35
|
+
/** Available ChainSelector values */
|
|
36
|
+
static readonly SUPPORTED_CHAIN_SELECTORS: {
|
|
37
|
+
readonly 'solana-devnet': 16423721717087811551n;
|
|
38
|
+
readonly 'solana-mainnet': 124615329519749607n;
|
|
39
|
+
readonly 'solana-testnet': 6302590918974934319n;
|
|
40
|
+
};
|
|
41
|
+
constructor(ChainSelector: bigint);
|
|
42
|
+
getAccountInfoWithOpts(runtime: Runtime<unknown>, input: GetAccountInfoWithOptsRequest | GetAccountInfoWithOptsRequestJson): {
|
|
43
|
+
result: () => GetAccountInfoWithOptsReply;
|
|
44
|
+
};
|
|
45
|
+
getBalance(runtime: Runtime<unknown>, input: GetBalanceRequest | GetBalanceRequestJson): {
|
|
46
|
+
result: () => GetBalanceReply;
|
|
47
|
+
};
|
|
48
|
+
getBlock(runtime: Runtime<unknown>, input: GetBlockRequest | GetBlockRequestJson): {
|
|
49
|
+
result: () => GetBlockReply;
|
|
50
|
+
};
|
|
51
|
+
getFeeForMessage(runtime: Runtime<unknown>, input: GetFeeForMessageRequest | GetFeeForMessageRequestJson): {
|
|
52
|
+
result: () => GetFeeForMessageReply;
|
|
53
|
+
};
|
|
54
|
+
getMultipleAccountsWithOpts(runtime: Runtime<unknown>, input: GetMultipleAccountsWithOptsRequest | GetMultipleAccountsWithOptsRequestJson): {
|
|
55
|
+
result: () => GetMultipleAccountsWithOptsReply;
|
|
56
|
+
};
|
|
57
|
+
getSignatureStatuses(runtime: Runtime<unknown>, input: GetSignatureStatusesRequest | GetSignatureStatusesRequestJson): {
|
|
58
|
+
result: () => GetSignatureStatusesReply;
|
|
59
|
+
};
|
|
60
|
+
getSlotHeight(runtime: Runtime<unknown>, input: GetSlotHeightRequest | GetSlotHeightRequestJson): {
|
|
61
|
+
result: () => GetSlotHeightReply;
|
|
62
|
+
};
|
|
63
|
+
getTransaction(runtime: Runtime<unknown>, input: GetTransactionRequest | GetTransactionRequestJson): {
|
|
64
|
+
result: () => GetTransactionReply;
|
|
65
|
+
};
|
|
66
|
+
logTrigger(config: FilterLogTriggerRequestJson): ClientLogTrigger;
|
|
67
|
+
writeReport(runtime: Runtime<unknown>, input: WriteCreReportRequest | WriteCreReportRequestJson): {
|
|
68
|
+
result: () => WriteReportReply;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Trigger implementation for LogTrigger
|
|
73
|
+
*/
|
|
74
|
+
declare class ClientLogTrigger implements Trigger<Log, Log> {
|
|
75
|
+
private readonly _capabilityId;
|
|
76
|
+
private readonly _method;
|
|
77
|
+
private readonly ChainSelector;
|
|
78
|
+
readonly config: FilterLogTriggerRequest;
|
|
79
|
+
constructor(config: FilterLogTriggerRequest | FilterLogTriggerRequestJson, _capabilityId: string, _method: string, ChainSelector: bigint);
|
|
80
|
+
capabilityId(): string;
|
|
81
|
+
method(): string;
|
|
82
|
+
outputSchema(): import("@bufbuild/protobuf/codegenv2").GenMessage<Log, {
|
|
83
|
+
jsonType: import("../../../../../generated/capabilities/blockchain/solana/v1alpha/client_pb").LogJson;
|
|
84
|
+
}>;
|
|
85
|
+
configAsAny(): Any;
|
|
86
|
+
/**
|
|
87
|
+
* Transform the raw trigger output - override this method if needed
|
|
88
|
+
* Default implementation returns the raw output unchanged
|
|
89
|
+
*/
|
|
90
|
+
adapt(rawOutput: Log): Log;
|
|
91
|
+
}
|
|
92
|
+
export {};
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import { create, fromJson } from '@bufbuild/protobuf';
|
|
2
|
+
import { AnySchema, anyPack } from '@bufbuild/protobuf/wkt';
|
|
3
|
+
import { AccountMetaSchema, ComputeConfigSchema, FilterLogTriggerRequestSchema, GetAccountInfoWithOptsReplySchema, GetAccountInfoWithOptsRequestSchema, GetBalanceReplySchema, GetBalanceRequestSchema, GetBlockReplySchema, GetBlockRequestSchema, GetFeeForMessageReplySchema, GetFeeForMessageRequestSchema, GetMultipleAccountsWithOptsReplySchema, GetMultipleAccountsWithOptsRequestSchema, GetSignatureStatusesReplySchema, GetSignatureStatusesRequestSchema, GetSlotHeightReplySchema, GetSlotHeightRequestSchema, GetTransactionReplySchema, GetTransactionRequestSchema, LogSchema, WriteReportReplySchema, WriteReportRequestSchema, } from '../../../../../generated/capabilities/blockchain/solana/v1alpha/client_pb';
|
|
4
|
+
import { ReportResponseSchema, } from '../../../../../generated/sdk/v1alpha/sdk_pb';
|
|
5
|
+
import { Report } from '../../../../../sdk/report';
|
|
6
|
+
import { hexToBytes } from '../../../../../sdk/utils/hex-utils';
|
|
7
|
+
export function x_generatedCodeOnly_wrap_WriteCreReportRequest(input) {
|
|
8
|
+
return {
|
|
9
|
+
remainingAccounts: input.remainingAccounts,
|
|
10
|
+
receiver: input.receiver,
|
|
11
|
+
computeConfig: input.computeConfig,
|
|
12
|
+
report: input.report !== undefined ? new Report(input.report) : undefined,
|
|
13
|
+
$report: true,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function createWriteCreReportRequest(input) {
|
|
17
|
+
return {
|
|
18
|
+
remainingAccounts: (input.remainingAccounts ?? []).map((v) => fromJson(AccountMetaSchema, v)),
|
|
19
|
+
receiver: hexToBytes(input.receiver),
|
|
20
|
+
computeConfig: input.computeConfig !== undefined
|
|
21
|
+
? fromJson(ComputeConfigSchema, input.computeConfig)
|
|
22
|
+
: undefined,
|
|
23
|
+
report: input.report,
|
|
24
|
+
$report: true,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function x_generatedCodeOnly_unwrap_WriteCreReportRequest(input) {
|
|
28
|
+
return create(WriteReportRequestSchema, {
|
|
29
|
+
remainingAccounts: input.remainingAccounts,
|
|
30
|
+
receiver: input.receiver,
|
|
31
|
+
computeConfig: input.computeConfig,
|
|
32
|
+
report: input.report !== undefined ? input.report.x_generatedCodeOnly_unwrap() : undefined,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Client Capability
|
|
37
|
+
*
|
|
38
|
+
* Capability ID: solana@1.0.0
|
|
39
|
+
* Capability Name: solana
|
|
40
|
+
* Capability Version: 1.0.0
|
|
41
|
+
*/
|
|
42
|
+
export class ClientCapability {
|
|
43
|
+
ChainSelector;
|
|
44
|
+
/** The capability ID for this service */
|
|
45
|
+
static CAPABILITY_ID = 'solana@1.0.0';
|
|
46
|
+
static CAPABILITY_NAME = 'solana';
|
|
47
|
+
static CAPABILITY_VERSION = '1.0.0';
|
|
48
|
+
/** Available ChainSelector values */
|
|
49
|
+
static SUPPORTED_CHAIN_SELECTORS = {
|
|
50
|
+
'solana-devnet': 16423721717087811551n,
|
|
51
|
+
'solana-mainnet': 124615329519749607n,
|
|
52
|
+
'solana-testnet': 6302590918974934319n,
|
|
53
|
+
};
|
|
54
|
+
constructor(ChainSelector) {
|
|
55
|
+
this.ChainSelector = ChainSelector;
|
|
56
|
+
}
|
|
57
|
+
getAccountInfoWithOpts(runtime, input) {
|
|
58
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
59
|
+
let payload;
|
|
60
|
+
if (input.$typeName) {
|
|
61
|
+
// It's the original protobuf type
|
|
62
|
+
payload = input;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
// It's regular JSON, convert using fromJson
|
|
66
|
+
payload = fromJson(GetAccountInfoWithOptsRequestSchema, input);
|
|
67
|
+
}
|
|
68
|
+
// Include all labels in capability ID for routing when specified
|
|
69
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
70
|
+
const capabilityResponse = runtime.callCapability({
|
|
71
|
+
capabilityId,
|
|
72
|
+
method: 'GetAccountInfoWithOpts',
|
|
73
|
+
payload,
|
|
74
|
+
inputSchema: GetAccountInfoWithOptsRequestSchema,
|
|
75
|
+
outputSchema: GetAccountInfoWithOptsReplySchema,
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
result: () => {
|
|
79
|
+
const result = capabilityResponse.result();
|
|
80
|
+
return result;
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
getBalance(runtime, input) {
|
|
85
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
86
|
+
let payload;
|
|
87
|
+
if (input.$typeName) {
|
|
88
|
+
// It's the original protobuf type
|
|
89
|
+
payload = input;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// It's regular JSON, convert using fromJson
|
|
93
|
+
payload = fromJson(GetBalanceRequestSchema, input);
|
|
94
|
+
}
|
|
95
|
+
// Include all labels in capability ID for routing when specified
|
|
96
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
97
|
+
const capabilityResponse = runtime.callCapability({
|
|
98
|
+
capabilityId,
|
|
99
|
+
method: 'GetBalance',
|
|
100
|
+
payload,
|
|
101
|
+
inputSchema: GetBalanceRequestSchema,
|
|
102
|
+
outputSchema: GetBalanceReplySchema,
|
|
103
|
+
});
|
|
104
|
+
return {
|
|
105
|
+
result: () => {
|
|
106
|
+
const result = capabilityResponse.result();
|
|
107
|
+
return result;
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
getBlock(runtime, input) {
|
|
112
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
113
|
+
let payload;
|
|
114
|
+
if (input.$typeName) {
|
|
115
|
+
// It's the original protobuf type
|
|
116
|
+
payload = input;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
// It's regular JSON, convert using fromJson
|
|
120
|
+
payload = fromJson(GetBlockRequestSchema, input);
|
|
121
|
+
}
|
|
122
|
+
// Include all labels in capability ID for routing when specified
|
|
123
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
124
|
+
const capabilityResponse = runtime.callCapability({
|
|
125
|
+
capabilityId,
|
|
126
|
+
method: 'GetBlock',
|
|
127
|
+
payload,
|
|
128
|
+
inputSchema: GetBlockRequestSchema,
|
|
129
|
+
outputSchema: GetBlockReplySchema,
|
|
130
|
+
});
|
|
131
|
+
return {
|
|
132
|
+
result: () => {
|
|
133
|
+
const result = capabilityResponse.result();
|
|
134
|
+
return result;
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
getFeeForMessage(runtime, input) {
|
|
139
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
140
|
+
let payload;
|
|
141
|
+
if (input.$typeName) {
|
|
142
|
+
// It's the original protobuf type
|
|
143
|
+
payload = input;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
// It's regular JSON, convert using fromJson
|
|
147
|
+
payload = fromJson(GetFeeForMessageRequestSchema, input);
|
|
148
|
+
}
|
|
149
|
+
// Include all labels in capability ID for routing when specified
|
|
150
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
151
|
+
const capabilityResponse = runtime.callCapability({
|
|
152
|
+
capabilityId,
|
|
153
|
+
method: 'GetFeeForMessage',
|
|
154
|
+
payload,
|
|
155
|
+
inputSchema: GetFeeForMessageRequestSchema,
|
|
156
|
+
outputSchema: GetFeeForMessageReplySchema,
|
|
157
|
+
});
|
|
158
|
+
return {
|
|
159
|
+
result: () => {
|
|
160
|
+
const result = capabilityResponse.result();
|
|
161
|
+
return result;
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
getMultipleAccountsWithOpts(runtime, input) {
|
|
166
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
167
|
+
let payload;
|
|
168
|
+
if (input.$typeName) {
|
|
169
|
+
// It's the original protobuf type
|
|
170
|
+
payload = input;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
// It's regular JSON, convert using fromJson
|
|
174
|
+
payload = fromJson(GetMultipleAccountsWithOptsRequestSchema, input);
|
|
175
|
+
}
|
|
176
|
+
// Include all labels in capability ID for routing when specified
|
|
177
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
178
|
+
const capabilityResponse = runtime.callCapability({
|
|
179
|
+
capabilityId,
|
|
180
|
+
method: 'GetMultipleAccountsWithOpts',
|
|
181
|
+
payload,
|
|
182
|
+
inputSchema: GetMultipleAccountsWithOptsRequestSchema,
|
|
183
|
+
outputSchema: GetMultipleAccountsWithOptsReplySchema,
|
|
184
|
+
});
|
|
185
|
+
return {
|
|
186
|
+
result: () => {
|
|
187
|
+
const result = capabilityResponse.result();
|
|
188
|
+
return result;
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
getSignatureStatuses(runtime, input) {
|
|
193
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
194
|
+
let payload;
|
|
195
|
+
if (input.$typeName) {
|
|
196
|
+
// It's the original protobuf type
|
|
197
|
+
payload = input;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
// It's regular JSON, convert using fromJson
|
|
201
|
+
payload = fromJson(GetSignatureStatusesRequestSchema, input);
|
|
202
|
+
}
|
|
203
|
+
// Include all labels in capability ID for routing when specified
|
|
204
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
205
|
+
const capabilityResponse = runtime.callCapability({
|
|
206
|
+
capabilityId,
|
|
207
|
+
method: 'GetSignatureStatuses',
|
|
208
|
+
payload,
|
|
209
|
+
inputSchema: GetSignatureStatusesRequestSchema,
|
|
210
|
+
outputSchema: GetSignatureStatusesReplySchema,
|
|
211
|
+
});
|
|
212
|
+
return {
|
|
213
|
+
result: () => {
|
|
214
|
+
const result = capabilityResponse.result();
|
|
215
|
+
return result;
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
getSlotHeight(runtime, input) {
|
|
220
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
221
|
+
let payload;
|
|
222
|
+
if (input.$typeName) {
|
|
223
|
+
// It's the original protobuf type
|
|
224
|
+
payload = input;
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
// It's regular JSON, convert using fromJson
|
|
228
|
+
payload = fromJson(GetSlotHeightRequestSchema, input);
|
|
229
|
+
}
|
|
230
|
+
// Include all labels in capability ID for routing when specified
|
|
231
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
232
|
+
const capabilityResponse = runtime.callCapability({
|
|
233
|
+
capabilityId,
|
|
234
|
+
method: 'GetSlotHeight',
|
|
235
|
+
payload,
|
|
236
|
+
inputSchema: GetSlotHeightRequestSchema,
|
|
237
|
+
outputSchema: GetSlotHeightReplySchema,
|
|
238
|
+
});
|
|
239
|
+
return {
|
|
240
|
+
result: () => {
|
|
241
|
+
const result = capabilityResponse.result();
|
|
242
|
+
return result;
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
getTransaction(runtime, input) {
|
|
247
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
248
|
+
let payload;
|
|
249
|
+
if (input.$typeName) {
|
|
250
|
+
// It's the original protobuf type
|
|
251
|
+
payload = input;
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
// It's regular JSON, convert using fromJson
|
|
255
|
+
payload = fromJson(GetTransactionRequestSchema, input);
|
|
256
|
+
}
|
|
257
|
+
// Include all labels in capability ID for routing when specified
|
|
258
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
259
|
+
const capabilityResponse = runtime.callCapability({
|
|
260
|
+
capabilityId,
|
|
261
|
+
method: 'GetTransaction',
|
|
262
|
+
payload,
|
|
263
|
+
inputSchema: GetTransactionRequestSchema,
|
|
264
|
+
outputSchema: GetTransactionReplySchema,
|
|
265
|
+
});
|
|
266
|
+
return {
|
|
267
|
+
result: () => {
|
|
268
|
+
const result = capabilityResponse.result();
|
|
269
|
+
return result;
|
|
270
|
+
},
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
logTrigger(config) {
|
|
274
|
+
// Include all labels in capability ID for routing when specified
|
|
275
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
276
|
+
return new ClientLogTrigger(config, capabilityId, 'LogTrigger', this.ChainSelector);
|
|
277
|
+
}
|
|
278
|
+
writeReport(runtime, input) {
|
|
279
|
+
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
|
|
280
|
+
let payload;
|
|
281
|
+
// Check if it's a wrapped type by looking for the $report property
|
|
282
|
+
if (input.$report) {
|
|
283
|
+
// It's a wrapped type, unwrap it
|
|
284
|
+
payload = x_generatedCodeOnly_unwrap_WriteCreReportRequest(input);
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
// It's wrapped JSON, convert using create function
|
|
288
|
+
payload = x_generatedCodeOnly_unwrap_WriteCreReportRequest(createWriteCreReportRequest(input));
|
|
289
|
+
}
|
|
290
|
+
// Include all labels in capability ID for routing when specified
|
|
291
|
+
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`;
|
|
292
|
+
const capabilityResponse = runtime.callCapability({
|
|
293
|
+
capabilityId,
|
|
294
|
+
method: 'WriteReport',
|
|
295
|
+
payload,
|
|
296
|
+
inputSchema: WriteReportRequestSchema,
|
|
297
|
+
outputSchema: WriteReportReplySchema,
|
|
298
|
+
});
|
|
299
|
+
return {
|
|
300
|
+
result: () => {
|
|
301
|
+
const result = capabilityResponse.result();
|
|
302
|
+
return result;
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Trigger implementation for LogTrigger
|
|
309
|
+
*/
|
|
310
|
+
class ClientLogTrigger {
|
|
311
|
+
_capabilityId;
|
|
312
|
+
_method;
|
|
313
|
+
ChainSelector;
|
|
314
|
+
config;
|
|
315
|
+
constructor(config, _capabilityId, _method, ChainSelector) {
|
|
316
|
+
this._capabilityId = _capabilityId;
|
|
317
|
+
this._method = _method;
|
|
318
|
+
this.ChainSelector = ChainSelector;
|
|
319
|
+
// biome-ignore lint/suspicious/noExplicitAny: Needed for runtime type checking of protocol buffer messages
|
|
320
|
+
this.config = config.$typeName
|
|
321
|
+
? config
|
|
322
|
+
: fromJson(FilterLogTriggerRequestSchema, config);
|
|
323
|
+
}
|
|
324
|
+
capabilityId() {
|
|
325
|
+
return this._capabilityId;
|
|
326
|
+
}
|
|
327
|
+
method() {
|
|
328
|
+
return this._method;
|
|
329
|
+
}
|
|
330
|
+
outputSchema() {
|
|
331
|
+
return LogSchema;
|
|
332
|
+
}
|
|
333
|
+
configAsAny() {
|
|
334
|
+
return anyPack(FilterLogTriggerRequestSchema, this.config);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Transform the raw trigger output - override this method if needed
|
|
338
|
+
* Default implementation returns the raw output unchanged
|
|
339
|
+
*/
|
|
340
|
+
adapt(rawOutput) {
|
|
341
|
+
return rawOutput;
|
|
342
|
+
}
|
|
343
|
+
}
|