Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solana/spl-governance

Package Overview
Dependencies
Maintainers
12
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/spl-governance - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

lib/accounts.d.ts

3

lib/chat/api.d.ts

@@ -6,2 +6,5 @@ import { PublicKey } from '@solana/web3.js';

}>;
export declare function getGovernanceChatMessagesByVoter(endpoint: string, voter: PublicKey): Promise<{
[pubKey: string]: import("..").ProgramAccount<ChatMessage>;
}>;
//# sourceMappingURL=api.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGovernanceChatMessages = void 0;
exports.getGovernanceChatMessagesByVoter = exports.getGovernanceChatMessages = void 0;
var api_1 = require("../core/api");

@@ -11,2 +11,6 @@ var accounts_1 = require("./accounts");

exports.getGovernanceChatMessages = getGovernanceChatMessages;
function getGovernanceChatMessagesByVoter(endpoint, voter) {
return (0, api_1.getBorshProgramAccounts)(accounts_1.GOVERNANCE_CHAT_PROGRAM_ID, function (_) { return serialisation_1.GOVERNANCE_CHAT_SCHEMA; }, endpoint, accounts_1.ChatMessage, [(0, api_1.pubkeyFilter)(33, voter)]);
}
exports.getGovernanceChatMessagesByVoter = getGovernanceChatMessagesByVoter;
//# sourceMappingURL=api.js.map

4

lib/chat/withPostChatMessage.d.ts

@@ -1,4 +0,4 @@

import { Account, PublicKey, TransactionInstruction } from '@solana/web3.js';
import { Keypair, PublicKey, TransactionInstruction } from '@solana/web3.js';
import { ChatMessageBody } from './accounts';
export declare function withPostChatMessage(instructions: TransactionInstruction[], signers: Account[], governanceProgramId: PublicKey, governance: PublicKey, proposal: PublicKey, tokenOwnerRecord: PublicKey, governanceAuthority: PublicKey, payer: PublicKey, replyTo: PublicKey | undefined, body: ChatMessageBody): Promise<void>;
export declare function withPostChatMessage(instructions: TransactionInstruction[], signers: Keypair[], governanceProgramId: PublicKey, governance: PublicKey, proposal: PublicKey, tokenOwnerRecord: PublicKey, governanceAuthority: PublicKey, payer: PublicKey, replyTo: PublicKey | undefined, body: ChatMessageBody): Promise<void>;
//# sourceMappingURL=withPostChatMessage.d.ts.map

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

data = Buffer.from((0, borsh_1.serialize)(serialisation_1.GOVERNANCE_CHAT_SCHEMA, args));
chatMessage = new web3_js_1.Account();
chatMessage = new web3_js_1.Keypair();
signers.push(chatMessage);

