Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"packages/cre-sdk": {
"name": "@chainlink/cre-sdk",
"version": "0.0.3-alpha",
"version": "0.0.4-alpha",
"bin": {
"cre-compile": "bin/cre-compile.ts",
},
Expand All @@ -37,15 +37,17 @@
},
"packages/cre-sdk-examples": {
"name": "@chainlink/cre-sdk-examples",
"version": "0.0.3-alpha",
"version": "0.0.4-alpha",
"dependencies": {
"@bufbuild/protobuf": "2.6.3",
"@chainlink/cre-sdk": "workspace:*",
"viem": "2.34.0",
"zod": "3.25.76",
},
},
"packages/cre-sdk-javy-plugin": {
"name": "@chainlink/cre-sdk-javy-plugin",
"version": "0.0.3-alpha",
"version": "0.0.4-alpha",
"bin": {
"cre-setup": "bin/setup.ts",
"cre-compile-workflow": "bin/compile-workflow.ts",
Expand Down
42 changes: 41 additions & 1 deletion packages/cre-sdk-examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,47 @@ Before first usage run the setup command. Setup will download the right Javy bin
bunx cre-setup
```

Then you are ready to use the CRE SDK to compile your workflows to WASM. Choose any workflow you want to compile and run the following command:
## Using CRE CLI to simulate example workflows

This repository is fully compatible with the [CRE CLI](https://github.com/smartcontractkit/cre-cli). You can use the CRE CLI to simulate the example workflows it provides.

The setup is done in a way that treats `cre-sdk-examples` root directory as a CRE project root. When simulating a workflow, you pass the path to the workflow directory you want to simulate.

**Examples**:

[Hello World workflow](https://github.com/smartcontractkit/cre-sdk-typescript/blob/main/packages/cre-sdk-examples/src/workflows/hello-world/index.ts):

```zsh
cre workflow simulate ./src/workflows/hello-world --target local-simulation
```

[Http Fetch workflow](https://github.com/smartcontractkit/cre-sdk-typescript/blob/main/packages/cre-sdk-examples/src/workflows/http-fetch/index.ts):

```zsh
cre workflow simulate ./src/workflows/http-fetch --target local-simulation
```

[On Chain Read workflow](https://github.com/smartcontractkit/cre-sdk-typescript/blob/main/packages/cre-sdk-examples/src/workflows/on-chain/index.ts):

```zsh
cre workflow simulate ./src/workflows/on-chain --target local-simulation
```

[On Chain Write workflow](https://github.com/smartcontractkit/cre-sdk-typescript/blob/main/packages/cre-sdk-examples/src/workflows/on-chain-write/index.ts):

```zsh
cre workflow simulate ./src/workflows/on-chain-write --target local-simulation --broadcast
```

[Proof of Reserve workflow](https://github.com/smartcontractkit/cre-sdk-typescript/blob/main/packages/cre-sdk-examples/src/workflows/proof-of-reserve/index.ts):

```zsh
cre workflow simulate ./src/workflows/proof-of-reserve --target local-simulation --broadcast --secrets ../../../secrets.yaml
```

## Testing workflow compilation only

If you want use the CRE SDK to compile your workflows to WASM, choose any workflow you want to compile and run the following command:

```bash
bunx cre-compile <input.ts> <output.wasm>
Expand Down
4 changes: 3 additions & 1 deletion packages/cre-sdk-examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
},
"dependencies": {
"@bufbuild/protobuf": "2.6.3",
"@chainlink/cre-sdk": "workspace:*"
"@chainlink/cre-sdk": "workspace:*",
"viem": "2.34.0",
"zod": "3.25.76"
},
"engines": {
"bun": ">=1.2.21"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ local-simulation:
user-workflow:
workflow-owner-address: "(optional) Multi-signature contract address"
workflow-name: "hello-world"
workflow-artifacts:
workflow-path: "./index.ts"
config-path: "./config.json"

# ==========================================================================
production-testnet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ local-simulation:
user-workflow:
workflow-owner-address: "(optional) Multi-signature contract address"
workflow-name: "http-fetch"
workflow-artifacts:
workflow-path: "./index.ts"
config-path: "./config.json"

# ==========================================================================
production-testnet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ local-simulation:
user-workflow:
workflow-owner-address: "(optional) Multi-signature contract address"
workflow-name: "on-chain-write"

workflow-artifacts:
workflow-path: "./index.ts"
config-path: "./config.json"
# ==========================================================================
production-testnet:
user-workflow:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ local-simulation:
user-workflow:
workflow-owner-address: "(optional) Multi-signature contract address"
workflow-name: "on-chain"
workflow-artifacts:
workflow-path: "./index.ts"
config-path: "./config.json"

# ==========================================================================
production-testnet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ local-simulation:
user-workflow:
workflow-owner-address: "(optional) Multi-signature contract address"
workflow-name: "proof-of-reserve"
workflow-artifacts:
workflow-path: "./index.ts"
config-path: "./config.json"

# ==========================================================================
production-testnet:
Expand Down