@orca-so/aquafarm
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -12,3 +12,3 @@ import { u64 } from "@solana/spl-token"; | ||
} | ||
export declare function constructInitGlobalFarmIx(globalFarmStatePubkey: PublicKey, baseTokenMintPubkey: PublicKey, globalBaseTokenVaultPubkey: PublicKey, rewardTokenVaultPubkey: PublicKey, farmTokenMintPubkey: PublicKey, emissionsAuthorityPubkey: PublicKey, removeRewardsAuthorityPubkey: PublicKey, emissionsPerSecondNumerator: u64, emissionsPerSecondDenominator: u64, nonce: number, aquafarmProgramId: PublicKey): TransactionInstruction; | ||
export declare function constructInitGlobalFarmIx(globalFarmStatePubkey: PublicKey, baseTokenMintPubkey: PublicKey, globalBaseTokenVaultPubkey: PublicKey, rewardTokenVaultPubkey: PublicKey, farmTokenMintPubkey: PublicKey, emissionsAuthorityPubkey: PublicKey, removeRewardsAuthorityPubkey: PublicKey, emissionsPerSecondNumerator: u64, emissionsPerSecondDenominator: u64, nonce: number, aquafarmProgramId: PublicKey, funderPubkey: PublicKey): TransactionInstruction; | ||
export declare function constructInitUserFarmIx(globalFarmStatePubkey: PublicKey, userFarmStatePubkey: PublicKey, ownerPubkey: PublicKey, aquafarmProgramId: PublicKey): TransactionInstruction; | ||
@@ -18,3 +18,3 @@ export declare function constructConvertTokensIx(userFarmOwner: PublicKey, userTransferAuthority: PublicKey, userBaseTokenAccountPubkey: PublicKey, userFarmTokenAccountPubkey: PublicKey, userRewardTokenAccountPubkey: PublicKey, globalBaseTokenVaultPubkey: PublicKey, farmTokenMintPubkey: PublicKey, globalFarm: PublicKey, userFarm: PublicKey, globalRewardTokenVaultPubkey: PublicKey, authority: PublicKey, aquafarmProgramId: PublicKey, amountToConvert: u64): TransactionInstruction; | ||
export declare function constructHarvestIx(userFarmOwner: PublicKey, userRewardTokenAccountPubkey: PublicKey, globalBaseTokenVaultPubkey: PublicKey, globalFarm: PublicKey, userFarm: PublicKey, globalRewardTokenVaultPubkey: PublicKey, authority: PublicKey, aquafarmProgramId: PublicKey): TransactionInstruction; | ||
export declare function constructSetEmissionsPerSecondIx(emissionsAuthorityPubkey: PublicKey, globalFarmStatePubkey: PublicKey, aquafarmProgramId: PublicKey, numerator: u64, denominator: u64): TransactionInstruction; | ||
export declare function constructSetEmissionsPerSecondIx(emissionsAuthorityPubkey: PublicKey, globalFarmStatePubkey: PublicKey, globalBaseTokenVaultKey: PublicKey, aquafarmProgramId: PublicKey, numerator: u64, denominator: u64): TransactionInstruction; | ||
export declare function constructRemoveRewardsIx(globalFarmStatePubkey: PublicKey, removeRewardsAuthorityPubkey: PublicKey, destRewardTokenAccountPubkey: PublicKey, globalRewardTokenVaultPubkey: PublicKey, authority: PublicKey, aquafarmProgramId: PublicKey, amountToConvert: u64): TransactionInstruction; |
@@ -21,3 +21,3 @@ "use strict"; | ||
})(INSTRUCTIONS = exports.INSTRUCTIONS || (exports.INSTRUCTIONS = {})); | ||
function constructInitGlobalFarmIx(globalFarmStatePubkey, baseTokenMintPubkey, globalBaseTokenVaultPubkey, rewardTokenVaultPubkey, farmTokenMintPubkey, emissionsAuthorityPubkey, removeRewardsAuthorityPubkey, emissionsPerSecondNumerator, emissionsPerSecondDenominator, nonce, aquafarmProgramId) { | ||
function constructInitGlobalFarmIx(globalFarmStatePubkey, baseTokenMintPubkey, globalBaseTokenVaultPubkey, rewardTokenVaultPubkey, farmTokenMintPubkey, emissionsAuthorityPubkey, removeRewardsAuthorityPubkey, emissionsPerSecondNumerator, emissionsPerSecondDenominator, nonce, aquafarmProgramId, funderPubkey) { | ||
const keys = [ | ||
@@ -33,2 +33,4 @@ { pubkey: baseTokenMintPubkey, isSigner: false, isWritable: false }, | ||
{ pubkey: globalFarmStatePubkey, isSigner: false, isWritable: true }, | ||
{ pubkey: funderPubkey, isSigner: true, isWritable: false }, | ||
{ pubkey: web3_js_1.SystemProgram.programId, isSigner: false, isWritable: false }, | ||
]; | ||
@@ -283,3 +285,3 @@ return new web3_js_1.TransactionInstruction({ | ||
exports.constructHarvestIx = constructHarvestIx; | ||
function constructSetEmissionsPerSecondIx(emissionsAuthorityPubkey, globalFarmStatePubkey, aquafarmProgramId, numerator, denominator) { | ||
function constructSetEmissionsPerSecondIx(emissionsAuthorityPubkey, globalFarmStatePubkey, globalBaseTokenVaultKey, aquafarmProgramId, numerator, denominator) { | ||
return new web3_js_1.TransactionInstruction({ | ||
@@ -297,2 +299,7 @@ keys: [ | ||
}, | ||
{ | ||
pubkey: globalBaseTokenVaultKey, | ||
isSigner: false, | ||
isWritable: false, | ||
}, | ||
], | ||
@@ -299,0 +306,0 @@ programId: aquafarmProgramId, |
@@ -44,1 +44,2 @@ import { PublicKey } from "@solana/web3.js"; | ||
export declare function getAuthorityAndNonce(publicKey: PublicKey, programId: PublicKey): Promise<[PublicKey, number]>; | ||
export declare function getGlobalFarmAddress(baseTokenMint: PublicKey, rewardTokenMint: PublicKey, funder: PublicKey, tokenProgramId: PublicKey, programId: PublicKey): Promise<[PublicKey, number]>; |
@@ -12,3 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getAuthorityAndNonce = void 0; | ||
exports.getGlobalFarmAddress = exports.getAuthorityAndNonce = void 0; | ||
const web3_js_1 = require("@solana/web3.js"); | ||
@@ -65,2 +65,13 @@ class GlobalFarm { | ||
exports.getAuthorityAndNonce = getAuthorityAndNonce; | ||
function getGlobalFarmAddress(baseTokenMint, rewardTokenMint, funder, tokenProgramId, programId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return web3_js_1.PublicKey.findProgramAddress([ | ||
baseTokenMint.toBuffer(), | ||
rewardTokenMint.toBuffer(), | ||
funder.toBuffer(), | ||
tokenProgramId.toBuffer(), | ||
], programId); | ||
}); | ||
} | ||
exports.getGlobalFarmAddress = getGlobalFarmAddress; | ||
//# sourceMappingURL=GlobalFarm.js.map |
@@ -19,2 +19,2 @@ import { PublicKey } from "@solana/web3.js"; | ||
} | ||
export declare function getUserFarmAddress(globalFarm: PublicKey, owner: PublicKey, aquafarmProgramId: PublicKey): Promise<[PublicKey, number]>; | ||
export declare function getUserFarmAddress(globalFarm: PublicKey, owner: PublicKey, tokenProgramId: PublicKey, aquafarmProgramId: PublicKey): Promise<[PublicKey, number]>; |
@@ -33,5 +33,5 @@ "use strict"; | ||
exports.default = UserFarm; | ||
function getUserFarmAddress(globalFarm, owner, aquafarmProgramId) { | ||
function getUserFarmAddress(globalFarm, owner, tokenProgramId, aquafarmProgramId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return web3_js_1.PublicKey.findProgramAddress([globalFarm.toBuffer(), owner.toBuffer()], aquafarmProgramId); | ||
return web3_js_1.PublicKey.findProgramAddress([globalFarm.toBuffer(), owner.toBuffer(), tokenProgramId.toBuffer()], aquafarmProgramId); | ||
}); | ||
@@ -38,0 +38,0 @@ } |
@@ -39,2 +39,3 @@ "use strict"; | ||
const UserFarm_2 = require("../models/UserFarm"); | ||
const spl_token_1 = require("@solana/spl-token"); | ||
function fetchBatchedAccountInfos(connection, pubkeys) { | ||
@@ -93,3 +94,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
const addresses = yield Promise.all(farmPubkeys.map((globalFarmPubkey) => __awaiter(this, void 0, void 0, function* () { | ||
return (yield UserFarm_2.getUserFarmAddress(globalFarmPubkey, userPubkey, programId))[0]; | ||
return (yield UserFarm_2.getUserFarmAddress(globalFarmPubkey, userPubkey, spl_token_1.TOKEN_PROGRAM_ID, programId))[0]; | ||
}))); | ||
@@ -96,0 +97,0 @@ const accountInfos = yield fetchBatchedAccountInfos(connection, addresses); |
@@ -27,2 +27,3 @@ /// <reference types="node" /> | ||
isInitialized: boolean; | ||
accountType: number; | ||
nonce: number; | ||
@@ -44,2 +45,3 @@ tokenProgramId: PublicKey; | ||
isInitialized: number; | ||
accountType: number; | ||
nonce: number; | ||
@@ -61,2 +63,3 @@ tokenProgramId: Uint8Array; | ||
isInitialized: boolean; | ||
accountType: number; | ||
owner: PublicKey; | ||
@@ -69,2 +72,3 @@ baseTokensConverted: u64; | ||
isInitialized: number; | ||
accountType: number; | ||
owner: Uint8Array; | ||
@@ -71,0 +75,0 @@ baseTokensConverted: Uint8Array; |
@@ -76,2 +76,3 @@ "use strict"; | ||
isInitialized: !!decoded.isInitialized, | ||
accountType: decoded.accountType, | ||
nonce: decoded.nonce, | ||
@@ -94,2 +95,3 @@ tokenProgramId: uint8ToPubkey(decoded.tokenProgramId), | ||
buffer_layout_1.default.u8("isInitialized"), | ||
buffer_layout_1.default.u8("accountType"), | ||
buffer_layout_1.default.u8("nonce"), | ||
@@ -121,2 +123,3 @@ exports.publicKey("tokenProgramId"), | ||
isInitialized: !!decoded.isInitialized, | ||
accountType: decoded.accountType, | ||
owner: uint8ToPubkey(decoded.owner), | ||
@@ -130,2 +133,3 @@ baseTokensConverted: uint8ToU64(decoded.baseTokensConverted), | ||
buffer_layout_1.default.u8("isInitialized"), | ||
buffer_layout_1.default.u8("accountType"), | ||
exports.publicKey("owner"), | ||
@@ -132,0 +136,0 @@ exports.uint64("baseTokensConverted"), |
{ | ||
"name": "@orca-so/aquafarm", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
70844
1044
22