Custom configuration API docs
The SDK can be configured in several ways to handle custom behaviour. When Connecting and disconnecting to the SDK it can be set to use a default configuration. Some of the configurable options include:
- Asset Metadata to add custom assets that the SDK can manage
- External Parsers to parse custom input strings
- Magic Routing Hints to set how the SDK handles direct Liquid payments
Magic Routing Hints
By default the SDK uses Magic Routing Hints (MRH) in order to bypass using swaps when both sender and receiver use Liquid. A side effect of this is when sending using the Magic Routing Hint, you don't receive the payment preimage from the receiver when the payment is complete. You can disable this behaviour and always use swaps in the config.
Rust
// Create the default config
let mut config = LiquidSdk::default_config(
LiquidNetwork::Mainnet,
Some("<your-Breez-API-key>".to_string()),
)?;
// Configure magic routing hints
config.use_magic_routing_hints = false;
Swift
// Create the default config
var config = try defaultConfig(
network: LiquidNetwork.mainnet, breezApiKey: "<your-Breez-API-key>")
// Configure magic routing hints
config.useMagicRoutingHints = false
Kotlin
// Create the default config
val config : Config = defaultConfig(LiquidNetwork.MAINNET, "<your Breez API key>")
// Configure magic routing hints
config.useMagicRoutingHints = false
Javascript
// Create the default config
const config = defaultConfig('mainnet', '<your-Breez-API-key>')
// Configure magic routing hints
config.useMagicRoutingHints = false
React Native
// Create the default config
const config = await defaultConfig(
LiquidNetwork.MAINNET,
'<your-Breez-API-key>'
)
// Configure magic routing hints
config.useMagicRoutingHints = false
Dart
// Create the default config
Config config = defaultConfig(network: LiquidNetwork.mainnet, breezApiKey: "<your-Breez-API-key>");
// Configure magic routing hints
config = config.copyWith(
useMagicRoutingHints: false,
);
Python
# Create the default config
config = default_config(
network=LiquidNetwork.MAINNET,
breez_api_key="<your-Breez-API-key>"
)
# Configure magic routing hints
config.use_magic_routing_hints = False
Go
// Create the default config
breezApiKey := "<your-Breez-API-key>"
config, err := breez_sdk_liquid.DefaultConfig(breez_sdk_liquid.LiquidNetworkMainnet, &breezApiKey)
if err != nil {
return err
}
// Configure magic routing hints
config.UseMagicRoutingHints = false
C#
// Create the default config
var config = BreezSdkLiquidMethods.DefaultConfig(
LiquidNetwork.Mainnet,
"<your-Breez-API-key>"
) with
{
// Configure magic routing hints
useMagicRoutingHints = false
};