near/near-cli-rs

Wrong console command for adding Function-Call key with any methods to account

pustovalov opened this issue · 1 comments

Hi,

near-cli-rs 0.9.1
> What are you up to? (select one of the options with the up-down arrows on your keyboard and press Enter) account     - Manage accounts
> What do you want to do with an account? add-key                 - Add an access key to an account
> Which account do you want to add an access key to? func-key-check.testnet
> Select a permission that you want to add to the access key: grant-function-call-access  - A permission with function call

> Do You want to input an allowance for receiver ID? No, I don't want to input allowance for receiver ID
> Enter a receiver to use by this access key to pay for function call gas and transaction fees: func-key-check.testnet

> Do You want to input a list of method names that can be used? No, I don't want to input a list of method names that can be used
> Add an access key for this account: autogenerate-new-keypair          - Automatically generate a key pair
> Save an access key for this account: save-to-legacy-keychain         - Save automatically generated key pair to the legacy keychain (compatible with JS CLI)
> What is the name of the network? testnet

Unsigned transaction:

signer_id:    func-key-check.testnet
receiver_id:  func-key-check.testnet
actions:
   -- add access key:
                   public key:   ed25519:FhAXYNoBmfWPMJcKZSge93Bs4tuUnUpBLw7JzT1piEmU
                   nonce:        0
                   permission:   FunctionCall(FunctionCallPermission { allowance: None, receiver_id: "func-key-check.testnet", method_names: [] })

> Select a tool for signing the transaction: sign-with-legacy-keychain        - Sign the transaction with a key saved in legacy keychain (compatible with the old near CLI)

Your transaction was signed successfully.
Public key: ed25519:38QRTEduz1rGPA1kszPUD73dLeaH8u6FB3gCdKijL6TT
Signature: ed25519:mmtQnKbZZ4s2VZXBiNQLSn5QNNmbAAvX5MBPnugRs6dLDgxdD41dFJTimVf2tkSzS95fFhGExhwophU9FxAKiEK
> How would you like to proceed? send             - Send the transaction to the network
▹▸▹▹▹ Sending transaction ...                                                                                                                                                                                 --- Logs ---------------------------
Logs [func-key-check.testnet]:   No logs
--- Result -------------------------
Empty result
------------------------------------

Added access key = ed25519:FhAXYNoBmfWPMJcKZSge93Bs4tuUnUpBLw7JzT1piEmU to func-key-check.testnet.
Transaction ID: BZiQ1FbA3NhcEaK8sUh6F4nDYC2Ff5e1fMnAapsM58Y2
To see the transaction in the transaction explorer, please open this url in your browser:
https://explorer.testnet.near.org/transactions/BZiQ1FbA3NhcEaK8sUh6F4nDYC2Ff5e1fMnAapsM58Y2

Interactive method added the key I was expecting

https://explorer.testnet.near.org/transactions/BZiQ1FbA3NhcEaK8sUh6F4nDYC2Ff5e1fMnAapsM58Y2

Access key added for contract func-key-check.testnet: ed25519:FhAXYNo...
with permission to call any methods

image

Here is your console command if you need to script it or re-run:
    near account add-key func-key-check.testnet grant-function-call-access --receiver-account-id func-key-check.testnet --method-names '' autogenerate-new-keypair save-to-legacy-keychain network-config testnet sign-with-legacy-keychain send

But if I call that command:

$ near account add-key func-key-check.testnet grant-function-call-access --receiver-account-id func-key-check.testnet --method-names '' autogenerate-new-keypair save-to-legacy-keychain network-config testnet sign-with-legacy-keychain send

> Do You want to input an allowance for receiver ID? No, I don't want to input allowance for receiver ID

Unsigned transaction:

signer_id:    func-key-check.testnet
receiver_id:  func-key-check.testnet
actions:
   -- add access key:
                   public key:   ed25519:2Y8LgYSdwknETLowZgLkheY2hFaQkc78gggpQ5K3TF6r
                   nonce:        0
                   permission:   FunctionCall(FunctionCallPermission { allowance: None, receiver_id: "func-key-check.testnet", method_names: [""] })


Your transaction was signed successfully.
Public key: ed25519:38QRTEduz1rGPA1kszPUD73dLeaH8u6FB3gCdKijL6TT
Signature: ed25519:5vTNWHNe4irk5awm1LwkviCTPNXeS7vWrYuG7KnNRZ3GstCy6GbasmiAUv8v8Bxh6DPWd77Z2GGeJajjiHQahSL1
▹▹▸▹▹ Sending transaction ...                                                                                                                                                                                 --- Logs ---------------------------
Logs [func-key-check.testnet]:   No logs
--- Result -------------------------
Empty result
------------------------------------

Added access key = ed25519:2Y8LgYSdwknETLowZgLkheY2hFaQkc78gggpQ5K3TF6r to func-key-check.testnet.
Transaction ID: 8ty8mn7xDcibWc9dLqdk72AdtJCDU5Hk5og5pWNxiQDD
To see the transaction in the transaction explorer, please open this url in your browser:

https://explorer.testnet.near.org/transactions/8ty8mn7xDcibWc9dLqdk72AdtJCDU5Hk5og5pWNxiQDD

Access key added for contract func-key-check.testnet: ed25519:2Y8LgYS...
with permission to call () methods

I got a key that can call none of methods
image

Thanks for submitting it!