rent_program.ts 838 B

1234567891011121314151617181920212223242526272829
  1. import * as anchor from '@coral-xyz/anchor';
  2. import { Program } from '@coral-xyz/anchor';
  3. import { RentProgram } from '../target/types/rent_program';
  4. describe('rent_program', () => {
  5. // Configure the client to use the local cluster.
  6. const provider = anchor.AnchorProvider.env();
  7. anchor.setProvider(provider);
  8. const program = anchor.workspace.RentProgram as Program<RentProgram>;
  9. const wallet = provider.wallet as anchor.Wallet;
  10. const addressData = {
  11. id: 87615,
  12. zipCode: 94016,
  13. };
  14. it('Create the account', async () => {
  15. const newKeypair = anchor.web3.Keypair.generate();
  16. await program.methods
  17. .createSystemAccount(new anchor.BN(addressData.id), new anchor.BN(addressData.zipCode))
  18. .accounts({
  19. owner: wallet.publicKey,
  20. })
  21. .signers([wallet.payer])
  22. .rpc();
  23. });
  24. });