mirror of
https://github.com/FuelLabs/sway.git
synced 2025-08-09 13:18:44 +00:00
![]() ## Description Implementation of direct transfer of assets to an address using `forc-call` binary. Refactor of the `forc-call` binary since it now supports 3 code paths: - calling (query or tx submission) contracts - transferring assets directly to an address (recipient and/or contract) - listing contract functions with call examples ## Usage ```sh # transfer default asset (eth) to `0x2c7Fd852EF2BaE281e90ccaDf18510701989469f7fc4b042F779b58a39919Eec` forc-call 0x2c7Fd852EF2BaE281e90ccaDf18510701989469f7fc4b042F779b58a39919Eec --amount 2 --mode=live ``` ### Output ```log warning: No signing key or wallet flag provided. Using default signer: 0x6b63804cfbf9856e68e5b6e7aef238dc8311ec55bec04df774003a2c96e0418e Transferring 2 0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07 to recipient address 0x2c7fd852ef2bae281e90ccadf18510701989469f7fc4b042f779b58a39919eec... tx hash: e4e931276a500cce1b5303cb594c0477968124ab0f70e77995bbb4499e0c3350 ``` ## Additional notes - Inspired by `cast send` where if the CLI is called without a function signature, it transfers value (eth) to the target address based on the `--value` parameter; `forc-call` does the same via the `--amount` param - One can specify the `asset` to be sent; defaults to native network asset (`eth`) - Transfers only work with `--mode=live`; since there is no simulation/dry-run functionality available for this - Transfers to both contracts and user recipients is supported ## Checklist - [ ] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [x] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [x] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers. --------- Co-authored-by: z <zees-dev@users.noreply.github.com> Co-authored-by: kaya <kaya.gokalp@fuel.sh> Co-authored-by: Joshua Batty <joshpbatty@gmail.com> |
||
---|---|---|
.. | ||
book | ||
reference | ||
slides | ||
breaking-release-checklist.md | ||
internals.md |