lib.rs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // This file is autogenerated with https://github.com/acheroncrypto/native-to-anchor
  2. use anchor_lang::prelude::*;
  3. declare_id!("11111111111111111111111111111111");
  4. #[program]
  5. pub mod spl_name_service {
  6. use super::*;
  7. pub fn create(
  8. ctx: Context<Create>,
  9. hashed_name: Vec<u8>,
  10. lamports: u64,
  11. space: u32,
  12. ) -> Result<()> {
  13. Ok(())
  14. }
  15. pub fn update(ctx: Context<Update>, offset: u32, data: Vec<u8>) -> Result<()> {
  16. Ok(())
  17. }
  18. pub fn transfer(ctx: Context<Transfer>, new_owner: Pubkey) -> Result<()> {
  19. Ok(())
  20. }
  21. pub fn delete(ctx: Context<Delete>) -> Result<()> {
  22. Ok(())
  23. }
  24. }
  25. #[derive(Accounts)]
  26. pub struct Create<'info> {
  27. system_program: Program<'info, System>,
  28. #[account(mut)]
  29. payer: Signer<'info>,
  30. #[account(mut)]
  31. name_account: AccountInfo<'info>,
  32. name_owner: AccountInfo<'info>,
  33. // optional_name_class: Signer<'info>,
  34. // optional_Pubkey: AccountInfo<'info>,
  35. // optional_name_parent: AccountInfo<'info>,
  36. // optional_Pubkey: AccountInfo<'info>,
  37. // optional_key: Signer<'info>,
  38. }
  39. #[derive(Accounts)]
  40. pub struct Update<'info> {
  41. #[account(mut)]
  42. name_account: AccountInfo<'info>,
  43. name_update_signer: Signer<'info>,
  44. // #[account(mut)]
  45. // optional_name_parent: AccountInfo<'info>,
  46. }
  47. #[derive(Accounts)]
  48. pub struct Transfer<'info> {
  49. #[account(mut)]
  50. name_account: AccountInfo<'info>,
  51. name_owner: Signer<'info>,
  52. // optional_key: Signer<'info>,
  53. }
  54. #[derive(Accounts)]
  55. pub struct Delete<'info> {
  56. #[account(mut)]
  57. name_account: AccountInfo<'info>,
  58. name_owner: Signer<'info>,
  59. #[account(mut)]
  60. refund_target: AccountInfo<'info>,
  61. }
  62. #[account]
  63. pub struct NameRecordHeader {
  64. // Names are hierarchical. `parent_name` contains the account address of the parent
  65. // name, or `Pubkey::default()` if no parent exists.
  66. pub parent_name: Pubkey,
  67. // The owner of this name
  68. pub owner: Pubkey,
  69. // The class of data this account represents (DNS record, twitter handle, SPL Token name/symbol, etc)
  70. //
  71. // If `Pubkey::default()` the data is unspecified.
  72. pub class: Pubkey,
  73. }
  74. #[error_code]
  75. pub enum NameServiceError {
  76. #[msg("Out of space")]
  77. OutOfSpace,
  78. }