Skip to content

Commit

Permalink
linter fix
Browse files Browse the repository at this point in the history
  • Loading branch information
macalinao committed Dec 4, 2023
1 parent f8c07b4 commit 01643e5
Show file tree
Hide file tree
Showing 31 changed files with 457 additions and 474 deletions.
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
4 changes: 2 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ export const QUARRY_CODERS = buildCoderMap<{
* Recipient of protocol fees.
*/
export const QUARRY_FEE_TO = new PublicKey(
"4MMZH3ih1aSty2nx4MC3kSR94Zb55XsXnqb5jfEcyHWQ"
"4MMZH3ih1aSty2nx4MC3kSR94Zb55XsXnqb5jfEcyHWQ",
);

/**
* Sets the protocol fees.
*/
export const QUARRY_FEE_SETTER = new PublicKey(
"4MMZH3ih1aSty2nx4MC3kSR94Zb55XsXnqb5jfEcyHWQ"
"4MMZH3ih1aSty2nx4MC3kSR94Zb55XsXnqb5jfEcyHWQ",
);
6 changes: 3 additions & 3 deletions src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { RedeemerWrapper } from "./wrappers/redeemer";
export class QuarrySDK {
constructor(
readonly provider: AugmentedProvider,
readonly programs: Programs
readonly programs: Programs,
) {}

/**
Expand Down Expand Up @@ -71,7 +71,7 @@ export class QuarrySDK {
*/
newTx(
instructions: TransactionInstruction[],
signers?: Signer[]
signers?: Signer[],
): TransactionEnvelope {
return this.provider.newTX(instructions, signers);
}
Expand All @@ -93,7 +93,7 @@ export class QuarrySDK {
const programs = newProgramMap<Programs>(
provider,
QUARRY_IDLS,
allAddresses
allAddresses,
);
return new QuarrySDK(new SolanaAugmentedProvider(provider), programs);
}
Expand Down
26 changes: 13 additions & 13 deletions src/wrappers/mergeMine/mergeMiner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class MergeMiner {
readonly mm: {
key: PublicKey;
data: MergeMinerData;
}
},
) {}

get provider(): Provider {
Expand Down Expand Up @@ -83,7 +83,7 @@ export class MergeMiner {
mmPrimaryTokenAccount,
owner,
[],
amount.toU64()
amount.toU64(),
),
]).combine(await this.stakePrimaryMiner(rewarder));
}
Expand Down Expand Up @@ -160,7 +160,7 @@ export class MergeMiner {
systemProgram: SystemProgram.programId,
tokenProgram: TOKEN_PROGRAM_ID,
},
})
}),
);
if (minerReplicaMintTokenAccount.instruction) {
txEnv.instructions.unshift(minerReplicaMintTokenAccount.instruction);
Expand All @@ -186,11 +186,11 @@ export class MergeMiner {
}): Promise<TransactionEnvelope> {
const withdrawPrimary = await this.unstakePrimaryMiner(rewarder, amount);
const withdrawPrimaryFromMM = await this.withdrawTokens(
amount.token.mintAccount
amount.token.mintAccount,
);
return TransactionEnvelope.combineAll(
withdrawPrimary,
withdrawPrimaryFromMM
withdrawPrimaryFromMM,
);
}

