Skip to content

Commit 4104116

Browse files
committed
"chore : refactored all the request and response templates"
1 parent d9a4b4e commit 4104116

19 files changed

+5933
-8097
lines changed

packages/plugin-injective/injective-sdk-client-ts/src/template/auction.ts

+144-280
Large diffs are not rendered by default.

packages/plugin-injective/injective-sdk-client-ts/src/template/auth.ts

+197-430
Large diffs are not rendered by default.

packages/plugin-injective/injective-sdk-client-ts/src/template/bank.ts

+200-526
Large diffs are not rendered by default.

packages/plugin-injective/injective-sdk-client-ts/src/template/distribution.ts

+99-306
Large diffs are not rendered by default.

packages/plugin-injective/injective-sdk-client-ts/src/template/exchange.ts

+2,181-2,129
Large diffs are not rendered by default.

packages/plugin-injective/injective-sdk-client-ts/src/template/explorer.ts

+291-586
Large diffs are not rendered by default.

packages/plugin-injective/injective-sdk-client-ts/src/template/gov.ts

+339-773
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -1,190 +1,135 @@
11
// IBC Module Templates
22

33
export const getDenomTraceTemplate = `
4-
### Get Denomination Trace
4+
Extract the following details to get denom trace information:
5+
- **hash** (string): The hash of the denomination to trace
56
6-
**Description**:
7-
This query retrieves the denomination trace for a specific hash within the IBC (Inter-Blockchain Communication) module. Denomination traces are essential for tracking the origin and path of tokens as they move across different blockchain networks. Understanding denomination traces helps in verifying token authenticity, preventing double-spending, and ensuring seamless cross-chain operations.
7+
Provide the request in the following JSON format:
88
9-
**Request Format**:
109
\`\`\`json
1110
{
12-
"hash": string // Denomination trace hash (e.g., "transfer/channel-0/uatom")
11+
"hash": "hash_string"
1312
}
1413
\`\`\`
1514
16-
**Example Request**:
17-
\`\`\`json
18-
{
19-
"hash": "transfer/channel-0/uatom"
20-
}
21-
\`\`\`
15+
The response will contain:
16+
- **path** (string): Chain of port/channel identifiers used for tracing
17+
- **baseDenom** (string): Base denomination of the relayed fungible token
2218
23-
**Response Format**:
24-
\`\`\`json
25-
{
26-
"height": number,
27-
"txHash": string,
28-
"codespace": string,
29-
"code": number,
30-
"data": string, // Optional: Base64 encoded data containing denomination trace details
31-
"rawLog": string,
32-
"logs": [], // Optional
33-
"info": string, // Optional
34-
"gasWanted": number,
35-
"gasUsed": number,
36-
"timestamp": string,
37-
"events": [] // Optional
38-
}
39-
\`\`\`
19+
Response format:
4020
41-
**Example Response**:
4221
\`\`\`json
4322
{
44-
"height": 123700,
45-
"txHash": "ABC123denomtrace...",
46-
"codespace": "",
47-
"code": 0,
48-
"data": "CgdkZXRvaW5fdHJhY2UAA==",
49-
"rawLog": "[{\"events\": [{\"type\": \"get_denom_trace\", \"attributes\": [{\"key\": \"hash\", \"value\": \"transfer/channel-0/uatom\"}]}]}]",
50-
"logs": [],
51-
"info": "",
52-
"gasWanted": 80000,
53-
"gasUsed": 60000,
54-
"timestamp": "2025-05-01T10:00:00Z",
55-
"events": []
23+
"path": "transfer/channel-0/transfer/channel-1",
24+
"baseDenom": "uatom"
5625
}
5726
\`\`\`
27+
28+
Here are the recent user messages for context:
29+
{{recentMessages}}
5830
`;
5931

