New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@quarryprotocol/gauge

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@quarryprotocol/gauge - npm Package Compare versions

Comparing version

to
0.1.6

52

dist/cjs/idls/gauge.d.ts
export declare type GaugeIDL = {
version: "0.1.3";
version: "0.1.6";
name: "gauge";

@@ -529,2 +529,27 @@ instructions: [

args: [];
},
{
name: "setGaugemeisterParams";
accounts: [
{
name: "gaugemeister";
isMut: true;
isSigner: false;
},
{
name: "foreman";
isMut: false;
isSigner: true;
}
];
args: [
{
name: "newEpochDurationSeconds";
type: "u32";
},
{
name: "newForeman";
type: "publicKey";
}
];
}

@@ -1091,2 +1116,27 @@ ];

{
name: "SetGaugemeisterParamsEvent";
fields: [
{
name: "prevForeman";
type: "publicKey";
index: false;
},
{
name: "newForeman";
type: "publicKey";
index: false;
},
{
name: "prevEpochDurationSeconds";
type: "u32";
index: false;
},
{
name: "newEpochDurationSeconds";
type: "u32";
index: false;
}
];
},
{
name: "SyncGaugeEvent";

@@ -1093,0 +1143,0 @@ fields: [

@@ -6,3 +6,3 @@ "use strict";

exports.GaugeJSON = {
version: "0.1.3",
version: "0.1.6",
name: "gauge",

@@ -535,2 +535,27 @@ instructions: [

},
{
name: "setGaugemeisterParams",
accounts: [
{
name: "gaugemeister",
isMut: true,
isSigner: false,
},
{
name: "foreman",
isMut: false,
isSigner: true,
},
],
args: [
{
name: "newEpochDurationSeconds",
type: "u32",
},
{
name: "newForeman",
type: "publicKey",
},
],
},
],

@@ -1096,2 +1121,27 @@ accounts: [

{
name: "SetGaugemeisterParamsEvent",
fields: [
{
name: "prevForeman",
type: "publicKey",
index: false,
},
{
name: "newForeman",
type: "publicKey",
index: false,
},
{
name: "prevEpochDurationSeconds",
type: "u32",
index: false,
},
{
name: "newEpochDurationSeconds",
type: "u32",
index: false,
},
],
},
{
name: "SyncGaugeEvent",

@@ -1098,0 +1148,0 @@ fields: [

@@ -164,3 +164,6 @@ import type { TransactionEnvelope } from "@saberhq/solana-contrib";

*/
commitVotes({ gaugemeister, gauges, owner, payer, skipEpochGaugeCreation, }: {
commitVotes({ gaugemeister, gauges, owner, payer, skipEpochGaugeCreation, checkGaugeVotesExist, }: {
/**
* The key of the Gaugemeister.
*/
gaugemeister: PublicKey;

@@ -171,3 +174,9 @@ /**

gauges: PublicKey[];
/**
* Escrow owner.
*/
owner?: PublicKey;
/**
* Funder of the EpochGaugeVotes.
*/
payer?: PublicKey;

@@ -178,2 +187,6 @@ /**

skipEpochGaugeCreation?: boolean;
/**
* If true, checks to see that a GaugeVote exists for each Gauge provided.
*/
checkGaugeVotesExist?: boolean;
}): Promise<TransactionEnvelope[]>;

@@ -218,3 +231,11 @@ /**

}): Promise<TransactionEnvelope>;
/**
* Sets parameters on a given Gaugemeister.
*/
setGaugemeisterParams({ gaugemeister, newEpochDurationSeconds, newForeman, }: {
gaugemeister: PublicKey;
newEpochDurationSeconds?: number;
newForeman?: PublicKey;
}): Promise<TransactionEnvelope>;
}
//# sourceMappingURL=gauge.d.ts.map

38

dist/cjs/wrappers/gauge/gauge.js

@@ -405,3 +405,3 @@ "use strict";

*/
commitVotes({ gaugemeister, gauges, owner = this.provider.wallet.publicKey, payer = this.provider.wallet.publicKey, skipEpochGaugeCreation = false, }) {
commitVotes({ gaugemeister, gauges, owner = this.provider.wallet.publicKey, payer = this.provider.wallet.publicKey, skipEpochGaugeCreation = false, checkGaugeVotesExist = true, }) {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {

@@ -420,15 +420,14 @@ const gmData = yield this.fetchGaugemeister(gaugemeister);

})));
const gaugeVotesInfo = yield this.provider.connection.getMultipleAccountsInfo(myGaugeVotes.map((gv) => gv.gaugeVote));
const gaugeVotesInfo = checkGaugeVotesExist
? yield this.provider.connection.getMultipleAccountsInfo(myGaugeVotes.map((gv) => gv.gaugeVote))
: [];
const epochGaugesInfo = !skipEpochGaugeCreation
? yield this.provider.connection.getMultipleAccountsInfo(myGaugeVotes.map((gv) => gv.epochGauge))
: [];
const voteTXs = yield Promise.all(gaugeVotesInfo.map((gvi, i) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
if (!gvi) {
const voteTXs = yield Promise.all(myGaugeVotes.map((myGaugeVote, i) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
const { gaugeKey, gaugeVote, epochGauge, epochGaugeBump } = myGaugeVote;
// if the gauge vote doesn't exist, don't commit the vote.
if (checkGaugeVotesExist && !gaugeVotesInfo[i]) {
return null;
}
const myGaugeVote = myGaugeVotes[i];
if (!myGaugeVote) {
return null;
}
const { gaugeKey, gaugeVote, epochGauge, epochGaugeBump } = myGaugeVote;
const createEpochGauge = !skipEpochGaugeCreation && !epochGaugesInfo[i];

@@ -601,4 +600,25 @@ const [epochGaugeVoter] = yield (0, _1.findEpochGaugeVoterAddress)(gaugeVoter, votingEpoch);

}
/**
* Sets parameters on a given Gaugemeister.
*/
setGaugemeisterParams({ gaugemeister, newEpochDurationSeconds, newForeman, }) {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
const gmData = yield this.fetchGaugemeister(gaugemeister);
if (!gmData) {
throw new Error("gaugemeister data not found");
}
const epochDurationSeconds = newEpochDurationSeconds !== null && newEpochDurationSeconds !== void 0 ? newEpochDurationSeconds : gmData.epochDurationSeconds;
const foreman = newForeman !== null && newForeman !== void 0 ? newForeman : gmData.foreman;
return this.provider.newTX([
this.program.instruction.setGaugemeisterParams(epochDurationSeconds, foreman, {
accounts: {
gaugemeister,
foreman: gmData.foreman,
},
}),
]);
});
}
}
exports.GaugeWrapper = GaugeWrapper;
//# sourceMappingURL=gauge.js.map
export declare type GaugeIDL = {
version: "0.1.3";
version: "0.1.6";
name: "gauge";

@@ -529,2 +529,27 @@ instructions: [

args: [];
},
{
name: "setGaugemeisterParams";
accounts: [
{
name: "gaugemeister";
isMut: true;
isSigner: false;
},
{
name: "foreman";
isMut: false;
isSigner: true;
}
];
args: [
{
name: "newEpochDurationSeconds";
type: "u32";
},
{
name: "newForeman";
type: "publicKey";
}
];
}

@@ -1091,2 +1116,27 @@ ];

{
name: "SetGaugemeisterParamsEvent";
fields: [
{
name: "prevForeman";
type: "publicKey";
index: false;
},
{
name: "newForeman";
type: "publicKey";
index: false;
},
{
name: "prevEpochDurationSeconds";
type: "u32";
index: false;
},
{
name: "newEpochDurationSeconds";
type: "u32";
index: false;
}
];
},
{
name: "SyncGaugeEvent";

@@ -1093,0 +1143,0 @@ fields: [

import { generateErrorMap } from "@saberhq/anchor-contrib";
export const GaugeJSON = {
version: "0.1.3",
version: "0.1.6",
name: "gauge",

@@ -531,2 +531,27 @@ instructions: [

},
{
name: "setGaugemeisterParams",
accounts: [
{
name: "gaugemeister",
isMut: true,
isSigner: false,
},
{
name: "foreman",
isMut: false,
isSigner: true,
},
],
args: [
{
name: "newEpochDurationSeconds",
type: "u32",
},
{
name: "newForeman",
type: "publicKey",
},
],
},
],

@@ -1092,2 +1117,27 @@ accounts: [

{
name: "SetGaugemeisterParamsEvent",
fields: [
{
name: "prevForeman",
type: "publicKey",
index: false,
},
{
name: "newForeman",
type: "publicKey",
index: false,
},
{
name: "prevEpochDurationSeconds",
type: "u32",
index: false,
},
{
name: "newEpochDurationSeconds",
type: "u32",
index: false,
},
],
},
{
name: "SyncGaugeEvent",

@@ -1094,0 +1144,0 @@ fields: [

@@ -164,3 +164,6 @@ import type { TransactionEnvelope } from "@saberhq/solana-contrib";

*/
commitVotes({ gaugemeister, gauges, owner, payer, skipEpochGaugeCreation, }: {
commitVotes({ gaugemeister, gauges, owner, payer, skipEpochGaugeCreation, checkGaugeVotesExist, }: {
/**
* The key of the Gaugemeister.
*/
gaugemeister: PublicKey;

@@ -171,3 +174,9 @@ /**

gauges: PublicKey[];
/**
* Escrow owner.
*/
owner?: PublicKey;
/**
* Funder of the EpochGaugeVotes.
*/
payer?: PublicKey;

@@ -178,2 +187,6 @@ /**

skipEpochGaugeCreation?: boolean;
/**
* If true, checks to see that a GaugeVote exists for each Gauge provided.
*/
checkGaugeVotesExist?: boolean;
}): Promise<TransactionEnvelope[]>;

@@ -218,3 +231,11 @@ /**

}): Promise<TransactionEnvelope>;
/**
* Sets parameters on a given Gaugemeister.
*/
setGaugemeisterParams({ gaugemeister, newEpochDurationSeconds, newForeman, }: {
gaugemeister: PublicKey;
newEpochDurationSeconds?: number;
newForeman?: PublicKey;
}): Promise<TransactionEnvelope>;
}
//# sourceMappingURL=gauge.d.ts.map

@@ -402,3 +402,3 @@ import { __awaiter } from "tslib";

*/
commitVotes({ gaugemeister, gauges, owner = this.provider.wallet.publicKey, payer = this.provider.wallet.publicKey, skipEpochGaugeCreation = false, }) {
commitVotes({ gaugemeister, gauges, owner = this.provider.wallet.publicKey, payer = this.provider.wallet.publicKey, skipEpochGaugeCreation = false, checkGaugeVotesExist = true, }) {
return __awaiter(this, void 0, void 0, function* () {

@@ -417,15 +417,14 @@ const gmData = yield this.fetchGaugemeister(gaugemeister);

})));
const gaugeVotesInfo = yield this.provider.connection.getMultipleAccountsInfo(myGaugeVotes.map((gv) => gv.gaugeVote));
const gaugeVotesInfo = checkGaugeVotesExist
? yield this.provider.connection.getMultipleAccountsInfo(myGaugeVotes.map((gv) => gv.gaugeVote))
: [];
const epochGaugesInfo = !skipEpochGaugeCreation
? yield this.provider.connection.getMultipleAccountsInfo(myGaugeVotes.map((gv) => gv.epochGauge))
: [];
const voteTXs = yield Promise.all(gaugeVotesInfo.map((gvi, i) => __awaiter(this, void 0, void 0, function* () {
if (!gvi) {
const voteTXs = yield Promise.all(myGaugeVotes.map((myGaugeVote, i) => __awaiter(this, void 0, void 0, function* () {
const { gaugeKey, gaugeVote, epochGauge, epochGaugeBump } = myGaugeVote;
// if the gauge vote doesn't exist, don't commit the vote.
if (checkGaugeVotesExist && !gaugeVotesInfo[i]) {
return null;
}
const myGaugeVote = myGaugeVotes[i];
if (!myGaugeVote) {
return null;
}
const { gaugeKey, gaugeVote, epochGauge, epochGaugeBump } = myGaugeVote;
const createEpochGauge = !skipEpochGaugeCreation && !epochGaugesInfo[i];

@@ -598,3 +597,24 @@ const [epochGaugeVoter] = yield findEpochGaugeVoterAddress(gaugeVoter, votingEpoch);

}
/**
* Sets parameters on a given Gaugemeister.
*/
setGaugemeisterParams({ gaugemeister, newEpochDurationSeconds, newForeman, }) {
return __awaiter(this, void 0, void 0, function* () {
const gmData = yield this.fetchGaugemeister(gaugemeister);
if (!gmData) {
throw new Error("gaugemeister data not found");
}
const epochDurationSeconds = newEpochDurationSeconds !== null && newEpochDurationSeconds !== void 0 ? newEpochDurationSeconds : gmData.epochDurationSeconds;
const foreman = newForeman !== null && newForeman !== void 0 ? newForeman : gmData.foreman;
return this.provider.newTX([
this.program.instruction.setGaugemeisterParams(epochDurationSeconds, foreman, {
accounts: {
gaugemeister,
foreman: gmData.foreman,
},
}),
]);
});
}
}
//# sourceMappingURL=gauge.js.map
{
"name": "@quarryprotocol/gauge",
"version": "0.1.5",
"version": "0.1.6",
"description": "The TypeScript SDK for Quarry Gauge.",

@@ -36,3 +36,3 @@ "keywords": [

"@gokiprotocol/client": "^0.5.4",
"@project-serum/anchor": "^0.20.0",
"@project-serum/anchor": "^0.20.1",
"@quarryprotocol/quarry-sdk": "^1.11.9",

@@ -71,3 +71,2 @@ "@rushstack/eslint-patch": "^1.1.0",

"peerDependencies": {
"@gokiprotocol/client": "^0.5",
"@project-serum/anchor": ">=0.19",

@@ -74,0 +73,0 @@ "@quarryprotocol/quarry-sdk": "^1.11.5",

import { generateErrorMap } from "@saberhq/anchor-contrib";
export type GaugeIDL = {
version: "0.1.3";
version: "0.1.6";
name: "gauge";

@@ -531,2 +531,27 @@ instructions: [

args: [];
},
{
name: "setGaugemeisterParams";
accounts: [
{
name: "gaugemeister";
isMut: true;
isSigner: false;
},
{
name: "foreman";
isMut: false;
isSigner: true;
}
];
args: [
{
name: "newEpochDurationSeconds";
type: "u32";
},
{
name: "newForeman";
type: "publicKey";
}
];
}

@@ -1093,2 +1118,27 @@ ];

{
name: "SetGaugemeisterParamsEvent";
fields: [
{
name: "prevForeman";
type: "publicKey";
index: false;
},
{
name: "newForeman";
type: "publicKey";
index: false;
},
{
name: "prevEpochDurationSeconds";
type: "u32";
index: false;
},
{
name: "newEpochDurationSeconds";
type: "u32";
index: false;
}
];
},
{
name: "SyncGaugeEvent";

@@ -1188,3 +1238,3 @@ fields: [

export const GaugeJSON: GaugeIDL = {
version: "0.1.3",
version: "0.1.6",
name: "gauge",

@@ -1717,2 +1767,27 @@ instructions: [

},
{
name: "setGaugemeisterParams",
accounts: [
{
name: "gaugemeister",
isMut: true,
isSigner: false,
},
{
name: "foreman",
isMut: false,
isSigner: true,
},
],
args: [
{
name: "newEpochDurationSeconds",
type: "u32",
},
{
name: "newForeman",
type: "publicKey",
},
],
},
],

@@ -2278,2 +2353,27 @@ accounts: [

{
name: "SetGaugemeisterParamsEvent",
fields: [
{
name: "prevForeman",
type: "publicKey",
index: false,
},
{
name: "newForeman",
type: "publicKey",
index: false,
},
{
name: "prevEpochDurationSeconds",
type: "u32",
index: false,
},
{
name: "newEpochDurationSeconds",
type: "u32",
index: false,
},
],
},
{
name: "SyncGaugeEvent",

@@ -2280,0 +2380,0 @@ fields: [

@@ -586,3 +586,7 @@ import { QUARRY_ADDRESSES } from "@quarryprotocol/quarry-sdk";

skipEpochGaugeCreation = false,
checkGaugeVotesExist = true,
}: {
/**
* The key of the Gaugemeister.
*/
gaugemeister: PublicKey;

@@ -593,3 +597,9 @@ /**

gauges: PublicKey[];
/**
* Escrow owner.
*/
owner?: PublicKey;
/**
* Funder of the EpochGaugeVotes.
*/
payer?: PublicKey;

@@ -600,2 +610,6 @@ /**

skipEpochGaugeCreation?: boolean;
/**
* If true, checks to see that a GaugeVote exists for each Gauge provided.
*/
checkGaugeVotesExist?: boolean;
}): Promise<TransactionEnvelope[]> {

@@ -621,6 +635,9 @@ const gmData = await this.fetchGaugemeister(gaugemeister);

);
const gaugeVotesInfo =
await this.provider.connection.getMultipleAccountsInfo(
myGaugeVotes.map((gv) => gv.gaugeVote)
);
const gaugeVotesInfo = checkGaugeVotesExist
? await this.provider.connection.getMultipleAccountsInfo(
myGaugeVotes.map((gv) => gv.gaugeVote)
)
: [];
const epochGaugesInfo = !skipEpochGaugeCreation

@@ -633,13 +650,10 @@ ? await this.provider.connection.getMultipleAccountsInfo(

const voteTXs = await Promise.all(
gaugeVotesInfo.map(async (gvi, i) => {
if (!gvi) {
myGaugeVotes.map(async (myGaugeVote, i) => {
const { gaugeKey, gaugeVote, epochGauge, epochGaugeBump } = myGaugeVote;
// if the gauge vote doesn't exist, don't commit the vote.
if (checkGaugeVotesExist && !gaugeVotesInfo[i]) {
return null;
}
const myGaugeVote = myGaugeVotes[i];
if (!myGaugeVote) {
return null;
}
const { gaugeKey, gaugeVote, epochGauge, epochGaugeBump } = myGaugeVote;
const createEpochGauge = !skipEpochGaugeCreation && !epochGaugesInfo[i];

@@ -887,2 +901,37 @@

}
/**
* Sets parameters on a given Gaugemeister.
*/
async setGaugemeisterParams({
gaugemeister,
newEpochDurationSeconds,
newForeman,
}: {
gaugemeister: PublicKey;
newEpochDurationSeconds?: number;
newForeman?: PublicKey;
}): Promise<TransactionEnvelope> {
const gmData = await this.fetchGaugemeister(gaugemeister);
if (!gmData) {
throw new Error("gaugemeister data not found");
}
const epochDurationSeconds =
newEpochDurationSeconds ?? gmData.epochDurationSeconds;
const foreman = newForeman ?? gmData.foreman;
return this.provider.newTX([
this.program.instruction.setGaugemeisterParams(
epochDurationSeconds,
foreman,
{
accounts: {
gaugemeister,
foreman: gmData.foreman,
},
}
),
]);
}
}

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