Skip to content

Commit

Permalink
js: improve bindings return types
Browse files Browse the repository at this point in the history
  • Loading branch information
dr497 committed May 30, 2024
1 parent aae48f1 commit c93754e
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion js/src/bindings/createReverseName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ export const createReverseName = async (

let instructions = [initCentralStateInstruction];

return [[], instructions];
return instructions;
};
2 changes: 1 addition & 1 deletion js/src/bindings/createSolRecordInstruction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ export const createSolRecordInstruction = async (
signer,
);

return [ix];
return ix;
};
4 changes: 2 additions & 2 deletions js/src/bindings/createSubdomain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const createSubdomain = async (
const reverseKey = getReverseKeySync(subdomain, true);
const info = await connection.getAccountInfo(reverseKey);
if (!info?.data) {
const [, ix_reverse] = await createReverseName(
const ix_reverse = await createReverseName(
pubkey,
"\0".concat(sub),
feePayer || owner,
Expand All @@ -61,5 +61,5 @@ export const createSubdomain = async (
ixs.push(...ix_reverse);
}

return [[], ixs];
return ixs;
};
2 changes: 1 addition & 1 deletion js/src/bindings/registerDomainName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,5 @@ export const registerDomainName = async (
);
ixs.push(ix);

return [[], ixs];
return ixs;
};
2 changes: 1 addition & 1 deletion js/src/bindings/registerFavorite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ export const registerFavorite = (nameAccount: PublicKey, owner: PublicKey) => {
owner,
SystemProgram.programId,
);
return [ix];
return ix;
};
2 changes: 1 addition & 1 deletion js/src/bindings/updateRecordInstruction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ export const updateRecordInstruction = async (
owner,
);

return [ix];
return ix;
};
2 changes: 1 addition & 1 deletion js/src/bindings/updateSolRecordInstruction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ export const updateSolRecordInstruction = async (
signer,
);

return [ix];
return ix;
};
2 changes: 1 addition & 1 deletion js/tests/favorite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ test("Register fav", async () => {
const owner = new PublicKey("Fxuoy3gFjfJALhwkRcuKjRdechcgffUApeYAfMWck6w8");
const tx = new Transaction();
const ix = registerFavorite(getDomainKeySync("wallet-guide-3").pubkey, owner);
tx.add(...ix);
tx.add(ix);
const { blockhash } = await connection.getLatestBlockhash();
tx.recentBlockhash = blockhash;
tx.feePayer = owner;
Expand Down
6 changes: 3 additions & 3 deletions js/tests/registration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const VAULT_OWNER = new PublicKey(

test("Registration", async () => {
const tx = new Transaction();
const [, ix] = await registerDomainName(
const ix = await registerDomainName(
connection,
randomBytes(10).toString("hex"),
1_000,
Expand All @@ -41,7 +41,7 @@ test("Registration", async () => {

test("Registration with ref", async () => {
const tx = new Transaction();
const [, ix] = await registerDomainName(
const ix = await registerDomainName(
connection,
randomBytes(10).toString("hex"),
1_000,
Expand Down Expand Up @@ -93,7 +93,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 registerDomainName(
connection,
randomBytes(10).toString("hex"),
1_000,
Expand Down
2 changes: 1 addition & 1 deletion js/tests/reverse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test("Create sub", async () => {
const parent = "bonfida.sol";

const parentOwner = await resolve(connection, parent);
const [, ix] = await createSubdomain(
const ix = await createSubdomain(
connection,
sub + "." + parent,
parentOwner,
Expand Down
4 changes: 2 additions & 2 deletions js/tests/sub.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const connection = new Connection(process.env.RPC_URL!);

test("Create sub", async () => {
const tx = new Transaction();
const [, ix] = await createSubdomain(
const ix = await createSubdomain(
connection,
randomBytes(10).toString("hex") + ".bonfida",
new PublicKey("HKKp49qGWXd639QsuH7JiLijfVW5UtCVY4s1n2HANwEA"),
Expand Down Expand Up @@ -78,7 +78,7 @@ test("Create sub - Fee payer ", async () => {
const feePayer = VAULT_OWNER;

const parentOwner = await resolve(connection, parent);
const [, ix] = await createSubdomain(
const ix = await createSubdomain(
connection,
sub + "." + parent,
parentOwner,
Expand Down

0 comments on commit c93754e

Please sign in to comment.