@gmsol-labs/gmsol-sdk
Version:
GMX-Solana is an extension of GMX on the Solana blockchain.
1,375 lines (1,329 loc) • 29.7 kB
TypeScript
/* tslint:disable */
/* eslint-disable */
/**
* Get default [`StoreProgram`].
*/
export function default_store_program(): StoreProgram;
/**
* Create transaction builder for create-order ixs.
*/
export function create_orders_builder(kind: CreateOrderKind, orders: CreateOrderParams[], options: CreateOrderOptions): CreateOrdersBuilder;
/**
* Build transactions for creating orders.
*/
export function create_orders(kind: CreateOrderKind, orders: CreateOrderParams[], options: CreateOrderOptions): TransactionGroup;
/**
* Build transactions for closing orders.
*/
export function close_orders(args: CloseOrderArgs): TransactionGroup;
/**
* Build transactions for updating orders.
*/
export function update_orders(args: UpdateOrderArgs): TransactionGroup;
/**
* Apply `factor` to the `value`.
*/
export function apply_factor(value: bigint, factor: bigint): bigint | undefined;
/**
* Initialize Javascript logging and panic handler
*/
export function solana_program_init(): void;
/**
* Params for calculating market token price.
*/
export interface MarketTokenPriceParams {
/**
* Prices.
*/
prices: Prices;
/**
* Pnl Factor.
*/
pnl_factor?: PnlFactorKind;
/**
* Maximize.
*/
maximize: boolean;
}
/**
* Params for calculating market status.
*/
export interface MarketStatusParams {
/**
* Prices.
*/
prices: Prices;
}
/**
* Best swap path.
*/
export interface BestSwapPath {
/**
* Params.
*/
params: SwapEstimationParams;
/**
* Exchange rate.
*/
exchange_rate: bigint | undefined;
/**
* Path.
*/
path: string[];
/**
* Arbitrage exists.
*/
arbitrage_exists: boolean | undefined;
}
/**
* Arguments for order simulation.
*/
export interface SimulateOrderArgs {
kind: CreateOrderKind;
params: CreateOrderParams;
collateral_or_swap_out_token: StringPubkey;
pay_token?: StringPubkey | undefined;
receive_token?: StringPubkey | undefined;
swap_path?: StringPubkey[] | undefined;
prefer_swap_out_token_update?: boolean | undefined;
}
/**
* Simulation output for increase order.
*/
export interface IncreaseOrderSimulationOutput {
swaps: string[];
report: string;
position: string;
}
/**
* Simulation output for decrease order.
*/
export interface DecreaseOrderSimulationOutput {
swaps: string[];
report: string;
position: string;
decrease_swap: string | undefined;
}
/**
* Simulation output for swap order.
*/
export interface SwapOrderSimulationOutput {
output_token: StringPubkey;
amount: bigint;
report: string[];
}
/**
* Options for creating orders.
*/
export interface CreateOrderOptions {
recent_blockhash: string;
compute_unit_price_micro_lamports?: number | undefined;
compute_unit_min_priority_lamports?: number | undefined;
payer: StringPubkey;
collateral_or_swap_out_token: StringPubkey;
hints: Map<StringPubkey, CreateOrderHint>;
program?: StoreProgram | undefined;
pay_token?: StringPubkey | undefined;
receive_token?: StringPubkey | undefined;
swap_path?: StringPubkey[] | undefined;
skip_wrap_native_on_pay?: boolean | undefined;
skip_unwrap_native_on_receive?: boolean | undefined;
callback?: Callback | undefined;
transaction_group?: TransactionGroupOptions;
force_create_positions_in_parallel?: boolean | undefined;
force_create_positions?: boolean | undefined;
}
/**
* Parameters for closing orders.
*/
export interface CloseOrderArgs {
recent_blockhash: string;
compute_unit_price_micro_lamports?: number | undefined;
compute_unit_min_priority_lamports?: number | undefined;
payer: StringPubkey;
orders: Map<StringPubkey, CloseOrderHint>;
program?: StoreProgram | undefined;
transaction_group?: TransactionGroupOptions;
}
export interface UpdateParams {
params: UpdateOrderParams;
hint: UpdateOrderHint;
}
/**
* Parameters for updating orders.
*/
export interface UpdateOrderArgs {
recent_blockhash: string;
compute_unit_price_micro_lamports?: number | undefined;
compute_unit_min_priority_lamports?: number | undefined;
payer: StringPubkey;
orders: Map<StringPubkey, UpdateParams>;
program?: StoreProgram | undefined;
transaction_group?: TransactionGroupOptions;
}
/**
* A JS version transaction group options.
*/
export interface TransactionGroupOptions {
max_transaction_size?: number | undefined;
max_instructions_per_tx?: number | undefined;
luts?: Map<StringPubkey, StringPubkey[]>;
memo?: string | undefined;
}
/**
* Serialized transaction group.
*/
export type SerializedTransactionGroup = number[][][];
/**
* Build transaction options.
*/
export interface BuildTransactionOptions {
recent_blockhash: string;
compute_unit_price_micro_lamports?: number | undefined;
compute_unit_min_priority_lamports?: number | undefined;
}
/**
* A Base58-encoded string representing a public key.
*/
export type StringPubkey = string;
/**
* Config for [`MarketGraph`](super::MarketGraph).
*/
export interface MarketGraphConfig {
/**
* Estimation Params for swap.
*/
swap_estimation_params: SwapEstimationParams;
/**
* Max steps.
*/
max_steps: number;
}
/**
* Estimation Parameters for Swap.
*/
export interface SwapEstimationParams {
/**
* Value.
*/
value: bigint;
/**
* Base cost.
*/
base_cost: bigint;
}
/**
* Js Prices.
*/
export interface Prices {
/**
* Index token price.
*/
index_token: Value;
/**
* Long token price.
*/
long_token: Value;
/**
* Short token price.
*/
short_token: Value;
}
/**
* Position Status.
*/
export interface PositionStatus {
/**
* Entry price.
*/
entry_price: bigint;
/**
* Collateral value.
*/
collateral_value: bigint;
/**
* Pending PnL.
*/
pending_pnl: bigint;
/**
* Pending borrowing fee value.
*/
pending_borrowing_fee_value: bigint;
/**
* Pending funding fee value.
*/
pending_funding_fee_value: bigint;
/**
* Pending claimable funding fee value in long token.
*/
pending_claimable_funding_fee_value_in_long_token: bigint;
/**
* Pending claimable funding fee value in short token.
*/
pending_claimable_funding_fee_value_in_short_token: bigint;
/**
* Close order fee value.
*/
close_order_fee_value: bigint;
/**
* Net value.
*/
net_value: bigint;
/**
* Leverage.
*/
leverage: bigint | undefined;
/**
* Liquidation price.
*/
liquidation_price: bigint | undefined;
}
/**
* Market Status.
*/
export interface MarketStatus {
/**
* Funding fee rate per hour for long.
*/
funding_rate_per_second_for_long: bigint;
/**
* Funding fee rate per hour for short.
*/
funding_rate_per_second_for_short: bigint;
/**
* Borrowing fee rate per second for long.
*/
borrowing_rate_per_second_for_long: bigint;
/**
* Borrowing fee rate per second for short.
*/
borrowing_rate_per_second_for_short: bigint;
/**
* Pending pnl for long.
*/
pending_pnl_for_long: SignedValue;
/**
* Pending pnl for short.
*/
pending_pnl_for_short: SignedValue;
/**
* Reserved value for long.
*/
reserved_value_for_long: bigint;
/**
* Reserved value for short.
*/
reserved_value_for_short: bigint;
/**
* Max reserve value for long.
*/
max_reserve_value_for_long: bigint;
/**
* Max reserve value for short.
*/
max_reserve_value_for_short: bigint;
/**
* Pool value without pnl for long.
*/
pool_value_without_pnl_for_long: Value;
/**
* Pool value without pnl for short.
*/
pool_value_without_pnl_for_short: Value;
/**
* Liquidity for long.
*/
liquidity_for_long: bigint;
/**
* Liquidity for short.
*/
liquidity_for_short: bigint;
/**
* Max liquidity for long.
*/
max_liquidity_for_long: bigint;
/**
* Max liquidity for short.
*/
max_liquidity_for_short: bigint;
/**
* Open interest for long.
*/
open_interest_for_long: bigint;
/**
* Open interest for short.
*/
open_interest_for_short: bigint;
/**
* Open interest in tokens for long.
*/
open_interest_in_tokens_for_long: bigint;
/**
* Open interest in tokens for short.
*/
open_interest_in_tokens_for_short: bigint;
/**
* Min collateral factor for long.
*/
min_collateral_factor_for_long: bigint;
/**
* Min collateral factor for short.
*/
min_collateral_factor_for_short: bigint;
}
/**
* Min max signed values.
*/
export interface SignedValue {
/**
* Min value.
*/
min: bigint;
/**
* Max value.
*/
max: bigint;
}
/**
* Min max values.
*/
export interface Value {
/**
* Min value.
*/
min: bigint;
/**
* Max value.
*/
max: bigint;
}
/**
* Callback.
*/
export interface Callback {
/**
* Callback version.
*/
version: number;
/**
* Callback program ID.
*/
program: StringPubkey;
/**
* The address of shared data account.
*/
shared_data: StringPubkey;
/**
* The address of partitioned data account.
*/
partitioned_data: StringPubkey;
}
/**
* Hint for [`UpdateFeesState`].
*/
export interface UpdateFeesStateHint {
/**
* Token map.
*/
token_map: StringPubkey;
/**
* Virtual inventories.
*/
virtual_inventories: StringPubkey[];
/**
* Feeds.
*/
feeds: SerdeTokenRecord[];
}
/**
* Builder for `update_fees_state` instruction.
*/
export interface UpdateFeesState {
/**
* Payer (a.k.a. authority).
*/
payer: StringPubkey;
/**
* Store program.
*/
store_program?: StoreProgram;
/**
* Oracle buffer account.
*/
oracle: StringPubkey;
/**
* Market token mint address.
*/
market_token: StringPubkey;
}
/**
* Hint for [`UpdateClosedState`].
*/
export interface UpdateClosedStateHint {
/**
* Token map.
*/
token_map: StringPubkey;
/**
* Feeds.
*/
feeds: SerdeTokenRecord[];
}
/**
* Builder for `update_closed_state` instruction.
*/
export interface UpdateClosedState {
/**
* Payer (a.k.a. authority).
*/
payer: StringPubkey;
/**
* Store program.
*/
store_program?: StoreProgram;
/**
* Oracle buffer account.
*/
oracle: StringPubkey;
/**
* Market token mint address.
*/
market_token: StringPubkey;
}
/**
* Builder for `udpate_closed_state` instruction.
*/
export interface SetMarketConfigUpdatable {
/**
* Payer (a.k.a. authority).
*/
payer: StringPubkey;
/**
* Store program.
*/
store_program?: StoreProgram;
/**
* Flags.
*/
flags?: IndexMap<MarketConfigFlag, boolean>;
/**
* Factors.
*/
factors?: IndexMap<MarketConfigFactor, boolean>;
}
/**
* Builder for the `close_empty_position` instruction.
*/
export interface CloseEmptyPosition {
/**
* Program.
*/
program?: StoreProgram;
/**
* Payer (a.k.a. owner).
*/
payer: StringPubkey;
/**
* Position to close.
*/
position: StringPubkey;
}
/**
* Builder for the `prepare_position` instruction.
*/
export interface PreparePosition {
/**
* Program.
*/
program?: StoreProgram;
/**
* Payer (a.k.a. owner).
*/
payer: StringPubkey;
/**
* Order Kind.
*/
kind: CreateOrderKind;
/**
* Collateral token.
*/
collateral_token: StringPubkey;
/**
* Order Parameters.
*/
params: CreateOrderParams;
/**
* Execution lamports.
*/
execution_lamports?: number;
/**
* Swap path length.
*/
swap_path_length?: number;
/**
* Whether to unwrap the native token.
*/
should_unwrap_native_token?: boolean;
}
/**
* Builder for the `set_should_keep_position_account` instruction.
*/
export interface SetShouldKeepPositionAccount {
/**
* Program.
*/
program?: StoreProgram;
/**
* Payer (a.k.a. owner).
*/
payer: StringPubkey;
/**
* Order.
*/
order: StringPubkey;
/**
* Whether to keep position account.
*/
keep: boolean;
}
/**
* Hint for [`UpdateOrder`].
*/
export interface UpdateOrderHint {
/**
* Market token.
*/
market_token: StringPubkey;
/**
* Callback.
*/
callback: Callback | undefined;
}
/**
* Parameters for creating an order.
*/
export interface UpdateOrderParams {
/**
* Size delta value.
*/
size_delta_value?: bigint | undefined;
/**
* Acceptable price.
*/
acceptable_price?: bigint | undefined;
/**
* Trigger price.
*/
trigger_price?: bigint | undefined;
/**
* Min output.
*/
min_output?: bigint | undefined;
/**
* Valid from this timestamp.
*/
valid_from_ts?: number | undefined;
}
/**
* Builder for the `update_order` instruction.
*/
export interface UpdateOrder {
/**
* Program.
*/
program?: StoreProgram;
/**
* Payer (a.k.a. owner).
*/
payer: StringPubkey;
/**
* Order.
*/
order: StringPubkey;
/**
* Parameters.
*/
params: UpdateOrderParams;
}
/**
* Hint for [`CloseOrder`].
*/
export interface CloseOrderHint {
/**
* Owner.
*/
owner: StringPubkey;
/**
* Receiver.
*/
receiver: StringPubkey;
/**
* Rent Receiver.
*/
rent_receiver: StringPubkey;
/**
* Referrer.
*/
referrer: StringPubkey | undefined;
/**
* Initial collateral token.
*/
initial_collateral_token: StringPubkey | undefined;
/**
* Final output token.
*/
final_output_token: StringPubkey | undefined;
/**
* Long token.
*/
long_token: StringPubkey | undefined;
/**
* Short token.
*/
short_token: StringPubkey | undefined;
/**
* `should_unwrap_native_token` flag.
*/
should_unwrap_native_token: boolean;
/**
* Callback.
*/
callback: Callback | undefined;
}
/**
* Builder for the `close_order` instruction.
*/
export interface CloseOrder {
/**
* Program.
*/
program?: StoreProgram;
/**
* Payer.
*/
payer: StringPubkey;
/**
* Order.
*/
order: StringPubkey;
/**
* Reason.
*/
reason: string;
}
/**
* Hint for [`CreateOrder`].
*/
export interface CreateOrderHint {
/**
* Long token.
*/
long_token: StringPubkey;
/**
* Short token.
*/
short_token: StringPubkey;
}
/**
* Builder for the `create_order` instruction.
*/
export interface CreateOrder {
/**
* Program.
*/
program?: StoreProgram;
/**
* Payer (a.k.a. owner).
*/
payer: StringPubkey;
/**
* Reciever.
*/
receiver?: StringPubkey | undefined;
/**
* Nonce for the order.
*/
nonce?: NonceBytes | undefined;
/**
* Execution fee paid to the keeper in lamports.
*/
execution_lamports?: number;
/**
* Order Kind.
*/
kind: CreateOrderKind;
/**
* Collateral or swap out token.
*/
collateral_or_swap_out_token: StringPubkey;
/**
* Order Parameters.
*/
params: CreateOrderParams;
/**
* Pay token.
*/
pay_token?: StringPubkey | undefined;
/**
* Pay token account.
*/
pay_token_account?: StringPubkey | undefined;
/**
* Receive token.
*/
receive_token?: StringPubkey | undefined;
/**
* Swap path.
*/
swap_path?: StringPubkey[];
/**
* Whether to unwrap the native token when receiving (e.g., convert WSOL to SOL).
*/
unwrap_native_on_receive?: boolean;
/**
* Callback.
*/
callback?: Callback | undefined;
/**
* Whether to skip position account creation.
*/
skip_position_creation?: boolean;
/**
* Whether to force position account creation.
*/
force_position_creation?: boolean;
}
/**
* Parameters for creating an order.
*/
export interface CreateOrderParams {
/**
* The market token of the market in which the order will be created.
*/
market_token: StringPubkey;
/**
* Whether the order is for a long or short position.
*/
is_long: boolean;
/**
* Delta size in USD.
*/
size: bigint;
/**
* Delta amount of tokens:
* - For increase / swap orders, it is the amount of pay tokens.
* - For decrease orders, it is the amount of collateral tokens to withdraw.
*/
amount?: bigint;
/**
* Minimum amount or value of output tokens.
*
* - Minimum collateral amount for increase-position orders after swap.
* - Minimum swap-out amount for swap orders.
* - Minimum output value for decrease-position orders.
*/
min_output?: bigint;
/**
* Trigger price (in unit price).
*/
trigger_price?: bigint | undefined;
/**
* Acceptable price (in unit price).
*/
acceptable_price?: bigint | undefined;
/**
* Decrease Position Swap Type.
*/
decrease_position_swap_type?: DecreasePositionSwapType | undefined;
/**
* Timestamp from which the order becomes valid.
*/
valid_from_ts?: number | undefined;
}
/**
* Swap type for decreasing position.
*/
export type DecreasePositionSwapType = "NoSwap" | "PnlTokenToCollateralToken" | "CollateralToPnlToken";
/**
* Create Order Kind.
*/
export type CreateOrderKind = "MarketSwap" | "MarketIncrease" | "MarketDecrease" | "LimitSwap" | "LimitIncrease" | "LimitDecrease" | "StopLossDecrease";
/**
* A store program.
*/
export interface StoreProgram {
/**
* Program ID.
*/
id: StringPubkey;
/**
* Store address.
*/
store: StringPubkey;
}
/**
* Pnl Factor Kind.
*/
export type PnlFactorKind = "max_after_deposit" | "max_after_withdrawal" | "max_for_trader" | "for_adl" | "min_after_adl";
/**
* Builder for create-order ixs.
*/
export class CreateOrdersBuilder {
private constructor();
free(): void;
/**
* Build transactions.
*/
build_with_options(transaction_group?: TransactionGroupOptions | null, build?: BuildTransactionOptions | null): TransactionGroup;
/**
* Merge with the other [`CreateOrderBuilder`].
*/
merge(other: CreateOrdersBuilder): void;
}
/**
* A (twisted) ElGamal encryption keypair.
*
* The instances of the secret key are zeroized on drop.
*/
export class ElGamalKeypair {
private constructor();
free(): void;
/**
* Generates the public and secret keys for ElGamal encryption.
*
* This function is randomized. It internally samples a scalar element using `OsRng`.
*/
static new_rand(): ElGamalKeypair;
pubkey_owned(): ElGamalPubkey;
}
/**
* Public key for the ElGamal encryption scheme.
*/
export class ElGamalPubkey {
private constructor();
free(): void;
}
/**
* A hash; the 32-byte output of a hashing algorithm.
*
* This struct is used most often in `solana-sdk` and related crates to contain
* a [SHA-256] hash, but may instead contain a [blake3] hash.
*
* [SHA-256]: https://en.wikipedia.org/wiki/SHA-2
* [blake3]: https://github.com/BLAKE3-team/BLAKE3
*/
export class Hash {
free(): void;
/**
* Create a new Hash object
*
* * `value` - optional hash as a base58 encoded string, `Uint8Array`, `[number]`
*/
constructor(value: any);
/**
* Return the base58 string representation of the hash
*/
toString(): string;
/**
* Checks if two `Hash`s are equal
*/
equals(other: Hash): boolean;
/**
* Return the `Uint8Array` representation of the hash
*/
toBytes(): Uint8Array;
}
/**
* wasm-bindgen version of the Instruction struct.
* This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
* is fixed. This must not diverge from the regular non-wasm Instruction struct.
*/
export class Instruction {
private constructor();
free(): void;
}
export class Instructions {
free(): void;
constructor();
push(instruction: Instruction): void;
}
/**
* A vanilla Ed25519 key pair
*/
export class Keypair {
free(): void;
/**
* Create a new `Keypair `
*/
constructor();
/**
* Convert a `Keypair` to a `Uint8Array`
*/
toBytes(): Uint8Array;
/**
* Recover a `Keypair` from a `Uint8Array`
*/
static fromBytes(bytes: Uint8Array): Keypair;
/**
* Return the `Pubkey` for this `Keypair`
*/
pubkey(): Pubkey;
}
/**
* Wrapper of [`Market`].
*/
export class Market {
private constructor();
free(): void;
/**
* Create from base64 encoded account data with options.
*/
static decode_from_base64_with_options(data: string, no_discriminator?: boolean | null): Market;
/**
* Create from base64 encoded account data.
*/
static decode_from_base64(data: string): Market;
/**
* Create from account data.
*/
static decode(data: Uint8Array): Market;
/**
* Convert into [`JsMarketModel`]
*/
to_model(supply: bigint): MarketModel;
/**
* Get market token address.
*/
market_token_address(): string;
/**
* Get index token address.
*/
index_token_address(): string;
/**
* Get long token address.
*/
long_token_address(): string;
/**
* Get short token address.
*/
short_token_address(): string;
}
/**
* A JS binding for [`MarketGraph`].
*/
export class MarketGraph {
free(): void;
/**
* Create an empty market graph.
*/
constructor(config: MarketGraphConfig);
/**
* Insert market from base64 encoded data.
*/
insert_market_from_base64(data: string, supply: bigint): boolean;
/**
* Update token price.
*/
update_token_price(token: string, price: Value): void;
/**
* Update value.
*/
update_value(value: bigint): void;
/**
* Update base cost.
*/
update_base_cost(base_cost: bigint): void;
/**
* Update max steps.
*/
update_max_steps(max_steps: number): void;
/**
* Get market by its market token.
*/
get_market(market_token: string): MarketModel | undefined;
/**
* Get all market tokens.
*/
market_tokens(): string[];
/**
* Get all index tokens.
*/
index_tokens(): string[];
/**
* Compute best swap path.
*/
best_swap_path(source: string, target: string, skip_bellman_ford: boolean): BestSwapPath;
/**
* Simulates order execution.
*/
simulate_order(args: SimulateOrderArgs, position?: Position | null): OrderSimulationOutput;
}
/**
* Wrapper of [`MarketModel`].
*/
export class MarketModel {
private constructor();
free(): void;
/**
* Get market token price.
*/
market_token_price(params: MarketTokenPriceParams): bigint;
/**
* Get market status.
*/
status(params: MarketStatusParams): MarketStatus;
}
/**
* wasm-bindgen version of the Message struct.
* This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
* is fixed. This must not diverge from the regular non-wasm Message struct.
*/
export class Message {
private constructor();
free(): void;
/**
* The id of a recent ledger entry.
*/
recent_blockhash: Hash;
}
/**
* A JS binding for [`OrderSimulationOutput`].
*/
export class OrderSimulationOutput {
private constructor();
free(): void;
/**
* Returns increase order simulation output.
*/
increase(): IncreaseOrderSimulationOutput | undefined;
/**
* Returns decrease order simulation output.
*/
decrease(): DecreaseOrderSimulationOutput | undefined;
/**
* Returns swap order simulation output.
*/
swap(): SwapOrderSimulationOutput | undefined;
}
/**
* The `ElGamalPubkey` type as a `Pod`.
*/
export class PodElGamalPubkey {
free(): void;
/**
* Create a new `PodElGamalPubkey` object
*
* * `value` - optional public key as a base64 encoded string, `Uint8Array`, `[number]`
*/
constructor(value: any);
/**
* Return the base64 string representation of the public key
*/
toString(): string;
/**
* Checks if two `ElGamalPubkey`s are equal
*/
equals(other: PodElGamalPubkey): boolean;
/**
* Return the `Uint8Array` representation of the public key
*/
toBytes(): Uint8Array;
static compressed(decoded: ElGamalPubkey): PodElGamalPubkey;
decompressed(): ElGamalPubkey;
}
/**
* JS version of [`Position`].
*/
export class Position {
private constructor();
free(): void;
/**
* Create from base64 encoded account data with options.
*/
static decode_from_base64_with_options(data: string, no_discriminator?: boolean | null): Position;
/**
* Create from base64 encoded account data.
*/
static decode_from_base64(data: string): Position;
/**
* Create from account data.
*/
static decode(data: Uint8Array): Position;
/**
* Convert to a [`JsPositionModel`].
*/
to_model(market: MarketModel): PositionModel;
}
/**
* JS version of [`PositionModel`].
*/
export class PositionModel {
private constructor();
free(): void;
/**
* Get position status.
*/
status(prices: Prices): PositionStatus;
/**
* Get position size.
*/
size(): bigint;
/**
* Get position size in tokens.
*/
size_in_tokens(): bigint;
/**
* Get collateral amount.
*/
collateral_amount(): bigint;
/**
* Returns the inner [`JsPosition`].
*/
position(): Position;
}
/**
* The address of a [Solana account][acc].
*
* Some account addresses are [ed25519] public keys, with corresponding secret
* keys that are managed off-chain. Often, though, account addresses do not
* have corresponding secret keys — as with [_program derived
* addresses_][pdas] — or the secret key is not relevant to the operation
* of a program, and may have even been disposed of. As running Solana programs
* can not safely create or manage secret keys, the full [`Keypair`] is not
* defined in `solana-program` but in `solana-sdk`.
*
* [acc]: https://solana.com/docs/core/accounts
* [ed25519]: https://ed25519.cr.yp.to/
* [pdas]: https://solana.com/docs/core/cpi#program-derived-addresses
* [`Keypair`]: https://docs.rs/solana-sdk/latest/solana_sdk/signer/keypair/struct.Keypair.html
*/
export class Pubkey {
free(): void;
/**
* Create a new Pubkey object
*
* * `value` - optional public key as a base58 encoded string, `Uint8Array`, `[number]`
*/
constructor(value: any);
/**
* Return the base58 string representation of the public key
*/
toString(): string;
/**
* Check if a `Pubkey` is on the ed25519 curve.
*/
isOnCurve(): boolean;
/**
* Checks if two `Pubkey`s are equal
*/
equals(other: Pubkey): boolean;
/**
* Return the `Uint8Array` representation of the public key
*/
toBytes(): Uint8Array;
/**
* Derive a Pubkey from another Pubkey, string seed, and a program id
*/
static createWithSeed(base: Pubkey, seed: string, owner: Pubkey): Pubkey;
/**
* Derive a program address from seeds and a program id
*/
static createProgramAddress(seeds: any[], program_id: Pubkey): Pubkey;
/**
* Find a valid program address
*
* Returns:
* * `[PubKey, number]` - the program address and bump seed
*/
static findProgramAddress(seeds: any[], program_id: Pubkey): any;
}
/**
* wasm-bindgen version of the Transaction struct.
* This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
* is fixed. This must not diverge from the regular non-wasm Transaction struct.
*/
export class Transaction {
free(): void;
/**
* Create a new `Transaction`
*/
constructor(instructions: Instructions, payer?: Pubkey | null);
/**
* Return a message containing all data that should be signed.
*/
message(): Message;
/**
* Return the serialized message data to sign.
*/
messageData(): Uint8Array;
/**
* Verify the transaction
*/
verify(): void;
partialSign(keypair: Keypair, recent_blockhash: Hash): void;
isSigned(): boolean;
toBytes(): Uint8Array;
static fromBytes(bytes: Uint8Array): Transaction;
}
/**
* A JS binding for compiled transaction group.
*/
export class TransactionGroup {
private constructor();
free(): void;
/**
* Returns serialized transaciton group.
*/
serialize(): SerializedTransactionGroup;
}
/**
* JS binding wrapper for [`UserHeader`]
*/
export class User {
private constructor();
free(): void;
/**
* Create from base64 encoded account data.
*/
static decode_from_base64(data: string): User;
/**
* Get the owner address.
*/
owner_address(): string;
/**
* Get the store address.
*/
store_address(): string;
/**
* Get the referral code address.
*/
referral_code_address(): string | undefined;
/**
* Get the referrer address.
*/
referrer_address(): string | undefined;
/**
* Get the GT rank.
*/
gt_rank(): number;
/**
* Get GT last minted at.
*/
gt_last_minted_at(): bigint;
/**
* Get total minted GT amount.
*/
gt_total_minted(): bigint;
/**
* Get GT amount.
*/
gt_amount(): bigint;
/**
* Get paid fee value of GT.
*/
gt_paid_fee_value(): bigint;
/**
* Get minted fee value of GT.
*/
gt_minted_fee_value(): bigint;
}