@quarryprotocol/quarry-sdk
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -8,2 +8,4 @@ # Quarry Protocol Changelog | ||
## Unreleased Changes | ||
## [v4.0.0] | ||
@@ -13,3 +15,3 @@ | ||
- Upgrade to Anchor v0.23.0 ([#409](https://github.com/QuarryProtocol/quarry/pull/409)). | ||
- Upgrade to Anchor v0.23.0 ([#447](https://github.com/QuarryProtocol/quarry/pull/447)). | ||
@@ -16,0 +18,0 @@ ## [v3.0.0] |
export declare type QuarryMergeMineIDL = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_merge_mine"; | ||
@@ -528,2 +528,48 @@ instructions: [ | ||
{ | ||
name: "rescueTokens"; | ||
accounts: [ | ||
{ | ||
name: "mmOwner"; | ||
isMut: false; | ||
isSigner: true; | ||
}, | ||
{ | ||
name: "mergePool"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "mm"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "miner"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "minerTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "destinationTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "quarryMineProgram"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "tokenProgram"; | ||
isMut: false; | ||
isSigner: false; | ||
} | ||
]; | ||
args: []; | ||
}, | ||
{ | ||
name: "claimRewards"; | ||
@@ -968,3 +1014,3 @@ accounts: [ | ||
export declare type AnchorQuarryMergeMine = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_merge_mine"; | ||
@@ -1495,2 +1541,48 @@ instructions: [ | ||
{ | ||
name: "rescueTokens"; | ||
accounts: [ | ||
{ | ||
name: "mmOwner"; | ||
isMut: false; | ||
isSigner: true; | ||
}, | ||
{ | ||
name: "mergePool"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "mm"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "miner"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "minerTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "destinationTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "quarryMineProgram"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "tokenProgram"; | ||
isMut: false; | ||
isSigner: false; | ||
} | ||
]; | ||
args: []; | ||
}, | ||
{ | ||
name: "claimRewards"; | ||
@@ -1497,0 +1589,0 @@ accounts: [ |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.AnchorQuarryMergeMineIDL = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_merge_mine", | ||
@@ -533,2 +533,48 @@ instructions: [ | ||
{ | ||
name: "rescueTokens", | ||
accounts: [ | ||
{ | ||
name: "mmOwner", | ||
isMut: false, | ||
isSigner: true, | ||
}, | ||
{ | ||
name: "mergePool", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "mm", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "miner", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "minerTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "destinationTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "quarryMineProgram", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "tokenProgram", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
], | ||
args: [], | ||
}, | ||
{ | ||
name: "claimRewards", | ||
@@ -973,3 +1019,3 @@ accounts: [ | ||
exports.QuarryMergeMineJSON = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_merge_mine", | ||
@@ -1500,2 +1546,48 @@ instructions: [ | ||
{ | ||
name: "rescueTokens", | ||
accounts: [ | ||
{ | ||
name: "mmOwner", | ||
isMut: false, | ||
isSigner: true, | ||
}, | ||
{ | ||
name: "mergePool", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "mm", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "miner", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "minerTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "destinationTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "quarryMineProgram", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "tokenProgram", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
], | ||
args: [], | ||
}, | ||
{ | ||
name: "claimRewards", | ||
@@ -1502,0 +1594,0 @@ accounts: [ |
export declare type QuarryMineIDL = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_mine"; | ||
@@ -593,2 +593,33 @@ instructions: [ | ||
{ | ||
name: "rescueTokens"; | ||
accounts: [ | ||
{ | ||
name: "miner"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "authority"; | ||
isMut: false; | ||
isSigner: true; | ||
}, | ||
{ | ||
name: "minerTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "destinationTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "tokenProgram"; | ||
isMut: false; | ||
isSigner: false; | ||
} | ||
]; | ||
args: []; | ||
}, | ||
{ | ||
name: "extractFees"; | ||
@@ -1040,3 +1071,3 @@ accounts: [ | ||
export declare type AnchorQuarryMine = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_mine"; | ||
@@ -1632,2 +1663,33 @@ instructions: [ | ||
{ | ||
name: "rescueTokens"; | ||
accounts: [ | ||
{ | ||
name: "miner"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "authority"; | ||
isMut: false; | ||
isSigner: true; | ||
}, | ||
{ | ||
name: "minerTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "destinationTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "tokenProgram"; | ||
isMut: false; | ||
isSigner: false; | ||
} | ||
]; | ||
args: []; | ||
}, | ||
{ | ||
name: "extractFees"; | ||
@@ -1634,0 +1696,0 @@ accounts: [ |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.AnchorQuarryMineIDL = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_mine", | ||
@@ -598,2 +598,33 @@ instructions: [ | ||
{ | ||
name: "rescueTokens", | ||
accounts: [ | ||
{ | ||
name: "miner", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "authority", | ||
isMut: false, | ||
isSigner: true, | ||
}, | ||
{ | ||
name: "minerTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "destinationTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "tokenProgram", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
], | ||
args: [], | ||
}, | ||
{ | ||
name: "extractFees", | ||
@@ -1045,3 +1076,3 @@ accounts: [ | ||
exports.QuarryMineJSON = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_mine", | ||
@@ -1637,2 +1668,33 @@ instructions: [ | ||
{ | ||
name: "rescueTokens", | ||
accounts: [ | ||
{ | ||
name: "miner", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "authority", | ||
isMut: false, | ||
isSigner: true, | ||
}, | ||
{ | ||
name: "minerTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "destinationTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "tokenProgram", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
], | ||
args: [], | ||
}, | ||
{ | ||
name: "extractFees", | ||
@@ -1639,0 +1701,0 @@ accounts: [ |
export declare type QuarryMintWrapperIDL = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_mint_wrapper"; | ||
@@ -486,3 +486,3 @@ instructions: [ | ||
export declare type AnchorQuarryMintWrapper = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_mint_wrapper"; | ||
@@ -489,0 +489,0 @@ instructions: [ |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.AnchorQuarryMintWrapperIDL = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_mint_wrapper", | ||
@@ -491,3 +491,3 @@ instructions: [ | ||
exports.QuarryMintWrapperJSON = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_mint_wrapper", | ||
@@ -494,0 +494,0 @@ instructions: [ |
export declare type QuarryOperatorIDL = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_operator"; | ||
@@ -389,3 +389,3 @@ instructions: [ | ||
export declare type AnchorQuarryOperator = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_operator"; | ||
@@ -392,0 +392,0 @@ instructions: [ |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.AnchorQuarryOperatorIDL = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_operator", | ||
@@ -394,3 +394,3 @@ instructions: [ | ||
exports.QuarryOperatorJSON = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_operator", | ||
@@ -397,0 +397,0 @@ instructions: [ |
export declare type QuarryRedeemerIDL = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_redeemer"; | ||
@@ -217,3 +217,3 @@ instructions: [ | ||
export declare type AnchorQuarryRedeemer = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_redeemer"; | ||
@@ -220,0 +220,0 @@ instructions: [ |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.AnchorQuarryRedeemerIDL = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_redeemer", | ||
@@ -222,3 +222,3 @@ instructions: [ | ||
exports.QuarryRedeemerJSON = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_redeemer", | ||
@@ -225,0 +225,0 @@ instructions: [ |
export declare type QuarryRegistryIDL = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_registry"; | ||
@@ -98,3 +98,3 @@ instructions: [ | ||
export declare type AnchorQuarryRegistry = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_registry"; | ||
@@ -101,0 +101,0 @@ instructions: [ |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.AnchorQuarryRegistryIDL = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_registry", | ||
@@ -103,3 +103,3 @@ instructions: [ | ||
exports.QuarryRegistryJSON = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_registry", | ||
@@ -106,0 +106,0 @@ instructions: [ |
@@ -104,3 +104,14 @@ import type { Provider } from "@saberhq/solana-contrib"; | ||
}): MergePool; | ||
/** | ||
* Rescue stuck tokens in a merge miner. | ||
* @returns | ||
*/ | ||
rescueTokens({ mergePool, mergeMiner, miner, minerTokenAccount, destinationTokenAccount, }: { | ||
mergePool: PublicKey; | ||
mergeMiner: PublicKey; | ||
miner: PublicKey; | ||
minerTokenAccount: PublicKey; | ||
destinationTokenAccount: PublicKey; | ||
}): TransactionEnvelope; | ||
} | ||
//# sourceMappingURL=quarryMergeMine.d.ts.map |
@@ -8,2 +8,3 @@ "use strict"; | ||
const web3_js_1 = require("@solana/web3.js"); | ||
const constants_1 = require("../../constants"); | ||
const pda_1 = require("../mine/pda"); | ||
@@ -240,4 +241,23 @@ const mergeMiner_1 = require("./mergeMiner"); | ||
} | ||
/** | ||
* Rescue stuck tokens in a merge miner. | ||
* @returns | ||
*/ | ||
rescueTokens({ mergePool, mergeMiner, miner, minerTokenAccount, destinationTokenAccount, }) { | ||
const withdrawTokensIX = this.program.instruction.rescueTokens({ | ||
accounts: { | ||
mmOwner: this.provider.wallet.publicKey, | ||
mergePool, | ||
mm: mergeMiner, | ||
miner, | ||
minerTokenAccount, | ||
destinationTokenAccount, | ||
tokenProgram: token_utils_1.TOKEN_PROGRAM_ID, | ||
quarryMineProgram: constants_1.QUARRY_ADDRESSES.Mine, | ||
}, | ||
}); | ||
return new solana_contrib_1.TransactionEnvelope(this.provider, [withdrawTokensIX]); | ||
} | ||
} | ||
exports.MergeMine = MergeMine; | ||
//# sourceMappingURL=quarryMergeMine.js.map |
@@ -26,3 +26,13 @@ import type { Provider, TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
loadRewarderWrapper(rewarder: PublicKey): Promise<RewarderWrapper>; | ||
/** | ||
* Rescue stuck tokens in a miner. | ||
* @returns | ||
*/ | ||
rescueTokens({ mint, miner, minerTokenAccount, owner, }: { | ||
mint: PublicKey; | ||
miner: PublicKey; | ||
minerTokenAccount: PublicKey; | ||
owner?: PublicKey; | ||
}): Promise<TransactionEnvelope>; | ||
} | ||
//# sourceMappingURL=mine.d.ts.map |
@@ -64,4 +64,31 @@ "use strict"; | ||
} | ||
/** | ||
* Rescue stuck tokens in a miner. | ||
* @returns | ||
*/ | ||
rescueTokens({ mint, miner, minerTokenAccount, owner = this.provider.wallet.publicKey, }) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const instructions = []; | ||
const { address: destinationTokenAccount, instruction: ataInstruction } = yield (0, token_utils_1.getOrCreateATA)({ | ||
provider: this.provider, | ||
mint, | ||
owner, | ||
}); | ||
if (ataInstruction) { | ||
instructions.push(ataInstruction); | ||
} | ||
instructions.push(this.program.instruction.rescueTokens({ | ||
accounts: { | ||
authority: owner, | ||
miner, | ||
minerTokenAccount, | ||
destinationTokenAccount, | ||
tokenProgram: token_utils_1.TOKEN_PROGRAM_ID, | ||
}, | ||
})); | ||
return this.sdk.newTx(instructions); | ||
}); | ||
} | ||
} | ||
exports.MineWrapper = MineWrapper; | ||
//# sourceMappingURL=mine.js.map |
import type { Provider } from "@saberhq/solana-contrib"; | ||
import { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import type { Token } from "@saberhq/token-utils"; | ||
import { u64 } from "@saberhq/token-utils"; | ||
import type { ProgramAccount } from "@saberhq/token-utils"; | ||
import { Token, u64 } from "@saberhq/token-utils"; | ||
import type { PublicKey } from "@solana/web3.js"; | ||
import type { MineProgram, MinerData, QuarryData, RewarderData } from "../../programs/mine"; | ||
import type { QuarrySDK } from "../../sdk"; | ||
import { QuarrySDK } from "../../sdk"; | ||
import { MinerWrapper } from "./miner"; | ||
@@ -46,2 +46,3 @@ import { Payroll } from "./payroll"; | ||
key: PublicKey); | ||
static fromData(provider: Provider, rewarder: ProgramAccount<RewarderData>, quarry: ProgramAccount<QuarryData>): QuarryWrapper; | ||
/** | ||
@@ -48,0 +49,0 @@ * The program. |
@@ -7,2 +7,3 @@ "use strict"; | ||
const token_utils_1 = require("@saberhq/token-utils"); | ||
const sdk_1 = require("../../sdk"); | ||
const miner_1 = require("./miner"); | ||
@@ -35,2 +36,5 @@ const payroll_1 = require("./payroll"); | ||
} | ||
static fromData(provider, rewarder, quarry) { | ||
return new QuarryWrapper(sdk_1.QuarrySDK.load({ provider }), token_utils_1.Token.fromMint(quarry.account.tokenMintKey, quarry.account.tokenMintDecimals), rewarder.account, quarry.account, quarry.publicKey); | ||
} | ||
/** | ||
@@ -37,0 +41,0 @@ * The program. |
@@ -0,6 +1,7 @@ | ||
import type { Provider } from "@saberhq/solana-contrib"; | ||
import { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import type { Token, u64 } from "@saberhq/token-utils"; | ||
import type { ProgramAccount, Token, u64 } from "@saberhq/token-utils"; | ||
import type { PublicKey } from "@solana/web3.js"; | ||
import type { MineProgram, RewarderData } from "../../programs/mine"; | ||
import type { QuarrySDK } from "../../sdk"; | ||
import { QuarrySDK } from "../../sdk"; | ||
import type { MineWrapper } from "."; | ||
@@ -16,2 +17,3 @@ import { QuarryWrapper } from "./quarry"; | ||
constructor(mineWrapper: MineWrapper, rewarderKey: PublicKey, rewarderData: RewarderData); | ||
static fromData(provider: Provider, rewarder: ProgramAccount<RewarderData>): RewarderWrapper; | ||
/** | ||
@@ -18,0 +20,0 @@ * Gets the quarry associated with the given token. |
@@ -7,2 +7,3 @@ "use strict"; | ||
const web3_js_1 = require("@solana/web3.js"); | ||
const sdk_1 = require("../../sdk"); | ||
const pda_1 = require("./pda"); | ||
@@ -18,2 +19,5 @@ const quarry_1 = require("./quarry"); | ||
} | ||
static fromData(provider, rewarder) { | ||
return new RewarderWrapper(sdk_1.QuarrySDK.load({ provider }).mine, rewarder.publicKey, rewarder.account); | ||
} | ||
/** | ||
@@ -20,0 +24,0 @@ * Gets the quarry associated with the given token. |
export declare type QuarryMergeMineIDL = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_merge_mine"; | ||
@@ -528,2 +528,48 @@ instructions: [ | ||
{ | ||
name: "rescueTokens"; | ||
accounts: [ | ||
{ | ||
name: "mmOwner"; | ||
isMut: false; | ||
isSigner: true; | ||
}, | ||
{ | ||
name: "mergePool"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "mm"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "miner"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "minerTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "destinationTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "quarryMineProgram"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "tokenProgram"; | ||
isMut: false; | ||
isSigner: false; | ||
} | ||
]; | ||
args: []; | ||
}, | ||
{ | ||
name: "claimRewards"; | ||
@@ -968,3 +1014,3 @@ accounts: [ | ||
export declare type AnchorQuarryMergeMine = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_merge_mine"; | ||
@@ -1495,2 +1541,48 @@ instructions: [ | ||
{ | ||
name: "rescueTokens"; | ||
accounts: [ | ||
{ | ||
name: "mmOwner"; | ||
isMut: false; | ||
isSigner: true; | ||
}, | ||
{ | ||
name: "mergePool"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "mm"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "miner"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "minerTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "destinationTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "quarryMineProgram"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "tokenProgram"; | ||
isMut: false; | ||
isSigner: false; | ||
} | ||
]; | ||
args: []; | ||
}, | ||
{ | ||
name: "claimRewards"; | ||
@@ -1497,0 +1589,0 @@ accounts: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export const AnchorQuarryMergeMineIDL = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_merge_mine", | ||
@@ -529,2 +529,48 @@ instructions: [ | ||
{ | ||
name: "rescueTokens", | ||
accounts: [ | ||
{ | ||
name: "mmOwner", | ||
isMut: false, | ||
isSigner: true, | ||
}, | ||
{ | ||
name: "mergePool", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "mm", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "miner", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "minerTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "destinationTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "quarryMineProgram", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "tokenProgram", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
], | ||
args: [], | ||
}, | ||
{ | ||
name: "claimRewards", | ||
@@ -969,3 +1015,3 @@ accounts: [ | ||
export const QuarryMergeMineJSON = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_merge_mine", | ||
@@ -1496,2 +1542,48 @@ instructions: [ | ||
{ | ||
name: "rescueTokens", | ||
accounts: [ | ||
{ | ||
name: "mmOwner", | ||
isMut: false, | ||
isSigner: true, | ||
}, | ||
{ | ||
name: "mergePool", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "mm", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "miner", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "minerTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "destinationTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "quarryMineProgram", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "tokenProgram", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
], | ||
args: [], | ||
}, | ||
{ | ||
name: "claimRewards", | ||
@@ -1498,0 +1590,0 @@ accounts: [ |
export declare type QuarryMineIDL = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_mine"; | ||
@@ -593,2 +593,33 @@ instructions: [ | ||
{ | ||
name: "rescueTokens"; | ||
accounts: [ | ||
{ | ||
name: "miner"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "authority"; | ||
isMut: false; | ||
isSigner: true; | ||
}, | ||
{ | ||
name: "minerTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "destinationTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "tokenProgram"; | ||
isMut: false; | ||
isSigner: false; | ||
} | ||
]; | ||
args: []; | ||
}, | ||
{ | ||
name: "extractFees"; | ||
@@ -1040,3 +1071,3 @@ accounts: [ | ||
export declare type AnchorQuarryMine = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_mine"; | ||
@@ -1632,2 +1663,33 @@ instructions: [ | ||
{ | ||
name: "rescueTokens"; | ||
accounts: [ | ||
{ | ||
name: "miner"; | ||
isMut: false; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "authority"; | ||
isMut: false; | ||
isSigner: true; | ||
}, | ||
{ | ||
name: "minerTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "destinationTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "tokenProgram"; | ||
isMut: false; | ||
isSigner: false; | ||
} | ||
]; | ||
args: []; | ||
}, | ||
{ | ||
name: "extractFees"; | ||
@@ -1634,0 +1696,0 @@ accounts: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export const AnchorQuarryMineIDL = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_mine", | ||
@@ -594,2 +594,33 @@ instructions: [ | ||
{ | ||
name: "rescueTokens", | ||
accounts: [ | ||
{ | ||
name: "miner", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "authority", | ||
isMut: false, | ||
isSigner: true, | ||
}, | ||
{ | ||
name: "minerTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "destinationTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "tokenProgram", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
], | ||
args: [], | ||
}, | ||
{ | ||
name: "extractFees", | ||
@@ -1041,3 +1072,3 @@ accounts: [ | ||
export const QuarryMineJSON = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_mine", | ||
@@ -1633,2 +1664,33 @@ instructions: [ | ||
{ | ||
name: "rescueTokens", | ||
accounts: [ | ||
{ | ||
name: "miner", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "authority", | ||
isMut: false, | ||
isSigner: true, | ||
}, | ||
{ | ||
name: "minerTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "destinationTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "tokenProgram", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
], | ||
args: [], | ||
}, | ||
{ | ||
name: "extractFees", | ||
@@ -1635,0 +1697,0 @@ accounts: [ |
export declare type QuarryMintWrapperIDL = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_mint_wrapper"; | ||
@@ -486,3 +486,3 @@ instructions: [ | ||
export declare type AnchorQuarryMintWrapper = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_mint_wrapper"; | ||
@@ -489,0 +489,0 @@ instructions: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export const AnchorQuarryMintWrapperIDL = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_mint_wrapper", | ||
@@ -487,3 +487,3 @@ instructions: [ | ||
export const QuarryMintWrapperJSON = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_mint_wrapper", | ||
@@ -490,0 +490,0 @@ instructions: [ |
export declare type QuarryOperatorIDL = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_operator"; | ||
@@ -389,3 +389,3 @@ instructions: [ | ||
export declare type AnchorQuarryOperator = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_operator"; | ||
@@ -392,0 +392,0 @@ instructions: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export const AnchorQuarryOperatorIDL = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_operator", | ||
@@ -390,3 +390,3 @@ instructions: [ | ||
export const QuarryOperatorJSON = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_operator", | ||
@@ -393,0 +393,0 @@ instructions: [ |
export declare type QuarryRedeemerIDL = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_redeemer"; | ||
@@ -217,3 +217,3 @@ instructions: [ | ||
export declare type AnchorQuarryRedeemer = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_redeemer"; | ||
@@ -220,0 +220,0 @@ instructions: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export const AnchorQuarryRedeemerIDL = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_redeemer", | ||
@@ -218,3 +218,3 @@ instructions: [ | ||
export const QuarryRedeemerJSON = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_redeemer", | ||
@@ -221,0 +221,0 @@ instructions: [ |
export declare type QuarryRegistryIDL = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_registry"; | ||
@@ -98,3 +98,3 @@ instructions: [ | ||
export declare type AnchorQuarryRegistry = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_registry"; | ||
@@ -101,0 +101,0 @@ instructions: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export const AnchorQuarryRegistryIDL = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_registry", | ||
@@ -99,3 +99,3 @@ instructions: [ | ||
export const QuarryRegistryJSON = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_registry", | ||
@@ -102,0 +102,0 @@ instructions: [ |
@@ -104,3 +104,14 @@ import type { Provider } from "@saberhq/solana-contrib"; | ||
}): MergePool; | ||
/** | ||
* Rescue stuck tokens in a merge miner. | ||
* @returns | ||
*/ | ||
rescueTokens({ mergePool, mergeMiner, miner, minerTokenAccount, destinationTokenAccount, }: { | ||
mergePool: PublicKey; | ||
mergeMiner: PublicKey; | ||
miner: PublicKey; | ||
minerTokenAccount: PublicKey; | ||
destinationTokenAccount: PublicKey; | ||
}): TransactionEnvelope; | ||
} | ||
//# sourceMappingURL=quarryMergeMine.d.ts.map |
@@ -5,2 +5,3 @@ import { __awaiter } from "tslib"; | ||
import { SystemProgram, SYSVAR_RENT_PUBKEY } from "@solana/web3.js"; | ||
import { QUARRY_ADDRESSES } from "../../constants"; | ||
import { findMinerAddress, findQuarryAddress } from "../mine/pda"; | ||
@@ -237,3 +238,22 @@ import { MergeMiner } from "./mergeMiner"; | ||
} | ||
/** | ||
* Rescue stuck tokens in a merge miner. | ||
* @returns | ||
*/ | ||
rescueTokens({ mergePool, mergeMiner, miner, minerTokenAccount, destinationTokenAccount, }) { | ||
const withdrawTokensIX = this.program.instruction.rescueTokens({ | ||
accounts: { | ||
mmOwner: this.provider.wallet.publicKey, | ||
mergePool, | ||
mm: mergeMiner, | ||
miner, | ||
minerTokenAccount, | ||
destinationTokenAccount, | ||
tokenProgram: TOKEN_PROGRAM_ID, | ||
quarryMineProgram: QUARRY_ADDRESSES.Mine, | ||
}, | ||
}); | ||
return new TransactionEnvelope(this.provider, [withdrawTokensIX]); | ||
} | ||
} | ||
//# sourceMappingURL=quarryMergeMine.js.map |
@@ -26,3 +26,13 @@ import type { Provider, TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
loadRewarderWrapper(rewarder: PublicKey): Promise<RewarderWrapper>; | ||
/** | ||
* Rescue stuck tokens in a miner. | ||
* @returns | ||
*/ | ||
rescueTokens({ mint, miner, minerTokenAccount, owner, }: { | ||
mint: PublicKey; | ||
miner: PublicKey; | ||
minerTokenAccount: PublicKey; | ||
owner?: PublicKey; | ||
}): Promise<TransactionEnvelope>; | ||
} | ||
//# sourceMappingURL=mine.d.ts.map |
import { __awaiter } from "tslib"; | ||
import { getOrCreateATA } from "@saberhq/token-utils"; | ||
import { getOrCreateATA, TOKEN_PROGRAM_ID } from "@saberhq/token-utils"; | ||
import { Keypair, SystemProgram, SYSVAR_CLOCK_PUBKEY } from "@solana/web3.js"; | ||
@@ -61,3 +61,30 @@ import { findRewarderAddress } from "./pda"; | ||
} | ||
/** | ||
* Rescue stuck tokens in a miner. | ||
* @returns | ||
*/ | ||
rescueTokens({ mint, miner, minerTokenAccount, owner = this.provider.wallet.publicKey, }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const instructions = []; | ||
const { address: destinationTokenAccount, instruction: ataInstruction } = yield getOrCreateATA({ | ||
provider: this.provider, | ||
mint, | ||
owner, | ||
}); | ||
if (ataInstruction) { | ||
instructions.push(ataInstruction); | ||
} | ||
instructions.push(this.program.instruction.rescueTokens({ | ||
accounts: { | ||
authority: owner, | ||
miner, | ||
minerTokenAccount, | ||
destinationTokenAccount, | ||
tokenProgram: TOKEN_PROGRAM_ID, | ||
}, | ||
})); | ||
return this.sdk.newTx(instructions); | ||
}); | ||
} | ||
} | ||
//# sourceMappingURL=mine.js.map |
import type { Provider } from "@saberhq/solana-contrib"; | ||
import { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import type { Token } from "@saberhq/token-utils"; | ||
import { u64 } from "@saberhq/token-utils"; | ||
import type { ProgramAccount } from "@saberhq/token-utils"; | ||
import { Token, u64 } from "@saberhq/token-utils"; | ||
import type { PublicKey } from "@solana/web3.js"; | ||
import type { MineProgram, MinerData, QuarryData, RewarderData } from "../../programs/mine"; | ||
import type { QuarrySDK } from "../../sdk"; | ||
import { QuarrySDK } from "../../sdk"; | ||
import { MinerWrapper } from "./miner"; | ||
@@ -46,2 +46,3 @@ import { Payroll } from "./payroll"; | ||
key: PublicKey); | ||
static fromData(provider: Provider, rewarder: ProgramAccount<RewarderData>, quarry: ProgramAccount<QuarryData>): QuarryWrapper; | ||
/** | ||
@@ -48,0 +49,0 @@ * The program. |
import { __awaiter } from "tslib"; | ||
import { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import { getATAAddress, getOrCreateATA, u64 } from "@saberhq/token-utils"; | ||
import { getATAAddress, getOrCreateATA, Token, u64, } from "@saberhq/token-utils"; | ||
import { QuarrySDK } from "../../sdk"; | ||
import { MinerWrapper } from "./miner"; | ||
@@ -31,2 +32,5 @@ import { Payroll } from "./payroll"; | ||
} | ||
static fromData(provider, rewarder, quarry) { | ||
return new QuarryWrapper(QuarrySDK.load({ provider }), Token.fromMint(quarry.account.tokenMintKey, quarry.account.tokenMintDecimals), rewarder.account, quarry.account, quarry.publicKey); | ||
} | ||
/** | ||
@@ -33,0 +37,0 @@ * The program. |
@@ -0,6 +1,7 @@ | ||
import type { Provider } from "@saberhq/solana-contrib"; | ||
import { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import type { Token, u64 } from "@saberhq/token-utils"; | ||
import type { ProgramAccount, Token, u64 } from "@saberhq/token-utils"; | ||
import type { PublicKey } from "@solana/web3.js"; | ||
import type { MineProgram, RewarderData } from "../../programs/mine"; | ||
import type { QuarrySDK } from "../../sdk"; | ||
import { QuarrySDK } from "../../sdk"; | ||
import type { MineWrapper } from "."; | ||
@@ -16,2 +17,3 @@ import { QuarryWrapper } from "./quarry"; | ||
constructor(mineWrapper: MineWrapper, rewarderKey: PublicKey, rewarderData: RewarderData); | ||
static fromData(provider: Provider, rewarder: ProgramAccount<RewarderData>): RewarderWrapper; | ||
/** | ||
@@ -18,0 +20,0 @@ * Gets the quarry associated with the given token. |
import { __awaiter } from "tslib"; | ||
import { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import { SystemProgram, SYSVAR_CLOCK_PUBKEY } from "@solana/web3.js"; | ||
import { QuarrySDK } from "../../sdk"; | ||
import { findQuarryAddress } from "./pda"; | ||
@@ -14,2 +15,5 @@ import { QuarryWrapper } from "./quarry"; | ||
} | ||
static fromData(provider, rewarder) { | ||
return new RewarderWrapper(QuarrySDK.load({ provider }).mine, rewarder.publicKey, rewarder.account); | ||
} | ||
/** | ||
@@ -16,0 +20,0 @@ * Gets the quarry associated with the given token. |
{ | ||
"name": "@quarryprotocol/quarry-sdk", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "Quarry Protocol SDK", | ||
@@ -35,8 +35,8 @@ "keywords": [ | ||
"@rushstack/eslint-patch": "^1.1.1", | ||
"@saberhq/anchor-contrib": "^1.12.55", | ||
"@saberhq/chai-solana": "^1.12.55", | ||
"@saberhq/eslint-config": "^1.12.55", | ||
"@saberhq/solana-contrib": "^1.12.55", | ||
"@saberhq/token-utils": "^1.12.55", | ||
"@saberhq/tsconfig": "^1.12.55", | ||
"@saberhq/anchor-contrib": "^1.12.57", | ||
"@saberhq/chai-solana": "^1.12.57", | ||
"@saberhq/eslint-config": "^1.12.57", | ||
"@saberhq/solana-contrib": "^1.12.57", | ||
"@saberhq/token-utils": "^1.12.57", | ||
"@saberhq/tsconfig": "^1.12.57", | ||
"@solana/web3.js": "^1.36.0", | ||
@@ -43,0 +43,0 @@ "@types/bn.js": "^5.1.0", |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export type QuarryMintWrapperIDL = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_mint_wrapper"; | ||
@@ -488,3 +488,3 @@ instructions: [ | ||
export type AnchorQuarryMintWrapper = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_mint_wrapper"; | ||
@@ -974,3 +974,3 @@ instructions: [ | ||
export const AnchorQuarryMintWrapperIDL: AnchorQuarryMintWrapper = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_mint_wrapper", | ||
@@ -1459,3 +1459,3 @@ instructions: [ | ||
export const QuarryMintWrapperJSON: QuarryMintWrapperIDL = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_mint_wrapper", | ||
@@ -1462,0 +1462,0 @@ instructions: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export type QuarryOperatorIDL = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_operator"; | ||
@@ -391,3 +391,3 @@ instructions: [ | ||
export type AnchorQuarryOperator = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_operator"; | ||
@@ -780,3 +780,3 @@ instructions: [ | ||
export const AnchorQuarryOperatorIDL: AnchorQuarryOperator = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_operator", | ||
@@ -1168,3 +1168,3 @@ instructions: [ | ||
export const QuarryOperatorJSON: QuarryOperatorIDL = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_operator", | ||
@@ -1171,0 +1171,0 @@ instructions: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export type QuarryRedeemerIDL = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_redeemer"; | ||
@@ -219,3 +219,3 @@ instructions: [ | ||
export type AnchorQuarryRedeemer = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_redeemer"; | ||
@@ -436,3 +436,3 @@ instructions: [ | ||
export const AnchorQuarryRedeemerIDL: AnchorQuarryRedeemer = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_redeemer", | ||
@@ -652,3 +652,3 @@ instructions: [ | ||
export const QuarryRedeemerJSON: QuarryRedeemerIDL = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_redeemer", | ||
@@ -655,0 +655,0 @@ instructions: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export type QuarryRegistryIDL = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_registry"; | ||
@@ -100,3 +100,3 @@ instructions: [ | ||
export type AnchorQuarryRegistry = { | ||
version: "4.0.0"; | ||
version: "4.1.0"; | ||
name: "quarry_registry"; | ||
@@ -198,3 +198,3 @@ instructions: [ | ||
export const AnchorQuarryRegistryIDL: AnchorQuarryRegistry = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_registry", | ||
@@ -295,3 +295,3 @@ instructions: [ | ||
export const QuarryRegistryJSON: QuarryRegistryIDL = { | ||
version: "4.0.0", | ||
version: "4.1.0", | ||
name: "quarry_registry", | ||
@@ -298,0 +298,0 @@ instructions: [ |
@@ -14,2 +14,3 @@ import type { Provider } from "@saberhq/solana-contrib"; | ||
import type { Programs } from "../../constants"; | ||
import { QUARRY_ADDRESSES } from "../../constants"; | ||
import type { | ||
@@ -347,2 +348,34 @@ MergeMinerData, | ||
} | ||
/** | ||
* Rescue stuck tokens in a merge miner. | ||
* @returns | ||
*/ | ||
rescueTokens({ | ||
mergePool, | ||
mergeMiner, | ||
miner, | ||
minerTokenAccount, | ||
destinationTokenAccount, | ||
}: { | ||
mergePool: PublicKey; | ||
mergeMiner: PublicKey; | ||
miner: PublicKey; | ||
minerTokenAccount: PublicKey; | ||
destinationTokenAccount: PublicKey; | ||
}): TransactionEnvelope { | ||
const withdrawTokensIX = this.program.instruction.rescueTokens({ | ||
accounts: { | ||
mmOwner: this.provider.wallet.publicKey, | ||
mergePool, | ||
mm: mergeMiner, | ||
miner, | ||
minerTokenAccount, | ||
destinationTokenAccount, | ||
tokenProgram: TOKEN_PROGRAM_ID, | ||
quarryMineProgram: QUARRY_ADDRESSES.Mine, | ||
}, | ||
}); | ||
return new TransactionEnvelope(this.provider, [withdrawTokensIX]); | ||
} | ||
} |
import type { Provider, TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import { getOrCreateATA } from "@saberhq/token-utils"; | ||
import type { PublicKey } from "@solana/web3.js"; | ||
import { getOrCreateATA, TOKEN_PROGRAM_ID } from "@saberhq/token-utils"; | ||
import type { PublicKey, TransactionInstruction } from "@solana/web3.js"; | ||
import { Keypair, SystemProgram, SYSVAR_CLOCK_PUBKEY } from "@solana/web3.js"; | ||
@@ -93,2 +93,43 @@ | ||
} | ||
/** | ||
* Rescue stuck tokens in a miner. | ||
* @returns | ||
*/ | ||
async rescueTokens({ | ||
mint, | ||
miner, | ||
minerTokenAccount, | ||
owner = this.provider.wallet.publicKey, | ||
}: { | ||
mint: PublicKey; | ||
miner: PublicKey; | ||
minerTokenAccount: PublicKey; | ||
owner?: PublicKey; | ||
}): Promise<TransactionEnvelope> { | ||
const instructions: TransactionInstruction[] = []; | ||
const { address: destinationTokenAccount, instruction: ataInstruction } = | ||
await getOrCreateATA({ | ||
provider: this.provider, | ||
mint, | ||
owner, | ||
}); | ||
if (ataInstruction) { | ||
instructions.push(ataInstruction); | ||
} | ||
instructions.push( | ||
this.program.instruction.rescueTokens({ | ||
accounts: { | ||
authority: owner, | ||
miner, | ||
minerTokenAccount, | ||
destinationTokenAccount, | ||
tokenProgram: TOKEN_PROGRAM_ID, | ||
}, | ||
}) | ||
); | ||
return this.sdk.newTx(instructions); | ||
} | ||
} |
import type { Provider } from "@saberhq/solana-contrib"; | ||
import { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import type { Token } from "@saberhq/token-utils"; | ||
import { getATAAddress, getOrCreateATA, u64 } from "@saberhq/token-utils"; | ||
import type { ProgramAccount } from "@saberhq/token-utils"; | ||
import { | ||
getATAAddress, | ||
getOrCreateATA, | ||
Token, | ||
u64, | ||
} from "@saberhq/token-utils"; | ||
import type { PublicKey } from "@solana/web3.js"; | ||
@@ -13,3 +18,3 @@ | ||
} from "../../programs/mine"; | ||
import type { QuarrySDK } from "../../sdk"; | ||
import { QuarrySDK } from "../../sdk"; | ||
import { MinerWrapper } from "./miner"; | ||
@@ -41,2 +46,19 @@ import { Payroll } from "./payroll"; | ||
static fromData( | ||
provider: Provider, | ||
rewarder: ProgramAccount<RewarderData>, | ||
quarry: ProgramAccount<QuarryData> | ||
): QuarryWrapper { | ||
return new QuarryWrapper( | ||
QuarrySDK.load({ provider }), | ||
Token.fromMint( | ||
quarry.account.tokenMintKey, | ||
quarry.account.tokenMintDecimals | ||
), | ||
rewarder.account, | ||
quarry.account, | ||
quarry.publicKey | ||
); | ||
} | ||
/** | ||
@@ -43,0 +65,0 @@ * The program. |
@@ -0,3 +1,4 @@ | ||
import type { Provider } from "@saberhq/solana-contrib"; | ||
import { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import type { Token, u64 } from "@saberhq/token-utils"; | ||
import type { ProgramAccount, Token, u64 } from "@saberhq/token-utils"; | ||
import type { PublicKey, TransactionInstruction } from "@solana/web3.js"; | ||
@@ -7,3 +8,3 @@ import { SystemProgram, SYSVAR_CLOCK_PUBKEY } from "@solana/web3.js"; | ||
import type { MineProgram, RewarderData } from "../../programs/mine"; | ||
import type { QuarrySDK } from "../../sdk"; | ||
import { QuarrySDK } from "../../sdk"; | ||
import type { MineWrapper } from "."; | ||
@@ -27,2 +28,13 @@ import { findQuarryAddress } from "./pda"; | ||
static fromData( | ||
provider: Provider, | ||
rewarder: ProgramAccount<RewarderData> | ||
): RewarderWrapper { | ||
return new RewarderWrapper( | ||
QuarrySDK.load({ provider }).mine, | ||
rewarder.publicKey, | ||
rewarder.account | ||
); | ||
} | ||
/** | ||
@@ -29,0 +41,0 @@ * Gets the quarry associated with the given token. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2819654
49973