@unloc-xyz/unloc-sdk
Version:
442 lines • 12 kB
TypeScript
/// <reference types="node" />
import * as anchor from "@project-serum/anchor";
import { BN } from "@project-serum/anchor";
import { UnlocVoting } from "../types/unloc_voting";
export declare const VOTING_GLOBAL_STATE_TAG: Buffer;
export declare const VOTING_TAG: Buffer;
export declare const VOTING_ITEM_TAG: Buffer;
export declare const VOTING_USER_TAG: Buffer;
export declare let votingProgram: anchor.Program<UnlocVoting>;
export declare let votingProgramProvider: anchor.AnchorProvider;
export declare let votingProgramId: anchor.web3.PublicKey;
export declare const initVotingProgram: (wallet: any, connection?: anchor.web3.Connection, pid?: anchor.web3.PublicKey) => void;
export declare const setVotingGlobalState: (newSuperOwner: anchor.web3.PublicKey, stakingPid?: anchor.web3.PublicKey, signer?: anchor.web3.PublicKey, signers?: anchor.web3.Keypair[]) => Promise<void>;
export declare const createVoting: (votingStartTimestamp: BN, votingEndTimestamp: BN, signer?: anchor.web3.PublicKey, signers?: anchor.web3.Keypair[]) => Promise<void>;
export declare const setVoting: (votingNumber: BN, votingStartTimestamp: BN, votingEndTimestamp: BN, signer?: anchor.web3.PublicKey, signers?: anchor.web3.Keypair[]) => Promise<void>;
export declare const setVotingItem: (collectionKey: anchor.web3.PublicKey, voting: anchor.web3.PublicKey, signer?: anchor.web3.PublicKey, signers?: anchor.web3.Keypair[]) => Promise<void>;
export declare const delVotingItem: (votingItem: anchor.web3.PublicKey, signer?: anchor.web3.PublicKey, signers?: anchor.web3.Keypair[]) => Promise<void>;
export declare const vote: (votingItem: anchor.web3.PublicKey, signer?: anchor.web3.PublicKey, signers?: anchor.web3.Keypair[]) => Promise<void>;
export declare const getVotingGlobalState: () => Promise<import("@project-serum/anchor/dist/cjs/program/namespace/types").TypeDef<{
name: "globalState";
type: {
kind: "struct";
fields: [{
name: "superOwner";
type: "publicKey";
}, {
name: "stakingPid";
type: "publicKey";
}, {
name: "votingCount";
type: "u64";
}];
};
} | {
name: "voting";
type: {
kind: "struct";
fields: [{
name: "votingNumber";
type: "u64";
}, {
name: "votingStartTimestamp";
type: "u64";
}, {
name: "votingEndTimestamp";
type: "u64";
}, {
name: "totalScore";
type: "u128";
}, {
name: "totalItems";
type: "u64";
}];
};
} | {
name: "votingItem";
type: {
kind: "struct";
fields: [{
name: "key";
type: "publicKey";
}, {
name: "voting";
type: "publicKey";
}, {
name: "votingScore";
type: "u128";
}];
};
} | {
name: "votingUser";
type: {
kind: "struct";
fields: [{
name: "owner";
type: "publicKey";
}, {
name: "voting";
type: "publicKey";
}, {
name: "votingItem";
type: "publicKey";
}, {
name: "votingScore";
type: "u128";
}];
};
}, anchor.IdlTypes<UnlocVoting>>>;
export declare const getVoting: (votingNumber: BN) => Promise<import("@project-serum/anchor/dist/cjs/program/namespace/types").TypeDef<{
name: "globalState";
type: {
kind: "struct";
fields: [{
name: "superOwner";
type: "publicKey";
}, {
name: "stakingPid";
type: "publicKey";
}, {
name: "votingCount";
type: "u64";
}];
};
} | {
name: "voting";
type: {
kind: "struct";
fields: [{
name: "votingNumber";
type: "u64";
}, {
name: "votingStartTimestamp";
type: "u64";
}, {
name: "votingEndTimestamp";
type: "u64";
}, {
name: "totalScore";
type: "u128";
}, {
name: "totalItems";
type: "u64";
}];
};
} | {
name: "votingItem";
type: {
kind: "struct";
fields: [{
name: "key";
type: "publicKey";
}, {
name: "voting";
type: "publicKey";
}, {
name: "votingScore";
type: "u128";
}];
};
} | {
name: "votingUser";
type: {
kind: "struct";
fields: [{
name: "owner";
type: "publicKey";
}, {
name: "voting";
type: "publicKey";
}, {
name: "votingItem";
type: "publicKey";
}, {
name: "votingScore";
type: "u128";
}];
};
}, anchor.IdlTypes<UnlocVoting>>>;
export declare const getLastVoting: () => Promise<import("@project-serum/anchor/dist/cjs/program/namespace/types").TypeDef<{
name: "globalState";
type: {
kind: "struct";
fields: [{
name: "superOwner";
type: "publicKey";
}, {
name: "stakingPid";
type: "publicKey";
}, {
name: "votingCount";
type: "u64";
}];
};
} | {
name: "voting";
type: {
kind: "struct";
fields: [{
name: "votingNumber";
type: "u64";
}, {
name: "votingStartTimestamp";
type: "u64";
}, {
name: "votingEndTimestamp";
type: "u64";
}, {
name: "totalScore";
type: "u128";
}, {
name: "totalItems";
type: "u64";
}];
};
} | {
name: "votingItem";
type: {
kind: "struct";
fields: [{
name: "key";
type: "publicKey";
}, {
name: "voting";
type: "publicKey";
}, {
name: "votingScore";
type: "u128";
}];
};
} | {
name: "votingUser";
type: {
kind: "struct";
fields: [{
name: "owner";
type: "publicKey";
}, {
name: "voting";
type: "publicKey";
}, {
name: "votingItem";
type: "publicKey";
}, {
name: "votingScore";
type: "u128";
}];
};
}, anchor.IdlTypes<UnlocVoting>>>;
export declare const getLastVotingKey: () => Promise<anchor.web3.PublicKey>;
export declare const getVotingItem: (votingItem: anchor.web3.PublicKey) => Promise<import("@project-serum/anchor/dist/cjs/program/namespace/types").TypeDef<{
name: "globalState";
type: {
kind: "struct";
fields: [{
name: "superOwner";
type: "publicKey";
}, {
name: "stakingPid";
type: "publicKey";
}, {
name: "votingCount";
type: "u64";
}];
};
} | {
name: "voting";
type: {
kind: "struct";
fields: [{
name: "votingNumber";
type: "u64";
}, {
name: "votingStartTimestamp";
type: "u64";
}, {
name: "votingEndTimestamp";
type: "u64";
}, {
name: "totalScore";
type: "u128";
}, {
name: "totalItems";
type: "u64";
}];
};
} | {
name: "votingItem";
type: {
kind: "struct";
fields: [{
name: "key";
type: "publicKey";
}, {
name: "voting";
type: "publicKey";
}, {
name: "votingScore";
type: "u128";
}];
};
} | {
name: "votingUser";
type: {
kind: "struct";
fields: [{
name: "owner";
type: "publicKey";
}, {
name: "voting";
type: "publicKey";
}, {
name: "votingItem";
type: "publicKey";
}, {
name: "votingScore";
type: "u128";
}];
};
}, anchor.IdlTypes<UnlocVoting>>>;
export declare const getAllVotingItems: () => Promise<anchor.ProgramAccount<import("@project-serum/anchor/dist/cjs/program/namespace/types").TypeDef<{
name: "globalState";
type: {
kind: "struct";
fields: [{
name: "superOwner";
type: "publicKey";
}, {
name: "stakingPid";
type: "publicKey";
}, {
name: "votingCount";
type: "u64";
}];
};
} | {
name: "voting";
type: {
kind: "struct";
fields: [{
name: "votingNumber";
type: "u64";
}, {
name: "votingStartTimestamp";
type: "u64";
}, {
name: "votingEndTimestamp";
type: "u64";
}, {
name: "totalScore";
type: "u128";
}, {
name: "totalItems";
type: "u64";
}];
};
} | {
name: "votingItem";
type: {
kind: "struct";
fields: [{
name: "key";
type: "publicKey";
}, {
name: "voting";
type: "publicKey";
}, {
name: "votingScore";
type: "u128";
}];
};
} | {
name: "votingUser";
type: {
kind: "struct";
fields: [{
name: "owner";
type: "publicKey";
}, {
name: "voting";
type: "publicKey";
}, {
name: "votingItem";
type: "publicKey";
}, {
name: "votingScore";
type: "u128";
}];
};
}, anchor.IdlTypes<UnlocVoting>>>[]>;
export declare const getVotingItemKey: (collectionKey: anchor.web3.PublicKey, voting: anchor.web3.PublicKey) => Promise<anchor.web3.PublicKey>;
export declare const getVotingUser: (voting: anchor.web3.PublicKey, signer?: anchor.web3.PublicKey, signers?: anchor.web3.Keypair[]) => Promise<import("@project-serum/anchor/dist/cjs/program/namespace/types").TypeDef<{
name: "globalState";
type: {
kind: "struct";
fields: [{
name: "superOwner";
type: "publicKey";
}, {
name: "stakingPid";
type: "publicKey";
}, {
name: "votingCount";
type: "u64";
}];
};
} | {
name: "voting";
type: {
kind: "struct";
fields: [{
name: "votingNumber";
type: "u64";
}, {
name: "votingStartTimestamp";
type: "u64";
}, {
name: "votingEndTimestamp";
type: "u64";
}, {
name: "totalScore";
type: "u128";
}, {
name: "totalItems";
type: "u64";
}];
};
} | {
name: "votingItem";
type: {
kind: "struct";
fields: [{
name: "key";
type: "publicKey";
}, {
name: "voting";
type: "publicKey";
}, {
name: "votingScore";
type: "u128";
}];
};
} | {
name: "votingUser";
type: {
kind: "struct";
fields: [{
name: "owner";
type: "publicKey";
}, {
name: "voting";
type: "publicKey";
}, {
name: "votingItem";
type: "publicKey";
}, {
name: "votingScore";
type: "u128";
}];
};
}, anchor.IdlTypes<UnlocVoting>>>;
export declare const getVotingUserKey: (voting: anchor.web3.PublicKey, signer?: anchor.web3.PublicKey, signers?: anchor.web3.Keypair[]) => Promise<anchor.web3.PublicKey>;
//# sourceMappingURL=index.d.ts.map