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

feat: dfx cycles top-up #3419

Merged
merged 17 commits into from
Oct 18, 2023
Merged

feat: dfx cycles top-up #3419

merged 17 commits into from
Oct 18, 2023

Conversation

ericswanson-dfinity
Copy link
Member

@ericswanson-dfinity ericswanson-dfinity commented Oct 13, 2023

Description

Added dfx cycles top-up <to canister name or principal> <amount> for transferring cycles from your account to a canister.

Also changed the --to-owner parameter of dfx cycles transfer to be positional, and updated the tests and docs for it, since dfx cycles transfer and dfx cycles top-up will now be separate commands.

Fixes https://dfinity.atlassian.net/browse/SDK-1163

How Has This Been Tested?

Updated and added e2e tests.

Checklist:

  • The title of this PR complies with Conventional Commits.
  • I have edited the CHANGELOG accordingly.
  • I have made corresponding changes to the documentation.

@ericswanson-dfinity ericswanson-dfinity changed the title feat: SDK-1163 dfx cycles transfer (top up) feat: dfx cycles transfer (top up canister mode) Oct 13, 2023
docs/cli-reference/dfx-cycles.md Outdated Show resolved Hide resolved
src/dfx/src/lib/operations/cycles_ledger.rs Outdated Show resolved Hide resolved
Describe more about difference between sending to an account and sending to a canister.
mergify bot pushed a commit that referenced this pull request Oct 17, 2023
…t stdout (#3420)

If the replica reports a duplicate transaction in `dfx ledger transfer`, dfx prints out a message about this.  This change logs that message at info level, rather than printing it to stdout.  This makes the stdout output of `dfx ledger transfer` consistent.

Why info level, rather than warn level?  Anyone calling `dfx ledger transfer`, even without specifying `--created-at-time`, can see this duplicate transaction message.  This is because dfx retries failures, and uses a consistent created_at_time (either from `--created-at-time`, or by getting the current system time before the first attempt).  It's possible that a call succeeds, but there is an i/o error before dfx receives the response.  In this case dfx will retry, and get a duplicate transaction result.

Motivation: #3419 (comment)
@ericswanson-dfinity ericswanson-dfinity changed the title feat: dfx cycles transfer (top up canister mode) feat: dfx cycles top-up Oct 17, 2023
| `--created-at-time <timestamp>` | Specify the timestamp-nanoseconds for the `created_at_time` field on the transfer request. Useful for controlling transaction-de-duplication. https://internetcomputer.org/docs/current/developer-docs/integrations/icrc-1/#transaction-deduplication- |

### Examples

Transfer 1 billion cycles to another account:

``` bash
dfx cycles transfer 1000000000 --to-owner raxcz-bidhr-evrzj-qyivt-nht5a-eltcc-24qfc-o6cvi-hfw7j-dcecz-kae --network ic
dfx cycles transfer raxcz-bidhr-evrzj-qyivt-nht5a-eltcc-24qfc-o6cvi-hfw7j-dcecz-kae 1000000000 --network ic
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there going to be support to specify the amount in a more human-readable format like 100B or 10T?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great idea for a future improvement. I'll create a ticket.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mergify mergify bot merged commit a302661 into master Oct 18, 2023
170 checks passed
@mergify mergify bot deleted the ens/sdk-1163-cycles-transfer-top-up branch October 18, 2023 17:39
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

Successfully merging this pull request may close these issues.

3 participants