PickUpCar.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /**
  2. * This code was GENERATED using the solita package.
  3. * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
  4. *
  5. * See: https://github.com/metaplex-foundation/solita
  6. */
  7. import * as beet from '@metaplex-foundation/beet'
  8. import * as web3 from '@solana/web3.js'
  9. /**
  10. * @category Instructions
  11. * @category PickUpCar
  12. * @category generated
  13. */
  14. export const PickUpCarStruct = new beet.BeetArgsStruct<{
  15. instructionDiscriminator: number
  16. }>([['instructionDiscriminator', beet.u8]], 'PickUpCarInstructionArgs')
  17. /**
  18. * Accounts required by the _PickUpCar_ instruction
  19. *
  20. * @property [_writable_] rentalAccount The account representing the active rental
  21. * @property [] carAccount The account representing the Car being rented in this order
  22. * @property [_writable_] payer Fee payer
  23. * @category Instructions
  24. * @category PickUpCar
  25. * @category generated
  26. */
  27. export type PickUpCarInstructionAccounts = {
  28. rentalAccount: web3.PublicKey
  29. carAccount: web3.PublicKey
  30. payer: web3.PublicKey
  31. }
  32. export const pickUpCarInstructionDiscriminator = 2
  33. /**
  34. * Creates a _PickUpCar_ instruction.
  35. *
  36. * @param accounts that will be accessed while the instruction is processed
  37. * @category Instructions
  38. * @category PickUpCar
  39. * @category generated
  40. */
  41. export function createPickUpCarInstruction(
  42. accounts: PickUpCarInstructionAccounts,
  43. programId = new web3.PublicKey('8avNGHVXDwsELJaWMSoUZ44CirQd4zyU9Ez4ZmP4jNjZ')
  44. ) {
  45. const [data] = PickUpCarStruct.serialize({
  46. instructionDiscriminator: pickUpCarInstructionDiscriminator,
  47. })
  48. const keys: web3.AccountMeta[] = [
  49. {
  50. pubkey: accounts.rentalAccount,
  51. isWritable: true,
  52. isSigner: false,
  53. },
  54. {
  55. pubkey: accounts.carAccount,
  56. isWritable: false,
  57. isSigner: false,
  58. },
  59. {
  60. pubkey: accounts.payer,
  61. isWritable: true,
  62. isSigner: false,
  63. },
  64. ]
  65. const ix = new web3.TransactionInstruction({
  66. programId,
  67. keys,
  68. data,
  69. })
  70. return ix
  71. }