@chainlink/cre-sdk 0.0.7-alpha → 0.0.9-alpha
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/pb.d.ts +1 -0
- package/dist/pb.js +1 -0
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.js +1 -0
- package/dist/sdk/types/bufbuild-types.d.ts +4 -0
- package/dist/sdk/types/bufbuild-types.js +1 -0
- package/dist/sdk/utils/capabilities/blockchain/blockchain-helpers.d.ts +17 -0
- package/dist/sdk/utils/capabilities/blockchain/blockchain-helpers.js +19 -0
- package/package.json +2 -2
- package/scripts/src/compile-to-wasm.ts +9 -2
- package/scripts/src/generate-chain-selectors.ts +26 -7
package/dist/pb.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export * as HTTP_TRIGGER_PB from './generated/capabilities/networking/http/v1alp
|
|
|
4
4
|
export * as CRON_TRIGGER_PB from './generated/capabilities/scheduler/cron/v1/trigger_pb';
|
|
5
5
|
export * as SDK_PB from './generated/sdk/v1alpha/sdk_pb';
|
|
6
6
|
export * as VALUES_PB from './generated/values/v1/values_pb';
|
|
7
|
+
export * as BUFBUILD_TYPES from './sdk/types/bufbuild-types';
|
package/dist/pb.js
CHANGED
|
@@ -4,3 +4,4 @@ export * as HTTP_TRIGGER_PB from './generated/capabilities/networking/http/v1alp
|
|
|
4
4
|
export * as CRON_TRIGGER_PB from './generated/capabilities/scheduler/cron/v1/trigger_pb';
|
|
5
5
|
export * as SDK_PB from './generated/sdk/v1alpha/sdk_pb';
|
|
6
6
|
export * as VALUES_PB from './generated/values/v1/values_pb';
|
|
7
|
+
export * as BUFBUILD_TYPES from './sdk/types/bufbuild-types';
|
package/dist/sdk/index.d.ts
CHANGED
package/dist/sdk/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CallMsgJson } from '../../../../generated/capabilities/blockchain/evm/v1alpha/client_pb';
|
|
2
|
+
import type { ReportRequestJson } from '../../../../generated/sdk/v1alpha/sdk_pb';
|
|
2
3
|
import type { Address, Hex } from 'viem';
|
|
3
4
|
/**
|
|
4
5
|
* EVM Capability Helper.
|
|
@@ -48,3 +49,19 @@ export interface EncodeCallMsgPayload {
|
|
|
48
49
|
* @returns The encoded call message payload.
|
|
49
50
|
*/
|
|
50
51
|
export declare const encodeCallMsg: (payload: EncodeCallMsgPayload) => CallMsgJson;
|
|
52
|
+
/**
|
|
53
|
+
* Default values expected by the EVM capability for report encoding.
|
|
54
|
+
*/
|
|
55
|
+
export declare const EVM_DEFAULT_REPORT_ENCODER: {
|
|
56
|
+
encoderName: string;
|
|
57
|
+
signingAlgo: string;
|
|
58
|
+
hashingAlgo: string;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Prepares a report request for the EVM capability to pass to `.report()` function.
|
|
62
|
+
*
|
|
63
|
+
* @param hexEncodedPayload - The hex encoded payload to be signed.
|
|
64
|
+
* @param reportEncoder - The report encoder to be used. Defaults to EVM_DEFAULT_REPORT_ENCODER.
|
|
65
|
+
* @returns The prepared report request.
|
|
66
|
+
*/
|
|
67
|
+
export declare const prepareReportRequest: (hexEncodedPayload: Hex, reportEncoder?: Exclude<ReportRequestJson, "encodedPayload">) => ReportRequestJson;
|
|
@@ -46,3 +46,22 @@ export const encodeCallMsg = (payload) => ({
|
|
|
46
46
|
to: hexToBase64(payload.to),
|
|
47
47
|
data: hexToBase64(payload.data),
|
|
48
48
|
});
|
|
49
|
+
/**
|
|
50
|
+
* Default values expected by the EVM capability for report encoding.
|
|
51
|
+
*/
|
|
52
|
+
export const EVM_DEFAULT_REPORT_ENCODER = {
|
|
53
|
+
encoderName: 'evm',
|
|
54
|
+
signingAlgo: 'ecdsa',
|
|
55
|
+
hashingAlgo: 'keccak256',
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Prepares a report request for the EVM capability to pass to `.report()` function.
|
|
59
|
+
*
|
|
60
|
+
* @param hexEncodedPayload - The hex encoded payload to be signed.
|
|
61
|
+
* @param reportEncoder - The report encoder to be used. Defaults to EVM_DEFAULT_REPORT_ENCODER.
|
|
62
|
+
* @returns The prepared report request.
|
|
63
|
+
*/
|
|
64
|
+
export const prepareReportRequest = (hexEncodedPayload, reportEncoder = EVM_DEFAULT_REPORT_ENCODER) => ({
|
|
65
|
+
encodedPayload: hexToBase64(hexEncodedPayload),
|
|
66
|
+
...reportEncoder,
|
|
67
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainlink/cre-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9-alpha",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@bufbuild/protobuf": "2.6.3",
|
|
56
56
|
"@bufbuild/protoc-gen-es": "2.6.3",
|
|
57
|
-
"@chainlink/cre-sdk-javy-plugin": "0.0.
|
|
57
|
+
"@chainlink/cre-sdk-javy-plugin": "0.0.6-alpha",
|
|
58
58
|
"@standard-schema/spec": "1.0.0",
|
|
59
59
|
"viem": "2.34.0",
|
|
60
60
|
"zod": "3.25.76"
|
|
@@ -51,8 +51,15 @@ export const main = async (inputFile?: string, outputFile?: string) => {
|
|
|
51
51
|
try {
|
|
52
52
|
await $`bun cre-compile-workflow ${resolvedInput} ${resolvedOutput}`
|
|
53
53
|
} catch {
|
|
54
|
-
//
|
|
55
|
-
|
|
54
|
+
// Fallback: locate compile-workflow.ts relative to this script file
|
|
55
|
+
// From: packages/cre-sdk/scripts/src/compile-to-wasm.ts
|
|
56
|
+
// To: packages/cre-sdk-javy-plugin/bin/compile-workflow.ts
|
|
57
|
+
const scriptDir = import.meta.dir
|
|
58
|
+
const compilerPath = path.resolve(
|
|
59
|
+
scriptDir,
|
|
60
|
+
'../../../cre-sdk-javy-plugin/bin/compile-workflow.ts',
|
|
61
|
+
)
|
|
62
|
+
await $`bun --bun ${compilerPath} ${resolvedInput} ${resolvedOutput}`
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
console.info(`✅ Compiled: ${resolvedOutput}`)
|
|
@@ -79,14 +79,33 @@ const CHAIN_CONFIGS: ChainSelectorConfig[] = [
|
|
|
79
79
|
]
|
|
80
80
|
|
|
81
81
|
const readYamlFile = (filename: string): string => {
|
|
82
|
-
// Look for chain-selectors in
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
// Look for chain-selectors in node_modules by trying multiple possible locations
|
|
83
|
+
// This handles different execution contexts (local dev, CI, etc.)
|
|
84
|
+
const possiblePaths = [
|
|
85
|
+
// Try workspace root (3 levels up from scripts/)
|
|
86
|
+
join(process.cwd(), '..', '..', '..', 'node_modules', 'chain-selectors', filename),
|
|
87
|
+
// Try 2 levels up (in case cwd is already in scripts/src/)
|
|
88
|
+
join(process.cwd(), '..', '..', 'node_modules', 'chain-selectors', filename),
|
|
89
|
+
// Try current directory's node_modules
|
|
90
|
+
join(process.cwd(), 'node_modules', 'chain-selectors', filename),
|
|
91
|
+
// Try parent directory's node_modules
|
|
92
|
+
join(process.cwd(), '..', 'node_modules', 'chain-selectors', filename),
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
for (const path of possiblePaths) {
|
|
96
|
+
try {
|
|
97
|
+
return readFileSync(path, 'utf-8')
|
|
98
|
+
} catch {
|
|
99
|
+
// Try next path
|
|
100
|
+
continue
|
|
101
|
+
}
|
|
89
102
|
}
|
|
103
|
+
|
|
104
|
+
throw new Error(
|
|
105
|
+
`Failed to find ${filename} in any of the expected locations. Tried:\n${possiblePaths.join(
|
|
106
|
+
'\n',
|
|
107
|
+
)}`,
|
|
108
|
+
)
|
|
90
109
|
}
|
|
91
110
|
|
|
92
111
|
const parseChainSelectors = (): NetworkInfo[] => {
|