File tree Expand file tree Collapse file tree 4 files changed +37
-2
lines changed
src/javy_chainlink_sdk/src
src/standard_tests/host_wasm_write_errors_are_respected Expand file tree Collapse file tree 4 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,10 @@ pub unsafe extern "C" fn initialize_runtime() {
124124 )
125125 } ;
126126 if n < 0 {
127- return Err ( Error :: new_into_js ( "Error" , "await_capabilities failed" ) ) ;
127+ let error_len = ( -n) as usize ;
128+ let error_msg = String :: from_utf8_lossy ( & buf[ ..error_len. min ( max_len as usize ) ] ) . into_owned ( ) ;
129+ let error_msg_static: & ' static str = Box :: leak ( error_msg. into_boxed_str ( ) ) ;
130+ return Err ( Error :: new_into_js ( "Error" , error_msg_static) ) ;
128131 }
129132
130133 let out = & buf[ ..n as usize ] ;
Original file line number Diff line number Diff line change 1- COMMON_VERSION ?=
[email protected] .
0 1+ COMMON_VERSION ?=
[email protected] .
1 22MODULE := github.com/smartcontractkit/chainlink-common
33TEST_PATTERN ?= ^TestStandard
44
Original file line number Diff line number Diff line change 1+ import { BasicActionCapability } from '@cre/generated-sdk/capabilities/internal/basicaction/v1/basicaction_sdk_gen'
2+ import { BasicCapability as BasicTriggerCapability } from '@cre/generated-sdk/capabilities/internal/basictrigger/v1/basic_sdk_gen'
3+ import { cre , type Runtime } from '@cre/sdk/cre'
4+ import { Runner } from '@cre/sdk/wasm'
5+
6+ const asyncCalls = ( runtime : Runtime < Uint8Array > ) => {
7+ const basicAction = new BasicActionCapability ( )
8+ const input = { inputThing : true }
9+ const p = basicAction . performAction ( runtime , input )
10+
11+ p . result ( )
12+
13+ return `We should not get here, result should throw an error`
14+ }
15+
16+ const initWorkflow = ( ) => {
17+ const basicTrigger = new BasicTriggerCapability ( )
18+ return [ cre . handler ( basicTrigger . trigger ( { } ) , asyncCalls ) ]
19+ }
20+
21+ export async function main ( ) {
22+ console . log (
23+ `TS workflow: standard test: capability calls are async [${ new Date ( ) . toISOString ( ) } ]` ,
24+ )
25+
26+ const runner = await Runner . newRunner < Uint8Array > ( {
27+ configParser : ( c ) => c ,
28+ } )
29+ runner . run ( initWorkflow )
30+ }
31+
32+ await main ( )
You can’t perform that action at this time.
0 commit comments