@quarryprotocol/quarry-sdk
Advanced tools
Comparing version 4.2.0 to 4.2.1
@@ -10,2 +10,9 @@ # Quarry Protocol Changelog | ||
## [v4.2.1] | ||
### Features | ||
- Update to Anchor v0.24. | ||
- Add support for Neodyme's [security.txt](https://github.com/neodyme-labs/solana-security-txt) standard. | ||
## [v4.2.0] | ||
@@ -12,0 +19,0 @@ |
export declare type QuarryMergeMineIDL = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_merge_mine"; | ||
@@ -1013,3 +1013,3 @@ instructions: [ | ||
export declare type AnchorQuarryMergeMine = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_merge_mine"; | ||
@@ -1016,0 +1016,0 @@ instructions: [ |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.AnchorQuarryMergeMineIDL = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_merge_mine", | ||
@@ -1018,3 +1018,3 @@ instructions: [ | ||
exports.QuarryMergeMineJSON = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_merge_mine", | ||
@@ -1021,0 +1021,0 @@ instructions: [ |
export declare type QuarryMineIDL = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_mine"; | ||
@@ -1070,3 +1070,3 @@ instructions: [ | ||
export declare type AnchorQuarryMine = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_mine"; | ||
@@ -1073,0 +1073,0 @@ instructions: [ |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.AnchorQuarryMineIDL = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_mine", | ||
@@ -1075,3 +1075,3 @@ instructions: [ | ||
exports.QuarryMineJSON = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_mine", | ||
@@ -1078,0 +1078,0 @@ instructions: [ |
export declare type QuarryMintWrapperIDL = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_mint_wrapper"; | ||
@@ -486,3 +486,3 @@ instructions: [ | ||
export declare type AnchorQuarryMintWrapper = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_mint_wrapper"; | ||
@@ -489,0 +489,0 @@ instructions: [ |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.AnchorQuarryMintWrapperIDL = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_mint_wrapper", | ||
@@ -491,3 +491,3 @@ instructions: [ | ||
exports.QuarryMintWrapperJSON = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_mint_wrapper", | ||
@@ -494,0 +494,0 @@ instructions: [ |
export declare type QuarryOperatorIDL = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_operator"; | ||
@@ -389,3 +389,3 @@ instructions: [ | ||
export declare type AnchorQuarryOperator = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_operator"; | ||
@@ -392,0 +392,0 @@ instructions: [ |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.AnchorQuarryOperatorIDL = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_operator", | ||
@@ -394,3 +394,3 @@ instructions: [ | ||
exports.QuarryOperatorJSON = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_operator", | ||
@@ -397,0 +397,0 @@ instructions: [ |
export declare type QuarryRedeemerIDL = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_redeemer"; | ||
@@ -217,3 +217,3 @@ instructions: [ | ||
export declare type AnchorQuarryRedeemer = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_redeemer"; | ||
@@ -220,0 +220,0 @@ instructions: [ |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.AnchorQuarryRedeemerIDL = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_redeemer", | ||
@@ -222,3 +222,3 @@ instructions: [ | ||
exports.QuarryRedeemerJSON = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_redeemer", | ||
@@ -225,0 +225,0 @@ instructions: [ |
export declare type QuarryRegistryIDL = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_registry"; | ||
@@ -98,3 +98,3 @@ instructions: [ | ||
export declare type AnchorQuarryRegistry = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_registry"; | ||
@@ -101,0 +101,0 @@ instructions: [ |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.AnchorQuarryRegistryIDL = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_registry", | ||
@@ -103,3 +103,3 @@ instructions: [ | ||
exports.QuarryRegistryJSON = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_registry", | ||
@@ -106,0 +106,0 @@ instructions: [ |
import type { Program } from "@project-serum/anchor"; | ||
import type { AugmentedProvider, Provider, TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import type { PublicKey, Signer, TransactionInstruction } from "@solana/web3.js"; | ||
import { Keypair } from "@solana/web3.js"; | ||
import type { Programs } from "./constants"; | ||
@@ -64,3 +63,3 @@ import type { PendingRedeemer } from "./programs/redeemer"; | ||
admin?: PublicKey; | ||
baseKP?: Keypair; | ||
baseKP?: Signer; | ||
payer?: PublicKey; | ||
@@ -67,0 +66,0 @@ }): Promise<{ |
import type { Provider, TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import type { PublicKey } from "@solana/web3.js"; | ||
import { Keypair } from "@solana/web3.js"; | ||
import type { PublicKey, Signer } from "@solana/web3.js"; | ||
import type { MineProgram } from "../../programs/mine"; | ||
@@ -14,3 +13,3 @@ import type { QuarrySDK } from "../../sdk"; | ||
mintWrapper: PublicKey; | ||
baseKP?: Keypair; | ||
baseKP?: Signer; | ||
authority?: PublicKey; | ||
@@ -17,0 +16,0 @@ }): Promise<{ |
@@ -19,3 +19,3 @@ "use strict"; | ||
} | ||
createRewarder({ mintWrapper, baseKP = web3_js_1.Keypair.generate(), authority = this.program.provider.wallet.publicKey, }) { | ||
createRewarder({ mintWrapper, baseKP = web3_js_1.Keypair.generate(), authority = this.provider.wallet.publicKey, }) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
@@ -42,3 +42,3 @@ const [rewarderKey, bump] = yield (0, pda_1.findRewarderAddress)(baseKP.publicKey, this.program.programId); | ||
rewarder: rewarderKey, | ||
payer: this.program.provider.wallet.publicKey, | ||
payer: this.provider.wallet.publicKey, | ||
systemProgram: web3_js_1.SystemProgram.programId, | ||
@@ -45,0 +45,0 @@ unusedClock: web3_js_1.SYSVAR_CLOCK_PUBKEY, |
@@ -53,3 +53,3 @@ "use strict"; | ||
systemProgram: web3_js_1.SystemProgram.programId, | ||
payer: this.program.provider.wallet.publicKey, | ||
payer: this.provider.wallet.publicKey, | ||
minerVault: this.tokenVaultKey, | ||
@@ -56,0 +56,0 @@ rewarder: this.quarry.quarryData.rewarderKey, |
import BN from "bn.js"; | ||
export declare const ZERO: BN; | ||
export declare const BASE_TEN: BN; | ||
export declare const MAX_U64_BN: BN; | ||
export declare const SECONDS_PER_YEAR: BN; | ||
export declare class Payroll { | ||
@@ -13,6 +15,6 @@ readonly famineTs: BN; | ||
* Calculates the amount of tokens that this user can receive. | ||
* @param current_ts | ||
* @param currentTs | ||
* @returns | ||
*/ | ||
calculateRewardPerToken(current_ts: BN): BN; | ||
calculateRewardPerToken(currentTs: BN): BN; | ||
/** | ||
@@ -19,0 +21,0 @@ * Calculates the amount of tokens that this user can claim. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Payroll = exports.BASE_TEN = exports.ZERO = void 0; | ||
exports.Payroll = exports.SECONDS_PER_YEAR = exports.MAX_U64_BN = exports.BASE_TEN = exports.ZERO = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -9,2 +9,4 @@ const token_utils_1 = require("@saberhq/token-utils"); | ||
exports.BASE_TEN = new bn_js_1.default(10); | ||
exports.MAX_U64_BN = new bn_js_1.default(token_utils_1.MAX_U64.toString()); | ||
exports.SECONDS_PER_YEAR = new bn_js_1.default(365 * 86400); | ||
class Payroll { | ||
@@ -20,15 +22,15 @@ constructor(famineTs, lastCheckpointTs, annualRewardsRate, rewardsPerTokenStored, totalTokensDeposited) { | ||
* Calculates the amount of tokens that this user can receive. | ||
* @param current_ts | ||
* @param currentTs | ||
* @returns | ||
*/ | ||
calculateRewardPerToken(current_ts) { | ||
calculateRewardPerToken(currentTs) { | ||
if (this.totalTokensDeposited.isZero()) { | ||
return this.rewardsPerTokenStored; | ||
} | ||
const lastTimeRewardsApplicable = bn_js_1.default.min(current_ts, this.famineTs); | ||
const lastTimeRewardsApplicable = bn_js_1.default.min(currentTs, this.famineTs); | ||
const timeWorked = bn_js_1.default.max(exports.ZERO, lastTimeRewardsApplicable.sub(this.lastCheckpointTs)); | ||
const reward = timeWorked | ||
.mul(new bn_js_1.default(token_utils_1.MAX_U64.toString())) | ||
.mul(exports.MAX_U64_BN) | ||
.mul(this.annualRewardsRate) | ||
.div(new bn_js_1.default(365 * 86400)) | ||
.div(exports.SECONDS_PER_YEAR) | ||
.div(this.totalTokensDeposited); | ||
@@ -47,5 +49,3 @@ return this.rewardsPerTokenStored.add(reward); | ||
const netNewRewards = this.calculateRewardPerToken(currentTs).sub(rewardsPerTokenPaid); | ||
const earnedRewards = tokensDeposited | ||
.mul(netNewRewards) | ||
.div(new bn_js_1.default(token_utils_1.MAX_U64.toString())); | ||
const earnedRewards = tokensDeposited.mul(netNewRewards).div(exports.MAX_U64_BN); | ||
return earnedRewards.add(rewardsEarned); | ||
@@ -52,0 +52,0 @@ } |
@@ -110,3 +110,3 @@ "use strict"; | ||
*/ | ||
getMinerActions(authority = this.program.provider.wallet.publicKey) { | ||
getMinerActions(authority = this.provider.wallet.publicKey) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
@@ -171,3 +171,3 @@ const miner = yield this.getMinerAddress(authority); | ||
*/ | ||
createMiner({ authority = this.program.provider.wallet.publicKey, } = {}) { | ||
createMiner({ authority = this.provider.wallet.publicKey, } = {}) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
@@ -174,0 +174,0 @@ const [miner, bump] = yield (0, pda_1.findMinerAddress)(this.key, authority, this.program.programId); |
@@ -1,2 +0,2 @@ | ||
import type { Provider } from "@saberhq/solana-contrib"; | ||
import type { AugmentedProvider, Provider } from "@saberhq/solana-contrib"; | ||
import { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
@@ -17,2 +17,3 @@ import type { ProgramAccount, Token, u64 } from "@saberhq/token-utils"; | ||
constructor(mineWrapper: MineWrapper, rewarderKey: PublicKey, rewarderData: RewarderData); | ||
get provider(): AugmentedProvider; | ||
static fromData(provider: Provider, rewarder: ProgramAccount<RewarderData>): RewarderWrapper; | ||
@@ -19,0 +20,0 @@ /** |
@@ -18,2 +18,5 @@ "use strict"; | ||
} | ||
get provider() { | ||
return this.sdk.provider; | ||
} | ||
static fromData(provider, rewarder) { | ||
@@ -63,3 +66,3 @@ return new RewarderWrapper(sdk_1.QuarrySDK.load({ provider }).mine, rewarder.publicKey, rewarder.account); | ||
*/ | ||
createQuarry({ token, authority = this.program.provider.wallet.publicKey, }) { | ||
createQuarry({ token, authority = this.provider.wallet.publicKey, }) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
@@ -75,3 +78,3 @@ const [quarryKey, bump] = yield (0, pda_1.findQuarryAddress)(this.rewarderKey, token.mintAccount, this.program.programId); | ||
tokenMint: token.mintAccount, | ||
payer: this.program.provider.wallet.publicKey, | ||
payer: this.provider.wallet.publicKey, | ||
unusedClock: web3_js_1.SYSVAR_CLOCK_PUBKEY, | ||
@@ -93,3 +96,3 @@ systemProgram: web3_js_1.SystemProgram.programId, | ||
*/ | ||
setAnnualRewards({ newAnnualRate, authority = this.program.provider.wallet.publicKey, }) { | ||
setAnnualRewards({ newAnnualRate, authority = this.provider.wallet.publicKey, }) { | ||
return new solana_contrib_1.TransactionEnvelope(this.sdk.provider, [ | ||
@@ -96,0 +99,0 @@ this.program.instruction.setAnnualRewards(newAnnualRate, { |
import type { AugmentedProvider } from "@saberhq/solana-contrib"; | ||
import { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import type { TokenAmount, u64 } from "@saberhq/token-utils"; | ||
import type { AccountInfo, PublicKey } from "@solana/web3.js"; | ||
import { Keypair } from "@solana/web3.js"; | ||
import type { AccountInfo, PublicKey, Signer } from "@solana/web3.js"; | ||
import type { MinterData, MintWrapperData, MintWrapperProgram } from "../../programs/mintWrapper"; | ||
@@ -17,3 +16,3 @@ import type { QuarrySDK } from "../../sdk"; | ||
tokenMint: PublicKey; | ||
baseKP?: Keypair; | ||
baseKP?: Signer; | ||
tokenProgram?: PublicKey; | ||
@@ -24,6 +23,6 @@ admin?: PublicKey; | ||
newWrapperAndMint({ mintKP, decimals, ...newWrapperArgs }: { | ||
mintKP?: Keypair; | ||
mintKP?: Signer; | ||
decimals?: number; | ||
hardcap: u64; | ||
baseKP?: Keypair; | ||
baseKP?: Signer; | ||
tokenProgram?: PublicKey; | ||
@@ -30,0 +29,0 @@ admin?: PublicKey; |
@@ -17,3 +17,3 @@ "use strict"; | ||
} | ||
newWrapper({ hardcap, tokenMint, baseKP = web3_js_1.Keypair.generate(), tokenProgram = token_utils_1.TOKEN_PROGRAM_ID, admin = this.program.provider.wallet.publicKey, payer = this.program.provider.wallet.publicKey, }) { | ||
newWrapper({ hardcap, tokenMint, baseKP = web3_js_1.Keypair.generate(), tokenProgram = token_utils_1.TOKEN_PROGRAM_ID, admin = this.provider.wallet.publicKey, payer = this.provider.wallet.publicKey, }) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
@@ -65,3 +65,3 @@ const [mintWrapper, nonce] = yield (0, pda_1.findMintWrapperAddress)(baseKP.publicKey, this.program.programId); | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const accountInfo = yield this.program.provider.connection.getAccountInfo(wrapper); | ||
const accountInfo = yield this.provider.connection.getAccountInfo(wrapper); | ||
if (!accountInfo) { | ||
@@ -81,3 +81,3 @@ return null; | ||
const [minterAddress] = yield (0, pda_1.findMinterAddress)(wrapper, authority, this.program.programId); | ||
const accountInfo = yield this.program.provider.connection.getAccountInfo(minterAddress); | ||
const accountInfo = yield this.provider.connection.getAccountInfo(minterAddress); | ||
if (!accountInfo) { | ||
@@ -97,7 +97,7 @@ return null; | ||
mintWrapper: wrapper, | ||
admin: this.program.provider.wallet.publicKey, | ||
admin: this.provider.wallet.publicKey, | ||
}, | ||
newMinterAuthority: authority, | ||
minter, | ||
payer: this.program.provider.wallet.publicKey, | ||
payer: this.provider.wallet.publicKey, | ||
systemProgram: web3_js_1.SystemProgram.programId, | ||
@@ -123,3 +123,3 @@ }, | ||
mintWrapper: wrapper, | ||
admin: this.program.provider.wallet.publicKey, | ||
admin: this.provider.wallet.publicKey, | ||
}, | ||
@@ -151,3 +151,3 @@ minter, | ||
mintWrapper: wrapper, | ||
admin: this.program.provider.wallet.publicKey, | ||
admin: this.provider.wallet.publicKey, | ||
nextAdmin, | ||
@@ -163,3 +163,3 @@ }, | ||
mintWrapper: wrapper, | ||
pendingAdmin: this.program.provider.wallet.publicKey, | ||
pendingAdmin: this.provider.wallet.publicKey, | ||
}, | ||
@@ -166,0 +166,0 @@ }), |
import { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import { u64 } from "@saberhq/token-utils"; | ||
import type { PublicKey } from "@solana/web3.js"; | ||
import { Keypair } from "@solana/web3.js"; | ||
import type { PublicKey, Signer } from "@solana/web3.js"; | ||
import type { OperatorData, QuarryOperatorProgram, QuarrySDK } from "../.."; | ||
@@ -28,3 +27,3 @@ /** | ||
admin?: PublicKey; | ||
baseKP?: Keypair; | ||
baseKP?: Signer; | ||
payer?: PublicKey; | ||
@@ -31,0 +30,0 @@ }): Promise<{ |
export declare type QuarryMergeMineIDL = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_merge_mine"; | ||
@@ -1013,3 +1013,3 @@ instructions: [ | ||
export declare type AnchorQuarryMergeMine = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_merge_mine"; | ||
@@ -1016,0 +1016,0 @@ instructions: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export const AnchorQuarryMergeMineIDL = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_merge_mine", | ||
@@ -1014,3 +1014,3 @@ instructions: [ | ||
export const QuarryMergeMineJSON = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_merge_mine", | ||
@@ -1017,0 +1017,0 @@ instructions: [ |
export declare type QuarryMineIDL = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_mine"; | ||
@@ -1070,3 +1070,3 @@ instructions: [ | ||
export declare type AnchorQuarryMine = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_mine"; | ||
@@ -1073,0 +1073,0 @@ instructions: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export const AnchorQuarryMineIDL = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_mine", | ||
@@ -1071,3 +1071,3 @@ instructions: [ | ||
export const QuarryMineJSON = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_mine", | ||
@@ -1074,0 +1074,0 @@ instructions: [ |
export declare type QuarryMintWrapperIDL = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_mint_wrapper"; | ||
@@ -486,3 +486,3 @@ instructions: [ | ||
export declare type AnchorQuarryMintWrapper = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_mint_wrapper"; | ||
@@ -489,0 +489,0 @@ instructions: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export const AnchorQuarryMintWrapperIDL = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_mint_wrapper", | ||
@@ -487,3 +487,3 @@ instructions: [ | ||
export const QuarryMintWrapperJSON = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_mint_wrapper", | ||
@@ -490,0 +490,0 @@ instructions: [ |
export declare type QuarryOperatorIDL = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_operator"; | ||
@@ -389,3 +389,3 @@ instructions: [ | ||
export declare type AnchorQuarryOperator = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_operator"; | ||
@@ -392,0 +392,0 @@ instructions: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export const AnchorQuarryOperatorIDL = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_operator", | ||
@@ -390,3 +390,3 @@ instructions: [ | ||
export const QuarryOperatorJSON = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_operator", | ||
@@ -393,0 +393,0 @@ instructions: [ |
export declare type QuarryRedeemerIDL = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_redeemer"; | ||
@@ -217,3 +217,3 @@ instructions: [ | ||
export declare type AnchorQuarryRedeemer = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_redeemer"; | ||
@@ -220,0 +220,0 @@ instructions: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export const AnchorQuarryRedeemerIDL = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_redeemer", | ||
@@ -218,3 +218,3 @@ instructions: [ | ||
export const QuarryRedeemerJSON = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_redeemer", | ||
@@ -221,0 +221,0 @@ instructions: [ |
export declare type QuarryRegistryIDL = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_registry"; | ||
@@ -98,3 +98,3 @@ instructions: [ | ||
export declare type AnchorQuarryRegistry = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_registry"; | ||
@@ -101,0 +101,0 @@ instructions: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export const AnchorQuarryRegistryIDL = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_registry", | ||
@@ -99,3 +99,3 @@ instructions: [ | ||
export const QuarryRegistryJSON = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_registry", | ||
@@ -102,0 +102,0 @@ instructions: [ |
import type { Program } from "@project-serum/anchor"; | ||
import type { AugmentedProvider, Provider, TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import type { PublicKey, Signer, TransactionInstruction } from "@solana/web3.js"; | ||
import { Keypair } from "@solana/web3.js"; | ||
import type { Programs } from "./constants"; | ||
@@ -64,3 +63,3 @@ import type { PendingRedeemer } from "./programs/redeemer"; | ||
admin?: PublicKey; | ||
baseKP?: Keypair; | ||
baseKP?: Signer; | ||
payer?: PublicKey; | ||
@@ -67,0 +66,0 @@ }): Promise<{ |
import type { Provider, TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import type { PublicKey } from "@solana/web3.js"; | ||
import { Keypair } from "@solana/web3.js"; | ||
import type { PublicKey, Signer } from "@solana/web3.js"; | ||
import type { MineProgram } from "../../programs/mine"; | ||
@@ -14,3 +13,3 @@ import type { QuarrySDK } from "../../sdk"; | ||
mintWrapper: PublicKey; | ||
baseKP?: Keypair; | ||
baseKP?: Signer; | ||
authority?: PublicKey; | ||
@@ -17,0 +16,0 @@ }): Promise<{ |
@@ -16,3 +16,3 @@ import { __awaiter } from "tslib"; | ||
} | ||
createRewarder({ mintWrapper, baseKP = Keypair.generate(), authority = this.program.provider.wallet.publicKey, }) { | ||
createRewarder({ mintWrapper, baseKP = Keypair.generate(), authority = this.provider.wallet.publicKey, }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -39,3 +39,3 @@ const [rewarderKey, bump] = yield findRewarderAddress(baseKP.publicKey, this.program.programId); | ||
rewarder: rewarderKey, | ||
payer: this.program.provider.wallet.publicKey, | ||
payer: this.provider.wallet.publicKey, | ||
systemProgram: SystemProgram.programId, | ||
@@ -42,0 +42,0 @@ unusedClock: SYSVAR_CLOCK_PUBKEY, |
@@ -50,3 +50,3 @@ import { __awaiter } from "tslib"; | ||
systemProgram: SystemProgram.programId, | ||
payer: this.program.provider.wallet.publicKey, | ||
payer: this.provider.wallet.publicKey, | ||
minerVault: this.tokenVaultKey, | ||
@@ -53,0 +53,0 @@ rewarder: this.quarry.quarryData.rewarderKey, |
import BN from "bn.js"; | ||
export declare const ZERO: BN; | ||
export declare const BASE_TEN: BN; | ||
export declare const MAX_U64_BN: BN; | ||
export declare const SECONDS_PER_YEAR: BN; | ||
export declare class Payroll { | ||
@@ -13,6 +15,6 @@ readonly famineTs: BN; | ||
* Calculates the amount of tokens that this user can receive. | ||
* @param current_ts | ||
* @param currentTs | ||
* @returns | ||
*/ | ||
calculateRewardPerToken(current_ts: BN): BN; | ||
calculateRewardPerToken(currentTs: BN): BN; | ||
/** | ||
@@ -19,0 +21,0 @@ * Calculates the amount of tokens that this user can claim. |
@@ -5,2 +5,4 @@ import { MAX_U64 } from "@saberhq/token-utils"; | ||
export const BASE_TEN = new BN(10); | ||
export const MAX_U64_BN = new BN(MAX_U64.toString()); | ||
export const SECONDS_PER_YEAR = new BN(365 * 86400); | ||
export class Payroll { | ||
@@ -16,15 +18,15 @@ constructor(famineTs, lastCheckpointTs, annualRewardsRate, rewardsPerTokenStored, totalTokensDeposited) { | ||
* Calculates the amount of tokens that this user can receive. | ||
* @param current_ts | ||
* @param currentTs | ||
* @returns | ||
*/ | ||
calculateRewardPerToken(current_ts) { | ||
calculateRewardPerToken(currentTs) { | ||
if (this.totalTokensDeposited.isZero()) { | ||
return this.rewardsPerTokenStored; | ||
} | ||
const lastTimeRewardsApplicable = BN.min(current_ts, this.famineTs); | ||
const lastTimeRewardsApplicable = BN.min(currentTs, this.famineTs); | ||
const timeWorked = BN.max(ZERO, lastTimeRewardsApplicable.sub(this.lastCheckpointTs)); | ||
const reward = timeWorked | ||
.mul(new BN(MAX_U64.toString())) | ||
.mul(MAX_U64_BN) | ||
.mul(this.annualRewardsRate) | ||
.div(new BN(365 * 86400)) | ||
.div(SECONDS_PER_YEAR) | ||
.div(this.totalTokensDeposited); | ||
@@ -43,5 +45,3 @@ return this.rewardsPerTokenStored.add(reward); | ||
const netNewRewards = this.calculateRewardPerToken(currentTs).sub(rewardsPerTokenPaid); | ||
const earnedRewards = tokensDeposited | ||
.mul(netNewRewards) | ||
.div(new BN(MAX_U64.toString())); | ||
const earnedRewards = tokensDeposited.mul(netNewRewards).div(MAX_U64_BN); | ||
return earnedRewards.add(rewardsEarned); | ||
@@ -48,0 +48,0 @@ } |
@@ -107,3 +107,3 @@ import { __awaiter } from "tslib"; | ||
*/ | ||
getMinerActions(authority = this.program.provider.wallet.publicKey) { | ||
getMinerActions(authority = this.provider.wallet.publicKey) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -168,3 +168,3 @@ const miner = yield this.getMinerAddress(authority); | ||
*/ | ||
createMiner({ authority = this.program.provider.wallet.publicKey, } = {}) { | ||
createMiner({ authority = this.provider.wallet.publicKey, } = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -171,0 +171,0 @@ const [miner, bump] = yield findMinerAddress(this.key, authority, this.program.programId); |
@@ -1,2 +0,2 @@ | ||
import type { Provider } from "@saberhq/solana-contrib"; | ||
import type { AugmentedProvider, Provider } from "@saberhq/solana-contrib"; | ||
import { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
@@ -17,2 +17,3 @@ import type { ProgramAccount, Token, u64 } from "@saberhq/token-utils"; | ||
constructor(mineWrapper: MineWrapper, rewarderKey: PublicKey, rewarderData: RewarderData); | ||
get provider(): AugmentedProvider; | ||
static fromData(provider: Provider, rewarder: ProgramAccount<RewarderData>): RewarderWrapper; | ||
@@ -19,0 +20,0 @@ /** |
@@ -15,2 +15,5 @@ import { __awaiter } from "tslib"; | ||
} | ||
get provider() { | ||
return this.sdk.provider; | ||
} | ||
static fromData(provider, rewarder) { | ||
@@ -60,3 +63,3 @@ return new RewarderWrapper(QuarrySDK.load({ provider }).mine, rewarder.publicKey, rewarder.account); | ||
*/ | ||
createQuarry({ token, authority = this.program.provider.wallet.publicKey, }) { | ||
createQuarry({ token, authority = this.provider.wallet.publicKey, }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -72,3 +75,3 @@ const [quarryKey, bump] = yield findQuarryAddress(this.rewarderKey, token.mintAccount, this.program.programId); | ||
tokenMint: token.mintAccount, | ||
payer: this.program.provider.wallet.publicKey, | ||
payer: this.provider.wallet.publicKey, | ||
unusedClock: SYSVAR_CLOCK_PUBKEY, | ||
@@ -90,3 +93,3 @@ systemProgram: SystemProgram.programId, | ||
*/ | ||
setAnnualRewards({ newAnnualRate, authority = this.program.provider.wallet.publicKey, }) { | ||
setAnnualRewards({ newAnnualRate, authority = this.provider.wallet.publicKey, }) { | ||
return new TransactionEnvelope(this.sdk.provider, [ | ||
@@ -93,0 +96,0 @@ this.program.instruction.setAnnualRewards(newAnnualRate, { |
import type { AugmentedProvider } from "@saberhq/solana-contrib"; | ||
import { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import type { TokenAmount, u64 } from "@saberhq/token-utils"; | ||
import type { AccountInfo, PublicKey } from "@solana/web3.js"; | ||
import { Keypair } from "@solana/web3.js"; | ||
import type { AccountInfo, PublicKey, Signer } from "@solana/web3.js"; | ||
import type { MinterData, MintWrapperData, MintWrapperProgram } from "../../programs/mintWrapper"; | ||
@@ -17,3 +16,3 @@ import type { QuarrySDK } from "../../sdk"; | ||
tokenMint: PublicKey; | ||
baseKP?: Keypair; | ||
baseKP?: Signer; | ||
tokenProgram?: PublicKey; | ||
@@ -24,6 +23,6 @@ admin?: PublicKey; | ||
newWrapperAndMint({ mintKP, decimals, ...newWrapperArgs }: { | ||
mintKP?: Keypair; | ||
mintKP?: Signer; | ||
decimals?: number; | ||
hardcap: u64; | ||
baseKP?: Keypair; | ||
baseKP?: Signer; | ||
tokenProgram?: PublicKey; | ||
@@ -30,0 +29,0 @@ admin?: PublicKey; |
@@ -14,3 +14,3 @@ import { __awaiter, __rest } from "tslib"; | ||
} | ||
newWrapper({ hardcap, tokenMint, baseKP = Keypair.generate(), tokenProgram = TOKEN_PROGRAM_ID, admin = this.program.provider.wallet.publicKey, payer = this.program.provider.wallet.publicKey, }) { | ||
newWrapper({ hardcap, tokenMint, baseKP = Keypair.generate(), tokenProgram = TOKEN_PROGRAM_ID, admin = this.provider.wallet.publicKey, payer = this.provider.wallet.publicKey, }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -62,3 +62,3 @@ const [mintWrapper, nonce] = yield findMintWrapperAddress(baseKP.publicKey, this.program.programId); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const accountInfo = yield this.program.provider.connection.getAccountInfo(wrapper); | ||
const accountInfo = yield this.provider.connection.getAccountInfo(wrapper); | ||
if (!accountInfo) { | ||
@@ -78,3 +78,3 @@ return null; | ||
const [minterAddress] = yield findMinterAddress(wrapper, authority, this.program.programId); | ||
const accountInfo = yield this.program.provider.connection.getAccountInfo(minterAddress); | ||
const accountInfo = yield this.provider.connection.getAccountInfo(minterAddress); | ||
if (!accountInfo) { | ||
@@ -94,7 +94,7 @@ return null; | ||
mintWrapper: wrapper, | ||
admin: this.program.provider.wallet.publicKey, | ||
admin: this.provider.wallet.publicKey, | ||
}, | ||
newMinterAuthority: authority, | ||
minter, | ||
payer: this.program.provider.wallet.publicKey, | ||
payer: this.provider.wallet.publicKey, | ||
systemProgram: SystemProgram.programId, | ||
@@ -120,3 +120,3 @@ }, | ||
mintWrapper: wrapper, | ||
admin: this.program.provider.wallet.publicKey, | ||
admin: this.provider.wallet.publicKey, | ||
}, | ||
@@ -148,3 +148,3 @@ minter, | ||
mintWrapper: wrapper, | ||
admin: this.program.provider.wallet.publicKey, | ||
admin: this.provider.wallet.publicKey, | ||
nextAdmin, | ||
@@ -160,3 +160,3 @@ }, | ||
mintWrapper: wrapper, | ||
pendingAdmin: this.program.provider.wallet.publicKey, | ||
pendingAdmin: this.provider.wallet.publicKey, | ||
}, | ||
@@ -163,0 +163,0 @@ }), |
import { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import { u64 } from "@saberhq/token-utils"; | ||
import type { PublicKey } from "@solana/web3.js"; | ||
import { Keypair } from "@solana/web3.js"; | ||
import type { PublicKey, Signer } from "@solana/web3.js"; | ||
import type { OperatorData, QuarryOperatorProgram, QuarrySDK } from "../.."; | ||
@@ -28,3 +27,3 @@ /** | ||
admin?: PublicKey; | ||
baseKP?: Keypair; | ||
baseKP?: Signer; | ||
payer?: PublicKey; | ||
@@ -31,0 +30,0 @@ }): Promise<{ |
{ | ||
"name": "@quarryprotocol/quarry-sdk", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"description": "Quarry Protocol SDK", | ||
@@ -33,28 +33,28 @@ "keywords": [ | ||
"devDependencies": { | ||
"@project-serum/anchor": "^0.23.0", | ||
"@rushstack/eslint-patch": "^1.1.1", | ||
"@saberhq/anchor-contrib": "^1.12.58", | ||
"@saberhq/chai-solana": "^1.12.58", | ||
"@saberhq/eslint-config": "^1.12.58", | ||
"@saberhq/solana-contrib": "^1.12.58", | ||
"@saberhq/token-utils": "^1.12.58", | ||
"@saberhq/tsconfig": "^1.12.58", | ||
"@solana/web3.js": "^1.37.0", | ||
"@project-serum/anchor": "^0.24.2", | ||
"@rushstack/eslint-patch": "^1.1.3", | ||
"@saberhq/anchor-contrib": "^1.12.61", | ||
"@saberhq/chai-solana": "^1.12.61", | ||
"@saberhq/eslint-config": "^1.12.61", | ||
"@saberhq/solana-contrib": "^1.12.61", | ||
"@saberhq/token-utils": "^1.12.61", | ||
"@saberhq/tsconfig": "^1.12.61", | ||
"@solana/web3.js": "^1.39.0", | ||
"@types/bn.js": "^5.1.0", | ||
"@types/chai": "^4.3.0", | ||
"@types/chai": "^4.3.1", | ||
"@types/mocha": "^9.1.0", | ||
"@types/node": "^17.0.23", | ||
"@types/prettier": "^2.4.4", | ||
"@types/node": "^17.0.24", | ||
"@types/prettier": "^2.6.0", | ||
"bn.js": "^5.2.0", | ||
"chai": "=4.3.4", | ||
"eslint": "^8.12.0", | ||
"eslint": "^8.13.0", | ||
"eslint-import-resolver-node": "^0.3.6", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-import": "^2.26.0", | ||
"husky": "^7.0.4", | ||
"jsbi": "^4.2.0", | ||
"lint-staged": "^12.3.7", | ||
"jsbi": "^4.2.1", | ||
"lint-staged": "^12.3.8", | ||
"mocha": "^9.2.2", | ||
"prettier": "^2.6.1", | ||
"prettier": "^2.6.2", | ||
"ts-node": "^10.7.0", | ||
"typedoc": "^0.22.13", | ||
"typedoc": "^0.22.15", | ||
"typescript": "^4.6.3" | ||
@@ -87,2 +87,3 @@ }, | ||
"dependencies": { | ||
"superstruct": "^0.15.4", | ||
"tiny-invariant": "^1.2.0", | ||
@@ -89,0 +90,0 @@ "tslib": "^2.3.1" |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export type QuarryMintWrapperIDL = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_mint_wrapper"; | ||
@@ -488,3 +488,3 @@ instructions: [ | ||
export type AnchorQuarryMintWrapper = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_mint_wrapper"; | ||
@@ -974,3 +974,3 @@ instructions: [ | ||
export const AnchorQuarryMintWrapperIDL: AnchorQuarryMintWrapper = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_mint_wrapper", | ||
@@ -1459,3 +1459,3 @@ instructions: [ | ||
export const QuarryMintWrapperJSON: QuarryMintWrapperIDL = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_mint_wrapper", | ||
@@ -1462,0 +1462,0 @@ instructions: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export type QuarryOperatorIDL = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_operator"; | ||
@@ -391,3 +391,3 @@ instructions: [ | ||
export type AnchorQuarryOperator = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_operator"; | ||
@@ -780,3 +780,3 @@ instructions: [ | ||
export const AnchorQuarryOperatorIDL: AnchorQuarryOperator = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_operator", | ||
@@ -1168,3 +1168,3 @@ instructions: [ | ||
export const QuarryOperatorJSON: QuarryOperatorIDL = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_operator", | ||
@@ -1171,0 +1171,0 @@ instructions: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export type QuarryRedeemerIDL = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_redeemer"; | ||
@@ -219,3 +219,3 @@ instructions: [ | ||
export type AnchorQuarryRedeemer = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_redeemer"; | ||
@@ -436,3 +436,3 @@ instructions: [ | ||
export const AnchorQuarryRedeemerIDL: AnchorQuarryRedeemer = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_redeemer", | ||
@@ -652,3 +652,3 @@ instructions: [ | ||
export const QuarryRedeemerJSON: QuarryRedeemerIDL = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_redeemer", | ||
@@ -655,0 +655,0 @@ instructions: [ |
import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
export type QuarryRegistryIDL = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_registry"; | ||
@@ -100,3 +100,3 @@ instructions: [ | ||
export type AnchorQuarryRegistry = { | ||
version: "4.2.0"; | ||
version: "4.2.1"; | ||
name: "quarry_registry"; | ||
@@ -198,3 +198,3 @@ instructions: [ | ||
export const AnchorQuarryRegistryIDL: AnchorQuarryRegistry = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_registry", | ||
@@ -295,3 +295,3 @@ instructions: [ | ||
export const QuarryRegistryJSON: QuarryRegistryIDL = { | ||
version: "4.2.0", | ||
version: "4.2.1", | ||
name: "quarry_registry", | ||
@@ -298,0 +298,0 @@ instructions: [ |
@@ -149,3 +149,3 @@ import type { Program } from "@project-serum/anchor"; | ||
admin?: PublicKey; | ||
baseKP?: Keypair; | ||
baseKP?: Signer; | ||
payer?: PublicKey; | ||
@@ -152,0 +152,0 @@ }): Promise<{ key: PublicKey; tx: TransactionEnvelope }> { |
import type { Provider, TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import { getOrCreateATA, TOKEN_PROGRAM_ID } from "@saberhq/token-utils"; | ||
import type { PublicKey, TransactionInstruction } from "@solana/web3.js"; | ||
import type { | ||
PublicKey, | ||
Signer, | ||
TransactionInstruction, | ||
} from "@solana/web3.js"; | ||
import { Keypair, SystemProgram, SYSVAR_CLOCK_PUBKEY } from "@solana/web3.js"; | ||
@@ -26,6 +30,6 @@ | ||
baseKP = Keypair.generate(), | ||
authority = this.program.provider.wallet.publicKey, | ||
authority = this.provider.wallet.publicKey, | ||
}: { | ||
mintWrapper: PublicKey; | ||
baseKP?: Keypair; | ||
baseKP?: Signer; | ||
authority?: PublicKey; | ||
@@ -71,3 +75,3 @@ }): Promise<{ | ||
rewarder: rewarderKey, | ||
payer: this.program.provider.wallet.publicKey, | ||
payer: this.provider.wallet.publicKey, | ||
systemProgram: SystemProgram.programId, | ||
@@ -74,0 +78,0 @@ unusedClock: SYSVAR_CLOCK_PUBKEY, |
@@ -70,3 +70,3 @@ import type { Provider } from "@saberhq/solana-contrib"; | ||
systemProgram: SystemProgram.programId, | ||
payer: this.program.provider.wallet.publicKey, | ||
payer: this.provider.wallet.publicKey, | ||
minerVault: this.tokenVaultKey, | ||
@@ -73,0 +73,0 @@ rewarder: this.quarry.quarryData.rewarderKey, |
@@ -7,2 +7,6 @@ import { MAX_U64 } from "@saberhq/token-utils"; | ||
export const MAX_U64_BN = new BN(MAX_U64.toString()); | ||
export const SECONDS_PER_YEAR = new BN(365 * 86_400); | ||
export class Payroll { | ||
@@ -19,6 +23,6 @@ constructor( | ||
* Calculates the amount of tokens that this user can receive. | ||
* @param current_ts | ||
* @param currentTs | ||
* @returns | ||
*/ | ||
calculateRewardPerToken(current_ts: BN): BN { | ||
calculateRewardPerToken(currentTs: BN): BN { | ||
if (this.totalTokensDeposited.isZero()) { | ||
@@ -28,3 +32,3 @@ return this.rewardsPerTokenStored; | ||
const lastTimeRewardsApplicable = BN.min(current_ts, this.famineTs); | ||
const lastTimeRewardsApplicable = BN.min(currentTs, this.famineTs); | ||
const timeWorked = BN.max( | ||
@@ -35,5 +39,5 @@ ZERO, | ||
const reward = timeWorked | ||
.mul(new BN(MAX_U64.toString())) | ||
.mul(MAX_U64_BN) | ||
.mul(this.annualRewardsRate) | ||
.div(new BN(365 * 86_400)) | ||
.div(SECONDS_PER_YEAR) | ||
.div(this.totalTokensDeposited); | ||
@@ -59,7 +63,5 @@ return this.rewardsPerTokenStored.add(reward); | ||
this.calculateRewardPerToken(currentTs).sub(rewardsPerTokenPaid); | ||
const earnedRewards = tokensDeposited | ||
.mul(netNewRewards) | ||
.div(new BN(MAX_U64.toString())); | ||
const earnedRewards = tokensDeposited.mul(netNewRewards).div(MAX_U64_BN); | ||
return earnedRewards.add(rewardsEarned); | ||
} | ||
} |
@@ -158,3 +158,3 @@ import type { Provider } from "@saberhq/solana-contrib"; | ||
async getMinerActions( | ||
authority: PublicKey = this.program.provider.wallet.publicKey | ||
authority: PublicKey = this.provider.wallet.publicKey | ||
): Promise<MinerWrapper> { | ||
@@ -239,3 +239,3 @@ const miner = await this.getMinerAddress(authority); | ||
async createMiner({ | ||
authority = this.program.provider.wallet.publicKey, | ||
authority = this.provider.wallet.publicKey, | ||
}: { | ||
@@ -242,0 +242,0 @@ authority?: PublicKey; |
@@ -1,2 +0,2 @@ | ||
import type { Provider } from "@saberhq/solana-contrib"; | ||
import type { AugmentedProvider, Provider } from "@saberhq/solana-contrib"; | ||
import { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
@@ -27,2 +27,6 @@ import type { ProgramAccount, Token, u64 } from "@saberhq/token-utils"; | ||
get provider(): AugmentedProvider { | ||
return this.sdk.provider; | ||
} | ||
static fromData( | ||
@@ -83,3 +87,3 @@ provider: Provider, | ||
token, | ||
authority = this.program.provider.wallet.publicKey, | ||
authority = this.provider.wallet.publicKey, | ||
}: { | ||
@@ -102,3 +106,3 @@ token: Token; | ||
tokenMint: token.mintAccount, | ||
payer: this.program.provider.wallet.publicKey, | ||
payer: this.provider.wallet.publicKey, | ||
unusedClock: SYSVAR_CLOCK_PUBKEY, | ||
@@ -123,3 +127,3 @@ systemProgram: SystemProgram.programId, | ||
newAnnualRate, | ||
authority = this.program.provider.wallet.publicKey, | ||
authority = this.provider.wallet.publicKey, | ||
}: { | ||
@@ -126,0 +130,0 @@ newAnnualRate: u64; |
@@ -9,3 +9,3 @@ import type { AugmentedProvider } from "@saberhq/solana-contrib"; | ||
} from "@saberhq/token-utils"; | ||
import type { AccountInfo, PublicKey } from "@solana/web3.js"; | ||
import type { AccountInfo, PublicKey, Signer } from "@solana/web3.js"; | ||
import { Keypair, SystemProgram } from "@solana/web3.js"; | ||
@@ -38,8 +38,8 @@ | ||
tokenProgram = TOKEN_PROGRAM_ID, | ||
admin = this.program.provider.wallet.publicKey, | ||
payer = this.program.provider.wallet.publicKey, | ||
admin = this.provider.wallet.publicKey, | ||
payer = this.provider.wallet.publicKey, | ||
}: { | ||
hardcap: u64; | ||
tokenMint: PublicKey; | ||
baseKP?: Keypair; | ||
baseKP?: Signer; | ||
tokenProgram?: PublicKey; | ||
@@ -80,7 +80,7 @@ admin?: PublicKey; | ||
}: { | ||
mintKP?: Keypair; | ||
mintKP?: Signer; | ||
decimals?: number; | ||
hardcap: u64; | ||
baseKP?: Keypair; | ||
baseKP?: Signer; | ||
tokenProgram?: PublicKey; | ||
@@ -115,5 +115,3 @@ admin?: PublicKey; | ||
async fetchMintWrapper(wrapper: PublicKey): Promise<MintWrapperData | null> { | ||
const accountInfo = await this.program.provider.connection.getAccountInfo( | ||
wrapper | ||
); | ||
const accountInfo = await this.provider.connection.getAccountInfo(wrapper); | ||
if (!accountInfo) { | ||
@@ -142,3 +140,3 @@ return null; | ||
); | ||
const accountInfo = await this.program.provider.connection.getAccountInfo( | ||
const accountInfo = await this.provider.connection.getAccountInfo( | ||
minterAddress | ||
@@ -169,7 +167,7 @@ ); | ||
mintWrapper: wrapper, | ||
admin: this.program.provider.wallet.publicKey, | ||
admin: this.provider.wallet.publicKey, | ||
}, | ||
newMinterAuthority: authority, | ||
minter, | ||
payer: this.program.provider.wallet.publicKey, | ||
payer: this.provider.wallet.publicKey, | ||
systemProgram: SystemProgram.programId, | ||
@@ -202,3 +200,3 @@ }, | ||
mintWrapper: wrapper, | ||
admin: this.program.provider.wallet.publicKey, | ||
admin: this.provider.wallet.publicKey, | ||
}, | ||
@@ -237,3 +235,3 @@ minter, | ||
mintWrapper: wrapper, | ||
admin: this.program.provider.wallet.publicKey, | ||
admin: this.provider.wallet.publicKey, | ||
nextAdmin, | ||
@@ -250,3 +248,3 @@ }, | ||
mintWrapper: wrapper, | ||
pendingAdmin: this.program.provider.wallet.publicKey, | ||
pendingAdmin: this.provider.wallet.publicKey, | ||
}, | ||
@@ -253,0 +251,0 @@ }), |
import { TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import { u64 } from "@saberhq/token-utils"; | ||
import type { PublicKey } from "@solana/web3.js"; | ||
import type { PublicKey, Signer } from "@solana/web3.js"; | ||
import { Keypair, SystemProgram, SYSVAR_CLOCK_PUBKEY } from "@solana/web3.js"; | ||
@@ -60,3 +60,3 @@ | ||
admin?: PublicKey; | ||
baseKP?: Keypair; | ||
baseKP?: Signer; | ||
payer?: PublicKey; | ||
@@ -63,0 +63,0 @@ }): Promise<{ |
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 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
2820395
49982
10
+ Addedsuperstruct@^0.15.4