What's New in v2.3.2
Version 2.3.2 of the Symphony SDK introduces powerful new ways to manage token lists and configure transaction fees, giving you greater flexibility and control.
🎉 Using v2.3.2, now you can get routes for any token pair that has sufficient liquidity! 🎉
Enhanced Token Management
We've added two new configuration options to give you more control over the tokens used by the Symphony SDK.
Custom Token Additions (additionalTokens
)
You can now seamlessly extend the default token list by providing your own custom tokens during SDK initialization. This is perfect for including tokens that are not yet in the default list, for project-specific tokens and imported tokens.
Example:const symphony = new Symphony({
options: {
// ... other options
additionalTokens: {
"0x1234567890abcdef1234567890abcdef12345678": {
id: "sei_0x1234567890abcdef1234567890abcdef12345678",
attributes: {
address: "0x1234567890abcdef1234567890abcdef12345678",
name: "Custom Token 1",
symbol: "CTK1",
decimals: 18,
logoUrl: "https://example.com/ctk1.png",
},
},
},
},
});
You can use setConfig()
to add or remove tokens in session.
import { Symphony as SymphonySDK } from "symphony-sdk/viem";
//Initialize Symphony with additional custom tokens
const Symphony = new SymphonySDK({
options: {
rpcUrl: "https://rpc.symphony.ag",
timeout: 60000,
additionalTokens: customTokens,
},
});
// Update Symphony config to add more tokens in session
Symphony.setConfig({
additionalTokens: {
[token.attributes.address]: token,
},
});
For more details and the full structure of token data, see the Configuration documentation.
Override Default Token List (overrideDefaultTokens
)
For complete control, you can now choose to entirely replace the default token list with your own set of tokens. When overrideDefaultTokens
is set to true
, only the tokens you provide in additionalTokens
will be used.
const symphony = new Symphony({
options: {
// ... other options
overrideDefaultTokens: true,
additionalTokens: {
"0xabcdef1234567890abcdef1234567890abcdef12": {
id: "sei_0xabcdef1234567890abcdef1234567890abcdef12",
attributes: {
address: "0xabcdef1234567890abcdef1234567890abcdef12",
name: "My Token A",
symbol: "MTA",
decimals: 18,
logoUrl: "https://example.com/mta.png",
},
},
},
},
});
Learn more about this feature in the Configuration documentation.
Fine-Grained Fee Control (feeParams
)
The feeParams
configuration option allows you to specify custom parameters for transaction fees, including the fee recipient address, the fee percentage, and how fees are shared. You don't have to change anything in your code if you don't want to use this funcionality.
feeAddress
: The address to receive the fees.paramFee
: The fee percentage (in basis points, e.g., 100 for 1%).feeSharePercentage
: The percentage of the fee to be shared.
This provides advanced control over fee structures for transactions processed through the SDK.
For a comprehensive guide on using feeParams
, refer to the Configuration documentation.
We're excited for you to leverage these new capabilities! As always, refer to the main Configuration page for a complete overview of all SDK options.