RPC Drop-In
Details
Provided as a migration solution, BaaS provides an RPC endpoint which is compatible with the native broker.
This allows integrators to simply re-use existing code written against the native broker with BaaS, just by changing the broker address.
This call overwrites the broker commission with your configured settings if the passed in commission is lower, to avoid users from tampering.
API Endpoint
/rpc/{apiKey}- Make abroker_request_swap_deposit_addressRPC call.
Chainflip SDK Testnet Example
When using the Chainflip SDK you can provide a custom broker url to use your BaaS account:
import { SwapSDK } from '@chainflip/sdk/swap';
const options = {
network: 'perseverance', // Testnet
broker: {
url: 'https://perseverance.chainflip-broker.io/rpc/93c2bff017e243f29ffb14e42dccbec8',
},
};
const swapSDK = new SwapSDK(options);
Swapkit Testnet Example
When using the Swapkit SDK you can provide a custom broker url to use your BaaS account:
import { createSwapKit } from "@swapkit/sdk";
const skClient = createSwapKit({
config: {
ethplorerApiKey: "freekey",
chainflipBrokerConfig: {
useChainflipSDKBroker: true,
chainflipBrokerUrl: "https://perseverance.chainflip-broker.io/rpc/93c2bff017e243f29ffb14e42dccbec8",
}
},
});
// Request quotes, connect wallets, ...
await skClient.swap(...);