Commit Graph

46 Commits

Author SHA1 Message Date
Henry-E 4bef8c40ef
Switch to using @coral-xyz/anchor packages (#2318) 2022-12-16 13:21:50 +00:00
Sammy Harris 484628070c
Feat: Optional Positional Accounts (#2101)
* optional accounts initial implementation

* cargo fmt

* panic if Account related traits are run on none

* Allow empty accounts to deserialize to None for optional accounts

* implement constraints for optional accounts

* optional accounts to idl gen

* accountstruct helper method

* implemented to_account_metas and infos

* add test program

* Rename optional to is_optional

* added more traits

* added TryKey error

* fix has_one

* update prelude

* is_optional

* add is_optional helper method

* Add TryAccountInfos trait

* improve constraint parser

* initial work on TryToAccountInfo

* Rename to TryToAccountInfo

* finished implementing tryToAccountInfo

* Using program method

* Formatting

* Fix program function call

* Remove function return borrow

* Fix access to program field

* finished implementing tryToAccountInfo

* add exit try_to_account_infos

* descriptive ID path

* try_to_account_info

* fix close constraint

* update test files

* completed typescript optional accounts implementation

* fix try accounts for init

* update tests

* fix to_account_metas

* update tests

* fix linting

* remove types/node

* update yarn.lock maybe?

* update optional test

* update optional test

* update optional rust cli test

* fix linting and tests

* fix tests

* update try_accounts to pass in accs during constraint gen

* Add default impl for TryToAccountInfos

* Removed TryToAccountInfos trait

* Formatting

* remove unneccesary traits and improve constraint gen drastically

* fix exit generation

* clippy

* improve cross check error message

* improve comments

* more comments

* update constraints hopefully good now?

* add new errors to ts client

* add new errors to ts client

* update optional test

* update anchor ts client

* update misc crate

* linting

* temporarily comment out optional rs tests

* update ts

* remove local test files

* linting

* optional client tests

* fix other lints to make the test pass

* remove comments

* remove misc-optional for now

* update optional program

* update optional program and client tests again

* update optional program and client tests again again

* added initialize tests that should pass

* undo unrelated anchor.toml change

* update close on optional program and improve tests

* update optional program again.

* update optional program and optional tests

* fix has one error message

* fix client example tests

* update lockfile

* update lockfile

* regenerate lockfile

* reset lockfile

* reset ts yarn lockfile

* update no caching tests

* update exit codegen to use generate_optional_check

* remove `try_to_account_infos`

* update parser to ignore method calls in constraints

* refactor and improve optional checks in constraints

* add misc-optional program and tests

* enable cpi for optional tests

* Revert "enable cpi for optional tests"

This reverts commit c864cd5d4f.

* simplify misc tests

* update version

* fix rust version and resolve merge conflicts

* prevent Option on composite accounts

* hopefully fixed ts stuff?

* hopefully fixed ts stuff?

* testing

* hopefully done?

* update misc test

* fix optional tests

* fix ts

* fix ts again!

* linting urg

* allow-missing-optionals feature

* fix client tests

* add bnjs types to tests

Co-authored-by: febo <febo@kent.ac.uk>
Co-authored-by: Henry-E <henry.elder@adaptcentre.ie>
2022-12-12 15:32:59 +00:00
Henry-E 09b829d1a3
Identity com bugfix/robust fetch nullable (#2301)
* ts: Fixed `.fetchNullable()` to be robust towards accounts only holding a balance

* update changelog to new PR id

* prettier

Co-authored-by: Martin Riedel <web@riedel-it.de>
Co-authored-by: henrye <henry@notanemail>
2022-12-07 10:54:45 +00:00
Henry-E 19e00e5d8f
Don't allow the payer to be initialized as a program account (#2284)
* don't allow people to initialize the payer as a program account

* update changelog

* accidentally commented out part of another test

Co-authored-by: henrye <henry@notanemail>
2022-11-25 15:12:58 +00:00
Jean Marchand (Exotic Markets) 8ce18c36db
spl: Update instructions and remove rent from constraints (#2265)
* Update spl instructions and remove the rent sys_var from constraints

* Fix initialize mint

* Update changelog and fix examples

* Remove oversights
2022-11-19 12:59:14 +00:00
Jean Marchand b107cbe94f
lang: Fix parsing for bytes literals in the IDL (#2261)
* lang: Fix parsing of some constants

* Fix lint + changelog
2022-11-16 15:59:09 +00:00
Sammy Harris fa1249836e
Feat: Update AccountsClose to be safe to call manually (#2209)
* fix other lints to make the test pass

(cherry picked from commit d6e43c1ed6)

* update close to make it safe to call manually

* fix test script

* re-add safety warnings for deprecated account types

* update close checking logic

* readd logic for deprecated methods

* add additional checks to account_loader in exit
2022-10-21 17:06:54 +01:00
Totoro 8e66d5bb5f
Add support for idl enum tuples, enchance types (#2185) 2022-10-18 10:13:23 -04:00
Henry-E d83efcdc3a
update solana web3 package to 1.64.0 (#2223)
* update solana web3 package to 1.64.0

* fix some missing packages; update changelog

* fix weird prettier thing messing with changelog

* also upgrade the yarn.lock in tests
2022-10-13 11:20:32 +01:00
Totoro 5ae52cae13
fix IDL types parsing (#2176) 2022-09-12 08:04:11 -04:00
ebrightfield ed15922f1a
Add docs field to idl (#1561) 2022-04-21 16:37:41 -04:00
Paul 42663eda25
ci: ci should error if tests have typescript errors (#1801) 2022-04-17 15:54:28 -04:00
Paul 6bd9879dd6
lang: codegen improvements (#1766) 2022-04-11 21:28:21 -04:00
Anan f5dffe6490
lang: allow `token::...` and `mint::...` to be used as checks without init (#1505)
Co-authored-by: Paul Schaaf <paulsimonschaaf@gmail.com>
2022-04-11 17:25:07 -04:00
Paul 537d470954
ts: make `Provider` an interface, add `AnchorProvider` class, and update provider functions (#1707) 2022-04-11 15:48:58 -04:00
Paul 3d0560db2c
Revert "lang: Make Anchor use fallback function instead of panicking if ix data.len() is < `8` (#1721)" (#1748) 2022-04-08 15:31:07 -04:00
Paul adb90c33d7
lang: Make Anchor use fallback function instead of panicking if ix data.len() is < `8` (#1721) 2022-04-02 22:27:39 -04:00
Kirill Fomichev 40ea715beb
lang, cli, spl: Update solana toolchain to v1.9.13 (#1653)
Co-authored-by: Paul Schaaf <paulsimonschaaf@gmail.com>
2022-03-26 20:28:55 -04:00
Matthew Callens 23efadf08f
tests: update assertions to use chai and more strict (#1672) 2022-03-24 11:44:33 -04:00
Paul 9afdb17ac2
ts: add error log parsing to ts client (#1640) 2022-03-20 20:29:12 -04:00
skrrb 58af625736
Handle arrays with const as size in endpoint function args (#1631) 2022-03-20 15:15:04 -04:00
Paul f0b4c385f3
tests: fix seemingly ok but actually broken tests (#1656) 2022-03-20 11:38:55 -04:00
Tom Linton 2529b06c02
lang: Handle const array size casting and add const array size support for events (#1485) 2022-03-11 18:05:19 -05:00
Paul c8d8cacd22
lang: remove default space calc (#1519) 2022-03-07 11:23:47 -05:00
Armani Ferrante 598c7b0790
lang: error if bump target is given on init (#1380) 2022-02-07 13:26:05 -05:00
Armani Ferrante d8d720067d
lang, ts: automatic client side pda derivation (#1331) 2022-01-24 14:44:24 -05:00
Alan O'Donnell e04f144e12
lang: add seeds::program constraint for PDAs (#1197) 2022-01-11 10:51:22 -05:00
Paul 4d4cba5add
lang: add rent exempt check for init_if_needed when init is not needed (#1250) 2022-01-06 15:31:36 -05:00
Paul e026e9e874
lang: fix missing ATA owner check (#1240) 2022-01-05 11:09:57 -05:00
Paul b3720a0b84
lang, ts: fix init_if_needed missing ATA address check (#1221) 2022-01-01 21:47:13 -05:00
Paul b6cbdb257e
tests: add tests for rent_exempt constraint (#1209) 2021-12-30 15:25:10 -05:00
Tom Linton 51aeb08ae1
lang: Handle arrays with const as length (#968) 2021-12-22 23:13:46 -05:00
Tom Linton 713d43668b
examples, tests: Setup prettier (#1152) 2021-12-15 18:11:41 -05:00
Paul 423ddde30a
lang: Always execute constraints for init_if_needed (#1096) 2021-12-08 16:50:08 -05:00
Kevin Heavey 105bb203c0
lang: add missing #[serde(rename = "type")] to IdlConst (#1107) 2021-12-05 17:47:50 -05:00
Tom Linton 6bc59350de
lang: Add constant attribute (#956) 2021-12-03 18:49:38 -05:00
Tom Linton f66eee7c6d
tests: 2d array test (#966) 2021-11-02 11:32:24 -07:00
Armani Ferrante 95bb9b3183
lang: Add init_with_needed keyword (#906) 2021-10-21 16:05:16 -07:00
Alan O'Donnell d774b456bf
lang: Support empty seeds constraint token (#853) 2021-10-09 12:21:15 -07:00
Alan O'Donnell 9d33e13465
lang: Remove mandatory init when using associated_token constraints (#843) 2021-10-07 13:57:47 -07:00
Alan O'Donnell dbb5f48b24
lang: Add mint::freeze_authority attribute for init mint (#835) 2021-10-05 11:36:17 -07:00
Daniel Marin 73f046e0a5
ts: Extend filters for `all` method (#788) 2021-09-25 07:22:12 -07:00
Armani Ferrante 2c827bc839
lang, spl, cli: Add associated_token keyword (#790) 2021-09-23 17:06:38 -07:00
Alan O'Donnell 5bd0309f66
lang: Use Expr for init payer. (#772) 2021-09-21 12:14:15 -07:00
Armani Ferrante 3958533750
Static owner and program ID checks (#686) 2021-09-07 13:06:15 -07:00
Armani Ferrante 5d8b4765f2
Add /tests dir (#676) 2021-09-04 05:33:39 -07:00