Skip to content

Conversation

PaulKorepanow
Copy link
Collaborator

No description provided.

@PaulKorepanow PaulKorepanow marked this pull request as ready for review September 17, 2025 17:19
Copy link
Contributor

@opcode0x opcode0x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the unit tests for the functions that build transactions create random values etc.

Add dist to gitignore.
Optimize tsconfig for node, there is dom used even though it's running in node env.

Separate functions in different files.

*/
export const getWalletBalance = async (wallet: WalletInfo): Promise<number> => {
const utxos = await getUTXOs(wallet.config, wallet.address);
export const getWalletBTCBalance = async (config: any, address: string): Promise<number> => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (newRunesData && newRunesData.results && newRunesData.results.length > 0) {
console.log("New rune ID:", newRunesData.results[0].rune.id);
return newRunesData.results[0].rune.id;
const newRunesData = await getRune(wallet.config, runeId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can query rune by it's NAME as it's unique, no need to query by block:txid

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getRune throws error if rune wasn't found. No need to do double try/catch

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name can be spaced or without "spaces" for the getRune request

block_time?: number;
}

export async function getRuneId(txId: string): Promise<string> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can drop this function

export const transferBitcoinForSwap = async (receiverAddress: string, bitcoinAmount: number, wallet: WalletInfo) => {
return await transferBTC(wallet.config, {
transfers: [
interface TxStatusResponse {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for this type

})
];
const res = await executeBTCTransactionWithIntentions(wallet, intentions)
const btcResultTxHash = await txIsUsed(res.btcTxId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point of the btcResultTxHash?

wallet,
);

const addLiquidityTxHash = await addLiquidity(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not a hash, isn't it?

runeId: string
}): Promise<string> {
const tokensBeforeSwap = await getERC20Balance(swapBTCOptions.tokenAddress, wallet.evmAddress)
const predictedTokens = await calculateTokensOut([WETH, swapBTCOptions.tokenAddress as `0x${string}`], satoshisToWei(swapBTCOptions.btcAmount))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an estimate of min token amount result after swap.

mnemonics: mnemonics,
};

fs.writeFileSync(MNEMONIC_FILE, JSON.stringify(data, null, 2));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need spacings?


const address = ordinalsAccount.address;
const publicKey = ordinalsAccount.publicKey;
const evmAddress = getEVMAddress(accounts[0], bitcoinNetwork);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not ordinalsAccount in here?

@@ -0,0 +1,17 @@
MNEMOMIC="female novel spatial beef vault summer ticket rug gain prize east chase"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont' expose mnemonics please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants