Skip to content

Commit

Permalink
js: remove deprecated register fn
Browse files Browse the repository at this point in the history
  • Loading branch information
dr497 committed Aug 7, 2024
1 parent 71095b5 commit c34d799
Showing 1 changed file with 2 additions and 40 deletions.
42 changes: 2 additions & 40 deletions js/tests/registration.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
require("dotenv").config();
import { test, jest } from "@jest/globals";
import { Connection, PublicKey, Transaction } from "@solana/web3.js";
import { registerDomainName } from "../src/bindings/registerDomainName";
import { registerDomainNameV2 } from "../src/bindings/registerDomainNameV2";
import { registerWithNft } from "../src/bindings/registerWithNft";
import { randomBytes } from "crypto";
import { REFERRERS, USDC_MINT } from "../src/constants";
import { REFERRERS } from "../src/constants";
import { getAssociatedTokenAddressSync } from "@solana/spl-token";
import { getDomainKeySync } from "../src/utils/getDomainKeySync";
import { getReverseKeySync } from "../src/utils/getReverseKeySync";
Expand All @@ -21,43 +20,6 @@ const VAULT_OWNER = new PublicKey(
"5D2zKog251d6KPCyFyLMt3KroWwXXPWSgTPyhV22K2gR",
);

test("Registration", async () => {
const tx = new Transaction();
const ix = await registerDomainName(
connection,
randomBytes(10).toString("hex"),
1_000,
VAULT_OWNER,
getAssociatedTokenAddressSync(USDC_MINT, VAULT_OWNER, true),
USDC_MINT,
);
tx.add(...ix);
const { blockhash } = await connection.getLatestBlockhash();
tx.recentBlockhash = blockhash;
tx.feePayer = VAULT_OWNER;
const res = await connection.simulateTransaction(tx);
expect(res.value.err).toBe(null);
});

test("Registration with ref", async () => {
const tx = new Transaction();
const ix = await registerDomainName(
connection,
randomBytes(10).toString("hex"),
1_000,
VAULT_OWNER,
getAssociatedTokenAddressSync(FIDA_MINT, VAULT_OWNER, true),
FIDA_MINT,
REFERRERS[1],
);
tx.add(...ix);
const { blockhash } = await connection.getLatestBlockhash();
tx.recentBlockhash = blockhash;
tx.feePayer = VAULT_OWNER;
const res = await connection.simulateTransaction(tx);
expect(res.value.err).toBe(null);
});

test("Register with NFT", async () => {
const tx = new Transaction();
const domain = randomBytes(10).toString("hex");
Expand Down Expand Up @@ -93,7 +55,7 @@ test("Register with NFT", async () => {
test("Indempotent ATA creation ref", async () => {
const tx = new Transaction();
for (let i = 0; i < 3; i++) {
const ix = await registerDomainName(
const ix = await registerDomainNameV2(
connection,
randomBytes(10).toString("hex"),
1_000,
Expand Down

0 comments on commit c34d799

Please sign in to comment.