pyth-lazer-solana-contract.ts 1.0 KB

1234567891011121314151617181920212223242526272829
  1. import * as anchor from "@coral-xyz/anchor";
  2. import { Program } from "@coral-xyz/anchor";
  3. import { PythLazerSolanaContract } from "../target/types/pyth_lazer_solana_contract";
  4. import { BN } from "bn.js";
  5. describe("pyth-lazer-solana-contract", () => {
  6. // Configure the client to use the local cluster.
  7. anchor.setProvider(anchor.AnchorProvider.env());
  8. const program = anchor.workspace
  9. .PythLazerSolanaContract as Program<PythLazerSolanaContract>;
  10. it("Is initialized!", async () => {
  11. const topAuthorityKeypair = anchor.web3.Keypair.generate();
  12. const tx = await program.methods
  13. .initialize(topAuthorityKeypair.publicKey, anchor.web3.PublicKey.unique())
  14. .rpc();
  15. console.log("Your transaction signature", tx);
  16. const trustedSigner1 = anchor.web3.PublicKey.unique();
  17. const tx2 = await program.methods
  18. .update(trustedSigner1, new BN(42))
  19. .accounts({ topAuthority: topAuthorityKeypair.publicKey })
  20. .signers([topAuthorityKeypair])
  21. .rpc();
  22. console.log("Your transaction signature", tx2);
  23. });
  24. });