6032
export const getDenomsTraceTemplate = `
61-
### Get List of Denomination Traces
33+
Extract the following details to get multiple denom traces:
34+
- **pagination** (object): Optional pagination parameters containing:
35+
- **key** (string): Pagination key
36+
- **offset** (number): Pagination offset
37+
- **limit** (number): Number of records to return
38+
- **countTotal** (boolean): Whether to count total records
6239
63-
**Description**:
64-
This query fetches a list of all denomination traces within the IBC module, with optional pagination parameters. Denomination traces track the movement and origin of tokens across different chains, ensuring transparency and security in cross-chain transactions. Monitoring denomination traces helps in auditing token flows, identifying token sources, and maintaining the integrity of the token ecosystem.
40+
Provide the request in the following JSON format:
6541
66-
**Request Format**:
6742
\`\`\`json
6843
{
6944
"pagination": {
70-
"limit": number, // (Optional) Number of denomination traces to retrieve
71-
"offset": number // (Optional) Starting point for retrieval
45+
"key": "",
46+
"offset": 0,
47+
"limit": 100,
48+
"countTotal": true
7249
}
7350
}
7451
\`\`\`
7552
76-
**Example Request**:
53+
The response will contain an array of denom traces:
54+
- **denomTraces** (array): List of denomination traces, each containing:
55+
- **path** (string): Chain of port/channel identifiers
56+
- **baseDenom** (string): Base denomination
57+
- **pagination** (object): Pagination response information
58+
59+
Response format:
60+
7761
\`\`\`json
7862
{
63+
"denomTraces": [
64+
{
65+
"path": "transfer/channel-0/transfer/channel-1",
66+
"baseDenom": "uatom"
67+
},
68+
{
69+
"path": "transfer/channel-2",
70+
"baseDenom": "uosmo"
71+
}
72+
],
7973
"pagination": {
80-
"limit": 10,
81-
"offset": 0
74+
"nextKey": "",
75+
"total": 10
8276
}
8377
}
8478
\`\`\`
8579
86-
**Response Format**:
87-
\`\`\`json
88-
{
89-
"height": number,
90-
"txHash": string,
91-
"codespace": string,
92-
"code": number,
93-
"data": string, // Optional: Base64 encoded data containing list of denomination traces
94-
"rawLog": string,
95-
"logs": [], // Optional
96-
"info": string, // Optional
97-
"gasWanted": number,
98-
"gasUsed": number,
99-
"timestamp": string,
100-
"events": [] // Optional
101-
}
102-
\`\`\`
103-
104-
**Example Response**:
105-
\`\`\`json
106-
{
107-
"height": 123701,
108-
"txHash": "DEF456denomsxyz...",
109-
"codespace": "",
110-
"code": 0,
111-
"data": "W3siaGFzaCI6ICJ0cmFuc2Zlci9jaGFubmVsLTAvdWF0b20iLCAibmFtZSI6ICJ1YXRvbSJ9LCB7Imhhc2giOiAidHJhbnNmZXIvY2hhbm5lbC0xL3VhdG9tIiwgIm5hbWUiOiAidWF0b20ifV0=",
112-
"rawLog": "[{\"events\": [{\"type\": \"get_denoms_trace\", \"attributes\": []}]}]",
113-
"logs": [],
114-
"info": "",
115-
"gasWanted": 100000,
116-
"gasUsed": 85000,
117-
"timestamp": "2025-05-02T11:15:30Z",
118-
"events": []
119-
}
120-
\`\`\`
80+
Here are the recent user messages for context:
81+
{{recentMessages}}
12182
`;
12283

