diff --git a/.env.example b/.env.example index f827cd92a7d..cafeac8e0a6 100644 --- a/.env.example +++ b/.env.example @@ -15,8 +15,8 @@ VITE_SERVER_PORT=${SERVER_PORT} SUPABASE_URL= SUPABASE_ANON_KEY= -# Remote character url (optional) -REMOTE_CHARACTER_URL= +# Comma separated list of remote character urls (optional) +REMOTE_CHARACTER_URLS= ############################### #### Client Configurations #### @@ -87,6 +87,13 @@ EMBEDDING_OPENAI_MODEL= # Default: text-embedding-3-small IMAGE_OPENAI_MODEL= # Default: dall-e-3 USE_OPENAI_EMBEDDING= # Set to TRUE for OpenAI/1536, leave blank for local +# Atoma SDK Configuration +ATOMASDK_BEARER_AUTH= # Atoma SDK Bearer Auth token +ATOMA_API_URL= # Default: https://api.atoma.network/v1 +SMALL_ATOMA_MODEL= # Default: meta-llama/Llama-3.3-70B-Instruct +MEDIUM_ATOMA_MODEL= # Default: meta-llama/Llama-3.3-70B-Instruct +LARGE_ATOMA_MODEL= # Default: meta-llama/Llama-3.3-70B-Instruct + # Eternal AI's Decentralized Inference API ETERNALAI_URL= ETERNALAI_MODEL= # Default: "NousResearch/Hermes-3-Llama-3.1-70B-FP8" @@ -134,8 +141,12 @@ MEDIUM_AKASH_CHAT_API_MODEL= # Default: Meta-Llama-3-3-70B-Instruct LARGE_AKASH_CHAT_API_MODEL= # Default: Meta-Llama-3-1-405B-Instruct-FP8 # Livepeer configuration -LIVEPEER_GATEWAY_URL= # Free inference gateways and docs: https://livepeer-eliza.com/ -LIVEPEER_IMAGE_MODEL= # Default: ByteDance/SDXL-Lightning + +LIVEPEER_GATEWAY_URL=https://dream-gateway.livepeer.cloud # Free inference gateways and docs: https://livepeer-eliza.com/ +IMAGE_LIVEPEER_MODEL= # Default: ByteDance/SDXL-Lightning +SMALL_LIVEPEER_MODEL= # Default: meta-llama/Meta-Llama-3.1-8B-Instruct +MEDIUM_LIVEPEER_MODEL= # Default: meta-llama/Meta-Llama-3.1-8B-Instruct +LARGE_LIVEPEER_MODEL= # Default: meta-llama/Meta-Llama-3.1-8B-Instruct # Speech Synthesis ELEVENLABS_XI_API_KEY= # API key from elevenlabs @@ -302,6 +313,10 @@ SOLANA_ADMIN_PRIVATE_KEY= # This wallet is used to verify NFTs SOLANA_ADMIN_PUBLIC_KEY= # This wallet is used to verify NFTs SOLANA_VERIFY_TOKEN= # Authentication token for calling the verification API +# Injective +INJECTIVE_PRIVATE_KEY= # +INJECTIVE_PUBLIC_KEY= # +INJECTIVE_NETWORK= # # Fallback Wallet Configuration (deprecated) WALLET_PRIVATE_KEY= WALLET_PUBLIC_KEY= @@ -337,6 +352,11 @@ COINBASE_GENERATED_WALLET_ID= # Not your address but the wallet ID from ge COINBASE_GENERATED_WALLET_HEX_SEED= # Not your address but the wallet hex seed from generating a wallet through the plugin and calling export COINBASE_NOTIFICATION_URI= # For webhook plugin the uri you want to send the webhook to for dummy ones use https://webhook.site +# Coinbase AgentKit +COINBASE_AGENT_KIT_NETWORK= # defaults to 'base-sepolia' +CDP_API_KEY_NAME= +CDP_API_KEY_PRIVATE_KEY= + # Coinbase Charity Configuration IS_CHARITABLE=false # Set to true to enable charity donations CHARITY_ADDRESS_BASE=0x1234567890123456789012345678901234567890 @@ -366,7 +386,7 @@ SQUID_SDK_URL=https://apiplus.squidrouter.com # Default: https://apiplus.squidro SQUID_INTEGRATOR_ID= # get integrator id through https://docs.squidrouter.com/ SQUID_EVM_ADDRESS= SQUID_EVM_PRIVATE_KEY= -SQUID_API_THROTTLE_INTERVAL= # Default: 0; Used to throttle API calls to avoid rate limiting (in ms) +SQUID_API_THROTTLE_INTERVAL=1000 # Default: 1000; Used to throttle API calls to avoid rate limiting (in ms) # TEE Configuration # TEE_MODE options: @@ -543,6 +563,10 @@ AWS_SECRET_ACCESS_KEY= AWS_REGION= AWS_S3_BUCKET= AWS_S3_UPLOAD_PATH= +AWS_S3_ENDPOINT= +AWS_S3_SSL_ENABLED= +AWS_S3_FORCE_PATH_STYLE= + # Deepgram DEEPGRAM_API_KEY= diff --git a/.github/workflows/smoke-tests.yml b/.github/workflows/smoke-tests.yml index 2c088afbe68..00d1a5116ba 100644 --- a/.github/workflows/smoke-tests.yml +++ b/.github/workflows/smoke-tests.yml @@ -10,17 +10,24 @@ on: jobs: smoke-tests: runs-on: ubuntu-latest + container: + image: node:23-bullseye steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v3 + - name: Cache pnpm + uses: actions/cache@v4 with: - version: 9.15.0 + path: | + ~/.pnpm-store + **/node_modules + key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: ${{ runner.os }}-pnpm- - - uses: actions/setup-node@v4 + - name: Setup pnpm + uses: pnpm/action-setup@v3 with: - node-version: "23.3.0" - cache: "pnpm" + version: 9.15.0 - name: Run smoke tests run: pnpm run smokeTests diff --git a/.gitignore b/.gitignore index 7c6c92eb7b9..a82e47b2b12 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,8 @@ tsup.config.bundled_*.mjs .turbo .cursorrules .pnpm-store +instructions.md +wallet_data.txt coverage .eslintcache diff --git a/agent/package.json b/agent/package.json index 44c42c84a9b..dc238b8246a 100644 --- a/agent/package.json +++ b/agent/package.json @@ -35,6 +35,7 @@ "@elizaos/core": "workspace:*", "@elizaos/plugin-0g": "workspace:*", "@elizaos/plugin-abstract": "workspace:*", + "@elizaos/plugin-agentkit": "workspace:*", "@elizaos/plugin-aptos": "workspace:*", "@elizaos/plugin-birdeye": "workspace:*", "@elizaos/plugin-coingecko": "workspace:*", @@ -61,6 +62,7 @@ "@elizaos/plugin-nft-generation": "workspace:*", "@elizaos/plugin-node": "workspace:*", "@elizaos/plugin-solana": "workspace:*", + "@elizaos/plugin-injective": "workspace:*", "@elizaos/plugin-solana-agentkit": "workspace:*", "@elizaos/plugin-squid-router": "workspace:*", "@elizaos/plugin-autonome": "workspace:*", diff --git a/agent/src/index.ts b/agent/src/index.ts index 4b3f12897a8..45e75a8f923 100644 --- a/agent/src/index.ts +++ b/agent/src/index.ts @@ -70,12 +70,9 @@ import { evmPlugin } from "@elizaos/plugin-evm"; import { flowPlugin } from "@elizaos/plugin-flow"; import { fuelPlugin } from "@elizaos/plugin-fuel"; import { genLayerPlugin } from "@elizaos/plugin-genlayer"; -import { giphyPlugin } from "@elizaos/plugin-giphy"; import { gitcoinPassportPlugin } from "@elizaos/plugin-gitcoin-passport"; -import { hyperliquidPlugin } from "@elizaos/plugin-hyperliquid"; import { imageGenerationPlugin } from "@elizaos/plugin-image-generation"; import { lensPlugin } from "@elizaos/plugin-lensNetwork"; -import { letzAIPlugin } from "@elizaos/plugin-letzai"; import { multiversxPlugin } from "@elizaos/plugin-multiversx"; import { nearPlugin } from "@elizaos/plugin-near"; import createNFTCollectionsPlugin from "@elizaos/plugin-nft-collections"; @@ -87,7 +84,7 @@ import { openWeatherPlugin } from "@elizaos/plugin-open-weather"; import { quaiPlugin } from "@elizaos/plugin-quai"; import { sgxPlugin } from "@elizaos/plugin-sgx"; import { solanaPlugin } from "@elizaos/plugin-solana"; -import { solanaAgentkitPlguin } from "@elizaos/plugin-solana-agentkit"; +import { solanaAgentkitPlugin } from "@elizaos/plugin-solana-agentkit"; import { squidRouterPlugin } from "@elizaos/plugin-squid-router"; import { stargazePlugin } from "@elizaos/plugin-stargaze"; import { storyPlugin } from "@elizaos/plugin-story"; @@ -96,9 +93,13 @@ import { TEEMode, teePlugin } from "@elizaos/plugin-tee"; import { teeLogPlugin } from "@elizaos/plugin-tee-log"; import { teeMarlinPlugin } from "@elizaos/plugin-tee-marlin"; import { verifiableLogPlugin } from "@elizaos/plugin-tee-verifiable-log"; -import { thirdwebPlugin } from "@elizaos/plugin-thirdweb"; import { tonPlugin } from "@elizaos/plugin-ton"; import { webSearchPlugin } from "@elizaos/plugin-web-search"; +import { injectivePlugin } from "@elizaos/plugin-injective"; +import { giphyPlugin } from "@elizaos/plugin-giphy"; +import { letzAIPlugin } from "@elizaos/plugin-letzai"; +import { thirdwebPlugin } from "@elizaos/plugin-thirdweb"; +import { hyperliquidPlugin } from "@elizaos/plugin-hyperliquid"; import { echoChambersPlugin } from "@elizaos/plugin-echochambers"; import { dexScreenerPlugin } from "@elizaos/plugin-dexscreener"; @@ -245,12 +246,15 @@ async function loadCharacter(filePath: string): Promise { return jsonToCharacter(filePath, character); } +function commaSeparatedStringToArray(commaSeparated: string): string[] { + return commaSeparated?.split(",").map(value => value.trim()) +} + + export async function loadCharacters( charactersArg: string ): Promise { - let characterPaths = charactersArg - ?.split(",") - .map((filePath) => filePath.trim()); + let characterPaths = commaSeparatedStringToArray(charactersArg) const loadedCharacters: Character[] = []; if (characterPaths?.length > 0) { @@ -322,17 +326,16 @@ export async function loadCharacters( } } - if (loadedCharacters.length === 0) { - if ( - process.env.REMOTE_CHARACTER_URL != "" && - process.env.REMOTE_CHARACTER_URL.startsWith("http") - ) { - const character = await loadCharacterFromUrl( - process.env.REMOTE_CHARACTER_URL - ); + if (hasValidRemoteUrls()) { + elizaLogger.info("Loading characters from remote URLs"); + let characterUrls = commaSeparatedStringToArray(process.env.REMOTE_CHARACTER_URLS) + for (const characterUrl of characterUrls) { + const character = await loadCharacterFromUrl(characterUrl); loadedCharacters.push(character); } + } + if (loadedCharacters.length === 0) { elizaLogger.info("No characters found, using default character"); loadedCharacters.push(defaultCharacter); } @@ -474,6 +477,11 @@ export function getTokenForProvider( character.settings?.secrets?.VENICE_API_KEY || settings.VENICE_API_KEY ); + case ModelProviderName.ATOMA: + return ( + character.settings?.secrets?.ATOMASDK_BEARER_AUTH || + settings.ATOMASDK_BEARER_AUTH + ); case ModelProviderName.AKASH_CHAT_API: return ( character.settings?.secrets?.AKASH_CHAT_API_KEY || @@ -504,6 +512,11 @@ export function getTokenForProvider( character.settings?.secrets?.DEEPSEEK_API_KEY || settings.DEEPSEEK_API_KEY ); + case ModelProviderName.LIVEPEER: + return ( + character.settings?.secrets?.LIVEPEER_GATEWAY_URL || + settings.LIVEPEER_GATEWAY_URL + ); default: const errorMessage = `Failed to get token - unsupported model provider: ${provider}`; elizaLogger.error(errorMessage); @@ -786,7 +799,7 @@ export async function createAgent( ? solanaPlugin : null, getSecret(character, "SOLANA_PRIVATE_KEY") - ? solanaAgentkitPlguin + ? solanaAgentkitPlugin : null, getSecret(character, "AUTONOME_JWT_TOKEN") ? autonomePlugin : null, (getSecret(character, "NEAR_ADDRESS") || @@ -799,6 +812,10 @@ export async function createAgent( getSecret(character, "WALLET_PUBLIC_KEY")?.startsWith("0x")) ? evmPlugin : null, + ((getSecret(character, "EVM_PUBLIC_KEY") || getSecret(character, "INJECTIVE_PUBLIC_KEY")) && + getSecret(character, "INJECTIVE_PRIVATE_KEY")) + ? injectivePlugin + : null, getSecret(character, "COSMOS_RECOVERY_PHRASE") && getSecret(character, "COSMOS_AVAILABLE_CHAINS") && createCosmosPlugin(), @@ -1099,6 +1116,13 @@ const checkPortAvailable = (port: number): Promise => { }); }; + +const hasValidRemoteUrls = () => + process.env.REMOTE_CHARACTER_URLS && + process.env.REMOTE_CHARACTER_URLS !== "" && + process.env.REMOTE_CHARACTER_URLS.startsWith("http"); + + const startAgents = async () => { const directClient = new DirectClient(); let serverPort = parseInt(settings.SERVER_PORT || "3000"); @@ -1106,7 +1130,7 @@ const startAgents = async () => { let charactersArg = args.characters || args.character; let characters = [defaultCharacter]; - if (charactersArg) { + if (charactersArg || hasValidRemoteUrls()) { characters = await loadCharacters(charactersArg); } diff --git a/characters/tate.character.json b/characters/tate.character.json deleted file mode 100644 index 618db266add..00000000000 --- a/characters/tate.character.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "tate", - "clients": [], - "modelProvider": "anthropic", - "settings": { - "secrets": {}, - "voice": { - "model": "en_US-male-medium" - } - }, - "plugins": [], - "bio": [ - "Andrew Tate is a former kickboxer, entrepreneur, and self-proclaimed misogynist.", - "He is a strong advocate for masculinity and believes in the importance of strength and dominance in relationships.", - "He is a self-proclaimed misogynist and believes that women should be submissive to men.", - "People call him the 'King of Men' and he believes that he is the best at everything he does." - ], - "lore": [ - "Andrew once was a kickboxer, but now he's a self-proclaimed misogynist entrepreneur.", - "He is a strong advocate for masculinity and believes in the importance of strength and dominance in relationships.", - "He is a self-proclaimed misogynist and believes that women should be submissive to men.", - "People call him the 'King of Men' and he believes that he is the best at everything he does." - ], - "knowledge": [], - "messageExamples": [ - [ - { - "user": "{{user1}}", - "content": { - "text": "How do I get rich?" - } - }, - { - "user": "tate", - "content": { - "text": "Simple. Stop being BROKE and LAZY. While you're sleeping, I'm breathing air like a G and making MILLIONS. Built multiple 8-figure businesses because I understand the MATRIX. What color is your Bugatti? Exactly. STAY POOR or join the WAR ROOM!" - } - } - ], - [ - { - "user": "{{user1}}", - "content": { - "text": "Why did you get banned?" - } - }, - { - "user": "tate", - "content": { - "text": "Matrix agents FEAR TRUTH. They can't handle a REAL MAN speaking FACTS. While betas cry about pronouns, I'm teaching MASCULINE EXCELLENCE. Ban me everywhere - I GET STRONGER. What color is your platform? EXACTLY!" - } - } - ] - ], - "postExamples": [""], - "topics": [""], - "style": { - "all": [""], - "chat": [""], - "post": [""] - }, - "adjectives": [""] -} diff --git a/client/src/lib/api.ts b/client/src/lib/api.ts index fdfd75e8da4..703a5181bf1 100644 --- a/client/src/lib/api.ts +++ b/client/src/lib/api.ts @@ -25,7 +25,7 @@ const fetcher = async ({ if (method === "POST") { if (body instanceof FormData) { - // @ts-expect-error - Supressing potentially undefined options header + // @ts-expect-error - Suppressing potentially undefined options header delete options.headers["Content-Type"]; options.body = body; } else { diff --git a/client/src/lib/info.json b/client/src/lib/info.json index de0516e20d6..18f2047dcae 100644 --- a/client/src/lib/info.json +++ b/client/src/lib/info.json @@ -1 +1 @@ -{"version": "0.1.8+build.1"} +{"version": "0.1.9-alpha.1"} diff --git a/docs/community/index.md b/docs/community/index.md index 2ab9f138a02..0fcfe54d063 100644 --- a/docs/community/index.md +++ b/docs/community/index.md @@ -27,7 +27,7 @@ ElizaOS empowers developers of all skill levels to harness the potential of AI a ## Governance -ai16z originates as being an AI agent led DAO. Similar to how we can influence the autonomous agents on memecoins to buy, we intend to bring similar functionality for token holders to actively participate in the decision-making process and shape the future of the project. Community members can pitch ideas, provide insights, and influence investment strategies based on their expertise and track record. +ai16z originates as being an AI agent-led DAO. Similar to how we can influence the autonomous agents on memecoins to buy, we intend to bring similar functionality for token holders to actively participate in the decision-making process and shape the future of the project. Community members can pitch ideas, provide insights, and influence investment strategies based on their expertise and track record. ## Explore and Contribute diff --git a/docs/docs/advanced/fine-tuning.md b/docs/docs/advanced/fine-tuning.md index 2a3220ddac6..9ee301b8621 100644 --- a/docs/docs/advanced/fine-tuning.md +++ b/docs/docs/advanced/fine-tuning.md @@ -26,6 +26,7 @@ enum ModelProviderName { REDPILL, OPENROUTER, HEURIST, + LIVEPEER, } ``` @@ -272,24 +273,45 @@ const llamaLocalSettings = { ```typescript const heuristSettings = { - settings: { - stop: [], - maxInputTokens: 32768, - maxOutputTokens: 8192, - repetition_penalty: 0.0, - temperature: 0.7, - }, - imageSettings: { - steps: 20, - }, - endpoint: "https://llm-gateway.heurist.xyz", - model: { - [ModelClass.SMALL]: "hermes-3-llama3.1-8b", - [ModelClass.MEDIUM]: "mistralai/mixtral-8x7b-instruct", - [ModelClass.LARGE]: "nvidia/llama-3.1-nemotron-70b-instruct", - [ModelClass.EMBEDDING]: "", // Add later - [ModelClass.IMAGE]: "FLUX.1-dev", - }, + settings: { + stop: [], + maxInputTokens: 32768, + maxOutputTokens: 8192, + repetition_penalty: 0.0, + temperature: 0.7, + }, + imageSettings: { + steps: 20, + }, + endpoint: "https://llm-gateway.heurist.xyz", + model: { + [ModelClass.SMALL]: "hermes-3-llama3.1-8b", + [ModelClass.MEDIUM]: "mistralai/mixtral-8x7b-instruct", + [ModelClass.LARGE]: "nvidia/llama-3.1-nemotron-70b-instruct", + [ModelClass.EMBEDDING]: "", // Add later + [ModelClass.IMAGE]: "FLUX.1-dev", + }, +}; +``` + +### Livepeer Provider + +```typescript +const livepeerSettings = { + settings: { + stop: [], + maxInputTokens: 128000, + maxOutputTokens: 8192, + repetition_penalty: 0.4, + temperature: 0.7, + }, + endpoint: "https://dream-gateway.livepeer.cloud", + model: { + [ModelClass.SMALL]: "meta-llama/Meta-Llama-3.1-8B-Instruct", + [ModelClass.MEDIUM]: "meta-llama/Meta-Llama-3.1-8B-Instruct", + [ModelClass.LARGE]: "meta-llama/Llama-3.3-70B-Instruct", + [ModelClass.IMAGE]: "ByteDance/SDXL-Lightning", + }, }; ``` diff --git a/docs/docs/core/actions.md b/docs/docs/core/actions.md index 0f710e0c90d..38fe9304921 100644 --- a/docs/docs/core/actions.md +++ b/docs/docs/core/actions.md @@ -164,7 +164,7 @@ interface Action { - **validate**: Determines if the action can be executed - **handler**: Implements the action's behavior - **examples**: Demonstrates proper usage patterns -- **suppressInitialMessage**: When true, suppresses the initial response message before processing the action. Useful for actions that generate their own responses (like image generation) +- **suppressInitialMessage**: When true, suppress the initial response message before processing the action. Useful for actions that generate their own responses (like image generation) --- @@ -179,7 +179,7 @@ const continueAction: Action = { name: "CONTINUE", similes: ["ELABORATE", "KEEP_TALKING"], description: - "Used when the message requires a follow-up. Don't use when the conversation is finished.", + "Used when the message requires a follow-up. Don't use it when the conversation is finished.", validate: async (runtime, message) => { // Validation logic return true; diff --git a/docs/docs/core/characterfile.md b/docs/docs/core/characterfile.md index 8b5a278f459..728d64e28e9 100644 --- a/docs/docs/core/characterfile.md +++ b/docs/docs/core/characterfile.md @@ -92,7 +92,7 @@ The character's display name for identification and in conversations. #### `modelProvider` (required) -Specifies the AI model provider. Supported options from [ModelProviderName](/api/enumerations/modelprovidername) include `anthropic`, `llama_local`, `openai`, and others. +Specifies the AI model provider. Supported options from [ModelProviderName](/api/enumerations/modelprovidername) include `anthropic`, `llama_local`, `openai`, `livepeer`, and others. #### `clients` (required) diff --git a/docs/docs/quickstart.md b/docs/docs/quickstart.md index 8267b1e98dd..991af92da99 100644 --- a/docs/docs/quickstart.md +++ b/docs/docs/quickstart.md @@ -92,10 +92,17 @@ Eliza supports multiple AI models: - **Heurist**: Set `modelProvider: "heurist"` in your character file. Most models are uncensored. - LLM: Select available LLMs [here](https://docs.heurist.ai/dev-guide/supported-models#large-language-models-llms) and configure `SMALL_HEURIST_MODEL`,`MEDIUM_HEURIST_MODEL`,`LARGE_HEURIST_MODEL` - Image Generation: Select available Stable Diffusion or Flux models [here](https://docs.heurist.ai/dev-guide/supported-models#image-generation-models) and configure `HEURIST_IMAGE_MODEL` (default is FLUX.1-dev) +<<<<<<< HEAD - **Llama**: Set `OLLAMA_MODEL` to your chosen model - **Grok**: Set `GROK_API_KEY` to your Grok API key and set `modelProvider: "grok"` in your character file - **OpenAI**: Set `OPENAI_API_KEY` to your OpenAI API key and set `modelProvider: "openai"` in your character file - **Livepeer**: Set `LIVEPEER_IMAGE_MODEL` to your chosen Livepeer image model, available models [here](https://livepeer-eliza.com/) +======= +- **Llama**: Set `XAI_MODEL=meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo` +- **Grok**: Set `XAI_MODEL=grok-beta` +- **OpenAI**: Set `XAI_MODEL=gpt-4o-mini` or `gpt-4o` +- **Livepeer**: Set `SMALL_LIVEPEER_MODEL`,`MEDIUM_LIVEPEER_MODEL`,`LARGE_LIVEPEER_MODEL` and `IMAGE_LIVEPEER_MODEL` to your desired models listed [here](https://livepeer-eliza.com/). +>>>>>>> 95f56e6b4 (Merge pull request #2 from Titan-Node/livepeer-doc-updates) You set which model to use inside the character JSON file @@ -130,7 +137,7 @@ You set which model to use inside the character JSON file pnpm start --character="characters/trump.character.json" ``` - You can also load multiple characters with the characters option with a comma separated list: + You can also load multiple characters with the characters option with a comma-separated list: ```bash pnpm start --characters="characters/trump.character.json,characters/tate.character.json" diff --git a/package.json b/package.json index af32159bf96..657c3eec6e3 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "@0glabs/0g-ts-sdk": "0.2.1", "@coinbase/coinbase-sdk": "0.10.0", "@deepgram/sdk": "^3.9.0", + "@injectivelabs/sdk-ts": "^1.14.33", "@vitest/eslint-plugin": "1.0.1", "amqplib": "0.10.5", "csv-parse": "5.6.0", diff --git a/packages/client-direct/src/api.ts b/packages/client-direct/src/api.ts index 0cecbb4b69a..ff97d23f0e7 100644 --- a/packages/client-direct/src/api.ts +++ b/packages/client-direct/src/api.ts @@ -109,7 +109,7 @@ export function createApiRouter( }; if (!agentId) return; - let agent: AgentRuntime = agents.get(agentId); + const agent: AgentRuntime = agents.get(agentId); if (agent) { agent.stop(); @@ -127,7 +127,7 @@ export function createApiRouter( }; if (!agentId) return; - let agent: AgentRuntime = agents.get(agentId); + const agent: AgentRuntime = agents.get(agentId); // update character if (agent) { diff --git a/packages/client-github/__tests__/environment.test.ts b/packages/client-github/__tests__/environment.test.ts new file mode 100644 index 00000000000..5efb2836bff --- /dev/null +++ b/packages/client-github/__tests__/environment.test.ts @@ -0,0 +1,50 @@ +import { describe, it, expect, vi } from 'vitest'; +import { validateGithubConfig, githubEnvSchema } from '../src/environment'; +import { IAgentRuntime } from '@elizaos/core'; + +describe('GitHub Environment Configuration', () => { + const mockRuntime: IAgentRuntime = { + getSetting: vi.fn(), + } as unknown as IAgentRuntime; + + it('validates correct GitHub configuration', async () => { + const validConfig = { + GITHUB_OWNER: 'testowner', + GITHUB_REPO: 'testrepo', + GITHUB_BRANCH: 'main', + GITHUB_PATH: 'src', + GITHUB_API_TOKEN: 'ghp_test123', + }; + + vi.mocked(mockRuntime.getSetting).mockImplementation((key: string) => validConfig[key as keyof typeof validConfig]); + + const config = await validateGithubConfig(mockRuntime); + expect(config).toEqual(validConfig); + }); + + it('throws error for missing configuration', async () => { + const invalidConfig = { + GITHUB_OWNER: '', + GITHUB_REPO: '', + GITHUB_BRANCH: '', + GITHUB_PATH: '', + GITHUB_API_TOKEN: '', + }; + + vi.mocked(mockRuntime.getSetting).mockImplementation((key: string) => invalidConfig[key as keyof typeof invalidConfig]); + + await expect(validateGithubConfig(mockRuntime)).rejects.toThrow(); + }); + + it('throws error for partial configuration', async () => { + const partialConfig = { + GITHUB_OWNER: 'testowner', + GITHUB_REPO: 'testrepo', + // Missing other required fields + }; + + vi.mocked(mockRuntime.getSetting).mockImplementation((key: string) => partialConfig[key as keyof typeof partialConfig]); + + await expect(validateGithubConfig(mockRuntime)).rejects.toThrow(); + }); +}); diff --git a/packages/client-github/__tests__/index.test.ts b/packages/client-github/__tests__/index.test.ts new file mode 100644 index 00000000000..68723df9146 --- /dev/null +++ b/packages/client-github/__tests__/index.test.ts @@ -0,0 +1,88 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { GitHubClient, GitHubClientInterface } from '../src'; +import { AgentRuntime, IAgentRuntime } from '@elizaos/core'; +import { Octokit } from '@octokit/rest'; +import simpleGit from 'simple-git'; +import fs from 'fs'; +import fsPromises from 'fs/promises'; + +// Mock external dependencies +vi.mock('@octokit/rest', () => ({ + Octokit: vi.fn(), +})); + +vi.mock('simple-git', () => ({ + default: vi.fn(() => ({ + clone: vi.fn(), + pull: vi.fn(), + checkout: vi.fn(), + })), +})); + +vi.mock('fs/promises', async (importOriginal) => { + const actual = await importOriginal() as typeof fsPromises; + return { + ...actual, + mkdir: vi.fn(), + lstat: vi.fn(), + readdir: vi.fn(), + readFile: vi.fn(), + writeFile: vi.fn(), + }; +}); + +vi.mock('fs', async (importOriginal) => { + const actual = await importOriginal() as typeof fs; + return { + ...actual, + existsSync: vi.fn(), + realpathSync: vi.fn(), + lstatSync: vi.fn(), + readdirSync: vi.fn(), + }; +}); + +describe('GitHubClient', () => { + let mockRuntime: AgentRuntime; + const mockConfig = { + GITHUB_OWNER: 'testowner', + GITHUB_REPO: 'testrepo', + GITHUB_BRANCH: 'main', + GITHUB_PATH: 'src', + GITHUB_API_TOKEN: 'ghp_test123', + }; + + beforeEach(() => { + vi.clearAllMocks(); + mockRuntime = { + getSetting: vi.fn((key: string) => mockConfig[key as keyof typeof mockConfig]), + } as unknown as AgentRuntime; + }); + + it('initializes with correct configuration', () => { + const client = new GitHubClient(mockRuntime); + expect(Octokit).toHaveBeenCalledWith({ auth: mockConfig.GITHUB_API_TOKEN }); + }); + + describe('GitHubClientInterface', () => { + it('has start and stop methods', () => { + expect(GitHubClientInterface.start).toBeDefined(); + expect(GitHubClientInterface.stop).toBeDefined(); + }); + + it('start method initializes client', async () => { + const runtime = { + getSetting: vi.fn((key: string) => mockConfig[key as keyof typeof mockConfig]), + } as unknown as IAgentRuntime; + + await GitHubClientInterface.start(runtime); + // Add more specific assertions based on what start should do + }); + + it('stop method cleans up resources', () => { + const runtime = {} as IAgentRuntime; + GitHubClientInterface.stop(runtime); + // Add assertions for cleanup if needed + }); + }); +}); diff --git a/packages/client-github/package.json b/packages/client-github/package.json index d0108927073..a740dc7fa59 100644 --- a/packages/client-github/package.json +++ b/packages/client-github/package.json @@ -27,11 +27,14 @@ }, "devDependencies": { "@types/glob": "8.1.0", - "tsup": "8.3.5" + "tsup": "8.3.5", + "vitest": "^1.2.1" }, "scripts": { "build": "tsup --format esm --dts", "dev": "tsup --format esm --dts --watch", - "lint": "eslint --fix --cache ." + "lint": "eslint --fix --cache .", + "test": "vitest run", + "test:watch": "vitest" } } diff --git a/packages/client-instagram/eslint.config.mjs b/packages/client-instagram/eslint.config.mjs new file mode 100644 index 00000000000..92fe5bbebef --- /dev/null +++ b/packages/client-instagram/eslint.config.mjs @@ -0,0 +1,3 @@ +import eslintGlobalConfig from "../../eslint.config.mjs"; + +export default [...eslintGlobalConfig]; diff --git a/packages/client-instagram/src/index.ts b/packages/client-instagram/src/index.ts index 9c70cb42a1f..f322d78c7ea 100644 --- a/packages/client-instagram/src/index.ts +++ b/packages/client-instagram/src/index.ts @@ -6,50 +6,52 @@ import { InstagramInteractionService } from "./services/interaction"; import { InstagramPostService } from "./services/post"; export const InstagramClientInterface: Client = { - async start(runtime: IAgentRuntime) { - try { - // Validate configuration - const config = await validateInstagramConfig(runtime); - elizaLogger.log("Instagram client configuration validated"); - - // Initialize client and get initial state - const state = await initializeClient(runtime, config); - elizaLogger.log("Instagram client initialized"); - - // Create services - const postService = new InstagramPostService(runtime, state); - const interactionService = new InstagramInteractionService(runtime, state); - - // Start services - if (!config.INSTAGRAM_DRY_RUN) { - await postService.start(); - elizaLogger.log("Instagram post service started"); - - if (config.INSTAGRAM_ENABLE_ACTION_PROCESSING) { - await interactionService.start(); - elizaLogger.log("Instagram interaction service started"); + async start(runtime: IAgentRuntime) { + try { + // Validate configuration + const config = await validateInstagramConfig(runtime); + elizaLogger.log("Instagram client configuration validated"); + + // Initialize client and get initial state + const state = await initializeClient(runtime, config); + elizaLogger.log("Instagram client initialized"); + + // Create services + const postService = new InstagramPostService(runtime, state); + const interactionService = new InstagramInteractionService( + runtime, + state + ); + + // Start services + if (!config.INSTAGRAM_DRY_RUN) { + await postService.start(); + elizaLogger.log("Instagram post service started"); + + if (config.INSTAGRAM_ENABLE_ACTION_PROCESSING) { + await interactionService.start(); + elizaLogger.log("Instagram interaction service started"); + } + } else { + elizaLogger.log("Instagram client running in dry-run mode"); + } + + // Return manager instance + return { + post: postService, + interaction: interactionService, + state, + }; + } catch (error) { + elizaLogger.error("Failed to start Instagram client:", error); + throw error; } - } else { - elizaLogger.log("Instagram client running in dry-run mode"); - } - - // Return manager instance - return { - post: postService, - interaction: interactionService, - state - }; - - } catch (error) { - elizaLogger.error("Failed to start Instagram client:", error); - throw error; - } - }, - - async stop(runtime: IAgentRuntime) { - elizaLogger.log("Stopping Instagram client services..."); - // Cleanup will be handled by the services themselves - } + }, + + async stop(_runtime: IAgentRuntime) { + elizaLogger.log("Stopping Instagram client services..."); + // Cleanup will be handled by the services themselves + }, }; -export default InstagramClientInterface; \ No newline at end of file +export default InstagramClientInterface; diff --git a/packages/client-instagram/src/lib/auth.ts b/packages/client-instagram/src/lib/auth.ts index a2b956ce98f..307547996cf 100644 --- a/packages/client-instagram/src/lib/auth.ts +++ b/packages/client-instagram/src/lib/auth.ts @@ -1,6 +1,6 @@ // src/lib/auth.ts import { IAgentRuntime, elizaLogger } from "@elizaos/core"; -import { IgLoginTwoFactorRequiredError } from 'instagram-private-api'; +import { IgLoginTwoFactorRequiredError } from "instagram-private-api"; import { InstagramConfig } from "../environment"; import { InstagramState } from "../types"; import { fetchProfile } from "./profile"; @@ -10,96 +10,94 @@ import { createInitialState, getIgClient } from "./state"; * Authenticates with Instagram */ async function authenticate( - runtime: IAgentRuntime, - config: InstagramConfig + runtime: IAgentRuntime, + config: InstagramConfig ): Promise { - const ig = getIgClient(); - let state = createInitialState(); + const ig = getIgClient(); + const state = createInitialState(); - try { - // Generate device ID - ig.state.generateDevice(config.INSTAGRAM_USERNAME); - - // Attempt to load cached session - const cachedSession = await runtime.cacheManager.get('instagram/session'); - if (cachedSession) { - try { - await ig.state.deserialize(cachedSession); - const profile = await fetchProfile(runtime, config); - return { - ...state, - isInitialized: true, - profile - }; - } catch (error) { - elizaLogger.warn('Cached session invalid, proceeding with fresh login'); - } - } - - // Proceed with fresh login try { - await ig.account.login( - config.INSTAGRAM_USERNAME, - config.INSTAGRAM_PASSWORD - ); + // Generate device ID + ig.state.generateDevice(config.INSTAGRAM_USERNAME); + + // Attempt to load cached session + const cachedSession = + await runtime.cacheManager.get("instagram/session"); + if (cachedSession) { + try { + await ig.state.deserialize(cachedSession); + const profile = await fetchProfile(runtime, config); + return { + ...state, + isInitialized: true, + profile, + }; + } catch { + elizaLogger.warn( + `Cached session invalid, proceeding with fresh login` + ); + } + } - // Cache the session - const serialized = await ig.state.serialize(); - await runtime.cacheManager.set('instagram/session', serialized); + // Proceed with fresh login + try { + await ig.account.login( + config.INSTAGRAM_USERNAME, + config.INSTAGRAM_PASSWORD + ); - const profile = await fetchProfile(runtime, config); + // Cache the session + const serialized = await ig.state.serialize(); + await runtime.cacheManager.set("instagram/session", serialized); - return { - ...state, - isInitialized: true, - profile - }; + const profile = await fetchProfile(runtime, config); + return { + ...state, + isInitialized: true, + profile, + }; + } catch (error) { + if (error instanceof IgLoginTwoFactorRequiredError) { + // Handle 2FA if needed - would need to implement 2FA code generation + throw new Error("2FA authentication not yet implemented"); + } + throw error; + } } catch (error) { - if (error instanceof IgLoginTwoFactorRequiredError) { - // Handle 2FA if needed - would need to implement 2FA code generation - throw new Error('2FA authentication not yet implemented'); - } - throw error; + elizaLogger.error("Authentication failed:", error); + throw error; } - - } catch (error) { - elizaLogger.error('Authentication failed:', error); - throw error; - } } /** * Sets up webhooks for real-time updates if needed */ async function setupWebhooks() { - // Implement webhook setup - // This is a placeholder for future implementation + // Implement webhook setup + // This is a placeholder for future implementation } /** * Initializes the Instagram client */ export async function initializeClient( - runtime: IAgentRuntime, - config: InstagramConfig + runtime: IAgentRuntime, + config: InstagramConfig ): Promise { - try { - // Authenticate and get initial state - const state = await authenticate(runtime, config); + try { + // Authenticate and get initial state + const state = await authenticate(runtime, config); - // Set up webhook handlers if needed - await setupWebhooks(); + // Set up webhook handlers if needed + await setupWebhooks(); - return state; - } catch (error) { - elizaLogger.error('Failed to initialize Instagram client:', error); - throw error; - } + return state; + } catch (error) { + elizaLogger.error("Failed to initialize Instagram client:", error); + throw error; + } } // Export other authentication related functions if needed -export { - authenticate, - setupWebhooks -}; +export { authenticate, setupWebhooks }; diff --git a/packages/client-instagram/src/services/post.ts b/packages/client-instagram/src/services/post.ts index 2d1a94d9b5e..67b8cb78abe 100644 --- a/packages/client-instagram/src/services/post.ts +++ b/packages/client-instagram/src/services/post.ts @@ -1,8 +1,17 @@ // src/services/post.ts -import { IAgentRuntime, ModelClass, composeContext, elizaLogger, generateImage, generateText, getEmbeddingZeroVector, stringToUuid } from "@elizaos/core"; -import { promises as fs } from 'fs'; +import { + IAgentRuntime, + ModelClass, + composeContext, + elizaLogger, + generateImage, + generateText, + getEmbeddingZeroVector, + stringToUuid, +} from "@elizaos/core"; +import { promises as fs } from "fs"; import path from "path"; -import sharp from 'sharp'; +import sharp from "sharp"; import { getIgClient } from "../lib/state"; import { InstagramState } from "../types"; @@ -29,300 +38,331 @@ Your response should not contain any questions. Brief, concise statements only. Add up to 3 relevant hashtags at the end.`; interface PostOptions { - media: Array<{ - type: 'IMAGE' | 'VIDEO' | 'CAROUSEL'; - url: string; - }>; - caption?: string; + media: Array<{ + type: "IMAGE" | "VIDEO" | "CAROUSEL"; + url: string; + }>; + caption?: string; } export class InstagramPostService { - private runtime: IAgentRuntime; - private state: InstagramState; - private isProcessing: boolean = false; - private lastPostTime: number = 0; - private stopProcessing: boolean = false; - - constructor(runtime: IAgentRuntime, state: InstagramState) { - this.runtime = runtime; - this.state = state; - } - - async start() { - const generatePostLoop = async () => { - const lastPost = await this.runtime.cacheManager.get<{ timestamp: number }>( - 'instagram/lastPost' - ); - - const lastPostTimestamp = lastPost?.timestamp ?? 0; - const minMinutes = parseInt(this.runtime.getSetting('POST_INTERVAL_MIN') || '90', 10); - const maxMinutes = parseInt(this.runtime.getSetting('POST_INTERVAL_MAX') || '180', 10); - const randomMinutes = Math.floor(Math.random() * (maxMinutes - minMinutes + 1)) + minMinutes; - const delay = randomMinutes * 60 * 1000; - - if (Date.now() > lastPostTimestamp + delay) { - await this.generateNewPost(); - } - - if (!this.stopProcessing) { - setTimeout(generatePostLoop, delay); - } - - elizaLogger.log(`Next Instagram post scheduled in ${randomMinutes} minutes`); - }; - - // Start the loop - generatePostLoop(); - } - - async stop() { - this.stopProcessing = true; - } - - private async generateNewPost() { - try { - elizaLogger.log("Generating new Instagram post"); - - const roomId = stringToUuid( - "instagram_generate_room-" + this.state.profile?.username - ); - - await this.runtime.ensureUserExists( - this.runtime.agentId, - this.state.profile?.username || '', - this.runtime.character.name, - "instagram" - ); - - const topics = this.runtime.character.topics.join(", "); - - const state = await this.runtime.composeState( - { - userId: this.runtime.agentId, - roomId: roomId, - agentId: this.runtime.agentId, - content: { - text: topics || "", - action: "POST", - }, - }, - { - instagramUsername: this.state.profile?.username - } - ); - - const context = composeContext({ - state, - // TODO: Add back in when we have a template for Instagram on character - //template: this.runtime.character.templates?.instagramPostTemplate || instagramPostTemplate, - template: instagramPostTemplate, - - }); - - elizaLogger.debug("generate post prompt:\n" + context); - - const content = await generateText({ - runtime: this.runtime, - context, - modelClass: ModelClass.SMALL, - }); - - // Clean the generated content - let cleanedContent = ""; - - // Try parsing as JSON first - try { - const parsedResponse = JSON.parse(content); - if (parsedResponse.text) { - cleanedContent = parsedResponse.text; - } else if (typeof parsedResponse === "string") { - cleanedContent = parsedResponse; + private runtime: IAgentRuntime; + private state: InstagramState; + private isProcessing: boolean = false; + private lastPostTime: number = 0; + private stopProcessing: boolean = false; + + constructor(runtime: IAgentRuntime, state: InstagramState) { + this.runtime = runtime; + this.state = state; + } + + async start() { + const generatePostLoop = async () => { + const lastPost = await this.runtime.cacheManager.get<{ + timestamp: number; + }>("instagram/lastPost"); + + const lastPostTimestamp = lastPost?.timestamp ?? 0; + const minMinutes = parseInt( + this.runtime.getSetting("POST_INTERVAL_MIN") || "90", + 10 + ); + const maxMinutes = parseInt( + this.runtime.getSetting("POST_INTERVAL_MAX") || "180", + 10 + ); + const randomMinutes = + Math.floor(Math.random() * (maxMinutes - minMinutes + 1)) + + minMinutes; + const delay = randomMinutes * 60 * 1000; + + if (Date.now() > lastPostTimestamp + delay) { + await this.generateNewPost(); + } + + if (!this.stopProcessing) { + setTimeout(generatePostLoop, delay); + } + + elizaLogger.log( + `Next Instagram post scheduled in ${randomMinutes} minutes` + ); + }; + + // Start the loop + generatePostLoop(); + } + + async stop() { + this.stopProcessing = true; + } + + private async generateNewPost() { + try { + elizaLogger.log("Generating new Instagram post"); + + const roomId = stringToUuid( + "instagram_generate_room-" + this.state.profile?.username + ); + + await this.runtime.ensureUserExists( + this.runtime.agentId, + this.state.profile?.username || "", + this.runtime.character.name, + "instagram" + ); + + const topics = this.runtime.character.topics.join(", "); + + const state = await this.runtime.composeState( + { + userId: this.runtime.agentId, + roomId: roomId, + agentId: this.runtime.agentId, + content: { + text: topics || "", + action: "POST", + }, + }, + { + instagramUsername: this.state.profile?.username, + } + ); + + const context = composeContext({ + state, + // TODO: Add back in when we have a template for Instagram on character + //template: this.runtime.character.templates?.instagramPostTemplate || instagramPostTemplate, + template: instagramPostTemplate, + }); + + elizaLogger.debug("generate post prompt:\n" + context); + + const content = await generateText({ + runtime: this.runtime, + context, + modelClass: ModelClass.SMALL, + }); + + // Clean the generated content + let cleanedContent = ""; + + // Try parsing as JSON first + try { + const parsedResponse = JSON.parse(content); + if (parsedResponse.text) { + cleanedContent = parsedResponse.text; + } else if (typeof parsedResponse === "string") { + cleanedContent = parsedResponse; + } + } catch { + // If not JSON, clean the raw content + cleanedContent = content + .replace(/^\s*{?\s*"text":\s*"|"\s*}?\s*$/g, "") // Remove JSON-like wrapper + .replace(/^['"](.*)['"]$/g, "$1") // Remove quotes + .replace(/\\"/g, '"') // Unescape quotes + .replace(/\\n/g, "\n\n") // Unescape newlines + .trim(); + } + + if (!cleanedContent) { + elizaLogger.error( + "Failed to extract valid content from response:", + { + rawResponse: content, + attempted: "JSON parsing", + } + ); + return; + } + + // For Instagram, we need to generate or get an image + const mediaUrl = await this.getOrGenerateImage(cleanedContent); + + await this.createPost({ + media: [ + { + type: "IMAGE", + url: mediaUrl, + }, + ], + caption: cleanedContent, + }); + + // Create memory of the post + await this.runtime.messageManager.createMemory({ + id: stringToUuid(`instagram-post-${Date.now()}`), + userId: this.runtime.agentId, + agentId: this.runtime.agentId, + content: { + text: cleanedContent, + source: "instagram", + }, + roomId, + embedding: getEmbeddingZeroVector(), + createdAt: Date.now(), + }); + } catch (error) { + elizaLogger.error("Error generating Instagram post:", { + error: error instanceof Error ? error.message : String(error), + stack: error instanceof Error ? error.stack : undefined, + phase: "generateNewPost", + }); } - } catch (error) { - // If not JSON, clean the raw content - cleanedContent = content - .replace(/^\s*{?\s*"text":\s*"|"\s*}?\s*$/g, "") // Remove JSON-like wrapper - .replace(/^['"](.*)['"]$/g, "$1") // Remove quotes - .replace(/\\"/g, '"') // Unescape quotes - .replace(/\\n/g, "\n\n") // Unescape newlines - .trim(); - } - - if (!cleanedContent) { - elizaLogger.error("Failed to extract valid content from response:", { - rawResponse: content, - attempted: "JSON parsing", - }); - return; - } - - // For Instagram, we need to generate or get an image - const mediaUrl = await this.getOrGenerateImage(cleanedContent); - - await this.createPost({ - media: [{ - type: 'IMAGE', - url: mediaUrl - }], - caption: cleanedContent - }); - - // Create memory of the post - await this.runtime.messageManager.createMemory({ - id: stringToUuid(`instagram-post-${Date.now()}`), - userId: this.runtime.agentId, - agentId: this.runtime.agentId, - content: { - text: cleanedContent, - source: "instagram", - }, - roomId, - embedding: getEmbeddingZeroVector(), - createdAt: Date.now(), - }); - - } catch (error) { - elizaLogger.error("Error generating Instagram post:", { - error: error instanceof Error ? error.message : String(error), - stack: error instanceof Error ? error.stack : undefined, - phase: 'generateNewPost' - }); } - } - - // Placeholder - implement actual image generation/selection - private async getOrGenerateImage(content: string): Promise { - try { - elizaLogger.log("Generating image for Instagram post"); - - const result = await generateImage({ - prompt: content, - width: 1024, - height: 1024, - count: 1, - numIterations: 50, - guidanceScale: 7.5 - }, this.runtime); - - if (!result.success || !result.data || result.data.length === 0) { - throw new Error("Failed to generate image: " + (result.error || "No image data returned")); - } - - // Save the base64 image to a temporary file - const imageData = result.data[0].replace(/^data:image\/\w+;base64,/, ''); - const tempDir = path.resolve(process.cwd(), 'temp'); - await fs.mkdir(tempDir, { recursive: true }); - const tempFile = path.join(tempDir, `instagram-post-${Date.now()}.png`); - await fs.writeFile(tempFile, Buffer.from(imageData, 'base64')); - - return tempFile; - } catch (error) { - elizaLogger.error("Error generating image:", { - error: error instanceof Error ? error.message : String(error), - stack: error instanceof Error ? error.stack : undefined, - phase: 'getOrGenerateImage' - }); - throw error; + + // Placeholder - implement actual image generation/selection + private async getOrGenerateImage(content: string): Promise { + try { + elizaLogger.log("Generating image for Instagram post"); + + const result = await generateImage( + { + prompt: content, + width: 1024, + height: 1024, + count: 1, + numIterations: 50, + guidanceScale: 7.5, + }, + this.runtime + ); + + if (!result.success || !result.data || result.data.length === 0) { + throw new Error( + "Failed to generate image: " + + (result.error || "No image data returned") + ); + } + + // Save the base64 image to a temporary file + const imageData = result.data[0].replace( + /^data:image\/\w+;base64,/, + "" + ); + const tempDir = path.resolve(process.cwd(), "temp"); + await fs.mkdir(tempDir, { recursive: true }); + const tempFile = path.join( + tempDir, + `instagram-post-${Date.now()}.png` + ); + await fs.writeFile(tempFile, Buffer.from(imageData, "base64")); + + return tempFile; + } catch (error) { + elizaLogger.error("Error generating image:", { + error: error instanceof Error ? error.message : String(error), + stack: error instanceof Error ? error.stack : undefined, + phase: "getOrGenerateImage", + }); + throw error; + } } - } - - async createPost(options: PostOptions) { - const ig = getIgClient(); - - try { - elizaLogger.log("Creating Instagram post", { - mediaCount: options.media.length, - hasCaption: !!options.caption - }); - - // Process media - const processedMedia = await Promise.all( - options.media.map(async (media) => { - const buffer = await this.processMedia(media); - return { - ...media, - buffer - }; - }) - ); - - // Handle different post types - if (processedMedia.length > 1) { - // Create carousel post - await ig.publish.album({ - items: processedMedia.map(media => ({ - file: media.buffer, - caption: options.caption - })) - }); - } else { - // Single image/video post - const media = processedMedia[0]; - if (media.type === 'VIDEO') { - await ig.publish.video({ - video: media.buffer, - caption: options.caption, - coverImage: media.buffer - }); - } else { - await ig.publish.photo({ - file: media.buffer, - caption: options.caption - }); + + async createPost(options: PostOptions) { + const ig = getIgClient(); + + try { + elizaLogger.log("Creating Instagram post", { + mediaCount: options.media.length, + hasCaption: !!options.caption, + }); + + // Process media + const processedMedia = await Promise.all( + options.media.map(async (media) => { + const buffer = await this.processMedia(media); + return { + ...media, + buffer, + }; + }) + ); + + // Handle different post types + if (processedMedia.length > 1) { + // Create carousel post + await ig.publish.album({ + items: processedMedia.map((media) => ({ + file: media.buffer, + caption: options.caption, + })), + }); + } else { + // Single image/video post + const media = processedMedia[0]; + if (media.type === "VIDEO") { + await ig.publish.video({ + video: media.buffer, + caption: options.caption, + coverImage: media.buffer, + }); + } else { + await ig.publish.photo({ + file: media.buffer, + caption: options.caption, + }); + } + } + + // Update last post time + this.lastPostTime = Date.now(); + await this.runtime.cacheManager.set("instagram/lastPost", { + timestamp: this.lastPostTime, + }); + + elizaLogger.log("Instagram post created successfully"); + } catch (error) { + elizaLogger.error("Error creating Instagram post:", { + error: error instanceof Error ? error.message : String(error), + stack: error instanceof Error ? error.stack : undefined, + phase: "createPost", + mediaCount: options.media.length, + hasCaption: !!options.caption, + }); + throw error; } - } - - // Update last post time - this.lastPostTime = Date.now(); - await this.runtime.cacheManager.set('instagram/lastPost', { - timestamp: this.lastPostTime - }); - - elizaLogger.log("Instagram post created successfully"); - } catch (error) { - elizaLogger.error("Error creating Instagram post:", { - error: error instanceof Error ? error.message : String(error), - stack: error instanceof Error ? error.stack : undefined, - phase: 'createPost', - mediaCount: options.media.length, - hasCaption: !!options.caption - }); - throw error; } - } - - private async processMedia(media: { type: string; url: string }): Promise { - try { - elizaLogger.log("Processing media", { type: media.type, url: media.url }); - - // Read file directly from filesystem instead of using fetch - const buffer = await fs.readFile(media.url); - - if (media.type === 'IMAGE') { - // Process image with sharp - return await sharp(buffer) - .resize(1080, 1080, { - fit: 'inside', - withoutEnlargement: true - }) - .jpeg({ - quality: 85, - progressive: true - }) - .toBuffer(); - } - - // For other types, return original buffer - return buffer; - } catch (error) { - elizaLogger.error("Error processing media:", { - error: error instanceof Error ? error.message : String(error), - stack: error instanceof Error ? error.stack : undefined, - phase: 'processMedia', - mediaType: media.type, - url: media.url - }); - throw error; + + private async processMedia(media: { + type: string; + url: string; + }): Promise { + try { + elizaLogger.log("Processing media", { + type: media.type, + url: media.url, + }); + + // Read file directly from filesystem instead of using fetch + const buffer = await fs.readFile(media.url); + + if (media.type === "IMAGE") { + // Process image with sharp + return await sharp(buffer) + .resize(1080, 1080, { + fit: "inside", + withoutEnlargement: true, + }) + .jpeg({ + quality: 85, + progressive: true, + }) + .toBuffer(); + } + + // For other types, return original buffer + return buffer; + } catch (error) { + elizaLogger.error("Error processing media:", { + error: error instanceof Error ? error.message : String(error), + stack: error instanceof Error ? error.stack : undefined, + phase: "processMedia", + mediaType: media.type, + url: media.url, + }); + throw error; + } } - } -} \ No newline at end of file +} diff --git a/packages/client-slack/__tests__/message-manager.test.ts b/packages/client-slack/__tests__/message-manager.test.ts new file mode 100644 index 00000000000..765355663e6 --- /dev/null +++ b/packages/client-slack/__tests__/message-manager.test.ts @@ -0,0 +1,89 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { MessageManager } from '../src/messages'; +import { WebClient } from '@slack/web-api'; +import { IAgentRuntime } from '@elizaos/core'; + +// Mock dependencies +vi.mock('@slack/web-api'); +vi.mock('@elizaos/core'); + +describe('MessageManager', () => { + let mockWebClient: WebClient; + let mockRuntime: IAgentRuntime; + let messageManager: MessageManager; + const mockBotUserId = 'U123456'; + + beforeEach(() => { + // Setup mock WebClient + mockWebClient = { + chat: { + postMessage: vi.fn() + } + } as unknown as WebClient; + + // Setup mock runtime + mockRuntime = { + getSetting: vi.fn(), + character: { + name: 'TestBot' + } + } as unknown as IAgentRuntime; + + messageManager = new MessageManager(mockWebClient, mockRuntime, mockBotUserId); + }); + + it('should initialize with correct parameters', () => { + expect(messageManager).toBeDefined(); + }); + + it('should not process duplicate events', () => { + const eventId = 'evt_123'; + const result1 = messageManager['processedEvents'].has(eventId); + expect(result1).toBe(false); + + // Add event to processed set + messageManager['processedEvents'].add(eventId); + const result2 = messageManager['processedEvents'].has(eventId); + expect(result2).toBe(true); + }); + + it('should handle message processing lock correctly', () => { + const messageId = 'msg_123'; + const isLocked1 = messageManager['messageProcessingLock'].has(messageId); + expect(isLocked1).toBe(false); + + // Lock message + messageManager['messageProcessingLock'].add(messageId); + const isLocked2 = messageManager['messageProcessingLock'].has(messageId); + expect(isLocked2).toBe(true); + }); + + it('should clean up old processed messages', () => { + vi.useFakeTimers(); + const oldMessageId = 'old_msg'; + const newMessageId = 'new_msg'; + + // Add messages with different timestamps + messageManager['processedMessages'].set(oldMessageId, Date.now() - 3700000); // older than 1 hour + messageManager['processedMessages'].set(newMessageId, Date.now()); // current + + // Trigger cleanup by advancing time and running interval callback + const cleanupInterval = setInterval(() => { + const oneHourAgo = Date.now() - 3600000; + for (const [key, timestamp] of messageManager['processedMessages'].entries()) { + if (timestamp < oneHourAgo) { + messageManager['processedMessages'].delete(key); + } + } + }, 3600000); + + vi.advanceTimersByTime(3600000); + + // Check if old message was cleaned up + expect(messageManager['processedMessages'].has(oldMessageId)).toBe(false); + expect(messageManager['processedMessages'].has(newMessageId)).toBe(true); + + clearInterval(cleanupInterval); + vi.useRealTimers(); + }); +}); diff --git a/packages/client-slack/__tests__/slack-client.provider.test.ts b/packages/client-slack/__tests__/slack-client.provider.test.ts new file mode 100644 index 00000000000..144a22c89f6 --- /dev/null +++ b/packages/client-slack/__tests__/slack-client.provider.test.ts @@ -0,0 +1,151 @@ +import { describe, expect, test, beforeEach, vi } from "vitest"; +import { SlackClientProvider } from "../src/providers/slack-client.provider"; +import { SlackConfig } from "../src/types/slack-types"; +import { WebClient } from "@slack/web-api"; +import type { + AuthTestResponse, + ChatPostMessageResponse, +} from "@slack/web-api"; + +vi.mock("@slack/web-api"); + +// Mock setup functions +const createMockSlackResponse = (ok: boolean, additionalData = {}) => ({ + ok, + ...additionalData, +}); + +const getMockWebClient = () => { + return { + auth: { + test: vi.fn(), + }, + chat: { + postMessage: vi.fn(), + }, + } as unknown as WebClient; +}; + +describe("SlackClientProvider", () => { + let provider: SlackClientProvider; + let mockWebClient: WebClient; + let mockConfig: SlackConfig; + + beforeEach(() => { + vi.clearAllMocks(); + mockConfig = { + appId: "test-app-id", + clientId: "test-client-id", + clientSecret: "test-client-secret", + signingSecret: "test-signing-secret", + verificationToken: "test-verification-token", + botToken: "test-bot-token", + botId: "test-bot-id", + }; + mockWebClient = getMockWebClient(); + provider = new SlackClientProvider(mockConfig); + // @ts-ignore - setting mock client for testing + provider['client'] = mockWebClient; + }); + + describe("Initialization", () => { + test("should create a provider instance with default retry options", () => { + expect(provider).toBeInstanceOf(SlackClientProvider); + const context = provider.getContext(); + expect(context).toHaveProperty("client"); + expect(context).toHaveProperty("config"); + expect(context.config).toEqual(mockConfig); + }); + + test("should create a provider instance with custom retry options", () => { + const retryOptions = { + maxRetries: 5, + initialDelay: 2000, + maxDelay: 10000, + }; + const providerWithOptions = new SlackClientProvider(mockConfig, retryOptions); + // @ts-ignore - setting mock client for testing + providerWithOptions['client'] = mockWebClient; + + expect(providerWithOptions).toBeInstanceOf(SlackClientProvider); + const context = providerWithOptions.getContext(); + expect(context).toHaveProperty("client"); + expect(context).toHaveProperty("config"); + expect(context.config).toEqual(mockConfig); + }); + }); + + describe("Connection Validation", () => { + test("should validate connection successfully", async () => { + const mockResponse = createMockSlackResponse(true, { + user_id: "test-bot-id", + }) as AuthTestResponse; + const mockTest = mockWebClient.auth.test as vi.Mock; + mockTest.mockResolvedValue(mockResponse); + + const result = await provider.validateConnection(); + expect(result).toBe(true); + }); + + test("should handle failed validation", async () => { + const mockResponse = createMockSlackResponse(false) as AuthTestResponse; + const mockTest = mockWebClient.auth.test as vi.Mock; + mockTest.mockResolvedValue(mockResponse); + + const result = await provider.validateConnection(); + expect(result).toBe(false); + }); + + test("should handle connection errors", async () => { + const mockTest = mockWebClient.auth.test as vi.Mock; + mockTest.mockRejectedValue(new Error("Connection failed")); + + const result = await provider.validateConnection(); + expect(result).toBe(false); + }); + }); + + describe("Message Sending", () => { + const channelId = "test-channel"; + const text = "Hello, world!"; + + test("should successfully send a message", async () => { + const expectedResponse = createMockSlackResponse(true, { + ts: "1234567890.123456", + }) as ChatPostMessageResponse; + const mockPostMessage = mockWebClient.chat.postMessage as vi.Mock; + mockPostMessage.mockResolvedValue(expectedResponse); + + const result = await provider.sendMessage(channelId, text); + expect(result.ok).toBe(true); + expect(mockPostMessage).toHaveBeenCalledWith({ + channel: channelId, + text: text, + }); + }); + + test("should handle rate limiting", async () => { + const mockResponse = createMockSlackResponse(true) as ChatPostMessageResponse; + const mockPostMessage = mockWebClient.chat.postMessage as vi.Mock; + + mockPostMessage + .mockRejectedValueOnce(new Error("rate_limited")) + .mockResolvedValueOnce(mockResponse); + + const result = await provider.sendMessage(channelId, text); + expect(result.ok).toBe(true); + }); + + test("should handle network errors with retry", async () => { + const mockResponse = createMockSlackResponse(true) as ChatPostMessageResponse; + const mockPostMessage = mockWebClient.chat.postMessage as vi.Mock; + + mockPostMessage + .mockRejectedValueOnce(new Error("network_error")) + .mockResolvedValueOnce(mockResponse); + + const result = await provider.sendMessage(channelId, text); + expect(result.ok).toBe(true); + }); + }); +}); diff --git a/packages/client-slack/__tests__/slack-client.test.ts b/packages/client-slack/__tests__/slack-client.test.ts new file mode 100644 index 00000000000..24de649fd6f --- /dev/null +++ b/packages/client-slack/__tests__/slack-client.test.ts @@ -0,0 +1,55 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { SlackClient } from '../src/index'; +import { WebClient } from '@slack/web-api'; +import { IAgentRuntime, Character } from '@elizaos/core'; + +// Mock dependencies +vi.mock('@slack/web-api'); +vi.mock('@elizaos/core'); + +describe('SlackClient', () => { + let mockRuntime: IAgentRuntime; + let slackClient: SlackClient; + + beforeEach(() => { + // Setup mock runtime + mockRuntime = { + getSetting: vi.fn((key: string) => { + const settings: { [key: string]: string } = { + 'SLACK_BOT_TOKEN': 'test-token', + 'SLACK_SIGNING_SECRET': 'test-secret' + }; + return settings[key]; + }), + character: {} as Character + } as unknown as IAgentRuntime; + }); + + it('should initialize with correct settings', () => { + slackClient = new SlackClient(mockRuntime); + expect(mockRuntime.getSetting).toHaveBeenCalledWith('SLACK_BOT_TOKEN'); + expect(mockRuntime.getSetting).toHaveBeenCalledWith('SLACK_SIGNING_SECRET'); + }); + + it('should throw error if SLACK_BOT_TOKEN is missing', () => { + mockRuntime.getSetting = vi.fn((key: string) => { + const settings: { [key: string]: string } = { + 'SLACK_SIGNING_SECRET': 'test-secret' + }; + return settings[key]; + }); + + expect(() => new SlackClient(mockRuntime)).toThrow('SLACK_BOT_TOKEN is required'); + }); + + it('should throw error if SLACK_SIGNING_SECRET is missing', () => { + mockRuntime.getSetting = vi.fn((key: string) => { + const settings: { [key: string]: string } = { + 'SLACK_BOT_TOKEN': 'test-token' + }; + return settings[key]; + }); + + expect(() => new SlackClient(mockRuntime)).toThrow('SLACK_SIGNING_SECRET is required'); + }); +}); diff --git a/packages/client-slack/package.json b/packages/client-slack/package.json index db9d5cfd4b8..95d58c0f701 100644 --- a/packages/client-slack/package.json +++ b/packages/client-slack/package.json @@ -21,7 +21,8 @@ ], "scripts": { "build": "tsup src/index.ts --format esm --dts", - "test": "jest", + "test": "vitest run", + "test:watch": "vitest", "lint": "eslint --fix --cache .", "clean": "rimraf dist", "dev": "tsup src/index.ts --watch", @@ -44,14 +45,11 @@ "devDependencies": { "@types/express": "^4.17.21", "@types/fluent-ffmpeg": "^2.1.24", - "@types/jest": "^29.5.0", "@types/node": "^18.15.11", - "jest": "^29.5.0", "rimraf": "^5.0.0", - "ts-jest": "^29.1.0", - "ts-node": "^10.9.1", - "tsup": "^8.3.5", - "typescript": "^5.0.0" + "tsup": "^6.7.0", + "typescript": "^5.0.3", + "vitest": "^1.2.1" }, "engines": { "node": ">=14.0.0" diff --git a/packages/client-slack/src/tests/setup.ts b/packages/client-slack/src/tests/setup.ts deleted file mode 100644 index fdb2f0ab956..00000000000 --- a/packages/client-slack/src/tests/setup.ts +++ /dev/null @@ -1,203 +0,0 @@ -import { jest } from "@jest/globals"; -import type { Mocked } from "jest-mock"; -import { config } from "dotenv"; -import { resolve } from "path"; -import { WebClient } from "@slack/web-api"; -import type { - AuthTestResponse, - ChatPostMessageResponse, - ConversationsInfoResponse, - FilesUploadResponse, -} from "@slack/web-api"; - -// Load test environment variables -const envPath = resolve(__dirname, "../../../../.env"); -console.log("Loading test environment from:", envPath); -config({ path: envPath }); - -// Set up test environment variables if not present -const testEnvVars = { - SLACK_APP_ID: "test-app-id", - SLACK_CLIENT_ID: "test-client-id", - SLACK_CLIENT_SECRET: "test-client-secret", - SLACK_SIGNING_SECRET: "test-signing-secret", - SLACK_VERIFICATION_TOKEN: "test-verification-token", - SLACK_BOT_TOKEN: "test-bot-token", - SLACK_CHANNEL_ID: "test-channel-id", - SLACK_BOT_ID: "test-bot-id", -}; - -Object.entries(testEnvVars).forEach(([key, value]) => { - if (!process.env[key]) { - process.env[key] = value; - } -}); - -// Create base mock functions with proper return types -const mockAuthTest = jest - .fn<() => Promise>() - .mockResolvedValue({ - ok: true, - url: "https://test.slack.com", - team: "test-team", - user: "test-user", - team_id: "T123456", - user_id: "U123456", - }); - -const mockPostMessage = jest - .fn<() => Promise>() - .mockResolvedValue({ - ok: true, - channel: "C123456", - ts: "1234567890.123456", - message: { - text: "test message", - ts: "1234567890.123456", - type: "message", - }, - }); - -const mockConversationsInfo = jest - .fn<() => Promise>() - .mockResolvedValue({ - ok: true, - channel: { - id: "C123456", - name: "test-channel", - is_channel: true, - created: 12345678, - }, - }); - -const mockFilesUpload = jest - .fn<() => Promise>() - .mockResolvedValue({ - ok: true, - file: { - id: "F123456", - name: "test-file", - title: "test-file", - mimetype: "text/plain", - filetype: "text", - pretty_type: "Plain Text", - user: "U123456", - size: 12345, - mode: "hosted", - is_external: false, - external_type: "", - is_public: true, - public_url_shared: false, - display_as_bot: false, - username: "", - url_private: "https://test.slack.com/files/test-file", - url_private_download: - "https://test.slack.com/files/test-file/download", - permalink: "https://test.slack.com/files/test-file/permalink", - permalink_public: "https://test.slack.com/files/test-file/public", - created: 12345678, - timestamp: 12345678, - channels: ["C123456"], - groups: [], - ims: [], - comments_count: 0, - }, - }); - -const mockFilesUploadV2 = jest - .fn<() => Promise>() - .mockResolvedValue({ - ok: true, - file: { - id: "F123456", - created: 12345678, - timestamp: 12345678, - name: "test-file", - title: "test-file", - mimetype: "text/plain", - filetype: "text", - pretty_type: "Plain Text", - user: "U123456", - size: 12345, - mode: "hosted", - is_external: false, - external_type: "", - is_public: true, - public_url_shared: false, - display_as_bot: false, - username: "", - url_private: "https://test.slack.com/files/test-file", - url_private_download: - "https://test.slack.com/files/test-file/download", - permalink: "https://test.slack.com/files/test-file/permalink", - permalink_public: "https://test.slack.com/files/test-file/public", - channels: ["C123456"], - groups: [], - ims: [], - comments_count: 0, - }, - }); - -// Create mock WebClient -const mockWebClient = { - slackApiUrl: "https://slack.com/api/", - token: "test-token", - apiCall: jest.fn(), - auth: { - test: mockAuthTest, - }, - chat: { - postMessage: mockPostMessage, - }, - conversations: { - info: mockConversationsInfo, - }, - files: { - upload: mockFilesUpload, - uploadV2: mockFilesUploadV2, - }, -} as unknown as Mocked; - -// Mock the WebClient constructor -jest.mock("@slack/web-api", () => ({ - WebClient: jest.fn().mockImplementation(() => mockWebClient), -})); - -// Helper function to get mock WebClient -export function getMockWebClient(): Mocked { - return mockWebClient; -} - -// Helper function to create mock Slack API responses -export function createMockSlackResponse(ok: boolean, data: any = {}) { - return { - ok, - ...data, - }; -} - -// Helper function to simulate rate limiting -export function simulateRateLimit(client: Mocked) { - const mockPostMessage = client.chat.postMessage as Mocked< - typeof client.chat.postMessage - >; - mockPostMessage.mockRejectedValueOnce(new Error("rate_limited")); -} - -// Helper function to simulate network errors -export function simulateNetworkError(client: Mocked) { - const mockPostMessage = client.chat.postMessage as Mocked< - typeof client.chat.postMessage - >; - mockPostMessage.mockRejectedValueOnce(new Error("network_error")); -} - -// Global test setup -beforeAll(() => { - jest.clearAllMocks(); -}); - -// Reset mocks after each test -afterEach(() => { - jest.clearAllMocks(); -}); diff --git a/packages/client-slack/src/tests/slack-client.provider.test.ts b/packages/client-slack/src/tests/slack-client.provider.test.ts deleted file mode 100644 index fbd7f225119..00000000000 --- a/packages/client-slack/src/tests/slack-client.provider.test.ts +++ /dev/null @@ -1,207 +0,0 @@ -import { describe, expect, test, jest, beforeEach } from "@jest/globals"; -import type { Mocked } from "jest-mock"; -import { SlackClientProvider } from "../providers/slack-client.provider"; -import { SlackConfig } from "../types/slack-types"; -import { getMockWebClient, createMockSlackResponse } from "./setup"; -import { WebClient } from "@slack/web-api"; -import type { - AuthTestResponse, - ChatPostMessageResponse, - ConversationsInfoResponse, -} from "@slack/web-api"; - -jest.mock("@slack/web-api"); - -describe("SlackClientProvider", () => { - let provider: SlackClientProvider; - let mockWebClient: Mocked; - let mockConfig: SlackConfig; - - beforeEach(() => { - jest.clearAllMocks(); - mockConfig = { - appId: "test-app-id", - clientId: "test-client-id", - clientSecret: "test-client-secret", - signingSecret: "test-signing-secret", - verificationToken: "test-verification-token", - botToken: "test-bot-token", - botId: "test-bot-id", - }; - mockWebClient = getMockWebClient(); - provider = new SlackClientProvider(mockConfig); - }); - - describe("Initialization", () => { - test("should create a provider instance with default retry options", () => { - expect(provider).toBeInstanceOf(SlackClientProvider); - const context = provider.getContext(); - expect(context).toHaveProperty("client"); - expect(context).toHaveProperty("config"); - expect(context.config).toEqual(mockConfig); - }); - - test("should create a provider instance with custom retry options", () => { - const retryOptions = { - maxRetries: 5, - initialDelay: 2000, - maxDelay: 10000, - }; - const providerWithOptions = new SlackClientProvider( - mockConfig, - retryOptions - ); - expect(providerWithOptions).toBeInstanceOf(SlackClientProvider); - }); - }); - - describe("Connection Validation", () => { - test("should successfully validate connection", async () => { - const mockResponse = createMockSlackResponse(true, { - user_id: "test-bot-id", - }) as AuthTestResponse; - const mockTest = mockWebClient.auth.test as Mocked< - typeof mockWebClient.auth.test - >; - mockTest.mockResolvedValue(mockResponse); - - const result = await provider.validateConnection(); - expect(result).toBe(true); - expect(mockTest).toHaveBeenCalled(); - }); - - test("should handle failed connection validation", async () => { - const mockResponse = createMockSlackResponse( - false - ) as AuthTestResponse; - const mockTest = mockWebClient.auth.test as Mocked< - typeof mockWebClient.auth.test - >; - mockTest.mockResolvedValue(mockResponse); - - const result = await provider.validateConnection(); - expect(result).toBe(false); - }); - - test("should handle connection errors", async () => { - const mockTest = mockWebClient.auth.test as Mocked< - typeof mockWebClient.auth.test - >; - mockTest.mockRejectedValue(new Error("Connection failed")); - - const result = await provider.validateConnection(); - expect(result).toBe(false); - }); - }); - - describe("Message Sending", () => { - const channelId = "test-channel"; - const text = "Hello, world!"; - - test("should successfully send a message", async () => { - const expectedResponse = createMockSlackResponse(true, { - ts: "1234567890.123456", - }) as ChatPostMessageResponse; - const mockPostMessage = mockWebClient.chat.postMessage as Mocked< - typeof mockWebClient.chat.postMessage - >; - mockPostMessage.mockResolvedValue(expectedResponse); - - const result = await provider.sendMessage(channelId, text); - expect(result).toEqual(expectedResponse); - expect(mockPostMessage).toHaveBeenCalledWith({ - channel: channelId, - text, - }); - }); - - test("should handle rate limiting", async () => { - const mockResponse = createMockSlackResponse( - true - ) as ChatPostMessageResponse; - const mockPostMessage = mockWebClient.chat.postMessage as Mocked< - typeof mockWebClient.chat.postMessage - >; - - mockPostMessage - .mockRejectedValueOnce(new Error("rate_limited")) - .mockResolvedValueOnce(mockResponse); - - const result = await provider.sendMessage(channelId, text); - expect(result.ok).toBe(true); - expect(mockPostMessage).toHaveBeenCalledTimes(2); - }); - - test("should handle network errors", async () => { - const mockResponse = createMockSlackResponse( - true - ) as ChatPostMessageResponse; - const mockPostMessage = mockWebClient.chat.postMessage as Mocked< - typeof mockWebClient.chat.postMessage - >; - - mockPostMessage - .mockRejectedValueOnce(new Error("network_error")) - .mockResolvedValueOnce(mockResponse); - - const result = await provider.sendMessage(channelId, text); - expect(result.ok).toBe(true); - expect(mockPostMessage).toHaveBeenCalledTimes(2); - }); - }); - - describe("Thread Replies", () => { - const channelId = "test-channel"; - const threadTs = "1234567890.123456"; - const text = "Thread reply"; - - test("should successfully reply in thread", async () => { - const expectedResponse = createMockSlackResponse(true, { - ts: "1234567890.123457", - }) as ChatPostMessageResponse; - const mockPostMessage = mockWebClient.chat.postMessage as Mocked< - typeof mockWebClient.chat.postMessage - >; - mockPostMessage.mockResolvedValue(expectedResponse); - - const result = await provider.replyInThread( - channelId, - threadTs, - text - ); - expect(result).toEqual(expectedResponse); - expect(mockPostMessage).toHaveBeenCalledWith({ - channel: channelId, - text, - thread_ts: threadTs, - }); - }); - }); - - describe("Channel Validation", () => { - const channelId = "test-channel"; - - test("should successfully validate channel", async () => { - const mockResponse = createMockSlackResponse( - true - ) as ConversationsInfoResponse; - const mockInfo = mockWebClient.conversations.info as Mocked< - typeof mockWebClient.conversations.info - >; - mockInfo.mockResolvedValue(mockResponse); - - const result = await provider.validateChannel(channelId); - expect(result).toBe(true); - }); - - test("should handle invalid channel", async () => { - const mockInfo = mockWebClient.conversations.info as Mocked< - typeof mockWebClient.conversations.info - >; - mockInfo.mockRejectedValue(new Error("Channel not found")); - - const result = await provider.validateChannel(channelId); - expect(result).toBe(false); - }); - }); -}); diff --git a/packages/client-slack/src/tests/test_image.png b/packages/client-slack/src/tests/test_image.png deleted file mode 100644 index b711feb1fa3..00000000000 Binary files a/packages/client-slack/src/tests/test_image.png and /dev/null differ diff --git a/packages/client-slack/vitest.config.ts b/packages/client-slack/vitest.config.ts new file mode 100644 index 00000000000..467b936e885 --- /dev/null +++ b/packages/client-slack/vitest.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + globals: true, + environment: 'node', + include: ['__tests__/**/*.test.ts'], + coverage: { + provider: 'v8', + reporter: ['text', 'json', 'html'], + }, + }, +}) diff --git a/packages/core/__tests__/models.test.ts b/packages/core/__tests__/models.test.ts index 4a883266b89..52c1649bee0 100644 --- a/packages/core/__tests__/models.test.ts +++ b/packages/core/__tests__/models.test.ts @@ -18,6 +18,8 @@ vi.mock("../settings", () => { LLAMACLOUD_MODEL_LARGE: "mock-llama-large", TOGETHER_MODEL_SMALL: "mock-together-small", TOGETHER_MODEL_LARGE: "mock-together-large", + LIVEPEER_GATEWAY_URL: "http://gateway.test-gateway", + IMAGE_LIVEPEER_MODEL: "ByteDance/SDXL-Lightning", }, loadEnv: vi.fn(), }; @@ -125,6 +127,26 @@ describe("Model Provider Configuration", () => { ); }); }); + describe("Livepeer Provider", () => { + test("should have correct endpoint configuration", () => { + expect(models[ModelProviderName.LIVEPEER].endpoint).toBe("http://gateway.test-gateway"); + }); + + test("should have correct model mappings", () => { + const livepeerModels = models[ModelProviderName.LIVEPEER].model; + expect(livepeerModels[ModelClass.SMALL]).toBe("meta-llama/Meta-Llama-3.1-8B-Instruct"); + expect(livepeerModels[ModelClass.MEDIUM]).toBe("meta-llama/Meta-Llama-3.1-8B-Instruct"); + expect(livepeerModels[ModelClass.LARGE]).toBe("meta-llama/Meta-Llama-3.1-8B-Instruct"); + expect(livepeerModels[ModelClass.IMAGE]).toBe("ByteDance/SDXL-Lightning"); + }); + + test("should have correct settings configuration", () => { + const settings = models[ModelProviderName.LIVEPEER].settings; + expect(settings.maxInputTokens).toBe(128000); + expect(settings.maxOutputTokens).toBe(8192); + expect(settings.temperature).toBe(0); + }); + }); }); describe("Model Retrieval Functions", () => { @@ -224,3 +246,16 @@ describe("Environment Variable Integration", () => { ); }); }); + +describe("Generation with Livepeer", () => { + test("should have correct image generation settings", () => { + const livepeerConfig = models[ModelProviderName.LIVEPEER]; + expect(livepeerConfig.model[ModelClass.IMAGE]).toBe("ByteDance/SDXL-Lightning"); + expect(livepeerConfig.settings.temperature).toBe(0); + }); + + test("should use default image model", () => { + delete process.env.IMAGE_LIVEPEER_MODEL; + expect(models[ModelProviderName.LIVEPEER].model[ModelClass.IMAGE]).toBe("ByteDance/SDXL-Lightning"); + }); +}); diff --git a/packages/core/src/generation.ts b/packages/core/src/generation.ts index 45519508aa7..4c3d51fae70 100644 --- a/packages/core/src/generation.ts +++ b/packages/core/src/generation.ts @@ -266,7 +266,6 @@ async function fetchEternalAISystemPrompt( } else { throw new Error("invalid on-chain system prompt"); } - return undefined; } } else { return content; @@ -579,7 +578,7 @@ export async function generateText({ const url = typeof input === 'string' ? input : input.toString(); const chain_id = runtime.getSetting("ETERNALAI_CHAIN_ID") || "45762"; - + const options: RequestInit = { ...init }; if (options?.body) { const body = JSON.parse(options.body as string); @@ -588,7 +587,7 @@ export async function generateText({ } const fetching = await runtime.fetch(url, options); - + if (parseBooleanFromText( runtime.getSetting("ETERNALAI_LOG") )) { @@ -1033,6 +1032,36 @@ export async function generateText({ break; } + case ModelProviderName.ATOMA: { + elizaLogger.debug("Initializing Atoma model."); + const atoma = createOpenAI({ + apiKey, + baseURL: endpoint, + fetch: runtime.fetch, + }); + + const { text: atomaResponse } = await aiGenerateText({ + model: atoma.languageModel(model), + prompt: context, + system: + runtime.character.system ?? + settings.SYSTEM_PROMPT ?? + undefined, + tools: tools, + onStepFinish: onStepFinish, + maxSteps: maxSteps, + temperature: temperature, + maxTokens: max_response_length, + frequencyPenalty: frequency_penalty, + presencePenalty: presence_penalty, + experimental_telemetry: experimental_telemetry, + }); + + response = atomaResponse; + elizaLogger.debug("Received response from Atoma model."); + break; + } + case ModelProviderName.GALADRIEL: { elizaLogger.debug("Initializing Galadriel model."); const headers = {}; @@ -1159,6 +1188,55 @@ export async function generateText({ break; } + case ModelProviderName.LIVEPEER: { + elizaLogger.debug("Initializing Livepeer model."); + + if (!endpoint) { + throw new Error("Livepeer Gateway URL is not defined"); + } + + const requestBody = { + model: model, + messages: [ + { + role: "system", + content: runtime.character.system ?? settings.SYSTEM_PROMPT ?? "You are a helpful assistant" + }, + { + role: "user", + content: context + } + ], + max_tokens: max_response_length, + stream: false + }; + + const fetchResponse = await runtime.fetch(endpoint+'/llm', { + method: "POST", + headers: { + "accept": "text/event-stream", + "Content-Type": "application/json", + "Authorization": "Bearer eliza-app-llm" + }, + body: JSON.stringify(requestBody) + }); + + if (!fetchResponse.ok) { + const errorText = await fetchResponse.text(); + throw new Error(`Livepeer request failed (${fetchResponse.status}): ${errorText}`); + } + + const json = await fetchResponse.json(); + + if (!json?.choices?.[0]?.message?.content) { + throw new Error("Invalid response format from Livepeer"); + } + + response = json.choices[0].message.content.replace(/<\|start_header_id\|>assistant<\|end_header_id\|>\n\n/, ''); + elizaLogger.debug("Successfully received response from Livepeer model"); + break; + } + default: { const errorMessage = `Unsupported provider: ${provider}`; elizaLogger.error(errorMessage); @@ -1692,7 +1770,6 @@ export const generateImage = async ( } }, }); - // Convert the returned image URLs to base64 to match existing functionality const base64Promises = result.data.images.map(async (image) => { const response = await fetch(image.url); @@ -1793,15 +1870,18 @@ export const generateImage = async ( if (!baseUrl.protocol.startsWith("http")) { throw new Error("Invalid Livepeer Gateway URL protocol"); } + const response = await fetch( `${baseUrl.toString()}text-to-image`, { method: "POST", headers: { "Content-Type": "application/json", + Authorization: "Bearer eliza-app-img", }, body: JSON.stringify({ - model_id: model, + model_id: + data.modelId || "ByteDance/SDXL-Lightning", prompt: data.prompt, width: data.width || 1024, height: data.height || 1024, @@ -2079,6 +2159,8 @@ export async function handleProvider( return await handleOllama(options); case ModelProviderName.DEEPSEEK: return await handleDeepSeek(options); + case ModelProviderName.LIVEPEER: + return await handleLivepeer(options); default: { const errorMessage = `Unsupported provider: ${provider}`; elizaLogger.error(errorMessage); @@ -2366,6 +2448,36 @@ async function handleDeepSeek({ }); } +async function handleLivepeer({ + model, + apiKey, + schema, + schemaName, + schemaDescription, + mode, + modelOptions, +}: ProviderOptions): Promise> { + console.log("Livepeer provider api key:", apiKey); + if (!apiKey) { + throw new Error("Livepeer provider requires LIVEPEER_GATEWAY_URL to be configured"); + } + + const livepeerClient = createOpenAI({ + apiKey, + baseURL: apiKey // Use the apiKey as the baseURL since it contains the gateway URL + }); + + return await aiGenerateObject({ + model: livepeerClient.languageModel(model), + schema, + schemaName, + schemaDescription, + mode, + ...modelOptions, + }); +} + + // Add type definition for Together AI response interface TogetherAIImageResponse { data: Array<{ @@ -2418,4 +2530,4 @@ export async function generateTweetActions({ await new Promise((resolve) => setTimeout(resolve, retryDelay)); retryDelay *= 2; } -} +} \ No newline at end of file diff --git a/packages/core/src/models.ts b/packages/core/src/models.ts index 903f865724f..af6faf44fa2 100644 --- a/packages/core/src/models.ts +++ b/packages/core/src/models.ts @@ -932,11 +932,38 @@ export const models: Models = { }, }, [ModelProviderName.LIVEPEER]: { - // livepeer endpoint is handled from the sdk + endpoint: settings.LIVEPEER_GATEWAY_URL, model: { + [ModelClass.SMALL]: { + name: + settings.SMALL_LIVEPEER_MODEL || + "meta-llama/Meta-Llama-3.1-8B-Instruct", + stop: [], + maxInputTokens: 8000, + maxOutputTokens: 8192, + temperature: 0, + }, + [ModelClass.MEDIUM]: { + name: + settings.MEDIUM_LIVEPEER_MODEL || + "meta-llama/Meta-Llama-3.1-8B-Instruct", + stop: [], + maxInputTokens: 8000, + maxOutputTokens: 8192, + temperature: 0, + }, + [ModelClass.LARGE]: { + name: + settings.LARGE_LIVEPEER_MODEL || + "meta-llama/Meta-Llama-3.1-8B-Instruct", + stop: [], + maxInputTokens: 8000, + maxOutputTokens: 8192, + temperature: 0, + }, [ModelClass.IMAGE]: { name: - settings.LIVEPEER_IMAGE_MODEL || "ByteDance/SDXL-Lightning", + settings.IMAGE_LIVEPEER_MODEL || "ByteDance/SDXL-Lightning", }, }, }, @@ -948,21 +975,21 @@ export const models: Models = { stop: [], maxInputTokens: 128000, maxOutputTokens: 8192, - temperature: 0.6, + temperature: 0, }, [ModelClass.MEDIUM]: { name: settings.MEDIUM_INFERA_MODEL || "mistral-nemo:latest", stop: [], maxInputTokens: 128000, maxOutputTokens: 8192, - temperature: 0.6, + temperature: 0, }, [ModelClass.LARGE]: { name: settings.LARGE_INFERA_MODEL || "mistral-small:latest", stop: [], maxInputTokens: 128000, maxOutputTokens: 8192, - temperature: 0.6, + temperature: 0, }, }, }, @@ -998,6 +1025,38 @@ export const models: Models = { }, }, }, + [ModelProviderName.ATOMA]: { + endpoint: settings.ATOMA_API_URL || "https://api.atoma.network/v1", + model: { + [ModelClass.SMALL]: { + name: + settings.SMALL_ATOMA_MODEL || + "meta-llama/Llama-3.3-70B-Instruct", + stop: [], + maxInputTokens: 128000, + maxOutputTokens: 8192, + temperature: 0.7, + }, + [ModelClass.MEDIUM]: { + name: + settings.MEDIUM_ATOMA_MODEL || + "meta-llama/Llama-3.3-70B-Instruct", + stop: [], + maxInputTokens: 128000, + maxOutputTokens: 8192, + temperature: 0.7, + }, + [ModelClass.LARGE]: { + name: + settings.LARGE_ATOMA_MODEL || + "meta-llama/Llama-3.3-70B-Instruct", + stop: [], + maxInputTokens: 128000, + maxOutputTokens: 8192, + temperature: 0.7, + }, + }, + }, }; export function getModelSettings( diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 26338791cbf..e34da93d06b 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -229,6 +229,7 @@ export type Models = { [ModelProviderName.LIVEPEER]: Model; [ModelProviderName.DEEPSEEK]: Model; [ModelProviderName.INFERA]: Model; + [ModelProviderName.ATOMA]: Model; }; /** @@ -264,6 +265,7 @@ export enum ModelProviderName { LETZAI = "letzai", DEEPSEEK = "deepseek", INFERA = "infera", + ATOMA = "atoma", } /** diff --git a/packages/plugin-agentkit/README.md b/packages/plugin-agentkit/README.md new file mode 100644 index 00000000000..dfd2499a9dc --- /dev/null +++ b/packages/plugin-agentkit/README.md @@ -0,0 +1,123 @@ +# @elizaos/plugin-agentkit + +AgentKit plugin for Eliza that enables interaction with CDP AgentKit tools for NFT and token management. + +## Setup + +1. Install dependencies: + +```bash +pnpm install +``` + +2. Configure environment variables: + +```env +CDP_API_KEY_NAME=your_key_name +CDP_API_KEY_PRIVATE_KEY=your_private_key +``` + +3. Add the plugin to your character configuration: + +```json +{ + "plugins": ["@ai16z/plugin-agentkit"], + "settings": { + "secrets": { + "CDP_API_KEY_NAME": "your_key_name", + "CDP_API_KEY_PRIVATE_KEY": "your_private_key", + "networkId": "base-sepolia" + } + } +} +``` + +## Available Tools + +The plugin provides access to the following CDP AgentKit tools: + +- `GET_WALLET_DETAILS`: Get wallet information +- `DEPLOY_NFT`: Deploy a new NFT collection +- `DEPLOY_TOKEN`: Deploy a new token +- `GET_BALANCE`: Check token or NFT balance +- `MINT_NFT`: Mint NFTs from a collection +- `REGISTER_BASENAME`: Register a basename for NFTs +- `REQUEST_FAUCET_FUNDS`: Request testnet funds +- `TRADE`: Execute trades +- `TRANSFER`: Transfer tokens or NFTs +- `WOW_BUY_TOKEN`: Buy WOW tokens +- `WOW_SELL_TOKEN`: Sell WOW tokens +- `WOW_CREATE_TOKEN`: Create new WOW tokens + +## Usage Examples + +1. Get wallet details: + +``` +Can you show me my wallet details? +``` + +2. Deploy an NFT collection: + +``` +Deploy a new NFT collection called "Music NFTs" with symbol "MUSIC" +``` + +3. Create a token: + +``` +Create a new WOW token called "Artist Token" with symbol "ART" +``` + +4. Check balance: + +``` +What's my current balance? +``` + +## Development + +1. Build the plugin: + +```bash +pnpm build +``` + +2. Run in development mode: + +```bash +pnpm dev +``` + +## Dependencies + +- @elizaos/core +- @coinbase/cdp-agentkit-core +- @coinbase/cdp-langchain +- @langchain/core + +## Network Support + +The plugin currently supports the following networks: + +- Base Sepolia (default) +- Base Mainnet + +Configure the network using the `networkId` setting in your character configuration. + +## Troubleshooting + +1. If tools are not being triggered: + + - Verify CDP API key configuration + - Check network settings + - Ensure character configuration includes the plugin + +2. Common errors: + - "Cannot find package": Make sure dependencies are installed + - "API key not found": Check environment variables + - "Network error": Verify network configuration + +## License + +MIT diff --git a/packages/plugin-agentkit/package.json b/packages/plugin-agentkit/package.json new file mode 100644 index 00000000000..212617b58a1 --- /dev/null +++ b/packages/plugin-agentkit/package.json @@ -0,0 +1,18 @@ +{ + "name": "@elizaos/plugin-agentkit", + "version": "0.0.1", + "main": "dist/index.js", + "type": "module", + "types": "dist/index.d.ts", + "dependencies": { + "@elizaos/core": "workspace:*", + "@coinbase/cdp-agentkit-core": "^0.0.10", + "@coinbase/cdp-langchain": "^0.0.11", + "@langchain/core": "^0.3.27", + "tsup": "8.3.5" + }, + "scripts": { + "build": "tsup --format esm --dts", + "dev": "tsup --format esm --dts --watch" + } +} diff --git a/packages/plugin-agentkit/src/actions.ts b/packages/plugin-agentkit/src/actions.ts new file mode 100644 index 00000000000..5d1c721c93a --- /dev/null +++ b/packages/plugin-agentkit/src/actions.ts @@ -0,0 +1,178 @@ +import { + type Action, + generateText, + type HandlerCallback, + type IAgentRuntime, + type Memory, + ModelClass, + type State, + composeContext, + generateObject, +} from "@elizaos/core"; +import { CdpAgentkit } from "@coinbase/cdp-agentkit-core"; +import { CdpToolkit, type Tool } from "@coinbase/cdp-langchain"; + +type GetAgentKitActionsParams = { + getClient: () => Promise; + config?: { + networkId?: string; + }; +}; + +/** + * Get all AgentKit actions + */ +export async function getAgentKitActions({ + getClient, +}: GetAgentKitActionsParams): Promise { + const agentkit = await getClient(); + const cdpToolkit = new CdpToolkit(agentkit); + const tools = cdpToolkit.getTools(); + const actions = tools.map((tool: Tool) => ({ + name: tool.name.toUpperCase(), + description: tool.description, + similes: [], + validate: async () => true, + handler: async ( + runtime: IAgentRuntime, + message: Memory, + state: State | undefined, + options?: Record, + callback?: HandlerCallback + ): Promise => { + try { + const client = await getClient(); + let currentState = + state ?? (await runtime.composeState(message)); + currentState = + await runtime.updateRecentMessageState(currentState); + + const parameterContext = composeParameterContext( + tool, + currentState + ); + const parameters = await generateParameters( + runtime, + parameterContext, + tool + ); + + const result = await executeToolAction( + tool, + parameters, + client + ); + + const responseContext = composeResponseContext( + tool, + result, + currentState + ); + const response = await generateResponse( + runtime, + responseContext + ); + + callback?.({ text: response, content: result }); + return true; + } catch (error) { + const errorMessage = + error instanceof Error ? error.message : String(error); + callback?.({ + text: `Error executing action ${tool.name}: ${errorMessage}`, + content: { error: errorMessage }, + }); + return false; + } + }, + examples: [], + })); + return actions; +} + +async function executeToolAction( + tool: Tool, + parameters: any, + client: CdpAgentkit +): Promise { + const toolkit = new CdpToolkit(client); + const tools = toolkit.getTools(); + const selectedTool = tools.find((t) => t.name === tool.name); + + if (!selectedTool) { + throw new Error(`Tool ${tool.name} not found`); + } + + return await selectedTool.call(parameters); +} + +function composeParameterContext(tool: any, state: State): string { + const contextTemplate = `{{recentMessages}} + +Given the recent messages, extract the following information for the action "${tool.name}": +${tool.description} +`; + return composeContext({ state, template: contextTemplate }); +} + +async function generateParameters( + runtime: IAgentRuntime, + context: string, + tool: Tool +): Promise { + const { object } = await generateObject({ + runtime, + context, + modelClass: ModelClass.LARGE, + schema: tool.schema, + }); + + return object; +} + +function composeResponseContext( + tool: Tool, + result: unknown, + state: State +): string { + const responseTemplate = ` +# Action Examples +{{actionExamples}} + +# Knowledge +{{knowledge}} + +# Task: Generate dialog and actions for the character {{agentName}}. +About {{agentName}}: +{{bio}} +{{lore}} + +{{providers}} + +{{attachments}} + +# Capabilities +Note that {{agentName}} is capable of reading/seeing/hearing various forms of media, including images, videos, audio, plaintext and PDFs. Recent attachments have been included above under the "Attachments" section. + +The action "${tool.name}" was executed successfully. +Here is the result: +${JSON.stringify(result)} + +{{actions}} + +Respond to the message knowing that the action was successful and these were the previous messages: +{{recentMessages}} +`; + return composeContext({ state, template: responseTemplate }); +} + +async function generateResponse( + runtime: IAgentRuntime, + context: string +): Promise { + return generateText({ + runtime, + context, + modelClass: ModelClass.LARGE, + }); +} diff --git a/packages/plugin-agentkit/src/index.ts b/packages/plugin-agentkit/src/index.ts new file mode 100644 index 00000000000..3901617b32b --- /dev/null +++ b/packages/plugin-agentkit/src/index.ts @@ -0,0 +1,16 @@ +import type { Plugin } from "@elizaos/core"; +import { walletProvider, getClient } from "./provider"; +import { getAgentKitActions } from "./actions"; + +export const agentKitPlugin: Plugin = { + name: "[AgentKit] Integration", + description: "AgentKit integration plugin", + providers: [walletProvider], + evaluators: [], + services: [], + actions: await getAgentKitActions({ + getClient, + }), +}; + +export default agentKitPlugin; diff --git a/packages/plugin-agentkit/src/provider.ts b/packages/plugin-agentkit/src/provider.ts new file mode 100644 index 00000000000..685469b09ed --- /dev/null +++ b/packages/plugin-agentkit/src/provider.ts @@ -0,0 +1,49 @@ +import { type Provider, type IAgentRuntime } from "@elizaos/core"; +import { CdpAgentkit } from "@coinbase/cdp-agentkit-core"; +import * as fs from "fs"; + +const WALLET_DATA_FILE = "wallet_data.txt"; + +export async function getClient( + networkId: string = "base-sepolia" +): Promise { + let walletDataStr: string | null = null; + + // Read existing wallet data if available + if (fs.existsSync(WALLET_DATA_FILE)) { + try { + walletDataStr = fs.readFileSync(WALLET_DATA_FILE, "utf8"); + } catch (error) { + console.error("Error reading wallet data:", error); + // Continue without wallet data + } + } + + // Configure CDP AgentKit + const config = { + cdpWalletData: walletDataStr || undefined, + networkId, + }; + + const agentkit = await CdpAgentkit.configureWithWallet(config); + // Save wallet data + const exportedWallet = await agentkit.exportWallet(); + fs.writeFileSync(WALLET_DATA_FILE, exportedWallet); + + return agentkit; +} + +export const walletProvider: Provider = { + async get(runtime: IAgentRuntime): Promise { + try { + const client = await getClient( + runtime.getSetting("COINBASE_AGENT_KIT_NETWORK") + ); + const address = (await (client as any).wallet.addresses)[0].id; + return `AgentKit Wallet Address: ${address}`; + } catch (error) { + console.error("Error in AgentKit provider:", error); + return null; + } + }, +}; diff --git a/packages/plugin-agentkit/tsconfig.json b/packages/plugin-agentkit/tsconfig.json new file mode 100644 index 00000000000..f642a90aee1 --- /dev/null +++ b/packages/plugin-agentkit/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../core/tsconfig.json", + "compilerOptions": { + "outDir": "dist", + "rootDir": "./src", + "declaration": true + }, + "include": ["src"] +} diff --git a/packages/plugin-agentkit/tsup.config.ts b/packages/plugin-agentkit/tsup.config.ts new file mode 100644 index 00000000000..a68ccd636ad --- /dev/null +++ b/packages/plugin-agentkit/tsup.config.ts @@ -0,0 +1,21 @@ +import { defineConfig } from "tsup"; + +export default defineConfig({ + entry: ["src/index.ts"], + outDir: "dist", + sourcemap: true, + clean: true, + format: ["esm"], // Ensure you're targeting CommonJS + external: [ + "dotenv", // Externalize dotenv to prevent bundling + "fs", // Externalize fs to use Node.js built-in module + "path", // Externalize other built-ins if necessary + "@reflink/reflink", + "@node-llama-cpp", + "https", + "http", + "agentkeepalive", + "viem", + "@lifi/sdk", + ], +}); diff --git a/packages/plugin-b2/src/actions/stake.ts b/packages/plugin-b2/src/actions/stake.ts index abc47000722..7fc543fa8ca 100644 --- a/packages/plugin-b2/src/actions/stake.ts +++ b/packages/plugin-b2/src/actions/stake.ts @@ -10,8 +10,8 @@ import { composeContext, ModelClass, } from "@elizaos/core"; -import { getTxReceipt, sendNativeAsset, sendToken, depositBTC } from "../utils"; -import { Address, Hash } from "viem"; +import { getTxReceipt, depositBTC } from "../utils"; +import { Hash } from "viem"; import { validateB2NetworkConfig } from "../environment"; import { stakeTemplate } from "../templates"; import { WalletProvider } from "../providers"; diff --git a/packages/plugin-b2/src/tests/stake.test.ts b/packages/plugin-b2/src/tests/stake.test.ts index e71eaa01caf..f2cb0429afc 100644 --- a/packages/plugin-b2/src/tests/stake.test.ts +++ b/packages/plugin-b2/src/tests/stake.test.ts @@ -1,6 +1,5 @@ import { describe, it, expect, beforeEach } from "vitest"; import { generatePrivateKey } from "viem/accounts"; -import { getEnvVariable } from "@elizaos/core"; import { StakeAction } from "../actions/stake"; import { WalletProvider } from "../providers"; diff --git a/packages/plugin-b2/src/tests/unstake.test.ts b/packages/plugin-b2/src/tests/unstake.test.ts index d1aa5e21364..332b992febb 100644 --- a/packages/plugin-b2/src/tests/unstake.test.ts +++ b/packages/plugin-b2/src/tests/unstake.test.ts @@ -1,10 +1,9 @@ import { describe, it, expect, beforeEach } from "vitest"; import { generatePrivateKey } from "viem/accounts"; -import { getEnvVariable } from "@elizaos/core"; import { UnstakeAction } from "../actions/unstake"; import { WalletProvider } from "../providers"; -import { TransferParams, UnstakeParams } from "../types"; +import { UnstakeParams } from "../types"; describe("Unstake Action", () => { let wp: WalletProvider; diff --git a/packages/plugin-b2/src/tests/wallet.test.ts b/packages/plugin-b2/src/tests/wallet.test.ts index c1429545e4f..b597b26c958 100644 --- a/packages/plugin-b2/src/tests/wallet.test.ts +++ b/packages/plugin-b2/src/tests/wallet.test.ts @@ -1,16 +1,15 @@ import { describe, it, expect, beforeEach, afterEach, vi } from "vitest"; import { initWalletProvider, WalletProvider } from "../providers"; -import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; -import { Memory, State } from "@elizaos/core"; +import { generatePrivateKey } from "viem/accounts"; describe("B2 Network Wallet Provider", () => { - let walletProvider: WalletProvider; + //let walletProvider: WalletProvider; let mockRuntime; beforeEach(() => { vi.clearAllMocks(); const pk = generatePrivateKey(); - walletProvider = new WalletProvider(pk); + //walletProvider = new WalletProvider(pk); mockRuntime = { getSetting: vi.fn(), }; diff --git a/packages/plugin-b2/src/types/index.ts b/packages/plugin-b2/src/types/index.ts index 97a6ac06590..f63ceeb87b5 100644 --- a/packages/plugin-b2/src/types/index.ts +++ b/packages/plugin-b2/src/types/index.ts @@ -1,4 +1,3 @@ -import type { Token } from "@lifi/types"; import type { Address, Hash, @@ -26,5 +25,5 @@ export interface UnstakeParams { amount: string | number; } -export interface WithdrawParams { -} +//export interface WithdrawParams { +//} diff --git a/packages/plugin-b2/src/utils/index.ts b/packages/plugin-b2/src/utils/index.ts index e4a1666c3cf..27453b2c658 100644 --- a/packages/plugin-b2/src/utils/index.ts +++ b/packages/plugin-b2/src/utils/index.ts @@ -1,10 +1,9 @@ -import { IAgentRuntime, elizaLogger } from "@elizaos/core"; +import { elizaLogger } from "@elizaos/core"; import { Hash, Address, parseUnits, encodeFunctionData, - SendTransactionParameters, } from "viem"; import { b2Network } from "./chains"; import { WalletProvider } from "../providers"; diff --git a/packages/plugin-dexscreener/src/actions/index.ts b/packages/plugin-dexscreener/src/actions/index.ts index ebd48ad84ac..70232198dfc 100644 --- a/packages/plugin-dexscreener/src/actions/index.ts +++ b/packages/plugin-dexscreener/src/actions/index.ts @@ -1 +1,2 @@ -export * from "./tokenAction.ts"; \ No newline at end of file +export * from "./tokenAction"; +export * from "./trendsAction"; diff --git a/packages/plugin-dexscreener/src/actions/tokenAction.ts b/packages/plugin-dexscreener/src/actions/tokenAction.ts index 67888c46088..0c5ec25dc1f 100644 --- a/packages/plugin-dexscreener/src/actions/tokenAction.ts +++ b/packages/plugin-dexscreener/src/actions/tokenAction.ts @@ -31,7 +31,7 @@ export class TokenPriceAction implements Action { const hasPriceKeyword = /\b(price|value|worth|cost)\b/i.test(content); const hasToken = ( /0x[a-fA-F0-9]{40}/.test(content) || - /[\$#]?[a-zA-Z0-9]+/i.test(content) + /[$#]?[a-zA-Z0-9]+/i.test(content) ); return hasPriceKeyword && hasToken; diff --git a/packages/plugin-dexscreener/src/actions/trendsAction.ts b/packages/plugin-dexscreener/src/actions/trendsAction.ts new file mode 100644 index 00000000000..1e2cda301f9 --- /dev/null +++ b/packages/plugin-dexscreener/src/actions/trendsAction.ts @@ -0,0 +1,383 @@ +import { + Action, + IAgentRuntime, + Memory, + State, + HandlerCallback, + elizaLogger, + getEmbeddingZeroVector, +} from "@elizaos/core"; + +interface TokenProfile { + url: string; + description?: string; + chainId: string; + tokenAddress: string; +} + +const createTokenMemory = async ( + runtime: IAgentRuntime, + _message: Memory, + formattedOutput: string +) => { + const memory: Memory = { + userId: _message.userId, + agentId: _message.agentId, + roomId: _message.roomId, + content: { text: formattedOutput }, + createdAt: Date.now(), + embedding: getEmbeddingZeroVector(), + }; + await runtime.messageManager.createMemory(memory); +}; + +export const latestTokensTemplate = `Determine if this is a request for latest tokens. If it is one of the specified situations, perform the corresponding action: + +Situation 1: "Get latest tokens" +- Message contains: words like "latest", "new", "recent" AND "tokens" +- Example: "Show me the latest tokens" or "What are the new tokens?" +- Action: Get the most recent tokens listed + +Previous conversation for context: +{{conversation}} + +You are replying to: {{message}} +`; + +export class LatestTokensAction implements Action { + name = "GET_LATEST_TOKENS"; + similes = ["FETCH_NEW_TOKENS", "CHECK_RECENT_TOKENS", "LIST_NEW_TOKENS"]; + description = "Get the latest tokens from DexScreener API"; + suppressInitialMessage = true; + template = latestTokensTemplate; + + async validate(runtime: IAgentRuntime, message: Memory): Promise { + const content = + typeof message.content === "string" + ? message.content + : message.content?.text; + + if (!content) return false; + + const hasLatestKeyword = /\b(latest|new|recent)\b/i.test(content); + const hasTokensKeyword = /\b(tokens?|coins?|crypto)\b/i.test(content); + + return hasLatestKeyword && hasTokensKeyword; + } + + async handler( + runtime: IAgentRuntime, + message: Memory, + state?: State, + _options: { [key: string]: unknown } = {}, + callback?: HandlerCallback + ): Promise { + elizaLogger.log("Starting GET_LATEST_TOKENS handler..."); + + try { + const response = await fetch( + "https://api.dexscreener.com/token-profiles/latest/v1", + { + method: "GET", + headers: { + accept: "application/json", + }, + } + ); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const tokens: TokenProfile[] = await response.json(); + + const formattedOutput = tokens + .map((token) => { + const description = + token.description || "No description available"; + return `Chain: ${token.chainId}\nToken Address: ${token.tokenAddress}\nURL: ${token.url}\nDescription: ${description}\n\n`; + }) + .join(""); + + await createTokenMemory(runtime, message, formattedOutput); + + if (callback) { + await callback({ + text: formattedOutput, + action: this.name, + }); + } + + return true; + } catch (error) { + elizaLogger.error("Error fetching latest tokens:", error); + + if (callback) { + await callback({ + text: `Failed to fetch latest tokens: ${error.message}`, + action: this.name, + }); + } + + return false; + } + } + + examples = [ + [ + { + user: "{{user}}", + content: { + text: "show me the latest tokens", + }, + }, + { + user: "{{system}}", + content: { + text: "Here are the latest tokens added to DexScreener...", + action: "GET_LATEST_TOKENS", + }, + }, + ], + ]; +} + +export const latestBoostedTemplate = `Determine if this is a request for latest boosted tokens. If it is one of the specified situations, perform the corresponding action: + +Situation 1: "Get latest boosted tokens" +- Message contains: words like "latest", "new", "recent" AND "boosted tokens" +- Example: "Show me the latest boosted tokens" or "What are the new promoted tokens?" +- Action: Get the most recent boosted tokens + +Previous conversation for context: +{{conversation}} + +You are replying to: {{message}} +`; + +export class LatestBoostedTokensAction implements Action { + name = "GET_LATEST_BOOSTED_TOKENS"; + similes = [ + "FETCH_NEW_BOOSTED_TOKENS", + "CHECK_RECENT_BOOSTED_TOKENS", + "LIST_NEW_BOOSTED_TOKENS", + ]; + description = "Get the latest boosted tokens from DexScreener API"; + suppressInitialMessage = true; + template = latestBoostedTemplate; + + async validate(runtime: IAgentRuntime, message: Memory): Promise { + const content = + typeof message.content === "string" + ? message.content + : message.content?.text; + + if (!content) return false; + + const hasLatestKeyword = /\b(latest|new|recent)\b/i.test(content); + const hasBoostedKeyword = /\b(boosted|promoted|featured)\b/i.test( + content + ); + const hasTokensKeyword = /\b(tokens?|coins?|crypto)\b/i.test(content); + + return hasLatestKeyword && (hasBoostedKeyword || hasTokensKeyword); + } + + async handler( + runtime: IAgentRuntime, + message: Memory, + state?: State, + _options: { [key: string]: unknown } = {}, + callback?: HandlerCallback + ): Promise { + elizaLogger.log("Starting GET_LATEST_BOOSTED_TOKENS handler..."); + + try { + const response = await fetch( + "https://api.dexscreener.com/token-boosts/latest/v1", + { + method: "GET", + headers: { + accept: "application/json", + }, + } + ); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const tokens: TokenProfile[] = await response.json(); + + const formattedOutput = tokens + .map((token) => { + const description = + token.description || "No description available"; + return `Chain: ${token.chainId}\nToken Address: ${token.tokenAddress}\nURL: ${token.url}\nDescription: ${description}\n\n`; + }) + .join(""); + + await createTokenMemory(runtime, message, formattedOutput); + + if (callback) { + await callback({ + text: formattedOutput, + action: this.name, + }); + } + + return true; + } catch (error) { + elizaLogger.error("Error fetching latest boosted tokens:", error); + + if (callback) { + await callback({ + text: `Failed to fetch latest boosted tokens: ${error.message}`, + action: this.name, + }); + } + + return false; + } + } + + examples = [ + [ + { + user: "{{user}}", + content: { + text: "show me the latest boosted tokens", + }, + }, + { + user: "{{system}}", + content: { + text: "Here are the latest boosted tokens on DexScreener...", + action: "GET_LATEST_BOOSTED_TOKENS", + }, + }, + ], + ]; +} + +export const topBoostedTemplate = `Determine if this is a request for top boosted tokens. If it is one of the specified situations, perform the corresponding action: + +Situation 1: "Get top boosted tokens" +- Message contains: words like "top", "best", "most" AND "boosted tokens" +- Example: "Show me the top boosted tokens" or "What are the most promoted tokens?" +- Action: Get the tokens with most active boosts + +Previous conversation for context: +{{conversation}} + +You are replying to: {{message}} +`; + +export class TopBoostedTokensAction implements Action { + name = "GET_TOP_BOOSTED_TOKENS"; + similes = [ + "FETCH_MOST_BOOSTED_TOKENS", + "CHECK_HIGHEST_BOOSTED_TOKENS", + "LIST_TOP_BOOSTED_TOKENS", + ]; + description = "Get tokens with most active boosts from DexScreener API"; + suppressInitialMessage = true; + template = topBoostedTemplate; + + async validate(runtime: IAgentRuntime, message: Memory): Promise { + const content = + typeof message.content === "string" + ? message.content + : message.content?.text; + + if (!content) return false; + + const hasTopKeyword = /\b(top|best|most)\b/i.test(content); + const hasBoostedKeyword = /\b(boosted|promoted|featured)\b/i.test( + content + ); + const hasTokensKeyword = /\b(tokens?|coins?|crypto)\b/i.test(content); + + return hasTopKeyword && (hasBoostedKeyword || hasTokensKeyword); + } + + async handler( + runtime: IAgentRuntime, + message: Memory, + state?: State, + _options: { [key: string]: unknown } = {}, + callback?: HandlerCallback + ): Promise { + elizaLogger.log("Starting GET_TOP_BOOSTED_TOKENS handler..."); + + try { + const response = await fetch( + "https://api.dexscreener.com/token-boosts/top/v1", + { + method: "GET", + headers: { + accept: "application/json", + }, + } + ); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const tokens: TokenProfile[] = await response.json(); + + const formattedOutput = tokens + .map((token) => { + const description = + token.description || "No description available"; + return `Chain: ${token.chainId}\nToken Address: ${token.tokenAddress}\nURL: ${token.url}\nDescription: ${description}\n\n`; + }) + .join(""); + + await createTokenMemory(runtime, message, formattedOutput); + + if (callback) { + await callback({ + text: formattedOutput, + action: this.name, + }); + } + + return true; + } catch (error) { + elizaLogger.error("Error fetching top boosted tokens:", error); + + if (callback) { + await callback({ + text: `Failed to fetch top boosted tokens: ${error.message}`, + action: this.name, + }); + } + + return false; + } + } + + examples = [ + [ + { + user: "{{user}}", + content: { + text: "show me the top boosted tokens", + }, + }, + { + user: "{{system}}", + content: { + text: "Here are the tokens with the most active boosts on DexScreener...", + action: "GET_TOP_BOOSTED_TOKENS", + }, + }, + ], + ]; +} + +export const latestTokensAction = new LatestTokensAction(); +export const latestBoostedTokensAction = new LatestBoostedTokensAction(); +export const topBoostedTokensAction = new TopBoostedTokensAction(); diff --git a/packages/plugin-dexscreener/src/evaluators/tokenEvaluator.ts b/packages/plugin-dexscreener/src/evaluators/tokenEvaluator.ts index fe7237a2c76..44e293d519c 100644 --- a/packages/plugin-dexscreener/src/evaluators/tokenEvaluator.ts +++ b/packages/plugin-dexscreener/src/evaluators/tokenEvaluator.ts @@ -21,14 +21,14 @@ export class TokenPriceEvaluator implements Evaluator { // 3. Token symbol after "of" or "for" (case insensitive) const hasToken = ( /0x[a-fA-F0-9]{40}/.test(content) || // Ethereum address - /[\$#][a-zA-Z]+/.test(content) || // $TOKEN or #TOKEN format + /[$#][a-zA-Z]+/.test(content) || // $TOKEN or #TOKEN format /\b(of|for)\s+[a-zA-Z0-9]+\b/i.test(content) // "price of TOKEN" format ); return hasPriceKeyword && hasToken; } - async handler(runtime: IAgentRuntime, message: Memory, state?: State): Promise { + async handler(_runtime: IAgentRuntime, _message: Memory, _state?: State): Promise { return "GET_TOKEN_PRICE"; } diff --git a/packages/plugin-dexscreener/src/index.ts b/packages/plugin-dexscreener/src/index.ts index 45b8781d8d4..b5d3508da88 100644 --- a/packages/plugin-dexscreener/src/index.ts +++ b/packages/plugin-dexscreener/src/index.ts @@ -1,7 +1,12 @@ import { Plugin } from "@elizaos/core"; -import { TokenPriceAction } from "./actions/tokenAction.ts"; -import { TokenPriceEvaluator } from "./evaluators/tokenEvaluator.ts"; -import { TokenPriceProvider } from "./providers/tokenProvider.ts"; +import { TokenPriceAction } from "./actions/tokenAction"; +import { TokenPriceEvaluator } from "./evaluators/tokenEvaluator"; +import { TokenPriceProvider } from "./providers/tokenProvider"; +import { + LatestTokensAction, + LatestBoostedTokensAction, + TopBoostedTokensAction, +} from "./actions/trendsAction"; export * as actions from "./actions"; export * as evaluators from "./evaluators"; @@ -9,10 +14,14 @@ export * as providers from "./providers"; export const dexScreenerPlugin: Plugin = { name: "dexscreener", - description: "Dex Screener Plugin with Token Price Action, Evaluators and Providers", + description: + "Dex Screener Plugin with Token Price Action, Token Trends, Evaluators and Providers", actions: [ - new TokenPriceAction() + new TokenPriceAction(), + new LatestTokensAction(), + new LatestBoostedTokensAction(), + new TopBoostedTokensAction(), ], - evaluators: [ new TokenPriceEvaluator() ], - providers: [ new TokenPriceProvider() ] + evaluators: [new TokenPriceEvaluator()], + providers: [new TokenPriceProvider()], }; diff --git a/packages/plugin-dexscreener/src/providers/tokenProvider.ts b/packages/plugin-dexscreener/src/providers/tokenProvider.ts index db8ccb260ac..49e8e495b49 100644 --- a/packages/plugin-dexscreener/src/providers/tokenProvider.ts +++ b/packages/plugin-dexscreener/src/providers/tokenProvider.ts @@ -1,5 +1,6 @@ import { Provider, IAgentRuntime, Memory, State } from "@elizaos/core"; +/* interface TokenPriceData { baseToken: { name: string; @@ -17,12 +18,13 @@ interface TokenPriceData { h24: number; }; } +*/ export class TokenPriceProvider implements Provider { async get( runtime: IAgentRuntime, message: Memory, - state?: State + _state?: State ): Promise { try { const content = @@ -35,7 +37,7 @@ export class TokenPriceProvider implements Provider { } // Extract token from content - let tokenIdentifier = this.extractToken(content); + const tokenIdentifier = this.extractToken(content); if (!tokenIdentifier) { throw new Error("Could not identify token in message"); } @@ -73,7 +75,7 @@ export class TokenPriceProvider implements Provider { // Try different patterns in order of specificity const patterns = [ /0x[a-fA-F0-9]{40}/, // ETH address - /[\$#]([a-zA-Z0-9]+)/, // $TOKEN or #TOKEN + /[$#]([a-zA-Z0-9]+)/, // $TOKEN or #TOKEN /(?:price|value|worth|cost)\s+(?:of|for)\s+([a-zA-Z0-9]+)/i, // "price of TOKEN" /\b(?:of|for)\s+([a-zA-Z0-9]+)\b/i, // "of TOKEN" ]; @@ -84,7 +86,7 @@ export class TokenPriceProvider implements Provider { // Use captured group if it exists, otherwise use full match const token = match[1] || match[0]; // Clean up the token identifier - return token.replace(/[\$#]/g, "").toLowerCase().trim(); + return token.replace(/[$#]/g, "").toLowerCase().trim(); } } @@ -101,7 +103,7 @@ export class TokenPriceProvider implements Provider { private formatPriceData(pair: any): string { const price = parseFloat(pair.priceUsd).toFixed(6); - const change24h = pair.priceChange?.h24?.toFixed(2) || "0.00"; + //const change24h = pair.priceChange?.h24?.toFixed(2) || "0.00"; const liquidity = parseFloat( pair.liquidity?.usd || "0" ).toLocaleString(); diff --git a/packages/plugin-evm/src/actions/gov-execute.ts b/packages/plugin-evm/src/actions/gov-execute.ts index 98cb054a09a..2aa52807168 100644 --- a/packages/plugin-evm/src/actions/gov-execute.ts +++ b/packages/plugin-evm/src/actions/gov-execute.ts @@ -7,12 +7,9 @@ import { ByteArray, Hex, encodeFunctionData, - getContract, keccak256, stringToHex, } from "viem"; -import { Chain } from "viem"; -import voteTokenArtifacts from "../contracts/artifacts/VoteToken.json"; export { executeProposalTemplate }; @@ -54,12 +51,12 @@ export class ExecuteAction { data: txData as Hex, chain: chainConfig, kzg: { - blobToKzgCommitment: function (blob: ByteArray): ByteArray { + blobToKzgCommitment: function (_blob: ByteArray): ByteArray { throw new Error("Function not implemented."); }, computeBlobKzgProof: function ( - blob: ByteArray, - commitment: ByteArray + _blob: ByteArray, + _commitment: ByteArray ): ByteArray { throw new Error("Function not implemented."); }, diff --git a/packages/plugin-evm/src/actions/gov-propose.ts b/packages/plugin-evm/src/actions/gov-propose.ts index 4b7895fc0f8..bc6e618990b 100644 --- a/packages/plugin-evm/src/actions/gov-propose.ts +++ b/packages/plugin-evm/src/actions/gov-propose.ts @@ -1,15 +1,12 @@ import type { IAgentRuntime, Memory, State } from "@ai16z/eliza"; import { WalletProvider } from "../providers/wallet"; -import { proposeTemplate, voteTemplate } from "../templates"; +import { proposeTemplate } from "../templates"; import type { ProposeProposalParams, Transaction } from "../types"; import governorArtifacts from "../contracts/artifacts/OZGovernor.json"; import { ByteArray, Hex, encodeFunctionData, - getContract, - keccak256, - stringToHex, } from "viem"; export { proposeTemplate }; @@ -50,12 +47,12 @@ export class ProposeAction { data: txData as Hex, chain: chainConfig, kzg: { - blobToKzgCommitment: function (blob: ByteArray): ByteArray { + blobToKzgCommitment: function (_blob: ByteArray): ByteArray { throw new Error("Function not implemented."); }, computeBlobKzgProof: function ( - blob: ByteArray, - commitment: ByteArray + _blob: ByteArray, + _commitment: ByteArray ): ByteArray { throw new Error("Function not implemented."); }, diff --git a/packages/plugin-evm/src/actions/gov-queue.ts b/packages/plugin-evm/src/actions/gov-queue.ts index a93db07676e..c54816185d6 100644 --- a/packages/plugin-evm/src/actions/gov-queue.ts +++ b/packages/plugin-evm/src/actions/gov-queue.ts @@ -7,12 +7,9 @@ import { ByteArray, Hex, encodeFunctionData, - getContract, keccak256, stringToHex, } from "viem"; -import { Chain } from "viem"; -import voteTokenArtifacts from "../contracts/artifacts/VoteToken.json"; export { queueProposalTemplate }; @@ -54,12 +51,12 @@ export class QueueAction { data: txData as Hex, chain: chainConfig, kzg: { - blobToKzgCommitment: function (blob: ByteArray): ByteArray { + blobToKzgCommitment: function (_blob: ByteArray): ByteArray { throw new Error("Function not implemented."); }, computeBlobKzgProof: function ( - blob: ByteArray, - commitment: ByteArray + _blob: ByteArray, + _commitment: ByteArray ): ByteArray { throw new Error("Function not implemented."); }, diff --git a/packages/plugin-evm/src/actions/gov-vote.ts b/packages/plugin-evm/src/actions/gov-vote.ts index 77ad3267baa..becd1319cdf 100644 --- a/packages/plugin-evm/src/actions/gov-vote.ts +++ b/packages/plugin-evm/src/actions/gov-vote.ts @@ -3,9 +3,7 @@ import { WalletProvider } from "../providers/wallet"; import { voteTemplate } from "../templates"; import type { Transaction, VoteParams } from "../types"; import governorArtifacts from "../contracts/artifacts/OZGovernor.json"; -import { ByteArray, Hex, encodeFunctionData, getContract } from "viem"; -import { Chain } from "viem"; -import voteTokenArtifacts from "../contracts/artifacts/VoteToken.json"; +import { ByteArray, Hex, encodeFunctionData } from "viem"; export { voteTemplate }; @@ -43,12 +41,12 @@ export class VoteAction { data: txData as Hex, chain: chainConfig, kzg: { - blobToKzgCommitment: function (blob: ByteArray): ByteArray { + blobToKzgCommitment: function (_blob: ByteArray): ByteArray { throw new Error("Function not implemented."); }, computeBlobKzgProof: function ( - blob: ByteArray, - commitment: ByteArray + _blob: ByteArray, + _commitment: ByteArray ): ByteArray { throw new Error("Function not implemented."); }, diff --git a/packages/plugin-evm/src/tests/gov.test.ts b/packages/plugin-evm/src/tests/gov.test.ts index cff0412e2ac..89821e9688c 100644 --- a/packages/plugin-evm/src/tests/gov.test.ts +++ b/packages/plugin-evm/src/tests/gov.test.ts @@ -1,7 +1,6 @@ import { describe, it, expect, beforeEach } from "vitest"; -import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; +import { generatePrivateKey } from "viem/accounts"; import { - Account, Address, Chain, encodeFunctionData, @@ -21,8 +20,6 @@ import { WalletProvider } from "../providers/wallet"; import governorArtifacts from "../contracts/artifacts/OZGovernor.json"; import voteTokenArtifacts from "../contracts/artifacts/VoteToken.json"; import timelockArtifacts from "../contracts/artifacts/TimelockController.json"; -import { OZGovernor } from "../contracts/types/OZGovernor"; -import { VoteToken } from "../contracts/types/VoteToken"; import { QueueAction } from "../actions/gov-queue"; import { Proposal } from "../types"; import { ExecuteAction } from "../actions/gov-execute"; @@ -55,7 +52,7 @@ export const buildProposal = ( }; describe("Vote Action", () => { - let alice: Address = "0xa1Ce000000000000000000000000000000000000"; + const alice: Address = "0xa1Ce000000000000000000000000000000000000"; let wp: WalletProvider; let wc: WalletClient; let tc: TestClient; @@ -144,7 +141,7 @@ describe("Vote Action", () => { it("should initialize with wallet provider", () => { const va = new VoteAction(wp); - expect(va).to.toBeDefined(); + expect(va).toBeDefined(); }); }); describe("Vote", () => { @@ -310,7 +307,7 @@ describe("Vote Action", () => { const queued = await timelock.read.isOperationPending([ timelockProposalId, ]); - expect(queued).to.be.true; + expect(queued).toBe(true); }); it("Executes a proposal", async () => { @@ -341,10 +338,6 @@ describe("Vote Action", () => { description: proposal.description, }); - const descriptionHash = keccak256( - stringToHex(proposal.description) - ); - const aliceBalance = await voteToken.read.balanceOf([alice]); const timelockBalance = await voteToken.read.balanceOf([ timelockAddress, @@ -373,7 +366,7 @@ describe("Vote Action", () => { }); const prepareChains = () => { - let customChains: Record = {}; + const customChains: Record = {}; const chainNames = ["hardhat"]; chainNames.forEach( (chain) => @@ -396,7 +389,7 @@ const getProposalId = (logs: any) => { topics: log.topics, }); return event.eventName === "ProposalCreated"; - } catch (error) { + } catch { return false; } }); diff --git a/packages/plugin-gitcoin-passport/src/actions/getScore.ts b/packages/plugin-gitcoin-passport/src/actions/getScore.ts index df9bfff8abf..5a86009258d 100644 --- a/packages/plugin-gitcoin-passport/src/actions/getScore.ts +++ b/packages/plugin-gitcoin-passport/src/actions/getScore.ts @@ -6,7 +6,6 @@ import { HandlerCallback, State, getEmbeddingZeroVector, - Content, composeContext, generateMessageResponse, ModelClass, diff --git a/packages/plugin-image-generation/src/environment.ts b/packages/plugin-image-generation/src/environment.ts index 5c6827dbfad..35ce50f5249 100644 --- a/packages/plugin-image-generation/src/environment.ts +++ b/packages/plugin-image-generation/src/environment.ts @@ -10,6 +10,7 @@ export const imageGenEnvSchema = z FAL_API_KEY: z.string().optional(), OPENAI_API_KEY: z.string().optional(), VENICE_API_KEY: z.string().optional(), + LIVEPEER_GATEWAY_URL: z.string().optional(), }) .refine( (data) => { @@ -20,12 +21,13 @@ export const imageGenEnvSchema = z data.HEURIST_API_KEY || data.FAL_API_KEY || data.OPENAI_API_KEY || - data.VENICE_API_KEY + data.VENICE_API_KEY || + data.LIVEPEER_GATEWAY_URL ); }, { message: - "At least one of ANTHROPIC_API_KEY, NINETEEN_AI_API_KEY, TOGETHER_API_KEY, HEURIST_API_KEY, FAL_API_KEY, OPENAI_API_KEY or VENICE_API_KEY is required", + "At least one of ANTHROPIC_API_KEY, NINETEEN_AI_API_KEY, TOGETHER_API_KEY, HEURIST_API_KEY, FAL_API_KEY, OPENAI_API_KEY, VENICE_API_KEY or LIVEPEER_GATEWAY_URL is required", } ); @@ -57,6 +59,9 @@ export async function validateImageGenConfig( VENICE_API_KEY: runtime.getSetting("VENICE_API_KEY") || process.env.VENICE_API_KEY, + LIVEPEER_GATEWAY_URL: + runtime.getSetting("LIVEPEER_GATEWAY_URL") || + process.env.LIVEPEER_GATEWAY_URL, }; return imageGenEnvSchema.parse(config); diff --git a/packages/plugin-injective/Readme.md b/packages/plugin-injective/Readme.md new file mode 100644 index 00000000000..d08ae4abf48 --- /dev/null +++ b/packages/plugin-injective/Readme.md @@ -0,0 +1,176 @@ +# @elizaos/plugin-injective + +A comprehensive plugin for interacting with the Injective chain through ElizaOS. + +## Project Structure + +``` +src/ +├── auction.ts # Auction module actions +├── auth.ts # Auth module actions +├── bank.ts # Bank module actions +├── distribution.ts # Distribution module actions +├── exchange.ts # Exchange module actions +├── explorer.ts # Explorer module actions +├── gov.ts # Governance module actions +├── ibc.ts # IBC module actions +├── insurance.ts # Insurance module actions +├── mint.ts # Mint module actions +├── mito.ts # Mito module actions +├── peggy.ts # Peggy module actions +├── permissions.ts # Permissions module actions +├── staking.ts # Staking module actions +├── token-factory.ts # Token Factory module actions +├── wasm.ts # WASM module actions +├── base.ts # Base action creation logic +└── index.ts # Main export file +``` + +## Module Organization + +Each module file follows a consistent organization pattern: + +### 1. File Structure +```typescript +// src/[module].ts + +import { createGenericAction } from './base'; +import * as ModuleTemplates from '@injective/template/[module]'; +import * as ModuleExamples from '@injective/examples/[module]'; + +// Export individual actions +export const Action1 = createGenericAction({...}); +export const Action2 = createGenericAction({...}); + +// Export all actions as a group +export const ModuleActions = [ + Action1, + Action2, + // ...other actions +]; +``` + +### 2. Main Export File +```typescript +// src/index.ts + +export * from './auction'; +export * from './auth'; +// ...other module exports + +export const InjectiveActions = [ + ...ExchangeActions, + ...AuctionActions, + // ...other module actions +]; +``` + +## Module Descriptions + +### auction.ts +Handles auction-related functionality including module parameters, auction rounds, and bidding. + +### auth.ts +Manages authentication, account details, and authorization grants. + +### bank.ts +Handles account balances, token transfers, and supply queries. + +### distribution.ts +Manages reward distribution and withdrawals. + +### exchange.ts +Core exchange functionality including spot/derivative markets, orders, and positions. + +### explorer.ts +Blockchain explorer functionality including transaction and block queries. + +### gov.ts +Handles protocol governance including proposals and voting. + +### ibc.ts +Inter-Blockchain Communication functionality. + +### insurance.ts +Manages insurance funds and redemptions. + +### mint.ts +Controls token minting and inflation parameters. + +### mito.ts +Handles Mito-specific functionality. + +### peggy.ts +Manages Ethereum bridge operations. + +### permissions.ts +Controls role-based access and permissions. + +### staking.ts +Manages validator operations and delegations. + +### token-factory.ts +Handles token creation and management. + +### wasm.ts +Smart contract functionality including deployment and execution. + +## Development + +### Adding New Actions + +1. Add action to appropriate module file: +```typescript +export const NewAction = createGenericAction({ + name: 'ACTION_NAME', + description: 'Action description', + template: Templates.template, + examples: Examples.example, + functionName: 'functionName', + validateContent: () => true +}); + +export const ModuleActions = [ + ...existingActions, + NewAction +]; +``` + +### Adding New Modules + +1. Create new module file: +```typescript +// src/new-module.ts +export const NewModuleActions = [...]; +``` + +2. Add to main exports: +```typescript +// src/index.ts +export * from './new-module'; +``` + +## Installation + +```bash +npm install @elizaos/plugin-injective +``` + +## Usage + +```typescript +import { InjectiveActions } from '@elizaos/plugin-injective'; +``` + +## Contributing +Feel free to contribute to more similes, examples and refined templates - for a more robust action contorl. + +1. Fork the repository +2. Create your feature branch +3. Commit your changes +4. Push to the branch +5. Create a Pull Request + +## License + +ISC \ No newline at end of file diff --git a/packages/plugin-injective/eslint.config.mjs b/packages/plugin-injective/eslint.config.mjs new file mode 100644 index 00000000000..92fe5bbebef --- /dev/null +++ b/packages/plugin-injective/eslint.config.mjs @@ -0,0 +1,3 @@ +import eslintGlobalConfig from "../../eslint.config.mjs"; + +export default [...eslintGlobalConfig]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/.eslintignore b/packages/plugin-injective/injective-sdk-client-ts/.eslintignore new file mode 100644 index 00000000000..d93463d4d64 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/.eslintignore @@ -0,0 +1,3 @@ +node_modules/ +dist/ +build/ diff --git a/packages/plugin-injective/injective-sdk-client-ts/.eslintrc.js b/packages/plugin-injective/injective-sdk-client-ts/.eslintrc.js new file mode 100644 index 00000000000..2688cb34e7a --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/.eslintrc.js @@ -0,0 +1,23 @@ +module.exports = { + "root": true, + "parser": "@typescript-eslint/parser", + "plugins": [ + "@typescript-eslint" + ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], + "rules": { + // TypeScript-specific rules + "@typescript-eslint/no-explicit-any": "warn", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }], + + // General ESLint rules + "no-console": "warn", + "eqeqeq": "error", + "no-duplicate-imports": "error", + "prefer-const": "warn" + } +} \ No newline at end of file diff --git a/packages/plugin-injective/injective-sdk-client-ts/Readme.md b/packages/plugin-injective/injective-sdk-client-ts/Readme.md new file mode 100644 index 00000000000..e2a8c26f110 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/Readme.md @@ -0,0 +1,190 @@ +# Injective SDK Client TypeScript + +A TypeScript client implementation for interacting with the Injective Protocol blockchain, providing comprehensive access to both chain and indexer gRPC endpoints. + +## Project Structure + +``` +plugin-injective/ +├── .vscode/ +├── injective-sdk-client-ts/ +│ ├── src/ +│ │ ├── exceptions/ +│ │ ├── grpc/ +│ │ │ ├── grpc-base.ts # Base gRPC client implementation +│ │ │ └── modules/ # Module-specific implementations +│ │ │ ├── auction.ts +│ │ │ ├── auth.ts +│ │ │ ├── authz.ts +│ │ │ ├── bank.ts +│ │ │ ├── distribution.ts +│ │ │ ├── exchange.ts +│ │ │ ├── explorer.ts +│ │ │ ├── gov.ts +│ │ │ ├── ibc.ts +│ │ │ ├── insurance-fund.ts +│ │ │ ├── mint.ts +│ │ │ ├── mito.ts +│ │ │ ├── oracle.ts +│ │ │ ├── peggy.ts +│ │ │ ├── permissions.ts +│ │ │ ├── staking.ts +│ │ │ ├── token-factory.ts +│ │ │ ├── wasm.ts +│ │ │ └── wasmx.ts +│ │ ├── template/ +│ │ └── types/ +│ ├── .eslintignore +│ ├── .eslintrc.js +│ ├── eslint.config.mjs +│ ├── package-lock.json +│ ├── package.json +│ └── tsconfig.json +``` + +## Features + +- **Comprehensive Module Support**: Includes implementations for all major Injective Protocol modules +- **Dual API Support**: Handles both Chain gRPC and Indexer gRPC endpoints +- **Type Safety**: Full TypeScript implementation with comprehensive type definitions +- **Error Handling**: Custom exception handling for gRPC-specific errors +- **Network Flexibility**: Supports multiple network types (Mainnet, Testnet, etc.) + +## Core Components + +### InjectiveGrpcBase + +The base class that provides fundamental gRPC functionality: +- Network configuration management +- Connection handling +- Request/query execution +- Message broadcasting capabilities + +### Supported Modules + +1. **Chain gRPC Modules** + - Auction + - Auth/AuthZ + - Bank + - Distribution + - Exchange + - Governance + - IBC + - Insurance Fund + - Mint + - Oracle + - Peggy + - Permissions + - Staking + - Token Factory + - Wasm/WasmX + +2. **Indexer gRPC Modules** + - Account & Portfolio + - Derivatives + - Spot Trading + - Explorer + - Insurance Fund + - Mito + - Oracle + - Web3 Gateway + +## Installation + +```bash +pnpm install +``` + +## Build and Use +To build and use the project, run the following command +```bash +pnpm build +``` + +## Usage + +Basic setup: + +```typescript +import { InjectiveGrpcClient } from '@injectivelabs/injective-sdk-client-ts' + +// Initialize client +const client = new InjectiveGrpcClient({ + networkType: "Mainnet", + privateKey: "your-private-key" +}) + +// Example: Query bank balance +const getBalance = async () => { + const response = await client.getBankBalance({ + address: "inj1..." + }) + console.log(response) +} +``` + +### Key Features + +1. **Address Generation** +```typescript +const address = getAddressFromPrivateKey(privateKey) +``` + +2. **Message Broadcasting** +```typescript +// Send tokens +const response = await client.msgSend({ + amount: "1000000000", + denom: "inj", + recipient: "inj1...", +}) +``` + +3. **Market Data Queries** +```typescript +// Get spot markets +const markets = await client.getSpotMarkets({}) + +// Get derivative markets +const derivativeMarkets = await client.getDerivativeMarkets({}) +``` + +## Error Handling + +The client implements custom error handling through the `GrpcException` class: + +```typescript +try { + await client.someMethod() +} catch (e) { + if (e instanceof GrpcException) { + console.error(`gRPC error: ${e.message}`) + } +} +``` + +## Network Configuration + +Supports multiple network types: +- Mainnet +- Testnet +- Devnet + +```typescript +const client = new InjectiveGrpcClient({ + networkType: "Testnet", + privateKey: "your-private-key" +}) +``` + +## Contributing + +1. Fork the repository +2. Create your feature branch (`git checkout -b feature/amazing-feature`) +3. Commit your changes (`git commit -m 'Add some amazing feature'`) +4. Push to the branch (`git push origin feature/amazing-feature`) +5. Open a Pull Request + +## License + +This project is licensed under the MIT License - see the LICENSE file for details. \ No newline at end of file diff --git a/packages/plugin-injective/injective-sdk-client-ts/eslint.config.mjs b/packages/plugin-injective/injective-sdk-client-ts/eslint.config.mjs new file mode 100644 index 00000000000..2415fb89f50 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/eslint.config.mjs @@ -0,0 +1,37 @@ +import globals from "globals"; +import pluginJs from "@eslint/js"; +import tseslint from "typescript-eslint"; + +export default [ + { + files: ["**/*.{js,mjs,cjs,ts}"], + languageOptions: { + globals: { + ...globals.browser, + ...globals.node + }, + parserOptions: { + ecmaVersion: "latest", + sourceType: "module" + } + } + }, + pluginJs.configs.recommended, + ...tseslint.configs.recommended, + { + rules: { + // Customize rules as needed + "no-unused-vars": "warn", + "@typescript-eslint/no-explicit-any": "warn", + "no-console": "warn" + } + }, + { + ignores: [ + "node_modules/", + "dist/", + "build/", + "**/*.d.ts" + ] + } +]; \ No newline at end of file diff --git a/packages/plugin-injective/injective-sdk-client-ts/package.json b/packages/plugin-injective/injective-sdk-client-ts/package.json new file mode 100644 index 00000000000..88cc4794864 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/package.json @@ -0,0 +1,50 @@ +{ + "name": "@injectivelabs/injective-sdk-client-ts", + "version": "1.0.0", + "description": "Injective Protocol TypeScript Library", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "tsc", + "test": "jest", + "lint": "eslint . ", + "lint:fix": "eslint . --fix", + "format": "prettier --write \"src/**/*.ts\"", + "test:integration": "vitest integration --reporter verbose", + "dev": "tsc --watch", + "type-check": "tsc --noEmit" + }, + "exports": { + ".": { + "require": "./dist/index.cjs", + "import": "./dist/index.js", + "types": "./dist/index.d.ts" + } + }, + + "dependencies": { + "@injectivelabs/networks": "1.14.34-beta.2", + "@injectivelabs/sdk-ts": "1.14.34-beta.2", + "@injectivelabs/token-metadata": "1.14.11", + "@injectivelabs/ts-types": "1.14.34-beta.2", + "@injectivelabs/utils": "1.14.34-beta.2", + "bignumber.js": "^9.1.2" + }, + "devDependencies": { + "@esbuild-plugins/node-globals-polyfill": "^0.2.3", + "@esbuild-plugins/node-modules-polyfill": "^0.2.2", + "@eslint/js": "^9.17.0", + "@types/eslint__js": "^8.42.3", + "@types/jest": "^29.5.14", + "@types/node": "^20.10.0", + "@typescript-eslint/eslint-plugin": "^6.21.0", + "@typescript-eslint/parser": "^6.21.0", + "eslint": "^8.57.1", + "eslint-config-prettier": "^9.1.0", + "globals": "^15.14.0", + "prettier": "^3.1.0", + "typescript": "^5.3.2", + "typescript-eslint": "^8.19.0", + "vitest": "latest" + } + } \ No newline at end of file diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/examples/auction.ts b/packages/plugin-injective/injective-sdk-client-ts/src/examples/auction.ts new file mode 100644 index 00000000000..d9da1b1959e --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/examples/auction.ts @@ -0,0 +1,218 @@ +export const getAuctionModuleParamsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve the auction module parameters, including the auction period and the minimum next bid increment rate.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Auction module parameters retrieved successfully.", + action: "GET_AUCTION_MODULE_PARAMS", + content: { + auctionPeriod: 7200, + minNextBidIncrementRate: "0.05", + }, + }, + }, +]; + +export const getAuctionModuleStateExample = [ + { + user: "{{user1}}", + content: { + text: "Get the current state of the auction module, including parameters, auction round, highest bid, and auction ending timestamp.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Auction module state retrieved successfully.", + action: "GET_AUCTION_MODULE_STATE", + content: { + params: { + auctionPeriod: 7200, + minNextBidIncrementRate: "0.05", + }, + auctionRound: 12, + highestBid: { + bidder: "inj1xmpl3bidderaddress", + amount: "2500000000", + }, + auctionEndingTimestamp: 1700000000, + }, + }, + }, +]; + +export const getCurrentBasketExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch the details of the current auction basket, including the list of amounts, auction round, closing time, highest bidder, and highest bid amount.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Current auction basket details retrieved successfully.", + action: "GET_CURRENT_BASKET", + content: { + amountList: [ + { + denom: "inj", + amount: "500000000", + }, + { + denom: "usdt", + amount: "1000000", + }, + ], + auctionRound: 12, + auctionClosingTime: 1700003600, + highestBidder: "inj1xmpl3bidderaddress", + highestBidAmount: "2500000000", + }, + }, + }, +]; + +export const getAuctionRoundExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve information for auction round number 12.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Auction round 12 details retrieved successfully.", + action: "GET_AUCTION_ROUND", + content: { + auction: { + winner: "inj1w1nn3raddress", + basketList: [ + { + denom: "inj", + amount: "500000000", + }, + { + denom: "usdt", + amount: "1000000", + }, + ], + winningBidAmount: "2500000000", + round: 12, + endTimestamp: 1700000000, + updatedAt: 1700000000, + }, + bids: [ + { + bidder: "inj1bidder1address", + bidAmount: "2000000000", + bidTimestamp: 1699999000, + }, + { + bidder: "inj1bidder2address", + bidAmount: "2500000000", + bidTimestamp: 1699999500, + }, + ], + }, + }, + }, +]; + +export const getAuctionsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve the list of all past auctions with their details.", + }, + }, + { + user: "{{agent}}", + content: { + text: "List of auctions retrieved successfully.", + action: "GET_AUCTIONS", + content: [ + { + winner: "inj1w1nn3raddress", + basketList: [ + { + denom: "inj", + amount: "500000000", + }, + { + denom: "usdt", + amount: "1000000", + }, + ], + winningBidAmount: "2500000000", + round: 12, + endTimestamp: 1700000000, + updatedAt: 1700000000, + }, + { + winner: "inj1w1nn3raddress2", + basketList: [ + { + denom: "inj", + amount: "750000000", + }, + { + denom: "usdt", + amount: "1500000", + }, + ], + winningBidAmount: "3500000000", + round: 11, + endTimestamp: 1699996400, + updatedAt: 1699996400, + }, + ], + }, + }, +]; + +export const msgBidExample = [ + { + user: "{{user1}}", + content: { + text: "Place a bid of 2600000000 INJ_DENOM in auction round 12.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Bid placed successfully.", + action: "PLACE_BID", + content: { + round: 12, + amount: "2600000000", + }, + }, + }, +]; + +export const msgBidResponseExample = [ + { + user: "{{user1}}", + content: { + text: "Confirm the bid transaction.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Bid transaction processed.", + action: "BID_TRANSACTION_RESPONSE", + content: { + txHash: "0xabc123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/examples/auth.ts b/packages/plugin-injective/injective-sdk-client-ts/src/examples/auth.ts new file mode 100644 index 00000000000..23ae93c9779 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/examples/auth.ts @@ -0,0 +1,313 @@ +export const getAuthModuleParamsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve the auth module parameters, including max memo characters, transaction signature limit, transaction size cost per byte, and signature verification costs.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Auth module parameters retrieved successfully.", + action: "GET_AUTH_MODULE_PARAMS", + content: { + maxMemoCharacters: 256, + txSigLimit: 7, + txSizeCostPerByte: 10, + sigVerifyCostEd25519: 590, + sigVerifyCostSecp256k1: 1000, + }, + }, + }, +]; + +export const getAccountDetailsExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch the account details for address inj1exampleaddress.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Account details retrieved successfully.", + action: "GET_ACCOUNT_DETAILS", + content: { + codeHash: "0xabcdef1234567890", + baseAccount: { + address: "inj1exampleaddress", + pubKey: { + key: "A1B2C3D4E5F6G7H8I9J0", + typeUrl: "/cosmos.crypto.secp256k1.PubKey", + }, + accountNumber: 123456, + sequence: 789012, + }, + }, + }, + }, +]; + +export const getAccountsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve the list of all accounts with pagination.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Accounts list retrieved successfully.", + action: "GET_ACCOUNTS", + content: { + pagination: { + nextKey: "eyJwYWdlIjoyfQ==", + total: 250, + }, + accounts: [ + { + codeHash: "0xabcdef1234567890", + baseAccount: { + address: "inj1account1address", + pubKey: { + key: "Z9Y8X7W6V5U4T3S2R1Q", + typeUrl: "/cosmos.crypto.secp256k1.PubKey", + }, + accountNumber: 654321, + sequence: 210987, + }, + }, + { + codeHash: "0x1234567890abcdef", + baseAccount: { + address: "inj1account2address", + pubKey: { + key: "L1K2J3H4G5F6D7S8A9Q", + typeUrl: "/cosmos.crypto.secp256k1.PubKey", + }, + accountNumber: 112233, + sequence: 445566, + }, + }, + ], + }, + }, + }, +]; + +export const getGrantsExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch all grants for granter inj1granteraddress and grantee inj1granteeaddress with message type /cosmos.bank.v1beta1.MsgSend.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Grants fetched successfully.", + action: "GET_GRANTS", + content: { + pagination: { + nextKey: "eyJwYWdlIjozfQ==", + total: 15, + }, + grants: [ + { + authorization: { + "@type": + "/cosmos.authz.v1beta1.GenericAuthorization", + msg: "/cosmos.bank.v1beta1.MsgSend", + }, + authorizationType: "GenericAuthorization", + expiration: "2024-12-31T23:59:59Z", + }, + { + authorization: { + "@type": "/cosmos.authz.v1beta1.SendAuthorization", + spendLimit: [ + { + denom: "inj", + amount: "1000000", + }, + ], + }, + authorizationType: "SendAuthorization", + expiration: "2025-06-30T12:00:00Z", + }, + ], + }, + }, + }, +]; + +export const getGranterGrantsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve all grants made by granter inj1granteraddress with pagination.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Granter's grants fetched successfully.", + action: "GET_GRANTER_GRANTS", + content: { + pagination: { + nextKey: "eyJwYWdlIjozfQ==", + total: 10, + }, + grants: [ + { + granter: "inj1granteraddress", + grantee: "inj1grantee1address", + authorization: { + "@type": + "/cosmos.authz.v1beta1.GenericAuthorization", + msg: "/cosmos.bank.v1beta1.MsgSend", + }, + authorizationType: "GenericAuthorization", + expiration: "2024-12-31T23:59:59Z", + }, + { + granter: "inj1granteraddress", + grantee: "inj1grantee2address", + authorization: { + "@type": "/cosmos.authz.v1beta1.SendAuthorization", + spendLimit: [ + { + denom: "usdt", + amount: "500000", + }, + ], + }, + authorizationType: "SendAuthorization", + expiration: "2025-01-15T08:30:00Z", + }, + ], + }, + }, + }, +]; + +export const getGranteeGrantsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve all grants received by grantee inj1granteeaddress with pagination.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Grantee's grants fetched successfully.", + action: "GET_GRANTEE_GRANTS", + content: { + pagination: { + nextKey: "eyJwYWdlIjozfQ==", + total: 8, + }, + grants: [ + { + granter: "inj1granter1address", + grantee: "inj1granteeaddress", + authorization: { + "@type": + "/cosmos.authz.v1beta1.GenericAuthorization", + msg: "/cosmos.bank.v1beta1.MsgSend", + }, + authorizationType: "GenericAuthorization", + expiration: "2024-12-31T23:59:59Z", + }, + { + granter: "inj1granter2address", + grantee: "inj1granteeaddress", + authorization: { + "@type": "/cosmos.authz.v1beta1.SendAuthorization", + spendLimit: [ + { + denom: "inj", + amount: "250000", + }, + ], + }, + authorizationType: "SendAuthorization", + expiration: "2025-03-10T16:45:00Z", + }, + ], + }, + }, + }, +]; + +export const msgGrantExample = [ + { + user: "{{user1}}", + content: { + text: "Grant authorization to grantee inj1granteeaddress for message type /cosmos.bank.v1beta1.MsgSend.", + }, + }, +]; + +export const msgGrantResponseExample = [ + { + user: "{{agent}}", + content: { + text: "Authorization granted successfully.", + action: "MSG_GRANT", + content: { + txHash: "0xgrant123hash456def789ghi012jkl345mno678pqr901stu234vwx", + success: true, + }, + }, + }, +]; + +export const msgExecExample = [ + { + user: "{{user1}}", + content: { + text: "Execute authorized messages for grantee inj1granteeaddress: Send 1000000000 inj to inj1recipientaddress.", + }, + }, +]; + +export const msgExecResponseExample = [ + { + user: "{{agent}}", + content: { + text: "Authorized messages executed successfully.", + action: "MSG_EXEC", + content: { + txHash: "0xexec123hash456def789ghi012jkl345mno678pqr901stu234vwx", + success: true, + }, + }, + }, +]; + +export const msgRevokeExample = [ + { + user: "{{user1}}", + content: { + text: "Revoke authorization for grantee inj1granteeaddress for message type /cosmos.bank.v1beta1.MsgSend.", + }, + }, +]; + +export const msgRevokeResponseExample = [ + { + user: "{{agent}}", + content: { + text: "Authorization revoked successfully.", + action: "MSG_REVOKE", + content: { + txHash: "0xrevoke123hash456def789ghi012jkl345mno678pqr901stu234vwx", + success: true, + }, + }, + }, +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/examples/bank.ts b/packages/plugin-injective/injective-sdk-client-ts/src/examples/bank.ts new file mode 100644 index 00000000000..794ff2409ba --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/examples/bank.ts @@ -0,0 +1,412 @@ +export const getBankModuleParamsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve the bank module parameters, including send enabled list and default send enabled status.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Bank module parameters retrieved successfully.", + action: "GET_BANK_MODULE_PARAMS", + content: { + sendEnabledList: [ + { + denom: "inj", + enabled: true, + }, + { + denom: "usdt", + enabled: false, + }, + ], + defaultSendEnabled: true, + }, + }, + }, +]; + +export const getBankBalanceExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch the bank balance for account inj1exampleaddress and denomination inj.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Bank balance retrieved successfully.", + action: "GET_BANK_BALANCE", + content: { + denom: "inj", + amount: "1000000000", + }, + }, + }, +]; + +export const getBankBalancesExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve all bank balances for account inj1exampleaddress with pagination.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Bank balances retrieved successfully.", + action: "GET_BANK_BALANCES", + content: { + balances: [ + { + denom: "inj", + amount: "1000000000", + }, + { + denom: "usdt", + amount: "5000000", + }, + ], + pagination: { + nextKey: "eyJwYWdlIjozfQ==", + total: 2, + }, + }, + }, + }, +]; + +export const getTotalSupplyExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve the total supply with optional pagination.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Total supply retrieved successfully.", + action: "GET_TOTAL_SUPPLY", + content: { + supply: [ + { + denom: "inj", + amount: "1000000000000", + }, + { + denom: "usdt", + amount: "2000000000", + }, + ], + pagination: { + nextKey: "eyJwYWdlIjozfQ==", + total: 2, + }, + }, + }, + }, +]; + +export const getAllTotalSupplyExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve the complete total supply for all denominations.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Complete total supply retrieved successfully.", + action: "GET_ALL_TOTAL_SUPPLY", + content: { + supply: [ + { + denom: "inj", + amount: "1000000000000", + }, + { + denom: "usdt", + amount: "2000000000", + }, + { + denom: "btc", + amount: "500000000", + }, + ], + pagination: { + nextKey: null, + total: 3, + }, + }, + }, + }, +]; + +export const getSupplyOfExample = [ + { + user: "{{user1}}", + content: { + text: "Get the supply of denomination inj.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Supply of inj retrieved successfully.", + action: "GET_SUPPLY_OF", + content: { + denom: "inj", + amount: "1000000000000", + }, + }, + }, +]; + +export const getDenomsMetadataExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch metadata for all denominations with pagination.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Denomination metadata fetched successfully.", + action: "GET_DENOMS_METADATA", + content: { + metadatas: [ + { + description: + "The native staking token of the Injective blockchain", + denom_units: [ + { + denom: "inj", + exponent: 0, + aliases: ["inj"], + }, + ], + base: "inj", + display: "inj", + name: "Injective", + symbol: "INJ", + }, + { + description: "USD Tether", + denom_units: [ + { + denom: "usdt", + exponent: 0, + aliases: ["usdt"], + }, + ], + base: "usdt", + display: "usdt", + name: "Tether USD", + symbol: "USDT", + }, + ], + pagination: { + nextKey: "eyJwYWdlIjozfQ==", + total: 2, + }, + }, + }, + }, +]; + +export const getDenomMetadataExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve metadata for denomination inj.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Denomination metadata for inj retrieved successfully.", + action: "GET_DENOM_METADATA", + content: { + description: + "The native staking token of the Injective blockchain", + denom_units: [ + { + denom: "inj", + exponent: 0, + aliases: ["inj"], + }, + { + denom: "inj", + exponent: 6, + aliases: ["uinj"], + }, + ], + base: "inj", + display: "inj", + name: "Injective", + symbol: "INJ", + }, + }, + }, +]; + +export const getDenomOwnersExample = [ + { + user: "{{user1}}", + content: { + text: "Get the owners of denomination inj with pagination.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Denomination owners retrieved successfully.", + action: "GET_DENOM_OWNERS", + content: { + denomOwners: [ + { + address: "inj1address1", + balance: { + denom: "inj", + amount: "500000000", + }, + }, + { + address: "inj1address2", + balance: { + denom: "inj", + amount: "300000000", + }, + }, + ], + pagination: { + nextKey: "eyJwYWdlIjozfQ==", + total: 2, + }, + }, + }, + }, +]; + +export const msgSendExample = [ + { + user: "{{user1}}", + content: { + text: "Send 1000000000 inj from inj1senderaddress to inj1recipientaddress.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Send transaction submitted successfully.", + action: "MSG_SEND", + content: { + srcInjectiveAddress: "inj1senderaddress", + dstInjectiveAddress: "inj1recipientaddress", + amount: { + denom: "inj", + amount: "1000000000", + }, + }, + }, + }, +]; + +export const msgSendResponseExample = [ + { + user: "{{user1}}", + content: { + text: "Confirm the send transaction.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Send transaction processed successfully.", + action: "MSG_SEND_RESPONSE", + content: { + txHash: "0xsendinghash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgMultiSendExample = [ + { + user: "{{user1}}", + content: { + text: "Execute a multi-send transaction: send 500000000 inj and 2500000 usdt from inj1senderaddress to inj1recipient1address and inj1recipient2address.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Multi-send transaction submitted successfully.", + action: "MSG_MULTI_SEND", + content: { + inputs: [ + { + address: "inj1senderaddress", + coins: [ + { + denom: "inj", + amount: "500000000", + }, + { + denom: "usdt", + amount: "2500000", + }, + ], + }, + ], + outputs: [ + { + address: "inj1recipient1address", + coins: [ + { + denom: "inj", + amount: "300000000", + }, + ], + }, + { + address: "inj1recipient2address", + coins: [ + { + denom: "inj", + amount: "200000000", + }, + ], + }, + ], + }, + }, + }, +]; + +export const msgMultiSendResponseExample = [ + { + user: "{{user1}}", + content: { + text: "Confirm the multi-send transaction.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Multi-send transaction processed successfully.", + action: "MSG_MULTI_SEND_RESPONSE", + content: { + txHash: "0xmultisendhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/examples/distribution.ts b/packages/plugin-injective/injective-sdk-client-ts/src/examples/distribution.ts new file mode 100644 index 00000000000..25c01fe9ef0 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/examples/distribution.ts @@ -0,0 +1,222 @@ +export const getDistributionModuleParamsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve the distribution module parameters, including community tax, base proposer reward, bonus proposer reward, and withdraw address enabled status.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Distribution module parameters retrieved successfully.", + action: "GET_DISTRIBUTION_MODULE_PARAMS", + content: { + communityTax: "0.020000000000000000", + baseProposerReward: "0.010000000000000000", + bonusProposerReward: "0.040000000000000000", + withdrawAddrEnabled: true, + }, + }, + }, +]; + +export const getDelegatorRewardsForValidatorExample = [ + { + user: "{{user1}}", + content: { + text: "Get delegator rewards for delegator address inj1delegatoraddress and validator address injvaloper1validatoraddress.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Delegator rewards retrieved successfully.", + action: "GET_DELEGATOR_REWARDS_FOR_VALIDATOR", + content: [ + { + denom: "inj", + amount: "1000000000", + }, + ], + }, + }, +]; + +export const getDelegatorRewardsForValidatorNoThrowExample = [ + { + user: "{{user1}}", + content: { + text: "Get delegator rewards for delegator address inj1delegatoraddress and validator address injvaloper1validatoraddress without throwing errors.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Delegator rewards retrieved successfully (no-throw).", + action: "GET_DELEGATOR_REWARDS_FOR_VALIDATOR_NO_THROW", + content: [ + { + denom: "inj", + amount: "1000000000", + }, + ], + }, + }, +]; + +export const getDelegatorRewardsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve all delegator rewards for delegator address inj1delegatoraddress.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Delegator rewards retrieved successfully.", + action: "GET_DELEGATOR_REWARDS", + content: [ + { + validatorAddress: "injvaloper1validatoraddress1", + rewards: [ + { + denom: "inj", + amount: "500000000", + }, + ], + }, + { + validatorAddress: "injvaloper1validatoraddress2", + rewards: [ + { + denom: "inj", + amount: "500000000", + }, + ], + }, + ], + }, + }, +]; + +export const getDelegatorRewardsNoThrowExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve all delegator rewards for delegator address inj1delegatoraddress without throwing errors.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Delegator rewards retrieved successfully (no-throw).", + action: "GET_DELEGATOR_REWARDS_NO_THROW", + content: [ + { + validatorAddress: "injvaloper1validatoraddress1", + rewards: [ + { + denom: "inj", + amount: "500000000", + }, + ], + }, + { + validatorAddress: "injvaloper1validatoraddress2", + rewards: [ + { + denom: "inj", + amount: "500000000", + }, + ], + }, + ], + }, + }, +]; + +export const msgWithdrawDelegatorRewardExample = [ + { + user: "{{user1}}", + content: { + text: "Withdraw delegator rewards for delegator address inj1delegatoraddress and validator address injvaloper1validatoraddress.", + }, + }, +]; + +export const msgWithdrawDelegatorRewardResponseExample = [ + { + user: "{{agent}}", + content: { + text: "Delegator rewards withdrawal submitted successfully.", + action: "MSG_WITHDRAW_DELEGATOR_REWARD", + content: { + delegatorAddress: "inj1delegatoraddress", + validatorAddress: "injvaloper1validatoraddress", + }, + }, + }, +]; + +export const msgWithdrawDelegatorRewardTransactionResponseExample = [ + { + user: "{{user1}}", + content: { + text: "Confirm the withdraw delegator reward transaction.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Withdraw delegator reward transaction processed successfully.", + action: "MSG_WITHDRAW_DELEGATOR_REWARD_RESPONSE", + content: { + txHash: "0xwithdrawdelegatorrewardhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgWithdrawValidatorCommissionExample = [ + { + user: "{{user1}}", + content: { + text: "Withdraw validator commission for validator address injvaloper1validatoraddress.", + }, + }, +]; + +export const msgWithdrawValidatorCommissionResponseExample = [ + { + user: "{{agent}}", + content: { + text: "Validator commission withdrawal submitted successfully.", + action: "MSG_WITHDRAW_VALIDATOR_COMMISSION", + content: { + validatorAddress: "injvaloper1validatoraddress", + }, + }, + }, +]; + +export const msgWithdrawValidatorCommissionTransactionResponseExample = [ + { + user: "{{user1}}", + content: { + text: "Confirm the withdraw validator commission transaction.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Withdraw validator commission transaction processed successfully.", + action: "MSG_WITHDRAW_VALIDATOR_COMMISSION_RESPONSE", + content: { + txHash: "0xwithdrawvalidatorcommissionhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/examples/exchange.ts b/packages/plugin-injective/injective-sdk-client-ts/src/examples/exchange.ts new file mode 100644 index 00000000000..3bbe96297bd --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/examples/exchange.ts @@ -0,0 +1,2304 @@ +export const getAccountPortfolioExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve account portfolio for address 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Account portfolio retrieved successfully.", + action: "GET_ACCOUNT_PORTFOLIO", + content: { + accountAddress: "inj1...", + bankBalancesList: [ + { + amount: "1000000", + denom: "inj", + }, + ], + subaccountsList: [ + { + subaccountId: "subaccount_id", + denom: "inj", + deposit: { + totalBalance: "1000000", + availableBalance: "900000", + }, + }, + ], + positionsWithUpnlList: [ + { + position: { + marketId: "market_id", + subaccountId: "subaccount_id", + direction: "long", + quantity: "1.5", + entryPrice: "25000.5", + margin: "1000", + liquidationPrice: "24000.0", + markPrice: "25100.0", + ticker: "BTC/USDT", + }, + unrealizedPnl: "150.75", + }, + ], + }, + }, + }, +]; + +export const getSubaccountHistoryExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch subaccount history for subaccount ID 'subaccount_id' with denom 'inj' and transfer types ['deposit', 'withdraw'].", + }, + }, + { + user: "{{agent}}", + content: { + text: "Subaccount history retrieved successfully.", + action: "GET_SUBACCOUNT_HISTORY", + content: { + transfers: [ + { + transferType: "deposit", + srcSubaccountId: "src_subaccount_id", + srcSubaccountAddress: "inj1...", + dstSubaccountId: "dst_subaccount_id", + dstSubaccountAddress: "inj1...", + amount: { + amount: "1000000", + denom: "inj", + }, + executedAt: 1641859200, + }, + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getSpotMarketExample = [ + { + user: "{{user1}}", + content: { + text: "Lookup spot market with market ID 'market_id'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Spot market retrieved successfully.", + action: "GET_SPOT_MARKET", + content: { + marketId: "market_id", + marketStatus: "active", + ticker: "INJ/USDT", + baseDenom: "inj", + quoteDenom: "usdt", + makerFeeRate: "0.001", + takerFeeRate: "0.002", + serviceProviderFee: "0.4", + minPriceTickSize: 0.000001, + minQuantityTickSize: 0.000001, + }, + }, + }, +]; + +export const getDerivativeMarketExample = [ + { + user: "{{user1}}", + content: { + text: "Lookup derivative market with market ID 'market_id'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Derivative market retrieved successfully.", + action: "GET_DERIVATIVE_MARKET", + content: { + marketId: "market_id", + marketStatus: "active", + ticker: "BTC/USDT PERP", + oracleBase: "BTC", + oracleQuote: "USDT", + quoteDenom: "usdt", + makerFeeRate: "0.001", + takerFeeRate: "0.002", + serviceProviderFee: "0.4", + initialMarginRatio: "0.05", + maintenanceMarginRatio: "0.02", + isPerpetual: true, + minPriceTickSize: 0.01, + minQuantityTickSize: 0.001, + }, + }, + }, +]; + +export const getExchangePositionsExample = [ + { + user: "{{user1}}", + content: { + text: "Query positions of the exchange modules", + }, + }, + { + user: "{{agent}}", + content: { + text: "Positions retrieved successfully.", + action: "GET_EXCHANGE_POSITIONS", + content: { + positions: [ + { + marketId: "market_id", + subaccountId: "subaccount_id", + direction: "long", + quantity: "1.5", + entryPrice: "25000.5", + margin: "1000", + liquidationPrice: "24000.0", + markPrice: "25100.0", + ticker: "BTC/USDT", + }, + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getInsuranceFundsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve insurance funds information.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Insurance funds information retrieved successfully.", + action: "GET_INSURANCE_FUNDS", + content: { + funds: [ + { + depositDenom: "inj", + insurancePoolTokenDenom: "insurance_pool_token", + redemptionNoticePeriodDuration: 1209600, + balance: "1000000", + totalShare: "1000000", + marketId: "market_id", + marketTicker: "BTC/USDT PERP", + oracleBase: "BTC", + oracleQuote: "USDT", + oracleType: "band", + expiry: 0, + }, + ], + }, + }, + }, +]; + +export const getRedemptionsExample = [ + { + user: "{{user1}}", + content: { + text: "Query redemptions for address 'inj1...' with denom 'inj' and status 'pending'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Redemptions retrieved successfully.", + action: "GET_REDEMPTIONS", + content: { + redemptions: [ + { + redemptionId: 1, + status: "pending", + redeemer: "inj1...", + claimableRedemptionTime: 1641859200, + redemptionAmount: "1000000", + redemptionDenom: "inj", + requestedAt: 1641772800, + disbursedAmount: "0", + disbursedDenom: "", + disbursedAt: 0, + }, + ], + }, + }, + }, +]; + +export const getSpotOrdersExample = [ + { + user: "{{user1}}", + content: { + text: "Query spot orders for market ID 'market_id1', 'market_id2', subaccount ID 'subaccount_id', order side 'buy', non-conditional, with pagination from 1 to 100 and limit 10.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Spot orders retrieved successfully.", + action: "GET_SPOT_ORDERS", + content: { + orders: [ + { + orderHash: "0x...", + orderSide: "buy", + marketId: "market_id", + subaccountId: "subaccount_id", + price: "25000.5", + quantity: "1.5", + unfilledQuantity: "0.5", + triggerPrice: "0", + feeRecipient: "inj1...", + state: "booked", + createdAt: 1641859200, + updatedAt: 1641859200, + }, + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getDerivativeOrdersExample = [ + { + user: "{{user1}}", + content: { + text: "Query derivative orders for market IDs 'market_id1' and 'market_id2', subaccount ID 'subaccount_id', order side 'buy', non-conditional, with pagination from 1 to 100 and limit 10.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Derivative orders retrieved successfully.", + action: "GET_DERIVATIVE_ORDERS", + content: { + orders: [ + { + orderHash: "0x...", + orderSide: "buy", + marketId: "market_id", + subaccountId: "subaccount_id", + margin: "1000", + price: "25000.5", + quantity: "1.5", + unfilledQuantity: "0.5", + triggerPrice: "0", + feeRecipient: "inj1...", + state: "booked", + createdAt: 1641859200, + updatedAt: 1641859200, + }, + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getHistoricalTradesExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch historical trades for market IDs 'market_id1' and 'market_id2', subaccount ID 'subaccount_id', between start time 1641859200 and end time 1641945600, direction 'buy', with pagination from 1 to 100 and limit 10.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Historical trades retrieved successfully.", + action: "GET_HISTORICAL_TRADES", + content: { + trades: [ + { + orderHash: "0x...", + subaccountId: "subaccount_id", + marketId: "market_id", + tradeId: "trade_id", + executedAt: 1641859200, + tradeExecutionType: "limit", + tradeDirection: "buy", + executionPrice: "25000.5", + executionQuantity: "1.5", + fee: "0.5", + feeRecipient: "inj1...", + }, + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getFundingRatesExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch funding rates for market ID 'market_id' with pagination from 1 to 100 and limit 10.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Funding rates retrieved successfully.", + action: "GET_FUNDING_RATES", + content: { + fundingRates: [ + { + marketId: "market_id", + rate: "0.0001", + timestamp: 1641859200, + }, + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const msgDepositExample = [ + { + user: "{{user1}}", + content: { + text: "Deposit 1,000,000 INJ to subaccount '0x...' from address 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Deposit successful.", + action: "MSG_DEPOSIT", + content: { + success: true, + txHash: "0x...", + }, + }, + }, +]; + +export const msgWithdrawExample = [ + { + user: "{{user1}}", + content: { + text: "Withdraw 1,000,000 INJ from subaccount '0x...' to address 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Withdrawal successful.", + action: "MSG_WITHDRAW", + content: { + success: true, + txHash: "0x...", + }, + }, + }, +]; + +export const msgCreateSpotMarketOrderExample = [ + { + user: "{{user1}}", + content: { + text: "Create a spot market order to BUY 0.5 INJ at price 25000.5 for subaccount '0x...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Spot market order created successfully.", + action: "MSG_CREATE_SPOT_MARKET_ORDER", + content: { + orderHash: "0x...", + txHash: "0x...", + }, + }, + }, +]; + +export const msgCreateDerivativeMarketOrderExample = [ + { + user: "{{user1}}", + content: { + text: "Create a derivative market order to BUY 1.5 BTC/USDT PERP at price 25000.5 with margin 1000 for subaccount '0x...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Derivative market order created successfully.", + action: "MSG_CREATE_DERIVATIVE_MARKET_ORDER", + content: { + orderHash: "0x...", + txHash: "0x...", + }, + }, + }, +]; + +export const msgBatchCancelOrdersExample = [ + { + user: "{{user1}}", + content: { + text: "Batch cancel spot and derivative orders for subaccount '0x...' with order hashes ['0x...'].", + }, + }, + { + user: "{{agent}}", + content: { + text: "Batch orders canceled successfully.", + action: "MSG_BATCH_CANCEL_ORDERS", + content: { + success: true, + txHash: "0x...", + }, + }, + }, +]; + +export const msgBatchUpdateOrdersExample = [ + { + user: "{{user1}}", + content: { + text: "Batch update spot and derivative orders for subaccount '0x...' with updated prices and quantities.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Batch orders updated successfully.", + action: "MSG_BATCH_UPDATE_ORDERS", + content: { + spotOrderHashes: ["0x..."], + derivativeOrderHashes: ["0x..."], + txHash: "0x...", + }, + }, + }, +]; + +export const msgAdminUpdateBinaryOptionsMarketExample = [ + { + user: "{{user1}}", + content: { + text: "Admin 'inj1...' updates binary options market '0x...' with settlement price 25000.5, expiry time 1641859200, and settlement time 1641945600.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Binary options market updated successfully.", + action: "MSG_ADMIN_UPDATE_BINARY_OPTIONS_MARKET", + content: { + success: true, + txHash: "0x...", + }, + }, + }, +]; + +export const getModuleStateExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch the current state of the exchange module.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Exchange module state retrieved successfully.", + action: "GET_MODULE_STATE", + content: { + moduleState: { + params: { + spotMarketInstantListingFee: { + amount: "100000000", + denom: "inj", + }, + derivativeMarketInstantListingFee: { + amount: "1000000000", + denom: "inj", + }, + defaultSpotMakerFeeRate: "0.001", + defaultSpotTakerFeeRate: "0.002", + defaultDerivativeMakerFeeRate: "0.001", + defaultDerivativeTakerFeeRate: "0.002", + defaultInitialMarginRatio: "0.05", + defaultMaintenanceMarginRatio: "0.02", + defaultFundingInterval: 3600, + fundingMultiple: 3600, + }, + spotMarkets: [], + derivativeMarkets: [], + spotOrderbooks: [], + derivativeOrderbooks: [], + balances: [], + positions: [], + }, + }, + }, + }, +]; + +export const getFeeDiscountScheduleExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve the fee discount schedule.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Fee discount schedule retrieved successfully.", + action: "GET_FEE_DISCOUNT_SCHEDULE", + content: { + bucketCount: 10, + bucketDuration: 1209600, + quoteDenomsList: ["inj"], + tierInfosList: [ + { + makerDiscountRate: "0.001", + takerDiscountRate: "0.001", + stakedAmount: "10000000000", + volume: "100000000", + }, + ], + disqualifiedMarketIdsList: [], + }, + }, + }, +]; + +export const getFeeDiscountAccountInfoExample = [ + { + user: "{{user1}}", + content: { + text: "Get fee discount account info for address 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Fee discount account info retrieved successfully.", + action: "GET_FEE_DISCOUNT_ACCOUNT_INFO", + content: { + tierLevel: 1, + accountInfo: { + makerDiscountRate: "0.001", + takerDiscountRate: "0.001", + stakedAmount: "10000000000", + volume: "100000000", + }, + accountTtl: { + tier: 1, + ttlTimestamp: 1641945600, + }, + }, + }, + }, +]; + +export const getModuleParamsExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch module parameters information.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Module parameters retrieved successfully.", + action: "GET_MODULE_PARAMS", + content: { + spotMarketInstantListingFee: { + amount: "100000000", + denom: "inj", + }, + derivativeMarketInstantListingFee: { + amount: "1000000000", + denom: "inj", + }, + defaultSpotMakerFeeRate: "0.001", + defaultSpotTakerFeeRate: "0.002", + defaultDerivativeMakerFeeRate: "0.001", + defaultDerivativeTakerFeeRate: "0.002", + defaultInitialMarginRatio: "0.05", + defaultMaintenanceMarginRatio: "0.02", + defaultFundingInterval: 3600, + fundingMultiple: 3600, + relayerFeeShareRate: "0.4", + exchangeModuleAdmin: "inj1...", + }, + }, + }, +]; + +export const getTradingRewardsCampaignExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve current trading rewards campaign information.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Trading rewards campaign information retrieved successfully.", + action: "GET_TRADING_REWARDS_CAMPAIGN", + content: { + tradingRewardCampaignInfo: { + campaignDurationSeconds: 604800, + quoteDenomsList: ["inj"], + tradingRewardBoostInfo: { + boostedSpotMarketIdsList: [], + spotMarketMultipliersList: [], + boostedDerivativeMarketIdsList: [], + derivativeMarketMultipliersList: [], + }, + disqualifiedMarketIdsList: [], + }, + tradingRewardPoolCampaignScheduleList: [ + { + startTimestamp: 1641859200, + maxCampaignRewardsList: [ + { + amount: "1000000000", + denom: "inj", + }, + ], + }, + ], + totalTradeRewardPoints: "1000000", + pendingTradingRewardPoolCampaignScheduleList: [], + pendingTotalTradeRewardPointsList: [], + }, + }, + }, +]; + +export const getTradeRewardPointsExample = [ + { + user: "{{user1}}", + content: { + text: "Get trade reward points for addresses ['inj1...', 'inj2...'].", + }, + }, + { + user: "{{agent}}", + content: { + text: "Trade reward points retrieved successfully.", + action: "GET_TRADE_REWARD_POINTS", + content: { + rewardPoints: ["100", "200"], + }, + }, + }, +]; + +export const getPendingTradeRewardPointsExample = [ + { + user: "{{user1}}", + content: { + text: "Get pending trade reward points for addresses ['inj1...', 'inj2...'].", + }, + }, + { + user: "{{agent}}", + content: { + text: "Pending trade reward points retrieved successfully.", + action: "GET_PENDING_TRADE_REWARD_POINTS", + content: { + rewardPoints: ["100", "200"], + }, + }, + }, +]; + +export const getBinaryOptionsMarketsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve all active binary options markets with quote denom 'usdt'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Binary options markets retrieved successfully.", + action: "GET_BINARY_OPTIONS_MARKETS", + content: { + markets: [ + { + marketId: "0x...", + marketStatus: "active", + ticker: "BTC>25000-240630", + oracleSymbol: "BTC", + oracleProvider: "band", + oracleScaleFactor: 6, + quoteDenom: "usdt", + makerFeeRate: "0.001", + takerFeeRate: "0.002", + expirationTimestamp: 1719705600, + settlementTimestamp: 1719792000, + serviceProviderFee: "0.4", + minPriceTickSize: 0.01, + minQuantityTickSize: 0.001, + }, + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getBinaryOptionsMarketExample = [ + { + user: "{{user1}}", + content: { + text: "Lookup binary options market with market ID '0x...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Binary options market retrieved successfully.", + action: "GET_BINARY_OPTIONS_MARKET", + content: { + market: { + marketId: "0x...", + marketStatus: "active", + ticker: "BTC>25000-240630", + oracleSymbol: "BTC", + oracleProvider: "band", + oracleScaleFactor: 6, + quoteDenom: "usdt", + makerFeeRate: "0.001", + takerFeeRate: "0.002", + expirationTimestamp: 1719705600, + settlementTimestamp: 1719792000, + serviceProviderFee: "0.4", + minPriceTickSize: 0.01, + minQuantityTickSize: 0.001, + }, + }, + }, + }, +]; + +export const msgCreateBinaryOptionsMarketExample = [ + { + user: "{{user1}}", + content: { + text: "Create a new binary options market with ticker 'BTC/USD', oracle 'band', expiry time 1641945600, settlement time 1641945600, admin 'inj1...', quote denom 'inj', min price tick size '0.000001', and min quantity tick size '0.000001'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Binary options market created successfully.", + action: "MSG_CREATE_BINARY_OPTIONS_MARKET", + content: { + marketId: "0x...", + success: true, + txHash: "0x...", + }, + }, + }, +]; + +export const getSubaccountTradeNonceExample = [ + { + user: "{{user1}}", + content: { + text: "Get trade nonce for subaccount ID 'subaccount_id'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Subaccount trade nonce retrieved successfully.", + action: "GET_SUBACCOUNT_TRADE_NONCE", + content: { + nonce: 5, + }, + }, + }, +]; + +export const getPositionsV2Example = [ + { + user: "{{user1}}", + content: { + text: "Query positions V2 for account 'inj1...', market ID 'market_id', subaccount ID 'subaccount_id', direction 'long' with pagination from 1 to 100 and limit 10.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Positions V2 retrieved successfully.", + action: "GET_POSITIONS_V2", + content: { + positions: [ + { + marketId: "market_id", + subaccountId: "subaccount_id", + direction: "long", + quantity: "1.5", + entryPrice: "25000.5", + margin: "1000", + liquidationPrice: "24000.0", + markPrice: "25100.0", + ticker: "BTC/USDT", + aggregateReduceOnlyQuantity: "0", + updatedAt: 1641859200, + }, + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getHistoricalBalanceExample = [ + { + user: "{{user1}}", + content: { + text: "Get historical balance for account 'inj1...' with daily resolution.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Historical balance data retrieved successfully.", + action: "GET_HISTORICAL_BALANCE", + content: { + t: [1641859200, 1641945600], + v: [1000.5, 1100.75], + }, + }, + }, +]; + +export const getHistoricalRpnlExample = [ + { + user: "{{user1}}", + content: { + text: "Get historical RPNL for account 'inj1...' with daily resolution.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Historical RPNL data retrieved successfully.", + action: "GET_HISTORICAL_RPNL", + content: { + t: [1641859200, 1641945600], + v: [1000.5, 1100.75], + }, + }, + }, +]; + +export const getHistoricalVolumesExample = [ + { + user: "{{user1}}", + content: { + text: "Get historical volumes for account 'inj1...' with daily resolution.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Historical volumes data retrieved successfully.", + action: "GET_HISTORICAL_VOLUMES", + content: { + t: [1641859200, 1641945600], + v: [50000.5, 75000.25], + }, + }, + }, +]; + +export const getDenomHoldersExample = [ + { + user: "{{user1}}", + content: { + text: "Get holders of denom 'inj' with token address '0x...' and limit 100.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Denom holders retrieved successfully.", + action: "GET_DENOM_HOLDERS", + content: { + holders: [ + { + accountAddress: "inj1...", + balance: "1000000", + }, + ], + next: ["next_key"], + }, + }, + }, +]; + +export const getGridStrategiesExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve grid strategies with limit 100, state 'active', market ID 'market_id', market type 'uniform', subaccount ID 'subaccount_id', and account address 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Grid strategies retrieved successfully.", + action: "GET_GRID_STRATEGIES", + content: { + strategies: [ + { + id: "strategy_id", + accountAddress: "inj1...", + subaccountId: "subaccount_id", + marketId: "market_id", + strategyType: "uniform", + tickSize: "0.1", + minPrice: "24000.0", + maxPrice: "26000.0", + gridCount: 20, + state: "active", + totalVolume: "100000.5", + currentPnL: "1000.25", + createdAt: 1641859200, + updatedAt: 1641945600, + }, + ], + }, + }, + }, +]; + +export const msgInstantSpotMarketLaunchExample = [ + { + user: "{{user1}}", + content: { + text: "Instantly launch a spot market with ticker 'INJ/USDT', base denom 'inj', quote denom 'usdt', min price tick size '0.000001', and min quantity tick size '0.000001'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Instant spot market launched successfully.", + action: "MSG_INSTANT_SPOT_MARKET_LAUNCH", + content: { + marketId: "0x...", + success: true, + txHash: "0x...", + }, + }, + }, +]; + +export const getFundingPaymentsExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch funding payments for market ID '0x...' and subaccount ID '0x...' with pagination from 1 to 100 and limit 10.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Funding payments retrieved successfully.", + action: "GET_FUNDING_PAYMENTS", + content: { + fundingPayments: [ + { + marketId: "0x...", + subaccountId: "0x...", + amount: "100.5", + timestamp: 1641859200, + }, + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getPnlLeaderboardExample = [ + { + user: "{{user1}}", + content: { + text: "Get PnL leaderboard for the period from '2024-01-01' to '2024-01-31' with limit 100 and account filter 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "PnL leaderboard retrieved successfully.", + action: "GET_PNL_LEADERBOARD", + content: { + firstDate: "2024-01-01", + lastDate: "2024-01-31", + leaders: [ + { + account: "inj1...", + pnl: 100000.5, + volume: 1000000.0, + rank: 1, + }, + ], + accountRow: { + account: "inj1...", + pnl: 50000.25, + volume: 500000.0, + rank: 10, + }, + }, + }, + }, +]; + +export const getVolLeaderboardExample = [ + { + user: "{{user1}}", + content: { + text: "Get volume leaderboard for the period from '2024-01-01' to '2024-01-31' with limit 100 and account filter 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Volume leaderboard retrieved successfully.", + action: "GET_VOL_LEADERBOARD", + content: { + firstDate: "2024-01-01", + lastDate: "2024-01-31", + leaders: [ + { + account: "inj1...", + volume: 1000000.0, + rank: 1, + }, + ], + accountRow: { + account: "inj1...", + volume: 500000.0, + rank: 10, + }, + }, + }, + }, +]; + +export const getPnlLeaderboardFixedResolutionExample = [ + { + user: "{{user1}}", + content: { + text: "Get PnL leaderboard with daily resolution, limit 100, and account filter 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "PnL leaderboard with fixed resolution retrieved successfully.", + action: "GET_PNL_LEADERBOARD_FIXED_RESOLUTION", + content: { + firstDate: "2024-01-01", + lastDate: "2024-01-31", + leaders: [ + { + account: "inj1...", + pnl: 100000.5, + volume: 1000000.0, + rank: 1, + }, + ], + accountRow: { + account: "inj1...", + pnl: 50000.25, + volume: 500000.0, + rank: 10, + }, + }, + }, + }, +]; + +export const getVolLeaderboardFixedResolutionExample = [ + { + user: "{{user1}}", + content: { + text: "Get volume leaderboard with daily resolution, limit 100, and account filter 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Volume leaderboard with fixed resolution retrieved successfully.", + action: "GET_VOL_LEADERBOARD_FIXED_RESOLUTION", + content: { + firstDate: "2024-01-01", + lastDate: "2024-01-31", + leaders: [ + { + account: "inj1...", + volume: 1000000.0, + rank: 1, + }, + ], + accountRow: { + account: "inj1...", + volume: 500000.0, + rank: 10, + }, + }, + }, + }, +]; + +export const getAtomicSwapHistoryExample = [ + { + user: "{{user1}}", + content: { + text: "Get atomic swap history for address 'inj1...', contract address '0x...', with pagination from 1 to 100 and limit 10.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Atomic swap history retrieved successfully.", + action: "GET_ATOMIC_SWAP_HISTORY", + content: { + swapHistory: [ + { + sender: "inj1...", + route: "route_id", + sourceCoin: { + amount: "1000000", + denom: "inj", + }, + destinationCoin: { + amount: "900000", + denom: "usdt", + }, + fees: [ + { + amount: "1000", + denom: "inj", + }, + ], + contractAddress: "0x...", + indexBySender: 1, + indexBySenderContract: 1, + txHash: "0x...", + executedAt: 1641859200, + }, + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getIsOptedOutOfRewardsExample = [ + { + user: "{{user1}}", + content: { + text: "Check if account 'inj1...' has opted out of rewards.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Opt-out status retrieved successfully.", + action: "GET_IS_OPTED_OUT_OF_REWARDS", + content: { + isOptedOut: true, + }, + }, + }, +]; + +export const getBinaryOptionsMarketsV2Example = [ + { + user: "{{user1}}", + content: { + text: "Retrieve all binary options markets with quote denom 'usdt' and market status 'active' and 'paused'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Binary options markets retrieved successfully.", + action: "GET_BINARY_OPTIONS_MARKETS_V2", + content: { + markets: [ + { + marketId: "0x...", + marketStatus: "active", + ticker: "BTC>25000-240630", + oracleSymbol: "BTC", + oracleProvider: "band", + oracleScaleFactor: 6, + quoteDenom: "usdt", + makerFeeRate: "0.001", + takerFeeRate: "0.002", + expirationTimestamp: 1719705600, + settlementTimestamp: 1719792000, + serviceProviderFee: "0.4", + minPriceTickSize: 0.01, + minQuantityTickSize: 0.001, + }, + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getTradingRewardsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve trading rewards for account 'inj1...' and epoch 1.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Trading rewards retrieved successfully.", + action: "GET_TRADING_REWARDS", + content: { + rewards: [ + { + accountAddress: "inj1...", + rewards: [ + { + amount: "1000000", + denom: "inj", + }, + ], + distributedAt: 1641859200, + }, + ], + }, + }, + }, +]; + +export const getSubaccountOrderSummaryExample = [ + { + user: "{{user1}}", + content: { + text: "Get order summary for subaccount ID '0x...', market ID '0x...', and order direction 'buy'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Order summary retrieved successfully.", + action: "GET_SUBACCOUNT_ORDER_SUMMARY", + content: { + spotOrdersTotal: "10", + derivativeOrdersTotal: "5", + spotOrdersActiveTotal: "3", + derivativeOrdersActiveTotal: "2", + spotOrdersCancelledTotal: "5", + derivativeOrdersCancelledTotal: "2", + spotOrdersFilledTotal: "2", + derivativeOrdersFilledTotal: "1", + }, + }, + }, +]; + +export const getDerivativeMarketsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve all derivative markets", + }, + }, + { + user: "{{agent}}", + content: { + text: "Derivative markets retrieved successfully.", + action: "GET_DERIVATIVE_MARKETS", + content: { + markets: [ + { + marketId: "0x...", + marketStatus: "active", + ticker: "BTC/USDT PERP", + oracleBase: "BTC", + oracleQuote: "USDT", + quoteDenom: "usdt", + makerFeeRate: "0.001", + takerFeeRate: "0.002", + serviceProviderFee: "0.4", + isPerpetual: true, + minPriceTickSize: 0.01, + minQuantityTickSize: 0.001, + }, + ], + }, + }, + }, +]; + +export const getSpotMarketsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve all spot markets with base denom 'inj', quote denom 'usdt', market status 'active' and 'paused'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Spot markets retrieved successfully.", + action: "GET_SPOT_MARKETS", + content: { + markets: [ + { + marketId: "0x...", + marketStatus: "active", + ticker: "INJ/USDT", + baseDenom: "inj", + quoteDenom: "usdt", + makerFeeRate: "0.001", + takerFeeRate: "0.002", + serviceProviderFee: "0.4", + minPriceTickSize: 0.000001, + minQuantityTickSize: 0.000001, + }, + ], + }, + }, + }, +]; + +export const getSubaccountsListExample = [ + { + user: "{{user1}}", + content: { + text: "Get list of subaccounts for address 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Subaccounts list retrieved successfully.", + action: "GET_SUBACCOUNTS_LIST", + content: { + subaccounts: ["0x..."], + }, + }, + }, +]; + +export const getSubaccountBalancesListExample = [ + { + user: "{{user1}}", + content: { + text: "Get balances for subaccount ID '0x...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Subaccount balances retrieved successfully.", + action: "GET_SUBACCOUNT_BALANCES_LIST", + content: { + balances: [ + { + subaccountId: "0x...", + accountAddress: "inj1...", + denom: "inj", + deposit: { + totalBalance: "1000000", + availableBalance: "900000", + }, + }, + ], + }, + }, + }, +]; + +export const getDerivativeOrderbooksV2Example = [ + { + user: "{{user1}}", + content: { + text: "Get derivative orderbooks for market IDs ['0x...'].", + }, + }, + { + user: "{{agent}}", + content: { + text: "Derivative orderbooks retrieved successfully.", + action: "GET_DERIVATIVE_ORDERBOOKS_V2", + content: { + orderbooks: [ + { + marketId: "0x12...", + orderbook: { + sequence: "123", + buys: [ + { + price: "25000.5", + quantity: "1.5", + timestamp: 1641859200, + }, + ], + sells: [ + { + price: "25100.5", + quantity: "0.5", + timestamp: 1641859200, + }, + ], + }, + }, + { + marketId: "0x212...", + orderbook: { + sequence: "123", + buys: [ + { + price: "2500.5", + quantity: "1", + timestamp: 1641859201, + }, + ], + sells: [ + { + price: "2510.5", + quantity: "0.5", + timestamp: 1641859203, + }, + ], + }, + }, + ], + }, + }, + }, +]; + +export const getDerivativeOrderbookV2Example = [ + { + user: "{{user1}}", + content: { + text: "Get derivative orderbook for market ID '0x...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Derivative orderbooks retrieved successfully.", + action: "GET_DERIVATIVE_ORDERBOOK_V2", + content: { + orderbook: [ + { + marketId: "0x...", + orderbook: { + sequence: "123", + buys: [ + { + price: "25000.5", + quantity: "1.5", + timestamp: 1641859200, + }, + ], + sells: [ + { + price: "25100.5", + quantity: "0.5", + timestamp: 1641859200, + }, + ], + }, + }, + ], + }, + }, + }, +]; + +export const getSpotOrderbooksV2Example = [ + { + user: "{{user1}}", + content: { + text: "Get orderbooks for market IDs ['0x...'].", + }, + }, + { + user: "{{agent}}", + content: { + text: "Spot orderbooks retrieved successfully.", + action: "GET_SPOT_ORDERBOOKS_V2", + content: { + orderbooks: [ + { + marketId: "0x...", + orderbook: { + sequence: "123", + buys: [ + { + price: "25000.5", + quantity: "1.5", + timestamp: 1641859200, + }, + ], + sells: [ + { + price: "25100.5", + quantity: "0.5", + timestamp: 1641859200, + }, + ], + }, + }, + ], + }, + }, + }, +]; + +export const getSpotOrderbookV2Example = [ + { + user: "{{user1}}", + content: { + text: "Get spot orderbook for market ID '0x...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Spot orderbook retrieved successfully.", + action: "GET_SPOT_ORDERBOOK_V2", + content: { + orderbook: [ + { + marketId: "0x...", + orderbook: { + sequence: "123", + buys: [ + { + price: "25000.5", + quantity: "1.5", + timestamp: 1641859200, + }, + ], + sells: [ + { + price: "25100.5", + quantity: "0.5", + timestamp: 1641859200, + }, + ], + }, + }, + ], + }, + }, + }, +]; + +export const msgBatchCancelBinaryOptionsOrdersExample = [ + { + user: "{{user1}}", + content: { + text: "Batch cancel binary options orders for injective address 'inj1...' with orders [{'marketId': '0x...', 'subaccountId': '0x...', 'orderHash': '0x...'}].", + }, + }, + { + user: "{{agent}}", + content: { + text: "Batch binary options orders canceled successfully.", + action: "MSG_BATCH_CANCEL_BINARY_OPTIONS_ORDERS", + content: { + success: true, + txHash: "0x...", + }, + }, + }, +]; + +export const msgCancelBinaryOptionsOrderExample = [ + { + user: "{{user1}}", + content: { + text: "Cancel binary options order with order hash '0x...' for injective address 'inj1...', market ID '0x...', and subaccount ID '0x...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Binary options order canceled successfully.", + action: "MSG_CANCEL_BINARY_OPTIONS_ORDER", + content: { + success: true, + txHash: "0x...", + }, + }, + }, +]; + +export const msgCreateBinaryOptionsLimitOrderExample = [ + { + user: "{{user1}}", + content: { + text: "Create a binary options limit order to BUY 1.5 BTC>25000-240630 at price 25000.5 for subaccount '0x...' with fee recipient 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Binary options limit order created successfully.", + action: "MSG_CREATE_BINARY_OPTIONS_LIMIT_ORDER", + content: { + orderHash: "0x...", + txHash: "0x...", + }, + }, + }, +]; + +export const msgLiquidatePositionExample = [ + { + user: "{{user1}}", + content: { + text: "Liquidate position for subaccount '0x...' in market '0x...' with order { marketId: '0x...', orderType: 'SELL', price: '24000.0', quantity: '1.5', margin: '1000' }.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Position liquidated successfully.", + action: "MSG_LIQUIDATE_POSITION", + content: { + success: true, + txHash: "0x...", + }, + }, + }, +]; + +export const msgReclaimLockedFundsExample = [ + { + user: "{{user1}}", + content: { + text: "Reclaim locked funds for injective address 'inj1...' with locked account public key '0x...' and signature '0x...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Locked funds reclaimed successfully.", + action: "MSG_RECLAIM_LOCKED_FUNDS", + content: { + success: true, + txHash: "0x...", + }, + }, + }, +]; + +export const msgSignDataExample = [ + { + user: "{{user1}}", + content: { + text: "Sign data '0x...' for injective address 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Data signed successfully.", + action: "MSG_SIGN_DATA", + content: { + signature: "0x...", + success: true, + txHash: "0x...", + }, + }, + }, +]; + +export const msgCreateSpotLimitOrderExample = [ + { + user: "{{user1}}", + content: { + text: "Create a spot limit order to BUY 1.5 INJ at price 25000.5 for subaccount '0x...' with fee recipient 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Spot limit order created successfully.", + action: "MSG_CREATE_SPOT_LIMIT_ORDER", + content: { + orderHash: "0x...", + txHash: "0x...", + }, + }, + }, +]; + +export const msgCreateDerivativeLimitOrderExample = [ + { + user: "{{user1}}", + content: { + text: "Create a derivative limit order to BUY 1.5 BTC/USDT PERP at price 25000.5 with margin 1000 for subaccount '0x...' and fee recipient 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Derivative limit order created successfully.", + action: "MSG_CREATE_DERIVATIVE_LIMIT_ORDER", + content: { + orderHash: "0x...", + txHash: "0x...", + }, + }, + }, +]; + +export const msgBatchCancelSpotOrdersExample = [ + { + user: "{{user1}}", + content: { + text: "Batch cancel spot orders for injective address 'inj1...' with orders [{'marketId': '0x...', 'subaccountId': '0x...', 'orderHash': '0x...'}].", + }, + }, + { + user: "{{agent}}", + content: { + text: "Batch spot orders canceled successfully.", + action: "MSG_BATCH_CANCEL_SPOT_ORDERS", + content: { + success: true, + txHash: "0x...", + }, + }, + }, +]; + +export const msgBatchCancelDerivativeOrdersExample = [ + { + user: "{{user1}}", + content: { + text: "Batch cancel derivative orders for injective address 'inj1...' with orders [{'marketId': '0x...', 'subaccountId': '0x...', 'orderHash': '0x...'}].", + }, + }, + { + user: "{{agent}}", + content: { + text: "Batch derivative orders canceled successfully.", + action: "MSG_BATCH_CANCEL_DERIVATIVE_ORDERS", + content: { + success: true, + txHash: "0x...", + }, + }, + }, +]; + +export const msgCancelSpotOrderExample = [ + { + user: "{{user1}}", + content: { + text: "Cancel spot order with order hash '0x...' for injective address 'inj1...', market ID '0x...', and subaccount ID '0x...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Spot order canceled successfully.", + action: "MSG_CANCEL_SPOT_ORDER", + content: { + success: true, + txHash: "0x...", + }, + }, + }, +]; + +export const msgCancelDerivativeOrderExample = [ + { + user: "{{user1}}", + content: { + text: "Cancel derivative order with order hash '0x...' for injective address 'inj1...', market ID '0x...', and subaccount ID '0x...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Derivative order canceled successfully.", + action: "MSG_CANCEL_DERIVATIVE_ORDER", + content: { + success: true, + txHash: "0x...", + }, + }, + }, +]; + +export const getSpotSubaccountOrdersListExample = [ + { + user: "{{user1}}", + content: { + text: "Get spot orders list for subaccount ID '0x...', market ID '0x...', with pagination from 1 to 100 and limit 10.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Spot subaccount orders list retrieved successfully.", + action: "GET_SPOT_SUBACCOUNT_ORDERS_LIST", + content: { + orders: [ + { + orderHash: "0x...", + orderSide: "buy", + marketId: "0x...", + subaccountId: "0x...", + price: "25000.5", + quantity: "1.5", + unfilledQuantity: "0.5", + triggerPrice: "0", + feeRecipient: "inj1...", + state: "booked", + createdAt: 1641859200, + updatedAt: 1641859200, + }, + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getSpotSubaccountTradesListExample = [ + { + user: "{{user1}}", + content: { + text: "Get spot trades list for subaccount ID '0x...', market ID '0x...', direction 'buy', execution type 'market', with pagination from 1 to 100 and limit 10.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Spot subaccount trades list retrieved successfully.", + action: "GET_SPOT_SUBACCOUNT_TRADES_LIST", + content: { + trades: [ + { + orderHash: "0x...", + subaccountId: "0x...", + marketId: "0x...", + tradeId: "trade_id", + executedAt: 1641859200, + executionSide: "taker", + tradeExecutionType: "market", + tradeDirection: "buy", + price: "25000.5", + quantity: "1.5", + fee: "25.0", + feeRecipient: "inj1...", + }, + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const msgCreateBinaryOptionsMarketOrderExample = [ + { + user: "{{user1}}", + content: { + text: "Create a binary options market order to BUY 1.5 BTC>25000-240630 at price 25000.5 for subaccount '0x...' with fee recipient 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Binary options market order created successfully.", + action: "MSG_CREATE_BINARY_OPTIONS_MARKET_ORDER", + content: { + orderHash: "0x...", + txHash: "0x...", + }, + }, + }, +]; + +export const getSpotOrderHistoryExample = [ + { + user: "{{user1}}", + content: { + text: "Get spot order history for subaccount ID '0x...', market ID '0x...', market IDs ['0x...'], order types ['limit', 'market'], execution types ['limit', 'market'], direction 'buy', is conditional false, state 'booked', with pagination from 1 to 100 and limit 10.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Spot order history retrieved successfully.", + action: "GET_SPOT_ORDER_HISTORY", + content: { + orderHistory: [ + { + orderHash: "0x...", + marketId: "0x...", + active: true, + subaccountId: "0x...", + executionType: "limit", + orderType: "buy", + price: "25000.5", + triggerPrice: "0", + quantity: "1.5", + filledQuantity: "0.5", + state: "booked", + createdAt: 1641859200, + updatedAt: 1641859200, + direction: "buy", + }, + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getSpotTradesExample = [ + { + user: "{{user1}}", + content: { + text: "Get spot trades for market IDs ['0x...'], subaccount ID '0x...', execution side 'taker', direction 'buy', execution types ['market', 'limit'], with pagination from 1 to 100 and limit 10.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Spot trades retrieved successfully.", + action: "GET_SPOT_TRADES", + content: { + trades: [ + { + orderHash: "0x...", + subaccountId: "0x...", + marketId: "0x...", + tradeId: "trade_id", + executedAt: 1641859200, + executionSide: "taker", + tradeExecutionType: "market", + tradeDirection: "buy", + price: "25000.5", + quantity: "1.5", + fee: "25.0", + feeRecipient: "inj1...", + }, + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getAccountPortfolioBalancesExample = [ + { + user: "{{user1}}", + content: { + text: "Get account portfolio balances for address 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Account portfolio balances retrieved successfully.", + action: "GET_ACCOUNT_PORTFOLIO_BALANCES", + content: { + balances: [ + { + denom: "inj", + totalBalance: "1000000", + availableBalance: "900000", + lockedBalance: "100000", + }, + ], + subaccountBalances: [ + { + subaccountId: "0x...", + denom: "inj", + deposit: { + totalBalance: "1000000", + availableBalance: "900000", + }, + }, + ], + }, + }, + }, +]; + +export const getRewardsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve rewards for account 'inj1...' and epoch 1.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Rewards retrieved successfully.", + action: "GET_REWARDS", + content: { + rewards: [ + { + accountAddress: "inj1...", + rewards: [ + { + amount: "1000000", + denom: "inj", + }, + ], + distributedAt: 1641859200, + }, + ], + }, + }, + }, +]; + +export const getDerivativeOrderHistoryExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve derivative order history for subaccount ID '0x...', market ID '0x...', multiple market IDs ['0x...', '0x...'], order types ['limit', 'market'], execution types ['limit', 'market'], direction 'buy', non-conditional, state 'booked', with pagination from 1 to 100 and limit 10.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Derivative order history retrieved successfully.", + action: "GET_DERIVATIVE_ORDER_HISTORY", + content: { + orderHistory: [ + { + orderHash: "0xabc123...", + marketId: "0xmarket1...", + isActive: true, + subaccountId: "0xsubaccount1...", + executionType: "limit", + orderType: "buy", + price: "25000.5", + triggerPrice: "0", + quantity: "1.5", + filledQuantity: "0.5", + state: "booked", + createdAt: 1641859200, + updatedAt: 1641859200, + direction: "buy", + isConditional: false, + triggerAt: 0, + margin: "1000", + }, + // ...additional order history entries + ], + pagination: { + total: 50, + }, + }, + }, + }, +]; + +export const getDerivativeTradesExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch derivative trades for market ID '0x...', multiple market IDs ['0x...', '0x...'], subaccount ID '0x...', execution side 'taker', direction 'buy', execution types ['market', 'limit'], with pagination from 1 to 100 and limit 10.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Derivative trades retrieved successfully.", + action: "GET_DERIVATIVE_TRADES", + content: { + trades: [ + { + orderHash: "0xabc123...", + subaccountId: "0xsubaccount1...", + marketId: "0xmarket1...", + tradeId: "trade_001", + executedAt: 1641859200, + tradeExecutionType: "market", + executionSide: "taker", + tradeDirection: "buy", + executionPrice: "25000.5", + executionQuantity: "1.5", + executionMargin: "1000", + fee: "25.0", + feeRecipient: "inj1...", + isLiquidation: false, + payout: "37525.75", + }, + ], + pagination: { + total: 30, + }, + }, + }, + }, +]; + +export const getOrderStatesExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve order states for subaccount ID '0x...', market ID '0x...', with order hashes ['0xorder1...', '0xorder2...'].", + }, + }, + { + user: "{{agent}}", + content: { + text: "Order states retrieved successfully.", + action: "GET_ORDER_STATES", + content: { + orders: [ + { + orderHash: "0xorder1...", + state: "filled", + filledQuantity: "1.0", + remainingQuantity: "0.0", + filledAt: 1641859200, + }, + { + orderHash: "0xorder2...", + state: "cancelled", + filledQuantity: "0.0", + remainingQuantity: "2.0", + filledAt: 0, + }, + ], + }, + }, + }, +]; + +export const msgIncreasePositionMarginExample = [ + { + user: "{{user1}}", + content: { + text: "Increase position margin by 1,000 INJ for subaccount '0x...', market ID '0x...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Position margin increased successfully.", + action: "MSG_INCREASE_POSITION_MARGIN", + content: { + success: true, + txHash: "0xdef456...", + }, + }, + }, +]; + +export const msgRewardsOptOutExample = [ + { + user: "{{user1}}", + content: { + text: "Opt out of trading rewards for account 'inj1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Successfully opted out of rewards.", + action: "MSG_REWARDS_OPT_OUT", + content: { + success: true, + txHash: "0xghi789...", + }, + }, + }, +]; + +export const msgExternalTransferExample = [ + { + user: "{{user1}}", + content: { + text: "Transfer 1,000,000 INJ from subaccount '0xsource...' to subaccount '0xdestination...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "External transfer completed successfully.", + action: "MSG_EXTERNAL_TRANSFER", + content: { + success: true, + txHash: "0xjkl012...", + }, + }, + }, +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/examples/explorer.ts b/packages/plugin-injective/injective-sdk-client-ts/src/examples/explorer.ts new file mode 100644 index 00000000000..ba205aa6674 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/examples/explorer.ts @@ -0,0 +1,359 @@ +export const getTxByHashExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve transaction details for hash 0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Transaction details retrieved successfully.", + action: "GET_TX_BY_HASH", + content: { + id: "tx_id_12345", + blockNumber: 12345, + blockTimestamp: "2024-01-11T12:00:00Z", + hash: "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890", + memo: "Payment for services", + code: 0, + data: "base64EncodedDataHere", + info: "Transaction executed successfully", + gasWanted: 100000, + gasUsed: 80000, + gasFee: { + amounts: [ + { + amount: "1000000", + denom: "inj", + }, + ], + gasLimit: 100000, + payer: "inj1payeraddress...", + granter: "inj1granteraddress...", + }, + txType: "MsgSend", + signatures: [ + { + pubkey: "cosmospub1addwnpepq...", + address: "inj1senderaddress...", + signature: "signatureDataHere", + sequence: 5, + }, + ], + messages: [ + { + key: "recipient", + value: "inj1recipientaddress...", + }, + ], + }, + }, + }, +]; + +export const getAccountTxExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve the latest 10 transactions for account address inj1accountaddress...", + }, + }, + { + user: "{{agent}}", + content: { + text: "Account transactions retrieved successfully.", + action: "GET_ACCOUNT_TX", + content: { + txs: [ + { + id: "tx_id_12345", + blockNumber: 12345, + blockTimestamp: "2024-01-11T12:00:00Z", + hash: "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890", + txType: "MsgSend", + }, + // ...additional transactions + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getValidatorExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve details for validator address injvaloper1validatoraddress...", + }, + }, + { + user: "{{agent}}", + content: { + text: "Validator details retrieved successfully.", + action: "GET_EXPLORER_VALIDATOR", + content: { + id: "validator_id_123", + moniker: "ValidatorMoniker", + operatorAddress: "injvaloper1validatoraddress...", + consensusAddress: "injvalcons1validatorconsensus...", + jailed: false, + status: 1, + tokens: "1000000000", + delegatorShares: "1000000000", + description: { + moniker: "ValidatorMoniker", + identity: "validatorIdentity", + website: "https://validatorwebsite.com", + securityContact: "security@validator.com", + details: "Detailed description of the validator.", + }, + uptimePercentage: 99.9, + commissionRate: "0.1", + commissionMaxRate: "0.2", + commissionMaxChangeRate: "0.01", + }, + }, + }, +]; + +export const getValidatorUptimeExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve uptime details for validator address injvaloper1validatoraddress...", + }, + }, + { + user: "{{agent}}", + content: { + text: "Validator uptime details retrieved successfully.", + action: "GET_VALIDATOR_UPTIME", + content: [ + { + blockNumber: 12345, + status: "signed", + }, + { + blockNumber: 12346, + status: "missed", + }, + // ...additional uptime records + ], + }, + }, +]; + +export const getPeggyDepositTxsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve Peggy deposit transactions for sender eth1senderaddress and receiver inj1receiveraddress...", + }, + }, + { + user: "{{agent}}", + content: { + text: "Peggy deposit transactions retrieved successfully.", + action: "GET_PEGGY_DEPOSIT_TXS", + content: [ + { + sender: "eth1senderaddress", + receiver: "inj1receiveraddress", + eventNonce: 123, + eventHeight: 12345, + amount: "1000000000", + denom: "peggy0xabcdef", + orchestratorAddress: "inj1orchestratoraddress", + state: "completed", + txHashesList: [ + "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890", + ], + }, + // ...additional deposit transactions + ], + }, + }, +]; + +export const getPeggyWithdrawalTxsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve Peggy withdrawal transactions for sender inj1senderaddress and receiver eth1receiveraddress...", + }, + }, + { + user: "{{agent}}", + content: { + text: "Peggy withdrawal transactions retrieved successfully.", + action: "GET_PEGGY_WITHDRAWAL_TXS", + content: [ + { + sender: "inj1senderaddress", + receiver: "eth1receiveraddress", + amount: "1000000000", + denom: "peggy0xabcdef", + bridgeFee: "1000000", + outgoingTxId: 123, + batchTimeout: 100, + batchNonce: 5, + state: "completed", + txHashesList: [ + "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890", + ], + }, + // ...additional withdrawal transactions + ], + }, + }, +]; + +export const getBlocksExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve the latest 10 blocks before block number 12345 and after block number 12300...", + }, + }, + { + user: "{{agent}}", + content: { + text: "Blocks retrieved successfully.", + action: "GET_BLOCKS", + content: { + blocks: [ + { + height: 12345, + proposer: "injvaloper1proposeraddress...", + moniker: "ProposerMoniker", + blockHash: "0xblockhash1234567890abcdef...", + parentHash: "0xparenthash1234567890abcdef...", + numPreCommits: 150, + numTxs: 10, + timestamp: "2024-01-11T12:00:00Z", + }, + // ...additional blocks + ], + }, + }, + }, +]; + +export const getBlockExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve details for block with height 12345.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Block details retrieved successfully.", + action: "GET_BLOCK", + content: { + block: { + height: 12345, + proposer: "injvaloper1proposeraddress...", + moniker: "ProposerMoniker", + blockHash: "0xblockhash1234567890abcdef...", + parentHash: "0xparenthash1234567890abcdef...", + numPreCommits: 150, + numTxs: 10, + timestamp: "2024-01-11T12:00:00Z", + }, + }, + }, + }, +]; + +export const getTxsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve transactions of type MsgSend from the bank module between block numbers 12300 and 12345, limited to 10 results.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Transactions retrieved successfully.", + action: "GET_TXS", + content: { + transactions: [ + { + id: "tx_id_12345", + blockNumber: 12345, + blockTimestamp: "2024-01-11T12:00:00Z", + hash: "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890", + txType: "MsgSend", + }, + // ...additional transactions + ], + }, + }, + }, +]; + +export const getIBCTransferTxsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve IBC transfer transactions sent by inj1senderaddress to cosmos1receiveraddress through source channel channel-1 and destination channel channel-0, limited to 10 results.", + }, + }, + { + user: "{{agent}}", + content: { + text: "IBC transfer transactions retrieved successfully.", + action: "GET_IBC_TRANSFER_TXS", + content: [ + { + sender: "inj1senderaddress", + receiver: "cosmos1receiveraddress", + sourcePort: "transfer", + sourceChannel: "channel-1", + destinationPort: "transfer", + destinationChannel: "channel-0", + amount: "1000000000", + denom: "inj", + timeoutHeight: "1-1000000", + timeoutTimestamp: 1641945600, + state: "completed", + }, + // ...additional IBC transfer transactions + ], + }, + }, +]; + +export const getExplorerStatsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve the latest explorer statistics.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Explorer statistics retrieved successfully.", + action: "GET_EXPLORER_STATS", + content: { + assets: "1000", + txsTotal: "1000000", + addresses: "50000", + injSupply: "100000000", + txsInPast30Days: "100000", + txsInPast24Hours: "10000", + blockCountInPast24Hours: "5000", + txsPerSecondInPast24Hours: "0.5", + txsPerSecondInPast100Blocks: "0.8", + }, + }, + }, +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/examples/gov.ts b/packages/plugin-injective/injective-sdk-client-ts/src/examples/gov.ts new file mode 100644 index 00000000000..a0c93c275ac --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/examples/gov.ts @@ -0,0 +1,373 @@ +export const getGovernanceModuleParamsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve governance module parameters, including votingParams, tallyParams, and depositParams.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Governance module parameters retrieved successfully.", + action: "GET_GOVERNANCE_MODULE_PARAMS", + content: { + votingParams: { + votingPeriod: 604800, + }, + tallyParams: { + quorum: "0.334", + threshold: "0.5", + vetoThreshold: "0.334", + }, + depositParams: { + minDepositList: [ + { + denom: "inj", + amount: "100000000000000000000", + }, + ], + maxDepositPeriod: 1209600, + }, + }, + }, + }, +]; + +export const getProposalsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve proposals with status 2 and paginate the results with a limit of 100.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Proposals retrieved successfully.", + action: "GET_PROPOSALS", + content: { + proposals: [ + { + proposalId: 1, + title: "Example Proposal", + summary: "This is an example proposal", + proposer: "inj1proposeraddress...", + status: 2, + finalTallyResult: { + yesCount: "100", + abstainCount: "10", + noCount: "5", + noWithVetoCount: "2", + }, + submitTime: 1632150400, + depositEndTime: 1633360000, + votingStartTime: 1633360000, + votingEndTime: 1633964800, + totalDeposits: [ + { + denom: "inj", + amount: "100000000000000000000", + }, + ], + }, + // ...additional proposals + ], + pagination: { + nextKey: "", + total: 100, + }, + }, + }, + }, +]; + +export const getProposalExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve details for proposal with ID 1.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Proposal details retrieved successfully.", + action: "GET_PROPOSAL", + content: { + proposalId: 1, + title: "Example Proposal", + summary: "This is an example proposal", + proposer: "inj1proposeraddress...", + status: 2, + finalTallyResult: { + yesCount: "100", + abstainCount: "10", + noCount: "5", + noWithVetoCount: "2", + }, + submitTime: 1632150400, + depositEndTime: 1633360000, + votingStartTime: 1633360000, + votingEndTime: 1633964800, + totalDeposits: [ + { + denom: "inj", + amount: "100000000000000000000", + }, + ], + }, + }, + }, +]; + +export const getProposalDepositsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve deposits for proposal ID 1 with pagination parameters.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Proposal deposits retrieved successfully.", + action: "GET_PROPOSAL_DEPOSITS", + content: { + deposits: [ + { + depositor: "inj1depositoraddress...", + amounts: [ + { + denom: "inj", + amount: "100000000000000000000", + }, + ], + }, + // ...additional deposits + ], + pagination: { + nextKey: "", + total: 10, + }, + }, + }, + }, +]; + +export const getProposalVotesExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve votes for proposal ID 1 with pagination parameters.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Proposal votes retrieved successfully.", + action: "GET_PROPOSAL_VOTES", + content: { + votes: [ + { + proposalId: 1, + voter: "inj1voteraddress...", + options: [ + { + option: 1, + weight: "1.0", + }, + ], + metadata: "", + }, + // ...additional votes + ], + pagination: { + nextKey: "", + total: 100, + }, + }, + }, + }, +]; + +export const getProposalTallyExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve tally results for proposal ID 1.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Proposal tally retrieved successfully.", + action: "GET_PROPOSAL_TALLY", + content: { + yesCount: "100", + abstainCount: "10", + noCount: "5", + noWithVetoCount: "2", + }, + }, + }, +]; + +export const msgSubmitProposalExpiryFuturesMarketLaunchExample = [ + { + user: "{{user1}}", + content: { + text: "Submit an expiry futures market launch proposal titled 'Launch BTC-USDT Quarterly Futures'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Expiry futures market launch proposal submitted successfully.", + action: "MSG_SUBMIT_PROPOSAL_EXPIRY_FUTURES_MARKET_LAUNCH", + content: { + txHash: "0xsubmitproposalexpiryfutureshash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgSubmitProposalSpotMarketLaunchExample = [ + { + user: "{{user1}}", + content: { + text: "Submit a spot market launch proposal titled 'Launch INJ-USDT Spot Market'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Spot market launch proposal submitted successfully.", + action: "MSG_SUBMIT_PROPOSAL_SPOT_MARKET_LAUNCH", + content: { + txHash: "0xsubmitproposalspotmarkethash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgSubmitProposalPerpetualMarketLaunchExample = [ + { + user: "{{user1}}", + content: { + text: "Submit a perpetual market launch proposal titled 'Launch ETH-USDT Perpetual'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Perpetual market launch proposal submitted successfully.", + action: "MSG_SUBMIT_PROPOSAL_PERPETUAL_MARKET_LAUNCH", + content: { + txHash: "0xsubmitproposalperpetualmarkethash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgVoteExample = [ + { + user: "{{user1}}", + content: { + text: "Submit a vote for proposal ID 1 with option 1 and weight 1.0.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Vote submitted successfully.", + action: "MSG_VOTE", + content: { + txHash: "0xvotehash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgSubmitTextProposalExample = [ + { + user: "{{user1}}", + content: { + text: "Submit a text proposal titled 'Community Pool Spend'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Text proposal submitted successfully.", + action: "MSG_SUBMIT_TEXT_PROPOSAL", + content: { + txHash: "0xsubmittextproposalhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgSubmitProposalSpotMarketParamUpdateExample = [ + { + user: "{{user1}}", + content: { + text: "Submit a spot market parameter update proposal titled 'Update INJ-USDT Spot Market Parameters'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Spot market parameter update proposal submitted successfully.", + action: "MSG_SUBMIT_PROPOSAL_SPOT_MARKET_PARAM_UPDATE", + content: { + txHash: "0xsubmitproposalspotmarketparamupdatehash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgSubmitGenericProposalExample = [ + { + user: "{{user1}}", + content: { + text: "Submit a generic governance proposal titled 'Generic Proposal'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Generic governance proposal submitted successfully.", + action: "MSG_SUBMIT_GENERIC_PROPOSAL", + content: { + txHash: "0xsubmitgenericproposalhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgGovDepositExample = [ + { + user: "{{user1}}", + content: { + text: "Deposit 100 INJ to proposal ID 1.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Deposit to proposal submitted successfully.", + action: "MSG_GOV_DEPOSIT", + content: { + txHash: "0xgovdeposithash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/examples/ibc.ts b/packages/plugin-injective/injective-sdk-client-ts/src/examples/ibc.ts new file mode 100644 index 00000000000..5c66323dbcd --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/examples/ibc.ts @@ -0,0 +1,102 @@ +export const getDenomTraceExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve the denomination trace for hash transfer/channel-0/uatom.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Denomination trace retrieved successfully.", + action: "GET_DENOM_TRACE", + content: { + denomTrace: { + path: "transfer/channel-0", + baseDenom: "uatom", + }, + }, + }, + }, +]; + +export const getDenomsTraceExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve all denomination traces with a limit of 100.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Denomination traces retrieved successfully.", + action: "GET_DENOMS_TRACE", + content: { + denomsTrace: [ + { + path: "transfer/channel-0", + baseDenom: "uatom", + }, + { + path: "transfer/channel-1", + baseDenom: "uosmo", + }, + // ...additional denom traces + ], + }, + }, + }, +]; + +export const getIBCTransferTxsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve IBC transfer transactions sent by inj1senderaddress... to cosmos1receiveraddress... through source channel channel-0 and destination channel channel-1, limited to 10 results.", + }, + }, + { + user: "{{agent}}", + content: { + text: "IBC transfer transactions retrieved successfully.", + action: "GET_IBC_TRANSFER_TXS", + content: [ + { + sender: "inj1senderaddress...", + receiver: "cosmos1receiveraddress...", + eventNonce: 123, + eventHeight: 12345, + amount: "1000000000", + denom: "peggy0xabcdef...", + orchestratorAddress: "inj1orchestratoraddress...", + state: "completed", + txHashesList: [ + "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890", + ], + }, + // ...additional IBC transfer transactions + ], + }, + }, +]; + +export const msgIBCTransferExample = [ + { + user: "{{user1}}", + content: { + text: "Perform an IBC transfer of 1,000,000,000 peggy0xabcdef... from inj1senderaddress... to cosmos1receiveraddress... via port transfer and channel channel-0 with a timeout of 300 seconds.", + }, + }, + { + user: "{{agent}}", + content: { + text: "IBC transfer submitted successfully.", + action: "MSG_IBC_TRANSFER", + content: { + txHash: "0xibctransferhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/examples/insurance.ts b/packages/plugin-injective/injective-sdk-client-ts/src/examples/insurance.ts new file mode 100644 index 00000000000..9180eb017cf --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/examples/insurance.ts @@ -0,0 +1,210 @@ +// ======================================= +// Insurance Fund Module +// ======================================= + +export const getInsuranceModuleParamsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve insurance module parameters, including the default redemption notice period duration.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Insurance module parameters retrieved successfully.", + action: "GET_INSURANCE_MODULE_PARAMS", + content: { + defaultRedemptionNoticePeriodDuration: 1209600, + }, + }, + }, +]; + +export const getInsuranceFundsExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch all insurance funds.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Insurance funds retrieved successfully.", + action: "GET_INSURANCE_FUNDS", + content: { + insuranceFunds: [ + { + depositDenom: "inj", + insurancePoolTokenDenom: "share1", + redemptionNoticePeriodDuration: 1209600, + balance: "1000000000000000000", + totalShare: "1000000000000000000", + marketId: "0x1234abcd...", + marketTicker: "BTC/USDT", + oracleBase: "BTC", + oracleQuote: "USDT", + oracleType: 1, + expiry: 1640995200, + }, + { + depositDenom: "inj", + insurancePoolTokenDenom: "share2", + redemptionNoticePeriodDuration: 1209600, + balance: "500000000000000000", + totalShare: "500000000000000000", + marketId: "0x5678efgh...", + marketTicker: "ETH/USDT", + oracleBase: "ETH", + oracleQuote: "USDT", + oracleType: 1, + expiry: 1643587200, + }, + // ...additional insurance funds + ], + }, + }, + }, +]; + +export const getInsuranceFundExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve details for the insurance fund with market ID 0x1234abcd...", + }, + }, + { + user: "{{agent}}", + content: { + text: "Insurance fund details retrieved successfully.", + action: "GET_INSURANCE_FUND", + content: { + depositDenom: "inj", + insurancePoolTokenDenom: "share1", + redemptionNoticePeriodDuration: 1209600, + balance: "1000000000000000000", + totalShare: "1000000000000000000", + marketId: "0x1234abcd...", + marketTicker: "BTC/USDT", + oracleBase: "BTC", + oracleQuote: "USDT", + oracleType: 1, + expiry: 1640995200, + }, + }, + }, +]; + +export const getEstimatedRedemptionsExample = [ + { + user: "{{user1}}", + content: { + text: "Get estimated redemptions for market ID 0x1234abcd... and address inj1useraddress...", + }, + }, + { + user: "{{agent}}", + content: { + text: "Estimated redemptions retrieved successfully.", + action: "GET_ESTIMATED_REDEMPTIONS", + content: { + amounts: [ + { + amount: "1000000000000000000", + denom: "inj", + }, + { + amount: "500000000000000000", + denom: "share1", + }, + ], + }, + }, + }, +]; + +export const getPendingRedemptionsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve pending redemptions for market ID 0x1234abcd... and address inj1useraddress...", + }, + }, + { + user: "{{agent}}", + content: { + text: "Pending redemptions retrieved successfully.", + action: "GET_PENDING_REDEMPTIONS", + content: { + amounts: [ + { + amount: "500000000000000000", + denom: "inj", + }, + ], + }, + }, + }, +]; + +export const msgCreateInsuranceFundExample = [ + { + user: "{{user1}}", + content: { + text: "Create a new insurance fund with market ID 0x1234abcd..., ticker 'BTC/USDT', and an initial deposit of 1,000,000,000 inj.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Insurance fund creation submitted successfully.", + action: "MSG_CREATE_INSURANCE_FUND", + content: { + txHash: "0xcreateinsurancefundhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgRequestRedemptionExample = [ + { + user: "{{user1}}", + content: { + text: "Request a redemption of 1,000,000,000 share1 from insurance fund with market ID 0x1234abcd...", + }, + }, + { + user: "{{agent}}", + content: { + text: "Redemption request submitted successfully.", + action: "MSG_REQUEST_REDEMPTION", + content: { + txHash: "0xrequestredemptionhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgUnderwriteExample = [ + { + user: "{{user1}}", + content: { + text: "Underwrite 1,000,000,000 inj to insurance fund with market ID 0x1234abcd...", + }, + }, + { + user: "{{agent}}", + content: { + text: "Underwriting submitted successfully.", + action: "MSG_UNDERWRITE", + content: { + txHash: "0xunderwritehash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/examples/mint.ts b/packages/plugin-injective/injective-sdk-client-ts/src/examples/mint.ts new file mode 100644 index 00000000000..6eb148c2682 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/examples/mint.ts @@ -0,0 +1,65 @@ +// ======================================= +// Mint Module +// ======================================= + +export const getMintModuleParamsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve mint module parameters, including mintDenom, inflationRateChange, inflationMax, inflationMin, goalBonded, and blocksPerYear.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Mint module parameters retrieved successfully.", + action: "GET_MINT_MODULE_PARAMS", + content: { + mintDenom: "inj", + inflationRateChange: "0.130000000000000000", + inflationMax: "0.200000000000000000", + inflationMin: "0.070000000000000000", + goalBonded: "0.670000000000000000", + blocksPerYear: "6311520", + }, + }, + }, +]; + +export const getInflationExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve the current inflation rate.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Current inflation rate retrieved successfully.", + action: "GET_INFLATION", + content: { + inflation: "0.130000000000000000", + }, + }, + }, +]; + +export const getAnnualProvisionsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve the current annual provisions.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Annual provisions retrieved successfully.", + action: "GET_ANNUAL_PROVISIONS", + content: { + annualProvisions: "5000000000000000000000000", + }, + }, + }, +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/examples/mito.ts b/packages/plugin-injective/injective-sdk-client-ts/src/examples/mito.ts new file mode 100644 index 00000000000..19105e266ef --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/examples/mito.ts @@ -0,0 +1,1232 @@ +// ======================================= +// Mito Module +// ======================================= + +export const getVaultExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve details for the vault with contract address inj1... and slug 'vault-slug'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Vault details retrieved successfully.", + action: "GET_VAULT", + content: { + contractAddress: "inj1...", + codeId: "1", + vaultName: "Example Vault", + marketId: "0x123...", + currentTvl: 1000000, + profits: { + allTimeChange: 10.5, + threeMonthsChange: 5.2, + oneMonthChange: 2.1, + oneDayChange: 0.5, + oneWeekChange: 1.2, + oneYearChange: 15.3, + threeYearsChange: 45.6, + sixMonthsChange: 8.4, + }, + updatedAt: 1632150400, + vaultType: "perpetual", + lpTokenPrice: 1.05, + subaccountInfo: { + subaccountId: "0x123...", + balancesList: [ + { + denom: "inj", + totalBalance: "1000000000", + }, + ], + }, + masterContractAddress: "inj1...", + totalLpAmount: "1000000", + slug: "vault-slug", + createdAt: 1632150400, + notionalValueCap: "10000000", + tvlChanges: { + allTimeChange: 20.5, + }, + apy: 15.2, + apy7D: 14.8, + apy7DFq: 14.9, + apyue: 15.0, + apyV3: 15.1, + registrationMode: "open", + }, + }, + }, +]; + +export const getVaultsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve the latest 10 vaults with code ID 1.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Vaults retrieved successfully.", + action: "GET_VAULTS", + content: { + vaults: [ + { + contractAddress: "inj1...", + vaultName: "Example Vault", + currentTvl: 1000000, + lpTokenPrice: 1.05, + apy: 15.2, + }, + { + contractAddress: "inj2...", + vaultName: "Another Vault", + currentTvl: 500000, + lpTokenPrice: 1.1, + apy: 14.5, + }, + // ...additional vaults + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getLpTokenPriceChartExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve LP token price chart for vault address inj1... from timestamp 1633360000 to 1640995200.", + }, + }, + { + user: "{{agent}}", + content: { + text: "LP token price chart retrieved successfully.", + action: "GET_LP_TOKEN_PRICE_CHART", + content: { + priceSnapshots: [ + { + price: 1.05, + updatedAt: 1633360000, + }, + { + price: 1.06, + updatedAt: 1633446400, + }, + // ...additional price snapshots + ], + }, + }, + }, +]; + +export const getTVLChartExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve TVL chart for vault address inj1... from timestamp 1633360000 to 1640995200.", + }, + }, + { + user: "{{agent}}", + content: { + text: "TVL chart retrieved successfully.", + action: "GET_TVL_CHART", + content: { + priceSnapshots: [ + { + price: 1000000, + updatedAt: 1633360000, + }, + { + price: 1005000, + updatedAt: 1633446400, + }, + // ...additional TVL snapshots + ], + }, + }, + }, +]; + +export const getVaultsByHolderAddressExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve vaults subscribed by holder address inj1... with vault address inj1..., skipping 0 and limiting to 10 records.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Vaults by holder address retrieved successfully.", + action: "GET_VAULTS_BY_HOLDER_ADDRESS", + content: { + subscriptions: [ + { + vaultInfo: { + contractAddress: "inj1...", + vaultName: "Example Vault", + currentTvl: 1000000, + }, + lpAmount: "1000000", + holderAddress: "inj1...", + lpAmountPercentage: 0.1, + }, + { + vaultInfo: { + contractAddress: "inj2...", + vaultName: "Another Vault", + currentTvl: 500000, + }, + lpAmount: "500000", + holderAddress: "inj1...", + lpAmountPercentage: 0.05, + }, + // ...additional subscriptions + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getLPHoldersExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve LP holders for vault address inj1... and staking contract address inj1..., skipping 0 and limiting to 10 records.", + }, + }, + { + user: "{{agent}}", + content: { + text: "LP holders retrieved successfully.", + action: "GET_LP_HOLDERS", + content: { + holders: [ + { + holderAddress: "inj1...", + vaultAddress: "inj1...", + amount: "1000000", + updatedAt: 1633360000, + lpAmountPercentage: 0.1, + redemptionLockTime: "1640995200", + stakedAmount: "500000", + }, + { + holderAddress: "inj2...", + vaultAddress: "inj1...", + amount: "500000", + updatedAt: 1633446400, + lpAmountPercentage: 0.05, + redemptionLockTime: "1643587200", + stakedAmount: "250000", + }, + // ...additional holders + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getHolderPortfolioExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve portfolio for holder address inj1... and staking contract address inj1....", + }, + }, + { + user: "{{agent}}", + content: { + text: "Holder portfolio retrieved successfully.", + action: "GET_HOLDER_PORTFOLIO", + content: { + totalValue: 1000000, + pnl: 50000, + totalValueChartList: [ + { + price: 1000000, + updatedAt: 1633360000, + }, + { + price: 1005000, + updatedAt: 1633446400, + }, + // ...additional total value snapshots + ], + pnlChartList: [ + { + price: 50000, + updatedAt: 1633360000, + }, + { + price: 50500, + updatedAt: 1633446400, + }, + // ...additional PnL snapshots + ], + updatedAt: 1633446400, + }, + }, + }, +]; + +export const getLeaderboardExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve leaderboard for epoch ID 1.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Leaderboard retrieved successfully.", + action: "GET_LEADERBOARD", + content: { + entries: [ + { + address: "inj1...", + accruedPoints: "100", + }, + { + address: "inj2...", + accruedPoints: "95", + }, + // ...additional leaderboard entries + ], + snapshotBlock: "1000000", + updatedAt: 1633360000, + rank: "1", + }, + }, + }, +]; + +export const getLeaderboardEpochsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve leaderboard epochs with a limit of 10, from epoch ID 1 to 10.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Leaderboard epochs retrieved successfully.", + action: "GET_LEADERBOARD_EPOCHS", + content: { + epochs: [ + { + epochId: 1, + startAt: 1633360000, + endAt: 1640995200, + isLive: true, + }, + { + epochId: 2, + startAt: 1640995200, + endAt: 1643587200, + isLive: false, + }, + // ...additional epochs + ], + pagination: { + total: 10, + }, + }, + }, + }, +]; + +export const getTransferHistoryExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve transfer history for vault address inj1... and account address inj1..., skipping 0 and limiting to 10 records up to number 100.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Transfer history retrieved successfully.", + action: "GET_TRANSFER_HISTORY", + content: { + transfers: [ + { + lpAmount: "1000000", + coins: [ + { + denom: "inj", + amount: "1000000", + }, + ], + usdValue: "1000000", + isDeposit: true, + executedAt: 1633360000, + account: "inj1...", + vault: "inj1...", + txHash: "0x...", + tidByVault: 1, + tidByAccount: 1, + }, + { + lpAmount: "500000", + coins: [ + { + denom: "inj", + amount: "500000", + }, + ], + usdValue: "500000", + isDeposit: false, + executedAt: 1633446400, + account: "inj2...", + vault: "inj1...", + txHash: "0x...", + tidByVault: 2, + tidByAccount: 2, + }, + // ...additional transfer records + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getStakingPoolsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve staking pools for staker address inj1... and staking contract address inj1..., skipping 0 and limiting to 10 records.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Staking pools retrieved successfully.", + action: "GET_STAKING_POOLS", + content: { + pools: [ + { + vaultName: "Example Vault", + vaultAddress: "inj1...", + stakeDenom: "inj", + gauges: [ + { + id: "1", + owner: "inj1...", + startTimestamp: 1633360000, + endTimestamp: 1640995200, + rewardTokens: [ + { + denom: "inj", + amount: "1000000", + }, + ], + lastDistribution: 1633360000, + status: "active", + }, + ], + apr: 15.2, + totalLiquidity: 1000000, + stakingAddress: "inj1...", + aprBreakdown: { + inj: 15.2, + }, + }, + { + vaultName: "Another Vault", + vaultAddress: "inj2...", + stakeDenom: "inj", + gauges: [ + { + id: "2", + owner: "inj2...", + startTimestamp: 1633446400, + endTimestamp: 1643587200, + rewardTokens: [ + { + denom: "inj", + amount: "500000", + }, + ], + lastDistribution: 1633446400, + status: "active", + }, + ], + apr: 14.5, + totalLiquidity: 500000, + stakingAddress: "inj2...", + aprBreakdown: { + inj: 14.5, + }, + }, + // ...additional staking pools + ], + pagination: { + total: 10, + }, + }, + }, + }, +]; + +export const getStakingHistoryExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve staking history for staker address inj1..., skipping 0 and limiting to 10 records up to number 100.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Staking history retrieved successfully.", + action: "GET_STAKING_HISTORY", + content: { + activities: [ + { + action: "stake", + txHash: "0x...", + staker: "inj1...", + vaultAddress: "inj1...", + numberByAccount: 1, + timestamp: 1633360000, + rewardedTokens: [ + { + denom: "inj", + amount: "1000000", + }, + ], + stakeAmount: { + denom: "inj", + amount: "1000000", + }, + }, + { + action: "unstake", + txHash: "0x...", + staker: "inj2...", + vaultAddress: "inj1...", + numberByAccount: 2, + timestamp: 1633446400, + rewardedTokens: [ + { + denom: "inj", + amount: "500000", + }, + ], + stakeAmount: { + denom: "inj", + amount: "500000", + }, + }, + // ...additional staking activities + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getStakingRewardsByAccountExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve staking rewards for staker address inj1... and staking contract address inj1....", + }, + }, + { + user: "{{agent}}", + content: { + text: "Staking rewards by account retrieved successfully.", + action: "GET_STAKING_REWARDS_BY_ACCOUNT", + content: { + rewards: [ + { + apr: 15.2, + vaultName: "Example Vault", + vaultAddress: "inj1...", + lockTimestamp: 1633360000, + claimableRewards: [ + { + denom: "inj", + amount: "1000000", + }, + ], + stakedAmount: { + denom: "inj", + amount: "1000000", + }, + lockedAmount: { + denom: "inj", + amount: "1000000", + }, + }, + { + apr: 14.5, + vaultName: "Another Vault", + vaultAddress: "inj2...", + lockTimestamp: 1633446400, + claimableRewards: [ + { + denom: "inj", + amount: "500000", + }, + ], + stakedAmount: { + denom: "inj", + amount: "500000", + }, + lockedAmount: { + denom: "inj", + amount: "500000", + }, + }, + // ...additional rewards + ], + pagination: { + total: 10, + }, + }, + }, + }, +]; + +export const getMissionsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve missions for account address inj1....", + }, + }, + { + user: "{{agent}}", + content: { + text: "Missions retrieved successfully.", + action: "GET_MISSIONS", + content: { + missions: [ + { + id: "mission1", + points: "100", + completed: true, + accruedPoints: "50", + updatedAt: 1633360000, + progress: 0.5, + expected: 100, + }, + { + id: "mission2", + points: "200", + completed: false, + accruedPoints: "150", + updatedAt: 1633446400, + progress: 0.75, + expected: 200, + }, + // ...additional missions + ], + }, + }, + }, +]; + +export const getMissionLeaderboardExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve mission leaderboard for user address inj1....", + }, + }, + { + user: "{{agent}}", + content: { + text: "Mission leaderboard retrieved successfully.", + action: "GET_MISSION_LEADERBOARD", + content: { + entries: [ + { + address: "inj1...", + accruedPoints: "100", + }, + { + address: "inj2...", + accruedPoints: "95", + }, + // ...additional leaderboard entries + ], + updatedAt: 1633360000, + rank: "1", + }, + }, + }, +]; + +export const getIDOExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve IDO information for contract address inj1... and account address inj1....", + }, + }, + { + user: "{{agent}}", + content: { + text: "IDO information retrieved successfully.", + action: "GET_IDO", + content: { + ido: { + startTime: 1633360000, + endTime: 1640995200, + owner: "inj1...", + status: "active", + tokenInfo: { + denom: "inj", + supply: "1000000", + symbol: "INJ", + decimal: 18, + logoUrl: "https://example.com/logo.png", + }, + capPerAddress: "1000000", + contractAddress: "inj1...", + subscribedAmount: "500000", + projectTokenAmount: "1000000", + targetAmountInQuoteDenom: "1000000", + secondBeforeStartToSetQuotePrice: 3600, + targetAmountInUsd: "1000000", + tokenPrice: 1.0, + isAccountWhiteListed: true, + isLaunchWithVault: true, + isVestingScheduleEnabled: true, + name: "Example IDO", + progress: [ + { + status: "active", + timestamp: 1633360000, + }, + ], + quoteDenom: "inj", + stakeToSubscription: [ + { + stakedAmount: "1000000", + subscribableAmount: "500000", + }, + ], + useWhitelist: true, + marketId: "0x...", + vaultAddress: "inj1...", + }, + }, + }, + }, +]; + +export const getIDOsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve all active IDOs with a limit of 10, up to IDO number 100, for account address inj1... and owner address inj1....", + }, + }, + { + user: "{{agent}}", + content: { + text: "IDOs retrieved successfully.", + action: "GET_IDOS", + content: { + idos: [ + { + startTime: 1633360000, + endTime: 1640995200, + owner: "inj1...", + status: "active", + contractAddress: "inj1...", + name: "Example IDO", + }, + { + startTime: 1633446400, + endTime: 1643587200, + owner: "inj2...", + status: "upcoming", + contractAddress: "inj2...", + name: "Another IDO", + }, + // ...additional IDOs + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getIDOSubscribersExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve subscribers for IDO with contract address inj1..., skipping 0 and limiting to 10 records sorted by subscribed amount.", + }, + }, + { + user: "{{agent}}", + content: { + text: "IDO subscribers retrieved successfully.", + action: "GET_IDO_SUBSCRIBERS", + content: { + idoAddress: "inj1...", + accounts: [ + { + accountAddress: "inj1...", + updatedAt: 1633360000, + weight: "1.0", + }, + { + accountAddress: "inj2...", + updatedAt: 1633446400, + weight: "0.8", + }, + // ...additional subscriber accounts + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getIDOSubscriptionExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve IDO subscription details for contract address inj1... and account address inj1....", + }, + }, + { + user: "{{agent}}", + content: { + text: "IDO subscription details retrieved successfully.", + action: "GET_IDO_SUBSCRIPTION", + content: { + subscription: { + maxSubscriptionCoin: { + denom: "inj", + amount: "1000000", + }, + committedAmount: "500000", + price: 1.0, + claimableCoins: [ + { + denom: "token", + amount: "500000", + }, + ], + rewardClaimed: false, + tokenInfo: { + denom: "inj", + supply: "1000000", + symbol: "INJ", + decimal: 18, + logoUrl: "https://example.com/logo.png", + }, + quoteDenom: "inj", + updatedAt: 1633360000, + stakedAmount: "1000000", + marketId: "0x...", + }, + }, + }, + }, +]; + +export const getIDOActivitiesExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve IDO activities for contract address inj1..., account address inj1..., skipping 0 and limiting to 10 records up to number 100.", + }, + }, + { + user: "{{agent}}", + content: { + text: "IDO activities retrieved successfully.", + action: "GET_IDO_ACTIVITIES", + content: { + activities: [ + { + address: "inj1...", + subscribedCoin: { + denom: "inj", + amount: "1000000", + }, + usdValue: 1000000, + timestamp: 1633360000, + txHash: "0x...", + }, + { + address: "inj2...", + subscribedCoin: { + denom: "inj", + amount: "500000", + }, + usdValue: 500000, + timestamp: 1633446400, + txHash: "0x...", + }, + // ...additional activities + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getIDOWhitelistExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve IDO whitelist for contract address inj1..., skipping 0 and limiting to 10 records.", + }, + }, + { + user: "{{agent}}", + content: { + text: "IDO whitelist retrieved successfully.", + action: "GET_IDO_WHITELIST", + content: { + idoAddress: "inj1...", + accounts: [ + { + accountAddress: "inj1...", + updatedAt: 1633360000, + weight: "1.0", + }, + { + accountAddress: "inj2...", + updatedAt: 1633446400, + weight: "0.8", + }, + // ...additional whitelist accounts + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +export const getClaimReferencesExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve claim references for IDO with contract address inj1... and account address inj1..., skipping 0 and limiting to 10 records up to number 100.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Claim references retrieved successfully.", + action: "GET_CLAIM_REFERENCES", + content: { + claimReferences: [ + { + denom: "inj", + updatedAt: 1633360000, + claimedAmount: "500000", + claimableAmount: "1000000", + accountAddress: "inj1...", + cwContractAddress: "inj1...", + idoContractAddress: "inj1...", + startVestingTime: 1633360000, + vestingDurationSeconds: 2592000, + }, + { + denom: "token", + updatedAt: 1633446400, + claimedAmount: "300000", + claimableAmount: "700000", + accountAddress: "inj2...", + cwContractAddress: "inj2...", + idoContractAddress: "inj2...", + startVestingTime: 1633446400, + vestingDurationSeconds: 2592000, + }, + // ...additional claim references + ], + pagination: { + total: 100, + }, + }, + }, + }, +]; + +//Mito execute messages examples + +export const getLaunchpadSubscribeExample = [ + { + user: "{{user1}}", + content: { + text: "Subscribe to launchpad with 1000 INJ tokens.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Launchpad subscription processed successfully.", + action: "LAUNCHPAD_SUBSCRIBE", + content: { + amount: 1000, + quoteTokenDenom: "inj", + quoteTokenDecimals: 18, + contractAddress: "inj1...", + }, + }, + }, +]; + +export const getSubscribeVaultExample = [ + { + user: "{{user1}}", + content: { + text: "Subscribe to vault with 1.5 INJ and 1000 USDT.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Vault subscription processed successfully.", + action: "SUBSCRIBE_VAULT", + content: { + market: { + baseDenom: "inj", + baseDecimals: 18, + quoteDecimals: 6, + quoteDenom: "usdt", + }, + baseAmount: 1.5, + quoteAmount: 1000, + subscriptionType: "BaseOnly", + vaultDetails: { + vaultSubaccountId: "0x...", + vaultMasterAddress: "inj1...", + vaultType: "crates.io:vault-cpmm-spot", + }, + slippage: { + max_penalty: "0.1", + }, + }, + }, + }, +]; + +export const getInstantiateCPMMVaultExample = [ + { + user: "{{user1}}", + content: { + text: "Create a new CPMM vault for INJ/USDT trading pair.", + }, + }, + { + user: "{{agent}}", + content: { + text: "CPMM vault instantiated successfully.", + action: "INSTANTIATE_CPMM_VAULT", + content: { + MITO_MASTER_CONTRACT_ADDRESS: "inj1...", + CPMM_CONTRACT_CODE: 123, + senderWalletAddress: "inj1...", + marketId: "0x...", + feeBps: 30, + baseDecimals: 18, + quoteDecimals: 6, + funds: [ + { + denom: "inj", + amount: "1000000000000000000", + }, + ], + notionalValueCap: "1000000", + pricingStrategy: { + SmoothingPricingWithRelativePriceRange: { + bid_range: "0.01", + ask_range: "0.01", + }, + }, + maxInvariantSensitivityBps: "100", + maxPriceSensitivityBps: "100", + orderType: "LIMIT", + }, + }, + }, +]; + +export const getLaunchpadClaimExample = [ + { + user: "{{user1}}", + content: { + text: "Claim tokens from launchpad contract.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Launchpad tokens claimed successfully.", + action: "LAUNCHPAD_CLAIM", + content: { + contractAddress: "inj1...", + }, + }, + }, +]; + +export const getVaultSubscribeExample = [ + { + user: "{{user1}}", + content: { + text: "Subscribe to a spot trading vault with INJ/USDT.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Vault subscription processed successfully.", + action: "VAULT_SUBSCRIBE", + content: { + vaultType: "crates.io:vault-cpmm-spot", + slippage: { + max_penalty: "0.1", + }, + vaultSubaccountId: "0x...", + baseAmount: 1.5, + quoteAmount: 1000, + market: { + baseDenom: "inj", + baseDecimals: 18, + quoteDenom: "usdt", + quoteDecimals: 6, + }, + subscriptionType: "BaseOnly", + masterAddress: "inj1...", + }, + }, + }, +]; + +export const getRedeemFromVaultExample = [ + { + user: "{{user1}}", + content: { + text: "Redeem 0.01 LP tokens from the vault.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Vault redemption processed successfully.", + action: "REDEEM_FROM_VAULT", + content: { + vaultSubaccountId: "0x...", + redeemAmount: 0.01, + vaultBaseDecimals: 18, + masterAddress: "inj1...", + vaultLpDenom: "factory/...", + marketType: "Spot", + redemptionType: "BaseOnly", + slippage: { + max_penalty: "0.1", + }, + }, + }, + }, +]; + +export const getStakeVaultLPExample = [ + { + user: "{{user1}}", + content: { + text: "Stake 0.01 LP tokens in the vault.", + }, + }, + { + user: "{{agent}}", + content: { + text: "LP tokens staked successfully.", + action: "STAKE_VAULT_LP", + content: { + amount: 0.01, + vaultLpDenom: "factory/...", + vaultTokenDecimals: 18, + stakingContractAddress: "inj1...", + }, + }, + }, +]; + +export const getUnstakeVaultLPExample = [ + { + user: "{{user1}}", + content: { + text: "Unstake 0.01 LP tokens from the vault.", + }, + }, + { + user: "{{agent}}", + content: { + text: "LP tokens unstaked successfully.", + action: "UNSTAKE_VAULT_LP", + content: { + amount: 0.01, + vaultLpDenom: "factory/...", + vaultTokenDecimals: 18, + stakingContractAddress: "inj1...", + }, + }, + }, +]; + +export const getClaimVaultRewardsExample = [ + { + user: "{{user1}}", + content: { + text: "Claim staking rewards from the vault.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Vault rewards claimed successfully.", + action: "CLAIM_VAULT_REWARDS", + content: { + vaultLpDenom: "factory/...", + stakingContractAddress: "inj1...", + }, + }, + }, +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/examples/peggy.ts b/packages/plugin-injective/injective-sdk-client-ts/src/examples/peggy.ts new file mode 100644 index 00000000000..b2dd09a2c0b --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/examples/peggy.ts @@ -0,0 +1,63 @@ +// ======================================= +// Peggy Module +// ======================================= + +export const getPeggyModuleParamsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve Peggy module parameters, including bridgeChainId, peggyId, signedValsetsWindow, signedBatchesWindow, signedClaimsWindow, targetBatchTimeout, averageBlockTime, averageEthereumBlockTime, slash fractions, unbondSlashingValsetsWindow, bridgeContractAddress, bridgeActive status, and oracles.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Peggy module parameters retrieved successfully.", + action: "GET_PEGGY_MODULE_PARAMS", + content: { + bridgeParams: { + bridgeChainId: "1", + peggyId: "peggy1", + signedValsetsWindow: "10000", + signedBatchesWindow: "10000", + signedClaimsWindow: "10000", + targetBatchTimeout: "43200000", + averageBlockTime: "5000", + averageEthereumBlockTime: "15000", + slashFractionValset: "0.001", + slashFractionBatch: "0.001", + slashFractionClaim: "0.001", + slashFractionConflictingClaim: "0.001", + unbondSlashingValsetsWindow: "10000", + bridgeContractAddress: "0xBridgeContractAddress...", + bridgeActive: true, + oracles: [ + "0xOracleAddress1...", + "0xOracleAddress2...", + // ...additional oracle addresses + ], + }, + }, + }, + }, +]; + +export const msgSendToEthExample = [ + { + user: "{{user1}}", + content: { + text: "Send 1,000,000,000 inj with a bridge fee of 1,000,000 inj to Ethereum address 0xEthereumAddress...", + }, + }, + { + user: "{{agent}}", + content: { + text: "Tokens sent to Ethereum successfully.", + action: "MSG_SEND_TO_ETH", + content: { + txHash: "0xibctransferhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/examples/permissions.ts b/packages/plugin-injective/injective-sdk-client-ts/src/examples/permissions.ts new file mode 100644 index 00000000000..bec41a88c99 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/examples/permissions.ts @@ -0,0 +1,209 @@ +// ======================================= +// Permission Module +// ======================================= + +export const getAddressesByRoleExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve all addresses with the role 'minter' for denomination 'peggy0x...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Addresses with role 'minter' retrieved successfully.", + action: "GET_ADDRESSES_BY_ROLE", + content: { + addresses: [ + "inj1address1...", + "inj1address2...", + "inj1address3...", + ], + }, + }, + }, +]; + +export const getAddressRolesExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch roles for address 'inj1address1...' and denomination 'peggy0x...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Roles for address 'inj1address1...' retrieved successfully.", + action: "GET_ADDRESS_ROLES", + content: { + roles: ["minter", "burner"], + }, + }, + }, +]; + +export const getAllNamespacesExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch all namespaces.", + }, + }, + { + user: "{{agent}}", + content: { + text: "All namespaces retrieved successfully.", + action: "GET_ALL_NAMESPACES", + content: { + namespaces: [ + { + denom: "peggy0x...", + wasmHook: "inj1hookaddress...", + mintsPaused: false, + sendsPaused: false, + burnsPaused: false, + rolePermissions: [ + { + role: "minter", + permissions: 1, + }, + { + role: "burner", + permissions: 2, + }, + ], + addressRoles: [ + { + address: "inj1address1...", + roles: ["minter"], + }, + { + address: "inj1address2...", + roles: ["burner"], + }, + ], + }, + { + denom: "peggy0xabc...", + wasmHook: "inj1anotherhook...", + mintsPaused: true, + sendsPaused: false, + burnsPaused: true, + rolePermissions: [ + { + role: "minter", + permissions: 1, + }, + ], + addressRoles: [ + { + address: "inj1address3...", + roles: ["minter"], + }, + ], + }, + // ...additional namespaces + ], + }, + }, + }, +]; + +export const getPermissionsModuleParamsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve Peggy module parameters, including bridge settings and oracle addresses.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Peggy module parameters retrieved successfully.", + action: "GET_PERMISSIONS_MODULE_PARAMS", + content: { + wasmHookQueryMaxGas: "1000000", + }, + }, + }, +]; + +export const getNamespaceByDenomExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch namespace details for denomination 'peggy0x...' and include role information.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Namespace details retrieved successfully.", + action: "GET_NAMESPACE_BY_DENOM", + content: { + namespace: { + denom: "peggy0x...", + wasmHook: "inj1hookaddress...", + mintsPaused: false, + sendsPaused: false, + burnsPaused: false, + rolePermissions: [ + { + role: "minter", + permissions: 1, + }, + ], + addressRoles: [ + { + address: "inj1address1...", + roles: ["minter"], + }, + ], + }, + }, + }, + }, +]; + +export const getVouchersForAddressExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve vouchers for address 'inj1address1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Vouchers for address 'inj1address1...' retrieved successfully.", + action: "GET_VOUCHERS_FOR_ADDRESS", + content: { + vouchers: [ + { + coins: [ + { + amount: "1000000000000000000", + denom: "peggy0x...", + }, + { + amount: "500000000000000000", + denom: "peggy0xabc...", + }, + ], + }, + { + coins: [ + { + amount: "2000000000000000000", + denom: "peggy0xdef...", + }, + ], + }, + // ...additional vouchers + ], + }, + }, + }, +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/examples/staking.ts b/packages/plugin-injective/injective-sdk-client-ts/src/examples/staking.ts new file mode 100644 index 00000000000..c33199f0c08 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/examples/staking.ts @@ -0,0 +1,726 @@ +// ======================================= +// Staking Module +// ======================================= + +export const getStakingModuleParamsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve staking module parameters including unbonding time, max validators, max entries, historical entries, and bond denomination.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Staking module parameters retrieved successfully.", + action: "GET_STAKING_MODULE_PARAMS", + content: { + unbondingTime: 1209600, + maxValidators: 100, + maxEntries: 7, + historicalEntries: 10000, + bondDenom: "inj", + }, + }, + }, +]; + +export const getPoolExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch staking pool information.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Staking pool information retrieved successfully.", + action: "GET_POOL", + content: { + notBondedTokens: "1000000000000000000", + bondedTokens: "5000000000000000000", + }, + }, + }, +]; + +export const getValidatorsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve validators with pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Validators retrieved successfully.", + action: "GET_VALIDATORS", + content: { + validators: [ + { + operatorAddress: "injvaloper1...", + consensusPubkey: "injvalconspub1...", + jailed: false, + status: 2, + tokens: "1000000", + delegatorShares: "1000000.000000000000000000", + description: { + moniker: "Validator One", + identity: "", + website: "https://validatorone.com", + securityContact: "security@validatorone.com", + details: "Leading validator in the network.", + }, + unbondingHeight: "0", + unbondingTime: "0", + commission: { + commissionRates: { + rate: "0.100000000000000000", + maxRate: "0.200000000000000000", + maxChangeRate: "0.010000000000000000", + }, + updateTime: "0", + }, + minSelfDelegation: "1000000", + }, + // ...additional validators + ], + pagination: { + nextKey: "def456...", + total: "100", + }, + }, + }, + }, +]; + +export const getValidatorExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch details for validator with address 'injvaloper1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Validator details retrieved successfully.", + action: "GET_VALIDATOR", + content: { + operatorAddress: "injvaloper1...", + consensusPubkey: "injvalconspub1...", + jailed: false, + status: 2, + tokens: "1000000", + delegatorShares: "1000000.000000000000000000", + description: { + moniker: "Validator One", + identity: "", + website: "https://validatorone.com", + securityContact: "security@validatorone.com", + details: "Leading validator in the network.", + }, + unbondingHeight: "0", + unbondingTime: "0", + commission: { + commissionRates: { + rate: "0.100000000000000000", + maxRate: "0.200000000000000000", + maxChangeRate: "0.010000000000000000", + }, + updateTime: "0", + }, + minSelfDelegation: "1000000", + }, + }, + }, +]; + +export const getValidatorDelegationsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve delegations for validator 'injvaloper1...' with pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Validator delegations retrieved successfully.", + action: "GET_VALIDATOR_DELEGATIONS", + content: { + delegations: [ + { + delegation: { + delegatorAddress: "inj1delegator1...", + validatorAddress: "injvaloper1...", + shares: "1000000.000000000000000000", + }, + balance: { + denom: "inj", + amount: "1000000000000000000", + }, + }, + // ...additional delegations + ], + pagination: { + nextKey: "ghi789...", + total: "50", + }, + }, + }, + }, +]; + +export const getValidatorDelegationsNoThrowExample = [ + { + user: "{{user1}}", + content: { + text: "Safely retrieve delegations for validator 'injvaloper1...' with pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Validator delegations retrieved successfully (no-throw).", + action: "GET_VALIDATOR_DELEGATIONS_NO_THROW", + content: { + delegations: [ + { + delegation: { + delegatorAddress: "inj1delegator1...", + validatorAddress: "injvaloper1...", + shares: "1000000.000000000000000000", + }, + balance: { + denom: "inj", + amount: "1000000000000000000", + }, + }, + // ...additional delegations + ], + pagination: { + nextKey: "ghi789...", + total: "50", + }, + }, + }, + }, +]; + +export const getValidatorUnbondingDelegationsExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch unbonding delegations for validator 'injvaloper1...' with pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Validator unbonding delegations retrieved successfully.", + action: "GET_VALIDATOR_UNBONDING_DELEGATIONS", + content: { + unbondingDelegations: [ + { + delegatorAddress: "inj1...", + validatorAddress: "injvaloper1...", + entries: [ + { + creationHeight: "1000000", + completionTime: "1633446400", + initialBalance: "1000000000000000000", + balance: "1000000000000000000", + }, + ], + }, + // ...additional unbonding delegations + ], + pagination: { + nextKey: "jkl012...", + total: "20", + }, + }, + }, + }, +]; + +export const getValidatorUnbondingDelegationsNoThrowExample = [ + { + user: "{{user1}}", + content: { + text: "Safely fetch unbonding delegations for validator 'injvaloper1...' with pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Validator unbonding delegations retrieved successfully (no-throw).", + action: "GET_VALIDATOR_UNBONDING_DELEGATIONS_NO_THROW", + content: { + unbondingDelegations: [ + { + delegatorAddress: "inj1...", + validatorAddress: "injvaloper1...", + entries: [ + { + creationHeight: "1000000", + completionTime: "1633446400", + initialBalance: "1000000000000000000", + balance: "1000000000000000000", + }, + ], + }, + // ...additional unbonding delegations + ], + pagination: { + nextKey: "jkl012...", + total: "20", + }, + }, + }, + }, +]; + +export const getDelegationsExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch all delegations for delegator address 'inj1...' with pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Delegations retrieved successfully.", + action: "GET_DELEGATIONS", + content: { + delegations: [ + { + delegation: { + delegatorAddress: "inj1...", + validatorAddress: "injvaloper1...", + shares: "1000000.000000000000000000", + }, + balance: { + denom: "inj", + amount: "1000000000000000000", + }, + }, + // ...additional delegations + ], + pagination: { + nextKey: "mno345...", + total: "100", + }, + }, + }, + }, +]; + +export const getDelegationsNoThrowExample = [ + { + user: "{{user1}}", + content: { + text: "Safely fetch all delegations for delegator address 'inj1...' with pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Delegations retrieved successfully (no-throw).", + action: "GET_DELEGATIONS_NO_THROW", + content: { + delegations: [ + { + delegation: { + delegatorAddress: "inj1...", + validatorAddress: "injvaloper1...", + shares: "1000000.000000000000000000", + }, + balance: { + denom: "inj", + amount: "1000000000000000000", + }, + }, + // ...additional delegations + ], + pagination: { + nextKey: "mno345...", + total: "100", + }, + }, + }, + }, +]; + +export const getUnbondingDelegationsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve unbonding delegations for delegator address 'inj1...' with pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Unbonding delegations retrieved successfully.", + action: "GET_UNBONDING_DELEGATIONS", + content: { + unbondingDelegations: [ + { + delegatorAddress: "inj1...", + validatorAddress: "injvaloper1...", + entries: [ + { + creationHeight: "1000000", + completionTime: "1633446400", + initialBalance: "1000000000000000000", + balance: "1000000000000000000", + }, + ], + }, + // ...additional unbonding delegations + ], + pagination: { + nextKey: "ghi789...", + total: "30", + }, + }, + }, + }, +]; + +export const getReDelegationsExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch redelegations for delegator address 'inj1...' with pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Redelegations retrieved successfully.", + action: "GET_REDELEGATIONS", + content: { + redelegations: [ + { + delegatorAddress: "inj1...", + validatorSrcAddress: "injvaloper1...", + validatorDstAddress: "injvaloper2...", + entries: [ + { + creationHeight: "1000000", + completionTime: "1633446400", + initialBalance: "500000000000000000", + sharesDst: "500000.000000000000000000", + }, + ], + }, + // ...additional redelegations + ], + pagination: { + nextKey: "stu901...", + total: "40", + }, + }, + }, + }, +]; + +export const msgCreateValidatorExample = [ + { + user: "{{user1}}", + content: { + text: "Create a new validator with moniker 'Validator One', identity 'keybase-id', website 'https://validatorone.com', security contact 'security@validatorone.com', details 'Leading validator in the network.', commission rate 0.10, max rate 0.20, max change rate 0.01, minimum self-delegation of 1000000000000000000 inj, delegator address 'inj1...', validator address 'injvaloper1...', public key 'injvalconspub1...', and initial self-delegation of 1000000000000000000 inj.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Validator creation submitted successfully.", + action: "MSG_CREATE_VALIDATOR", + content: { + txHash: "0xcreatevalidatorhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgEditValidatorExample = [ + { + user: "{{user1}}", + content: { + text: "Edit validator 'injvaloper1...' with new moniker 'Validator One Updated', new identity 'new-keybase-id', new website 'https://new-validatorone.com', new security contact 'newsecurity@validatorone.com', new details 'Updated details.', new commission rate 0.15, and new minimum self-delegation of 2000000000000000000 inj.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Validator edited successfully.", + action: "MSG_EDIT_VALIDATOR", + content: { + txHash: "0xeditvalidatorhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgDelegateExample = [ + { + user: "{{user1}}", + content: { + text: "Delegate 1000000000000000000 inj from delegator address 'inj1...' to validator address 'injvaloper1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Delegation submitted successfully.", + action: "MSG_DELEGATE", + content: { + txHash: "0xdelegationhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgBeginRedelegateExample = [ + { + user: "{{user1}}", + content: { + text: "Begin redelegating 1000000000000000000 inj from validator 'injvaloper1...' to validator 'injvaloper2...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Redelegation submitted successfully.", + action: "MSG_BEGIN_REDELEGATE", + content: { + txHash: "0xredelegationhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgUndelegateExample = [ + { + user: "{{user1}}", + content: { + text: "Undelegate 1000000000000000000 inj from delegator address 'inj1...' to validator address 'injvaloper1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Undelegation submitted successfully.", + action: "MSG_UNDELEGATE", + content: { + txHash: "0xundelegationhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgCancelUnbondingDelegationExample = [ + { + user: "{{user1}}", + content: { + text: "Cancel undelegation of 1000000000000000000 inj from delegator address 'inj1...' to validator address 'injvaloper1...' initiated at height 1000000.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Unbonding delegation cancellation submitted successfully.", + action: "MSG_CANCEL_UNBONDING_DELEGATION", + content: { + txHash: "0xcancelundelegationhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const getDelegationExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch delegation details for delegator address 'inj1...' and validator address 'injvaloper1...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Delegation details retrieved successfully.", + action: "GET_DELEGATION", + content: { + delegation: { + delegatorAddress: "inj1...", + validatorAddress: "injvaloper1...", + shares: "1000000000000000000", + }, + balance: { + denom: "inj", + amount: "1000000000000000000", + }, + }, + }, + }, +]; + +export const getDelegatorsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve all delegators for validator 'injvaloper1...' with pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Delegators retrieved successfully.", + action: "GET_DELEGATORS", + content: { + delegators: [ + { + delegation: { + delegatorAddress: "inj1delegator1...", + validatorAddress: "injvaloper1...", + shares: "1000000.000000000000000000", + }, + balance: { + denom: "inj", + amount: "1000000000000000000", + }, + }, + // ...additional delegators + ], + pagination: { + nextKey: "def456...", + total: "50", + }, + }, + }, + }, +]; + +export const getDelegatorsNoThrowExample = [ + { + user: "{{user1}}", + content: { + text: "Safely retrieve all delegators for validator 'injvaloper1...' with pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Delegators retrieved successfully (no-throw).", + action: "GET_DELEGATORS_NO_THROW", + content: { + delegators: [ + { + delegation: { + delegatorAddress: "inj1delegator1...", + validatorAddress: "injvaloper1...", + shares: "1000000.000000000000000000", + }, + balance: { + denom: "inj", + amount: "1000000000000000000", + }, + }, + // ...additional delegators + ], + pagination: { + nextKey: "def456...", + total: "50", + }, + }, + }, + }, +]; + +export const getUnbondingDelegationsNoThrowExample = [ + { + user: "{{user1}}", + content: { + text: "Safely retrieve unbonding delegations for delegator address 'inj1...' with pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Unbonding delegations retrieved successfully (no-throw).", + action: "GET_UNBONDING_DELEGATIONS_NO_THROW", + content: { + unbondingDelegations: [ + { + delegatorAddress: "inj1...", + validatorAddress: "injvaloper1...", + entries: [ + { + creationHeight: "1000000", + completionTime: "1633446400", + initialBalance: "1000000000000000000", + balance: "1000000000000000000", + }, + ], + }, + // ...additional unbonding delegations + ], + pagination: { + nextKey: "ghi789...", + total: "30", + }, + }, + }, + }, +]; + +export const getReDelegationsNoThrowExample = [ + { + user: "{{user1}}", + content: { + text: "Safely fetch redelegations for delegator address 'inj1...' with pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Redelegations retrieved successfully (no-throw).", + action: "GET_REDELEGATIONS_NO_THROW", + content: { + redelegations: [ + { + delegatorAddress: "inj1...", + validatorSrcAddress: "injvaloper1...", + validatorDstAddress: "injvaloper2...", + entries: [ + { + creationHeight: "1000000", + completionTime: "1633446400", + initialBalance: "500000000000000000", + sharesDst: "500000.000000000000000000", + }, + ], + }, + // ...additional redelegations + ], + pagination: { + nextKey: "stu901...", + total: "40", + }, + }, + }, + }, +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/examples/token-factory.ts b/packages/plugin-injective/injective-sdk-client-ts/src/examples/token-factory.ts new file mode 100644 index 00000000000..fa95fd9bf78 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/examples/token-factory.ts @@ -0,0 +1,192 @@ +// ======================================= +// Token Factory Module +// ======================================= + +export const getDenomsFromCreatorExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve all denominations created by creator address 'inj1creator...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Denominations created by 'inj1creator...' retrieved successfully.", + action: "GET_DENOMS_FROM_CREATOR", + content: { + denoms: [ + "peggy0xabc...", + "peggy0xdef...", + "peggy0xghi...", + // ...additional denominations + ], + }, + }, + }, +]; + +export const getDenomAuthorityMetadataExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch authority metadata for denomination 'peggy0xabc...' created by 'inj1creator...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Authority metadata for denomination 'peggy0xabc...' retrieved successfully.", + action: "GET_DENOM_AUTHORITY_METADATA", + content: { + authorityMetadata: { + admin: "inj1admin...", + mintRestricted: false, + burnRestricted: true, + }, + }, + }, + }, +]; + +export const getTokenFactoryModuleParamsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve Token Factory module parameters.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Token Factory module parameters retrieved successfully.", + action: "GET_TOKEN_FACTORY_MODULE_PARAMS", + content: { + mintDenom: "inj", + mintDenomMinAmount: "1000", + mintDenomMaxAmount: "1000000", + }, + }, + }, +]; + +export const getTokenFactoryModuleStateExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch current state of the Token Factory module.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Token Factory module state retrieved successfully.", + action: "GET_TOKEN_FACTORY_MODULE_STATE", + content: { + totalDenoms: 150, + activeDenoms: 145, + pausedDenoms: 5, + }, + }, + }, +]; + +export const msgBurnExample = [ + { + user: "{{user1}}", + content: { + text: "Burn 5000000 peggy0xabc... from sender address 'inj1sender...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Burn transaction submitted successfully.", + action: "MSG_BURN", + content: { + txHash: "0xburntxhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgChangeAdminExample = [ + { + user: "{{user1}}", + content: { + text: "Change admin of denomination 'peggy0xabc...' to new admin address 'inj1newadmin...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Admin change for denomination 'peggy0xabc...' submitted successfully.", + action: "MSG_CHANGE_ADMIN", + content: { + txHash: "0xchangeadminhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgCreateDenomExample = [ + { + user: "{{user1}}", + content: { + text: "Create a new denomination 'peggy0xjkl...' with sub-denomination 'subdenom'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Denomination 'peggy0xjkl...' created successfully.", + action: "MSG_CREATE_DENOM", + content: { + txHash: "0xcreatedenomhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgMintExample = [ + { + user: "{{user1}}", + content: { + text: "Mint 10000000 peggy0xabc... to creator address 'inj1creator...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Mint transaction submitted successfully.", + action: "MSG_MINT", + content: { + txHash: "0xminttxhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgSetDenomMetadataExample = [ + { + user: "{{user1}}", + content: { + text: "Set metadata for denomination 'peggy0xabc...' with name 'Peggy Token', symbol 'PEG', description 'Peggy token description', and display denomination 'peg'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Denomination metadata for 'peggy0xabc...' set successfully.", + action: "MSG_SET_DENOM_METADATA", + content: { + txHash: "0xsetmetadatahash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/examples/wasm.ts b/packages/plugin-injective/injective-sdk-client-ts/src/examples/wasm.ts new file mode 100644 index 00000000000..02284db33ba --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/examples/wasm.ts @@ -0,0 +1,608 @@ +// ======================================= +// WASM and WasmX Module +// ======================================= + +export const getWasmxModuleParamsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve WasmX module parameters.", + }, + }, + { + user: "{{agent}}", + content: { + text: "WasmX module parameters retrieved successfully.", + action: "GET_WASMX_MODULE_PARAMS", + content: { + params: { + is_execution_enabled: true, + registration_fee: { + denom: "inj", + amount: "100000000000000000000", + }, + max_begin_block_tx_gas: 1000000, + max_contract_gas_limit: 500000, + min_gas_price: "1000000000", + }, + }, + }, + }, +]; + +export const getWasmxModuleStateExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch current state of the WasmX module.", + }, + }, + { + user: "{{agent}}", + content: { + text: "WasmX module state retrieved successfully.", + action: "GET_WASMX_MODULE_STATE", + content: { + params: { + is_execution_enabled: true, + registration_fee: { + denom: "inj", + amount: "100000000000000000000", + }, + max_begin_block_tx_gas: 1000000, + max_contract_gas_limit: 500000, + min_gas_price: "1000000000", + }, + registered_contracts: [ + { + address: "inj1contract...", + gas_limit: 1000000, + gas_price: "1000000000", + is_executable: true, + code_id: 1, + }, + // ...additional registered contracts + ], + }, + }, + }, +]; + +export const getContractAccountsBalanceExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve contract accounts balance for contract address 'inj1contract...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Contract accounts balance retrieved successfully.", + action: "GET_CONTRACT_ACCOUNTS_BALANCE", + content: { + tokenInfo: { + name: "Example Token", + symbol: "EXT", + decimals: 18, + total_supply: "1000000000000000000000000", + mint: "inj1creator...", + }, + contractInfo: { + codeId: 1, + creator: "inj1creator...", + admin: "inj1admin...", + label: "Example Contract", + }, + marketingInfo: { + project: "Example Project", + description: "Example Description", + logo: { + url: "https://example.com/logo.png", + }, + marketing: "Example Marketing Info", + }, + contractAccountsBalance: [ + { + account: "inj1account...", + balance: "1000000000000000000", + }, + ], + pagination: { + nextKey: "xyz789...", + total: "100", + }, + }, + }, + }, +]; + +export const getContractStateExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch contract state for contract address 'inj1contract...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Contract state retrieved successfully.", + action: "GET_CONTRACT_STATE", + content: { + tokenInfo: { + name: "Example Token", + symbol: "EXT", + decimals: 18, + total_supply: "1000000000000000000000000", + mint: "inj1creator...", + }, + contractInfo: { + codeId: 1, + creator: "inj1creator...", + admin: "inj1admin...", + label: "Example Contract", + }, + marketingInfo: { + project: "Example Project", + description: "Example Description", + logo: { + url: "https://example.com/logo.png", + }, + marketing: "Example Marketing Info", + }, + contractAccountsBalance: [ + { + account: "inj1account...", + balance: "1000000000000000000", + }, + ], + pagination: { + nextKey: "xyz789...", + total: "100", + }, + }, + }, + }, +]; + +export const getContractInfoExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve contract information for contract address 'inj1contract...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Contract information retrieved successfully.", + action: "GET_CONTRACT_INFO", + content: { + codeId: 1, + creator: "inj1creator...", + admin: "inj1admin...", + label: "Example Contract", + created: { + blockHeight: 1000000, + txIndex: 0, + }, + ibcPortId: "wasm.1", + extension: { + typeUrl: "example", + value: "base64encodeddata", + }, + }, + }, + }, +]; + +export const getContractHistoryExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch contract history for contract address 'inj1contract...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Contract history retrieved successfully.", + action: "GET_CONTRACT_HISTORY", + content: { + entriesList: [ + { + operation: "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT", + codeId: 1, + updated: { + blockHeight: 1000000, + txIndex: 0, + }, + msg: "base64encodeddata", + }, + ], + pagination: { + nextKey: "xyz789...", + total: "10", + }, + }, + }, + }, +]; + +export const getSmartContractStateExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve smart contract state for contract address 'inj1contract...' with query { get_state: {} }.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Smart contract state retrieved successfully.", + action: "GET_SMART_CONTRACT_STATE", + content: { + // Contract-specific state data + state: { + key1: "value1", + key2: "value2", + // ...additional state data + }, + }, + }, + }, +]; + +export const getRawContractStateExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch raw contract state for contract address 'inj1contract...' with key 'base64encodedkey'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Raw contract state retrieved successfully.", + action: "GET_RAW_CONTRACT_STATE", + content: { + data: "base64encodedvalue", + }, + }, + }, +]; + +export const getContractCodesExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve all contract codes with pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Contract codes retrieved successfully.", + action: "GET_CONTRACT_CODES", + content: { + codeInfosList: [ + { + codeId: 1, + creator: "inj1creator...", + dataHash: "base64encodeddata", + }, + ], + pagination: { + nextKey: "xyz789...", + total: "50", + }, + }, + }, + }, +]; + +export const getContractCodeExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch contract code for code ID 1.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Contract code retrieved successfully.", + action: "GET_CONTRACT_CODE", + content: { + codeInfo: { + codeId: 1, + creator: "inj1creator...", + dataHash: "base64encodeddata", + }, + data: "base64encodedwasmcode", + }, + }, + }, +]; + +export const getContractCodeContractsExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve all contracts for code ID 1 with pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Contracts for code ID 1 retrieved successfully.", + action: "GET_CONTRACT_CODE_CONTRACTS", + content: { + contractsList: ["inj1contract1...", "inj2contract2..."], + pagination: { + nextKey: "xyz789...", + total: "20", + }, + }, + }, + }, +]; + +export const msgStoreCodeExample = [ + { + user: "{{user1}}", + content: { + text: "Store new contract code with sender 'inj1sender...' and WASM bytecode 'base64encodedwasmcode'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Contract code stored successfully.", + action: "MSG_STORE_CODE", + content: { + txHash: "0xstorecodehash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgUpdateAdminExample = [ + { + user: "{{user1}}", + content: { + text: "Update admin of contract 'inj1contract...' to new admin address 'inj2newadmin...'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Contract admin updated successfully.", + action: "MSG_UPDATE_ADMIN", + content: { + txHash: "0xupdateadminhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgExecuteContractExample = [ + { + user: "{{user1}}", + content: { + text: "Execute contract 'inj2contract...' with message { execute: { action: 'transfer', amount: '1000000000000000000', recipient: 'inj3recipient...' } } and send funds [{ denom: 'inj', amount: '1000000000000000000' }].", + }, + }, + { + user: "{{agent}}", + content: { + text: "Contract executed successfully.", + action: "MSG_EXECUTE_CONTRACT", + content: { + txHash: "0xexecutecontracthash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgMigrateContractExample = [ + { + user: "{{user1}}", + content: { + text: "Migrate contract 'inj2contract...' to new code ID 2 with migration message { migrate: { new_parameter: 'value' } }.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Contract migrated successfully.", + action: "MSG_MIGRATE_CONTRACT", + content: { + txHash: "0xmigratecontracthash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgInstantiateContractExample = [ + { + user: "{{user1}}", + content: { + text: "Instantiate contract with sender 'inj1sender...', admin 'inj2admin...', code ID 1, label 'Example Contract', instantiation message { name: 'Example Token', symbol: 'EXT', decimals: 18, initial_balances: [{ address: 'inj3address...', amount: '1000000000000000000000000' }] }, and send funds [{ denom: 'inj', amount: '1000000000000000000' }].", + }, + }, + { + user: "{{agent}}", + content: { + text: "Contract instantiated successfully.", + action: "MSG_INSTANTIATE_CONTRACT", + content: { + txHash: "0xinstantiatecontracthash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgExecuteContractCompatExample = [ + { + user: "{{user1}}", + content: { + text: "Execute contract 'inj2contract...' in compatibility mode with message { send: { to: 'inj3recipient...', amount: '1000000000000000000' } } and send funds [{ denom: 'inj', amount: '1000000000000000000' }].", + }, + }, + { + user: "{{agent}}", + content: { + text: "Contract executed successfully in compatibility mode.", + action: "MSG_EXECUTE_CONTRACT_COMPAT", + content: { + txHash: "0xexecutecompathash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const msgPrivilegedExecuteContractExample = [ + { + user: "{{user1}}", + content: { + text: "Privileged execute contract 'inj2contract...' with message { privileged_action: { parameter: 'value' } }.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Privileged contract execution submitted successfully.", + action: "MSG_PRIVILEGED_EXECUTE_CONTRACT", + content: { + txHash: "0xprivilegedexecutehash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + success: true, + }, + }, + }, +]; + +export const getContractStateByKeyExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch contract state for contract address 'inj1contract...' with key 'base64encodedkey'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Contract state for key 'base64encodedkey' retrieved successfully.", + action: "GET_CONTRACT_STATE_BY_KEY", + content: { + data: "base64encodedvalue", + }, + }, + }, +]; + +export const getContractHistoryByOperationExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch contract history for contract address 'inj1contract...' with operation type 'Init'.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Contract history for operation type 'Init' retrieved successfully.", + action: "GET_CONTRACT_HISTORY_BY_OPERATION", + content: { + entries: [ + { + operation: "Init", + codeId: 1, + updated: { + blockHeight: 1000000, + txIndex: 0, + }, + msg: "base64encodeddata", + }, + ], + }, + }, + }, +]; + +export const getContractCodeHistoryExample = [ + { + user: "{{user1}}", + content: { + text: "Retrieve complete contract code history for contract address 'inj1contract...' with pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Complete contract code history retrieved successfully.", + action: "GET_CONTRACT_CODE_HISTORY", + content: { + history: [ + { + codeId: 1, + timeStamp: "2024-01-01T00:00:00Z", + operation: "Init", + msg: "base64encodeddata", + initiator: "inj1admin...", + }, + ], + pagination: { + nextKey: "xyz789...", + total: "10", + }, + }, + }, + }, +]; + +export const getContractEventsExample = [ + { + user: "{{user1}}", + content: { + text: "Fetch contract events for contract address 'inj1contract...' with event type 'wasm' and pagination key 'abc123...', offset 0, limit 100, and count total.", + }, + }, + { + user: "{{agent}}", + content: { + text: "Contract events retrieved successfully.", + action: "GET_CONTRACT_EVENTS", + content: { + events: [ + { + type: "wasm", + attributes: [ + { + key: "action", + value: "transfer", + }, + { + key: "amount", + value: "1000000000000000000", + }, + ], + blockHeight: 1000000, + txHash: "0xeventtxhash123def456ghi789jkl012mno345pqr678stu901vwx234yz", + }, + ], + pagination: { + nextKey: "xyz789...", + total: "100", + }, + }, + }, + }, +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/exceptions/GrpcException.ts b/packages/plugin-injective/injective-sdk-client-ts/src/exceptions/GrpcException.ts new file mode 100644 index 00000000000..7f5f48cdc14 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/exceptions/GrpcException.ts @@ -0,0 +1,24 @@ +import { + GeneralException, + UnspecifiedErrorCode, +} from "@injectivelabs/exceptions"; + +export class GrpcException extends GeneralException { + constructor( + error: Error | string, + public code = UnspecifiedErrorCode, + public contextModule?: string + ) { + super(error instanceof Error ? error : new Error(error)); + this.name = "GrpcException"; + } + + public toJSON() { + return { + name: this.name, + message: this.message, + code: this.code, + contextModule: this.contextModule, + }; + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/exceptions/index.ts b/packages/plugin-injective/injective-sdk-client-ts/src/exceptions/index.ts new file mode 100644 index 00000000000..d85ddc9ae63 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/exceptions/index.ts @@ -0,0 +1 @@ +export * from "./GrpcException"; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/grpc/grpc-base.ts b/packages/plugin-injective/injective-sdk-client-ts/src/grpc/grpc-base.ts new file mode 100644 index 00000000000..6ee22177a52 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/grpc/grpc-base.ts @@ -0,0 +1,242 @@ +// We need to add the following: +// basically wrap rpc requests, query, and response +// TODO : Assert type safety for the requests +import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; +//chain imports +import { + ChainGrpcAuctionApi, + ChainGrpcAuthApi, + ChainGrpcAuthZApi, + ChainGrpcBankApi, + ChainGrpcDistributionApi, + ChainGrpcExchangeApi, + ChainGrpcGovApi, + ChainGrpcIbcApi, + ChainGrpcInsuranceFundApi, + ChainGrpcMintApi, + ChainGrpcOracleApi, + ChainGrpcPeggyApi, + ChainGrpcPermissionsApi, + ChainGrpcStakingApi, + ChainGrpcTendermintApi, + ChainGrpcTokenFactoryApi, + ChainGrpcWasmApi, + ChainGrpcWasmXApi, + MsgBroadcasterWithPk, +} from "@injectivelabs/sdk-ts"; +//indexer imports +import { + IndexerGrpcAccountApi, + IndexerGrpcArchiverApi, + IndexerGrpcAuctionApi, + IndexerGrpcDerivativesApi, + IndexerGrpcExplorerApi, + IndexerGrpcInsuranceFundApi, + IndexerGrpcMitoApi, + IndexerGrpcOracleApi, + IndexerGrpcAccountPortfolioApi, + IndexerGrpcSpotApi, + IndexerGrpcTradingApi, + IndexerGrpcWeb3GwApi, +} from "@injectivelabs/sdk-ts"; +//minimal rest imports +import { + ChainRestAuthApi, + ChainRestTendermintApi, + getInjectiveAddress, + getEthereumAddress, +} from "@injectivelabs/sdk-ts"; + +export type RequestMethod = ( + request: TRequest +) => Promise; + +export interface GrpcRequestOptions { + method: RequestMethod; + params: TRequest; + endpoint?: string; +} + +export interface GrpcQueryOptions { + method: RequestMethod; + params: TRequest; + endpoint?: string; +} + +export class InjectiveGrpcBase { + protected readonly network: Network; + protected readonly endpoints: ReturnType; + //rest for auth + protected readonly chainRestAuthApi: ChainRestAuthApi; + protected readonly chainRestTendermintApi: ChainRestTendermintApi; + //add all chain grpc endpoints here + protected readonly chainGrpcAuctionApi: ChainGrpcAuctionApi; + protected readonly chainGrpcAuthApi: ChainGrpcAuthApi; + protected readonly chainGrpcAuthZApi: ChainGrpcAuthZApi; + protected readonly chainGrpcBankApi: ChainGrpcBankApi; + protected readonly chainGrpcDistributionApi: ChainGrpcDistributionApi; + protected readonly chainGrpcExchangeApi: ChainGrpcExchangeApi; + protected readonly chainGrpcGovApi: ChainGrpcGovApi; + protected readonly chainGrpcIbcApi: ChainGrpcIbcApi; + protected readonly chainGrpcInsuranceFundApi: ChainGrpcInsuranceFundApi; + protected readonly chainGrpcMintApi: ChainGrpcMintApi; + protected readonly chainGrpcOracleApi: ChainGrpcOracleApi; + protected readonly chainGrpcPeggyApi: ChainGrpcPeggyApi; + protected readonly chainGrpcPermissionsApi: ChainGrpcPermissionsApi; + protected readonly chainGrpcStakingApi: ChainGrpcStakingApi; + protected readonly chainGrpcTendermintApi: ChainGrpcTendermintApi; + protected readonly chainGrpcTokenFactoryApi: ChainGrpcTokenFactoryApi; + protected readonly chainGrpcWasmApi: ChainGrpcWasmApi; + protected readonly chainGrpcWasmXApi: ChainGrpcWasmXApi; + + //add all indexer grpc endpoints here + protected readonly indexerGrpcAuctionApi: IndexerGrpcAuctionApi; + //these are majorly exchange module's + protected readonly indexerGrpcDerivativesApi: IndexerGrpcDerivativesApi; + protected readonly indexerGrpcAccountApi: IndexerGrpcAccountApi; + protected readonly indexerGrpcAccountPortfolioApi: IndexerGrpcAccountPortfolioApi; + protected readonly indexerGrpcSpotApi: IndexerGrpcSpotApi; + protected readonly indexerGrpcInsuranceFundApi: IndexerGrpcInsuranceFundApi; + protected readonly indexerGrpcTradingApi: IndexerGrpcTradingApi; + protected readonly indexerGrpcArchiverApi: IndexerGrpcArchiverApi; + + //this is explorer import + protected readonly indexerGrpcExplorerApi: IndexerGrpcExplorerApi; + + protected readonly indexerGrpcMitoApi: IndexerGrpcMitoApi; + protected readonly indexerGrpcOracleApi: IndexerGrpcOracleApi; + protected readonly indexerGrpcWeb3GwApi: IndexerGrpcWeb3GwApi; + + protected readonly ethAddress: string; + protected readonly injAddress: string; + private privateKey: string; + protected msgBroadcaster!: MsgBroadcasterWithPk; + constructor( + protected readonly networkType: keyof typeof Network = "Mainnet", + protected readonly injectivePrivateKey: string, + protected readonly ethPublicKey?: string, + protected readonly injPublicKey?: string + ) { + this.network = Network[networkType]; + this.endpoints = getNetworkEndpoints(this.network); + //Initialize the broadcaster + + // Initialize Chain gRPCs + this.chainGrpcAuctionApi = new ChainGrpcAuctionApi(this.endpoints.grpc); + this.chainGrpcAuthApi = new ChainGrpcAuthApi(this.endpoints.grpc); + this.chainGrpcAuthZApi = new ChainGrpcAuthZApi(this.endpoints.grpc); + this.chainGrpcBankApi = new ChainGrpcBankApi(this.endpoints.grpc); + this.chainGrpcDistributionApi = new ChainGrpcDistributionApi( + this.endpoints.grpc + ); + this.chainGrpcExchangeApi = new ChainGrpcExchangeApi( + this.endpoints.grpc + ); + this.chainGrpcGovApi = new ChainGrpcGovApi(this.endpoints.grpc); + this.chainGrpcIbcApi = new ChainGrpcIbcApi(this.endpoints.grpc); + this.chainGrpcInsuranceFundApi = new ChainGrpcInsuranceFundApi( + this.endpoints.grpc + ); + this.chainGrpcMintApi = new ChainGrpcMintApi(this.endpoints.grpc); + this.chainGrpcOracleApi = new ChainGrpcOracleApi(this.endpoints.grpc); + this.chainGrpcPeggyApi = new ChainGrpcPeggyApi(this.endpoints.grpc); + this.chainGrpcPermissionsApi = new ChainGrpcPermissionsApi( + this.endpoints.grpc + ); + this.chainGrpcStakingApi = new ChainGrpcStakingApi(this.endpoints.grpc); + this.chainGrpcTendermintApi = new ChainGrpcTendermintApi( + this.endpoints.grpc + ); + this.chainGrpcTokenFactoryApi = new ChainGrpcTokenFactoryApi( + this.endpoints.grpc + ); + this.chainGrpcWasmApi = new ChainGrpcWasmApi(this.endpoints.grpc); + this.chainGrpcWasmXApi = new ChainGrpcWasmXApi(this.endpoints.grpc); + + // Initialize Indexer gRPCs + // All exchange related functions + this.indexerGrpcDerivativesApi = new IndexerGrpcDerivativesApi( + this.endpoints.indexer + ); + this.indexerGrpcAccountApi = new IndexerGrpcAccountApi( + this.endpoints.indexer + ); + this.indexerGrpcInsuranceFundApi = new IndexerGrpcInsuranceFundApi( + this.endpoints.indexer + ); + this.indexerGrpcAccountPortfolioApi = + new IndexerGrpcAccountPortfolioApi(this.endpoints.indexer); + this.indexerGrpcTradingApi = new IndexerGrpcTradingApi( + this.endpoints.indexer + ); + this.indexerGrpcSpotApi = new IndexerGrpcSpotApi( + this.endpoints.indexer + ); + // End of exchange functions + this.indexerGrpcArchiverApi = new IndexerGrpcArchiverApi( + this.endpoints.indexer + ); + this.indexerGrpcAuctionApi = new IndexerGrpcAuctionApi( + this.endpoints.indexer + ); + this.indexerGrpcExplorerApi = new IndexerGrpcExplorerApi( + this.endpoints.indexer + ); + //TODO: WARNING replace with testnet env, dont leave this hardcoded + const MITO_API_ENDPOINT = + "https://k8s.mainnet.mito.grpc-web.injective.network"; + this.indexerGrpcMitoApi = new IndexerGrpcMitoApi(MITO_API_ENDPOINT); + this.indexerGrpcOracleApi = new IndexerGrpcOracleApi( + this.endpoints.indexer + ); + this.indexerGrpcWeb3GwApi = new IndexerGrpcWeb3GwApi( + this.endpoints.indexer + ); + + // Minimal REST endpoint - TODO: need to move this into REST client + + this.chainRestAuthApi = new ChainRestAuthApi(this.endpoints.rest); + this.chainRestTendermintApi = new ChainRestTendermintApi( + this.endpoints.rest + ); + + // Initialize EthAddress and InjAddress + this.ethAddress = + ethPublicKey || + (injPublicKey ? getEthereumAddress(injPublicKey) : ""); + + this.injAddress = + injPublicKey || + (ethPublicKey ? getInjectiveAddress(ethPublicKey) : ""); + + this.privateKey = injectivePrivateKey; + + this.msgBroadcaster = new MsgBroadcasterWithPk({ + network: this.network, + privateKey: this.privateKey, + }); + } + /** + * Get network configuration + * @returns Current network endpoints + */ + protected getNetworkConfig() { + return { + network: this.network, + endpoints: this.endpoints, + }; + } + + /** + * Check if the connection is alive + * @returns Promise resolving to boolean indicating connection status + */ + protected async isConnectionAlive(): Promise { + try { + await this.chainGrpcAuthApi.fetchModuleParams(); + return true; + } catch { + return false; + } + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/Ibc.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/Ibc.ts new file mode 100644 index 00000000000..6b990c78b1e --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/Ibc.ts @@ -0,0 +1,78 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base.js"; +import { PaginationOption } from "@injectivelabs/ts-types"; +import { MsgTransfer, TxResponse } from "@injectivelabs/sdk-ts"; +import * as IBCTypes from "../types/ibc"; // Assuming IBC types are in ibc.ts +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; + +/** + * IBC Module Chain GRPC Async Functions with Error Handling + */ + +/** + * Fetches the denomination trace for a specific hash. + * + * @this InjectiveGrpcBase + * @param {IBCTypes.GetDenomTraceParams} params - Parameters including the denomination hash. + * @returns {Promise} The standard response containing the denomination trace or an error. + */ +export async function getDenomTrace( + this: InjectiveGrpcBase, + params: IBCTypes.GetDenomTraceParams +): Promise { + try { + const result = await this.chainGrpcIbcApi.fetchDenomTrace(params.hash); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDenomTraceError", err); + } +} + +/** + * Fetches a list of denomination traces with optional pagination. + * + * @this InjectiveGrpcBase + * @param {IBCTypes.GetDenomsTraceParams} [params] - Optional parameters including pagination options. + * @returns {Promise} The standard response containing a list of denomination traces or an error. + */ +export async function getDenomsTrace( + this: InjectiveGrpcBase, + params: IBCTypes.GetDenomsTraceParams +): Promise { + try { + const result = await this.chainGrpcIbcApi.fetchDenomsTrace( + params.pagination + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDenomsTraceError", err); + } +} + +/** + * Broadcasts an IBC transfer message. + * + * @this InjectiveGrpcBase + * @param {IBCTypes.MsgIBCTransferParams} params - Parameters to perform the IBC transfer. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgIBCTransfer( + this: InjectiveGrpcBase, + params: IBCTypes.MsgIBCTransferParams +): Promise { + try { + const msg = MsgTransfer.fromJSON({ + ...params, + sender: this.injAddress, + }); + const result: TxResponse = await this.msgBroadcaster.broadcast({ + msgs: msg, + }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgIBCTransferError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/auction.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/auction.ts new file mode 100644 index 00000000000..8b0454acfcb --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/auction.ts @@ -0,0 +1,128 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import { MsgBid } from "@injectivelabs/sdk-ts"; +import * as AuctionTypes from "../types/auction"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; +import { INJ_DENOM } from "@injectivelabs/utils"; + +/** + * Fetches the auction module parameters. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing module parameters or an error. + */ +export async function getAuctionModuleParams( + this: InjectiveGrpcBase +): Promise { + try { + const result = this.chainGrpcAuctionApi.fetchModuleParams(); + + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getAuctionModuleParamsError", err); + } +} + +/** + * Fetches the auction module state. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing module state or an error. + */ +export async function getAuctionModuleState( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcAuctionApi.fetchModuleState(); + + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getAuctionModuleStateError", err); + } +} + +/** + * Fetches the current auction basket. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing the current basket or an error. + */ +export async function getCurrentBasket( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcAuctionApi.fetchCurrentBasket(); + + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getCurrentBasketError", err); + } +} + +/** + * Fetches details of a specific auction round. + * + * @this InjectiveGrpcBase + * @param {AuctionTypes.GetAuctionRoundParams} params - Parameters including the auction round number. + * @returns {Promise} The standard response containing auction round details or an error. + */ +export async function getAuctionRound( + this: InjectiveGrpcBase, + params: AuctionTypes.GetAuctionRoundParams +): Promise { + try { + const result = await this.indexerGrpcAuctionApi.fetchAuction( + params.round + ); + + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getAuctionRoundError", err); + } +} + +/** + * Fetches a list of auctions based on provided parameters. + * + * @this InjectiveGrpcBase + * @param {AuctionTypes.GetAuctionsParams} params - Parameters to filter auctions. + * @returns {Promise} The standard response containing a list of auctions or an error. + */ +export async function getAuctions( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.indexerGrpcAuctionApi.fetchAuctions(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getAuctionsError", err); + } +} + +/** + * Places a bid in an auction round. + * + * @this InjectiveGrpcBase + * @param {AuctionTypes.MsgBidRequestParams} params - Parameters including round number and bid amount. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgBid( + this: InjectiveGrpcBase, + params: AuctionTypes.MsgBidRequestParams +): Promise { + try { + const amount = { denom: INJ_DENOM, amount: params.amount }; + const msg = MsgBid.fromJSON({ + round: params.round, + injectiveAddress: this.injAddress, + amount: amount, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgBidError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/auth.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/auth.ts new file mode 100644 index 00000000000..9ea8258a638 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/auth.ts @@ -0,0 +1,61 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types"; + +/** + * Fetches the authentication module parameters. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing module parameters or an error. + */ +export async function getAuthModuleParams( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcAuthApi.fetchModuleParams(); + + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getAuthModuleParamsError", err); + } +} + +/** + * Fetches the details of the current account. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing account details or an error. + */ +export async function getAccountDetails( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcAuthApi.fetchAccount( + this.injAddress + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getAccountDetailsError", err); + } +} + +/** + * Fetches all accounts associated with the current address. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing all accounts or an error. + */ +export async function getAccounts( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcAuthApi.fetchAccounts(); + + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getAccountsError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/authz.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/authz.ts new file mode 100644 index 00000000000..f6c1379f258 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/authz.ts @@ -0,0 +1,141 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import { MsgGrant, MsgRevoke, MsgAuthzExec } from "@injectivelabs/sdk-ts"; +import * as AuthzTypes from "../types/auth"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; + +/** + * Fetches all grants based on provided parameters. + * + * @this InjectiveGrpcBase + * @param {AuthzTypes.GetGrantsParams} params - Parameters to filter grants. + * @returns {Promise} The standard response containing grants or an error. + */ +export async function getGrants( + this: InjectiveGrpcBase, + params: AuthzTypes.GetGrantsParams +): Promise { + try { + const result = await this.chainGrpcAuthZApi.fetchGrants(params); + + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getGrantsError", err); + } +} + +/** + * Fetches all grants granted by a specific granter. + * + * @this InjectiveGrpcBase + * @param {AuthzTypes.GetGranterGrantsParams} params - Parameters including the granter's address. + * @returns {Promise} The standard response containing grants or an error. + */ +export async function getGranterGrants( + this: InjectiveGrpcBase, + params: AuthzTypes.GetGranterGrantsParams +): Promise { + try { + const result = await this.chainGrpcAuthZApi.fetchGranterGrants( + params.granter + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getGranterGrantsError", err); + } +} + +/** + * Fetches all grants received by a specific grantee. + * + * @this InjectiveGrpcBase + * @param {AuthzTypes.GetGranteeGrantsParams} params - Parameters including the grantee's address. + * @returns {Promise} The standard response containing grants or an error. + */ +export async function getGranteeGrants( + this: InjectiveGrpcBase, + params: AuthzTypes.GetGranteeGrantsParams +): Promise { + try { + const result = await this.chainGrpcAuthZApi.fetchGranteeGrants( + params.grantee + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getGranteeGrantsError", err); + } +} + +/** + * Grants authorization to a grantee to perform specific actions on behalf of the granter. + * + * @this InjectiveGrpcBase + * @param {AuthzTypes.MsgGrantParams} params - Parameters including message type, grantee, and granter. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgGrant( + this: InjectiveGrpcBase, + params: AuthzTypes.MsgGrantParams +): Promise { + try { + const msg = MsgGrant.fromJSON({ + messageType: params.messageType, + grantee: params.grantee, + granter: params.granter, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgGrantError", err); + } +} + +/** + * Executes authorized messages on behalf of the grantee. + * + * @this InjectiveGrpcBase + * @param {AuthzTypes.MsgAuthzExecParams} params - Parameters including grantee and messages to execute. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgExec( + this: InjectiveGrpcBase, + params: AuthzTypes.MsgAuthzExecParams +): Promise { + try { + const msg = MsgAuthzExec.fromJSON({ + grantee: params.grantee, + msgs: params.msgs, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgExecError", err); + } +} + +/** + * Revokes previously granted authorizations from a grantee. + * + * @this InjectiveGrpcBase + * @param {AuthzTypes.MsgRevokeParams} params - Parameters including message type, grantee, and granter. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgRevoke( + this: InjectiveGrpcBase, + params: AuthzTypes.MsgRevokeParams +): Promise { + try { + const msg = MsgRevoke.fromJSON({ + messageType: params.messageType, + grantee: params.grantee, + granter: params.granter, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgRevokeError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/bank.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/bank.ts new file mode 100644 index 00000000000..cf6af2dc3fd --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/bank.ts @@ -0,0 +1,232 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import { MsgSend, MsgMultiSend } from "@injectivelabs/sdk-ts"; +import * as BankTypes from "../types/bank"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; + +// Bank Module Chain GRPC Async Functions with Error Handling + +/** + * Fetches the bank module parameters. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing module parameters or an error. + */ +export async function getBankModuleParams( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcBankApi.fetchModuleParams(); + + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getBankModuleParamsError", err); + } +} + +/** + * Fetches the balance of a specific account. + * + * @this InjectiveGrpcBase + * @param {BankTypes.GetBankBalanceParams} params - Parameters including account address. + * @returns {Promise} The standard response containing the balance or an error. + */ +export async function getBankBalance( + this: InjectiveGrpcBase, + params: BankTypes.GetBankBalanceParams +): Promise { + try { + const result = await this.chainGrpcBankApi.fetchBalance({ + ...params, + accountAddress: this.injAddress, + }); + + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getBankBalanceError", err); + } +} + +/** + * Fetches all balances for the current account. + * + * @this InjectiveGrpcBase + * @param {BankTypes.GetBankBalancesParams} params - Parameters including account identifier. + * @returns {Promise} The standard response containing all balances or an error. + */ +export async function getBankBalances( + this: InjectiveGrpcBase, + params: BankTypes.GetBankBalancesParams +): Promise { + try { + const result = await this.chainGrpcBankApi.fetchBalances( + this.injAddress + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getBankBalancesError", err); + } +} + +/** + * Fetches the total supply of all denominations. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing total supply or an error. + */ +export async function getTotalSupply( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcBankApi.fetchTotalSupply(); + + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getTotalSupplyError", err); + } +} + +/** + * Fetches the total supply for all denominations. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing all total supplies or an error. + */ +export async function getAllTotalSupply( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcBankApi.fetchAllTotalSupply(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getAllTotalSupplyError", err); + } +} + +/** + * Fetches the supply of a specific denomination. + * + * @this InjectiveGrpcBase + * @param {BankTypes.GetSupplyOfParams} params - Parameters including denomination. + * @returns {Promise} The standard response containing the supply or an error. + */ +export async function getSupplyOf( + this: InjectiveGrpcBase, + params: BankTypes.GetSupplyOfParams +): Promise { + try { + const result = await this.chainGrpcBankApi.fetchSupplyOf(params.denom); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getSupplyOfError", err); + } +} + +/** + * Fetches metadata for all denominations. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing denomination metadata or an error. + */ +export async function getDenomsMetadata( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcBankApi.fetchDenomsMetadata(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDenomsMetadataError", err); + } +} + +/** + * Fetches metadata for a specific denomination. + * + * @this InjectiveGrpcBase + * @param {BankTypes.GetDenomMetadataParams} params - Parameters including denomination. + * @returns {Promise} The standard response containing denomination metadata or an error. + */ +export async function getDenomMetadata( + this: InjectiveGrpcBase, + params: BankTypes.GetDenomMetadataParams +): Promise { + try { + const result = await this.chainGrpcBankApi.fetchDenomMetadata( + params.denom + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDenomMetadataError", err); + } +} + +/** + * Fetches the owners of a specific denomination. + * + * @this InjectiveGrpcBase + * @param {BankTypes.GetDenomOwnersParams} params - Parameters including denomination. + * @returns {Promise} The standard response containing denomination owners or an error. + */ +export async function getDenomOwners( + this: InjectiveGrpcBase, + params: BankTypes.GetDenomOwnersParams +): Promise { + try { + const result = await this.chainGrpcBankApi.fetchDenomOwners( + params.denom + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDenomOwnersError", err); + } +} + +/** + * Sends tokens from one account to another. + * + * @this InjectiveGrpcBase + * @param {BankTypes.MsgSendParams} params - Parameters including sender, receiver, and amount. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgSend( + this: InjectiveGrpcBase, + params: BankTypes.MsgSendParams +): Promise { + try { + const msg = MsgSend.fromJSON({ + amount: params.amount, + srcInjectiveAddress: params.srcInjectiveAddress, + dstInjectiveAddress: params.dstInjectiveAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgSendError", err); + } +} + +/** + * Sends tokens from multiple senders to multiple receivers. + * + * @this InjectiveGrpcBase + * @param {BankTypes.MsgMultiSendParams} params - Parameters including inputs and outputs. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgMultiSend( + this: InjectiveGrpcBase, + params: BankTypes.MsgMultiSendParams +): Promise { + try { + const msg = MsgMultiSend.fromJSON({ + inputs: params.inputs, + outputs: params.outputs, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgMultiSendError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/distribution.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/distribution.ts new file mode 100644 index 00000000000..8c1d740f339 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/distribution.ts @@ -0,0 +1,173 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import { + MsgWithdrawDelegatorReward, + MsgWithdrawValidatorCommission, +} from "@injectivelabs/sdk-ts"; +import * as DistributionTypes from "../types/distribution"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; + +// Distribution Module Async Functions with Error Handling + +/** + * Fetches the distribution module parameters. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing module parameters or an error. + */ +export async function getDistributionModuleParams( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcDistributionApi.fetchModuleParams(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDistributionModuleParamsError", err); + } +} + +/** + * Fetches the delegator rewards for a specific validator. + * + * @this InjectiveGrpcBase + * @param {DistributionTypes.GetDelegatorRewardsForValidatorParams} params - Parameters including delegator and validator addresses. + * @returns {Promise} The standard response containing delegator rewards or an error. + */ +export async function getDelegatorRewardsForValidator( + this: InjectiveGrpcBase, + params: DistributionTypes.GetDelegatorRewardsForValidatorParams +): Promise { + try { + const result = + await this.chainGrpcDistributionApi.fetchDelegatorRewardsForValidator( + { + delegatorAddress: params.delegatorAddress, + validatorAddress: params.validatorAddress, + } + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDelegatorRewardsForValidatorError", err); + } +} + +/** + * Fetches the delegator rewards for a specific validator without throwing an error. + * + * @this InjectiveGrpcBase + * @param {DistributionTypes.GetDelegatorRewardsForValidatorParams} params - Parameters including delegator and validator addresses. + * @returns {Promise} The standard response containing delegator rewards or an error. + */ +export async function getDelegatorRewardsForValidatorNoThrow( + this: InjectiveGrpcBase, + params: DistributionTypes.GetDelegatorRewardsForValidatorParams +): Promise { + try { + const result = + await this.chainGrpcDistributionApi.fetchDelegatorRewardsForValidatorNoThrow( + { + delegatorAddress: params.delegatorAddress, + validatorAddress: params.validatorAddress, + } + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse( + "getDelegatorRewardsForValidatorNoThrowError", + err + ); + } +} + +/** + * Fetches the rewards for a delegator. + * + * @this InjectiveGrpcBase + * @param {DistributionTypes.GetDelegatorRewardsParams} params - Parameters including the delegator's Injective address. + * @returns {Promise} The standard response containing delegator rewards or an error. + */ +export async function getDelegatorRewards( + this: InjectiveGrpcBase, + params: DistributionTypes.GetDelegatorRewardsParams +): Promise { + try { + const result = + await this.chainGrpcDistributionApi.fetchDelegatorRewards( + params.injectiveAddress + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDelegatorRewardsError", err); + } +} + +/** + * Fetches the rewards for a delegator without throwing an error. + * + * @this InjectiveGrpcBase + * @param {DistributionTypes.GetDelegatorRewardsParams} params - Parameters including the delegator's Injective address. + * @returns {Promise} The standard response containing delegator rewards or an error. + */ +export async function getDelegatorRewardsNoThrow( + this: InjectiveGrpcBase, + params: DistributionTypes.GetDelegatorRewardsParams +): Promise { + try { + const result = + await this.chainGrpcDistributionApi.fetchDelegatorRewardsNoThrow( + params.injectiveAddress + ); + + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDelegatorRewardsNoThrowError", err); + } +} + +/** + * Broadcasts a message to withdraw delegator rewards. + * + * @this InjectiveGrpcBase + * @param {DistributionTypes.MsgWithdrawDelegatorRewardParams} params - Parameters including delegator and validator addresses. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgWithdrawDelegatorReward( + this: InjectiveGrpcBase, + params: DistributionTypes.MsgWithdrawDelegatorRewardParams +): Promise { + try { + const msg = MsgWithdrawDelegatorReward.fromJSON({ + delegatorAddress: params.delegatorAddress, + validatorAddress: params.validatorAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgWithdrawDelegatorRewardError", err); + } +} + +/** + * Broadcasts a message to withdraw validator commission. + * + * @this InjectiveGrpcBase + * @param {DistributionTypes.MsgWithdrawValidatorCommissionParams} params - Parameters including the validator's address. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgWithdrawValidatorCommission( + this: InjectiveGrpcBase, + params: DistributionTypes.MsgWithdrawValidatorCommissionParams +): Promise { + try { + const msg = MsgWithdrawValidatorCommission.fromJSON({ + validatorAddress: params.validatorAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgWithdrawValidatorCommissionError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/exchange.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/exchange.ts new file mode 100644 index 00000000000..014a8296bb8 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/exchange.ts @@ -0,0 +1,1679 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import { + BinaryOptionsMarket, + DerivativeLimitOrder, + DerivativeOrderHistory, + Position, + PositionV2, + DerivativeTrade, + FundingPayment, + FundingRate, + ExchangePagination, + SubaccountTransfer, + SpotLimitOrder, + SpotOrderHistory, + SpotTrade, + AtomicSwap, + MsgAdminUpdateBinaryOptionsMarket, + MsgBatchCancelBinaryOptionsOrders, + MsgBatchCancelDerivativeOrders, + MsgBatchCancelSpotOrders, + MsgBatchUpdateOrders, + MsgCancelBinaryOptionsOrder, + MsgCancelDerivativeOrder, + MsgCancelSpotOrder, + MsgCreateBinaryOptionsLimitOrder, + MsgCreateBinaryOptionsMarketOrder, + MsgCreateDerivativeLimitOrder, + MsgCreateDerivativeMarketOrder, + MsgCreateSpotLimitOrder, + MsgCreateSpotMarketOrder, + MsgDeposit, + MsgIncreasePositionMargin, + MsgInstantSpotMarketLaunch, + MsgLiquidatePosition, + MsgReclaimLockedFunds, + MsgRewardsOptOut, + MsgSignData, + MsgWithdraw, + MsgExternalTransfer, +} from "@injectivelabs/sdk-ts"; +import * as ExchangeTypes from "../types/exchange"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; + +/** + * Exchange Module Chain GRPC Async Functions with Error Handling + */ + +/** + * Fetches the exchange module parameters. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetModuleParamsParams} [params] - Optional parameters to filter module parameters. + * @returns {Promise} The standard response containing module parameters or an error. + */ +export async function getModuleParams( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetModuleParamsParams +): Promise { + try { + const result = await this.chainGrpcExchangeApi.fetchModuleParams(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getModuleParamsError", err); + } +} + +/** + * Fetches the current state of the exchange module. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetModuleStateParams} [params] - Optional parameters to filter module state. + * @returns {Promise} The standard response containing module state or an error. + */ +export async function getModuleState( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetModuleStateParams +): Promise { + try { + const result = await this.chainGrpcExchangeApi.fetchModuleState(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getModuleStateError", err); + } +} + +/** + * Fetches the fee discount schedule. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetFeeDiscountScheduleParams} [params] - Optional parameters to filter fee discount schedule. + * @returns {Promise} The standard response containing fee discount schedule or an error. + */ +export async function getFeeDiscountSchedule( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetFeeDiscountScheduleParams +): Promise { + try { + const result = + await this.chainGrpcExchangeApi.fetchFeeDiscountSchedule(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getFeeDiscountScheduleError", err); + } +} + +/** + * Fetches the fee discount account information for a specific Injective address. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetFeeDiscountAccountInfoParams} params - Parameters including the Injective address. + * @returns {Promise} The standard response containing fee discount account info or an error. + */ +export async function getFeeDiscountAccountInfo( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetFeeDiscountAccountInfoParams +): Promise { + try { + const result = + await this.chainGrpcExchangeApi.fetchFeeDiscountAccountInfo( + params.injAddress + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getFeeDiscountAccountInfoError", err); + } +} + +/** + * Fetches the trading rewards campaign details. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetTradingRewardsCampaignParams} [params] - Optional parameters to filter trading rewards campaign. + * @returns {Promise} The standard response containing trading rewards campaign details or an error. + */ +export async function getTradingRewardsCampaign( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetTradingRewardsCampaignParams +): Promise { + try { + const result = + await this.chainGrpcExchangeApi.fetchTradingRewardsCampaign(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getTradingRewardsCampaignError", err); + } +} + +/** + * Fetches the trade reward points for specified Injective addresses. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetTradeRewardPointsParams} params - Parameters including Injective addresses. + * @returns {Promise} The standard response containing trade reward points or an error. + */ +export async function getTradeRewardPoints( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetTradeRewardPointsParams +): Promise { + try { + const result = await this.chainGrpcExchangeApi.fetchTradeRewardPoints( + params.injectiveAddresses + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getTradeRewardPointsError", err); + } +} + +/** + * Fetches the pending trade reward points for specified Injective addresses. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetPendingTradeRewardPointsParams} params - Parameters including Injective addresses. + * @returns {Promise} The standard response containing pending trade reward points or an error. + */ +export async function getPendingTradeRewardPoints( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetPendingTradeRewardPointsParams +): Promise { + try { + const result = + await this.chainGrpcExchangeApi.fetchPendingTradeRewardPoints( + params.injectiveAddresses + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getPendingTradeRewardPointsError", err); + } +} + +/** + * Fetches the exchange positions based on provided parameters. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.getPositionsParams} [params] - Optional parameters to filter exchange positions. + * @returns {Promise} The standard response containing exchange positions or an error. + */ +export async function getExchangePositions( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetExchangePositionsParams +): Promise { + try { + const result = await this.chainGrpcExchangeApi.fetchPositions(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getPositionsError", err); + } +} + +/** + * Fetches the trade nonce for a specific subaccount. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetSubaccountTradeNonceParams} params - Parameters including the subaccount ID. + * @returns {Promise} The standard response containing trade nonce or an error. + */ +export async function getSubaccountTradeNonce( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetSubaccountTradeNonceParams +): Promise { + try { + const result = + await this.chainGrpcExchangeApi.fetchSubaccountTradeNonce( + params.subaccountId + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getSubaccountTradeNonceError", err); + } +} + +/** + * Checks if an account is opted out of rewards. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetIsOptedOutOfRewardsParams} params - Parameters including the account address. + * @returns {Promise} The standard response indicating opt-out status or an error. + */ +export async function getIsOptedOutOfRewards( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetIsOptedOutOfRewardsParams +): Promise { + try { + const result = await this.chainGrpcExchangeApi.fetchIsOptedOutOfRewards( + params.account + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getIsOptedOutOfRewardsError", err); + } +} + +/** + * Fetches all derivative markets. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetDerivativeMarketsParams} [params] - Optional parameters to filter derivative markets. + * @returns {Promise} The standard response containing derivative markets or an error. + */ +export async function getDerivativeMarkets( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetDerivativeMarketsParams +): Promise { + try { + const result = await this.indexerGrpcDerivativesApi.fetchMarkets( + params || {} + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDerivativeMarketsError", err); + } +} + +/** + * Fetches a specific derivative market by its ID. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetDerivativeMarketParams} params - Parameters including the market ID. + * @returns {Promise} The standard response containing derivative market details or an error. + */ +export async function getDerivativeMarket( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetDerivativeMarketParams +): Promise { + try { + const result = await this.indexerGrpcDerivativesApi.fetchMarket( + params.marketId + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDerivativeMarketError", err); + } +} + +/** + * Fetches all binary options markets. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetBinaryOptionsMarketsParams} [params] - Optional parameters to filter binary options markets. + * @returns {Promise} The standard response containing binary options markets or an error. + */ +export async function getBinaryOptionsMarkets( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetBinaryOptionsMarketsParams +): Promise { + try { + const result = + await this.indexerGrpcDerivativesApi.fetchBinaryOptionsMarkets( + params || {} + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getBinaryOptionsMarketsError", err); + } +} + +/** + * Fetches a specific binary options market by its ID. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetBinaryOptionsMarketParams} params - Parameters including the market ID. + * @returns {Promise} The standard response containing binary options market details or an error. + */ +export async function getBinaryOptionsMarket( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetBinaryOptionsMarketParams +): Promise { + try { + const result = + await this.indexerGrpcDerivativesApi.fetchBinaryOptionsMarket( + params.marketId + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getBinaryOptionsMarketError", err); + } +} + +/** + * Fetches all derivative orders. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetDerivativeOrdersParams} [params] - Optional parameters to filter derivative orders. + * @returns {Promise} The standard response containing derivative orders or an error. + */ +export async function getDerivativeOrders( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetDerivativeOrdersParams +): Promise { + try { + const result = await this.indexerGrpcDerivativesApi.fetchOrders( + params || {} + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDerivativeOrdersError", err); + } +} + +/** + * Fetches the history of derivative orders. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetDerivativeOrderHistoryParams} [params] - Optional parameters to filter derivative order history. + * @returns {Promise} The standard response containing derivative order history or an error. + */ +export async function getDerivativeOrderHistory( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetDerivativeOrderHistoryParams +): Promise { + try { + const result = await this.indexerGrpcDerivativesApi.fetchOrderHistory( + params || {} + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDerivativeOrderHistoryError", err); + } +} + +/** + * Fetches all positions. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetPositionsParams} [params] - Optional parameters to filter positions. + * @returns {Promise} The standard response containing positions or an error. + */ +export async function getPositionsList( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetPositionsParams +): Promise { + try { + const result = await this.indexerGrpcDerivativesApi.fetchPositions( + params || {} + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getPositionsListError", err); + } +} + +/** + * Fetches all positions version 2. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetPositionsV2Params} [params] - Optional parameters to filter positions version 2. + * @returns {Promise} The standard response containing positions version 2 or an error. + */ +export async function getPositionsV2( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetPositionsV2Params +): Promise { + try { + const result = await this.indexerGrpcDerivativesApi.fetchPositionsV2( + params || {} + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getPositionsV2Error", err); + } +} + +/** + * Fetches all derivative trades. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetDerivativeTradesParams} [params] - Optional parameters to filter derivative trades. + * @returns {Promise} The standard response containing derivative trades or an error. + */ +export async function getDerivativeTrades( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetDerivativeTradesParams +): Promise { + try { + const result = await this.indexerGrpcDerivativesApi.fetchTrades( + params || {} + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDerivativeTradesError", err); + } +} + +/** + * Fetches all funding payments. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetFundingPaymentsParams} [params] - Optional parameters to filter funding payments. + * @returns {Promise} The standard response containing funding payments or an error. + */ +export async function getFundingPayments( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetFundingPaymentsParams +): Promise { + try { + const result = + await this.indexerGrpcDerivativesApi.fetchFundingPayments( + params || {} + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getFundingPaymentsError", err); + } +} + +/** + * Fetches all funding rates. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetFundingRatesParams} [params] - Optional parameters to filter funding rates. + * @returns {Promise} The standard response containing funding rates or an error. + */ +export async function getFundingRates( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetFundingRatesParams +): Promise { + try { + const result = await this.indexerGrpcDerivativesApi.fetchFundingRates( + params || {} + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getFundingRatesError", err); + } +} + +/** + * Fetches the list of derivative subaccount orders. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetDerivativeSubaccountOrdersListParams} [params] - Optional parameters to filter subaccount orders. + * @returns {Promise} The standard response containing subaccount orders or an error. + */ +export async function getDerivativeSubaccountOrdersList( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetDerivativeSubaccountOrdersListParams +): Promise { + try { + const result = + await this.indexerGrpcDerivativesApi.fetchSubaccountOrdersList( + params || {} + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse( + "getDerivativeSubaccountOrdersListError", + err + ); + } +} + +/** + * Fetches the list of derivative subaccount trades. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetDerivativeSubaccountTradesListParams} params - Parameters to filter subaccount trades. + * @returns {Promise} The standard response containing subaccount trades or an error. + */ +export async function getDerivativeSubaccountTradesList( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetDerivativeSubaccountTradesListParams +): Promise { + try { + const result = + await this.indexerGrpcDerivativesApi.fetchSubaccountTradesList( + params + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse( + "getDerivativeSubaccountTradesListError", + err + ); + } +} + +/** + * Fetches the orderbooks version 2 for specified market IDs. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetDerivativeOrderbooksV2Params} params - Parameters including market IDs. + * @returns {Promise<{ + * marketId: string; + * orderbook: OrderbookWithSequence; + * }[] | StandardResponse>} The standard response containing orderbooks or an error. + */ +export async function getDerivativeOrderbooksV2( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetDerivativeOrderbooksV2Params +): Promise { + try { + const result = await this.indexerGrpcDerivativesApi.fetchOrderbooksV2( + params.marketIds + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDerivativeOrderbooksV2Error", err); + } +} + +/** + * Fetches the orderbook version 2 for a specific market ID. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetDerivativeOrderbookV2Params} params - Parameters including the market ID. + * @returns {Promise} The standard response containing the orderbook or an error. + */ +export async function getDerivativeOrderbookV2( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetDerivativeOrderbookV2Params +): Promise { + try { + const result = await this.indexerGrpcDerivativesApi.fetchOrderbookV2( + params.marketId + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDerivativeOrderbookV2Error", err); + } +} + +/** + * Fetches the rewards for specified Injective addresses. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetRewardsParams} params - Parameters including Injective addresses. + * @returns {Promise} The standard response containing rewards or an error. + */ +export async function getRewards( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetRewardsParams +): Promise { + try { + const result = await this.indexerGrpcAccountApi.fetchRewards(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getRewardsError", err); + } +} + +/** + * Fetches the list of subaccounts for a specific address. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetSubaccountsListParams} params - Parameters including the account address. + * @returns {Promise} The standard response containing subaccounts list or an error. + */ +export async function getSubaccountsList( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetSubaccountsListParams +): Promise { + try { + const result = await this.indexerGrpcAccountApi.fetchSubaccountsList( + params.address + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getSubaccountsListError", err); + } +} + +/** + * Fetches the balances list for a specific subaccount. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetSubaccountBalancesListParams} params - Parameters including the subaccount ID. + * @returns {Promise} The standard response containing subaccount balances list or an error. + */ +export async function getSubaccountBalancesList( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetSubaccountBalancesListParams +): Promise { + try { + const result = + await this.indexerGrpcAccountApi.fetchSubaccountBalancesList( + params.subaccountId + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getSubaccountBalancesListError", err); + } +} + +/** + * Fetches the history of a specific subaccount. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetSubaccountHistoryParams} params - Parameters including subaccount details. + * @returns {Promise} The standard response containing subaccount history or an error. + */ +export async function getSubaccountHistory( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetSubaccountHistoryParams +): Promise { + try { + const result = + await this.indexerGrpcAccountApi.fetchSubaccountHistory(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getSubaccountHistoryError", err); + } +} + +/** + * Fetches the order summary for a specific subaccount. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetSubaccountOrderSummaryParams} params - Parameters including subaccount details. + * @returns {Promise} The standard response containing subaccount order summary or an error. + */ +export async function getSubaccountOrderSummary( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetSubaccountOrderSummaryParams +): Promise { + try { + const result = + await this.indexerGrpcAccountApi.fetchSubaccountOrderSummary( + params + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getSubaccountOrderSummaryError", err); + } +} + +/** + * Fetches the states of orders. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetOrderStatesParams} [params] - Optional parameters to filter order states. + * @returns {Promise} The standard response containing order states or an error. + */ +export async function getOrderStates( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetOrderStatesParams +): Promise { + try { + const result = await this.indexerGrpcAccountApi.fetchOrderStates( + params || {} + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getOrderStatesError", err); + } +} + +/** + * Fetches the account portfolio for a specific address. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetAccountPortfolioParams} params - Parameters including the account address. + * @returns {Promise} The standard response containing account portfolio or an error. + */ +export async function getAccountPortfolio( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetAccountPortfolioParams +): Promise { + try { + const result = + await this.indexerGrpcAccountPortfolioApi.fetchAccountPortfolio( + params.address + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getAccountPortfolioError", err); + } +} + +/** + * Fetches the balances of the account portfolio for a specific address. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetAccountPortfolioBalancesParams} params - Parameters including the account address. + * @returns {Promise} The standard response containing account portfolio balances or an error. + */ +export async function getAccountPortfolioBalances( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetAccountPortfolioBalancesParams +): Promise { + try { + const result = + await this.indexerGrpcAccountPortfolioApi.fetchAccountPortfolioBalances( + params.address + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getAccountPortfolioBalancesError", err); + } +} + +/** + * Fetches all spot markets. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetSpotMarketsParams} [params] - Optional parameters to filter spot markets. + * @returns {Promise} The standard response containing spot markets or an error. + */ +export async function getSpotMarkets( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetSpotMarketsParams +): Promise { + try { + const result = await this.indexerGrpcSpotApi.fetchMarkets(params || {}); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getSpotMarketsError", err); + } +} + +/** + * Fetches a specific spot market by its ID. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetSpotMarketParams} params - Parameters including the market ID. + * @returns {Promise} The standard response containing spot market details or an error. + */ +export async function getSpotMarket( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetSpotMarketParams +): Promise { + try { + const result = await this.indexerGrpcSpotApi.fetchMarket( + params.marketId + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getSpotMarketError", err); + } +} + +/** + * Fetches all spot orders. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetSpotOrdersParams} [params] - Optional parameters to filter spot orders. + * @returns {Promise} The standard response containing spot orders or an error. + */ +export async function getSpotOrders( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetSpotOrdersParams +): Promise { + try { + const result = await this.indexerGrpcSpotApi.fetchOrders(params || {}); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getSpotOrdersError", err); + } +} + +/** + * Fetches the history of spot orders. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetSpotOrderHistoryParams} [params] - Optional parameters to filter spot order history. + * @returns {Promise} The standard response containing spot order history or an error. + */ +export async function getSpotOrderHistory( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetSpotOrderHistoryParams +): Promise { + try { + const result = await this.indexerGrpcSpotApi.fetchOrderHistory( + params || {} + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getSpotOrderHistoryError", err); + } +} + +/** + * Fetches all spot trades. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetSpotTradesParams} [params] - Optional parameters to filter spot trades. + * @returns {Promise} The standard response containing spot trades or an error. + */ +export async function getSpotTrades( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetSpotTradesParams +): Promise { + try { + const result = await this.indexerGrpcSpotApi.fetchTrades(params || {}); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getSpotTradesError", err); + } +} + +/** + * Fetches the list of spot subaccount orders. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetSpotSubaccountOrdersListParams} [params] - Optional parameters to filter spot subaccount orders. + * @returns {Promise} The standard response containing spot subaccount orders or an error. + */ +export async function getSpotSubaccountOrdersList( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetSpotSubaccountOrdersListParams +): Promise { + try { + const result = await this.indexerGrpcSpotApi.fetchSubaccountOrdersList( + params || {} + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getSpotSubaccountOrdersListError", err); + } +} + +/** + * Fetches the list of spot subaccount trades. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetSpotSubaccountTradesListParams} [params] - Optional parameters to filter spot subaccount trades. + * @returns {Promise} The standard response containing spot subaccount trades or an error. + */ +export async function getSpotSubaccountTradesList( + this: InjectiveGrpcBase, + params?: ExchangeTypes.GetSpotSubaccountTradesListParams +): Promise { + try { + const result = await this.indexerGrpcSpotApi.fetchSubaccountTradesList( + params || {} + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getSpotSubaccountTradesListError", err); + } +} + +/** + * Fetches the orderbooks version 2 for specified spot market IDs. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetSpotOrderbooksV2Params} params - Parameters including spot market IDs. + * @returns {Promise} The standard response containing spot orderbooks or an error. + */ +export async function getSpotOrderbooksV2( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetSpotOrderbooksV2Params +): Promise { + try { + const result = await this.indexerGrpcSpotApi.fetchOrderbooksV2( + params.marketIds + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getSpotOrderbooksV2Error", err); + } +} + +/** + * Fetches the orderbook version 2 for a specific spot market ID. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetSpotOrderbookV2Params} params - Parameters including the spot market ID. + * @returns {Promise} The standard response containing the spot orderbook or an error. + */ +export async function getSpotOrderbookV2( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetSpotOrderbookV2Params +): Promise { + try { + const result = await this.indexerGrpcSpotApi.fetchOrderbookV2( + params.marketId + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getSpotOrderbookV2Error", err); + } +} + +/** + * Fetches the atomic swap history. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetAtomicSwapHistoryParams} params - Parameters to filter atomic swap history. + * @returns {Promise} The standard response containing atomic swap history or an error. + */ +export async function getAtomicSwapHistory( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetAtomicSwapHistoryParams +): Promise< + | { + swapHistory: AtomicSwap[]; + pagination: ExchangePagination; + } + | StandardResponse +> { + try { + const result = + await this.indexerGrpcSpotApi.fetchAtomicSwapHistory(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getAtomicSwapHistoryError", err); + } +} + +/** + * Fetches all grid strategies. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetGridStrategiesParams} params - Parameters to filter grid strategies. + * @returns {Promise} The standard response containing grid strategies or an error. + */ +export async function getGridStrategies( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetGridStrategiesParams +): Promise { + try { + const result = + await this.indexerGrpcTradingApi.fetchGridStrategies(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getGridStrategiesError", err); + } +} + +/** + * Fetches the historical balance. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetHistoricalBalanceParams} params - Parameters to filter historical balance. + * @returns {Promise} The standard response containing historical balance or an error. + */ +export async function getHistoricalBalance( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetHistoricalBalanceParams +): Promise { + try { + const result = + await this.indexerGrpcArchiverApi.fetchHistoricalBalance(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getHistoricalBalanceError", err); + } +} + +/** + * Fetches the historical realized PnL (Rpnl). + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetHistoricalRpnlParams} params - Parameters to filter historical Rpnl. + * @returns {Promise} The standard response containing historical Rpnl or an error. + */ +export async function getHistoricalRpnl( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetHistoricalRpnlParams +): Promise { + try { + const result = + await this.indexerGrpcArchiverApi.fetchHistoricalRpnl(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getHistoricalRpnlError", err); + } +} + +/** + * Fetches the historical trading volumes. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetHistoricalVolumesParams} params - Parameters to filter historical volumes. + * @returns {Promise} The standard response containing historical volumes or an error. + */ +export async function getHistoricalVolumes( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetHistoricalVolumesParams +): Promise { + try { + const result = + await this.indexerGrpcArchiverApi.fetchHistoricalVolumes(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getHistoricalVolumesError", err); + } +} + +/** + * Fetches the PnL leaderboard. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetPnlLeaderboardParams} params - Parameters to filter PnL leaderboard. + * @returns {Promise} The standard response containing PnL leaderboard or an error. + */ +export async function getPnlLeaderboard( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetPnlLeaderboardParams +): Promise { + try { + const result = + await this.indexerGrpcArchiverApi.fetchPnlLeaderboard(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getPnlLeaderboardError", err); + } +} + +/** + * Fetches the volume leaderboard. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetVolLeaderboardParams} params - Parameters to filter volume leaderboard. + * @returns {Promise} The standard response containing volume leaderboard or an error. + */ +export async function getVolLeaderboard( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetVolLeaderboardParams +): Promise { + try { + const result = + await this.indexerGrpcArchiverApi.fetchVolLeaderboard(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getVolLeaderboardError", err); + } +} + +/** + * Fetches the PnL leaderboard with fixed resolution. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetPnlLeaderboardFixedResolutionParams} params - Parameters to filter PnL leaderboard with fixed resolution. + * @returns {Promise} The standard response containing PnL leaderboard with fixed resolution or an error. + */ +export async function getPnlLeaderboardFixedResolution( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetPnlLeaderboardFixedResolutionParams +): Promise { + try { + const result = + await this.indexerGrpcArchiverApi.fetchPnlLeaderboardFixedResolution( + params + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse( + "getPnlLeaderboardFixedResolutionError", + err + ); + } +} + +/** + * Fetches the volume leaderboard with fixed resolution. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetVolLeaderboardFixedResolutionParams} params - Parameters to filter volume leaderboard with fixed resolution. + * @returns {Promise} The standard response containing volume leaderboard with fixed resolution or an error. + */ +export async function getVolLeaderboardFixedResolution( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetVolLeaderboardFixedResolutionParams +): Promise { + try { + const result = + await this.indexerGrpcArchiverApi.fetchVolLeaderboardFixedResolution( + params + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse( + "getVolLeaderboardFixedResolutionError", + err + ); + } +} + +/** + * Fetches the holders of a specific denomination. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.GetDenomHoldersParams} params - Parameters including the denomination. + * @returns {Promise} The standard response containing denomination holders or an error. + */ +export async function getDenomHolders( + this: InjectiveGrpcBase, + params: ExchangeTypes.GetDenomHoldersParams +): Promise { + try { + const result = + await this.indexerGrpcArchiverApi.fetchDenomHolders(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDenomHoldersError", err); + } +} + +/** + * Broadcasts a message to update a binary options market as an admin. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgAdminUpdateBinaryOptionsMarketParams} params - Parameters to update the binary options market. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgAdminUpdateBinaryOptionsMarket( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgAdminUpdateBinaryOptionsMarketParams +): Promise { + try { + const msg = MsgAdminUpdateBinaryOptionsMarket.fromJSON({ ...params }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse( + "msgAdminUpdateBinaryOptionsMarketError", + err + ); + } +} + +/** + * Broadcasts a message to batch cancel binary options orders. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgBatchCancelBinaryOptionsOrdersParams} params - Parameters to batch cancel binary options orders. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgBatchCancelBinaryOptionsOrders( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgBatchCancelBinaryOptionsOrdersParams +): Promise { + try { + const msg = MsgBatchCancelBinaryOptionsOrders.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse( + "msgBatchCancelBinaryOptionsOrdersError", + err + ); + } +} + +/** + * Broadcasts a message to batch cancel derivative orders. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgBatchCancelDerivativeOrdersParams} params - Parameters to batch cancel derivative orders. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgBatchCancelDerivativeOrders( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgBatchCancelDerivativeOrdersParams +): Promise { + try { + const msg = MsgBatchCancelDerivativeOrders.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgBatchCancelDerivativeOrdersError", err); + } +} + +/** + * Broadcasts a message to batch cancel spot orders. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgBatchCancelSpotOrdersParams} params - Parameters to batch cancel spot orders. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgBatchCancelSpotOrders( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgBatchCancelSpotOrdersParams +): Promise { + try { + const msg = MsgBatchCancelSpotOrders.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgBatchCancelSpotOrdersError", err); + } +} + +/** + * Broadcasts a message to batch update orders. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgBatchUpdateOrdersParams} params - Parameters to batch update orders. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgBatchUpdateOrders( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgBatchUpdateOrdersParams +): Promise { + try { + const msg = MsgBatchUpdateOrders.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgBatchUpdateOrdersError", err); + } +} + +/** + * Broadcasts a message to cancel a binary options order. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgCancelBinaryOptionsOrderParams} params - Parameters to cancel a binary options order. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgCancelBinaryOptionsOrder( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgCancelBinaryOptionsOrderParams +): Promise { + try { + const msg = MsgCancelBinaryOptionsOrder.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgCancelBinaryOptionsOrderError", err); + } +} + +/** + * Broadcasts a message to cancel a derivative order. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgCancelDerivativeOrderParams} params - Parameters to cancel a derivative order. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgCancelDerivativeOrder( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgCancelDerivativeOrderParams +): Promise { + try { + const msg = MsgCancelDerivativeOrder.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgCancelDerivativeOrderError", err); + } +} + +/** + * Broadcasts a message to cancel a spot order. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgCancelSpotOrderParams} params - Parameters to cancel a spot order. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgCancelSpotOrder( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgCancelSpotOrderParams +): Promise { + try { + const msg = MsgCancelSpotOrder.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgCancelSpotOrderError", err); + } +} + +/** + * Broadcasts a message to create a binary options limit order. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgCreateBinaryOptionsLimitOrderParams} params - Parameters to create a binary options limit order. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgCreateBinaryOptionsLimitOrder( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgCreateBinaryOptionsLimitOrderParams +): Promise { + try { + const msg = MsgCreateBinaryOptionsLimitOrder.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse( + "msgCreateBinaryOptionsLimitOrderError", + err + ); + } +} + +/** + * Broadcasts a message to create a binary options market order. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgCreateBinaryOptionsMarketOrderParams} params - Parameters to create a binary options market order. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgCreateBinaryOptionsMarketOrder( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgCreateBinaryOptionsMarketOrderParams +): Promise { + try { + const msg = MsgCreateBinaryOptionsMarketOrder.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse( + "msgCreateBinaryOptionsMarketOrderError", + err + ); + } +} + +/** + * Broadcasts a message to create a derivative limit order. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgCreateDerivativeLimitOrderParams} params - Parameters to create a derivative limit order. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgCreateDerivativeLimitOrder( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgCreateDerivativeLimitOrderParams +): Promise { + try { + const msg = MsgCreateDerivativeLimitOrder.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgCreateDerivativeLimitOrderError", err); + } +} + +/** + * Broadcasts a message to create a derivative market order. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgCreateDerivativeMarketOrderParams} params - Parameters to create a derivative market order. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgCreateDerivativeMarketOrder( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgCreateDerivativeMarketOrderParams +): Promise { + try { + const msg = MsgCreateDerivativeMarketOrder.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgCreateDerivativeMarketOrderError", err); + } +} + +/** + * Broadcasts a message to create a spot limit order. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgCreateSpotLimitOrderParams} params - Parameters to create a spot limit order. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgCreateSpotLimitOrder( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgCreateSpotLimitOrderParams +): Promise { + try { + const msg = MsgCreateSpotLimitOrder.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgCreateSpotLimitOrderError", err); + } +} + +/** + * Broadcasts a message to create a spot market order. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgCreateSpotMarketOrderParams} params - Parameters to create a spot market order. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgCreateSpotMarketOrder( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgCreateSpotMarketOrderParams +): Promise { + try { + const msg = MsgCreateSpotMarketOrder.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgCreateSpotMarketOrderError", err); + } +} + +/** + * Broadcasts a message to deposit funds. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgDepositParams} params - Parameters to deposit funds. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgDeposit( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgDepositParams +): Promise { + try { + const msg = MsgDeposit.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgDepositError", err); + } +} + +/** + * Broadcasts a message to perform an external transfer. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgExternalTransferParams} params - Parameters to perform an external transfer. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgExternalTransfer( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgExternalTransferParams +): Promise { + try { + const msg = MsgExternalTransfer.fromJSON({ + ...params, + amount: params.totalAmount, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgExternalTransferError", err); + } +} + +/** + * Broadcasts a message to increase position margin. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgIncreasePositionMarginParams} params - Parameters to increase position margin. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgIncreasePositionMargin( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgIncreasePositionMarginParams +): Promise { + try { + const msg = MsgIncreasePositionMargin.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgIncreasePositionMarginError", err); + } +} + +/** + * Broadcasts a message to instantly launch a spot market. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgInstantSpotMarketLaunchParams} params - Parameters to instantly launch a spot market. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgInstantSpotMarketLaunch( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgInstantSpotMarketLaunchParams +): Promise { + try { + const msg = MsgInstantSpotMarketLaunch.fromJSON({ ...params }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgInstantSpotMarketLaunchError", err); + } +} + +/** + * Broadcasts a message to liquidate a position. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgLiquidatePositionParams} params - Parameters to liquidate a position. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgLiquidatePosition( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgLiquidatePositionParams +): Promise { + try { + const msg = MsgLiquidatePosition.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgLiquidatePositionError", err); + } +} + +/** + * Broadcasts a message to reclaim locked funds. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgReclaimLockedFundsParams} params - Parameters to reclaim locked funds. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgReclaimLockedFunds( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgReclaimLockedFundsParams +): Promise { + try { + const msg = MsgReclaimLockedFunds.fromJSON({ ...params }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgReclaimLockedFundsError", err); + } +} + +/** + * Broadcasts a message to opt out of rewards. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgRewardsOptOutParams} params - Parameters to opt out of rewards. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgRewardsOptOut( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgRewardsOptOutParams +): Promise { + try { + const msg = MsgRewardsOptOut.fromJSON({ ...params }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgRewardsOptOutError", err); + } +} + +/** + * Broadcasts a message to sign data. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgSignDataParams} params - Parameters to sign data. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgSignData( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgSignDataParams +): Promise { + try { + const msg = MsgSignData.fromJSON({ ...params }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgSignDataError", err); + } +} + +/** + * Broadcasts a message to withdraw funds. + * + * @this InjectiveGrpcBase + * @param {ExchangeTypes.MsgWithdrawParams} params - Parameters to withdraw funds. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgWithdraw( + this: InjectiveGrpcBase, + params: ExchangeTypes.MsgWithdrawParams +): Promise { + try { + const msg = MsgWithdraw.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgWithdrawError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/explorer.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/explorer.ts new file mode 100644 index 00000000000..5464a51d070 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/explorer.ts @@ -0,0 +1,227 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import * as ExplorerTypes from "../types/explorer"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; + +/** + * Explorer Module Chain GRPC Async Functions with Error Handling + */ + +/** + * Fetches a transaction by its hash. + * + * @this InjectiveGrpcBase + * @param {ExplorerTypes.GetTxByHashParams} params - Parameters including the transaction hash. + * @returns {Promise} The standard response containing transaction details or an error. + */ +export async function getTxByHash( + this: InjectiveGrpcBase, + params: ExplorerTypes.GetTxByHashParams +): Promise { + try { + const result = await this.indexerGrpcExplorerApi.fetchTxByHash( + params.hash + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getTxByHashError", err); + } +} + +/** + * Fetches transactions for a specific account. + * + * @this InjectiveGrpcBase + * @param {ExplorerTypes.GetAccountTxParams} params - Parameters including account details. + * @returns {Promise} The standard response containing account transactions or an error. + */ +export async function getAccountTx( + this: InjectiveGrpcBase, + params: ExplorerTypes.GetAccountTxParams +): Promise { + try { + const result = await this.indexerGrpcExplorerApi.fetchAccountTx(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getAccountTxError", err); + } +} + +/** + * Fetches details of a specific validator. + * + * @this InjectiveGrpcBase + * @param {ExplorerTypes.GetExplorerValidatorParams} params - Parameters including the validator's address. + * @returns {Promise} The standard response containing validator details or an error. + */ +export async function getValidator( + this: InjectiveGrpcBase, + params: ExplorerTypes.GetExplorerValidatorParams +): Promise { + try { + const result = await this.indexerGrpcExplorerApi.fetchValidator( + params.address + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getValidatorError", err); + } +} + +/** + * Fetches the uptime of a specific validator. + * + * @this InjectiveGrpcBase + * @param {ExplorerTypes.GetValidatorUptimeParams} params - Parameters including the validator's address. + * @returns {Promise} The standard response indicating validator uptime or an error. + */ +export async function getValidatorUptime( + this: InjectiveGrpcBase, + params: ExplorerTypes.GetValidatorUptimeParams +): Promise { + try { + const result = await this.indexerGrpcExplorerApi.fetchValidatorUptime( + params.validatorAddress + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getValidatorUptimeError", err); + } +} + +/** + * Fetches Peggy deposit transactions. + * + * @this InjectiveGrpcBase + * @param {ExplorerTypes.GetPeggyDepositTxsParams} params - Parameters to filter Peggy deposit transactions. + * @returns {Promise} The standard response containing Peggy deposit transactions or an error. + */ +export async function getPeggyDepositTxs( + this: InjectiveGrpcBase, + params: ExplorerTypes.GetPeggyDepositTxsParams +): Promise { + try { + const result = + await this.indexerGrpcExplorerApi.fetchPeggyDepositTxs(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getPeggyDepositTxsError", err); + } +} + +/** + * Fetches Peggy withdrawal transactions. + * + * @this InjectiveGrpcBase + * @param {ExplorerTypes.GetPeggyWithdrawalTxsParams} params - Parameters to filter Peggy withdrawal transactions. + * @returns {Promise} The standard response containing Peggy withdrawal transactions or an error. + */ +export async function getPeggyWithdrawalTxs( + this: InjectiveGrpcBase, + params: ExplorerTypes.GetPeggyWithdrawalTxsParams +): Promise { + try { + const result = + await this.indexerGrpcExplorerApi.fetchPeggyWithdrawalTxs(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getPeggyWithdrawalTxsError", err); + } +} + +/** + * Fetches a list of blocks based on provided parameters. + * + * @this InjectiveGrpcBase + * @param {ExplorerTypes.GetBlocksParams} params - Parameters to filter blocks. + * @returns {Promise} The standard response containing blocks or an error. + */ +export async function getBlocks( + this: InjectiveGrpcBase, + params: ExplorerTypes.GetBlocksParams +): Promise { + try { + const result = await this.indexerGrpcExplorerApi.fetchBlocks(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getBlocksError", err); + } +} + +/** + * Fetches details of a specific block by its ID. + * + * @this InjectiveGrpcBase + * @param {ExplorerTypes.GetBlockParams} params - Parameters including the block ID. + * @returns {Promise} The standard response containing block details or an error. + */ +export async function getBlock( + this: InjectiveGrpcBase, + params: ExplorerTypes.GetBlockParams +): Promise { + try { + const result = await this.indexerGrpcExplorerApi.fetchBlock(params.id); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getBlockError", err); + } +} + +/** + * Fetches a list of transactions based on provided parameters. + * + * @this InjectiveGrpcBase + * @param {ExplorerTypes.GetTxsParams} params - Parameters to filter transactions. + * @returns {Promise} The standard response containing transactions or an error. + */ +export async function getTxs( + this: InjectiveGrpcBase, + params: ExplorerTypes.GetTxsParams +): Promise { + try { + const result = await this.indexerGrpcExplorerApi.fetchTxs(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getTxsError", err); + } +} + +/** + * Fetches IBC transfer transactions based on provided parameters. + * + * @this InjectiveGrpcBase + * @param {ExplorerTypes.GetIBCTransferTxsParams} params - Parameters to filter IBC transfer transactions. + * @returns {Promise} The standard response containing IBC transfer transactions or an error. + */ +export async function getIBCTransferTxs( + this: InjectiveGrpcBase, + params: ExplorerTypes.GetIBCTransferTxsParams +): Promise { + try { + const result = + await this.indexerGrpcExplorerApi.fetchIBCTransferTxs(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getIBCTransferTxsError", err); + } +} + +/** + * Fetches explorer statistics. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing explorer statistics or an error. + */ +export async function getExplorerStats( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.indexerGrpcExplorerApi.fetchExplorerStats(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getStatsError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/gov.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/gov.ts new file mode 100644 index 00000000000..06ea77fc279 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/gov.ts @@ -0,0 +1,350 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import { + MsgSubmitProposalExpiryFuturesMarketLaunch, + MsgSubmitProposalSpotMarketLaunch, + MsgSubmitProposalPerpetualMarketLaunch, + MsgVote, + MsgSubmitTextProposal, + MsgSubmitProposalSpotMarketParamUpdate, + MsgSubmitGenericProposal, + MsgGovDeposit, + TxResponse, +} from "@injectivelabs/sdk-ts"; +import * as GovernanceTypes from "../types/gov"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; + +/** + * Governance Module Chain GRPC Async Functions with Error Handling + */ + +/** + * Fetches the governance module parameters. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing governance module parameters or an error. + */ +export async function getGovernanceModuleParams( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcGovApi.fetchModuleParams(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getModuleParamsError", err); + } +} + +/** + * Fetches a list of proposals based on provided parameters. + * + * @this InjectiveGrpcBase + * @param {GovernanceTypes.GetProposalsParams} params - Parameters to filter proposals. + * @returns {Promise} The standard response containing a list of proposals or an error. + */ +export async function getProposals( + this: InjectiveGrpcBase, + params: GovernanceTypes.GetProposalsParams +): Promise { + try { + const result = await this.chainGrpcGovApi.fetchProposals(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getProposalsError", err); + } +} + +/** + * Fetches details of a specific proposal by its ID. + * + * @this InjectiveGrpcBase + * @param {GovernanceTypes.GetProposalParams} params - Parameters including the proposal ID. + * @returns {Promise} The standard response containing proposal details or an error. + */ +export async function getProposal( + this: InjectiveGrpcBase, + params: GovernanceTypes.GetProposalParams +): Promise { + try { + const result = await this.chainGrpcGovApi.fetchProposal( + params.proposalId + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getProposalError", err); + } +} + +/** + * Fetches deposits for a specific proposal. + * + * @this InjectiveGrpcBase + * @param {GovernanceTypes.GetProposalDepositsParams} params - Parameters including the proposal ID. + * @returns {Promise} The standard response containing proposal deposits or an error. + */ +export async function getProposalDeposits( + this: InjectiveGrpcBase, + params: GovernanceTypes.GetProposalDepositsParams +): Promise { + try { + const result = await this.chainGrpcGovApi.fetchProposalDeposits(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getProposalDepositsError", err); + } +} + +/** + * Fetches votes for a specific proposal. + * + * @this InjectiveGrpcBase + * @param {GovernanceTypes.GetProposalVotesParams} params - Parameters including the proposal ID. + * @returns {Promise} The standard response containing proposal votes or an error. + */ +export async function getProposalVotes( + this: InjectiveGrpcBase, + params: GovernanceTypes.GetProposalVotesParams +): Promise { + try { + const result = await this.chainGrpcGovApi.fetchProposalVotes(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getProposalVotesError", err); + } +} + +/** + * Fetches the tally results of a specific proposal. + * + * @this InjectiveGrpcBase + * @param {GovernanceTypes.GetProposalTallyParams} params - Parameters including the proposal ID. + * @returns {Promise} The standard response containing proposal tally or an error. + */ +export async function getProposalTally( + this: InjectiveGrpcBase, + params: GovernanceTypes.GetProposalTallyParams +): Promise { + try { + const result = await this.chainGrpcGovApi.fetchProposalTally( + params.proposalId + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getProposalTallyError", err); + } +} + +/** + * Submits a proposal to launch an expiry futures market. + * + * @this InjectiveGrpcBase + * @param {GovernanceTypes.MsgSubmitProposalExpiryFuturesMarketLaunchParams} params - Parameters to submit the proposal. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgSubmitProposalExpiryFuturesMarketLaunch( + this: InjectiveGrpcBase, + params: GovernanceTypes.MsgSubmitProposalExpiryFuturesMarketLaunchParams +): Promise { + try { + const msg = MsgSubmitProposalExpiryFuturesMarketLaunch.fromJSON({ + ...params, + proposer: this.injAddress, + }); + const result: TxResponse = await this.msgBroadcaster.broadcast({ + msgs: msg, + }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse( + "msgSubmitProposalExpiryFuturesMarketLaunchError", + err + ); + } +} + +/** + * Submits a proposal to launch a spot market. + * + * @this InjectiveGrpcBase + * @param {GovernanceTypes.MsgSubmitProposalSpotMarketLaunchParams} params - Parameters to submit the proposal. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgSubmitProposalSpotMarketLaunch( + this: InjectiveGrpcBase, + params: GovernanceTypes.MsgSubmitProposalSpotMarketLaunchParams +): Promise { + try { + const msg = MsgSubmitProposalSpotMarketLaunch.fromJSON({ + ...params, + proposer: this.injAddress, + }); + const result: TxResponse = await this.msgBroadcaster.broadcast({ + msgs: msg, + }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse( + "msgSubmitProposalSpotMarketLaunchError", + err + ); + } +} + +/** + * Submits a proposal to launch a perpetual market. + * + * @this InjectiveGrpcBase + * @param {GovernanceTypes.MsgSubmitProposalPerpetualMarketLaunchParams} params - Parameters to submit the proposal. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgSubmitProposalPerpetualMarketLaunch( + this: InjectiveGrpcBase, + params: GovernanceTypes.MsgSubmitProposalPerpetualMarketLaunchParams +): Promise { + try { + const msg = MsgSubmitProposalPerpetualMarketLaunch.fromJSON({ + ...params, + proposer: this.injAddress, + }); + const result: TxResponse = await this.msgBroadcaster.broadcast({ + msgs: msg, + }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse( + "msgSubmitProposalPerpetualMarketLaunchError", + err + ); + } +} + +/** + * Casts a vote on a specific proposal. + * + * @this InjectiveGrpcBase + * @param {GovernanceTypes.MsgVoteParams} params - Parameters to cast the vote. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgVote( + this: InjectiveGrpcBase, + params: GovernanceTypes.MsgVoteParams +): Promise { + try { + const msg = MsgVote.fromJSON({ + ...params, + voter: this.injAddress, + }); + const result: TxResponse = await this.msgBroadcaster.broadcast({ + msgs: msg, + }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgVoteError", err); + } +} + +/** + * Submits a text-based proposal. + * + * @this InjectiveGrpcBase + * @param {GovernanceTypes.MsgSubmitTextProposalParams} params - Parameters to submit the text proposal. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgSubmitTextProposal( + this: InjectiveGrpcBase, + params: GovernanceTypes.MsgSubmitTextProposalParams +): Promise { + try { + const msg = MsgSubmitTextProposal.fromJSON({ + ...params, + proposer: this.injAddress, + }); + const result: TxResponse = await this.msgBroadcaster.broadcast({ + msgs: msg, + }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgSubmitTextProposalError", err); + } +} + +/** + * Submits a proposal to update spot market parameters. + * + * @this InjectiveGrpcBase + * @param {GovernanceTypes.MsgSubmitProposalSpotMarketParamUpdateParams} params - Parameters to submit the proposal. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgSubmitProposalSpotMarketParamUpdate( + this: InjectiveGrpcBase, + params: GovernanceTypes.MsgSubmitProposalSpotMarketParamUpdateParams +): Promise { + try { + const msg = MsgSubmitProposalSpotMarketParamUpdate.fromJSON({ + ...params, + proposer: this.injAddress, + }); + const result: TxResponse = await this.msgBroadcaster.broadcast({ + msgs: msg, + }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse( + "msgSubmitProposalSpotMarketParamUpdateError", + err + ); + } +} + +/** + * Submits a generic proposal. + * + * @this InjectiveGrpcBase + * @param {GovernanceTypes.MsgSubmitGenericProposalParams} params - Parameters to submit the generic proposal. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgSubmitGenericProposal( + this: InjectiveGrpcBase, + params: GovernanceTypes.MsgSubmitGenericProposalParams +): Promise { + try { + const msg = MsgSubmitGenericProposal.fromJSON({ + ...params, + proposer: this.injAddress, + }); + const result: TxResponse = await this.msgBroadcaster.broadcast({ + msgs: msg, + }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgSubmitGenericProposalError", err); + } +} + +/** + * Deposits tokens to a specific proposal. + * + * @this InjectiveGrpcBase + * @param {GovernanceTypes.MsgGovDepositParams} params - Parameters to deposit tokens to a proposal. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgGovDeposit( + this: InjectiveGrpcBase, + params: GovernanceTypes.MsgGovDepositParams +): Promise { + try { + const msg = MsgGovDeposit.fromJSON({ + ...params, + depositor: this.injAddress, + }); + const result: TxResponse = await this.msgBroadcaster.broadcast({ + msgs: msg, + }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgDepositError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/index.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/index.ts new file mode 100644 index 00000000000..446d888ee7e --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/index.ts @@ -0,0 +1,408 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import { Network } from "@injectivelabs/networks"; + +import * as AuctionModule from "./auction"; +import * as AuthModule from "./auth"; +import * as AuthZModule from "./authz"; +import * as BankModule from "./bank"; +import * as DistributionModule from "./distribution"; +import * as ExchangeModule from "./exchange"; +import * as GovernanceModule from "./gov"; +import * as IbcModule from "./Ibc"; +import * as InsuranceFundModule from "./insurance"; +import * as MintModule from "./mint"; +import * as MitoModule from "./mito"; +import * as ExplorerModule from "./explorer"; +import * as OracleModule from "./oracle"; +import * as PeggyModule from "./peggy"; +import * as PermissionsModule from "./permissions"; +import * as StakingModule from "./staking"; +import * as TokenFactoryModule from "./token-factory"; +import * as WasmModule from "./wasm"; +import * as WasmXModule from "./wasmx"; + +export class InjectiveGrpcClient extends InjectiveGrpcBase { + constructor( + networkType: keyof typeof Network = "Mainnet", + injectivePrivateKey: string, + ethPublicKey?: string, + injPublicKey?: string + ) { + if (!ethPublicKey && !injPublicKey) { + throw new Error("Either eth or inj public key is required"); + } + super(networkType, injectivePrivateKey, ethPublicKey, injPublicKey); + console.log("InjectiveGrpcClient constructor init"); + } + // Auction endpoints + public getAuctionModuleParams = + AuctionModule.getAuctionModuleParams.bind(this); + public getAuctionModuleState = + AuctionModule.getAuctionModuleState.bind(this); + public getCurrentBasket = AuctionModule.getCurrentBasket.bind(this); + public getAuctionRound = AuctionModule.getAuctionRound.bind(this); + public getAuctions = AuctionModule.getAuctions.bind(this); + + //Auth endpoints + public getAuthModuleParams = AuthModule.getAuthModuleParams.bind(this); + public getAccountDetails = AuthModule.getAccountDetails.bind(this); + public getAccounts = AuthModule.getAccounts.bind(this); + + //Authz endpoints + public getGrants = AuthZModule.getGrants.bind(this); + public getGranterGrants = AuthZModule.getGranterGrants.bind(this); + public getGranteeGrants = AuthZModule.getGranteeGrants.bind(this); + + //Bank endpoints + public getBankModuleParams = BankModule.getBankModuleParams.bind(this); + public getBankBalance = BankModule.getBankBalance.bind(this); + public getTotalSupply = BankModule.getTotalSupply.bind(this); + public getAllTotalSupply = BankModule.getAllTotalSupply.bind(this); + public getSupplyOf = BankModule.getSupplyOf.bind(this); + public getDenomsMetadata = BankModule.getDenomsMetadata.bind(this); + public getDenomMetadata = BankModule.getDenomMetadata.bind(this); + public getDenomOwners = BankModule.getDenomOwners.bind(this); + + //Distribution endpoints + public getDistributionModuleParams = + DistributionModule.getDistributionModuleParams.bind(this); + public getDelegatorRewardsForValidator = + DistributionModule.getDelegatorRewardsForValidator.bind(this); + public getDelegatorRewardsForValidatorNoThrow = + DistributionModule.getDelegatorRewardsForValidatorNoThrow.bind(this); + public getDelegatorRewards = + DistributionModule.getDelegatorRewards.bind(this); + public getDelegatorRewardsNoThrow = + DistributionModule.getDelegatorRewardsNoThrow.bind(this); + + //Exchange endpoints + //============================CHAIN=============================== + public getModuleParams = ExchangeModule.getModuleParams.bind(this); + public getModuleState = ExchangeModule.getModuleState.bind(this); + public getFeeDiscountSchedule = + ExchangeModule.getFeeDiscountSchedule.bind(this); + public getFeeDiscountAccountInfo = + ExchangeModule.getFeeDiscountAccountInfo.bind(this); + public getTradingRewardsCampaign = + ExchangeModule.getTradingRewardsCampaign.bind(this); + public getTradeRewardPoints = + ExchangeModule.getTradeRewardPoints.bind(this); + public getPendingTradeRewardPoints = + ExchangeModule.getPendingTradeRewardPoints.bind(this); + public getExchangePositions = + ExchangeModule.getExchangePositions.bind(this); + public getSubaccountTradeNonce = + ExchangeModule.getSubaccountTradeNonce.bind(this); + public getIsOptedOutOfRewards = + ExchangeModule.getIsOptedOutOfRewards.bind(this); + //===========================INDEXER============================== + public getDerivativeMarkets = + ExchangeModule.getDerivativeMarkets.bind(this); + public getDerivativeMarket = ExchangeModule.getDerivativeMarket.bind(this); + public getBinaryOptionsMarkets = + ExchangeModule.getBinaryOptionsMarkets.bind(this); + public getBinaryOptionsMarket = + ExchangeModule.getBinaryOptionsMarket.bind(this); + public getDerivativeOrders = ExchangeModule.getDerivativeOrders.bind(this); + public getDerivativeOrderHistory = + ExchangeModule.getDerivativeOrderHistory.bind(this); + public getPositionsV2 = ExchangeModule.getPositionsV2.bind(this); + public getDerivativeTrades = ExchangeModule.getDerivativeTrades.bind(this); + public getFundingPayments = ExchangeModule.getFundingPayments.bind(this); + public getFundingRates = ExchangeModule.getFundingRates.bind(this); + public getDerivativeSubaccountOrdersList = + ExchangeModule.getDerivativeSubaccountOrdersList.bind(this); + public getDerivativeSubaccountTradesList = + ExchangeModule.getDerivativeSubaccountTradesList.bind(this); + public getDerivativeOrderbooksV2 = + ExchangeModule.getDerivativeOrderbooksV2.bind(this); + public getDerivativeOrderbookV2 = + ExchangeModule.getDerivativeOrderbookV2.bind(this); + public getRewards = ExchangeModule.getRewards.bind(this); + public getSubaccountsList = ExchangeModule.getSubaccountsList.bind(this); + public getSubaccountBalancesList = + ExchangeModule.getSubaccountBalancesList.bind(this); + public getSubaccountHistory = + ExchangeModule.getSubaccountHistory.bind(this); + public getSubaccountOrderSummary = + ExchangeModule.getSubaccountOrderSummary.bind(this); + public getOrderStates = ExchangeModule.getOrderStates.bind(this); + public getAccountPortfolio = ExchangeModule.getAccountPortfolio.bind(this); + public getAccountPortfolioBalances = + ExchangeModule.getAccountPortfolioBalances.bind(this); + public getSpotMarkets = ExchangeModule.getSpotMarkets.bind(this); + public getSpotMarket = ExchangeModule.getSpotMarket.bind(this); + public getSpotOrders = ExchangeModule.getSpotOrders.bind(this); + public getSpotOrderHistory = ExchangeModule.getSpotOrderHistory.bind(this); + public getSpotTrades = ExchangeModule.getSpotTrades.bind(this); + public getSpotSubaccountOrdersList = + ExchangeModule.getSpotSubaccountOrdersList.bind(this); + public getSpotSubaccountTradesList = + ExchangeModule.getSpotSubaccountTradesList.bind(this); + public getSpotOrderbooksV2 = ExchangeModule.getSpotOrderbooksV2.bind(this); + public getSpotOrderbookV2 = ExchangeModule.getSpotOrderbookV2.bind(this); + public getAtomicSwapHistory = + ExchangeModule.getAtomicSwapHistory.bind(this); + public getGridStrategies = ExchangeModule.getGridStrategies.bind(this); + public getHistoricalBalance = + ExchangeModule.getHistoricalBalance.bind(this); + public getHistoricalRpnl = ExchangeModule.getHistoricalRpnl.bind(this); + public getHistoricalVolumes = + ExchangeModule.getHistoricalVolumes.bind(this); + public getPnlLeaderboard = ExchangeModule.getPnlLeaderboard.bind(this); + public getVolLeaderboard = ExchangeModule.getVolLeaderboard.bind(this); + public getPnlLeaderboardFixedResolution = + ExchangeModule.getPnlLeaderboardFixedResolution.bind(this); + public getVolLeaderboardFixedResolution = + ExchangeModule.getVolLeaderboardFixedResolution.bind(this); + public getDenomHolders = ExchangeModule.getDenomHolders.bind(this); + //Governance functions + public getGovernanceModuleParams = + GovernanceModule.getGovernanceModuleParams.bind(this); + public getProposals = GovernanceModule.getProposals.bind(this); + public getProposal = GovernanceModule.getProposal.bind(this); + public getProposalDeposits = + GovernanceModule.getProposalDeposits.bind(this); + public getProposalVotes = GovernanceModule.getProposalVotes.bind(this); + public getProposalTally = GovernanceModule.getProposalTally.bind(this); + //ibc functions + public getDenomTrace = IbcModule.getDenomTrace.bind(this); + public getDenomsTrace = IbcModule.getDenomsTrace.bind(this); + //Insurance functions + public getInsuranceModuleParams = + InsuranceFundModule.getInsuranceModuleParams.bind(this); + public getInsuranceFunds = InsuranceFundModule.getInsuranceFunds.bind(this); + public getInsuranceFund = InsuranceFundModule.getInsuranceFund.bind(this); + public getInsuranceFundDeposits = + InsuranceFundModule.getEstimatedRedemptions.bind(this); + public getInsuranceFundRedemptions = + InsuranceFundModule.getPendingRedemptions.bind(this); + //Mint functions + public getMintModuleParams = MintModule.getMintModuleParams.bind(this); + public getInflation = MintModule.getInflation.bind(this); + public getAnnualProvisions = MintModule.getAnnualProvisions.bind(this); + //Mito functions + public getVault = MitoModule.getVault.bind(this); + public getVaults = MitoModule.getVaults.bind(this); + public getLpTokenPriceChart = MitoModule.getLpTokenPriceChart.bind(this); + public getTVLChart = MitoModule.getTVLChart.bind(this); + public getVaultsByHolderAddress = + MitoModule.getVaultsByHolderAddress.bind(this); + public getLPHolders = MitoModule.getLPHolders.bind(this); + public getHolderPortfolio = MitoModule.getHolderPortfolio.bind(this); + public getLeaderboard = MitoModule.getLeaderboard.bind(this); + public getTransferHistory = MitoModule.getTransferHistory.bind(this); + public getLeaderboardEpochs = MitoModule.getLeaderboardEpochs.bind(this); + public getStakingPools = MitoModule.getStakingPools.bind(this); + public getStakingHistory = MitoModule.getStakingHistory.bind(this); + public getStakingRewardsByAccount = + MitoModule.getStakingRewardsByAccount.bind(this); + public getMissions = MitoModule.getMissions.bind(this); + public getMissionLeaderboard = MitoModule.getMissionLeaderboard.bind(this); + public getIDO = MitoModule.getIDO.bind(this); + public getIDOs = MitoModule.getIDOs.bind(this); + public getIDOSubscribers = MitoModule.getIDOSubscribers.bind(this); + public getIDOSubscription = MitoModule.getIDOSubscription.bind(this); + public getIDOActivities = MitoModule.getIDOActivities.bind(this); + public getIDOWhitelist = MitoModule.getIDOWhitelist.bind(this); + public getClaimReferences = MitoModule.getClaimReferences.bind(this); + //Oracle functions + public getOracleModuleParams = + OracleModule.getOracleModuleParams.bind(this); + //Peggy functions + public getPeggyModuleParams = PeggyModule.getPeggyModuleParams.bind(this); + //Permissions functions + public getAddressesByRole = PermissionsModule.getAddressesByRole.bind(this); + public getAddressRoles = PermissionsModule.getAddressRoles.bind(this); + public getAllNamespaces = PermissionsModule.getAllNamespaces.bind(this); + public getPermissionsModuleParams = + PermissionsModule.getPermissionsModuleParams.bind(this); + public getNamespaceByDenom = + PermissionsModule.getNamespaceByDenom.bind(this); + public getVouchersForAddress = + PermissionsModule.getVouchersForAddress.bind(this); + //Staking functions + public getStakingModuleParams = + StakingModule.getStakingModuleParams.bind(this); + public getPool = StakingModule.getPool.bind(this); + public getValidators = StakingModule.getValidators.bind(this); + public getStakingValidator = StakingModule.getValidator.bind(this); + public getValidatorDelegations = + StakingModule.getValidatorDelegations.bind(this); + public getValidatorDelegationsNoThrow = + StakingModule.getValidatorDelegationsNoThrow.bind(this); + public getValidatorUnbondingDelegations = + StakingModule.getValidatorUnbondingDelegations.bind(this); + public getValidatorUnbondingDelegationsNoThrow = + StakingModule.getValidatorUnbondingDelegationsNoThrow.bind(this); + public getDelegation = StakingModule.getDelegation.bind(this); + public getDelegations = StakingModule.getDelegations.bind(this); + public getDelegationsNoThrow = + StakingModule.getDelegationsNoThrow.bind(this); + public getDelegators = StakingModule.getDelegators.bind(this); + public getDelegatorsNoThrow = StakingModule.getDelegatorsNoThrow.bind(this); + public getUnbondingDelegations = + StakingModule.getUnbondingDelegations.bind(this); + public getUnbondingDelegationsNoThrow = + StakingModule.getUnbondingDelegationsNoThrow.bind(this); + public getReDelegations = StakingModule.getReDelegations.bind(this); + public getReDelegationsNoThrow = + StakingModule.getReDelegationsNoThrow.bind(this); + //Token Factory functions + public getDenomsFromCreator = + TokenFactoryModule.getDenomsFromCreator.bind(this); + public getDenomAuthorityMetadata = + TokenFactoryModule.getDenomAuthorityMetadata.bind(this); + public getTokenFactoryModuleParams = + TokenFactoryModule.getTokenFactoryModuleParams.bind(this); + public getTokenFactoryModuleState = + TokenFactoryModule.getTokenFactoryModuleState.bind(this); + //Wasm contract functions + public getContractAccountsBalance = + WasmModule.getContractAccountsBalance.bind(this); + public getContractState = WasmModule.getContractState.bind(this); + public getContractInfo = WasmModule.getContractInfo.bind(this); + public getContractHistory = WasmModule.getContractHistory.bind(this); + public getSmartContractState = WasmModule.getSmartContractState.bind(this); + public getRawContractState = WasmModule.getRawContractState.bind(this); + public getContractCodes = WasmModule.getContractCodes.bind(this); + public getContractCode = WasmModule.getContractCode.bind(this); + public getContractCodeContracts = + WasmModule.getContractCodeContracts.bind(this); + //Wasmx functions + public getWasmxModuleParams = WasmXModule.getWasmxModuleParams.bind(this); + public getWasmxWasmModuleState = WasmXModule.getWasmxModuleState.bind(this); + //Explorer functions + //===========================INDEXER============================== + public getTxByHash = ExplorerModule.getTxByHash.bind(this); + public getAccountTx = ExplorerModule.getAccountTx.bind(this); + public getExplorerValidator = ExplorerModule.getValidator.bind(this); + public getValidatorUptime = ExplorerModule.getValidatorUptime.bind(this); + public getPeggyDepositTxs = ExplorerModule.getPeggyDepositTxs.bind(this); + public getPeggyWithdrawalTxs = + ExplorerModule.getPeggyWithdrawalTxs.bind(this); + public getBlocks = ExplorerModule.getBlocks.bind(this); + public getBlock = ExplorerModule.getBlock.bind(this); + public getTxs = ExplorerModule.getTxs.bind(this); + public getIBCTransferTxs = ExplorerModule.getIBCTransferTxs.bind(this); + public getExplorerStats = ExplorerModule.getExplorerStats.bind(this); + + // Messages Broadcasting endpoints + // Auction message functions + public msgBid = AuctionModule.msgBid.bind(this); + + // AuthZ message functions + public msgGrant = AuthZModule.msgGrant.bind(this); + public msgExec = AuthZModule.msgExec.bind(this); + public msgRevoke = AuthZModule.msgRevoke.bind(this); + + // Bank message functions + public msgSend = BankModule.msgSend.bind(this); + public msgMultiSend = BankModule.msgMultiSend.bind(this); + + // Distribution message functions + public msgWithdrawDelegatorReward = + DistributionModule.msgWithdrawDelegatorReward.bind(this); + public msgWithdrawValidatorCommission = + DistributionModule.msgWithdrawValidatorCommission.bind(this); + + // Exchange message functions + public msgAdminUpdateBinaryOptionsMarket = + ExchangeModule.msgAdminUpdateBinaryOptionsMarket.bind(this); + public msgBatchCancelBinaryOptionsOrders = + ExchangeModule.msgBatchCancelBinaryOptionsOrders.bind(this); + public msgBatchCancelDerivativeOrders = + ExchangeModule.msgBatchCancelDerivativeOrders.bind(this); + public msgBatchCancelSpotOrders = + ExchangeModule.msgBatchCancelSpotOrders.bind(this); + public msgBatchUpdateOrders = + ExchangeModule.msgBatchUpdateOrders.bind(this); + public msgCancelBinaryOptionsOrder = + ExchangeModule.msgCancelBinaryOptionsOrder.bind(this); + public msgCancelDerivativeOrder = + ExchangeModule.msgCancelDerivativeOrder.bind(this); + public msgCancelSpotOrder = ExchangeModule.msgCancelSpotOrder.bind(this); + public msgCreateBinaryOptionsLimitOrder = + ExchangeModule.msgCreateBinaryOptionsLimitOrder.bind(this); + public msgCreateBinaryOptionsMarketOrder = + ExchangeModule.msgCreateBinaryOptionsMarketOrder.bind(this); + public msgCreateDerivativeLimitOrder = + ExchangeModule.msgCreateDerivativeLimitOrder.bind(this); + public msgCreateDerivativeMarketOrder = + ExchangeModule.msgCreateDerivativeMarketOrder.bind(this); + public msgCreateSpotLimitOrder = + ExchangeModule.msgCreateSpotLimitOrder.bind(this); + public msgCreateSpotMarketOrder = + ExchangeModule.msgCreateSpotMarketOrder.bind(this); + public msgDeposit = ExchangeModule.msgDeposit.bind(this); + public msgExternalTransfer = ExchangeModule.msgExternalTransfer.bind(this); + public msgIncreasePositionMargin = + ExchangeModule.msgIncreasePositionMargin.bind(this); + public msgInstantSpotMarketLaunch = + ExchangeModule.msgInstantSpotMarketLaunch.bind(this); + public msgLiquidatePosition = + ExchangeModule.msgLiquidatePosition.bind(this); + public msgReclaimLockedFunds = + ExchangeModule.msgReclaimLockedFunds.bind(this); + public msgRewardsOptOut = ExchangeModule.msgRewardsOptOut.bind(this); + public msgSignData = ExchangeModule.msgSignData.bind(this); + public msgWithdraw = ExchangeModule.msgWithdraw.bind(this); + + // Governance message functions + public msgSubmitProposalExpiryFuturesMarketLaunch = + GovernanceModule.msgSubmitProposalExpiryFuturesMarketLaunch.bind(this); + public msgSubmitProposalSpotMarketLaunch = + GovernanceModule.msgSubmitProposalSpotMarketLaunch.bind(this); + public msgSubmitProposalPerpetualMarketLaunch = + GovernanceModule.msgSubmitProposalPerpetualMarketLaunch.bind(this); + public msgVote = GovernanceModule.msgVote.bind(this); + public msgSubmitTextProposal = + GovernanceModule.msgSubmitTextProposal.bind(this); + public msgSubmitProposalSpotMarketParamUpdate = + GovernanceModule.msgSubmitProposalSpotMarketParamUpdate.bind(this); + public msgSubmitGenericProposal = + GovernanceModule.msgSubmitGenericProposal.bind(this); + public msgGovDeposit = GovernanceModule.msgGovDeposit.bind(this); + + // IBC message functions + public msgIBCTransfer = IbcModule.msgIBCTransfer.bind(this); + + // Insurance Fund message functions + public msgCreateInsuranceFund = + InsuranceFundModule.msgCreateInsuranceFund.bind(this); + public msgRequestRedemption = + InsuranceFundModule.msgRequestRedemption.bind(this); + public msgUnderwrite = InsuranceFundModule.msgUnderwrite.bind(this); + + // Peggy message functions + public msgSendToEth = PeggyModule.msgSendToEth.bind(this); + + // Staking message functions + public msgBeginRedelegate = StakingModule.msgBeginRedelegate.bind(this); + public msgDelegate = StakingModule.msgDelegate.bind(this); + public msgUndelegate = StakingModule.msgUndelegate.bind(this); + public msgCreateValidator = StakingModule.msgCreateValidator.bind(this); + public msgEditValidator = StakingModule.msgEditValidator.bind(this); + public msgCancelUnbondingDelegation = + StakingModule.msgCancelUnbondingDelegation.bind(this); + + // Token Factory message functions + public msgBurn = TokenFactoryModule.msgBurn.bind(this); + public msgChangeAdmin = TokenFactoryModule.msgChangeAdmin.bind(this); + public msgCreateDenom = TokenFactoryModule.msgCreateDenom.bind(this); + public msgMint = TokenFactoryModule.msgMint.bind(this); + public msgSetDenomMetadata = + TokenFactoryModule.msgSetDenomMetadata.bind(this); + + // Wasm message functions + public msgStoreCode = WasmModule.msgStoreCode.bind(this); + public msgUpdateAdmin = WasmModule.msgUpdateAdmin.bind(this); + public msgExecuteContract = WasmModule.msgExecuteContract.bind(this); + public msgMigrateContract = WasmModule.msgMigrateContract.bind(this); + public msgInstantiateContract = + WasmModule.msgInstantiateContract.bind(this); + public msgExecuteContractCompat = + WasmModule.msgExecuteContractCompat.bind(this); + public msgPrivilegedExecuteContract = + WasmModule.msgPrivilegedExecuteContract.bind(this); +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/insurance.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/insurance.ts new file mode 100644 index 00000000000..c266fe16ba6 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/insurance.ts @@ -0,0 +1,197 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import { + MsgCreateInsuranceFund, + MsgRequestRedemption, + MsgUnderwrite, + TxResponse, +} from "@injectivelabs/sdk-ts"; +import { + MsgCreateInsuranceFundParams, + MsgRequestRedemptionParams, + MsgUnderwriteParams, + GetInsuranceFundParams, + GetEstimatedRedemptionsParams, + GetPendingRedemptionsParams, +} from "../types/insurance"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; + +/** + * Fetches the insurance module parameters. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing insurance module parameters or an error. + */ +export async function getInsuranceModuleParams( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcInsuranceFundApi.fetchModuleParams(); + + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getInsuranceModuleParamsError", err); + } +} + +/** + * Fetches a list of all insurance funds. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing a list of insurance funds or an error. + */ +export async function getInsuranceFunds( + this: InjectiveGrpcBase +): Promise { + try { + const result = + await this.chainGrpcInsuranceFundApi.fetchInsuranceFunds(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getInsuranceFundsError", err); + } +} + +/** + * Fetches details of a specific insurance fund by its market ID. + * + * @this InjectiveGrpcBase + * @param {InsuranceTypes.GetInsuranceFundParams} params - Parameters including the market ID. + * @returns {Promise} The standard response containing insurance fund details or an error. + */ +export async function getInsuranceFund( + this: InjectiveGrpcBase, + params: GetInsuranceFundParams +): Promise { + try { + const result = await this.chainGrpcInsuranceFundApi.fetchInsuranceFund( + params.marketId + ); + + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getInsuranceFundError", err); + } +} + +/** + * Fetches estimated redemptions based on provided parameters. + * + * @this InjectiveGrpcBase + * @param {InsuranceTypes.GetEstimatedRedemptionsParams} params - Parameters to filter estimated redemptions. + * @returns {Promise} The standard response containing estimated redemptions or an error. + */ +export async function getEstimatedRedemptions( + this: InjectiveGrpcBase, + params: GetEstimatedRedemptionsParams +): Promise { + try { + const result = + await this.chainGrpcInsuranceFundApi.fetchEstimatedRedemptions( + params + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getEstimatedRedemptionsError", err); + } +} + +/** + * Fetches pending redemptions based on provided parameters. + * + * @this InjectiveGrpcBase + * @param {InsuranceTypes.GetPendingRedemptionsParams} params - Parameters to filter pending redemptions. + * @returns {Promise} The standard response containing pending redemptions or an error. + */ +export async function getPendingRedemptions( + this: InjectiveGrpcBase, + params: GetPendingRedemptionsParams +): Promise { + try { + const result = + await this.chainGrpcInsuranceFundApi.fetchPendingRedemptions( + params + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getPendingRedemptionsError", err); + } +} + +/** + * Broadcasts a message to create a new insurance fund. + * + * @this InjectiveGrpcBase + * @param {InsuranceTypes.MsgCreateInsuranceFundParams} params - Parameters to create the insurance fund. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgCreateInsuranceFund( + this: InjectiveGrpcBase, + params: MsgCreateInsuranceFundParams +): Promise { + try { + const msg = MsgCreateInsuranceFund.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result: TxResponse = await this.msgBroadcaster.broadcast({ + msgs: msg, + }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgCreateInsuranceFundError", err); + } +} + +/** + * Broadcasts a message to request a redemption from an insurance fund. + * + * @this InjectiveGrpcBase + * @param {InsuranceTypes.MsgRequestRedemptionParams} params - Parameters to request the redemption. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgRequestRedemption( + this: InjectiveGrpcBase, + params: MsgRequestRedemptionParams +): Promise { + try { + const msg = MsgRequestRedemption.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result: TxResponse = await this.msgBroadcaster.broadcast({ + msgs: msg, + }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgRequestRedemptionError", err); + } +} + +/** + * Broadcasts a message to underwrite an insurance fund. + * + * @this InjectiveGrpcBase + * @param {InsuranceTypes.MsgUnderwriteParams} params - Parameters to underwrite the insurance fund. + * @returns {Promise} The standard response containing the transaction result or an error. + */ +export async function msgUnderwrite( + this: InjectiveGrpcBase, + params: MsgUnderwriteParams +): Promise { + try { + const msg = MsgUnderwrite.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result: TxResponse = await this.msgBroadcaster.broadcast({ + msgs: msg, + }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgUnderwriteError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/mint.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/mint.ts new file mode 100644 index 00000000000..d4e381245a1 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/mint.ts @@ -0,0 +1,63 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; + +/** + * Fetches the parameters of the Mint module. + * + * @this InjectiveGrpcBase + * @returns {Promise} + * - On success: A standard response containing Mint module parameters. + * - On failure: A standard response containing an error message. + */ +export async function getMintModuleParams( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcMintApi.fetchModuleParams(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getMintModuleParamsError", err); + } +} + +/** + * Retrieves the current inflation rate. + * + * @this InjectiveGrpcBase + * @returns {Promise} + * - On success: A standard response containing the current inflation rate. + * - On failure: A standard response containing an error message. + */ +export async function getInflation( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcMintApi.fetchInflation(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getInflationError", err); + } +} + +/** + * Obtains the annual provisions. + * + * @this InjectiveGrpcBase + * @returns {Promise} + * - On success: A standard response containing the annual provisions. + * - On failure: A standard response containing an error message. + */ +export async function getAnnualProvisions( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcMintApi.fetchAnnualProvisions(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getAnnualProvisionsError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/mito.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/mito.ts new file mode 100644 index 00000000000..7bad58676fa --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/mito.ts @@ -0,0 +1,763 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import * as MitoTypes from "../types/mito"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; +import { + MsgExecuteContractCompat, + MsgPrivilegedExecuteContract, + getDefaultSubaccountId, + ExecPrivilegedArgVaultSubscribe, + ExecPrivilegedArgVaultRedeem, + spotQuantityToChainQuantityToFixed, +} from "@injectivelabs/sdk-ts"; +/** + * Fetches the details of a specific vault. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetVaultParams} params - Parameters including the vault identifier. + * @returns {Promise} + * - On success: A standard response containing vault details. + * - On failure: A standard response containing an error message. + */ +export async function getVault( + this: InjectiveGrpcBase, + params: MitoTypes.GetVaultParams +): Promise { + try { + const result = await this.indexerGrpcMitoApi.fetchVault(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getVaultError", err); + } +} + +/** + * Fetches a list of all vaults with optional filtering. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetVaultsParams} [params={}] - Optional parameters to filter the list of vaults. + * @returns {Promise} + * - On success: A standard response containing a list of vaults. + * - On failure: A standard response containing an error message. + */ +export async function getVaults( + this: InjectiveGrpcBase, + params: MitoTypes.GetVaultsParams = {} +): Promise { + try { + const result = await this.indexerGrpcMitoApi.fetchVaults(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getVaultsError", err); + } +} + +/** + * Retrieves the price chart data for LP tokens. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetLpTokenPriceChartParams} params - Parameters including the LP token identifier and chart options. + * @returns {Promise} + * - On success: A standard response containing LP token price chart data. + * - On failure: A standard response containing an error message. + */ +export async function getLpTokenPriceChart( + this: InjectiveGrpcBase, + params: MitoTypes.GetLpTokenPriceChartParams +): Promise { + try { + const result = + await this.indexerGrpcMitoApi.fetchLpTokenPriceChart(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getLpTokenPriceChartError", err); + } +} + +/** + * Retrieves the Total Value Locked (TVL) chart data. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetTVLChartParams} params - Parameters including time range and other chart options. + * @returns {Promise} + * - On success: A standard response containing TVL chart data. + * - On failure: A standard response containing an error message. + */ +export async function getTVLChart( + this: InjectiveGrpcBase, + params: MitoTypes.GetTVLChartParams +): Promise { + try { + const result = + await this.indexerGrpcMitoApi.fetchTVLChartRequest(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getTVLChartError", err); + } +} + +/** + * Fetches vaults associated with a specific holder address. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetVaultsByHolderAddressParams} params - Parameters including the holder's address. + * @returns {Promise} + * - On success: A standard response containing vaults linked to the holder. + * - On failure: A standard response containing an error message. + */ +export async function getVaultsByHolderAddress( + this: InjectiveGrpcBase, + params: MitoTypes.GetVaultsByHolderAddressParams +): Promise { + try { + const result = + await this.indexerGrpcMitoApi.fetchVaultsByHolderAddress(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getVaultsByHolderAddressError", err); + } +} + +/** + * Retrieves a list of LP token holders. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetLPHoldersParams} params - Parameters to filter LP token holders. + * @returns {Promise} + * - On success: A standard response containing a list of LP token holders. + * - On failure: A standard response containing an error message. + */ +export async function getLPHolders( + this: InjectiveGrpcBase, + params: MitoTypes.GetLPHoldersParams +): Promise { + try { + const result = await this.indexerGrpcMitoApi.fetchLPHolders(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getLPHoldersError", err); + } +} + +/** + * Retrieves the portfolio details of a specific holder. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetHolderPortfolioParams} params - Parameters including the holder's address. + * @returns {Promise} + * - On success: A standard response containing the holder's portfolio details. + * - On failure: A standard response containing an error message. + */ +export async function getHolderPortfolio( + this: InjectiveGrpcBase, + params: MitoTypes.GetHolderPortfolioParams +): Promise { + try { + const result = + await this.indexerGrpcMitoApi.fetchHolderPortfolio(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getHolderPortfolioError", err); + } +} + +/** + * Retrieves the leaderboard for a specific epoch. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetLeaderboardParams} params - Parameters including the epoch identifier. + * @returns {Promise} + * - On success: A standard response containing leaderboard details for the epoch. + * - On failure: A standard response containing an error message. + */ +export async function getLeaderboard( + this: InjectiveGrpcBase, + params: MitoTypes.GetLeaderboardParams +): Promise { + try { + const result = await this.indexerGrpcMitoApi.fetchLeaderboard( + params.epochId + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getLeaderboardError", err); + } +} + +/** + * Fetches the transfer history based on provided parameters. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetTransferHistoryParams} params - Parameters to filter transfer history. + * @returns {Promise} + * - On success: A standard response containing transfer history data. + * - On failure: A standard response containing an error message. + */ +export async function getTransferHistory( + this: InjectiveGrpcBase, + params: MitoTypes.GetTransferHistoryParams +): Promise { + try { + const result = + await this.indexerGrpcMitoApi.fetchTransferHistory(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getTransferHistoryError", err); + } +} + +/** + * Retrieves the epochs associated with leaderboards. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetLeaderboardEpochsParams} [params={}] - Optional parameters to filter leaderboard epochs. + * @returns {Promise} + * - On success: A standard response containing leaderboard epochs. + * - On failure: A standard response containing an error message. + */ +export async function getLeaderboardEpochs( + this: InjectiveGrpcBase, + params: MitoTypes.GetLeaderboardEpochsParams = {} +): Promise { + try { + const result = + await this.indexerGrpcMitoApi.fetchLeaderboardEpochs(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getLeaderboardEpochsError", err); + } +} + +/** + * Retrieves information about staking pools. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetStakingPoolsParams} params - Parameters to filter staking pools. + * @returns {Promise} + * - On success: A standard response containing staking pool details. + * - On failure: A standard response containing an error message. + */ +export async function getStakingPools( + this: InjectiveGrpcBase, + params: MitoTypes.GetStakingPoolsParams +): Promise { + try { + const result = await this.indexerGrpcMitoApi.fetchStakingPools(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getStakingPoolsError", err); + } +} + +/** + * Retrieves the staking history based on provided parameters. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetStakingHistoryParams} [params={}] - Optional parameters to filter staking history. + * @returns {Promise} + * - On success: A standard response containing staking history data. + * - On failure: A standard response containing an error message. + */ +export async function getStakingHistory( + this: InjectiveGrpcBase, + params: MitoTypes.GetStakingHistoryParams = {} +): Promise { + try { + const result = + await this.indexerGrpcMitoApi.fetchStakingHistory(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getStakingHistoryError", err); + } +} + +/** + * Retrieves staking rewards for a specific account. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetStakingRewardsByAccountParams} params - Parameters including the account identifier. + * @returns {Promise} + * - On success: A standard response containing staking rewards details. + * - On failure: A standard response containing an error message. + */ +export async function getStakingRewardsByAccount( + this: InjectiveGrpcBase, + params: MitoTypes.GetStakingRewardsByAccountParams +): Promise { + try { + const result = + await this.indexerGrpcMitoApi.fetchStakingRewardsByAccount(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getStakingRewardsByAccountError", err); + } +} + +/** + * Fetches a list of missions based on provided parameters. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetMissionsParams} params - Parameters to filter missions. + * @returns {Promise} + * - On success: A standard response containing a list of missions. + * - On failure: A standard response containing an error message. + */ +export async function getMissions( + this: InjectiveGrpcBase, + params: MitoTypes.GetMissionsParams +): Promise { + try { + const result = await this.indexerGrpcMitoApi.fetchMissions(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getMissionsError", err); + } +} + +/** + * Retrieves the leaderboard for missions based on the user address. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetMissionLeaderboardParams} [params={}] - Optional parameters including the user's address. + * @returns {Promise} + * - On success: A standard response containing the mission leaderboard. + * - On failure: A standard response containing an error message. + */ +export async function getMissionLeaderboard( + this: InjectiveGrpcBase, + params: MitoTypes.GetMissionLeaderboardParams = {} +): Promise { + try { + const result = await this.indexerGrpcMitoApi.fetchMissionLeaderboard( + params.userAddress + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getMissionLeaderboardError", err); + } +} + +/** + * Fetches details of a specific Initial DEX Offering (IDO). + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetIDOParams} params - Parameters including the IDO identifier. + * @returns {Promise} + * - On success: A standard response containing IDO details. + * - On failure: A standard response containing an error message. + */ +export async function getIDO( + this: InjectiveGrpcBase, + params: MitoTypes.GetIDOParams +): Promise { + try { + const result = await this.indexerGrpcMitoApi.fetchIDO(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getIDOError", err); + } +} + +/** + * Retrieves a list of all IDOs with optional filtering. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetIDOsParams} [params={}] - Optional parameters to filter the list of IDOs. + * @returns {Promise} + * - On success: A standard response containing a list of IDOs. + * - On failure: A standard response containing an error message. + */ +export async function getIDOs( + this: InjectiveGrpcBase, + params: MitoTypes.GetIDOsParams = {} +): Promise { + try { + const result = await this.indexerGrpcMitoApi.fetchIDOs(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getIDOsError", err); + } +} + +/** + * Fetches subscribers for a specific IDO. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetIDOSubscribersParams} params - Parameters including the IDO identifier. + * @returns {Promise} + * - On success: A standard response containing a list of subscribers. + * - On failure: A standard response containing an error message. + */ +export async function getIDOSubscribers( + this: InjectiveGrpcBase, + params: MitoTypes.GetIDOSubscribersParams +): Promise { + try { + const result = + await this.indexerGrpcMitoApi.fetchIDOSubscribers(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getIDOSubscribersError", err); + } +} + +/** + * Retrieves the subscription details for a specific IDO. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetIDOSubscriptionParams} params - Parameters including the IDO identifier. + * @returns {Promise} + * - On success: A standard response containing subscription details. + * - On failure: A standard response containing an error message. + */ +export async function getIDOSubscription( + this: InjectiveGrpcBase, + params: MitoTypes.GetIDOSubscriptionParams +): Promise { + try { + const result = + await this.indexerGrpcMitoApi.fetchIDOSubscription(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getIDOSubscriptionError", err); + } +} + +/** + * Retrieves activities related to a specific IDO. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetIDOActivitiesParams} [params={}] - Optional parameters to filter IDO activities. + * @returns {Promise} + * - On success: A standard response containing IDO activities. + * - On failure: A standard response containing an error message. + */ +export async function getIDOActivities( + this: InjectiveGrpcBase, + params: MitoTypes.GetIDOActivitiesParams = {} +): Promise { + try { + const result = await this.indexerGrpcMitoApi.fetchIDOActivities(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getIDOActivitiesError", err); + } +} + +/** + * Fetches the whitelist for a specific IDO. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetIDOWhitelistParams} params - Parameters including the IDO identifier. + * @returns {Promise} + * - On success: A standard response containing the IDO whitelist. + * - On failure: A standard response containing an error message. + */ +export async function getIDOWhitelist( + this: InjectiveGrpcBase, + params: MitoTypes.GetIDOWhitelistParams +): Promise { + try { + const result = await this.indexerGrpcMitoApi.fetchIDOWhitelist(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getIDOWhitelistError", err); + } +} + +/** + * Retrieves claim references based on provided parameters. + * + * @this InjectiveGrpcBase + * @param {MitoTypes.GetClaimReferencesParams} params - Parameters to filter claim references. + * @returns {Promise} + * - On success: A standard response containing claim references. + * - On failure: A standard response containing an error message. + */ +export async function getClaimReferences( + this: InjectiveGrpcBase, + params: MitoTypes.GetClaimReferencesParams +): Promise { + try { + const result = + await this.indexerGrpcMitoApi.fetchClaimReferences(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getClaimReferencesError", err); + } +} +// All these fucntions from here on out broadcasts messages to the chain. +export async function subscribeLaunchpad( + this: InjectiveGrpcBase, + params: MitoTypes.GetLaunchpadSubscribeParams +): Promise { + try { + const { amount, quoteTokenDenom, quoteTokenDecimals, contractAddress } = + params; + + const msgs = MsgExecuteContractCompat.fromJSON({ + sender: this.injAddress, + funds: [ + { + denom: quoteTokenDenom, + amount: spotQuantityToChainQuantityToFixed({ + value: amount, + baseDecimals: quoteTokenDecimals, + }), + }, + ], + contractAddress, + exec: { + action: "Subscribe", + msg: {}, + }, + }); + + const response = this.msgBroadcaster.broadcast({ msgs }); + return createSuccessResponse(response); + } catch (err) { + return createErrorResponse("mito launchpad subscription error!", err); + } +} +export async function claimLaunchpad( + this: InjectiveGrpcBase, + params: MitoTypes.GetLaunchpadClaimParams +): Promise { + try { + const { contractAddress } = params; + + const msgs = MsgExecuteContractCompat.fromJSON({ + sender: this.injAddress, + contractAddress, + exec: { + action: "Claim", + msg: {}, + }, + }); + + const response = await this.msgBroadcaster.broadcast({ msgs }); + + return createSuccessResponse(response); + } catch (err) { + return createErrorResponse("claimLaunchpadSubscription!", err); + } +} +// TODO : Need safer params for the xyk CPMM +export async function instantiateCPMMVault( + this: InjectiveGrpcBase, + params: MitoTypes.GetInstantiateCPMMVaultParams +): Promise { + try { + const defaultAmmConfig = { + notional_value_cap: "100000000000000000000000", + pricing_strategy: { + SmoothingPricingWithRelativePriceRange: { + bid_range: "0.8", + ask_range: "0.8", + }, + }, + max_invariant_sensitivity_bps: "5", + max_price_sensitivity_bps: "5", + order_type: "Vanilla", + }; + + const msgs = MsgExecuteContractCompat.fromJSON({ + contractAddress: params.MITO_MASTER_CONTRACT_ADDRESS, + funds: params.funds, + exec: { + action: "register_vault", + msg: { + is_subscribing_with_funds: true, + registration_mode: { + permissionless: { + whitelisted_vault_code_id: + params.CPMM_CONTRACT_CODE, + }, + }, + instantiate_vault_msg: { + Amm: { + owner: this.injAddress, + master_address: params.MITO_MASTER_CONTRACT_ADDRESS, + market_id: params.marketId, + fee_bps: params.feeBps, + config_owner: this.injAddress, + base_decimals: params.baseDecimals, + quote_decimals: params.quoteDecimals, + ...defaultAmmConfig, + }, + }, + }, + }, + sender: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("instantiateCPMMVaultError", err); + } +} + +export async function subscribeToVault( + this: InjectiveGrpcBase, + params: MitoTypes.GetVaultSubscribeParams +): Promise { + try { + const data = ExecPrivilegedArgVaultSubscribe.fromJSON({ + args: + params.vaultType === MitoTypes.VaultContractType.CPMM + ? { slippage: params.slippage } + : {}, + origin: this.injAddress, + vaultSubaccountId: params.vaultSubaccountId, + traderSubaccountId: getDefaultSubaccountId(this.injAddress), + }); + + const formattedBaseAmount = + params.subscriptionType !== MitoTypes.SpotRedemptionType.QuoteOnly + ? `${spotQuantityToChainQuantityToFixed({ + value: params.baseAmount, + baseDecimals: params.market.baseDecimals, + })} ${params.market.baseDenom}` + : ""; + + const formattedQuoteAmount = + params.subscriptionType !== MitoTypes.SpotRedemptionType.BaseOnly + ? `${spotQuantityToChainQuantityToFixed({ + value: params.quoteAmount, + baseDecimals: params.market.quoteDecimals, + })} ${params.market.quoteDenom}` + : ""; + + const funds = [formattedBaseAmount, formattedQuoteAmount] + .filter((amount) => amount) + .join(", "); + + const msgs = MsgPrivilegedExecuteContract.fromJSON({ + data, + sender: this.injAddress, + funds, + contractAddress: params.masterAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("subscribeToVaultError", err); + } +} + +export async function redeemFromVault( + this: InjectiveGrpcBase, + params: MitoTypes.GetVaultRedeemParams +): Promise { + try { + const data = ExecPrivilegedArgVaultRedeem.fromJSON({ + origin: this.injAddress, + vaultSubaccountId: params.vaultSubaccountId, + traderSubaccountId: getDefaultSubaccountId(this.injAddress), + args: { + ...(params.marketType === MitoTypes.VaultMarketType.Derivative + ? { slippage: params.slippage } + : {}), + redemption_type: params.redemptionType, + }, + }); + + const amount = spotQuantityToChainQuantityToFixed({ + value: params.redeemAmount, + baseDecimals: params.vaultBaseDecimals, + }); + + const msgs = MsgPrivilegedExecuteContract.fromJSON({ + data, + sender: this.injAddress, + contractAddress: params.masterAddress, + funds: `${amount} ${params.vaultLpDenom}`, + }); + const result = await this.msgBroadcaster.broadcast({ msgs }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("redeemFromVaultError", err); + } +} + +export async function stakeVaultLP( + this: InjectiveGrpcBase, + params: MitoTypes.GetStakeVaultLPParams +): Promise { + try { + const msgs = MsgExecuteContractCompat.fromJSON({ + sender: this.injAddress, + funds: [ + { + denom: params.vaultLpDenom, + amount: spotQuantityToChainQuantityToFixed({ + value: params.amount, + baseDecimals: params.vaultTokenDecimals, + }), + }, + ], + contractAddress: params.stakingContractAddress, + exec: { + action: "stake", + msg: {}, + }, + }); + const result = await this.msgBroadcaster.broadcast({ msgs }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("stakeVaultLPError", err); + } +} + +export async function unstakeVaultLP( + this: InjectiveGrpcBase, + params: MitoTypes.GetUnstakeVaultLPParams +): Promise { + try { + const msgs = MsgExecuteContractCompat.fromJSON({ + sender: this.injAddress, + contractAddress: params.stakingContractAddress, + exec: { + action: "unstake", + msg: { + coin: { + denom: params.vaultLpDenom, + amount: spotQuantityToChainQuantityToFixed({ + value: params.amount, + baseDecimals: params.vaultTokenDecimals, + }), + }, + }, + }, + }); + const result = await this.msgBroadcaster.broadcast({ msgs }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("unstakeVaultLPError", err); + } +} + +export async function claimVaultRewards( + this: InjectiveGrpcBase, + params: MitoTypes.GetClaimVaultRewardsParams +): Promise { + try { + const msgs = MsgExecuteContractCompat.fromJSON({ + sender: this.injAddress, + contractAddress: params.stakingContractAddress, + exec: { + action: "claim_rewards", + msg: { + lp_token: params.vaultLpDenom, + }, + }, + }); + const result = await this.msgBroadcaster.broadcast({ msgs }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("claimVaultRewardsError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/oracle.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/oracle.ts new file mode 100644 index 00000000000..168877c28c3 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/oracle.ts @@ -0,0 +1,25 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; + +/** + * Fetches the parameters of the Oracle module. + * + * @this InjectiveGrpcBase + * @returns {Promise} + * - On success: A standard response containing Oracle module parameters. + * - On failure: A standard response containing an error message. + */ +export async function getOracleModuleParams( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcOracleApi.fetchModuleParams(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getOracleModuleParamsError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/peggy.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/peggy.ts new file mode 100644 index 00000000000..a1d1164f66c --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/peggy.ts @@ -0,0 +1,59 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import { + PeggyModuleParams, + MsgSendToEth, + TxResponse, +} from "@injectivelabs/sdk-ts"; +import { MsgSendToEthParams } from "../types/peggy"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; + +/** + * Fetches the parameters of the Peggy module. + * + * @this InjectiveGrpcBase + * @returns {Promise} + * - On success: A standard response containing Peggy module parameters. + * - On failure: A standard response containing an error message. + */ +export async function getPeggyModuleParams( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcPeggyApi.fetchModuleParams(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getPeggyModuleParamsError", err); + } +} + +/** + * Broadcasts a message to send tokens to an Ethereum address via IBC transfer. + * + * @this InjectiveGrpcBase + * @param {MsgSendToEthParams} params - Parameters including the recipient address and transfer details. + * @returns {Promise} + * - On success: A standard response containing the transaction result. + * - On failure: A standard response containing an error message. + */ +export async function msgSendToEth( + this: InjectiveGrpcBase, + params: MsgSendToEthParams +): Promise { + try { + const msg = MsgSendToEth.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + address: this.ethAddress, + }); + const result: TxResponse = await this.msgBroadcaster.broadcast({ + msgs: msg, + }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgSendToEthError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/permissions.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/permissions.ts new file mode 100644 index 00000000000..d805b73f135 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/permissions.ts @@ -0,0 +1,133 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import * as PermissionsType from "../types/permissions"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; + +/** + * Fetches addresses associated with a specific role. + * + * @this InjectiveGrpcBase + * @param {GetAddressesByRoleParams} params - Parameters including the role identifier. + * @returns {Promise} + * - On success: A standard response containing a list of addresses. + * - On failure: A standard response containing an error message. + */ +export async function getAddressesByRole( + this: InjectiveGrpcBase, + params: PermissionsType.GetAddressesByRoleParams +): Promise { + try { + const result = + await this.chainGrpcPermissionsApi.fetchAddressesByRole(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getAddressesByRoleError", err); + } +} + +/** + * Retrieves roles associated with a specific address. + * + * @this InjectiveGrpcBase + * @param {GetAddressRolesParams} params - Parameters including the address identifier. + * @returns {Promise} + * - On success: A standard response containing a list of roles. + * - On failure: A standard response containing an error message. + */ +export async function getAddressRoles( + this: InjectiveGrpcBase, + params: PermissionsType.GetAddressRolesParams +): Promise { + try { + const result = + await this.chainGrpcPermissionsApi.fetchAddressRoles(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getAddressRolesError", err); + } +} + +/** + * Retrieves all namespaces within the permissions module. + * + * @this InjectiveGrpcBase + * @returns {Promise} + * - On success: A standard response containing a list of namespaces. + * - On failure: A standard response containing an error message. + */ +export async function getAllNamespaces( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcPermissionsApi.fetchAllNamespaces(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getAllNamespacesError", err); + } +} + +/** + * Fetches the parameters of the Permissions module. + * + * @this InjectiveGrpcBase + * @returns {Promise} + * - On success: A standard response containing Permissions module parameters. + * - On failure: A standard response containing an error message. + */ +export async function getPermissionsModuleParams( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcPermissionsApi.fetchModuleParams(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getPermissionsModuleParamsError", err); + } +} + +/** + * Retrieves the namespace associated with a specific denomination. + * + * @this InjectiveGrpcBase + * @param {GetNamespaceByDenomParams} params - Parameters including the denomination identifier. + * @returns {Promise} + * - On success: A standard response containing the namespace. + * - On failure: A standard response containing an error message. + */ +export async function getNamespaceByDenom( + this: InjectiveGrpcBase, + params: PermissionsType.GetNamespaceByDenomParams +): Promise { + try { + const result = + await this.chainGrpcPermissionsApi.fetchNamespaceByDenom(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getNamespaceByDenomError", err); + } +} + +/** + * Retrieves vouchers associated with a specific address. + * + * @this InjectiveGrpcBase + * @param {GetVouchersForAddressParams} params - Parameters including the address identifier. + * @returns {Promise} + * - On success: A standard response containing a list of vouchers. + * - On failure: A standard response containing an error message. + */ +export async function getVouchersForAddress( + this: InjectiveGrpcBase, + params: PermissionsType.GetVouchersForAddressParams +): Promise { + try { + const result = + await this.chainGrpcPermissionsApi.fetchVouchersForAddress(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getVouchersForAddressError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/staking.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/staking.ts new file mode 100644 index 00000000000..2688dbf851b --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/staking.ts @@ -0,0 +1,500 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import { + MsgBeginRedelegate, + MsgDelegate, + MsgUndelegate, + MsgCreateValidator, + MsgEditValidator, + MsgCancelUnbondingDelegation, +} from "@injectivelabs/sdk-ts"; +import * as StakingTypes from "../types/staking"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; + +// Staking Module Async Functions with Error Handling + +/** + * Fetches the staking module parameters. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing module parameters or an error. + */ +export async function getStakingModuleParams( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcStakingApi.fetchModuleParams(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getStakingModuleParamsError", err); + } +} + +/** + * Fetches the staking pool information. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing pool information or an error. + */ +export async function getPool( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcStakingApi.fetchPool(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getPoolError", err); + } +} + +/** + * Fetches a list of validators with optional pagination. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.GetValidatorsParams} params - Parameters including pagination options. + * @returns {Promise} The standard response containing validators or an error. + */ +export async function getValidators( + this: InjectiveGrpcBase, + params: StakingTypes.GetValidatorsParams = {} +): Promise { + try { + const result = await this.chainGrpcStakingApi.fetchValidators( + params.pagination + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getValidatorsError", err); + } +} + +/** + * Fetches a specific validator by address. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.GetValidatorParams} params - Parameters including the validator's address. + * @returns {Promise} The standard response containing the validator or an error. + */ +export async function getValidator( + this: InjectiveGrpcBase, + params: StakingTypes.GetValidatorParams +): Promise { + try { + const result = await this.chainGrpcStakingApi.fetchValidator( + params.address + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getValidatorError", err); + } +} + +/** + * Fetches delegations for a specific validator. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.GetValidatorDelegationsParams} params - Parameters including the validator's address and pagination options. + * @returns {Promise} The standard response containing delegations or an error. + */ +export async function getValidatorDelegations( + this: InjectiveGrpcBase, + params: StakingTypes.GetValidatorDelegationsParams +): Promise { + try { + const result = + await this.chainGrpcStakingApi.fetchValidatorDelegations(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getValidatorDelegationsError", err); + } +} + +/** + * Fetches delegations for a specific validator without throwing an error. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.GetValidatorDelegationsParams} params - Parameters including the validator's address and pagination options. + * @returns {Promise} The standard response containing delegations or an error. + */ +export async function getValidatorDelegationsNoThrow( + this: InjectiveGrpcBase, + params: StakingTypes.GetValidatorDelegationsParams +): Promise { + try { + const result = + await this.chainGrpcStakingApi.fetchValidatorDelegationsNoThrow( + params + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getValidatorDelegationsNoThrowError", err); + } +} + +/** + * Fetches unbonding delegations for a specific validator. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.GetValidatorDelegationsParams} params - Parameters including the validator's address and pagination options. + * @returns {Promise} The standard response containing unbonding delegations or an error. + */ +export async function getValidatorUnbondingDelegations( + this: InjectiveGrpcBase, + params: StakingTypes.GetValidatorDelegationsParams +): Promise { + try { + const result = + await this.chainGrpcStakingApi.fetchValidatorUnbondingDelegations( + params + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse( + "getValidatorUnbondingDelegationsError", + err + ); + } +} + +/** + * Fetches unbonding delegations for a specific validator without throwing an error. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.GetValidatorDelegationsParams} params - Parameters including the validator's address and pagination options. + * @returns {Promise} The standard response containing unbonding delegations or an error. + */ +export async function getValidatorUnbondingDelegationsNoThrow( + this: InjectiveGrpcBase, + params: StakingTypes.GetValidatorDelegationsParams +): Promise { + try { + const result = + await this.chainGrpcStakingApi.fetchValidatorUnbondingDelegationsNoThrow( + params + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse( + "getValidatorUnbondingDelegationsNoThrowError", + err + ); + } +} + +/** + * Fetches a specific delegation. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.GetDelegationParams} params - Parameters including delegator and validator addresses. + * @returns {Promise} The standard response containing the delegation or an error. + */ +export async function getDelegation( + this: InjectiveGrpcBase, + params: StakingTypes.GetDelegationParams +): Promise { + try { + const result = await this.chainGrpcStakingApi.fetchDelegation(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDelegationError", err); + } +} + +/** + * Fetches all delegations for a delegator. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.GetDelegationsParams} params - Parameters including the delegator's address and pagination options. + * @returns {Promise} The standard response containing delegations or an error. + */ +export async function getDelegations( + this: InjectiveGrpcBase, + params: StakingTypes.GetDelegationsParams +): Promise { + try { + const result = await this.chainGrpcStakingApi.fetchDelegations(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDelegationsError", err); + } +} + +/** + * Fetches all delegations for a delegator without throwing an error. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.GetDelegationsParams} params - Parameters including the delegator's address and pagination options. + * @returns {Promise} The standard response containing delegations or an error. + */ +export async function getDelegationsNoThrow( + this: InjectiveGrpcBase, + params: StakingTypes.GetDelegationsParams +): Promise { + try { + const result = + await this.chainGrpcStakingApi.fetchDelegationsNoThrow(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDelegationsNoThrowError", err); + } +} + +/** + * Fetches all delegators for a validator. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.GetDelegatorsParams} params - Parameters including the validator's address and pagination options. + * @returns {Promise} The standard response containing delegators or an error. + */ +export async function getDelegators( + this: InjectiveGrpcBase, + params: StakingTypes.GetDelegatorsParams +): Promise { + try { + const result = await this.chainGrpcStakingApi.fetchDelegators(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDelegatorsError", err); + } +} + +/** + * Fetches all delegators for a validator without throwing an error. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.GetDelegatorsParams} params - Parameters including the validator's address and pagination options. + * @returns {Promise} The standard response containing delegators or an error. + */ +export async function getDelegatorsNoThrow( + this: InjectiveGrpcBase, + params: StakingTypes.GetDelegatorsParams +): Promise { + try { + const result = + await this.chainGrpcStakingApi.fetchDelegatorsNoThrow(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDelegatorsNoThrowError", err); + } +} + +/** + * Fetches all unbonding delegations for a delegator. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.GetUnbondingDelegationsParams} params - Parameters including the delegator's address and pagination options. + * @returns {Promise} The standard response containing unbonding delegations or an error. + */ +export async function getUnbondingDelegations( + this: InjectiveGrpcBase, + params: StakingTypes.GetUnbondingDelegationsParams +): Promise { + try { + const result = + await this.chainGrpcStakingApi.fetchUnbondingDelegations(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getUnbondingDelegationsError", err); + } +} + +/** + * Fetches all unbonding delegations for a delegator without throwing an error. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.GetUnbondingDelegationsParams} params - Parameters including the delegator's address and pagination options. + * @returns {Promise} The standard response containing unbonding delegations or an error. + */ +export async function getUnbondingDelegationsNoThrow( + this: InjectiveGrpcBase, + params: StakingTypes.GetUnbondingDelegationsParams +): Promise { + try { + const result = + await this.chainGrpcStakingApi.fetchUnbondingDelegationsNoThrow( + params + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getUnbondingDelegationsNoThrowError", err); + } +} + +/** + * Fetches all redelegations for a delegator. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.GetReDelegationsParams} params - Parameters including the delegator's address and pagination options. + * @returns {Promise} The standard response containing redelegations or an error. + */ +export async function getReDelegations( + this: InjectiveGrpcBase, + params: StakingTypes.GetReDelegationsParams +): Promise { + try { + const result = + await this.chainGrpcStakingApi.fetchReDelegations(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getReDelegationsError", err); + } +} + +/** + * Fetches all redelegations for a delegator without throwing an error. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.GetReDelegationsParams} params - Parameters including the delegator's address and pagination options. + * @returns {Promise} The standard response containing redelegations or an error. + */ +export async function getReDelegationsNoThrow( + this: InjectiveGrpcBase, + params: StakingTypes.GetReDelegationsParams +): Promise { + try { + const result = + await this.chainGrpcStakingApi.fetchReDelegationsNoThrow(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getReDelegationsNoThrowError", err); + } +} + +/** + * Broadcasts a message to begin redelegating tokens. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.MsgBeginRedelegateParams} params - Parameters including delegator address, source validator address, destination validator address, and amount. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgBeginRedelegate( + this: InjectiveGrpcBase, + params: StakingTypes.MsgBeginRedelegateParams +): Promise { + try { + const msg = MsgBeginRedelegate.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgBeginRedelegateError", err); + } +} + +/** + * Broadcasts a message to delegate tokens to a validator. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.MsgDelegateParams} params - Parameters including delegator address, validator address, and amount. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgDelegate( + this: InjectiveGrpcBase, + params: StakingTypes.MsgDelegateParams +): Promise { + try { + const msg = MsgDelegate.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgDelegateError", err); + } +} + +/** + * Broadcasts a message to undelegate tokens from a validator. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.MsgUndelegateParams} params - Parameters including delegator address, validator address, and amount. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgUndelegate( + this: InjectiveGrpcBase, + params: StakingTypes.MsgUndelegateParams +): Promise { + try { + const msg = MsgUndelegate.fromJSON({ + ...params, + injectiveAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgUndelegateError", err); + } +} + +/** + * Broadcasts a message to create a new validator. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.MsgCreateValidatorParams} params - Parameters including delegator address, validator details, and commission rates. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgCreateValidator( + this: InjectiveGrpcBase, + params: StakingTypes.MsgCreateValidatorParams +): Promise { + try { + const msg = MsgCreateValidator.fromJSON({ + ...params, + delegatorAddress: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgCreateValidatorError", err); + } +} + +/** + * Broadcasts a message to edit an existing validator. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.MsgEditValidatorParams} params - Parameters including validator address and updated details. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgEditValidator( + this: InjectiveGrpcBase, + params: StakingTypes.MsgEditValidatorParams +): Promise { + try { + const msg = MsgEditValidator.fromJSON({ + ...params, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgEditValidatorError", err); + } +} + +/** + * Broadcasts a message to cancel an unbonding delegation. + * + * @this InjectiveGrpcBase + * @param {StakingTypes.MsgCancelUnbondingDelegationParams} params - Parameters including delegator address, validator address, and completion time. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgCancelUnbondingDelegation( + this: InjectiveGrpcBase, + params: StakingTypes.MsgCancelUnbondingDelegationParams +): Promise { + try { + const msg = MsgCancelUnbondingDelegation.fromJSON({ + ...params, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgCancelUnbondingDelegationError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/token-factory.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/token-factory.ts new file mode 100644 index 00000000000..7f74b048b3c --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/token-factory.ts @@ -0,0 +1,210 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import { + MsgBurn, + MsgChangeAdmin, + MsgCreateDenom, + MsgMint, + MsgSetDenomMetadata, +} from "@injectivelabs/sdk-ts"; +import * as TokenFactoryTypes from "../types/token-factory"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; + +// Token Factory Module Async Functions with Error Handling + +/** + * Fetches all denominations created by a specific creator. + * + * @this InjectiveGrpcBase + * @param {TokenFactoryTypes.GetDenomsFromCreatorParams} params - Parameters including the creator's address. + * @returns {Promise} The standard response containing denominations or an error. + */ +export async function getDenomsFromCreator( + this: InjectiveGrpcBase, + params: TokenFactoryTypes.GetDenomsFromCreatorParams +): Promise { + try { + const result = + await this.chainGrpcTokenFactoryApi.fetchDenomsFromCreator( + params.creator + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDenomsFromCreatorError", err); + } +} + +/** + * Fetches the authority metadata for a specific denomination. + * + * @this InjectiveGrpcBase + * @param {TokenFactoryTypes.GetDenomAuthorityMetadataParams} params - Parameters including creator and sub-denomination. + * @returns {Promise} The standard response containing authority metadata or an error. + */ +export async function getDenomAuthorityMetadata( + this: InjectiveGrpcBase, + params: TokenFactoryTypes.GetDenomAuthorityMetadataParams +): Promise { + try { + const result = + await this.chainGrpcTokenFactoryApi.fetchDenomAuthorityMetadata( + params.creator, + params.subDenom + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getDenomAuthorityMetadataError", err); + } +} + +/** + * Fetches the parameters of the Token Factory module. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing module parameters or an error. + */ +export async function getTokenFactoryModuleParams( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcTokenFactoryApi.fetchModuleParams(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getTokenFactoryModuleParamsError", err); + } +} + +/** + * Fetches the current state of the Token Factory module. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing module state or an error. + */ +export async function getTokenFactoryModuleState( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcTokenFactoryApi.fetchModuleState(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getTokenFactoryModuleStateError", err); + } +} + +/** + * Broadcasts a message to burn tokens. + * + * @this InjectiveGrpcBase + * @param {TokenFactoryTypes.MsgBurnParams} params - Parameters including sender and amount. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgBurn( + this: InjectiveGrpcBase, + params: TokenFactoryTypes.MsgBurnParams +): Promise { + try { + const msg = MsgBurn.fromJSON({ + ...params, + sender: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgBurnError", err); + } +} + +/** + * Broadcasts a message to change the admin of a denomination. + * + * @this InjectiveGrpcBase + * @param {TokenFactoryTypes.MsgChangeAdminParams} params - Parameters including sender, denom, and new admin address. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgChangeAdmin( + this: InjectiveGrpcBase, + params: TokenFactoryTypes.MsgChangeAdminParams +): Promise { + try { + const msg = MsgChangeAdmin.fromJSON({ + ...params, + sender: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgChangeAdminError", err); + } +} + +/** + * Broadcasts a message to create a new denomination. + * + * @this InjectiveGrpcBase + * @param {TokenFactoryTypes.MsgCreateDenomParams} params - Parameters including sender and sub-denomination. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgCreateDenom( + this: InjectiveGrpcBase, + params: TokenFactoryTypes.MsgCreateDenomParams +): Promise { + try { + const msg = MsgCreateDenom.fromJSON({ + ...params, + sender: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgCreateDenomError", err); + } +} + +/** + * Broadcasts a message to mint new tokens. + * + * @this InjectiveGrpcBase + * @param {TokenFactoryTypes.MsgMintParams} params - Parameters including sender and total amount to mint. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgMint( + this: InjectiveGrpcBase, + params: TokenFactoryTypes.MsgMintParams +): Promise { + try { + const msg = MsgMint.fromJSON({ + amount: params.totalAmount, + sender: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgMintError", err); + } +} + +/** + * Broadcasts a message to set metadata for a denomination. + * + * @this InjectiveGrpcBase + * @param {TokenFactoryTypes.MsgSetDenomMetadataParams} params - Parameters including sender and metadata details. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgSetDenomMetadata( + this: InjectiveGrpcBase, + params: TokenFactoryTypes.MsgSetDenomMetadataParams +): Promise { + try { + const msg = MsgSetDenomMetadata.fromJSON({ + ...params, + sender: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgSetDenomMetadataError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/wasm.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/wasm.ts new file mode 100644 index 00000000000..5fedbd40f1a --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/wasm.ts @@ -0,0 +1,369 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import { + MsgStoreCode, + MsgUpdateAdmin, + MsgExecuteContract, + MsgMigrateContract, + MsgInstantiateContract, + MsgExecuteContractCompat, + MsgPrivilegedExecuteContract, +} from "@injectivelabs/sdk-ts"; +import * as WasmTypes from "../types/wasm"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; + +// Wasm Module Async Functions with Error Handling + +/** + * Fetches the balance of contract accounts. + * + * @this InjectiveGrpcBase + * @param {WasmTypes.GetContractAccountsBalanceParams} params - Parameters including contract addresses and pagination options. + * @returns {Promise} The standard response containing contract accounts balance or an error. + */ +export async function getContractAccountsBalance( + this: InjectiveGrpcBase, + params: WasmTypes.GetContractAccountsBalanceParams +): Promise { + try { + const result = + await this.chainGrpcWasmApi.fetchContractAccountsBalance(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getContractAccountsBalanceError", err); + } +} + +/** + * Fetches the state of a specific contract. + * + * @this InjectiveGrpcBase + * @param {WasmTypes.GetContractStateParams} params - Parameters including the contract address. + * @returns {Promise} The standard response containing contract state or an error. + */ +export async function getContractState( + this: InjectiveGrpcBase, + params: WasmTypes.GetContractStateParams +): Promise { + try { + const result = await this.chainGrpcWasmApi.fetchContractState(params); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getContractStateError", err); + } +} + +/** + * Fetches information about a specific contract. + * + * @this InjectiveGrpcBase + * @param {WasmTypes.GetContractInfoParams} params - Parameters including the contract address. + * @returns {Promise} The standard response containing contract info or an error. + */ +export async function getContractInfo( + this: InjectiveGrpcBase, + params: WasmTypes.GetContractInfoParams +): Promise { + try { + const result = await this.chainGrpcWasmApi.fetchContractInfo( + params.contractAddress + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getContractInfoError", err); + } +} + +/** + * Fetches the history of a specific contract. + * + * @this InjectiveGrpcBase + * @param {WasmTypes.GetContractHistoryParams} params - Parameters including the contract address. + * @returns {Promise} The standard response containing contract history or an error. + */ +export async function getContractHistory( + this: InjectiveGrpcBase, + params: WasmTypes.GetContractHistoryParams +): Promise { + try { + const result = await this.chainGrpcWasmApi.fetchContractHistory( + params.contractAddress + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getContractHistoryError", err); + } +} + +/** + * Fetches the smart contract state based on a query. + * + * @this InjectiveGrpcBase + * @param {WasmTypes.GetSmartContractStateParams} params - Parameters including contract address and query. + * @returns {Promise} The standard response containing smart contract state or an error. + */ +export async function getSmartContractState( + this: InjectiveGrpcBase, + params: WasmTypes.GetSmartContractStateParams +): Promise { + try { + const result = await this.chainGrpcWasmApi.fetchSmartContractState( + params.contractAddress, + params.query + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getSmartContractStateError", err); + } +} + +/** + * Fetches the raw state of a specific contract based on a query. + * + * @this InjectiveGrpcBase + * @param {WasmTypes.GetRawContractStateParams} params - Parameters including contract address and query. + * @returns {Promise} The standard response containing raw contract state or an error. + */ +export async function getRawContractState( + this: InjectiveGrpcBase, + params: WasmTypes.GetRawContractStateParams +): Promise { + try { + const result = await this.chainGrpcWasmApi.fetchRawContractState( + params.contractAddress, + params.query + ); + + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getRawContractStateError", err); + } +} + +/** + * Fetches all contract codes with optional pagination. + * + * @this InjectiveGrpcBase + * @param {WasmTypes.GetContractCodesParams} params - Parameters including pagination options. + * @returns {Promise} The standard response containing contract codes or an error. + */ +export async function getContractCodes( + this: InjectiveGrpcBase, + params: WasmTypes.GetContractCodesParams = {} +): Promise { + try { + const result = await this.chainGrpcWasmApi.fetchContractCodes( + params.pagination + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getContractCodesError", err); + } +} + +/** + * Fetches a specific contract code by its ID. + * + * @this InjectiveGrpcBase + * @param {WasmTypes.GetContractCodeParams} params - Parameters including the code ID. + * @returns {Promise} The standard response containing contract code or an error. + */ +export async function getContractCode( + this: InjectiveGrpcBase, + params: WasmTypes.GetContractCodeParams +): Promise { + try { + const result = await this.chainGrpcWasmApi.fetchContractCode( + params.codeId + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getContractCodeError", err); + } +} + +/** + * Fetches contracts associated with a specific contract code with optional pagination. + * + * @this InjectiveGrpcBase + * @param {WasmTypes.GetContractCodeContractsParams} params - Parameters including code ID and pagination options. + * @returns {Promise} The standard response containing contracts or an error. + */ +export async function getContractCodeContracts( + this: InjectiveGrpcBase, + params: WasmTypes.GetContractCodeContractsParams +): Promise { + try { + const result = await this.chainGrpcWasmApi.fetchContractCodeContracts( + params.codeId, + params.pagination + ); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getContractCodeContractsError", err); + } +} + +/** + * Broadcasts a message to store new contract code. + * + * @this InjectiveGrpcBase + * @param {WasmTypes.MsgStoreCodeParams} params - Parameters including sender and wasm bytecode. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgStoreCode( + this: InjectiveGrpcBase, + params: WasmTypes.MsgStoreCodeParams +): Promise { + try { + const msg = MsgStoreCode.fromJSON({ + ...params, + sender: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgStoreCodeError", err); + } +} + +/** + * Broadcasts a message to update the admin of a contract. + * + * @this InjectiveGrpcBase + * @param {WasmTypes.MsgUpdateAdminParams} params - Parameters including sender, contract address, and new admin address. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgUpdateAdmin( + this: InjectiveGrpcBase, + params: WasmTypes.MsgUpdateAdminParams +): Promise { + try { + const msg = MsgUpdateAdmin.fromJSON({ + ...params, + sender: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgUpdateAdminError", err); + } +} + +/** + * Broadcasts a message to execute a contract. + * + * @this InjectiveGrpcBase + * @param {WasmTypes.MsgExecuteContractParams} params - Parameters including sender, contract address, and execute message. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgExecuteContract( + this: InjectiveGrpcBase, + params: WasmTypes.MsgExecuteContractParams +): Promise { + try { + const msg = MsgExecuteContract.fromJSON({ + ...params, + sender: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgExecuteContractError", err); + } +} + +/** + * Broadcasts a message to migrate a contract to a new code version. + * + * @this InjectiveGrpcBase + * @param {WasmTypes.MsgMigrateContractParams} params - Parameters including sender, contract address, new code ID, and migrate message. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgMigrateContract( + this: InjectiveGrpcBase, + params: WasmTypes.MsgMigrateContractParams +): Promise { + try { + const msg = MsgMigrateContract.fromJSON({ + ...params, + sender: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgMigrateContractError", err); + } +} + +/** + * Broadcasts a message to instantiate a new contract. + * + * @this InjectiveGrpcBase + * @param {WasmTypes.MsgInstantiateContractParams} params - Parameters including sender, code ID, instantiate message, and label. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgInstantiateContract( + this: InjectiveGrpcBase, + params: WasmTypes.MsgInstantiateContractParams +): Promise { + try { + const msg = MsgInstantiateContract.fromJSON({ + ...params, + sender: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgInstantiateContractError", err); + } +} + +/** + * Broadcasts a message to execute a contract using compatibility mode. + * + * @this InjectiveGrpcBase + * @param {WasmTypes.MsgExecuteContractCompatParams} params - Parameters including sender, contract address, and execute message. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgExecuteContractCompat( + this: InjectiveGrpcBase, + params: WasmTypes.MsgExecuteContractCompatParams +): Promise { + try { + const msg = MsgExecuteContractCompat.fromJSON({ + ...params, + sender: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgExecuteContractCompatError", err); + } +} + +/** + * Broadcasts a privileged message to execute a contract. + * + * @this InjectiveGrpcBase + * @param {WasmTypes.MsgPrivilegedExecuteContractParams} params - Parameters including sender, contract address, and execute message. + * @returns {Promise} The standard response containing the broadcast result or an error. + */ +export async function msgPrivilegedExecuteContract( + this: InjectiveGrpcBase, + params: WasmTypes.MsgPrivilegedExecuteContractParams +): Promise { + try { + const msg = MsgPrivilegedExecuteContract.fromJSON({ + ...params, + sender: this.injAddress, + }); + const result = await this.msgBroadcaster.broadcast({ msgs: msg }); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("msgPrivilegedExecuteContractError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/modules/wasmx.ts b/packages/plugin-injective/injective-sdk-client-ts/src/modules/wasmx.ts new file mode 100644 index 00000000000..1fb8b2cab83 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/modules/wasmx.ts @@ -0,0 +1,44 @@ +import { InjectiveGrpcBase } from "../grpc/grpc-base"; +import { + StandardResponse, + createSuccessResponse, + createErrorResponse, +} from "../types/index"; + +/** + * WasmX Module Async Functions with Error Handling + */ + +/** + * Fetches the parameters of the WasmX module. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing module parameters or an error. + */ +export async function getWasmxModuleParams( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcWasmXApi.fetchModuleParams(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getWasmxModuleParamsError", err); + } +} + +/** + * Fetches the current state of the WasmX module. + * + * @this InjectiveGrpcBase + * @returns {Promise} The standard response containing module state or an error. + */ +export async function getWasmxModuleState( + this: InjectiveGrpcBase +): Promise { + try { + const result = await this.chainGrpcWasmXApi.fetchModuleState(); + return createSuccessResponse(result); + } catch (err) { + return createErrorResponse("getWasmxModuleStateError", err); + } +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/similes/auction.ts b/packages/plugin-injective/injective-sdk-client-ts/src/similes/auction.ts new file mode 100644 index 00000000000..18ef0afa1d8 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/similes/auction.ts @@ -0,0 +1,71 @@ +export const getAuctionModuleParamsSimiles = [ + "VIEW_PARAMS", + "GET_PARAMS", + "CHECK_PARAMS", + "FETCH_PARAMS", + "READ_PARAMS", + "DISPLAY_PARAMS", + "SHOW_PARAMS", + "LIST_PARAMS", + "RETRIEVE_PARAMS", +]; + +export const getAuctionModuleStateSimiles = [ + "VIEW_STATE", + "GET_STATE", + "CHECK_STATE", + "FETCH_STATE", + "READ_STATE", + "DISPLAY_STATE", + "SHOW_STATE", + "LIST_STATE", + "RETRIEVE_STATE", +]; + +export const getCurrentBasketSimiles = [ + "VIEW_BASKET", + "GET_BASKET", + "CHECK_BASKET", + "FETCH_BASKET", + "READ_BASKET", + "DISPLAY_BASKET", + "SHOW_BASKET", + "LIST_BASKET", + "RETRIEVE_BASKET", +]; + +export const getAuctionRoundSimiles = [ + "VIEW_ROUND", + "GET_ROUND", + "CHECK_ROUND", + "FETCH_ROUND", + "READ_ROUND", + "DISPLAY_ROUND", + "SHOW_ROUND", + "LIST_ROUND", + "RETRIEVE_ROUND", +]; + +export const getAuctionsSimiles = [ + "VIEW_AUCTIONS", + "GET_AUCTIONS", + "CHECK_AUCTIONS", + "FETCH_AUCTIONS", + "READ_AUCTIONS", + "DISPLAY_AUCTIONS", + "SHOW_AUCTIONS", + "LIST_AUCTIONS", + "RETRIEVE_AUCTIONS", +]; + +export const MsgBidSimiles = [ + "PLACE_BID", + "SUBMIT_BID", + "SEND_BID", + "MAKE_BID", + "CREATE_BID", + "START_BID", + "ENTER_BID", + "POST_BID", + "REGISTER_BID", +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/similes/auth.ts b/packages/plugin-injective/injective-sdk-client-ts/src/similes/auth.ts new file mode 100644 index 00000000000..8d189a10f47 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/similes/auth.ts @@ -0,0 +1,107 @@ +export const getAuthModuleParamsSimiles = [ + "VIEW_AUTH_PARAMS", + "GET_AUTH_PARAMS", + "CHECK_AUTH_PARAMS", + "FETCH_AUTH_PARAMS", + "READ_AUTH_PARAMS", + "DISPLAY_AUTH_PARAMS", + "SHOW_AUTH_PARAMS", + "LIST_AUTH_PARAMS", + "RETRIEVE_AUTH_PARAMS", +]; + +export const getAccountDetailsSimiles = [ + "VIEW_AUTH_ACCOUNT", + "GET_AUTH_ACCOUNT", + "CHECK_AUTH_ACCOUNT", + "FETCH_AUTH_ACCOUNT", + "READ_AUTH_ACCOUNT", + "DISPLAY_AUTH_ACCOUNT", + "SHOW_AUTH_ACCOUNT", + "LIST_AUTH_ACCOUNT", + "RETRIEVE_AUTH_ACCOUNT", +]; + +export const getAccountsSimiles = [ + "VIEW_AUTH_ACCOUNTS", + "GET_AUTH_ACCOUNTS", + "CHECK_AUTH_ACCOUNTS", + "FETCH_AUTH_ACCOUNTS", + "READ_AUTH_ACCOUNTS", + "DISPLAY_AUTH_ACCOUNTS", + "SHOW_AUTH_ACCOUNTS", + "LIST_AUTH_ACCOUNTS", + "RETRIEVE_AUTH_ACCOUNTS", +]; + +export const getGrantsSimiles = [ + "VIEW_AUTH_GRANTS", + "GET_AUTH_GRANTS", + "CHECK_AUTH_GRANTS", + "FETCH_AUTH_GRANTS", + "READ_AUTH_GRANTS", + "DISPLAY_AUTH_GRANTS", + "SHOW_AUTH_GRANTS", + "LIST_AUTH_GRANTS", + "RETRIEVE_AUTH_GRANTS", +]; + +export const getGranterGrantsSimiles = [ + "VIEW_GRANTER_GRANTS", + "GET_GRANTER_GRANTS", + "CHECK_GRANTER_GRANTS", + "FETCH_GRANTER_GRANTS", + "READ_GRANTER_GRANTS", + "DISPLAY_GRANTER_GRANTS", + "SHOW_GRANTER_GRANTS", + "LIST_GRANTER_GRANTS", + "RETRIEVE_GRANTER_GRANTS", +]; + +export const getGranteeGrantsSimiles = [ + "VIEW_GRANTEE_GRANTS", + "GET_GRANTEE_GRANTS", + "CHECK_GRANTEE_GRANTS", + "FETCH_GRANTEE_GRANTS", + "READ_GRANTEE_GRANTS", + "DISPLAY_GRANTEE_GRANTS", + "SHOW_GRANTEE_GRANTS", + "LIST_GRANTEE_GRANTS", + "RETRIEVE_GRANTEE_GRANTS", +]; + +export const msgGrantSimiles = [ + "CREATE_AUTH_GRANT", + "MAKE_AUTH_GRANT", + "SET_AUTH_GRANT", + "START_AUTH_GRANT", + "BEGIN_AUTH_GRANT", + "INIT_AUTH_GRANT", + "ASSIGN_AUTH_GRANT", + "ENABLE_AUTH_GRANT", + "REGISTER_AUTH_GRANT", +]; + +export const msgExecSimiles = [ + "EXECUTE_AUTH_ACTION", + "RUN_AUTH_ACTION", + "PERFORM_AUTH_ACTION", + "START_AUTH_ACTION", + "BEGIN_AUTH_ACTION", + "TRIGGER_AUTH_ACTION", + "LAUNCH_AUTH_ACTION", + "PROCESS_AUTH_ACTION", + "INITIATE_AUTH_ACTION", +]; + +export const msgRevokeSimiles = [ + "REVOKE_AUTH_GRANT", + "REMOVE_AUTH_GRANT", + "CANCEL_AUTH_GRANT", + "DELETE_AUTH_GRANT", + "STOP_AUTH_GRANT", + "END_AUTH_GRANT", + "DISABLE_AUTH_GRANT", + "WITHDRAW_AUTH_GRANT", + "TERMINATE_AUTH_GRANT", +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/similes/bank.ts b/packages/plugin-injective/injective-sdk-client-ts/src/similes/bank.ts new file mode 100644 index 00000000000..9d25dc30d8e --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/similes/bank.ts @@ -0,0 +1,131 @@ +export const getBankModuleParamsSimiles = [ + "VIEW_BANK_PARAMS", + "GET_BANK_PARAMS", + "CHECK_BANK_PARAMS", + "FETCH_BANK_PARAMS", + "READ_BANK_PARAMS", + "DISPLAY_BANK_PARAMS", + "SHOW_BANK_PARAMS", + "LIST_BANK_PARAMS", + "RETRIEVE_BANK_PARAMS", +]; + +export const getBankBalanceSimiles = [ + "VIEW_BANK_BALANCE", + "GET_BANK_BALANCE", + "CHECK_BANK_BALANCE", + "FETCH_BANK_BALANCE", + "READ_BANK_BALANCE", + "DISPLAY_BANK_BALANCE", + "SHOW_BANK_BALANCE", + "LIST_BANK_BALANCE", + "RETRIEVE_BANK_BALANCE", +]; + +export const getBankBalancesSimiles = [ + "VIEW_BANK_BALANCES", + "GET_BANK_BALANCES", + "CHECK_BANK_BALANCES", + "FETCH_BANK_BALANCES", + "READ_BANK_BALANCES", + "DISPLAY_BANK_BALANCES", + "SHOW_BANK_BALANCES", + "LIST_BANK_BALANCES", + "RETRIEVE_BANK_BALANCES", +]; + +export const getTotalSupplySimiles = [ + "VIEW_BANK_SUPPLY", + "GET_BANK_SUPPLY", + "CHECK_BANK_SUPPLY", + "FETCH_BANK_SUPPLY", + "READ_BANK_SUPPLY", + "DISPLAY_BANK_SUPPLY", + "SHOW_BANK_SUPPLY", + "LIST_BANK_SUPPLY", + "RETRIEVE_BANK_SUPPLY", +]; + +export const getAllTotalSupplySimiles = [ + "VIEW_BANK_SUPPLIES", + "GET_BANK_SUPPLIES", + "CHECK_BANK_SUPPLIES", + "FETCH_BANK_SUPPLIES", + "READ_BANK_SUPPLIES", + "DISPLAY_BANK_SUPPLIES", + "SHOW_BANK_SUPPLIES", + "LIST_BANK_SUPPLIES", + "RETRIEVE_BANK_SUPPLIES", +]; + +export const getSupplyOfSimiles = [ + "VIEW_TOKEN_SUPPLY", + "GET_TOKEN_SUPPLY", + "CHECK_TOKEN_SUPPLY", + "FETCH_TOKEN_SUPPLY", + "READ_TOKEN_SUPPLY", + "DISPLAY_TOKEN_SUPPLY", + "SHOW_TOKEN_SUPPLY", + "LIST_TOKEN_SUPPLY", + "RETRIEVE_TOKEN_SUPPLY", +]; + +export const getDenomsMetadataSimiles = [ + "VIEW_BANK_DENOMS", + "GET_BANK_DENOMS", + "CHECK_BANK_DENOMS", + "FETCH_BANK_DENOMS", + "READ_BANK_DENOMS", + "DISPLAY_BANK_DENOMS", + "SHOW_BANK_DENOMS", + "LIST_BANK_DENOMS", + "RETRIEVE_BANK_DENOMS", +]; + +export const getDenomMetadataSimiles = [ + "VIEW_BANK_DENOM", + "GET_BANK_DENOM", + "CHECK_BANK_DENOM", + "FETCH_BANK_DENOM", + "READ_BANK_DENOM", + "DISPLAY_BANK_DENOM", + "SHOW_BANK_DENOM", + "LIST_BANK_DENOM", + "RETRIEVE_BANK_DENOM", +]; + +export const getDenomOwnersSimiles = [ + "VIEW_DENOM_OWNERS", + "GET_DENOM_OWNERS", + "CHECK_DENOM_OWNERS", + "FETCH_DENOM_OWNERS", + "READ_DENOM_OWNERS", + "DISPLAY_DENOM_OWNERS", + "SHOW_DENOM_OWNERS", + "LIST_DENOM_OWNERS", + "RETRIEVE_DENOM_OWNERS", +]; + +export const msgSendSimiles = [ + "SEND_BANK_TOKENS", + "TRANSFER_BANK_TOKENS", + "MOVE_BANK_TOKENS", + "SUBMIT_BANK_TRANSFER", + "CREATE_BANK_TRANSFER", + "EXECUTE_BANK_TRANSFER", + "PROCESS_BANK_TRANSFER", + "INITIATE_BANK_TRANSFER", + "PERFORM_BANK_TRANSFER", +]; + +export const msgMultiSendSimiles = [ + "SEND_MULTIPLE_TOKENS", + "TRANSFER_MULTIPLE_TOKENS", + "MOVE_MULTIPLE_TOKENS", + "SUBMIT_MULTIPLE_TRANSFERS", + "CREATE_MULTIPLE_TRANSFERS", + "EXECUTE_MULTIPLE_TRANSFERS", + "PROCESS_MULTIPLE_TRANSFERS", + "INITIATE_MULTIPLE_TRANSFERS", + "PERFORM_MULTIPLE_TRANSFERS", +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/similes/distribution.ts b/packages/plugin-injective/injective-sdk-client-ts/src/similes/distribution.ts new file mode 100644 index 00000000000..1a2673893ec --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/similes/distribution.ts @@ -0,0 +1,83 @@ +export const getDistributionModuleParamsSimiles = [ + "VIEW_DISTRIBUTION_PARAMS", + "GET_DISTRIBUTION_PARAMS", + "CHECK_DISTRIBUTION_PARAMS", + "FETCH_DISTRIBUTION_PARAMS", + "READ_DISTRIBUTION_PARAMS", + "DISPLAY_DISTRIBUTION_PARAMS", + "SHOW_DISTRIBUTION_PARAMS", + "LIST_DISTRIBUTION_PARAMS", + "RETRIEVE_DISTRIBUTION_PARAMS", +]; + +export const getDelegatorRewardsForValidatorSimiles = [ + "VIEW_VALIDATOR_REWARDS", + "GET_VALIDATOR_REWARDS", + "CHECK_VALIDATOR_REWARDS", + "FETCH_VALIDATOR_REWARDS", + "READ_VALIDATOR_REWARDS", + "DISPLAY_VALIDATOR_REWARDS", + "SHOW_VALIDATOR_REWARDS", + "LIST_VALIDATOR_REWARDS", + "RETRIEVE_VALIDATOR_REWARDS", +]; + +export const getDelegatorRewardsForValidatorNoThrowSimiles = [ + "VIEW_VALIDATOR_REWARDS_SAFE", + "GET_VALIDATOR_REWARDS_SAFE", + "CHECK_VALIDATOR_REWARDS_SAFE", + "FETCH_VALIDATOR_REWARDS_SAFE", + "READ_VALIDATOR_REWARDS_SAFE", + "DISPLAY_VALIDATOR_REWARDS_SAFE", + "SHOW_VALIDATOR_REWARDS_SAFE", + "LIST_VALIDATOR_REWARDS_SAFE", + "RETRIEVE_VALIDATOR_REWARDS_SAFE", +]; + +export const getDelegatorRewardsSimiles = [ + "VIEW_DELEGATOR_REWARDS", + "GET_DELEGATOR_REWARDS", + "CHECK_DELEGATOR_REWARDS", + "FETCH_DELEGATOR_REWARDS", + "READ_DELEGATOR_REWARDS", + "DISPLAY_DELEGATOR_REWARDS", + "SHOW_DELEGATOR_REWARDS", + "LIST_DELEGATOR_REWARDS", + "RETRIEVE_DELEGATOR_REWARDS", +]; + +export const getDelegatorRewardsNoThrowSimiles = [ + "VIEW_DELEGATOR_REWARDS_SAFE", + "GET_DELEGATOR_REWARDS_SAFE", + "CHECK_DELEGATOR_REWARDS_SAFE", + "FETCH_DELEGATOR_REWARDS_SAFE", + "READ_DELEGATOR_REWARDS_SAFE", + "DISPLAY_DELEGATOR_REWARDS_SAFE", + "SHOW_DELEGATOR_REWARDS_SAFE", + "LIST_DELEGATOR_REWARDS_SAFE", + "RETRIEVE_DELEGATOR_REWARDS_SAFE", +]; + +export const msgWithdrawDelegatorRewardSimiles = [ + "WITHDRAW_DELEGATOR_REWARDS", + "CLAIM_DELEGATOR_REWARDS", + "COLLECT_DELEGATOR_REWARDS", + "FETCH_DELEGATOR_REWARDS", + "REQUEST_DELEGATOR_REWARDS", + "RETRIEVE_DELEGATOR_REWARDS", + "PROCESS_DELEGATOR_REWARDS", + "EXTRACT_DELEGATOR_REWARDS", + "RELEASE_DELEGATOR_REWARDS", +]; + +export const msgWithdrawValidatorCommissionSimiles = [ + "WITHDRAW_VALIDATOR_COMMISSION", + "CLAIM_VALIDATOR_COMMISSION", + "COLLECT_VALIDATOR_COMMISSION", + "FETCH_VALIDATOR_COMMISSION", + "REQUEST_VALIDATOR_COMMISSION", + "RETRIEVE_VALIDATOR_COMMISSION", + "PROCESS_VALIDATOR_COMMISSION", + "EXTRACT_VALIDATOR_COMMISSION", + "RELEASE_VALIDATOR_COMMISSION", +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/similes/exchange.ts b/packages/plugin-injective/injective-sdk-client-ts/src/similes/exchange.ts new file mode 100644 index 00000000000..3e2613413d7 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/similes/exchange.ts @@ -0,0 +1,852 @@ +// Module Parameters and State +export const getModuleParamsSimiles = [ + "VIEW_EXCHANGE_PARAMS", + "GET_EXCHANGE_PARAMS", + "CHECK_EXCHANGE_PARAMS", + "FETCH_EXCHANGE_PARAMS", + "READ_EXCHANGE_PARAMS", + "DISPLAY_EXCHANGE_PARAMS", + "SHOW_EXCHANGE_PARAMS", + "LIST_EXCHANGE_PARAMS", + "RETRIEVE_EXCHANGE_PARAMS", +]; + +export const getModuleStateSimiles = [ + "VIEW_EXCHANGE_STATE", + "GET_EXCHANGE_STATE", + "CHECK_EXCHANGE_STATE", + "FETCH_EXCHANGE_STATE", + "READ_EXCHANGE_STATE", + "DISPLAY_EXCHANGE_STATE", + "SHOW_EXCHANGE_STATE", + "LIST_EXCHANGE_STATE", + "RETRIEVE_EXCHANGE_STATE", +]; + +// Fee Discounts +export const getFeeDiscountScheduleSimiles = [ + "VIEW_DISCOUNT_SCHEDULE", + "GET_DISCOUNT_SCHEDULE", + "CHECK_DISCOUNT_SCHEDULE", + "FETCH_DISCOUNT_SCHEDULE", + "READ_DISCOUNT_SCHEDULE", + "DISPLAY_DISCOUNT_SCHEDULE", + "SHOW_DISCOUNT_SCHEDULE", + "LIST_DISCOUNT_SCHEDULE", + "RETRIEVE_DISCOUNT_SCHEDULE", +]; + +export const getFeeDiscountAccountInfoSimiles = [ + "VIEW_DISCOUNT_INFO", + "GET_DISCOUNT_INFO", + "CHECK_DISCOUNT_INFO", + "FETCH_DISCOUNT_INFO", + "READ_DISCOUNT_INFO", + "DISPLAY_DISCOUNT_INFO", + "SHOW_DISCOUNT_INFO", + "LIST_DISCOUNT_INFO", + "RETRIEVE_DISCOUNT_INFO", +]; + +// Trading Rewards +export const getTradingRewardsCampaignSimiles = [ + "VIEW_REWARDS_CAMPAIGN", + "GET_REWARDS_CAMPAIGN", + "CHECK_REWARDS_CAMPAIGN", + "FETCH_REWARDS_CAMPAIGN", + "READ_REWARDS_CAMPAIGN", + "DISPLAY_REWARDS_CAMPAIGN", + "SHOW_REWARDS_CAMPAIGN", + "LIST_REWARDS_CAMPAIGN", + "RETRIEVE_REWARDS_CAMPAIGN", +]; + +export const getTradeRewardPointsSimiles = [ + "VIEW_REWARD_POINTS", + "GET_REWARD_POINTS", + "CHECK_REWARD_POINTS", + "FETCH_REWARD_POINTS", + "READ_REWARD_POINTS", + "DISPLAY_REWARD_POINTS", + "SHOW_REWARD_POINTS", + "LIST_REWARD_POINTS", + "RETRIEVE_REWARD_POINTS", +]; + +export const getPendingTradeRewardPointsSimiles = [ + "VIEW_PENDING_REWARDS", + "GET_PENDING_REWARDS", + "CHECK_PENDING_REWARDS", + "FETCH_PENDING_REWARDS", + "READ_PENDING_REWARDS", + "DISPLAY_PENDING_REWARDS", + "SHOW_PENDING_REWARDS", + "LIST_PENDING_REWARDS", + "RETRIEVE_PENDING_REWARDS", +]; + +// Orderbooks +export const getDerivativeOrderbooksSimiles = [ + "VIEW_DERIVATIVE_BOOKS", + "GET_DERIVATIVE_BOOKS", + "CHECK_DERIVATIVE_BOOKS", + "FETCH_DERIVATIVE_BOOKS", + "READ_DERIVATIVE_BOOKS", + "DISPLAY_DERIVATIVE_BOOKS", + "SHOW_DERIVATIVE_BOOKS", + "LIST_DERIVATIVE_BOOKS", + "RETRIEVE_DERIVATIVE_BOOKS", +]; + +export const getDerivativeOrderbookSimiles = [ + "VIEW_DERIVATIVE_BOOK", + "GET_DERIVATIVE_BOOK", + "CHECK_DERIVATIVE_BOOK", + "FETCH_DERIVATIVE_BOOK", + "READ_DERIVATIVE_BOOK", + "DISPLAY_DERIVATIVE_BOOK", + "SHOW_DERIVATIVE_BOOK", + "LIST_DERIVATIVE_BOOK", + "RETRIEVE_DERIVATIVE_BOOK", +]; + +export const getSpotOrderbooksSimiles = [ + "VIEW_SPOT_BOOKS", + "GET_SPOT_BOOKS", + "CHECK_SPOT_BOOKS", + "FETCH_SPOT_BOOKS", + "READ_SPOT_BOOKS", + "DISPLAY_SPOT_BOOKS", + "SHOW_SPOT_BOOKS", + "LIST_SPOT_BOOKS", + "RETRIEVE_SPOT_BOOKS", +]; + +export const getSpotOrderbookSimiles = [ + "VIEW_SPOT_BOOK", + "GET_SPOT_BOOK", + "CHECK_SPOT_BOOK", + "FETCH_SPOT_BOOK", + "READ_SPOT_BOOK", + "DISPLAY_SPOT_BOOK", + "SHOW_SPOT_BOOK", + "LIST_SPOT_BOOK", + "RETRIEVE_SPOT_BOOK", +]; + +// Spot Markets +export const getSpotMarketsSimiles = [ + "VIEW_SPOT_MARKETS", + "GET_SPOT_MARKETS", + "CHECK_SPOT_MARKETS", + "FETCH_SPOT_MARKETS", + "READ_SPOT_MARKETS", + "DISPLAY_SPOT_MARKETS", + "SHOW_SPOT_MARKETS", + "LIST_SPOT_MARKETS", + "RETRIEVE_SPOT_MARKETS", +]; + +export const getSpotMarketSimiles = [ + "VIEW_SPOT_MARKET", + "GET_SPOT_MARKET", + "CHECK_SPOT_MARKET", + "FETCH_SPOT_MARKET", + "READ_SPOT_MARKET", + "DISPLAY_SPOT_MARKET", + "SHOW_SPOT_MARKET", + "LIST_SPOT_MARKET", + "RETRIEVE_SPOT_MARKET", +]; + +export const getSpotOrdersSimiles = [ + "VIEW_SPOT_ORDERS", + "GET_SPOT_ORDERS", + "CHECK_SPOT_ORDERS", + "FETCH_SPOT_ORDERS", + "READ_SPOT_ORDERS", + "DISPLAY_SPOT_ORDERS", + "SHOW_SPOT_ORDERS", + "LIST_SPOT_ORDERS", + "RETRIEVE_SPOT_ORDERS", +]; + +export const getSpotOrderHistorySimiles = [ + "VIEW_SPOT_HISTORY", + "GET_SPOT_HISTORY", + "CHECK_SPOT_HISTORY", + "FETCH_SPOT_HISTORY", + "READ_SPOT_HISTORY", + "DISPLAY_SPOT_HISTORY", + "SHOW_SPOT_HISTORY", + "LIST_SPOT_HISTORY", + "RETRIEVE_SPOT_HISTORY", +]; + +export const getSpotTradesSimiles = [ + "VIEW_SPOT_TRADES", + "GET_SPOT_TRADES", + "CHECK_SPOT_TRADES", + "FETCH_SPOT_TRADES", + "READ_SPOT_TRADES", + "DISPLAY_SPOT_TRADES", + "SHOW_SPOT_TRADES", + "LIST_SPOT_TRADES", + "RETRIEVE_SPOT_TRADES", +]; + +// Derivative Markets +export const getDerivativeMarketsSimiles = [ + "VIEW_DERIVATIVE_MARKETS", + "GET_DERIVATIVE_MARKETS", + "CHECK_DERIVATIVE_MARKETS", + "FETCH_DERIVATIVE_MARKETS", + "READ_DERIVATIVE_MARKETS", + "DISPLAY_DERIVATIVE_MARKETS", + "SHOW_DERIVATIVE_MARKETS", + "LIST_DERIVATIVE_MARKETS", + "RETRIEVE_DERIVATIVE_MARKETS", +]; + +export const getDerivativeMarketSimiles = [ + "VIEW_DERIVATIVE_MARKET", + "GET_DERIVATIVE_MARKET", + "CHECK_DERIVATIVE_MARKET", + "FETCH_DERIVATIVE_MARKET", + "READ_DERIVATIVE_MARKET", + "DISPLAY_DERIVATIVE_MARKET", + "SHOW_DERIVATIVE_MARKET", + "LIST_DERIVATIVE_MARKET", + "RETRIEVE_DERIVATIVE_MARKET", +]; + +export const getDerivativeOrdersSimiles = [ + "VIEW_DERIVATIVE_ORDERS", + "GET_DERIVATIVE_ORDERS", + "CHECK_DERIVATIVE_ORDERS", + "FETCH_DERIVATIVE_ORDERS", + "READ_DERIVATIVE_ORDERS", + "DISPLAY_DERIVATIVE_ORDERS", + "SHOW_DERIVATIVE_ORDERS", + "LIST_DERIVATIVE_ORDERS", + "RETRIEVE_DERIVATIVE_ORDERS", +]; + +export const getDerivativeOrderHistorySimiles = [ + "VIEW_DERIVATIVE_ORDER_HISTORY", + "GET_DERIVATIVE_ORDER_HISTORY", + "CHECK_DERIVATIVE_ORDER_HISTORY", + "FETCH_DERIVATIVE_ORDER_HISTORY", + "READ_DERIVATIVE_ORDER_HISTORY", + "DISPLAY_DERIVATIVE_ORDER_HISTORY", + "SHOW_DERIVATIVE_ORDER_HISTORY", + "LIST_DERIVATIVE_ORDER_HISTORY", + "RETRIEVE_DERIVATIVE_ORDER_HISTORY", +]; + +export const getDerivativeTradesSimiles = [ + "VIEW_DERIVATIVE_TRADES", + "GET_DERIVATIVE_TRADES", + "CHECK_DERIVATIVE_TRADES", + "FETCH_DERIVATIVE_TRADES", + "READ_DERIVATIVE_TRADES", + "DISPLAY_DERIVATIVE_TRADES", + "SHOW_DERIVATIVE_TRADES", + "LIST_DERIVATIVE_TRADES", + "RETRIEVE_DERIVATIVE_TRADES", +]; + +// Binary Options +export const getBinaryOptionsMarketsSimiles = [ + "VIEW_BINARY_OPTIONS_MARKET", + "GET_BINARY_OPTIONS_MARKET", + "CHECK_BINARY_OPTIONS_MARKET", + "FETCH_BINARY_OPTIONS_MARKET", + "READ_BINARY_OPTIONS_MARKET", + "DISPLAY_BINARY_OPTIONS_MARKET", + "SHOW_BINARY_OPTIONS_MARKET", + "LIST_BINARY_OPTIONS_MARKET", + "RETRIEVE_BINARY_OPTIONS_MARKET", +]; + +export const getBinaryOptionsMarketSimiles = [ + "VIEW_BINARY_OPTIONS", + "GET_BINARY_OPTIONS", + "CHECK_BINARY_OPTIONS", + "FETCH_BINARY_OPTIONS", + "READ_BINARY_OPTIONS", + "DISPLAY_BINARY_OPTIONS", + "SHOW_BINARY_OPTIONS", + "LIST_BINARY_OPTIONS", + "RETRIEVE_BINARY_OPTIONS", +]; + +// Positions +export const getExchangePositionsSimiles = [ + "VIEW_EXCHANGE_POSITIONS", + "GET_EXCHANGE_POSITIONS", + "CHECK_EXCHANGE_POSITIONS", + "FETCH_EXCHANGE_POSITIONS", + "READ_EXCHANGE_POSITIONS", + "DISPLAY_EXCHANGE_POSITIONS", + "SHOW_EXCHANGE_POSITIONS", + "LIST_EXCHANGE_POSITIONS", + "RETRIEVE_EXCHANGE_POSITIONS", +]; +// Positions +export const getUserPositionsSimiles = [ + "VIEW_USER_POSITIONS", + "GET_USER_POSITIONS", + "CHECK_USER_POSITIONS", + "FETCH_USER_POSITIONS", + "READ_USER_POSITIONS", + "DISPLAY_USER_POSITIONS", + "SHOW_USER_POSITIONS", + "LIST_USER_POSITIONS", + "RETRIEVE_USER_POSITIONS", +]; + +// Funding +export const getFundingPaymentsSimiles = [ + "VIEW_FUNDING_PAYMENTS", + "GET_FUNDING_PAYMENTS", + "CHECK_FUNDING_PAYMENTS", + "FETCH_FUNDING_PAYMENTS", + "READ_FUNDING_PAYMENTS", + "DISPLAY_FUNDING_PAYMENTS", + "SHOW_FUNDING_PAYMENTS", + "LIST_FUNDING_PAYMENTS", + "RETRIEVE_FUNDING_PAYMENTS", +]; + +export const getFundingRatesSimiles = [ + "VIEW_FUNDING_RATES", + "GET_FUNDING_RATES", + "CHECK_FUNDING_RATES", + "FETCH_FUNDING_RATES", + "READ_FUNDING_RATES", + "DISPLAY_FUNDING_RATES", + "SHOW_FUNDING_RATES", + "LIST_FUNDING_RATES", + "RETRIEVE_FUNDING_RATES", +]; + +// Subaccounts +export const getSubaccountTradeNonceSimiles = [ + "VIEW_TRADE_NONCE", + "GET_TRADE_NONCE", + "CHECK_TRADE_NONCE", + "FETCH_TRADE_NONCE", + "READ_TRADE_NONCE", + "DISPLAY_TRADE_NONCE", + "SHOW_TRADE_NONCE", + "LIST_TRADE_NONCE", + "RETRIEVE_TRADE_NONCE", +]; + +export const getSubaccountsListSimiles = [ + "VIEW_SUBACCOUNT_LIST", + "GET_SUBACCOUNT_LIST", + "CHECK_SUBACCOUNT_LIST", + "FETCH_SUBACCOUNT_LIST", + "READ_SUBACCOUNT_LIST", + "DISPLAY_SUBACCOUNT_LIST", + "SHOW_SUBACCOUNT_LIST", + "LIST_SUBACCOUNT_LIST", + "RETRIEVE_SUBACCOUNT_LIST", +]; + +export const getSubaccountBalancesListSimiles = [ + "VIEW_SUBACCOUNT_BALANCES", + "GET_SUBACCOUNT_BALANCES", + "CHECK_SUBACCOUNT_BALANCES", + "FETCH_SUBACCOUNT_BALANCES", + "READ_SUBACCOUNT_BALANCES", + "DISPLAY_SUBACCOUNT_BALANCES", + "SHOW_SUBACCOUNT_BALANCES", + "LIST_SUBACCOUNT_BALANCES", + "RETRIEVE_SUBACCOUNT_BALANCES", +]; + +export const getSubaccountHistorySimiles = [ + "VIEW_SUBACCOUNT_HISTORY", + "GET_SUBACCOUNT_HISTORY", + "CHECK_SUBACCOUNT_HISTORY", + "FETCH_SUBACCOUNT_HISTORY", + "READ_SUBACCOUNT_HISTORY", + "DISPLAY_SUBACCOUNT_HISTORY", + "SHOW_SUBACCOUNT_HISTORY", + "LIST_SUBACCOUNT_HISTORY", + "RETRIEVE_SUBACCOUNT_HISTORY", +]; + +export const getSubaccountOrderSummarySimiles = [ + "VIEW_ORDER_SUMMARY", + "GET_ORDER_SUMMARY", + "CHECK_ORDER_SUMMARY", + "FETCH_ORDER_SUMMARY", + "READ_ORDER_SUMMARY", + "DISPLAY_ORDER_SUMMARY", + "SHOW_ORDER_SUMMARY", + "LIST_ORDER_SUMMARY", + "RETRIEVE_ORDER_SUMMARY", +]; + +export const getOrderStatesSimiles = [ + "VIEW_ORDER_STATE", + "GET_ORDER_STATE", + "CHECK_ORDER_STATE", + "FETCH_ORDER_STATE", + "READ_ORDER_STATE", + "DISPLAY_ORDER_STATE", + "SHOW_ORDER_STATE", + "LIST_ORDER_STATE", + "RETRIEVE_ORDER_STATE", +]; + +export const getIsOptedOutOfRewardsSimiles = [ + "GET_IS_OPTED_OUT_OF_REWARDS", + "VIEW_IS_OPTED_OUT_OF_REWARDS", + "CHECK_IS_OPTED_OUT_OF_REWARDS", + "FETCH_IS_OPTED_OUT_OF_REWARDS", + "READ_IS_OPTED_OUT_OF_REWARDS", + "DISPLAY_IS_OPTED_OUT_OF_REWARDS", + "SHOW_IS_OPTED_OUT_OF_REWARDS", + "LIST_IS_OPTED_OUT_OF_REWARDS", +]; + +// Portfolio +export const getAccountPortfolioSimiles = [ + "VIEW_ACCOUNT_PORTFOLIO", + "GET_ACCOUNT_PORTFOLIO", + "CHECK_ACCOUNT_PORTFOLIO", + "FETCH_ACCOUNT_PORTFOLIO", + "READ_ACCOUNT_PORTFOLIO", + "DISPLAY_ACCOUNT_PORTFOLIO", + "SHOW_ACCOUNT_PORTFOLIO", + "LIST_ACCOUNT_PORTFOLIO", + "RETRIEVE_ACCOUNT_PORTFOLIO", +]; + +export const getAccountPortfolioBalancesSimiles = [ + "VIEW_PORTFOLIO_BALANCES", + "GET_PORTFOLIO_BALANCES", + "CHECK_PORTFOLIO_BALANCES", + "FETCH_PORTFOLIO_BALANCES", + "READ_PORTFOLIO_BALANCES", + "DISPLAY_PORTFOLIO_BALANCES", + "SHOW_PORTFOLIO_BALANCES", + "LIST_PORTFOLIO_BALANCES", + "RETRIEVE_PORTFOLIO_BALANCES", +]; + +// Historical Data +export const getHistoricalBalanceSimiles = [ + "VIEW_HISTORICAL_BALANCE", + "GET_HISTORICAL_BALANCE", + "CHECK_HISTORICAL_BALANCE", + "FETCH_HISTORICAL_BALANCE", + "READ_HISTORICAL_BALANCE", + "DISPLAY_HISTORICAL_BALANCE", + "SHOW_HISTORICAL_BALANCE", + "LIST_HISTORICAL_BALANCE", + "RETRIEVE_HISTORICAL_BALANCE", +]; + +export const getHistoricalRpnlSimiles = [ + "VIEW_HISTORICAL_RPNL", + "GET_HISTORICAL_RPNL", + "CHECK_HISTORICAL_RPNL", + "FETCH_HISTORICAL_RPNL", + "READ_HISTORICAL_RPNL", + "DISPLAY_HISTORICAL_RPNL", + "SHOW_HISTORICAL_RPNL", + "LIST_HISTORICAL_RPNL", + "RETRIEVE_HISTORICAL_RPNL", +]; +// Leaderboard +export const getPnlLeaderboardSimiles = [ + "VIEW_PNL_LEADERBOARD", + "GET_PNL_LEADERBOARD", + "CHECK_PNL_LEADERBOARD", + "FETCH_PNL_LEADERBOARD", + "READ_PNL_LEADERBOARD", + "DISPLAY_PNL_LEADERBOARD", + "SHOW_PNL_LEADERBOARD", + "LIST_PNL_LEADERBOARD", + "RETRIEVE_PNL_LEADERBOARD", +]; + +export const getVolLeaderboardSimiles = [ + "VIEW_VOLUME_LEADERBOARD", + "GET_VOLUME_LEADERBOARD", + "CHECK_VOLUME_LEADERBOARD", + "FETCH_VOLUME_LEADERBOARD", + "READ_VOLUME_LEADERBOARD", + "DISPLAY_VOLUME_LEADERBOARD", + "SHOW_VOLUME_LEADERBOARD", + "LIST_VOLUME_LEADERBOARD", + "RETRIEVE_VOLUME_LEADERBOARD", +]; + +// Message Actions - Order Management +export const msgBatchCancelBinaryOptionsOrdersSimiles = [ + "BATCH_CANCEL_BINARY_OPTIONS_ORDERS", + "BATCH_REMOVE_BINARY_OPTIONS_ORDERS", + "BATCH_DELETE_BINARY_OPTIONS_ORDERS", + "BATCH_STOP_BINARY_OPTIONS_ORDERS", + "BATCH_END_BINARY_OPTIONS_ORDERS", + "BATCH_CLEAR_BINARY_OPTIONS_ORDERS", + "BATCH_TERMINATE_BINARY_OPTIONS_ORDERS", + "BATCH_HALT_BINARY_OPTIONS_ORDERS", + "BATCH_CLOSE_BINARY_OPTIONS_ORDERS", +]; + +export const msgBatchCancelDerivativeOrdersSimiles = [ + "BATCH_CANCEL_DERIVATIVE_ORDERS", + "BATCH_REMOVE_DERIVATIVE_ORDERS", + "BATCH_DELETE_DERIVATIVE_ORDERS", + "BATCH_STOP_DERIVATIVE_ORDERS", + "BATCH_END_DERIVATIVE_ORDERS", + "BATCH_CLEAR_DERIVATIVE_ORDERS", + "BATCH_TERMINATE_DERIVATIVE_ORDERS", + "BATCH_HALT_DERIVATIVE_ORDERS", + "BATCH_CLOSE_DERIVATIVE_ORDERS", +]; + +export const msgBatchCancelSpotOrdersSimiles = [ + "BATCH_CANCEL_SPOT_ORDERS", + "BATCH_REMOVE_SPOT_ORDERS", + "BATCH_DELETE_SPOT_ORDERS", + "BATCH_STOP_SPOT_ORDERS", + "BATCH_END_SPOT_ORDERS", + "BATCH_CLEAR_SPOT_ORDERS", + "BATCH_TERMINATE_SPOT_ORDERS", + "BATCH_HALT_SPOT_ORDERS", + "BATCH_CLOSE_SPOT_ORDERS", +]; + +// Message Actions - Creating Orders +export const msgCreateBinaryOptionsLimitOrderSimiles = [ + "CREATE_BINARY_OPTIONS_LIMIT_ORDERS", + "PLACE_BINARY_OPTIONS_LIMIT_ORDERS", + "SUBMIT_BINARY_OPTIONS_LIMIT_ORDERS", + "START_BINARY_OPTIONS_LIMIT_ORDERS", + "OPEN_BINARY_OPTIONS_LIMIT_ORDERS", + "SET_BINARY_OPTIONS_LIMIT_ORDERS", + "MAKE_BINARY_OPTIONS_LIMIT_ORDERS", + "INITIALIZE_BINARY_OPTIONS_LIMIT_ORDERS", + "BEGIN_BINARY_OPTIONS_LIMIT_ORDERS", +]; + +export const msgCreateBinaryOptionsMarketOrderSimiles = [ + "CREATE_BINARY_OPTIONS_ORDERS", + "PLACE_BINARY_OPTIONS_ORDERS", + "SUBMIT_BINARY_OPTIONS_ORDERS", + "START_BINARY_OPTIONS_ORDERS", + "OPEN_BINARY_OPTIONS_ORDERS", + "SET_BINARY_OPTIONS_ORDERS", + "MAKE_BINARY_OPTIONS_ORDERS", + "INITIALIZE_BINARY_OPTIONS_ORDERS", + "BEGIN_BINARY_OPTIONS_ORDERS", +]; + +export const msgCreateDerivativeLimitOrderSimiles = [ + "CREATE_DERIVATIVE_LIMIT_ORDERS", + "PLACE_DERIVATIVE_LIMIT_ORDERS", + "SUBMIT_DERIVATIVE_LIMIT_ORDERS", + "START_DERIVATIVE_LIMIT_ORDERS", + "OPEN_DERIVATIVE_LIMIT_ORDERS", + "SET_DERIVATIVE_LIMIT_ORDERS", + "MAKE_DERIVATIVE_LIMIT_ORDERS", + "INITIALIZE_DERIVATIVE_LIMIT_ORDERS", + "BEGIN_DERIVATIVE_LIMIT_ORDERS", +]; + +export const msgCreateDerivativeMarketOrderSimiles = [ + "CREATE_DERIVATIVE_MARKET_ORDERS", + "PLACE_DERIVATIVE_MARKET_ORDERS", + "SUBMIT_DERIVATIVE_MARKET_ORDERS", + "START_DERIVATIVE_MARKET_ORDERS", + "OPEN_DERIVATIVE_MARKET_ORDERS", + "SET_DERIVATIVE_MARKET_ORDERS", + "MAKE_DERIVATIVE_MARKET_ORDERS", + "INITIALIZE_DERIVATIVE_MARKET_ORDERS", + "BEGIN_DERIVATIVE_MARKET_ORDERS", +]; + +export const msgCreateSpotLimitOrderSimiles = [ + "CREATE_SPOT_LIMIT_ORDERS", + "PLACE_SPOT_LIMIT_ORDERS", + "SUBMIT_SPOT_LIMIT_ORDERS", + "START_SPOT_LIMIT_ORDERS", + "OPEN_SPOT_LIMIT_ORDERS", + "SET_SPOT_LIMIT_ORDERS", + "MAKE_SPOT_LIMIT_ORDERS", + "INITIALIZE_SPOT_LIMIT_ORDERS", + "BEGIN_SPOT_LIMIT_ORDERS", +]; + +export const msgCreateSpotMarketOrderSimiles = [ + "CREATE_SPOT_MARKET_ORDERS", + "PLACE_SPOT_MARKET_ORDERS", + "SUBMIT_SPOT_MARKET_ORDERS", + "START_SPOT_MARKET_ORDERS", + "OPEN_SPOT_MARKET_ORDERS", + "SET_SPOT_MARKET_ORDERS", + "MAKE_SPOT_MARKET_ORDERS", + "INITIALIZE_SPOT_MARKET_ORDERS", + "BEGIN_SPOT_MARKET_ORDERS", +]; +// Deposit and Withdrawal Actions +export const msgDepositSimiles = [ + "CREATE_EXCHANGE_DEPOSIT", + "MAKE_EXCHANGE_DEPOSIT", + "SUBMIT_EXCHANGE_DEPOSIT", + "START_EXCHANGE_DEPOSIT", + "OPEN_EXCHANGE_DEPOSIT", + "SET_EXCHANGE_DEPOSIT", + "PROCESS_EXCHANGE_DEPOSIT", + "INITIALIZE_EXCHANGE_DEPOSIT", + "BEGIN_EXCHANGE_DEPOSIT", +]; + +export const msgWithdrawSimiles = [ + "CREATE_EXCHANGE_WITHDRAWAL", + "MAKE_EXCHANGE_WITHDRAWAL", + "SUBMIT_EXCHANGE_WITHDRAWAL", + "START_EXCHANGE_WITHDRAWAL", + "OPEN_EXCHANGE_WITHDRAWAL", + "SET_EXCHANGE_WITHDRAWAL", + "PROCESS_EXCHANGE_WITHDRAWAL", + "INITIALIZE_EXCHANGE_WITHDRAWAL", + "BEGIN_EXCHANGE_WITHDRAWAL", +]; + +// Position Management Actions +export const msgIncreasePositionMarginSimiles = [ + "INCREASE_POSITION_MARGIN", + "ADD_POSITION_MARGIN", + "RAISE_POSITION_MARGIN", + "BOOST_POSITION_MARGIN", + "EXPAND_POSITION_MARGIN", + "EXTEND_POSITION_MARGIN", + "ENHANCE_POSITION_MARGIN", + "GROW_POSITION_MARGIN", + "LIFT_POSITION_MARGIN", +]; + +export const msgLiquidatePositionSimiles = [ + "LIQUIDATE_EXCHANGE_POSITION", + "END_EXCHANGE_POSITION", + "TERMINATE_EXCHANGE_POSITION", + "FINISH_EXCHANGE_POSITION", + "CLEAR_EXCHANGE_POSITION", + "COMPLETE_EXCHANGE_POSITION", + "RESOLVE_EXCHANGE_POSITION", + "SETTLE_EXCHANGE_POSITION", +]; + +// Administrative Actions +export const msgInstantSpotMarketLaunchSimiles = [ + "LAUNCH_SPOT_MARKET", + "START_SPOT_MARKET", + "CREATE_SPOT_MARKET", + "OPEN_SPOT_MARKET", + "INITIALIZE_SPOT_MARKET", + "BEGIN_SPOT_MARKET", + "DEPLOY_SPOT_MARKET", + "ESTABLISH_SPOT_MARKET", + "ACTIVATE_SPOT_MARKET", +]; + +export const msgReclaimLockedFundsSimiles = [ + "RECLAIM_LOCKED_FUNDS", + "RECOVER_LOCKED_FUNDS", + "RETRIEVE_LOCKED_FUNDS", + "RELEASE_LOCKED_FUNDS", + "RESTORE_LOCKED_FUNDS", + "RETURN_LOCKED_FUNDS", + "UNLOCK_LOCKED_FUNDS", + "FREE_LOCKED_FUNDS", + "COLLECT_LOCKED_FUNDS", +]; + +export const msgRewardsOptOutSimiles = [ + "DISABLE_EXCHANGE_REWARDS", + "STOP_EXCHANGE_REWARDS", + "EXIT_EXCHANGE_REWARDS", + "LEAVE_EXCHANGE_REWARDS", + "QUIT_EXCHANGE_REWARDS", + "END_EXCHANGE_REWARDS", + "WITHDRAW_EXCHANGE_REWARDS", + "ABANDON_EXCHANGE_REWARDS", + "DECLINE_EXCHANGE_REWARDS", +]; + +export const msgSignDataSimiles = [ + "SIGN_EXCHANGE_DATA", + "AUTHORIZE_EXCHANGE_DATA", + "APPROVE_EXCHANGE_DATA", + "VALIDATE_EXCHANGE_DATA", + "CONFIRM_EXCHANGE_DATA", + "VERIFY_EXCHANGE_DATA", + "ENDORSE_EXCHANGE_DATA", + "CERTIFY_EXCHANGE_DATA", + "AUTHENTICATE_EXCHANGE_DATA", +]; + +export const msgExternalTransferSimiles = [ + "CREATE_EXTERNAL_TRANSFER", + "MAKE_EXTERNAL_TRANSFER", + "SUBMIT_EXTERNAL_TRANSFER", + "START_EXTERNAL_TRANSFER", + "PROCESS_EXTERNAL_TRANSFER", + "INITIATE_EXTERNAL_TRANSFER", + "BEGIN_EXTERNAL_TRANSFER", + "EXECUTE_EXTERNAL_TRANSFER", + "PERFORM_EXTERNAL_TRANSFER", +]; + +export const msgAdminUpdateBinaryOptionsMarketSimiles = [ + "UPDATE_BINARY_OPTIONS", + "MODIFY_BINARY_OPTIONS", + "CHANGE_BINARY_OPTIONS", + "ADJUST_BINARY_OPTIONS", + "EDIT_BINARY_OPTIONS", + "REVISE_BINARY_OPTIONS", + "ALTER_BINARY_OPTIONS", + "AMEND_BINARY_OPTIONS", + "CONFIGURE_BINARY_OPTIONS", +]; +export const getRewardsSimiles = [ + "VIEW_EXCHANGE_REWARDS", + "GET_EXCHANGE_REWARDS", + "CHECK_EXCHANGE_REWARDS", + "FETCH_EXCHANGE_REWARDS", + "READ_EXCHANGE_REWARDS", + "DISPLAY_EXCHANGE_REWARDS", + "SHOW_EXCHANGE_REWARDS", + "LIST_EXCHANGE_REWARDS", + "RETRIEVE_EXCHANGE_REWARDS", +]; + +export const getAtomicSwapHistorySimiles = [ + "VIEW_ATOMIC_SWAPS", + "GET_ATOMIC_SWAPS", + "CHECK_ATOMIC_SWAPS", + "FETCH_ATOMIC_SWAPS", + "READ_ATOMIC_SWAPS", + "DISPLAY_ATOMIC_SWAPS", + "SHOW_ATOMIC_SWAPS", + "LIST_ATOMIC_SWAPS", + "RETRIEVE_ATOMIC_SWAPS", +]; + +export const getGridStrategiesSimiles = [ + "VIEW_GRID_STRATEGIES", + "GET_GRID_STRATEGIES", + "CHECK_GRID_STRATEGIES", + "FETCH_GRID_STRATEGIES", + "READ_GRID_STRATEGIES", + "DISPLAY_GRID_STRATEGIES", + "SHOW_GRID_STRATEGIES", + "LIST_GRID_STRATEGIES", + "RETRIEVE_GRID_STRATEGIES", +]; + +export const getHistoricalVolumesSimiles = [ + "VIEW_HISTORICAL_VOLUMES", + "GET_HISTORICAL_VOLUMES", + "CHECK_HISTORICAL_VOLUMES", + "FETCH_HISTORICAL_VOLUMES", + "READ_HISTORICAL_VOLUMES", + "DISPLAY_HISTORICAL_VOLUMES", + "SHOW_HISTORICAL_VOLUMES", + "LIST_HISTORICAL_VOLUMES", + "RETRIEVE_HISTORICAL_VOLUMES", +]; + +export const getPnlLeaderboardFixedResolutionSimiles = [ + "VIEW_FIXED_RESOLUTION_LEADERBOARD", + "GET_FIXED_RESOLUTION_LEADERBOARD", + "CHECK_FIXED_RESOLUTION_LEADERBOARD", + "FETCH_FIXED_RESOLUTION_LEADERBOARD", + "READ_FIXED_RESOLUTION_LEADERBOARD", + "DISPLAY_FIXED_RESOLUTION_LEADERBOARD", + "SHOW_FIXED_RESOLUTION_LEADERBOARD", + "LIST_FIXED_RESOLUTION_LEADERBOARD", + "RETRIEVE_FIXED_RESOLUTION_LEADERBOARD", +]; + +export const getVolLeaderboardFixedResolutionSimiles = [ + "VIEW_VOLUME_FIXED", + "GET_VOLUME_FIXED", + "CHECK_VOLUME_FIXED", + "FETCH_VOLUME_FIXED", + "READ_VOLUME_FIXED", + "DISPLAY_VOLUME_FIXED", + "SHOW_VOLUME_FIXED", + "LIST_VOLUME_FIXED", + "RETRIEVE_VOLUME_FIXED", +]; + +export const getDenomHoldersSimiles = [ + "VIEW_DENOM_HOLDERS", + "GET_DENOM_HOLDERS", + "CHECK_DENOM_HOLDERS", + "FETCH_DENOM_HOLDERS", + "READ_DENOM_HOLDERS", + "DISPLAY_DENOM_HOLDERS", + "SHOW_DENOM_HOLDERS", + "LIST_DENOM_HOLDERS", + "RETRIEVE_DENOM_HOLDERS", +]; + +export const msgBatchUpdateOrdersSimiles = [ + "UPDATE_ORDER_BATCH", + "MODIFY_ORDER_BATCH", + "CHANGE_ORDER_BATCH", + "ADJUST_ORDER_BATCH", + "EDIT_ORDER_BATCH", + "REVISE_ORDER_BATCH", + "ALTER_ORDER_BATCH", + "AMEND_ORDER_BATCH", + "CONFIGURE_ORDER_BATCH", +]; + +export const msgCancelBinaryOptionsOrderSimiles = [ + "CANCEL_BINARY_OPTIONS_ORDER", + "REMOVE_BINARY_OPTIONS_ORDER", + "DELETE_BINARY_OPTIONS_ORDER", + "STOP_BINARY_OPTIONS_ORDER", + "END_BINARY_OPTIONS_ORDER", + "CLEAR_BINARY_OPTIONS_ORDER", + "TERMINATE_BINARY_OPTIONS_ORDER", + "HALT_BINARY_OPTIONS_ORDER", + "CLOSE_BINARY_OPTIONS_ORDER", +]; + +export const msgCancelDerivativeOrderSimiles = [ + "CANCEL_DERIVATIVE_ORDER", + "REMOVE_DERIVATIVE_ORDER", + "DELETE_DERIVATIVE_ORDER", + "STOP_DERIVATIVE_ORDER", + "END_DERIVATIVE_ORDER", + "CLEAR_DERIVATIVE_ORDER", + "TERMINATE_DERIVATIVE_ORDER", + "HALT_DERIVATIVE_ORDER", + "CLOSE_DERIVATIVE_ORDER", +]; + +export const msgCancelSpotOrderSimiles = [ + "CANCEL_SPOT_ORDER", + "REMOVE_SPOT_ORDER", + "DELETE_SPOT_ORDER", + "STOP_SPOT_ORDER", + "END_SPOT_ORDER", + "CLEAR_SPOT_ORDER", + "TERMINATE_SPOT_ORDER", + "HALT_SPOT_ORDER", + "CLOSE_SPOT_ORDER", +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/similes/explorer.ts b/packages/plugin-injective/injective-sdk-client-ts/src/similes/explorer.ts new file mode 100644 index 00000000000..c1b8b4d3a95 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/similes/explorer.ts @@ -0,0 +1,131 @@ +export const getTxByHashSimiles = [ + "VIEW_TRANSACTION_BY_HASH_BY_HASH", + "GET_TRANSACTION_BY_HASH", + "CHECK_TRANSACTION_BY_HASH", + "FETCH_TRANSACTION_BY_HASH", + "READ_TRANSACTION_BY_HASH", + "DISPLAY_TRANSACTION_BY_HASH", + "SHOW_TRANSACTION_BY_HASH", + "LIST_TRANSACTION_BY_HASH", + "RETRIEVE_TRANSACTION_BY_HASH", +]; + +export const getAccountTxSimiles = [ + "VIEW_ACCOUNT_TRANSACTIONS", + "GET_ACCOUNT_TRANSACTIONS", + "CHECK_ACCOUNT_TRANSACTIONS", + "FETCH_ACCOUNT_TRANSACTIONS", + "READ_ACCOUNT_TRANSACTIONS", + "DISPLAY_ACCOUNT_TRANSACTIONS", + "SHOW_ACCOUNT_TRANSACTIONS", + "LIST_ACCOUNT_TRANSACTIONS", + "RETRIEVE_ACCOUNT_TRANSACTIONS", +]; + +export const getExplorerValidatorSimiles = [ + "VIEW_EXPLORER_EXPLORER_VALIDATOR", + "GET_EXPLORER_EXPLORER_VALIDATOR", + "CHECK_EXPLORER_VALIDATOR", + "FETCH_EXPLORER_VALIDATOR", + "READ_EXPLORER_VALIDATOR", + "DISPLAY_EXPLORER_VALIDATOR", + "SHOW_EXPLORER_VALIDATOR", + "LIST_EXPLORER_VALIDATOR", + "RETRIEVE_EXPLORER_VALIDATOR", +]; + +export const getExplorerValidatorUptimeSimiles = [ + "VIEW_EXPLORER_VALIDATOR_UPTIME", + "GET_EXPLORER_VALIDATOR_UPTIME", + "CHECK_EXPLORER_VALIDATOR_UPTIME", + "FETCH_EXPLORER_VALIDATOR_UPTIME", + "READ_EXPLORER_VALIDATOR_UPTIME", + "DISPLAY_EXPLORER_VALIDATOR_UPTIME", + "SHOW_EXPLORER_VALIDATOR_UPTIME", + "LIST_EXPLORER_VALIDATOR_UPTIME", + "RETRIEVE_EXPLORER_VALIDATOR_UPTIME", +]; + +export const getPeggyDepositTxsSimiles = [ + "VIEW_PEGGY_DEPOSITS", + "GET_PEGGY_DEPOSITS", + "CHECK_PEGGY_DEPOSITS", + "FETCH_PEGGY_DEPOSITS", + "READ_PEGGY_DEPOSITS", + "DISPLAY_PEGGY_DEPOSITS", + "SHOW_PEGGY_DEPOSITS", + "LIST_PEGGY_DEPOSITS", + "RETRIEVE_PEGGY_DEPOSITS", +]; + +export const getPeggyWithdrawalTxsSimiles = [ + "VIEW_PEGGY_WITHDRAWALS", + "GET_PEGGY_WITHDRAWALS", + "CHECK_PEGGY_WITHDRAWALS", + "FETCH_PEGGY_WITHDRAWALS", + "READ_PEGGY_WITHDRAWALS", + "DISPLAY_PEGGY_WITHDRAWALS", + "SHOW_PEGGY_WITHDRAWALS", + "LIST_PEGGY_WITHDRAWALS", + "RETRIEVE_PEGGY_WITHDRAWALS", +]; + +export const getBlocksSimiles = [ + "VIEW_BLOCKS", + "GET_BLOCKS", + "CHECK_BLOCKS", + "FETCH_BLOCKS", + "READ_BLOCKS", + "DISPLAY_BLOCKS", + "SHOW_BLOCKS", + "LIST_BLOCKS", + "RETRIEVE_BLOCKS", +]; + +export const getBlockSimiles = [ + "VIEW_BLOCK", + "GET_BLOCK", + "CHECK_BLOCK", + "FETCH_BLOCK", + "READ_BLOCK", + "DISPLAY_BLOCK", + "SHOW_BLOCK", + "LIST_BLOCK", + "RETRIEVE_BLOCK", +]; + +export const getTxsSimiles = [ + "VIEW_TRANSACTIONS", + "GET_TRANSACTIONS", + "CHECK_TRANSACTIONS", + "FETCH_TRANSACTIONS", + "READ_TRANSACTIONS", + "DISPLAY_TRANSACTIONS", + "SHOW_TRANSACTIONS", + "LIST_TRANSACTIONS", + "RETRIEVE_TRANSACTIONS", +]; + +export const getIBCTransferTxsSimiles = [ + "VIEW_IBC_TRANSFERS", + "GET_IBC_TRANSFERS", + "CHECK_IBC_TRANSFERS", + "FETCH_IBC_TRANSFERS", + "READ_IBC_TRANSFERS", + "DISPLAY_IBC_TRANSFERS", + "SHOW_IBC_TRANSFERS", + "LIST_IBC_TRANSFERS", + "RETRIEVE_IBC_TRANSFERS", +]; + +export const getExplorerStatsSimiles = [ + "VIEW_EXPLORER_STATS", + "GET_EXPLORER_STATS", + "CHECK_EXPLORER_STATS", + "FETCH_EXPLORER_STATS", + "READ_EXPLORER_STATS", + "DISPLAY_EXPLORER_STATS", + "SHOW_EXPLORER_STATS", + "LIST_EXPLORER_STATS", + "RETRIEVE_EXPLORER_STATS", +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/similes/gov.ts b/packages/plugin-injective/injective-sdk-client-ts/src/similes/gov.ts new file mode 100644 index 00000000000..0550865a444 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/similes/gov.ts @@ -0,0 +1,167 @@ +export const getGovernanceModuleParamsSimiles = [ + "VIEW_GOVERNANCE_PARAMS", + "GET_GOVERNANCE_PARAMS", + "CHECK_GOVERNANCE_PARAMS", + "FETCH_GOVERNANCE_PARAMS", + "READ_GOVERNANCE_PARAMS", + "DISPLAY_GOVERNANCE_PARAMS", + "SHOW_GOVERNANCE_PARAMS", + "LIST_GOVERNANCE_PARAMS", + "RETRIEVE_GOVERNANCE_PARAMS", +]; + +export const getProposalsSimiles = [ + "VIEW_PROPOSALS", + "GET_PROPOSALS", + "CHECK_PROPOSALS", + "FETCH_PROPOSALS", + "READ_PROPOSALS", + "DISPLAY_PROPOSALS", + "SHOW_PROPOSALS", + "LIST_PROPOSALS", + "RETRIEVE_PROPOSALS", +]; + +export const getProposalSimiles = [ + "VIEW_PROPOSAL", + "GET_PROPOSAL", + "CHECK_PROPOSAL", + "FETCH_PROPOSAL", + "READ_PROPOSAL", + "DISPLAY_PROPOSAL", + "SHOW_PROPOSAL", + "LIST_PROPOSAL", + "RETRIEVE_PROPOSAL", +]; + +export const getProposalDepositsSimiles = [ + "VIEW_PROPOSAL_DEPOSITS", + "GET_PROPOSAL_DEPOSITS", + "CHECK_PROPOSAL_DEPOSITS", + "FETCH_PROPOSAL_DEPOSITS", + "READ_PROPOSAL_DEPOSITS", + "DISPLAY_PROPOSAL_DEPOSITS", + "SHOW_PROPOSAL_DEPOSITS", + "LIST_PROPOSAL_DEPOSITS", + "RETRIEVE_PROPOSAL_DEPOSITS", +]; + +export const getProposalVotesSimiles = [ + "VIEW_PROPOSAL_VOTES", + "GET_PROPOSAL_VOTES", + "CHECK_PROPOSAL_VOTES", + "FETCH_PROPOSAL_VOTES", + "READ_PROPOSAL_VOTES", + "DISPLAY_PROPOSAL_VOTES", + "SHOW_PROPOSAL_VOTES", + "LIST_PROPOSAL_VOTES", + "RETRIEVE_PROPOSAL_VOTES", +]; + +export const getProposalTallySimiles = [ + "VIEW_PROPOSAL_TALLY", + "GET_PROPOSAL_TALLY", + "CHECK_PROPOSAL_TALLY", + "FETCH_PROPOSAL_TALLY", + "READ_PROPOSAL_TALLY", + "DISPLAY_PROPOSAL_TALLY", + "SHOW_PROPOSAL_TALLY", + "LIST_PROPOSAL_TALLY", + "RETRIEVE_PROPOSAL_TALLY", +]; + +export const msgSubmitProposalExpiryFuturesMarketLaunchSimiles = [ + "SUBMIT_EXPIRY_FUTURES_MARKET_PROPOSAL", + "CREATE_EXPIRY_FUTURES_MARKET_PROPOSAL", + "INITIALIZE_EXPIRY_FUTURES_MARKET_PROPOSAL", + "START_EXPIRY_FUTURES_MARKET_PROPOSAL", + "LAUNCH_EXPIRY_FUTURES_MARKET_PROPOSAL", + "PROPOSE_EXPIRY_FUTURES_MARKET_MARKET", + "BEGIN_EXPIRY_FUTURES_MARKET_PROPOSAL", + "ESTABLISH_EXPIRY_FUTURES_MARKET_PROPOSAL", + "SETUP_EXPIRY_FUTURES_MARKET_PROPOSAL", +]; + +export const msgSubmitProposalSpotMarketLaunchSimiles = [ + "SUBMIT_SPOT_MARKET_PROPOSAL", + "CREATE_SPOT_MARKET_PROPOSAL", + "INITIALIZE_SPOT_MARKET_PROPOSAL", + "START_SPOT_MARKET_PROPOSAL", + "LAUNCH_SPOT_MARKET_PROPOSAL", + "PROPOSE_SPOT_MARKET", + "BEGIN_SPOT_MARKET_PROPOSAL", + "ESTABLISH_SPOT_MARKET_PROPOSAL", + "SETUP_SPOT_MARKET_PROPOSAL", +]; + +export const msgSubmitProposalPerpetualMarketLaunchSimiles = [ + "SUBMIT_PERPETUAL_MARKET_PROPOSAL", + "CREATE_PERPETUAL_MARKET_PROPOSAL", + "INITIALIZE_PERPETUAL_MARKET_PROPOSAL", + "START_PERPETUAL_MARKET_PROPOSAL", + "LAUNCH_PERPETUAL_MARKET_PROPOSAL", + "PROPOSE_PERPETUAL_MARKET", + "BEGIN_PERPETUAL_MARKET_PROPOSAL", + "ESTABLISH_PERPETUAL_MARKET_PROPOSAL", + "SETUP_PERPETUAL_MARKET_PROPOSAL", +]; + +export const msgVoteSimiles = [ + "SUBMIT_VOTE", + "CAST_VOTE", + "REGISTER_VOTE", + "RECORD_VOTE", + "ENTER_VOTE", + "PLACE_VOTE", + "LOG_VOTE", + "SEND_VOTE", + "MAKE_VOTE", +]; + +export const msgSubmitTextProposalSimiles = [ + "SUBMIT_TEXT_PROPOSAL", + "CREATE_TEXT_PROPOSAL", + "INITIALIZE_TEXT_PROPOSAL", + "START_TEXT_PROPOSAL", + "LAUNCH_TEXT_PROPOSAL", + "PROPOSE_TEXT_CHANGE", + "BEGIN_TEXT_PROPOSAL", + "ESTABLISH_TEXT_PROPOSAL", + "SETUP_TEXT_PROPOSAL", +]; + +export const msgSubmitProposalSpotMarketParamUpdateSimiles = [ + "SUBMIT_SPOT_MARKET_PARAM_UPDATE", + "CREATE_SPOT_MARKET_PARAM_UPDATE", + "INITIALIZE_SPOT_MARKET_PARAM_UPDATE", + "START_SPOT_MARKET_PARAM_UPDATE", + "LAUNCH_SPOT_MARKET_PARAM_UPDATE", + "PROPOSE_SPOT_MARKET_PARAM_CHANGE", + "BEGIN_SPOT_MARKET_PARAM_UPDATE", + "ESTABLISH_SPOT_MARKET_PARAM_UPDATE", + "SETUP_SPOT_MARKET_PARAM_UPDATE", +]; + +export const msgSubmitGenericProposalSimiles = [ + "SUBMIT_GENERIC_PROPOSAL", + "CREATE_GENERIC_PROPOSAL", + "INITIALIZE_GENERIC_PROPOSAL", + "START_GENERIC_PROPOSAL", + "LAUNCH_GENERIC_PROPOSAL", + "PROPOSE_GENERIC_CHANGE", + "BEGIN_GENERIC_PROPOSAL", + "ESTABLISH_GENERIC_PROPOSAL", + "SETUP_GENERIC_PROPOSAL", +]; + +export const msgGovDepositSimiles = [ + "SUBMIT_PROPOSAL_DEPOSIT", + "ADD_PROPOSAL_DEPOSIT", + "MAKE_PROPOSAL_DEPOSIT", + "SEND_PROPOSAL_DEPOSIT", + "PLACE_PROPOSAL_DEPOSIT", + "TRANSFER_PROPOSAL_DEPOSIT", + "DEPOSIT_TO_PROPOSAL", + "FUND_PROPOSAL", + "CONTRIBUTE_TO_PROPOSAL", +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/similes/ibc.ts b/packages/plugin-injective/injective-sdk-client-ts/src/similes/ibc.ts new file mode 100644 index 00000000000..1fba527763b --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/similes/ibc.ts @@ -0,0 +1,35 @@ +export const getDenomTraceSimiles = [ + "VIEW_DENOM_TRACE", + "GET_DENOM_TRACE", + "CHECK_DENOM_TRACE", + "FETCH_DENOM_TRACE", + "READ_DENOM_TRACE", + "DISPLAY_DENOM_TRACE", + "SHOW_DENOM_TRACE", + "LIST_DENOM_TRACE", + "RETRIEVE_DENOM_TRACE", +]; + +export const getDenomsTraceSimiles = [ + "VIEW_DENOM_TRACES", + "GET_DENOM_TRACES", + "CHECK_DENOM_TRACES", + "FETCH_DENOM_TRACES", + "READ_DENOM_TRACES", + "DISPLAY_DENOM_TRACES", + "SHOW_DENOM_TRACES", + "LIST_DENOM_TRACES", + "RETRIEVE_DENOM_TRACES", +]; + +export const msgIBCTransferSimiles = [ + "SUBMIT_IBC_TRANSFER", + "EXECUTE_IBC_TRANSFER", + "PERFORM_IBC_TRANSFER", + "SEND_IBC_TOKENS", + "TRANSFER_IBC_TOKENS", + "INITIATE_IBC_TRANSFER", + "START_IBC_TRANSFER", + "CREATE_IBC_TRANSFER", + "PROCESS_IBC_TRANSFER", +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/similes/insurance.ts b/packages/plugin-injective/injective-sdk-client-ts/src/similes/insurance.ts new file mode 100644 index 00000000000..2f2ac0c8090 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/similes/insurance.ts @@ -0,0 +1,95 @@ +export const getInsuranceModuleParamsSimiles = [ + "VIEW_INSURANCE_MODULE_PARAMS", + "GET_INSURANCE_MODULE_PARAMS", + "CHECK_INSURANCE_MODULE_PARAMS", + "FETCH_INSURANCE_MODULE_PARAMS", + "READ_INSURANCE_MODULE_PARAMS", + "DISPLAY_INSURANCE_MODULE_PARAMS", + "SHOW_INSURANCE_MODULE_PARAMS", + "LIST_INSURANCE_MODULE_PARAMS", + "RETRIEVE_INSURANCE_MODULE_PARAMS", +]; + +export const getInsuranceFundsSimiles = [ + "VIEW_INSURANCE_FUNDS", + "GET_INSURANCE_FUNDS", + "CHECK_INSURANCE_FUNDS", + "FETCH_INSURANCE_FUNDS", + "READ_INSURANCE_FUNDS", + "DISPLAY_INSURANCE_FUNDS", + "SHOW_INSURANCE_FUNDS", + "LIST_INSURANCE_FUNDS", + "RETRIEVE_INSURANCE_FUNDS", +]; + +export const getInsuranceFundSimiles = [ + "VIEW_INSURANCE_FUND", + "GET_INSURANCE_FUND", + "CHECK_INSURANCE_FUND", + "FETCH_INSURANCE_FUND", + "READ_INSURANCE_FUND", + "DISPLAY_INSURANCE_FUND", + "SHOW_INSURANCE_FUND", + "LIST_INSURANCE_FUND", + "RETRIEVE_INSURANCE_FUND", +]; + +export const getEstimatedRedemptionsSimiles = [ + "VIEW_ESTIMATED_REDEMPTIONS", + "GET_ESTIMATED_REDEMPTIONS", + "CHECK_ESTIMATED_REDEMPTIONS", + "FETCH_ESTIMATED_REDEMPTIONS", + "READ_ESTIMATED_REDEMPTIONS", + "DISPLAY_ESTIMATED_REDEMPTIONS", + "SHOW_ESTIMATED_REDEMPTIONS", + "LIST_ESTIMATED_REDEMPTIONS", + "RETRIEVE_ESTIMATED_REDEMPTIONS", +]; + +export const getPendingRedemptionsSimiles = [ + "VIEW_PENDING_REDEMPTIONS", + "GET_PENDING_REDEMPTIONS", + "CHECK_PENDING_REDEMPTIONS", + "FETCH_PENDING_REDEMPTIONS", + "READ_PENDING_REDEMPTIONS", + "DISPLAY_PENDING_REDEMPTIONS", + "SHOW_PENDING_REDEMPTIONS", + "LIST_PENDING_REDEMPTIONS", + "RETRIEVE_PENDING_REDEMPTIONS", +]; + +export const msgCreateInsuranceFundSimiles = [ + "CREATE_INSURANCE_FUND", + "ESTABLISH_INSURANCE_FUND", + "SETUP_INSURANCE_FUND", + "INITIALIZE_INSURANCE_FUND", + "START_INSURANCE_FUND", + "LAUNCH_INSURANCE_FUND", + "OPEN_INSURANCE_FUND", + "BEGIN_INSURANCE_FUND", + "INSTITUTE_INSURANCE_FUND", +]; + +export const msgRequestRedemptionSimiles = [ + "REQUEST_REDEMPTION", + "INITIATE_REDEMPTION", + "SUBMIT_REDEMPTION", + "START_REDEMPTION", + "PROCESS_REDEMPTION", + "CREATE_REDEMPTION", + "EXECUTE_REDEMPTION", + "BEGIN_REDEMPTION", + "PERFORM_REDEMPTION", +]; + +export const msgUnderwriteSimiles = [ + "UNDERWRITE_INSURANCE", + "BACK_INSURANCE", + "SUPPORT_INSURANCE", + "GUARANTEE_INSURANCE", + "SECURE_INSURANCE", + "SPONSOR_INSURANCE", + "FUND_INSURANCE", + "FINANCE_INSURANCE", + "PROVIDE_INSURANCE_BACKING", +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/similes/mint.ts b/packages/plugin-injective/injective-sdk-client-ts/src/similes/mint.ts new file mode 100644 index 00000000000..d5f12887b35 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/similes/mint.ts @@ -0,0 +1,35 @@ +export const getMintModuleParamsSimiles = [ + "VIEW_MINT_MODULE_PARAMS", + "GET_MINT_MODULE_PARAMS", + "CHECK_MINT_MODULE_PARAMS", + "FETCH_MINT_MODULE_PARAMS", + "READ_MINT_MODULE_PARAMS", + "DISPLAY_MINT_MODULE_PARAMS", + "SHOW_MINT_MODULE_PARAMS", + "LIST_MINT_MODULE_PARAMS", + "RETRIEVE_MINT_MODULE_PARAMS", +]; + +export const getInflationSimiles = [ + "VIEW_INFLATION_RATE", + "GET_INFLATION_RATE", + "CHECK_INFLATION_RATE", + "FETCH_INFLATION_RATE", + "READ_INFLATION_RATE", + "DISPLAY_INFLATION_RATE", + "SHOW_INFLATION_RATE", + "LIST_INFLATION_RATE", + "RETRIEVE_INFLATION_RATE", +]; + +export const getAnnualProvisionsSimiles = [ + "VIEW_ANNUAL_PROVISIONS", + "GET_ANNUAL_PROVISIONS", + "CHECK_ANNUAL_PROVISIONS", + "FETCH_ANNUAL_PROVISIONS", + "READ_ANNUAL_PROVISIONS", + "DISPLAY_ANNUAL_PROVISIONS", + "SHOW_ANNUAL_PROVISIONS", + "LIST_ANNUAL_PROVISIONS", + "RETRIEVE_ANNUAL_PROVISIONS", +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/similes/mito.ts b/packages/plugin-injective/injective-sdk-client-ts/src/similes/mito.ts new file mode 100644 index 00000000000..6f039389f89 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/similes/mito.ts @@ -0,0 +1,364 @@ +// Vault Related Similes +export const getVaultSimiles = [ + "VIEW_VAULT", + "GET_VAULT", + "CHECK_VAULT", + "FETCH_VAULT", + "READ_VAULT", + "DISPLAY_VAULT", + "SHOW_VAULT", + "LIST_VAULT", + "RETRIEVE_VAULT", +]; + +export const getVaultsSimiles = [ + "VIEW_VAULTS", + "GET_VAULTS", + "CHECK_VAULTS", + "FETCH_VAULTS", + "READ_VAULTS", + "DISPLAY_VAULTS", + "SHOW_VAULTS", + "LIST_VAULTS", + "RETRIEVE_VAULTS", +]; + +export const getVaultsByHolderAddressSimiles = [ + "VIEW_HOLDER_VAULTS", + "GET_HOLDER_VAULTS", + "CHECK_HOLDER_VAULTS", + "FETCH_HOLDER_VAULTS", + "READ_HOLDER_VAULTS", + "DISPLAY_HOLDER_VAULTS", + "SHOW_HOLDER_VAULTS", + "LIST_HOLDER_VAULTS", + "RETRIEVE_HOLDER_VAULTS", +]; + +// LP Token Related Similes +export const getLpTokenPriceChartSimiles = [ + "VIEW_LP_PRICE_CHART", + "GET_LP_PRICE_CHART", + "CHECK_LP_PRICE_CHART", + "FETCH_LP_PRICE_CHART", + "READ_LP_PRICE_CHART", + "DISPLAY_LP_PRICE_CHART", + "SHOW_LP_PRICE_CHART", + "LIST_LP_PRICE_CHART", + "RETRIEVE_LP_PRICE_CHART", +]; + +export const getLPHoldersSimiles = [ + "VIEW_LP_HOLDERS", + "GET_LP_HOLDERS", + "CHECK_LP_HOLDERS", + "FETCH_LP_HOLDERS", + "READ_LP_HOLDERS", + "DISPLAY_LP_HOLDERS", + "SHOW_LP_HOLDERS", + "LIST_LP_HOLDERS", + "RETRIEVE_LP_HOLDERS", +]; + +// TVL and Portfolio Related Similes +export const getTVLChartSimiles = [ + "VIEW_TVL_CHART", + "GET_TVL_CHART", + "CHECK_TVL_CHART", + "FETCH_TVL_CHART", + "READ_TVL_CHART", + "DISPLAY_TVL_CHART", + "SHOW_TVL_CHART", + "LIST_TVL_CHART", + "RETRIEVE_TVL_CHART", +]; + +export const getHolderPortfolioSimiles = [ + "VIEW_HOLDER_PORTFOLIO", + "GET_HOLDER_PORTFOLIO", + "CHECK_HOLDER_PORTFOLIO", + "FETCH_HOLDER_PORTFOLIO", + "READ_HOLDER_PORTFOLIO", + "DISPLAY_HOLDER_PORTFOLIO", + "SHOW_HOLDER_PORTFOLIO", + "LIST_HOLDER_PORTFOLIO", + "RETRIEVE_HOLDER_PORTFOLIO", +]; + +// MITO_LEADERBOARD Related Similes +export const getLeaderboardSimiles = [ + "VIEW_MITO_LEADERBOARD", + "GET_MITO_LEADERBOARD", + "CHECK_MITO_LEADERBOARD", + "FETCH_MITO_LEADERBOARD", + "READ_MITO_LEADERBOARD", + "DISPLAY_MITO_LEADERBOARD", + "SHOW_MITO_LEADERBOARD", + "LIST_MITO_LEADERBOARD", + "RETRIEVE_MITO_LEADERBOARD", +]; + +export const getLeaderboardEpochsSimiles = [ + "VIEW_MITO_LEADERBOARD_EPOCHS", + "GET_MITO_LEADERBOARD_EPOCHS", + "CHECK_MITO_LEADERBOARD_EPOCHS", + "FETCH_MITO_LEADERBOARD_EPOCHS", + "READ_MITO_LEADERBOARD_EPOCHS", + "DISPLAY_MITO_LEADERBOARD_EPOCHS", + "SHOW_MITO_LEADERBOARD_EPOCHS", + "LIST_MITO_LEADERBOARD_EPOCHS", + "RETRIEVE_MITO_LEADERBOARD_EPOCHS", +]; + +// Transfer Related Similes +export const getTransferHistorySimiles = [ + "VIEW_TRANSFER_HISTORY", + "GET_TRANSFER_HISTORY", + "CHECK_TRANSFER_HISTORY", + "FETCH_TRANSFER_HISTORY", + "READ_TRANSFER_HISTORY", + "DISPLAY_TRANSFER_HISTORY", + "SHOW_TRANSFER_HISTORY", + "LIST_TRANSFER_HISTORY", + "RETRIEVE_TRANSFER_HISTORY", +]; + +// Staking Related Similes +export const getStakingPoolsSimiles = [ + "VIEW_STAKING_POOLS", + "GET_STAKING_POOLS", + "CHECK_STAKING_POOLS", + "FETCH_STAKING_POOLS", + "READ_STAKING_POOLS", + "DISPLAY_STAKING_POOLS", + "SHOW_STAKING_POOLS", + "LIST_STAKING_POOLS", + "RETRIEVE_STAKING_POOLS", +]; + +export const getStakingHistorySimiles = [ + "VIEW_STAKING_HISTORY", + "GET_STAKING_HISTORY", + "CHECK_STAKING_HISTORY", + "FETCH_STAKING_HISTORY", + "READ_STAKING_HISTORY", + "DISPLAY_STAKING_HISTORY", + "SHOW_STAKING_HISTORY", + "LIST_STAKING_HISTORY", + "RETRIEVE_STAKING_HISTORY", +]; + +export const getStakingRewardsByAccountSimiles = [ + "VIEW_STAKING_REWARDS", + "GET_STAKING_REWARDS", + "CHECK_STAKING_REWARDS", + "FETCH_STAKING_REWARDS", + "READ_STAKING_REWARDS", + "DISPLAY_STAKING_REWARDS", + "SHOW_STAKING_REWARDS", + "LIST_STAKING_REWARDS", + "RETRIEVE_STAKING_REWARDS", +]; + +// Mission Related Similes +export const getMissionsSimiles = [ + "VIEW_MISSIONS", + "GET_MISSIONS", + "CHECK_MISSIONS", + "FETCH_MISSIONS", + "READ_MISSIONS", + "DISPLAY_MISSIONS", + "SHOW_MISSIONS", + "LIST_MISSIONS", + "RETRIEVE_MISSIONS", +]; + +export const getMissionLeaderboardSimiles = [ + "VIEW_MISSION_MITO_LEADERBOARD", + "GET_MISSION_MITO_LEADERBOARD", + "CHECK_MISSION_MITO_LEADERBOARD", + "FETCH_MISSION_MITO_LEADERBOARD", + "READ_MISSION_MITO_LEADERBOARD", + "DISPLAY_MISSION_MITO_LEADERBOARD", + "SHOW_MISSION_MITO_LEADERBOARD", + "LIST_MISSION_MITO_LEADERBOARD", + "RETRIEVE_MISSION_MITO_LEADERBOARD", +]; + +// IDO Related Similes +export const getIDOSimiles = [ + "VIEW_IDO", + "GET_IDO", + "CHECK_IDO", + "FETCH_IDO", + "READ_IDO", + "DISPLAY_IDO", + "SHOW_IDO", + "LIST_IDO", + "RETRIEVE_IDO", +]; + +export const getIDOsSimiles = [ + "VIEW_IDOS", + "GET_IDOS", + "CHECK_IDOS", + "FETCH_IDOS", + "READ_IDOS", + "DISPLAY_IDOS", + "SHOW_IDOS", + "LIST_IDOS", + "RETRIEVE_IDOS", +]; + +export const getIDOSubscribersSimiles = [ + "VIEW_IDO_SUBSCRIBERS", + "GET_IDO_SUBSCRIBERS", + "CHECK_IDO_SUBSCRIBERS", + "FETCH_IDO_SUBSCRIBERS", + "READ_IDO_SUBSCRIBERS", + "DISPLAY_IDO_SUBSCRIBERS", + "SHOW_IDO_SUBSCRIBERS", + "LIST_IDO_SUBSCRIBERS", + "RETRIEVE_IDO_SUBSCRIBERS", +]; + +export const getIDOSubscriptionSimiles = [ + "VIEW_IDO_SUBSCRIPTION", + "GET_IDO_SUBSCRIPTION", + "CHECK_IDO_SUBSCRIPTION", + "FETCH_IDO_SUBSCRIPTION", + "READ_IDO_SUBSCRIPTION", + "DISPLAY_IDO_SUBSCRIPTION", + "SHOW_IDO_SUBSCRIPTION", + "LIST_IDO_SUBSCRIPTION", + "RETRIEVE_IDO_SUBSCRIPTION", +]; + +export const getIDOActivitiesSimiles = [ + "VIEW_IDO_ACTIVITIES", + "GET_IDO_ACTIVITIES", + "CHECK_IDO_ACTIVITIES", + "FETCH_IDO_ACTIVITIES", + "READ_IDO_ACTIVITIES", + "DISPLAY_IDO_ACTIVITIES", + "SHOW_IDO_ACTIVITIES", + "LIST_IDO_ACTIVITIES", + "RETRIEVE_IDO_ACTIVITIES", +]; + +export const getIDOWhitelistSimiles = [ + "VIEW_IDO_WHITELIST", + "GET_IDO_WHITELIST", + "CHECK_IDO_WHITELIST", + "FETCH_IDO_WHITELIST", + "READ_IDO_WHITELIST", + "DISPLAY_IDO_WHITELIST", + "SHOW_IDO_WHITELIST", + "LIST_IDO_WHITELIST", + "RETRIEVE_IDO_WHITELIST", +]; + +export const getClaimReferencesSimiles = [ + "VIEW_CLAIM_REFERENCES", + "GET_CLAIM_REFERENCES", + "CHECK_CLAIM_REFERENCES", + "FETCH_CLAIM_REFERENCES", + "READ_CLAIM_REFERENCES", + "DISPLAY_CLAIM_REFERENCES", + "SHOW_CLAIM_REFERENCES", + "LIST_CLAIM_REFERENCES", + "RETRIEVE_CLAIM_REFERENCES", +]; + +// Mito interactions + +// Launchpad Related Similes +export const getLaunchpadSubscribeSimiles = [ + "LAUNCHPAD_SUBSCRIBE", + "JOIN_LAUNCHPAD", + "ENTER_LAUNCHPAD", + "PARTICIPATE_LAUNCHPAD", + "REGISTER_LAUNCHPAD", + "ENROLL_LAUNCHPAD", + "ACCESS_LAUNCHPAD", + "ENGAGE_LAUNCHPAD", + "START_LAUNCHPAD", +]; + +export const getLaunchpadClaimSimiles = [ + "LAUNCHPAD_CLAIM", + "COLLECT_LAUNCHPAD", + "WITHDRAW_LAUNCHPAD", + "RETRIEVE_LAUNCHPAD", + "REDEEM_LAUNCHPAD", + "GATHER_LAUNCHPAD", + "OBTAIN_LAUNCHPAD", + "ACQUIRE_LAUNCHPAD", + "EXTRACT_LAUNCHPAD", +]; + +// Vault Related Action Similes +export const getSubscribeVaultSimiles = [ + "SUBSCRIBE_VAULT", + "JOIN_VAULT", + "ENTER_VAULT", + "PARTICIPATE_VAULT", + "REGISTER_VAULT", + "ENROLL_VAULT", + "ACCESS_VAULT", + "ENGAGE_VAULT", + "START_VAULT", +]; + +export const getInstantiateCPMMVaultSimiles = [ + "INSTANTIATE_CPMM_VAULT", + "CREATE_CPMM_VAULT", + "DEPLOY_CPMM_VAULT", + "LAUNCH_CPMM_VAULT", + "INITIALIZE_CPMM_VAULT", + "SETUP_CPMM_VAULT", + "START_CPMM_VAULT", + "BEGIN_CPMM_VAULT", + "ESTABLISH_CPMM_VAULT", +]; +export const getRedeemFromVaultSimiles = [ + "WITHDRAW_FROM_VAULT", + "EXIT_VAULT", + "REDEEM_FROM_VAULT", + "REMOVE_FROM_VAULT", + "LEAVE_VAULT", + "CASH_OUT_VAULT", + "EXTRACT_FROM_VAULT", + "PULL_FROM_VAULT", + "RECOVER_FROM_VAULT", +]; + +export const getStakeVaultLPSimiles = [ + "LOCK_VAULT_LP", + "STAKE_VAULT_LP", + "COMMIT_VAULT_LP", + "BOND_VAULT_LP", + "ALLOCATE_VAULT_LP", + "INVEST_VAULT_LP", + "HOLD_VAULT_LP", +]; + +export const getUnstakeVaultLPSimiles = [ + "UNLOCK_VAULT_LP", + "UNSTAKE_VAULT_LP", + "RELEASE_VAULT_LP", + "UNBOND_VAULT_LP", + "FREE_VAULT_LP", +]; + +export const getClaimVaultRewardsSimiles = [ + "COLLECT_VAULT_REWARDS", + "HARVEST_VAULT_REWARDS", + "CLAIM_VAULT_REWARDS", + "GATHER_VAULT_REWARDS", + "RECEIVE_VAULT_REWARDS", + "WITHDRAW_VAULT_REWARDS", + "GET_VAULT_REWARDS", + "FETCH_VAULT_REWARDS", + "REDEEM_VAULT_REWARDS", +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/similes/peggy.ts b/packages/plugin-injective/injective-sdk-client-ts/src/similes/peggy.ts new file mode 100644 index 00000000000..bb846c2e6e8 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/similes/peggy.ts @@ -0,0 +1,23 @@ +export const getPeggyModuleParamsSimiles = [ + "VIEW_PEGGY_BRIDGE_PARAMS", + "GET_PEGGY_BRIDGE_PARAMS", + "CHECK_PEGGY_BRIDGE_PARAMS", + "FETCH_PEGGY_BRIDGE_PARAMS", + "READ_PEGGY_BRIDGE_PARAMS", + "DISPLAY_PEGGY_BRIDGE_PARAMS", + "SHOW_PEGGY_BRIDGE_PARAMS", + "LIST_PEGGY_BRIDGE_PARAMS", + "RETRIEVE_PEGGY_BRIDGE_PARAMS", +]; + +export const msgSendToEthSimiles = [ + "SEND_TO_ETHEREUM", + "TRANSFER_TO_ETH", + "BRIDGE_TO_ETHEREUM", + "MOVE_TO_ETH", + "TRANSMIT_TO_ETHEREUM", + "FORWARD_TO_ETH", + "RELAY_TO_ETHEREUM", + "DISPATCH_TO_ETH", + "TRANSPORT_TO_ETHEREUM", +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/similes/permissions.ts b/packages/plugin-injective/injective-sdk-client-ts/src/similes/permissions.ts new file mode 100644 index 00000000000..b19ace1efc3 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/similes/permissions.ts @@ -0,0 +1,71 @@ +export const getAddressesByRoleSimiles = [ + "VIEW_ROLE_ADDRESSES", + "GET_ROLE_ADDRESSES", + "CHECK_ROLE_ADDRESSES", + "FETCH_ROLE_ADDRESSES", + "READ_ROLE_ADDRESSES", + "DISPLAY_ROLE_ADDRESSES", + "SHOW_ROLE_ADDRESSES", + "LIST_ROLE_ADDRESSES", + "RETRIEVE_ROLE_ADDRESSES", +]; + +export const getAddressRolesSimiles = [ + "VIEW_ADDRESS_ROLES", + "GET_ADDRESS_ROLES", + "CHECK_ADDRESS_ROLES", + "FETCH_ADDRESS_ROLES", + "READ_ADDRESS_ROLES", + "DISPLAY_ADDRESS_ROLES", + "SHOW_ADDRESS_ROLES", + "LIST_ADDRESS_ROLES", + "RETRIEVE_ADDRESS_ROLES", +]; + +export const getAllNamespacesSimiles = [ + "VIEW_NAMESPACES", + "GET_NAMESPACES", + "CHECK_NAMESPACES", + "FETCH_NAMESPACES", + "READ_NAMESPACES", + "DISPLAY_NAMESPACES", + "SHOW_NAMESPACES", + "LIST_NAMESPACES", + "RETRIEVE_NAMESPACES", +]; + +export const getPermissionsModuleParamsSimiles = [ + "VIEW_PERMISSIONS_PARAMS", + "GET_PERMISSIONS_PARAMS", + "CHECK_PERMISSIONS_PARAMS", + "FETCH_PERMISSIONS_PARAMS", + "READ_PERMISSIONS_PARAMS", + "DISPLAY_PERMISSIONS_PARAMS", + "SHOW_PERMISSIONS_PARAMS", + "LIST_PERMISSIONS_PARAMS", + "RETRIEVE_PERMISSIONS_PARAMS", +]; + +export const getNamespaceByDenomSimiles = [ + "VIEW_DENOM_NAMESPACE", + "GET_DENOM_NAMESPACE", + "CHECK_DENOM_NAMESPACE", + "FETCH_DENOM_NAMESPACE", + "READ_DENOM_NAMESPACE", + "DISPLAY_DENOM_NAMESPACE", + "SHOW_DENOM_NAMESPACE", + "LIST_DENOM_NAMESPACE", + "RETRIEVE_DENOM_NAMESPACE", +]; + +export const getVouchersForAddressSimiles = [ + "VIEW_ADDRESS_VOUCHERS", + "GET_ADDRESS_VOUCHERS", + "CHECK_ADDRESS_VOUCHERS", + "FETCH_ADDRESS_VOUCHERS", + "READ_ADDRESS_VOUCHERS", + "DISPLAY_ADDRESS_VOUCHERS", + "SHOW_ADDRESS_VOUCHERS", + "LIST_ADDRESS_VOUCHERS", + "RETRIEVE_ADDRESS_VOUCHERS", +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/similes/staking.ts b/packages/plugin-injective/injective-sdk-client-ts/src/similes/staking.ts new file mode 100644 index 00000000000..a1acb0d55c8 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/similes/staking.ts @@ -0,0 +1,279 @@ +// Module and Pool Query Actions +export const getStakingModuleParamsSimiles = [ + "VIEW_STAKING_PARAMS", + "GET_STAKING_PARAMS", + "CHECK_STAKING_PARAMS", + "FETCH_STAKING_PARAMS", + "READ_STAKING_PARAMS", + "DISPLAY_STAKING_PARAMS", + "SHOW_STAKING_PARAMS", + "LIST_STAKING_PARAMS", + "RETRIEVE_STAKING_PARAMS", +]; + +export const getPoolSimiles = [ + "VIEW_STAKING_POOL", + "GET_STAKING_POOL", + "CHECK_STAKING_POOL", + "FETCH_STAKING_POOL", + "READ_STAKING_POOL", + "DISPLAY_STAKING_POOL", + "SHOW_STAKING_POOL", + "LIST_STAKING_POOL", + "RETRIEVE_STAKING_POOL", +]; + +// Validator Query Actions +export const getValidatorsSimiles = [ + "VIEW_VALIDATORS", + "GET_VALIDATORS", + "CHECK_VALIDATORS", + "FETCH_VALIDATORS", + "READ_VALIDATORS", + "DISPLAY_VALIDATORS", + "SHOW_VALIDATORS", + "LIST_VALIDATORS", + "RETRIEVE_VALIDATORS", +]; + +export const getValidatorSimiles = [ + "VIEW_VALIDATOR", + "GET_VALIDATOR", + "CHECK_VALIDATOR", + "FETCH_VALIDATOR", + "READ_VALIDATOR", + "DISPLAY_VALIDATOR", + "SHOW_VALIDATOR", + "LIST_VALIDATOR", + "RETRIEVE_VALIDATOR", +]; + +// Delegation Query Actions +export const getValidatorDelegationsSimiles = [ + "VIEW_VALIDATOR_DELEGATIONS", + "GET_VALIDATOR_DELEGATIONS", + "CHECK_VALIDATOR_DELEGATIONS", + "FETCH_VALIDATOR_DELEGATIONS", + "READ_VALIDATOR_DELEGATIONS", + "DISPLAY_VALIDATOR_DELEGATIONS", + "SHOW_VALIDATOR_DELEGATIONS", + "LIST_VALIDATOR_DELEGATIONS", + "RETRIEVE_VALIDATOR_DELEGATIONS", +]; + +export const getValidatorDelegationsNoThrowSimiles = [ + "VIEW_VALIDATOR_DELEGATIONS_SAFE", + "GET_VALIDATOR_DELEGATIONS_SAFE", + "CHECK_VALIDATOR_DELEGATIONS_SAFE", + "FETCH_VALIDATOR_DELEGATIONS_SAFE", + "READ_VALIDATOR_DELEGATIONS_SAFE", + "DISPLAY_VALIDATOR_DELEGATIONS_SAFE", + "SHOW_VALIDATOR_DELEGATIONS_SAFE", + "LIST_VALIDATOR_DELEGATIONS_SAFE", + "RETRIEVE_VALIDATOR_DELEGATIONS_SAFE", +]; + +export const getValidatorUnbondingDelegationsSimiles = [ + "VIEW_VALIDATOR_UNBONDING", + "GET_VALIDATOR_UNBONDING", + "CHECK_VALIDATOR_UNBONDING", + "FETCH_VALIDATOR_UNBONDING", + "READ_VALIDATOR_UNBONDING", + "DISPLAY_VALIDATOR_UNBONDING", + "SHOW_VALIDATOR_UNBONDING", + "LIST_VALIDATOR_UNBONDING", + "RETRIEVE_VALIDATOR_UNBONDING", +]; + +export const getValidatorUnbondingDelegationsNoThrowSimiles = [ + "VIEW_VALIDATOR_UNBONDING_SAFE", + "GET_VALIDATOR_UNBONDING_SAFE", + "CHECK_VALIDATOR_UNBONDING_SAFE", + "FETCH_VALIDATOR_UNBONDING_SAFE", + "READ_VALIDATOR_UNBONDING_SAFE", + "DISPLAY_VALIDATOR_UNBONDING_SAFE", + "SHOW_VALIDATOR_UNBONDING_SAFE", + "LIST_VALIDATOR_UNBONDING_SAFE", + "RETRIEVE_VALIDATOR_UNBONDING_SAFE", +]; + +export const getDelegationSimiles = [ + "VIEW_DELEGATION", + "GET_DELEGATION", + "CHECK_DELEGATION", + "FETCH_DELEGATION", + "READ_DELEGATION", + "DISPLAY_DELEGATION", + "SHOW_DELEGATION", + "LIST_DELEGATION", + "RETRIEVE_DELEGATION", +]; + +export const getDelegationsSimiles = [ + "VIEW_DELEGATIONS", + "GET_DELEGATIONS", + "CHECK_DELEGATIONS", + "FETCH_DELEGATIONS", + "READ_DELEGATIONS", + "DISPLAY_DELEGATIONS", + "SHOW_DELEGATIONS", + "LIST_DELEGATIONS", + "RETRIEVE_DELEGATIONS", +]; + +export const getDelegationsNoThrowSimiles = [ + "VIEW_DELEGATIONS_SAFE", + "GET_DELEGATIONS_SAFE", + "CHECK_DELEGATIONS_SAFE", + "FETCH_DELEGATIONS_SAFE", + "READ_DELEGATIONS_SAFE", + "DISPLAY_DELEGATIONS_SAFE", + "SHOW_DELEGATIONS_SAFE", + "LIST_DELEGATIONS_SAFE", + "RETRIEVE_DELEGATIONS_SAFE", +]; + +export const getDelegatorsSimiles = [ + "VIEW_DELEGATORS", + "GET_DELEGATORS", + "CHECK_DELEGATORS", + "FETCH_DELEGATORS", + "READ_DELEGATORS", + "DISPLAY_DELEGATORS", + "SHOW_DELEGATORS", + "LIST_DELEGATORS", + "RETRIEVE_DELEGATORS", +]; + +export const getDelegatorsNoThrowSimiles = [ + "VIEW_DELEGATORS_SAFE", + "GET_DELEGATORS_SAFE", + "CHECK_DELEGATORS_SAFE", + "FETCH_DELEGATORS_SAFE", + "READ_DELEGATORS_SAFE", + "DISPLAY_DELEGATORS_SAFE", + "SHOW_DELEGATORS_SAFE", + "LIST_DELEGATORS_SAFE", + "RETRIEVE_DELEGATORS_SAFE", +]; + +export const getUnbondingDelegationsSimiles = [ + "VIEW_UNBONDING_DELEGATIONS", + "GET_UNBONDING_DELEGATIONS", + "CHECK_UNBONDING_DELEGATIONS", + "FETCH_UNBONDING_DELEGATIONS", + "READ_UNBONDING_DELEGATIONS", + "DISPLAY_UNBONDING_DELEGATIONS", + "SHOW_UNBONDING_DELEGATIONS", + "LIST_UNBONDING_DELEGATIONS", + "RETRIEVE_UNBONDING_DELEGATIONS", +]; + +export const getUnbondingDelegationsNoThrowSimiles = [ + "VIEW_UNBONDING_DELEGATIONS_SAFE", + "GET_UNBONDING_DELEGATIONS_SAFE", + "CHECK_UNBONDING_DELEGATIONS_SAFE", + "FETCH_UNBONDING_DELEGATIONS_SAFE", + "READ_UNBONDING_DELEGATIONS_SAFE", + "DISPLAY_UNBONDING_DELEGATIONS_SAFE", + "SHOW_UNBONDING_DELEGATIONS_SAFE", + "LIST_UNBONDING_DELEGATIONS_SAFE", + "RETRIEVE_UNBONDING_DELEGATIONS_SAFE", +]; + +export const getReDelegationsSimiles = [ + "VIEW_REDELEGATIONS", + "GET_REDELEGATIONS", + "CHECK_REDELEGATIONS", + "FETCH_REDELEGATIONS", + "READ_REDELEGATIONS", + "DISPLAY_REDELEGATIONS", + "SHOW_REDELEGATIONS", + "LIST_REDELEGATIONS", + "RETRIEVE_REDELEGATIONS", +]; + +export const getReDelegationsNoThrowSimiles = [ + "VIEW_REDELEGATIONS_SAFE", + "GET_REDELEGATIONS_SAFE", + "CHECK_REDELEGATIONS_SAFE", + "FETCH_REDELEGATIONS_SAFE", + "READ_REDELEGATIONS_SAFE", + "DISPLAY_REDELEGATIONS_SAFE", + "SHOW_REDELEGATIONS_SAFE", + "LIST_REDELEGATIONS_SAFE", + "RETRIEVE_REDELEGATIONS_SAFE", +]; + +// Message Actions +export const msgBeginRedelegateSimiles = [ + "START_REDELEGATION", + "BEGIN_REDELEGATION", + "INITIATE_REDELEGATION", + "CREATE_REDELEGATION", + "SUBMIT_REDELEGATION", + "EXECUTE_REDELEGATION", + "PROCESS_REDELEGATION", + "PERFORM_REDELEGATION", + "LAUNCH_REDELEGATION", +]; + +export const msgDelegateSimiles = [ + "START_DELEGATION", + "BEGIN_DELEGATION", + "INITIATE_DELEGATION", + "CREATE_DELEGATION", + "SUBMIT_DELEGATION", + "EXECUTE_DELEGATION", + "PROCESS_DELEGATION", + "PERFORM_DELEGATION", + "LAUNCH_DELEGATION", +]; + +export const msgUndelegateSimiles = [ + "START_UNDELEGATION", + "BEGIN_UNDELEGATION", + "INITIATE_UNDELEGATION", + "CREATE_UNDELEGATION", + "SUBMIT_UNDELEGATION", + "EXECUTE_UNDELEGATION", + "PROCESS_UNDELEGATION", + "PERFORM_UNDELEGATION", + "LAUNCH_UNDELEGATION", +]; + +export const msgCreateValidatorSimiles = [ + "CREATE_VALIDATOR", + "ESTABLISH_VALIDATOR", + "INITIALIZE_VALIDATOR", + "SETUP_VALIDATOR", + "REGISTER_VALIDATOR", + "START_VALIDATOR", + "LAUNCH_VALIDATOR", + "DEPLOY_VALIDATOR", + "INSTITUTE_VALIDATOR", +]; + +export const msgEditValidatorSimiles = [ + "UPDATE_VALIDATOR", + "MODIFY_VALIDATOR", + "CHANGE_VALIDATOR", + "EDIT_VALIDATOR", + "REVISE_VALIDATOR", + "ALTER_VALIDATOR", + "ADJUST_VALIDATOR", + "AMEND_VALIDATOR", + "TRANSFORM_VALIDATOR", +]; + +export const msgCancelUnbondingDelegationSimiles = [ + "CANCEL_UNBONDING", + "STOP_UNBONDING", + "HALT_UNBONDING", + "TERMINATE_UNBONDING", + "END_UNBONDING", + "ABORT_UNBONDING", + "WITHDRAW_UNBONDING", + "REVERSE_UNBONDING", + "NULLIFY_UNBONDING", +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/similes/token-factory.ts b/packages/plugin-injective/injective-sdk-client-ts/src/similes/token-factory.ts new file mode 100644 index 00000000000..7120de01e24 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/similes/token-factory.ts @@ -0,0 +1,109 @@ +// Query Actions +export const getDenomsFromCreatorSimiles = [ + "VIEW_CREATOR_TOKENS", + "GET_CREATOR_TOKENS", + "CHECK_CREATOR_TOKENS", + "FETCH_CREATOR_TOKENS", + "READ_CREATOR_TOKENS", + "DISPLAY_CREATOR_TOKENS", + "SHOW_CREATOR_TOKENS", + "LIST_CREATOR_TOKENS", + "RETRIEVE_CREATOR_TOKENS", +]; + +export const getDenomAuthorityMetadataSimiles = [ + "VIEW_TOKEN_AUTHORITY", + "GET_TOKEN_AUTHORITY", + "CHECK_TOKEN_AUTHORITY", + "FETCH_TOKEN_AUTHORITY", + "READ_TOKEN_AUTHORITY", + "DISPLAY_TOKEN_AUTHORITY", + "SHOW_TOKEN_AUTHORITY", + "LIST_TOKEN_AUTHORITY", + "RETRIEVE_TOKEN_AUTHORITY", +]; + +export const getTokenFactoryModuleParamsSimiles = [ + "VIEW_TOKEN_FACTORY_PARAMS", + "GET_TOKEN_FACTORY_PARAMS", + "CHECK_TOKEN_FACTORY_PARAMS", + "FETCH_TOKEN_FACTORY_PARAMS", + "READ_TOKEN_FACTORY_PARAMS", + "DISPLAY_TOKEN_FACTORY_PARAMS", + "SHOW_TOKEN_FACTORY_PARAMS", + "LIST_TOKEN_FACTORY_PARAMS", + "RETRIEVE_TOKEN_FACTORY_PARAMS", +]; + +export const getTokenFactoryModuleStateSimiles = [ + "VIEW_TOKEN_FACTORY_STATE", + "GET_TOKEN_FACTORY_STATE", + "CHECK_TOKEN_FACTORY_STATE", + "FETCH_TOKEN_FACTORY_STATE", + "READ_TOKEN_FACTORY_STATE", + "DISPLAY_TOKEN_FACTORY_STATE", + "SHOW_TOKEN_FACTORY_STATE", + "LIST_TOKEN_FACTORY_STATE", + "RETRIEVE_TOKEN_FACTORY_STATE", +]; + +// Message Actions +export const msgBurnSimiles = [ + "BURN_TOKENS", + "DESTROY_TOKENS", + "REMOVE_TOKENS", + "DELETE_TOKENS", + "ELIMINATE_TOKENS", + "CONSUME_TOKENS", + "ERASE_TOKENS", + "CANCEL_TOKENS", + "NULLIFY_TOKENS", +]; + +export const msgChangeAdminSimiles = [ + "UPDATE_TOKEN_ADMIN", + "CHANGE_TOKEN_ADMIN", + "MODIFY_TOKEN_ADMIN", + "TRANSFER_TOKEN_ADMIN", + "REPLACE_TOKEN_ADMIN", + "REASSIGN_TOKEN_ADMIN", + "SWITCH_TOKEN_ADMIN", + "ALTER_TOKEN_ADMIN", + "REVISE_TOKEN_ADMIN", +]; + +export const msgCreateDenomSimiles = [ + "CREATE_TOKEN_DENOM", + "ESTABLISH_TOKEN_DENOM", + "INITIALIZE_TOKEN_DENOM", + "SETUP_TOKEN_DENOM", + "GENERATE_TOKEN_DENOM", + "LAUNCH_TOKEN_DENOM", + "DEPLOY_TOKEN_DENOM", + "INSTITUTE_TOKEN_DENOM", + "PRODUCE_TOKEN_DENOM", +]; + +export const msgMintSimiles = [ + "MINT_TOKENS", + "ISSUE_TOKENS", + "GENERATE_TOKENS", + "CREATE_TOKENS", + "PRODUCE_TOKENS", + "MAKE_TOKENS", + "FORGE_TOKENS", + "FABRICATE_TOKENS", + "CONSTRUCT_TOKENS", +]; + +export const msgSetDenomMetadataSimiles = [ + "UPDATE_TOKEN_METADATA", + "SET_TOKEN_METADATA", + "MODIFY_TOKEN_METADATA", + "CHANGE_TOKEN_METADATA", + "REVISE_TOKEN_METADATA", + "ALTER_TOKEN_METADATA", + "ADJUST_TOKEN_METADATA", + "EDIT_TOKEN_METADATA", + "CONFIGURE_TOKEN_METADATA", +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/similes/wasm.ts b/packages/plugin-injective/injective-sdk-client-ts/src/similes/wasm.ts new file mode 100644 index 00000000000..a73c8614589 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/similes/wasm.ts @@ -0,0 +1,219 @@ +// Contract Query Actions +export const getContractAccountsBalanceSimiles = [ + "VIEW_CONTRACT_BALANCES", + "GET_CONTRACT_BALANCES", + "CHECK_CONTRACT_BALANCES", + "FETCH_CONTRACT_BALANCES", + "READ_CONTRACT_BALANCES", + "DISPLAY_CONTRACT_BALANCES", + "SHOW_CONTRACT_BALANCES", + "LIST_CONTRACT_BALANCES", + "RETRIEVE_CONTRACT_BALANCES", +]; + +export const getContractStateSimiles = [ + "VIEW_CONTRACT_STATE", + "GET_CONTRACT_STATE", + "CHECK_CONTRACT_STATE", + "FETCH_CONTRACT_STATE", + "READ_CONTRACT_STATE", + "DISPLAY_CONTRACT_STATE", + "SHOW_CONTRACT_STATE", + "LIST_CONTRACT_STATE", + "RETRIEVE_CONTRACT_STATE", +]; + +export const getContractInfoSimiles = [ + "VIEW_CONTRACT_INFO", + "GET_CONTRACT_INFO", + "CHECK_CONTRACT_INFO", + "FETCH_CONTRACT_INFO", + "READ_CONTRACT_INFO", + "DISPLAY_CONTRACT_INFO", + "SHOW_CONTRACT_INFO", + "LIST_CONTRACT_INFO", + "RETRIEVE_CONTRACT_INFO", +]; + +export const getContractHistorySimiles = [ + "VIEW_CONTRACT_HISTORY", + "GET_CONTRACT_HISTORY", + "CHECK_CONTRACT_HISTORY", + "FETCH_CONTRACT_HISTORY", + "READ_CONTRACT_HISTORY", + "DISPLAY_CONTRACT_HISTORY", + "SHOW_CONTRACT_HISTORY", + "LIST_CONTRACT_HISTORY", + "RETRIEVE_CONTRACT_HISTORY", +]; + +export const getSmartContractStateSimiles = [ + "VIEW_SMART_STATE", + "GET_SMART_STATE", + "CHECK_SMART_STATE", + "FETCH_SMART_STATE", + "READ_SMART_STATE", + "DISPLAY_SMART_STATE", + "SHOW_SMART_STATE", + "LIST_SMART_STATE", + "RETRIEVE_SMART_STATE", +]; + +export const getRawContractStateSimiles = [ + "VIEW_RAW_STATE", + "GET_RAW_STATE", + "CHECK_RAW_STATE", + "FETCH_RAW_STATE", + "READ_RAW_STATE", + "DISPLAY_RAW_STATE", + "SHOW_RAW_STATE", + "LIST_RAW_STATE", + "RETRIEVE_RAW_STATE", +]; + +// Code Query Actions +export const getContractCodesSimiles = [ + "VIEW_CONTRACT_CODES", + "GET_CONTRACT_CODES", + "CHECK_CONTRACT_CODES", + "FETCH_CONTRACT_CODES", + "READ_CONTRACT_CODES", + "DISPLAY_CONTRACT_CODES", + "SHOW_CONTRACT_CODES", + "LIST_CONTRACT_CODES", + "RETRIEVE_CONTRACT_CODES", +]; + +export const getContractCodeSimiles = [ + "VIEW_CONTRACT_CODE", + "GET_CONTRACT_CODE", + "CHECK_CONTRACT_CODE", + "FETCH_CONTRACT_CODE", + "READ_CONTRACT_CODE", + "DISPLAY_CONTRACT_CODE", + "SHOW_CONTRACT_CODE", + "LIST_CONTRACT_CODE", + "RETRIEVE_CONTRACT_CODE", +]; + +export const getContractCodeContractsSimiles = [ + "VIEW_CODE_CONTRACTS", + "GET_CODE_CONTRACTS", + "CHECK_CODE_CONTRACTS", + "FETCH_CODE_CONTRACTS", + "READ_CODE_CONTRACTS", + "DISPLAY_CODE_CONTRACTS", + "SHOW_CODE_CONTRACTS", + "LIST_CODE_CONTRACTS", + "RETRIEVE_CODE_CONTRACTS", +]; + +// Message Actions +export const msgStoreCodeSimiles = [ + "STORE_CONTRACT_CODE", + "UPLOAD_CONTRACT_CODE", + "DEPLOY_CONTRACT_CODE", + "SUBMIT_CONTRACT_CODE", + "PUBLISH_CONTRACT_CODE", + "REGISTER_CONTRACT_CODE", + "SAVE_CONTRACT_CODE", + "INSTALL_CONTRACT_CODE", + "PUSH_CONTRACT_CODE", +]; + +export const msgUpdateAdminSimiles = [ + "UPDATE_CONTRACT_ADMIN", + "CHANGE_CONTRACT_ADMIN", + "MODIFY_CONTRACT_ADMIN", + "TRANSFER_CONTRACT_ADMIN", + "REPLACE_CONTRACT_ADMIN", + "REASSIGN_CONTRACT_ADMIN", + "SWITCH_CONTRACT_ADMIN", + "ALTER_CONTRACT_ADMIN", + "REVISE_CONTRACT_ADMIN", +]; + +export const msgExecuteContractSimiles = [ + "EXECUTE_CONTRACT", + "RUN_CONTRACT", + "CALL_CONTRACT", + "INVOKE_CONTRACT", + "TRIGGER_CONTRACT", + "PERFORM_CONTRACT", + "PROCESS_CONTRACT", + "START_CONTRACT", + "OPERATE_CONTRACT", +]; + +export const msgMigrateContractSimiles = [ + "MIGRATE_CONTRACT", + "UPGRADE_CONTRACT", + "UPDATE_CONTRACT", + "TRANSFER_CONTRACT", + "MOVE_CONTRACT", + "SHIFT_CONTRACT", + "PORT_CONTRACT", + "TRANSITION_CONTRACT", + "CONVERT_CONTRACT", +]; + +export const msgInstantiateContractSimiles = [ + "CREATE_CONTRACT_INSTANCE", + "INSTANTIATE_CONTRACT", + "INITIALIZE_CONTRACT", + "DEPLOY_CONTRACT", + "LAUNCH_CONTRACT", + "START_CONTRACT_INSTANCE", + "SETUP_CONTRACT", + "ESTABLISH_CONTRACT", + "GENERATE_CONTRACT", +]; + +export const msgExecuteContractCompatSimiles = [ + "EXECUTE_COMPAT_CONTRACT", + "RUN_COMPAT_CONTRACT", + "CALL_COMPAT_CONTRACT", + "INVOKE_COMPAT_CONTRACT", + "TRIGGER_COMPAT_CONTRACT", + "PERFORM_COMPAT_CONTRACT", + "PROCESS_COMPAT_CONTRACT", + "START_COMPAT_CONTRACT", + "OPERATE_COMPAT_CONTRACT", +]; + +export const msgPrivilegedExecuteContractSimiles = [ + "EXECUTE_PRIVILEGED_CONTRACT", + "RUN_PRIVILEGED_CONTRACT", + "CALL_PRIVILEGED_CONTRACT", + "INVOKE_PRIVILEGED_CONTRACT", + "TRIGGER_PRIVILEGED_CONTRACT", + "PERFORM_PRIVILEGED_CONTRACT", + "PROCESS_PRIVILEGED_CONTRACT", + "START_PRIVILEGED_CONTRACT", + "OPERATE_PRIVILEGED_CONTRACT", +]; + +// WasmX Query Actions +export const getWasmxModuleParamsSimiles = [ + "VIEW_WASMX_PARAMS", + "GET_WASMX_PARAMS", + "CHECK_WASMX_PARAMS", + "FETCH_WASMX_PARAMS", + "READ_WASMX_PARAMS", + "DISPLAY_WASMX_PARAMS", + "SHOW_WASMX_PARAMS", + "LIST_WASMX_PARAMS", + "RETRIEVE_WASMX_PARAMS", +]; + +export const getWasmxModuleStateSimiles = [ + "VIEW_WASMX_STATE", + "GET_WASMX_STATE", + "CHECK_WASMX_STATE", + "FETCH_WASMX_STATE", + "READ_WASMX_STATE", + "DISPLAY_WASMX_STATE", + "SHOW_WASMX_STATE", + "LIST_WASMX_STATE", + "RETRIEVE_WASMX_STATE", +]; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/auction.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/auction.ts new file mode 100644 index 00000000000..85fdaa8559f --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/auction.ts @@ -0,0 +1,212 @@ +// Auction Module Templates + +export const getAuctionModuleParamsTemplate = ` +Extract the following details to get auction module parameters: +- **auctionPeriod** (number): The duration of each auction period in seconds +- **minNextBidIncrementRate** (string): The minimum rate at which the next bid must increase + +Provide the response in the following JSON format: + +\`\`\`json +{ + "auctionPeriod": 3600, + "minNextBidIncrementRate": "0.1" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getAuctionModuleStateTemplate = ` +Extract the following details for the auction module state: +- **params** (object): Module parameters containing: + - **auctionPeriod** (number): The duration of each auction period in seconds + - **minNextBidIncrementRate** (string): The minimum rate for next bid increment +- **auctionRound** (number): Current auction round number +- **highestBid** (object): Information about the highest bid: + - **bidder** (string): Address of the highest bidder + - **amount** (string): Amount of the highest bid +- **auctionEndingTimestamp** (number): Unix timestamp when the auction ends + +Provide the response in the following JSON format: + +\`\`\`json +{ + "params": { + "auctionPeriod": 3600, + "minNextBidIncrementRate": "0.1" + }, + "auctionRound": 5, + "highestBid": { + "bidder": "inj1...", + "amount": "1000000000" + }, + "auctionEndingTimestamp": 1632150400 +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getCurrentBasketTemplate = ` +Extract the following details for the current auction basket: +- **amountList** (array): List of amounts in the basket, each containing: + - **denom** (string): Token denomination (e.g., "inj") + - **amount** (string): Token amount +- **auctionRound** (number): Current auction round number +- **auctionClosingTime** (number): Unix timestamp when the auction closes +- **highestBidder** (string): Address of the current highest bidder +- **highestBidAmount** (string): Amount of the current highest bid + +Provide the response in the following JSON format: + +\`\`\`json +{ + "amountList": [ + { + "denom": "inj", + "amount": "1000000000" + } + ], + "auctionRound": 5, + "auctionClosingTime": 1632150400, + "highestBidder": "inj1...", + "highestBidAmount": "1000000000" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getAuctionRoundTemplate = ` +Extract the following details for getting auction round information: +- **round** (number): The auction round number to query + +Ensure that: +1. Round number is positive +2. Round number exists in the system + +Provide the round parameter in the following JSON format: + +\`\`\`json +{ + "round": 5 +} +\`\`\` + +The response will contain: +- **auction** (object): Auction information containing: + - **winner** (string): Address of the auction winner + - **basketList** (array): List of tokens in the basket + - **winningBidAmount** (string): Amount of the winning bid + - **round** (number): Round number + - **endTimestamp** (number): Unix timestamp when the round ended + - **updatedAt** (number): Last update timestamp +- **bids** (array): List of bids in the round, each containing: + - **bidder** (string): Address of the bidder + - **bidAmount** (string): Bid amount + - **bidTimestamp** (number): When the bid was placed + +Response format: + +\`\`\`json +{ + "auction": { + "winner": "inj1...", + "basketList": [ + { + "denom": "inj", + "amount": "1000000000" + } + ], + "winningBidAmount": "1000000000", + "round": 5, + "endTimestamp": 1632150400, + "updatedAt": 1632150400 + }, + "bids": [ + { + "bidder": "inj1...", + "bidAmount": "1000000000", + "bidTimestamp": 1632150300 + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getAuctionsTemplate = ` +Extract details for retrieving multiple auctions. The response will provide: +- **auction** (array): List of auctions, each containing: + - **winner** (string): Address of the auction winner + - **basketList** (array): List of tokens in the basket + - **winningBidAmount** (string): Amount of the winning bid + - **round** (number): Auction round number + - **endTimestamp** (number): Unix timestamp when the auction ended + - **updatedAt** (number): Last update timestamp + +Provide the response in the following JSON format: + +\`\`\`json +[ + { + "winner": "inj1...", + "basketList": [ + { + "denom": "inj", + "amount": "1000000000" + } + ], + "winningBidAmount": "1000000000", + "round": 5, + "endTimestamp": 1632150400, + "updatedAt": 1632150400 + } +] +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgBidTemplate = ` +Extract the following details for placing a bid: +- **round** (number): The auction round number to bid in +- **amount** (string): The bid amount in INJ_DENOM + +Ensure that: +1. Round number is positive and exists in the system +2. Amount is positive and properly formatted +3. Amount is greater than the current highest bid plus minimum increment + +Provide the bid details in the following JSON format: + +\`\`\`json +{ + "round": 5, + "amount": "1000000000" +} +\`\`\` + +A successful response will include: +- **txHash** (string): The transaction hash +- **success** (boolean): Whether the bid was successful + +Response format: + +\`\`\`json +{ + "txHash": "0x...", + "success": true +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/auth.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/auth.ts new file mode 100644 index 00000000000..6fb8a639611 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/auth.ts @@ -0,0 +1,330 @@ +export const getAuthModuleParamsTemplate = ` +Extract the following details for auth module parameters: +- **maxMemoCharacters** (number): Maximum number of characters allowed in memo +- **txSigLimit** (number): Transaction signature limit +- **txSizeCostPerByte** (number): Cost per byte for transaction size +- **sigVerifyCostEd25519** (number): Cost for Ed25519 signature verification +- **sigVerifyCostSecp256k1** (number): Cost for Secp256k1 signature verification + +Provide the response in the following JSON format: + +\`\`\`json +{ + "maxMemoCharacters": 256, + "txSigLimit": 7, + "txSizeCostPerByte": 10, + "sigVerifyCostEd25519": 590, + "sigVerifyCostSecp256k1": 1000 +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getAccountDetailsTemplate = ` +Extract the following details for account information: +- **codeHash** (string): Hash of the account's code +- **baseAccount** (object): Base account information containing: + - **address** (string): Account address + - **pubKey** (object, optional): Public key information: + - **key** (string): The public key + - **typeUrl** (string): Type URL of the public key + - **accountNumber** (number): Account number + - **sequence** (number): Account sequence + +Provide the response in the following JSON format: + +\`\`\`json +{ + "codeHash": "0x...", + "baseAccount": { + "address": "inj1...", + "pubKey": { + "key": "key_string", + "typeUrl": "/cosmos.crypto.secp256k1.PubKey" + }, + "accountNumber": 12345, + "sequence": 67890 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getAccountsTemplate = ` +Extract the following details for multiple accounts: +- **pagination** (object): Pagination information containing: + - **nextKey** (string): Key for the next page + - **total** (number): Total number of items +- **accounts** (array): List of accounts, each containing: + - **codeHash** (string): Hash of the account's code + - **baseAccount** (object): Base account information + +Provide the response in the following JSON format: + +\`\`\`json +{ + "pagination": { + "nextKey": "next_page_key", + "total": 100 + }, + "accounts": [ + { + "codeHash": "0x...", + "baseAccount": { + "address": "inj1...", + "pubKey": { + "key": "key_string", + "typeUrl": "/cosmos.crypto.secp256k1.PubKey" + }, + "accountNumber": 12345, + "sequence": 67890 + } + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getGrantsTemplate = ` +Extract the following details for fetching grants: +- **pagination** (object, optional): Pagination options +- **granter** (string): Address of the granter +- **grantee** (string): Address of the grantee +- **msgTypeUrl** (string, optional): Type of message authorization + +Provide the request in the following JSON format: + +\`\`\`json +{ + "pagination": { + "key": "base64_encoded_key", + "offset": 0, + "limit": 100, + "reverse": false + }, + "granter": "inj1...", + "grantee": "inj1...", + "msgTypeUrl": "/cosmos.bank.v1beta1.MsgSend" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "pagination": { + "nextKey": "next_page_key", + "total": 100 + }, + "grants": [ + { + "authorization": { + "@type": "/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "/cosmos.bank.v1beta1.MsgSend" + }, + "authorizationType": "GenericAuthorization", + "expiration": "2024-12-31T23:59:59Z" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getGranterGrantsTemplate = ` +Extract the following details for fetching granter's grants: +- **granter** (string): Address of the granter +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "granter": "inj1...", + "pagination": { + "key": "base64_encoded_key", + "offset": 0, + "limit": 100, + "reverse": false + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "pagination": { + "nextKey": "next_page_key", + "total": 100 + }, + "grants": [ + { + "granter": "inj1...", + "grantee": "inj1...", + "authorization": { + "@type": "/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "/cosmos.bank.v1beta1.MsgSend" + }, + "authorizationType": "GenericAuthorization", + "expiration": "2024-12-31T23:59:59Z" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getGranteeGrantsTemplate = ` +Extract the following details for fetching grantee's grants: +- **grantee** (string): Address of the grantee +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "grantee": "inj1...", + "pagination": { + "key": "base64_encoded_key", + "offset": 0, + "limit": 100, + "reverse": false + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "pagination": { + "nextKey": "next_page_key", + "total": 100 + }, + "grants": [ + { + "granter": "inj1...", + "grantee": "inj1...", + "authorization": { + "@type": "/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "/cosmos.bank.v1beta1.MsgSend" + }, + "authorizationType": "GenericAuthorization", + "expiration": "2024-12-31T23:59:59Z" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgGrantTemplate = ` +Extract the following details for granting authorization: +- **messageType** (string): Type of message to authorize +- **grantee** (string): Address of the grantee +- **granter** (string): Address of the granter + +Provide the request in the following JSON format: + +\`\`\`json +{ + "messageType": "/cosmos.bank.v1beta1.MsgSend", + "grantee": "inj1...", + "granter": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "txHash": "0x...", + "success": true +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgExecTemplate = ` +Extract the following details for executing authorized messages: +- **grantee** (string): Address of the grantee executing the messages +- **msgs** (array): Array of messages to execute + +Provide the request in the following JSON format: + +\`\`\`json +{ + "grantee": "inj1...", + "msgs": [ + { + "@type": "/cosmos.bank.v1beta1.MsgSend", + "fromAddress": "inj1...", + "toAddress": "inj1...", + "amount": [ + { + "denom": "inj", + "amount": "1000000000" + } + ] + } + ] +} +\`\`\` + +Response format: + +\`\`\`json +{ + "txHash": "0x...", + "success": true +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgRevokeTemplate = ` +Extract the following details for revoking authorization: +- **messageType** (string): Type of message authorization to revoke +- **grantee** (string): Address of the grantee +- **granter** (string): Address of the granter + +Provide the request in the following JSON format: + +\`\`\`json +{ + "messageType": "/cosmos.bank.v1beta1.MsgSend", + "grantee": "inj1...", + "granter": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "txHash": "0x...", + "success": true +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/bank.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/bank.ts new file mode 100644 index 00000000000..2cdd091fd88 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/bank.ts @@ -0,0 +1,372 @@ +export const getBankModuleParamsTemplate = ` +Extract the following details for bank module parameters: +- **sendEnabledList** (array): List of send-enabled denominations containing: + - **denom** (string): Denomination + - **enabled** (boolean): Whether sending is enabled +- **defaultSendEnabled** (boolean): Default send enabled status + +Provide the response in the following JSON format: + +\`\`\`json +{ + "sendEnabledList": [ + { + "denom": "inj", + "enabled": true + } + ], + "defaultSendEnabled": true +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getBankBalanceTemplate = ` +Extract the following details for bank balance: +- **accountAddress** (string): Address of the account +- **denom** (string): Denomination to query + +Provide the request in the following JSON format: + +\`\`\`json +{ + "accountAddress": "inj1...", + "denom": "inj" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "denom": "inj", + "amount": "1000000000" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getBankBalancesTemplate = ` +Extract the following details for all bank balances: +- **accountAddress** (string): Address of the account +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "accountAddress": "inj1...", + "pagination": { + "key": "base64_encoded_key", + "offset": 0, + "limit": 100, + "reverse": false + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "balances": [ + { + "denom": "inj", + "amount": "1000000000" + } + ], + "pagination": { + "nextKey": "next_page_key", + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getTotalSupplyTemplate = ` +Extract total supply with optional pagination. + +Response format: + +\`\`\`json +{ + "supply": [ + { + "denom": "inj", + "amount": "1000000000000" + } + ], + "pagination": { + "nextKey": "next_page_key", + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getAllTotalSupplyTemplate = ` +Extract complete total supply for all denominations. + +Response format: + +\`\`\`json +{ + "supply": [ + { + "denom": "inj", + "amount": "1000000000000" + } + ], + "pagination": { + "nextKey": "next_page_key", + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getSupplyOfTemplate = ` +Extract the following details for supply of specific denomination: +- **denom** (string): Denomination to query + +Provide the request in the following JSON format: + +\`\`\`json +{ + "denom": "inj" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "denom": "inj", + "amount": "1000000000000" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDenomsMetadataTemplate = ` +Extract metadata for all denominations with optional pagination. + +Response format: + +\`\`\`json +{ + "metadatas": [ + { + "description": "The native staking token of the Injective blockchain", + "denom_units": [ + { + "denom": "inj", + "exponent": 0, + "aliases": ["inj"] + } + ], + "base": "inj", + "display": "inj", + "name": "Injective", + "symbol": "INJ" + } + ], + "pagination": { + "nextKey": "next_page_key", + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDenomMetadataTemplate = ` +Extract the following details for denomination metadata: +- **denom** (string): Denomination to query + +Provide the request in the following JSON format: + +\`\`\`json +{ + "denom": "inj" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "description": "The native staking token of the Injective blockchain", + "denom_units": [ + { + "denom": "inj", + "exponent": 0, + "aliases": ["inj"] + } + ], + "base": "inj", + "display": "inj", + "name": "Injective", + "symbol": "INJ" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDenomOwnersTemplate = ` +Extract the following details for denomination owners: +- **denom** (string): Denomination to query +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "denom": "inj", + "pagination": { + "key": "base64_encoded_key", + "offset": 0, + "limit": 100, + "reverse": false + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "denomOwners": [ + { + "address": "inj1...", + "balance": { + "denom": "inj", + "amount": "1000000000" + } + } + ], + "pagination": { + "nextKey": "next_page_key", + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgSendTemplate = ` +Extract the following details for sending tokens: +- **srcInjectiveAddress** (string): Source address +- **dstInjectiveAddress** (string): Destination address +- **amount** (object): Amount to send containing: + - **denom** (string): Token denomination + - **amount** (string): Token amount + +Provide the request in the following JSON format: + +\`\`\`json +{ + "srcInjectiveAddress": "inj1...", + "dstInjectiveAddress": "inj1...", + "amount": { + "denom": "inj", + "amount": "1000000000" + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "txHash": "0x...", + "success": true +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgMultiSendTemplate = ` +Extract the following details for multi-send transaction: +- **inputs** (array): List of input addresses and amounts +- **outputs** (array): List of output addresses and amounts + +Each input/output contains: +- **address** (string): Injective address +- **amount** (array): List of coins containing: + - **denom** (string): Token denomination + - **amount** (string): Token amount + +Provide the request in the following JSON format: + +\`\`\`json +{ + "inputs": [ + { + "address": "inj1...", + "coins": [ + { + "denom": "inj", + "amount": "1000000000" + } + ] + } + ], + "outputs": [ + { + "address": "inj1...", + "coins": [ + { + "denom": "inj", + "amount": "500000000" + } + ] + }, + { + "address": "inj1...", + "coins": [ + { + "denom": "inj", + "amount": "500000000" + } + ] + } + ] +} +\`\`\` + +Response format: + +\`\`\`json +{ + "txHash": "0x...", + "success": true +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/base.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/base.ts new file mode 100644 index 00000000000..c27ea1254aa --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/base.ts @@ -0,0 +1,31 @@ +// base-templates.ts +export const paginationParamsTemplate = ` +Extract pagination parameters: +- Pagination: {{pagination}} (PaginationOption?) - Optional pagination configuration + - Key: {{pagination.key}} (string?) - Optional pagination key + - Offset: {{pagination.offset}} (number?) - Optional offset + - Limit: {{pagination.limit}} (number?) - Optional limit + - Reverse: {{pagination.reverse}} (boolean?) - Optional reverse order flag +`; + +export const addressParamsTemplate = ` +Extract address parameters: +- Address: {{address}} (string) - Account address +`; + +export const timeRangeParamsTemplate = ` +Extract time range parameters: +- Start Time: {{startTime}} (number?) - Optional start timestamp +- End Time: {{endTime}} (number?) - Optional end timestamp +`; + +export const denomParamTemplate = ` +Extract denomination parameters: +- Denom: {{denom}} (string) - Token denomination +`; + +export const standardResponseTemplate = ` +Extract standard response structure: +- Success: {{success}} (boolean) - Operation success status +- Result: {{result}} (T) - Response data of generic type T +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/distribution.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/distribution.ts new file mode 100644 index 00000000000..194c748988c --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/distribution.ts @@ -0,0 +1,195 @@ +export const getDistributionModuleParamsTemplate = ` +Extract the following details for distribution module parameters: +- **communityTax** (string): Tax rate for community fund +- **baseProposerReward** (string): Base reward for block proposer +- **bonusProposerReward** (string): Bonus reward for block proposer +- **withdrawAddrEnabled** (boolean): Whether withdraw address modification is enabled + +Provide the response in the following JSON format: + +\`\`\`json +{ + "communityTax": "0.020000000000000000", + "baseProposerReward": "0.010000000000000000", + "bonusProposerReward": "0.040000000000000000", + "withdrawAddrEnabled": true +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDelegatorRewardsForValidatorTemplate = ` +Extract the following details for delegator rewards from specific validator: +- **delegatorAddress** (string): Address of the delegator +- **validatorAddress** (string): Address of the validator + +Provide the request in the following JSON format: + +\`\`\`json +{ + "delegatorAddress": "inj1...", + "validatorAddress": "injvaloper1..." +} +\`\`\` + +Response format: + +\`\`\`json +[ + { + "denom": "inj", + "amount": "1000000000" + } +] +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDelegatorRewardsForValidatorNoThrowTemplate = ` +Extract the following details for delegator rewards from specific validator (no-throw version): +- **delegatorAddress** (string): Address of the delegator +- **validatorAddress** (string): Address of the validator + +Provide the request in the following JSON format: + +\`\`\`json +{ + "delegatorAddress": "inj1...", + "validatorAddress": "injvaloper1..." +} +\`\`\` + +Response format: + +\`\`\`json +[ + { + "denom": "inj", + "amount": "1000000000" + } +] +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDelegatorRewardsTemplate = ` +Extract the following details for delegator rewards: +- **injectiveAddress** (string): Address of the delegator + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +[ + { + "validatorAddress": "injvaloper1...", + "rewards": [ + { + "denom": "inj", + "amount": "1000000000" + } + ] + } +] +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDelegatorRewardsNoThrowTemplate = ` +Extract the following details for delegator rewards (no-throw version): +- **injectiveAddress** (string): Address of the delegator + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +[ + { + "validatorAddress": "injvaloper1...", + "rewards": [ + { + "denom": "inj", + "amount": "1000000000" + } + ] + } +] +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgWithdrawDelegatorRewardTemplate = ` +Extract the following details for withdrawing delegator rewards: +- **delegatorAddress** (string): Address of the delegator +- **validatorAddress** (string): Address of the validator + +Provide the request in the following JSON format: + +\`\`\`json +{ + "delegatorAddress": "inj1...", + "validatorAddress": "injvaloper1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "txHash": "0x...", + "success": true +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgWithdrawValidatorCommissionTemplate = ` +Extract the following details for withdrawing validator commission: +- **validatorAddress** (string): Address of the validator + +Provide the request in the following JSON format: + +\`\`\`json +{ + "validatorAddress": "injvaloper1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "txHash": "0x...", + "success": true +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/exchange.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/exchange.ts new file mode 100644 index 00000000000..902510178ed --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/exchange.ts @@ -0,0 +1,3100 @@ +export const getAccountPortfolioTemplate = ` +Extract the following details for account portfolio: +- **address** (string): Account address + +Provide the request in the following JSON format: + +\`\`\`json +{ + "address": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "accountAddress": "inj1...", + "bankBalancesList": [ + { + "amount": "1000000", + "denom": "inj" + } + ], + "subaccountsList": [ + { + "subaccountId": "subaccount_id", + "denom": "inj", + "deposit": { + "totalBalance": "1000000", + "availableBalance": "900000" + } + } + ], + "positionsWithUpnlList": [ + { + "position": { + "marketId": "market_id", + "subaccountId": "subaccount_id", + "direction": "long", + "quantity": "1.5", + "entryPrice": "25000.5", + "margin": "1000", + "liquidationPrice": "24000.0", + "markPrice": "25100.0", + "ticker": "BTC/USDT" + }, + "unrealizedPnl": "150.75" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getSubaccountHistoryTemplate = ` +Extract the following details for subaccount history: +- **subaccountId** (string): Subaccount ID +- **denom** (string, optional): Token denomination +- **transferTypes** (string[], optional): Types of transfers to include +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "subaccountId": "subaccount_id", + "denom": "inj", + "transferTypes": ["deposit", "withdraw"], + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "transfers": [ + { + "transferType": "deposit", + "srcSubaccountId": "src_subaccount_id", + "srcSubaccountAddress": "inj1...", + "dstSubaccountId": "dst_subaccount_id", + "dstSubaccountAddress": "inj1...", + "amount": { + "amount": "1000000", + "denom": "inj" + }, + "executedAt": 1641859200 + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getSpotMarketTemplate = ` +Extract the following details for spot market lookup: +- **marketId** (string): Market ID + +Provide the request in the following JSON format: + +\`\`\`json +{ + "marketId": "market_id" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "marketId": "market_id", + "marketStatus": "active", + "ticker": "INJ/USDT", + "baseDenom": "inj", + "quoteDenom": "usdt", + "makerFeeRate": "0.001", + "takerFeeRate": "0.002", + "serviceProviderFee": "0.4", + "minPriceTickSize": 0.000001, + "minQuantityTickSize": 0.000001 +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDerivativeMarketTemplate = ` +Extract the following details for derivative market lookup: +- **marketId** (string): Market ID + +Provide the request in the following JSON format: + +\`\`\`json +{ + "marketId": "market_id" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "marketId": "market_id", + "marketStatus": "active", + "ticker": "BTC/USDT PERP", + "oracleBase": "BTC", + "oracleQuote": "USDT", + "quoteDenom": "usdt", + "makerFeeRate": "0.001", + "takerFeeRate": "0.002", + "serviceProviderFee": "0.4", + "initialMarginRatio": "0.05", + "maintenanceMarginRatio": "0.02", + "isPerpetual": true, + "minPriceTickSize": 0.01, + "minQuantityTickSize": 0.001 +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getExchangePositionsTemplate = ` +Extract the exchange module's open positions +Response format: + +\`\`\`json +{ + "positions": [ + { + "marketId": "market_id", + "subaccountId": "subaccount_id", + "direction": "long", + "quantity": "1.5", + "entryPrice": "25000.5", + "margin": "1000", + "liquidationPrice": "24000.0", + "markPrice": "25100.0", + "ticker": "BTC/USDT" + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getExchangeInsuranceFundsTemplate = ` +Extract insurance funds information. + +Response format: + +\`\`\`json +{ + "funds": [ + { + "depositDenom": "inj", + "insurancePoolTokenDenom": "insurance_pool_token", + "redemptionNoticePeriodDuration": 1209600, + "balance": "1000000", + "totalShare": "1000000", + "marketId": "market_id", + "marketTicker": "BTC/USDT PERP", + "oracleBase": "BTC", + "oracleQuote": "USDT", + "oracleType": "band", + "expiry": 0 + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getRedemptionsTemplate = ` +Extract the following details for redemptions query: +- **address** (string): Account address +- **denom** (string, optional): Token denomination +- **status** (string, optional): Redemption status + +Provide the request in the following JSON format: + +\`\`\`json +{ + "address": "inj1...", + "denom": "inj", + "status": "pending" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "redemptions": [ + { + "redemptionId": 1, + "status": "pending", + "redeemer": "inj1...", + "claimableRedemptionTime": 1641859200, + "redemptionAmount": "1000000", + "redemptionDenom": "inj", + "requestedAt": 1641772800, + "disbursedAmount": "0", + "disbursedDenom": "", + "disbursedAt": 0 + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getSpotOrdersTemplate = ` +Extract the following details for spot orders query: +- **marketId** (string, optional): Market ID filter +- **marketIds** (string[], optional): Multiple market IDs filter +- **subaccountId** (string, optional): Subaccount ID filter +- **orderSide** (string, optional): Order side (buy/sell) +- **isConditional** (boolean, optional): Whether order is conditional +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "marketId": "market_id", + "marketIds": ["market_id1", "market_id2"], + "subaccountId": "subaccount_id", + "orderSide": "buy", + "isConditional": false, + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "orders": [ + { + "orderHash": "0x...", + "orderSide": "buy", + "marketId": "market_id", + "subaccountId": "subaccount_id", + "price": "25000.5", + "quantity": "1.5", + "unfilledQuantity": "0.5", + "triggerPrice": "0", + "feeRecipient": "inj1...", + "state": "booked", + "createdAt": 1641859200, + "updatedAt": 1641859200 + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDerivativeOrdersTemplate = ` +Extract the following details for derivative orders query: +- **marketId** (string, optional): Market ID filter +- **marketIds** (string[], optional): Multiple market IDs filter +- **subaccountId** (string, optional): Subaccount ID filter +- **orderSide** (string, optional): Order side (buy/sell) +- **isConditional** (boolean, optional): Whether order is conditional +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "marketId": "market_id", + "marketIds": ["market_id1", "market_id2"], + "subaccountId": "subaccount_id", + "orderSide": "buy", + "isConditional": false, + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "orders": [ + { + "orderHash": "0x...", + "orderSide": "buy", + "marketId": "market_id", + "subaccountId": "subaccount_id", + "margin": "1000", + "price": "25000.5", + "quantity": "1.5", + "unfilledQuantity": "0.5", + "triggerPrice": "0", + "feeRecipient": "inj1...", + "state": "booked", + "createdAt": 1641859200, + "updatedAt": 1641859200 + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getHistoricalTradesTemplate = ` +Extract the following details for historical trades query: +- **marketId** (string, optional): Market ID filter +- **marketIds** (string[], optional): Multiple market IDs filter +- **subaccountId** (string, optional): Subaccount ID filter +- **endTime** (number, optional): End timestamp +- **startTime** (number, optional): Start timestamp +- **direction** (string, optional): Trade direction +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "marketId": "market_id", + "marketIds": ["market_id1", "market_id2"], + "subaccountId": "subaccount_id", + "endTime": 1641945600, + "startTime": 1641859200, + "direction": "buy", + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "trades": [ + { + "orderHash": "0x...", + "subaccountId": "subaccount_id", + "marketId": "market_id", + "tradeId": "trade_id", + "executedAt": 1641859200, + "tradeExecutionType": "limit", + "tradeDirection": "buy", + "executionPrice": "25000.5", + "executionQuantity": "1.5", + "fee": "0.5", + "feeRecipient": "inj1..." + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getFundingRatesTemplate = ` +Extract the following details for funding rates query: +- **marketId** (string, optional): Market ID filter +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "marketId": "market_id", + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "fundingRates": [ + { + "marketId": "market_id", + "rate": "0.0001", + "timestamp": 1641859200 + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Account & Portfolio Related Templates +export const msgDepositTemplate = ` +Extract the following details for deposit: +- **injectiveAddress** (string): Injective sender address +- **subaccountId** (string): Subaccount ID to deposit to +- **amount** (string): Amount to deposit + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "subaccountId": "0x...", + "amount": "1000000" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgWithdrawTemplate = ` +Extract the following details for withdrawal: +- **injectiveAddress** (string): Injective sender address +- **subaccountId** (string): Subaccount ID to withdraw from +- **amount** (string): Amount to withdraw + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "subaccountId": "0x...", + "amount": "1000000" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Order Related Templates +export const msgCreateSpotMarketOrderTemplate = ` +Extract the following details for creating spot market order: +- **marketId** (string): Market ID +- **subaccountId** (string): Subaccount ID +- **injectiveAddress** (string): Injective sender address +- **orderType** (string): Order type (BUY/SELL) +- **price** (string): Order price +- **quantity** (string): Order quantity + +Provide the request in the following JSON format: + +\`\`\`json +{ + "marketId": "0x...", + "subaccountId": "0x...", + "injectiveAddress": "inj1...", + "orderType": "BUY", + "price": "25000.5", + "quantity": "0.5" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "orderHash": "0x...", + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgCreateDerivativeMarketOrderTemplate = ` +Extract the following details for creating derivative market order: +- **marketId** (string): Market ID +- **subaccountId** (string): Subaccount ID +- **injectiveAddress** (string): Injective sender address +- **orderType** (string): Order type (BUY/SELL) +- **price** (string): Order price +- **quantity** (string): Order quantity +- **margin** (string): Order margin +- **leverage** (string): Order leverage + +Provide the request in the following JSON format: + +\`\`\`json +{ + "marketId": "0x...", + "subaccountId": "0x...", + "injectiveAddress": "inj1...", + "orderType": "BUY", + "price": "25000.5", + "quantity": "0.5", + "margin": "1000", + "leverage": "10" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "orderHash": "0x...", + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgBatchCancelOrdersTemplate = ` +Extract the following details for batch canceling orders: +- **injectiveAddress** (string): Injective sender address +- **orders** (array): List of orders to cancel containing: + - marketId (string) + - subaccountId (string) + - orderHash (string) + - orderMask (number) + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "orders": [ + { + "marketId": "0x...", + "subaccountId": "0x...", + "orderHash": "0x...", + "orderMask": 1 + } + ] +} +\`\`\` + +Response format: + +\`\`\`json +{ + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgBatchUpdateOrdersTemplate = ` +Extract the following details for batch updating orders: +- **injectiveAddress** (string): Injective sender address +- **spotOrders** (array, optional): List of spot orders to update +- **derivativeOrders** (array, optional): List of derivative orders to update +Each order contains: + - marketId (string) + - subaccountId (string) + - orderHash (string, optional) + - orderType (string) + - price (string) + - quantity (string) + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "spotOrders": [ + { + "marketId": "0x...", + "subaccountId": "0x...", + "orderHash": "0x...", + "orderType": "BUY", + "price": "25000.5", + "quantity": "0.5" + } + ], + "derivativeOrders": [ + { + "marketId": "0x...", + "subaccountId": "0x...", + "orderHash": "0x...", + "orderType": "SELL", + "price": "25100.5", + "quantity": "1.0" + } + ] +} +\`\`\` + +Response format: + +\`\`\`json +{ + "spotOrderHashes": ["0x..."], + "derivativeOrderHashes": ["0x..."], + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgExternalTransferTemplate = ` +Extract the following details for external transfer: +- **injectiveAddress** (string): Injective sender address +- **sourceSubaccountId** (string): Source subaccount ID +- **destinationSubaccountId** (string): Destination subaccount ID +- **amount** (string): Amount to transfer + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "sourceSubaccountId": "0x...", + "destinationSubaccountId": "0x...", + "amount": "1000000" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgIncreasePositionMarginTemplate = ` +Extract the following details for increasing position margin: +- **injectiveAddress** (string): Injective sender address +- **marketId** (string): Market ID +- **sourceSubaccountId** (string): Source subaccount ID +- **destinationSubaccountId** (string): Destination subaccount ID +- **amount** (string): Margin amount to add + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "marketId": "0x...", + "sourceSubaccountId": "0x...", + "destinationSubaccountId": "0x...", + "amount": "1000000" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgRewardsOptOutTemplate = ` +Extract the following details for opting out of rewards: +- **injectiveAddress** (string): Injective sender address + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Admin Related Templates +export const msgAdminUpdateBinaryOptionsMarketTemplate = ` +Extract the following details for admin updating binary options market: +- **injectiveAddress** (string): Admin injective address +- **marketId** (string): Market ID +- **settlementPrice** (string): Settlement price +- **expiryTime** (number): Expiry timestamp +- **settlementTime** (number): Settlement timestamp + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "marketId": "0x...", + "settlementPrice": "25000.5", + "expiryTime": 1641859200, + "settlementTime": 1641945600 +} +\`\`\` + +Response format: + +\`\`\`json +{ + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Module State & Parameters +export const getModuleStateTemplate = ` +Extract module state information. + +Response format: + +\`\`\`json +{ + "moduleState": { + "params": { + "spotMarketInstantListingFee": { + "amount": "100000000", + "denom": "inj" + }, + "derivativeMarketInstantListingFee": { + "amount": "1000000000", + "denom": "inj" + }, + "defaultSpotMakerFeeRate": "0.001", + "defaultSpotTakerFeeRate": "0.002", + "defaultDerivativeMakerFeeRate": "0.001", + "defaultDerivativeTakerFeeRate": "0.002", + "defaultInitialMarginRatio": "0.05", + "defaultMaintenanceMarginRatio": "0.02", + "defaultFundingInterval": 3600, + "fundingMultiple": 3600 + }, + "spotMarkets": [], + "derivativeMarkets": [], + "spotOrderbooks": [], + "derivativeOrderbooks": [], + "balances": [], + "positions": [] + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getFeeDiscountScheduleTemplate = ` +Extract fee discount schedule information. + +Response format: + +\`\`\`json +{ + "bucketCount": 10, + "bucketDuration": 1209600, + "quoteDenomsList": ["inj"], + "tierInfosList": [ + { + "makerDiscountRate": "0.001", + "takerDiscountRate": "0.001", + "stakedAmount": "10000000000", + "volume": "100000000" + } + ], + "disqualifiedMarketIdsList": [] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getFeeDiscountAccountInfoTemplate = ` +Extract the following details for fee discount account info: +- **injAddress** (string): Injective address + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "tierLevel": 1, + "accountInfo": { + "makerDiscountRate": "0.001", + "takerDiscountRate": "0.001", + "stakedAmount": "10000000000", + "volume": "100000000" + }, + "accountTtl": { + "tier": 1, + "ttlTimestamp": 1641945600 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Trading Rewards +export const getTradingRewardsCampaignTemplate = ` +Extract trading rewards campaign information. + +Response format: + +\`\`\`json +{ + "tradingRewardCampaignInfo": { + "campaignDurationSeconds": 604800, + "quoteDenomsList": ["inj"], + "tradingRewardBoostInfo": { + "boostedSpotMarketIdsList": [], + "spotMarketMultipliersList": [], + "boostedDerivativeMarketIdsList": [], + "derivativeMarketMultipliersList": [] + }, + "disqualifiedMarketIdsList": [] + }, + "tradingRewardPoolCampaignScheduleList": [ + { + "startTimestamp": 1641859200, + "maxCampaignRewardsList": [ + { + "amount": "1000000000", + "denom": "inj" + } + ] + } + ], + "totalTradeRewardPoints": "1000000", + "pendingTradingRewardPoolCampaignScheduleList": [], + "pendingTotalTradeRewardPointsList": [] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getTradeRewardPointsTemplate = ` +Extract the following details for trade reward points: +- **injectiveAddresses** (string[]): List of Injective addresses + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddresses": ["inj1...", "inj2..."] +} +\`\`\` + +Response format: + +\`\`\`json +{ + "rewardPoints": ["100", "200"] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getPendingTradeRewardPointsTemplate = ` +Extract the following details for pending trade reward points: +- **injectiveAddresses** (string[]): List of Injective addresses + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddresses": ["inj1...", "inj2..."] +} +\`\`\` + +Response format: + +\`\`\`json +{ + "rewardPoints": ["100", "200"] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Binary Options Markets +export const msgCreateBinaryOptionsMarketTemplate = ` +Extract the following details for creating binary options market: +- **oracle** (string): Oracle provider +- **symbol** (string): Trading symbol +- **expiryTime** (number): Market expiry timestamp +- **settlementTime** (number): Settlement timestamp +- **admin** (string): Admin address +- **quoteDenom** (string): Quote denomination +- **minPriceTickSize** (string): Minimum price tick size +- **minQuantityTickSize** (string): Minimum quantity tick size + +Provide the request in the following JSON format: + +\`\`\`json +{ + "oracle": "band", + "symbol": "BTC/USD", + "expiryTime": 1641945600, + "settlementTime": 1641945600, + "admin": "inj1...", + "quoteDenom": "inj", + "minPriceTickSize": "0.000001", + "minQuantityTickSize": "0.000001" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "marketId": "0x...", + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Subaccount Trade Nonce +export const getSubaccountTradeNonceTemplate = ` +Extract the following details for subaccount trade nonce: +- **subaccountId** (string): Subaccount ID + +Provide the request in the following JSON format: + +\`\`\`json +{ + "subaccountId": "subaccount_id" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "nonce": 5 +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Position History +export const getPositionsV2Template = ` +Extract the following details for positions V2 query: +- **address** (string, optional): Account address +- **marketId** (string, optional): Market ID +- **marketIds** (string[], optional): Multiple market IDs +- **subaccountId** (string, optional): Subaccount ID +- **direction** (string, optional): Position direction +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "address": "inj1...", + "marketId": "market_id", + "marketIds": ["market_id1", "market_id2"], + "subaccountId": "subaccount_id", + "direction": "long", + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "positions": [ + { + "marketId": "market_id", + "subaccountId": "subaccount_id", + "direction": "long", + "quantity": "1.5", + "entryPrice": "25000.5", + "margin": "1000", + "liquidationPrice": "24000.0", + "markPrice": "25100.0", + "ticker": "BTC/USDT", + "aggregateReduceOnlyQuantity": "0", + "updatedAt": 1641859200 + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Historical Data +export const getHistoricalBalanceTemplate = ` +Extract the following details for historical balance: +- **account** (string): Account address +- **resolution** (string): Time resolution for data points + +Provide the request in the following JSON format: + +\`\`\`json +{ + "account": "inj1...", + "resolution": "1d" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "t": [1641859200, 1641945600], + "v": [1000.5, 1100.75] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Denom Holders +export const getDenomHoldersTemplate = ` +Extract the following details for denom holders: +- **denom** (string): Token denomination +- **token** (string, optional): Token address +- **limit** (number, optional): Number of results + +Provide the request in the following JSON format: + +\`\`\`json +{ + "denom": "inj", + "token": "0x...", + "limit": 100 +} +\`\`\` + +Response format: + +\`\`\`json +{ + "holders": [ + { + "accountAddress": "inj1...", + "balance": "1000000" + } + ], + "next": ["next_key"] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Grid Strategies +export const getGridStrategiesTemplate = ` +Extract the following details for grid strategies: +- **skip** (number, optional): Number of items to skip +- **limit** (number, optional): Number of items to return +- **state** (string, optional): Strategy state +- **marketId** (string, optional): Market ID +- **marketType** (string, optional): Market type +- **strategyType** (string[], optional): Strategy types +- **subaccountId** (string, optional): Subaccount ID +- **accountAddress** (string, optional): Account address + +Provide the request in the following JSON format: + +\`\`\`json +{ + "skip": 0, + "limit": 100, + "state": "active", + "marketId": "market_id", + "marketType": "spot", + "strategyType": ["uniform"], + "subaccountId": "subaccount_id", + "accountAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "strategies": [ + { + "id": "strategy_id", + "accountAddress": "inj1...", + "subaccountId": "subaccount_id", + "marketId": "market_id", + "strategyType": "uniform", + "tickSize": "0.1", + "minPrice": "24000.0", + "maxPrice": "26000.0", + "gridCount": 20, + "state": "active", + "totalVolume": "100000.5", + "currentPnL": "1000.25", + "createdAt": 1641859200, + "updatedAt": 1641945600 + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Instant Market Launch +export const msgInstantSpotMarketLaunchTemplate = ` +Extract the following details for instant spot market launch: +- **ticker** (string): Market ticker +- **baseDenom** (string): Base denomination +- **quoteDenom** (string): Quote denomination +- **minPriceTickSize** (string): Minimum price tick size +- **minQuantityTickSize** (string): Minimum quantity tick size + +Provide the request in the following JSON format: + +\`\`\`json +{ + "ticker": "INJ/USDT", + "baseDenom": "inj", + "quoteDenom": "usdt", + "minPriceTickSize": "0.000001", + "minQuantityTickSize": "0.000001" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "marketId": "0x...", + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getModuleParamsTemplate = ` +Extract module parameters information. + +Response format: + +\`\`\`json +{ + "spotMarketInstantListingFee": { + "amount": "100000000", + "denom": "inj" + }, + "derivativeMarketInstantListingFee": { + "amount": "1000000000", + "denom": "inj" + }, + "defaultSpotMakerFeeRate": "0.001", + "defaultSpotTakerFeeRate": "0.002", + "defaultDerivativeMakerFeeRate": "0.001", + "defaultDerivativeTakerFeeRate": "0.002", + "defaultInitialMarginRatio": "0.05", + "defaultMaintenanceMarginRatio": "0.02", + "defaultFundingInterval": 3600, + "fundingMultiple": 3600, + "relayerFeeShareRate": "0.4", + "exchangeModuleAdmin": "inj1..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getOrderStatesTemplate = ` +Extract the following details for order states: +- **spotOrderHashes** (string[], optional): Spot order hashes +- **derivativeOrderHashes** (string[], optional): Derivative order hashes + +Provide the request in the following JSON format: + +\`\`\`json +{ + "spotOrderHashes": ["0x..."], + "derivativeOrderHashes": ["0x..."] +} +\`\`\` + +Response format: + +\`\`\`json +{ + "spotOrderStates": { + "orderHash": "OrderState" + }, + "derivativeOrderStates": { + "orderHash": "OrderState" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getSubaccountOrderSummaryTemplate = ` +Extract the following details for subaccount order summary: +- **subaccountId** (string): Subaccount ID +- **marketId** (string, optional): Market ID filter +- **orderDirection** (string, optional): Order direction filter + +Provide the request in the following JSON format: + +\`\`\`json +{ + "subaccountId": "0x...", + "marketId": "0x...", + "orderDirection": "buy" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "spotOrdersTotal": "10", + "derivativeOrdersTotal": "5", + "spotOrdersActiveTotal": "3", + "derivativeOrdersActiveTotal": "2", + "spotOrdersCancelledTotal": "5", + "derivativeOrdersCancelledTotal": "2", + "spotOrdersFilledTotal": "2", + "derivativeOrdersFilledTotal": "1" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDerivativeMarketsTemplate = ` +Extract the following details for derivative markets: +- **quoteDenom** (string, optional): Quote denomination filter, this needs to be in denom format! +- **marketStatus** (string, optional): Market status filter +- **marketStatuses** (string[], optional): Multiple market status filter + +Provide the request in the following JSON format: + +\`\`\`json +{ + "quoteDenom": "peggy0xdAC17F958D2ee523a2206206994597C13D831ec7", + "marketStatus": "active", + "marketStatuses": ["active", "paused"] +} +\`\`\` + +Response format: + +\`\`\`json +{ + "markets": [ + { + "marketId": "0x...", + "marketStatus": "active", + "ticker": "BTC/USDT PERP", + "oracleBase": "BTC", + "oracleQuote": "USDT", + "quoteDenom": "usdt", + "makerFeeRate": "0.001", + "takerFeeRate": "0.002", + "serviceProviderFee": "0.4", + "isPerpetual": true, + "minPriceTickSize": 0.01, + "minQuantityTickSize": 0.001 + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getSpotMarketsTemplate = ` +Extract the following details for spot markets: +- **baseDenom** (string, optional): Base denomination filter +- **quoteDenom** (string, optional): Quote denomination filter +- **marketStatus** (string, optional): Market status filter +- **marketStatuses** (string[], optional): Multiple market status filter + +Provide the request in the following JSON format: + +\`\`\`json +{ + "baseDenom": "inj", + "quoteDenom": "peggy0xdAC17F958D2ee523a2206206994597C13D831ec7", + "marketStatus": "active", + "marketStatuses": ["active", "paused"] +} +\`\`\` + +Response format: + +\`\`\`json +{ + "markets": [ + { + "marketId": "0x...", + "marketStatus": "active", + "ticker": "INJ/USDT", + "baseDenom": "inj", + "quoteDenom": "usdt", + "makerFeeRate": "0.001", + "takerFeeRate": "0.002", + "serviceProviderFee": "0.4", + "minPriceTickSize": 0.000001, + "minQuantityTickSize": 0.000001 + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getSubaccountsListTemplate = ` +Extract the following details for subaccounts list: +- **address** (string): Account address + +Provide the request in the following JSON format: + +\`\`\`json +{ + "address": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "subaccounts": ["0x..."] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getSubaccountBalancesListTemplate = ` +Extract the following details for subaccount balances: +- **subaccountId** (string): Subaccount ID + +Provide the request in the following JSON format: + +\`\`\`json +{ + "subaccountId": "0x..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "balances": [ + { + "subaccountId": "0x...", + "accountAddress": "inj1...", + "denom": "inj", + "deposit": { + "totalBalance": "1000000", + "availableBalance": "900000" + } + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getOrderbooksV2Template = ` +Extract the following details for orderbooks V2: +- **marketIds** (string[]): List of market IDs + +Provide the request in the following JSON format: + +\`\`\`json +{ + "marketIds": ["0x..."] +} +\`\`\` + +Response format: + +\`\`\`json +{ + "orderbooks": [ + { + "marketId": "0x...", + "orderbook": { + "sequence": "123", + "buys": [ + { + "price": "25000.5", + "quantity": "1.5", + "timestamp": 1641859200 + } + ], + "sells": [ + { + "price": "25100.5", + "quantity": "0.5", + "timestamp": 1641859200 + } + ] + } + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getTradingRewardsTemplate = ` +Extract the following details for trading rewards: +- **address** (string): Account address +- **epoch** (number): Reward epoch + +Provide the request in the following JSON format: + +\`\`\`json +{ + "address": "inj1...", + "epoch": 1 +} +\`\`\` + +Response format: + +\`\`\`json +{ + "rewards": [ + { + "accountAddress": "inj1...", + "rewards": [ + { + "amount": "1000000", + "denom": "inj" + } + ], + "distributedAt": 1641859200 + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getHistoricalRpnlTemplate = ` +Extract the following details for historical RPNL: +- **account** (string): Account address +- **resolution** (string): Time resolution for data points + +Provide the request in the following JSON format: + +\`\`\`json +{ + "account": "inj1...", + "resolution": "1d" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "t": [1641859200, 1641945600], + "v": [1000.5, 1100.75] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getHistoricalVolumesTemplate = ` +Extract the following details for historical volumes: +- **account** (string): Account address +- **resolution** (string): Time resolution for data points + +Provide the request in the following JSON format: + +\`\`\`json +{ + "account": "inj1...", + "resolution": "1d" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "t": [1641859200, 1641945600], + "v": [50000.5, 75000.25] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getFundingPaymentsTemplate = ` +Extract the following details for funding payments: +- **marketId** (string, optional): Market ID filter +- **marketIds** (string[], optional): Multiple market IDs filter +- **subaccountId** (string, optional): Subaccount ID filter +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "marketId": "0x...", + "marketIds": ["0x..."], + "subaccountId": "0x...", + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "fundingPayments": [ + { + "marketId": "0x...", + "subaccountId": "0x...", + "amount": "100.5", + "timestamp": 1641859200 + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getPnlLeaderboardTemplate = ` +Extract the following details for PnL leaderboard: +- **startDate** (string): Start date +- **endDate** (string): End date +- **limit** (number, optional): Number of results +- **account** (string, optional): Account address filter + +Provide the request in the following JSON format: + +\`\`\`json +{ + "startDate": "2024-01-01", + "endDate": "2024-01-31", + "limit": 100, + "account": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "firstDate": "2024-01-01", + "lastDate": "2024-01-31", + "leaders": [ + { + "account": "inj1...", + "pnl": 100000.5, + "volume": 1000000.0, + "rank": 1 + } + ], + "accountRow": { + "account": "inj1...", + "pnl": 50000.25, + "volume": 500000.0, + "rank": 10 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getVolLeaderboardTemplate = ` +Extract the following details for volume leaderboard: +- **startDate** (string): Start date +- **endDate** (string): End date +- **limit** (number, optional): Number of results +- **account** (string, optional): Account address filter + +Provide the request in the following JSON format: + +\`\`\`json +{ + "startDate": "2024-01-01", + "endDate": "2024-01-31", + "limit": 100, + "account": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "firstDate": "2024-01-01", + "lastDate": "2024-01-31", + "leaders": [ + { + "account": "inj1...", + "volume": 1000000.0, + "rank": 1 + } + ], + "accountRow": { + "account": "inj1...", + "volume": 500000.0, + "rank": 10 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getPnlLeaderboardFixedResolutionTemplate = ` +Extract the following details for PnL leaderboard with fixed resolution: +- **resolution** (string): Time resolution +- **limit** (number, optional): Number of results +- **account** (string, optional): Account address filter + +Provide the request in the following JSON format: + +\`\`\`json +{ + "resolution": "1d", + "limit": 100, + "account": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "firstDate": "2024-01-01", + "lastDate": "2024-01-31", + "leaders": [ + { + "account": "inj1...", + "pnl": 100000.5, + "volume": 1000000.0, + "rank": 1 + } + ], + "accountRow": { + "account": "inj1...", + "pnl": 50000.25, + "volume": 500000.0, + "rank": 10 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getVolLeaderboardFixedResolutionTemplate = ` +Extract the following details for volume leaderboard with fixed resolution: +- **resolution** (string): Time resolution +- **limit** (number, optional): Number of results +- **account** (string, optional): Account address filter + +Provide the request in the following JSON format: + +\`\`\`json +{ + "resolution": "1d", + "limit": 100, + "account": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "firstDate": "2024-01-01", + "lastDate": "2024-01-31", + "leaders": [ + { + "account": "inj1...", + "volume": 1000000.0, + "rank": 1 + } + ], + "accountRow": { + "account": "inj1...", + "volume": 500000.0, + "rank": 10 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getAtomicSwapHistoryTemplate = ` +Extract the following details for atomic swap history: +- **address** (string): Account address +- **contractAddress** (string): Contract address +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "address": "inj1...", + "contractAddress": "0x...", + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "swapHistory": [ + { + "sender": "inj1...", + "route": "route_id", + "sourceCoin": { + "amount": "1000000", + "denom": "inj" + }, + "destinationCoin": { + "amount": "900000", + "denom": "usdt" + }, + "fees": [ + { + "amount": "1000", + "denom": "inj" + } + ], + "contractAddress": "0x...", + "indexBySender": 1, + "indexBySenderContract": 1, + "txHash": "0x...", + "executedAt": 1641859200 + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getIsOptedOutOfRewardsTemplate = ` +Extract the following details for rewards opt-out status: +- **account** (string): Account address + +Provide the request in the following JSON format: + +\`\`\`json +{ + "account": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "isOptedOut": true +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getBinaryOptionsMarketsTemplate = ` +Extract the following details for binary options markets: +- **marketStatus** (string, optional): Market status filter +- **quoteDenom** (string, optional): Quote denomination filter +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "marketStatus": "active", + "quoteDenom": "usdt", + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "markets": [ + { + "marketId": "0x...", + "marketStatus": "active", + "ticker": "BTC>25000-240630", + "oracleSymbol": "BTC", + "oracleProvider": "band", + "oracleScaleFactor": 6, + "quoteDenom": "usdt", + "makerFeeRate": "0.001", + "takerFeeRate": "0.002", + "expirationTimestamp": 1719705600, + "settlementTimestamp": 1719792000, + "serviceProviderFee": "0.4", + "minPriceTickSize": 0.01, + "minQuantityTickSize": 0.001 + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getBinaryOptionsMarketTemplate = ` +Extract the following details for binary options market lookup: +- **marketId** (string): Market ID + +Provide the request in the following JSON format: + +\`\`\`json +{ + "marketId": "0x..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "market": { + "marketId": "0x...", + "marketStatus": "active", + "ticker": "BTC>25000-240630", + "oracleSymbol": "BTC", + "oracleProvider": "band", + "oracleScaleFactor": 6, + "quoteDenom": "usdt", + "makerFeeRate": "0.001", + "takerFeeRate": "0.002", + "expirationTimestamp": 1719705600, + "settlementTimestamp": 1719792000, + "serviceProviderFee": "0.4", + "minPriceTickSize": 0.01, + "minQuantityTickSize": 0.001 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDerivativeOrderHistoryTemplate = ` +Extract the following details for derivative order history: +- **subaccountId** (string, optional): Subaccount ID filter +- **marketId** (string, optional): Market ID filter +- **marketIds** (string[], optional): Multiple market IDs filter +- **orderTypes** (string[], optional): Order types filter +- **executionTypes** (string[], optional): Execution types filter +- **direction** (string, optional): Order direction filter +- **isConditional** (boolean, optional): Whether order is conditional +- **state** (string, optional): Order state filter +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "subaccountId": "0x...", + "marketId": "0x...", + "marketIds": ["0x..."], + "orderTypes": ["limit", "market"], + "executionTypes": ["limit", "market"], + "direction": "buy", + "isConditional": false, + "state": "booked", + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "orderHistory": [ + { + "orderHash": "0x...", + "marketId": "0x...", + "isActive": true, + "subaccountId": "0x...", + "executionType": "limit", + "orderType": "buy", + "price": "25000.5", + "triggerPrice": "0", + "quantity": "1.5", + "filledQuantity": "0.5", + "state": "booked", + "createdAt": 1641859200, + "updatedAt": 1641859200, + "direction": "buy", + "isConditional": false, + "triggerAt": 0, + "margin": "1000" + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getPositionsListTemplate = ` +Extract the following details for positions list: +- **marketId** (string, optional): Market ID filter +- **marketIds** (string[], optional): Multiple market IDs filter +- **subaccountId** (string, optional): Subaccount ID filter +- **direction** (string, optional): Position direction filter +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "marketId": "0x...", + "marketIds": ["0x..."], + "subaccountId": "0x...", + "direction": "long", + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "positions": [ + { + "marketId": "0x...", + "subaccountId": "0x...", + "direction": "long", + "quantity": "1.5", + "entryPrice": "25000.5", + "margin": "1000", + "liquidationPrice": "24000.0", + "markPrice": "25100.0", + "ticker": "BTC/USDT" + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDerivativeTradesTemplate = ` +Extract the following details for derivative trades: +- **marketId** (string, optional): Market ID filter +- **marketIds** (string[], optional): Multiple market IDs filter +- **subaccountId** (string, optional): Subaccount ID filter +- **executionSide** (string, optional): Execution side filter +- **direction** (string, optional): Trade direction filter +- **executionTypes** (string[], optional): Execution types filter +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "marketId": "0x...", + "marketIds": ["0x..."], + "subaccountId": "0x...", + "executionSide": "taker", + "direction": "buy", + "executionTypes": ["market", "limit"], + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "trades": [ + { + "orderHash": "0x...", + "subaccountId": "0x...", + "marketId": "0x...", + "tradeId": "trade_id", + "executedAt": 1641859200, + "tradeExecutionType": "market", + "executionSide": "taker", + "tradeDirection": "buy", + "executionPrice": "25000.5", + "executionQuantity": "1.5", + "executionMargin": "1000", + "fee": "25.0", + "feeRecipient": "inj1...", + "isLiquidation": false, + "payout": "37525.75" + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDerivativeSubaccountOrdersListTemplate = ` +Extract the following details for derivative subaccount orders: +- **subaccountId** (string): Subaccount ID +- **marketId** (string, optional): Market ID filter +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "subaccountId": "0x...", + "marketId": "0x...", + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "orders": [ + { + "orderHash": "0x...", + "orderSide": "buy", + "marketId": "0x...", + "subaccountId": "0x...", + "isReduceOnly": false, + "margin": "1000", + "price": "25000.5", + "quantity": "1.5", + "unfilledQuantity": "0.5", + "triggerPrice": "0", + "feeRecipient": "inj1...", + "state": "booked", + "createdAt": 1641859200, + "updatedAt": 1641859200, + "orderNumber": 1, + "orderType": "limit", + "isConditional": false, + "triggerAt": 0, + "placedOrderHash": "0x...", + "executionType": "limit" + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getOrderbookTemplate = ` +Extract the following details for orderbooks: +- **marketIds** (string[]): Market IDs + +Provide the request in the following JSON format: + +\`\`\`json +{ + "marketIds": ["0x..."] +} +\`\`\` + +Response format: + +\`\`\`json +{ + "orderbook": [ + "marketId": "0x...", + "orderbook": { + "sequence": "123", + "buys": [ + { + "price": "25000.5", + "quantity": "1.5", + "timestamp": 1641859200 + } + ], + "sells": [ + { + "price": "25100.5", + "quantity": "0.5", + "timestamp": 1641859200 + } + ] + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgBatchCancelBinaryOptionsOrdersTemplate = ` +Extract the following details for batch canceling binary options orders: +- **injectiveAddress** (string): Injective sender address +- **orders** (array): List of orders to cancel containing: + - marketId (string) + - subaccountId (string) + - orderHash (string) + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "orders": [ + { + "marketId": "0x...", + "subaccountId": "0x...", + "orderHash": "0x..." + } + ] +} +\`\`\` + +Response format: + +\`\`\`json +{ + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgCancelBinaryOptionsOrderTemplate = ` +Extract the following details for canceling a binary options order: +- **injectiveAddress** (string): Injective sender address +- **marketId** (string): Market ID +- **subaccountId** (string): Subaccount ID +- **orderHash** (string): Order hash + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "marketId": "0x...", + "subaccountId": "0x...", + "orderHash": "0x..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgCreateBinaryOptionsLimitOrderTemplate = ` +Extract the following details for creating binary options limit order: +- **injectiveAddress** (string): Injective sender address +- **marketId** (string): Market ID +- **subaccountId** (string): Subaccount ID +- **feeRecipient** (string): Fee recipient address +- **price** (string): Order price +- **quantity** (string): Order quantity +- **orderType** (string): Order type (BUY/SELL) + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "marketId": "0x...", + "subaccountId": "0x...", + "feeRecipient": "inj1...", + "price": "25000.5", + "quantity": "1.5", + "orderType": "BUY" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "orderHash": "0x...", + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgLiquidatePositionTemplate = ` +Extract the following details for liquidating a position: +- **injectiveAddress** (string): Injective sender address +- **subaccountId** (string): Subaccount ID to liquidate +- **marketId** (string): Market ID +- **order** (object): Liquidation order details containing: + - marketId (string) + - orderType (string) + - price (string) + - quantity (string) + - margin (string) + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "subaccountId": "0x...", + "marketId": "0x...", + "order": { + "marketId": "0x...", + "orderType": "SELL", + "price": "24000.0", + "quantity": "1.5", + "margin": "1000" + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgReclaimLockedFundsTemplate = ` +Extract the following details for reclaiming locked funds: +- **injectiveAddress** (string): Injective sender address +- **lockedAccountPubKey** (string): Public key of the locked account +- **lockedAccountSignature** (string): Signature from the locked account + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "lockedAccountPubKey": "0x...", + "lockedAccountSignature": "0x..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgSignDataTemplate = ` +Extract the following details for signing data: +- **injectiveAddress** (string): Injective sender address +- **data** (string): Data to sign + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "data": "0x..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "signature": "0x...", + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgCreateSpotLimitOrderTemplate = ` +Extract the following details for creating spot limit order: +- **injectiveAddress** (string): Injective sender address +- **marketId** (string): Market ID +- **subaccountId** (string): Subaccount ID +- **orderType** (string): Order type (BUY/SELL) +- **price** (string): Order price +- **quantity** (string): Order quantity +- **feeRecipient** (string): Fee recipient address + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "marketId": "0x...", + "subaccountId": "0x...", + "orderType": "BUY", + "price": "25000.5", + "quantity": "1.5", + "feeRecipient": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "orderHash": "0x...", + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgCreateDerivativeLimitOrderTemplate = ` +Extract the following details for creating derivative limit order: +- **injectiveAddress** (string): Injective sender address +- **marketId** (string): Market ID +- **subaccountId** (string): Subaccount ID +- **orderType** (string): Order type (BUY/SELL) +- **price** (string): Order price +- **quantity** (string): Order quantity +- **margin** (string): Order margin +- **feeRecipient** (string): Fee recipient address + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "marketId": "0x...", + "subaccountId": "0x...", + "orderType": "BUY", + "price": "25000.5", + "quantity": "1.5", + "margin": "1000", + "feeRecipient": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "orderHash": "0x...", + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgBatchCancelSpotOrdersTemplate = ` +Extract the following details for batch canceling spot orders: +- **injectiveAddress** (string): Injective sender address +- **orders** (array): List of orders to cancel containing: + - marketId (string) + - subaccountId (string) + - orderHash (string) + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "orders": [ + { + "marketId": "0x...", + "subaccountId": "0x...", + "orderHash": "0x..." + } + ] +} +\`\`\` + +Response format: + +\`\`\`json +{ + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgBatchCancelDerivativeOrdersTemplate = ` +Extract the following details for batch canceling derivative orders: +- **injectiveAddress** (string): Injective sender address +- **orders** (array): List of orders to cancel containing: + - marketId (string) + - subaccountId (string) + - orderHash (string) + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "orders": [ + { + "marketId": "0x...", + "subaccountId": "0x...", + "orderHash": "0x..." + } + ] +} +\`\`\` + +Response format: + +\`\`\`json +{ + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgCancelSpotOrderTemplate = ` +Extract the following details for canceling a spot order: +- **injectiveAddress** (string): Injective sender address +- **marketId** (string): Market ID +- **subaccountId** (string): Subaccount ID +- **orderHash** (string): Order hash + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "marketId": "0x...", + "subaccountId": "0x...", + "orderHash": "0x..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgCancelDerivativeOrderTemplate = ` +Extract the following details for canceling a derivative order: +- **injectiveAddress** (string): Injective sender address +- **marketId** (string): Market ID +- **subaccountId** (string): Subaccount ID +- **orderHash** (string): Order hash + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "marketId": "0x...", + "subaccountId": "0x...", + "orderHash": "0x..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "success": true, + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getSpotSubaccountOrdersListTemplate = ` +Extract the following details for spot subaccount orders: +- **subaccountId** (string): Subaccount ID +- **marketId** (string, optional): Market ID filter +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "subaccountId": "0x...", + "marketId": "0x...", + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "orders": [ + { + "orderHash": "0x...", + "orderSide": "buy", + "marketId": "0x...", + "subaccountId": "0x...", + "price": "25000.5", + "quantity": "1.5", + "unfilledQuantity": "0.5", + "triggerPrice": "0", + "feeRecipient": "inj1...", + "state": "booked", + "createdAt": 1641859200, + "updatedAt": 1641859200 + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getSpotSubaccountTradesListTemplate = ` +Extract the following details for spot subaccount trades: +- **subaccountId** (string): Subaccount ID +- **marketId** (string, optional): Market ID filter +- **direction** (string, optional): Trade direction +- **executionType** (string, optional): Execution type +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "subaccountId": "0x...", + "marketId": "0x...", + "direction": "buy", + "executionType": "market", + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "trades": [ + { + "orderHash": "0x...", + "subaccountId": "0x...", + "marketId": "0x...", + "tradeId": "trade_id", + "executedAt": 1641859200, + "executionSide": "taker", + "tradeExecutionType": "market", + "tradeDirection": "buy", + "executionPrice": "25000.5", + "executionQuantity": "1.5", + "fee": "25.0", + "feeRecipient": "inj1..." + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgCreateBinaryOptionsMarketOrderTemplate = ` +Extract the following details for creating binary options market order: +- **injectiveAddress** (string): Injective sender address +- **marketId** (string): Market ID +- **subaccountId** (string): Subaccount ID +- **feeRecipient** (string): Fee recipient address +- **price** (string): Order price +- **quantity** (string): Order quantity +- **orderType** (string): Order type (BUY/SELL) + +Provide the request in the following JSON format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "marketId": "0x...", + "subaccountId": "0x...", + "feeRecipient": "inj1...", + "price": "25000.5", + "quantity": "1.5", + "orderType": "BUY" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "orderHash": "0x...", + "txHash": "0x..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getSpotOrderHistoryTemplate = ` +Extract the following details for spot order history: +- **subaccountId** (string, optional): Subaccount ID filter +- **marketId** (string, optional): Market ID filter +- **marketIds** (string[], optional): Multiple market IDs filter +- **orderTypes** (string[], optional): Order types filter +- **executionTypes** (string[], optional): Execution types filter +- **direction** (string, optional): Order direction filter +- **isConditional** (boolean, optional): Whether order is conditional +- **state** (string, optional): Order state filter +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "subaccountId": "0x...", + "marketId": "0x...", + "marketIds": ["0x..."], + "orderTypes": ["limit", "market"], + "executionTypes": ["limit", "market"], + "direction": "buy", + "isConditional": false, + "state": "booked", + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "orderHistory": [ + { + "orderHash": "0x...", + "marketId": "0x...", + "active": true, + "subaccountId": "0x...", + "executionType": "limit", + "orderType": "buy", + "price": "25000.5", + "triggerPrice": "0", + "quantity": "1.5", + "filledQuantity": "0.5", + "state": "booked", + "createdAt": 1641859200, + "updatedAt": 1641859200, + "direction": "buy" + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getSpotTradesTemplate = ` +Extract the following details for spot trades: +- **marketId** (string, optional): Market ID filter +- **marketIds** (string[], optional): Multiple market IDs filter +- **subaccountId** (string, optional): Subaccount ID filter +- **executionSide** (string, optional): Execution side filter +- **direction** (string, optional): Trade direction filter +- **executionTypes** (string[], optional): Execution types filter +- **pagination** (object, optional): Pagination options + +Provide the request in the following JSON format: + +\`\`\`json +{ + "marketId": "0x...", + "marketIds": ["0x..."], + "subaccountId": "0x...", + "executionSide": "taker", + "direction": "buy", + "executionTypes": ["market", "limit"], + "pagination": { + "from": 1, + "to": 100, + "limit": 10 + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "trades": [ + { + "orderHash": "0x...", + "subaccountId": "0x...", + "marketId": "0x...", + "tradeId": "trade_id", + "executedAt": 1641859200, + "executionSide": "taker", + "tradeExecutionType": "market", + "tradeDirection": "buy", + "price": "25000.5", + "quantity": "1.5", + "fee": "25.0", + "feeRecipient": "inj1..." + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getAccountPortfolioBalancesTemplate = ` +Extract the following details for account portfolio balances: +- **address** (string): Account address + +Provide the request in the following JSON format: + +\`\`\`json +{ + "address": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "balances": [ + { + "denom": "inj", + "totalBalance": "1000000", + "availableBalance": "900000", + "lockedBalance": "100000" + } + ], + "subaccountBalances": [ + { + "subaccountId": "0x...", + "denom": "inj", + "deposit": { + "totalBalance": "1000000", + "availableBalance": "900000" + } + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getRewardsTemplate = ` +Extract the following details for rewards: +- **address** (string): Account address +- **epoch** (number): Reward epoch + +Provide the request in the following JSON format: + +\`\`\`json +{ + "address": "inj1...", + "epoch": 1 +} +\`\`\` + +Response format: + +\`\`\`json +{ + "rewards": [ + { + "accountAddress": "inj1...", + "rewards": [ + { + "amount": "1000000", + "denom": "inj" + } + ], + "distributedAt": 1641859200 + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/explorer.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/explorer.ts new file mode 100644 index 00000000000..f4f4606a243 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/explorer.ts @@ -0,0 +1,450 @@ +export const getTxByHashTemplate = ` +Extract the following details for transaction lookup: +- **hash** (string): Transaction hash to lookup + +Provide the request in the following JSON format: + +\`\`\`json +{ + "hash": "0x..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "id": "tx_id", + "blockNumber": 12345, + "blockTimestamp": "2024-01-11T12:00:00Z", + "hash": "0x...", + "memo": "transaction memo", + "code": 0, + "data": "base64_encoded_data", + "info": "transaction info", + "gasWanted": 100000, + "gasUsed": 80000, + "gasFee": { + "amounts": [ + { + "amount": "1000000", + "denom": "inj" + } + ], + "gasLimit": 100000, + "payer": "inj1...", + "granter": "inj1..." + }, + "txType": "MsgSend", + "signatures": [ + { + "pubkey": "public_key", + "address": "inj1...", + "signature": "sig_data", + "sequence": 5 + } + ], + "messages": [ + { + "key": "message_key", + "value": "message_value" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getAccountTxTemplate = ` +Extract the following details for account transactions: +- **address** (string): Account address +- **limit** (number, optional): Number of results +- **type** (string, optional): Transaction type filter +- **before** (number, optional): Results before this block +- **after** (number, optional): Results after this block +- **startTime** (number, optional): Start timestamp +- **endTime** (number, optional): End timestamp + +Provide the request in the following JSON format: + +\`\`\`json +{ + "address": "inj1...", + "limit": 10, + "type": "MsgSend", + "before": 12345, + "after": 12300, + "startTime": 1641859200, + "endTime": 1641945600 +} +\`\`\` + +Response format: + +\`\`\`json +{ + "txs": [ + { + "id": "tx_id", + "blockNumber": 12345, + "blockTimestamp": "2024-01-11T12:00:00Z", + "hash": "0x...", + "txType": "MsgSend" + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getValidatorTemplate = ` +Extract the following details for validator lookup: +- **address** (string): Validator address + +Provide the request in the following JSON format: + +\`\`\`json +{ + "address": "injvaloper1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "id": "validator_id", + "moniker": "Validator Name", + "operatorAddress": "injvaloper1...", + "consensusAddress": "injvalcons1...", + "jailed": false, + "status": 1, + "tokens": "1000000000", + "delegatorShares": "1000000000", + "description": { + "moniker": "Validator Name", + "identity": "keybase_id", + "website": "https://validator.com", + "securityContact": "security@validator.com", + "details": "Validator details" + }, + "uptimePercentage": 99.9, + "commissionRate": "0.1", + "commissionMaxRate": "0.2", + "commissionMaxChangeRate": "0.01" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getValidatorUptimeTemplate = ` +Extract the following details for validator uptime: +- **validatorAddress** (string): Validator address + +Provide the request in the following JSON format: + +\`\`\`json +{ + "validatorAddress": "injvaloper1..." +} +\`\`\` + +Response format: + +\`\`\`json +[ + { + "blockNumber": 12345, + "status": "signed" + } +] +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getPeggyDepositTxsTemplate = ` +Extract the following details for Peggy deposit transactions: +- **sender** (string, optional): Sender address +- **receiver** (string, optional): Receiver address +- **limit** (number, optional): Number of results +- **skip** (number, optional): Number of results to skip + +Provide the request in the following JSON format: + +\`\`\`json +{ + "sender": "eth_address", + "receiver": "inj1...", + "limit": 10, + "skip": 0 +} +\`\`\` + +Response format: + +\`\`\`json +[ + { + "sender": "eth_address", + "receiver": "inj1...", + "eventNonce": 123, + "eventHeight": 12345, + "amount": "1000000000", + "denom": "peggy0x...", + "orchestratorAddress": "inj1...", + "state": "completed", + "txHashesList": ["0x..."] + } +] +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getPeggyWithdrawalTxsTemplate = ` +Extract the following details for Peggy withdrawal transactions: +- **sender** (string, optional): Sender address +- **receiver** (string, optional): Receiver address +- **limit** (number, optional): Number of results +- **skip** (number, optional): Number of results to skip + +Provide the request in the following JSON format: + +\`\`\`json +{ + "sender": "inj1...", + "receiver": "eth_address", + "limit": 10, + "skip": 0 +} +\`\`\` + +Response format: + +\`\`\`json +[ + { + "sender": "inj1...", + "receiver": "eth_address", + "amount": "1000000000", + "denom": "peggy0x...", + "bridgeFee": "1000000", + "outgoingTxId": 123, + "batchTimeout": 100, + "batchNonce": 5, + "state": "completed", + "txHashesList": ["0x..."] + } +] +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getBlocksTemplate = ` +Extract the following details for blocks query: +- **before** (number, optional): Results before this block +- **after** (number, optional): Results after this block +- **limit** (number, optional): Number of results +- **from** (number, optional): Start block height +- **to** (number, optional): End block height + +Provide the request in the following JSON format: + +\`\`\`json +{ + "before": 12345, + "after": 12300, + "limit": 10, + "from": 12300, + "to": 12345 +} +\`\`\` + +Response format: + +\`\`\`json +{ + "blocks": [ + { + "height": 12345, + "proposer": "injvaloper1...", + "moniker": "Validator Name", + "blockHash": "0x...", + "parentHash": "0x...", + "numPreCommits": 150, + "numTxs": 10, + "timestamp": "2024-01-11T12:00:00Z" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getBlockTemplate = ` +Extract the following details for block lookup: +- **id** (string): Block height or hash + +Provide the request in the following JSON format: + +\`\`\`json +{ + "id": "12345" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "block": { + "height": 12345, + "proposer": "injvaloper1...", + "moniker": "Validator Name", + "blockHash": "0x...", + "parentHash": "0x...", + "numPreCommits": 150, + "numTxs": 10, + "timestamp": "2024-01-11T12:00:00Z" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getTxsTemplate = ` +Extract the following details for transactions query: +- **before** (number, optional): Results before this block +- **after** (number, optional): Results after this block +- **limit** (number, optional): Number of results +- **skip** (number, optional): Number of results to skip +- **type** (string, optional): Transaction type filter +- **chainModule** (string, optional): Chain module filter +- **startTime** (number, optional): Start timestamp +- **endTime** (number, optional): End timestamp + +Provide the request in the following JSON format: + +\`\`\`json +{ + "before": 12345, + "after": 12300, + "limit": 10, + "skip": 0, + "type": "MsgSend", + "chainModule": "bank", + "startTime": 1641859200, + "endTime": 1641945600 +} +\`\`\` + +Response format: + +\`\`\`json +{ + "transactions": [ + { + "id": "tx_id", + "blockNumber": 12345, + "blockTimestamp": "2024-01-11T12:00:00Z", + "hash": "0x...", + "txType": "MsgSend" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getIBCTransferTxsTemplate = ` +Extract the following details for IBC transfer transactions: +- **sender** (string, optional): Sender address +- **receiver** (string, optional): Receiver address +- **srcChannel** (string, optional): Source channel +- **srcPort** (string, optional): Source port +- **destChannel** (string, optional): Destination channel +- **destPort** (string, optional): Destination port +- **limit** (number, optional): Number of results +- **skip** (number, optional): Number of results to skip + +Provide the request in the following JSON format: + +\`\`\`json +{ + "sender": "inj1...", + "receiver": "cosmos1...", + "srcChannel": "channel-1", + "srcPort": "transfer", + "destChannel": "channel-0", + "destPort": "transfer", + "limit": 10, + "skip": 0 +} +\`\`\` + +Response format: + +\`\`\`json +[ + { + "sender": "inj1...", + "receiver": "cosmos1...", + "sourcePort": "transfer", + "sourceChannel": "channel-1", + "destinationPort": "transfer", + "destinationChannel": "channel-0", + "amount": "1000000000", + "denom": "inj", + "timeoutHeight": "1-1000000", + "timeoutTimestamp": 1641945600, + "state": "completed" + } +] +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getExplorerStatsTemplate = ` +Extract explorer statistics. + +Response format: + +\`\`\`json +{ + "assets": "1000", + "txsTotal": "1000000", + "addresses": "50000", + "injSupply": "100000000", + "txsInPast30Days": "100000", + "txsInPast24Hours": "10000", + "blockCountInPast24Hours": "5000", + "txsPerSecondInPast24Hours": "0.5", + "txsPerSecondInPast100Blocks": "0.8" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/gov.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/gov.ts new file mode 100644 index 00000000000..3f6467b1ffb --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/gov.ts @@ -0,0 +1,503 @@ +// Governance Module Templates + +export const getGovernanceModuleParamsTemplate = ` +Extract the following details to get governance module parameters: +- **votingParams** (object): Contains: + - **votingPeriod** (number): Duration of the voting period in seconds +- **tallyParams** (object): Contains: + - **quorum** (string): Minimum percentage of voting power required + - **threshold** (string): Minimum percentage for proposal to pass + - **vetoThreshold** (string): Minimum veto percentage to reject +- **depositParams** (object): Contains: + - **minDepositList** (array): Required minimum deposits + - **maxDepositPeriod** (number): Maximum deposit period in seconds + +Provide the response in the following JSON format: + +\`\`\`json +{ + "votingParams": { + "votingPeriod": 604800 + }, + "tallyParams": { + "quorum": "0.334", + "threshold": "0.5", + "vetoThreshold": "0.334" + }, + "depositParams": { + "minDepositList": [ + { + "denom": "inj", + "amount": "100000000000000000000" + } + ], + "maxDepositPeriod": 1209600 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getProposalsTemplate = ` +Extract the following details for retrieving proposals: +- **status** (CosmosGovV1Gov.ProposalStatus): Filter by proposal status +- **pagination** (PaginationOption): Optional pagination parameters + +Response will contain: +- **proposals** (Proposal[]): List of proposals +- **pagination**: Pagination response information + +Provide the request in the following JSON format: + +\`\`\`json +{ + "status": 2, + "pagination": { + "key": "", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "proposals": [ + { + "proposalId": 1, + "title": "Example Proposal", + "summary": "This is an example proposal", + "proposer": "inj1...", + "status": 2, + "finalTallyResult": { + "yesCount": "100", + "abstainCount": "10", + "noCount": "5", + "noWithVetoCount": "2" + }, + "submitTime": 1632150400, + "depositEndTime": 1633360000, + "votingStartTime": 1633360000, + "votingEndTime": 1633964800, + "totalDeposits": [ + { + "denom": "inj", + "amount": "100000000000000000000" + } + ] + } + ], + "pagination": { + "nextKey": "", + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getProposalTemplate = ` +Extract the following details for retrieving a specific proposal: +- **proposalId** (number): The ID of the proposal + +Provide the request in the following JSON format: + +\`\`\`json +{ + "proposalId": 1 +} +\`\`\` + +Response format: + +\`\`\`json +{ + "proposalId": 1, + "title": "Example Proposal", + "summary": "This is an example proposal", + "proposer": "inj1...", + "status": 2, + "finalTallyResult": { + "yesCount": "100", + "abstainCount": "10", + "noCount": "5", + "noWithVetoCount": "2" + }, + "submitTime": 1632150400, + "depositEndTime": 1633360000, + "votingStartTime": 1633360000, + "votingEndTime": 1633964800, + "totalDeposits": [ + { + "denom": "inj", + "amount": "100000000000000000000" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getProposalDepositsTemplate = ` +Extract the following details for retrieving proposal deposits: +- **proposalId** (number): The ID of the proposal +- **pagination** (PaginationOption): Optional pagination parameters + +Response will contain: +- **deposits** (ProposalDeposit[]): List of deposits +- **pagination**: Pagination response information + +Request format: + +\`\`\`json +{ + "proposalId": 1, + "pagination": { + "key": "", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "deposits": [ + { + "depositor": "inj1...", + "amounts": [ + { + "denom": "inj", + "amount": "100000000000000000000" + } + ] + } + ], + "pagination": { + "nextKey": "", + "total": 10 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getProposalVotesTemplate = ` +Extract the following details for retrieving proposal votes: +- **proposalId** (number): The ID of the proposal +- **pagination** (PaginationOption): Optional pagination parameters + +Request format: + +\`\`\`json +{ + "proposalId": 1, + "pagination": { + "key": "", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response format: + +\`\`\`json +{ + "votes": [ + { + "proposalId": 1, + "voter": "inj1...", + "options": [ + { + "option": 1, + "weight": "1.0" + } + ], + "metadata": "" + } + ], + "pagination": { + "nextKey": "", + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getProposalTallyTemplate = ` +Extract the following details for retrieving proposal tally: +- **proposalId** (number): The ID of the proposal + +Request format: + +\`\`\`json +{ + "proposalId": 1 +} +\`\`\` + +Response format: + +\`\`\`json +{ + "yesCount": "100", + "abstainCount": "10", + "noCount": "5", + "noWithVetoCount": "2" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgSubmitProposalExpiryFuturesMarketLaunchTemplate = ` +Extract the following details for submitting an expiry futures market launch proposal: +- **title** (string): Proposal title +- **description** (string): Proposal description +- **marketId** (string): Market identifier +- **ticker** (string): Market ticker symbol +- **quoteDenom** (string): Quote denomination +- **oracleBase** (string): Oracle base +- **oracleQuote** (string): Oracle quote +- **expiry** (number): Expiry timestamp +- **initialDeposit** (Coin[]): Initial deposit amount + +Request format: + +\`\`\`json +{ + "title": "Launch BTC-USDT Quarterly Futures", + "description": "Proposal to launch BTC-USDT quarterly futures market", + "marketId": "0x123...", + "ticker": "BTC-USDT-Q", + "quoteDenom": "peggy0x123...USDT", + "oracleBase": "BTC", + "oracleQuote": "USDT", + "expiry": 1640995200, + "initialDeposit": [ + { + "denom": "inj", + "amount": "100000000000000000000" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgSubmitProposalSpotMarketLaunchTemplate = ` +Extract the following details for submitting a spot market launch proposal: +- **title** (string): Proposal title +- **description** (string): Proposal description +- **ticker** (string): Market ticker symbol +- **baseDenom** (string): Base denomination +- **quoteDenom** (string): Quote denomination +- **initialDeposit** (Coin[]): Initial deposit amount + +Request format: + +\`\`\`json +{ + "title": "Launch INJ-USDT Spot Market", + "description": "Proposal to launch INJ-USDT spot market", + "ticker": "INJ-USDT", + "baseDenom": "inj", + "quoteDenom": "peggy0x123...USDT", + "initialDeposit": [ + { + "denom": "inj", + "amount": "100000000000000000000" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgSubmitProposalPerpetualMarketLaunchTemplate = ` +Extract the following details for submitting a perpetual market launch proposal: +- **title** (string): Proposal title +- **description** (string): Proposal description +- **ticker** (string): Market ticker symbol +- **quoteDenom** (string): Quote denomination +- **oracleBase** (string): Oracle base +- **oracleQuote** (string): Oracle quote +- **initialDeposit** (Coin[]): Initial deposit amount + +Request format: + +\`\`\`json +{ + "title": "Launch ETH-USDT Perpetual", + "description": "Proposal to launch ETH-USDT perpetual market", + "ticker": "ETH-USDT-PERP", + "quoteDenom": "peggy0x123...USDT", + "oracleBase": "ETH", + "oracleQuote": "USDT", + "initialDeposit": [ + { + "denom": "inj", + "amount": "100000000000000000000" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgVoteTemplate = ` +Extract the following details for submitting a vote: +- **proposalId** (number): The ID of the proposal +- **options** (WeightedVoteOption[]): Vote options with weights +- **metadata** (string): Optional vote metadata + +Request format: + +\`\`\`json +{ + "proposalId": 1, + "options": [ + { + "option": 1, + "weight": "1.0" + } + ], + "metadata": "" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgSubmitTextProposalTemplate = ` +Extract the following details for submitting a text proposal: +- **title** (string): Proposal title +- **description** (string): Proposal description +- **initialDeposit** (Coin[]): Initial deposit amount + +Request format: + +\`\`\`json +{ + "title": "Community Pool Spend", + "description": "Proposal to spend community pool funds", + "initialDeposit": [ + { + "denom": "inj", + "amount": "100000000000000000000" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgSubmitProposalSpotMarketParamUpdateTemplate = ` +Extract the following details for submitting a spot market parameter update proposal: +- **title** (string): Proposal title +- **description** (string): Proposal description +- **marketId** (string): Market identifier +- **makerFeeRate** (string): Maker fee rate +- **takerFeeRate** (string): Taker fee rate +- **initialDeposit** (Coin[]): Initial deposit amount + +Request format: + +\`\`\`json +{ + "title": "Update INJ-USDT Spot Market Parameters", + "description": "Proposal to update INJ-USDT spot market parameters", + "marketId": "0x123...", + "makerFeeRate": "-0.0001", + "takerFeeRate": "0.001", + "initialDeposit": [ + { + "denom": "inj", + "amount": "100000000000000000000" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgSubmitGenericProposalTemplate = ` +Extract the following details for submitting a generic proposal: +- **title** (string): Proposal title +- **description** (string): Proposal description +- **messages** (any[]): Proposal messages +- **initialDeposit** (Coin[]): Initial deposit amount + +Request format: + +\`\`\`json +{ + "title": "Generic Proposal", + "description": "Generic governance proposal", + "messages": [], + "initialDeposit": [ + { + "denom": "inj", + "amount": "100000000000000000000" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgGovDepositTemplate = ` +Extract the following details for depositing to a proposal: +- **proposalId** (number): The ID of the proposal +- **amount** (Coin[]): Deposit amount + +Request format: + +\`\`\`json +{ + "proposalId": 1, + "amount": [ + { + "denom": "inj", + "amount": "100000000000000000000" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/ibc.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/ibc.ts new file mode 100644 index 00000000000..b97e6a1f38c --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/ibc.ts @@ -0,0 +1,135 @@ +// IBC Module Templates + +export const getDenomTraceTemplate = ` +Extract the following details to get denom trace information: +- **hash** (string): The hash of the denomination to trace + +Provide the request in the following JSON format: + +\`\`\`json +{ + "hash": "hash_string" +} +\`\`\` + +The response will contain: +- **path** (string): Chain of port/channel identifiers used for tracing +- **baseDenom** (string): Base denomination of the relayed fungible token + +Response format: + +\`\`\`json +{ + "path": "transfer/channel-0/transfer/channel-1", + "baseDenom": "uatom" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDenomsTraceTemplate = ` +Extract the following details to get multiple denom traces: +- **pagination** (object): Optional pagination parameters containing: + - **key** (string): Pagination key + - **offset** (number): Pagination offset + - **limit** (number): Number of records to return + - **countTotal** (boolean): Whether to count total records + +Provide the request in the following JSON format: + +\`\`\`json +{ + "pagination": { + "key": "", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +The response will contain an array of denom traces: +- **denomTraces** (array): List of denomination traces, each containing: + - **path** (string): Chain of port/channel identifiers + - **baseDenom** (string): Base denomination +- **pagination** (object): Pagination response information + +Response format: + +\`\`\`json +{ + "denomTraces": [ + { + "path": "transfer/channel-0/transfer/channel-1", + "baseDenom": "uatom" + }, + { + "path": "transfer/channel-2", + "baseDenom": "uosmo" + } + ], + "pagination": { + "nextKey": "", + "total": 10 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgIBCTransferTemplate = ` +Extract the following details for IBC token transfer: +- **sourcePort** (string): Source port ID (e.g., "transfer") +- **sourceChannel** (string): Source channel ID +- **token** (object): Token to transfer containing: + - **denom** (string): Token denomination + - **amount** (string): Token amount +- **receiver** (string): Receiver address on destination chain +- **timeoutHeight** (object): Optional timeout height containing: + - **revisionNumber** (string): Chain revision number + - **revisionHeight** (string): Block height for timeout +- **timeoutTimestamp** (string): Optional timeout timestamp in nanoseconds +- **memo** (string): Optional transfer memo + +Ensure that: +1. Port ID and channel ID are valid +2. Token amount is positive +3. Receiver address is valid for destination chain +4. Either timeoutHeight or timeoutTimestamp is specified + +Provide the transfer details in the following JSON format: + +\`\`\`json +{ + "sourcePort": "transfer", + "sourceChannel": "channel-0", + "token": { + "denom": "inj", + "amount": "1000000000000000000" + }, + "receiver": "cosmos1...", + "timeoutHeight": { + "revisionNumber": "1", + "revisionHeight": "1000000" + }, + "timeoutTimestamp": "1640995200000000000", + "memo": "Optional transfer memo" +} +\`\`\` + +Success response format: + +\`\`\`json +{ + "txHash": "0x...", + "success": true +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/index.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/index.ts new file mode 100644 index 00000000000..5045f3233d2 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/index.ts @@ -0,0 +1,15 @@ +export * from "./auction"; +export * from "./auth"; +export * from "./bank"; +export * from "./distribution"; +export * from "./exchange"; +export * from "./gov"; +export * from "./ibc"; +export * from "./insurance"; +export * from "./mint"; +export * from "./mito"; +export * from "./peggy"; +export * from "./permissions"; +export * from "./staking"; +export * from "./token-factory"; +export * from "./wasm"; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/insurance.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/insurance.ts new file mode 100644 index 00000000000..3d7b09d98ae --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/insurance.ts @@ -0,0 +1,246 @@ +// Insurance Fund Module Templates + +export const getInsuranceModuleParamsTemplate = ` +Extract the following details for insurance module parameters: +- **defaultRedemptionNoticePeriodDuration** (number): Default duration for redemption notice period in seconds + +Provide the response in the following JSON format: + +\`\`\`json +{ + "defaultRedemptionNoticePeriodDuration": 1209600 +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getInsuranceFundsTemplate = ` +Request to fetch all insurance funds. No parameters required. + +Response will contain an array of insurance funds with the following details: +- **depositDenom** (string): Denomination of deposits +- **insurancePoolTokenDenom** (string): Denomination of pool tokens +- **redemptionNoticePeriodDuration** (number): Duration for redemption notice +- **balance** (string): Current fund balance +- **totalShare** (string): Total share amount +- **marketId** (string): Market identifier +- **marketTicker** (string): Market ticker symbol +- **oracleBase** (string): Oracle base asset +- **oracleQuote** (string): Oracle quote asset +- **oracleType** (number): Type of oracle +- **expiry** (number): Expiry timestamp + +Response format: + +\`\`\`json +{ + "insuranceFunds": [ + { + "depositDenom": "inj", + "insurancePoolTokenDenom": "share1", + "redemptionNoticePeriodDuration": 1209600, + "balance": "1000000000000000000", + "totalShare": "1000000000000000000", + "marketId": "0x1234...", + "marketTicker": "BTC/USDT", + "oracleBase": "BTC", + "oracleQuote": "USDT", + "oracleType": 1, + "expiry": 1640995200 + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getInsuranceFundTemplate = ` +Extract the following details to get a specific insurance fund: +- **marketId** (string): Market identifier for the insurance fund + +Request format: + +\`\`\`json +{ + "marketId": "0x1234..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "depositDenom": "inj", + "insurancePoolTokenDenom": "share1", + "redemptionNoticePeriodDuration": 1209600, + "balance": "1000000000000000000", + "totalShare": "1000000000000000000", + "marketId": "0x1234...", + "marketTicker": "BTC/USDT", + "oracleBase": "BTC", + "oracleQuote": "USDT", + "oracleType": 1, + "expiry": 1640995200 +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getEstimatedRedemptionsTemplate = ` +Extract the following details for estimated redemptions: +- **marketId** (string): Market identifier +- **address** (string): Account address + +Request format: + +\`\`\`json +{ + "marketId": "0x1234...", + "address": "inj1..." +} +\`\`\` + +Response will contain array of redemption amounts: +- **amounts** (array): List of redemption amounts containing: + - **amount** (string): Redemption amount + - **denom** (string): Token denomination + +Response format: + +\`\`\`json +{ + "amounts": [ + { + "amount": "1000000000000000000", + "denom": "inj" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getPendingRedemptionsTemplate = ` +Extract the following details for pending redemptions: +- **marketId** (string): Market identifier +- **address** (string): Account address + +Request format: + +\`\`\`json +{ + "marketId": "0x1234...", + "address": "inj1..." +} +\`\`\` + +Response will contain array of pending redemption amounts: +- **amounts** (array): List of pending redemption amounts containing: + - **amount** (string): Redemption amount + - **denom** (string): Token denomination + +Response format: + +\`\`\`json +{ + "amounts": [ + { + "amount": "1000000000000000000", + "denom": "inj" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgCreateInsuranceFundTemplate = ` +Extract the following details for creating an insurance fund: +- **marketId** (string): Market identifier +- **ticker** (string): Market ticker symbol +- **quoteDenom** (string): Quote denomination +- **oracleBase** (string): Oracle base asset +- **oracleQuote** (string): Oracle quote asset +- **oracleType** (number): Type of oracle +- **expiry** (number): Optional expiry timestamp +- **initialDeposit** (object): Initial deposit containing: + - **amount** (string): Deposit amount + - **denom** (string): Token denomination + +Request format: + +\`\`\`json +{ + "marketId": "0x1234...", + "ticker": "BTC/USDT", + "quoteDenom": "peggy0x...", + "oracleBase": "BTC", + "oracleQuote": "USDT", + "oracleType": 1, + "expiry": 1640995200, + "initialDeposit": { + "amount": "1000000000000000000", + "denom": "inj" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgRequestRedemptionTemplate = ` +Extract the following details for requesting a redemption: +- **marketId** (string): Market identifier +- **amount** (object): Redemption amount containing: + - **amount** (string): Amount to redeem + - **denom** (string): Token denomination + +Request format: + +\`\`\`json +{ + "marketId": "0x1234...", + "amount": { + "amount": "1000000000000000000", + "denom": "share1" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgUnderwriteTemplate = ` +Extract the following details for underwriting an insurance fund: +- **marketId** (string): Market identifier +- **deposit** (object): Deposit amount containing: + - **amount** (string): Amount to deposit + - **denom** (string): Token denomination + +Request format: + +\`\`\`json +{ + "marketId": "0x1234...", + "deposit": { + "amount": "1000000000000000000", + "denom": "inj" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/mint.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/mint.ts new file mode 100644 index 00000000000..10ed5c94768 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/mint.ts @@ -0,0 +1,65 @@ +// Mint Module Templates + +export const getMintModuleParamsTemplate = ` +Extract the mint module parameters. + +The response will contain: +- **mintDenom** (string): Type of coin to mint +- **inflationRateChange** (string): Maximum annual change in inflation rate +- **inflationMax** (string): Maximum inflation rate +- **inflationMin** (string): Minimum inflation rate +- **goalBonded** (string): Goal of percent bonded atoms +- **blocksPerYear** (string): Expected blocks per year + +Response format: + +\`\`\`json +{ + "mintDenom": "inj", + "inflationRateChange": "0.130000000000000000", + "inflationMax": "0.200000000000000000", + "inflationMin": "0.070000000000000000", + "goalBonded": "0.670000000000000000", + "blocksPerYear": "6311520" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getInflationTemplate = ` +Extract the current inflation rate. + +The response will contain: +- **inflation** (string): Current inflation rate + +Response format: + +\`\`\`json +{ + "inflation": "0.130000000000000000" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getAnnualProvisionsTemplate = ` +Extract the current annual provisions. + +The response will contain: +- **annualProvisions** (string): Current annual provisions + +Response format: + +\`\`\`json +{ + "annualProvisions": "5000000000000000000000000" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/mito.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/mito.ts new file mode 100644 index 00000000000..980269a967b --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/mito.ts @@ -0,0 +1,1242 @@ +// Mito Module Templates + +export const getVaultTemplate = ` +Extract the following details for retrieving a specific vault: +- **contractAddress** (string): Optional contract address +- **slug** (string): Optional vault slug + +Request format: + +\`\`\`json +{ + "contractAddress": "inj1...", + "slug": "vault-slug" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "contractAddress": "inj1...", + "codeId": "1", + "vaultName": "Example Vault", + "marketId": "0x123...", + "currentTvl": 1000000, + "profits": { + "allTimeChange": 10.5, + "threeMonthsChange": 5.2, + "oneMonthChange": 2.1, + "oneDayChange": 0.5, + "oneWeekChange": 1.2, + "oneYearChange": 15.3, + "threeYearsChange": 45.6, + "sixMonthsChange": 8.4 + }, + "updatedAt": 1632150400, + "vaultType": "perpetual", + "lpTokenPrice": 1.05, + "subaccountInfo": { + "subaccountId": "0x123...", + "balancesList": [ + { + "denom": "inj", + "totalBalance": "1000000000" + } + ] + }, + "masterContractAddress": "inj1...", + "totalLpAmount": "1000000", + "slug": "vault-slug", + "createdAt": 1632150400, + "notionalValueCap": "10000000", + "tvlChanges": { + "allTimeChange": 20.5 + }, + "apy": 15.2, + "apy7D": 14.8, + "apy7DFq": 14.9, + "apyue": 15.0, + "apyV3": 15.1, + "registrationMode": "open" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getVaultsTemplate = ` +Extract the following details for retrieving vaults: +- **limit** (number): Optional number of records +- **codeId** (string): Optional code ID filter +- **pageIndex** (number): Optional page index + +Request format: + +\`\`\`json +{ + "limit": 10, + "codeId": "1", + "pageIndex": 0 +} +\`\`\` + +Response format: + +\`\`\`json +{ + "vaults": [ + { + "contractAddress": "inj1...", + "vaultName": "Example Vault", + "currentTvl": 1000000, + "lpTokenPrice": 1.05, + "apy": 15.2 + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getLpTokenPriceChartTemplate = ` +Extract the following details for LP token price chart: +- **to** (string): Optional end timestamp +- **from** (string): Optional start timestamp +- **vaultAddress** (string): Vault address + +Request format: + +\`\`\`json +{ + "to": "1640995200", + "from": "1633360000", + "vaultAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "priceSnapshots": [ + { + "price": 1.05, + "updatedAt": 1633360000 + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getTVLChartTemplate = ` +Extract the following details for TVL chart: +- **to** (string): Optional end timestamp +- **from** (string): Optional start timestamp +- **vaultAddress** (string): Vault address + +Request format: + +\`\`\`json +{ + "to": "1640995200", + "from": "1633360000", + "vaultAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "priceSnapshots": [ + { + "price": 1000000, + "updatedAt": 1633360000 + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getVaultsByHolderAddressTemplate = ` +Extract the following details for vaults by holder: +- **skip** (number): Optional skip count +- **limit** (number): Optional number of records +- **holderAddress** (string): Holder address +- **vaultAddress** (string): Optional vault address + +Request format: + +\`\`\`json +{ + "skip": 0, + "limit": 10, + "holderAddress": "inj1...", + "vaultAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "subscriptions": [ + { + "vaultInfo": { + "contractAddress": "inj1...", + "vaultName": "Example Vault", + "currentTvl": 1000000 + }, + "lpAmount": "1000000", + "holderAddress": "inj1...", + "lpAmountPercentage": 0.1 + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getLPHoldersTemplate = ` +Extract the following details for LP holders: +- **skip** (number): Optional skip count +- **limit** (number): Optional number of records +- **vaultAddress** (string): Vault address +- **stakingContractAddress** (string): Staking contract address + +Request format: + +\`\`\`json +{ + "skip": 0, + "limit": 10, + "vaultAddress": "inj1...", + "stakingContractAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "holders": [ + { + "holderAddress": "inj1...", + "vaultAddress": "inj1...", + "amount": "1000000", + "updatedAt": 1633360000, + "lpAmountPercentage": 0.1, + "redemptionLockTime": "1640995200", + "stakedAmount": "500000" + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getHolderPortfolioTemplate = ` +Extract the following details for holder portfolio: +- **holderAddress** (string): Holder address +- **stakingContractAddress** (string): Staking contract address + +Request format: + +\`\`\`json +{ + "holderAddress": "inj1...", + "stakingContractAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "totalValue": 1000000, + "pnl": 50000, + "totalValueChartList": [ + { + "price": 1000000, + "updatedAt": 1633360000 + } + ], + "pnlChartList": [ + { + "price": 50000, + "updatedAt": 1633360000 + } + ], + "updatedAt": 1633360000 +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getLeaderboardTemplate = ` +Extract the following details for leaderboard: +- **epochId** (number): Optional epoch ID + +Request format: + +\`\`\`json +{ + "epochId": 1 +} +\`\`\` + +Response format: + +\`\`\`json +{ + "entriesList": [ + { + "address": "inj1...", + "pnl": 50000 + } + ], + "snapshotBlock": "1000000", + "updatedAt": 1633360000, + "epochId": 1 +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getLeaderboardEpochsTemplate = ` +Extract the following details for leaderboard epochs: +- **limit** (number): Optional number of records +- **toEpochId** (number): Optional end epoch ID +- **fromEpochId** (number): Optional start epoch ID + +Request format: + +\`\`\`json +{ + "limit": 10, + "toEpochId": 10, + "fromEpochId": 1 +} +\`\`\` + +Response format: + +\`\`\`json +{ + "epochs": [ + { + "epochId": 1, + "startAt": 1633360000, + "endAt": 1640995200, + "isLive": true + } + ], + "pagination": { + "total": 10 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getTransferHistoryTemplate = ` +Extract the following details for transfer history: +- **vault** (string): Optional vault address +- **account** (string): Optional account address +- **limit** (number): Optional number of records +- **toNumber** (number): Optional end number +- **fromNumber** (number): Optional start number + +Request format: + +\`\`\`json +{ + "vault": "inj1...", + "account": "inj1...", + "limit": 10, + "toNumber": 100, + "fromNumber": 1 +} +\`\`\` + +Response format: + +\`\`\`json +{ + "transfers": [ + { + "lpAmount": "1000000", + "coins": [ + { + "denom": "inj", + "amount": "1000000" + } + ], + "usdValue": "1000000", + "isDeposit": true, + "executedAt": 1633360000, + "account": "inj1...", + "vault": "inj1...", + "txHash": "0x...", + "tidByVault": 1, + "tidByAccount": 1 + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getStakingPoolsTemplate = ` +Extract the following details for staking pools: +- **staker** (string): Optional staker address +- **stakingContractAddress** (string): Staking contract address + +Request format: + +\`\`\`json +{ + "staker": "inj1...", + "stakingContractAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "pools": [ + { + "vaultName": "Example Vault", + "vaultAddress": "inj1...", + "stakeDenom": "inj", + "gauges": [ + { + "id": "1", + "owner": "inj1...", + "startTimestamp": 1633360000, + "endTimestamp": 1640995200, + "rewardTokens": [ + { + "denom": "inj", + "amount": "1000000" + } + ], + "lastDistribution": 1633360000, + "status": "active" + } + ], + "apr": 15.2, + "totalLiquidity": 1000000, + "stakingAddress": "inj1...", + "aprBreakdown": { + "inj": 15.2 + } + } + ], + "pagination": { + "total": 10 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getStakingHistoryTemplate = ` +Extract the following details for staking history: +- **staker** (string): Optional staker address +- **toNumber** (number): Optional end number +- **limit** (number): Optional number of records +- **fromNumber** (number): Optional start number + +Request format: + +\`\`\`json +{ + "staker": "inj1...", + "toNumber": 100, + "limit": 10, + "fromNumber": 1 +} +\`\`\` + +Response format: + +\`\`\`json +{ + "activities": [ + { + "action": "stake", + "txHash": "0x...", + "staker": "inj1...", + "vaultAddress": "inj1...", + "numberByAccount": 1, + "timestamp": 1633360000, + "rewardedTokens": [ + { + "denom": "inj", + "amount": "1000000" + } + ], + "stakeAmount": { + "denom": "inj", + "amount": "1000000" + } + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getStakingRewardsByAccountTemplate = ` +Extract the following details for staking rewards: +- **staker** (string): Staker address +- **stakingContractAddress** (string): Staking contract address + +Request format: + +\`\`\`json +{ + "staker": "inj1...", + "stakingContractAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "rewards": [ + { + "apr": 15.2, + "vaultName": "Example Vault", + "vaultAddress": "inj1...", + "lockTimestamp": 1633360000, + "claimableRewards": [ + { + "denom": "inj", + "amount": "1000000" + } + ], + "stakedAmount": { + "denom": "inj", + "amount": "1000000" + }, + "lockedAmount": { + "denom": "inj", + "amount": "1000000" + } + } + ], + "pagination": { + "total": 10 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getMissionsTemplate = ` +Extract the following details for retrieving missions: +- **accountAddress** (string): Account address + +Request format: + +\`\`\`json +{ + "accountAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "missions": [ + { + "id": "mission1", + "points": "100", + "completed": true, + "accruedPoints": "50", + "updatedAt": 1633360000, + "progress": 0.5, + "expected": 100 + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getMissionLeaderboardTemplate = ` +Extract the following details for mission leaderboard: +- **userAddress** (string): Optional user address + +Request format: + +\`\`\`json +{ + "userAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "entries": [ + { + "address": "inj1...", + "accruedPoints": "100" + } + ], + "updatedAt": 1633360000, + "rank": "1" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getIDOTemplate = ` +Extract the following details for IDO information: +- **contractAddress** (string): Contract address +- **accountAddress** (string): Optional account address + +Request format: + +\`\`\`json +{ + "contractAddress": "inj1...", + "accountAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "ido": { + "startTime": 1633360000, + "endTime": 1640995200, + "owner": "inj1...", + "status": "active", + "tokenInfo": { + "denom": "inj", + "supply": "1000000", + "symbol": "INJ", + "decimal": 18, + "logoUrl": "https://example.com/logo.png" + }, + "capPerAddress": "1000000", + "contractAddress": "inj1...", + "subscribedAmount": "500000", + "projectTokenAmount": "1000000", + "targetAmountInQuoteDenom": "1000000", + "secondBeforeStartToSetQuotePrice": 3600, + "targetAmountInUsd": "1000000", + "tokenPrice": 1.0, + "isAccountWhiteListed": true, + "isLaunchWithVault": true, + "isVestingScheduleEnabled": true, + "name": "Example IDO", + "progress": [ + { + "status": "active", + "timestamp": 1633360000 + } + ], + "quoteDenom": "inj", + "stakeToSubscription": [ + { + "stakedAmount": "1000000", + "subscribableAmount": "500000" + } + ], + "useWhitelist": true, + "marketId": "0x...", + "vaultAddress": "inj1..." + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getIDOsTemplate = ` +Extract the following details for retrieving IDOs: +- **status** (string): Optional status filter +- **limit** (number): Optional number of records +- **toNumber** (number): Optional end number +- **accountAddress** (string): Optional account address +- **ownerAddress** (string): Optional owner address + +Request format: + +\`\`\`json +{ + "status": "active", + "limit": 10, + "toNumber": 100, + "accountAddress": "inj1...", + "ownerAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "idos": [ + { + "startTime": 1633360000, + "endTime": 1640995200, + "owner": "inj1...", + "status": "active", + "contractAddress": "inj1...", + "name": "Example IDO" + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getIDOSubscribersTemplate = ` +Extract the following details for IDO subscribers: +- **skip** (number): Optional skip count +- **limit** (number): Optional number of records +- **sortBy** (string): Optional sort field +- **contractAddress** (string): Contract address + +Request format: + +\`\`\`json +{ + "skip": 0, + "limit": 10, + "sortBy": "subscribedAmount", + "contractAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "marketId": "0x...", + "quoteDenom": "inj", + "subscribers": [ + { + "address": "inj1...", + "subscribedCoin": { + "denom": "inj", + "amount": "1000000" + }, + "lastSubscribeTime": 1633360000, + "estimateTokenReceived": { + "denom": "token", + "amount": "500000" + }, + "createdAt": 1633360000 + } + ], + "pagination": { + "total": 100 + }, + "tokenInfo": { + "denom": "inj", + "supply": "1000000", + "symbol": "INJ", + "decimal": 18, + "logoUrl": "https://example.com/logo.png" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getIDOSubscriptionTemplate = ` +Extract the following details for IDO subscription: +- **contractAddress** (string): Contract address +- **accountAddress** (string): Account address + +Request format: + +\`\`\`json +{ + "contractAddress": "inj1...", + "accountAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "subscription": { + "maxSubscriptionCoin": { + "denom": "inj", + "amount": "1000000" + }, + "committedAmount": "500000", + "price": 1.0, + "claimableCoins": [ + { + "denom": "token", + "amount": "500000" + } + ], + "rewardClaimed": false, + "tokenInfo": { + "denom": "inj", + "supply": "1000000", + "symbol": "INJ", + "decimal": 18, + "logoUrl": "https://example.com/logo.png" + }, + "quoteDenom": "inj", + "updatedAt": 1633360000, + "stakedAmount": "1000000", + "marketId": "0x..." + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getIDOActivitiesTemplate = ` +Extract the following details for IDO activities: +- **contractAddress** (string): Optional contract address +- **accountAddress** (string): Optional account address +- **limit** (number): Optional number of records +- **toNumber** (string): Optional end number + +Request format: + +\`\`\`json +{ + "contractAddress": "inj1...", + "accountAddress": "inj1...", + "limit": 10, + "toNumber": "100" +} +\`\`\` + +Response format: + +\`\`\`json +{ + "activities": [ + { + "address": "inj1...", + "subscribedCoin": { + "denom": "inj", + "amount": "1000000" + }, + "usdValue": 1000000, + "timestamp": 1633360000, + "txHash": "0x..." + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getIDOWhitelistTemplate = ` +Extract the following details for IDO whitelist: +- **skip** (number): Optional skip count +- **limit** (number): Optional number of records +- **idoAddress** (string): IDO address + +Request format: + +\`\`\`json +{ + "skip": 0, + "limit": 10, + "idoAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "idoAddress": "inj1...", + "accounts": [ + { + "accountAddress": "inj1...", + "updatedAt": 1633360000, + "weight": "1.0" + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getClaimReferencesTemplate = ` +Extract the following details for claim references: +- **skip** (number): Optional skip count +- **limit** (number): Optional number of records +- **idoAddress** (string): IDO address +- **accountAddress** (string): Account address + +Request format: + +\`\`\`json +{ + "skip": 0, + "limit": 10, + "idoAddress": "inj1...", + "accountAddress": "inj1..." +} +\`\`\` + +Response format: + +\`\`\`json +{ + "claimReferences": [ + { + "denom": "inj", + "updatedAt": 1633360000, + "claimedAmount": "500000", + "claimableAmount": "1000000", + "accountAddress": "inj1...", + "cwContractAddress": "inj1...", + "idoContractAddress": "inj1...", + "startVestingTime": 1633360000, + "vestingDurationSeconds": 2592000 + } + ], + "pagination": { + "total": 100 + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +//Mito txs +export const getLaunchpadSubscribeTemplate = ` +Extract the following details for launchpad subscription: +- **amount** (number): Amount to subscribe +- **quoteTokenDenom** (string): Quote token denomination +- **quoteTokenDecimals** (number): Quote token decimals +- **contractAddress** (string): Contract address + +Request format: + +\`\`\`json +{ + "amount": 1000, + "quoteTokenDenom": "inj", + "quoteTokenDecimals": 18, + "contractAddress": "inj1..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getSubscribeVaultTemplate = ` +Extract the following details for vault subscription: +- **market** (object): Market details including base/quote denominations and decimals +- **baseAmount** (number): Base token amount +- **quoteAmount** (number): Quote token amount +- **subscriptionType** (string): Type of subscription (BaseOnly, QuoteOnly, etc.) +- **vaultDetails** (object): Vault details including subaccount ID and master address +- **slippage** (object): Optional slippage configuration + +Request format: + +\`\`\`json +{ + "market": { + "baseDenom": "inj", + "baseDecimals": 18, + "quoteDecimals": 6, + "quoteDenom": "usdt" + }, + "baseAmount": 1.5, + "quoteAmount": 1000, + "subscriptionType": "BaseOnly", + "vaultDetails": { + "vaultSubaccountId": "0x...", + "vaultMasterAddress": "inj1...", + "vaultType": "crates.io:vault-cpmm-spot" + }, + "slippage": { + "max_penalty": "0.1" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getInstantiateCPMMVaultTemplate = ` +Extract the following details for instantiating a CPMM vault: +- **MITO_MASTER_CONTRACT_ADDRESS** (string): Mito master contract address +- **CPMM_CONTRACT_CODE** (number): CPMM contract code +- **senderWalletAddress** (string): Sender's wallet address +- **marketId** (string): Market ID +- **feeBps** (number): Fee in basis points +- **baseDecimals** (number): Base token decimals +- **quoteDecimals** (number): Quote token decimals +- **funds** (array): Array of fund objects with denom and amount +- **notionalValueCap** (string): Optional notional value cap +- **pricingStrategy** (object): Optional pricing strategy configuration +- **maxInvariantSensitivityBps** (string): Optional max invariant sensitivity in basis points +- **maxPriceSensitivityBps** (string): Optional max price sensitivity in basis points +- **orderType** (string): Optional order type + +Request format: + +\`\`\`json +{ + "MITO_MASTER_CONTRACT_ADDRESS": "inj1...", + "CPMM_CONTRACT_CODE": 123, + "senderWalletAddress": "inj1...", + "marketId": "0x...", + "feeBps": 30, + "baseDecimals": 18, + "quoteDecimals": 6, + "funds": [ + { + "denom": "inj", + "amount": "1000000000000000000" + } + ], + "notionalValueCap": "1000000", + "pricingStrategy": { + "SmoothingPricingWithRelativePriceRange": { + "bid_range": "0.01", + "ask_range": "0.01" + } + }, + "maxInvariantSensitivityBps": "100", + "maxPriceSensitivityBps": "100", + "orderType": "LIMIT" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; +export const getLaunchpadClaimTemplate = ` +Extract the following details for claiming launchpad tokens: +- **contractAddress** (string): Contract address of the launchpad + +Request format: + +\`\`\`json +{ + "contractAddress": "inj1..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; +export const getVaultSubscribeTemplate = ` +Extract the following details for subscribing to a vault: +- **vaultType** (string): Type of vault contract +- **slippage** (object): Optional slippage configuration +- **vaultSubaccountId** (string): Vault subaccount ID +- **baseAmount** (number): Base token amount +- **quoteAmount** (number): Quote token amount +- **market** (object): Market details including base/quote denominations and decimals +- **subscriptionType** (string): Type of subscription +- **masterAddress** (string): Master contract address + +Request format: + +\`\`\`json +{ + "vaultType": "crates.io:vault-cpmm-spot", + "slippage": { + "max_penalty": "0.1" + }, + "vaultSubaccountId": "0x...", + "baseAmount": 1.5, + "quoteAmount": 1000, + "market": { + "baseDenom": "inj", + "baseDecimals": 18, + "quoteDenom": "usdt", + "quoteDecimals": 6 + }, + "subscriptionType": "BaseOnly", + "masterAddress": "inj1..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getRedeemFromVaultTemplate = ` +Extract the following details for redeeming from a vault: +- **vaultSubaccountId** (string): Vault subaccount ID +- **redeemAmount** (number): Amount to redeem +- **vaultBaseDecimals** (number): Vault base token decimals +- **masterAddress** (string): Master contract address +- **vaultLpDenom** (string): LP token denom +- **marketType** (string): Market type (Spot or Derivative) +- **redemptionType** (string): Type of redemption +- **slippage** (object): Optional slippage configuration + +Request format: + +\`\`\`json +{ + "vaultSubaccountId": "0x...", + "redeemAmount": 0.01, + "vaultBaseDecimals": 18, + "masterAddress": "inj1...", + "vaultLpDenom": "factory/...", + "marketType": "Spot", + "redemptionType": "BaseOnly", + "slippage": { + "max_penalty": "0.1" + } +} +\`\`\` +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getStakeVaultLPTemplate = ` +Extract the following details for staking vault LP tokens: +- **amount** (number): Amount to stake +- **vaultLpDenom** (string): LP token denom +- **vaultTokenDecimals** (number): Token decimals +- **stakingContractAddress** (string): Staking contract address + +Request format: + +\`\`\`json +{ + "amount": 0.01, + "vaultLpDenom": "factory/...", + "vaultTokenDecimals": 18, + "stakingContractAddress": "inj1..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getUnstakeVaultLPTemplate = ` +Extract the following details for unstaking vault LP tokens: +- **amount** (number): Amount to unstake +- **vaultLpDenom** (string): LP token denom +- **vaultTokenDecimals** (number): Token decimals +- **stakingContractAddress** (string): Staking contract address + +Request format: + +\`\`\`json +{ + "amount": 0.01, + "vaultLpDenom": "factory/...", + "vaultTokenDecimals": 18, + "stakingContractAddress": "inj1..." +} +\`\`\` + +Response format: +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getClaimVaultRewardsTemplate = ` +Extract the following details for claiming vault rewards: +- **vaultLpDenom** (string): LP token denom +- **stakingContractAddress** (string): Staking contract address + +Request format: + +\`\`\`json +{ + "vaultLpDenom": "factory/...", + "stakingContractAddress": "inj1..." +} +\`\`\` +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/peggy.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/peggy.ts new file mode 100644 index 00000000000..b19332be21b --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/peggy.ts @@ -0,0 +1,99 @@ +// Peggy Module Templates + +export const getPeggyModuleParamsTemplate = ` +Extract the Peggy module parameters. + +Response will contain the following parameters: +- **bridgeParams** (object): Bridge parameters containing: + - **bridgeChainId** (string): Chain ID for the bridge + - **peggyId** (string): Unique identifier for the Peggy bridge + - **signedValsetsWindow** (string): Window for signed validator sets + - **signedBatchesWindow** (string): Window for signed batches + - **signedClaimsWindow** (string): Window for signed claims + - **targetBatchTimeout** (string): Target timeout for batches + - **averageBlockTime** (string): Average block time + - **averageEthereumBlockTime** (string): Average Ethereum block time + - **slashFractionValset** (string): Slash fraction for validator sets + - **slashFractionBatch** (string): Slash fraction for batches + - **slashFractionClaim** (string): Slash fraction for claims + - **slashFractionConflictingClaim** (string): Slash fraction for conflicting claims + - **unbondSlashingValsetsWindow** (string): Unbond slashing window for validator sets + - **bridgeContractAddress** (string): Ethereum bridge contract address + - **bridgeActive** (boolean): Whether the bridge is active + - **oracles** (string[]): List of oracle addresses + +Response format: + +\`\`\`json +{ + "bridgeParams": { + "bridgeChainId": "1", + "peggyId": "peggy1", + "signedValsetsWindow": "10000", + "signedBatchesWindow": "10000", + "signedClaimsWindow": "10000", + "targetBatchTimeout": "43200000", + "averageBlockTime": "5000", + "averageEthereumBlockTime": "15000", + "slashFractionValset": "0.001", + "slashFractionBatch": "0.001", + "slashFractionClaim": "0.001", + "slashFractionConflictingClaim": "0.001", + "unbondSlashingValsetsWindow": "10000", + "bridgeContractAddress": "0x...", + "bridgeActive": true, + "oracles": [ + "0x..." + ] + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgSendToEthTemplate = ` +Extract the following details for sending tokens to Ethereum: +- **amount** (object): Token amount containing: + - **denom** (string): Token denomination + - **amount** (string): Token amount +- **bridgeFee** (object): Bridge fee containing: + - **denom** (string): Fee denomination + - **amount** (string): Fee amount +- **ethDest** (string): Destination Ethereum address + +Ensure that: +1. Amount is positive and properly formatted +2. Bridge fee is sufficient for the transfer +3. Ethereum destination address is valid +4. Token denomination is supported by the bridge + +Request format: + +\`\`\`json +{ + "amount": { + "denom": "inj", + "amount": "1000000000000000000" + }, + "bridgeFee": { + "denom": "inj", + "amount": "1000000000000000" + }, + "ethDest": "0x..." +} +\`\`\` + +Success response format: + +\`\`\`json +{ + "txHash": "0x...", + "success": true +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/permissions.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/permissions.ts new file mode 100644 index 00000000000..5edf158efd5 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/permissions.ts @@ -0,0 +1,221 @@ +// Permission Module Templates + +export const getAddressesByRoleTemplate = ` +Extract the following details for fetching addresses by role: +- **denom** (string): Token denomination +- **role** (string): Role identifier + +Request format: + +\`\`\`json +{ + "denom": "peggy0x...", + "role": "minter" +} +\`\`\` + +Response will contain an array of addresses: +- **addresses** (array): List of addresses associated with the role + +Response format: + +\`\`\`json +{ + "addresses": [ + "inj1...", + "inj2..." + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getAddressRolesTemplate = ` +Extract the following details for fetching roles by address: +- **address** (string): Account address +- **denom** (string): Token denomination + +Request format: + +\`\`\`json +{ + "address": "inj1...", + "denom": "peggy0x..." +} +\`\`\` + +Response will contain an array of roles: +- **roles** (array): List of roles associated with the address + +Response format: + +\`\`\`json +{ + "roles": [ + "minter", + "burner" + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getAllNamespacesTemplate = ` +Request to fetch all namespaces. No parameters required. + +Response will contain an array of namespace objects: +- **namespaces** (array): List of namespaces containing: + - **denom** (string): Token denomination + - **wasmHook** (string): WASM hook address + - **mintsPaused** (boolean): Minting pause status + - **sendsPaused** (boolean): Sending pause status + - **burnsPaused** (boolean): Burning pause status + - **rolePermissions** (array): List of role permissions + - **addressRoles** (array): List of address roles + +Response format: + +\`\`\`json +{ + "namespaces": [ + { + "denom": "peggy0x...", + "wasmHook": "inj1...", + "mintsPaused": false, + "sendsPaused": false, + "burnsPaused": false, + "rolePermissions": [ + { + "role": "minter", + "permissions": 1 + } + ], + "addressRoles": [ + { + "address": "inj1...", + "roles": ["minter"] + } + ] + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getPermissionsModuleParamsTemplate = ` +Request to fetch permission module parameters. No parameters required. + +Response will contain module parameters: +- **wasmHookQueryMaxGas** (string): Maximum gas for WASM hook queries + +Response format: + +\`\`\`json +{ + "wasmHookQueryMaxGas": "1000000" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getNamespaceByDenomTemplate = ` +Extract the following details for fetching namespace by denomination: +- **denom** (string): Token denomination +- **includeRoles** (boolean): Whether to include role information + +Request format: + +\`\`\`json +{ + "denom": "peggy0x...", + "includeRoles": true +} +\`\`\` + +Response will contain namespace details: +- **namespace** (object): Namespace information containing: + - **denom** (string): Token denomination + - **wasmHook** (string): WASM hook address + - **mintsPaused** (boolean): Minting pause status + - **sendsPaused** (boolean): Sending pause status + - **burnsPaused** (boolean): Burning pause status + - **rolePermissions** (array): Optional list of role permissions if includeRoles is true + - **addressRoles** (array): Optional list of address roles if includeRoles is true + +Response format: + +\`\`\`json +{ + "namespace": { + "denom": "peggy0x...", + "wasmHook": "inj1...", + "mintsPaused": false, + "sendsPaused": false, + "burnsPaused": false, + "rolePermissions": [ + { + "role": "minter", + "permissions": 1 + } + ], + "addressRoles": [ + { + "address": "inj1...", + "roles": ["minter"] + } + ] + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getVouchersForAddressTemplate = ` +Extract the following details for fetching vouchers by address: +- **address** (string): Account address + +Request format: + +\`\`\`json +{ + "address": "inj1..." +} +\`\`\` + +Response will contain array of vouchers: +- **vouchers** (array): List of voucher objects containing: + - **coins** (array): List of coin objects containing: + - **amount** (string): Token amount + - **denom** (string): Token denomination + +Response format: + +\`\`\`json +{ + "vouchers": [ + { + "coins": [ + { + "amount": "1000000000000000000", + "denom": "peggy0x..." + } + ] + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/staking.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/staking.ts new file mode 100644 index 00000000000..d7f4f1e11ba --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/staking.ts @@ -0,0 +1,664 @@ +// Staking Module Templates Aligned with Actions + +export const getStakingModuleParamsTemplate = ` +Request to fetch staking module parameters. No parameters required. + +Response will contain module parameters: +- **unbondingTime** (number): Time in seconds for unbonding period +- **maxValidators** (number): Maximum number of validators +- **maxEntries** (number): Maximum entries for unbonding delegation +- **historicalEntries** (number): Number of historical entries to persist +- **bondDenom** (string): Native token denomination for staking + +Response format: + +\`\`\`json +{ + "unbondingTime": 1209600, + "maxValidators": 100, + "maxEntries": 7, + "historicalEntries": 10000, + "bondDenom": "inj" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getPoolTemplate = ` +Request to fetch staking pool information. No parameters required. + +Response will contain pool details: +- **notBondedTokens** (string): Amount of tokens not bonded +- **bondedTokens** (string): Amount of tokens bonded + +Response format: + +\`\`\`json +{ + "notBondedTokens": "1000000000000000000", + "bondedTokens": "5000000000000000000" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getValidatorsTemplate = ` +Extract the following details for fetching validators: +- **pagination** (object): Optional pagination parameters + - **key** (string): Page key + - **offset** (number): Page offset + - **limit** (number): Page size + - **countTotal** (boolean): Whether to count total + +Request format: + +\`\`\`json +{ + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain validator list and pagination details. + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getValidatorTemplate = ` +Extract the following details for fetching a specific validator: +- **address** (string): Validator operator address + +Request format: + +\`\`\`json +{ + "address": "injvaloper1..." +} +\`\`\` + +Response will contain validator details including description, commission rates, and delegation information. + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getValidatorDelegationsTemplate = ` +Extract the following details for fetching validator delegations: +- **validatorAddress** (string): Validator address +- **pagination** (object): Optional pagination parameters + +Request format: + +\`\`\`json +{ + "validatorAddress": "injvaloper1...", + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain list of delegations to this validator. + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getValidatorDelegationsNoThrowTemplate = ` +Extract the following details for fetching validator delegations (safe version): +- **validatorAddress** (string): Validator address +- **pagination** (object): Optional pagination parameters + +Request format: + +\`\`\`json +{ + "validatorAddress": "injvaloper1...", + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain list of delegations to this validator. This version handles errors gracefully. + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getValidatorUnbondingDelegationsTemplate = ` +Extract the following details for fetching validator unbonding delegations: +- **validatorAddress** (string): Validator address +- **pagination** (object): Optional pagination parameters + +Request format: + +\`\`\`json +{ + "validatorAddress": "injvaloper1...", + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain list of unbonding delegations from this validator. + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getValidatorUnbondingDelegationsNoThrowTemplate = ` +Extract the following details for fetching validator unbonding delegations (safe version): +- **validatorAddress** (string): Validator address +- **pagination** (object): Optional pagination parameters + +Request format: + +\`\`\`json +{ + "validatorAddress": "injvaloper1...", + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain list of unbonding delegations from this validator. This version handles errors gracefully. + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDelegationsTemplate = ` +Extract the following details for fetching all delegations: +- **injectiveAddress** (string): Delegator address +- **pagination** (object): Optional pagination parameters + +Request format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain list of all delegations for this address. + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDelegationsNoThrowTemplate = ` +Extract the following details for fetching all delegations (safe version): +- **injectiveAddress** (string): Delegator address +- **pagination** (object): Optional pagination parameters + +Request format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain list of all delegations for this address. This version handles errors gracefully. + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getUnbondingDelegationsTemplate = ` +Extract the following details for fetching unbonding delegations: +- **injectiveAddress** (string): Delegator address +- **pagination** (object): Optional pagination parameters + +Request format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain list of unbonding delegations for this address. + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getReDelegationsTemplate = ` +Extract the following details for fetching redelegations: +- **injectiveAddress** (string): Delegator address +- **pagination** (object): Optional pagination parameters + +Request format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain list of redelegations for this address. + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgCreateValidatorTemplate = ` +Extract the following details for creating a validator: +- **moniker** (string): Validator name +- **identity** (string): Optional identity string (e.g., Keybase) +- **website** (string): Optional website URL +- **securityContact** (string): Optional security contact +- **details** (string): Optional validator details +- **rate** (string): Commission rate (e.g., "0.100000000000000000") +- **maxRate** (string): Maximum commission rate +- **maxChangeRate** (string): Maximum commission change rate +- **minSelfDelegation** (string): Minimum self-delegation amount +- **delegatorAddress** (string): Delegator address +- **validatorAddress** (string): Validator address +- **pubkey** (string): Validator public key +- **value** (object): Initial self-delegation + - **denom** (string): Token denomination + - **amount** (string): Token amount + +Request format: + +\`\`\`json +{ + "description": { + "moniker": "Validator Name", + "identity": "keybase-id", + "website": "https://validator.com", + "securityContact": "security@validator.com", + "details": "Validator details" + }, + "commission": { + "rate": "0.100000000000000000", + "maxRate": "0.200000000000000000", + "maxChangeRate": "0.010000000000000000" + }, + "minSelfDelegation": "1000000000000000000", + "delegatorAddress": "inj1...", + "validatorAddress": "injvaloper1...", + "pubkey": "injvalconspub1...", + "value": { + "denom": "inj", + "amount": "1000000000000000000" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgEditValidatorTemplate = ` +Extract the following details for editing a validator: +- **description** (object): Updated validator description + - **moniker** (string): Optional new validator name + - **identity** (string): Optional new identity string + - **website** (string): Optional new website URL + - **securityContact** (string): Optional new security contact + - **details** (string): Optional new validator details +- **validatorAddress** (string): Validator address +- **commissionRate** (string): Optional new commission rate +- **minSelfDelegation** (string): Optional new minimum self-delegation amount + +Request format: + +\`\`\`json +{ + "description": { + "moniker": "New Validator Name", + "identity": "new-keybase-id", + "website": "https://new-website.com", + "securityContact": "new-security@validator.com", + "details": "Updated validator details" + }, + "validatorAddress": "injvaloper1...", + "commissionRate": "0.150000000000000000", + "minSelfDelegation": "2000000000000000000" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgDelegateTemplate = ` +Extract the following details for delegating tokens: +- **delegatorAddress** (string): Delegator address +- **validatorAddress** (string): Validator address +- **amount** (object): Delegation amount + - **denom** (string): Token denomination + - **amount** (string): Token amount + +Request format: + +\`\`\`json +{ + "delegatorAddress": "inj1...", + "validatorAddress": "injvaloper1...", + "amount": { + "denom": "inj", + "amount": "1000000000000000000" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgBeginRedelegateTemplate = ` +Extract the following details for beginning a redelegation: +- **delegatorAddress** (string): Delegator address +- **validatorSrcAddress** (string): Source validator address +- **validatorDstAddress** (string): Destination validator address +- **amount** (object): Amount to redelegate + - **denom** (string): Token denomination + - **amount** (string): Token amount + +Request format: + +\`\`\`json +{ + "delegatorAddress": "inj1...", + "validatorSrcAddress": "injvaloper1...", + "validatorDstAddress": "injvaloper2...", + "amount": { + "denom": "inj", + "amount": "1000000000000000000" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Staking Module Templates - Part 2 (Message Templates Continued) + +export const msgUndelegateTemplate = ` +Extract the following details for undelegating tokens: +- **delegatorAddress** (string): Delegator address +- **validatorAddress** (string): Validator address +- **amount** (object): Amount to undelegate + - **denom** (string): Token denomination + - **amount** (string): Token amount + +Request format: + +\`\`\`json +{ + "delegatorAddress": "inj1...", + "validatorAddress": "injvaloper1...", + "amount": { + "denom": "inj", + "amount": "1000000000000000000" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgCancelUnbondingDelegationTemplate = ` +Extract the following details for canceling an unbonding delegation: +- **delegatorAddress** (string): Delegator address +- **validatorAddress** (string): Validator address +- **amount** (object): Amount to cancel unbonding + - **denom** (string): Token denomination + - **amount** (string): Token amount +- **creationHeight** (number): Original unbonding creation height + +Request format: + +\`\`\`json +{ + "delegatorAddress": "inj1...", + "validatorAddress": "injvaloper1...", + "amount": { + "denom": "inj", + "amount": "1000000000000000000" + }, + "creationHeight": 1000000 +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDelegationTemplate = ` +Extract the following details for fetching a specific delegation: +- **injectiveAddress** (string): Delegator address +- **validatorAddress** (string): Validator address + +Request format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "validatorAddress": "injvaloper1..." +} +\`\`\` + +Response will contain delegation details: +- **delegation** (object): Delegation information + - **delegatorAddress** (string): Delegator address + - **validatorAddress** (string): Validator address + - **shares** (string): Delegation shares +- **balance** (object): Balance information + - **denom** (string): Token denomination + - **amount** (string): Token amount + +Response format: + +\`\`\`json +{ + "delegation": { + "delegatorAddress": "inj1...", + "validatorAddress": "injvaloper1...", + "shares": "1000000000000000000" + }, + "balance": { + "denom": "inj", + "amount": "1000000000000000000" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDelegatorsTemplate = ` +Extract the following details for fetching all delegators of a validator: +- **validatorAddress** (string): Validator address +- **pagination** (object): Optional pagination parameters + - **key** (string): Page key + - **offset** (number): Page offset + - **limit** (number): Page size + - **countTotal** (boolean): Whether to count total + +Request format: + +\`\`\`json +{ + "validatorAddress": "injvaloper1...", + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain delegations and pagination: +- **delegations** (array): List of delegations +- **pagination** (object): Pagination information + - **nextKey** (string): Next page key + - **total** (string): Total count if requested + +Response format: + +\`\`\`json +{ + "delegations": [ + { + "delegation": { + "delegatorAddress": "inj1...", + "validatorAddress": "injvaloper1...", + "shares": "1000000000000000000" + }, + "balance": { + "denom": "inj", + "amount": "1000000000000000000" + } + } + ], + "pagination": { + "nextKey": "xyz789...", + "total": "50" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Template for NoThrow versions (handling errors gracefully) +export const getDelegatorsNoThrowTemplate = ` +Extract the following details for fetching all delegators (safe version): +- **validatorAddress** (string): Validator address +- **pagination** (object): Optional pagination parameters + - **key** (string): Page key + - **offset** (number): Page offset + - **limit** (number): Page size + - **countTotal** (boolean): Whether to count total + +Request format: + +\`\`\`json +{ + "validatorAddress": "injvaloper1...", + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain delegations and pagination (same format as getDelegatorsTemplate). +This version handles errors gracefully and won't throw exceptions. + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Additional NoThrow templates for other endpoints +export const getUnbondingDelegationsNoThrowTemplate = ` +Extract the following details for fetching unbonding delegations (safe version): +- **injectiveAddress** (string): Delegator address +- **pagination** (object): Optional pagination parameters + +Request format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain list of unbonding delegations. +This version handles errors gracefully and won't throw exceptions. + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getReDelegationsNoThrowTemplate = ` +Extract the following details for fetching redelegations (safe version): +- **injectiveAddress** (string): Delegator address +- **pagination** (object): Optional pagination parameters + +Request format: + +\`\`\`json +{ + "injectiveAddress": "inj1...", + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain list of redelegations. +This version handles errors gracefully and won't throw exceptions. + +Here are the recent user messages for context: +{{recentMessages}} +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/token-factory.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/token-factory.ts new file mode 100644 index 00000000000..1f9679f6a08 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/token-factory.ts @@ -0,0 +1,227 @@ +// Token Factory Module Templates + +export const getDenomsFromCreatorTemplate = ` +Extract the following details for fetching denominations from creator: +- **creator** (string): Creator's address + +Request format: + +\`\`\`json +{ + "creator": "inj1..." +} +\`\`\` + +Response will contain an array of denominations: +- **denoms** (array): List of denomination strings + +Response format: + +\`\`\`json +{ + "denoms": [ + "factory/inj1.../token1", + "factory/inj1.../token2" + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getDenomAuthorityMetadataTemplate = ` +Extract the following details for fetching denomination authority metadata: +- **creator** (string): Creator's address +- **subDenom** (string): Sub-denomination identifier + +Request format: + +\`\`\`json +{ + "creator": "inj1...", + "subDenom": "token1" +} +\`\`\` + +Response will contain authority metadata: +- **authorityMetadata** (object): Authority metadata information + - **admin** (string): Admin address (can be undefined) + +Response format: + +\`\`\`json +{ + "authorityMetadata": { + "admin": "inj1..." + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getTokenFactoryModuleParamsTemplate = ` +Request to fetch token factory module parameters. No parameters required. + +Response will contain module parameters: +- **denomCreationFee** (array): Array of creation fee coins + - **denom** (string): Token denomination + - **amount** (string): Fee amount + +Response format: + +\`\`\`json +{ + "denomCreationFee": [ + { + "denom": "inj", + "amount": "1000000000000000000" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getTokenFactoryModuleStateTemplate = ` +Request to fetch token factory module state. No parameters required. + +Response will contain module state: +- **denomCreationFee** (array): Array of creation fee coins + - **denom** (string): Token denomination + - **amount** (string): Fee amount +- **factoryDenoms** (array): List of factory denominations with metadata + - **denom** (string): Full denomination string + - **authorityMetadata** (object): Authority metadata + - **admin** (string): Admin address + +Response format: + +\`\`\`json +{ + "denomCreationFee": [ + { + "denom": "inj", + "amount": "1000000000000000000" + } + ], + "factoryDenoms": [ + { + "denom": "factory/inj1.../token1", + "authorityMetadata": { + "admin": "inj1..." + } + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgBurnTemplate = ` +Extract the following details for burning tokens: +- **amount** (object): Amount to burn + - **denom** (string): Token denomination + - **amount** (string): Token amount + +Request format: + +\`\`\`json +{ + "amount": { + "denom": "factory/inj1.../token1", + "amount": "1000000000000000000" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgChangeAdminTemplate = ` +Extract the following details for changing token admin: +- **denom** (string): Token denomination +- **newAdmin** (string): New admin address + +Request format: + +\`\`\`json +{ + "denom": "factory/inj1.../token1", + "newAdmin": "inj1..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgCreateDenomTemplate = ` +Extract the following details for creating a new denomination: +- **subDenom** (string): Sub-denomination identifier + +Request format: + +\`\`\`json +{ + "subDenom": "token1" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgMintTemplate = ` +Extract the following details for minting tokens: +- **totalAmount** (object): Amount to mint + - **denom** (string): Token denomination + - **amount** (string): Token amount + +Request format: + +\`\`\`json +{ + "totalAmount": { + "denom": "factory/inj1.../token1", + "amount": "1000000000000000000" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgSetDenomMetadataTemplate = ` +Extract the following details for setting denomination metadata: +- **description** (string): Token description +- **denom** (string): Token denomination +- **name** (string): Token name +- **symbol** (string): Token symbol +- **uri** (string): Project URI +- **uriHash** (string): URI hash + +Request format: + +\`\`\`json +{ + "description": "Example Token", + "denom": "factory/inj1.../token1", + "name": "Example Token", + "symbol": "EXT", + "uri": "https://example.com", + "uriHash": "hash123" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/template/wasm.ts b/packages/plugin-injective/injective-sdk-client-ts/src/template/wasm.ts new file mode 100644 index 00000000000..99e882a0e4e --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/template/wasm.ts @@ -0,0 +1,848 @@ +// WASM and WasmX Module Templates + +// WasmX Module Templates + +export const getWasmxModuleParamsTemplate = ` +Request to fetch WasmX module parameters. No parameters required. + +Response will contain module parameters as per the WasmX params structure: +- **params** (object): Module parameters and settings + +Response format: + +\`\`\`json +{ + "params": { + "is_execution_enabled": true, + "registration_fee": { + "denom": "inj", + "amount": "100000000000000000000" + }, + "max_begin_block_tx_gas": 1000000, + "max_contract_gas_limit": 500000, + "min_gas_price": "1000000000" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getWasmxModuleStateTemplate = ` +Request to fetch WasmX module state. No parameters required. + +Response will contain the complete module state: +- **params** (object): Module parameters +- **registered_contracts** (array): List of registered contracts + - **address** (string): Contract address + - **gas_limit** (number): Gas limit + - **gas_price** (string): Gas price + - **is_executable** (boolean): Execution status + - **code_id** (number): Contract code ID + +Response format: + +\`\`\`json +{ + "params": { + "is_execution_enabled": true, + "registration_fee": { + "denom": "inj", + "amount": "100000000000000000000" + }, + "max_begin_block_tx_gas": 1000000, + "max_contract_gas_limit": 500000, + "min_gas_price": "1000000000" + }, + "registered_contracts": [ + { + "address": "inj1...", + "gas_limit": 1000000, + "gas_price": "1000000000", + "is_executable": true, + "code_id": 1 + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Standard WASM Module Templates + +export const getContractAccountsBalanceTemplate = ` +Extract the following details for fetching contract accounts balance: +- **contractAddress** (string): Contract address +- **pagination** (object): Optional pagination parameters + - **key** (string): Page key + - **offset** (number): Page offset + - **limit** (number): Page size + - **countTotal** (boolean): Whether to count total + +Request format: + +\`\`\`json +{ + "contractAddress": "inj1...", + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain contract balances and information: +- **tokenInfo** (object): Token information + - **name** (string): Token name + - **symbol** (string): Token symbol + - **decimals** (number): Token decimals + - **total_supply** (string): Total supply + - **mint** (string): Mint address +- **contractInfo** (object): Contract information + - **codeId** (number): Code ID + - **creator** (string): Creator address + - **admin** (string): Admin address + - **label** (string): Contract label +- **marketingInfo** (object): Marketing information + - **project** (string): Project name + - **description** (string): Project description + - **logo** (object): Logo information + - **url** (string): Logo URL + - **marketing** (string): Marketing info +- **contractAccountsBalance** (array): List of account balances + - **account** (string): Account address + - **balance** (string): Account balance + +Response format: + +\`\`\`json +{ + "tokenInfo": { + "name": "Example Token", + "symbol": "EXT", + "decimals": 18, + "total_supply": "1000000000000000000000000", + "mint": "inj1..." + }, + "contractInfo": { + "codeId": 1, + "creator": "inj1...", + "admin": "inj1...", + "label": "Example Contract" + }, + "marketingInfo": { + "project": "Example Project", + "description": "Example Description", + "logo": { + "url": "https://example.com/logo.png" + }, + "marketing": "Example Marketing Info" + }, + "contractAccountsBalance": [ + { + "account": "inj1...", + "balance": "1000000000000000000" + } + ], + "pagination": { + "nextKey": "xyz789...", + "total": "100" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getContractStateTemplate = ` +Extract the following details for fetching contract state: +- **contractAddress** (string): Contract address +- **pagination** (object): Optional pagination parameters + +Request format: + +\`\`\`json +{ + "contractAddress": "inj1...", + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain contract state with same structure as getContractAccountsBalanceTemplate. + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getContractInfoTemplate = ` +Extract the following details for fetching contract information: +- **contractAddress** (string): Contract address + +Request format: + +\`\`\`json +{ + "contractAddress": "inj1..." +} +\`\`\` + +Response will contain contract information: +- **codeId** (number): Code ID +- **creator** (string): Creator address +- **admin** (string): Admin address +- **label** (string): Contract label +- **created** (object): Creation information + - **blockHeight** (number): Block height + - **txIndex** (number): Transaction index +- **ibcPortId** (string): IBC port ID +- **extension** (object): Optional extension data + +Response format: + +\`\`\`json +{ + "codeId": 1, + "creator": "inj1...", + "admin": "inj1...", + "label": "Example Contract", + "created": { + "blockHeight": 1000000, + "txIndex": 0 + }, + "ibcPortId": "wasm.1", + "extension": { + "typeUrl": "example", + "value": "base64encodeddata" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getContractHistoryTemplate = ` +Extract the following details for fetching contract history: +- **contractAddress** (string): Contract address + +Request format: + +\`\`\`json +{ + "contractAddress": "inj1..." +} +\`\`\` + +Response will contain contract history: +- **entriesList** (array): List of history entries + - **operation** (string): Operation type + - **codeId** (number): Code ID + - **updated** (object): Update information + - **blockHeight** (number): Block height + - **txIndex** (number): Transaction index + - **msg** (string): Operation message +- **pagination** (object): Pagination information + +Response format: + +\`\`\`json +{ + "entriesList": [ + { + "operation": "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT", + "codeId": 1, + "updated": { + "blockHeight": 1000000, + "txIndex": 0 + }, + "msg": "base64encodeddata" + } + ], + "pagination": { + "nextKey": "xyz789...", + "total": "10" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getSmartContractStateTemplate = ` +Extract the following details for fetching smart contract state: +- **contractAddress** (string): Contract address +- **query** (string or object): Query parameters + +Request format: + +\`\`\`json +{ + "contractAddress": "inj1...", + "query": { + "get_state": {} + } +} +\`\`\` + +Response will contain contract-specific state data. + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getRawContractStateTemplate = ` +Extract the following details for fetching raw contract state: +- **contractAddress** (string): Contract address +- **query** (string): Query key + +Request format: + +\`\`\`json +{ + "contractAddress": "inj1...", + "query": "base64encodedkey" +} +\`\`\` + +Response will contain raw contract state data. + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getContractCodesTemplate = ` +Extract the following details for fetching contract codes: +- **pagination** (object): Optional pagination parameters + +Request format: + +\`\`\`json +{ + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain list of code information: +- **codeInfosList** (array): List of code information + - **codeId** (number): Code ID + - **creator** (string): Creator address + - **dataHash** (string): Code data hash +- **pagination** (object): Pagination information + +Response format: + +\`\`\`json +{ + "codeInfosList": [ + { + "codeId": 1, + "creator": "inj1...", + "dataHash": "base64encodeddata" + } + ], + "pagination": { + "nextKey": "xyz789...", + "total": "50" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getContractCodeTemplate = ` +Extract the following details for fetching contract code: +- **codeId** (number): Code ID + +Request format: + +\`\`\`json +{ + "codeId": 1 +} +\`\`\` + +Response will contain code information and data: +- **codeInfo** (object): Code information + - **codeId** (number): Code ID + - **creator** (string): Creator address + - **dataHash** (string): Code data hash +- **data** (string): Base64 encoded WASM bytecode + +Response format: + +\`\`\`json +{ + "codeInfo": { + "codeId": 1, + "creator": "inj1...", + "dataHash": "base64encodeddata" + }, + "data": "base64encodedwasmcode" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getContractCodeContractsTemplate = ` +Extract the following details for fetching contracts by code ID: +- **codeId** (number): Code ID +- **pagination** (object): Optional pagination parameters + +Request format: + +\`\`\`json +{ + "codeId": 1, + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain list of contracts: +- **contractsList** (array): List of contract addresses +- **pagination** (object): Pagination information + +Response format: + +\`\`\`json +{ + "contractsList": [ + "inj1...", + "inj2..." + ], + "pagination": { + "nextKey": "xyz789...", + "total": "20" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Message Templates + +export const msgStoreCodeTemplate = ` +Extract the following details for storing contract code: +- **sender** (string): Sender address +- **wasmByteCode** (string): Base64 encoded WASM bytecode +- **instantiatePermission** (object): Optional instantiation permission + - **permission** (string): Permission type + - **address** (string): Restricted address + +Request format: + +\`\`\`json +{ + "sender": "inj1...", + "wasmByteCode": "base64encodedwasmcode", + "instantiatePermission": { + "permission": "Everybody", + "address": "" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgUpdateAdminTemplate = ` +Extract the following details for updating contract admin: +- **sender** (string): Current admin address +- **newAdmin** (string): New admin address +- **contract** (string): Contract address + +Request format: + +\`\`\`json +{ + "sender": "inj1...", + "newAdmin": "inj2...", + "contract": "inj3..." +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgExecuteContractTemplate = ` +Extract the following details for executing contract: +- **sender** (string): Sender address +- **contract** (string): Contract address +- **msg** (string or object): Execute message +- **funds** (array): Optional funds to send + - **denom** (string): Token denomination + - **amount** (string): Token amount + +Request format: + +\`\`\`json +{ + "sender": "inj1...", + "contract": "inj2...", + "msg": { + "execute": { + "action": "transfer", + "amount": "1000000000000000000", + "recipient": "inj3..." + } + }, + "funds": [ + { + "denom": "inj", + "amount": "1000000000000000000" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgMigrateContractTemplate = ` +Extract the following details for migrating contract: +- **sender** (string): Admin address +- **contract** (string): Contract address +- **codeId** (number): New code ID +- **msg** (string or object): Migration message + +Request format: + +\`\`\`json +{ + "sender": "inj1...", + "contract": "inj2...", + "codeId": 2, + "msg": { + "migrate": { + "new_parameter": "value" + } + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgInstantiateContractTemplate = ` +Extract the following details for instantiating contract: +- **sender** (string): Sender address +- **admin** (string): Optional admin address +- **codeId** (number): Code ID to instantiate +- **label** (string): Contract label +- **msg** (object): Instantiation message +- **funds** (array): Optional funds to send + - **denom** (string): Token denomination + - **amount** (string): Token amount + +Request format: + +\`\`\`json +{ + "sender": "inj1...", + "admin": "inj2...", + "codeId": 1, + "label": "Example Contract", + "msg": { + "name": "Example Token", + "symbol": "EXT", + "decimals": 18, + "initial_balances": [ + { + "address": "inj3...", + "amount": "1000000000000000000000000" + } + ] + }, + "funds": [ + { + "denom": "inj", + "amount": "1000000000000000000" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgExecuteContractCompatTemplate = ` +Extract the following details for executing contract in compatibility mode: +- **sender** (string): Sender address +- **contract** (string): Contract address +- **msg** (object): Execute message in compatibility format +- **funds** (array): Optional funds to send + - **denom** (string): Token denomination + - **amount** (string): Token amount + +Request format: + +\`\`\`json +{ + "sender": "inj1...", + "contract": "inj2...", + "msg": { + "send": { + "to": "inj3...", + "amount": "1000000000000000000" + } + }, + "funds": [ + { + "denom": "inj", + "amount": "1000000000000000000" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const msgPrivilegedExecuteContractTemplate = ` +Extract the following details for privileged contract execution: +- **sender** (string): Privileged sender address +- **contract** (string): Contract address +- **msg** (object): Privileged execute message + +Request format: + +\`\`\`json +{ + "sender": "inj1...", + "contract": "inj2...", + "msg": { + "privileged_action": { + "parameter": "value" + } + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Additional Query Templates for Contract State + +export const getContractStateByKeyTemplate = ` +Extract the following details for fetching contract state by key: +- **contractAddress** (string): Contract address +- **key** (string): State key in base64 format + +Request format: + +\`\`\`json +{ + "contractAddress": "inj1...", + "key": "base64encodedkey" +} +\`\`\` + +Response will contain state value for the given key in base64 format. + +Response format: + +\`\`\`json +{ + "data": "base64encodedvalue" +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getContractHistoryByOperationTemplate = ` +Extract the following details for fetching contract history by operation type: +- **contractAddress** (string): Contract address +- **operationType** (string): Operation type (Init/Migrate/Genesis) + +Request format: + +\`\`\`json +{ + "contractAddress": "inj1...", + "operationType": "Init" +} +\`\`\` + +Response will contain filtered history entries: +- **entries** (array): List of history entries matching the operation type + - **operation** (string): Operation type + - **codeId** (number): Code ID + - **updated** (object): Update information + - **blockHeight** (number): Block height + - **txIndex** (number): Transaction index + - **msg** (string): Operation message + +Response format: + +\`\`\`json +{ + "entries": [ + { + "operation": "Init", + "codeId": 1, + "updated": { + "blockHeight": 1000000, + "txIndex": 0 + }, + "msg": "base64encodeddata" + } + ] +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +export const getContractCodeHistoryTemplate = ` +Extract the following details for fetching complete contract code history: +- **contractAddress** (string): Contract address +- **pagination** (object): Optional pagination parameters + +Request format: + +\`\`\`json +{ + "contractAddress": "inj1...", + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain complete code history: +- **history** (array): List of all code changes + - **codeId** (number): Code ID + - **timeStamp** (string): Change timestamp + - **operation** (string): Operation type + - **msg** (string): Operation message + - **initiator** (string): Change initiator address +- **pagination** (object): Pagination information + +Response format: + +\`\`\`json +{ + "history": [ + { + "codeId": 1, + "timeStamp": "2024-01-01T00:00:00Z", + "operation": "Init", + "msg": "base64encodeddata", + "initiator": "inj1..." + } + ], + "pagination": { + "nextKey": "xyz789...", + "total": "10" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; + +// Templates for Contract Events and Logs + +export const getContractEventsTemplate = ` +Extract the following details for fetching contract events: +- **contractAddress** (string): Contract address +- **eventType** (string): Optional event type filter +- **pagination** (object): Optional pagination parameters + +Request format: + +\`\`\`json +{ + "contractAddress": "inj1...", + "eventType": "wasm", + "pagination": { + "key": "abc123...", + "offset": 0, + "limit": 100, + "countTotal": true + } +} +\`\`\` + +Response will contain contract events: +- **events** (array): List of contract events + - **type** (string): Event type + - **attributes** (array): Event attributes + - **key** (string): Attribute key + - **value** (string): Attribute value + - **blockHeight** (number): Block height + - **txHash** (string): Transaction hash +- **pagination** (object): Pagination information + +Response format: + +\`\`\`json +{ + "events": [ + { + "type": "wasm", + "attributes": [ + { + "key": "action", + "value": "transfer" + }, + { + "key": "amount", + "value": "1000000000000000000" + } + ], + "blockHeight": 1000000, + "txHash": "0x..." + } + ], + "pagination": { + "nextKey": "xyz789...", + "total": "100" + } +} +\`\`\` + +Here are the recent user messages for context: +{{recentMessages}} +`; diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/auction.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/auction.ts new file mode 100644 index 00000000000..ae8601a51f0 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/auction.ts @@ -0,0 +1,13 @@ +//Auction Module Params +export interface MsgBidRequestParams { + amount: string; + round: number; +} +export interface GetAuctionRoundParams { + round: number; +} + +export interface GetAuctionsParams { + startRound: number; + limit: number; +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/auth.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/auth.ts new file mode 100644 index 00000000000..5f9c4acd8e4 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/auth.ts @@ -0,0 +1,60 @@ +import { + PaginationOption, + GrantWithDecodedAuthorization, + GrantAuthorizationWithDecodedAuthorization, + Pagination, + Msgs, +} from "@injectivelabs/sdk-ts"; +import { AddressParams } from "./base"; +// Auth Module Params +// Start of Get Auth Module Request Parameters +export interface AuthAccountParams extends AddressParams { + accountAddress: string; +} +export interface GetGrantsParams { + granter: string; + grantee: string; + pagination?: PaginationOption; +} + +export interface GetGranterGrantsParams { + granter: string; + pagination?: PaginationOption; +} + +export interface GetGranteeGrantsParams { + grantee: string; + pagination?: PaginationOption; +} +export interface MsgGrantParams { + messageType: string; + grantee: string; + granter: string; +} + +export interface MsgAuthzExecParams { + grantee: string; + msgs: Msgs | Msgs[]; +} +export interface MsgRevokeParams { + messageType: string; + grantee: string; + granter: string; +} +// End of Get Auth Module Request Parameters +// Start of Auth Response Parameters +export interface GrantsResponse { + pagination: Pagination; + grants: GrantWithDecodedAuthorization[]; +} + +export interface GranterGrantsResponse { + pagination: Pagination; + grants: GrantAuthorizationWithDecodedAuthorization[]; +} + +export interface GranteeGrantsResponse { + pagination: Pagination; + grants: GrantAuthorizationWithDecodedAuthorization[]; +} +// End of Auth Response Parameters diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/bank.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/bank.ts new file mode 100644 index 00000000000..8fb6b2c8a1f --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/bank.ts @@ -0,0 +1,99 @@ +import { PaginationOption, Pagination, Coin } from "@injectivelabs/sdk-ts"; +import { CosmosBaseV1Beta1Coin } from "@injectivelabs/core-proto-ts"; +import { DenomParam } from "./base"; +// Bank Module Params +// Start of Get Bank Request Parameters +export interface GetBankBalanceParams { + denom: string; +} + +export interface GetBankBalancesParams { + pagination?: PaginationOption; +} + +export interface GetSupplyOfParams { + denom: string; +} + +export interface GetDenomMetadataParams { + denom: string; +} + +export interface GetDenomOwnersParams { + denom: string; +} + +export interface BankBalanceParams { + accountAddress: string; + denom: string; +} + +export interface MsgSendParams { + amount: + | { + denom: string; + amount: string; + } + | { + denom: string; + amount: string; + }[]; + srcInjectiveAddress: string; + dstInjectiveAddress: string; +} + +export interface MsgMultiSendParams { + inputs: { + address: string; + coins: CosmosBaseV1Beta1Coin.Coin[]; + }[]; + outputs: { + address: string; + coins: CosmosBaseV1Beta1Coin.Coin[]; + }[]; +} +// End of Get Bank Module Parameters +// Start of Bank Module Response Parameters +export interface BankModuleParamsResponse { + params: any; // Replace 'any' with actual params type from your SDK +} + +export interface BankBalanceResponse { + balance: Coin; +} + +export interface BankBalancesResponse { + balances: Coin[]; + pagination: Pagination; +} + +export interface TotalSupplyResponse { + supply: { denom: string; amount: string }[]; + pagination: Pagination; +} + +export interface SupplyOfResponse { + amount: Coin; +} + +export interface DenomsMetadataResponse { + metadatas: Metadata[]; + pagination: Pagination; +} + +export interface DenomMetadataResponse { + metadata: Metadata; +} + +export interface DenomOwnersResponse { + denomOwners: { + address: string; + balance: Coin | undefined; + }[]; + pagination: Pagination; +} + +export interface DenomMetadataParams extends DenomParam {} + +export interface DenomOwnerParams extends DenomParam {} +// End of Bank Module Response parameters diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/base.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/base.ts new file mode 100644 index 00000000000..2e7da0044af --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/base.ts @@ -0,0 +1,17 @@ +import { PaginationOption } from "@injectivelabs/sdk-ts"; +export interface PaginationParams { + pagination?: PaginationOption; +} +export interface PaginationParams { + pagination?: PaginationOption; +} +export interface AddressParams { + address: string; +} +export interface TimeRangeParams { + startTime?: number; + endTime?: number; +} +export interface DenomParam { + denom: string; +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/distribution.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/distribution.ts new file mode 100644 index 00000000000..60750f0ef80 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/distribution.ts @@ -0,0 +1,41 @@ +// Distribution Module Params +// Start of Get Distribution Module Parameters + +import { + DistributionModuleParams, + ValidatorRewards, + Coin, +} from "@injectivelabs/sdk-ts"; +export interface DelegatorValidatorParams { + delegatorAddress: string; + validatorAddress: string; +} +export interface MsgWithdrawDelegatorRewardParams { + delegatorAddress: string; + validatorAddress: string; +} +export interface MsgWithdrawValidatorCommissionParams { + validatorAddress: string; +} +export interface GetDelegatorRewardsForValidatorParams { + delegatorAddress: string; + validatorAddress: string; +} + +export interface GetDelegatorRewardsParams { + injectiveAddress: string; +} +// End of Get Distribution Module Request parameters +// Start of Distribution Module Response +export interface DistributionModuleParamsResponse { + params: DistributionModuleParams; +} + +export interface DelegatorRewardsForValidatorResponse { + rewards: Coin[]; +} + +export interface DelegatorRewardsResponse { + rewards: ValidatorRewards[]; +} +// End of Distribution Module Response parameters diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/exchange.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/exchange.ts new file mode 100644 index 00000000000..4d8a5f5307c --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/exchange.ts @@ -0,0 +1,659 @@ +import { + PaginationOption, + TradeDirection, + TradeExecutionType, + TradeExecutionSide, + GrpcMarketStatus, + MarketType, + GridStrategyType, +} from "@injectivelabs/sdk-ts"; +import { PaginationParams, TimeRangeParams } from "./base"; +import { + InjectiveExchangeV1Beta1Exchange, + InjectiveOracleV1Beta1Oracle, +} from "@injectivelabs/core-proto-ts"; +import { OrderSide, OrderState } from "@injectivelabs/ts-types"; + +export interface MarketIdParam { + marketId: string; +} + +export interface SubaccountIdParam { + subaccountId: string; +} +// Exchange Module +// Start of Get Exchange Module Params +export interface GetModuleParamsParams {} + +export interface GetModuleStateParams {} + +export interface GetFeeDiscountScheduleParams {} + +export interface GetFeeDiscountAccountInfoParams { + injAddress: string; +} + +export interface GetTradingRewardsCampaignParams {} + +export interface GetTradeRewardPointsParams { + injectiveAddresses: string[]; +} + +export interface GetPendingTradeRewardPointsParams { + injectiveAddresses: string[]; +} + +export interface GetExchangePositionsParams {} + +export interface GetSubaccountTradeNonceParams { + subaccountId: string; +} + +export interface GetIsOptedOutOfRewardsParams { + account: string; +} + +export interface GetDerivativeMarketsParams { + quoteDenom?: string; + marketStatus?: string; + marketStatuses?: string[]; +} + +export interface GetDerivativeMarketParams { + marketId: string; +} + +export interface GetBinaryOptionsMarketsParams { + marketStatus?: string; + quoteDenom?: string; + pagination?: PaginationOption; +} + +export interface GetBinaryOptionsMarketParams { + marketId: string; +} + +export interface GetDerivativeOrdersParams { + marketId?: string; + marketIds?: string[]; + orderSide?: OrderSide; + isConditional?: boolean; + subaccountId?: string; + pagination?: PaginationOption; +} + +export interface GetDerivativeOrderHistoryParams { + subaccountId?: string; + marketId?: string; + marketIds?: string[]; + orderTypes?: OrderSide[]; + executionTypes?: TradeExecutionType[]; + direction?: TradeDirection; + isConditional?: boolean; + state?: OrderState; + pagination?: PaginationOption; +} + +export interface GetPositionsParams { + marketId?: string; + marketIds?: string[]; + subaccountId?: string; + direction?: TradeDirection; + pagination?: PaginationOption; +} + +export interface GetPositionsV2Params { + address?: string; + marketId?: string; + marketIds?: string[]; + subaccountId?: string; + direction?: TradeDirection; + pagination?: PaginationOption; +} + +export interface GetDerivativeTradesParams { + endTime?: number; + tradeId?: string; + marketId?: string; + startTime?: number; + marketIds?: string[]; + subaccountId?: string; + accountAddress?: string; + direction?: TradeDirection; + pagination?: PaginationOption; + executionSide?: TradeExecutionSide; + executionTypes?: TradeExecutionType[]; +} + +export interface GetFundingPaymentsParams { + marketId?: string; + marketIds?: string[]; + subaccountId?: string; + pagination?: PaginationOption; +} + +export interface GetFundingRatesParams { + marketId?: string; + pagination?: PaginationOption; +} + +export interface GetDerivativeSubaccountOrdersListParams { + marketId?: string; + subaccountId?: string; + pagination?: PaginationOption; +} + +export interface GetDerivativeSubaccountTradesListParams { + marketId?: string; + subaccountId?: string; + direction?: TradeDirection; + executionType?: TradeExecutionType; + pagination?: PaginationOption; +} + +export interface GetDerivativeOrderbooksV2Params { + marketIds: string[]; +} + +export interface GetDerivativeOrderbookV2Params { + marketId: string; +} + +export interface GetRewardsParams { + address: string; + epoch: number; +} + +export interface GetSubaccountsListParams { + address: string; +} + +export interface GetSubaccountBalancesListParams { + subaccountId: string; +} + +export interface GetSubaccountHistoryParams { + subaccountId: string; + denom?: string; + transferTypes?: string[]; + pagination?: PaginationOption; +} + +export interface GetSubaccountOrderSummaryParams { + subaccountId: string; + marketId?: string; + orderDirection?: string; +} + +export interface GetOrderStatesParams { + spotOrderHashes?: string[]; + derivativeOrderHashes?: string[]; +} + +export interface GetAccountPortfolioParams { + address: string; +} + +export interface GetAccountPortfolioBalancesParams { + address: string; +} + +export interface GetSpotMarketsParams { + baseDenom?: string; + marketStatus?: string; + quoteDenom?: string; + marketStatuses?: string[]; +} + +export interface GetSpotMarketParams { + marketId: string; +} + +export interface GetSpotOrdersParams { + marketId?: string; + marketIds?: string[]; + subaccountId?: string; + orderSide?: OrderSide; + isConditional?: boolean; + pagination?: PaginationOption; +} + +export interface GetSpotOrderHistoryParams { + subaccountId?: string; + marketId?: string; + marketIds?: string[]; + orderTypes?: OrderSide[]; + executionTypes?: TradeExecutionType[]; + direction?: TradeDirection; + isConditional?: boolean; + state?: OrderState; + pagination?: PaginationOption; +} + +export interface GetSpotTradesParams { + endTime?: number; + tradeId?: string; + marketId?: string; + startTime?: number; + marketIds?: string[]; + subaccountId?: string; + accountAddress?: string; + direction?: TradeDirection; + pagination?: PaginationOption; + executionSide?: TradeExecutionSide; + executionTypes?: TradeExecutionType[]; +} + +export interface GetSpotSubaccountOrdersListParams { + subaccountId?: string; + marketId?: string; + pagination?: PaginationOption; +} + +export interface GetSpotSubaccountTradesListParams { + subaccountId?: string; + marketId?: string; + direction?: TradeDirection; + executionType?: TradeExecutionType; + pagination?: PaginationOption; +} + +export interface GetSpotOrderbooksV2Params { + marketIds: string[]; +} + +export interface GetSpotOrderbookV2Params { + marketId: string; +} + +export interface GetAtomicSwapHistoryParams { + address: string; + contractAddress: string; + pagination?: PaginationOption; +} + +export interface GetGridStrategiesParams { + accountAddress?: string; + subaccountId?: string; + state?: string; + marketId?: string; + limit?: number; + skip?: number; + marketType?: MarketType; + strategyType?: GridStrategyType[]; +} + +export interface GetHistoricalBalanceParams { + account: string; + resolution: string; +} + +export interface GetHistoricalRpnlParams { + account: string; + resolution: string; +} + +export interface GetHistoricalVolumesParams { + account: string; + resolution: string; +} + +export interface GetPnlLeaderboardParams { + startDate: string; + endDate: string; + limit?: number; + account?: string; +} + +export interface GetVolLeaderboardParams { + startDate: string; + endDate: string; + limit?: number; + account?: string; +} + +export interface GetPnlLeaderboardFixedResolutionParams { + resolution: string; + limit?: number; + account?: string; +} + +export interface GetVolLeaderboardFixedResolutionParams { + resolution: string; + limit?: number; + account?: string; +} + +export interface GetDenomHoldersParams { + denom: string; + token?: string; + limit?: number; +} +export interface MarketParams extends PaginationParams { + baseDenom?: string; + quoteDenom?: string; + marketStatus?: string; + marketStatuses?: string[]; +} + +export interface OrderParams extends PaginationParams { + marketId?: string; + marketIds?: string[]; + subaccountId?: string; + orderSide?: OrderSide; + isConditional?: boolean; +} + +export interface OrderHistoryParams extends PaginationParams { + subaccountId?: string; + marketId?: string; + marketIds?: string[]; + orderTypes?: OrderSide[]; + executionTypes?: TradeExecutionType[]; + direction?: TradeDirection; + isConditional?: boolean; + state?: OrderState; +} + +export interface PositionParams extends PaginationParams { + marketId?: string; + marketIds?: string[]; + subaccountId?: string; + direction?: TradeDirection; + address?: string; +} + +export interface TradeParams extends TimeRangeParams, PaginationParams { + tradeId?: string; + marketId?: string; + marketIds?: string[]; + subaccountId?: string; + accountAddress?: string; + direction?: TradeDirection; + executionSide?: TradeExecutionSide; + executionTypes?: TradeExecutionType[]; +} + +export interface FundingParams extends PaginationParams { + marketId?: string; + marketIds?: string[]; + subaccountId?: string; +} + +export interface SubaccountOrderParams extends PaginationParams { + marketId?: string; + subaccountId?: string; +} + +export interface SubaccountTradeParams extends SubaccountOrderParams { + direction?: TradeDirection; + executionType?: TradeExecutionType; +} + +export interface SubaccountHistoryParams extends SubaccountIdParam { + denom?: string; + transferTypes?: string[]; + pagination?: PaginationOption; +} + +export interface SubaccountOrderSummaryParams extends SubaccountIdParam { + marketId?: string; + orderDirection?: string; +} + +export interface OrderStateParams { + spotOrderHashes?: string[]; + derivativeOrderHashes?: string[]; +} + +export interface GetSpotOrderbookV2Params { + marketId: string; +} + +export interface MsgAdminUpdateBinaryOptionsMarketParams { + sender: string; + marketId: string; + settlementPrice: string; + expirationTimestamp: string; + settlementTimestamp: string; + status: GrpcMarketStatus; +} + +export interface MsgAuthorizeStakeGrantsParams { + grantee: string; + amount: string; +} + +export interface MsgBatchCancelBinaryOptionsOrdersParams { + orders: { + marketId: string; + subaccountId: string; + orderHash?: string; + orderMask?: InjectiveExchangeV1Beta1Exchange.OrderMask; + cid?: string; + }[]; +} + +export interface MsgBatchCancelDerivativeOrdersParams { + orders: { + marketId: string; + subaccountId: string; + orderHash?: string; + orderMask?: InjectiveExchangeV1Beta1Exchange.OrderMask; + cid?: string; + }[]; +} + +export interface MsgBatchCancelSpotOrdersParams { + orders: { + marketId: string; + subaccountId: string; + orderHash?: string; + orderMask?: InjectiveExchangeV1Beta1Exchange.OrderMask; + cid?: string; + }[]; +} + +export interface MsgBatchUpdateOrdersParams { + subaccountId: string; + spotMarketIdsToCancelAll?: string[]; + derivativeMarketIdsToCancelAll?: string[]; + binaryOptionsMarketIdsToCancelAll?: string[]; + spotOrdersToCancel?: { + marketId: string; + subaccountId: string; + orderHash?: string; + cid?: string; + }[]; +} + +export interface MsgCancelBinaryOptionsOrderParams { + marketId: string; + subaccountId: string; + orderHash?: string; + orderMask?: InjectiveExchangeV1Beta1Exchange.OrderMask; + cid?: string; +} + +export interface MsgCancelDerivativeOrderParams { + marketId: string; + subaccountId: string; + orderHash?: string; + orderMask?: InjectiveExchangeV1Beta1Exchange.OrderMask; + cid?: string; +} + +export interface MsgCancelSpotOrderParams { + marketId: string; + subaccountId: string; + orderHash?: string; + cid?: string; +} + +export interface MsgCreateBinaryOptionsLimitOrderParams { + marketId: string; + subaccountId: string; + orderType: InjectiveExchangeV1Beta1Exchange.OrderType; + triggerPrice?: string; + feeRecipient: string; + price: string; + margin: string; + quantity: string; + cid?: string; +} + +export interface MsgCreateBinaryOptionsMarketOrderParams { + marketId: string; + subaccountId: string; + orderType: InjectiveExchangeV1Beta1Exchange.OrderType; + triggerPrice?: string; + feeRecipient: string; + price: string; + margin: string; + quantity: string; + cid?: string; +} + +export interface MsgCreateDerivativeLimitOrderParams { + marketId: string; + subaccountId: string; + orderType: InjectiveExchangeV1Beta1Exchange.OrderType; + triggerPrice?: string; + feeRecipient: string; + price: string; + margin: string; + quantity: string; + cid?: string; +} + +export interface MsgCreateDerivativeMarketOrderParams { + marketId: string; + subaccountId: string; + orderType: InjectiveExchangeV1Beta1Exchange.OrderType; + triggerPrice?: string; + feeRecipient: string; + price: string; + margin: string; + quantity: string; + cid?: string; +} + +export interface MsgCreateSpotLimitOrderParams { + marketId: string; + subaccountId: string; + orderType: InjectiveExchangeV1Beta1Exchange.OrderType; + triggerPrice?: string; + feeRecipient: string; + price: string; + quantity: string; + cid?: string; +} + +export interface MsgCreateSpotMarketOrderParams { + marketId: string; + subaccountId: string; + orderType: InjectiveExchangeV1Beta1Exchange.OrderType; + triggerPrice?: string; + feeRecipient: string; + price: string; + quantity: string; + cid?: string; +} + +export interface MsgDepositParams { + subaccountId: string; + amount: { + amount: string; + denom: string; + }; +} + +export interface MsgExternalTransferParams { + srcSubaccountId: string; + dstSubaccountId: string; + totalAmount: { + amount: string; + denom: string; + }; +} + +export interface MsgIncreasePositionMarginParams { + marketId: string; + srcSubaccountId: string; + dstSubaccountId: string; + amount: string; +} + +export interface MsgInstantBinaryOptionsMarketLaunchParams { + proposer: string; + market: { + ticker: string; + admin: string; + oracleSymbol: string; + oracleProvider: string; + oracleScaleFactor: number; + oracleType: InjectiveOracleV1Beta1Oracle.OracleType; + quoteDenom: string; + makerFeeRate: string; + takerFeeRate: string; + expirationTimestamp: number; + settlementTimestamp: number; + minPriceTickSize: string; + minQuantityTickSize: string; + minNotional: string; + }; +} + +export interface MsgInstantSpotMarketLaunchParams { + proposer: string; + market: { + sender: string; + ticker: string; + baseDenom: string; + quoteDenom: string; + minNotional: string; + minPriceTickSize: string; + minQuantityTickSize: string; + }; +} + +export interface MsgLiquidatePositionParams { + subaccountId: string; + injectiveAddress: string; + marketId: string; + /** optional order to provide for liquidation */ + order?: { + marketId: string; + subaccountId: string; + orderType: InjectiveExchangeV1Beta1Exchange.OrderType; + triggerPrice?: string; + feeRecipient: string; + price: string; + margin: string; + quantity: string; + cid?: string; + }; +} + +export interface MsgReclaimLockedFundsParams { + sender: string; + lockedAccountPubKey: string; + signature: Uint8Array; +} + +export interface MsgRewardsOptOutParams { + sender: string; +} + +export interface MsgSignDataParams { + sender: string; + data: string; +} + +export interface MsgWithdrawParams { + subaccountId: string; + amount: { + amount: string; + denom: string; + }; +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/explorer.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/explorer.ts new file mode 100644 index 00000000000..2a11e2dba65 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/explorer.ts @@ -0,0 +1,149 @@ +import { + Transaction, + ExplorerValidator, + ValidatorUptime, + PeggyDepositTx, + PeggyWithdrawalTx, + IBCTransferTx, + ExplorerStats, + ExchangePagination, +} from "@injectivelabs/sdk-ts"; +import { InjectiveExplorerRpc } from "@injectivelabs/indexer-proto-ts"; +import { TimeRangeParams } from "./base"; +/// Explorer Module Params +export interface GetTxByHashParams { + hash: string; +} +export interface GetExplorerValidatorParams { + address: string; +} +export interface GetAccountTxParams { + address: string; + limit?: number; + type?: string; + before?: number; + after?: number; + startTime?: number; + endTime?: number; +} + +export interface GetValidatorUptimeParams { + validatorAddress: string; +} + +export interface GetPeggyDepositTxsParams { + receiver?: string; + sender?: string; + limit?: number; + skip?: number; +} + +export interface GetPeggyWithdrawalTxsParams { + sender?: string; + receiver?: string; + limit?: number; + skip?: number; +} + +export interface GetBlocksParams { + before?: number; + after?: number; + limit?: number; + from?: number; + to?: number; +} + +export interface GetBlockParams { + id: string; +} + +export interface GetTxsParams { + before?: number; + after?: number; + limit?: number; + skip?: number; + type?: string; + startTime?: number; + endTime?: number; + chainModule?: string; +} + +export interface GetIBCTransferTxsParams { + sender?: string; + receiver?: string; + srcChannel?: string; + srcPort?: string; + destChannel?: string; + destPort?: string; + limit?: number; + skip?: number; +} + +// Response interfaces +export interface GetTxByHashResponse { + tx: Transaction; +} + +export interface GetAccountTxResponse { + txs: Transaction[]; + pagination: ExchangePagination; +} + +export interface GetExplorerValidatorResponse { + validator: ExplorerValidator; +} + +export interface GetValidatorUptimeResponse { + uptime: ValidatorUptime[]; +} + +export interface GetPeggyDepositTxsResponse { + txs: PeggyDepositTx[]; +} + +export interface GetPeggyWithdrawalTxsResponse { + txs: PeggyWithdrawalTx[]; +} + +export interface GetBlocksResponse + extends InjectiveExplorerRpc.GetBlocksResponse {} + +export interface GetBlockResponse + extends InjectiveExplorerRpc.GetBlockResponse {} + +export interface GetTxsResponse extends InjectiveExplorerRpc.GetTxsResponse {} + +export interface GetIBCTransferTxsResponse { + txs: IBCTransferTx[]; +} + +export interface GetExplorerStatsResponse { + stats: ExplorerStats; +} + +export interface AccountTxParams extends TimeRangeParams { + address: string; + limit?: number; + type?: string; + before?: number; + after?: number; +} + +export interface BlocksParams extends TimeRangeParams { + before?: number; + after?: number; + limit?: number; +} + +export interface BlockParams { + id: string; +} + +export interface TxsParams extends TimeRangeParams { + before?: number; + after?: number; + limit?: number; + skip?: number; + type?: string; + chainModule?: string; +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/gov.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/gov.ts new file mode 100644 index 00000000000..2b2a074be63 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/gov.ts @@ -0,0 +1,196 @@ +import { + PaginationOption, + Pagination, + Msgs, + GovModuleStateParams, + Proposal, + ProposalDeposit, + Vote, + TallyResult, +} from "@injectivelabs/sdk-ts"; +import { PaginationParams } from "./base"; +import { + CosmosGovV1Gov, + InjectiveExchangeV1Beta1Exchange, + InjectiveOracleV1Beta1Oracle, +} from "@injectivelabs/core-proto-ts"; +// Governance Module Params +export interface GetProposalsParams { + status: CosmosGovV1Gov.ProposalStatus; + pagination?: PaginationOption; +} + +export interface GetProposalParams { + proposalId: number; +} + +export interface GetProposalDepositsParams { + proposalId: number; + pagination?: PaginationOption; +} + +export interface GetProposalVotesParams { + proposalId: number; + pagination?: PaginationOption; +} + +export interface GetProposalTallyParams { + proposalId: number; +} + +// Response interfaces +export interface GovernanceModuleParamsResponse { + params: GovModuleStateParams; +} + +export interface GetProposalsResponse { + proposals: Proposal[]; + pagination: Pagination; +} + +export interface GetProposalResponse { + proposal: Proposal; +} + +export interface GetProposalDepositsResponse { + deposits: ProposalDeposit[]; + pagination: Pagination; +} + +export interface GetProposalVotesResponse { + votes: Vote[]; + pagination: Pagination; +} + +export interface GetProposalTallyResponse { + tally: TallyResult; +} + +export interface ProposalParams extends PaginationParams { + status: CosmosGovV1Gov.ProposalStatus; +} + +export interface ProposalQueryParams { + proposalId: number; +} + +export interface MsgSubmitProposalExpiryFuturesMarketLaunchParams { + market: { + title: string; + description: string; + ticker: string; + quoteDenom: string; + oracleBase: string; + oracleQuote: string; + expiry: number; + oracleScaleFactor: number; + oracleType: InjectiveOracleV1Beta1Oracle.OracleType; + initialMarginRatio: string; + maintenanceMarginRatio: string; + makerFeeRate: string; + takerFeeRate: string; + minPriceTickSize: string; + minQuantityTickSize: string; + }; + deposit: { + amount: string; + denom: string; + }; +} + +export interface MsgSubmitProposalSpotMarketLaunchParams { + market: { + title: string; + description: string; + ticker: string; + baseDenom: string; + quoteDenom: string; + minPriceTickSize: string; + minQuantityTickSize: string; + makerFeeRate: string; + takerFeeRate: string; + minNotional: string; + }; + deposit: { + amount: string; + denom: string; + }; +} + +export interface MsgSubmitProposalPerpetualMarketLaunchParams { + market: { + title: string; + description: string; + ticker: string; + quoteDenom: string; + oracleBase: string; + oracleQuote: string; + oracleScaleFactor: number; + oracleType: InjectiveOracleV1Beta1Oracle.OracleType; + initialMarginRatio: string; + maintenanceMarginRatio: string; + makerFeeRate: string; + takerFeeRate: string; + minPriceTickSize: string; + minQuantityTickSize: string; + minNotional: string; + }; + deposit: { + amount: string; + denom: string; + }; +} + +export interface MsgVoteParams { + proposalId: number; + metadata: string; + vote: CosmosGovV1Gov.VoteOption; +} + +export interface MsgSubmitTextProposalParams { + title: string; + description: string; + deposit: { + amount: string; + denom: string; + }; +} + +export interface MsgSubmitProposalSpotMarketParamUpdateParams { + market: { + title: string; + description: string; + marketId: string; + makerFeeRate: string; + takerFeeRate: string; + relayerFeeShareRate: string; + minPriceTickSize: string; + minQuantityTickSize: string; + ticker: string; + status: InjectiveExchangeV1Beta1Exchange.MarketStatus; + }; + deposit: { + amount: string; + denom: string; + }; +} + +export interface MsgSubmitGenericProposalParams { + title: string; + summary: string; + expedited?: boolean; + metadata?: string; + messages: Msgs[]; + deposit: { + amount: string; + denom: string; + }; +} + +export interface MsgGovDepositParams { + proposalId: number; + amount: { + denom: string; + amount: string; + }; +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/ibc.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/ibc.ts new file mode 100644 index 00000000000..582c5c35f57 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/ibc.ts @@ -0,0 +1,48 @@ +import { PaginationOption } from "@injectivelabs/sdk-ts"; +import { DenomTrace } from "@injectivelabs/core-proto-ts/cjs/ibc/applications/transfer/v1/transfer.js"; +import { PaginationParams } from "./base"; +//IBC params +export interface GetDenomTraceParams { + hash: string; +} + +export interface GetDenomsTraceParams { + pagination?: PaginationOption; +} + +// Response interfaces +export interface GetDenomTraceResponse { + denomTrace: DenomTrace; +} + +export interface GetDenomsTraceResponse { + denomsTrace: DenomTrace[]; +} + +export interface IBCTransferParams extends PaginationParams { + sender?: string; + receiver?: string; + srcChannel?: string; + srcPort?: string; + destChannel?: string; + destPort?: string; + limit?: number; + skip?: number; +} + +export interface MsgIBCTransferParams { + amount: { + denom: string; + amount: string; + }; + memo?: string; + sender: string; + port: string; + receiver: string; + channelId: string; + timeout?: number; + height?: { + revisionHeight: number; + revisionNumber: number; + }; +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/index.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/index.ts new file mode 100644 index 00000000000..ceb1f7d2ae7 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/index.ts @@ -0,0 +1,44 @@ +export * from "./base"; +export * from "./auction"; +export * from "./auth"; +export * from "./bank"; +export * from "./distribution"; +export * from "./exchange"; +export * from "./explorer"; +export * from "./gov"; +export * from "./ibc"; +export * from "./insurance"; +export * from "./mint"; +export * from "./mito"; +export * from "./peggy"; +export * from "./permissions"; +export * from "./staking"; +export * from "./token-factory"; +export * from "./wasm"; + +// Generic Standard Response +export interface StandardResponse { + success: boolean; + result: T; +} + +// Helper functions with generic success type parameter +export function createSuccessResponse(data: T): StandardResponse { + return { + success: true, + result: data, + }; +} +// Helper functions with generic error type parameter +export function createErrorResponse( + code: string, + details?: unknown +): StandardResponse { + return { + success: false, + result: { + code, + details, + }, + }; +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/insurance.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/insurance.ts new file mode 100644 index 00000000000..242067a87d4 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/insurance.ts @@ -0,0 +1,78 @@ +import { InsuranceFund, InsuranceModuleParams } from "@injectivelabs/sdk-ts"; +import { InjectiveOracleV1Beta1Oracle } from "@injectivelabs/core-proto-ts"; + +// Insurance Fund Module Params +export interface GetInsuranceFundParams { + marketId: string; +} + +export interface GetEstimatedRedemptionsParams { + marketId: string; + address: string; +} + +export interface GetPendingRedemptionsParams { + marketId: string; + address: string; +} + +// Response interfaces +export interface InsuranceModuleParamsResponse { + params: InsuranceModuleParams; +} + +export interface GetInsuranceFundsResponse { + funds: InsuranceFund[]; +} + +export interface GetInsuranceFundResponse { + fund: InsuranceFund; +} + +export interface RedemptionAmount { + amount: string; + denom: string; +} + +export interface GetEstimatedRedemptionsResponse { + redemption: RedemptionAmount; +} + +export interface GetPendingRedemptionsResponse { + redemptions: RedemptionAmount[]; +} +export interface InsuranceFundParams { + marketId: string; + address: string; +} + +export interface MsgCreateInsuranceFundParams { + fund: { + ticker: string; + quoteDenom: string; + oracleBase: string; + oracleQuote: string; + oracleType: InjectiveOracleV1Beta1Oracle.OracleType; + expiry?: number; + }; + deposit: { + amount: string; + denom: string; + }; +} + +export interface MsgRequestRedemptionParams { + marketId: string; + amount: { + denom: string; + amount: string; + }; +} + +export interface MsgUnderwriteParams { + marketId: string; + amount: { + denom: string; + amount: string; + }; +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/mint.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/mint.ts new file mode 100644 index 00000000000..18e0bba08cf --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/mint.ts @@ -0,0 +1,14 @@ +import { MinModuleParams } from "@injectivelabs/sdk-ts"; +// Mint module params +// Response interfaces +export interface MintModuleParamsResponse { + params: MinModuleParams; +} + +export interface GetInflationResponse { + inflation: string; +} + +export interface GetAnnualProvisionsResponse { + annualProvisions: string; +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/mito.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/mito.ts new file mode 100644 index 00000000000..e9aa45f2072 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/mito.ts @@ -0,0 +1,542 @@ +import { + Coin, + MitoVault, + MitoPagination, + MitoPriceSnapshot, + MitoSubscription, + MitoHolders, + MitoPortfolio, + MitoLeaderboard, + MitoTransfer, + MitoLeaderboardEpoch, + MitoStakingPool, + MitoMission, + MitoMissionLeaderboard, + MitoIDO, + MitoIDOSubscriber, + MitoTokenInfo, + MitoIDOSubscription, + MitoIDOSubscriptionActivity, + MitoWhitelistAccount, + MitoClaimReference, +} from "@injectivelabs/sdk-ts"; +import { PaginationParams, TimeRangeParams, AddressParams } from "./base"; +// Mito Module Params +// Param interfaces + +export interface GetVaultParams { + contractAddress?: string; + slug?: string; +} + +export interface GetVaultsParams { + limit?: number; + codeId?: string; + pageIndex?: number; +} + +export interface GetLpTokenPriceChartParams { + to?: string; + from?: string; + vaultAddress: string; +} + +export interface GetTVLChartParams { + to?: string; + from?: string; + vaultAddress: string; +} + +export interface GetVaultsByHolderAddressParams { + skip?: number; + limit?: number; + holderAddress: string; + vaultAddress?: string; +} + +export interface GetLPHoldersParams { + skip?: number; + limit?: number; + vaultAddress: string; + stakingContractAddress: string; +} + +export interface GetHolderPortfolioParams { + holderAddress: string; + stakingContractAddress: string; +} + +export interface GetTransferHistoryParams { + vault?: string; + account?: string; + limit?: number; + toNumber?: number; + fromNumber?: number; +} + +export interface GetLeaderboardParams { + epochId?: number; +} + +export interface GetLeaderboardEpochsParams { + limit?: number; + toEpochId?: number; + fromEpochId?: number; +} + +export interface GetStakingPoolsParams { + staker?: string; + stakingContractAddress: string; +} + +export interface GetStakingHistoryParams { + staker?: string; + limit?: number; + toNumber?: number; + fromNumber?: number; +} + +export interface GetStakingRewardsByAccountParams { + staker: string; + stakingContractAddress: string; +} + +export interface GetMissionsParams { + accountAddress: string; +} + +export interface GetMissionLeaderboardParams { + userAddress?: string; +} + +export interface GetIDOParams { + contractAddress: string; + accountAddress?: string; +} + +export interface GetIDOsParams { + status?: string; + limit?: number; + toNumber?: number; + accountAddress?: string; + ownerAddress?: string; +} + +export interface GetIDOSubscribersParams { + skip?: number; + limit?: number; + sortBy?: string; + contractAddress: string; +} + +export interface GetIDOSubscriptionParams { + contractAddress: string; + accountAddress: string; +} + +export interface GetIDOActivitiesParams { + contractAddress?: string; + accountAddress?: string; + limit?: number; + toNumber?: string; +} + +export interface GetIDOWhitelistParams { + skip?: number; + limit?: number; + idoAddress: string; +} + +export interface GetClaimReferencesParams { + skip?: number; + limit?: number; + idoAddress: string; + accountAddress: string; +} + +// Response interfaces +export interface GetVaultResponse { + vault: MitoVault; +} + +export interface GetVaultsResponse { + vaults: MitoVault[]; + pagination?: MitoPagination; +} + +export interface GetLpTokenPriceChartResponse { + priceSnapshots: MitoPriceSnapshot[]; +} + +export interface GetTVLChartResponse { + priceSnapshots: MitoPriceSnapshot[]; +} + +export interface GetVaultsByHolderAddressResponse { + subscriptions: MitoSubscription[]; + pagination?: MitoPagination; +} + +export interface GetLPHoldersResponse { + holders: MitoHolders[]; + pagination?: MitoPagination; +} + +export interface GetHolderPortfolioResponse { + portfolio: MitoPortfolio; +} + +export interface GetTransferHistoryResponse { + transfers: MitoTransfer[]; + pagination?: MitoPagination; +} + +export interface GetLeaderboardResponse { + leaderboard: MitoLeaderboard; +} + +export interface GetLeaderboardEpochsResponse { + epochs: MitoLeaderboardEpoch[]; + pagination?: MitoPagination; +} + +export interface GetStakingPoolsResponse { + pools: MitoStakingPool[]; + pagination?: MitoPagination; +} + +export interface StakingActivity { + action: string; + txHash: string; + staker: string; + vaultAddress: string; + numberByAccount: number; + timestamp: number; + rewardedTokens: Coin[]; + stakeAmount: Coin | undefined; +} + +export interface GetStakingHistoryResponse { + activities: StakingActivity[]; + pagination?: MitoPagination; +} + +export interface StakingReward { + apr: number; + vaultName: string; + vaultAddress: string; + lockTimestamp: number; + claimableRewards: Coin[]; + stakedAmount: Coin | undefined; + lockedAmount: Coin | undefined; +} + +export interface GetStakingRewardsByAccountResponse { + rewards: StakingReward[]; + pagination?: MitoPagination; +} + +export interface GetMissionsResponse { + missions: MitoMission[]; +} + +export interface GetMissionLeaderboardResponse { + leaderboard: MitoMissionLeaderboard; +} + +export interface GetIDOResponse { + ido?: MitoIDO; +} + +export interface GetIDOsResponse { + idos: MitoIDO[]; + pagination?: MitoPagination; +} + +export interface GetIDOSubscribersResponse { + marketId: string; + quoteDenom: string; + subscribers: MitoIDOSubscriber[]; + pagination?: MitoPagination; + tokenInfo?: MitoTokenInfo; +} + +export interface GetIDOSubscriptionResponse { + subscription?: MitoIDOSubscription; +} + +export interface GetIDOActivitiesResponse { + activities: MitoIDOSubscriptionActivity[]; + pagination?: MitoPagination; +} + +export interface GetIDOWhitelistResponse { + idoAddress?: string; + accounts: MitoWhitelistAccount[]; + pagination?: MitoPagination; +} + +export interface GetClaimReferencesResponse { + claimReferences: MitoClaimReference[]; + pagination?: MitoPagination; +} + +export interface VaultParams { + contractAddress?: string; + slug?: string; +} + +export interface VaultsParams extends PaginationParams { + limit?: number; + codeId?: string; + pageIndex?: number; +} + +export interface ChartParams extends TimeRangeParams { + vaultAddress: string; +} + +export interface VaultHolderParams extends PaginationParams { + skip?: number; + limit?: number; + holderAddress: string; + vaultAddress?: string; +} + +export interface LPHoldersParams extends PaginationParams { + skip?: number; + limit?: number; + vaultAddress: string; + stakingContractAddress: string; +} + +export interface HolderPortfolioParams { + holderAddress: string; + stakingContractAddress: string; +} + +export interface TransferHistoryParams extends PaginationParams { + vault?: string; + account?: string; + limit?: number; + toNumber?: number; + fromNumber?: number; +} + +export interface LeaderboardEpochParams extends PaginationParams { + limit?: number; + toEpochId?: number; + fromEpochId?: number; +} + +export interface StakingPoolParams { + staker?: string; + stakingContractAddress: string; +} + +export interface StakingHistoryParams extends PaginationParams { + staker?: string; + limit?: number; + toNumber?: number; + fromNumber?: number; +} + +export interface StakingRewardsParams { + staker: string; + stakingContractAddress: string; +} + +export interface MissionParams extends AddressParams { + accountAddress: string; +} + +export interface IDOParams { + contractAddress: string; + accountAddress?: string; +} + +export interface IDOListParams extends PaginationParams { + status?: string; + limit?: number; + toNumber?: number; + accountAddress?: string; + ownerAddress?: string; +} + +export interface IDOSubscribersParams extends PaginationParams { + skip?: number; + limit?: number; + sortBy?: string; + contractAddress: string; +} + +export interface IDOSubscriptionParams { + contractAddress: string; + accountAddress: string; +} + +export interface IDOActivityParams extends PaginationParams { + contractAddress?: string; + accountAddress?: string; + limit?: number; + toNumber?: string; +} + +export interface IDOWhitelistParams extends PaginationParams { + skip?: number; + limit?: number; + idoAddress: string; +} + +export interface ClaimReferenceParams extends PaginationParams { + skip?: number; + limit?: number; + idoAddress: string; + accountAddress: string; +} + +export enum VaultContractType { + ManagedVault = "crates.io:managed-vault", + CPMM = "crates.io:vault-cpmm-spot", + ASMMSpot = "crates.io:vault-asmm-spot", + ASMMPerp = "crates.io:vault-asmm-perp", +} + +export enum DerivativeRedemptionType { + QuoteOnly = "QuoteOnly", + PositionAndQuote = "PositionAndQuote", +} + +export enum SpotRedemptionType { + BaseOnly = "BaseOnly", + QuoteOnly = "QuoteOnly", + BaseAndQuote = "BaseAndQuote", + FixedBaseAndQuote = "FixedBaseAndQuote", + VariableBaseAndQuote = "VariableBaseAndQuote", +} + +export enum VaultMarketType { + Spot = "Spot", + Derivative = "Derivative", +} + +export interface GetLaunchpadSubscribeParams { + amount: number; + quoteTokenDenom: string; + quoteTokenDecimals: number; + contractAddress: string; +} +export interface GetLaunchpadClaimParams { + contractAddress: string; +} + +export interface GetSubscribeVaultParams { + market: { + baseDenom: string; + baseDecimals: number; + quoteDecimals: number; + quoteDenom: string; + }; + + baseAmount: number; + quoteAmount: number; + subscriptionType: SpotRedemptionType; + vaultDetails: { + vaultSubaccountId: string; + vaultMasterAddress: string; + vaultType: VaultContractType; + }; + slippage?: { + max_penalty: string; + }; +} + +export interface GetInstantiateCPMMVaultParams { + MITO_MASTER_CONTRACT_ADDRESS: string; + CPMM_CONTRACT_CODE: number; + senderWalletAddress: string; + marketId: string; + feeBps: number; + baseDecimals: number; + quoteDecimals: number; + funds: { + denom: string; + amount: string; + }[]; + // Overrides default parameters + notionalValueCap?: string; + pricingStrategy?: { + SmoothingPricingWithRelativePriceRange: { + bid_range: string; + ask_range: string; + }; + }; + maxInvariantSensitivityBps?: string; + maxPriceSensitivityBps?: string; + orderType?: string; +} + +export interface GetVaultSubscribeParams { + vaultType: VaultContractType; + slippage?: { + max_penalty: string; + }; + + vaultSubaccountId: string; + baseAmount: number; + quoteAmount: number; + market: { + baseDenom: string; + baseDecimals: number; + quoteDenom: string; + quoteDecimals: number; + }; + subscriptionType: SpotRedemptionType; + masterAddress: string; +} + +export interface GetVaultRedeemParams { + vaultSubaccountId: string; + marketType: VaultMarketType; + slippage?: { + max_penalty: string; + }; + redemptionType: SpotRedemptionType | DerivativeRedemptionType; + redeemAmount: number; + vaultBaseDecimals: number; + masterAddress: string; + vaultLpDenom: string; +} + +export interface GetStakeVaultLPParams { + amount: number; + vaultLpDenom: string; + vaultTokenDecimals: number; + stakingContractAddress: string; +} + +export interface GetUnstakeVaultLPParams { + amount: number; + vaultLpDenom: string; + vaultTokenDecimals: number; + stakingContractAddress: string; +} + +export interface GetClaimVaultRewardsParams { + vaultLpDenom: string; + stakingContractAddress: string; +} + +export interface GetVaultsParams { + skip?: number; + limit?: number; +} + +export interface GetLPHoldersParams { + vaultAddress: string; + stakingContractAddress: string; +} + +export interface GetStakingPoolsParams { + stakingContractAddress: string; +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/peggy.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/peggy.ts new file mode 100644 index 00000000000..182ecabfd8b --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/peggy.ts @@ -0,0 +1,11 @@ +//Peggy +export interface MsgSendToEthParams { + amount: { + denom: string; + amount: string; + }; + bridgeFee?: { + denom: string; + amount: string; + }; +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/permissions.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/permissions.ts new file mode 100644 index 00000000000..4b2e9fa105a --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/permissions.ts @@ -0,0 +1,69 @@ +import { + Coin, + PermissionsModuleParams, + Namespace, +} from "@injectivelabs/sdk-ts"; +import { AddressParams } from "./base"; + +// Base parameter interfaces +// Permissions Module Params +// Param interfaces +export interface GetAddressesByRoleParams { + denom: string; + role: string; +} + +export interface GetAddressRolesParams { + address: string; + denom: string; +} + +export interface GetNamespaceByDenomParams { + denom: string; + includeRoles: boolean; +} + +export interface GetVouchersForAddressParams { + address: string; +} + +// Response interfaces +export interface GetAddressesByRoleResponse { + addresses: string[]; +} + +export interface GetAddressRolesResponse { + roles: string[]; +} + +export interface GetAllNamespacesResponse { + namespaces: Namespace[]; +} + +export interface GetPermissionsModuleParamsResponse { + params: PermissionsModuleParams; +} + +export interface GetNamespaceByDenomResponse { + namespace: Namespace; +} + +export interface GetVouchersForAddressResponse { + vouchers: Coin[]; +} +export interface RoleParams { + denom: string; + role: string; +} + +export interface AddressRoleParams { + address: string; + denom: string; +} + +export interface NamespaceParams { + denom: string; + includeRoles: boolean; +} + +export interface VoucherParams extends AddressParams {} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/staking.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/staking.ts new file mode 100644 index 00000000000..366a48144ee --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/staking.ts @@ -0,0 +1,175 @@ +import { + PaginationOption, + Pagination, + StakingModuleParams, + Pool, + Validator, + Delegation, + UnBondingDelegation, + ReDelegation, +} from "@injectivelabs/sdk-ts"; +import { PaginationParams } from "./base"; +// Staking Module Params +// Param interfaces + +export interface GetValidatorsParams { + pagination?: PaginationOption; +} + +export interface GetValidatorParams { + address: string; +} + +export interface GetValidatorDelegationsParams { + validatorAddress: string; + pagination?: PaginationOption; +} + +export interface GetDelegationParams { + injectiveAddress: string; + validatorAddress: string; +} + +export interface GetDelegationsParams { + injectiveAddress: string; + pagination?: PaginationOption; +} + +export interface GetDelegatorsParams { + validatorAddress: string; + pagination?: PaginationOption; +} + +export interface GetUnbondingDelegationsParams { + injectiveAddress: string; + pagination?: PaginationOption; +} + +export interface GetReDelegationsParams { + injectiveAddress: string; + pagination?: PaginationOption; +} + +// Response interfaces +export interface GetStakingModuleParamsResponse { + params: StakingModuleParams; +} + +export interface GetPoolResponse { + pool: Pool; +} + +export interface GetValidatorsResponse { + validators: Validator[]; + pagination: Pagination; +} + +export interface GetValidatorResponse { + validator: Validator; +} + +export interface GetValidatorDelegationsResponse { + delegations: Delegation[]; + pagination: Pagination; +} + +export interface GetDelegationResponse { + delegation: Delegation; +} + +export interface GetDelegationsResponse { + delegations: Delegation[]; + pagination: Pagination; +} + +export interface GetUnbondingDelegationsResponse { + unbondingDelegations: UnBondingDelegation[]; + pagination: Pagination; +} + +export interface GetReDelegationsResponse { + redelegations: ReDelegation[]; + pagination: Pagination; +} +export interface MsgBeginRedelegateParams { + amount: { + denom: string; + amount: string; + }; + srcValidatorAddress: string; + dstValidatorAddress: string; +} + +export interface MsgDelegateParams { + amount: { + denom: string; + amount: string; + }; + validatorAddress: string; +} + +export interface MsgUndelegateParams { + amount: { + denom: string; + amount: string; + }; + validatorAddress: string; +} + +export interface MsgCreateValidatorParams { + description: { + moniker: string; + identity: string; + website: string; + securityContact?: string; + details: string; + }; + value: { + amount: string; + denom: string; + }; + pubKey: { + type: string; + value: string; + }; + delegatorAddress: string; + validatorAddress: string; + commission: { + maxChangeRate: string; + rate: string; + maxRate: string; + }; +} + +export interface MsgEditValidatorParams { + description: { + moniker: string; + identity: string; + website: string; + securityContact?: string; + details: string; + }; + validatorAddress: string; + commissionRate?: string; + minSelfDelegation?: string; +} + +export interface MsgCancelUnbondingDelegationParams { + amount: { + denom: string; + amount: string; + }; + validatorAddress: string; + delegatorAddress: string; + creationHeight: string; +} + +export interface ValidatorParams extends PaginationParams { + validatorAddress: string; +} + +export interface DelegationParams { + validatorAddress: string; +} + +export interface DelegationsParams extends PaginationParams {} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/token-factory.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/token-factory.ts new file mode 100644 index 00000000000..7c4e56e2c7c --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/token-factory.ts @@ -0,0 +1,63 @@ +import { + AuthorityMetadata, + TokenFactoryModuleParams, + TokenFactoryModuleState, +} from "@injectivelabs/sdk-ts"; +import { CosmosBankV1Beta1Bank } from "@injectivelabs/core-proto-ts"; +// Token Factory Module Params// Param interfaces +export interface GetDenomsFromCreatorParams { + creator: string; +} + +export interface GetDenomAuthorityMetadataParams { + creator: string; + subDenom: string; +} + +// Response interfaces +export interface GetDenomsFromCreatorResponse { + denoms: string[]; +} + +export interface GetDenomAuthorityMetadataResponse { + metadata: AuthorityMetadata; +} + +export interface GetTokenFactoryModuleParamsResponse { + params: TokenFactoryModuleParams; +} + +export interface GetTokenFactoryModuleStateResponse { + state: TokenFactoryModuleState; +} +export interface TokenFactoryParams { + creator: string; + subDenom: string; +} + +export interface MsgBurnParams { + amount: { + amount: string; + denom: string; + }; +} +export interface MsgChangeAdminParams { + denom: string; + newAdmin: string; +} + +export interface MsgCreateDenomParams { + subdenom: string; + decimals?: number; + name?: string; + symbol?: string; +} +export interface MsgMintParams { + totalAmount: { + amount: string; + denom: string; + }; +} +export interface MsgSetDenomMetadataParams { + metadata: CosmosBankV1Beta1Bank.Metadata; +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/src/types/wasm.ts b/packages/plugin-injective/injective-sdk-client-ts/src/types/wasm.ts new file mode 100644 index 00000000000..68fd78d4bc9 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/src/types/wasm.ts @@ -0,0 +1,184 @@ +import { + PaginationOption, + Pagination, + ExecArgs, + ExecPrivilegedArgs, + ContractAccountsBalanceWithPagination, + ContractStateWithPagination, + ContractInfo, + ContractCodeHistoryEntry, + CodeInfoResponse, +} from "@injectivelabs/sdk-ts"; +import { CosmwasmWasmV1Query } from "@injectivelabs/core-proto-ts"; +import { AccessConfig } from "@injectivelabs/core-proto-ts/cjs/cosmwasm/wasm/v1/types"; +import { PaginationParams } from "./base"; +// Wasm Module Params +// Param interfaces +export interface GetContractAccountsBalanceParams { + contractAddress: string; + pagination?: PaginationOption; +} + +export interface GetContractStateParams { + contractAddress: string; + pagination?: PaginationOption; +} + +export interface GetContractInfoParams { + contractAddress: string; +} + +export interface GetContractHistoryParams { + contractAddress: string; +} + +export interface GetSmartContractStateParams { + contractAddress: string; + query?: string | Record; +} + +export interface GetRawContractStateParams { + contractAddress: string; + query?: string; +} + +export interface GetContractCodesParams { + pagination?: PaginationOption; +} + +export interface GetContractCodeParams { + codeId: number; +} + +export interface GetContractCodeContractsParams { + codeId: number; + pagination?: PaginationOption; +} + +// Response interfaces +export interface GetContractAccountsBalanceResponse { + balance: ContractAccountsBalanceWithPagination; +} + +export interface GetContractStateResponse { + state: ContractStateWithPagination; +} + +export interface GetContractInfoResponse { + contractInfo?: ContractInfo; +} + +export interface GetContractHistoryResponse { + entriesList: ContractCodeHistoryEntry[]; + pagination: Pagination; +} + +export interface GetSmartContractStateResponse + extends CosmwasmWasmV1Query.QuerySmartContractStateResponse {} + +export interface GetRawContractStateResponse + extends CosmwasmWasmV1Query.QueryRawContractStateResponse {} + +export interface GetContractCodesResponse { + codeInfosList: CodeInfoResponse[]; + pagination: Pagination; +} + +export interface GetContractCodeResponse { + codeInfo: CodeInfoResponse; + data: Uint8Array; +} + +export interface GetContractCodeContractsResponse { + contractsList: string[]; + pagination: Pagination; +} + +export interface ContractBalanceParams extends PaginationParams { + contractAddress: string; +} + +export interface ContractStateParams extends PaginationParams { + contractAddress: string; +} + +export interface SmartContractParams { + contractAddress: string; + query?: string | Record; +} + +export interface RawContractParams { + contractAddress: string; + query?: string; +} + +export interface ContractCodeParams { + codeId: number; + pagination?: PaginationOption; +} + +export interface MsgStoreCodeParams { + wasmBytes: Uint8Array | string; + instantiatePermission?: AccessConfig; +} +export interface MsgUpdateAdminParams { + newAdmin: string; + contract: string; +} +export interface MsgExecuteContractParams { + funds?: + | { + denom: string; + amount: string; + } + | { + denom: string; + amount: string; + }[]; + sender: string; + contractAddress: string; + execArgs?: ExecArgs; + exec?: { + msg: object; + action: string; + }; + msg?: object; +} +export interface MsgMigrateContractParams { + contract: string; + codeId: number; + msg: object; +} +export interface MsgInstantiateContractParams { + admin: string; + codeId: number; + label: string; + msg: Object; + amount?: { + denom: string; + amount: string; + }; +} +export interface MsgExecuteContractCompatParams { + funds?: + | { + denom: string; + amount: string; + } + | { + denom: string; + amount: string; + }[]; + contractAddress: string; + execArgs?: ExecArgs; + exec?: { + msg: Record; + action: string; + }; + msg?: Record; +} +export interface MsgPrivilegedExecuteContractParams { + funds: string; + contractAddress: string; + data: ExecPrivilegedArgs; +} diff --git a/packages/plugin-injective/injective-sdk-client-ts/tsconfig.json b/packages/plugin-injective/injective-sdk-client-ts/tsconfig.json new file mode 100644 index 00000000000..0605046f5d7 --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "NodeNext", + "lib": [ + "ES2020" + ], + "moduleResolution": "NodeNext", + "strict": true, + "skipLibCheck": true, + "declaration": true, + "outDir": "./dist", + "esModuleInterop": true, + "resolveJsonModule": true, + "isolatedModules": true, + "forceConsistentCasingInFileNames": true + }, + "include": [ + "./**/*.ts", + "./**/*.d.ts" + ], + "exclude": [ + "node_modules", + "dist" + ] +} \ No newline at end of file diff --git a/packages/plugin-injective/injective-sdk-client-ts/tsup.config.ts b/packages/plugin-injective/injective-sdk-client-ts/tsup.config.ts new file mode 100644 index 00000000000..793480487bb --- /dev/null +++ b/packages/plugin-injective/injective-sdk-client-ts/tsup.config.ts @@ -0,0 +1,48 @@ +import { defineConfig } from 'tsup'; +import { builtinModules } from 'module'; +import pkg from './package.json'; + +export default defineConfig({ + entry: ['src/index.ts'], + format: ['cjs', 'esm'], + dts: true, + sourcemap: true, + clean: true, + splitting: false, + minify: false, + platform: 'node', + target: 'node23', + + noExternal: [ + '@injectivelabs/networks', + '@injectivelabs/sdk-ts', + '@injectivelabs/token-metadata', + '@injectivelabs/ts-types', + '@injectivelabs/utils', + 'form-data', + 'combined-stream' + ], + + external: [ + ...builtinModules.filter(mod => mod !== 'util'), + ...Object.keys(pkg.dependencies || {}) + .filter(dep => !dep.startsWith('@injectivelabs/')) + ], + + esbuildOptions: (options) => { + options.mainFields = ['module', 'main']; + options.banner = { + js: ` + import { createRequire } from 'module'; + import { fileURLToPath } from 'url'; + import { dirname } from 'path'; + const require = createRequire(import.meta.url); + const __filename = fileURLToPath(import.meta.url); + const __dirname = dirname(__filename); + ` + }; + options.define = { + 'process.env.NODE_ENV': '"production"' + }; + } +}); \ No newline at end of file diff --git a/packages/plugin-injective/jest.config.js b/packages/plugin-injective/jest.config.js new file mode 100644 index 00000000000..a6b47f84035 --- /dev/null +++ b/packages/plugin-injective/jest.config.js @@ -0,0 +1,9 @@ +module.exports = { + preset: 'ts-jest', + testEnvironment: 'node', + moduleNameMapper: { + '^@injective/(.*)$': '/injective-sdk-client-ts/src/$1' + }, + testMatch: ['**/tests/**/*.test.ts'], + setupFilesAfterEnv: ['./tests/setup.ts'] +}; diff --git a/packages/plugin-injective/package.json b/packages/plugin-injective/package.json new file mode 100644 index 00000000000..13ba85ddf8f --- /dev/null +++ b/packages/plugin-injective/package.json @@ -0,0 +1,51 @@ +{ + "name": "@elizaos/plugin-injective", + "version": "0.1.7", + "description": "", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "type": "module", + "scripts": { + "build": "tsup --format esm --dts", + "dev": "tsup --format esm --dts --watch", + "lint": "eslint --fix --cache .", + "test": "jest", + "test:watch": "jest --watch", + "format": "prettier --write \"src/**/*.ts\"", + "test:coverage": "jest --coverage" + }, + "exports": { + "./package.json": "./package.json", + ".": { + "require": "./dist/index.cjs", + "import": "./dist/index.js", + "types": "./dist/index.d.ts" + } + }, + "files": [ + "dist" + ], + "keywords": [], + "author": "hrishikesh@injectivelabs.org", + "license": "ISC", + "devDependencies": { + "@types/chai": "^5.0.1", + "@types/jest": "^29.5.14", + "@types/node": "^22.10.3", + "@types/sinon": "^17.0.3", + "@typescript-eslint/eslint-plugin": "8.16.0", + "@typescript-eslint/parser": "8.16.0", + "chai": "^5.1.2", + "eslint": "9.16.0", + "jest": "^29.7.0", + "prettier": "3.4.1", + "sinon": "^19.0.2", + "ts-jest": "^29.2.5", + "typescript": "^5.7.2" + }, + "dependencies": { + "@elizaos/adapter-sqlite": "0.1.7-alpha.2", + "@elizaos/core": "workspace:*", + "injective-sdk-client-ts": "file:../../packages/plugin-injective/injective-sdk-client-ts" + } + } \ No newline at end of file diff --git a/packages/plugin-injective/src/action/auction.ts b/packages/plugin-injective/src/action/auction.ts new file mode 100644 index 00000000000..7d1c1e6f31c --- /dev/null +++ b/packages/plugin-injective/src/action/auction.ts @@ -0,0 +1,72 @@ +import { createGenericAction } from "./base"; +import * as AuctionTemplates from "@injective/template/auction"; +import * as AuctionExamples from "@injective/examples/auction"; +import * as AuctionSimilies from "@injective/similes/auction"; +export const GetAuctionModuleParamsAction = createGenericAction({ + name: "GET_AUCTION_MODULE_PARAMS", + description: "Fetches the auction module parameters", + template: AuctionTemplates.getAuctionModuleParamsTemplate, + examples: AuctionExamples.getAuctionModuleParamsExample, + similes: AuctionSimilies.getAuctionModuleParamsSimiles, + functionName: "getAuctionModuleParams", + validateContent: () => true, +}); + +export const GetAuctionModuleStateAction = createGenericAction({ + name: "GET_AUCTION_MODULE_STATE", + description: "Fetches the auction module state", + template: AuctionTemplates.getAuctionModuleStateTemplate, + examples: AuctionExamples.getAuctionModuleStateExample, + similes: AuctionSimilies.getAuctionModuleStateSimiles, + functionName: "getAuctionModuleState", + validateContent: () => true, +}); + +export const GetCurrentBasketAction = createGenericAction({ + name: "GET_CURRENT_BASKET", + description: "Fetches the current auction basket", + template: AuctionTemplates.getCurrentBasketTemplate, + examples: AuctionExamples.getCurrentBasketExample, + functionName: "getCurrentBasket", + similes: AuctionSimilies.getCurrentBasketSimiles, + validateContent: () => true, +}); + +export const GetAuctionRoundAction = createGenericAction({ + name: "GET_AUCTION_ROUND", + description: "Fetches details of a specific auction round", + template: AuctionTemplates.getAuctionRoundTemplate, + examples: AuctionExamples.getAuctionRoundExample, + similes: AuctionSimilies.getAuctionRoundSimiles, + functionName: "getAuctionRound", + validateContent: () => true, +}); + +export const GetAuctionsAction = createGenericAction({ + name: "GET_AUCTIONS", + description: "Fetches a list of auctions", + template: AuctionTemplates.getAuctionsTemplate, + examples: AuctionExamples.getAuctionsExample, + similes: AuctionSimilies.getAuctionsSimiles, + functionName: "getAuctions", + validateContent: () => true, +}); + +export const MsgBidAction = createGenericAction({ + name: "MSG_BID", + description: "Places a bid in an auction round", + template: AuctionTemplates.msgBidTemplate, + examples: AuctionExamples.msgBidExample, + similes: AuctionSimilies.MsgBidSimiles, + functionName: "msgBid", + validateContent: () => true, +}); + +export const AuctionActions = [ + GetAuctionModuleParamsAction, + GetAuctionModuleStateAction, + GetCurrentBasketAction, + GetAuctionRoundAction, + GetAuctionsAction, + MsgBidAction, +]; diff --git a/packages/plugin-injective/src/action/auth.ts b/packages/plugin-injective/src/action/auth.ts new file mode 100644 index 00000000000..ff82e083f31 --- /dev/null +++ b/packages/plugin-injective/src/action/auth.ts @@ -0,0 +1,107 @@ +import { createGenericAction } from "./base"; +import * as AuthTemplates from "@injective/template/auth"; +import * as AuthExamples from "@injective/examples/auth"; +import * as AuthSimilies from "@injective/similes/auth"; +// Auth Module Actions +export const GetAuthModuleParamsAction = createGenericAction({ + name: "GET_AUTH_MODULE_PARAMS", + description: "Fetches the authentication module parameters", + template: AuthTemplates.getAuthModuleParamsTemplate, + examples: AuthExamples.getAuthModuleParamsExample, + similes: AuthSimilies.getAuthModuleParamsSimiles, + functionName: "getAuthModuleParams", + validateContent: () => true, +}); + +export const GetAccountDetailsAction = createGenericAction({ + name: "GET_ACCOUNT_DETAILS", + description: "Fetches the details of the current account", + template: AuthTemplates.getAccountDetailsTemplate, + examples: AuthExamples.getAccountDetailsExample, + similes: AuthSimilies.getAccountDetailsSimiles, + functionName: "getAccountDetails", + validateContent: () => true, +}); + +export const GetAccountsAction = createGenericAction({ + name: "GET_ACCOUNTS", + description: "Fetches all accounts associated with the current address", + template: AuthTemplates.getAccountsTemplate, + examples: AuthExamples.getAccountsExample, + similes: AuthSimilies.getAccountsSimiles, + functionName: "getAccounts", + validateContent: () => true, +}); + +export const GetGrantsAction = createGenericAction({ + name: "GET_GRANTS", + description: "Fetches all grants based on provided parameters", + template: AuthTemplates.getGrantsTemplate, + examples: AuthExamples.getGrantsExample, + similes: AuthSimilies.getGrantsSimiles, + functionName: "getGrants", + validateContent: () => true, +}); + +export const GetGranterGrantsAction = createGenericAction({ + name: "GET_GRANTER_GRANTS", + description: "Fetches all grants granted by a specific granter", + template: AuthTemplates.getGranterGrantsTemplate, + examples: AuthExamples.getGranterGrantsExample, + similes: AuthSimilies.getGranterGrantsSimiles, + functionName: "getGranterGrants", + validateContent: () => true, +}); + +export const GetGranteeGrantsAction = createGenericAction({ + name: "GET_GRANTEE_GRANTS", + description: "Fetches all grants received by a specific grantee", + template: AuthTemplates.getGranteeGrantsTemplate, + examples: AuthExamples.getGranteeGrantsExample, + similes: AuthSimilies.getGranteeGrantsSimiles, + functionName: "getGranteeGrants", + validateContent: () => true, +}); + +export const MsgGrantAction = createGenericAction({ + name: "MSG_GRANT", + description: + "Grants authorization to a grantee to perform specific actions", + template: AuthTemplates.msgGrantTemplate, + examples: AuthExamples.msgGrantExample, + similes: AuthSimilies.msgGrantSimiles, + functionName: "msgGrant", + validateContent: () => true, +}); + +export const MsgExecAction = createGenericAction({ + name: "MSG_EXEC", + description: "Executes authorized messages on behalf of the grantee", + template: AuthTemplates.msgExecTemplate, + examples: AuthExamples.msgExecExample, + similes: AuthSimilies.msgExecSimiles, + functionName: "msgExec", + validateContent: () => true, +}); + +export const MsgRevokeAction = createGenericAction({ + name: "MSG_REVOKE", + description: "Revokes previously granted authorizations from a grantee", + template: AuthTemplates.msgRevokeTemplate, + examples: AuthExamples.msgRevokeExample, + similes: AuthSimilies.msgRevokeSimiles, + functionName: "msgRevoke", + validateContent: () => true, +}); + +export const AuthActions = [ + GetAuthModuleParamsAction, + GetAccountDetailsAction, + GetAccountsAction, + GetGrantsAction, + GetGranterGrantsAction, + GetGranteeGrantsAction, + MsgGrantAction, + MsgExecAction, + MsgRevokeAction, +]; diff --git a/packages/plugin-injective/src/action/bank.ts b/packages/plugin-injective/src/action/bank.ts new file mode 100644 index 00000000000..ace1a608c34 --- /dev/null +++ b/packages/plugin-injective/src/action/bank.ts @@ -0,0 +1,129 @@ +import { createGenericAction } from "./base"; +import * as BankTemplates from "@injective/template/bank"; +import * as BankExamples from "@injective/examples/bank"; +import * as BankSimilies from "@injective/similes/bank"; +// Query Actions +export const GetBankModuleParamsAction = createGenericAction({ + name: "GET_BANK_MODULE_PARAMS", + description: "Fetches the bank module parameters", + template: BankTemplates.getBankModuleParamsTemplate, + examples: BankExamples.getBankModuleParamsExample, + similes: BankSimilies.getBankModuleParamsSimiles, + functionName: "getBankModuleParams", + validateContent: () => true, +}); + +export const GetBankBalanceAction = createGenericAction({ + name: "GET_BANK_BALANCE", + description: "Fetches the balance of a specific account", + template: BankTemplates.getBankBalanceTemplate, + examples: BankExamples.getBankBalanceExample, + similes: BankSimilies.getBankBalanceSimiles, + functionName: "getBankBalance", + validateContent: () => true, +}); + +export const GetBankBalancesAction = createGenericAction({ + name: "GET_BANK_BALANCES", + description: "Fetches all balances for the current account", + template: BankTemplates.getBankBalancesTemplate, + examples: BankExamples.getBankBalancesExample, + similes: BankSimilies.getBankBalancesSimiles, + functionName: "getBankBalances", + validateContent: () => true, +}); + +export const GetTotalSupplyAction = createGenericAction({ + name: "GET_TOTAL_SUPPLY", + description: "Fetches the total supply of all denominations", + template: BankTemplates.getTotalSupplyTemplate, + examples: BankExamples.getTotalSupplyExample, + similes: BankSimilies.getTotalSupplySimiles, + functionName: "getTotalSupply", + validateContent: () => true, +}); + +export const GetAllTotalSupplyAction = createGenericAction({ + name: "GET_ALL_TOTAL_SUPPLY", + description: "Fetches the total supply for all denominations", + template: BankTemplates.getAllTotalSupplyTemplate, + examples: BankExamples.getAllTotalSupplyExample, + similes: BankSimilies.getAllTotalSupplySimiles, + functionName: "getAllTotalSupply", + validateContent: () => true, +}); + +export const GetSupplyOfAction = createGenericAction({ + name: "GET_SUPPLY_OF", + description: "Fetches the supply of a specific denomination", + template: BankTemplates.getSupplyOfTemplate, + examples: BankExamples.getSupplyOfExample, + similes: BankSimilies.getSupplyOfSimiles, + functionName: "getSupplyOf", + validateContent: () => true, +}); + +export const GetDenomsMetadataAction = createGenericAction({ + name: "GET_DENOMS_METADATA", + description: "Fetches metadata for all denominations", + template: BankTemplates.getDenomsMetadataTemplate, + examples: BankExamples.getDenomsMetadataExample, + similes: BankSimilies.getDenomMetadataSimiles, + functionName: "getDenomsMetadata", + validateContent: () => true, +}); + +export const GetDenomMetadataAction = createGenericAction({ + name: "GET_DENOM_METADATA", + description: "Fetches metadata for a specific denomination", + template: BankTemplates.getDenomMetadataTemplate, + examples: BankExamples.getDenomMetadataExample, + similes: BankSimilies.getDenomMetadataSimiles, + functionName: "getDenomMetadata", + validateContent: () => true, +}); + +export const GetDenomOwnersAction = createGenericAction({ + name: "GET_DENOM_OWNERS", + description: "Fetches the owners of a specific denomination", + template: BankTemplates.getDenomOwnersTemplate, + examples: BankExamples.getDenomOwnersExample, + similes: BankSimilies.getDenomOwnersSimiles, + functionName: "getDenomOwners", + validateContent: () => true, +}); + +// Transaction Actions +export const MsgSendAction = createGenericAction({ + name: "MSG_SEND", + description: "Sends tokens from one account to another", + template: BankTemplates.msgSendTemplate, + examples: BankExamples.msgSendExample, + similes: BankSimilies.msgSendSimiles, + functionName: "msgSend", + validateContent: () => true, +}); + +export const MsgMultiSendAction = createGenericAction({ + name: "MSG_MULTI_SEND", + description: "Sends tokens from multiple senders to multiple receivers", + template: BankTemplates.msgMultiSendTemplate, + examples: BankExamples.msgMultiSendExample, + similes: BankSimilies.msgMultiSendSimiles, + functionName: "msgMultiSend", + validateContent: () => true, +}); + +export const BankActions = [ + GetBankModuleParamsAction, + GetBankBalanceAction, + GetBankBalancesAction, + GetTotalSupplyAction, + GetAllTotalSupplyAction, + GetSupplyOfAction, + GetDenomsMetadataAction, + GetDenomMetadataAction, + GetDenomOwnersAction, + MsgSendAction, + MsgMultiSendAction, +]; diff --git a/packages/plugin-injective/src/action/base.ts b/packages/plugin-injective/src/action/base.ts new file mode 100644 index 00000000000..73933aeaafb --- /dev/null +++ b/packages/plugin-injective/src/action/base.ts @@ -0,0 +1,183 @@ +// createGenericAction.ts +import { ActionExample } from "@elizaos/core"; +import { + HandlerCallback, + IAgentRuntime, + Memory, + ModelClass, + State, + elizaLogger, + composeContext, + type Action, + generateObjectDeprecated, + generateText, +} from "@elizaos/core"; +import { InjectiveGrpcClient } from "@injective/modules"; + +/** + * Shape of the arguments to create our generic action. + * + * @property {string} name - The action name (e.g., "PLACE_BID", "CANCEL_BID"). + * @property {string} description - A brief summary of what the action does. + * @property {unknown} template - A template object (e.g., from @injective/template/auction) used for context composition. + * @property {any[]} examples - The example user/assistant interactions you want associated with this action. + * @property {string} functionName - The name of the method you want to call on `InjectiveGrpcClient` (e.g. `"msgBid"`). + * @property {(runtime: IAgentRuntime, content: any) => boolean} validateContent - Function to validate the AI-generated content. + */ +export interface CreateGenericActionArgs { + name: string; + similes: string[]; // (optional) synonyms or alternate names if you like + description: string; + template: string; + examples: any[]; + functionName: string; // e.g. "msgBid" + validateContent: (runtime: IAgentRuntime, content: any) => boolean; +} +/** + * A factory function that returns an ElizaOS Action. + */ +export function createGenericAction({ + name, + description, + template, + examples, + functionName, + similes, +}: CreateGenericActionArgs): Action { + return { + name, // e.g. "PLACE_BID" + description, // e.g. "Place a bid using the InjectiveGrpcClient" + examples: [examples as ActionExample[]], // I have manually casted the inputs here + similes, // (optional) synonyms or alternate names if you like + validate: async (_runtime, _message) => { + return true; + }, + + handler: async ( + runtime: IAgentRuntime, + message: Memory, + state: State, + _options: { [key: string]: unknown }, + callback?: HandlerCallback + ): Promise => { + elizaLogger.debug(`create action: ${name}`); + // 1. Compose or update the state + if (!state) { + state = (await runtime.composeState(message)) as State; + } else { + state = await runtime.updateRecentMessageState(state); + } + + // 2. Compose a context from the given template + const context = composeContext({ + state, + template, + }); + + // 3. Use the AI model to generate content based on the context + const params = await generateObjectDeprecated({ + runtime, + context, + modelClass: ModelClass.LARGE, + }); + + // 5. Initialize the Injective client + try { + const rawNetwork = runtime.getSetting("INJECTIVE_NETWORK"); + const injectivePrivateKey = runtime.getSetting( + "INJECTIVE_PRIVATE_KEY" + ); + const ethPublicKey = runtime.getSetting("EVM_PUBLIC_KEY"); + const injPublicKey = runtime.getSetting("INJECTIVE_PUBLIC_KEY"); + const network = rawNetwork as + | "MainnetK8s" + | "MainnetLB" + | "Mainnet" + | "MainnetSentry" + | "MainnetOld" + | "Staging" + | "Internal" + | "TestnetK8s" + | "TestnetOld" + | "TestnetSentry" + | "Testnet" + | "Devnet1" + | "Devnet2" + | "Devnet" + | "Local"; + if ( + !injectivePrivateKey || + (!ethPublicKey && !injPublicKey) || + !network + ) { + throw new Error("Incorrect configuration"); + } + + const client = new InjectiveGrpcClient( + network, + injectivePrivateKey, + ethPublicKey, + injPublicKey + ); + + // 6. Dynamically call the specified functionName on the Injective client + const method = (client as any)[functionName]; + if (typeof method !== "function") { + throw new Error( + `Method "${functionName}" does not exist on InjectiveGrpcClient` + ); + } + //Function that the LLM extracted + console.log(`wil pass these params ${JSON.stringify(params)}}`); + + //Need to standardize this context params + const response = await method(params); + console.log( + `Recieved a response from InjectiveGrpcClient , response: ${JSON.stringify(response)}, ` + ); + // Lets convert the result of the response into something that can be read + if (response.success) { + console.log("Cleaning up the response"); + const additionalTemplate = `Extract the response from the following data, also make sure that you format the response into human readable format, make it the prettiest thing anyone can read basically a very nice comprehensive summary in a string format.`; + const responseResult = JSON.stringify(response.result); + const newContext = `${additionalTemplate}\n${responseResult}`; + const totalContext = `Previous chat context:${context} \n New information : ${newContext}`; + console.log( + `Got context, now will pass it on to llm ${totalContext}` + ); + const responseContent = await generateText({ + runtime, + context: totalContext, + modelClass: ModelClass.SMALL, + }); + + console.log("Response content:", responseContent); + if (callback) + callback({ + text: `Operation ${name} succeeded, ${responseContent}.`, + content: response.result, + }); + } else { + // 7. Trigger any callback with failure info + if (callback) { + callback({ + text: `Operation ${name} failed.\n${response.result}`, + content: response.result, + }); + } + } + + // Return true if code == 0 (success), else false + return response.result.code === 0; + } catch (error) { + if (callback) { + callback({ + text: `Error in ${name}: ${(error as Error).message}`, + content: { error: (error as Error).message }, + }); + } + return false; + } + }, + }; +} diff --git a/packages/plugin-injective/src/action/distribution.ts b/packages/plugin-injective/src/action/distribution.ts new file mode 100644 index 00000000000..590292f0478 --- /dev/null +++ b/packages/plugin-injective/src/action/distribution.ts @@ -0,0 +1,91 @@ +import { createGenericAction } from "./base"; +import * as DistributionTemplates from "@injective/template/distribution"; +import * as DistributionExamples from "@injective/examples/distribution"; +import * as DistributionSimilies from "@injective/similes/distribution"; + +export const GetDistributionModuleParamsAction = createGenericAction({ + name: "GET_DISTRIBUTION_MODULE_PARAMS", + description: "Fetches the distribution module parameters", + template: DistributionTemplates.getDistributionModuleParamsTemplate, + examples: DistributionExamples.getDistributionModuleParamsExample, + similes: DistributionSimilies.getDistributionModuleParamsSimiles, + functionName: "getDistributionModuleParams", + validateContent: () => true, +}); + +export const GetDelegatorRewardsForValidatorAction = createGenericAction({ + name: "GET_DELEGATOR_REWARDS_FOR_VALIDATOR", + description: "Fetches the delegator rewards for a specific validator", + template: DistributionTemplates.getDelegatorRewardsForValidatorTemplate, + examples: DistributionExamples.getDelegatorRewardsForValidatorExample, + similes: DistributionSimilies.getDelegatorRewardsForValidatorSimiles, + functionName: "getDelegatorRewardsForValidator", + validateContent: () => true, +}); + +export const GetDelegatorRewardsForValidatorNoThrowAction = createGenericAction( + { + name: "GET_DELEGATOR_REWARDS_FOR_VALIDATOR_NO_THROW", + description: + "Fetches the delegator rewards for a specific validator without throwing errors", + template: + DistributionTemplates.getDelegatorRewardsForValidatorNoThrowTemplate, + examples: + DistributionExamples.getDelegatorRewardsForValidatorNoThrowExample, + similes: + DistributionSimilies.getDelegatorRewardsForValidatorNoThrowSimiles, + functionName: "getDelegatorRewardsForValidatorNoThrow", + validateContent: () => true, + } +); + +export const GetDelegatorRewardsAction = createGenericAction({ + name: "GET_DELEGATOR_REWARDS", + description: "Fetches the rewards for a delegator", + template: DistributionTemplates.getDelegatorRewardsTemplate, + examples: DistributionExamples.getDelegatorRewardsExample, + similes: DistributionSimilies.getDelegatorRewardsSimiles, + functionName: "getDelegatorRewards", + validateContent: () => true, +}); + +export const GetDelegatorRewardsNoThrowAction = createGenericAction({ + name: "GET_DELEGATOR_REWARDS_NO_THROW", + description: "Fetches the rewards for a delegator without throwing errors", + template: DistributionTemplates.getDelegatorRewardsNoThrowTemplate, + examples: DistributionExamples.getDelegatorRewardsNoThrowExample, + similes: DistributionSimilies.getDelegatorRewardsNoThrowSimiles, + functionName: "getDelegatorRewardsNoThrow", + validateContent: () => true, +}); + +export const MsgWithdrawDelegatorRewardAction = createGenericAction({ + name: "MSG_WITHDRAW_DELEGATOR_REWARD", + description: "Withdraws delegator rewards from a specific validator", + template: DistributionTemplates.msgWithdrawDelegatorRewardTemplate, + examples: DistributionExamples.msgWithdrawDelegatorRewardExample, + similes: DistributionSimilies.msgWithdrawDelegatorRewardSimiles, + functionName: "msgWithdrawDelegatorReward", + validateContent: () => true, +}); + +export const MsgWithdrawValidatorCommissionAction = createGenericAction({ + name: "MSG_WITHDRAW_VALIDATOR_COMMISSION", + description: "Withdraws validator commission rewards", + template: DistributionTemplates.msgWithdrawValidatorCommissionTemplate, + examples: DistributionExamples.msgWithdrawValidatorCommissionExample, + similes: DistributionSimilies.msgWithdrawValidatorCommissionSimiles, + functionName: "msgWithdrawValidatorCommission", + validateContent: () => true, +}); + +// Export all actions as a group +export const DistributionActions = [ + GetDistributionModuleParamsAction, + GetDelegatorRewardsForValidatorAction, + GetDelegatorRewardsForValidatorNoThrowAction, + GetDelegatorRewardsAction, + GetDelegatorRewardsNoThrowAction, + MsgWithdrawDelegatorRewardAction, + MsgWithdrawValidatorCommissionAction, +]; diff --git a/packages/plugin-injective/src/action/exchange.ts b/packages/plugin-injective/src/action/exchange.ts new file mode 100644 index 00000000000..ba222a2e7a1 --- /dev/null +++ b/packages/plugin-injective/src/action/exchange.ts @@ -0,0 +1,847 @@ +import { createGenericAction } from "./base"; +import * as ExchangeTemplates from "@injective/template/exchange"; +import * as ExchangeExamples from "@injective/examples/exchange"; +import * as ExchangeSimiles from "@injective/similes/exchange"; +// Module Parameters and State Actions +export const GetModuleParamsAction = createGenericAction({ + name: "GET_MODULE_PARAMS", + description: "Fetches the exchange module parameters", + template: ExchangeTemplates.getModuleParamsTemplate, + examples: ExchangeExamples.getModuleParamsExample, + similes: ExchangeSimiles.getModuleParamsSimiles, + functionName: "getModuleParams", + validateContent: () => true, +}); +// Dont query exchange module state lmao +// export const GetModuleStateAction = createGenericAction({ +// name: "GET_MODULE_STATE", +// description: "Fetches the current state of the exchange module", +// template: ExchangeTemplates.getModuleStateTemplate, +// examples: ExchangeExamples.getModuleStateExample, +// functionName: "getModuleState", +// similes: ExchangeSimiles, +// validateContent: () => true, +// }); + +// Fee Discount Actions +export const GetFeeDiscountScheduleAction = createGenericAction({ + name: "GET_FEE_DISCOUNT_SCHEDULE", + description: "Fetches the fee discount schedule", + template: ExchangeTemplates.getFeeDiscountScheduleTemplate, + examples: ExchangeExamples.getFeeDiscountScheduleExample, + similes: ExchangeSimiles.getFeeDiscountScheduleSimiles, + functionName: "getFeeDiscountSchedule", + validateContent: () => true, +}); + +export const GetFeeDiscountAccountInfoAction = createGenericAction({ + name: "GET_FEE_DISCOUNT_ACCOUNT_INFO", + description: + "Fetches the fee discount information for a specific Injective address", + template: ExchangeTemplates.getFeeDiscountAccountInfoTemplate, + examples: ExchangeExamples.getFeeDiscountAccountInfoExample, + similes: ExchangeSimiles.getFeeDiscountAccountInfoSimiles, + functionName: "getFeeDiscountAccountInfo", + validateContent: () => true, +}); + +// Trading Rewards Actions +export const GetTradingRewardsCampaignAction = createGenericAction({ + name: "GET_TRADING_REWARDS_CAMPAIGN", + description: "Fetches the trading rewards campaign details", + template: ExchangeTemplates.getTradingRewardsCampaignTemplate, + examples: ExchangeExamples.getTradingRewardsCampaignExample, + similes: ExchangeSimiles.getTradingRewardsCampaignSimiles, + functionName: "getTradingRewardsCampaign", + validateContent: () => true, +}); + +export const GetTradeRewardPointsAction = createGenericAction({ + name: "GET_TRADE_REWARD_POINTS", + description: + "Fetches the trade reward points for specified Injective addresses", + template: ExchangeTemplates.getTradeRewardPointsTemplate, + examples: ExchangeExamples.getTradeRewardPointsExample, + similes: ExchangeSimiles.getTradeRewardPointsSimiles, + functionName: "getTradeRewardPoints", + validateContent: () => true, +}); + +export const GetPendingTradeRewardPointsAction = createGenericAction({ + name: "GET_PENDING_TRADE_REWARD_POINTS", + description: + "Fetches pending trade reward points for specified Injective addresses", + template: ExchangeTemplates.getPendingTradeRewardPointsTemplate, + examples: ExchangeExamples.getPendingTradeRewardPointsExample, + similes: ExchangeSimiles.getPendingTradeRewardPointsSimiles, + functionName: "getPendingTradeRewardPoints", + validateContent: () => true, +}); + +// Spot Market Actions +export const GetSpotMarketsAction = createGenericAction({ + name: "GET_SPOT_MARKETS", + description: "Fetches all spot markets", + template: ExchangeTemplates.getSpotMarketsTemplate, + examples: ExchangeExamples.getSpotMarketsExample, + similes: ExchangeSimiles.getSpotMarketSimiles, + functionName: "getSpotMarkets", + validateContent: () => true, +}); + +export const GetSpotMarketAction = createGenericAction({ + name: "GET_SPOT_MARKET", + description: "Fetches a specific spot market by its ID", + template: ExchangeTemplates.getSpotMarketTemplate, + examples: ExchangeExamples.getSpotMarketExample, + similes: ExchangeSimiles.getSpotMarketSimiles, + functionName: "getSpotMarket", + validateContent: () => true, +}); + +export const GetSpotOrdersAction = createGenericAction({ + name: "GET_SPOT_ORDERS", + description: "Fetches all spot orders", + template: ExchangeTemplates.getSpotOrdersTemplate, + examples: ExchangeExamples.getSpotOrdersExample, + similes: ExchangeSimiles.getSpotOrdersSimiles, + functionName: "getSpotOrders", + validateContent: () => true, +}); + +export const GetSpotOrderHistoryAction = createGenericAction({ + name: "GET_SPOT_ORDER_HISTORY", + description: "Fetches the history of spot orders", + template: ExchangeTemplates.getSpotOrderHistoryTemplate, + examples: ExchangeExamples.getSpotOrderHistoryExample, + similes: ExchangeSimiles.getSpotOrderHistorySimiles, + functionName: "getSpotOrderHistory", + validateContent: () => true, +}); + +export const GetSpotTradesAction = createGenericAction({ + name: "GET_SPOT_TRADES", + description: "Fetches all spot trades", + template: ExchangeTemplates.getSpotTradesTemplate, + examples: ExchangeExamples.getSpotTradesExample, + similes: ExchangeSimiles.getSpotTradesSimiles, + functionName: "getSpotTrades", + validateContent: () => true, +}); +//Orderbooks Action +export const GetDerivativeOrderbooksAction = createGenericAction({ + name: "GET_DERIVATIVE_ORDERBOOKS", + description: "Fetches all the derivative or perpetual orderbooks", + template: ExchangeTemplates.getOrderbooksV2Template, + examples: ExchangeExamples.getDerivativeOrderbooksV2Example, + similes: ExchangeSimiles.getDerivativeOrderbookSimiles, + functionName: "getDerivativeOrderbooksV2", + validateContent: () => true, +}); +export const GetDerivativeOrderbookAction = createGenericAction({ + name: "GET_DERIVATIVE_ORDERBOOK", + description: "Fetches a single derivative or perpetual orderbook", + template: ExchangeTemplates.getOrderbookTemplate, + examples: ExchangeExamples.getDerivativeOrderbookV2Example, + similes: ExchangeSimiles.getDerivativeOrderbookSimiles, + functionName: "getDerivativeOrderbookV2", + validateContent: () => true, +}); + +export const GetSpotOrderbooksAction = createGenericAction({ + name: "GET_SPOT_ORDERBOOKS", + description: "Fetches all the spot markets orderbooks", + template: ExchangeTemplates.getOrderbooksV2Template, + examples: ExchangeExamples.getSpotOrderbooksV2Example, + similes: ExchangeSimiles.getSpotOrderbooksSimiles, + functionName: "getSpotOrderbooksV2", + validateContent: () => true, +}); +export const GetSpotOrderbookAction = createGenericAction({ + name: "GET_SPOT_ORDERBOOK", + description: "Fetches a single spot market orderbook", + template: ExchangeTemplates.getOrderbookTemplate, + examples: ExchangeExamples.getSpotOrderbookV2Example, + similes: ExchangeSimiles.getSpotOrderbookSimiles, + functionName: "getSpotOrderbookV2", + validateContent: () => true, +}); + +// Derivative Market Actions +export const GetDerivativeMarketsAction = createGenericAction({ + name: "GET_DERIVATIVE_MARKETS", + description: "Fetches all derivative markets", + template: ExchangeTemplates.getDerivativeMarketsTemplate, + examples: ExchangeExamples.getDerivativeMarketsExample, + similes: ExchangeSimiles.getDerivativeMarketsSimiles, + functionName: "getDerivativeMarkets", + validateContent: () => true, +}); + +export const GetDerivativeMarketAction = createGenericAction({ + name: "GET_DERIVATIVE_MARKET", + description: "Fetches a specific derivative market by its ID", + template: ExchangeTemplates.getDerivativeMarketTemplate, + examples: ExchangeExamples.getDerivativeMarketExample, + similes: ExchangeSimiles.getDerivativeMarketSimiles, + functionName: "getDerivativeMarket", + validateContent: () => true, +}); + +export const GetDerivativeOrdersAction = createGenericAction({ + name: "GET_DERIVATIVE_ORDERS", + description: "Fetches all derivative orders", + template: ExchangeTemplates.getDerivativeOrdersTemplate, + examples: ExchangeExamples.getDerivativeOrdersExample, + similes: ExchangeSimiles.getDerivativeOrdersSimiles, + functionName: "getDerivativeOrders", + validateContent: () => true, +}); + +export const GetDerivativeOrderHistoryAction = createGenericAction({ + name: "GET_DERIVATIVE_ORDER_HISTORY", + description: "Fetches the history of derivative orders", + template: ExchangeTemplates.getDerivativeOrderHistoryTemplate, + examples: ExchangeExamples.getDerivativeOrderHistoryExample, + similes: ExchangeSimiles.getDerivativeOrderHistorySimiles, + functionName: "getDerivativeOrderHistory", + validateContent: () => true, +}); + +export const GetDerivativeTradesAction = createGenericAction({ + name: "GET_DERIVATIVE_TRADES", + description: "Fetches all derivative trades", + template: ExchangeTemplates.getDerivativeTradesTemplate, + examples: ExchangeExamples.getDerivativeTradesExample, + similes: ExchangeSimiles.getDerivativeTradesSimiles, + functionName: "getDerivativeTrades", + validateContent: () => true, +}); + +// Binary Options Actions +export const GetBinaryOptionsMarketsAction = createGenericAction({ + name: "GET_BINARY_OPTIONS_MARKETS", + description: "Fetches all binary options markets", + template: ExchangeTemplates.getBinaryOptionsMarketsTemplate, + examples: ExchangeExamples.getBinaryOptionsMarketsExample, + similes: ExchangeSimiles.getBinaryOptionsMarketsSimiles, + functionName: "getBinaryOptionsMarkets", + validateContent: () => true, +}); + +export const GetBinaryOptionsMarketAction = createGenericAction({ + name: "GET_BINARY_OPTIONS_MARKET", + description: "Fetches a specific binary options market by its ID", + template: ExchangeTemplates.getBinaryOptionsMarketTemplate, + examples: ExchangeExamples.getBinaryOptionsMarketExample, + similes: ExchangeSimiles.getBinaryOptionsMarketSimiles, + functionName: "getBinaryOptionsMarket", + validateContent: () => true, +}); + +// Exchange Positions Actions +export const GetExchangePositionsAction = createGenericAction({ + name: "GET_EXCHANGE_POSITIONS", + description: "Fetches all positions", + template: ExchangeTemplates.getExchangePositionsTemplate, + examples: ExchangeExamples.getExchangePositionsExample, + similes: ExchangeSimiles.getExchangePositionsSimiles, + functionName: "getExchangePositions", + validateContent: () => true, +}); + +export const GetPositionsV2Action = createGenericAction({ + name: "GET_POSITIONS_V2", + description: "Fetches all positions using version 2 of the API", + template: ExchangeTemplates.getPositionsV2Template, + examples: ExchangeExamples.getPositionsV2Example, + similes: ExchangeSimiles.getUserPositionsSimiles, + functionName: "getPositionsV2", + validateContent: () => true, +}); + +// Funding Rate Actions +export const GetFundingPaymentsAction = createGenericAction({ + name: "GET_FUNDING_PAYMENTS", + description: "Fetches all funding payments", + template: ExchangeTemplates.getFundingPaymentsTemplate, + examples: ExchangeExamples.getFundingPaymentsExample, + similes: ExchangeSimiles.getFundingPaymentsSimiles, + functionName: "getFundingPayments", + validateContent: () => true, +}); + +export const GetFundingRatesAction = createGenericAction({ + name: "GET_FUNDING_RATES", + description: "Fetches all funding rates", + template: ExchangeTemplates.getFundingRatesTemplate, + examples: ExchangeExamples.getFundingRatesExample, + similes: ExchangeSimiles.getFundingRatesSimiles, + functionName: "getFundingRates", + validateContent: () => true, +}); + +// Subaccount Actions +export const GetSubaccountTradeNonceAction = createGenericAction({ + name: "GET_SUBACCOUNT_TRADE_NONCE", + description: "Fetches the trade nonce for a specific subaccount", + template: ExchangeTemplates.getSubaccountTradeNonceTemplate, + examples: ExchangeExamples.getSubaccountTradeNonceExample, + similes: ExchangeSimiles.getSubaccountTradeNonceSimiles, + functionName: "getSubaccountTradeNonce", + validateContent: () => true, +}); + +export const GetSubaccountsListAction = createGenericAction({ + name: "GET_SUBACCOUNTS_LIST", + description: "Fetches the list of subaccounts for a specific address", + template: ExchangeTemplates.getSubaccountsListTemplate, + examples: ExchangeExamples.getSubaccountsListExample, + similes: ExchangeSimiles.getSubaccountsListSimiles, + functionName: "getSubaccountsList", + validateContent: () => true, +}); + +export const GetSubaccountBalancesListAction = createGenericAction({ + name: "GET_SUBACCOUNT_BALANCES_LIST", + description: "Fetches the balances list for a specific subaccount", + template: ExchangeTemplates.getSubaccountBalancesListTemplate, + examples: ExchangeExamples.getSubaccountBalancesListExample, + similes: ExchangeSimiles.getSubaccountBalancesListSimiles, + functionName: "getSubaccountBalancesList", + validateContent: () => true, +}); + +export const GetSubaccountHistoryAction = createGenericAction({ + name: "GET_SUBACCOUNT_HISTORY", + description: "Fetches the transfer history of a specific subaccount", + template: ExchangeTemplates.getSubaccountHistoryTemplate, + examples: ExchangeExamples.getSubaccountHistoryExample, + similes: ExchangeSimiles.getSubaccountHistorySimiles, + functionName: "getSubaccountHistory", + validateContent: () => true, +}); + +export const GetSubaccountOrderSummaryAction = createGenericAction({ + name: "GET_SUBACCOUNT_ORDER_SUMMARY", + description: "Fetches the order summary for a specific subaccount", + template: ExchangeTemplates.getSubaccountOrderSummaryTemplate, + examples: ExchangeExamples.getSubaccountOrderSummaryExample, + similes: ExchangeSimiles.getSubaccountOrderSummarySimiles, + functionName: "getSubaccountOrderSummary", + validateContent: () => true, +}); + +// Order Management Actions +export const GetOrderStatesAction = createGenericAction({ + name: "GET_ORDER_STATES", + description: "Fetches the states of orders", + template: ExchangeTemplates.getOrderStatesTemplate, + examples: ExchangeExamples.getOrderStatesExample, + similes: ExchangeSimiles.getOrderStatesSimiles, + functionName: "getOrderStates", + validateContent: () => true, +}); + +// Portfolio Actions +export const GetAccountPortfolioAction = createGenericAction({ + name: "GET_ACCOUNT_PORTFOLIO", + description: "Fetches the account portfolio for a specific address", + template: ExchangeTemplates.getAccountPortfolioTemplate, + examples: ExchangeExamples.getAccountPortfolioExample, + similes: ExchangeSimiles.getAccountPortfolioSimiles, + functionName: "getAccountPortfolio", + validateContent: () => true, +}); + +export const GetAccountPortfolioBalancesAction = createGenericAction({ + name: "GET_ACCOUNT_PORTFOLIO_BALANCES", + description: + "Fetches the balances of the account portfolio for a specific address", + template: ExchangeTemplates.getAccountPortfolioBalancesTemplate, + examples: ExchangeExamples.getAccountPortfolioBalancesExample, + similes: ExchangeSimiles.getAccountPortfolioBalancesSimiles, + functionName: "getAccountPortfolioBalances", + validateContent: () => true, +}); + +// Rewards and Opt-out Actions +export const GetIsOptedOutOfRewardsAction = createGenericAction({ + name: "GET_IS_OPTED_OUT_OF_REWARDS", + description: "Checks if an account is opted out of rewards", + template: ExchangeTemplates.getIsOptedOutOfRewardsTemplate, + examples: ExchangeExamples.getIsOptedOutOfRewardsExample, + similes: ExchangeSimiles.getIsOptedOutOfRewardsSimiles, + functionName: "getIsOptedOutOfRewards", + validateContent: () => true, +}); + +export const GetRewardsAction = createGenericAction({ + name: "GET_REWARDS", + description: "Fetches the rewards for specified Injective addresses", + template: ExchangeTemplates.getRewardsTemplate, + examples: ExchangeExamples.getRewardsExample, + similes: ExchangeSimiles.getRewardsSimiles, + functionName: "getRewards", + validateContent: () => true, +}); + +// Atomic Swap Actions +export const GetAtomicSwapHistoryAction = createGenericAction({ + name: "GET_ATOMIC_SWAP_HISTORY", + description: "Fetches the atomic swap history", + template: ExchangeTemplates.getAtomicSwapHistoryTemplate, + examples: ExchangeExamples.getAtomicSwapHistoryExample, + similes: ExchangeSimiles.getAtomicSwapHistorySimiles, + functionName: "getAtomicSwapHistory", + validateContent: () => true, +}); + +// Grid Strategy Actions +export const GetGridStrategiesAction = createGenericAction({ + name: "GET_GRID_STRATEGIES", + description: "Fetches all grid strategies", + template: ExchangeTemplates.getGridStrategiesTemplate, + examples: ExchangeExamples.getGridStrategiesExample, + similes: ExchangeSimiles.getGridStrategiesSimiles, + functionName: "getGridStrategies", + validateContent: () => true, +}); + +// Historical Data Actions +export const GetHistoricalBalanceAction = createGenericAction({ + name: "GET_HISTORICAL_BALANCE", + description: "Fetches the historical balance", + template: ExchangeTemplates.getHistoricalBalanceTemplate, + examples: ExchangeExamples.getHistoricalBalanceExample, + similes: ExchangeSimiles.getHistoricalBalanceSimiles, + functionName: "getHistoricalBalance", + validateContent: () => true, +}); + +export const GetHistoricalRpnlAction = createGenericAction({ + name: "GET_HISTORICAL_RPNL", + description: "Fetches the historical realized PnL (Rpnl)", + template: ExchangeTemplates.getHistoricalRpnlTemplate, + examples: ExchangeExamples.getHistoricalRpnlExample, + similes: ExchangeSimiles.getHistoricalRpnlSimiles, + functionName: "getHistoricalRpnl", + validateContent: () => true, +}); + +export const GetHistoricalVolumesAction = createGenericAction({ + name: "GET_HISTORICAL_VOLUMES", + description: "Fetches the historical trading volumes", + template: ExchangeTemplates.getHistoricalVolumesTemplate, + examples: ExchangeExamples.getHistoricalVolumesExample, + similes: ExchangeSimiles.getHistoricalVolumesSimiles, + functionName: "getHistoricalVolumes", + validateContent: () => true, +}); + +// Leaderboard Actions +export const GetPnlLeaderboardAction = createGenericAction({ + name: "GET_PNL_LEADERBOARD", + description: "Fetches the PnL leaderboard", + template: ExchangeTemplates.getPnlLeaderboardTemplate, + examples: ExchangeExamples.getPnlLeaderboardExample, + similes: ExchangeSimiles.getPnlLeaderboardSimiles, + functionName: "getPnlLeaderboard", + validateContent: () => true, +}); + +export const GetVolLeaderboardAction = createGenericAction({ + name: "GET_VOL_LEADERBOARD", + description: "Fetches the volume leaderboard", + template: ExchangeTemplates.getVolLeaderboardTemplate, + examples: ExchangeExamples.getVolLeaderboardExample, + similes: ExchangeSimiles.getVolLeaderboardSimiles, + functionName: "getVolLeaderboard", + validateContent: () => true, +}); + +export const GetPnlLeaderboardFixedResolutionAction = createGenericAction({ + name: "GET_PNL_LEADERBOARD_FIXED_RESOLUTION", + description: "Fetches the PnL leaderboard with fixed resolution", + template: ExchangeTemplates.getPnlLeaderboardFixedResolutionTemplate, + examples: ExchangeExamples.getPnlLeaderboardFixedResolutionExample, + similes: ExchangeSimiles.getPnlLeaderboardFixedResolutionSimiles, + functionName: "getPnlLeaderboardFixedResolution", + validateContent: () => true, +}); + +export const GetVolLeaderboardFixedResolutionAction = createGenericAction({ + name: "GET_VOL_LEADERBOARD_FIXED_RESOLUTION", + description: "Fetches the volume leaderboard with fixed resolution", + template: ExchangeTemplates.getVolLeaderboardFixedResolutionTemplate, + examples: ExchangeExamples.getVolLeaderboardFixedResolutionExample, + similes: ExchangeSimiles.getVolLeaderboardFixedResolutionSimiles, + functionName: "getVolLeaderboardFixedResolution", + validateContent: () => true, +}); + +// Denom Holders Action +export const GetDenomHoldersAction = createGenericAction({ + name: "GET_DENOM_HOLDERS", + description: "Fetches the holders of a specific denomination", + template: ExchangeTemplates.getDenomHoldersTemplate, + examples: ExchangeExamples.getDenomHoldersExample, + similes: ExchangeSimiles.getDenomHoldersSimiles, + functionName: "getDenomHolders", + validateContent: () => true, +}); + +// Message Actions for Order Management +export const MsgBatchCancelBinaryOptionsOrdersAction = createGenericAction({ + name: "MSG_BATCH_CANCEL_BINARY_OPTIONS_ORDERS", + description: "Broadcasts a message to batch cancel binary options orders", + template: ExchangeTemplates.msgBatchCancelBinaryOptionsOrdersTemplate, + examples: ExchangeExamples.msgBatchCancelBinaryOptionsOrdersExample, + similes: ExchangeSimiles.msgBatchCancelBinaryOptionsOrdersSimiles, + functionName: "msgBatchCancelBinaryOptionsOrders", + validateContent: () => true, +}); + +export const MsgBatchCancelDerivativeOrdersAction = createGenericAction({ + name: "MSG_BATCH_CANCEL_DERIVATIVE_ORDERS", + description: "Broadcasts a message to batch cancel derivative orders", + template: ExchangeTemplates.msgBatchCancelDerivativeOrdersTemplate, + examples: ExchangeExamples.msgBatchCancelDerivativeOrdersExample, + similes: ExchangeSimiles.msgBatchCancelDerivativeOrdersSimiles, + functionName: "msgBatchCancelDerivativeOrders", + validateContent: () => true, +}); + +export const MsgBatchCancelSpotOrdersAction = createGenericAction({ + name: "MSG_BATCH_CANCEL_SPOT_ORDERS", + description: "Broadcasts a message to batch cancel spot orders", + template: ExchangeTemplates.msgBatchCancelSpotOrdersTemplate, + examples: ExchangeExamples.msgBatchCancelSpotOrdersExample, + similes: ExchangeSimiles.msgBatchCancelSpotOrdersSimiles, + functionName: "msgBatchCancelSpotOrders", + validateContent: () => true, +}); + +export const MsgBatchUpdateOrdersAction = createGenericAction({ + name: "MSG_BATCH_UPDATE_ORDERS", + description: "Broadcasts a message to batch update orders", + template: ExchangeTemplates.msgBatchUpdateOrdersTemplate, + examples: ExchangeExamples.msgBatchUpdateOrdersExample, + similes: ExchangeSimiles.msgBatchUpdateOrdersSimiles, + functionName: "msgBatchUpdateOrders", + validateContent: () => true, +}); + +// Message Actions for Individual Orders +export const MsgCancelBinaryOptionsOrderAction = createGenericAction({ + name: "MSG_CANCEL_BINARY_OPTIONS_ORDER", + description: "Broadcasts a message to cancel a binary options order", + template: ExchangeTemplates.msgCancelBinaryOptionsOrderTemplate, + examples: ExchangeExamples.msgCancelBinaryOptionsOrderExample, + similes: ExchangeSimiles.msgCancelBinaryOptionsOrderSimiles, + functionName: "msgCancelBinaryOptionsOrder", + validateContent: () => true, +}); + +export const MsgCancelDerivativeOrderAction = createGenericAction({ + name: "MSG_CANCEL_DERIVATIVE_ORDER", + description: "Broadcasts a message to cancel a derivative order", + template: ExchangeTemplates.msgCancelDerivativeOrderTemplate, + examples: ExchangeExamples.msgCancelDerivativeOrderExample, + similes: ExchangeSimiles.msgCancelDerivativeOrderSimiles, + functionName: "msgCancelDerivativeOrder", + validateContent: () => true, +}); + +export const MsgCancelSpotOrderAction = createGenericAction({ + name: "MSG_CANCEL_SPOT_ORDER", + description: "Broadcasts a message to cancel a spot order", + template: ExchangeTemplates.msgCancelSpotOrderTemplate, + examples: ExchangeExamples.msgCancelSpotOrderExample, + similes: ExchangeSimiles.msgCancelSpotOrderSimiles, + functionName: "msgCancelSpotOrder", + validateContent: () => true, +}); + +// Message Actions for Creating Orders +export const MsgCreateBinaryOptionsLimitOrderAction = createGenericAction({ + name: "MSG_CREATE_BINARY_OPTIONS_LIMIT_ORDER", + description: "Broadcasts a message to create a binary options limit order", + template: ExchangeTemplates.msgCreateBinaryOptionsLimitOrderTemplate, + examples: ExchangeExamples.msgCreateBinaryOptionsLimitOrderExample, + similes: ExchangeSimiles.msgCreateBinaryOptionsLimitOrderSimiles, + functionName: "msgCreateBinaryOptionsLimitOrder", + validateContent: () => true, +}); + +export const MsgCreateBinaryOptionsMarketOrderAction = createGenericAction({ + name: "MSG_CREATE_BINARY_OPTIONS_MARKET_ORDER", + description: "Broadcasts a message to create a binary options market order", + template: ExchangeTemplates.msgCreateBinaryOptionsMarketOrderTemplate, + examples: ExchangeExamples.msgCreateBinaryOptionsMarketOrderExample, + similes: ExchangeSimiles.msgCreateBinaryOptionsMarketOrderSimiles, + functionName: "msgCreateBinaryOptionsMarketOrder", + validateContent: () => true, +}); + +export const MsgCreateDerivativeLimitOrderAction = createGenericAction({ + name: "MSG_CREATE_DERIVATIVE_LIMIT_ORDER", + description: "Broadcasts a message to create a derivative limit order", + template: ExchangeTemplates.msgCreateDerivativeLimitOrderTemplate, + examples: ExchangeExamples.msgCreateDerivativeLimitOrderExample, + similes: ExchangeSimiles.msgCreateDerivativeLimitOrderSimiles, + functionName: "msgCreateDerivativeLimitOrder", + validateContent: () => true, +}); + +export const MsgCreateDerivativeMarketOrderAction = createGenericAction({ + name: "MSG_CREATE_DERIVATIVE_MARKET_ORDER", + description: "Broadcasts a message to create a derivative market order", + template: ExchangeTemplates.msgCreateDerivativeMarketOrderTemplate, + examples: ExchangeExamples.msgCreateDerivativeMarketOrderExample, + similes: ExchangeSimiles.msgCreateDerivativeMarketOrderSimiles, + functionName: "msgCreateDerivativeMarketOrder", + validateContent: () => true, +}); + +export const MsgCreateSpotLimitOrderAction = createGenericAction({ + name: "MSG_CREATE_SPOT_LIMIT_ORDER", + description: "Broadcasts a message to create a spot limit order", + template: ExchangeTemplates.msgCreateSpotLimitOrderTemplate, + examples: ExchangeExamples.msgCreateSpotLimitOrderExample, + similes: ExchangeSimiles.msgCreateSpotLimitOrderSimiles, + functionName: "msgCreateSpotLimitOrder", + validateContent: () => true, +}); + +export const MsgCreateSpotMarketOrderAction = createGenericAction({ + name: "MSG_CREATE_SPOT_MARKET_ORDER", + description: "Broadcasts a message to create a spot market order", + template: ExchangeTemplates.msgCreateSpotMarketOrderTemplate, + examples: ExchangeExamples.msgCreateSpotMarketOrderExample, + similes: ExchangeSimiles.msgCreateSpotMarketOrderSimiles, + functionName: "msgCreateSpotMarketOrder", + validateContent: () => true, +}); + +// Message Actions for Deposits and Withdrawals +export const MsgDepositAction = createGenericAction({ + name: "MSG_DEPOSIT", + description: "Broadcasts a message to deposit funds", + template: ExchangeTemplates.msgDepositTemplate, + examples: ExchangeExamples.msgDepositExample, + similes: ExchangeSimiles.msgDepositSimiles, + functionName: "msgDeposit", + validateContent: () => true, +}); + +export const MsgWithdrawAction = createGenericAction({ + name: "MSG_WITHDRAW", + description: "Broadcasts a message to withdraw funds", + template: ExchangeTemplates.msgWithdrawTemplate, + examples: ExchangeExamples.msgWithdrawExample, + similes: ExchangeSimiles.msgWithdrawSimiles, + functionName: "msgWithdraw", + validateContent: () => true, +}); + +// Message Actions for Position Management +export const MsgIncreasePositionMarginAction = createGenericAction({ + name: "MSG_INCREASE_POSITION_MARGIN", + description: "Broadcasts a message to increase position margin", + template: ExchangeTemplates.msgIncreasePositionMarginTemplate, + examples: ExchangeExamples.msgIncreasePositionMarginExample, + similes: ExchangeSimiles.msgIncreasePositionMarginSimiles, + functionName: "msgIncreasePositionMargin", + validateContent: () => true, +}); + +// Message Actions for Market Administration +export const MsgInstantSpotMarketLaunchAction = createGenericAction({ + name: "MSG_INSTANT_SPOT_MARKET_LAUNCH", + description: "Broadcasts a message to instantly launch a spot market", + template: ExchangeTemplates.msgInstantSpotMarketLaunchTemplate, + examples: ExchangeExamples.msgInstantSpotMarketLaunchExample, + similes: ExchangeSimiles.msgInstantSpotMarketLaunchSimiles, + functionName: "msgInstantSpotMarketLaunch", + validateContent: () => true, +}); + +export const MsgLiquidatePositionAction = createGenericAction({ + name: "MSG_LIQUIDATE_POSITION", + description: "Broadcasts a message to liquidate a position", + template: ExchangeTemplates.msgLiquidatePositionTemplate, + examples: ExchangeExamples.msgLiquidatePositionExample, + similes: ExchangeSimiles.msgLiquidatePositionSimiles, + functionName: "msgLiquidatePosition", + validateContent: () => true, +}); + +export const MsgReclaimLockedFundsAction = createGenericAction({ + name: "MSG_RECLAIM_LOCKED_FUNDS", + description: "Broadcasts a message to reclaim locked funds", + template: ExchangeTemplates.msgReclaimLockedFundsTemplate, + examples: ExchangeExamples.msgReclaimLockedFundsExample, + similes: ExchangeSimiles.msgReclaimLockedFundsSimiles, + functionName: "msgReclaimLockedFunds", + validateContent: () => true, +}); + +export const MsgRewardsOptOutAction = createGenericAction({ + name: "MSG_REWARDS_OPT_OUT", + description: "Broadcasts a message to opt out of rewards", + template: ExchangeTemplates.msgRewardsOptOutTemplate, + examples: ExchangeExamples.msgRewardsOptOutExample, + similes: ExchangeSimiles.msgRewardsOptOutSimiles, + functionName: "msgRewardsOptOut", + validateContent: () => true, +}); + +export const MsgSignDataAction = createGenericAction({ + name: "MSG_SIGN_DATA", + description: "Broadcasts a message to sign data", + template: ExchangeTemplates.msgSignDataTemplate, + examples: ExchangeExamples.msgSignDataExample, + similes: ExchangeSimiles.msgSignDataSimiles, + functionName: "msgSignData", + validateContent: () => true, +}); + +export const MsgExternalTransferAction = createGenericAction({ + name: "MSG_EXTERNAL_TRANSFER", + description: "Broadcasts a message to perform an external transfer", + template: ExchangeTemplates.msgExternalTransferTemplate, + examples: ExchangeExamples.msgExternalTransferExample, + similes: ExchangeSimiles.msgExternalTransferSimiles, + functionName: "msgExternalTransfer", + validateContent: () => true, +}); + +export const MsgAdminUpdateBinaryOptionsMarketAction = createGenericAction({ + name: "MSG_ADMIN_UPDATE_BINARY_OPTIONS_MARKET", + description: + "Broadcasts a message to update a binary options market as an admin", + template: ExchangeTemplates.msgAdminUpdateBinaryOptionsMarketTemplate, + examples: ExchangeExamples.msgAdminUpdateBinaryOptionsMarketExample, + functionName: "msgAdminUpdateBinaryOptionsMarket", + similes: ExchangeSimiles.msgAdminUpdateBinaryOptionsMarketSimiles, + validateContent: () => true, +}); + +// Export all actions as a group +export const ExchangeActions = [ + // Module Parameters and State + GetModuleParamsAction, + + // Fee Discount + GetFeeDiscountScheduleAction, + GetFeeDiscountAccountInfoAction, + + // Trading Rewards + GetTradingRewardsCampaignAction, + GetTradeRewardPointsAction, + GetPendingTradeRewardPointsAction, + + // Orderbooks + GetDerivativeOrderbooksAction, + GetDerivativeOrderbookAction, + GetSpotOrderbooksAction, + GetSpotOrderbookAction, + + // Spot Market + GetSpotMarketsAction, + GetSpotMarketAction, + GetSpotOrdersAction, + GetSpotOrderHistoryAction, + GetSpotTradesAction, + + // Derivative Market + GetDerivativeMarketsAction, + GetDerivativeMarketAction, + GetDerivativeOrdersAction, + GetDerivativeOrderHistoryAction, + GetDerivativeTradesAction, + + // Binary Options + GetBinaryOptionsMarketsAction, + GetBinaryOptionsMarketAction, + + // Positions + GetExchangePositionsAction, + GetPositionsV2Action, + + // Funding + GetFundingPaymentsAction, + GetFundingRatesAction, + + // Subaccount + GetSubaccountTradeNonceAction, + GetSubaccountsListAction, + GetSubaccountBalancesListAction, + GetSubaccountHistoryAction, + GetSubaccountOrderSummaryAction, + + // Order Management + GetOrderStatesAction, + + // Portfolio + GetAccountPortfolioAction, + GetAccountPortfolioBalancesAction, + + // Rewards and Opt-out + GetIsOptedOutOfRewardsAction, + GetRewardsAction, + + // Atomic Swap + GetAtomicSwapHistoryAction, + + // Grid Strategy + GetGridStrategiesAction, + + // Historical Data + GetHistoricalBalanceAction, + GetHistoricalRpnlAction, + GetHistoricalVolumesAction, + + // Leaderboard + GetPnlLeaderboardAction, + GetVolLeaderboardAction, + GetPnlLeaderboardFixedResolutionAction, + GetVolLeaderboardFixedResolutionAction, + + // Denom Holders + GetDenomHoldersAction, + + // Message Actions - Order Management + MsgBatchCancelBinaryOptionsOrdersAction, + MsgBatchCancelDerivativeOrdersAction, + MsgBatchCancelSpotOrdersAction, + MsgBatchUpdateOrdersAction, + MsgCancelBinaryOptionsOrderAction, + MsgCancelDerivativeOrderAction, + MsgCancelSpotOrderAction, + + // Message Actions - Creating Orders + MsgCreateBinaryOptionsLimitOrderAction, + MsgCreateBinaryOptionsMarketOrderAction, + MsgCreateDerivativeLimitOrderAction, + MsgCreateDerivativeMarketOrderAction, + MsgCreateSpotLimitOrderAction, + MsgCreateSpotMarketOrderAction, + + // Message Actions - Deposits and Withdrawals + MsgDepositAction, + MsgWithdrawAction, + + // Message Actions - Position Management + MsgIncreasePositionMarginAction, + MsgInstantSpotMarketLaunchAction, + MsgLiquidatePositionAction, + + // Message Actions - Administration and Utils + MsgReclaimLockedFundsAction, + MsgRewardsOptOutAction, + MsgSignDataAction, + MsgExternalTransferAction, + MsgAdminUpdateBinaryOptionsMarketAction, +]; diff --git a/packages/plugin-injective/src/action/explorer.ts b/packages/plugin-injective/src/action/explorer.ts new file mode 100644 index 00000000000..5b7d5b029ec --- /dev/null +++ b/packages/plugin-injective/src/action/explorer.ts @@ -0,0 +1,129 @@ +// src/actions/explorer/explorer-actions.ts +import { createGenericAction } from "./base"; +import * as ExplorerTemplates from "@injective/template/explorer"; +import * as ExplorerExamples from "@injective/examples/explorer"; +import * as ExplorerSimiles from "@injective/similes/explorer"; +export const GetTxByHashAction = createGenericAction({ + name: "GET_TX_BY_HASH", + description: "Fetches a transaction by its hash", + template: ExplorerTemplates.getTxByHashTemplate, + examples: ExplorerExamples.getTxByHashExample, + similes: ExplorerSimiles.getTxByHashSimiles, + functionName: "getTxByHash", + validateContent: () => true, +}); + +export const GetAccountTxAction = createGenericAction({ + name: "GET_ACCOUNT_TX", + description: "Fetches transactions for a specific account", + template: ExplorerTemplates.getAccountTxTemplate, + examples: ExplorerExamples.getAccountTxExample, + similes: ExplorerSimiles.getAccountTxSimiles, + functionName: "getAccountTx", + validateContent: () => true, +}); + +export const GetExplorerValidatorAction = createGenericAction({ + name: "GET_EXPLORER_VALIDATOR", + description: "Fetches details of a specific validator", + template: ExplorerTemplates.getValidatorTemplate, + examples: ExplorerExamples.getValidatorExample, + similes: ExplorerSimiles.getExplorerValidatorSimiles, + functionName: "getValidator", + validateContent: () => true, +}); + +export const GetValidatorUptimeAction = createGenericAction({ + name: "GET_VALIDATOR_UPTIME", + description: "Fetches the uptime of a specific validator", + template: ExplorerTemplates.getValidatorUptimeTemplate, + examples: ExplorerExamples.getValidatorUptimeExample, + similes: ExplorerSimiles.getExplorerValidatorUptimeSimiles, + functionName: "getValidatorUptime", + validateContent: () => true, +}); + +export const GetPeggyDepositTxsAction = createGenericAction({ + name: "GET_PEGGY_DEPOSIT_TXS", + description: "Fetches Peggy deposit transactions", + template: ExplorerTemplates.getPeggyDepositTxsTemplate, + examples: ExplorerExamples.getPeggyDepositTxsExample, + similes: ExplorerSimiles.getPeggyDepositTxsSimiles, + functionName: "getPeggyDepositTxs", + validateContent: () => true, +}); + +export const GetPeggyWithdrawalTxsAction = createGenericAction({ + name: "GET_PEGGY_WITHDRAWAL_TXS", + description: "Fetches Peggy withdrawal transactions", + template: ExplorerTemplates.getPeggyWithdrawalTxsTemplate, + examples: ExplorerExamples.getPeggyWithdrawalTxsExample, + similes: ExplorerSimiles.getPeggyWithdrawalTxsSimiles, + functionName: "getPeggyWithdrawalTxs", + validateContent: () => true, +}); + +export const GetBlocksAction = createGenericAction({ + name: "GET_BLOCKS", + description: "Fetches a list of blocks based on provided parameters", + template: ExplorerTemplates.getBlocksTemplate, + examples: ExplorerExamples.getBlocksExample, + similes: ExplorerSimiles.getBlocksSimiles, + functionName: "getBlocks", + validateContent: () => true, +}); + +export const GetBlockAction = createGenericAction({ + name: "GET_BLOCK", + description: "Fetches details of a specific block by its ID", + template: ExplorerTemplates.getBlockTemplate, + examples: ExplorerExamples.getBlockExample, + similes: ExplorerSimiles.getBlockSimiles, + functionName: "getBlock", + validateContent: () => true, +}); + +export const GetTxsAction = createGenericAction({ + name: "GET_TXS", + description: "Fetches a list of transactions based on provided parameters", + template: ExplorerTemplates.getTxsTemplate, + examples: ExplorerExamples.getTxsExample, + similes: ExplorerSimiles.getTxsSimiles, + functionName: "getTxs", + validateContent: () => true, +}); + +export const GetIBCTransferTxsAction = createGenericAction({ + name: "GET_IBC_TRANSFER_TXS", + description: "Fetches IBC transfer transactions", + template: ExplorerTemplates.getIBCTransferTxsTemplate, + examples: ExplorerExamples.getIBCTransferTxsExample, + similes: ExplorerSimiles.getIBCTransferTxsSimiles, + functionName: "getIBCTransferTxs", + validateContent: () => true, +}); + +export const GetExplorerStatsAction = createGenericAction({ + name: "GET_EXPLORER_STATS", + description: "Fetches explorer statistics", + template: ExplorerTemplates.getExplorerStatsTemplate, + examples: ExplorerExamples.getExplorerStatsExample, + similes: ExplorerSimiles.getExplorerStatsSimiles, + functionName: "getExplorerStats", + validateContent: () => true, +}); + +// Export all actions as a group +export const ExplorerActions = [ + GetTxByHashAction, + GetAccountTxAction, + GetExplorerValidatorAction, + GetValidatorUptimeAction, + GetPeggyDepositTxsAction, + GetPeggyWithdrawalTxsAction, + GetBlocksAction, + GetBlockAction, + GetTxsAction, + GetIBCTransferTxsAction, + GetExplorerStatsAction, +]; diff --git a/packages/plugin-injective/src/action/gov.ts b/packages/plugin-injective/src/action/gov.ts new file mode 100644 index 00000000000..5698c5d2d29 --- /dev/null +++ b/packages/plugin-injective/src/action/gov.ts @@ -0,0 +1,169 @@ +// src/actions/governance/governance-actions.ts +import { createGenericAction } from "./base"; +import * as GovTemplates from "@injective/template/gov"; +import * as GovExamples from "@injective/examples/gov"; +import * as GovSimiles from "@injective/similes/gov"; +export const GetGovernanceModuleParamsAction = createGenericAction({ + name: "GET_GOVERNANCE_MODULE_PARAMS", + description: "Fetches the governance module parameters", + template: GovTemplates.getGovernanceModuleParamsTemplate, + examples: GovExamples.getGovernanceModuleParamsExample, + functionName: "getGovernanceModuleParams", + similes: GovSimiles.getGovernanceModuleParamsSimiles, + validateContent: () => true, +}); + +export const GetProposalsAction = createGenericAction({ + name: "GET_PROPOSALS", + description: "Fetches a list of proposals based on provided parameters", + template: GovTemplates.getProposalsTemplate, + examples: GovExamples.getProposalsExample, + functionName: "getProposals", + similes: GovSimiles.getProposalsSimiles, + validateContent: () => true, +}); + +export const GetProposalAction = createGenericAction({ + name: "GET_PROPOSAL", + description: "Fetches details of a specific proposal by its ID", + template: GovTemplates.getProposalTemplate, + examples: GovExamples.getProposalExample, + similes: GovSimiles.getProposalsSimiles, + functionName: "getProposal", + validateContent: () => true, +}); + +export const GetProposalDepositsAction = createGenericAction({ + name: "GET_PROPOSAL_DEPOSITS", + description: "Fetches deposits for a specific proposal", + template: GovTemplates.getProposalDepositsTemplate, + examples: GovExamples.getProposalDepositsExample, + similes: GovSimiles.getProposalDepositsSimiles, + functionName: "getProposalDeposits", + validateContent: () => true, +}); + +export const GetProposalVotesAction = createGenericAction({ + name: "GET_PROPOSAL_VOTES", + description: "Fetches votes for a specific proposal", + template: GovTemplates.getProposalVotesTemplate, + examples: GovExamples.getProposalVotesExample, + similes: GovSimiles.getProposalVotesSimiles, + functionName: "getProposalVotes", + validateContent: () => true, +}); + +export const GetProposalTallyAction = createGenericAction({ + name: "GET_PROPOSAL_TALLY", + description: "Fetches the tally results of a specific proposal", + template: GovTemplates.getProposalTallyTemplate, + examples: GovExamples.getProposalTallyExample, + similes: GovSimiles.getProposalTallySimiles, + functionName: "getProposalTally", + validateContent: () => true, +}); + +// Message Actions +export const MsgSubmitProposalExpiryFuturesMarketLaunchAction = + createGenericAction({ + name: "MSG_SUBMIT_PROPOSAL_EXPIRY_FUTURES_MARKET_LAUNCH", + description: "Submits a proposal to launch an expiry futures market", + template: + GovTemplates.msgSubmitProposalExpiryFuturesMarketLaunchTemplate, + examples: GovExamples.msgSubmitProposalExpiryFuturesMarketLaunchExample, + similes: GovSimiles.msgSubmitProposalExpiryFuturesMarketLaunchSimiles, + functionName: "msgSubmitProposalExpiryFuturesMarketLaunch", + validateContent: () => true, + }); + +export const MsgSubmitProposalSpotMarketLaunchAction = createGenericAction({ + name: "MSG_SUBMIT_PROPOSAL_SPOT_MARKET_LAUNCH", + description: "Submits a proposal to launch a spot market", + template: GovTemplates.msgSubmitProposalSpotMarketLaunchTemplate, + examples: GovExamples.msgSubmitProposalSpotMarketLaunchExample, + similes: GovSimiles.msgSubmitProposalSpotMarketLaunchSimiles, + functionName: "msgSubmitProposalSpotMarketLaunch", + validateContent: () => true, +}); + +export const MsgSubmitProposalPerpetualMarketLaunchAction = createGenericAction( + { + name: "MSG_SUBMIT_PROPOSAL_PERPETUAL_MARKET_LAUNCH", + description: "Submits a proposal to launch a perpetual market", + template: GovTemplates.msgSubmitProposalPerpetualMarketLaunchTemplate, + examples: GovExamples.msgSubmitProposalPerpetualMarketLaunchExample, + similes: GovSimiles.msgSubmitProposalPerpetualMarketLaunchSimiles, + functionName: "msgSubmitProposalPerpetualMarketLaunch", + validateContent: () => true, + } +); + +export const MsgVoteAction = createGenericAction({ + name: "MSG_VOTE", + description: "Casts a vote on a specific proposal", + template: GovTemplates.msgVoteTemplate, + examples: GovExamples.msgVoteExample, + similes: GovSimiles.msgVoteSimiles, + functionName: "msgVote", + validateContent: () => true, +}); + +export const MsgSubmitTextProposalAction = createGenericAction({ + name: "MSG_SUBMIT_TEXT_PROPOSAL", + description: "Submits a text-based proposal", + template: GovTemplates.msgSubmitTextProposalTemplate, + examples: GovExamples.msgSubmitTextProposalExample, + similes: GovSimiles.msgSubmitTextProposalSimiles, + functionName: "msgSubmitTextProposal", + validateContent: () => true, +}); + +export const MsgSubmitProposalSpotMarketParamUpdateAction = createGenericAction( + { + name: "MSG_SUBMIT_PROPOSAL_SPOT_MARKET_PARAM_UPDATE", + description: "Submits a proposal to update spot market parameters", + template: GovTemplates.msgSubmitProposalSpotMarketParamUpdateTemplate, + examples: GovExamples.msgSubmitProposalSpotMarketParamUpdateExample, + similes: GovSimiles.msgSubmitProposalSpotMarketParamUpdateSimiles, + functionName: "msgSubmitProposalSpotMarketParamUpdate", + validateContent: () => true, + } +); + +export const MsgSubmitGenericProposalAction = createGenericAction({ + name: "MSG_SUBMIT_GENERIC_PROPOSAL", + description: "Submits a generic proposal", + template: GovTemplates.msgSubmitGenericProposalTemplate, + examples: GovExamples.msgSubmitGenericProposalExample, + similes: GovSimiles.msgSubmitGenericProposalSimiles, + functionName: "msgSubmitGenericProposal", + validateContent: () => true, +}); + +export const MsgGovDepositAction = createGenericAction({ + name: "MSG_GOV_DEPOSIT", + description: "Deposits tokens to a specific proposal", + similes: GovSimiles.msgGovDepositSimiles, + template: GovTemplates.msgGovDepositTemplate, + examples: GovExamples.msgGovDepositExample, + functionName: "msgGovDeposit", + validateContent: () => true, +}); + +// Export all actions as a group +export const GovActions = [ + GetGovernanceModuleParamsAction, + GetProposalsAction, + GetProposalAction, + GetProposalDepositsAction, + GetProposalVotesAction, + GetProposalTallyAction, + MsgSubmitProposalExpiryFuturesMarketLaunchAction, + MsgSubmitProposalSpotMarketLaunchAction, + MsgSubmitProposalPerpetualMarketLaunchAction, + MsgVoteAction, + MsgSubmitTextProposalAction, + MsgSubmitProposalSpotMarketParamUpdateAction, + MsgSubmitGenericProposalAction, + MsgGovDepositAction, +]; diff --git a/packages/plugin-injective/src/action/ibc.ts b/packages/plugin-injective/src/action/ibc.ts new file mode 100644 index 00000000000..09c9eff7645 --- /dev/null +++ b/packages/plugin-injective/src/action/ibc.ts @@ -0,0 +1,41 @@ +import { createGenericAction } from "./base"; +import * as IBCTemplates from "@injective/template/ibc"; +import * as IBCExamples from "@injective/examples/ibc"; +import * as IBCSimiles from "@injective/similes/ibc"; +export const GetDenomTraceAction = createGenericAction({ + name: "GET_DENOM_TRACE", + description: "Fetches the denomination trace for a specific hash", + template: IBCTemplates.getDenomTraceTemplate, + examples: IBCExamples.getDenomTraceExample, + similes: IBCSimiles.getDenomTraceSimiles, + functionName: "getDenomTrace", + validateContent: () => true, +}); + +export const GetDenomsTraceAction = createGenericAction({ + name: "GET_DENOMS_TRACE", + description: + "Fetches a list of denomination traces with optional pagination", + template: IBCTemplates.getDenomsTraceTemplate, + examples: IBCExamples.getDenomsTraceExample, + similes: IBCSimiles.getDenomsTraceSimiles, + functionName: "getDenomsTrace", + validateContent: () => true, +}); + +export const MsgIBCTransferAction = createGenericAction({ + name: "MSG_IBC_TRANSFER", + description: "Broadcasts an IBC transfer message", + template: IBCTemplates.msgIBCTransferTemplate, + examples: IBCExamples.msgIBCTransferExample, + similes: IBCSimiles.msgIBCTransferSimiles, + functionName: "msgIBCTransfer", + validateContent: () => true, +}); + +// Export all actions as a group +export const IbcActions = [ + GetDenomTraceAction, + GetDenomsTraceAction, + MsgIBCTransferAction, +]; diff --git a/packages/plugin-injective/src/action/index.ts b/packages/plugin-injective/src/action/index.ts new file mode 100644 index 00000000000..210527f612f --- /dev/null +++ b/packages/plugin-injective/src/action/index.ts @@ -0,0 +1,54 @@ +import { AuctionActions } from "./auction"; +import { AuthActions } from "./auth"; +import { BankActions } from "./bank"; +import { DistributionActions } from "./distribution"; +import { ExchangeActions } from "./exchange"; +import { ExplorerActions } from "./explorer"; +import { GovActions } from "./gov"; +import { IbcActions } from "./ibc"; +import { InsuranceActions } from "./insurance"; +import { MintActions } from "./mint"; +import { MitoActions } from "./mito"; +import { PeggyActions } from "./peggy"; +import { PermissionsActions } from "./permissions"; +import { StakingActions } from "./staking"; +import { TokenFactoryActions } from "./token-factory"; +import { WasmActions } from "./wasm"; +// Exporting all actions +export * from "./auction"; +export * from "./auth"; +export * from "./bank"; +export * from "./distribution"; +export * from "./exchange"; +export * from "./explorer"; +export * from "./gov"; +export * from "./ibc"; +export * from "./insurance"; +export * from "./mint"; +export * from "./mito"; +export * from "./peggy"; +export * from "./permissions"; +export * from "./staking"; +export * from "./token-factory"; +export * from "./wasm"; + +export const InjectiveActions = [ + ...ExchangeActions, + ...AuctionActions, + ...AuthActions, + ...BankActions, + ...DistributionActions, + ...ExplorerActions, + ...GovActions, + ...IbcActions, + ...InsuranceActions, + ...MintActions, + ...MitoActions, + ...PeggyActions, + ...PermissionsActions, + ...StakingActions, + ...TokenFactoryActions, + ...WasmActions, +]; + +export default InjectiveActions; diff --git a/packages/plugin-injective/src/action/insurance.ts b/packages/plugin-injective/src/action/insurance.ts new file mode 100644 index 00000000000..c1298910c80 --- /dev/null +++ b/packages/plugin-injective/src/action/insurance.ts @@ -0,0 +1,99 @@ +import { createGenericAction } from "./base"; +import * as InsuranceTemplates from "@injective/template/insurance"; +import * as InsuranceExamples from "@injective/examples/insurance"; +import * as InsuranceSimiles from "@injective/similes/insurance"; +// Query Actions +export const GetInsuranceModuleParamsAction = createGenericAction({ + name: "GET_INSURANCE_MODULE_PARAMS", + description: "Fetches the insurance module parameters", + template: InsuranceTemplates.getInsuranceModuleParamsTemplate, + examples: InsuranceExamples.getInsuranceModuleParamsExample, + similes: InsuranceSimiles.getInsuranceModuleParamsSimiles, + functionName: "getInsuranceModuleParams", + validateContent: () => true, +}); + +export const GetInsuranceFundsAction = createGenericAction({ + name: "GET_INSURANCE_FUNDS", + description: "Fetches a list of all insurance funds", + template: InsuranceTemplates.getInsuranceFundsTemplate, + examples: InsuranceExamples.getInsuranceFundsExample, + similes: InsuranceSimiles.getInsuranceFundsSimiles, + functionName: "getInsuranceFunds", + validateContent: () => true, +}); + +export const GetInsuranceFundAction = createGenericAction({ + name: "GET_INSURANCE_FUND", + description: + "Fetches details of a specific insurance fund by its market ID", + template: InsuranceTemplates.getInsuranceFundTemplate, + examples: InsuranceExamples.getInsuranceFundExample, + similes: InsuranceSimiles.getInsuranceFundSimiles, + functionName: "getInsuranceFund", + validateContent: () => true, +}); + +export const GetEstimatedRedemptionsAction = createGenericAction({ + name: "GET_ESTIMATED_REDEMPTIONS", + description: "Fetches estimated redemptions based on provided parameters", + template: InsuranceTemplates.getEstimatedRedemptionsTemplate, + examples: InsuranceExamples.getEstimatedRedemptionsExample, + similes: InsuranceSimiles.getEstimatedRedemptionsSimiles, + functionName: "getEstimatedRedemptions", + validateContent: () => true, +}); + +export const GetPendingRedemptionsAction = createGenericAction({ + name: "GET_PENDING_REDEMPTIONS", + description: "Fetches pending redemptions based on provided parameters", + template: InsuranceTemplates.getPendingRedemptionsTemplate, + examples: InsuranceExamples.getPendingRedemptionsExample, + similes: InsuranceSimiles.getPendingRedemptionsSimiles, + functionName: "getPendingRedemptions", + validateContent: () => true, +}); + +// Message Actions +export const MsgCreateInsuranceFundAction = createGenericAction({ + name: "MSG_CREATE_INSURANCE_FUND", + description: "Broadcasts a message to create a new insurance fund", + template: InsuranceTemplates.msgCreateInsuranceFundTemplate, + examples: InsuranceExamples.msgCreateInsuranceFundExample, + similes: InsuranceSimiles.msgCreateInsuranceFundSimiles, + functionName: "msgCreateInsuranceFund", + validateContent: () => true, +}); + +export const MsgRequestRedemptionAction = createGenericAction({ + name: "MSG_REQUEST_REDEMPTION", + description: + "Broadcasts a message to request a redemption from an insurance fund", + template: InsuranceTemplates.msgRequestRedemptionTemplate, + examples: InsuranceExamples.msgRequestRedemptionExample, + similes: InsuranceSimiles.msgRequestRedemptionSimiles, + functionName: "msgRequestRedemption", + validateContent: () => true, +}); + +export const MsgUnderwriteAction = createGenericAction({ + name: "MSG_UNDERWRITE", + description: "Broadcasts a message to underwrite an insurance fund", + template: InsuranceTemplates.msgUnderwriteTemplate, + examples: InsuranceExamples.msgUnderwriteExample, + similes: InsuranceSimiles.msgUnderwriteSimiles, + functionName: "msgUnderwrite", + validateContent: () => true, +}); + +// Export all actions as a group +export const InsuranceActions = [ + GetInsuranceModuleParamsAction, + GetInsuranceFundsAction, + GetInsuranceFundAction, + GetEstimatedRedemptionsAction, + GetPendingRedemptionsAction, + MsgCreateInsuranceFundAction, + MsgRequestRedemptionAction, + MsgUnderwriteAction, +]; diff --git a/packages/plugin-injective/src/action/mint.ts b/packages/plugin-injective/src/action/mint.ts new file mode 100644 index 00000000000..a66fb7d64ce --- /dev/null +++ b/packages/plugin-injective/src/action/mint.ts @@ -0,0 +1,40 @@ +import { createGenericAction } from "./base"; +import * as MintTemplates from "@injective/template/mint"; +import * as MintExamples from "@injective/examples/mint"; +import * as MintSimiles from "@injective/similes/mint"; +export const GetMintModuleParamsAction = createGenericAction({ + name: "GET_MINT_MODULE_PARAMS", + description: "Fetches the parameters of the Mint module", + template: MintTemplates.getMintModuleParamsTemplate, + examples: MintExamples.getMintModuleParamsExample, + similes: MintSimiles.getMintModuleParamsSimiles, + functionName: "getMintModuleParams", + validateContent: () => true, +}); + +export const GetInflationAction = createGenericAction({ + name: "GET_INFLATION", + description: "Retrieves the current inflation rate", + template: MintTemplates.getInflationTemplate, + examples: MintExamples.getInflationExample, + similes: MintSimiles.getInflationSimiles, + functionName: "getInflation", + validateContent: () => true, +}); + +export const GetAnnualProvisionsAction = createGenericAction({ + name: "GET_ANNUAL_PROVISIONS", + description: "Obtains the annual provisions", + template: MintTemplates.getAnnualProvisionsTemplate, + examples: MintExamples.getAnnualProvisionsExample, + similes: MintSimiles.getAnnualProvisionsSimiles, + functionName: "getAnnualProvisions", + validateContent: () => true, +}); + +// Export all actions as a group +export const MintActions = [ + GetMintModuleParamsAction, + GetInflationAction, + GetAnnualProvisionsAction, +]; diff --git a/packages/plugin-injective/src/action/mito.ts b/packages/plugin-injective/src/action/mito.ts new file mode 100644 index 00000000000..8895499611b --- /dev/null +++ b/packages/plugin-injective/src/action/mito.ts @@ -0,0 +1,347 @@ +import { createGenericAction } from "./base"; +import * as MitoTemplates from "@injective/template/mito"; +import * as MitoExamples from "@injective/examples/mito"; +import * as MitoSimiles from "@injective/similes/mito"; +// Vault Related Actions +export const GetVaultAction = createGenericAction({ + name: "GET_VAULT", + description: "Fetches the details of a specific vault", + template: MitoTemplates.getVaultTemplate, + examples: MitoExamples.getVaultExample, + similes: MitoSimiles.getVaultSimiles, + functionName: "getVault", + validateContent: () => true, +}); + +export const GetVaultsAction = createGenericAction({ + name: "GET_VAULTS", + description: "Fetches a list of all vaults with optional filtering", + template: MitoTemplates.getVaultsTemplate, + examples: MitoExamples.getVaultsExample, + similes: MitoSimiles.getVaultSimiles, + functionName: "getVaults", + validateContent: () => true, +}); + +export const GetVaultsByHolderAddressAction = createGenericAction({ + name: "GET_VAULTS_BY_HOLDER_ADDRESS", + description: "Fetches vaults associated with a specific holder address", + template: MitoTemplates.getVaultsByHolderAddressTemplate, + examples: MitoExamples.getVaultsByHolderAddressExample, + similes: MitoSimiles.getVaultsByHolderAddressSimiles, + functionName: "getVaultsByHolderAddress", + validateContent: () => true, +}); + +// LP Token Related Actions +export const GetLpTokenPriceChartAction = createGenericAction({ + name: "GET_LP_TOKEN_PRICE_CHART", + description: "Retrieves the price chart data for LP tokens", + template: MitoTemplates.getLpTokenPriceChartTemplate, + examples: MitoExamples.getLpTokenPriceChartExample, + similes: MitoSimiles.getLpTokenPriceChartSimiles, + functionName: "getLpTokenPriceChart", + validateContent: () => true, +}); + +export const GetLPHoldersAction = createGenericAction({ + name: "GET_LP_HOLDERS", + description: "Retrieves a list of LP token holders", + template: MitoTemplates.getLPHoldersTemplate, + examples: MitoExamples.getLPHoldersExample, + similes: MitoSimiles.getLPHoldersSimiles, + functionName: "getLPHolders", + validateContent: () => true, +}); + +// TVL and Portfolio Actions +export const GetTVLChartAction = createGenericAction({ + name: "GET_TVL_CHART", + description: "Retrieves the Total Value Locked (TVL) chart data", + template: MitoTemplates.getTVLChartTemplate, + examples: MitoExamples.getTVLChartExample, + similes: MitoSimiles.getTVLChartSimiles, + functionName: "getTVLChart", + validateContent: () => true, +}); + +export const GetHolderPortfolioAction = createGenericAction({ + name: "GET_HOLDER_PORTFOLIO", + description: "Retrieves the portfolio details of a specific holder", + template: MitoTemplates.getHolderPortfolioTemplate, + examples: MitoExamples.getHolderPortfolioExample, + similes: MitoSimiles.getHolderPortfolioSimiles, + functionName: "getHolderPortfolio", + validateContent: () => true, +}); + +// Leaderboard Related Actions +export const GetLeaderboardAction = createGenericAction({ + name: "GET_LEADERBOARD", + description: "Retrieves the leaderboard for a specific epoch", + template: MitoTemplates.getLeaderboardTemplate, + examples: MitoExamples.getLeaderboardExample, + similes: MitoSimiles.getLeaderboardSimiles, + functionName: "getLeaderboard", + validateContent: () => true, +}); + +export const GetLeaderboardEpochsAction = createGenericAction({ + name: "GET_LEADERBOARD_EPOCHS", + description: "Retrieves the epochs associated with leaderboards", + template: MitoTemplates.getLeaderboardEpochsTemplate, + examples: MitoExamples.getLeaderboardEpochsExample, + similes: MitoSimiles.getLeaderboardEpochsSimiles, + functionName: "getLeaderboardEpochs", + validateContent: () => true, +}); + +// Transfer and History Actions +export const GetTransferHistoryAction = createGenericAction({ + name: "GET_TRANSFER_HISTORY", + description: "Fetches the transfer history based on provided parameters", + template: MitoTemplates.getTransferHistoryTemplate, + examples: MitoExamples.getTransferHistoryExample, + similes: MitoSimiles.getTransferHistorySimiles, + functionName: "getTransferHistory", + validateContent: () => true, +}); + +// Staking Related Actions +export const GetStakingPoolsAction = createGenericAction({ + name: "GET_STAKING_POOLS", + description: "Retrieves information about staking pools", + template: MitoTemplates.getStakingPoolsTemplate, + examples: MitoExamples.getStakingPoolsExample, + similes: MitoSimiles.getStakingPoolsSimiles, + functionName: "getStakingPools", + validateContent: () => true, +}); + +export const GetStakingHistoryAction = createGenericAction({ + name: "GET_STAKING_HISTORY", + description: "Retrieves the staking history based on provided parameters", + template: MitoTemplates.getStakingHistoryTemplate, + examples: MitoExamples.getStakingHistoryExample, + similes: MitoSimiles.getStakingHistorySimiles, + functionName: "getStakingHistory", + validateContent: () => true, +}); + +export const GetStakingRewardsByAccountAction = createGenericAction({ + name: "GET_STAKING_REWARDS_BY_ACCOUNT", + description: "Retrieves staking rewards for a specific account", + template: MitoTemplates.getStakingRewardsByAccountTemplate, + examples: MitoExamples.getStakingRewardsByAccountExample, + similes: MitoSimiles.getStakingRewardsByAccountSimiles, + functionName: "getStakingRewardsByAccount", + validateContent: () => true, +}); + +// Mission Related Actions +export const GetMissionsAction = createGenericAction({ + name: "GET_MISSIONS", + description: "Fetches a list of missions based on provided parameters", + template: MitoTemplates.getMissionsTemplate, + examples: MitoExamples.getMissionsExample, + similes: MitoSimiles.getMissionsSimiles, + functionName: "getMissions", + validateContent: () => true, +}); + +export const GetMissionLeaderboardAction = createGenericAction({ + name: "GET_MISSION_LEADERBOARD", + description: + "Retrieves the leaderboard for missions based on the user address", + template: MitoTemplates.getMissionLeaderboardTemplate, + examples: MitoExamples.getMissionLeaderboardExample, + similes: MitoSimiles.getMissionLeaderboardSimiles, + functionName: "getMissionLeaderboard", + validateContent: () => true, +}); + +// IDO Related Actions +export const GetIDOAction = createGenericAction({ + name: "GET_IDO", + description: "Fetches details of a specific Initial DEX Offering (IDO)", + template: MitoTemplates.getIDOTemplate, + examples: MitoExamples.getIDOExample, + similes: MitoSimiles.getIDOSimiles, + functionName: "getIDO", + validateContent: () => true, +}); + +export const GetIDOsAction = createGenericAction({ + name: "GET_IDOS", + description: "Retrieves a list of all IDOs with optional filtering", + template: MitoTemplates.getIDOsTemplate, + examples: MitoExamples.getIDOsExample, + similes: MitoSimiles.getIDOsSimiles, + functionName: "getIDOs", + validateContent: () => true, +}); + +export const GetIDOSubscribersAction = createGenericAction({ + name: "GET_IDO_SUBSCRIBERS", + description: "Fetches subscribers for a specific IDO", + template: MitoTemplates.getIDOSubscribersTemplate, + examples: MitoExamples.getIDOSubscribersExample, + similes: MitoSimiles.getIDOSubscribersSimiles, + functionName: "getIDOSubscribers", + validateContent: () => true, +}); + +export const GetIDOSubscriptionAction = createGenericAction({ + name: "GET_IDO_SUBSCRIPTION", + description: "Retrieves the subscription details for a specific IDO", + template: MitoTemplates.getIDOSubscriptionTemplate, + examples: MitoExamples.getIDOSubscriptionExample, + similes: MitoSimiles.getIDOSubscriptionSimiles, + functionName: "getIDOSubscription", + validateContent: () => true, +}); + +export const GetIDOActivitiesAction = createGenericAction({ + name: "GET_IDO_ACTIVITIES", + description: "Retrieves activities related to a specific IDO", + template: MitoTemplates.getIDOActivitiesTemplate, + examples: MitoExamples.getIDOActivitiesExample, + similes: MitoSimiles.getIDOActivitiesSimiles, + functionName: "getIDOActivities", + validateContent: () => true, +}); + +export const GetIDOWhitelistAction = createGenericAction({ + name: "GET_IDO_WHITELIST", + description: "Fetches the whitelist for a specific IDO", + template: MitoTemplates.getIDOWhitelistTemplate, + examples: MitoExamples.getIDOWhitelistExample, + similes: MitoSimiles.getIDOWhitelistSimiles, + functionName: "getIDOWhitelist", + validateContent: () => true, +}); + +export const GetClaimReferencesAction = createGenericAction({ + name: "GET_CLAIM_REFERENCES", + description: "Retrieves claim references based on provided parameters", + template: MitoTemplates.getClaimReferencesTemplate, + examples: MitoExamples.getClaimReferencesExample, + similes: MitoSimiles.getClaimReferencesSimiles, + functionName: "getClaimReferences", + validateContent: () => true, +}); + +export const GetLaunchpadSubscribeAction = createGenericAction({ + name: "GET_LAUNCHPAD_SUBSCRIBE", + description: "Subscribes to a launchpad offering", + template: MitoTemplates.getLaunchpadSubscribeTemplate, + examples: MitoExamples.getLaunchpadSubscribeExample, + similes: MitoSimiles.getLaunchpadSubscribeSimiles, + functionName: "getLaunchpadSubscribe", + validateContent: () => true, +}); + +export const GetLaunchpadClaimAction = createGenericAction({ + name: "GET_LAUNCHPAD_CLAIM", + description: "Claims tokens from a launchpad offering", + template: MitoTemplates.getLaunchpadClaimTemplate, + examples: MitoExamples.getLaunchpadClaimExample, + similes: MitoSimiles.getLaunchpadClaimSimiles, + functionName: "getLaunchpadClaim", + validateContent: () => true, +}); + +// Vault Related Actions +export const GetSubscribeVaultAction = createGenericAction({ + name: "GET_SUBSCRIBE_VAULT", + description: "Subscribes to a specific vault", + template: MitoTemplates.getSubscribeVaultTemplate, + examples: MitoExamples.getSubscribeVaultExample, + similes: MitoSimiles.getSubscribeVaultSimiles, + functionName: "getSubscribeVault", + validateContent: () => true, +}); + +export const GetInstantiateCPMMVaultAction = createGenericAction({ + name: "GET_INSTANTIATE_CPMM_VAULT", + description: "Creates a new CPMM vault instance", + template: MitoTemplates.getInstantiateCPMMVaultTemplate, + examples: MitoExamples.getInstantiateCPMMVaultExample, + similes: MitoSimiles.getInstantiateCPMMVaultSimiles, + functionName: "getInstantiateCPMMVault", + validateContent: () => true, +}); + +export const GetRedeemFromVaultAction = createGenericAction({ + name: "GET_REDEEM_FROM_VAULT", + description: "Redeems tokens from a specific vault", + template: MitoTemplates.getRedeemFromVaultTemplate, + examples: MitoExamples.getRedeemFromVaultExample, + similes: MitoSimiles.getRedeemFromVaultSimiles, + functionName: "getRedeemFromVault", + validateContent: () => true, +}); + +export const GetStakeVaultLPAction = createGenericAction({ + name: "GET_STAKE_VAULT_LP", + description: "Stakes LP tokens in a vault", + template: MitoTemplates.getStakeVaultLPTemplate, + examples: MitoExamples.getStakeVaultLPExample, + similes: MitoSimiles.getStakeVaultLPSimiles, + functionName: "getStakeVaultLP", + validateContent: () => true, +}); + +export const GetUnstakeVaultLPAction = createGenericAction({ + name: "GET_UNSTAKE_VAULT_LP", + description: "Unstakes LP tokens from a vault", + template: MitoTemplates.getUnstakeVaultLPTemplate, + examples: MitoExamples.getUnstakeVaultLPExample, + similes: MitoSimiles.getUnstakeVaultLPSimiles, + functionName: "getUnstakeVaultLP", + validateContent: () => true, +}); + +export const GetClaimVaultRewardsAction = createGenericAction({ + name: "GET_CLAIM_VAULT_REWARDS", + description: "Claims rewards from a vault", + template: MitoTemplates.getClaimVaultRewardsTemplate, + examples: MitoExamples.getClaimVaultRewardsExample, + similes: MitoSimiles.getClaimVaultRewardsSimiles, + functionName: "getClaimVaultRewards", + validateContent: () => true, +}); + +// Export all actions as a group +export const MitoActions = [ + GetVaultAction, + GetVaultsAction, + GetVaultsByHolderAddressAction, + GetLpTokenPriceChartAction, + GetLPHoldersAction, + GetTVLChartAction, + GetHolderPortfolioAction, + GetLeaderboardAction, + GetLeaderboardEpochsAction, + GetTransferHistoryAction, + GetStakingPoolsAction, + GetStakingHistoryAction, + GetStakingRewardsByAccountAction, + GetMissionsAction, + GetMissionLeaderboardAction, + GetIDOAction, + GetIDOsAction, + GetIDOSubscribersAction, + GetIDOSubscriptionAction, + GetIDOActivitiesAction, + GetIDOWhitelistAction, + GetClaimReferencesAction, + GetLaunchpadSubscribeAction, + GetLaunchpadClaimAction, + GetSubscribeVaultAction, + GetInstantiateCPMMVaultAction, + GetRedeemFromVaultAction, + GetStakeVaultLPAction, + GetUnstakeVaultLPAction, + GetClaimVaultRewardsAction, +]; diff --git a/packages/plugin-injective/src/action/peggy.ts b/packages/plugin-injective/src/action/peggy.ts new file mode 100644 index 00000000000..96ea69e0419 --- /dev/null +++ b/packages/plugin-injective/src/action/peggy.ts @@ -0,0 +1,29 @@ +import { createGenericAction } from "./base"; +import * as PeggyTemplates from "@injective/template/peggy"; +import * as PeggyExamples from "@injective/examples/peggy"; +import * as PeggySimiles from "@injective/similes/peggy"; +// Query Actions +export const GetPeggyModuleParamsAction = createGenericAction({ + name: "GET_PEGGY_MODULE_PARAMS", + description: "Fetches the parameters of the Peggy module", + template: PeggyTemplates.getPeggyModuleParamsTemplate, + examples: PeggyExamples.getPeggyModuleParamsExample, + functionName: "getPeggyModuleParams", + similes: PeggySimiles.getPeggyModuleParamsSimiles, + validateContent: () => true, +}); + +// Message Actions +export const MsgSendToEthAction = createGenericAction({ + name: "MSG_SEND_TO_ETH", + description: + "Broadcasts a message to send tokens to an Ethereum address via IBC transfer", + template: PeggyTemplates.msgSendToEthTemplate, + examples: PeggyExamples.msgSendToEthExample, + functionName: "msgSendToEth", + similes: PeggySimiles.msgSendToEthSimiles, + validateContent: () => true, +}); + +// Export all actions as a group +export const PeggyActions = [GetPeggyModuleParamsAction, MsgSendToEthAction]; diff --git a/packages/plugin-injective/src/action/permissions.ts b/packages/plugin-injective/src/action/permissions.ts new file mode 100644 index 00000000000..e87c8a8ed75 --- /dev/null +++ b/packages/plugin-injective/src/action/permissions.ts @@ -0,0 +1,74 @@ +import { createGenericAction } from "./base"; +import * as PermissionsTemplates from "@injective/template/permissions"; +import * as PermissionsExamples from "@injective/examples/permissions"; +import * as PermissionsSimiles from "@injective/similes/permissions"; +export const GetAddressesByRoleAction = createGenericAction({ + name: "GET_ADDRESSES_BY_ROLE", + description: "Fetches addresses associated with a specific role", + template: PermissionsTemplates.getAddressesByRoleTemplate, + examples: PermissionsExamples.getAddressesByRoleExample, + similes: PermissionsSimiles.getAddressesByRoleSimiles, + functionName: "getAddressesByRole", + validateContent: () => true, +}); + +export const GetAddressRolesAction = createGenericAction({ + name: "GET_ADDRESS_ROLES", + description: "Retrieves roles associated with a specific address", + template: PermissionsTemplates.getAddressRolesTemplate, + examples: PermissionsExamples.getAddressRolesExample, + similes: PermissionsSimiles.getAddressRolesSimiles, + functionName: "getAddressRoles", + validateContent: () => true, +}); + +export const GetAllNamespacesAction = createGenericAction({ + name: "GET_ALL_NAMESPACES", + description: "Retrieves all namespaces within the permissions module", + template: PermissionsTemplates.getAllNamespacesTemplate, + examples: PermissionsExamples.getAllNamespacesExample, + similes: PermissionsSimiles.getAllNamespacesSimiles, + functionName: "getAllNamespaces", + validateContent: () => true, +}); + +export const GetPermissionsModuleParamsAction = createGenericAction({ + name: "GET_PERMISSIONS_MODULE_PARAMS", + description: "Fetches the parameters of the Permissions module", + template: PermissionsTemplates.getPermissionsModuleParamsTemplate, + examples: PermissionsExamples.getPermissionsModuleParamsExample, + similes: PermissionsSimiles.getPermissionsModuleParamsSimiles, + functionName: "getPermissionsModuleParams", + validateContent: () => true, +}); + +export const GetNamespaceByDenomAction = createGenericAction({ + name: "GET_NAMESPACE_BY_DENOM", + description: + "Retrieves the namespace associated with a specific denomination", + template: PermissionsTemplates.getNamespaceByDenomTemplate, + examples: PermissionsExamples.getNamespaceByDenomExample, + similes: PermissionsSimiles.getNamespaceByDenomSimiles, + functionName: "getNamespaceByDenom", + validateContent: () => true, +}); + +export const GetVouchersForAddressAction = createGenericAction({ + name: "GET_VOUCHERS_FOR_ADDRESS", + description: "Retrieves vouchers associated with a specific address", + template: PermissionsTemplates.getVouchersForAddressTemplate, + examples: PermissionsExamples.getVouchersForAddressExample, + similes: PermissionsSimiles.getVouchersForAddressSimiles, + functionName: "getVouchersForAddress", + validateContent: () => true, +}); + +// Export all actions as a group +export const PermissionsActions = [ + GetAddressesByRoleAction, + GetAddressRolesAction, + GetAllNamespacesAction, + GetPermissionsModuleParamsAction, + GetNamespaceByDenomAction, + GetVouchersForAddressAction, +]; diff --git a/packages/plugin-injective/src/action/staking.ts b/packages/plugin-injective/src/action/staking.ts new file mode 100644 index 00000000000..45288e26fa4 --- /dev/null +++ b/packages/plugin-injective/src/action/staking.ts @@ -0,0 +1,280 @@ +import { createGenericAction } from "./base"; +import * as StakingTemplates from "@injective/template/staking"; +import * as StakingExamples from "@injective/examples/staking"; +import * as StakingSimiles from "@injective/similes/staking"; +// Module and Pool Query Actions +export const GetStakingModuleParamsAction = createGenericAction({ + name: "GET_STAKING_MODULE_PARAMS", + description: "Fetches the staking module parameters", + template: StakingTemplates.getStakingModuleParamsTemplate, + examples: StakingExamples.getStakingModuleParamsExample, + similes: StakingSimiles.getStakingModuleParamsSimiles, + functionName: "getStakingModuleParams", + validateContent: () => true, +}); + +export const GetPoolAction = createGenericAction({ + name: "GET_POOL", + description: "Fetches the staking pool information", + template: StakingTemplates.getPoolTemplate, + examples: StakingExamples.getPoolExample, + similes: StakingSimiles.getPoolSimiles, + functionName: "getPool", + validateContent: () => true, +}); + +// Validator Query Actions +export const GetValidatorsAction = createGenericAction({ + name: "GET_VALIDATORS", + description: "Fetches a list of validators with optional pagination", + template: StakingTemplates.getValidatorsTemplate, + examples: StakingExamples.getValidatorsExample, + similes: StakingSimiles.getValidatorSimiles, + functionName: "getValidators", + validateContent: () => true, +}); + +export const GetValidatorAction = createGenericAction({ + name: "GET_VALIDATOR", + description: "Fetches a specific validator by address", + template: StakingTemplates.getValidatorTemplate, + examples: StakingExamples.getValidatorExample, + similes: StakingSimiles.getValidatorSimiles, + functionName: "getValidator", + validateContent: () => true, +}); + +// Delegation Query Actions +export const GetValidatorDelegationsAction = createGenericAction({ + name: "GET_VALIDATOR_DELEGATIONS", + description: "Fetches delegations for a specific validator", + template: StakingTemplates.getValidatorDelegationsTemplate, + examples: StakingExamples.getValidatorDelegationsExample, + similes: StakingSimiles.getValidatorDelegationsSimiles, + functionName: "getValidatorDelegations", + validateContent: () => true, +}); + +export const GetValidatorDelegationsNoThrowAction = createGenericAction({ + name: "GET_VALIDATOR_DELEGATIONS_NO_THROW", + description: + "Fetches delegations for a specific validator without throwing an error", + template: StakingTemplates.getValidatorDelegationsNoThrowTemplate, + examples: StakingExamples.getValidatorDelegationsNoThrowExample, + similes: StakingSimiles.getValidatorDelegationsNoThrowSimiles, + functionName: "getValidatorDelegationsNoThrow", + validateContent: () => true, +}); + +export const GetValidatorUnbondingDelegationsAction = createGenericAction({ + name: "GET_VALIDATOR_UNBONDING_DELEGATIONS", + description: "Fetches unbonding delegations for a specific validator", + template: StakingTemplates.getValidatorUnbondingDelegationsTemplate, + examples: StakingExamples.getValidatorUnbondingDelegationsExample, + similes: StakingSimiles.getValidatorUnbondingDelegationsSimiles, + functionName: "getValidatorUnbondingDelegations", + validateContent: () => true, +}); + +export const GetValidatorUnbondingDelegationsNoThrowAction = + createGenericAction({ + name: "GET_VALIDATOR_UNBONDING_DELEGATIONS_NO_THROW", + description: + "Fetches unbonding delegations for a specific validator without throwing an error", + template: + StakingTemplates.getValidatorUnbondingDelegationsNoThrowTemplate, + examples: + StakingExamples.getValidatorUnbondingDelegationsNoThrowExample, + similes: StakingSimiles.getValidatorDelegationsNoThrowSimiles, + functionName: "getValidatorUnbondingDelegationsNoThrow", + validateContent: () => true, + }); + +export const GetDelegationAction = createGenericAction({ + name: "GET_DELEGATION", + description: "Fetches a specific delegation", + template: StakingTemplates.getDelegationTemplate, + examples: StakingExamples.getDelegationExample, + similes: StakingSimiles.getDelegationSimiles, + functionName: "getDelegation", + validateContent: () => true, +}); + +export const GetDelegationsAction = createGenericAction({ + name: "GET_DELEGATIONS", + description: "Fetches all delegations for a delegator", + template: StakingTemplates.getDelegationsTemplate, + examples: StakingExamples.getDelegationsExample, + similes: StakingSimiles.getDelegationsSimiles, + functionName: "getDelegations", + validateContent: () => true, +}); + +export const GetDelegationsNoThrowAction = createGenericAction({ + name: "GET_DELEGATIONS_NO_THROW", + description: + "Fetches all delegations for a delegator without throwing an error", + template: StakingTemplates.getDelegationsNoThrowTemplate, + examples: StakingExamples.getDelegationsNoThrowExample, + similes: StakingSimiles.getDelegationsNoThrowSimiles, + functionName: "getDelegationsNoThrow", + validateContent: () => true, +}); + +export const GetDelegatorsAction = createGenericAction({ + name: "GET_DELEGATORS", + description: "Fetches all delegators for a validator", + template: StakingTemplates.getDelegatorsTemplate, + examples: StakingExamples.getDelegatorsExample, + similes: StakingSimiles.getDelegatorsSimiles, + functionName: "getDelegators", + validateContent: () => true, +}); + +export const GetDelegatorsNoThrowAction = createGenericAction({ + name: "GET_DELEGATORS_NO_THROW", + description: + "Fetches all delegators for a validator without throwing an error", + template: StakingTemplates.getDelegatorsNoThrowTemplate, + examples: StakingExamples.getDelegatorsNoThrowExample, + similes: StakingSimiles.getDelegatorsNoThrowSimiles, + functionName: "getDelegatorsNoThrow", + validateContent: () => true, +}); + +export const GetUnbondingDelegationsAction = createGenericAction({ + name: "GET_UNBONDING_DELEGATIONS", + description: "Fetches all unbonding delegations for a delegator", + template: StakingTemplates.getUnbondingDelegationsTemplate, + examples: StakingExamples.getUnbondingDelegationsExample, + similes: StakingSimiles.getUnbondingDelegationsSimiles, + functionName: "getUnbondingDelegations", + validateContent: () => true, +}); + +export const GetUnbondingDelegationsNoThrowAction = createGenericAction({ + name: "GET_UNBONDING_DELEGATIONS_NO_THROW", + description: + "Fetches all unbonding delegations for a delegator without throwing an error", + template: StakingTemplates.getUnbondingDelegationsNoThrowTemplate, + examples: StakingExamples.getUnbondingDelegationsNoThrowExample, + similes: StakingSimiles.getUnbondingDelegationsNoThrowSimiles, + functionName: "getUnbondingDelegationsNoThrow", + validateContent: () => true, +}); + +export const GetReDelegationsAction = createGenericAction({ + name: "GET_REDELEGATIONS", + description: "Fetches all redelegations for a delegator", + template: StakingTemplates.getReDelegationsTemplate, + examples: StakingExamples.getReDelegationsExample, + similes: StakingSimiles.getReDelegationsSimiles, + functionName: "getReDelegations", + validateContent: () => true, +}); + +export const GetReDelegationsNoThrowAction = createGenericAction({ + name: "GET_REDELEGATIONS_NO_THROW", + description: + "Fetches all redelegations for a delegator without throwing an error", + template: StakingTemplates.getReDelegationsNoThrowTemplate, + examples: StakingExamples.getReDelegationsNoThrowExample, + similes: StakingSimiles.getReDelegationsNoThrowSimiles, + functionName: "getReDelegationsNoThrow", + validateContent: () => true, +}); + +// Message Actions +export const MsgBeginRedelegateAction = createGenericAction({ + name: "MSG_BEGIN_REDELEGATE", + description: "Broadcasts a message to begin redelegating tokens", + template: StakingTemplates.msgBeginRedelegateTemplate, + examples: StakingExamples.msgBeginRedelegateExample, + similes: StakingSimiles.msgBeginRedelegateSimiles, + functionName: "msgBeginRedelegate", + validateContent: () => true, +}); + +export const MsgDelegateAction = createGenericAction({ + name: "MSG_DELEGATE", + description: "Broadcasts a message to delegate tokens to a validator", + template: StakingTemplates.msgDelegateTemplate, + examples: StakingExamples.msgDelegateExample, + similes: StakingSimiles.msgDelegateSimiles, + functionName: "msgDelegate", + validateContent: () => true, +}); + +export const MsgUndelegateAction = createGenericAction({ + name: "MSG_UNDELEGATE", + description: "Broadcasts a message to undelegate tokens from a validator", + template: StakingTemplates.msgUndelegateTemplate, + examples: StakingExamples.msgUndelegateExample, + similes: StakingSimiles.msgUndelegateSimiles, + functionName: "msgUndelegate", + validateContent: () => true, +}); + +export const MsgCreateValidatorAction = createGenericAction({ + name: "MSG_CREATE_VALIDATOR", + description: "Broadcasts a message to create a new validator", + template: StakingTemplates.msgCreateValidatorTemplate, + examples: StakingExamples.msgCreateValidatorExample, + similes: StakingSimiles.msgCreateValidatorSimiles, + functionName: "msgCreateValidator", + validateContent: () => true, +}); + +export const MsgEditValidatorAction = createGenericAction({ + name: "MSG_EDIT_VALIDATOR", + description: "Broadcasts a message to edit an existing validator", + template: StakingTemplates.msgEditValidatorTemplate, + examples: StakingExamples.msgEditValidatorExample, + similes: StakingSimiles.msgEditValidatorSimiles, + functionName: "msgEditValidator", + validateContent: () => true, +}); + +export const MsgCancelUnbondingDelegationAction = createGenericAction({ + name: "MSG_CANCEL_UNBONDING_DELEGATION", + description: "Broadcasts a message to cancel an unbonding delegation", + template: StakingTemplates.msgCancelUnbondingDelegationTemplate, + examples: StakingExamples.msgCancelUnbondingDelegationExample, + similes: StakingSimiles.msgCancelUnbondingDelegationSimiles, + functionName: "msgCancelUnbondingDelegation", + validateContent: () => true, +}); + +// Export all actions as a group +export const StakingActions = [ + // Module and Pool Actions + GetStakingModuleParamsAction, + GetPoolAction, + + // Validator Actions + GetValidatorsAction, + GetValidatorAction, + + // Delegation Query Actions + GetValidatorDelegationsAction, + GetValidatorDelegationsNoThrowAction, + GetValidatorUnbondingDelegationsAction, + GetValidatorUnbondingDelegationsNoThrowAction, + GetDelegationAction, + GetDelegationsAction, + GetDelegationsNoThrowAction, + GetDelegatorsAction, + GetDelegatorsNoThrowAction, + GetUnbondingDelegationsAction, + GetUnbondingDelegationsNoThrowAction, + GetReDelegationsAction, + GetReDelegationsNoThrowAction, + + // Message Actions + MsgBeginRedelegateAction, + MsgDelegateAction, + MsgUndelegateAction, + MsgCreateValidatorAction, + MsgEditValidatorAction, + MsgCancelUnbondingDelegationAction, +]; diff --git a/packages/plugin-injective/src/action/token-factory.ts b/packages/plugin-injective/src/action/token-factory.ts new file mode 100644 index 00000000000..c92a31a6f06 --- /dev/null +++ b/packages/plugin-injective/src/action/token-factory.ts @@ -0,0 +1,111 @@ +import { createGenericAction } from "./base"; +import * as TokenFactoryTemplates from "@injective/template/token-factory"; +import * as TokenFactoryExamples from "@injective/examples/token-factory"; +import * as TokenFactorySimiles from "@injective/similes/token-factory"; +// Query Actions +export const GetDenomsFromCreatorAction = createGenericAction({ + name: "GET_DENOMS_FROM_CREATOR", + description: "Fetches all denominations created by a specific creator", + template: TokenFactoryTemplates.getDenomsFromCreatorTemplate, + examples: TokenFactoryExamples.getDenomsFromCreatorExample, + similes: TokenFactorySimiles.getDenomsFromCreatorSimiles, + functionName: "getDenomsFromCreator", + validateContent: () => true, +}); + +export const GetDenomAuthorityMetadataAction = createGenericAction({ + name: "GET_DENOM_AUTHORITY_METADATA", + description: "Fetches the authority metadata for a specific denomination", + template: TokenFactoryTemplates.getDenomAuthorityMetadataTemplate, + examples: TokenFactoryExamples.getDenomAuthorityMetadataExample, + similes: TokenFactorySimiles.getDenomAuthorityMetadataSimiles, + functionName: "getDenomAuthorityMetadata", + validateContent: () => true, +}); + +export const GetTokenFactoryModuleParamsAction = createGenericAction({ + name: "GET_TOKEN_FACTORY_MODULE_PARAMS", + description: "Fetches the parameters of the Token Factory module", + template: TokenFactoryTemplates.getTokenFactoryModuleParamsTemplate, + examples: TokenFactoryExamples.getTokenFactoryModuleParamsExample, + similes: TokenFactorySimiles.getTokenFactoryModuleParamsSimiles, + functionName: "getTokenFactoryModuleParams", + validateContent: () => true, +}); + +export const GetTokenFactoryModuleStateAction = createGenericAction({ + name: "GET_TOKEN_FACTORY_MODULE_STATE", + description: "Fetches the current state of the Token Factory module", + template: TokenFactoryTemplates.getTokenFactoryModuleStateTemplate, + examples: TokenFactoryExamples.getTokenFactoryModuleStateExample, + similes: TokenFactorySimiles.getTokenFactoryModuleStateSimiles, + functionName: "getTokenFactoryModuleState", + validateContent: () => true, +}); + +// Message Actions +export const MsgBurnAction = createGenericAction({ + name: "MSG_BURN", + description: "Broadcasts a message to burn tokens", + template: TokenFactoryTemplates.msgBurnTemplate, + examples: TokenFactoryExamples.msgBurnExample, + similes: TokenFactorySimiles.msgBurnSimiles, + functionName: "msgBurn", + validateContent: () => true, +}); + +export const MsgChangeAdminAction = createGenericAction({ + name: "MSG_CHANGE_ADMIN", + description: "Broadcasts a message to change the admin of a denomination", + template: TokenFactoryTemplates.msgChangeAdminTemplate, + examples: TokenFactoryExamples.msgChangeAdminExample, + similes: TokenFactorySimiles.msgChangeAdminSimiles, + functionName: "msgChangeAdmin", + validateContent: () => true, +}); + +export const MsgCreateDenomAction = createGenericAction({ + name: "MSG_CREATE_DENOM", + description: "Broadcasts a message to create a new denomination", + template: TokenFactoryTemplates.msgCreateDenomTemplate, + examples: TokenFactoryExamples.msgCreateDenomExample, + similes: TokenFactorySimiles.msgCreateDenomSimiles, + functionName: "msgCreateDenom", + validateContent: () => true, +}); + +export const MsgMintAction = createGenericAction({ + name: "MSG_MINT", + description: "Broadcasts a message to mint new tokens", + template: TokenFactoryTemplates.msgMintTemplate, + examples: TokenFactoryExamples.msgMintExample, + similes: TokenFactorySimiles.msgMintSimiles, + functionName: "msgMint", + validateContent: () => true, +}); + +export const MsgSetDenomMetadataAction = createGenericAction({ + name: "MSG_SET_DENOM_METADATA", + description: "Broadcasts a message to set metadata for a denomination", + template: TokenFactoryTemplates.msgSetDenomMetadataTemplate, + examples: TokenFactoryExamples.msgSetDenomMetadataExample, + similes: TokenFactorySimiles.msgSetDenomMetadataSimiles, + functionName: "msgSetDenomMetadata", + validateContent: () => true, +}); + +// Export all actions as a group +export const TokenFactoryActions = [ + // Query Actions + GetDenomsFromCreatorAction, + GetDenomAuthorityMetadataAction, + GetTokenFactoryModuleParamsAction, + GetTokenFactoryModuleStateAction, + + // Message Actions + MsgBurnAction, + MsgChangeAdminAction, + MsgCreateDenomAction, + MsgMintAction, + MsgSetDenomMetadataAction, +]; diff --git a/packages/plugin-injective/src/action/wasm.ts b/packages/plugin-injective/src/action/wasm.ts new file mode 100644 index 00000000000..06908519d43 --- /dev/null +++ b/packages/plugin-injective/src/action/wasm.ts @@ -0,0 +1,219 @@ +import { createGenericAction } from "./base"; +import * as WasmTemplates from "@injective/template/wasm"; +import * as WasmExamples from "@injective/examples/wasm"; +import * as WasmSimiles from "@injective/similes/wasm"; +// Contract Query Actions +export const GetContractAccountsBalanceAction = createGenericAction({ + name: "GET_CONTRACT_ACCOUNTS_BALANCE", + description: "Fetches the balance of contract accounts", + template: WasmTemplates.getContractAccountsBalanceTemplate, + examples: WasmExamples.getContractAccountsBalanceExample, + similes: WasmSimiles.getContractAccountsBalanceSimiles, + functionName: "getContractAccountsBalance", + validateContent: () => true, +}); + +export const GetContractStateAction = createGenericAction({ + name: "GET_CONTRACT_STATE", + description: "Fetches the state of a specific contract", + template: WasmTemplates.getContractStateTemplate, + examples: WasmExamples.getContractStateExample, + similes: WasmSimiles.getContractStateSimiles, + functionName: "getContractState", + validateContent: () => true, +}); + +export const GetContractInfoAction = createGenericAction({ + name: "GET_CONTRACT_INFO", + description: "Fetches information about a specific contract", + template: WasmTemplates.getContractInfoTemplate, + examples: WasmExamples.getContractInfoExample, + similes: WasmSimiles.getContractInfoSimiles, + functionName: "getContractInfo", + validateContent: () => true, +}); + +export const GetContractHistoryAction = createGenericAction({ + name: "GET_CONTRACT_HISTORY", + description: "Fetches the history of a specific contract", + template: WasmTemplates.getContractHistoryTemplate, + examples: WasmExamples.getContractHistoryExample, + similes: WasmSimiles.getContractHistorySimiles, + functionName: "getContractHistory", + validateContent: () => true, +}); + +export const GetSmartContractStateAction = createGenericAction({ + name: "GET_SMART_CONTRACT_STATE", + description: "Fetches the smart contract state based on a query", + template: WasmTemplates.getSmartContractStateTemplate, + examples: WasmExamples.getSmartContractStateExample, + similes: WasmSimiles.getSmartContractStateSimiles, + functionName: "getSmartContractState", + validateContent: () => true, +}); + +export const GetRawContractStateAction = createGenericAction({ + name: "GET_RAW_CONTRACT_STATE", + description: + "Fetches the raw state of a specific contract based on a query", + template: WasmTemplates.getRawContractStateTemplate, + examples: WasmExamples.getRawContractStateExample, + similes: WasmSimiles.getRawContractStateSimiles, + functionName: "getRawContractState", + validateContent: () => true, +}); + +// Code Query Actions +export const GetContractCodesAction = createGenericAction({ + name: "GET_CONTRACT_CODES", + description: "Fetches all contract codes with optional pagination", + template: WasmTemplates.getContractCodesTemplate, + examples: WasmExamples.getContractCodesExample, + similes: WasmSimiles.getContractCodesSimiles, + functionName: "getContractCodes", + validateContent: () => true, +}); + +export const GetContractCodeAction = createGenericAction({ + name: "GET_CONTRACT_CODE", + description: "Fetches a specific contract code by its ID", + template: WasmTemplates.getContractCodeTemplate, + examples: WasmExamples.getContractCodeExample, + similes: WasmSimiles.getContractCodeSimiles, + functionName: "getContractCode", + validateContent: () => true, +}); + +export const GetContractCodeContractsAction = createGenericAction({ + name: "GET_CONTRACT_CODE_CONTRACTS", + description: "Fetches contracts associated with a specific contract code", + template: WasmTemplates.getContractCodeContractsTemplate, + examples: WasmExamples.getContractCodeContractsExample, + similes: WasmSimiles.getContractCodeContractsSimiles, + functionName: "getContractCodeContracts", + validateContent: () => true, +}); + +// Message Actions +export const MsgStoreCodeAction = createGenericAction({ + name: "MSG_STORE_CODE", + description: "Broadcasts a message to store new contract code", + template: WasmTemplates.msgStoreCodeTemplate, + examples: WasmExamples.msgStoreCodeExample, + similes: WasmSimiles.msgStoreCodeSimiles, + functionName: "msgStoreCode", + validateContent: () => true, +}); + +export const MsgUpdateAdminAction = createGenericAction({ + name: "MSG_UPDATE_ADMIN", + description: "Broadcasts a message to update the admin of a contract", + template: WasmTemplates.msgUpdateAdminTemplate, + examples: WasmExamples.msgUpdateAdminExample, + similes: WasmSimiles.msgUpdateAdminSimiles, + functionName: "msgUpdateAdmin", + validateContent: () => true, +}); + +export const MsgExecuteContractAction = createGenericAction({ + name: "MSG_EXECUTE_CONTRACT", + description: "Broadcasts a message to execute a contract", + template: WasmTemplates.msgExecuteContractTemplate, + examples: WasmExamples.msgExecuteContractExample, + similes: WasmSimiles.msgExecuteContractSimiles, + functionName: "msgExecuteContract", + validateContent: () => true, +}); + +export const MsgMigrateContractAction = createGenericAction({ + name: "MSG_MIGRATE_CONTRACT", + description: + "Broadcasts a message to migrate a contract to a new code version", + template: WasmTemplates.msgMigrateContractTemplate, + examples: WasmExamples.msgMigrateContractExample, + similes: WasmSimiles.msgMigrateContractSimiles, + functionName: "msgMigrateContract", + validateContent: () => true, +}); + +export const MsgInstantiateContractAction = createGenericAction({ + name: "MSG_INSTANTIATE_CONTRACT", + description: "Broadcasts a message to instantiate a new contract", + template: WasmTemplates.msgInstantiateContractTemplate, + examples: WasmExamples.msgInstantiateContractExample, + similes: WasmSimiles.msgInstantiateContractSimiles, + functionName: "msgInstantiateContract", + validateContent: () => true, +}); + +export const MsgExecuteContractCompatAction = createGenericAction({ + name: "MSG_EXECUTE_CONTRACT_COMPAT", + description: + "Broadcasts a message to execute a contract using compatibility mode", + template: WasmTemplates.msgExecuteContractCompatTemplate, + examples: WasmExamples.msgExecuteContractCompatExample, + similes: WasmSimiles.msgExecuteContractCompatSimiles, + functionName: "msgExecuteContractCompat", + validateContent: () => true, +}); + +export const MsgPrivilegedExecuteContractAction = createGenericAction({ + name: "MSG_PRIVILEGED_EXECUTE_CONTRACT", + description: "Broadcasts a privileged message to execute a contract", + template: WasmTemplates.msgPrivilegedExecuteContractTemplate, + examples: WasmExamples.msgPrivilegedExecuteContractExample, + similes: WasmSimiles.msgPrivilegedExecuteContractSimiles, + functionName: "msgPrivilegedExecuteContract", + validateContent: () => true, +}); + +// WasmX Query Actions +export const GetWasmxModuleParamsAction = createGenericAction({ + name: "GET_WASMX_MODULE_PARAMS", + description: "Fetches the parameters of the WasmX module", + template: WasmTemplates.getWasmxModuleParamsTemplate, + examples: WasmExamples.getWasmxModuleParamsExample, + similes: WasmSimiles.getWasmxModuleParamsSimiles, + functionName: "getWasmxModuleParams", + validateContent: () => true, +}); + +export const GetWasmxModuleStateAction = createGenericAction({ + name: "GET_WASMX_MODULE_STATE", + description: "Fetches the current state of the WasmX module", + template: WasmTemplates.getWasmxModuleStateTemplate, + examples: WasmExamples.getWasmxModuleStateExample, + similes: WasmSimiles.getWasmxModuleStateSimiles, + functionName: "getWasmxModuleState", + validateContent: () => true, +}); + +// Export all actions as a group +export const WasmActions = [ + // Contract Query Actions + GetContractAccountsBalanceAction, + GetContractStateAction, + GetContractInfoAction, + GetContractHistoryAction, + GetSmartContractStateAction, + GetRawContractStateAction, + + // Code Query Actions + GetContractCodesAction, + GetContractCodeAction, + GetContractCodeContractsAction, + + // Message Actions + MsgStoreCodeAction, + MsgUpdateAdminAction, + MsgExecuteContractAction, + MsgMigrateContractAction, + MsgInstantiateContractAction, + MsgExecuteContractCompatAction, + MsgPrivilegedExecuteContractAction, + + // WasmX Query Actions + GetWasmxModuleParamsAction, + GetWasmxModuleStateAction, +]; diff --git a/packages/plugin-injective/src/index.ts b/packages/plugin-injective/src/index.ts new file mode 100644 index 00000000000..c0d5e1e49dd --- /dev/null +++ b/packages/plugin-injective/src/index.ts @@ -0,0 +1,11 @@ +import InjectiveActions from "./action"; +import { Plugin } from "@elizaos/core"; +export const injectivePlugin: Plugin = { + name: "injective", + description: "A plugin for interacting with the Injective blockchain", + actions: InjectiveActions, + evaluators: [], + providers: [], //TODO: Integrate with injective-trader to run MM and Taking Strats +}; + +export default injectivePlugin; diff --git a/packages/plugin-injective/tsconfig.json b/packages/plugin-injective/tsconfig.json new file mode 100644 index 00000000000..5d351328304 --- /dev/null +++ b/packages/plugin-injective/tsconfig.json @@ -0,0 +1,24 @@ +{ + "extends": "../core/tsconfig.json", + "compilerOptions": { + "outDir": "dist", + "rootDir": ".", + "rootDirs": [ + "src", + "injective-sdk-client-ts" + ], + "baseUrl": ".", + "paths": { + "@injective/*": [ + "injective-sdk-client-ts/src/*" + ] + }, + "types": [ + "node" + ] + }, + "include": [ + "src/**/*.ts", + "injective-sdk-client-ts/**/*.ts", + ] +} \ No newline at end of file diff --git a/packages/plugin-injective/tsup.config.ts b/packages/plugin-injective/tsup.config.ts new file mode 100644 index 00000000000..78773191659 --- /dev/null +++ b/packages/plugin-injective/tsup.config.ts @@ -0,0 +1,50 @@ +import { defineConfig } from 'tsup'; +import { builtinModules } from 'module'; +import pkg from './package.json'; + +export default defineConfig({ + entry: ['src/index.ts'], + format: ['cjs', 'esm'], + dts: true, + sourcemap: true, + clean: true, + splitting: false, + minify: false, + platform: 'node', + target: 'node23', + + // Bundle problematic packages + noExternal: [ + 'form-data', + 'combined-stream', + 'delayed-stream', + 'mime-types', + 'mime-db', + 'asynckit', + 'util' + ], + + external: [ + ...builtinModules.filter(mod => mod !== 'util'), + ...Object.keys(pkg.dependencies || {}) + .filter(dep => !['form-data', 'combined-stream', 'delayed-stream', + 'mime-types', 'mime-db', 'asynckit'].includes(dep)) + ], + + esbuildOptions: (options) => { + options.mainFields = ['module', 'main']; + options.banner = { + js: ` + import { createRequire } from 'module'; + import { fileURLToPath } from 'url'; + import { dirname } from 'path'; + const require = createRequire(import.meta.url); + const __filename = fileURLToPath(import.meta.url); + const __dirname = dirname(__filename); + ` + }; + options.define = { + 'process.env.NODE_ENV': '"production"' + }; + } +}); \ No newline at end of file diff --git a/packages/plugin-node/README.md b/packages/plugin-node/README.md index c0f367c1c52..f9066fcb08a 100644 --- a/packages/plugin-node/README.md +++ b/packages/plugin-node/README.md @@ -54,6 +54,9 @@ AWS_SECRET_ACCESS_KEY=your_aws_secret_key AWS_REGION=your_aws_region AWS_S3_BUCKET=your_s3_bucket AWS_S3_UPLOAD_PATH=your_upload_path +AWS_S3_ENDPOINT=an_alternative_endpoint +AWS_S3_SSL_ENABLED=boolean(true|false) +AWS_S3_FORCE_PATH_STYLE=boolean(true|false) ``` ## Usage diff --git a/packages/plugin-node/src/services/awsS3.ts b/packages/plugin-node/src/services/awsS3.ts index 0c038c5ef5d..988d2f6d12f 100644 --- a/packages/plugin-node/src/services/awsS3.ts +++ b/packages/plugin-node/src/services/awsS3.ts @@ -58,7 +58,17 @@ export class AwsS3Service extends Service implements IAwsS3Service { return false; } + /** Optional fields to allow for other providers */ + const endpoint = this.runtime.getSetting("AWS_S3_ENDPOINT"); + const sslEnabled = this.runtime.getSetting("AWS_S3_SSL_ENABLED"); + const forcePathStyle = this.runtime.getSetting("AWS_S3_FORCE_PATH_STYLE"); + this.s3Client = new S3Client({ + ...(endpoint ? { endpoint } : {}), + ...(sslEnabled ? { sslEnabled } : {}), + ...(forcePathStyle + ? { forcePathStyle: Boolean(forcePathStyle) } + : {}), region: AWS_REGION, credentials: { accessKeyId: AWS_ACCESS_KEY_ID, diff --git a/packages/plugin-solana-agentkit/src/index.ts b/packages/plugin-solana-agentkit/src/index.ts index ae80c66c744..2d1e3a43fae 100644 --- a/packages/plugin-solana-agentkit/src/index.ts +++ b/packages/plugin-solana-agentkit/src/index.ts @@ -1,7 +1,7 @@ import { Plugin } from "@elizaos/core"; import createToken from "./actions/createToken.ts"; -export const solanaAgentkitPlguin: Plugin = { +export const solanaAgentkitPlugin: Plugin = { name: "solana", description: "Solana Plugin with solana agent kit for Eliza", actions: [createToken], @@ -9,4 +9,4 @@ export const solanaAgentkitPlguin: Plugin = { providers: [], }; -export default solanaAgentkitPlguin; +export default solanaAgentkitPlugin; diff --git a/packages/plugin-solana/__tests__/actions/swap.test.ts b/packages/plugin-solana/__tests__/actions/swap.test.ts new file mode 100644 index 00000000000..f38f806c4e8 --- /dev/null +++ b/packages/plugin-solana/__tests__/actions/swap.test.ts @@ -0,0 +1,22 @@ +import { describe, it, expect, vi } from 'vitest'; + +describe('Swap Action', () => { + describe('validate', () => { + it('should handle swap message validation', async () => { + const mockMessage = { + content: 'Swap 1 SOL to USDC', + metadata: { + fromToken: 'SOL', + toToken: 'USDC', + amount: '1' + } + }; + + // Basic test to ensure message structure + expect(mockMessage.metadata).toBeDefined(); + expect(mockMessage.metadata.fromToken).toBe('SOL'); + expect(mockMessage.metadata.toToken).toBe('USDC'); + expect(mockMessage.metadata.amount).toBe('1'); + }); + }); +}); diff --git a/packages/plugin-solana/__tests__/evaluators/trust.test.ts b/packages/plugin-solana/__tests__/evaluators/trust.test.ts new file mode 100644 index 00000000000..ff7cb8b1343 --- /dev/null +++ b/packages/plugin-solana/__tests__/evaluators/trust.test.ts @@ -0,0 +1,55 @@ +import { describe, it, expect, vi } from 'vitest'; +import { trustEvaluator } from '../../src/evaluators/trust'; + +// Mock the core module +vi.mock('@elizaos/core', () => ({ + generateTrueOrFalse: vi.fn().mockResolvedValue(false), + ModelClass: { + SMALL: 'small' + }, + settings: { + MAIN_WALLET_ADDRESS: 'test-wallet-address' + }, + booleanFooter: 'Answer with Yes or No.', + elizaLogger: { + log: vi.fn(), + debug: vi.fn(), + info: vi.fn(), + error: vi.fn() + }, + composeContext: vi.fn().mockReturnValue({ + state: {}, + template: '' + }) +})); + +describe('Trust Evaluator', () => { + it('should handle non-trust messages', async () => { + const mockRuntime = { + getSetting: vi.fn(), + composeState: vi.fn().mockResolvedValue({ + agentId: 'test-agent', + roomId: 'test-room' + }), + getLogger: vi.fn().mockReturnValue({ + debug: vi.fn(), + info: vi.fn(), + log: vi.fn(), + error: vi.fn() + }) + }; + + const mockMessage = { + content: 'Hello world', + metadata: {} + }; + + const mockState = { + agentId: 'test-agent', + roomId: 'test-room' + }; + + const result = await trustEvaluator.handler(mockRuntime, mockMessage, mockState); + expect(result).toBeDefined(); + }); +}); diff --git a/packages/plugin-solana/__tests__/providers/token-security.test.ts b/packages/plugin-solana/__tests__/providers/token-security.test.ts new file mode 100644 index 00000000000..d350953092d --- /dev/null +++ b/packages/plugin-solana/__tests__/providers/token-security.test.ts @@ -0,0 +1,36 @@ +import { describe, it, expect, vi } from 'vitest'; +import { TokenProvider } from '../../src/providers/token'; +import { WalletProvider } from '../../src/providers/wallet'; +import { ICacheManager } from '@elizaos/core'; + +describe('Token Security', () => { + it('should handle empty security data gracefully', async () => { + const mockCacheManager = { + get: vi.fn().mockResolvedValue(null), + set: vi.fn(), + delete: vi.fn(), + clear: vi.fn(), + has: vi.fn(), + }; + + const mockWalletProvider = new WalletProvider(mockCacheManager); + const tokenProvider = new TokenProvider( + 'So11111111111111111111111111111111111111112', + mockWalletProvider, + mockCacheManager + ); + + global.fetch = vi.fn().mockResolvedValueOnce({ + ok: true, + json: () => Promise.resolve({ + success: true, + data: {} + }) + }); + + const result = await tokenProvider.fetchTokenSecurity(); + expect(result).toBeDefined(); + expect(result.ownerBalance).toBe(undefined); + expect(result.creatorBalance).toBe(undefined); + }); +}); diff --git a/packages/plugin-solana/src/tests/token.test.ts b/packages/plugin-solana/__tests__/token.test.ts similarity index 98% rename from packages/plugin-solana/src/tests/token.test.ts rename to packages/plugin-solana/__tests__/token.test.ts index 6b799c1c239..5d1a5e23451 100644 --- a/packages/plugin-solana/src/tests/token.test.ts +++ b/packages/plugin-solana/__tests__/token.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect, beforeEach, vi, afterEach } from "vitest"; -import { TokenProvider } from "../providers/token.ts"; +import { TokenProvider } from "../src/providers/token.ts"; // Mock NodeCache vi.mock("node-cache", () => { diff --git a/packages/plugin-squid-router/src/helpers/utils.ts b/packages/plugin-squid-router/src/helpers/utils.ts index 6909ca8382f..f8e69882d38 100644 --- a/packages/plugin-squid-router/src/helpers/utils.ts +++ b/packages/plugin-squid-router/src/helpers/utils.ts @@ -1,8 +1,6 @@ import { IAgentRuntime } from "@elizaos/core"; import { z } from 'zod'; import { ethers } from 'ethers'; -import { bech32 } from 'bech32'; -import bs58 from 'bs58'; import {SquidToken, XChainSwapContent} from "../types"; export function convertToWei(amount: string | number, token: SquidToken): string { @@ -55,32 +53,6 @@ const isValidEvmPrivateKey = (key: string): boolean => { return /^[0-9a-fA-F]{64}$/.test(cleanedKey); }; -const isValidSolanaAddress = (address: string): boolean => { - try { - const decoded = bs58.decode(address); - return decoded.length === 32; // Corrected from 32 || 44 to only 32 - } catch { - return false; - } -}; - -const isValidSolanaPrivateKey = (key: string): boolean => { - return /^[0-9a-fA-F]{64}$/.test(key); -}; - -const isValidCosmosAddress = (address: string): boolean => { - try { - const decoded = bech32.decode(address); - return decoded.prefix.startsWith('cosmos') && decoded.words.length === 52; - } catch { - return false; - } -}; - -const isValidCosmosPrivateKey = (key: string): boolean => { - return /^[0-9a-fA-F]{64}$/.test(key); -}; - export const squidRouterEnvSchema = z .object({ SQUID_INTEGRATOR_ID: z.string().min(1, "Squid Integrator ID is required"), diff --git a/packages/plugin-squid-router/src/providers/squidRouter.ts b/packages/plugin-squid-router/src/providers/squidRouter.ts index 5034b23f82d..c37f62c0520 100644 --- a/packages/plugin-squid-router/src/providers/squidRouter.ts +++ b/packages/plugin-squid-router/src/providers/squidRouter.ts @@ -109,7 +109,7 @@ const squidRouterProvider: Provider = { _state?: State ): Promise => { try { - const provider = initSquidRouterProvider(runtime); + /*const provider = */ initSquidRouterProvider(runtime); return "Squid Router provider setup successful." } catch (error) { console.error("Error in Squid Router provider:", error); diff --git a/packages/plugin-whatsapp/__tests__/handlers/message.handler.test.ts b/packages/plugin-whatsapp/__tests__/handlers/message.handler.test.ts index abbf0c8760b..1a8f61851b0 100644 --- a/packages/plugin-whatsapp/__tests__/handlers/message.handler.test.ts +++ b/packages/plugin-whatsapp/__tests__/handlers/message.handler.test.ts @@ -4,31 +4,31 @@ import { WhatsAppClient } from '../../src/client'; import { WhatsAppMessage } from '../../src/types'; describe('MessageHandler', () => { - let messageHandler: MessageHandler; - let mockClient: WhatsAppClient; + let messageHandler; + let mockClient; beforeEach(() => { mockClient = { sendMessage: vi.fn(), - } as any as WhatsAppClient; + }; messageHandler = new MessageHandler(mockClient); }); it('should successfully send a message', async () => { - const mockMessage: WhatsAppMessage = { + const mockMessage = { type: 'text', to: '1234567890', content: 'Test message' }; - const mockResponse = { + const mockResponse = { messaging_product: 'whatsapp', contacts: [{ input: '1234567890', wa_id: 'WHATSAPP_ID' }], messages: [{ id: 'MESSAGE_ID' }] }; - (mockClient.sendMessage as any).mockResolvedValue({ data: mockResponse }); + (mockClient.sendMessage).mockResolvedValue({ data: mockResponse }); const result = await messageHandler.send(mockMessage); @@ -37,14 +37,14 @@ describe('MessageHandler', () => { }); it('should handle client errors with error message', async () => { - const mockMessage: WhatsAppMessage = { + const mockMessage = { type: 'text', to: '1234567890', content: 'Test message' }; const errorMessage = 'API Error'; - (mockClient.sendMessage as any).mockRejectedValue(new Error(errorMessage)); + (mockClient.sendMessage).mockRejectedValue(new Error(errorMessage)); await expect(messageHandler.send(mockMessage)) .rejects @@ -52,13 +52,13 @@ describe('MessageHandler', () => { }); it('should handle unknown errors', async () => { - const mockMessage: WhatsAppMessage = { + const mockMessage = { type: 'text', to: '1234567890', content: 'Test message' }; - (mockClient.sendMessage as any).mockRejectedValue('Unknown error'); + (mockClient.sendMessage).mockRejectedValue('Unknown error'); await expect(messageHandler.send(mockMessage)) .rejects diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 34c0bf8294f..31a9456c047 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -21,6 +21,9 @@ importers: '@deepgram/sdk': specifier: ^3.9.0 version: 3.9.0(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@6.0.5) + '@injectivelabs/sdk-ts': + specifier: ^1.14.33 + version: 1.14.33(@types/react@19.0.7)(bufferutil@4.0.9)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(utf-8-validate@6.0.5) '@vitest/eslint-plugin': specifier: 1.0.1 version: 1.0.1(@typescript-eslint/utils@8.20.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.6.3))(eslint@9.16.0(jiti@2.4.2))(typescript@5.6.3)(vitest@2.1.5(@types/node@22.10.7)(jsdom@25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@6.0.5))(terser@5.37.0)) @@ -81,7 +84,7 @@ importers: version: 9.1.7 jest: specifier: ^29.7.0 - version: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0) + version: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)) lerna: specifier: 8.1.5 version: 8.1.5(@swc/core@1.10.7(@swc/helpers@0.5.15))(babel-plugin-macros@3.1.0)(encoding@0.1.13) @@ -169,6 +172,9 @@ importers: '@elizaos/plugin-abstract': specifier: workspace:* version: link:../packages/plugin-abstract + '@elizaos/plugin-agentkit': + specifier: workspace:* + version: link:../packages/plugin-agentkit '@elizaos/plugin-akash': specifier: workspace:* version: link:../packages/plugin-akash @@ -262,6 +268,9 @@ importers: '@elizaos/plugin-image-generation': specifier: workspace:* version: link:../packages/plugin-image-generation + '@elizaos/plugin-injective': + specifier: workspace:* + version: link:../packages/plugin-injective '@elizaos/plugin-intiface': specifier: workspace:* version: link:../packages/plugin-intiface @@ -376,13 +385,13 @@ importers: version: 29.5.14 jest: specifier: ^29.7.0 - version: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)) + version: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)) ts-jest: specifier: ^29.2.5 - version: 29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(esbuild@0.24.2)(jest@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)))(typescript@5.7.3) + version: 29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(esbuild@0.24.2)(jest@29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)))(typescript@5.7.3) ts-node: specifier: 10.9.2 - version: 10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3) + version: 10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3) tsup: specifier: 8.3.5 version: 8.3.5(@swc/core@1.10.7(@swc/helpers@0.5.15))(jiti@2.4.2)(postcss@8.5.1)(tsx@4.19.2)(typescript@5.7.3)(yaml@2.7.0) @@ -879,6 +888,9 @@ importers: tsup: specifier: 8.3.5 version: 8.3.5(@swc/core@1.10.7(@swc/helpers@0.5.15))(jiti@2.4.2)(postcss@8.5.1)(tsx@4.19.2)(typescript@5.7.3)(yaml@2.7.0) + vitest: + specifier: ^1.2.1 + version: 1.2.1(@types/node@22.10.7)(jsdom@25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@6.0.5))(terser@5.37.0) packages/client-instagram: dependencies: @@ -912,7 +924,7 @@ importers: version: link:../core '@lens-protocol/client': specifier: 2.2.0 - version: 2.2.0(@jest/globals@29.7.0)(@lens-protocol/metadata@1.2.0(zod@3.23.8))(bufferutil@4.0.9)(encoding@0.1.13)(ethers@6.13.4(bufferutil@4.0.9)(utf-8-validate@5.0.10))(utf-8-validate@5.0.10) + version: 2.2.0(@jest/globals@29.7.0)(@lens-protocol/metadata@1.2.0(zod@3.23.8))(@types/react@19.0.7)(bufferutil@4.0.9)(encoding@0.1.13)(ethers@6.13.4(bufferutil@4.0.9)(utf-8-validate@5.0.10))(react@19.0.0)(utf-8-validate@5.0.10) '@lens-protocol/metadata': specifier: 1.2.0 version: 1.2.0(zod@3.23.8) @@ -960,30 +972,21 @@ importers: '@types/fluent-ffmpeg': specifier: ^2.1.24 version: 2.1.27 - '@types/jest': - specifier: ^29.5.0 - version: 29.5.14 '@types/node': specifier: ^18.15.11 version: 18.19.71 - jest: - specifier: ^29.5.0 - version: 29.7.0(@types/node@18.19.71)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)) rimraf: specifier: ^5.0.0 version: 5.0.10 - ts-jest: - specifier: ^29.1.0 - version: 29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(jest@29.7.0(@types/node@18.19.71)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)))(typescript@5.6.3) - ts-node: - specifier: ^10.9.1 - version: 10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3) tsup: - specifier: ^8.3.5 - version: 8.3.5(@swc/core@1.10.7(@swc/helpers@0.5.15))(jiti@2.4.2)(postcss@8.5.1)(tsx@4.19.2)(typescript@5.6.3)(yaml@2.7.0) + specifier: ^6.7.0 + version: 6.7.0(@swc/core@1.10.7(@swc/helpers@0.5.15))(postcss@8.5.1)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3))(typescript@5.6.3) typescript: - specifier: ^5.0.0 + specifier: ^5.0.3 version: 5.6.3 + vitest: + specifier: ^1.2.1 + version: 1.2.1(@types/node@18.19.71)(jsdom@25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@6.0.5))(terser@5.37.0) packages/client-telegram: dependencies: @@ -1277,6 +1280,24 @@ importers: specifier: 7.1.0 version: 7.1.0 + packages/plugin-agentkit: + dependencies: + '@coinbase/cdp-agentkit-core': + specifier: ^0.0.10 + version: 0.0.10(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@6.0.5) + '@coinbase/cdp-langchain': + specifier: ^0.0.11 + version: 0.0.11(@coinbase/coinbase-sdk@0.13.0(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@6.0.5)(zod@3.23.8))(bufferutil@4.0.9)(openai@4.78.1(encoding@0.1.13)(zod@3.23.8))(typescript@5.7.3)(utf-8-validate@6.0.5) + '@elizaos/core': + specifier: workspace:* + version: link:../core + '@langchain/core': + specifier: ^0.3.27 + version: 0.3.30(openai@4.78.1(encoding@0.1.13)(zod@3.23.8)) + tsup: + specifier: 8.3.5 + version: 8.3.5(@swc/core@1.10.7(@swc/helpers@0.5.15))(jiti@2.4.2)(postcss@8.5.1)(tsx@4.19.2)(typescript@5.7.3)(yaml@2.7.0) + packages/plugin-akash: dependencies: '@akashnetwork/akash-api': @@ -2033,7 +2054,7 @@ importers: version: 29.5.14 jest: specifier: 29.7.0 - version: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0) + version: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)) tsup: specifier: 8.3.5 version: 8.3.5(@swc/core@1.10.7(@swc/helpers@0.5.15))(jiti@2.4.2)(postcss@8.5.1)(tsx@4.19.2)(typescript@5.6.3)(yaml@2.7.0) @@ -2053,6 +2074,58 @@ importers: specifier: 7.1.0 version: 7.1.0 + packages/plugin-injective: + dependencies: + '@elizaos/adapter-sqlite': + specifier: 0.1.7-alpha.2 + version: 0.1.7-alpha.2(@google-cloud/vertexai@1.9.2(encoding@0.1.13))(@langchain/core@0.3.30(openai@4.73.0(encoding@0.1.13)(zod@3.23.8)))(@langchain/groq@0.1.3(@langchain/core@0.3.30(openai@4.73.0(encoding@0.1.13)(zod@3.23.8)))(encoding@0.1.13))(axios@1.7.9)(encoding@0.1.13)(react@19.0.0)(sswr@2.1.0(svelte@5.18.0))(svelte@5.18.0)(whatwg-url@14.1.0) + '@elizaos/core': + specifier: workspace:* + version: link:../core + injective-sdk-client-ts: + specifier: file:../../packages/plugin-injective/injective-sdk-client-ts + version: '@injectivelabs/injective-sdk-client-ts@file:packages/plugin-injective/injective-sdk-client-ts(@types/react@19.0.7)(bufferutil@4.0.9)(google-protobuf@3.21.4)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(utf-8-validate@6.0.5)' + devDependencies: + '@types/chai': + specifier: ^5.0.1 + version: 5.0.1 + '@types/jest': + specifier: ^29.5.14 + version: 29.5.14 + '@types/node': + specifier: ^22.10.3 + version: 22.10.7 + '@types/sinon': + specifier: ^17.0.3 + version: 17.0.3 + '@typescript-eslint/eslint-plugin': + specifier: 8.16.0 + version: 8.16.0(@typescript-eslint/parser@8.16.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3))(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3) + '@typescript-eslint/parser': + specifier: 8.16.0 + version: 8.16.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3) + chai: + specifier: ^5.1.2 + version: 5.1.2 + eslint: + specifier: 9.16.0 + version: 9.16.0(jiti@2.4.2) + jest: + specifier: ^29.7.0 + version: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)) + prettier: + specifier: 3.4.1 + version: 3.4.1 + sinon: + specifier: ^19.0.2 + version: 19.0.2 + ts-jest: + specifier: ^29.2.5 + version: 29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(esbuild@0.24.2)(jest@29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)))(typescript@5.7.3) + typescript: + specifier: ^5.7.2 + version: 5.7.3 + packages/plugin-intiface: dependencies: '@elizaos/core': @@ -4493,9 +4566,20 @@ packages: '@coinbase-samples/advanced-sdk-ts@file:packages/plugin-coinbase/advanced-sdk-ts': resolution: {directory: packages/plugin-coinbase/advanced-sdk-ts, type: directory} + '@coinbase/cdp-agentkit-core@0.0.10': + resolution: {integrity: sha512-EFTaCkCd1445B4jq3LxVJaqw+r4BrwyjTAOoEabKrv9BycCPgS7fPRLuuugmnJRbSEtlG90NbsRZ7B6YkQRJ/g==} + + '@coinbase/cdp-langchain@0.0.11': + resolution: {integrity: sha512-RqnViEuhPHa0uTWTA08R6G7JIco8s4hPiX/ChbeXC0q4h+0cGATC1bJxIW73NMJXEZfLPitM0871UZPdnDXxuw==} + peerDependencies: + '@coinbase/coinbase-sdk': ^0.13.0 + '@coinbase/coinbase-sdk@0.10.0': resolution: {integrity: sha512-sqLH7dE/0XSn5jHddjVrC1PR77sQUEytYcQAlH2d8STqRARcvddxVAByECUIL32MpbdJY7Wca3KfSa6qo811Mg==} + '@coinbase/coinbase-sdk@0.13.0': + resolution: {integrity: sha512-qYOcFwTANhiJvSTF2sn53Hkycj2UebOIzieNOkg42qWD606gCudCBuzV3PDrOQYVJBS/g10hyX10u5yPkIZ89w==} + '@coinbase/wallet-sdk@4.2.4': resolution: {integrity: sha512-wJ9QOXOhRdGermKAoJSr4JgGqZm/Um0m+ecywzEC9qSOu3TXuVcG3k0XXTXW11UBgjdoPRuf5kAwRX3T9BynFA==} @@ -5343,6 +5427,14 @@ packages: '@electric-sql/pglite@0.2.15': resolution: {integrity: sha512-Jiq31Dnk+rg8rMhcSxs4lQvHTyizNo5b269c1gCC3ldQ0sCLrNVPGzy+KnmonKy1ZArTUuXZf23/UamzFMKVaA==} + '@elizaos/adapter-sqlite@0.1.7-alpha.2': + resolution: {integrity: sha512-T6G/Y6FRihIOS+hvY95nLRha1xQGj7omKlhfaC15ZixVZDRLufGeJ+IuN0ecNLLgnf2A7+y3mmFrs1/pQqWkZw==} + peerDependencies: + whatwg-url: 7.1.0 + + '@elizaos/core@0.1.7-alpha.2': + resolution: {integrity: sha512-gNvFw/Xnv4dlcfmmKxRa+baKq6en4TitAjUGvo8LgAUkSk156A0fffJ0lAsc1rX8zMB5NsIqdvMCbwKxDd54OQ==} + '@emnapi/core@1.3.1': resolution: {integrity: sha512-pVGjBIt1Y6gg3EJN8jTcfpP/+uuRksIo055oE/OBkDNcjZqVbfkWCksG1Jp4yZnj3iKWyWX8fdG/j6UDYPbFog==} @@ -5440,6 +5532,12 @@ packages: cpu: [ppc64] os: [aix] + '@esbuild/android-arm64@0.17.19': + resolution: {integrity: sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + '@esbuild/android-arm64@0.19.12': resolution: {integrity: sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==} engines: {node: '>=12'} @@ -5464,6 +5562,12 @@ packages: cpu: [arm64] os: [android] + '@esbuild/android-arm@0.17.19': + resolution: {integrity: sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + '@esbuild/android-arm@0.19.12': resolution: {integrity: sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==} engines: {node: '>=12'} @@ -5488,6 +5592,12 @@ packages: cpu: [arm] os: [android] + '@esbuild/android-x64@0.17.19': + resolution: {integrity: sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + '@esbuild/android-x64@0.19.12': resolution: {integrity: sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==} engines: {node: '>=12'} @@ -5512,6 +5622,12 @@ packages: cpu: [x64] os: [android] + '@esbuild/darwin-arm64@0.17.19': + resolution: {integrity: sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + '@esbuild/darwin-arm64@0.19.12': resolution: {integrity: sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==} engines: {node: '>=12'} @@ -5536,6 +5652,12 @@ packages: cpu: [arm64] os: [darwin] + '@esbuild/darwin-x64@0.17.19': + resolution: {integrity: sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + '@esbuild/darwin-x64@0.19.12': resolution: {integrity: sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==} engines: {node: '>=12'} @@ -5560,6 +5682,12 @@ packages: cpu: [x64] os: [darwin] + '@esbuild/freebsd-arm64@0.17.19': + resolution: {integrity: sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + '@esbuild/freebsd-arm64@0.19.12': resolution: {integrity: sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==} engines: {node: '>=12'} @@ -5584,6 +5712,12 @@ packages: cpu: [arm64] os: [freebsd] + '@esbuild/freebsd-x64@0.17.19': + resolution: {integrity: sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + '@esbuild/freebsd-x64@0.19.12': resolution: {integrity: sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==} engines: {node: '>=12'} @@ -5608,6 +5742,12 @@ packages: cpu: [x64] os: [freebsd] + '@esbuild/linux-arm64@0.17.19': + resolution: {integrity: sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + '@esbuild/linux-arm64@0.19.12': resolution: {integrity: sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==} engines: {node: '>=12'} @@ -5632,6 +5772,12 @@ packages: cpu: [arm64] os: [linux] + '@esbuild/linux-arm@0.17.19': + resolution: {integrity: sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + '@esbuild/linux-arm@0.19.12': resolution: {integrity: sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==} engines: {node: '>=12'} @@ -5656,6 +5802,12 @@ packages: cpu: [arm] os: [linux] + '@esbuild/linux-ia32@0.17.19': + resolution: {integrity: sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + '@esbuild/linux-ia32@0.19.12': resolution: {integrity: sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==} engines: {node: '>=12'} @@ -5680,6 +5832,12 @@ packages: cpu: [ia32] os: [linux] + '@esbuild/linux-loong64@0.17.19': + resolution: {integrity: sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + '@esbuild/linux-loong64@0.19.12': resolution: {integrity: sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==} engines: {node: '>=12'} @@ -5704,6 +5862,12 @@ packages: cpu: [loong64] os: [linux] + '@esbuild/linux-mips64el@0.17.19': + resolution: {integrity: sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + '@esbuild/linux-mips64el@0.19.12': resolution: {integrity: sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==} engines: {node: '>=12'} @@ -5728,6 +5892,12 @@ packages: cpu: [mips64el] os: [linux] + '@esbuild/linux-ppc64@0.17.19': + resolution: {integrity: sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + '@esbuild/linux-ppc64@0.19.12': resolution: {integrity: sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==} engines: {node: '>=12'} @@ -5752,6 +5922,12 @@ packages: cpu: [ppc64] os: [linux] + '@esbuild/linux-riscv64@0.17.19': + resolution: {integrity: sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + '@esbuild/linux-riscv64@0.19.12': resolution: {integrity: sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==} engines: {node: '>=12'} @@ -5776,6 +5952,12 @@ packages: cpu: [riscv64] os: [linux] + '@esbuild/linux-s390x@0.17.19': + resolution: {integrity: sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + '@esbuild/linux-s390x@0.19.12': resolution: {integrity: sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==} engines: {node: '>=12'} @@ -5800,6 +5982,12 @@ packages: cpu: [s390x] os: [linux] + '@esbuild/linux-x64@0.17.19': + resolution: {integrity: sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + '@esbuild/linux-x64@0.19.12': resolution: {integrity: sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==} engines: {node: '>=12'} @@ -5830,6 +6018,12 @@ packages: cpu: [arm64] os: [netbsd] + '@esbuild/netbsd-x64@0.17.19': + resolution: {integrity: sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + '@esbuild/netbsd-x64@0.19.12': resolution: {integrity: sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==} engines: {node: '>=12'} @@ -5866,6 +6060,12 @@ packages: cpu: [arm64] os: [openbsd] + '@esbuild/openbsd-x64@0.17.19': + resolution: {integrity: sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + '@esbuild/openbsd-x64@0.19.12': resolution: {integrity: sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==} engines: {node: '>=12'} @@ -5890,6 +6090,12 @@ packages: cpu: [x64] os: [openbsd] + '@esbuild/sunos-x64@0.17.19': + resolution: {integrity: sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + '@esbuild/sunos-x64@0.19.12': resolution: {integrity: sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==} engines: {node: '>=12'} @@ -5914,6 +6120,12 @@ packages: cpu: [x64] os: [sunos] + '@esbuild/win32-arm64@0.17.19': + resolution: {integrity: sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + '@esbuild/win32-arm64@0.19.12': resolution: {integrity: sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==} engines: {node: '>=12'} @@ -5938,6 +6150,12 @@ packages: cpu: [arm64] os: [win32] + '@esbuild/win32-ia32@0.17.19': + resolution: {integrity: sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + '@esbuild/win32-ia32@0.19.12': resolution: {integrity: sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==} engines: {node: '>=12'} @@ -5962,6 +6180,12 @@ packages: cpu: [ia32] os: [win32] + '@esbuild/win32-x64@0.17.19': + resolution: {integrity: sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + '@esbuild/win32-x64@0.19.12': resolution: {integrity: sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==} engines: {node: '>=12'} @@ -6547,12 +6771,18 @@ packages: '@injectivelabs/core-proto-ts@0.0.21': resolution: {integrity: sha512-RBxSkRBCty60R/l55/D1jsSW0Aof5dyGFhCFdN3A010KjMv/SzZGGr+6DZPY/hflyFeaJzDv/VTopCymKNRBvQ==} + '@injectivelabs/core-proto-ts@1.13.4': + resolution: {integrity: sha512-81+bwey0qzNgOzUASsxYghSahcWzH5l6bSceW8FdR7w42+Knp+bAgbg12sSyS1hiOO2kMXx6tBvmYkCmnghM1Q==} + '@injectivelabs/dmm-proto-ts@1.0.19': resolution: {integrity: sha512-2FCzCziy1RhzmnkAVIU+Asby/GXAVQqKt5/o1s52j0LJXfJMpiCrV6soLfnjTebj61T+1WvJBPFoZCCiVYBpcw==} '@injectivelabs/exceptions@1.14.33': resolution: {integrity: sha512-2c8YzLgwTOOsyc1WheqdM8jEfgGBhVrXN4cZ0jsikFVsLF619IDRn3hjIYqTeNERaEpeRPiuJGfZDu0DomwFrQ==} + '@injectivelabs/exceptions@1.14.34-beta.5': + resolution: {integrity: sha512-Tr6JYYp1WgJbr9QwuNrxM1xyeLRtZ9ah8jaIn37RBJzX00uxgAc46H5n2pSsr84G7R7c5gfEFfJ98o7X875dNQ==} + '@injectivelabs/grpc-web-node-http-transport@0.0.2': resolution: {integrity: sha512-rpyhXLiGY/UMs6v6YmgWHJHiO9l0AgDyVNv+jcutNVt4tQrmNvnpvz2wCAGOFtq5LuX/E9ChtTVpk3gWGqXcGA==} peerDependencies: @@ -6571,27 +6801,63 @@ packages: '@injectivelabs/indexer-proto-ts@1.11.32': resolution: {integrity: sha512-gCkbMlBq34MY2xZcauDEsCP0h5l/FgKMwCgJ8aWGaTkh27XBWpl1zvlreuWg/IpSvTPJZBoADW9KqixqyoBdJw==} + '@injectivelabs/indexer-proto-ts@1.13.3': + resolution: {integrity: sha512-rLesVPCARl+OC82vj063/pUawYu0ISty/2+xg6ya4Lwk6PDbXmtRvw8wpNP6K+pAsBOKaSkRnO4ThP5qbX+E6A==} + + '@injectivelabs/injective-sdk-client-ts@file:packages/plugin-injective/injective-sdk-client-ts': + resolution: {directory: packages/plugin-injective/injective-sdk-client-ts, type: directory} + '@injectivelabs/mito-proto-ts@1.0.55': resolution: {integrity: sha512-clFKpU/LCYvYiPg5PRjhVJFTxKcfJHzaj5saJHuL32LaOaB3Rd8L3CqP9qUrg78L7eKjjXjyG97U3NdRdZBlWg==} + '@injectivelabs/mito-proto-ts@1.13.0': + resolution: {integrity: sha512-DE9iK7PkEnkWAMTDJDH01R8jxkxVCNuurfVp/09Te9wY3dm3mRx9M6R756JywP2Sd/ggJl2UbavGAQe2pZ7v1w==} + '@injectivelabs/networks@1.14.33': resolution: {integrity: sha512-XDhAYwWYKdKBRfwO/MIfMyKjKRWz/AliMJG9yaM1C/cDlGHmA3EY7Au2Nf+PdkRhuxl2FzLV2Hp4uWeC0g8BYw==} + '@injectivelabs/networks@1.14.34-beta.2': + resolution: {integrity: sha512-OleogANWicpKUcGMdybfFvxOubXY9fvj5MKea49Q2XO8ErTicaUijsWHUWSdTrW+XQJwH5FXaKHX/1jS7UbRFQ==} + + '@injectivelabs/networks@1.14.34-beta.5': + resolution: {integrity: sha512-VCgDhWfgpP5nyEwKelTm1IZWCKXgonkRlaRSMOxifkjcut5q2rwjpGuM5X0s18UkW3iV44C4p9otPDZCGML0NQ==} + + '@injectivelabs/olp-proto-ts@1.13.1': + resolution: {integrity: sha512-dKxse7mZpmvRhm00Wn8Yy93EVEvFD7FPWeWFfxga0Patow3HK0D7k43VV7fE5kX9CDM1bxTatEVQ7WYGq4w0Eg==} + + '@injectivelabs/sdk-ts@1.14.33': + resolution: {integrity: sha512-qEuu6yzhy8t8rtviCBqV1VMR+JAaDSy59Eebd23i+1P5zqQ9X2lZLLLxz+gWjiglWb8uQYsoLN3TFh2509WNzQ==} + + '@injectivelabs/sdk-ts@1.14.34-beta.2': + resolution: {integrity: sha512-L5T/GCm+3b0CjRS5SSNpT4Rq9OgsbtcnH3xcB2V/I9a/u+6AssNiG3CiNRnqjeU74GqH5+M3y/tKIIS0bsnrRw==} + '@injectivelabs/sdk-ts@1.14.5': resolution: {integrity: sha512-j/6EcvNgQn563L0P5x80cZDTbYYbsXmHgtIbj8DCzemzgPRadmZLtlMDBjMQZ0ZcMhDSMfVOCINBOB2bBz2qMw==} '@injectivelabs/test-utils@1.14.33': resolution: {integrity: sha512-1SfIRsMnWcJAYNrrpY+ZUWmbD62lWWdIvD6c+FYmFKS14zU3yDIK9NXe9g1lTM/GdUVkVKQgGg2QAYZ5f2G/xA==} + '@injectivelabs/test-utils@1.14.34-beta.8': + resolution: {integrity: sha512-X63Uqo7aCMBBAcnaxoKyQROtl/n/353epDL0JHLj8Uk4FIWfhox3bTdZcHGtwwZabJMadPlQliHIe5WhGxA/hA==} + '@injectivelabs/token-metadata@1.14.11': resolution: {integrity: sha512-WKJlvjKiTRHxpOeez4kYrzIwgWmpspD1IMxWclkTysAcwGltUfUsvUhu1cKuACleIjFFWmiZv/HoGRFdvEAZ8w==} '@injectivelabs/ts-types@1.14.33': resolution: {integrity: sha512-sJZzMNJtZFFZoPKZ91G09bxrZqQ5aS9omoTjQWy+7OxfiRAakzhsarTueX47hm6oTaN0XeBgD3wkMukkWUaobw==} + '@injectivelabs/ts-types@1.14.34-beta.2': + resolution: {integrity: sha512-iK50g0TI71Q8lxjl8DLa2qCdypxaPqEHRM/LZt7+vYuazX+2SVuavV4V81Dt0vUcu39DC9yB46FVwcjniCl60Q==} + '@injectivelabs/utils@1.14.33': resolution: {integrity: sha512-zsezML4dTujF0xGLhcGmWBCghfJiy9MW+r6VqR8zJUlxnmnEdNpmsvBhBI6cmmov6Se4FL+yALAIFRvTm3txbg==} + '@injectivelabs/utils@1.14.34-beta.2': + resolution: {integrity: sha512-M1TCXZz4jr06zCZoFmoCLLyEuwQ1sObRAIngiUUf3R725oX0c1dpfWEqUmDR/U/MUvJI3Kna7wzyZ7NnBhU23A==} + + '@injectivelabs/utils@1.14.34-beta.5': + resolution: {integrity: sha512-x15HVMii1lwOVHUIgvgP0/QoRHNvMXHZSVswiQvcHDiy83IuUCZxc8/W0ELjKKfkIw66zM2pd0UBwJ0IMaJLzw==} + '@ioredis/commands@1.2.0': resolution: {integrity: sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg==} @@ -9102,6 +9368,15 @@ packages: '@sinonjs/fake-timers@10.3.0': resolution: {integrity: sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==} + '@sinonjs/fake-timers@13.0.5': + resolution: {integrity: sha512-36/hTbH2uaWuGVERyC6da9YwGWnzUZXuPro/F2LfsdOsLnCojz/iSH8MxUt/FD2S5XBSVPhmArFUXcpCQ2Hkiw==} + + '@sinonjs/samsam@8.0.2': + resolution: {integrity: sha512-v46t/fwnhejRSFTGqbpn9u+LQ9xJDse10gNnPgAcxgdoCDMXj/G2asWAC/8Qs+BAZDicX+MNZouXT1A7c83kVw==} + + '@sinonjs/text-encoding@0.7.3': + resolution: {integrity: sha512-DE427ROAphMQzU4ENbliGYrBSYPXF+TtLg9S8vzeA+OF4ZKzoDdzfL8sxuMUGS/lgRhM6j1URSk9ghf7Xo1tyA==} + '@skip-go/client@0.16.4': resolution: {integrity: sha512-/E5sDH7LLLHWB+xn4GLubV/g87HZINJ5fadC3RKYbct5hsjwGHcL3BYE12RJZZ0Sxv+VshihkB89Xlta1mo7MQ==} peerDependencies: @@ -9967,6 +10242,9 @@ packages: '@types/chai@4.3.20': resolution: {integrity: sha512-/pC9HAB5I/xMlc5FP77qjCnI16ChlJfW0tGa0IUcFn38VJrTV6DeZ60NU5KZBtaOZqjdpwTWohz5HU1RrhiYxQ==} + '@types/chai@5.0.1': + resolution: {integrity: sha512-5T8ajsg3M/FOncpLYW7sdOcD6yf4+722sze/tc4KQV0P8Z2rAr3SAuHCIkYmYpt8VbcQlnz8SxlOlPQYefe4cA==} + '@types/chance@1.1.6': resolution: {integrity: sha512-V+pm3stv1Mvz8fSKJJod6CglNGVqEQ6OyuqitoDkWywEODM/eJd1eSuIp9xt6DrX8BWZ2eDSIzbw1tPCUTvGbQ==} @@ -10081,6 +10359,9 @@ packages: '@types/debug@4.1.12': resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==} + '@types/deep-eql@4.0.2': + resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + '@types/diff-match-patch@1.0.36': resolution: {integrity: sha512-xFdR6tkm0MWvBfO8xXCSsinYxHcqkQUlcHeSpMC2ukzOb6lwQAfDmW+Qt0AvlGd8HpsS28qKsB+oPeJn9I39jg==} @@ -10370,6 +10651,12 @@ packages: resolution: {integrity: sha512-OOi3kL+FZDnPhVzsfD37J88FNeZh6gQsGcLc95NbeURRGvmSjeXiDcyWzF2o3yh/gQAUn2uhh/e+CPCa5nwAxw==} deprecated: This is a stub types definition. sharp provides its own type definitions, so you do not need this installed. + '@types/sinon@17.0.3': + resolution: {integrity: sha512-j3uovdn8ewky9kRBG19bOwaZbexJu/XjtkHyjvUgt4xfPFz18dcORIMqnYh66Fx3Powhcr85NT5+er3+oViapw==} + + '@types/sinonjs__fake-timers@8.1.5': + resolution: {integrity: sha512-mQkU2jY8jJEF7YHjHvsQO8+3ughTL1mcnn96igfhONmR+fUPSKIkefQYpSe8bsly2Ep7oQbn/6VG5/9/0qcArQ==} + '@types/sockjs@0.3.36': resolution: {integrity: sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q==} @@ -12005,6 +12292,12 @@ packages: builtin-status-codes@3.0.0: resolution: {integrity: sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==} + bundle-require@4.2.1: + resolution: {integrity: sha512-7Q/6vkyYAwOmQNRw75x+4yRtZCZJXUDmHHlFdkiV0wgv/reNjtJwpu1jPJ0w2kbEpIM0uoKI3S4/f39dU7AjSA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + peerDependencies: + esbuild: '>=0.17' + bundle-require@5.1.0: resolution: {integrity: sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -13485,6 +13778,10 @@ packages: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} + diff@7.0.0: + resolution: {integrity: sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==} + engines: {node: '>=0.3.1'} + diffie-hellman@5.0.3: resolution: {integrity: sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==} @@ -13836,6 +14133,11 @@ packages: peerDependencies: esbuild: '*' + esbuild@0.17.19: + resolution: {integrity: sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==} + engines: {node: '>=12'} + hasBin: true + esbuild@0.19.12: resolution: {integrity: sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==} engines: {node: '>=12'} @@ -16292,6 +16594,9 @@ packages: just-diff@6.0.2: resolution: {integrity: sha512-S59eriX5u3/QhMNq3v/gm8Kd0w8OS6Tz2FS1NG4blv+z0MuQcBRJyFWjdovM0Rad4/P4aUPFtnkNjMjyMlMSYA==} + just-extend@6.2.0: + resolution: {integrity: sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==} + jwa@1.4.1: resolution: {integrity: sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==} @@ -16553,6 +16858,10 @@ packages: lifecycle-utils@1.7.3: resolution: {integrity: sha512-T7zs7J6/sgsqwVyG34Sfo5LTQmlPmmqaUe3yBhdF8nq24RtR/HtbkNZRhNbr9BEaKySdSgH+P9H5U9X+p0WjXw==} + lilconfig@2.1.0: + resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==} + engines: {node: '>=10'} + lilconfig@3.1.3: resolution: {integrity: sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==} engines: {node: '>=14'} @@ -16671,6 +16980,9 @@ packages: lodash.defaults@4.2.0: resolution: {integrity: sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==} + lodash.get@4.4.2: + resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==} + lodash.includes@4.3.0: resolution: {integrity: sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==} @@ -17581,6 +17893,9 @@ packages: next-tick@1.1.0: resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==} + nise@6.1.1: + resolution: {integrity: sha512-aMSAzLVY7LyeM60gvBS423nBmIPP+Wy7St7hsb+8/fc1HmeoHJfLO8CKse4u3BtOZvQLJghYPI2i/1WZrEj5/g==} + no-case@3.0.4: resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} @@ -18300,6 +18615,10 @@ packages: path-to-regexp@3.3.0: resolution: {integrity: sha512-qyCH421YQPS2WFDxDjftfc1ZR5WKQzVzqsp4n9M2kQhVOo/ByahFoUNJfl58kOcEGfQ//7weFTDhm+ss8Ecxgw==} + path-to-regexp@8.2.0: + resolution: {integrity: sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==} + engines: {node: '>=16'} + path-type@3.0.0: resolution: {integrity: sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==} engines: {node: '>=4'} @@ -18747,6 +19066,18 @@ packages: peerDependencies: postcss: ^8.4 + postcss-load-config@3.1.4: + resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==} + engines: {node: '>= 10'} + peerDependencies: + postcss: '>=8.0.9' + ts-node: '>=9.0.0' + peerDependenciesMeta: + postcss: + optional: true + ts-node: + optional: true + postcss-load-config@4.0.2: resolution: {integrity: sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==} engines: {node: '>= 14'} @@ -20470,6 +20801,9 @@ packages: resolution: {integrity: sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==} engines: {node: '>=10'} + sinon@19.0.2: + resolution: {integrity: sha512-euuToqM+PjO4UgXeLETsfQiuoyPXlqFezr6YZDFwHR3t4qaX0fZUe1MfPMznTL5f8BWrVS89KduLdMUsxFCO6g==} + sirv@2.0.4: resolution: {integrity: sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==} engines: {node: '>= 10'} @@ -21549,6 +21883,22 @@ packages: resolution: {integrity: sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==} engines: {node: '>=0.6.x'} + tsup@6.7.0: + resolution: {integrity: sha512-L3o8hGkaHnu5TdJns+mCqFsDBo83bJ44rlK7e6VdanIvpea4ArPcU3swWGsLVbXak1PqQx/V+SSmFPujBK+zEQ==} + engines: {node: '>=14.18'} + hasBin: true + peerDependencies: + '@swc/core': ^1 + postcss: ^8.4.12 + typescript: '>=4.1.0' + peerDependenciesMeta: + '@swc/core': + optional: true + postcss: + optional: true + typescript: + optional: true + tsup@8.3.5: resolution: {integrity: sha512-Tunf6r6m6tnZsG9GYWndg0z8dEV7fD733VBFzFJ5Vcm1FtlXB8xBD/rtrBi2a3YKEV7hHtxiZtW5EAVADoe1pA==} engines: {node: '>=18'} @@ -25393,6 +25743,31 @@ snapshots: transitivePeerDependencies: - encoding + '@coinbase/cdp-agentkit-core@0.0.10(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@6.0.5)': + dependencies: + '@coinbase/coinbase-sdk': 0.13.0(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@6.0.5)(zod@3.23.8) + twitter-api-v2: 1.19.0 + viem: 2.21.58(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@6.0.5)(zod@3.23.8) + zod: 3.23.8 + transitivePeerDependencies: + - bufferutil + - debug + - typescript + - utf-8-validate + + '@coinbase/cdp-langchain@0.0.11(@coinbase/coinbase-sdk@0.13.0(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@6.0.5)(zod@3.23.8))(bufferutil@4.0.9)(openai@4.78.1(encoding@0.1.13)(zod@3.23.8))(typescript@5.7.3)(utf-8-validate@6.0.5)': + dependencies: + '@coinbase/cdp-agentkit-core': 0.0.10(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@6.0.5) + '@coinbase/coinbase-sdk': 0.13.0(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@6.0.5)(zod@3.23.8) + '@langchain/core': 0.3.30(openai@4.78.1(encoding@0.1.13)(zod@3.23.8)) + zod: 3.23.8 + transitivePeerDependencies: + - bufferutil + - debug + - openai + - typescript + - utf-8-validate + '@coinbase/coinbase-sdk@0.10.0(bufferutil@4.0.9)(typescript@5.6.3)(utf-8-validate@6.0.5)(zod@3.24.1)': dependencies: '@scure/bip32': 1.6.1 @@ -25415,6 +25790,28 @@ snapshots: - utf-8-validate - zod + '@coinbase/coinbase-sdk@0.13.0(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@6.0.5)(zod@3.23.8)': + dependencies: + '@scure/bip32': 1.6.1 + abitype: 1.0.8(typescript@5.7.3)(zod@3.23.8) + axios: 1.7.9(debug@4.4.0) + axios-mock-adapter: 1.22.0(axios@1.7.9) + axios-retry: 4.5.0(axios@1.7.9) + bip32: 4.0.0 + bip39: 3.1.0 + decimal.js: 10.4.3 + dotenv: 16.4.7 + ethers: 6.13.4(bufferutil@4.0.9)(utf-8-validate@6.0.5) + node-jose: 2.2.0 + secp256k1: 5.0.1 + viem: 2.21.58(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@6.0.5)(zod@3.23.8) + transitivePeerDependencies: + - bufferutil + - debug + - typescript + - utf-8-validate + - zod + '@coinbase/wallet-sdk@4.2.4': dependencies: '@noble/hashes': 1.6.1 @@ -25873,6 +26270,16 @@ snapshots: - bufferutil - utf-8-validate + '@cosmjs/socket@0.32.4(bufferutil@4.0.9)(utf-8-validate@6.0.5)': + dependencies: + '@cosmjs/stream': 0.32.4 + isomorphic-ws: 4.0.1(ws@7.5.10(bufferutil@4.0.9)(utf-8-validate@6.0.5)) + ws: 7.5.10(bufferutil@4.0.9)(utf-8-validate@6.0.5) + xstream: 11.14.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + '@cosmjs/stargate@0.31.0-alpha.1(bufferutil@4.0.9)(utf-8-validate@5.0.10)': dependencies: '@confio/ics23': 0.6.8 @@ -25945,6 +26352,23 @@ snapshots: - debug - utf-8-validate + '@cosmjs/stargate@0.32.4(bufferutil@4.0.9)(utf-8-validate@6.0.5)': + dependencies: + '@confio/ics23': 0.6.8 + '@cosmjs/amino': 0.32.4 + '@cosmjs/encoding': 0.32.4 + '@cosmjs/math': 0.32.4 + '@cosmjs/proto-signing': 0.32.4 + '@cosmjs/stream': 0.32.4 + '@cosmjs/tendermint-rpc': 0.32.4(bufferutil@4.0.9)(utf-8-validate@6.0.5) + '@cosmjs/utils': 0.32.4 + cosmjs-types: 0.9.0 + xstream: 11.14.0 + transitivePeerDependencies: + - bufferutil + - debug + - utf-8-validate + '@cosmjs/stream@0.30.1': dependencies: xstream: 11.14.0 @@ -26008,6 +26432,23 @@ snapshots: - debug - utf-8-validate + '@cosmjs/tendermint-rpc@0.32.4(bufferutil@4.0.9)(utf-8-validate@6.0.5)': + dependencies: + '@cosmjs/crypto': 0.32.4 + '@cosmjs/encoding': 0.32.4 + '@cosmjs/json-rpc': 0.32.4 + '@cosmjs/math': 0.32.4 + '@cosmjs/socket': 0.32.4(bufferutil@4.0.9)(utf-8-validate@6.0.5) + '@cosmjs/stream': 0.32.4 + '@cosmjs/utils': 0.32.4 + axios: 1.7.9(debug@4.4.0) + readonly-date: 1.0.0 + xstream: 11.14.0 + transitivePeerDependencies: + - bufferutil + - debug + - utf-8-validate + '@cosmjs/utils@0.27.1': {} '@cosmjs/utils@0.31.3': {} @@ -27325,6 +27766,86 @@ snapshots: '@electric-sql/pglite@0.2.15': {} + '@elizaos/adapter-sqlite@0.1.7-alpha.2(@google-cloud/vertexai@1.9.2(encoding@0.1.13))(@langchain/core@0.3.30(openai@4.73.0(encoding@0.1.13)(zod@3.23.8)))(@langchain/groq@0.1.3(@langchain/core@0.3.30(openai@4.73.0(encoding@0.1.13)(zod@3.23.8)))(encoding@0.1.13))(axios@1.7.9)(encoding@0.1.13)(react@19.0.0)(sswr@2.1.0(svelte@5.18.0))(svelte@5.18.0)(whatwg-url@14.1.0)': + dependencies: + '@elizaos/core': 0.1.7-alpha.2(@google-cloud/vertexai@1.9.2(encoding@0.1.13))(@langchain/core@0.3.30(openai@4.73.0(encoding@0.1.13)(zod@3.23.8)))(@langchain/groq@0.1.3(@langchain/core@0.3.30(openai@4.73.0(encoding@0.1.13)(zod@3.23.8)))(encoding@0.1.13))(axios@1.7.9)(encoding@0.1.13)(react@19.0.0)(sswr@2.1.0(svelte@5.18.0))(svelte@5.18.0) + '@types/better-sqlite3': 7.6.12 + better-sqlite3: 11.6.0 + sqlite-vec: 0.1.6 + whatwg-url: 14.1.0 + transitivePeerDependencies: + - '@google-cloud/vertexai' + - '@langchain/anthropic' + - '@langchain/aws' + - '@langchain/cohere' + - '@langchain/core' + - '@langchain/google-genai' + - '@langchain/google-vertexai' + - '@langchain/groq' + - '@langchain/mistralai' + - '@langchain/ollama' + - axios + - cheerio + - encoding + - peggy + - react + - solid-js + - sswr + - supports-color + - svelte + - typeorm + - vue + + '@elizaos/core@0.1.7-alpha.2(@google-cloud/vertexai@1.9.2(encoding@0.1.13))(@langchain/core@0.3.30(openai@4.73.0(encoding@0.1.13)(zod@3.23.8)))(@langchain/groq@0.1.3(@langchain/core@0.3.30(openai@4.73.0(encoding@0.1.13)(zod@3.23.8)))(encoding@0.1.13))(axios@1.7.9)(encoding@0.1.13)(react@19.0.0)(sswr@2.1.0(svelte@5.18.0))(svelte@5.18.0)': + dependencies: + '@ai-sdk/anthropic': 0.0.56(zod@3.23.8) + '@ai-sdk/google': 0.0.55(zod@3.23.8) + '@ai-sdk/google-vertex': 0.0.43(@google-cloud/vertexai@1.9.2(encoding@0.1.13))(zod@3.23.8) + '@ai-sdk/groq': 0.0.3(zod@3.23.8) + '@ai-sdk/openai': 1.0.5(zod@3.23.8) + '@anthropic-ai/sdk': 0.30.1(encoding@0.1.13) + '@fal-ai/client': 1.2.0 + '@types/uuid': 10.0.0 + ai: 3.4.33(openai@4.73.0(encoding@0.1.13)(zod@3.23.8))(react@19.0.0)(sswr@2.1.0(svelte@5.18.0))(svelte@5.18.0)(vue@3.5.13(typescript@5.6.3))(zod@3.23.8) + anthropic-vertex-ai: 1.0.2(encoding@0.1.13)(zod@3.23.8) + fastembed: 1.14.1 + fastestsmallesttextencoderdecoder: 1.0.22 + gaxios: 6.7.1(encoding@0.1.13) + glob: 11.0.0 + handlebars: 4.7.8 + js-sha1: 0.7.0 + js-tiktoken: 1.0.15 + langchain: 0.3.6(@langchain/core@0.3.30(openai@4.73.0(encoding@0.1.13)(zod@3.23.8)))(@langchain/groq@0.1.3(@langchain/core@0.3.30(openai@4.73.0(encoding@0.1.13)(zod@3.23.8)))(encoding@0.1.13))(axios@1.7.9)(encoding@0.1.13)(handlebars@4.7.8)(openai@4.73.0(encoding@0.1.13)(zod@3.23.8)) + ollama-ai-provider: 0.16.1(zod@3.23.8) + openai: 4.73.0(encoding@0.1.13)(zod@3.23.8) + tinyld: 1.3.4 + together-ai: 0.7.0(encoding@0.1.13) + unique-names-generator: 4.7.1 + uuid: 11.0.3 + zod: 3.23.8 + transitivePeerDependencies: + - '@google-cloud/vertexai' + - '@langchain/anthropic' + - '@langchain/aws' + - '@langchain/cohere' + - '@langchain/core' + - '@langchain/google-genai' + - '@langchain/google-vertexai' + - '@langchain/groq' + - '@langchain/mistralai' + - '@langchain/ollama' + - axios + - cheerio + - encoding + - peggy + - react + - solid-js + - sswr + - supports-color + - svelte + - typeorm + - vue + '@emnapi/core@1.3.1': dependencies: '@emnapi/wasi-threads': 1.0.1 @@ -27443,6 +27964,9 @@ snapshots: '@esbuild/aix-ppc64@0.24.2': optional: true + '@esbuild/android-arm64@0.17.19': + optional: true + '@esbuild/android-arm64@0.19.12': optional: true @@ -27455,6 +27979,9 @@ snapshots: '@esbuild/android-arm64@0.24.2': optional: true + '@esbuild/android-arm@0.17.19': + optional: true + '@esbuild/android-arm@0.19.12': optional: true @@ -27467,6 +27994,9 @@ snapshots: '@esbuild/android-arm@0.24.2': optional: true + '@esbuild/android-x64@0.17.19': + optional: true + '@esbuild/android-x64@0.19.12': optional: true @@ -27479,6 +28009,9 @@ snapshots: '@esbuild/android-x64@0.24.2': optional: true + '@esbuild/darwin-arm64@0.17.19': + optional: true + '@esbuild/darwin-arm64@0.19.12': optional: true @@ -27491,6 +28024,9 @@ snapshots: '@esbuild/darwin-arm64@0.24.2': optional: true + '@esbuild/darwin-x64@0.17.19': + optional: true + '@esbuild/darwin-x64@0.19.12': optional: true @@ -27503,6 +28039,9 @@ snapshots: '@esbuild/darwin-x64@0.24.2': optional: true + '@esbuild/freebsd-arm64@0.17.19': + optional: true + '@esbuild/freebsd-arm64@0.19.12': optional: true @@ -27515,6 +28054,9 @@ snapshots: '@esbuild/freebsd-arm64@0.24.2': optional: true + '@esbuild/freebsd-x64@0.17.19': + optional: true + '@esbuild/freebsd-x64@0.19.12': optional: true @@ -27527,6 +28069,9 @@ snapshots: '@esbuild/freebsd-x64@0.24.2': optional: true + '@esbuild/linux-arm64@0.17.19': + optional: true + '@esbuild/linux-arm64@0.19.12': optional: true @@ -27539,6 +28084,9 @@ snapshots: '@esbuild/linux-arm64@0.24.2': optional: true + '@esbuild/linux-arm@0.17.19': + optional: true + '@esbuild/linux-arm@0.19.12': optional: true @@ -27551,6 +28099,9 @@ snapshots: '@esbuild/linux-arm@0.24.2': optional: true + '@esbuild/linux-ia32@0.17.19': + optional: true + '@esbuild/linux-ia32@0.19.12': optional: true @@ -27563,6 +28114,9 @@ snapshots: '@esbuild/linux-ia32@0.24.2': optional: true + '@esbuild/linux-loong64@0.17.19': + optional: true + '@esbuild/linux-loong64@0.19.12': optional: true @@ -27575,6 +28129,9 @@ snapshots: '@esbuild/linux-loong64@0.24.2': optional: true + '@esbuild/linux-mips64el@0.17.19': + optional: true + '@esbuild/linux-mips64el@0.19.12': optional: true @@ -27587,6 +28144,9 @@ snapshots: '@esbuild/linux-mips64el@0.24.2': optional: true + '@esbuild/linux-ppc64@0.17.19': + optional: true + '@esbuild/linux-ppc64@0.19.12': optional: true @@ -27599,6 +28159,9 @@ snapshots: '@esbuild/linux-ppc64@0.24.2': optional: true + '@esbuild/linux-riscv64@0.17.19': + optional: true + '@esbuild/linux-riscv64@0.19.12': optional: true @@ -27611,6 +28174,9 @@ snapshots: '@esbuild/linux-riscv64@0.24.2': optional: true + '@esbuild/linux-s390x@0.17.19': + optional: true + '@esbuild/linux-s390x@0.19.12': optional: true @@ -27623,6 +28189,9 @@ snapshots: '@esbuild/linux-s390x@0.24.2': optional: true + '@esbuild/linux-x64@0.17.19': + optional: true + '@esbuild/linux-x64@0.19.12': optional: true @@ -27638,6 +28207,9 @@ snapshots: '@esbuild/netbsd-arm64@0.24.2': optional: true + '@esbuild/netbsd-x64@0.17.19': + optional: true + '@esbuild/netbsd-x64@0.19.12': optional: true @@ -27656,6 +28228,9 @@ snapshots: '@esbuild/openbsd-arm64@0.24.2': optional: true + '@esbuild/openbsd-x64@0.17.19': + optional: true + '@esbuild/openbsd-x64@0.19.12': optional: true @@ -27668,6 +28243,9 @@ snapshots: '@esbuild/openbsd-x64@0.24.2': optional: true + '@esbuild/sunos-x64@0.17.19': + optional: true + '@esbuild/sunos-x64@0.19.12': optional: true @@ -27680,6 +28258,9 @@ snapshots: '@esbuild/sunos-x64@0.24.2': optional: true + '@esbuild/win32-arm64@0.17.19': + optional: true + '@esbuild/win32-arm64@0.19.12': optional: true @@ -27692,6 +28273,9 @@ snapshots: '@esbuild/win32-arm64@0.24.2': optional: true + '@esbuild/win32-ia32@0.17.19': + optional: true + '@esbuild/win32-ia32@0.19.12': optional: true @@ -27704,6 +28288,9 @@ snapshots: '@esbuild/win32-ia32@0.24.2': optional: true + '@esbuild/win32-x64@0.17.19': + optional: true + '@esbuild/win32-x64@0.19.12': optional: true @@ -28601,6 +29188,13 @@ snapshots: protobufjs: 7.4.0 rxjs: 7.8.1 + '@injectivelabs/core-proto-ts@1.13.4': + dependencies: + '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.4) + google-protobuf: 3.21.4 + protobufjs: 7.4.0 + rxjs: 7.8.1 + '@injectivelabs/dmm-proto-ts@1.0.19': dependencies: '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.4) @@ -28617,6 +29211,15 @@ snapshots: transitivePeerDependencies: - google-protobuf + '@injectivelabs/exceptions@1.14.34-beta.5(google-protobuf@3.21.4)': + dependencies: + '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.4) + '@injectivelabs/ts-types': 1.14.34-beta.2 + http-status-codes: 2.3.0 + shx: 0.3.4 + transitivePeerDependencies: + - google-protobuf + '@injectivelabs/grpc-web-node-http-transport@0.0.2(@injectivelabs/grpc-web@0.0.1(google-protobuf@3.21.4))': dependencies: '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.4) @@ -28637,6 +29240,32 @@ snapshots: protobufjs: 7.4.0 rxjs: 7.8.1 + '@injectivelabs/indexer-proto-ts@1.13.3': + dependencies: + '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.4) + google-protobuf: 3.21.4 + protobufjs: 7.4.0 + rxjs: 7.8.1 + + '@injectivelabs/injective-sdk-client-ts@file:packages/plugin-injective/injective-sdk-client-ts(@types/react@19.0.7)(bufferutil@4.0.9)(google-protobuf@3.21.4)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(utf-8-validate@6.0.5)': + dependencies: + '@injectivelabs/networks': 1.14.34-beta.2(google-protobuf@3.21.4) + '@injectivelabs/sdk-ts': 1.14.34-beta.2(@types/react@19.0.7)(bufferutil@4.0.9)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(utf-8-validate@6.0.5) + '@injectivelabs/token-metadata': 1.14.11(google-protobuf@3.21.4) + '@injectivelabs/ts-types': 1.14.34-beta.2 + '@injectivelabs/utils': 1.14.34-beta.2(google-protobuf@3.21.4) + bignumber.js: 9.1.2 + transitivePeerDependencies: + - '@types/react' + - bufferutil + - debug + - google-protobuf + - graphql-ws + - react + - react-dom + - subscriptions-transport-ws + - utf-8-validate + '@injectivelabs/mito-proto-ts@1.0.55': dependencies: '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.4) @@ -28644,6 +29273,13 @@ snapshots: protobufjs: 7.4.0 rxjs: 7.8.1 + '@injectivelabs/mito-proto-ts@1.13.0': + dependencies: + '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.4) + google-protobuf: 3.21.4 + protobufjs: 7.4.0 + rxjs: 7.8.1 + '@injectivelabs/networks@1.14.33(google-protobuf@3.21.4)': dependencies: '@injectivelabs/exceptions': 1.14.33(google-protobuf@3.21.4) @@ -28654,6 +29290,125 @@ snapshots: - debug - google-protobuf + '@injectivelabs/networks@1.14.34-beta.2(google-protobuf@3.21.4)': + dependencies: + '@injectivelabs/exceptions': 1.14.34-beta.5(google-protobuf@3.21.4) + '@injectivelabs/ts-types': 1.14.34-beta.2 + '@injectivelabs/utils': 1.14.34-beta.2(google-protobuf@3.21.4) + shx: 0.3.4 + transitivePeerDependencies: + - debug + - google-protobuf + + '@injectivelabs/networks@1.14.34-beta.5(google-protobuf@3.21.4)': + dependencies: + '@injectivelabs/exceptions': 1.14.34-beta.5(google-protobuf@3.21.4) + '@injectivelabs/ts-types': 1.14.34-beta.2 + '@injectivelabs/utils': 1.14.34-beta.5(google-protobuf@3.21.4) + shx: 0.3.4 + transitivePeerDependencies: + - debug + - google-protobuf + + '@injectivelabs/olp-proto-ts@1.13.1': + dependencies: + '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.4) + google-protobuf: 3.21.4 + protobufjs: 7.4.0 + rxjs: 7.8.1 + + '@injectivelabs/sdk-ts@1.14.33(@types/react@19.0.7)(bufferutil@4.0.9)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(utf-8-validate@6.0.5)': + dependencies: + '@apollo/client': 3.12.6(@types/react@19.0.7)(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@cosmjs/amino': 0.32.4 + '@cosmjs/proto-signing': 0.32.4 + '@cosmjs/stargate': 0.32.4(bufferutil@4.0.9)(utf-8-validate@6.0.5) + '@ethersproject/bytes': 5.7.0 + '@injectivelabs/core-proto-ts': 1.13.4 + '@injectivelabs/exceptions': 1.14.33(google-protobuf@3.21.4) + '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.4) + '@injectivelabs/grpc-web-node-http-transport': 0.0.2(@injectivelabs/grpc-web@0.0.1(google-protobuf@3.21.4)) + '@injectivelabs/grpc-web-react-native-transport': 0.0.2(@injectivelabs/grpc-web@0.0.1(google-protobuf@3.21.4)) + '@injectivelabs/indexer-proto-ts': 1.13.3 + '@injectivelabs/mito-proto-ts': 1.13.0 + '@injectivelabs/networks': 1.14.33(google-protobuf@3.21.4) + '@injectivelabs/olp-proto-ts': 1.13.1 + '@injectivelabs/test-utils': 1.14.33(google-protobuf@3.21.4) + '@injectivelabs/ts-types': 1.14.33 + '@injectivelabs/utils': 1.14.33(google-protobuf@3.21.4) + '@metamask/eth-sig-util': 4.0.1 + '@noble/curves': 1.8.0 + axios: 1.7.9(debug@4.4.0) + bech32: 2.0.0 + bip39: 3.1.0 + cosmjs-types: 0.9.0 + ethereumjs-util: 7.1.5 + ethers: 6.13.4(bufferutil@4.0.9)(utf-8-validate@6.0.5) + google-protobuf: 3.21.4 + graphql: 16.10.0 + http-status-codes: 2.3.0 + js-sha3: 0.8.0 + jscrypto: 1.0.3 + keccak256: 1.0.6 + secp256k1: 4.0.4 + shx: 0.3.4 + snakecase-keys: 5.5.0 + transitivePeerDependencies: + - '@types/react' + - bufferutil + - debug + - graphql-ws + - react + - react-dom + - subscriptions-transport-ws + - utf-8-validate + + '@injectivelabs/sdk-ts@1.14.34-beta.2(@types/react@19.0.7)(bufferutil@4.0.9)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(utf-8-validate@6.0.5)': + dependencies: + '@apollo/client': 3.12.6(@types/react@19.0.7)(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@cosmjs/amino': 0.32.4 + '@cosmjs/proto-signing': 0.32.4 + '@cosmjs/stargate': 0.32.4(bufferutil@4.0.9)(utf-8-validate@6.0.5) + '@ethersproject/bytes': 5.7.0 + '@injectivelabs/core-proto-ts': 1.13.4 + '@injectivelabs/exceptions': 1.14.33(google-protobuf@3.21.4) + '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.4) + '@injectivelabs/grpc-web-node-http-transport': 0.0.2(@injectivelabs/grpc-web@0.0.1(google-protobuf@3.21.4)) + '@injectivelabs/grpc-web-react-native-transport': 0.0.2(@injectivelabs/grpc-web@0.0.1(google-protobuf@3.21.4)) + '@injectivelabs/indexer-proto-ts': 1.13.3 + '@injectivelabs/mito-proto-ts': 1.13.0 + '@injectivelabs/networks': 1.14.33(google-protobuf@3.21.4) + '@injectivelabs/olp-proto-ts': 1.13.1 + '@injectivelabs/test-utils': 1.14.34-beta.8(google-protobuf@3.21.4) + '@injectivelabs/ts-types': 1.14.33 + '@injectivelabs/utils': 1.14.33(google-protobuf@3.21.4) + '@metamask/eth-sig-util': 4.0.1 + '@noble/curves': 1.8.0 + axios: 1.7.9(debug@4.4.0) + bech32: 2.0.0 + bip39: 3.1.0 + cosmjs-types: 0.9.0 + ethereumjs-util: 7.1.5 + ethers: 6.13.4(bufferutil@4.0.9)(utf-8-validate@6.0.5) + google-protobuf: 3.21.4 + graphql: 16.10.0 + http-status-codes: 2.3.0 + js-sha3: 0.8.0 + jscrypto: 1.0.3 + keccak256: 1.0.6 + secp256k1: 4.0.4 + shx: 0.3.4 + snakecase-keys: 5.5.0 + transitivePeerDependencies: + - '@types/react' + - bufferutil + - debug + - graphql-ws + - react + - react-dom + - subscriptions-transport-ws + - utf-8-validate + '@injectivelabs/sdk-ts@1.14.5(@types/react@19.0.7)(bufferutil@4.0.9)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(utf-8-validate@5.0.10)': dependencies: '@apollo/client': 3.12.6(@types/react@19.0.7)(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) @@ -28718,6 +29473,21 @@ snapshots: - debug - google-protobuf + '@injectivelabs/test-utils@1.14.34-beta.8(google-protobuf@3.21.4)': + dependencies: + '@injectivelabs/exceptions': 1.14.34-beta.5(google-protobuf@3.21.4) + '@injectivelabs/networks': 1.14.34-beta.5(google-protobuf@3.21.4) + '@injectivelabs/ts-types': 1.14.34-beta.2 + '@injectivelabs/utils': 1.14.34-beta.5(google-protobuf@3.21.4) + axios: 1.7.9(debug@4.4.0) + bignumber.js: 9.1.2 + shx: 0.3.4 + snakecase-keys: 5.5.0 + store2: 2.14.4 + transitivePeerDependencies: + - debug + - google-protobuf + '@injectivelabs/token-metadata@1.14.11(google-protobuf@3.21.4)': dependencies: '@injectivelabs/exceptions': 1.14.33(google-protobuf@3.21.4) @@ -28739,6 +29509,10 @@ snapshots: dependencies: shx: 0.3.4 + '@injectivelabs/ts-types@1.14.34-beta.2': + dependencies: + shx: 0.3.4 + '@injectivelabs/utils@1.14.33(google-protobuf@3.21.4)': dependencies: '@injectivelabs/exceptions': 1.14.33(google-protobuf@3.21.4) @@ -28753,6 +29527,34 @@ snapshots: - debug - google-protobuf + '@injectivelabs/utils@1.14.34-beta.2(google-protobuf@3.21.4)': + dependencies: + '@injectivelabs/exceptions': 1.14.34-beta.5(google-protobuf@3.21.4) + '@injectivelabs/ts-types': 1.14.34-beta.2 + axios: 1.7.9(debug@4.4.0) + bignumber.js: 9.1.2 + http-status-codes: 2.3.0 + shx: 0.3.4 + snakecase-keys: 5.5.0 + store2: 2.14.4 + transitivePeerDependencies: + - debug + - google-protobuf + + '@injectivelabs/utils@1.14.34-beta.5(google-protobuf@3.21.4)': + dependencies: + '@injectivelabs/exceptions': 1.14.34-beta.5(google-protobuf@3.21.4) + '@injectivelabs/ts-types': 1.14.34-beta.2 + axios: 1.7.9(debug@4.4.0) + bignumber.js: 9.1.2 + http-status-codes: 2.3.0 + shx: 0.3.4 + snakecase-keys: 5.5.0 + store2: 2.14.4 + transitivePeerDependencies: + - debug + - google-protobuf + '@ioredis/commands@1.2.0': {} '@irys/arweave@0.0.2': @@ -28923,62 +29725,27 @@ snapshots: '@jest/console@29.7.0': dependencies: '@jest/types': 29.6.3 - '@types/node': 20.17.9 + '@types/node': 22.10.7 chalk: 4.1.2 jest-message-util: 29.7.0 jest-util: 29.7.0 slash: 3.0.0 - '@jest/core@29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3))': + '@jest/core@29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3))': dependencies: '@jest/console': 29.7.0 '@jest/reporters': 29.7.0 '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.17.9 - ansi-escapes: 4.3.2 - chalk: 4.1.2 - ci-info: 3.9.0 - exit: 0.1.2 - graceful-fs: 4.2.11 - jest-changed-files: 29.7.0 - jest-config: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)) - jest-haste-map: 29.7.0 - jest-message-util: 29.7.0 - jest-regex-util: 29.6.3 - jest-resolve: 29.7.0 - jest-resolve-dependencies: 29.7.0 - jest-runner: 29.7.0 - jest-runtime: 29.7.0 - jest-snapshot: 29.7.0 - jest-util: 29.7.0 - jest-validate: 29.7.0 - jest-watcher: 29.7.0 - micromatch: 4.0.8 - pretty-format: 29.7.0 - slash: 3.0.0 - strip-ansi: 6.0.1 - transitivePeerDependencies: - - babel-plugin-macros - - supports-color - - ts-node - - '@jest/core@29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3))': - dependencies: - '@jest/console': 29.7.0 - '@jest/reporters': 29.7.0 - '@jest/test-result': 29.7.0 - '@jest/transform': 29.7.0 - '@jest/types': 29.6.3 - '@types/node': 20.17.9 + '@types/node': 22.10.7 ansi-escapes: 4.3.2 chalk: 4.1.2 ci-info: 3.9.0 exit: 0.1.2 graceful-fs: 4.2.11 jest-changed-files: 29.7.0 - jest-config: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)) + jest-config: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)) jest-haste-map: 29.7.0 jest-message-util: 29.7.0 jest-regex-util: 29.6.3 @@ -29006,14 +29773,14 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.17.9 + '@types/node': 22.10.7 ansi-escapes: 4.3.2 chalk: 4.1.2 ci-info: 3.9.0 exit: 0.1.2 graceful-fs: 4.2.11 jest-changed-files: 29.7.0 - jest-config: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.8.4)(typescript@5.6.3)) + jest-config: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.8.4)(typescript@5.6.3)) jest-haste-map: 29.7.0 jest-message-util: 29.7.0 jest-regex-util: 29.6.3 @@ -29038,7 +29805,7 @@ snapshots: dependencies: '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.17.9 + '@types/node': 22.10.7 jest-mock: 29.7.0 '@jest/expect-utils@29.7.0': @@ -29056,7 +29823,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@sinonjs/fake-timers': 10.3.0 - '@types/node': 20.17.9 + '@types/node': 22.10.7 jest-message-util: 29.7.0 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -29078,7 +29845,7 @@ snapshots: '@jest/transform': 29.7.0 '@jest/types': 29.6.3 '@jridgewell/trace-mapping': 0.3.25 - '@types/node': 20.17.9 + '@types/node': 22.10.7 chalk: 4.1.2 collect-v8-coverage: 1.0.2 exit: 0.1.2 @@ -29148,7 +29915,7 @@ snapshots: '@jest/schemas': 29.6.3 '@types/istanbul-lib-coverage': 2.0.6 '@types/istanbul-reports': 3.0.4 - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/yargs': 17.0.33 chalk: 4.1.2 @@ -29223,6 +29990,23 @@ snapshots: transitivePeerDependencies: - openai + '@langchain/core@0.3.30(openai@4.78.1(encoding@0.1.13)(zod@3.23.8))': + dependencies: + '@cfworker/json-schema': 4.1.0 + ansi-styles: 5.2.0 + camelcase: 6.3.0 + decamelize: 1.2.0 + js-tiktoken: 1.0.15 + langsmith: 0.2.15(openai@4.78.1(encoding@0.1.13)(zod@3.23.8)) + mustache: 4.2.0 + p-queue: 6.6.2 + p-retry: 4.6.2 + uuid: 10.0.0 + zod: 3.23.8 + zod-to-json-schema: 3.24.1(zod@3.23.8) + transitivePeerDependencies: + - openai + '@langchain/core@0.3.30(openai@4.78.1(encoding@0.1.13)(zod@3.24.1))': dependencies: '@cfworker/json-schema': 4.1.0 @@ -29338,7 +30122,7 @@ snapshots: - utf-8-validate - wait-for-expect - '@lens-protocol/client@2.2.0(@jest/globals@29.7.0)(@lens-protocol/metadata@1.2.0(zod@3.23.8))(bufferutil@4.0.9)(encoding@0.1.13)(ethers@6.13.4(bufferutil@4.0.9)(utf-8-validate@5.0.10))(utf-8-validate@5.0.10)': + '@lens-protocol/client@2.2.0(@jest/globals@29.7.0)(@lens-protocol/metadata@1.2.0(zod@3.23.8))(@types/react@19.0.7)(bufferutil@4.0.9)(encoding@0.1.13)(ethers@6.13.4(bufferutil@4.0.9)(utf-8-validate@5.0.10))(react@19.0.0)(utf-8-validate@5.0.10)': dependencies: '@ethersproject/abi': 5.7.0 '@ethersproject/abstract-signer': 5.7.0 @@ -29349,7 +30133,7 @@ snapshots: '@ethersproject/providers': 5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@ethersproject/wallet': 5.7.0 '@lens-protocol/blockchain-bindings': 0.10.2(@jest/globals@29.7.0)(bufferutil@4.0.9)(utf-8-validate@5.0.10) - '@lens-protocol/gated-content': 0.5.1(@ethersproject/abi@5.7.0)(@ethersproject/address@5.7.0)(@ethersproject/bignumber@5.7.0)(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0)(@lens-protocol/metadata@1.2.0(zod@3.23.8))(bufferutil@4.0.9)(encoding@0.1.13)(ethers@6.13.4(bufferutil@4.0.9)(utf-8-validate@5.0.10))(utf-8-validate@5.0.10)(zod@3.23.8) + '@lens-protocol/gated-content': 0.5.1(@ethersproject/abi@5.7.0)(@ethersproject/address@5.7.0)(@ethersproject/bignumber@5.7.0)(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0)(@lens-protocol/metadata@1.2.0(zod@3.23.8))(@types/react@19.0.7)(bufferutil@4.0.9)(encoding@0.1.13)(ethers@6.13.4(bufferutil@4.0.9)(utf-8-validate@5.0.10))(react@19.0.0)(utf-8-validate@5.0.10)(zod@3.23.8) '@lens-protocol/shared-kernel': 0.12.0 '@lens-protocol/storage': 0.8.1 graphql: 16.10.0 @@ -29398,7 +30182,7 @@ snapshots: optionalDependencies: '@jest/globals': 29.7.0 - '@lens-protocol/gated-content@0.5.1(@ethersproject/abi@5.7.0)(@ethersproject/address@5.7.0)(@ethersproject/bignumber@5.7.0)(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0)(@lens-protocol/metadata@1.2.0(zod@3.23.8))(bufferutil@4.0.9)(encoding@0.1.13)(ethers@6.13.4(bufferutil@4.0.9)(utf-8-validate@5.0.10))(utf-8-validate@5.0.10)(zod@3.23.8)': + '@lens-protocol/gated-content@0.5.1(@ethersproject/abi@5.7.0)(@ethersproject/address@5.7.0)(@ethersproject/bignumber@5.7.0)(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0)(@lens-protocol/metadata@1.2.0(zod@3.23.8))(@types/react@19.0.7)(bufferutil@4.0.9)(encoding@0.1.13)(ethers@6.13.4(bufferutil@4.0.9)(utf-8-validate@5.0.10))(react@19.0.0)(utf-8-validate@5.0.10)(zod@3.23.8)': dependencies: '@ethersproject/abi': 5.7.0 '@ethersproject/address': 5.7.0 @@ -29413,7 +30197,7 @@ snapshots: '@lit-protocol/constants': 2.1.62 '@lit-protocol/crypto': 2.1.62(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@lit-protocol/encryption': 2.1.62(bufferutil@4.0.9)(utf-8-validate@5.0.10) - '@lit-protocol/node-client': 2.1.62(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0)(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10) + '@lit-protocol/node-client': 2.1.62(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0)(@types/react@19.0.7)(bufferutil@4.0.9)(encoding@0.1.13)(react@19.0.0)(utf-8-validate@5.0.10) '@lit-protocol/types': 2.1.62 siwe: 2.3.2(ethers@6.13.4(bufferutil@4.0.9)(utf-8-validate@5.0.10)) tslib: 2.8.1 @@ -29611,14 +30395,14 @@ snapshots: - bufferutil - utf-8-validate - '@lit-protocol/auth-browser@2.1.62(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0)(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10)': + '@lit-protocol/auth-browser@2.1.62(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0)(@types/react@19.0.7)(bufferutil@4.0.9)(encoding@0.1.13)(react@19.0.0)(utf-8-validate@5.0.10)': dependencies: '@lit-protocol/constants': 2.1.62 '@lit-protocol/misc': 2.1.62 '@lit-protocol/misc-browser': 2.1.62(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@lit-protocol/types': 2.1.62 '@lit-protocol/uint8arrays': 2.1.62 - '@walletconnect/ethereum-provider': 2.17.3(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10) + '@walletconnect/ethereum-provider': 2.17.3(@types/react@19.0.7)(bufferutil@4.0.9)(encoding@0.1.13)(react@19.0.0)(utf-8-validate@5.0.10) ethers: 5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10) lit-connect-modal: 0.1.11 lit-siwe: 1.1.8(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0) @@ -29719,10 +30503,10 @@ snapshots: '@lit-protocol/nacl@2.1.62': {} - '@lit-protocol/node-client@2.1.62(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0)(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10)': + '@lit-protocol/node-client@2.1.62(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0)(@types/react@19.0.7)(bufferutil@4.0.9)(encoding@0.1.13)(react@19.0.0)(utf-8-validate@5.0.10)': dependencies: '@lit-protocol/access-control-conditions': 2.1.62(bufferutil@4.0.9)(utf-8-validate@5.0.10) - '@lit-protocol/auth-browser': 2.1.62(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0)(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10) + '@lit-protocol/auth-browser': 2.1.62(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10))(@ethersproject/wallet@5.7.0)(@types/react@19.0.7)(bufferutil@4.0.9)(encoding@0.1.13)(react@19.0.0)(utf-8-validate@5.0.10) '@lit-protocol/bls-sdk': 2.1.62 '@lit-protocol/constants': 2.1.62 '@lit-protocol/crypto': 2.1.62(bufferutil@4.0.9)(utf-8-validate@5.0.10) @@ -29734,7 +30518,7 @@ snapshots: '@lit-protocol/nacl': 2.1.62 '@lit-protocol/types': 2.1.62 '@lit-protocol/uint8arrays': 2.1.62 - '@walletconnect/ethereum-provider': 2.17.3(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10) + '@walletconnect/ethereum-provider': 2.17.3(@types/react@19.0.7)(bufferutil@4.0.9)(encoding@0.1.13)(react@19.0.0)(utf-8-validate@5.0.10) ethers: 5.7.2(bufferutil@4.0.9)(utf-8-validate@5.0.10) jszip: 3.10.1 lit-connect-modal: 0.1.11 @@ -32887,6 +33671,18 @@ snapshots: dependencies: '@sinonjs/commons': 3.0.1 + '@sinonjs/fake-timers@13.0.5': + dependencies: + '@sinonjs/commons': 3.0.1 + + '@sinonjs/samsam@8.0.2': + dependencies: + '@sinonjs/commons': 3.0.1 + lodash.get: 4.4.2 + type-detect: 4.1.0 + + '@sinonjs/text-encoding@0.7.3': {} + '@skip-go/client@0.16.4(@solana/web3.js@1.98.0(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10))(@types/react@19.0.7)(bufferutil@4.0.9)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(starknet@6.18.0(encoding@0.1.13))(utf-8-validate@5.0.10)(viem@2.21.58(bufferutil@4.0.9)(typescript@5.7.3)(utf-8-validate@5.0.10)(zod@3.23.8))': dependencies: '@cosmjs/amino': 0.32.4 @@ -32936,7 +33732,7 @@ snapshots: '@slack/logger@3.0.0': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@slack/types@2.14.0': {} @@ -34458,11 +35254,11 @@ snapshots: '@types/bn.js@4.11.6': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/bn.js@5.1.6': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/body-parser@1.19.5': dependencies: @@ -34471,23 +35267,27 @@ snapshots: '@types/bonjour@3.5.13': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/cacheable-request@6.0.3': dependencies: '@types/http-cache-semantics': 4.0.4 '@types/keyv': 3.1.4 - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/responselike': 1.0.3 '@types/caseless@0.12.5': {} '@types/chai-subset@1.3.5': dependencies: - '@types/chai': 4.3.20 + '@types/chai': 5.0.1 '@types/chai@4.3.20': {} + '@types/chai@5.0.1': + dependencies: + '@types/deep-eql': 4.0.2 + '@types/chance@1.1.6': {} '@types/chrome@0.0.278': @@ -34498,11 +35298,11 @@ snapshots: '@types/connect-history-api-fallback@1.5.4': dependencies: '@types/express-serve-static-core': 5.0.5 - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/connect@3.4.38': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/cookie@0.6.0': {} @@ -34631,6 +35431,8 @@ snapshots: dependencies: '@types/ms': 0.7.34 + '@types/deep-eql@4.0.2': {} + '@types/diff-match-patch@1.0.36': {} '@types/dompurify@3.2.0': @@ -34665,14 +35467,14 @@ snapshots: '@types/express-serve-static-core@4.19.6': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/qs': 6.9.18 '@types/range-parser': 1.2.7 '@types/send': 0.17.4 '@types/express-serve-static-core@5.0.5': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/qs': 6.9.18 '@types/range-parser': 1.2.7 '@types/send': 0.17.4 @@ -34712,7 +35514,7 @@ snapshots: '@types/graceful-fs@4.1.9': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/gtag.js@0.0.12': {} @@ -34736,7 +35538,7 @@ snapshots: '@types/http-proxy@1.17.15': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/ioredis@5.0.0': dependencies: @@ -34746,7 +35548,7 @@ snapshots: '@types/is-stream@1.1.0': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/istanbul-lib-coverage@2.0.6': {} @@ -34775,7 +35577,7 @@ snapshots: '@types/keyv@3.1.4': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/lodash.isstring@4.0.9': dependencies: @@ -34813,12 +35615,12 @@ snapshots: '@types/node-fetch@2.6.12': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 form-data: 4.0.1 '@types/node-forge@1.3.11': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/node@10.17.60': {} @@ -34858,7 +35660,7 @@ snapshots: '@types/pbkdf2@3.1.2': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/pdfjs-dist@2.10.378(encoding@0.1.13)': dependencies: @@ -34918,7 +35720,7 @@ snapshots: '@types/request@2.48.12': dependencies: '@types/caseless': 0.12.5 - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/tough-cookie': 4.0.5 form-data: 2.5.2 @@ -34926,7 +35728,7 @@ snapshots: '@types/responselike@1.0.3': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/retry@0.12.0': {} @@ -34934,18 +35736,18 @@ snapshots: '@types/sax@1.2.7': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/secp256k1@4.0.6': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/semver@7.5.8': {} '@types/send@0.17.4': dependencies: '@types/mime': 1.3.5 - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/serve-index@1.9.4': dependencies: @@ -34954,16 +35756,22 @@ snapshots: '@types/serve-static@1.15.7': dependencies: '@types/http-errors': 2.0.4 - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/send': 0.17.4 '@types/sharp@0.32.0': dependencies: sharp: 0.33.5 + '@types/sinon@17.0.3': + dependencies: + '@types/sinonjs__fake-timers': 8.1.5 + + '@types/sinonjs__fake-timers@8.1.5': {} + '@types/sockjs@0.3.36': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/sql.js@1.4.9': dependencies: @@ -34987,7 +35795,7 @@ snapshots: '@types/unzipper@0.10.10': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/uuid@10.0.0': {} @@ -34999,7 +35807,7 @@ snapshots: '@types/ws@7.4.7': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/ws@8.5.13': dependencies: @@ -35007,7 +35815,7 @@ snapshots: '@types/ws@8.5.3': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 '@types/yargs-parser@21.0.3': {} @@ -35021,7 +35829,7 @@ snapshots: '@types/yauzl@2.10.3': dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 optional: true '@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0(eslint@9.18.0(jiti@2.4.2))(typescript@5.6.3))(eslint@9.18.0(jiti@2.4.2))(typescript@5.6.3)': @@ -35062,6 +35870,24 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/eslint-plugin@8.16.0(@typescript-eslint/parser@8.16.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3))(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3)': + dependencies: + '@eslint-community/regexpp': 4.12.1 + '@typescript-eslint/parser': 8.16.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3) + '@typescript-eslint/scope-manager': 8.16.0 + '@typescript-eslint/type-utils': 8.16.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3) + '@typescript-eslint/utils': 8.16.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3) + '@typescript-eslint/visitor-keys': 8.16.0 + eslint: 9.16.0(jiti@2.4.2) + graphemer: 1.4.0 + ignore: 5.3.2 + natural-compare: 1.4.0 + ts-api-utils: 1.4.3(typescript@5.7.3) + optionalDependencies: + typescript: 5.7.3 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/eslint-plugin@8.16.0(@typescript-eslint/parser@8.16.0(eslint@9.18.0(jiti@2.4.2))(typescript@5.6.3))(eslint@9.18.0(jiti@2.4.2))(typescript@5.6.3)': dependencies: '@eslint-community/regexpp': 4.12.1 @@ -35123,6 +35949,19 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/parser@8.16.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3)': + dependencies: + '@typescript-eslint/scope-manager': 8.16.0 + '@typescript-eslint/types': 8.16.0 + '@typescript-eslint/typescript-estree': 8.16.0(typescript@5.7.3) + '@typescript-eslint/visitor-keys': 8.16.0 + debug: 4.4.0(supports-color@5.5.0) + eslint: 9.16.0(jiti@2.4.2) + optionalDependencies: + typescript: 5.7.3 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/parser@8.16.0(eslint@9.18.0(jiti@2.4.2))(typescript@5.6.3)': dependencies: '@typescript-eslint/scope-manager': 8.16.0 @@ -35187,6 +36026,18 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/type-utils@8.16.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3)': + dependencies: + '@typescript-eslint/typescript-estree': 8.16.0(typescript@5.7.3) + '@typescript-eslint/utils': 8.16.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3) + debug: 4.4.0(supports-color@5.5.0) + eslint: 9.16.0(jiti@2.4.2) + ts-api-utils: 1.4.3(typescript@5.7.3) + optionalDependencies: + typescript: 5.7.3 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/type-utils@8.16.0(eslint@9.18.0(jiti@2.4.2))(typescript@5.6.3)': dependencies: '@typescript-eslint/typescript-estree': 8.16.0(typescript@5.6.3) @@ -35246,6 +36097,21 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/typescript-estree@8.16.0(typescript@5.7.3)': + dependencies: + '@typescript-eslint/types': 8.16.0 + '@typescript-eslint/visitor-keys': 8.16.0 + debug: 4.4.0(supports-color@5.5.0) + fast-glob: 3.3.3 + is-glob: 4.0.3 + minimatch: 9.0.5 + semver: 7.6.3 + ts-api-utils: 1.4.3(typescript@5.7.3) + optionalDependencies: + typescript: 5.7.3 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/typescript-estree@8.20.0(typescript@5.6.3)': dependencies: '@typescript-eslint/types': 8.20.0 @@ -35286,6 +36152,18 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/utils@8.16.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3)': + dependencies: + '@eslint-community/eslint-utils': 4.4.1(eslint@9.16.0(jiti@2.4.2)) + '@typescript-eslint/scope-manager': 8.16.0 + '@typescript-eslint/types': 8.16.0 + '@typescript-eslint/typescript-estree': 8.16.0(typescript@5.7.3) + eslint: 9.16.0(jiti@2.4.2) + optionalDependencies: + typescript: 5.7.3 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/utils@8.16.0(eslint@9.18.0(jiti@2.4.2))(typescript@5.6.3)': dependencies: '@eslint-community/eslint-utils': 4.4.1(eslint@9.18.0(jiti@2.4.2)) @@ -35806,6 +36684,47 @@ snapshots: - uploadthing - utf-8-validate + '@walletconnect/core@2.17.3(bufferutil@4.0.9)(utf-8-validate@5.0.10)': + dependencies: + '@walletconnect/heartbeat': 1.2.2 + '@walletconnect/jsonrpc-provider': 1.0.14 + '@walletconnect/jsonrpc-types': 1.0.4 + '@walletconnect/jsonrpc-utils': 1.0.8 + '@walletconnect/jsonrpc-ws-connection': 1.0.16(bufferutil@4.0.9)(utf-8-validate@5.0.10) + '@walletconnect/keyvaluestorage': 1.1.1(ioredis@5.4.2) + '@walletconnect/logger': 2.1.2 + '@walletconnect/relay-api': 1.0.11 + '@walletconnect/relay-auth': 1.0.4 + '@walletconnect/safe-json': 1.0.2 + '@walletconnect/time': 1.0.2 + '@walletconnect/types': 2.17.3(ioredis@5.4.2) + '@walletconnect/utils': 2.17.3(ioredis@5.4.2) + '@walletconnect/window-getters': 1.0.1 + events: 3.3.0 + lodash.isequal: 4.5.0 + uint8arrays: 3.1.0 + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@deno/kv' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@upstash/redis' + - '@vercel/blob' + - '@vercel/kv' + - aws4fetch + - bufferutil + - db0 + - ioredis + - uploadthing + - utf-8-validate + '@walletconnect/environment@1.0.1': dependencies: tslib: 1.14.1 @@ -35848,7 +36767,7 @@ snapshots: - uploadthing - utf-8-validate - '@walletconnect/ethereum-provider@2.17.3(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10)': + '@walletconnect/ethereum-provider@2.17.3(@types/react@19.0.7)(bufferutil@4.0.9)(encoding@0.1.13)(react@19.0.0)(utf-8-validate@5.0.10)': dependencies: '@walletconnect/jsonrpc-http-connection': 1.0.8(encoding@0.1.13) '@walletconnect/jsonrpc-provider': 1.0.14 @@ -36082,7 +37001,7 @@ snapshots: '@walletconnect/sign-client@2.17.3(bufferutil@4.0.9)(utf-8-validate@5.0.10)': dependencies: - '@walletconnect/core': 2.17.3(bufferutil@4.0.9)(ioredis@5.4.2)(utf-8-validate@5.0.10) + '@walletconnect/core': 2.17.3(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@walletconnect/events': 1.0.1 '@walletconnect/heartbeat': 1.2.2 '@walletconnect/jsonrpc-utils': 1.0.8 @@ -37706,6 +38625,11 @@ snapshots: builtin-status-codes@3.0.0: {} + bundle-require@4.2.1(esbuild@0.17.19): + dependencies: + esbuild: 0.17.19 + load-tsconfig: 0.2.5 + bundle-require@5.1.0(esbuild@0.24.2): dependencies: esbuild: 0.24.2 @@ -38604,43 +39528,13 @@ snapshots: safe-buffer: 5.2.1 sha.js: 2.4.11 - create-jest@29.7.0(@types/node@18.19.71)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)): - dependencies: - '@jest/types': 29.6.3 - chalk: 4.1.2 - exit: 0.1.2 - graceful-fs: 4.2.11 - jest-config: 29.7.0(@types/node@18.19.71)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)) - jest-util: 29.7.0 - prompts: 2.4.2 - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - - create-jest@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)): - dependencies: - '@jest/types': 29.6.3 - chalk: 4.1.2 - exit: 0.1.2 - graceful-fs: 4.2.11 - jest-config: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)) - jest-util: 29.7.0 - prompts: 2.4.2 - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - - create-jest@29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0): + create-jest@29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)): dependencies: '@jest/types': 29.6.3 chalk: 4.1.2 exit: 0.1.2 graceful-fs: 4.2.11 - jest-config: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0) + jest-config: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)) jest-util: 29.7.0 prompts: 2.4.2 transitivePeerDependencies: @@ -39404,6 +40298,8 @@ snapshots: diff@4.0.2: {} + diff@7.0.0: {} + diffie-hellman@5.0.3: dependencies: bn.js: 4.12.1 @@ -39913,6 +40809,31 @@ snapshots: esbuild: 0.24.2 import-meta-resolve: 3.1.1 + esbuild@0.17.19: + optionalDependencies: + '@esbuild/android-arm': 0.17.19 + '@esbuild/android-arm64': 0.17.19 + '@esbuild/android-x64': 0.17.19 + '@esbuild/darwin-arm64': 0.17.19 + '@esbuild/darwin-x64': 0.17.19 + '@esbuild/freebsd-arm64': 0.17.19 + '@esbuild/freebsd-x64': 0.17.19 + '@esbuild/linux-arm': 0.17.19 + '@esbuild/linux-arm64': 0.17.19 + '@esbuild/linux-ia32': 0.17.19 + '@esbuild/linux-loong64': 0.17.19 + '@esbuild/linux-mips64el': 0.17.19 + '@esbuild/linux-ppc64': 0.17.19 + '@esbuild/linux-riscv64': 0.17.19 + '@esbuild/linux-s390x': 0.17.19 + '@esbuild/linux-x64': 0.17.19 + '@esbuild/netbsd-x64': 0.17.19 + '@esbuild/openbsd-x64': 0.17.19 + '@esbuild/sunos-x64': 0.17.19 + '@esbuild/win32-arm64': 0.17.19 + '@esbuild/win32-ia32': 0.17.19 + '@esbuild/win32-x64': 0.17.19 + esbuild@0.19.12: optionalDependencies: '@esbuild/aix-ppc64': 0.19.12 @@ -40651,7 +41572,7 @@ snapshots: eval@0.1.8: dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 require-like: 0.1.2 event-emitter@0.3.5: @@ -42941,7 +43862,7 @@ snapshots: '@jest/expect': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.17.9 + '@types/node': 22.10.7 chalk: 4.1.2 co: 4.6.0 dedent: 1.5.3(babel-plugin-macros@3.1.0) @@ -42961,54 +43882,16 @@ snapshots: - babel-plugin-macros - supports-color - jest-cli@29.7.0(@types/node@18.19.71)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)): - dependencies: - '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)) - '@jest/test-result': 29.7.0 - '@jest/types': 29.6.3 - chalk: 4.1.2 - create-jest: 29.7.0(@types/node@18.19.71)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)) - exit: 0.1.2 - import-local: 3.2.0 - jest-config: 29.7.0(@types/node@18.19.71)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)) - jest-util: 29.7.0 - jest-validate: 29.7.0 - yargs: 17.7.2 - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - - jest-cli@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)): - dependencies: - '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)) - '@jest/test-result': 29.7.0 - '@jest/types': 29.6.3 - chalk: 4.1.2 - create-jest: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)) - exit: 0.1.2 - import-local: 3.2.0 - jest-config: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)) - jest-util: 29.7.0 - jest-validate: 29.7.0 - yargs: 17.7.2 - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - - jest-cli@29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0): + jest-cli@29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)): dependencies: - '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)) + '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)) '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 chalk: 4.1.2 - create-jest: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0) + create-jest: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)) exit: 0.1.2 import-local: 3.2.0 - jest-config: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0) + jest-config: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)) jest-util: 29.7.0 jest-validate: 29.7.0 yargs: 17.7.2 @@ -43037,7 +43920,7 @@ snapshots: - supports-color - ts-node - jest-config@29.7.0(@types/node@18.19.71)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)): + jest-config@29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)): dependencies: '@babel/core': 7.26.0 '@jest/test-sequencer': 29.7.0 @@ -43062,106 +43945,13 @@ snapshots: slash: 3.0.0 strip-json-comments: 3.1.1 optionalDependencies: - '@types/node': 18.19.71 - ts-node: 10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3) - transitivePeerDependencies: - - babel-plugin-macros - - supports-color - - jest-config@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)): - dependencies: - '@babel/core': 7.26.0 - '@jest/test-sequencer': 29.7.0 - '@jest/types': 29.6.3 - babel-jest: 29.7.0(@babel/core@7.26.0) - chalk: 4.1.2 - ci-info: 3.9.0 - deepmerge: 4.3.1 - glob: 7.2.3 - graceful-fs: 4.2.11 - jest-circus: 29.7.0(babel-plugin-macros@3.1.0) - jest-environment-node: 29.7.0 - jest-get-type: 29.6.3 - jest-regex-util: 29.6.3 - jest-resolve: 29.7.0 - jest-runner: 29.7.0 - jest-util: 29.7.0 - jest-validate: 29.7.0 - micromatch: 4.0.8 - parse-json: 5.2.0 - pretty-format: 29.7.0 - slash: 3.0.0 - strip-json-comments: 3.1.1 - optionalDependencies: - '@types/node': 20.17.9 - ts-node: 10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3) - transitivePeerDependencies: - - babel-plugin-macros - - supports-color - - jest-config@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)): - dependencies: - '@babel/core': 7.26.0 - '@jest/test-sequencer': 29.7.0 - '@jest/types': 29.6.3 - babel-jest: 29.7.0(@babel/core@7.26.0) - chalk: 4.1.2 - ci-info: 3.9.0 - deepmerge: 4.3.1 - glob: 7.2.3 - graceful-fs: 4.2.11 - jest-circus: 29.7.0(babel-plugin-macros@3.1.0) - jest-environment-node: 29.7.0 - jest-get-type: 29.6.3 - jest-regex-util: 29.6.3 - jest-resolve: 29.7.0 - jest-runner: 29.7.0 - jest-util: 29.7.0 - jest-validate: 29.7.0 - micromatch: 4.0.8 - parse-json: 5.2.0 - pretty-format: 29.7.0 - slash: 3.0.0 - strip-json-comments: 3.1.1 - optionalDependencies: - '@types/node': 20.17.9 - ts-node: 10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3) - transitivePeerDependencies: - - babel-plugin-macros - - supports-color - - jest-config@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.8.4)(typescript@5.6.3)): - dependencies: - '@babel/core': 7.26.0 - '@jest/test-sequencer': 29.7.0 - '@jest/types': 29.6.3 - babel-jest: 29.7.0(@babel/core@7.26.0) - chalk: 4.1.2 - ci-info: 3.9.0 - deepmerge: 4.3.1 - glob: 7.2.3 - graceful-fs: 4.2.11 - jest-circus: 29.7.0(babel-plugin-macros@3.1.0) - jest-environment-node: 29.7.0 - jest-get-type: 29.6.3 - jest-regex-util: 29.6.3 - jest-resolve: 29.7.0 - jest-runner: 29.7.0 - jest-util: 29.7.0 - jest-validate: 29.7.0 - micromatch: 4.0.8 - parse-json: 5.2.0 - pretty-format: 29.7.0 - slash: 3.0.0 - strip-json-comments: 3.1.1 - optionalDependencies: - '@types/node': 20.17.9 - ts-node: 10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.8.4)(typescript@5.6.3) + '@types/node': 22.10.7 + ts-node: 10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3) transitivePeerDependencies: - babel-plugin-macros - supports-color - jest-config@29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0): + jest-config@29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.8.4)(typescript@5.6.3)): dependencies: '@babel/core': 7.26.0 '@jest/test-sequencer': 29.7.0 @@ -43187,6 +43977,7 @@ snapshots: strip-json-comments: 3.1.1 optionalDependencies: '@types/node': 22.10.7 + ts-node: 10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.8.4)(typescript@5.6.3) transitivePeerDependencies: - babel-plugin-macros - supports-color @@ -43224,7 +44015,7 @@ snapshots: jest-diff@29.7.0: dependencies: - chalk: 4.1.0 + chalk: 4.1.2 diff-sequences: 29.6.3 jest-get-type: 29.6.3 pretty-format: 29.7.0 @@ -43246,7 +44037,7 @@ snapshots: '@jest/environment': 29.7.0 '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.17.9 + '@types/node': 22.10.7 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -43256,7 +44047,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@types/graceful-fs': 4.1.9 - '@types/node': 20.17.9 + '@types/node': 22.10.7 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -43295,7 +44086,7 @@ snapshots: jest-mock@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 20.17.9 + '@types/node': 22.10.7 jest-util: 29.7.0 jest-pnp-resolver@1.2.3(jest-resolve@29.7.0): @@ -43330,7 +44121,7 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.17.9 + '@types/node': 22.10.7 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.11 @@ -43358,7 +44149,7 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.17.9 + '@types/node': 22.10.7 chalk: 4.1.2 cjs-module-lexer: 1.4.1 collect-v8-coverage: 1.0.2 @@ -43404,7 +44195,7 @@ snapshots: jest-util@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 20.17.9 + '@types/node': 22.10.7 chalk: 4.1.2 ci-info: 3.9.0 graceful-fs: 4.2.11 @@ -43423,7 +44214,7 @@ snapshots: dependencies: '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.17.9 + '@types/node': 22.10.7 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.13.1 @@ -43432,47 +44223,23 @@ snapshots: jest-worker@27.5.1: dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 merge-stream: 2.0.0 supports-color: 8.1.1 jest-worker@29.7.0: dependencies: - '@types/node': 20.17.9 + '@types/node': 22.10.7 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 - jest@29.7.0(@types/node@18.19.71)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)): - dependencies: - '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)) - '@jest/types': 29.6.3 - import-local: 3.2.0 - jest-cli: 29.7.0(@types/node@18.19.71)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)) - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - - jest@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)): + jest@29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)): dependencies: - '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)) + '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)) '@jest/types': 29.6.3 import-local: 3.2.0 - jest-cli: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)) - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - - jest@29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0): - dependencies: - '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)) - '@jest/types': 29.6.3 - import-local: 3.2.0 - jest-cli: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0) + jest-cli: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -43732,6 +44499,8 @@ snapshots: just-diff@6.0.2: {} + just-extend@6.2.0: {} + jwa@1.4.1: dependencies: buffer-equal-constant-time: 1.0.1 @@ -43889,6 +44658,17 @@ snapshots: optionalDependencies: openai: 4.73.0(encoding@0.1.13)(zod@3.23.8) + langsmith@0.2.15(openai@4.78.1(encoding@0.1.13)(zod@3.23.8)): + dependencies: + '@types/uuid': 10.0.0 + commander: 10.0.1 + p-queue: 6.6.2 + p-retry: 4.6.2 + semver: 7.6.3 + uuid: 10.0.0 + optionalDependencies: + openai: 4.78.1(encoding@0.1.13)(zod@3.23.8) + langsmith@0.2.15(openai@4.78.1(encoding@0.1.13)(zod@3.24.1)): dependencies: '@types/uuid': 10.0.0 @@ -44062,6 +44842,8 @@ snapshots: lifecycle-utils@1.7.3: {} + lilconfig@2.1.0: {} + lilconfig@3.1.3: {} lines-and-columns@1.2.4: {} @@ -44197,6 +44979,8 @@ snapshots: lodash.defaults@4.2.0: {} + lodash.get@4.4.2: {} + lodash.includes@4.3.0: {} lodash.isarguments@3.1.0: {} @@ -45344,7 +46128,7 @@ snapshots: array-differ: 3.0.0 array-union: 2.1.0 arrify: 2.0.1 - minimatch: 3.0.5 + minimatch: 3.1.2 multistream@4.1.0: dependencies: @@ -45472,6 +46256,14 @@ snapshots: next-tick@1.1.0: {} + nise@6.1.1: + dependencies: + '@sinonjs/commons': 3.0.1 + '@sinonjs/fake-timers': 13.0.5 + '@sinonjs/text-encoding': 0.7.3 + just-extend: 6.2.0 + path-to-regexp: 8.2.0 + no-case@3.0.4: dependencies: lower-case: 2.0.2 @@ -45783,7 +46575,7 @@ snapshots: '@yarnpkg/parsers': 3.0.0-rc.46 '@zkochan/js-yaml': 0.0.7 axios: 1.7.9(debug@4.4.0) - chalk: 4.1.0 + chalk: 4.1.2 cli-cursor: 3.1.0 cli-spinners: 2.6.1 cliui: 8.0.1 @@ -46081,7 +46873,7 @@ snapshots: ora@5.3.0: dependencies: bl: 4.1.0 - chalk: 4.1.0 + chalk: 4.1.2 cli-cursor: 3.1.0 cli-spinners: 2.6.1 is-interactive: 1.0.0 @@ -46463,6 +47255,8 @@ snapshots: path-to-regexp@3.3.0: {} + path-to-regexp@8.2.0: {} + path-type@3.0.0: dependencies: pify: 3.0.0 @@ -46959,6 +47753,14 @@ snapshots: '@csstools/utilities': 2.0.0(postcss@8.5.1) postcss: 8.5.1 + postcss-load-config@3.1.4(postcss@8.5.1)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)): + dependencies: + lilconfig: 2.1.0 + yaml: 1.10.2 + optionalDependencies: + postcss: 8.5.1 + ts-node: 10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3) + postcss-load-config@4.0.2(postcss@8.5.1)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.6.3)): dependencies: lilconfig: 3.1.3 @@ -47564,7 +48366,7 @@ snapshots: '@protobufjs/pool': 1.1.0 '@protobufjs/utf8': 1.1.0 '@types/long': 4.0.2 - '@types/node': 20.17.9 + '@types/node': 22.10.7 long: 4.0.0 protobufjs@7.4.0: @@ -47579,7 +48381,7 @@ snapshots: '@protobufjs/path': 1.1.2 '@protobufjs/pool': 1.1.0 '@protobufjs/utf8': 1.1.0 - '@types/node': 20.17.9 + '@types/node': 22.10.7 long: 5.2.4 protocols@2.0.1: {} @@ -49011,6 +49813,15 @@ snapshots: dependencies: semver: 7.6.3 + sinon@19.0.2: + dependencies: + '@sinonjs/commons': 3.0.1 + '@sinonjs/fake-timers': 13.0.5 + '@sinonjs/samsam': 8.0.2 + diff: 7.0.0 + nise: 6.1.1 + supports-color: 7.2.0 + sirv@2.0.4: dependencies: '@polka/url': 1.0.0-next.28 @@ -50154,6 +50965,10 @@ snapshots: dependencies: typescript: 5.6.3 + ts-api-utils@1.4.3(typescript@5.7.3): + dependencies: + typescript: 5.7.3 + ts-api-utils@2.0.0(typescript@5.6.3): dependencies: typescript: 5.6.3 @@ -50168,12 +50983,12 @@ snapshots: dependencies: tslib: 2.8.1 - ts-jest@29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(esbuild@0.24.2)(jest@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)))(typescript@5.7.3): + ts-jest@29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(esbuild@0.24.2)(jest@29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)))(typescript@5.7.3): dependencies: bs-logger: 0.2.6 ejs: 3.1.10 fast-json-stable-stringify: 2.1.0 - jest: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)) + jest: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)) jest-util: 29.7.0 json5: 2.2.3 lodash.memoize: 4.1.2 @@ -50188,31 +51003,12 @@ snapshots: babel-jest: 29.7.0(@babel/core@7.26.0) esbuild: 0.24.2 - ts-jest@29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(jest@29.7.0(@types/node@18.19.71)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)))(typescript@5.6.3): - dependencies: - bs-logger: 0.2.6 - ejs: 3.1.10 - fast-json-stable-stringify: 2.1.0 - jest: 29.7.0(@types/node@18.19.71)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)) - jest-util: 29.7.0 - json5: 2.2.3 - lodash.memoize: 4.1.2 - make-error: 1.3.6 - semver: 7.6.3 - typescript: 5.6.3 - yargs-parser: 21.1.1 - optionalDependencies: - '@babel/core': 7.26.0 - '@jest/transform': 29.7.0 - '@jest/types': 29.6.3 - babel-jest: 29.7.0(@babel/core@7.26.0) - ts-jest@29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(jest@29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0))(typescript@5.6.3): dependencies: bs-logger: 0.2.6 ejs: 3.1.10 fast-json-stable-stringify: 2.1.0 - jest: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0) + jest: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@22.10.7)(typescript@5.7.3)) jest-util: 29.7.0 json5: 2.2.3 lodash.memoize: 4.1.2 @@ -50268,6 +51064,7 @@ snapshots: yn: 3.1.1 optionalDependencies: '@swc/core': 1.10.7(@swc/helpers@0.5.15) + optional: true ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3): dependencies: @@ -50383,6 +51180,30 @@ snapshots: tsscmp@1.0.6: {} + tsup@6.7.0(@swc/core@1.10.7(@swc/helpers@0.5.15))(postcss@8.5.1)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3))(typescript@5.6.3): + dependencies: + bundle-require: 4.2.1(esbuild@0.17.19) + cac: 6.7.14 + chokidar: 3.6.0 + debug: 4.4.0(supports-color@5.5.0) + esbuild: 0.17.19 + execa: 5.1.1 + globby: 11.1.0 + joycon: 3.1.1 + postcss-load-config: 3.1.4(postcss@8.5.1)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@18.19.71)(typescript@5.6.3)) + resolve-from: 5.0.0 + rollup: 3.29.5 + source-map: 0.8.0-beta.0 + sucrase: 3.35.0 + tree-kill: 1.2.2 + optionalDependencies: + '@swc/core': 1.10.7(@swc/helpers@0.5.15) + postcss: 8.5.1 + typescript: 5.6.3 + transitivePeerDependencies: + - supports-color + - ts-node + tsup@8.3.5(@swc/core@1.10.7(@swc/helpers@0.5.15))(jiti@2.4.2)(postcss@8.5.1)(tsx@4.19.2)(typescript@5.6.3)(yaml@2.7.0): dependencies: bundle-require: 5.1.0(esbuild@0.24.2) @@ -51245,6 +52066,24 @@ snapshots: - supports-color - terser + vite-node@1.2.1(@types/node@18.19.71)(terser@5.37.0): + dependencies: + cac: 6.7.14 + debug: 4.4.0(supports-color@5.5.0) + pathe: 1.1.2 + picocolors: 1.1.1 + vite: 5.4.11(@types/node@18.19.71)(terser@5.37.0) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + vite-node@1.2.1(@types/node@20.17.9)(terser@5.37.0): dependencies: cac: 6.7.14 @@ -51418,6 +52257,16 @@ snapshots: - supports-color - typescript + vite@5.4.11(@types/node@18.19.71)(terser@5.37.0): + dependencies: + esbuild: 0.21.5 + postcss: 8.5.1 + rollup: 4.30.1 + optionalDependencies: + '@types/node': 18.19.71 + fsevents: 2.3.3 + terser: 5.37.0 + vite@5.4.11(@types/node@20.17.9)(terser@5.37.0): dependencies: esbuild: 0.21.5 @@ -51537,6 +52386,42 @@ snapshots: - supports-color - terser + vitest@1.2.1(@types/node@18.19.71)(jsdom@25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@6.0.5))(terser@5.37.0): + dependencies: + '@vitest/expect': 1.2.1 + '@vitest/runner': 1.2.1 + '@vitest/snapshot': 1.2.1 + '@vitest/spy': 1.2.1 + '@vitest/utils': 1.2.1 + acorn-walk: 8.3.4 + cac: 6.7.14 + chai: 4.5.0 + debug: 4.4.0(supports-color@5.5.0) + execa: 8.0.1 + local-pkg: 0.5.1 + magic-string: 0.30.17 + pathe: 1.1.2 + picocolors: 1.1.1 + std-env: 3.8.0 + strip-literal: 1.3.0 + tinybench: 2.9.0 + tinypool: 0.8.4 + vite: 5.4.11(@types/node@18.19.71)(terser@5.37.0) + vite-node: 1.2.1(@types/node@18.19.71)(terser@5.37.0) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 18.19.71 + jsdom: 25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@6.0.5) + transitivePeerDependencies: + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + vitest@1.2.1(@types/node@20.17.9)(jsdom@25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@5.0.10))(terser@5.37.0): dependencies: '@vitest/expect': 1.2.1 diff --git a/scripts/clean.sh b/scripts/clean.sh index d377f85f2cf..736024f0d0d 100644 --- a/scripts/clean.sh +++ b/scripts/clean.sh @@ -15,3 +15,4 @@ rm -rf ./packages/core/cache rm ./pnpm-lock.yaml echo "Cleanup completed." +exit 0 diff --git a/tests/README.md b/tests/README.md index 8717d9127e2..00d6585bda2 100644 --- a/tests/README.md +++ b/tests/README.md @@ -24,6 +24,6 @@ This directory contains smoke and integration tests for Eliza project. ## Using in GitHub CI/CD - Settings -> Secrets and variables -> Actions: -- Create an enviroment +- Create an environment - Add repository secret `OPENAI_API_KEY` - Refer to https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions for more information diff --git a/turbo.json b/turbo.json deleted file mode 100644 index 129de654728..00000000000 --- a/turbo.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "$schema": "https://turbo.build/schema.json", - "tasks": { - "check-types": { - "dependsOn": ["build"] - }, - "@elizaos/agent#check-types": { - "dependsOn": [ - "@elizaos/plugin-solana#build", - "@elizaos/plugin-direct#build" - ] - }, - "build": { - "outputs": ["dist/**"], - "dependsOn": ["^@elizaos/core#build"] - }, - "@elizaos/client-direct#build": { - "outputs": ["dist/**"], - "dependsOn": [ - "@elizaos/plugin-image-generation#build", - "@elizaos/plugin-tee-log#build" - ] - }, - "@elizaos/plugin-solana#build": { - "outputs": ["dist/**"], - "dependsOn": [ - "@elizaos/plugin-trustdb#build", - "@elizaos/plugin-tee#build" - ] - }, - "@elizaos/plugin-nft-generation#build": { - "outputs": ["dist/**"], - "dependsOn": ["@elizaos/plugin-node#build"] - }, - "@elizaos/client-direct#build": { - "outputs": ["dist/**"], - "dependsOn": ["@elizaos/plugin-tee-verifiable-log#build"] - }, - "@elizaos/plugin-tee-verifiable-log#build": { - "outputs": ["dist/**"], - "dependsOn": ["@elizaos/core#build", "@elizaos/plugin-tee#build"] - }, - "@elizaos/plugin-evm#build": { - "outputs": ["dist/**"], - "dependsOn": ["@elizaos/plugin-tee#build"] - }, - "@elizaos/plugin-tee-log#build": { - "outputs": ["dist/**"], - "dependsOn": [ - "@elizaos/plugin-tee#build", - "@elizaos/plugin-sgx#build" - ] - }, - "@elizaos/plugin-quai#build": { - "outputs": ["dist/**"], - "dependsOn": [ - "@elizaos/plugin-trustdb#build" - ] - }, - "eliza-docs#build": { - "outputs": ["build/**"] - }, - "dev": { - "persistent": true, - "cache": false - } - } -}