@quarryprotocol/quarry-sdk
Advanced tools
Comparing version 0.1.2 to 0.2.0
@@ -52,2 +52,7 @@ export declare type QuarryMineIDL = { | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "claimFeeTokenAccount"; | ||
isMut: false; | ||
isSigner: false; | ||
} | ||
@@ -349,2 +354,7 @@ ]; | ||
{ | ||
name: "claimFeeTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "stake"; | ||
@@ -528,2 +538,7 @@ accounts: [ | ||
{ | ||
name: "claimFeeTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "stake"; | ||
@@ -622,2 +637,10 @@ accounts: [ | ||
type: "publicKey"; | ||
}, | ||
{ | ||
name: "claimFeeTokenAccount"; | ||
type: "publicKey"; | ||
}, | ||
{ | ||
name: "maxClaimFeeKbps"; | ||
type: "u64"; | ||
} | ||
@@ -768,2 +791,7 @@ ]; | ||
{ | ||
name: "fees"; | ||
type: "u64"; | ||
index: false; | ||
}, | ||
{ | ||
name: "timestamp"; | ||
@@ -946,2 +974,7 @@ type: "i64"; | ||
msg: "Invalid timestamp."; | ||
}, | ||
{ | ||
code: 308; | ||
name: "InvalidMaxClaimFee"; | ||
msg: "Invalid max claim fee."; | ||
} | ||
@@ -1008,3 +1041,10 @@ ]; | ||
}; | ||
InvalidMaxClaimFee: { | ||
code: 308; | ||
name: "InvalidMaxClaimFee"; | ||
msg: "Invalid max claim fee."; | ||
} & { | ||
name: "InvalidMaxClaimFee"; | ||
}; | ||
}; | ||
//# sourceMappingURL=quarry_mine.d.ts.map |
@@ -57,2 +57,7 @@ "use strict"; | ||
}, | ||
{ | ||
name: "claimFeeTokenAccount", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
], | ||
@@ -353,2 +358,7 @@ args: [ | ||
{ | ||
name: "claimFeeTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "stake", | ||
@@ -532,2 +542,7 @@ accounts: [ | ||
{ | ||
name: "claimFeeTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "stake", | ||
@@ -627,2 +642,10 @@ accounts: [ | ||
}, | ||
{ | ||
name: "claimFeeTokenAccount", | ||
type: "publicKey", | ||
}, | ||
{ | ||
name: "maxClaimFeeKbps", | ||
type: "u64", | ||
}, | ||
], | ||
@@ -772,2 +795,7 @@ }, | ||
{ | ||
name: "fees", | ||
type: "u64", | ||
index: false, | ||
}, | ||
{ | ||
name: "timestamp", | ||
@@ -951,2 +979,7 @@ type: "i64", | ||
}, | ||
{ | ||
code: 308, | ||
name: "InvalidMaxClaimFee", | ||
msg: "Invalid max claim fee.", | ||
}, | ||
], | ||
@@ -953,0 +986,0 @@ }; |
@@ -13,2 +13,3 @@ "use strict"; | ||
exports.MineWrapper = void 0; | ||
const token_utils_1 = require("@saberhq/token-utils"); | ||
const web3_js_1 = require("@solana/web3.js"); | ||
@@ -31,5 +32,11 @@ const pda_1 = require("./pda"); | ||
const mintWrapperData = yield this.sdk.programs.MintWrapper.account.mintWrapper.fetch(mintWrapper); | ||
const { address: claimFeeTokenAccount, instruction: createATAInstruction } = yield token_utils_1.getOrCreateATA({ | ||
provider: this.provider, | ||
mint: mintWrapperData.tokenMint, | ||
owner: rewarderKey, | ||
}); | ||
return { | ||
key: rewarderKey, | ||
tx: this.sdk.newTx([ | ||
...(createATAInstruction ? [createATAInstruction] : []), | ||
this.program.instruction.newRewarder(bump, { | ||
@@ -46,2 +53,3 @@ accounts: { | ||
rewardsTokenMint: mintWrapperData.tokenMint, | ||
claimFeeTokenAccount, | ||
}, | ||
@@ -48,0 +56,0 @@ }), |
@@ -169,2 +169,3 @@ "use strict"; | ||
stake: this.userStakeAccounts, | ||
claimFeeTokenAccount: this.quarry.rewarderData.claimFeeTokenAccount, | ||
}, | ||
@@ -171,0 +172,0 @@ }); |
{ | ||
"name": "@quarryprotocol/quarry-sdk", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "Quarry Protocol SDK", | ||
@@ -17,2 +17,3 @@ "main": "dist/index.js", | ||
"test:e2e": "anchor test --skip-build 'tests/**/*.ts'", | ||
"docs:generate": "typedoc --excludePrivate --includeVersion --out site/ts/ src/index.ts", | ||
"prepare": "husky install" | ||
@@ -31,2 +32,3 @@ }, | ||
"ts-mocha": "^8.0.0", | ||
"typedoc": "^0.21.7", | ||
"typescript": "^4.3.5" | ||
@@ -33,0 +35,0 @@ }, |
# ⛏ Quarry | ||
[![License](https://img.shields.io/badge/license-AGPL%203.0-blue?style=flat-square)](https://github.com/QuarryProtocol/quarry/blob/master/LICENSE) | ||
[![Build Status](https://img.shields.io/github/workflow/status/QuarryProtocol/quarry/E2E/master?style=flat-square)](https://github.com/QuarryProtocol/quarry/actions/workflows/programs-e2e.yml?query=branch%3Amaster) | ||
[![Contributors](https://img.shields.io/github/contributors/QuarryProtocol/quarry?style=flat-square)](https://github.com/QuarryProtocol/quarry/graphs/contributors) | ||
[![License](https://img.shields.io/badge/license-AGPL%203.0-blue)](https://github.com/QuarryProtocol/quarry/blob/master/LICENSE) | ||
[![Build Status](https://img.shields.io/github/workflow/status/QuarryProtocol/quarry/E2E/master)](https://github.com/QuarryProtocol/quarry/actions/workflows/programs-e2e.yml?query=branch%3Amaster) | ||
[![Contributors](https://img.shields.io/github/contributors/QuarryProtocol/quarry)](https://github.com/QuarryProtocol/quarry/graphs/contributors) | ||
@@ -24,2 +24,10 @@ <p align="center"> | ||
## Packages | ||
| Package | Description | Version | Docs | | ||
| :--------------------------- | :---------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------- | | ||
| `quarry-mint-wrapper` | Mints tokens to authorized accounts | [![Crates.io](https://img.shields.io/crates/v/quarry-mint-wrapper?color=blue)](https://crates.io/crates/quarry-mint-wrapper) | [![Docs.rs](https://docs.rs/quarry-mint-wrapper/badge.svg)](https://docs.rs/quarry-mint-wrapper) | | ||
| `quarry-mine` | Distributes liquidity mining rewards to token stakers | ![crates](https://img.shields.io/crates/v/quarry-mine?color=blue) | [![Docs.rs](https://docs.rs/quarry-mine/badge.svg)](https://docs.rs/quarry-mine) | | ||
| `@quarryprotocol/quarry-sdk` | TypeScript SDK for Quarry | [![npm](https://img.shields.io/npm/v/@quarryprotocol/quarry-sdk.svg?color=blue)](https://www.npmjs.com/package/@quarryprotocol/quarry-sdk) | [![Docs](https://img.shields.io/badge/docs-typedoc-blue)](https://docs.quarry.so/ts/) | | ||
## Documentation | ||
@@ -26,0 +34,0 @@ |
@@ -54,2 +54,7 @@ import { generateErrorMap } from "@saberhq/anchor-contrib"; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "claimFeeTokenAccount"; | ||
isMut: false; | ||
isSigner: false; | ||
} | ||
@@ -351,2 +356,7 @@ ]; | ||
{ | ||
name: "claimFeeTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "stake"; | ||
@@ -530,2 +540,7 @@ accounts: [ | ||
{ | ||
name: "claimFeeTokenAccount"; | ||
isMut: true; | ||
isSigner: false; | ||
}, | ||
{ | ||
name: "stake"; | ||
@@ -624,2 +639,10 @@ accounts: [ | ||
type: "publicKey"; | ||
}, | ||
{ | ||
name: "claimFeeTokenAccount"; | ||
type: "publicKey"; | ||
}, | ||
{ | ||
name: "maxClaimFeeKbps"; | ||
type: "u64"; | ||
} | ||
@@ -770,2 +793,7 @@ ]; | ||
{ | ||
name: "fees"; | ||
type: "u64"; | ||
index: false; | ||
}, | ||
{ | ||
name: "timestamp"; | ||
@@ -948,2 +976,7 @@ type: "i64"; | ||
msg: "Invalid timestamp."; | ||
}, | ||
{ | ||
code: 308; | ||
name: "InvalidMaxClaimFee"; | ||
msg: "Invalid max claim fee."; | ||
} | ||
@@ -1004,2 +1037,7 @@ ]; | ||
}, | ||
{ | ||
name: "claimFeeTokenAccount", | ||
isMut: false, | ||
isSigner: false, | ||
}, | ||
], | ||
@@ -1300,2 +1338,7 @@ args: [ | ||
{ | ||
name: "claimFeeTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "stake", | ||
@@ -1479,2 +1522,7 @@ accounts: [ | ||
{ | ||
name: "claimFeeTokenAccount", | ||
isMut: true, | ||
isSigner: false, | ||
}, | ||
{ | ||
name: "stake", | ||
@@ -1574,2 +1622,10 @@ accounts: [ | ||
}, | ||
{ | ||
name: "claimFeeTokenAccount", | ||
type: "publicKey", | ||
}, | ||
{ | ||
name: "maxClaimFeeKbps", | ||
type: "u64", | ||
}, | ||
], | ||
@@ -1719,2 +1775,7 @@ }, | ||
{ | ||
name: "fees", | ||
type: "u64", | ||
index: false, | ||
}, | ||
{ | ||
name: "timestamp", | ||
@@ -1898,4 +1959,9 @@ type: "i64", | ||
}, | ||
{ | ||
code: 308, | ||
name: "InvalidMaxClaimFee", | ||
msg: "Invalid max claim fee.", | ||
}, | ||
], | ||
}; | ||
export const QuarryMineErrors = generateErrorMap(QuarryMineJSON); |
import type { Provider, TransactionEnvelope } from "@saberhq/solana-contrib"; | ||
import { getOrCreateATA } from "@saberhq/token-utils"; | ||
import type { PublicKey } from "@solana/web3.js"; | ||
@@ -41,2 +42,10 @@ import { Keypair, SystemProgram, SYSVAR_CLOCK_PUBKEY } from "@solana/web3.js"; | ||
); | ||
const { address: claimFeeTokenAccount, instruction: createATAInstruction } = | ||
await getOrCreateATA({ | ||
provider: this.provider, | ||
mint: mintWrapperData.tokenMint, | ||
owner: rewarderKey, | ||
}); | ||
return { | ||
@@ -46,2 +55,3 @@ key: rewarderKey, | ||
[ | ||
...(createATAInstruction ? [createATAInstruction] : []), | ||
this.program.instruction.newRewarder(bump, { | ||
@@ -58,2 +68,3 @@ accounts: { | ||
rewardsTokenMint: mintWrapperData.tokenMint, | ||
claimFeeTokenAccount, | ||
}, | ||
@@ -60,0 +71,0 @@ }), |
@@ -186,2 +186,3 @@ import type { Provider } from "@saberhq/solana-contrib"; | ||
stake: this.userStakeAccounts, | ||
claimFeeTokenAccount: this.quarry.rewarderData.claimFeeTokenAccount, | ||
}, | ||
@@ -188,0 +189,0 @@ }); |
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
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
333737
7844
43
12