Skip to content

Commit 0a1f31a

Browse files
authored
use squads mesh package instead (#310)
1 parent d5b4f57 commit 0a1f31a

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

third_party/pyth/multisig-wh-message-builder/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

third_party/pyth/multisig-wh-message-builder/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"@ledgerhq/hw-transport-node-hid": "^6.27.2",
4444
"@project-serum/anchor": "^0.25.0",
4545
"@solana/web3.js": "^1.53.0",
46-
"@sqds/sdk": "^1.0.4",
46+
"@sqds/mesh": "^1.0.4",
4747
"bs58": "^5.0.0",
4848
"commander": "^9.4.0",
4949
"ethers": "^5.7.0"

third_party/pyth/multisig-wh-message-builder/src/index.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
PublicKey,
1313
SystemProgram,
1414
} from "@solana/web3.js";
15-
import Squads from "@sqds/sdk";
15+
import Squads from "@sqds/mesh";
1616
import bs58 from "bs58";
1717
import { program } from "commander";
1818
import * as fs from "fs";
@@ -180,11 +180,11 @@ async function createMultisigTx(
180180
);
181181
console.log(`Loaded wallet with address: ${wallet.publicKey.toBase58()}`);
182182
}
183-
const squads =
183+
const squad =
184184
cluster === "devnet" ? Squads.devnet(wallet) : Squads.mainnet(wallet);
185-
const msAccount = await squads.getMultisig(vault);
185+
const msAccount = await squad.getMultisig(vault);
186186

187-
const emitter = squads.getAuthorityPDA(
187+
const emitter = squad.getAuthorityPDA(
188188
msAccount.publicKey,
189189
msAccount.authorityIndex
190190
);
@@ -193,7 +193,7 @@ async function createMultisigTx(
193193
console.log("Creating new transaction...");
194194
if (ledger)
195195
console.log("Please approve the transaction on your ledger device...");
196-
const newTx = await squads.createTransaction(
196+
const newTx = await squad.createTransaction(
197197
msAccount.publicKey,
198198
msAccount.authorityIndex
199199
);
@@ -210,7 +210,7 @@ async function createMultisigTx(
210210
emitter,
211211
emitter,
212212
message.publicKey,
213-
squads.connection,
213+
squad.connection,
214214
payload
215215
);
216216
console.log("Wormhole instructions created.");
@@ -219,17 +219,17 @@ async function createMultisigTx(
219219
if (ledger)
220220
console.log("Please approve the transaction on your ledger device...");
221221
// transfer sol to the message account
222-
await squads.addInstruction(newTx.publicKey, wormholeIxs[0]);
222+
await squad.addInstruction(newTx.publicKey, wormholeIxs[0]);
223223
console.log("Adding instruction 2/2 to transaction...");
224224
if (ledger)
225225
console.log("Please approve the transaction on your ledger device...");
226226
// wormhole post message ix
227-
await squads.addInstruction(newTx.publicKey, wormholeIxs[1]);
227+
await squad.addInstruction(newTx.publicKey, wormholeIxs[1]);
228228

229229
console.log("Activating transaction...");
230230
if (ledger)
231231
console.log("Please approve the transaction on your ledger device...");
232-
await squads.activateTransaction(newTx.publicKey);
232+
await squad.activateTransaction(newTx.publicKey);
233233
console.log("Transaction created.");
234234
}
235235

@@ -268,16 +268,16 @@ async function executeMultisigTx(
268268
`Loaded message account with address: ${message.publicKey.toBase58()}`
269269
);
270270

271-
const squads =
271+
const squad =
272272
cluster === "devnet" ? Squads.devnet(wallet) : Squads.mainnet(wallet);
273-
const msAccount = await squads.getMultisig(vault);
273+
const msAccount = await squad.getMultisig(vault);
274274

275-
const emitter = squads.getAuthorityPDA(
275+
const emitter = squad.getAuthorityPDA(
276276
msAccount.publicKey,
277277
msAccount.authorityIndex
278278
);
279279

280-
const executeIx = await squads.buildExecuteTransaction(
280+
const executeIx = await squad.buildExecuteTransaction(
281281
txPDA,
282282
wallet.publicKey
283283
);
@@ -290,13 +290,13 @@ async function executeMultisigTx(
290290
// airdrop 0.1 SOL to emitter if on devnet
291291
if (cluster === "devnet") {
292292
console.log("Airdropping 0.1 SOL to emitter...");
293-
const airdropSignature = await squads.connection.requestAirdrop(
293+
const airdropSignature = await squad.connection.requestAirdrop(
294294
emitter,
295295
0.1 * LAMPORTS_PER_SOL
296296
);
297297
const { blockhash, lastValidBlockHeight } =
298-
await squads.connection.getLatestBlockhash();
299-
await squads.connection.confirmTransaction({
298+
await squad.connection.getLatestBlockhash();
299+
await squad.connection.confirmTransaction({
300300
blockhash,
301301
lastValidBlockHeight,
302302
signature: airdropSignature,
@@ -305,13 +305,13 @@ async function executeMultisigTx(
305305
}
306306

307307
const { blockhash, lastValidBlockHeight } =
308-
await squads.connection.getLatestBlockhash();
308+
await squad.connection.getLatestBlockhash();
309309
const executeTx = new anchor.web3.Transaction({
310310
blockhash,
311311
lastValidBlockHeight,
312312
feePayer: wallet.publicKey,
313313
});
314-
const provider = new anchor.AnchorProvider(squads.connection, wallet, {
314+
const provider = new anchor.AnchorProvider(squad.connection, wallet, {
315315
commitment: "confirmed",
316316
preflightCommitment: "confirmed",
317317
});
@@ -328,7 +328,7 @@ async function executeMultisigTx(
328328
}`
329329
);
330330

331-
const txDetails = await squads.connection.getParsedTransaction(
331+
const txDetails = await squad.connection.getParsedTransaction(
332332
signature,
333333
"confirmed"
334334
);

0 commit comments

Comments
 (0)