Skip to content

Commit

Permalink
chore: rest of ts fixes and applies
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-chillios committed Feb 11, 2025
1 parent d1250e1 commit 4e7fe3f
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 46 deletions.
1 change: 0 additions & 1 deletion packages/swapkit/helpers/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export * from "./chains";
export * from "./commonTypes";
export * from "./derivationPath";
export * from "./network";
export * from "./tokens";
export * from "./wallet";
export * from "./sdk";
Expand Down
24 changes: 0 additions & 24 deletions packages/swapkit/helpers/src/types/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,4 @@
import type { CovalentApiType, EthplorerApiType } from "@swapkit/toolbox-evm";
import type { BlockchairApiType } from "@swapkit/toolbox-utxo";

import type { AssetValue } from "../modules/assetValue";
import type { Chain, CosmosChain, UTXOChain } from "./chains";

type CovalentChains =
| Chain.Base
| Chain.BinanceSmartChain
| Chain.Polygon
| Chain.Avalanche
| Chain.Arbitrum
| Chain.Optimism;

export type ChainApis = { [key in CovalentChains]?: CovalentApiType } & {
[key in Chain.Ethereum]?: EthplorerApiType;
} & {
[key in UTXOChain]?: BlockchairApiType;
} & {
[key in CosmosChain | Chain.Solana | Chain.Radix | Chain.Polkadot | Chain.Chainflip]?: string;
} & {
[key in Chain.Fiat]?: undefined;
};

export type ChainApi = EthplorerApiType | CovalentApiType | BlockchairApiType | string;

export type GenericSwapParams<T = unknown> = {
buyAsset?: AssetValue;
Expand Down
4 changes: 1 addition & 3 deletions packages/toolboxes/utxo/src/helpers/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,12 @@ export function getUtxoApi(chain: UTXOChain) {

if (customUtxoApi) {
warnOnce(true, "Using custom UTXO API. Be sure to implement all methods to avoid issues.");
return customUtxoApi as UTXOApiType;
return customUtxoApi as ReturnType<typeof utxoApi>;
}

return utxoApi(chain);
}

export type UTXOApiType = ReturnType<typeof utxoApi>;

interface BlockchairMultipleBalancesResponse {
[key: string]: number;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/toolboxes/utxo/src/helpers/coinselect.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Chain, type UTXOChain } from "@swapkit/helpers";

import type { TargetOutput, UTXOCalculateTxSizeParams, UTXOType } from "../types/index";
import {
TX_OVERHEAD,
UTXOScriptType,
calculateTxSize,
getInputSize,
getOutputSize,
getScriptTypeForAddress,
} from "../utils/index";
} from "../helpers";
import type { TargetOutput, UTXOCalculateTxSizeParams, UTXOType } from "../types";

export const getDustThreshold = (chain: UTXOChain) => {
switch (chain) {
Expand Down
2 changes: 1 addition & 1 deletion packages/toolboxes/utxo/src/helpers/txSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
UTXOCalculateTxSizeParams,
UTXOInputWithScriptType,
UTXOType,
} from "../types/index";
} from "../types";

/**
* Minimum transaction fee
Expand Down
2 changes: 1 addition & 1 deletion packages/toolboxes/utxo/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export { type Network, networks, Psbt, Transaction } from "bitcoinjs-lib";
export * from "./toolbox/index";
export * from "./toolbox/utxo";
export * from "./helpers/index";
export * from "./types/index";
export * from "./types";
7 changes: 1 addition & 6 deletions packages/toolboxes/utxo/src/toolbox/utxo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ import {
getUtxoApi,
standardFeeRates,
} from "../helpers";
import type {
TargetOutput,
UTXOBuildTxParams,
UTXOType,
UTXOWalletTransferParams,
} from "../types/common";
import type { TargetOutput, UTXOBuildTxParams, UTXOType, UTXOWalletTransferParams } from "../types";
import { validateAddress as validateBCHAddress } from "./bitcoinCash";
import type { BCHToolbox, BTCToolbox, DASHToolbox, DOGEToolbox, LTCToolbox } from "./index";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { AssetValue, FeeOption, UTXOChain, Witness } from "@swapkit/helpers";

import type { UTXOScriptType } from "../helpers";
import type { BCHToolbox, BTCToolbox, DOGEToolbox, LTCToolbox } from "../index";
import type { UTXOScriptType } from "./helpers";
import type { BCHToolbox, BTCToolbox, DOGEToolbox, LTCToolbox } from "./index";

export type TransactionType = {
toHex(): string;
Expand Down
2 changes: 0 additions & 2 deletions packages/toolboxes/utxo/src/types/index.ts

This file was deleted.

3 changes: 1 addition & 2 deletions packages/wallets/keepkey/src/chains/utxo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,10 @@ export const utxoWalletMethods = async ({
const { psbt, inputs: rawInputs } = await toolbox.buildTx({
...rest,
memo,
feeOptionKey,
recipient,
feeRate: feeRate || (await toolbox.getFeeRates())[feeOptionKey || FeeOption.Fast],
sender: from,
fetchTxHex: chain,
fetchTxHex: chain === Chain.BitcoinCash,
});

const inputs = rawInputs.map(({ value, index, hash, txHex }) => ({
Expand Down
3 changes: 1 addition & 2 deletions packages/wallets/ledger/src/ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
StagenetChain,
WalletOption,
filterSupportedChains,
getRPCUrl,
} from "@swapkit/helpers";
import type { DepositParam, TransferParams } from "@swapkit/toolbox-cosmos";
import type { UTXOBuildTxParams } from "@swapkit/toolbox-utxo";
Expand Down Expand Up @@ -127,7 +126,7 @@ const getWalletMethods = async ({
};

const signingClient = await createSigningStargateClient(
getRPCUrl(Chain.Cosmos),
SKConfig.get("rpcUrls")[chain],
signer,
"0.007uatom",
);
Expand Down

0 comments on commit 4e7fe3f

Please sign in to comment.