Skip to content

Commit

Permalink
Add support for token extensions (coral-xyz#2789)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhargavamacha authored Apr 11, 2024
1 parent ae26fd8 commit e3ced78
Show file tree
Hide file tree
Showing 42 changed files with 2,463 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/reusable-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ jobs:
path: spl/token-wrapper
- cmd: cd tests/spl/transfer-hook && anchor test --skip-lint
path: spl/transfer-hook
- cmd: cd tests/spl/token-extensions && anchor test --skip-lint
path: spl/token-extensions
- cmd: cd tests/multisig && anchor test --skip-lint
path: tests/multisig
# - cmd: cd tests/lockup && anchor test --skip-lint
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ The minor version will be incremented upon a breaking change and the patch versi
- idl: Add `docs` field for constants ([#2887](https://github.com/coral-xyz/anchor/pull/2887)).
- idl: Store deployment addresses for other clusters ([#2892](https://github.com/coral-xyz/anchor/pull/2892)).
- lang: Add `Event` utility type to get events from bytes ([#2897](https://github.com/coral-xyz/anchor/pull/2897)).
- spl: Add support for [token extensions](https://solana.com/solutions/token-extensions) ([#2789](https://github.com/coral-xyz/anchor/pull/2789)).

### Fixes

Expand Down
19 changes: 11 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions lang/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,5 @@ borsh = ">=0.9, <0.11"
bytemuck = "1"
solana-program = "1.16"
thiserror = "1"

# TODO: Remove. This crate has been added to fix a build error with the 1.16.0 release.
getrandom = { version = "0.2", features = ["custom"] }
getrandom = { version = "0.2", features = ["custom"] }
50 changes: 50 additions & 0 deletions lang/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,56 @@ pub enum ErrorCode {
/// 2023 - A mint token program constraint was violated
#[msg("An associated token account token program constraint was violated")]
ConstraintAssociatedTokenTokenProgram,
/// Extension constraints
///
/// 2024 - A group pointer extension constraint was violated
#[msg("A group pointer extension constraint was violated")]
ConstraintMintGroupPointerExtension,
/// 2025 - A group pointer extension authority constraint was violated
#[msg("A group pointer extension authority constraint was violated")]
ConstraintMintGroupPointerExtensionAuthority,
/// 2026 - A group pointer extension group address constraint was violated
#[msg("A group pointer extension group address constraint was violated")]
ConstraintMintGroupPointerExtensionGroupAddress,
/// 2027 - A group member pointer extension constraint was violated
#[msg("A group member pointer extension constraint was violated")]
ConstraintMintGroupMemberPointerExtension,
/// 2028 - A group member pointer extension authority constraint was violated
#[msg("A group member pointer extension authority constraint was violated")]
ConstraintMintGroupMemberPointerExtensionAuthority,
/// 2029 - A group member pointer extension member address constraint was violated
#[msg("A group member pointer extension group address constraint was violated")]
ConstraintMintGroupMemberPointerExtensionMemberAddress,
/// 2030 - A metadata pointer extension constraint was violated
#[msg("A metadata pointer extension constraint was violated")]
ConstraintMintMetadataPointerExtension,
/// 2031 - A metadata pointer extension authority constraint was violated
#[msg("A metadata pointer extension authority constraint was violated")]
ConstraintMintMetadataPointerExtensionAuthority,
/// 2032 - A metadata pointer extension metadata address constraint was violated
#[msg("A metadata pointer extension metadata address constraint was violated")]
ConstraintMintMetadataPointerExtensionMetadataAddress,
/// 2033 - A close authority extension constraint was violated
#[msg("A close authority constraint was violated")]
ConstraintMintCloseAuthorityExtension,
/// 2034 - A close authority extension authority constraint was violated
#[msg("A close authority extension authority constraint was violated")]
ConstraintMintCloseAuthorityExtensionAuthority,
/// 2035 - A permanent delegate extension constraint was violated
#[msg("A permanent delegate extension constraint was violated")]
ConstraintMintPermanentDelegateExtension,
/// 2036 - A permanent delegate extension authority constraint was violated
#[msg("A permanent delegate extension delegate constraint was violated")]
ConstraintMintPermanentDelegateExtensionDelegate,
/// 2037 - A transfer hook extension constraint was violated
#[msg("A transfer hook extension constraint was violated")]
ConstraintMintTransferHookExtension,
/// 2038 - A transfer hook extension authority constraint was violated
#[msg("A transfer hook extension authority constraint was violated")]
ConstraintMintTransferHookExtensionAuthority,
/// 2039 - A transfer hook extension transfer hook program id constraint was violated
#[msg("A transfer hook extension transfer hook program id constraint was violated")]
ConstraintMintTransferHookExtensionProgramId,

// Require
/// 2500 - A require expression was violated
Expand Down
Loading

0 comments on commit e3ced78

Please sign in to comment.