12384
export const msgIBCTransferTemplate = `
124-
### IBC Transfer
125-
126-
**Description**:
127-
This message broadcasts a transaction to perform an IBC (Inter-Blockchain Communication) transfer. IBC transfers enable the movement of tokens between different blockchain networks, facilitating interoperability and expanding the utility of assets across multiple ecosystems. Successfully executing an IBC transfer ensures that tokens are securely and accurately moved to the intended recipient on the target chain.
85+
Extract the following details for IBC token transfer:
86+
- **sourcePort** (string): Source port ID (e.g., "transfer")
87+
- **sourceChannel** (string): Source channel ID
88+
- **token** (object): Token to transfer containing:
89+
- **denom** (string): Token denomination
90+
- **amount** (string): Token amount
91+
- **receiver** (string): Receiver address on destination chain
92+
- **timeoutHeight** (object): Optional timeout height containing:
93+
- **revisionNumber** (string): Chain revision number
94+
- **revisionHeight** (string): Block height for timeout
95+
- **timeoutTimestamp** (string): Optional timeout timestamp in nanoseconds
96+
- **memo** (string): Optional transfer memo
97+
98+
Ensure that:
99+
1. Port ID and channel ID are valid
100+
2. Token amount is positive
101+
3. Receiver address is valid for destination chain
102+
4. Either timeoutHeight or timeoutTimestamp is specified
103+
104+
Provide the transfer details in the following JSON format:
128105
129-
**Request Format**:
130106
\`\`\`json
131107
{
132-
"sender": string, // Address of the sender initiating the transfer (e.g., "inj1sender123...")
133-
"receiver": string, // Address of the receiver on the target chain (e.g., "cosmos1receiver...")
134-
"sourceChannel": string, // IBC source channel (e.g., "transfer/channel-0")
135-
"destinationChannel": string, // IBC destination channel on the target chain (e.g., "transfer/channel-1")
136-
"denom": string, // Denomination of the token to transfer (e.g., "uatom")
137-
"amount": string, // Amount of tokens to transfer (e.g., "1000")
138-
"timeoutTimestamp": string // (Optional) Timeout timestamp in nanoseconds since epoch
108+
"sourcePort": "transfer",
109+
"sourceChannel": "channel-0",
110+
"token": {
111+
"denom": "inj",
112+
"amount": "1000000000000000000"
113+
},
114+
"receiver": "cosmos1...",
115+
"timeoutHeight": {
116+
"revisionNumber": "1",
117+
"revisionHeight": "1000000"
118+
},
119+
"timeoutTimestamp": "1640995200000000000",
120+
"memo": "Optional transfer memo"
139121
}
140122
\`\`\`
141123
142-
**Example Request**:
143-
\`\`\`json
144-
{
145-
"sender": "inj1sender1234567890...",
146-
"receiver": "cosmos1receiver1234567890...",
147-
"sourceChannel": "transfer/channel-0",
148-
"destinationChannel": "transfer/channel-1",
149-
"denom": "uatom",
150-
"amount": "1000",
151-
"timeoutTimestamp": "1704067200000000000" // Represents a future timestamp
152-
}
153-
\`\`\`
124+
Success response format:
154125
155-
**Response Format**:
156126
\`\`\`json
157127
{
158-
"height": number,
159-
"txHash": string,
160-
"codespace": string,
161-
"code": number,
162-
"data": string, // Optional: Base64 encoded data containing transaction details
163-
"rawLog": string,
164-
"logs": [], // Optional
165-
"info": string, // Optional
166-
"gasWanted": number,
167-
"gasUsed": number,
168-
"timestamp": string,
169-
"events": [] // Optional
128+
"txHash": "0x...",
129+
"success": true
170130
}
171131
\`\`\`
172132
173-
**Example Response**:
174-
\`\`\`json
175-
{
176-
"height": 123702,
177-
"txHash": "GHI789ibctransfer...",
178-
"codespace": "",
179-
"code": 0,
180-
"data": "CgVtZ3NUcmFuc2ZlcgA=",
181-
"rawLog": "[{\"events\": [{\"type\": \"ibc_transfer\", \"attributes\": [{\"key\": \"sender\", \"value\": \"inj1sender1234567890...\"}, {\"key\": \"receiver\", \"value\": \"cosmos1receiver1234567890...\"}, {\"key\": \"amount\", \"value\": \"1000uatom\"}]}]}]",
182-
"logs": [],
183-
"info": "",
184-
"gasWanted": 200000,
185-
"gasUsed": 150000,
186-
"timestamp": "2025-05-03T12:20:40Z",
187-
"events": []
188-
}
189-
\`\`\`
190-
`;
133+
Here are the recent user messages for context:
134+
{{recentMessages}}
135+
`;

0 commit comments

Comments
 (0)