@solana/spl-governance
Advanced tools
Comparing version 0.0.26 to 0.0.27
@@ -10,6 +10,6 @@ import { Connection, PublicKey } from '@solana/web3.js'; | ||
/** | ||
* Returns TokenOwnerRecords for given token owner | ||
* Returns TokenOwnerRecords for the given token owner (voter) | ||
* Note: The function returns TokenOwnerRecords for both council and community token holders | ||
* | ||
* @param rpcEndpoint | ||
* @param connection | ||
* @param programId | ||
@@ -20,7 +20,43 @@ * @param governingTokenOwner | ||
export declare function getTokenOwnerRecordsByOwner(connection: Connection, programId: PublicKey, governingTokenOwner: PublicKey): Promise<ProgramAccount<TokenOwnerRecord>[]>; | ||
/** | ||
* Returns all TokenOwnerRecords for all members for the given Realm | ||
* Note: The function returns TokenOwnerRecords for both council and community token holders | ||
* | ||
* @param connection | ||
* @param programId | ||
* @param realmPk | ||
* @returns | ||
*/ | ||
export declare function getAllTokenOwnerRecords(connection: Connection, programId: PublicKey, realmPk: PublicKey): Promise<ProgramAccount<TokenOwnerRecord>[]>; | ||
export declare function getGovernance(connection: Connection, governance: PublicKey): Promise<ProgramAccount<Governance>>; | ||
/** | ||
* Returns all governances for the given program instance and realm | ||
* | ||
* @param connection | ||
* @param programId | ||
* @param realmPk | ||
* @returns | ||
*/ | ||
export declare function getAllGovernances(connection: Connection, programId: PublicKey, realmPk: PublicKey): Promise<ProgramAccount<Governance>[]>; | ||
export declare function getProposal(connection: Connection, proposal: PublicKey): Promise<ProgramAccount<Proposal>>; | ||
/** | ||
* Returns all Proposals for the given Governance | ||
* | ||
* @param connection | ||
* @param programId | ||
* @param governancePk | ||
* @returns | ||
*/ | ||
export declare function getProposalsByGovernance(connection: Connection, programId: PublicKey, governancePk: PublicKey): Promise<ProgramAccount<Proposal>[]>; | ||
/** | ||
* Returns all Proposals for the given Realm | ||
* | ||
* @param connection | ||
* @param programId | ||
* @param realmPk | ||
* @returns | ||
*/ | ||
export declare function getAllProposals(connection: Connection, programId: PublicKey, realmPk: PublicKey): Promise<ProgramAccount<Proposal>[][]>; | ||
export declare function getGovernanceAccounts<TAccount extends GovernanceAccount>(connection: Connection, programId: PublicKey, accountClass: new (args: any) => TAccount, filters?: MemcmpFilter[]): Promise<ProgramAccount<TAccount>[]>; | ||
export declare function getGovernanceAccount<TAccount extends GovernanceAccount>(connection: Connection, accountPk: PublicKey, accountClass: new (args: any) => TAccount): Promise<ProgramAccount<TAccount>>; | ||
//# sourceMappingURL=api.d.ts.map |
@@ -12,3 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getGovernanceAccount = exports.getGovernanceAccounts = exports.getProposal = exports.getAllGovernances = exports.getGovernance = exports.getTokenOwnerRecordsByOwner = exports.getTokenOwnerRecordForRealm = exports.getVoteRecordsByVoter = exports.getRealms = exports.getRealm = void 0; | ||
exports.getGovernanceAccount = exports.getGovernanceAccounts = exports.getAllProposals = exports.getProposalsByGovernance = exports.getProposal = exports.getAllGovernances = exports.getGovernance = exports.getAllTokenOwnerRecords = exports.getTokenOwnerRecordsByOwner = exports.getTokenOwnerRecordForRealm = exports.getVoteRecordsByVoter = exports.getRealms = exports.getRealm = void 0; | ||
const serialisation_1 = require("./serialisation"); | ||
@@ -48,6 +48,6 @@ const accounts_1 = require("./accounts"); | ||
/** | ||
* Returns TokenOwnerRecords for given token owner | ||
* Returns TokenOwnerRecords for the given token owner (voter) | ||
* Note: The function returns TokenOwnerRecords for both council and community token holders | ||
* | ||
* @param rpcEndpoint | ||
* @param connection | ||
* @param programId | ||
@@ -65,2 +65,19 @@ * @param governingTokenOwner | ||
exports.getTokenOwnerRecordsByOwner = getTokenOwnerRecordsByOwner; | ||
/** | ||
* Returns all TokenOwnerRecords for all members for the given Realm | ||
* Note: The function returns TokenOwnerRecords for both council and community token holders | ||
* | ||
* @param connection | ||
* @param programId | ||
* @param realmPk | ||
* @returns | ||
*/ | ||
function getAllTokenOwnerRecords(connection, programId, realmPk) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return getGovernanceAccounts(connection, programId, accounts_1.TokenOwnerRecord, [ | ||
(0, api_1.pubkeyFilter)(1, realmPk), | ||
]); | ||
}); | ||
} | ||
exports.getAllTokenOwnerRecords = getAllTokenOwnerRecords; | ||
// Governances | ||
@@ -73,2 +90,10 @@ function getGovernance(connection, governance) { | ||
exports.getGovernance = getGovernance; | ||
/** | ||
* Returns all governances for the given program instance and realm | ||
* | ||
* @param connection | ||
* @param programId | ||
* @param realmPk | ||
* @returns | ||
*/ | ||
function getAllGovernances(connection, programId, realmPk) { | ||
@@ -89,2 +114,32 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.getProposal = getProposal; | ||
/** | ||
* Returns all Proposals for the given Governance | ||
* | ||
* @param connection | ||
* @param programId | ||
* @param governancePk | ||
* @returns | ||
*/ | ||
function getProposalsByGovernance(connection, programId, governancePk) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return getGovernanceAccounts(connection, programId, accounts_1.Proposal, [ | ||
(0, api_1.pubkeyFilter)(1, governancePk), | ||
]); | ||
}); | ||
} | ||
exports.getProposalsByGovernance = getProposalsByGovernance; | ||
/** | ||
* Returns all Proposals for the given Realm | ||
* | ||
* @param connection | ||
* @param programId | ||
* @param realmPk | ||
* @returns | ||
*/ | ||
function getAllProposals(connection, programId, realmPk) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return getAllGovernances(connection, programId, realmPk).then(gs => Promise.all(gs.map(g => getProposalsByGovernance(connection, programId, g.pubkey)))); | ||
}); | ||
} | ||
exports.getAllProposals = getAllProposals; | ||
// Generic API | ||
@@ -91,0 +146,0 @@ function getGovernanceAccounts(connection, programId, accountClass, filters = []) { |
@@ -66,3 +66,3 @@ "use strict"; | ||
const getVersion = yield (0, runtime_1.simulateTransaction)(connection, transaction, 'recent'); | ||
if (!getVersion.value.err && getVersion.value.logs) { | ||
if (getVersion.value.logs) { | ||
const prefix = 'PROGRAM-VERSION:"'; | ||
@@ -69,0 +69,0 @@ const simVersion = getVersion.value.logs |
{ | ||
"name": "@solana/spl-governance", | ||
"version": "0.0.26", | ||
"version": "0.0.27", | ||
"description": "SPL Governance Client API", | ||
@@ -5,0 +5,0 @@ "author": "Solana Maintainers <maintainers@solana.foundation>", |
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
411904
5960