curl --request GET \
--url https://api.example.com/api/:projectId/types{
"projectId": "<string>",
"programName": "<string>",
"types": [
{
"name": "<string>",
"kind": "<string>",
"fields": [
{
"name": "<string>",
"type": "<string>"
}
]
}
],
"Type Resolution Examples": {}
}List all custom type definitions from a program IDL
curl --request GET \
--url https://api.example.com/api/:projectId/types{
"projectId": "<string>",
"programName": "<string>",
"types": [
{
"name": "<string>",
"kind": "<string>",
"fields": [
{
"name": "<string>",
"type": "<string>"
}
]
}
],
"Type Resolution Examples": {}
}Documentation Index
Fetch the complete documentation index at: https://mintlify.com/berkayoztunc/orquestra/llms.txt
Use this file to discover all available pages before exploring further.
GET /api/:projectId/types
curl -X GET "https://api.orquestra.so/api/proj_abc123/types"
{
"projectId": "proj_abc123",
"programName": "token_swap",
"types": [
{
"name": "PoolConfig",
"kind": "struct",
"fields": [
{
"name": "minLiquidity",
"type": "u64"
},
{
"name": "maxSlippage",
"type": "u16"
},
{
"name": "enableOracle",
"type": "bool"
},
{
"name": "oracleAddress",
"type": "option<publicKey>"
}
]
},
{
"name": "SwapDirection",
"kind": "enum",
"fields": [
{
"name": "AToB",
"type": "unit"
},
{
"name": "BToA",
"type": "unit"
}
]
},
{
"name": "PriceOracle",
"kind": "struct",
"fields": [
{
"name": "address",
"type": "publicKey"
},
{
"name": "lastPrice",
"type": "u64"
},
{
"name": "lastUpdated",
"type": "i64"
},
{
"name": "confidence",
"type": "u64"
}
]
},
{
"name": "LiquidityOperation",
"kind": "enum",
"fields": [
{
"name": "Deposit",
"type": "{ amountA: u64, amountB: u64 }"
},
{
"name": "Withdraw",
"type": "{ liquidity: u64 }"
}
]
},
{
"name": "FeeStructure",
"kind": "struct",
"fields": [
{
"name": "tradeFee",
"type": "u16"
},
{
"name": "protocolFee",
"type": "u16"
},
{
"name": "lpFee",
"type": "u16"
}
]
},
{
"name": "TradeHistory",
"kind": "struct",
"fields": [
{
"name": "user",
"type": "publicKey"
},
{
"name": "timestamp",
"type": "i64"
},
{
"name": "direction",
"type": "SwapDirection"
},
{
"name": "amountIn",
"type": "u64"
},
{
"name": "amountOut",
"type": "u64"
}
]
}
]
}
#[derive(AnchorSerialize, AnchorDeserialize, Clone)]
pub struct PoolConfig {
pub min_liquidity: u64,
pub max_slippage: u16,
pub enable_oracle: bool,
pub oracle_address: Option<Pubkey>,
}
#[derive(AnchorSerialize, AnchorDeserialize, Clone)]
pub enum SwapDirection {
AToB,
BToA,
}
#[derive(AnchorSerialize, AnchorDeserialize, Clone)]
pub enum LiquidityOperation {
Deposit { amount_a: u64, amount_b: u64 },
Withdraw { liquidity: u64 },
}
| IDL Type | Resolved String |
|---|---|
{ "defined": "PoolConfig" } | PoolConfig |
{ "option": "publicKey" } | option<publicKey> |
{ "vec": "u8" } | vec<u8> |
{ "array": ["u8", 32] } | [u8; 32] |
"publicKey" | publicKey |
"u64" | u64 |
"string" | string |
const config = {
minLiquidity: 1000000n,
maxSlippage: 100,
enableOracle: false,
oracleAddress: null
};
const feeStructure = {
tradeFee: 30, // 0.3%
protocolFee: 5, // 0.05%
lpFee: 25 // 0.25%
};
await program.methods
.initializePool(config, feeStructure)
.accounts({
pool: poolPda,
authority: wallet.publicKey,
// ...
})
.rpc();
{
"name": "PoolState",
"kind": "struct",
"fields": [
{
"name": "config",
"type": "PoolConfig"
},
{
"name": "fees",
"type": "FeeStructure"
},
{
"name": "oracle",
"type": "option<PriceOracle>"
},
{
"name": "recentTrades",
"type": "vec<TradeHistory>"
}
]
}
404 Not Found
{
"error": "Project not found or not public"
}
500 Internal Server Error
{
"error": "Failed to get types"
}
PoolConfig contains a FeeStructure), you’ll see the type name, and you can look up the referenced type in the same response.