goodrdotfun-sdk
Version:
SDK for interacting with goodr.fun and Sonic on Solana
85 lines (84 loc) • 3.03 kB
TypeScript
import { PublicKey, TokenAmount, VersionedTransactionResponse } from '@solana/web3.js';
export declare const DECIMALS = 6;
export declare const TokenMetadataAttributeKeys: {
readonly DonationDestination: "Donation Destination";
readonly DonationAmount: "Donation Amount";
readonly TwitterUrl: "Twitter URL";
readonly TelegramUrl: "Telegram URL";
readonly WebsiteUrl: "Website URL";
};
export interface TokenMetadataJSON {
name: string;
symbol: string;
description: string;
image: string;
animation_url: string;
external_url: string;
attributes: {
trait_type: (typeof TokenMetadataAttributeKeys)[keyof typeof TokenMetadataAttributeKeys];
value: string;
}[];
}
export declare class TokenMetadata {
name?: string;
description?: string;
ticker?: string;
donationAmount?: string;
twitterUrl?: string;
telegramUrl?: string;
websiteUrl?: string;
donationDestinationId?: number;
imageUrl?: string;
constructor(params: Partial<TokenMetadata>);
static fromJSON(json: TokenMetadataJSON): TokenMetadata;
toJSON(): TokenMetadataJSON;
}
export interface TokenBalanceRow {
account: PublicKey;
mint: string;
balance: TokenAmount;
delta: BigNumber;
accountIndex: number;
}
export interface PriceData {
price: BigNumber;
marketCap: BigNumber;
totalSupply: BigNumber;
}
export interface TokenState {
priceData: PriceData;
bondingCurveProgress: number;
totalSupply: BigNumber;
currencyType: 'SOL' | 'SONIC';
}
export interface PriorityFee {
unitLimit: number;
unitPrice: number;
}
export interface TransactionResult {
signature?: string;
error?: unknown;
results?: VersionedTransactionResponse;
success: boolean;
}
export declare enum ProgramErrorCodeTs {
AlreadyInitialized = "The program is already initialized.",
NotAuthorized = "The given account is not authorized to execute this instruction.",
TooMuchSolRequired = "slippage: Too much SOL required to buy the given amount of tokens.",
TooLittleSolReceived = "slippage: Too little SOL received to sell the given amount of tokens.",
MintDoesNotMatchBondingCurve = "The mint does not match the bonding curve.",
BondingCurveComplete = "The bonding curve has completed and liquidity migrated to raydium.",
BondingCurveNotComplete = "The bonding curve has not completed yet.",
NotInitialized = "The program is not initialized.",
NotAuthorizedDonationDestination = "The donation destination is not authorized.",
InsufficientTokens = "Insufficient Tokens",
MinBuy = "Min buy is 1 Token",
MinSell = "Min sell is 1 Token",
InsufficientSOL = "Insufficient SOL",
InvalidMintAccountSpace = "Invalid Mint Account Space",
CantInitializeMetadataPointer = "Can't Initialize Metadata Pointer"
}
export declare class ProgramError extends Error {
code: keyof typeof ProgramErrorCodeTs;
constructor(code: keyof typeof ProgramErrorCodeTs, message?: string);
}