-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Token Metadata v1.12 -- Initial Fees (#1106)
* add fee fee collection and create fees * add lock file * add fee tests * fix RefCell borrow panic; change fee flag value * update to leave fee accounts open when burning * regen JS API & update test setup * remove bitflags * fix JS burn tests * handle cases where fee amounts are less than min rent exempt * address PR feedback; regen JS API * add test for burned metadata account with fees stored * remove unwrap * clean up burn JS test to address PR feedback * refactor to only have Create fee * revert non-create fees account additions * refactor close-program-account * regen JS API * update shank annotations and regen JS API * remove sysvar instructions in txs-init * remove extra accounts * regen JS API * address Febo's review changes * address Michael's PR feedback * fix final issue
- Loading branch information
1 parent
e4df367
commit e462a01
Showing
45 changed files
with
808 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** | ||
* This code was GENERATED using the solita package. | ||
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. | ||
* | ||
* See: https://github.com/metaplex-foundation/solita | ||
*/ | ||
|
||
import * as beet from '@metaplex-foundation/beet'; | ||
import * as web3 from '@solana/web3.js'; | ||
|
||
/** | ||
* @category Instructions | ||
* @category Collect | ||
* @category generated | ||
*/ | ||
export const CollectStruct = new beet.BeetArgsStruct<{ instructionDiscriminator: number }>( | ||
[['instructionDiscriminator', beet.u8]], | ||
'CollectInstructionArgs', | ||
); | ||
/** | ||
* Accounts required by the _Collect_ instruction | ||
* | ||
* @property [**signer**] authority Authority to collect fees | ||
* @property [] pdaAccount PDA to retrieve fees from | ||
* @category Instructions | ||
* @category Collect | ||
* @category generated | ||
*/ | ||
export type CollectInstructionAccounts = { | ||
authority: web3.PublicKey; | ||
pdaAccount: web3.PublicKey; | ||
}; | ||
|
||
export const collectInstructionDiscriminator = 54; | ||
|
||
/** | ||
* Creates a _Collect_ instruction. | ||
* | ||
* @param accounts that will be accessed while the instruction is processed | ||
* @category Instructions | ||
* @category Collect | ||
* @category generated | ||
*/ | ||
export function createCollectInstruction( | ||
accounts: CollectInstructionAccounts, | ||
programId = new web3.PublicKey('metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s'), | ||
) { | ||
const [data] = CollectStruct.serialize({ | ||
instructionDiscriminator: collectInstructionDiscriminator, | ||
}); | ||
const keys: web3.AccountMeta[] = [ | ||
{ | ||
pubkey: accounts.authority, | ||
isWritable: false, | ||
isSigner: true, | ||
}, | ||
{ | ||
pubkey: accounts.pdaAccount, | ||
isWritable: false, | ||
isSigner: false, | ||
}, | ||
]; | ||
|
||
const ix = new web3.TransactionInstruction({ | ||
programId, | ||
keys, | ||
data, | ||
}); | ||
return ix; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use solana_program::{ | ||
instruction::{AccountMeta, Instruction}, | ||
pubkey::Pubkey, | ||
}; | ||
|
||
use crate::state::fee::FEE_AUTHORITY; | ||
|
||
use super::*; | ||
|
||
pub fn collect_fees(recipient: Pubkey, fee_accounts: Vec<Pubkey>) -> Instruction { | ||
let mut accounts = vec![ | ||
AccountMeta::new(FEE_AUTHORITY, true), | ||
AccountMeta::new(recipient, false), | ||
]; | ||
|
||
for fee_account in fee_accounts { | ||
accounts.push(AccountMeta::new(fee_account, false)); | ||
} | ||
Instruction { | ||
program_id: crate::ID, | ||
accounts, | ||
data: MetadataInstruction::Collect.try_to_vec().unwrap(), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.