@cks-systems/manifest-sdk
Version:
TypeScript SDK for Manifest
56 lines (55 loc) • 1.92 kB
TypeScript
import { PublicKey, Connection } from '@solana/web3.js';
import { bignum } from '@metaplex-foundation/beet';
export type GlobalDeposit = {
trader: PublicKey;
balanceAtoms: bignum;
};
export interface GlobalData {
mint: PublicKey;
vault: PublicKey;
globalDeposits: GlobalDeposit[];
numBytesAllocated: number;
numSeatsClaimed: number;
}
export declare class Global {
address: PublicKey;
private data;
private mintDecimals;
private constructor();
/**
* Returns a `Global` for a given address, a data buffer
*
* @param connection The Solana `Connection` object
* @param address The `PublicKey` of the global account
*/
static loadFromAddress({ connection, address, }: {
connection: Connection;
address: PublicKey;
}): Promise<Global | null>;
/**
* Returns a `Global` for a given address, a data buffer
*
* @param globalAddress The `PublicKey` of the global account
* @param buffer The buffer holding the market account data
*/
static loadFromBuffer({ address, buffer, }: {
address: PublicKey;
buffer: Buffer;
}): Global;
reload(connection: Connection): Promise<void>;
getMintDecimals(connection: Connection): Promise<number>;
getGlobalBalanceTokens(connection: Connection, trader: PublicKey): Promise<number>;
getGlobalBalanceTokensWithDecimals(trader: PublicKey, decimals: number): number;
tokenMint(): PublicKey;
hasSeat(trader: PublicKey): boolean;
prettyPrint(): void;
/**
* Deserializes global data from a given mint and returns a `Global` object
*
* This includes both the fixed and dynamic parts of the market.
* https://github.com/CKS-Systems/manifest/blob/main/programs/manifest/src/state/global.rs
*
* @param data The data buffer to deserialize
*/
private static deserializeGlobalBuffer;
}