seahorse.py 976 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # seahorse
  2. # Built with Seahorse v0.2.7
  3. from seahorse.prelude import *
  4. declare_id('5KCV219sxBAZMfXWP5EZ57D6K9568krgPKGe1Lq2nkxH')
  5. @instruction
  6. def create_token(
  7. mint: Empty[TokenMint],
  8. signer: Signer
  9. ):
  10. mint.init(
  11. payer = signer,
  12. decimals = 6,
  13. authority = signer
  14. )
  15. @instruction
  16. def mint_token(
  17. mint: TokenMint,
  18. recipient: TokenAccount,
  19. signer: Signer,
  20. amount: u64
  21. ):
  22. mint.mint(
  23. authority = signer,
  24. to = recipient,
  25. amount = amount * u64(10) ** 6
  26. )
  27. @instruction
  28. def create_associated_token_account(
  29. token_account: Empty[TokenAccount],
  30. mint: TokenMint,
  31. signer: Signer
  32. ):
  33. token_account.init(
  34. associated = True,
  35. payer = signer,
  36. mint = mint,
  37. authority = signer
  38. )
  39. @instruction
  40. def transfer(
  41. signer_token_account: TokenAccount,
  42. recipient: TokenAccount,
  43. signer: Signer,
  44. amount: u64
  45. ):
  46. signer_token_account.transfer(
  47. authority = signer,
  48. to = recipient,
  49. amount = amount * u64(10) ** 6
  50. )