@moneyos/swap
v0.2.1
Published
Swap tool for MoneyOS — token swaps with pluggable providers
Readme
@moneyos/swap
Canonical swap package for MoneyOS.
This package owns the public swap execution surface, swap provider contract,
the first provider implementation, OdosProvider, and the root CLI integration
contract for moneyos swap.
Release history lives in CHANGELOG.md.
Install
Root CLI path:
npm install -g moneyos
moneyos init
moneyos auth unlock
moneyos balance --allIf you want to swap from the CLI, fund the wallet first with the input token and enough gas for the target chain, then add the tool:
moneyos add swap
moneyos swap 0.1 RYZE ETHDirect package path:
npm install @moneyos/swap viemWhat it exports
executeSwapswapActioncreateSwapToolmoneyosCliToolSwapProviderSwapQuoteSwapResultSwapInputOdosProvider
Example
import { createMoneyOS } from "moneyos";
import { executeSwap, OdosProvider } from "@moneyos/swap";
const moneyos = createMoneyOS({
chainId: 42161,
privateKey: process.env.MONEYOS_PRIVATE_KEY as `0x${string}`,
});
const result = await executeSwap(
{
tokenIn: "USDC",
tokenOut: "RYZE",
amount: "1",
provider: new OdosProvider(),
chainId: 42161,
},
moneyos.runtime,
);
console.log(result.hash);Related packages
@moneyos/corefor the runtime contract packagemoneyosfor the default SDK and CLI
