Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:
run: pnpm run prisma:generate
- name: Run build
run: pnpm run build
- name: Check format & lint
run: pnpm run check-format
- name: Run test
run: pnpm run test
env:
BLOCKFROST_PROJECT_ID_MAINNET: ${{ secrets.BLOCKFROST_PROJECT_ID_MAINNET }}
BLOCKFROST_PROJECT_ID_TESTNET: ${{ secrets.BLOCKFROST_PROJECT_ID_TESTNET }}
MAESTRO_API_KEY_MAINNET: ${{ secrets.MAESTRO_API_KEY_MAINNET }}
MAESTRO_API_KEY_TESTNET: ${{ secrets.MAESTRO_API_KEY_TESTNET }}
- name: Check format & lint
run: pnpm run check-format
18 changes: 9 additions & 9 deletions examples/build-tx-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export async function _createPoolV2(
export async function _swapExactInV2TxExample(
lucid: Lucid,
adapter: Adapter,
address: string,
address: string
): Promise<TxComplete> {
const assetA = ADA;
const assetB = MIN;
Expand Down Expand Up @@ -385,7 +385,7 @@ export async function _swapExactInV2TxExample(
export async function _swapExactOutV2TxExample(
lucid: Lucid,
adapter: Adapter,
address: string,
address: string
): Promise<TxComplete> {
const assetA = ADA;
const assetB = MIN;
Expand Down Expand Up @@ -427,7 +427,7 @@ export async function _swapExactOutV2TxExample(
export async function _depositV2TxExample(
lucid: Lucid,
adapter: Adapter,
address: string,
address: string
): Promise<TxComplete> {
const assetA = ADA;
const assetB = MIN;
Expand Down Expand Up @@ -470,7 +470,7 @@ export async function _depositV2TxExample(
export async function _withdrawV2TxExample(
lucid: Lucid,
adapter: Adapter,
address: string,
address: string
): Promise<TxComplete> {
// ADA-MIN Lp Asset
const lpAsset = {
Expand Down Expand Up @@ -519,7 +519,7 @@ export async function _withdrawV2TxExample(
export async function _stopV2TxExample(
lucid: Lucid,
adapter: Adapter,
address: string,
address: string
): Promise<TxComplete> {
const assetA = ADA;
const assetB = MIN;
Expand Down Expand Up @@ -559,7 +559,7 @@ export async function _stopV2TxExample(
export async function _ocoV2TxExample(
lucid: Lucid,
adapter: Adapter,
address: string,
address: string
): Promise<TxComplete> {
const assetA = ADA;
const assetB = MIN;
Expand Down Expand Up @@ -606,7 +606,7 @@ export async function _ocoV2TxExample(
export async function _zapOutV2TxExample(
lucid: Lucid,
adapter: Adapter,
address: string,
address: string
): Promise<TxComplete> {
// ADA-MIN Lp Asset
const lpAsset = {
Expand Down Expand Up @@ -647,7 +647,7 @@ export async function _zapOutV2TxExample(
export async function _partialSwapV2TxExample(
lucid: Lucid,
adapter: Adapter,
address: string,
address: string
): Promise<TxComplete> {
const assetA = ADA;
const assetB = MIN;
Expand Down Expand Up @@ -697,7 +697,7 @@ export async function _partialSwapV2TxExample(
export async function _multiRoutingTxExample(
lucid: Lucid,
adapter: Adapter,
address: string,
address: string
): Promise<TxComplete> {
const assetA = MIN;
const amountA = 10_000n;
Expand Down
24 changes: 6 additions & 18 deletions src/dex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class Dex {
invariant(amountIn > 0n, "amount in must be positive");
invariant(minimumAmountOut > 0n, "minimum amount out must be positive");
const orderAssets: Assets = { [Asset.toString(assetIn)]: amountIn };
const batcherFee = BATCHER_FEE_DEX_V1[OrderV1.StepType.SWAP_EXACT_IN]
const batcherFee = BATCHER_FEE_DEX_V1[OrderV1.StepType.SWAP_EXACT_IN];
if (orderAssets["lovelace"]) {
orderAssets["lovelace"] += FIXED_DEPOSIT_ADA + batcherFee;
} else {
Expand Down Expand Up @@ -212,7 +212,7 @@ export class Dex {
"amount in and out must be positive"
);
const orderAssets: Assets = { [Asset.toString(assetIn)]: maximumAmountIn };
const batcherFee = BATCHER_FEE_DEX_V1[OrderV1.StepType.SWAP_EXACT_OUT]
const batcherFee = BATCHER_FEE_DEX_V1[OrderV1.StepType.SWAP_EXACT_OUT];
if (orderAssets["lovelace"]) {
orderAssets["lovelace"] += FIXED_DEPOSIT_ADA + batcherFee;
} else {
Expand Down Expand Up @@ -273,7 +273,7 @@ export class Dex {
"minimum asset received must be positive"
);
const orderAssets: Assets = { [Asset.toString(lpAsset)]: lpAmount };
const batcherFee = BATCHER_FEE_DEX_V1[OrderV1.StepType.WITHDRAW]
const batcherFee = BATCHER_FEE_DEX_V1[OrderV1.StepType.WITHDRAW];
if (orderAssets["lovelace"]) {
orderAssets["lovelace"] += FIXED_DEPOSIT_ADA + batcherFee;
} else {
Expand Down Expand Up @@ -304,13 +304,7 @@ export class Dex {
}

async buildZapInTx(options: BuildZapInTxOptions): Promise<TxComplete> {
const {
sender,
assetIn,
amountIn,
assetOut,
minimumLPReceived,
} = options;
const { sender, assetIn, amountIn, assetOut, minimumLPReceived } = options;
invariant(amountIn > 0n, "amount in must be positive");
invariant(minimumLPReceived > 0n, "minimum LP received must be positive");
const orderAssets: Assets = { [Asset.toString(assetIn)]: amountIn };
Expand Down Expand Up @@ -346,14 +340,8 @@ export class Dex {
}

async buildDepositTx(options: BuildDepositTxOptions): Promise<TxComplete> {
const {
sender,
assetA,
assetB,
amountA,
amountB,
minimumLPReceived,
} = options;
const { sender, assetA, assetB, amountA, amountB, minimumLPReceived } =
options;
invariant(amountA > 0n && amountB > 0n, "amount must be positive");
invariant(minimumLPReceived > 0n, "minimum LP received must be positive");
const orderAssets = {
Expand Down
5 changes: 4 additions & 1 deletion src/stableswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import {
StableswapConstant,
V1AndStableswapCustomReceiver,
} from ".";
import { BATCHER_FEE_STABLESWAP, DexVersion } from "./batcher-fee/configs.internal";
import {
BATCHER_FEE_STABLESWAP,
DexVersion,
} from "./batcher-fee/configs.internal";
import { Asset } from "./types/asset";
import { NetworkEnvironment, NetworkId } from "./types/network";
import { lucidToNetworkEnv } from "./utils/network.internal";
Expand Down
Loading
Loading