RubicBridge SDK class, located at /src/tests/bridge/rubic.test.ts.
The test file exercises three flows: getTrade, executeTrade with mock data, and executeTrade with real funds.
Before running the tests, start the node repository so the bridge RPC is reachable.
The first two tests (getTrade and the mock executeTrade) work without any wallet setup — the default test mnemonic is fine.
To run executeTrade with real funds:
- Remove the
skipoperator from the test (set it toonlyif you want to run it in isolation). - Replace the test mnemonic in
rubic.test.tswith a wallet that holds funds on the source chain.
getTrade
Fetches the best cross-chain trade option for the supplied payload. Returns the best trade or an error if no valid route is found.
executeTrade
Submits the trade. Manages allowance, approval, the swap call, and confirmation. Returns the transaction receipt.
Payload shape
fromToken / toToken accept "NATIVE" | "USDC" | "USDT". See the crosschain swap recipe for the production-flow example.