Commit Graph

1094 Commits

Author SHA1 Message Date
Jordan Sexton 552ada1035 remove old ts dir 2022-03-30 11:12:13 -06:00
Jon Cinque fe4eb13fec
token-js: Fix build due to duplicated web3.js (#3048) 2022-03-29 21:24:21 +02:00
Danny Povolotski 29d424e597
fully switch to @solana/buffer-layout (#2634)
* remove unused buffer-layout

* change to solana implementation of buffer-layout

* use latest buffer-layout and utils

* update buffer-layout-utils

* update buffer-layout-utils

* info.data is already Uint8Array

* update deps, fix lint

* remove node engine requirements

Co-authored-by: Danny Povolotski <danny@192.168.1.34>
Co-authored-by: Jordan Sexton <jordan@jordansexton.com>
2022-03-26 22:00:59 -06:00
Jon Cinque b7a3fc6243
token-2022: Fix (rarely) flakey test by changing tx (#3015) 2022-03-19 02:39:31 +01:00
Jon Cinque 2292dc2c8c
token-2022: Refactor instruction encoding / decoding (#3011) 2022-03-17 18:27:06 +01:00
Brennan Gebotys a2bbabc1dc
add getMultipleAccounts for Token (#2990)
* add getMultipleAccounts for Token

* update naming convention of fcn

* rename & reorg code

* lint fix

Co-authored-by: obiwan <you@example.com>
2022-03-11 22:11:50 +01:00
samkim-crypto 4ddaae5f21
Bump zk token sdk (#3002)
* token-2022: bumping zk-token-sdk to 1.10.1-pre1 and updating variable names accordingly

* token-2022: updating client and test variables to match newest zk-token-sdk
2022-03-11 06:57:32 -05:00
Jon Cinque 56a1e97c95
token-js: Update @solana/web3.js dependency (#3001) 2022-03-10 22:32:31 +01:00
Jon Cinque 29479fcc72
token-2022: Make program and crate deployable (#2985)
* token-2022: Make program and crate deployable

* Featurize the syscall usage

* Re-add GenericTokenAccount

* Rebase correctly with GenericTokenAccount

* Add updated valid_account_data implementation
2022-03-10 17:42:16 +01:00
Tyera Eulberg 810c79ec32
token-2022: Allow anyone to burn/close an Account owned by the system program or the incinerator (#2890)
* Allow anyone to burn and close token Accounts owned by the system program and the incinerator

* Require rent from incinerator/system-owned token accounts be burnt when accounts closed

* Add support to OG program
2022-03-09 19:31:39 -07:00
Lijun Wang 76a92cda2d
Added checks if a token account is initialized when checking validity (#2986)
* Added checks if an account is initialized when checking validity
2022-03-09 16:53:48 -08:00
Tyera Eulberg 221935bdba
Ignore failing test (#2999) 2022-03-09 16:48:36 -07:00
Tyera Eulberg 26d3a33939
Update twoxtx patch (#2997) 2022-03-09 12:15:42 -07:00
samkim-crypto 7ab4de6174
token-2022: minor rename pod types with descriptive types (#2983) 2022-03-04 12:26:28 -05:00
Tyera Eulberg e17706c7be
Spell out destination (#2977) 2022-03-03 12:34:17 -07:00
Lijun Wang bbbf250a67
Support unpacking token accounts fields partially (#2970)
* Support unpacking token accounts fields partially

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
2022-03-02 11:34:55 -08:00
Michael Vines ab23d6b41e Augment ct tests with decryptable_available_balance assertions 2022-02-28 17:26:32 -08:00
Michael Vines 22135e547c Add ConfidentialTransferInstruction Deposit/Transfer/Withdraw tests 2022-02-28 09:34:23 -08:00
Michael Vines 3450f173de Fix transfer bug 2022-02-28 09:34:23 -08:00
Michael Vines 38243ddcd4 Add temporary twoxtx feature for ConfidentialTransfer extension unit testing 2022-02-28 09:34:23 -08:00
Michael Vines 6875603085 Initial ConfidentialTransferInstruction::EmptyAccount test 2022-02-28 09:34:23 -08:00
Tyera Eulberg 29089e873e
Fix copypasta (#2962) 2022-02-26 13:28:57 -07:00
samkim-crypto 66cf3e9720
token-2022: update doc style for confidential extension instructions (#2961) 2022-02-26 09:21:48 -05:00
Jon Cinque 2e1286b06a
token-js: Support MintCloseAuthority (#2951) 2022-02-25 00:24:26 -05:00
samkim-crypto af90facd1d
token-2022: add fee withdraw and harvest instructions (#2907)
* token-2022: add fee harvest instruction for confidential extension

* token-2022: cargo fmt

* token-2022: add `WithdrawWithheldTokensMint` processor

* token-2022: add `WithdrawWithheldTokensAccounts` processor

* token-2022: incorporate VerifyWithdrawWithheldTokens instruction

* token-2022: minor variable name changes

* token-2022: additional comments + renaming variables

* token-2022: check if confidential extension was approved for fee harvest

Co-authored-by: Michael Vines <mvines@gmail.com>

* token-2022: fix error type for overflow

* token-2022: remove unnecessary fee extension check for confidential token harvest

* token-2022: add extra detail on front-running for harvesting fees

* token-2022: fix pending balance

* token-2022: bump zk-token-sdk to 0.8.0

* token-2022: fix minor variable name issue

* token-2022: minor spelling

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>

* token-2022: addressing smaller review feedback

* token-2022: change fee_mint to transfer_fee_config in confidential transfer

* Update token/program-2022/Cargo.toml

* token-2022: fix cargo bpf-test fail

* token-2022: fixing a previous comment mistake

Co-authored-by: Michael Vines <mvines@gmail.com>
Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
2022-02-24 21:16:32 -05:00
Tyera Eulberg 0268d76d30
token-2022: complete memo extension functionality (#2876)
* Add NoMemo error and use syscall to require memos

* Flesh out + dedupe memo-transfer tests

* Add memo v1 test cases
2022-02-24 16:48:42 -07:00
Tyera Eulberg d505f2a739
Add comment (#2954) 2022-02-24 16:46:47 -07:00
Jon Cinque c3fda0d956
token-js: Add support for extension data (#2950) 2022-02-24 15:55:29 -05:00
Jon Cinque 5229a21c6a
token-js: Update instruction enum for UiAmountToAmount / AmountToUiAmount (#2949)
* token-js: Unflake create native test

* Add UiAmountToAmount and AmountToUiAmount to enum
2022-02-24 15:17:32 -05:00
Tyera Eulberg f4c5fdcfcf
Bump solana to v1.9.9 (#2902) 2022-02-23 16:20:55 -07:00
Michael Vines 131612417a Do not permit token accounts to be closed when the withheld amount is non-zero 2022-02-23 11:48:03 -08:00
Michael Vines 10559aed7a Reduce mut usage 2022-02-23 11:48:03 -08:00
Michael Vines 1bcd07dca1 Field name cleanup 2022-02-23 09:54:46 -08:00
Michael Vines 656f0eb1d9 Reduce test code duplication 2022-02-23 09:54:46 -08:00
Michael Vines e111e997b7 Add {En,Dis}ableBalanceCredits test 2022-02-23 08:37:19 -08:00
Michael Vines 7bdb77b330 Enable balance credits by default 2022-02-23 08:37:19 -08:00
Michael Vines 3f393e8a85 Remove unnecessary approval checks 2022-02-23 08:37:19 -08:00
Michael Vines 7c3b614af0 Add confidential transfer configure and approve account tests 2022-02-23 07:37:14 -08:00
Tyera Eulberg 6944577691
Custom build.rs for program-2022-test (#2940)
* Add custom build script from program-2022-test to build .so

* Log output
2022-02-22 22:29:28 -07:00
Michael Vines c4c14b5c51 Add confidential transfer initialize/update mint tests 2022-02-22 21:25:18 -07:00
Michael Vines 45ce0818f0 Add zktoken paper 2022-02-22 12:22:48 -07:00
Tyera Eulberg 3d92f8f4dc
Add token Amount/UiAmount conversion Instructions (#2928)
* Add Amount/UiAmount conversion Instructions to spl-token

* Use invalid-mint error in spl_token get_account_data_size

* Add Amount/UiAmount conversion Instructions to spl-token-2022
2022-02-17 16:25:57 -07:00
Jon Cinque bb6a91c56f
token-js: Support token-2022 in base tests (#2927) 2022-02-17 23:26:54 +01:00
Jon Cinque 558322798f
token-2022: Support extensions in `SyncNative` (#2926) 2022-02-17 22:50:10 +01:00
Zicklag 48fbb5b7c4 Fix Broken Link to Token Program TypeScript Docs 2022-02-16 12:59:12 -06:00
Tyera Eulberg 172e24e1f2
Initialize close_authority explicitly (#2919) 2022-02-15 17:27:28 -07:00
Jordan Sexton b5f3dfe0e4 token: fix gh-pages deploy path 2022-02-15 16:57:16 -06:00
Jordan Sexton d525d1ea2e token: fix gh-pages 2022-02-15 16:38:39 -06:00
Jordan Sexton f487f520bf run example 2022-02-15 16:33:36 -06:00
Jordan Sexton 00371383e8 update gh-pages config and link 2022-02-15 16:33:36 -06:00
Jordan Sexton f2134f36e8 remove usage 2022-02-15 16:33:36 -06:00
Jordan Sexton 16aa92df0a fix faq link 2022-02-15 16:33:36 -06:00
Jordan Sexton 292153ad40 increase mocha timeout 2022-02-15 16:33:36 -06:00
Jon Cinque 9698c2b481 Remove `js-old` 2022-02-15 16:33:36 -06:00
Jon Cinque f9a93e5636 Port e2e tests to mocha 2022-02-15 16:33:36 -06:00
Jordan Sexton 70f2333e98 update version 2022-02-15 16:33:36 -06:00
Jordan Sexton 118bd047aa move ts to js 2022-02-15 16:33:36 -06:00
Jordan Sexton ca17166471 move js to js-old 2022-02-15 16:33:36 -06:00
Jordan Sexton da7a97c76e fix argument order 2022-02-15 16:33:36 -06:00
Jordan Sexton b37390433c update path 2022-02-15 16:33:36 -06:00
Jon Cinque 20864c0be7
token: Support both token programs in associated-token-account (#2904)
* token: Support both token programs in associated-token-account

* Rename spl-token -> spl-token-2022, spl-token-legacy -> spl-token

* Use spl-token by default

* Check mint in get_account_data_len

* Add checks for either token program

* Rebase fix

* Update version comments in tests
2022-02-15 14:20:14 +01:00
Michael Vines 93c8086e13 Rename token/rust to token/client 2022-02-11 21:47:43 -08:00
Tyera Eulberg ab4b9fb779
Add rust token client support for memo (#2901)
* Remove unnecessary fee-payer repeat signing

* Add with_memo api
2022-02-11 14:27:18 -07:00
samkim-crypto 7330b17482
token-2022: add fee for confidential extension (#2897)
* token-2022: add fee for confidential extension

* token-2022: change receiver to dest for consistency

* token-2022: addressing readability review comments for confidential extension
2022-02-11 08:37:30 -05:00
Michael Vines 1b369e1cf7 Bump spl-token-2022 version to 0.2.0 2022-02-10 16:03:45 -08:00
Michael Vines 2e968115ab Add CreateNativeMint instruction 2022-02-09 20:03:21 -08:00
Tyera Eulberg 428d93bdcb
Move program-2022 tests to new crate (#2892) 2022-02-09 15:02:33 -07:00
Michael Vines f36e973697 Update program id 2022-02-08 11:59:50 -08:00
Tyera Eulberg c3ad86dc2c
token-2022: fixup set_account_type to confirm AccountType (#2885)
* Add failing test

* Prevent cross-type set_account_types
2022-02-08 10:06:23 -07:00
Jon Cinque edec44180c
token-2022: Force refresh blockhash on no-op transaction (#2884) 2022-02-07 23:01:33 +01:00
Harsh Ghodkar 37a6db89db shifted dotenv to dev dependancies 2022-02-07 08:57:37 -08:00
Harsh Ghodkar c03de12813 update 2022-02-07 08:08:10 -08:00
Tyera Eulberg 482a9281f6
token-2022: Add MemoTransfer extension (#2822)
* Style nits

* Initial MemoTransfer extension

* Stub in check for memo

* Add memo-transfer token-client method

* Add MemoTransfer tests

* Add immutable get_extension, and clean up mod

* Update token/program-2022/src/extension/memo_transfer/instruction.rs

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

* Update token/rust/src/token.rs

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

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
2022-02-04 17:12:01 -07:00
Tyera Eulberg c7ec4427b6
token-2022: Add Reallocate instruction (#2864)
* Pass by ref

* Dedupe ExtensionTypes in length apis

* Depend on deduplication in ExtensionType::get_account_len

* Add Reallocate instruction

* Remove unneeded api

* Add set_account_type helper and remove unneeded StateWithExtensionsMut api
2022-02-04 15:23:16 -07:00
Jon Cinque 129b35609a
token-2022: Support approve / revoke with extensions (#2870) 2022-02-04 23:07:48 +01:00
Jon Cinque d3539c19f9
token-2022: Fail to close account with withheld fees (#2871)
* token-2022: Fail to close account with withheld fees

* Add comment to use `get_extension`
2022-02-04 23:07:22 +01:00
Jon Cinque 93c7ad7618
token-2022: Support extensions in burn (#2869) 2022-02-04 22:25:36 +01:00
Jon Cinque 9b52455213
token-2022: Add delegate self-revoke (#2872)
* token-2022: Add delegate self-revoke

* Address feedback
2022-02-04 22:23:41 +01:00
Jon Cinque 0a0a6d9380
token-2022: Try to fix flaky test (#2874) 2022-02-04 20:11:01 +01:00
Jon Cinque 2d357e85f5
token-2022: Add transfer tests with extension too (#2868) 2022-02-04 19:16:39 +01:00
Michael Vines 43b9a37836 Remove TODO 2022-02-04 09:58:06 -08:00
Michael Vines 0df75ab5e8 Freezing -> Thawing 2022-02-04 09:55:36 -08:00
Jon Cinque eb048559eb
token-2022: Add withdraw withheld tokens from accounts (#2857)
* token-2022: Add withdraw withheld tokens from accounts

* Add instruction field for number of signers

* Update instruction field

* Rename field and update comment

* Fix test?
2022-02-03 00:08:13 +01:00
Tyera Eulberg 27b0df1159
token-2022: add StateWithExtensionsMut::unpack_after_realloc (#2859)
* Add unpack_after_realloc

* Dedupe with internal fn
2022-02-02 15:20:54 -07:00
Tyera Eulberg 3863914b10
token-2022: fix handling for extensions with no data (#2858)
* Add failing test

* Fix
2022-02-01 20:53:37 -07:00
Tyera Eulberg 448e75f8ec
token-2022: fixup realloc_needed (#2856)
* Add failing test cases and fix buggy method

* Add extension initializations to ensure buffers are long enough

* Add extra checks

* Move multisig check lower

* Add missing test case and fix
2022-02-01 19:31:10 -07:00
Michael Vines 115c3c4703 Add ImmutableOwner extension to block ATA owner authority changes 2022-02-01 12:53:45 -08:00
Jon Cinque ab05e4e597
token-2022: Fix flaky test (#2851) 2022-02-01 11:57:02 +01:00
Michael Vines 809c1a1a77 GetAccountDataSize instruction now accepts user-provided extension types 2022-01-31 23:03:22 -08:00
Michael Vines 4ddd6c81cc Permit new token accounts to be overallocated 2022-01-31 22:48:16 -08:00
Jon Cinque ccebd8d4c8
token-2022: Add transfer fee withdrawal from mint (#2849) 2022-02-01 01:00:20 +01:00
Jon Cinque 28f1ba9be5
token-2022: Add freeze / thaw through StateWithExtensions (#2848) 2022-02-01 00:24:59 +01:00
Jon Cinque 1f77ba09ed
token-2022: DRY out the transfer fee tests (#2845) 2022-01-31 22:08:44 +01:00
Jon Cinque 95f6c4f501
token-2022: Add harvest from accounts to mint (#2820)
* token-2022: Add harvest from accounts to mint

* Address feedback
2022-01-29 12:21:57 +01:00
Tyera Eulberg f9e6f66758
Add extension realloc helper (#2821) 2022-01-28 15:41:22 -07:00
Tyera Eulberg 8a2d3cc227
token-2022: fix panics due to small buffers (#2824)
* Add panicking test

* Fix panic

* Add another panicking case

* Fix panic

* Add another panicking case

* Fix panics

* Add another panicking case

* Fix

* Add another case

* Move existing fix outside if clause

* Add some helpful comments
2022-01-28 09:47:47 -07:00
Tyera Eulberg 76b59b6dc1
Fixup use stmts (#2816) 2022-01-26 15:02:07 -07:00
Tyera Eulberg c4de9e35f2
token-2022: remove split_at usages (#2813)
* Add helper and remove split_at usage

* Rework helpers for TransferFee extension ix unpacking

* Refactor pubkey unpacking, remove magic numbers
2022-01-26 14:11:15 -07:00
Tyera Eulberg 2daa6e645f
token-2022: add DefaultAccountState mint extension (#2810)
* Add DefaultAccountState extension

* Check DefaultAccountState in InitializeAccount

* Add rust client functionality

* Add tests

* Simplify ix variants

* Fixup freeze-auth signing state for multisig

* Add InitializeMint check to prevent freeze_authority.is_none() and default AccountState::Frozen

* Use separate freeze_authority in program_test

* Add docs for default-state instruction data

* Rebase on #2807
2022-01-26 13:30:24 -07:00
Jon Cinque e2d56f403d
token-2022: Assess transfer fees (#2807)
* Refactor transfer to use StateWithExtensionsMut

* Add basic transfer tests

* Add transfer fee calculation and use in transfer

* Add specific transfer fee tests

* Add self-transfer test + rename test
2022-01-26 19:25:10 +01:00