Commit Graph

183 Commits

Author SHA1 Message Date
hanako mumei 8e6caf45ac token-cli: new config function get_account_checked
this replaces all instances of rpc_client.get_account -> check_owner
also we convert from rpc_client to program_client to further enforce offlineness
2022-09-07 14:36:39 -07:00
hanako mumei d2c33e26a4 token-cli: infer program_id based on cli args 2022-09-07 14:36:39 -07:00
hanako mumei 191977e2c6 token-cli: normalize argument names/descriptions
we now strictly adhere to the pattern:
* positional arg named `token`: a mint, described `TOKEN_MINT_ADDRESS`
* positional arg named `account`: an account, described `TOKEN_ACCOUNT_ADDRESS`
* positional arg named `address`: a mint or account, described `TOKEN_ADDRESS`, or a multisig, described `MULTISIG_ACCOUNT_ADDRESS`
* `--address` flag, named `address`: an account, described `TOKEN_ACCOUNT_ADDRESS`

normalize burn, unwrap, and supply to follow this convention
2022-09-07 14:36:39 -07:00
hanako mumei b9cab85d81 token-cli: final cleanups on client refactor
use mint for Token objects whenever possible, rework multisig_signers to be prettier
2022-08-31 13:57:41 -07:00
hanako mumei 5e494c63e0 token-cli: promote fee_payer to Arc<dyn Signer> 2022-08-31 13:57:41 -07:00
hanako mumei cf25381108 token-cli: use token client for approve 2022-08-31 13:57:41 -07:00
hanako mumei b91972debb token-cli: use token client for freeze/thaw/revoke 2022-08-31 13:57:41 -07:00
hanako mumei 46206fe64c token-cli: support memo on command_mint 2022-08-31 13:57:41 -07:00
hanako mumei 8e196e5e77 token-cli: use token client for command_burn 2022-08-31 13:57:41 -07:00
hanako mumei e540b172db token-cli: use token client for command_mint
* client: change mint_to to accept decimals and prefer mint_checked
* client: move multisig key winnowing into utility function
2022-08-31 13:57:41 -07:00
hanako mumei 8d1e57018a token-cli: finish interest bearing mint
minor cleanups, guards on set-interest-rate, impl set-authority for interest-bearing mints
2022-08-30 21:12:59 -07:00
Udbhav Muthakana fbae99fe2c token-cli: Support the InterestBearingMint extension 2022-08-30 21:12:59 -07:00
Andrii Tretyakov d65ab18fbd
token-cli: Removed usage of Account::LEN as a verificaton for token account (#3527)
replaced with Account::valid_account_data to support token2022
2022-08-29 12:42:33 -07:00
hanako mumei 9382641da2 token-cli: remove #[allow(deprecated)] from toplevel
also remove ArcSigners temp code
2022-08-25 09:53:29 -07:00
hana e03a013184
token-cli: support `MintCloseAuthority` (#3487)
* cli: add --enable-close flag to create-token which sets its close authority to mint authority
* cli: add support to changing a mint close authority to authorize
* cli: add close-mint, a new command for closing a mint
* cli: update authorize and close-account to go through the token client
* client: change set_authority and close_account to support multisigners
2022-08-23 15:54:10 -07:00
hanako mumei e06506b40b token-cli: dont push duplicates to bulk_signers 2022-08-22 16:28:43 -07:00
hanako mumei c426ed9749 Refactor create-token to go through token client
* cli: remove offline args from commands that create accounts
* cli: implement finish_tx, to be a replacement for handle_tx, which branches on the client return
* client: validate a transaction is fully signed before sending over rpc
* client: convert payer from Signer to Arc<dyn Signer> to support cli signers
* client: support nonce mode
* client: change create_mint to be an object method that returns SendTransaction::Output
* client: rename S2 to S everywhere that Token<T, S> is Token<T>
2022-08-18 17:35:55 -07:00
hanako mumei c5caba0d63 token-cli: use program_client for blockhash 2022-08-15 16:06:50 -07:00
Jon Cinque 3d42786e6e token-cli: Add no-op client 2022-08-15 16:06:50 -07:00
Justin Malčić cc2739fce1
token-cli: Clone signers (#3290)
* Switch to Arc

* Add temporary structs

To be removed upon upstream changes

* Get multisig signers earlier

* Build SignerFromPathConfig with multisig pubkeys

* Get default signer and address

* Store default signer and address

* Use stored default address

* Use stored default signer

* Avoid rereading signer for fee payer

* Clean up use statements

* Rename to ArcSigner

* Remove default_keypair

* Remove default_address

* Add comment for temporary newtype

* Refactor config

* Create config from args in tests

* Remove unused params

* Fix clippy warnings

* Fix rustfmt warnings

* Fix clippy warnings

* Move imports
2022-08-08 23:40:08 +02:00
hana abc63ad946
token-cli: don't error when missing default config (#3424) 2022-08-03 14:58:24 -07:00
Jon Cinque 93ec6cf74a
token-cli: Split out CI into separate step, run tests in serial (#3425)
* token-cli: Split out CI into separate step, run tests in serial

* Remove dependency on cargo-test-bpf to speed things up

* Don't download programs since they won't be available
2022-08-03 21:54:35 +02:00
Jon Cinque 8f74ba517c
token-cli: Run fewer tests at once (#3414) 2022-08-03 01:14:55 +02:00
Jon Cinque 674b0ac70e
token-cli: Add token-client dependency for token-2022 support (#3386) 2022-08-01 17:13:42 +02:00
Jon Cinque 80b8ff3b1d
token-cli: Run tests in batches (#3396) 2022-07-30 00:34:49 +02:00
Jon Cinque 48e6acb53f
token-cli: Support base token-2022 (without extensions) (#3071) 2022-07-27 10:47:43 +02:00
Jon Cinque 60117fd9c5
token-cli: Figure out program_id dynamically (#3354)
* Resolve program id with mint info, use it where possible

* Avoid using `config.program_id` when we can figure it out

* Rename function
2022-07-25 23:22:47 +02:00
Jon Cinque 37280ce2e6
token-cli: Move everything to async (#3353) 2022-07-25 21:05:01 +02:00
Jon Cinque 725430d81c
Revert "token-cli: Downgrade to crates.io versions for release (#3371)" (#3372)
This reverts commit 1c9e2a540c.
2022-07-23 20:16:24 +02:00
Jon Cinque 1c9e2a540c
token-cli: Downgrade to crates.io versions for release (#3371) 2022-07-23 19:14:14 +02:00
Justin Malčić 04954d0a1e
Add delegation tests (#3316)
* Add transfer test

* Add burn test

* Fix formatting
2022-07-21 14:51:45 +02:00
Alisamar Husain b39efe8fb8
token-cli: Fix unexpected behavior when closing a wrapped SOL account with another wrapped SOL account as recipient (#3278)
* Check if recipient is a wrapped account

* Make clippy and fmt happy

* Avoided mutable, more functional clarity

* Add test for closing wrapped sol account

* wrap the default account

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>

* Fix formatting and failing tests

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
2022-07-17 16:50:39 +02:00
Jon Cinque 5874a14584
token-cli: Move cmd test into a separate file (#3306) 2022-07-01 19:41:27 -04:00
Athar Mohammad 351cd60a5e
spl-token: Enums for Cli command names (#2598) (#3236)
* Added Enums which can be turned into strings
  for command names.
2022-06-17 16:56:03 -04:00
dboures 3e9104736a
token-cli: produce error if invalid --config option (#3166)
* token-cli: produce error if invalid --config option

* token-cli: add test for invalid --config
2022-06-08 14:48:55 +02:00
Harsh Ghodkar f7d4ebecc6
added a flag to check if the recipient address is correct (#3085)
* added a flag to check if the recipient address is correct

* small fix

* Made the changes of adding the check to a suggested block

* updating from base

* was able to clear merge conflicts

* added a couple tests

* better names for tests

* done with fixes

* cargo fmt
2022-04-21 21:53:30 +02:00
Jon Cinque bbde6d8703
token-cli: Add tests for all cases from docs (#3070)
* token-cli: Add tests for all cases from docs

* Add TestValidator and build.rs for programs

* Fix solana-test-validator version

* Add solana-test-validator to patch script
2022-04-15 21:51:16 +02:00
Jon Cinque 513c1143a2
token-cli-bench: Remove RPC utils in favor of Tpu Client (#3046) 2022-04-01 13:41:33 +02:00
Michael Vines 0df75ab5e8 Freezing -> Thawing 2022-02-04 09:55:36 -08:00
Michael Vines 6d62ea6cc7 Drop _program_id 2022-01-24 17:41:47 -08:00
Michael Vines 8e559ce69c Add --program-id argument 2022-01-24 17:41:47 -08:00
Jon Cinque 78e7a9538e
associated-token-account: Bump dependent token version to 3.3 (#2766)
* associated-token-account: Bump dependent token version to 3.3

* Fix uses of deprecated instruction
2022-01-21 11:01:06 +01:00
Michael Vines 9aa859c929 Display RPC transport stats 2022-01-10 11:54:22 -08:00
Paul 7393f1de43
spl-token: provide more useful output when using create-token with the output option and small redesign of token cli architecture (#2593)
* spl-token: WIP

* Remove and_then, move tx handling in separate function- output handling still missing

* spl-token: add basic output handling for all calls, add detailed output to create-token

* spl-token: remove changes in bench that are not strictly necessary to remove # of files touched in this PR

* [spl-token] cli: HandleTxReturn is now TransactionReturnData

* [spl-token] cli: Make commands return output String that is printed in fn main()

* [spl-token] cli: remove old todos

* [spl-token] cli: only use no_wait arg in command_transfer and use constant for "create-token"
2021-11-24 12:08:46 -07:00
Ikko Ashimine 707382ee96
Fix typo in main.rs (#2569)
auxillary -> auxiliary
2021-11-10 11:18:07 -07:00
MarkSackerberg 81c90f5c73
Allow GC to close empty associated accounts (#2554)
* Allow GC to close empty associated accounts

Empty associated accounts will only be closed in case the new flag del_associated_accounts is set. Otherwise behaviour is as before.

Useage:
spl-token gc --del_associated_accounts

* use kebab-case

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>

* align coding style

Thank you jon!

* Add sanity check

* correcting amount check before closing

* formatting correcly

using cargo fmt

* changing sanity check to assert!

Co-authored-by: Sack <none>
Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
Co-authored-by: Mark Sackerberg <Contact@Discord>
2021-11-04 22:49:23 +01:00
Ryo Onodera 462f1e0708
Really plumb dump_transaction_message (#2448) 2021-09-24 12:05:26 +09:00
Michael Vines 9f0f30a21d Always check transaction statuses before resending 2021-09-19 21:44:09 -07:00
Michael Vines 7d1c0c48fb Use status.satisfies_commitment 2021-09-16 19:35:30 -07:00
Michael Vines 2fa7bb0ef3 Adjust send_and_confirm_messages_with_spinner() to work better with public mainnet RPC 2021-09-08 12:08:27 -05:00
Michael Vines 35e4c1ab49 Slow down retransmission of transactions 2021-09-08 09:48:46 -05:00
Michael Vines 054e4f71c5 Fix issues building against solana 1.8 2021-09-05 17:06:27 -07:00
Michael Vines 902ca60aa3 Groom send_and_confirm_messages_with_spinner 2021-09-05 17:06:27 -07:00
Michael Vines 0737892ba6 Add bench subcommand 2021-09-04 22:31:11 -07:00
Michael Vines ca685784ee Add memo support to transfer and burn commands 2021-08-31 18:08:46 -07:00
Jon Cinque 0db32380a8
token-cli: Add `--use-unchecked-instruction` flag (#2328)
* token-cli: Add `--use-legacy-unchecked-instruction` flag

* use-legacy-unchecked-instruction -> use-unchecked-instruction
2021-08-26 20:38:10 +02:00
Trent Nelson e4145e3341 token-cli: fix resolving multisig authorities 2021-07-23 01:45:35 -06:00
Tyera Eulberg c87bb29f48
token-cli: support json output (#2130)
* Add output_format to config

* Add --output global parameter

* Add json output handling for tx commands

* Impl OutputFormat handling for easy get requests

* Remove redundant struct

* Impl OutputFormat handling for accounts command

* Remove unused config field

* Prevent gc --output json for now
2021-07-23 01:44:06 +00:00
Jon Cinque aef1e239b3
token: Add SyncNative instruction (program, CLI, JS) (#2091)
* Add SyncNative to program

* Add CLI support

* Add JS bindings

* Fix syncNative test to not run for existing token program

* Combine checks
2021-07-19 21:50:42 +02:00
Trent Nelson 7b5afeac8d token-cli: Dedupe 'transfer' help message --owner value name 2021-07-06 20:37:55 +00:00
Jon Cinque 21f8af34e7
Update all solana dependencies to 1.7.3, fix issues (#1958)
* Update all dependencies to 1.7.3, fix issues

* Remove esm from mocha

* Fix missed token test

* Also update rust version

* token-swap: update tolerance on sim test

* Run `cargo clippy --fix` for needless_borrow errors

* Rerun cargo fmt
2021-06-25 00:39:08 +02:00
Justin Starry 3cf9f0d0f9
spl-token-cli: Remove global owner argument (#1870) 2021-06-10 11:52:39 -07:00
drbh 41568014eb implement the ability to leave a memo on token creation 2021-05-11 20:21:08 -07:00
Trent Nelson dfc5cc5a23 token-cli: Fix ATA creation in offline mode 2021-04-23 07:42:45 +00:00
Trent Nelson 96901b1299 token-cli: sign_only gates for `transfer` 2021-04-14 12:13:52 -06:00
Trent Nelson b8a773fddd token-cli: sign_only gates for `authorize` 2021-04-14 12:13:52 -06:00
Trent Nelson 4374d8dee4 token-cli: Fix transfer to multisig ATAs 2021-04-14 12:13:52 -06:00
Trent Nelson 6a52ba7d92 token-cli: sign_only gates for `create-account` 2021-04-14 12:13:52 -06:00
Trent Nelson 84f2f33f49 spl-token-cli: Use CLI config wallet for nonce authority fallback 2021-04-01 01:41:24 -06:00
Trent Nelson 25a6a6e923 spl-token-cli: Sort multisigners 2021-04-01 01:41:13 -06:00
Trent Nelson 8b989d562b spl-token-cli: Simplify owner resolution 2021-03-31 23:52:16 -06:00
Tyera Eulberg f2de73da8e
spl-token-cli: support ATA in close, balance, and account-info (#1537)
* Use ATA by default in close command

* Use ATA by default in balance/account-info queries

* Add Aux tag and gc messaging to spl-token account-info

* Recommend 'token' only if no args provided
2021-03-30 22:31:54 +00:00
Ryo Onodera 0500f5fb02
Add spl-token transfer --no-wait (#1525) 2021-03-30 16:25:21 +09:00
Tyera Eulberg 75e122061e
Accounts: check mint if provided, use helper (#1503) 2021-03-24 00:06:39 +00:00
Tyera Eulberg a3e8af2068
spl-token-cli: use ATA by default in wrap/unwrap commands (#1492)
* Wrap to ATA by default

* Unwrap ATA by default

* Review comments
2021-03-23 15:48:27 -06:00
Tyera Eulberg 80819fa05a
Transfer from ATA by default (#1487)
* Transfer from ATA by default

* Update token/cli/src/main.rs
2021-03-23 04:12:29 +00:00
Tyera Eulberg 603a94327f
Add spl-token address command (#1484) 2021-03-22 23:58:09 +00:00
Tyera Eulberg 04fc247b2e
Reorder App subcommands (#1485) 2021-03-22 22:47:25 +00:00
Michael Vines bb05462d59 Rename --allow-empty-recipient to --allow-unfunded-recipient 2021-03-22 13:45:18 -07:00
Michael Vines 58807c5f8b Back out clippy::manual_map for now 2021-03-16 22:22:59 -07:00
Michael Vines af5fdb3146 Bump Rust version to 1.50.0 2021-03-16 22:22:59 -07:00
Tyera Eulberg d65d2eac41
Token cli: Improve authorize command (#1445)
* Return clear error message if auth type is incompatible with account

* Report real current authority

* Prevent reauth of owner's ATA

* Fix typo, messaging improvements

Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>

Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
2021-03-16 13:59:21 -06:00
Justin Starry 5aa60dd892
token-cli: Don't sign with owner when creating an associated token account (#1449) 2021-03-16 15:59:38 +08:00
Tyera Eulberg 5aa0341478
Token cli: spl-token accounts improvements (#1440)
* Swap token/account to prep for display changes

* Refactor accounts parsing for deterministic order and to batch by mint

* Add Aux tags and gc alert

* Hide account addresses for non-verbose returns

* Review nits

* Set balance display len dynamically

* Bump solana version to reduce Account parse failures

* Fix aux width
2021-03-12 19:34:14 -07:00
Tyera Eulberg 123f0daffe
Allow pubkey owner for accounts subcommand (#1439) 2021-03-11 15:40:47 -07:00
Tyera Eulberg 7a2d17b57f
Enable short arg, monikers (#1433) 2021-03-11 06:44:00 +00:00
Tyera Eulberg f0b70989c0
Use forward-compatible apis (#1353) 2021-03-02 09:56:34 -07:00
Michael Vines a782f3e52f Add --allow-empty-recipient to `transfer` command 2021-02-22 11:50:34 -08:00
Trent Nelson 188c03e9a1 chore: bump solana crates to 1.5.6 2021-02-11 16:30:03 -07:00
Michael Vines 7e3115fb25 Avoid RpcClient::get_account() in some cases 2020-11-19 10:28:18 -08:00
Michael Vines 222ec663df Use RpcClient::new_with_commitment() 2020-11-18 04:37:30 +00:00
Michael Vines 0bafe9891d spl-token transfer now supports ALL keyword 2020-11-18 02:06:46 +00:00
Michael Vines 43d808c5fd Clean up `spl-token accounts <MINT>` output 2020-11-18 02:05:52 +00:00
Tyera Eulberg 6ee1f09311
Use config commitment for balance checks (#842) 2020-11-14 01:24:13 -07:00
Michael Vines 645a9874d3 Output tweaks 2020-11-05 13:42:48 -08:00
Michael Vines 8ea9b28edf Add associated token account support 2020-11-04 09:13:21 -08:00
Tyera Eulberg c312a0576a
Clippy suggestions (#765) 2020-10-31 19:10:33 -06:00
Trent Nelson de23dbc8a0 token-cli: Don't panic on signing errors 2020-10-30 15:57:20 -06:00
Trent Nelson d02975bb0b token-cli: Plumb multisig support for supporting subcommands 2020-10-30 15:57:20 -06:00
Trent Nelson 23e2b0bed3 token-cli: Add `multisig-info` subcommand 2020-10-30 15:57:20 -06:00