bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 7쪽
ge queries to reduce API calls
2. **Debounce Search**: Debounce user input when searching by address
3. **Handle Pagination**: Always check `hasNextPage` before loading more
4. **Error Recovery**: Implement retry logic for transient failures
5. **Status Polling**: Only poll for messages that aren't in final states (SUCCESS/FAILED)
6. **Rate Limiting**: Be mindful of API rate limits in production
## Message Information via API <a href="#ccip-api-message-info" id="ccip-api-message-info"></a>
The CCIP API provides endpoints to query detailed message information by message ID, sender address, or receiver address. This is useful for building monitoring dashboards, transaction history, and status tracking in your application.
#### API Base URL
```
https://api.ccip.cldev.cloud/v2/
```
> **Note:** This is a pre-release version of the CCIP API (v2). The public release will be published soon.
#### Get Message by Message ID
Query a specific message using its message ID:
{% code expandable="true" %}
```typescript
const CCIP_API_BASE = "https://api.ccip.cldev.cloud/v2/";
interface MessageDetails {
messageId: string;
sender: string;
receiver: string;
origin?: string | null;
status: MessageStatus;
sourceNetworkInfo: NetworkInfo;
destNetworkInfo: NetworkInfo;
sendTransactionHash: string;
sendTimestamp: string;
receiptTransactionHash?: string | null;
receiptTimestamp?: string | null;
sourceTokenAddress?: string | null;
}
async function getMessageById(messageId: string): Promise<MessageDetails> {
// Remove 0x prefix if present
const cleanMessageId = messageId.startsWith("0x") ? messageId.slice(2) : messageId;
const url = `${CCIP_API_BASE}messages/${cleanMessageId}`;
const response = await fetch(url, {
headers: {
"Accept": "application/json",
},
});
if (!response.ok) {
const error = await response.json().catch(() => ({
error: "Unknown error",
message: `HTTP ${response.status}`,
}));
throw new Error(error.message || error.error);
}
return await response.json();
}
// Example usage
const messageId = "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef";
const message = await getMessageById(messageId);
console.log(`Message status: ${message.status}`);
console.log(`Send transaction: ${message.sendTransactionHash}`);
if (message.receiptTransactionHash) {
console.log(`Receipt transaction: ${message.receiptTransactionHash}`);
}
```
{% endcode %}
#### Query Messages by Receiver Address
Get all messages sent to the Maple receiver contract:
{% code expandable="true" %}
```typescript
async function getMessagesByReceiver(
receiverAddress: string,
limit: number = 50,
cursor?: string | null
): Promise<MessagesResponse> {
const params = new URLSearchParams();
if (cursor) {
params.set("cursor", cursor);
params.set("limit", limit.toString());
} else {
params.set("limit", limit.toString());
params.set("receiver", receiverAddress.toLowerCase());
}
const url = `${CCIP_API_BASE}messages?${params.toString()}`;
const response = await fetch(url, {
headers: {
"Accept": "application/json",
},
});
if (!response.ok) {
const error = await response.json().catch(() => ({
error: "Unknown error",
message: `HTTP ${response.status}`,
}));
throw new Error(error.message || error.error);
}
return await response.json();
}
// Example: Get all messages sent to Maple receiver contract
const receiverAddress = "0x02b6a75c5d1f430f0614dc5ac8ad5f9d35fba2c4";
const result = await getMessagesByReceiver(receiverAddress);
console.log(`Found ${result.data.length} messages`);
result.data.forEach((msg) => {
console.log(`Message ${msg.messageId}: ${msg.status}`);
});
```
{% endcode %}
#### Query Messages by Sender Address
Get all messages sent by a specific Solana address:
{% code expandable="true" %}
```typescript
async function getMessagesBySender(
senderAddress: string,
limit: number = 50,
cursor?: string | null
): Promise<MessagesResponse> {
const params = new URLSearchParams();
if (cursor) {
params.set("cursor", cursor);
params.set("limit", limit.toString());
} else {
params.set("limit", limit.toString());
// For Solana addresses, use the base58 address directly
params.set("sender", senderAddress);
}
const url = `${CCIP_API_BASE}messages?${params.toString()}`;
const response = await fetch(url, {
headers: {
"Accept": "application/json",
},
});
if (!response.ok) {
const error = await response.json().catch(() => ({
error: "Unknown error",
message: `HTTP ${response.status}`,
}));
throw new Error(error.message || error.error);
}
return await response.json();
}
// Example: Get all messages sent by a Solana user
const solanaSender = "2hVTZGxQZTpPjarHQsnQfnRSGSy8LPy85szn8Wy4sj5V";
const result = await getMessagesBySender(solanaSender);
console.log(`User has sent ${result.data.length} messages`);
result.data.forEach((msg) => {
console.log(`Message ${msg.messageId} to ${msg.receiver}: ${msg.status}`);
});
```
{% endcode %}
#### Polling for Message Status Updates
Poll the API to check when a message status changes:
{% code expandable="true" %}
```typescript
async function pollMessageStatus(
messageId: string,
onStatusUpdate: (status: MessageStatus) => void,
pollInterval: number = 5000, // 5 seconds
maxAttempts: number = 120 // 10 minutes max
): Promise<MessageDetails> {
let attempts = 0;
const poll = async (): Promise<MessageDetails> => {
attempts++;
const message = await getMessageById(messageId);
onStatusUpdate(message.status);
// Stop polling if message is in final state
if (message.status === "SUCCESS" || message.status === "FAILED") {
return message;
}
// Stop polling if max attempts reached
if (attempts >= maxAttempts) {
throw new Error(`Polling timeout: Message ${messageId} did not reach final state`);
}
// Wait before next poll
await new Promise(resolve => setTimeout(resolve, pollInterval));
return poll();
};
return poll();
}
// Example usage
const messageId = "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef";
pollMessageStatus(
messageId,
(status) => {
console.log(`Message status updated: ${status}`);
}
).then((message) => {
console.log(`Message completed with status: ${message.status}`);
if (message.receiptTransactionHash) {
console.log(`Receipt: ${message.receiptTransactionHash}`);
}
}).catch((error) => {
console.error("Polling error:", error);
});
```
{% endcode %}
#### Complete Example: Message Monitoring Hook
A React hook for monitoring messages:
{% code expandable="true" %}
```typescript
import { useState, useEffect, useCallback } from "react";
function useMessageStatus(messageId: string | null) {
const [message, setMessage] = useState<MessageDetails | null>(null);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
const fetchMessage = useCallback(async () => {
if (!messageId) return;
setLoading(true);
setError(null);
try {
const data = await getMessageById(messageId);
setMessage(data);
} catch (err: any) {
setError(err.message || "Failed to fetch message");
} finally {
setLoading(false);
}
}, [messageId]);
useEffect(() => {
if (!messageId) return;
fetchMessage();
// Poll for status updates if message is not in final state
const interval = setInterval(() => {
if (message && message.status !== "SUCCESS" && message.status !== "FAILED") {
fetchMessage();
}
}, 5000); // Poll every 5 seconds
return () => clearInterval(interval);
}, [messageId, message, fetchMessage]);
return { message, loading, error, refetch: fetchMessage };
}
// Usage in component
function MessageStatus({ messageId }: { messageId: string }) {
const { message, loading, error } = useMessageStatus(messageId);
if (loading) return <div>Loading message status...</div>;
if (error) return <div>Error: {error}</div>;
if (!message) return null;
return (
<div>
<h3>Message Status</h3>
<p>Status: {message.status}</p>
<p>Send Transaction: <a href={`https://explorer.solana.com/tx/${message.sendTransactionHash}`}>{message.sendTransactionHash}</a></p>
{message.receiptTransactionHash && (
<p>Receipt Transaction: <a href={`https://sepolia.etherscan.io/tx/${message.receiptTransactionHash}`}>{message.receiptTransactionHash}</a></p>
)}
</div>
);
}
```
{% endcode %}
#### Best Practices (Same as Monitoring)
1. **Rate Limiting**: Be mindful of API rate limits. Implement exponential backoff for retries
2. **Caching**: Cache message data to reduce API calls, especially for completed messages
3. **Polling Strategy**: Only poll messages that aren't in final states (SUCCESS/FAILED)
4. **Error Handling**: Implement retry logic for transient failures
5. **Pagination**: Use cursors for pagination when querying multiple messages
6. **Address Format**: Ensure addresses are in the correct format (lowercase for EVM, base58 for Solana)
## Important Notes <a href="#important-notes" id="important-notes"></a>
#### **Minimum Transfer Amounts**
> **⚠** Deposits and redemptions must exceed the configured fee for that token. Transactions with amounts below the fee will require manual recovery (handled by Maple).
Before sending a crosschain deposit or redemption:
1. Query the receiver contract for the current fee configuration
2. Validate the user's amount exceeds the fee
3. Display a clear error if the amount is too low
Fee amounts are configured per-token on the receiver contract. For fee queries and recovery procedures, see [Failed Deposit/Redemption Retry and Recovery](/technical-resources/crosschain/failed-message-recovery). Maple handles these edge cases with a 24h SLA, but you can as well for faster resolution.
#### Address Format Differences
* **Gas Estimation**: Use standard EVM address format (20 bytes, 42 characters with `0x`)
* Example: `0x02b6a75c5d1f430f0614dc5ac8ad5f9d35fba2c4`
* **Message Construction**: Use bytes32-padded address format (32 bytes, 66 characters with `0x`)
* Example: `0x00000000000000000000000002b6a75c5d1f430f0614dc5ac8ad5f9d35fba2c4`
#### Token Transfer Behavior
* **USDC Transfer**: When USDC is sent to the receiver, it processes a **deposit** operation
* **SyrupUSDC Transfer**: When SyrupUSDC is sent to the receiver, it processes a **redemption** operation
Ensure you're sending the correct token type based on the operation you want to perform.
#### Mainnet Deployment
All addresses in this guide are for **testnet only**. Before deploying to mainnet:
1. Update receiver contract address
2. Update pool contract address
3. Update token addresses (USDC, SyrupUSDC) for mainnet
4. Update destination chain selector if using a different chain
5. Verify all addresses on mainnet explorer
All addresses are available in [Asset Integration: Crosschain](/integrate/crosschain/syrupusd-crosschain).
#### Gas Estimation Best Practices
Always use `estimateReceiveExecution` to estimate gas limits. Never hardcode gas values.
**Key Points:**
* **Always estimate**: Use `estimateReceiveExecution` for every message
* **Sender required**: Include the sender address for accurate Solana-to-EVM estimation
* **API signature**: Use `estimateReceiveExecution({ source, dest, routerOrRamp, message })`
* **Validate estimates**: Check that estimates are reasonable (not zero, not extremely high)
* **Handle failures**: If estimation fails, retry before using fallback values
* **Fallback value**: 700,000 gas is a conservative fallback for emergency cases, not a recommended value
**Why estimation is important:**
* Gas requirements vary based on message data size
* SyrupUSDC Contract state can cause variable gas usage
* Other conditions can influence gas requirements
**If estimation fails:**
1. Check network connectivity
2. Verify receiver contract is deployed and accessible
3. Ensure all parameters (sender, receiver, data) are correct
4. Retry the estimation (most failures are transient)
5. Only use fallback values as a last resort
#### Out-of-Order Execution
Always set `allowOutOfOrderExecution: true`
#### Error Handling
Implement comprehensive error handling for:
* User transaction rejection
* Insufficient funds (SOL for fees, tokens for transfer)
* Network errors
* Gas estimation failures
* Transaction confirmation failures
#### Message Tracking
After sending, track your message using the CCIP Explorer:
* URL: `https://ccip.chain.link/msg/{messageId}`
* The message ID is extracted from the transaction logs after confirmation
## Resources & Contact
* Partnerships & queries: <partnerships@maple.finance>
* [Technical Docs](/technical-resources/crosschain)
* [Integration Support](https://chain.link/ccip-contact)
* [Failed Deposit/Redemption Retry and Recovery](/technical-resources/crosschain/failed-message-recovery)<br>
# Technical Resources
# Collateral & Yield Disclosure
All the data shown in the [Maple Open Access Details](https://app.maple.finance/earn/details) Page is available via API.
## Get Details Data Programmatically
Query the [Maple GraphQL API](https://api.maple.finance/v2/graphql) for a detailed breakdown of AUM, APY, loans and collateral:
```graphql
{
syrupGlobals {
collateralRatio
collateralValue
loansValue
# WEEK | MONTH | YEAR
aumTimeSeries(range: WEEK) {
timestamp
assetsUsd
assetsInStrategiesUsd
loansUsd
collateralUsd
}
# WEEK | MONTH | YEAR
apyTimeSeries(range: YEAR) {
timestamp
apy
boostApy
coreApy
usdBenchmarkApy
}
}
}
```
## Calculations
`AUM` = `loansUsd` + `assetsUsd` + `assetsInStrategiesUsd` + `collateralUsd`
`collateralRatio` = `collateralValue` ÷ `loansValue`
`apy` = `coreApy` + `boostApy`
## API Fields & Calculations
<table><thead><tr><th width="199.6531982421875">AUM Time Series Field</th><th width="189.533935546875">Example raw value</th><th width="169.8284912109375">Parsing</th><th>Parsed value</th></tr></thead><tbody><tr><td><code>timestamp</code></td><td><code>1753142400</code></td><td><code>timestamp * 1000</code></td><td>Tue, 22 Jul 2025</td></tr><tr><td><code>assetsUsd</code></td><td><code>25244993430500</code></td><td>8 decimals</td><td>$252,449</td></tr><tr><td><code>assetsInStrategiesUsd</code></td><td><code>179322260822400</code></td><td>8 decimals</td><td>$1.8M</td></tr><tr><td><code>loansUsd</code></td><td><code>84946501100000000</code></td><td>8 decimals</td><td>$849.5M</td></tr><tr><td><code>collateralUsd</code></td><td><code>141683063371031490</code></td><td>8 decimals</td><td>$1.4B</td></tr></tbody></table>
<table><thead><tr><th width="199.68927001953125">APY Time Series Field</th><th width="190.0164794921875">Example raw value</th><th width="170.471435546875">Parsing</th><th>Parsed value</th></tr></thead><tbody><tr><td><code>timestamp</code></td><td><code>1753142400</code></td><td><code>timestamp * 1000</code></td><td>Tue, 22 Jul 2025</td></tr><tr><td><code>apy</code></td><td><code>249098664347445580210603714885</code></td><td>30 decimals</td><td>24.9%</td></tr><tr><td><code>boostApy</code></td><td><code>135000000000000000000000000000</code></td><td>30 decimals</td><td>13.5%</td></tr><tr><td><code>coreApy</code></td><td><code>114098664347445580210603714885</code></td><td>30 decimals</td><td>11.4%</td></tr><tr><td><code>usdBenchmarkApy</code></td><td><code>103200000000000000000000000000</code></td><td>30 decimals</td><td>10.3%</td></tr></tbody></table>
<table><thead><tr><th width="199.68841552734375">Root Field (Collat. ratio)</th><th width="190.1441650390625">Example raw value</th><th width="170.033447265625">Parsing</th><th>Parsed value</th></tr></thead><tbody><tr><td><code>collateralRatio</code></td><td><code>147387147</code></td><td>8 decimals</td><td>147.4%</td></tr><tr><td><code>collateralValue</code></td><td><code>1332876094058522</code></td><td>6 decimals</td><td>$1.3B</td></tr><tr><td><code>loansValue</code></td><td><code>904336721000000</code></td><td>6 decimals</td><td>$904.3M</td></tr></tbody></table>
# Configure MCP Server
Use the Maple Docs MCP server to access the full protocol & integration context in a simple and secure way. [MCP is an open protocol](https://modelcontextprotocol.io/specification/2025-03-26) that enables AI models to securely interact with local and remote resources through standardized server implementations.
## What does the Maple Docs MCP Server do?
It connects Maple Docs to tools like Cursor, Claude Code, and any other MCP-enabled software, enabling your AI agents to help with the syrupUSD integration and protocol questions. If you have problems, questions or feedback, please reach out to us via the Intercom chat on the bottom right hand side of the screen.
## Setup Instructions
MCP Server URL: <https://docs.maple.finance/~gitbook/mcp>
### **Claude Code**
1\. Open your `~/.claude.json` config file\
2\. Add:
{% code overflow="wrap" %}
```json
{
"mcpServers": {
"maple-docs": {
"type": "http",
"url": "https://docs.maple.finance/~gitbook/mcp"
}
}
}
```
{% endcode %}
### **Cursor**
1. Open (or create) `~/.cursor/mcp.json`
2. Add:
{% code overflow="wrap" %}
```json
{
"mcpServers": {
"maple-docs": {
"type": "http",
"url": "https://docs.maple.finance/~gitbook/mcp"
}
}
}
```
{% endcode %}
## VS Code
1. Open (or create) `~/.vscode/mcp.json` on Mac/Linux or Windows
2. Add:
{% code overflow="wrap" %}
```json
{
"mcpServers": {
"maple-docs": {
"type": "http",
"url": "https://docs.maple.finance/~gitbook/mcp"
}
}
}
```
{% endcode %}
# Powered by Maple
**Maple Smart Contracts**
Maple is a leading digital asset lending platform, empowering the digital asset economy with secure, innovative lending solutions. Lending opportunities are tailored to meet diverse liquidity needs, risk appetites, and return expectations and facilitated through Maple’s industry-leading smart contract technology that provides real-time monitoring and transparency.
#### Maple and syrupUSDC/USDT/USDG Structure
syrupUSDC, syrupUSDT and syrupUSDG enable direct access to Maple pools through an interface and smart contract router (refer to Technical Resources for further details). Maple established new unique pools for syrupUSDC, syrupUSDT and syrupUSDG to ensure that proceeds and risks are segmented from existing pools accessible to Maple customers. Each of syrupUSDC, syrupUSDT and syrupUSDG operates under its own distinct legal entity: 
* syrupUSDC through Maple International Operations SPC acting on behalf of and for the account of Secured Loan Segregated Portfolio 1
* syrupUSDT through Maple International Operations SPC acting on behalf of and for the account of Maple USDT Segregated Portfolio 1 
* syrupUSDG through Maple International Operations SPC acting on behalf of and for the account of Maple USDG Segregated Portfolio 1
This provides provides full legal separation between the products and from Maple's institutional pools. Refer to the Legal section for further details on each product's structure.\
\
More details on the differences between Maple, syrupUSDC, syrupUSDT and syrupUSDG pools, and their benefits, can be found [here](https://maple.finance/news/yield-comparison-maple-syrup-ethena-and-aave).
#### Maple Underwriting and Credit
syrupUSDC, syrupUSDT and syrupUSDG users benefit from the strong track record and expertise of Maple's institutional credit operations - more on that[ here](https://maple.finance/news/yield-generation-underwriting-and-risk-management). Maple Direct (the lending arm of Maple Finance) is responsible for the underwriting, structuring and management of the loans that are originated in the Maple pools that Syrup access. All loans that provide yield to syrupUSDC, syrupUSDT and syrupUSDG will be to creditworthy crypto-native institutions that post liquid digital assets as collateral.
Moreover, Maple's smart contracts and technology infrastructure monitor all loans in real time to ensure adherence to collateralization levels, loan terms and financial disclosures and provide transparency for users to verify directly.
#### **Yield Strategies**
In addition to overcollat프로젝트로 돌아가기