Dfx 0.10.0 - dfx canister deposit-cycles returns error

When I call
dfx canister --network ic deposit-cycles 100000000000 main
it returns
Error: The deposit cycles call needs to proxied via the wallet canister. Invoke this command without the `--no-wallet` flag.

Misleading error message. I just patched it, but it hasn’t made its way into a release yet. The new message will be: The deposit cycles call needs to proxied via the wallet canister. Please run this command using 'dfx canister --wallet <your wallet id> deposit-cycles <other arguments>'. Does this work?

1 Like

Thanks, its works. Also dfx wallet send ... works too.

1 Like

I was receiving this error when executing any of the following commands

% dfx canister --wallet=local deposit-cycles 8000000000000 6t4yy-zqaaa-aaaaa-aag3a-cai 
Error: Text cannot be converted to a Principal; too small.
% dfx canister --wallet=local deposit-cycles 8000000000000 index
Error: Text cannot be converted to a Principal; too small.

I figured out that I needed to pass the principal of my wallet, and couldn’t use the wallet name that I had set.

% dfx canister --wallet=zj7qq-3iaaa-aaaaa-aagjq-cai deposit-cycles 8000000000000 index

It would be nice if we could use the wallet name alias with these commands (just like we can use the canister name alias)

Added this to our backlog. I agree and I’m not sure why there are even wallet names in the first place if we don’t allow them to be used by name…

1 Like

Wanted to check in on this, as I’m writing some quickstart documentation for a developer tool and would love for the copy paste steps I’m writing to be easier to digest for the end user (developer).

This is the best solution I have right now

dfx canister --wallet=$(dfx identity get-wallet) deposit-cycles <cycle_amount> <canister>

I think the default behavior if a wallet-id or name is not provided would be to use this default wallet for the developer’s identity.

The ideal would be for the command below to use this default wallet

dfx canister deposit-cycles <cycles> <canister>

If the sdk team still wants to make the wallet explicit for the IC, then it might be helpful to allow developers to reference a default alias via --wallet=default that would use the same wallet returned by dfx identity get-wallet.

Now this same command would look like

dfx canister --wallet=default deposit-cycles <cycles> <canister>.

I also know that the cycles wallet is being deprecated, so I’m not sure if that’s what’s holding this up :slightly_smiling_face:

Additionally, I wanted to check in on the dfx ordering of flag arguments ticket mentioned in Depositing Cycles from Terminal - #14 by Severin (allow dfx flags to be placed at various placed in the middle of or at the end of the command)

Using wallet names is still asleep in the backlog. Not deleted/wontfix, just not urgent enough.

Agreed. Made a quick PR for this: chore: deposit-cycles uses default wallet if none is specified by sesi200 · Pull Request #2553 · dfinity/sdk · GitHub

Implemented and will be included in the next release. Changelog entry here.

1 Like

20 chars in :clap: :clap: :clap: :clap: :clap: :clap:

Since you’re not mentioning --network ic: Are you aware of dfx ledger fabricate-cycles? That would be the easiest way to go about adding cycles on local(!) networks.

I was not aware of this!

How many cycles can I fabricate locally? More than 100T?

The only restriction I’m aware of is that the number will be parsed as a Rust u128, but otherwise you should be good to go with anything. If you can find an input that breaks your canister I’d be very interested to hear it :smile:

1 Like