Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement build command to build contract and ABI together #21

Closed
2 of 3 tasks
austinabell opened this issue Aug 4, 2022 · 3 comments
Closed
2 of 3 tasks

Implement build command to build contract and ABI together #21

austinabell opened this issue Aug 4, 2022 · 3 comments
Assignees

Comments

@austinabell
Copy link
Contributor

austinabell commented Aug 4, 2022

Motivation is that it would be preferred if these are built together to ensure there is no mismatch of versions when using.

cargo near build

should build similar to cargo build except that it includes "-C", "link-arg=-s" rustflags to ensure those aren't left out and includes --target wasm32-unknown-unknown. Unsure if all cargo options should/can be forwarded easily, but at least --release needs to be included as configuration.

This command should output the following files in $CARGO_TARGET_DIR/near/:

  • <crate name>.json: ABI of contract (logic exists already with cargo near abi)
  • <crate name>.wasm: Built wasm file
  • <crate name>.<extension>: Bundle of ABI and wasm in JSON file. Wasm should probably be included in base64 (nearcore RPC accepts this, so no transformation will be required). The motivation for this is some tooling might want both to avoid having to use two separate files.

What the bundle looks like may be opinionated, maybe it's the same schema as ABI except with an extra key for code, or it's a map of {"abi": ..., "code":}. The latter might be a bit redundant/confusing because ABI already has a key abi.

If it works out cleanly, this can be split into three separate changes:

@austinabell
Copy link
Contributor Author

@miraclx, you were looking into this and related tasks, do you want to assign yourself to this?

@miraclx
Copy link
Contributor

miraclx commented Aug 8, 2022

Sure thing.

@miraclx miraclx self-assigned this Aug 8, 2022
@miraclx miraclx linked a pull request Aug 22, 2022 that will close this issue
@miraclx miraclx removed a link to a pull request Aug 25, 2022
@austinabell
Copy link
Contributor Author

re-opening because there are still components relevant in this issue. exalate screwed up the formatting so it's unviewable now. I'll try to fix it later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants