@chainlink/cre-sdk 1.1.3-alpha.2 → 1.1.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/README.md +1 -12
- package/bin/cre-compile.ts +1 -6
- package/dist/generated/capabilities/blockchain/evm/v1alpha/client_pb.js +1 -1
- package/dist/generated-sdk/capabilities/blockchain/evm/v1alpha/client_sdk_gen.d.ts +1 -0
- package/dist/generated-sdk/capabilities/blockchain/evm/v1alpha/client_sdk_gen.js +1 -0
- package/dist/index.d.ts +0 -3
- package/dist/sdk/types/global.d.ts +2 -105
- package/dist/sdk/types/restricted-apis.d.ts +23 -18
- package/dist/sdk/utils/capabilities/blockchain/blockchain-helpers.d.ts +38 -1
- package/dist/sdk/utils/capabilities/blockchain/blockchain-helpers.js +80 -6
- package/dist/sdk/utils/prepare-runtime.d.ts +1 -1
- package/dist/sdk/utils/prepare-runtime.js +2 -9
- package/package.json +1 -1
- package/scripts/run.ts +1 -5
- package/scripts/src/build-types.ts +1 -31
- package/scripts/src/compile-to-js.ts +0 -2
- package/scripts/src/compile-workflow.ts +4 -7
- package/dist/sdk/types/restricted-node-modules.d.ts +0 -405
- package/scripts/src/validate-workflow-runtime-compat.test.ts +0 -412
- package/scripts/src/validate-workflow-runtime-compat.ts +0 -573
package/README.md
CHANGED
|
@@ -8,7 +8,6 @@ The Chainlink Runtime Environment (CRE) SDK for TypeScript enables developers to
|
|
|
8
8
|
- [Examples](#examples)
|
|
9
9
|
- [Simulate locally with CRE CLI](#simulate-locally-with-cre-cli)
|
|
10
10
|
- [Installation](#installation)
|
|
11
|
-
- [Runtime Compatibility Constraints](#runtime-compatibility-constraints)
|
|
12
11
|
- [Core Concepts](#core-concepts)
|
|
13
12
|
- [Workflows](#workflows)
|
|
14
13
|
- [Runtime Modes](#runtime-modes)
|
|
@@ -48,20 +47,10 @@ This package must be used along with the [CRE CLI tool](https://github.com/smart
|
|
|
48
47
|
|
|
49
48
|
## Prerequisites
|
|
50
49
|
|
|
51
|
-
1. the [bun runtime](https://bun.com/)
|
|
50
|
+
1. the [bun runtime](https://bun.com/). The wasm compilation currently is only supported by the bun runtime which has near-complete NodeJS compatibility.
|
|
52
51
|
|
|
53
52
|
2. the [CRE CLI tool](https://github.com/smartcontractkit/cre-cli) installed.
|
|
54
53
|
|
|
55
|
-
## Runtime Compatibility Constraints
|
|
56
|
-
|
|
57
|
-
CRE workflows are compiled to WASM and executed through Javy (QuickJS). This is **not** a full Node.js runtime.
|
|
58
|
-
|
|
59
|
-
- Node built-ins like `node:fs`, `node:crypto`, `node:http`, `node:net`, etc. are not supported in workflows.
|
|
60
|
-
- Browser globals like `fetch`, `window`, and `setTimeout` are also not available in workflow runtime.
|
|
61
|
-
- `cre compile:workflow` / `cre-compile` now validates workflow source and fails fast when unsupported APIs are used.
|
|
62
|
-
|
|
63
|
-
Use CRE capabilities (for example, `cre.capabilities.HTTPClient`) instead of direct Node/browser APIs.
|
|
64
|
-
|
|
65
54
|
## Getting Started
|
|
66
55
|
|
|
67
56
|
We recommend you consult the [getting started docs](https://docs.chain.link/cre/getting-started/cli-installation) and install the CRE CLI.
|
package/bin/cre-compile.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
3
|
import { main as compileWorkflow } from "../scripts/src/compile-workflow";
|
|
4
|
-
import { WorkflowRuntimeCompatibilityError } from "../scripts/src/validate-workflow-runtime-compat";
|
|
5
4
|
|
|
6
5
|
const main = async () => {
|
|
7
6
|
const cliArgs = process.argv.slice(2);
|
|
@@ -27,10 +26,6 @@ const main = async () => {
|
|
|
27
26
|
|
|
28
27
|
// CLI entry point
|
|
29
28
|
main().catch((e) => {
|
|
30
|
-
|
|
31
|
-
console.error(`\n❌ ${e.message}`);
|
|
32
|
-
} else {
|
|
33
|
-
console.error(e);
|
|
34
|
-
}
|
|
29
|
+
console.error(e);
|
|
35
30
|
process.exit(1);
|
|
36
31
|
});
|
|
@@ -10,7 +10,7 @@ import { file_values_v1_values } from '../../../../values/v1/values_pb';
|
|
|
10
10
|
*/
|
|
11
11
|
export const file_capabilities_blockchain_evm_v1alpha_client =
|
|
12
12
|
/*@__PURE__*/
|
|
13
|
-
fileDesc('
|
|
13
|
+
fileDesc('CjBjYXBhYmlsaXRpZXMvYmxvY2tjaGFpbi9ldm0vdjFhbHBoYS9jbGllbnQucHJvdG8SI2NhcGFiaWxpdGllcy5ibG9ja2NoYWluLmV2bS52MWFscGhhIh0KC1RvcGljVmFsdWVzEg4KBnZhbHVlcxgBIAMoDCK4AQoXRmlsdGVyTG9nVHJpZ2dlclJlcXVlc3QSEQoJYWRkcmVzc2VzGAEgAygMEkAKBnRvcGljcxgCIAMoCzIwLmNhcGFiaWxpdGllcy5ibG9ja2NoYWluLmV2bS52MWFscGhhLlRvcGljVmFsdWVzEkgKCmNvbmZpZGVuY2UYAyABKA4yNC5jYXBhYmlsaXRpZXMuYmxvY2tjaGFpbi5ldm0udjFhbHBoYS5Db25maWRlbmNlTGV2ZWwiegoTQ2FsbENvbnRyYWN0UmVxdWVzdBI6CgRjYWxsGAEgASgLMiwuY2FwYWJpbGl0aWVzLmJsb2NrY2hhaW4uZXZtLnYxYWxwaGEuQ2FsbE1zZxInCgxibG9ja19udW1iZXIYAiABKAsyES52YWx1ZXMudjEuQmlnSW50IiEKEUNhbGxDb250cmFjdFJlcGx5EgwKBGRhdGEYASABKAwiWwoRRmlsdGVyTG9nc1JlcXVlc3QSRgoMZmlsdGVyX3F1ZXJ5GAEgASgLMjAuY2FwYWJpbGl0aWVzLmJsb2NrY2hhaW4uZXZtLnYxYWxwaGEuRmlsdGVyUXVlcnkiSQoPRmlsdGVyTG9nc1JlcGx5EjYKBGxvZ3MYASADKAsyKC5jYXBhYmlsaXRpZXMuYmxvY2tjaGFpbi5ldm0udjFhbHBoYS5Mb2cixwEKA0xvZxIPCgdhZGRyZXNzGAEgASgMEg4KBnRvcGljcxgCIAMoDBIPCgd0eF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vcy1hdGxhbnRpYy10ZXN0bmV0EMyZ7eDOvK+03wEKGgoOcGhhcm9zLW1haW5uZXQQyMGHnvXvzaFsChoKDnBsYXNtYS10ZXN0bmV0ENWbv6XDtJmHNwobCg9wb2x5Z29uLW1haW5uZXQQsavk8JqShp04CiEKFHBvbHlnb24tdGVzdG5ldC1hbW95EM2P1t/xx5D64QEKJAoYcHJpdmF0ZS10ZXN0bmV0LWFuZGVzaXRlENSmmKXBj9z8X0LlAQonY29tLmNhcGFiaWxpdGllcy5ibG9ja2NoYWluLmV2bS52MWFscGhhQgtDbGllbnRQcm90b1ABogIDQ0JFqgIjQ2FwYWJpbGl0aWVzLkJsb2NrY2hhaW4uRXZtLlYxYWxwaGHKAiNDYXBhYmlsaXRpZXNcQmxvY2tjaGFpblxFdm1cVjFhbHBoYeICL0NhcGFiaWxpdGllc1xCbG9ja2NoYWluXEV2bVxWMWFscGhhXEdQQk1ldGFkYXRh6gImQ2FwYWJpbGl0aWVzOjpCbG9ja2NoYWluOjpFdm06OlYxYWxwaGFiBnByb3RvMw', [file_sdk_v1alpha_sdk, file_tools_generator_v1alpha_cre_metadata, file_values_v1_values]);
|
|
14
14
|
/**
|
|
15
15
|
* Describes the message capabilities.blockchain.evm.v1alpha.TopicValues.
|
|
16
16
|
* Use `create(TopicValuesSchema)` to create a new message.
|
|
@@ -56,6 +56,7 @@ export declare class ClientCapability {
|
|
|
56
56
|
readonly 'ink-testnet-sepolia': 9763904284804119144n;
|
|
57
57
|
readonly 'jovay-mainnet': 1523760397290643893n;
|
|
58
58
|
readonly 'jovay-testnet': 945045181441419236n;
|
|
59
|
+
readonly 'pharos-atlantic-testnet': 16098325658947243212n;
|
|
59
60
|
readonly 'pharos-mainnet': 7801139999541420232n;
|
|
60
61
|
readonly 'plasma-testnet': 3967220077692964309n;
|
|
61
62
|
readonly 'polygon-mainnet': 4051577828743386545n;
|
|
@@ -66,6 +66,7 @@ export class ClientCapability {
|
|
|
66
66
|
'ink-testnet-sepolia': 9763904284804119144n,
|
|
67
67
|
'jovay-mainnet': 1523760397290643893n,
|
|
68
68
|
'jovay-testnet': 945045181441419236n,
|
|
69
|
+
'pharos-atlantic-testnet': 16098325658947243212n,
|
|
69
70
|
'pharos-mainnet': 7801139999541420232n,
|
|
70
71
|
'plasma-testnet': 3967220077692964309n,
|
|
71
72
|
'polygon-mainnet': 4051577828743386545n,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
// Global type declarations for the CRE SDK runtime
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
type ExistingGlobal<K extends PropertyKey, Fallback> =
|
|
5
|
-
typeof globalThis extends Record<K, infer T> ? T : Fallback
|
|
1
|
+
// Global type declarations for the CRE SDK runtime
|
|
2
|
+
// Those are the methods that the Host exposes to the Guest.
|
|
6
3
|
|
|
7
4
|
/**
|
|
8
5
|
* Host functions exposed by the CRE runtime to WASM guests
|
|
@@ -81,106 +78,6 @@ declare global {
|
|
|
81
78
|
* @returns Unix timestamp in milliseconds
|
|
82
79
|
*/
|
|
83
80
|
function now(): number
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Console API available in the QuickJS runtime
|
|
87
|
-
*/
|
|
88
|
-
type CreConsole = {
|
|
89
|
-
log(...args: unknown[]): void
|
|
90
|
-
warn(...args: unknown[]): void
|
|
91
|
-
error(...args: unknown[]): void
|
|
92
|
-
info(...args: unknown[]): void
|
|
93
|
-
debug(...args: unknown[]): void
|
|
94
|
-
}
|
|
95
|
-
var console: ExistingGlobal<'console', CreConsole>
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* TextEncoder/TextDecoder APIs available via Javy's text_encoding support
|
|
99
|
-
*/
|
|
100
|
-
interface CreTextEncoderEncodeIntoResult {
|
|
101
|
-
read: number
|
|
102
|
-
written: number
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
interface CreTextEncoder {
|
|
106
|
-
readonly encoding: string
|
|
107
|
-
encode(input?: string): Uint8Array
|
|
108
|
-
encodeInto(input: string, dest: Uint8Array): CreTextEncoderEncodeIntoResult
|
|
109
|
-
}
|
|
110
|
-
var TextEncoder: ExistingGlobal<
|
|
111
|
-
'TextEncoder',
|
|
112
|
-
{ prototype: CreTextEncoder; new (): CreTextEncoder }
|
|
113
|
-
>
|
|
114
|
-
|
|
115
|
-
interface CreTextDecoder {
|
|
116
|
-
readonly encoding: string
|
|
117
|
-
readonly fatal: boolean
|
|
118
|
-
readonly ignoreBOM: boolean
|
|
119
|
-
decode(input?: ArrayBuffer | ArrayBufferView, options?: { stream?: boolean }): string
|
|
120
|
-
}
|
|
121
|
-
var TextDecoder: ExistingGlobal<
|
|
122
|
-
'TextDecoder',
|
|
123
|
-
{
|
|
124
|
-
prototype: CreTextDecoder
|
|
125
|
-
new (label?: string, options?: { fatal?: boolean; ignoreBOM?: boolean }): CreTextDecoder
|
|
126
|
-
}
|
|
127
|
-
>
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Base64 encoding/decoding — exposed via prepareRuntime() from node:buffer
|
|
131
|
-
*/
|
|
132
|
-
function atob(encodedData: string): string
|
|
133
|
-
function btoa(stringToEncode: string): string
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* URL and URLSearchParams — exposed via prepareRuntime() from node:url
|
|
137
|
-
*/
|
|
138
|
-
interface CreURLSearchParams {
|
|
139
|
-
append(name: string, value: string): void
|
|
140
|
-
delete(name: string): void
|
|
141
|
-
get(name: string): string | null
|
|
142
|
-
getAll(name: string): string[]
|
|
143
|
-
has(name: string): boolean
|
|
144
|
-
set(name: string, value: string): void
|
|
145
|
-
sort(): void
|
|
146
|
-
toString(): string
|
|
147
|
-
forEach(callback: (value: string, key: string, parent: CreURLSearchParams) => void): void
|
|
148
|
-
entries(): IterableIterator<[string, string]>
|
|
149
|
-
keys(): IterableIterator<string>
|
|
150
|
-
values(): IterableIterator<string>
|
|
151
|
-
[Symbol.iterator](): IterableIterator<[string, string]>
|
|
152
|
-
readonly size: number
|
|
153
|
-
}
|
|
154
|
-
var URLSearchParams: ExistingGlobal<
|
|
155
|
-
'URLSearchParams',
|
|
156
|
-
{
|
|
157
|
-
prototype: CreURLSearchParams
|
|
158
|
-
new (
|
|
159
|
-
init?: string | Record<string, string> | [string, string][] | CreURLSearchParams,
|
|
160
|
-
): CreURLSearchParams
|
|
161
|
-
}
|
|
162
|
-
>
|
|
163
|
-
|
|
164
|
-
interface CreURL {
|
|
165
|
-
hash: string
|
|
166
|
-
host: string
|
|
167
|
-
hostname: string
|
|
168
|
-
href: string
|
|
169
|
-
readonly origin: string
|
|
170
|
-
password: string
|
|
171
|
-
pathname: string
|
|
172
|
-
port: string
|
|
173
|
-
protocol: string
|
|
174
|
-
search: string
|
|
175
|
-
readonly searchParams: CreURLSearchParams
|
|
176
|
-
username: string
|
|
177
|
-
toString(): string
|
|
178
|
-
toJSON(): string
|
|
179
|
-
}
|
|
180
|
-
var URL: ExistingGlobal<
|
|
181
|
-
'URL',
|
|
182
|
-
{ prototype: CreURL; new (url: string, base?: string | CreURL): CreURL }
|
|
183
|
-
>
|
|
184
81
|
}
|
|
185
82
|
|
|
186
83
|
export {}
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
declare global {
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
/** @deprecated fetch is not available in CRE WASM workflows. Use cre.capabilities.HTTPClient instead. */
|
|
3
|
+
const fetch: never
|
|
4
|
+
|
|
5
|
+
/** @deprecated window is not available in CRE WASM workflows. */
|
|
6
|
+
const window: never
|
|
7
|
+
|
|
8
|
+
/** @deprecated document is not available in CRE WASM workflows. */
|
|
9
|
+
const document: never
|
|
10
|
+
|
|
11
|
+
/** @deprecated XMLHttpRequest is not available in CRE WASM workflows. Use cre.capabilities.HTTPClient instead. */
|
|
12
|
+
const XMLHttpRequest: never
|
|
13
|
+
|
|
14
|
+
/** @deprecated localStorage is not available in CRE WASM workflows. */
|
|
15
|
+
const localStorage: never
|
|
16
|
+
|
|
17
|
+
/** @deprecated sessionStorage is not available in CRE WASM workflows. */
|
|
18
|
+
const sessionStorage: never
|
|
19
|
+
|
|
20
|
+
/** @deprecated setTimeout is not available in CRE WASM workflows. Use cre.capabilities.CronCapability for scheduling. */
|
|
21
|
+
const setTimeout: never
|
|
22
|
+
|
|
23
|
+
/** @deprecated setInterval is not available in CRE WASM workflows. Use cre.capabilities.CronCapability for scheduling. */
|
|
24
|
+
const setInterval: never
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
export {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CallMsgJson } from '../../../../generated/capabilities/blockchain/evm/v1alpha/client_pb';
|
|
1
|
+
import type { CallMsgJson, FilterLogTriggerRequestJson } from '../../../../generated/capabilities/blockchain/evm/v1alpha/client_pb';
|
|
2
2
|
import type { ReportRequestJson } from '../../../../generated/sdk/v1alpha/sdk_pb';
|
|
3
3
|
import { type BigInt as GeneratedBigInt } from '../../../../generated/values/v1/values_pb';
|
|
4
4
|
import type { Address, Hex } from 'viem';
|
|
@@ -107,4 +107,41 @@ export declare const EVM_DEFAULT_REPORT_ENCODER: {
|
|
|
107
107
|
* @returns The prepared report request.
|
|
108
108
|
*/
|
|
109
109
|
export declare const prepareReportRequest: (hexEncodedPayload: Hex, reportEncoder?: Omit<ReportRequestJson, "encodedPayload">) => ReportRequestJson;
|
|
110
|
+
export interface LogTriggerConfigOptions {
|
|
111
|
+
/** EVM addresses to monitor — hex strings with 0x prefix (20 bytes each) */
|
|
112
|
+
addresses: Hex[];
|
|
113
|
+
/** Topic filters — array of up to 4 arrays of hex topic values (32 bytes each).
|
|
114
|
+
* - topics[0]: event signatures (keccak256 hashes), at least one required
|
|
115
|
+
* - topics[1]: possible values for first indexed arg (optional)
|
|
116
|
+
* - topics[2]: possible values for second indexed arg (optional)
|
|
117
|
+
* - topics[3]: possible values for third indexed arg (optional)
|
|
118
|
+
*/
|
|
119
|
+
topics?: Hex[][];
|
|
120
|
+
/** Confidence level for log finality. Defaults to SAFE. */
|
|
121
|
+
confidence?: 'SAFE' | 'LATEST' | 'FINALIZED';
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Creates a log trigger configuration from hex-encoded addresses and topics.
|
|
125
|
+
*
|
|
126
|
+
* This helper converts hex addresses and topic hashes to the base64-encoded format
|
|
127
|
+
* expected by the EVM capability's `FilterLogTriggerRequest`, and validates that
|
|
128
|
+
* addresses are 20 bytes and topics are 32 bytes.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* const WETH = '0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9'
|
|
132
|
+
* const TRANSFER = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
|
|
133
|
+
*
|
|
134
|
+
* handler(
|
|
135
|
+
* evmClient.logTrigger(logTriggerConfig({
|
|
136
|
+
* addresses: [WETH],
|
|
137
|
+
* topics: [[TRANSFER]],
|
|
138
|
+
* confidence: 'LATEST',
|
|
139
|
+
* })),
|
|
140
|
+
* onLogTrigger,
|
|
141
|
+
* )
|
|
142
|
+
*
|
|
143
|
+
* @param opts - Hex-encoded addresses, topic filters, and optional confidence level.
|
|
144
|
+
* @returns The `FilterLogTriggerRequestJson` ready to pass to `evmClient.logTrigger()`.
|
|
145
|
+
*/
|
|
146
|
+
export declare const logTriggerConfig: (opts: LogTriggerConfigOptions) => FilterLogTriggerRequestJson;
|
|
110
147
|
export declare const isChainSelectorSupported: (chainSelectorName: string) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { create, toJson } from '@bufbuild/protobuf';
|
|
2
2
|
import { BigIntSchema } from '../../../../generated/values/v1/values_pb';
|
|
3
3
|
import { EVMClient } from '../../../cre';
|
|
4
|
-
import { bigintToBytes, bytesToBigint, hexToBase64 } from '../../hex-utils';
|
|
4
|
+
import { bigintToBytes, bytesToBigint, hexToBase64, hexToBytes } from '../../hex-utils';
|
|
5
5
|
/**
|
|
6
6
|
* Converts a native JS bigint to a protobuf BigInt JSON representation.
|
|
7
7
|
* Use this when passing bigint values to SDK methods.
|
|
@@ -95,11 +95,21 @@ export const LATEST_BLOCK_NUMBER = {
|
|
|
95
95
|
* @param payload - The call message payload to encode.
|
|
96
96
|
* @returns The encoded call message payload.
|
|
97
97
|
*/
|
|
98
|
-
export const encodeCallMsg = (payload) =>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
98
|
+
export const encodeCallMsg = (payload) => {
|
|
99
|
+
const encodeField = (fieldName, value) => {
|
|
100
|
+
try {
|
|
101
|
+
return hexToBase64(value);
|
|
102
|
+
}
|
|
103
|
+
catch (e) {
|
|
104
|
+
throw new Error(`Invalid hex in '${fieldName}' field of CallMsg: ${e instanceof Error ? e.message : String(e)}`);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
return {
|
|
108
|
+
from: encodeField('from', payload.from),
|
|
109
|
+
to: encodeField('to', payload.to),
|
|
110
|
+
data: encodeField('data', payload.data),
|
|
111
|
+
};
|
|
112
|
+
};
|
|
103
113
|
/**
|
|
104
114
|
* Default values expected by the EVM capability for report encoding.
|
|
105
115
|
*/
|
|
@@ -119,4 +129,68 @@ export const prepareReportRequest = (hexEncodedPayload, reportEncoder = EVM_DEFA
|
|
|
119
129
|
encodedPayload: hexToBase64(hexEncodedPayload),
|
|
120
130
|
...reportEncoder,
|
|
121
131
|
});
|
|
132
|
+
/**
|
|
133
|
+
* Validates a hex string and checks that the decoded bytes have the expected length.
|
|
134
|
+
*/
|
|
135
|
+
const validateHexByteLength = (hex, expectedBytes, fieldLabel) => {
|
|
136
|
+
const bytes = hexToBytes(hex);
|
|
137
|
+
if (bytes.length !== expectedBytes) {
|
|
138
|
+
throw new Error(`Invalid ${fieldLabel}: expected ${expectedBytes} bytes, got ${bytes.length} bytes from '${hex.length > 200 ? hex.slice(0, 200) + '...' : hex}'. EVM ${fieldLabel}s must be exactly ${expectedBytes} bytes.`);
|
|
139
|
+
}
|
|
140
|
+
return hexToBase64(hex);
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Creates a log trigger configuration from hex-encoded addresses and topics.
|
|
144
|
+
*
|
|
145
|
+
* This helper converts hex addresses and topic hashes to the base64-encoded format
|
|
146
|
+
* expected by the EVM capability's `FilterLogTriggerRequest`, and validates that
|
|
147
|
+
* addresses are 20 bytes and topics are 32 bytes.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* const WETH = '0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9'
|
|
151
|
+
* const TRANSFER = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
|
|
152
|
+
*
|
|
153
|
+
* handler(
|
|
154
|
+
* evmClient.logTrigger(logTriggerConfig({
|
|
155
|
+
* addresses: [WETH],
|
|
156
|
+
* topics: [[TRANSFER]],
|
|
157
|
+
* confidence: 'LATEST',
|
|
158
|
+
* })),
|
|
159
|
+
* onLogTrigger,
|
|
160
|
+
* )
|
|
161
|
+
*
|
|
162
|
+
* @param opts - Hex-encoded addresses, topic filters, and optional confidence level.
|
|
163
|
+
* @returns The `FilterLogTriggerRequestJson` ready to pass to `evmClient.logTrigger()`.
|
|
164
|
+
*/
|
|
165
|
+
export const logTriggerConfig = (opts) => {
|
|
166
|
+
if (!opts.addresses || opts.addresses.length === 0) {
|
|
167
|
+
throw new Error('logTriggerConfig requires at least one address. Provide an array of hex-encoded EVM addresses (20 bytes each).');
|
|
168
|
+
}
|
|
169
|
+
const addresses = opts.addresses.map((addr, i) => {
|
|
170
|
+
try {
|
|
171
|
+
return validateHexByteLength(addr, 20, 'address');
|
|
172
|
+
}
|
|
173
|
+
catch (e) {
|
|
174
|
+
throw new Error(`Invalid address at index ${i}: ${e instanceof Error ? e.message : String(e)}`);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
const topics = opts.topics?.map((topicSlot, slotIndex) => ({
|
|
178
|
+
values: topicSlot.map((topic, valueIndex) => {
|
|
179
|
+
try {
|
|
180
|
+
return validateHexByteLength(topic, 32, 'topic');
|
|
181
|
+
}
|
|
182
|
+
catch (e) {
|
|
183
|
+
throw new Error(`Invalid topic at topics[${slotIndex}][${valueIndex}]: ${e instanceof Error ? e.message : String(e)}`);
|
|
184
|
+
}
|
|
185
|
+
}),
|
|
186
|
+
}));
|
|
187
|
+
const confidence = opts.confidence
|
|
188
|
+
? `CONFIDENCE_LEVEL_${opts.confidence}`
|
|
189
|
+
: undefined;
|
|
190
|
+
return {
|
|
191
|
+
addresses,
|
|
192
|
+
...(topics ? { topics } : {}),
|
|
193
|
+
...(confidence ? { confidence } : {}),
|
|
194
|
+
};
|
|
195
|
+
};
|
|
122
196
|
export const isChainSelectorSupported = (chainSelectorName) => Object.keys(EVMClient.SUPPORTED_CHAIN_SELECTORS).includes(chainSelectorName);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This function is used to prepare the runtime for the SDK to work.
|
|
3
3
|
* It should be called as a part of SDK initialization.
|
|
4
|
-
* It exposes
|
|
4
|
+
* It exposes NodeJS Buffer in global namespace, so it can be bundled and used in workflow code.
|
|
5
5
|
*/
|
|
6
6
|
export declare const prepareRuntime: () => void;
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { URL, URLSearchParams } from 'node:url';
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
3
2
|
/**
|
|
4
3
|
* This function is used to prepare the runtime for the SDK to work.
|
|
5
4
|
* It should be called as a part of SDK initialization.
|
|
6
|
-
* It exposes
|
|
5
|
+
* It exposes NodeJS Buffer in global namespace, so it can be bundled and used in workflow code.
|
|
7
6
|
*/
|
|
8
7
|
export const prepareRuntime = () => {
|
|
9
8
|
globalThis.Buffer = Buffer;
|
|
10
|
-
globalThis.atob = atob;
|
|
11
|
-
globalThis.btoa = btoa;
|
|
12
|
-
// node:url constructor types are slightly narrower than lib.dom/global types.
|
|
13
|
-
// Runtime behavior is compatible; cast to the global constructor shapes.
|
|
14
|
-
globalThis.URL = URL;
|
|
15
|
-
globalThis.URLSearchParams = URLSearchParams;
|
|
16
9
|
};
|
package/package.json
CHANGED
package/scripts/run.ts
CHANGED
|
@@ -37,11 +37,7 @@ const main = async () => {
|
|
|
37
37
|
process.exit(1)
|
|
38
38
|
}
|
|
39
39
|
} catch (error) {
|
|
40
|
-
|
|
41
|
-
console.error(error.message)
|
|
42
|
-
} else {
|
|
43
|
-
console.error(`Failed to run script ${scriptName}:`, error)
|
|
44
|
-
}
|
|
40
|
+
console.error(`Failed to load script ${scriptName}:`, error)
|
|
45
41
|
process.exit(1)
|
|
46
42
|
}
|
|
47
43
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { glob } from 'fast-glob'
|
|
2
|
-
import { copyFile, mkdir
|
|
2
|
+
import { copyFile, mkdir } from 'fs/promises'
|
|
3
3
|
import { join } from 'path'
|
|
4
4
|
|
|
5
5
|
const buildTypes = async () => {
|
|
@@ -28,36 +28,6 @@ const buildTypes = async () => {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
console.log(`✅ Copied ${typeFiles.length} type definition file(s) to dist/sdk/types`)
|
|
31
|
-
|
|
32
|
-
// Prepend triple-slash references to dist/index.d.ts so consumers pick up
|
|
33
|
-
// global type augmentations (e.g. restricted-apis.d.ts) automatically.
|
|
34
|
-
// tsc strips these from the emitted .d.ts, so we add them back here.
|
|
35
|
-
const indexDts = join(packageRoot, 'dist/index.d.ts')
|
|
36
|
-
const sourceIndex = join(packageRoot, 'src/index.ts')
|
|
37
|
-
const sourceContent = await readFile(sourceIndex, 'utf-8')
|
|
38
|
-
|
|
39
|
-
const refsFromSource = sourceContent
|
|
40
|
-
.split('\n')
|
|
41
|
-
.filter((line) => line.startsWith('/// <reference types='))
|
|
42
|
-
|
|
43
|
-
// Add references for consumer-only type declarations that cannot be in src/index.ts
|
|
44
|
-
// because they would break the SDK's own scripts/tests (which legitimately use Node.js APIs).
|
|
45
|
-
const consumerOnlyRefs = ['/// <reference types="./sdk/types/restricted-node-modules" />']
|
|
46
|
-
|
|
47
|
-
const tripleSlashRefs = [...refsFromSource, ...consumerOnlyRefs].join('\n')
|
|
48
|
-
|
|
49
|
-
if (tripleSlashRefs) {
|
|
50
|
-
const indexContent = await readFile(indexDts, 'utf-8')
|
|
51
|
-
// Strip any existing triple-slash references from the top of the file
|
|
52
|
-
// so that re-running build-types is idempotent.
|
|
53
|
-
const withoutExistingRefs = indexContent
|
|
54
|
-
.split('\n')
|
|
55
|
-
.filter((line) => !line.startsWith('/// <reference types='))
|
|
56
|
-
.join('\n')
|
|
57
|
-
.replace(/^\n+/, '') // trim leading blank lines left after stripping
|
|
58
|
-
await writeFile(indexDts, `${tripleSlashRefs}\n${withoutExistingRefs}`)
|
|
59
|
-
console.log('✅ Added triple-slash references to dist/index.d.ts')
|
|
60
|
-
}
|
|
61
31
|
}
|
|
62
32
|
|
|
63
33
|
export const main = buildTypes
|
|
@@ -2,7 +2,6 @@ import { existsSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs'
|
|
|
2
2
|
import { mkdir } from 'node:fs/promises'
|
|
3
3
|
import path from 'node:path'
|
|
4
4
|
import { $ } from 'bun'
|
|
5
|
-
import { assertWorkflowRuntimeCompatibility } from './validate-workflow-runtime-compat'
|
|
6
5
|
import { wrapWorkflowCode } from './workflow-wrapper'
|
|
7
6
|
|
|
8
7
|
export const main = async (tsFilePath?: string, outputFilePath?: string) => {
|
|
@@ -20,7 +19,6 @@ export const main = async (tsFilePath?: string, outputFilePath?: string) => {
|
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
const resolvedInput = path.resolve(inputPath)
|
|
23
|
-
assertWorkflowRuntimeCompatibility(resolvedInput)
|
|
24
22
|
console.info(`📁 Using input file: ${resolvedInput}`)
|
|
25
23
|
|
|
26
24
|
// If no explicit output path → same dir, swap extension to .js
|
|
@@ -3,7 +3,6 @@ import { mkdir } from 'node:fs/promises'
|
|
|
3
3
|
import path from 'node:path'
|
|
4
4
|
import { main as compileToJs } from './compile-to-js'
|
|
5
5
|
import { main as compileToWasm } from './compile-to-wasm'
|
|
6
|
-
import { WorkflowRuntimeCompatibilityError } from './validate-workflow-runtime-compat'
|
|
7
6
|
|
|
8
7
|
export const main = async (inputFile?: string, outputWasmFile?: string) => {
|
|
9
8
|
const cliArgs = process.argv.slice(3)
|
|
@@ -42,7 +41,9 @@ export const main = async (inputFile?: string, outputWasmFile?: string) => {
|
|
|
42
41
|
await mkdir(path.dirname(resolvedJsOutput), { recursive: true })
|
|
43
42
|
|
|
44
43
|
console.info(`🚀 Compiling workflow`)
|
|
45
|
-
console.info(`📁 Input: ${resolvedInput}
|
|
44
|
+
console.info(`📁 Input: ${resolvedInput}`)
|
|
45
|
+
console.info(`🧪 JS out: ${resolvedJsOutput}`)
|
|
46
|
+
console.info(`🎯 WASM out:${resolvedWasmOutput}\n`)
|
|
46
47
|
|
|
47
48
|
// Step 1: TS/JS → JS (bundled)
|
|
48
49
|
console.info('📦 Step 1: Compiling JS...')
|
|
@@ -59,11 +60,7 @@ export const main = async (inputFile?: string, outputWasmFile?: string) => {
|
|
|
59
60
|
// Optional: allow direct CLI usage
|
|
60
61
|
if (import.meta.main) {
|
|
61
62
|
main().catch((e) => {
|
|
62
|
-
|
|
63
|
-
console.error(`\n❌ ${e.message}`)
|
|
64
|
-
} else {
|
|
65
|
-
console.error(e)
|
|
66
|
-
}
|
|
63
|
+
console.error(e)
|
|
67
64
|
process.exit(1)
|
|
68
65
|
})
|
|
69
66
|
}
|