@@ -57,0 +57,0 @@ keys = [

@@ -28,3 +28,3 @@ import { PublicKey } from '@solana/web3.js';

export declare function getAccountTypes(accountClass: GovernanceAccountClass): GovernanceAccountType[];
export declare function getAccountProgramVersion(accountType: GovernanceAccountType): 1 | 2;
export declare function getAccountProgramVersion(accountType: GovernanceAccountType): 2 | 1;
export declare enum VoteThresholdPercentageType {

@@ -70,2 +70,3 @@ YesVote = 0,

getSupplyFraction(): BN;
fmtSupplyFractionPercentage(): string;
}

@@ -297,2 +298,6 @@ export declare enum VoteTypeKind {

getNoVoteCount(): BN;
getTimeToVoteEnd(governance: Governance): number;
hasVoteTimeEnded(governance: Governance): boolean;
canCancel(governance: Governance): boolean;
canWalletCancel(governance: Governance, proposalOwner: TokenOwnerRecord, walletPk: PublicKey): boolean | undefined;
}

@@ -299,0 +304,0 @@ export declare class SignatoryRecord {

@@ -45,4 +45,6 @@ "use strict";

var bn_js_1 = __importDefault(require("bn.js"));
var bignumber_js_1 = __importDefault(require("bignumber.js"));
var instructions_1 = require("./instructions");
var constants_1 = require("../registry/constants");
var moment_1 = __importDefault(require("moment"));
/// Seed prefix for Governance Program PDAs

@@ -169,2 +171,7 @@ exports.GOVERNANCE_PROGRAM_SEED = 'governance';

};
MintMaxVoteWeightSource.prototype.fmtSupplyFractionPercentage = function () {
return new bignumber_js_1.default(this.getSupplyFraction())
.shiftedBy(-MintMaxVoteWeightSource.SUPPLY_FRACTION_DECIMALS + 2)
.toFormat();
};
MintMaxVoteWeightSource.SUPPLY_FRACTION_BASE = new bn_js_1.default(10000000000);

@@ -512,2 +519,33 @@ MintMaxVoteWeightSource.SUPPLY_FRACTION_DECIMALS = 10;

};
Proposal.prototype.getTimeToVoteEnd = function (governance) {
var _a, _b;
var now = (0, moment_1.default)().unix();
return this.isPreVotingState()
? governance.config.maxVotingTime
: ((_b = (_a = this.votingAt) === null || _a === void 0 ? void 0 : _a.toNumber()) !== null && _b !== void 0 ? _b : 0) +
governance.config.maxVotingTime -
now;
};
Proposal.prototype.hasVoteTimeEnded = function (governance) {
return this.getTimeToVoteEnd(governance) <= 0;
};
Proposal.prototype.canCancel = function (governance) {
if (this.state === ProposalState.Draft ||
this.state === ProposalState.SigningOff) {
return true;
}
if (this.state === ProposalState.Voting &&
!this.hasVoteTimeEnded(governance)) {
return true;
}
return false;
};
Proposal.prototype.canWalletCancel = function (governance, proposalOwner, walletPk) {
var _a;
if (!this.canCancel(governance)) {
return false;
}
return (proposalOwner.governingTokenOwner.equals(walletPk) ||
((_a = proposalOwner.governanceDelegate) === null || _a === void 0 ? void 0 : _a.equals(walletPk)));
};
return Proposal;

@@ -514,0 +552,0 @@ }());

import { SendTransactionError } from '../tools/sdk/runtime';
import { WalletNotConnectedError } from '../tools/walletAdapter';
export declare const GovernanceError: Record<number, string>;

@@ -7,3 +6,2 @@ export declare const TokenError: Record<number, string>;

export declare function getTransactionErrorMsg(error: SendTransactionError): any;
export declare function isWalletNotConnectedError(error: any): error is WalletNotConnectedError;
//# sourceMappingURL=errors.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isWalletNotConnectedError = exports.getTransactionErrorMsg = exports.GovernanceToolsError = exports.TokenError = exports.GovernanceError = void 0;
var walletAdapter_1 = require("../tools/walletAdapter");
exports.getTransactionErrorMsg = exports.GovernanceToolsError = exports.TokenError = exports.GovernanceError = void 0;
exports.GovernanceError = [

@@ -149,6 +148,2 @@ 'Invalid instruction passed to program',

exports.getTransactionErrorMsg = getTransactionErrorMsg;
function isWalletNotConnectedError(error) {
return error instanceof walletAdapter_1.WalletNotConnectedError;
}
exports.isWalletNotConnectedError = isWalletNotConnectedError;
//# sourceMappingURL=errors.js.map

@@ -1,2 +0,1 @@

/// <reference types="node" />
import { TransactionInstruction } from '@solana/web3.js';

@@ -3,0 +2,0 @@ import { InstructionData, GovernanceAccountClass, GovernanceAccountType } from './accounts';

@@ -14,2 +14,3 @@ import { PublicKey, Transaction } from '@solana/web3.js';

}
export declare function isWalletNotConnectedError(error: any): error is WalletNotConnectedError;
//# sourceMappingURL=walletAdapter.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isWalletNotConnectedError = void 0;
function isWalletNotConnectedError(error) {
return error instanceof WalletNotConnectedError;
}
exports.isWalletNotConnectedError = isWalletNotConnectedError;
//# sourceMappingURL=walletAdapter.js.map
{
"name": "@solana/spl-governance",
"version": "0.0.5",
"version": "0.0.6",
"description": "SPL Governance Client API",

@@ -33,5 +33,7 @@ "author": "Solana Maintainers <maintainers@solana.foundation>",

"@solana/web3.js": "^1.22.0",
"bignumber.js": "^9.0.1",
"bn.js": "^5.1.3",
"bs58": "^4.0.1",
"borsh": "^0.3.1"
"borsh": "^0.3.1",
"moment": "^2.29.1"
},

@@ -38,0 +40,0 @@ "devDependencies": {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc