Skip to content

Commit

Permalink
feat: multiple token pool accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
ananas-block authored and ananas-block committed Dec 23, 2024
1 parent fe0e214 commit 4a44eaa
Show file tree
Hide file tree
Showing 21 changed files with 1,984 additions and 146 deletions.
1 change: 1 addition & 0 deletions client/tests/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ async fn test_all_endpoints() {
vec![payer_pubkey],
None,
false,
0,
);

let tx = Transaction::new_signed_with_payer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ pub fn create_withdrawal_escrow_instruction(
None,
None,
None,
&[],
);

let merkle_tree_indices = add_and_get_remaining_account_indices(
Expand Down
102 changes: 102 additions & 0 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,57 @@ export type LightCompressedToken = {
];
args: [];
},
{
name: 'addTokenPool';
docs: [
'This instruction creates an additional token pool for a given mint.',
'The maximum number of token pools per mint is 5.',
];
accounts: [
{
name: 'feePayer';
isMut: true;
isSigner: true;
docs: ['UNCHECKED: only pays fees.'];
},
{
name: 'tokenPoolPda';
isMut: true;
isSigner: false;
},
{
name: 'existingTokenPoolPda';
isMut: false;
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: 'tokenPoolBump';
type: 'u8';
},
];
},
{
name: 'mintTo';
docs: [
Expand Down Expand Up @@ -1597,6 +1648,57 @@ export const IDL: LightCompressedToken = {
],
args: [],
},
{
name: 'addTokenPool',
docs: [
'This instruction creates an additional token pool for a given mint.',
'The maximum number of token pools per mint is 5.',
],
accounts: [
{
name: 'feePayer',
isMut: true,
isSigner: true,
docs: ['UNCHECKED: only pays fees.'],
},
{
name: 'tokenPoolPda',
isMut: true,
isSigner: false,
},
{
name: 'existingTokenPoolPda',
isMut: false,
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: 'tokenPoolBump',
type: 'u8',
},
],
},
{
name: 'mintTo',
docs: [
Expand Down
160 changes: 160 additions & 0 deletions js/stateless.js/src/idls/account_compression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,45 @@ export type AccountCompression = {
},
];
},
{
name: 'migrateState';
accounts: [
{
name: 'authority';
isMut: false;
isSigner: true;
},
{
name: 'registeredProgramPda';
isMut: false;
isSigner: false;
isOptional: true;
},
{
name: 'logWrapper';
isMut: false;
isSigner: false;
},
{
name: 'merkleTree';
isMut: true;
isSigner: false;
},
{
name: 'outputQueue';
isMut: true;
isSigner: false;
},
];
args: [
{
name: 'input';
type: {
defined: 'MigrateLeafParams';
};
},
];
},
];
accounts: [
{
Expand Down Expand Up @@ -1151,6 +1190,39 @@ export type AccountCompression = {
];
};
},
{
name: 'MigrateLeafParams';
type: {
kind: 'struct';
fields: [
{
name: 'changeLogIndex';
type: 'u64';
},
{
name: 'leaf';
type: {
array: ['u8', 32];
};
},
{
name: 'leafIndex';
type: 'u64';
},
{
name: 'proof';
type: {
array: [
{
array: ['u8', 32];
},
16,
];
};
},
];
};
},
{
name: 'AddressQueueConfig';
type: {
Expand Down Expand Up @@ -1314,6 +1386,14 @@ export type AccountCompression = {
code: 6031;
name: 'StateMerkleTreeAccountDiscriminatorMismatch';
},
{
code: 6032;
name: 'RegistryProgramIsNone';
},
{
code: 6033;
name: 'EmptyLeaf';
},
];
};

Expand Down Expand Up @@ -2259,6 +2339,45 @@ export const IDL: AccountCompression = {
},
],
},
{
name: 'migrateState',
accounts: [
{
name: 'authority',
isMut: false,
isSigner: true,
},
{
name: 'registeredProgramPda',
isMut: false,
isSigner: false,
isOptional: true,
},
{
name: 'logWrapper',
isMut: false,
isSigner: false,
},
{
name: 'merkleTree',
isMut: true,
isSigner: false,
},
{
name: 'outputQueue',
isMut: true,
isSigner: false,
},
],
args: [
{
name: 'input',
type: {
defined: 'MigrateLeafParams',
},
},
],
},
],
accounts: [
{
Expand Down Expand Up @@ -2470,6 +2589,39 @@ export const IDL: AccountCompression = {
],
},
},
{
name: 'MigrateLeafParams',
type: {
kind: 'struct',
fields: [
{
name: 'changeLogIndex',
type: 'u64',
},
{
name: 'leaf',
type: {
array: ['u8', 32],
},
},
{
name: 'leafIndex',
type: 'u64',
},
{
name: 'proof',
type: {
array: [
{
array: ['u8', 32],
},
16,
],
},
},
],
},
},
{
name: 'AddressQueueConfig',
type: {
Expand Down Expand Up @@ -2633,5 +2785,13 @@ export const IDL: AccountCompression = {
code: 6031,
name: 'StateMerkleTreeAccountDiscriminatorMismatch',
},
{
code: 6032,
name: 'RegistryProgramIsNone',
},
{
code: 6033,
name: 'EmptyLeaf',
},
],
};
Loading

0 comments on commit 4a44eaa

Please sign in to comment.