Skip to content

Commit

Permalink
Merge branch 'main' of github.com:blockworks-foundation/mango-client-v3
Browse files Browse the repository at this point in the history
  • Loading branch information
riordanp committed Jan 22, 2023
2 parents 2098b2e + 1d1fe1b commit 4efda25
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/scripts/serumCrank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
Connection,
PublicKey,
Transaction,
ComputeBudgetInstruction,
ComputeBudgetProgram,
} from '@solana/web3.js';
import { getMultipleAccounts, sleep } from '../utils/utils';
import BN from 'bn.js';
Expand All @@ -18,7 +20,8 @@ import {
DexInstructions,
Market,
} from '@project-serum/serum';
import { Token, TOKEN_PROGRAM_ID } from '@solana/spl-token';
import { ASSOCIATED_TOKEN_PROGRAM_ID, Token, TOKEN_PROGRAM_ID } from '@solana/spl-token';
import { WRAPPED_SOL_MINT } from '@project-serum/serum/lib/token-instructions';

const {
ENDPOINT_URL,
Expand All @@ -43,7 +46,7 @@ const payer = Keypair.fromSecretKey(
Uint8Array.from(
JSON.parse(
KEYPAIR ||
fs.readFileSync(os.homedir() + '/.config/solana/devnet.json', 'utf-8'),
fs.readFileSync(os.homedir() + '/.config/solana/azzers.json', 'utf-8'),
),
),
);
Expand All @@ -55,6 +58,7 @@ const connection = new Connection(ENDPOINT_URL!, 'processed' as Commitment);
async function run() {
const spotMarkets = await Promise.all(
markets[cluster].map((m) => {
console.log(m.address);
return Market.load(
connection,
new PublicKey(m.address),
Expand Down Expand Up @@ -137,6 +141,9 @@ async function run() {
});

const transaction = new Transaction();
transaction.add(ComputeBudgetProgram.setComputeUnitPrice({
microLamports: 25000
}))
transaction.add(instr);

console.log(
Expand All @@ -146,10 +153,10 @@ async function run() {
events.length,
'events',
);
await connection.sendTransaction(transaction, [payer], {
console.log(await connection.sendTransaction(transaction, [payer], {
skipPreflight: true,
maxRetries: 2,
});
}));
}
await sleep(interval);
} catch (e) {
Expand Down

0 comments on commit 4efda25

Please sign in to comment.