Expand Down Expand Up @@ -224,7 +224,7 @@ export class MergeMiner {
*/
async unstakePrimaryMiner(
rewarder: PublicKey,
amount: TokenAmount
amount: TokenAmount,
): Promise<TransactionEnvelope> {
const stake = await this.getPrimaryStakeAccounts(rewarder);
const mmPrimaryTokenAccount = await getATAAddress({
Expand Down Expand Up @@ -312,7 +312,7 @@ export class MergeMiner {
async claimPrimaryRewards(rewarder: PublicKey): Promise<TransactionEnvelope> {
return await this.claimRewardsCommon(
this.primaryMint,
await this.getPrimaryStakeAccounts(rewarder)
await this.getPrimaryStakeAccounts(rewarder),
);
}

Expand All @@ -323,7 +323,7 @@ export class MergeMiner {
async claimReplicaRewards(rewarder: PublicKey): Promise<TransactionEnvelope> {
return await this.claimRewardsCommon(
this.replicaMint,
await this.getReplicaStakeAccounts(rewarder)
await this.getReplicaStakeAccounts(rewarder),
);
}

Expand All @@ -335,17 +335,17 @@ export class MergeMiner {
async claimRewardsCommon(
quarryMint: PublicKey,
stake: QuarryStakeAccounts,
mmOwner: PublicKey = this.provider.wallet.publicKey
mmOwner: PublicKey = this.provider.wallet.publicKey,
): Promise<TransactionEnvelope> {
const rewarderKey = stake.rewarder;
const rewarder =
await this.mergeMine.sdk.programs.Mine.account.rewarder.fetch(
rewarderKey
rewarderKey,
);
const [minter] = await findMinterAddress(
rewarder.mintWrapper,
rewarderKey,
this.mergeMine.sdk.programs.MintWrapper.programId
this.mergeMine.sdk.programs.MintWrapper.programId,
);

const mm = this.mm.key;
Expand Down Expand Up @@ -392,7 +392,7 @@ export class MergeMiner {
}

async getReplicaStakeAccounts(
rewarder: PublicKey
rewarder: PublicKey,
): Promise<QuarryStakeAccounts> {
const [quarry] = await findQuarryAddress(rewarder, this.replicaMint);
const [miner] = await findMinerAddress(quarry, this.mm.key);
Expand All @@ -410,7 +410,7 @@ export class MergeMiner {
}

async getPrimaryStakeAccounts(
rewarder: PublicKey
rewarder: PublicKey,
): Promise<QuarryStakeAccounts> {
const [quarry] = await findQuarryAddress(rewarder, this.primaryMint);
const [miner] = await findMinerAddress(quarry, this.mm.key);
Expand Down
49 changes: 26 additions & 23 deletions src/wrappers/mergeMine/mergePool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ import type { MergeMine } from "./quarryMergeMine";
export class MergePool {
private _data: MergePoolData | null = null;

constructor(readonly mergeMine: MergeMine, readonly key: PublicKey) {}
constructor(
readonly mergeMine: MergeMine,
readonly key: PublicKey,
) {}

async reloadData(): Promise<MergePoolData> {
this._data = await this.mergeMine.program.account.mergePool.fetch(this.key);
Expand Down Expand Up @@ -95,7 +98,7 @@ export class MergePool {
payer: this.provider.wallet.publicKey,
systemProgram: SystemProgram.programId,
},
})
}),
);
if (mmATAIx) {
allInstructions.push(mmATAIx);
Expand All @@ -117,12 +120,12 @@ export class MergePool {
mmPrimaryTokenAccount,
mmOwner,
[],
amount.toU64()
)
amount.toU64(),
),
);

return new TransactionEnvelope(this.provider, allInstructions).combine(
await this.stakePrimaryMiner(rewarder, mmKey)
await this.stakePrimaryMiner(rewarder, mmKey),
);
}

Expand All @@ -133,7 +136,7 @@ export class MergePool {
*/
async stakePrimaryMiner(
rewarder: PublicKey,
mergeMiner: PublicKey
mergeMiner: PublicKey,
): Promise<TransactionEnvelope> {
const { provider } = this.mergeMine;
const data = await this.data();
Expand All @@ -160,7 +163,7 @@ export class MergePool {
*/
async stakeReplicaMiner(
rewarder: PublicKey,
mergeMiner: PublicKey
mergeMiner: PublicKey,
): Promise<TransactionEnvelope> {
const poolData = await this.data();

Expand Down Expand Up @@ -209,7 +212,7 @@ export class MergePool {
systemProgram: SystemProgram.programId,
tokenProgram: TOKEN_PROGRAM_ID,
},
})
}),
);
if (minerReplicaMintTokenAccount.instruction) {
txEnv.instructions.unshift(minerReplicaMintTokenAccount.instruction);
Expand Down Expand Up @@ -238,15 +241,15 @@ export class MergePool {
const withdrawPrimary = await this.unstakePrimaryMiner(
rewarder,
mergeMiner,
amount
amount,
);
const withdrawPrimaryFromMM = await this.withdrawTokens(
amount.token.mintAccount,
mergeMiner
mergeMiner,
);
return TransactionEnvelope.combineAll(
withdrawPrimary,
withdrawPrimaryFromMM
withdrawPrimaryFromMM,
);
}

Expand All @@ -257,7 +260,7 @@ export class MergePool {
*/
async unstakeAllReplica(
rewarder: PublicKey,
mergeMiner: PublicKey
mergeMiner: PublicKey,
): Promise<TransactionEnvelope> {
const poolData = await this.data();

Expand Down Expand Up @@ -286,7 +289,7 @@ export class MergePool {
async unstakePrimaryMiner(
rewarder: PublicKey,
mergeMiner: PublicKey,
amount: TokenAmount
amount: TokenAmount,
): Promise<TransactionEnvelope> {
const poolData = await this.data();

Expand All @@ -313,7 +316,7 @@ export class MergePool {
*/
async withdrawTokens(
withdrawMint: PublicKey,
mergeMiner: PublicKey
mergeMiner: PublicKey,
): Promise<TransactionEnvelope> {
const owner = this.provider.wallet.publicKey;
const mmPrimaryAccount = await getATAAddress({
Expand Down Expand Up @@ -345,12 +348,12 @@ export class MergePool {
*/
async claimPrimaryRewards(
rewarder: PublicKey,
mergeMiner: PublicKey
mergeMiner: PublicKey,
): Promise<TransactionEnvelope> {
const poolData = await this.data();
return await this.claimRewardsCommon(
poolData.primaryMint,
await this.getPrimaryStakeAccounts(rewarder, mergeMiner)
await this.getPrimaryStakeAccounts(rewarder, mergeMiner),
);
}

Expand All @@ -360,13 +363,13 @@ export class MergePool {
*/
async claimReplicaRewards(
rewarder: PublicKey,
mergeMiner: PublicKey
mergeMiner: PublicKey,
): Promise<TransactionEnvelope> {
const poolData = await this.data();

return await this.claimRewardsCommon(
poolData.replicaMint,
await this.getReplicaStakeAccounts(rewarder, mergeMiner)
await this.getReplicaStakeAccounts(rewarder, mergeMiner),
);
}

Expand All @@ -378,16 +381,16 @@ export class MergePool {
async claimRewardsCommon(
quarryMint: PublicKey,
stake: QuarryStakeAccounts,
mmOwner: PublicKey = this.provider.wallet.publicKey
mmOwner: PublicKey = this.provider.wallet.publicKey,
): Promise<TransactionEnvelope> {
const rewarder =
await this.mergeMine.sdk.programs.Mine.account.rewarder.fetch(
stake.rewarder
stake.rewarder,
);
const [minter] = await findMinterAddress(
rewarder.mintWrapper,
stake.rewarder,
this.mergeMine.sdk.programs.MintWrapper.programId
this.mergeMine.sdk.programs.MintWrapper.programId,
);

const withdrawMint = rewarder.rewardsTokenMint;
Expand Down Expand Up @@ -434,7 +437,7 @@ export class MergePool {

async getReplicaStakeAccounts(
rewarder: PublicKey,
mergeMiner: PublicKey
mergeMiner: PublicKey,
): Promise<QuarryStakeAccounts> {
const poolData = await this.data();

Expand All @@ -456,7 +459,7 @@ export class MergePool {

async getPrimaryStakeAccounts(
rewarder: PublicKey,
mergeMiner: PublicKey
mergeMiner: PublicKey,
): Promise<QuarryStakeAccounts> {
const poolData = await this.data();

Expand Down
6 changes: 3 additions & 3 deletions src/wrappers/mergeMine/pda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const findPoolAddress = async ({
}): Promise<[PublicKey, number]> => {
return await PublicKey.findProgramAddress(
[utils.bytes.utf8.encode("MergePool"), primaryMint.toBuffer()],
programId
programId,
);
};

Expand All @@ -34,7 +34,7 @@ export const findReplicaMintAddress = async ({
const [pool] = await findPoolAddress({ programId, primaryMint });
return await PublicKey.findProgramAddress(
[utils.bytes.utf8.encode("ReplicaMint"), pool.toBuffer()],
programId
programId,
);
};

Expand All @@ -53,6 +53,6 @@ export const findMergeMinerAddress = async ({
}): Promise<[PublicKey, number]> => {
return await PublicKey.findProgramAddress(
[utils.bytes.utf8.encode("MergeMiner"), pool.toBuffer(), owner.toBuffer()],
programId
programId,
);
};
Loading

0 comments on commit 01643e5

Please sign in to comment.