Skip to content

Commit

Permalink
feat: restrict allowed token 2022 extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
ananas-block committed Dec 1, 2024
1 parent 864e2f0 commit b4e0eb6
Show file tree
Hide file tree
Showing 10 changed files with 361 additions and 24 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ solana-transaction-status = "=1.18.22"
solana-account-decoder = "=1.18.22"
solana-rpc = "=1.18.22"
spl-token = "=4.0.0"
spl-token-2022 = {version="3.0.0", no-default-features = true, features = ["no-entrypoint"]}

# Anchor
anchor-lang = "=0.29.0"
Expand Down
96 changes: 90 additions & 6 deletions js/compressed-token/src/idl/light_compressed_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,43 @@ export type LightCompressedToken = {
];
args: [];
},
{
name: 'createTokenPool2022';
accounts: [
{
name: 'feePayer';
isMut: true;
isSigner: true;
docs: ['UNCHECKED: only pays fees.'];
},
{
name: 'tokenPoolPda';
isMut: true;
isSigner: false;
},
{
name: 'systemProgram';
isMut: false;
isSigner: false;
},
{
name: 'mint';
isMut: true;
isSigner: false;
},
{
name: 'tokenProgram';
isMut: false;
isSigner: false;
},
{
name: 'cpiAuthorityPda';
isMut: false;
isSigner: false;
},
];
args: [];
},
{
name: 'mintTo';
docs: [
Expand Down Expand Up @@ -77,14 +114,15 @@ export type LightCompressedToken = {
name: 'mint';
isMut: true;
isSigner: false;
docs: [
'mint is written to and we check the program id we invoke to be either',
'spl_token::ID or token_2022::ID.',
];
},
{
name: 'tokenPoolPda';
isMut: true;
isSigner: false;
docs: [
'account to a token account of a different mint will fail',
];
},
{
name: 'tokenProgram';
Expand Down Expand Up @@ -521,6 +559,7 @@ export type LightCompressedToken = {
name: 'authority';
isMut: false;
isSigner: true;
docs: ['check_mint_and_freeze_authority().'];
},
{
name: 'cpiAuthorityPda';
Expand Down Expand Up @@ -567,6 +606,7 @@ export type LightCompressedToken = {
name: 'mint';
isMut: false;
isSigner: false;
docs: ['check_mint_and_freeze_authority().'];
},
];
args: [
Expand All @@ -593,6 +633,7 @@ export type LightCompressedToken = {
name: 'authority';
isMut: false;
isSigner: true;
docs: ['check_mint_and_freeze_authority().'];
},
{
name: 'cpiAuthorityPda';
Expand Down Expand Up @@ -639,6 +680,7 @@ export type LightCompressedToken = {
name: 'mint';
isMut: false;
isSigner: false;
docs: ['check_mint_and_freeze_authority().'];
},
];
args: [
Expand Down Expand Up @@ -1716,6 +1758,43 @@ export const IDL: LightCompressedToken = {
],
args: [],
},
{
name: 'createTokenPool2022',
accounts: [
{
name: 'feePayer',
isMut: true,
isSigner: true,
docs: ['UNCHECKED: only pays fees.'],
},
{
name: 'tokenPoolPda',
isMut: true,
isSigner: false,
},
{
name: 'systemProgram',
isMut: false,
isSigner: false,
},
{
name: 'mint',
isMut: true,
isSigner: false,
},
{
name: 'tokenProgram',
isMut: false,
isSigner: false,
},
{
name: 'cpiAuthorityPda',
isMut: false,
isSigner: false,
},
],
args: [],
},
{
name: 'mintTo',
docs: [
Expand Down Expand Up @@ -1748,14 +1827,15 @@ export const IDL: LightCompressedToken = {
name: 'mint',
isMut: true,
isSigner: false,
docs: [
'mint is written to and we check the program id we invoke to be either',
'spl_token::ID or token_2022::ID.',
],
},
{
name: 'tokenPoolPda',
isMut: true,
isSigner: false,
docs: [
'account to a token account of a different mint will fail',
],
},
{
name: 'tokenProgram',
Expand Down Expand Up @@ -2192,6 +2272,7 @@ export const IDL: LightCompressedToken = {
name: 'authority',
isMut: false,
isSigner: true,
docs: ['check_mint_and_freeze_authority().'],
},
{
name: 'cpiAuthorityPda',
Expand Down Expand Up @@ -2238,6 +2319,7 @@ export const IDL: LightCompressedToken = {
name: 'mint',
isMut: false,
isSigner: false,
docs: ['check_mint_and_freeze_authority().'],
},
],
args: [
Expand All @@ -2264,6 +2346,7 @@ export const IDL: LightCompressedToken = {
name: 'authority',
isMut: false,
isSigner: true,
docs: ['check_mint_and_freeze_authority().'],
},
{
name: 'cpiAuthorityPda',
Expand Down Expand Up @@ -2310,6 +2393,7 @@ export const IDL: LightCompressedToken = {
name: 'mint',
isMut: false,
isSigner: false,
docs: ['check_mint_and_freeze_authority().'],
},
],
args: [
Expand Down
96 changes: 90 additions & 6 deletions js/stateless.js/src/idls/light_compressed_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,43 @@ export type LightCompressedToken = {
];
args: [];
},
{
name: 'createTokenPool2022';
accounts: [
{
name: 'feePayer';
isMut: true;
isSigner: true;
docs: ['UNCHECKED: only pays fees.'];
},
{
name: 'tokenPoolPda';
isMut: true;
isSigner: false;
},
{
name: 'systemProgram';
isMut: false;
isSigner: false;
},
{
name: 'mint';
isMut: true;
isSigner: false;
},
{
name: 'tokenProgram';
isMut: false;
isSigner: false;
},
{
name: 'cpiAuthorityPda';
isMut: false;
isSigner: false;
},
];
args: [];
},
{
name: 'mintTo';
docs: [
Expand Down Expand Up @@ -77,14 +114,15 @@ export type LightCompressedToken = {
name: 'mint';
isMut: true;
isSigner: false;
docs: [
'mint is written to and we check the program id we invoke to be either',
'spl_token::ID or token_2022::ID.',
];
},
{
name: 'tokenPoolPda';
isMut: true;
isSigner: false;
docs: [
'account to a token account of a different mint will fail',
];
},
{
name: 'tokenProgram';
Expand Down Expand Up @@ -521,6 +559,7 @@ export type LightCompressedToken = {
name: 'authority';
isMut: false;
isSigner: true;
docs: ['check_mint_and_freeze_authority().'];
},
{
name: 'cpiAuthorityPda';
Expand Down Expand Up @@ -567,6 +606,7 @@ export type LightCompressedToken = {
name: 'mint';
isMut: false;
isSigner: false;
docs: ['check_mint_and_freeze_authority().'];
},
];
args: [
Expand All @@ -593,6 +633,7 @@ export type LightCompressedToken = {
name: 'authority';
isMut: false;
isSigner: true;
docs: ['check_mint_and_freeze_authority().'];
},
{
name: 'cpiAuthorityPda';
Expand Down Expand Up @@ -639,6 +680,7 @@ export type LightCompressedToken = {
name: 'mint';
isMut: false;
isSigner: false;
docs: ['check_mint_and_freeze_authority().'];
},
];
args: [
Expand Down Expand Up @@ -1716,6 +1758,43 @@ export const IDL: LightCompressedToken = {
],
args: [],
},
{
name: 'createTokenPool2022',
accounts: [
{
name: 'feePayer',
isMut: true,
isSigner: true,
docs: ['UNCHECKED: only pays fees.'],
},
{
name: 'tokenPoolPda',
isMut: true,
isSigner: false,
},
{
name: 'systemProgram',
isMut: false,
isSigner: false,
},
{
name: 'mint',
isMut: true,
isSigner: false,
},
{
name: 'tokenProgram',
isMut: false,
isSigner: false,
},
{
name: 'cpiAuthorityPda',
isMut: false,
isSigner: false,
},
],
args: [],
},
{
name: 'mintTo',
docs: [
Expand Down Expand Up @@ -1748,14 +1827,15 @@ export const IDL: LightCompressedToken = {
name: 'mint',
isMut: true,
isSigner: false,
docs: [
'mint is written to and we check the program id we invoke to be either',
'spl_token::ID or token_2022::ID.',
],
},
{
name: 'tokenPoolPda',
isMut: true,
isSigner: false,
docs: [
'account to a token account of a different mint will fail',
],
},
{
name: 'tokenProgram',
Expand Down Expand Up @@ -2192,6 +2272,7 @@ export const IDL: LightCompressedToken = {
name: 'authority',
isMut: false,
isSigner: true,
docs: ['check_mint_and_freeze_authority().'],
},
{
name: 'cpiAuthorityPda',
Expand Down Expand Up @@ -2238,6 +2319,7 @@ export const IDL: LightCompressedToken = {
name: 'mint',
isMut: false,
isSigner: false,
docs: ['check_mint_and_freeze_authority().'],
},
],
args: [
Expand All @@ -2264,6 +2346,7 @@ export const IDL: LightCompressedToken = {
name: 'authority',
isMut: false,
isSigner: true,
docs: ['check_mint_and_freeze_authority().'],
},
{
name: 'cpiAuthorityPda',
Expand Down Expand Up @@ -2310,6 +2393,7 @@ export const IDL: LightCompressedToken = {
name: 'mint',
isMut: false,
isSigner: false,
docs: ['check_mint_and_freeze_authority().'],
},
],
args: [
Expand Down
Loading

0 comments on commit b4e0eb6

Please sign in to comment.