-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tests): updates to test suite and helpers
- Loading branch information
Showing
11 changed files
with
257 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { createBlankTransaction } from "./transactions"; | ||
|
||
export const agnosticExecute = async (squads, txPDA, member) => { | ||
try { | ||
const executeIx = await squads.buildExecuteTransaction(txPDA, member.publicKey); | ||
const executeTx = await createBlankTransaction( | ||
squads.connection, | ||
member.publicKey | ||
); | ||
executeTx.add(executeIx); | ||
//get the latest blockhash and attach it to the transaction | ||
const blockhash = await squads.connection.getLatestBlockhash(); | ||
executeTx.recentBlockhash = blockhash.blockhash; | ||
|
||
// airdrop a small amount to member2 for feepaying | ||
await squads.connection.requestAirdrop(member.publicKey, 1000000); | ||
// sign the transaction on behalf of member2 | ||
await executeTx.sign(member); | ||
// send the transaction | ||
const sig = await squads.connection.sendRawTransaction(executeTx.serialize(), { | ||
skipPreflight: true, | ||
commitment: "confirmed", | ||
}); | ||
|
||
await squads.connection.confirmTransaction(sig, "confirmed"); | ||
return sig; | ||
} catch (e) { | ||
console.log("unable to execute add member tx on behalf of ", member.publicKey.toBase58()); | ||
throw e; | ||
} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.