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
16 changes: 16 additions & 0 deletions cmd/crates/soroban-test/tests/it/integration/cookbook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@ fn run_command(
modified_args.push(key_xdr.to_string());
skip_next = true;
}
"--manifest-path" => {
// this defaults to the hello_world manifest path in fixtures/test-wasms
let hello_world_manifest_path = get_repo_root()
.join("cmd")
.join("crates")
.join("soroban-test")
.join("tests")
.join("fixtures")
.join("test-wasms")
.join("hello_world")
.join("Cargo.toml");
modified_args.push(arg.to_string());
modified_args.push(hello_world_manifest_path.display().to_string());
skip_next = true;
}

"<DURABILITY>" => {
modified_args.push("persistent".to_string());
skip_next = false;
Expand Down
35 changes: 35 additions & 0 deletions cookbook/contract-build-meta.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Add meta data to contract WASM on build
hide_table_of_contents: true
description: Include meta data in the contract WASM byte code on build
custom_edit_url: https://github.com/stellar/stellar-cli/edit/main/cookbook/contract-build-meta.mdx
---

To build a smart contract, use the `stellar contract build` command. The `--meta` option will allow you to add additional meta data entries to the `contractmetav0` custom section of the resulting WASM file at build time.

```bash cookbooktest.ignore
export SHA=$(git rev-parse HEAD)
```

```bash
stellar contract build \
--manifest-path ./cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml \
--meta source_repo=https://github.com/stellar/stellar-cli \
--meta commit_sha=$SHA
```

You can then use `stellar contract info meta` to see the meta data:

```bash
stellar contract info meta \
--wasm target/wasm32v1-none/release/test_hello_world.wasm
```

```bash cookbooktest.ignore
Contract meta:
• rsver: 1.91.0 (Rust version)
• rssdkver: 23.0.1#510d3feb724c2b01d7e7ab7652f03b9f8efc3f35 (Soroban SDK version and its commit hash)
• cliver: 23.1.4#v20.0.0-646-g70895dd66fb7dbf2f4c2a81cf38546512ba4198e-dirty
• source_repo: https://github.com/stellar/stellar-cli
• commit_sha: c6f881689d3f4936cb3262089eb70142e9ca9c91
```
Loading