diff --git a/package.json b/package.json index 4eaadfa..4724a79 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "outputPath": "./" }, "dependencies": { - "@dyne/slangroom-chain": "^1.5.0", + "@dyne/slangroom-chain": "^1.6.0", "@slangroom/core": "^1.33.1", "@slangroom/db": "^1.33.1", "@slangroom/ethereum": "^1.33.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f9edef5..e5da636 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,7 +9,7 @@ importers: .: dependencies: '@dyne/slangroom-chain': - specifier: ^1.5.0 + specifier: ^1.6.0 version: 1.6.0(@capacitor/core@6.0.0)(zenroom@4.32.2) '@slangroom/core': specifier: ^1.33.1 diff --git a/src/index.ts b/src/index.ts index 2c55ace..99ef2f0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -324,7 +324,7 @@ const generateRoutes = (app: TemplatedApp) => { let jsonResult: Record ; try { if (chain) { - jsonResult = JSON.parse(await slangroomChainExecute(chain)); + jsonResult = JSON.parse(await slangroomChainExecute(chain, data? JSON.stringify(data) : undefined)); } else { ({ result: jsonResult } = await s.execute(contract, { keys, data, conf })); } diff --git a/tests/fixtures/chain/hello_with_input.chain.js b/tests/fixtures/chain/hello_with_input.chain.js new file mode 100644 index 0000000..411897e --- /dev/null +++ b/tests/fixtures/chain/hello_with_input.chain.js @@ -0,0 +1,10 @@ +() => { + return { + "steps": [ + { + "id": "first", + "zencode": "Given I have a 'string' named 'say_hi'\nThen print 'say_hi'" + } + ] + } +} \ No newline at end of file diff --git a/tests/workflow.stepci.yml b/tests/workflow.stepci.yml index 8d71501..60809e7 100644 --- a/tests/workflow.stepci.yml +++ b/tests/workflow.stepci.yml @@ -383,6 +383,26 @@ tests: json: say_hi: hello from dataTransform + - name: hello chain with input GET + http: + url: http://${{env.host}}/chain/hello_with_input?say_hi=bonjour + method: GET + check: + status: 200 + json: + say_hi: bonjour + + - name: hello chain with input POST + http: + url: http://${{env.host}}/chain/hello_with_input + method: POST + json: + say_hi: Buen día + check: + status: 200 + json: + say_hi: Buen día + public_dir: steps: - name: public with wrong precondition