Skip to content

Add near contract call-function in near-cli-rs grammar, use FastNear RPC - #176

Closed
n13 wants to merge 1 commit into
mainfrom
n13/near-contract-call
Closed

n13 wants to merge 1 commit into
mainfrom
n13/near-contract-call

Conversation

@n13

@n13 n13 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

What

  • quantus near contract call-function as-read-only <CONTRACT> <METHOD> json-args <ARGS> network-config <NET> now
  • quantus near contract call-function as-transaction <CONTRACT> <METHOD> json-args <ARGS> prepaid-gas '30 Tgas' attached-deposit '1 yoctoNEAR' sign-as <ACCOUNT> network-config <NET> sign-with-wallet <WALLET> send|display

The grammar is near-cli-rs's own, copied word for word, so a script written for one runs on the other with sign-with-keychain swapped for sign-with-wallet <WALLET>. display prints the decoded transaction and the equivalent near-cli-rs line without loading the wallet or touching the network. Amounts use near-cli's unit strings; sign-with-wallet takes --password-file for scripting.

Any contract method (storage_deposit, ft_transfer_call, Rhea DCL calls, …) is now reachable from an ML-DSA-65 wallet without a dedicated command.

  • submit_dao_call generalised to submit_function_call, shared with the DAO commands.
  • RPC defaults switched to FastNear (rpc.mainnet.fastnear.com, test.rpc.fastnear.com); rpc.*.near.org is deprecated and rate-limits. network-config / --network also accept an RPC URL.
  • README section for the NEAR commands.

Testing

  • cargo test --lib near: 29 passed (6 new: sentence parsing, step order enforcement, units incl. zero deposit, near-cli line rendering, JSON validation). Clippy clean.
  • Live as-read-only: get_metadata on dclv2.ref-labs.near (mainnet, v2.3.15) and dclv2.ref-dev.testnet (testnet, v2.3.14), ft_metadata via an explicit RPC URL.
  • display of a create_pool transaction: decoded args, gas and deposit match the input; printed near-cli-rs line parses in near-cli-rs.
  • Error paths ('30' without unit, unknown network, missing wallet) fail before any network I/O.
  • Not yet exercised: as-transaction … send on a live network. It reuses the signing and send_tx path the DAO commands already use in production; a testnet run from an ML-DSA-65-controlled account is still to do before relying on it.

quantus near contract call-function as-read-only|as-transaction copies the
near-cli-rs sentence word for word (json-args, prepaid-gas, attached-deposit,
sign-as, network-config) with sign-with-wallet <WALLET> in place of
sign-with-keychain and display as the offline dry run. Any contract method is
reachable from an ML-DSA-65 wallet without a dedicated command.

The DAO call submitter becomes submit_function_call and is shared. Network
defaults move to FastNear (rpc.*.near.org is deprecated and rate-limits) and
network-config also accepts an RPC URL.
@n13

n13 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Superseded: #174/#175 cover arbitrary contract calls via near-cli-rs sign-later + quantus near sign-cold. The FastNear RPC default from this PR moves to its own PR.

@n13 n13 closed this Oct 3, 2026
@n13
n13 deleted the n13/near-contract-call branch October 3, 2026 01:55
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.

1 participant