@shogun-sdk/money-legos
Version:
Shogun Money Legos: clients and types for quotes, memes, prices, balances, fees, validations, etc.
473 lines • 16.9 kB
TypeScript
import { Codex, GraphQL } from '@codex-data/sdk';
import type { Token, TokenBalanceResults, TokenPrice } from '../types/index.js';
type TokenFilterResult = GraphQL.TokenFilterResult;
export type Balance = {
walletId: string;
tokenId: string;
balance: string;
shiftedBalance: number;
};
type BalancesResponse = {
items: Balance[];
};
interface FallbackTokens {
tokenIn?: Token | null;
tokenOut?: Token | null;
}
export declare const getEVMWalletBalance: (sdk: Codex, address: string) => Promise<{
Balances: BalancesResponse;
} | null>;
export declare const getPortfolioTokens: (sdk: Codex, data: Balance[], walletAddress: string, fallbackTokens?: FallbackTokens) => Promise<TokenBalanceResults[]>;
export declare const mapEvmTokenBalancesToInfo: (balances: Balance[], tokenInfos: TokenFilterResult[]) => ({
tokenAddress: string | undefined;
symbol: GraphQL.Maybe<string> | undefined;
name: GraphQL.Maybe<string> | undefined;
decimals: number | undefined;
balance: string;
balanceFormatted: string;
totalSupply: string;
mcap: string;
logo: string;
usdPrice: number;
usdPrice1hrPercentChange: number;
usdPrice4hrPercentChange: number;
usdPrice12hrPercentChange: number;
usdPrice24hrPercentChange: number;
usdValue: number;
nativeToken: boolean;
network: string | number | undefined;
walletAddress: string | undefined;
} | null)[];
export declare const mapEvmNativeBalancesToInfo: (ethBalance: bigint, arbBalance: bigint, baseBalance: bigint, berachainBalance: bigint, bscBalance: bigint, sonicBalance: bigint, avalancheBalance: bigint, polygonBalance: bigint, hyperevmBalance: bigint, walletAddress: string, tokenInfos: TokenFilterResult[]) => {
tokenAddress: string;
symbol: string | undefined;
name: string | undefined;
decimals: number | undefined;
balance: string;
balanceFormatted: string;
totalSupply: string;
mcap: string;
logo: string;
usdPrice: number;
usdPrice1hrPercentChange: number;
usdPrice4hrPercentChange: number;
usdPrice12hrPercentChange: number;
usdPrice24hrPercentChange: number;
usdValue: number;
nativeToken: boolean;
network: number;
walletAddress: string;
}[];
export declare const getSolanaTokenBalances: (sdk: Codex, walletAddress: string) => Promise<TokenBalanceResults[] | {
network: number;
walletAddress: string;
tokenAddress: any;
symbol: any;
name: any;
decimals: number;
balance: any;
balanceFormatted: string;
usdPrice: number;
usdValue: number;
nativeToken: boolean;
usdPrice1hrPercentChange: number;
usdPrice4hrPercentChange: number;
usdPrice12hrPercentChange: number;
usdPrice24hrPercentChange: number;
totalSupply: any;
mcap: any;
logo: any;
}[]>;
export declare const createNativeSolToken: (walletAddress: string, nativeBalance?: bigint | number, codexData?: any) => {
network: number;
walletAddress: string;
tokenAddress: any;
symbol: any;
name: any;
decimals: number;
balance: any;
balanceFormatted: string;
usdPrice: number;
usdValue: number;
nativeToken: boolean;
usdPrice1hrPercentChange: number;
usdPrice4hrPercentChange: number;
usdPrice12hrPercentChange: number;
usdPrice24hrPercentChange: number;
totalSupply: any;
mcap: any;
logo: any;
};
export declare const isValidSolanaOrEvMaddreess: (address: string) => boolean;
export declare const mapSolanaToken: (token: any, walletAddress: string, isNative?: boolean, codexToken?: any) => {
network: number;
walletAddress: string;
tokenAddress: any;
symbol: any;
name: any;
decimals: number;
balance: any;
balanceFormatted: string;
usdPrice: number;
usdValue: number;
nativeToken: boolean;
usdPrice1hrPercentChange: number;
usdPrice4hrPercentChange: number;
usdPrice12hrPercentChange: number;
usdPrice24hrPercentChange: number;
totalSupply: any;
mcap: any;
logo: any;
};
export declare function isPumpfun(tokenAddress: string): boolean;
export declare const normalizeCodexSolanaChainId: (chainId: number) => number;
export declare const filterTokensByValue: (tokens: TokenBalanceResults[]) => TokenBalanceResults[];
export declare const SOLANA_NETWORK_ID = 1399811149;
export declare const getTokenUSDPrice: (sdk: Codex, tokenAddress: string, chainId: number) => Promise<TokenPrice | null>;
export declare const getTopTokens: (sdk: Codex) => Promise<Token[]>;
export declare const searchToken: (sdk: Codex, symbolOrAddress: string) => Promise<{
symbol: string | null | undefined;
address: string | undefined;
decimals: number | undefined;
chainId: number;
image: string | null | undefined;
name: string | null | undefined;
mcap: string | null | undefined;
}[]>;
export declare const searchTokenByAddress: (sdk: Codex, options: {
addresses: string[];
network?: number[];
}) => Promise<({
__typename?: "TokenFilterResult";
buyCount1?: number | null;
buyCount4?: number | null;
buyCount5m?: number | null;
buyCount12?: number | null;
buyCount24?: number | null;
change1?: string | null;
change4?: string | null;
change5m?: string | null;
change12?: string | null;
change24?: string | null;
createdAt?: number | null;
high1?: string | null;
high4?: string | null;
high5m?: string | null;
high12?: string | null;
high24?: string | null;
holders?: number | null;
isScam?: boolean | null;
lastTransaction?: number | null;
liquidity?: string | null;
low1?: string | null;
low4?: string | null;
low5m?: string | null;
low12?: string | null;
low24?: string | null;
marketCap?: string | null;
priceUSD?: string | null;
quoteToken?: string | null;
sellCount1?: number | null;
sellCount4?: number | null;
sellCount5m?: number | null;
sellCount12?: number | null;
sellCount24?: number | null;
txnCount1?: number | null;
txnCount4?: number | null;
txnCount5m?: number | null;
txnCount12?: number | null;
txnCount24?: number | null;
uniqueBuys1?: number | null;
uniqueBuys4?: number | null;
uniqueBuys5m?: number | null;
uniqueBuys12?: number | null;
uniqueBuys24?: number | null;
uniqueSells1?: number | null;
uniqueSells4?: number | null;
uniqueSells5m?: number | null;
uniqueSells12?: number | null;
uniqueSells24?: number | null;
uniqueTransactions1?: number | null;
uniqueTransactions4?: number | null;
uniqueTransactions5m?: number | null;
uniqueTransactions12?: number | null;
uniqueTransactions24?: number | null;
volume1?: string | null;
volume4?: string | null;
volume5m?: string | null;
volume12?: string | null;
volume24?: string | null;
volumeChange1?: string | null;
volumeChange4?: string | null;
volumeChange5m?: string | null;
volumeChange12?: string | null;
volumeChange24?: string | null;
exchanges?: Array<{
__typename?: "Exchange";
address: string;
color?: string | null;
exchangeVersion?: string | null;
iconUrl?: string | null;
id: string;
name?: string | null;
networkId: number;
tradeUrl?: string | null;
} | null> | null;
pair?: {
__typename?: "Pair";
address: string;
createdAt?: number | null;
exchangeHash: string;
fee?: number | null;
id: string;
networkId: number;
tickSpacing?: number | null;
token0: string;
token1: string;
pooled?: {
__typename?: "PooledTokenValues";
token0?: string | null;
token1?: string | null;
} | null;
token0Data?: {
__typename?: "EnhancedToken";
address: string;
cmcId?: number | null;
createBlockNumber?: number | null;
createTransactionHash?: string | null;
createdAt?: number | null;
creatorAddress?: string | null;
decimals: number;
freezable?: string | null;
id: string;
isScam?: boolean | null;
mintable?: string | null;
name?: string | null;
networkId: number;
symbol?: string | null;
exchanges?: Array<{
__typename?: "Exchange";
address: string;
color?: string | null;
exchangeVersion?: string | null;
iconUrl?: string | null;
id: string;
name?: string | null;
networkId: number;
tradeUrl?: string | null;
}> | null;
info?: {
__typename?: "TokenInfo";
address: string;
circulatingSupply?: string | null;
cmcId?: number | null;
description?: string | null;
id: string;
imageBannerUrl?: string | null;
imageLargeUrl?: string | null;
imageSmallUrl?: string | null;
imageThumbUrl?: string | null;
isScam?: boolean | null;
name?: string | null;
networkId: number;
symbol: string;
totalSupply?: string | null;
} | null;
launchpad?: {
__typename?: "LaunchpadData";
completed?: boolean | null;
completedAt?: number | null;
completedSlot?: number | null;
graduationPercent?: number | null;
migrated?: boolean | null;
migratedAt?: number | null;
migratedPoolAddress?: string | null;
migratedSlot?: number | null;
poolAddress?: string | null;
} | null;
socialLinks?: {
__typename?: "SocialLinks";
bitcointalk?: string | null;
blog?: string | null;
coingecko?: string | null;
coinmarketcap?: string | null;
discord?: string | null;
email?: string | null;
facebook?: string | null;
github?: string | null;
instagram?: string | null;
linkedin?: string | null;
reddit?: string | null;
slack?: string | null;
telegram?: string | null;
twitch?: string | null;
twitter?: string | null;
website?: string | null;
wechat?: string | null;
whitepaper?: string | null;
youtube?: string | null;
} | null;
} | null;
token1Data?: {
__typename?: "EnhancedToken";
address: string;
cmcId?: number | null;
createBlockNumber?: number | null;
createTransactionHash?: string | null;
createdAt?: number | null;
creatorAddress?: string | null;
decimals: number;
freezable?: string | null;
id: string;
isScam?: boolean | null;
mintable?: string | null;
name?: string | null;
networkId: number;
symbol?: string | null;
exchanges?: Array<{
__typename?: "Exchange";
address: string;
color?: string | null;
exchangeVersion?: string | null;
iconUrl?: string | null;
id: string;
name?: string | null;
networkId: number;
tradeUrl?: string | null;
}> | null;
info?: {
__typename?: "TokenInfo";
address: string;
circulatingSupply?: string | null;
cmcId?: number | null;
description?: string | null;
id: string;
imageBannerUrl?: string | null;
imageLargeUrl?: string | null;
imageSmallUrl?: string | null;
imageThumbUrl?: string | null;
isScam?: boolean | null;
name?: string | null;
networkId: number;
symbol: string;
totalSupply?: string | null;
} | null;
launchpad?: {
__typename?: "LaunchpadData";
completed?: boolean | null;
completedAt?: number | null;
completedSlot?: number | null;
graduationPercent?: number | null;
migrated?: boolean | null;
migratedAt?: number | null;
migratedPoolAddress?: string | null;
migratedSlot?: number | null;
poolAddress?: string | null;
} | null;
socialLinks?: {
__typename?: "SocialLinks";
bitcointalk?: string | null;
blog?: string | null;
coingecko?: string | null;
coinmarketcap?: string | null;
discord?: string | null;
email?: string | null;
facebook?: string | null;
github?: string | null;
instagram?: string | null;
linkedin?: string | null;
reddit?: string | null;
slack?: string | null;
telegram?: string | null;
twitch?: string | null;
twitter?: string | null;
website?: string | null;
wechat?: string | null;
whitepaper?: string | null;
youtube?: string | null;
} | null;
} | null;
} | null;
token?: {
__typename?: "EnhancedToken";
address: string;
cmcId?: number | null;
createBlockNumber?: number | null;
createTransactionHash?: string | null;
createdAt?: number | null;
creatorAddress?: string | null;
decimals: number;
freezable?: string | null;
id: string;
isScam?: boolean | null;
mintable?: string | null;
name?: string | null;
networkId: number;
symbol?: string | null;
exchanges?: Array<{
__typename?: "Exchange";
address: string;
color?: string | null;
exchangeVersion?: string | null;
iconUrl?: string | null;
id: string;
name?: string | null;
networkId: number;
tradeUrl?: string | null;
}> | null;
info?: {
__typename?: "TokenInfo";
address: string;
circulatingSupply?: string | null;
cmcId?: number | null;
description?: string | null;
id: string;
imageBannerUrl?: string | null;
imageLargeUrl?: string | null;
imageSmallUrl?: string | null;
imageThumbUrl?: string | null;
isScam?: boolean | null;
name?: string | null;
networkId: number;
symbol: string;
totalSupply?: string | null;
} | null;
launchpad?: {
__typename?: "LaunchpadData";
completed?: boolean | null;
completedAt?: number | null;
completedSlot?: number | null;
graduationPercent?: number | null;
migrated?: boolean | null;
migratedAt?: number | null;
migratedPoolAddress?: string | null;
migratedSlot?: number | null;
poolAddress?: string | null;
} | null;
socialLinks?: {
__typename?: "SocialLinks";
bitcointalk?: string | null;
blog?: string | null;
coingecko?: string | null;
coinmarketcap?: string | null;
discord?: string | null;
email?: string | null;
facebook?: string | null;
github?: string | null;
instagram?: string | null;
linkedin?: string | null;
reddit?: string | null;
slack?: string | null;
telegram?: string | null;
twitch?: string | null;
twitter?: string | null;
website?: string | null;
wechat?: string | null;
whitepaper?: string | null;
youtube?: string | null;
} | null;
} | null;
} | null)[] | null | undefined>;
export declare const getTokenInfo: (sdk: Codex, tokenAddress: string, chainId: number) => Promise<GraphQL.TokenFilterResult>;
export {};
//# sourceMappingURL=codex.d.ts.map