@solana/spl-governance
Advanced tools
Comparing version 0.0.29 to 0.0.30
@@ -5,4 +5,7 @@ import { Connection, PublicKey } from '@solana/web3.js'; | ||
import { ProgramAccount } from '../tools/sdk/runtime'; | ||
import { RealmConfigAccount } from '.'; | ||
export declare function getRealm(connection: Connection, realm: PublicKey): Promise<ProgramAccount<Realm>>; | ||
export declare function getRealms(connection: Connection, programId: PublicKey): Promise<ProgramAccount<Realm>[]>; | ||
export declare function getRealmConfig(connection: Connection, realmConfigPk: PublicKey): Promise<ProgramAccount<RealmConfigAccount>>; | ||
export declare function tryGetRealmConfig(connection: Connection, realmConfigPk: PublicKey): Promise<ProgramAccount<RealmConfigAccount> | undefined>; | ||
export declare function getVoteRecordsByVoter(connection: Connection, programId: PublicKey, voter: PublicKey): Promise<ProgramAccount<VoteRecord>[]>; | ||
@@ -61,2 +64,3 @@ export declare function getTokenOwnerRecordForRealm(connection: Connection, programId: PublicKey, realm: PublicKey, governingTokenMint: PublicKey, governingTokenOwner: PublicKey): Promise<ProgramAccount<TokenOwnerRecord>>; | ||
export declare function getGovernanceAccount<TAccount extends GovernanceAccount>(connection: Connection, accountPk: PublicKey, accountClass: new (args: any) => TAccount): Promise<ProgramAccount<TAccount>>; | ||
export declare function tryGetGovernanceAccount<TAccount extends GovernanceAccount>(connection: Connection, accountPk: PublicKey, accountClass: new (args: any) => TAccount | undefined): Promise<ProgramAccount<TAccount> | undefined>; | ||
//# sourceMappingURL=api.d.ts.map |
@@ -12,6 +12,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
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; | ||
exports.tryGetGovernanceAccount = exports.getGovernanceAccount = exports.getGovernanceAccounts = exports.getAllProposals = exports.getProposalsByGovernance = exports.getProposal = exports.getAllGovernances = exports.getGovernance = exports.getAllTokenOwnerRecords = exports.getTokenOwnerRecordsByOwner = exports.getTokenOwnerRecordForRealm = exports.getVoteRecordsByVoter = exports.tryGetRealmConfig = exports.getRealmConfig = exports.getRealms = exports.getRealm = void 0; | ||
const serialisation_1 = require("./serialisation"); | ||
const accounts_1 = require("./accounts"); | ||
const api_1 = require("../core/api"); | ||
const _1 = require("."); | ||
// Realms | ||
@@ -30,3 +31,20 @@ function getRealm(connection, realm) { | ||
exports.getRealms = getRealms; | ||
function getRealmConfig(connection, realmConfigPk) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return getGovernanceAccount(connection, realmConfigPk, _1.RealmConfigAccount); | ||
}); | ||
} | ||
exports.getRealmConfig = getRealmConfig; | ||
// Realm config | ||
// export async function tryGetRealmConfig(connection: Connection, programId: PublicKey, realm: PublicKey) { | ||
// const realmConfigPk = await getRealmConfigAddress(programId,realm); | ||
// return tryGetGovernanceAccount(connection, realmConfigPk, RealmConfigAccount); | ||
// } | ||
// VoteRecords | ||
function tryGetRealmConfig(connection, realmConfigPk) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return tryGetGovernanceAccount(connection, realmConfigPk, _1.RealmConfigAccount); | ||
}); | ||
} | ||
exports.tryGetRealmConfig = tryGetRealmConfig; | ||
function getVoteRecordsByVoter(connection, programId, voter) { | ||
@@ -165,2 +183,11 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.getGovernanceAccount = getGovernanceAccount; | ||
function tryGetGovernanceAccount(connection, accountPk, accountClass) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const accountInfo = yield connection.getAccountInfo(accountPk); | ||
if (accountInfo) { | ||
return (0, serialisation_1.GovernanceAccountParser)(accountClass)(accountPk, accountInfo); | ||
} | ||
}); | ||
} | ||
exports.tryGetGovernanceAccount = tryGetGovernanceAccount; | ||
//# sourceMappingURL=api.js.map |
{ | ||
"name": "@solana/spl-governance", | ||
"version": "0.0.29", | ||
"version": "0.0.30", | ||
"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
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
419387
6031